@dxos/react-ui 0.1.31-next.ea8f0bc → 0.1.32-next.77d513e
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 +1047 -886
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts.map +1 -1
- package/dist/types/src/composites/DevicesDialog/DevicesDialog.d.ts.map +1 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/Shell.stories.d.ts.map +1 -1
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts.map +1 -1
- package/dist/types/src/panels/DevicesPanel/DevicesPanel.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts +2 -2
- 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 +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +64 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts +2 -5
- package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts +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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/ViewState.d.ts +4 -6
- package/dist/types/src/panels/JoinPanel/view-states/ViewState.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/index.d.ts +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/index.d.ts.map +1 -1
- package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +3 -1
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/toEmoji.d.ts +2 -0
- package/dist/types/src/util/toEmoji.d.ts.map +1 -0
- package/package.json +24 -20
- package/src/components/IdentityList/SpaceMemberListContainer.tsx +6 -2
- package/src/components/InvitationList/InvitationList.stories.tsx +1 -1
- package/src/components/InvitationList/InvitationListItem.tsx +1 -1
- package/src/composites/DevicesDialog/DevicesDialog.tsx +3 -2
- package/src/composites/JoinDialog/JoinDialog.stories.tsx +4 -2
- package/src/composites/JoinDialog/JoinDialog.tsx +4 -2
- package/src/composites/Shell/Shell.stories.tsx +34 -17
- package/src/composites/Shell/Shell.tsx +1 -1
- package/src/composites/SpaceDialog/SpaceDialog.tsx +3 -2
- package/src/panels/DevicesPanel/DevicesPanel.tsx +17 -5
- package/src/panels/IdentityPanel/IdentityPanel.tsx +17 -13
- package/src/panels/JoinPanel/JoinHeading.tsx +42 -40
- package/src/panels/JoinPanel/JoinPanel.tsx +143 -220
- package/src/panels/JoinPanel/JoinPanelProps.ts +1 -1
- package/src/panels/JoinPanel/joinMachine.ts +418 -0
- package/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx +9 -21
- package/src/panels/JoinPanel/view-states/IdentityAdded.tsx +7 -7
- package/src/panels/JoinPanel/view-states/IdentityInput.tsx +5 -5
- package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +23 -19
- package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +39 -29
- package/src/panels/JoinPanel/view-states/InvitationInput.tsx +22 -22
- package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +59 -42
- package/src/panels/JoinPanel/view-states/ViewState.tsx +12 -63
- package/src/panels/JoinPanel/view-states/index.ts +0 -1
- package/src/panels/SpacePanel/SpacePanel.tsx +1 -1
- package/src/playwright/invitations-manager.ts +6 -2
- package/src/playwright/invitations.spec.ts +14 -5
- package/src/stories/Invitations.stories.tsx +3 -3
- package/src/translations/locales/en-US.ts +6 -4
- package/src/util/index.ts +1 -0
- package/src/util/toEmoji.ts +22 -0
- package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts +0 -7
- package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts.map +0 -1
- package/src/panels/JoinPanel/view-states/IdentitySelector.tsx +0 -100
|
@@ -8,7 +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': '
|
|
11
|
+
'joining space heading': 'Joining space',
|
|
12
12
|
'join space heading': 'Join a space',
|
|
13
13
|
'halo heading': 'Initialize device identity',
|
|
14
14
|
'exit label': 'Exit',
|
|
@@ -27,7 +27,7 @@ export const os = {
|
|
|
27
27
|
'join identity label': 'Use an authed device',
|
|
28
28
|
'join identity description': 'Add this device to an identity you’re already logged into on another device.',
|
|
29
29
|
'deselect identity label': 'Back to identities',
|
|
30
|
-
'addition method selector title': '
|
|
30
|
+
'addition method selector title': 'An identity is required to continue',
|
|
31
31
|
'new identity input label': 'Add a display name',
|
|
32
32
|
'recover identity input label': 'Type or paste your seed phrase',
|
|
33
33
|
'failed to create identity message': 'Failed to create an identity.',
|
|
@@ -48,7 +48,7 @@ export const os = {
|
|
|
48
48
|
'cancel label': 'Cancel',
|
|
49
49
|
'done label': 'Done',
|
|
50
50
|
'reset label': 'Start over',
|
|
51
|
-
'auth code input label': '
|
|
51
|
+
'auth code input label': 'Enter the verification code',
|
|
52
52
|
'invitation input label': 'Paste an invitation code or URL',
|
|
53
53
|
'create device invitation label': 'Invite',
|
|
54
54
|
'create space invitation label': 'Invite',
|
|
@@ -62,5 +62,7 @@ export const os = {
|
|
|
62
62
|
'view space invitations label': 'View space invitations',
|
|
63
63
|
'toggle sidebar label': 'Open/close sidebar',
|
|
64
64
|
'open sidebar label': 'Open sidebar',
|
|
65
|
-
'close sidebar label': 'Close sidebar'
|
|
65
|
+
'close sidebar label': 'Close sidebar',
|
|
66
|
+
'welcome message': 'Welcome',
|
|
67
|
+
'selecting identity heading': 'Selecting identity'
|
|
66
68
|
};
|
package/src/util/index.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import toArray from 'lodash.toarray';
|
|
6
|
+
|
|
7
|
+
const emoji = toArray(
|
|
8
|
+
// When changing this set, please check the result in a console or e.g. RunKit (https://runkit.com/thure/642214441dd6ae000855a8de)
|
|
9
|
+
// Emoji sometimes use a combination of code points, and some code points aren't visible on their own, so by adding or deleting you may unintentionally create non-visible items.
|
|
10
|
+
// This set was chosen from the characters in Unicode Emoji v15.0 based on the following criteria:
|
|
11
|
+
// – not people or isolated anthropomorphic faces
|
|
12
|
+
// – not flags
|
|
13
|
+
// – more concrete than abstract
|
|
14
|
+
// – less culturally specific
|
|
15
|
+
// – less easily confused with another emoji in the set
|
|
16
|
+
// – requires less special knowledge to identify
|
|
17
|
+
// – less likely to evoke negative feelings (no meat, no drugs, no weapons, etc)
|
|
18
|
+
// – less common as a signifier in UX
|
|
19
|
+
'👹👻👽🤖🎃🦾🦿🦷👣👁️🧶👑🐒🦆🦉🐴🦄🐝🦋🐞🪲🐢🦎🦕🦑🦀🐠🐬🐋🦭🐅🐆🦓🦍🦧🐘🐫🦒🦘🦬🐖🐏🦌🐕🐈🐓🦚🦜🦢🦩🦦🐁🐿️🌵🌲🌳🪵🌱🍁🪺🍄🐚🪸🪨🌾🌷🌻☀️🌙🪐⭐️⚡️☄️🔥🌈☁️💧⛱️🌊🍎🍋🍉🍇🫐🍈🍒🍑🥭🍍🥥🥝🥑🌶️🌽🥕🍬🥜🫖☕️🍵🧊🧂🏔️⚓️🛟🏝️🛶🚀🛰️⛲️🏰🚲⛺️🎙️🧲⚙️🔩🔮🔭🔬🧬🌡️🧺🛎️🔑🪑🧸🎈🎀🎊♻️🎵'
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export const toEmoji = (keyAsHex: string) => emoji[parseInt(keyAsHex, 16) % emoji.length];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Identity } from '@dxos/client';
|
|
2
|
-
import { ViewStateProps } from './ViewState';
|
|
3
|
-
export interface IdentitySelectorProps extends ViewStateProps {
|
|
4
|
-
availableIdentities: Identity[];
|
|
5
|
-
}
|
|
6
|
-
export declare const IdentitySelector: ({ availableIdentities, ...viewStateProps }: IdentitySelectorProps) => JSX.Element;
|
|
7
|
-
//# sourceMappingURL=IdentitySelector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IdentitySelector.d.ts","sourceRoot":"","sources":["../../../../../../src/panels/JoinPanel/view-states/IdentitySelector.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAA+B,cAAc,EAAE,MAAM,aAAa,CAAC;AAE1E,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,mBAAmB,EAAE,QAAQ,EAAE,CAAC;CACjC;AAED,eAAO,MAAM,gBAAgB,+CAAgD,qBAAqB,gBAkFjG,CAAC"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as RadioGroup from '@radix-ui/react-radio-group';
|
|
6
|
-
import { CaretLeft, CaretRight, UserPlus } from 'phosphor-react';
|
|
7
|
-
import React, { useCallback, useState } from 'react';
|
|
8
|
-
|
|
9
|
-
import type { Identity } from '@dxos/client';
|
|
10
|
-
import { Avatar, Button, themeVariantFocus, getSize, mx, useTranslation } from '@dxos/react-components';
|
|
11
|
-
|
|
12
|
-
import { ViewState, ViewStateHeading, ViewStateProps } from './ViewState';
|
|
13
|
-
|
|
14
|
-
export interface IdentitySelectorProps extends ViewStateProps {
|
|
15
|
-
availableIdentities: Identity[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const IdentitySelector = ({ availableIdentities, ...viewStateProps }: IdentitySelectorProps) => {
|
|
19
|
-
const { dispatch } = viewStateProps;
|
|
20
|
-
const disabled = !viewStateProps.active;
|
|
21
|
-
|
|
22
|
-
const { t } = useTranslation('os');
|
|
23
|
-
const [activeIdentity, setActiveIdentity] = useState(availableIdentities[0]);
|
|
24
|
-
const onValueChange = useCallback(
|
|
25
|
-
(nextHex: string) =>
|
|
26
|
-
setActiveIdentity(
|
|
27
|
-
availableIdentities.find((identity) => identity.identityKey.toHex() === nextHex) || activeIdentity
|
|
28
|
-
),
|
|
29
|
-
[availableIdentities]
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<ViewState {...viewStateProps}>
|
|
34
|
-
<ViewStateHeading>{t('identity selector title')}</ViewStateHeading>
|
|
35
|
-
<RadioGroup.Root
|
|
36
|
-
disabled={disabled}
|
|
37
|
-
value={activeIdentity?.identityKey.toHex()}
|
|
38
|
-
onValueChange={onValueChange}
|
|
39
|
-
className='overflow-y-auto grow shrink min-bs-10 pli-1 -mli-1'
|
|
40
|
-
aria-label={t('identity radio group title')}
|
|
41
|
-
data-autofocus='identity selector'
|
|
42
|
-
>
|
|
43
|
-
{availableIdentities.map(({ profile, identityKey }) => {
|
|
44
|
-
const hex = identityKey.toHex();
|
|
45
|
-
const inputId = `identitySelector__item--${hex}`;
|
|
46
|
-
const labelId = `identitySelector__itemLabel--${hex}`;
|
|
47
|
-
return (
|
|
48
|
-
<label htmlFor={inputId} key={hex} className='flex items-center mbe-2 gap-2 cursor-pointer'>
|
|
49
|
-
<RadioGroup.Item
|
|
50
|
-
id={inputId}
|
|
51
|
-
aria-labelledby={labelId}
|
|
52
|
-
value={hex}
|
|
53
|
-
className={mx(
|
|
54
|
-
'peer relative w-4 h-4 rounded-full',
|
|
55
|
-
'border border-transparent text-white',
|
|
56
|
-
'radix-state-checked:bg-primary-600',
|
|
57
|
-
'radix-state-unchecked:bg-neutral-100 dark:radix-state-unchecked:bg-neutral-900',
|
|
58
|
-
themeVariantFocus('os')
|
|
59
|
-
)}
|
|
60
|
-
data-testid='identity-selector-item'
|
|
61
|
-
>
|
|
62
|
-
<RadioGroup.Indicator className='absolute inset-0 flex items-center justify-center leading-0'>
|
|
63
|
-
<div className='w-1.5 h-1.5 rounded-full bg-white' />
|
|
64
|
-
</RadioGroup.Indicator>
|
|
65
|
-
</RadioGroup.Item>
|
|
66
|
-
<Avatar fallbackValue={hex} labelId={labelId} variant='circle' />
|
|
67
|
-
<span id={labelId} className={mx(!profile?.displayName && 'font-mono')}>
|
|
68
|
-
{profile?.displayName ?? identityKey.truncate() ?? ''}
|
|
69
|
-
</span>
|
|
70
|
-
</label>
|
|
71
|
-
);
|
|
72
|
-
})}
|
|
73
|
-
</RadioGroup.Root>
|
|
74
|
-
<Button
|
|
75
|
-
disabled={disabled}
|
|
76
|
-
onClick={() => dispatch({ type: 'add identity' })}
|
|
77
|
-
className='flex items-center gap-2 pli-2'
|
|
78
|
-
data-testid='add-identity'
|
|
79
|
-
>
|
|
80
|
-
<span>{t('add identity label')}</span>
|
|
81
|
-
<UserPlus weight='bold' className={getSize(3.5)} />
|
|
82
|
-
</Button>
|
|
83
|
-
<Button
|
|
84
|
-
disabled={disabled || !activeIdentity}
|
|
85
|
-
className='flex items-center gap-2 pli-2'
|
|
86
|
-
onClick={() =>
|
|
87
|
-
dispatch({
|
|
88
|
-
type: 'select identity',
|
|
89
|
-
identity: activeIdentity
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
data-testid='select-identity'
|
|
93
|
-
>
|
|
94
|
-
<CaretLeft weight='bold' className={mx(getSize(4), 'invisible')} />
|
|
95
|
-
<span className='grow'>{t('continue label')}</span>
|
|
96
|
-
<CaretRight weight='bold' className={getSize(4)} />
|
|
97
|
-
</Button>
|
|
98
|
-
</ViewState>
|
|
99
|
-
);
|
|
100
|
-
};
|