@dxos/react-ui 0.1.31 → 0.1.32-next.86f5578
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 +1018 -870
- 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/JoinDialog/JoinDialog.stories.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 +18 -14
- package/src/components/IdentityList/SpaceMemberListContainer.tsx +6 -2
- package/src/components/InvitationList/InvitationList.stories.tsx +1 -1
- package/src/composites/JoinDialog/JoinDialog.stories.tsx +4 -2
- package/src/composites/Shell/Shell.stories.tsx +1 -1
- package/src/composites/Shell/Shell.tsx +1 -1
- package/src/panels/JoinPanel/JoinHeading.tsx +42 -40
- package/src/panels/JoinPanel/JoinPanel.tsx +140 -218
- 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 +6 -6
- package/src/panels/JoinPanel/view-states/IdentityInput.tsx +4 -4
- package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +22 -18
- package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +37 -28
- package/src/panels/JoinPanel/view-states/InvitationInput.tsx +21 -21
- package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +58 -41
- package/src/panels/JoinPanel/view-states/ViewState.tsx +11 -62
- package/src/panels/JoinPanel/view-states/index.ts +0 -1
- package/src/playwright/invitations-manager.ts +6 -2
- package/src/playwright/invitations.spec.ts +14 -5
- package/src/stories/Invitations.stories.tsx +2 -2
- 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
|
@@ -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 { CaretLeft, CaretRight, UserPlus } from '@phosphor-icons/react';
|
|
6
|
-
import * as RadioGroup from '@radix-ui/react-radio-group';
|
|
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
|
-
};
|