@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
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { StoryContext, StoryFn } from '@storybook/react';
|
|
6
|
-
import React, { useEffect, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
import { Client, Space } from '@dxos/client';
|
|
9
|
-
import { TestBuilder } from '@dxos/client/testing';
|
|
10
|
-
import { ClientContext } from '@dxos/react-client';
|
|
11
|
-
import { Loading } from '@dxos/react-components';
|
|
12
|
-
|
|
13
|
-
import { SpacePanel } from './SpacePanel';
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
component: SpacePanel
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const SpaceDecorator = (Story: StoryFn, { args }: StoryContext) => {
|
|
20
|
-
const testBuilder = new TestBuilder();
|
|
21
|
-
const [client, setClient] = useState<Client>();
|
|
22
|
-
const [space, setSpace] = useState<Space>();
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const timeout = setTimeout(async () => {
|
|
26
|
-
const client = new Client({ services: testBuilder.createClientServicesHost() });
|
|
27
|
-
await client.initialize();
|
|
28
|
-
setClient(client);
|
|
29
|
-
|
|
30
|
-
await client.halo.createProfile();
|
|
31
|
-
const space = await client.echo.createSpace();
|
|
32
|
-
space.properties.name = 'Q3 2022 Planning';
|
|
33
|
-
|
|
34
|
-
setSpace(space);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
return () => clearTimeout(timeout);
|
|
38
|
-
}, []);
|
|
39
|
-
|
|
40
|
-
if (!client || !space) {
|
|
41
|
-
return <Loading label='Setting things up…' />;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<ClientContext.Provider value={{ client }}>
|
|
46
|
-
<Story args={{ space, ...args }} />
|
|
47
|
-
</ClientContext.Provider>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const Default = {
|
|
52
|
-
decorators: [SpaceDecorator]
|
|
53
|
-
};
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { CaretLeft, CaretRight, Intersect, PlusCircle, UserPlus } from 'phosphor-react';
|
|
6
|
-
import React, { cloneElement, useReducer } from 'react';
|
|
7
|
-
|
|
8
|
-
import { Space, SpaceMember } from '@dxos/client';
|
|
9
|
-
import { useClient, useSpaceInvitations, useSpaces } from '@dxos/react-client';
|
|
10
|
-
import { Button, getSize, mx, Tooltip, useTranslation } from '@dxos/react-components';
|
|
11
|
-
|
|
12
|
-
import { InvitationList, PanelSeparator, SpaceListItem, SpaceMemberListContainer } from '../../components';
|
|
13
|
-
import { defaultSurface, subduedSurface } from '../../styles';
|
|
14
|
-
|
|
15
|
-
export type SpacePanelProps = {
|
|
16
|
-
titleId?: string;
|
|
17
|
-
space?: Space;
|
|
18
|
-
initialState?: SpaceView;
|
|
19
|
-
createInvitationUrl: (invitationCode: string) => string;
|
|
20
|
-
onClickJoinSpace?: () => void;
|
|
21
|
-
onClickMember?: (member: SpaceMember) => void;
|
|
22
|
-
doneActionParent?: Parameters<typeof cloneElement>[0];
|
|
23
|
-
onDone?: (result: Space | null) => void;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type SpaceView = 'current space' | 'space list';
|
|
27
|
-
|
|
28
|
-
export type SpaceState = {
|
|
29
|
-
activeView: SpaceView;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const CurrentSpaceView = ({
|
|
33
|
-
space,
|
|
34
|
-
createInvitationUrl,
|
|
35
|
-
onClickMember,
|
|
36
|
-
onShowAll,
|
|
37
|
-
titleId
|
|
38
|
-
}: { onShowAll: () => void } & SpacePanelProps) => {
|
|
39
|
-
const { t } = useTranslation('os');
|
|
40
|
-
const invitations = useSpaceInvitations(space?.key);
|
|
41
|
-
const name = space?.properties.name;
|
|
42
|
-
|
|
43
|
-
if (!space) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<div role='none' className='flex flex-col'>
|
|
49
|
-
<div role='none' className={mx(subduedSurface, 'rounded-bs-md flex items-center p-2 gap-2')}>
|
|
50
|
-
<Tooltip content={t('show all spaces label')} zIndex='z-50'>
|
|
51
|
-
<Button compact variant='ghost' onClick={onShowAll} data-testid='show-all-spaces'>
|
|
52
|
-
<CaretLeft className={getSize(4)} weight='bold' />
|
|
53
|
-
</Button>
|
|
54
|
-
</Tooltip>
|
|
55
|
-
{/* TODO(wittjosiah): Label this as the space panel. */}
|
|
56
|
-
<h2 id={titleId} className={mx('grow font-system-medium', !name && 'font-mono')}>
|
|
57
|
-
{name ?? space.key.truncate()}
|
|
58
|
-
</h2>
|
|
59
|
-
</div>
|
|
60
|
-
<div role='region' className={mx(defaultSurface, 'rounded-be-md p-2')}>
|
|
61
|
-
<InvitationList
|
|
62
|
-
invitations={invitations}
|
|
63
|
-
onClickRemove={({ invitation }) => invitation && space?.removeInvitation(invitation.invitationId!)}
|
|
64
|
-
createInvitationUrl={createInvitationUrl}
|
|
65
|
-
/>
|
|
66
|
-
<Button
|
|
67
|
-
className='is-full flex gap-2 mbs-2'
|
|
68
|
-
compact
|
|
69
|
-
onClick={() => space?.createInvitation()}
|
|
70
|
-
data-testid='create-space-invitation'
|
|
71
|
-
>
|
|
72
|
-
<span>{t('create space invitation label')}</span>
|
|
73
|
-
<UserPlus className={getSize(4)} weight='bold' />
|
|
74
|
-
</Button>
|
|
75
|
-
<PanelSeparator />
|
|
76
|
-
<SpaceMemberListContainer spaceKey={space.key} includeSelf onSelect={onClickMember} />
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const SpaceListView = ({
|
|
83
|
-
doneActionParent,
|
|
84
|
-
onDone,
|
|
85
|
-
onClickJoinSpace,
|
|
86
|
-
onShowCurrent,
|
|
87
|
-
titleId
|
|
88
|
-
}: { onShowCurrent: () => void } & SpacePanelProps) => {
|
|
89
|
-
const { t } = useTranslation('os');
|
|
90
|
-
const client = useClient();
|
|
91
|
-
const spaces = useSpaces();
|
|
92
|
-
|
|
93
|
-
const handleCreateSpace = async () => {
|
|
94
|
-
const space = await client.echo.createSpace();
|
|
95
|
-
onDone?.(space);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<div role='none' className='flex flex-col'>
|
|
100
|
-
<div role='none' className={mx(subduedSurface, 'rounded-bs-md flex items-center p-2 gap-2')}>
|
|
101
|
-
<h2 id={titleId} className='grow font-system-medium'>
|
|
102
|
-
{t('all spaces label')}
|
|
103
|
-
</h2>
|
|
104
|
-
<Tooltip content={t('show current space label')} zIndex='z-50'>
|
|
105
|
-
<Button compact variant='ghost' onClick={onShowCurrent} data-testid='show-current-space'>
|
|
106
|
-
<CaretRight className={getSize(4)} weight='bold' />
|
|
107
|
-
</Button>
|
|
108
|
-
</Tooltip>
|
|
109
|
-
</div>
|
|
110
|
-
<div role='region' className={mx(defaultSurface, 'rounded-be-md p-2')}>
|
|
111
|
-
<ul className='flex flex-col gap-2'>
|
|
112
|
-
{spaces.map((space) => {
|
|
113
|
-
const key = space.key.toHex();
|
|
114
|
-
const listItem = <SpaceListItem key={key} space={space} onClick={() => onDone?.(space)} />;
|
|
115
|
-
return doneActionParent ? cloneElement(doneActionParent, { key }, listItem) : listItem;
|
|
116
|
-
})}
|
|
117
|
-
</ul>
|
|
118
|
-
<Button className='is-full flex gap-2 mbs-2' compact onClick={handleCreateSpace} data-testid='create-space'>
|
|
119
|
-
<span>{t('create space label')}</span>
|
|
120
|
-
<PlusCircle className={getSize(4)} weight='bold' />
|
|
121
|
-
</Button>
|
|
122
|
-
{onClickJoinSpace && (
|
|
123
|
-
<Button
|
|
124
|
-
className='is-full flex gap-2 mbs-2'
|
|
125
|
-
compact
|
|
126
|
-
onClick={() => onClickJoinSpace?.()}
|
|
127
|
-
data-testid='join-space'
|
|
128
|
-
>
|
|
129
|
-
<span>{t('join space label')}</span>
|
|
130
|
-
<Intersect className={getSize(4)} weight='bold' />
|
|
131
|
-
</Button>
|
|
132
|
-
)}
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
interface SpacePanelState {
|
|
139
|
-
activeView: SpaceView;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
interface SpacePanelAction {
|
|
143
|
-
type: 'deselect space' | 'select space';
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export const SpacePanel = (props: SpacePanelProps) => {
|
|
147
|
-
const reducer = (state: SpacePanelState, action: SpacePanelAction) => {
|
|
148
|
-
const nextState = { ...state };
|
|
149
|
-
switch (action.type) {
|
|
150
|
-
case 'deselect space':
|
|
151
|
-
nextState.activeView = 'space list';
|
|
152
|
-
break;
|
|
153
|
-
case 'select space':
|
|
154
|
-
nextState.activeView = 'current space';
|
|
155
|
-
break;
|
|
156
|
-
}
|
|
157
|
-
return nextState;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const [panelState, dispatch] = useReducer(reducer, {
|
|
161
|
-
activeView: props.initialState ?? 'current space'
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
// TODO(wittjosiah): Use ViewState or similar.
|
|
165
|
-
return (
|
|
166
|
-
<>
|
|
167
|
-
{panelState.activeView === 'current space' ? (
|
|
168
|
-
<CurrentSpaceView {...props} onShowAll={() => dispatch({ type: 'deselect space' })} />
|
|
169
|
-
) : (
|
|
170
|
-
<SpaceListView {...props} onShowCurrent={() => dispatch({ type: 'select space' })} />
|
|
171
|
-
)}
|
|
172
|
-
</>
|
|
173
|
-
);
|
|
174
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
export const defaultOverlay =
|
|
6
|
-
'fixed inset-0 backdrop-blur z-50 overflow-auto grid place-items-center p-2 md:p-4 lg:p-8';
|
|
7
|
-
|
|
8
|
-
export const defaultDialogContent = 'is-full min-is-[260px] max-is-[320px] rounded-md shadow-md backdrop-blur-md';
|