@dxos/react-ui 0.1.32-next.86f5578 → 0.1.33
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 +629 -534
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts +9 -0
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +5 -0
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/index.d.ts +3 -0
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -0
- package/dist/types/src/components/InvitationEmoji/InvitationEmoji.d.ts +7 -0
- package/dist/types/src/components/InvitationEmoji/InvitationEmoji.d.ts.map +1 -0
- package/dist/types/src/components/InvitationEmoji/index.d.ts +2 -0
- package/dist/types/src/components/InvitationEmoji/index.d.ts.map +1 -0
- 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 +2 -1
- 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 +2 -0
- package/dist/types/src/components/index.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/SpaceDialog/SpaceDialog.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.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +1 -0
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/components/Clipboard/ClipboardProvider.tsx +26 -0
- package/src/components/Clipboard/CopyButton.tsx +38 -0
- package/src/components/Clipboard/index.ts +6 -0
- package/src/components/InvitationEmoji/InvitationEmoji.tsx +32 -0
- package/src/components/InvitationEmoji/index.ts +5 -0
- package/src/components/InvitationList/InvitationList.tsx +7 -4
- package/src/components/InvitationList/InvitationListItem.tsx +6 -11
- package/src/components/InvitationList/InvitationStatusAvatar.tsx +37 -26
- package/src/components/index.ts +2 -0
- package/src/composites/DevicesDialog/DevicesDialog.tsx +3 -2
- package/src/composites/JoinDialog/JoinDialog.tsx +4 -2
- package/src/composites/SpaceDialog/SpaceDialog.tsx +3 -2
- package/src/panels/IdentityPanel/IdentityPanel.tsx +4 -2
- package/src/panels/JoinPanel/JoinHeading.tsx +3 -12
- package/src/panels/JoinPanel/JoinPanel.tsx +4 -3
- package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +1 -0
- package/src/translations/locales/en-US.ts +1 -0
|
@@ -4,13 +4,69 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// packages/apps/patterns/react-ui/src/components/
|
|
7
|
+
// packages/apps/patterns/react-ui/src/components/Clipboard/CopyButton.tsx
|
|
8
|
+
import { Check, Copy } from "@phosphor-icons/react";
|
|
8
9
|
import React2 from "react";
|
|
10
|
+
import { Button, getSize, mx, useTranslation } from "@dxos/react-components";
|
|
11
|
+
|
|
12
|
+
// packages/apps/patterns/react-ui/src/components/Clipboard/ClipboardProvider.tsx
|
|
13
|
+
import React, { createContext, useCallback, useContext, useState } from "react";
|
|
14
|
+
var ClipboardContext = /* @__PURE__ */ createContext({
|
|
15
|
+
textValue: "",
|
|
16
|
+
setTextValue: async (_) => {
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var useClipboardContext = () => useContext(ClipboardContext);
|
|
20
|
+
var ClipboardProvider = ({ children }) => {
|
|
21
|
+
const [textValue, setInternalTextValue] = useState("");
|
|
22
|
+
const setTextValue = useCallback(async (nextValue) => {
|
|
23
|
+
await navigator.clipboard.writeText(nextValue);
|
|
24
|
+
return setInternalTextValue(nextValue);
|
|
25
|
+
}, []);
|
|
26
|
+
return /* @__PURE__ */ React.createElement(ClipboardContext.Provider, {
|
|
27
|
+
value: {
|
|
28
|
+
textValue,
|
|
29
|
+
setTextValue
|
|
30
|
+
}
|
|
31
|
+
}, children);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// packages/apps/patterns/react-ui/src/components/Clipboard/CopyButton.tsx
|
|
35
|
+
var inactiveLabelStyles = "invisible bs-px -mbe-px";
|
|
36
|
+
var CopyButton = ({ value }) => {
|
|
37
|
+
const { t } = useTranslation("os");
|
|
38
|
+
const { textValue, setTextValue } = useClipboardContext();
|
|
39
|
+
const isCopied = textValue === value;
|
|
40
|
+
return /* @__PURE__ */ React2.createElement(Button, {
|
|
41
|
+
className: "inline-flex flex-col justify-center",
|
|
42
|
+
onClick: () => setTextValue(value),
|
|
43
|
+
"data-testid": "copy-invitation"
|
|
44
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
45
|
+
role: "none",
|
|
46
|
+
className: mx("flex gap-1", isCopied && inactiveLabelStyles)
|
|
47
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
48
|
+
className: "pli-1"
|
|
49
|
+
}, t("copy invitation code label")), /* @__PURE__ */ React2.createElement(Copy, {
|
|
50
|
+
className: getSize(4),
|
|
51
|
+
weight: "bold"
|
|
52
|
+
})), /* @__PURE__ */ React2.createElement("div", {
|
|
53
|
+
role: "none",
|
|
54
|
+
className: mx("flex gap-1", !isCopied && inactiveLabelStyles)
|
|
55
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
56
|
+
className: "pli-1"
|
|
57
|
+
}, t("copy invitation code success label")), /* @__PURE__ */ React2.createElement(Check, {
|
|
58
|
+
className: getSize(4),
|
|
59
|
+
weight: "bold"
|
|
60
|
+
})));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// packages/apps/patterns/react-ui/src/components/IdentityList/DeviceList.tsx
|
|
64
|
+
import React4 from "react";
|
|
9
65
|
|
|
10
66
|
// packages/apps/patterns/react-ui/src/components/IdentityList/IdentityListItem.tsx
|
|
11
|
-
import
|
|
67
|
+
import React3 from "react";
|
|
12
68
|
import { SpaceMember } from "@dxos/client";
|
|
13
|
-
import { Avatar, mx, useTranslation } from "@dxos/react-components";
|
|
69
|
+
import { Avatar, mx as mx2, useTranslation as useTranslation2 } from "@dxos/react-components";
|
|
14
70
|
function _extends() {
|
|
15
71
|
_extends = Object.assign || function(target) {
|
|
16
72
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -27,21 +83,21 @@ function _extends() {
|
|
|
27
83
|
}
|
|
28
84
|
var IdentityListItem = ({ identity, presence, onClick }) => {
|
|
29
85
|
var _a, _b;
|
|
30
|
-
const { t } =
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
className:
|
|
86
|
+
const { t } = useTranslation2("os");
|
|
87
|
+
return /* @__PURE__ */ React3.createElement("li", {
|
|
88
|
+
className: mx2("flex gap-2 items-center", onClick && "cursor-pointer"),
|
|
33
89
|
onClick: () => onClick == null ? void 0 : onClick(),
|
|
34
90
|
"data-testid": "identity-list-item"
|
|
35
|
-
}, /* @__PURE__ */
|
|
91
|
+
}, /* @__PURE__ */ React3.createElement(Avatar, _extends({}, {
|
|
36
92
|
variant: "circle",
|
|
37
93
|
size: 9,
|
|
38
94
|
fallbackValue: identity.identityKey.toHex(),
|
|
39
|
-
label: /* @__PURE__ */
|
|
95
|
+
label: /* @__PURE__ */ React3.createElement("p", {
|
|
40
96
|
className: "text-sm truncate"
|
|
41
97
|
}, (_b = (_a = identity.profile) == null ? void 0 : _a.displayName) != null ? _b : identity.identityKey.truncate()),
|
|
42
98
|
...presence === SpaceMember.PresenceState.OFFLINE && {
|
|
43
99
|
status: "inactive",
|
|
44
|
-
description: /* @__PURE__ */
|
|
100
|
+
description: /* @__PURE__ */ React3.createElement("p", {
|
|
45
101
|
className: "font-system-normal text-xs text-neutral-700 dark:text-neutral-300"
|
|
46
102
|
}, t("identity offline description"))
|
|
47
103
|
},
|
|
@@ -61,7 +117,7 @@ var IdentityListItem = ({ identity, presence, onClick }) => {
|
|
|
61
117
|
|
|
62
118
|
// packages/apps/patterns/react-ui/src/components/IdentityList/DeviceList.tsx
|
|
63
119
|
var DeviceList = ({ devices, onSelect }) => {
|
|
64
|
-
return /* @__PURE__ */
|
|
120
|
+
return /* @__PURE__ */ React4.createElement("ul", {
|
|
65
121
|
className: "flex flex-col gap-2"
|
|
66
122
|
}, devices.map((device) => {
|
|
67
123
|
var _a;
|
|
@@ -71,7 +127,7 @@ var DeviceList = ({ devices, onSelect }) => {
|
|
|
71
127
|
displayName: (_a = device.profile) == null ? void 0 : _a.displayName
|
|
72
128
|
}
|
|
73
129
|
};
|
|
74
|
-
return /* @__PURE__ */
|
|
130
|
+
return /* @__PURE__ */ React4.createElement(IdentityListItem, {
|
|
75
131
|
key: device.deviceKey.toHex(),
|
|
76
132
|
identity,
|
|
77
133
|
onClick: onSelect && (() => onSelect(device))
|
|
@@ -80,12 +136,12 @@ var DeviceList = ({ devices, onSelect }) => {
|
|
|
80
136
|
};
|
|
81
137
|
|
|
82
138
|
// packages/apps/patterns/react-ui/src/components/IdentityList/SpaceMemberList.tsx
|
|
83
|
-
import
|
|
139
|
+
import React5 from "react";
|
|
84
140
|
var SpaceMemberList = ({ members, onSelect }) => {
|
|
85
|
-
return /* @__PURE__ */
|
|
141
|
+
return /* @__PURE__ */ React5.createElement("ul", {
|
|
86
142
|
className: "flex flex-col gap-2"
|
|
87
143
|
}, members.filter((member) => member.identity).map((member) => {
|
|
88
|
-
return /* @__PURE__ */
|
|
144
|
+
return /* @__PURE__ */ React5.createElement(IdentityListItem, {
|
|
89
145
|
key: member.identity.identityKey.toHex(),
|
|
90
146
|
identity: member.identity,
|
|
91
147
|
presence: member.presence,
|
|
@@ -95,7 +151,7 @@ var SpaceMemberList = ({ members, onSelect }) => {
|
|
|
95
151
|
};
|
|
96
152
|
|
|
97
153
|
// packages/apps/patterns/react-ui/src/components/IdentityList/SpaceMemberListContainer.tsx
|
|
98
|
-
import
|
|
154
|
+
import React6, { useMemo } from "react";
|
|
99
155
|
import { useClient, useMembers } from "@dxos/react-client";
|
|
100
156
|
var SpaceMemberListContainer = ({ spaceKey, includeSelf, onSelect }) => {
|
|
101
157
|
const client = useClient();
|
|
@@ -103,80 +159,49 @@ var SpaceMemberListContainer = ({ spaceKey, includeSelf, onSelect }) => {
|
|
|
103
159
|
const members = useMemo(() => includeSelf ? allUnsortedMembers.sort((a) => a.identity.identityKey.equals(client.halo.identity.get().identityKey) ? -1 : 1) : allUnsortedMembers.filter((member) => !member.identity.identityKey.equals(client.halo.identity.get().identityKey)), [
|
|
104
160
|
allUnsortedMembers
|
|
105
161
|
]);
|
|
106
|
-
return /* @__PURE__ */
|
|
162
|
+
return /* @__PURE__ */ React6.createElement(SpaceMemberList, {
|
|
107
163
|
members,
|
|
108
164
|
onSelect
|
|
109
165
|
});
|
|
110
166
|
};
|
|
111
167
|
|
|
112
|
-
// packages/apps/patterns/react-ui/src/components/
|
|
113
|
-
import
|
|
114
|
-
import {
|
|
115
|
-
import { getSize, mx as mx2 } from "@dxos/react-components";
|
|
116
|
-
|
|
117
|
-
// packages/apps/patterns/react-ui/src/styles/dialogStyles.ts
|
|
118
|
-
var defaultOverlay = "fixed inset-0 backdrop-blur z-50 overflow-auto grid place-items-center p-2 md:p-4 lg:p-8";
|
|
119
|
-
var defaultDialogContent = "is-full min-is-[260px] max-is-[320px] rounded-md shadow-md backdrop-blur-md";
|
|
120
|
-
|
|
121
|
-
// packages/apps/patterns/react-ui/src/styles/panelStyles.ts
|
|
122
|
-
var defaultSurface = "bg-neutral-50/[.72] dark:bg-neutral-950/[.72]";
|
|
123
|
-
var subduedSurface = "bg-neutral-100/[.66] dark:bg-neutral-900/[.66]";
|
|
124
|
-
var defaultArrow = "text-neutral-50/[.66] dark:text-neutral-950/[.66]";
|
|
125
|
-
|
|
126
|
-
// packages/apps/patterns/react-ui/src/styles/invitationStatusStyles.ts
|
|
127
|
-
import { Invitation } from "@dxos/client";
|
|
128
|
-
var inactiveBgColor = "bg-neutral-100 dark:bg-neutral-600";
|
|
129
|
-
var activeBgColor = "bg-primary-500 dark:bg-primary-400";
|
|
130
|
-
var successBgColor = "bg-success-500 dark:bg-success-400";
|
|
131
|
-
var errorBgColor = "bg-error-500 dark:bg-error-400";
|
|
132
|
-
var cancelledBgColor = "bg-warning-500 dark:bg-warning-400";
|
|
133
|
-
var inactiveTextColor = "text-neutral-100 dark:text-neutral-600";
|
|
134
|
-
var activeTextColor = "text-primary-400 dark:text-primary-500";
|
|
135
|
-
var successTextColor = "text-success-400 dark:text-success-500";
|
|
136
|
-
var errorTextColor = "text-error-400 dark:text-error-500";
|
|
137
|
-
var cancelledTextColor = "text-warning-400 dark:text-warning-500";
|
|
138
|
-
var inactiveStrokeColor = "stroke-neutral-100 dark:stroke-neutral-700";
|
|
139
|
-
var activeStrokeColor = "stroke-primary-500 dark:stroke-primary-150";
|
|
140
|
-
var successStrokeColor = "stroke-success-400 dark:stroke-primary-400";
|
|
141
|
-
var errorStrokeColor = "stroke-error-400 dark:stroke-error-500";
|
|
142
|
-
var cancelledStrokeColor = "stroke-warning-400 dark:stroke-warning-500";
|
|
143
|
-
var resolvedStrokeColor = (status) => status === Invitation.State.ERROR ? errorStrokeColor : status === Invitation.State.CANCELLED || status === Invitation.State.TIMEOUT ? cancelledStrokeColor : successStrokeColor;
|
|
144
|
-
var resolvedBgColor = (status) => status === Invitation.State.ERROR ? errorBgColor : status === Invitation.State.CANCELLED || status === Invitation.State.TIMEOUT ? cancelledBgColor : successBgColor;
|
|
145
|
-
var resolvedTextColor = (status) => status === Invitation.State.ERROR ? errorTextColor : status === Invitation.State.CANCELLED || status === Invitation.State.TIMEOUT ? cancelledTextColor : successTextColor;
|
|
168
|
+
// packages/apps/patterns/react-ui/src/components/InvitationEmoji/InvitationEmoji.tsx
|
|
169
|
+
import React7 from "react";
|
|
170
|
+
import { getSize as getSize2, mx as mx3 } from "@dxos/react-components";
|
|
146
171
|
|
|
147
172
|
// packages/apps/patterns/react-ui/src/util/invitationStatusValue.ts
|
|
148
|
-
import { Invitation
|
|
173
|
+
import { Invitation } from "@dxos/client";
|
|
149
174
|
var invitationStatusValue = /* @__PURE__ */ new Map([
|
|
150
175
|
[
|
|
151
|
-
|
|
176
|
+
Invitation.State.ERROR,
|
|
152
177
|
-3
|
|
153
178
|
],
|
|
154
179
|
[
|
|
155
|
-
|
|
180
|
+
Invitation.State.TIMEOUT,
|
|
156
181
|
-2
|
|
157
182
|
],
|
|
158
183
|
[
|
|
159
|
-
|
|
184
|
+
Invitation.State.CANCELLED,
|
|
160
185
|
-1
|
|
161
186
|
],
|
|
162
187
|
[
|
|
163
|
-
|
|
188
|
+
Invitation.State.INIT,
|
|
164
189
|
0
|
|
165
190
|
],
|
|
166
191
|
[
|
|
167
|
-
|
|
192
|
+
Invitation.State.CONNECTING,
|
|
168
193
|
1
|
|
169
194
|
],
|
|
170
195
|
[
|
|
171
|
-
|
|
196
|
+
Invitation.State.CONNECTED,
|
|
172
197
|
2
|
|
173
198
|
],
|
|
174
199
|
[
|
|
175
|
-
|
|
200
|
+
Invitation.State.AUTHENTICATING,
|
|
176
201
|
3
|
|
177
202
|
],
|
|
178
203
|
[
|
|
179
|
-
|
|
204
|
+
Invitation.State.SUCCESS,
|
|
180
205
|
4
|
|
181
206
|
]
|
|
182
207
|
]);
|
|
@@ -199,7 +224,7 @@ var emoji = toArray(
|
|
|
199
224
|
);
|
|
200
225
|
var toEmoji = (keyAsHex) => emoji[parseInt(keyAsHex, 16) % emoji.length];
|
|
201
226
|
|
|
202
|
-
// packages/apps/patterns/react-ui/src/components/
|
|
227
|
+
// packages/apps/patterns/react-ui/src/components/InvitationEmoji/InvitationEmoji.tsx
|
|
203
228
|
function _extends2() {
|
|
204
229
|
_extends2 = Object.assign || function(target) {
|
|
205
230
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -214,6 +239,67 @@ function _extends2() {
|
|
|
214
239
|
};
|
|
215
240
|
return _extends2.apply(this, arguments);
|
|
216
241
|
}
|
|
242
|
+
var InvitationEmoji = ({ invitationId, size = "lg", ...rootProps }) => {
|
|
243
|
+
const invitationEmoji = invitationId && toEmoji(invitationId);
|
|
244
|
+
return /* @__PURE__ */ React7.createElement("div", _extends2({
|
|
245
|
+
role: "none"
|
|
246
|
+
}, rootProps, {
|
|
247
|
+
className: mx3(getSize2(size === "sm" ? 8 : 12), "inline-flex items-center justify-center leading-none", size === "sm" ? "text-2xl" : "text-5xl bg-neutral-300 dark:bg-neutral-700 rounded-full", rootProps.className)
|
|
248
|
+
}), /* @__PURE__ */ React7.createElement("span", {
|
|
249
|
+
role: "none"
|
|
250
|
+
}, invitationEmoji));
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
// packages/apps/patterns/react-ui/src/components/InvitationList/InvitationStatusAvatar.tsx
|
|
254
|
+
import React8 from "react";
|
|
255
|
+
import { Invitation as Invitation3 } from "@dxos/client";
|
|
256
|
+
import { getSize as getSize3, mx as mx4 } from "@dxos/react-components";
|
|
257
|
+
|
|
258
|
+
// packages/apps/patterns/react-ui/src/styles/dialogStyles.ts
|
|
259
|
+
var defaultOverlay = "fixed inset-0 backdrop-blur z-50 overflow-auto grid place-items-center p-2 md:p-4 lg:p-8";
|
|
260
|
+
var defaultDialogContent = "is-full min-is-[260px] max-is-[320px] rounded-md shadow-md backdrop-blur-md";
|
|
261
|
+
|
|
262
|
+
// packages/apps/patterns/react-ui/src/styles/panelStyles.ts
|
|
263
|
+
var defaultSurface = "bg-neutral-50/[.72] dark:bg-neutral-950/[.72]";
|
|
264
|
+
var subduedSurface = "bg-neutral-100/[.66] dark:bg-neutral-900/[.66]";
|
|
265
|
+
var defaultArrow = "text-neutral-50/[.66] dark:text-neutral-950/[.66]";
|
|
266
|
+
|
|
267
|
+
// packages/apps/patterns/react-ui/src/styles/invitationStatusStyles.ts
|
|
268
|
+
import { Invitation as Invitation2 } from "@dxos/client";
|
|
269
|
+
var inactiveBgColor = "bg-neutral-100 dark:bg-neutral-600";
|
|
270
|
+
var activeBgColor = "bg-primary-500 dark:bg-primary-400";
|
|
271
|
+
var successBgColor = "bg-success-500 dark:bg-success-400";
|
|
272
|
+
var errorBgColor = "bg-error-500 dark:bg-error-400";
|
|
273
|
+
var cancelledBgColor = "bg-warning-500 dark:bg-warning-400";
|
|
274
|
+
var inactiveTextColor = "text-neutral-100 dark:text-neutral-600";
|
|
275
|
+
var activeTextColor = "text-primary-400 dark:text-primary-500";
|
|
276
|
+
var successTextColor = "text-success-400 dark:text-success-500";
|
|
277
|
+
var errorTextColor = "text-error-400 dark:text-error-500";
|
|
278
|
+
var cancelledTextColor = "text-warning-400 dark:text-warning-500";
|
|
279
|
+
var inactiveStrokeColor = "stroke-neutral-100 dark:stroke-neutral-700";
|
|
280
|
+
var activeStrokeColor = "stroke-primary-500 dark:stroke-primary-150";
|
|
281
|
+
var successStrokeColor = "stroke-success-400 dark:stroke-primary-400";
|
|
282
|
+
var errorStrokeColor = "stroke-error-400 dark:stroke-error-500";
|
|
283
|
+
var cancelledStrokeColor = "stroke-warning-400 dark:stroke-warning-500";
|
|
284
|
+
var resolvedStrokeColor = (status) => status === Invitation2.State.ERROR ? errorStrokeColor : status === Invitation2.State.CANCELLED || status === Invitation2.State.TIMEOUT ? cancelledStrokeColor : successStrokeColor;
|
|
285
|
+
var resolvedBgColor = (status) => status === Invitation2.State.ERROR ? errorBgColor : status === Invitation2.State.CANCELLED || status === Invitation2.State.TIMEOUT ? cancelledBgColor : successBgColor;
|
|
286
|
+
var resolvedTextColor = (status) => status === Invitation2.State.ERROR ? errorTextColor : status === Invitation2.State.CANCELLED || status === Invitation2.State.TIMEOUT ? cancelledTextColor : successTextColor;
|
|
287
|
+
|
|
288
|
+
// packages/apps/patterns/react-ui/src/components/InvitationList/InvitationStatusAvatar.tsx
|
|
289
|
+
function _extends3() {
|
|
290
|
+
_extends3 = Object.assign || function(target) {
|
|
291
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
292
|
+
var source = arguments[i];
|
|
293
|
+
for (var key in source) {
|
|
294
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
295
|
+
target[key] = source[key];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return target;
|
|
300
|
+
};
|
|
301
|
+
return _extends3.apply(this, arguments);
|
|
302
|
+
}
|
|
217
303
|
var svgSize = 32;
|
|
218
304
|
var strokeWidth = 5;
|
|
219
305
|
var radius = (svgSize - strokeWidth) / 2;
|
|
@@ -231,33 +317,40 @@ var circleProps = {
|
|
|
231
317
|
strokeWidth,
|
|
232
318
|
strokeDasharray: `${segment - gap} ${2 * segment + gap}`
|
|
233
319
|
};
|
|
234
|
-
var InvitationStatusAvatar = ({ size = 10, status, haltedAt, slots = {} }) => {
|
|
320
|
+
var InvitationStatusAvatar = ({ size = 10, status, haltedAt, slots = {}, invitationId }) => {
|
|
235
321
|
var _a;
|
|
236
322
|
const resolvedColor = resolvedStrokeColor(status);
|
|
237
323
|
const halted = status === Invitation3.State.CANCELLED || status === Invitation3.State.TIMEOUT || status === Invitation3.State.ERROR;
|
|
238
324
|
const cursor = invitationStatusValue.get(halted ? haltedAt : status);
|
|
239
|
-
return /* @__PURE__ */
|
|
325
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
326
|
+
className: "inline-block relative"
|
|
327
|
+
}, /* @__PURE__ */ React8.createElement(InvitationEmoji, _extends3({}, {
|
|
328
|
+
invitationId
|
|
329
|
+
}, {
|
|
330
|
+
size: "sm",
|
|
331
|
+
className: "absolute inset-0 text-base"
|
|
332
|
+
})), /* @__PURE__ */ React8.createElement("svg", _extends3({}, slots.svg, {
|
|
240
333
|
viewBox: `0 0 ${svgSize} ${svgSize}`,
|
|
241
|
-
className:
|
|
334
|
+
className: mx4(getSize3(size), (_a = slots.svg) == null ? void 0 : _a.className)
|
|
242
335
|
}), [
|
|
243
336
|
...Array(nSegments)
|
|
244
|
-
].map((_, index) => /* @__PURE__ */
|
|
337
|
+
].map((_, index) => /* @__PURE__ */ React8.createElement("circle", _extends3({
|
|
245
338
|
key: index
|
|
246
339
|
}, circleProps, {
|
|
247
340
|
strokeDashoffset: index * segment + baseOffset,
|
|
248
341
|
className: index === 0 ? cursor === 1 ? halted ? resolvedColor : activeStrokeColor : cursor > 1 ? resolvedColor : inactiveStrokeColor : index === 1 ? cursor === 3 ? halted ? resolvedColor : activeStrokeColor : cursor > 3 ? resolvedColor : inactiveStrokeColor : cursor > 3 ? resolvedColor : inactiveStrokeColor
|
|
249
|
-
}))));
|
|
342
|
+
})))));
|
|
250
343
|
};
|
|
251
344
|
|
|
252
345
|
// packages/apps/patterns/react-ui/src/components/InvitationList/InvitationListItem.tsx
|
|
253
|
-
import {
|
|
346
|
+
import { ProhibitInset, QrCode, X } from "@phosphor-icons/react";
|
|
254
347
|
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
255
348
|
import { QRCodeSVG } from "qrcode.react";
|
|
256
|
-
import
|
|
349
|
+
import React9, { useCallback as useCallback2 } from "react";
|
|
257
350
|
import { useInvitationStatus } from "@dxos/react-client";
|
|
258
|
-
import { Button, getSize as
|
|
259
|
-
function
|
|
260
|
-
|
|
351
|
+
import { Button as Button2, getSize as getSize4, mx as mx5, useId, useTranslation as useTranslation3 } from "@dxos/react-components";
|
|
352
|
+
function _extends4() {
|
|
353
|
+
_extends4 = Object.assign || function(target) {
|
|
261
354
|
for (var i = 1; i < arguments.length; i++) {
|
|
262
355
|
var source = arguments[i];
|
|
263
356
|
for (var key in source) {
|
|
@@ -268,103 +361,90 @@ function _extends3() {
|
|
|
268
361
|
}
|
|
269
362
|
return target;
|
|
270
363
|
};
|
|
271
|
-
return
|
|
364
|
+
return _extends4.apply(this, arguments);
|
|
272
365
|
}
|
|
273
366
|
var InvitationListItem = ({ invitation, value, onClickRemove, createInvitationUrl }) => {
|
|
274
|
-
var _a;
|
|
275
|
-
const { t } =
|
|
367
|
+
var _a, _b;
|
|
368
|
+
const { t } = useTranslation3("os");
|
|
276
369
|
const qrLabel = useId("qrLabel");
|
|
277
370
|
const { cancel, status, haltedAt, invitationCode, authenticationCode } = useInvitationStatus(invitation);
|
|
278
371
|
const statusValue = (_a = invitationStatusValue.get(status)) != null ? _a : 0;
|
|
279
372
|
const isCancellable = statusValue < 4 && statusValue >= 0;
|
|
280
373
|
const showShare = statusValue < 3 && statusValue >= 0;
|
|
281
374
|
const showAuthCode = statusValue === 3;
|
|
282
|
-
const handleClickRemove =
|
|
375
|
+
const handleClickRemove = useCallback2(() => onClickRemove(invitation), [
|
|
283
376
|
invitation,
|
|
284
377
|
onClickRemove
|
|
285
378
|
]);
|
|
286
379
|
const invitationUrl = invitationCode && createInvitationUrl(invitationCode);
|
|
287
|
-
|
|
288
|
-
if (invitationUrl) {
|
|
289
|
-
void navigator.clipboard.writeText(invitationUrl);
|
|
290
|
-
}
|
|
291
|
-
}, [
|
|
292
|
-
invitationUrl
|
|
293
|
-
]);
|
|
294
|
-
return /* @__PURE__ */ React6.createElement(AccordionPrimitive.Item, {
|
|
380
|
+
return /* @__PURE__ */ React9.createElement(AccordionPrimitive.Item, {
|
|
295
381
|
value
|
|
296
|
-
}, /* @__PURE__ */
|
|
382
|
+
}, /* @__PURE__ */ React9.createElement(AccordionPrimitive.Header, {
|
|
297
383
|
className: "flex gap-2 items-center"
|
|
298
|
-
}, /* @__PURE__ */
|
|
384
|
+
}, /* @__PURE__ */ React9.createElement(InvitationStatusAvatar, _extends4({}, {
|
|
299
385
|
status,
|
|
300
386
|
haltedAt,
|
|
301
|
-
size: 8
|
|
302
|
-
|
|
387
|
+
size: 8,
|
|
388
|
+
invitationId: (_b = invitation == null ? void 0 : invitation.invitation) == null ? void 0 : _b.invitationId
|
|
389
|
+
})), showShare && invitationUrl ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(AccordionPrimitive.Trigger, {
|
|
303
390
|
asChild: true
|
|
304
|
-
}, /* @__PURE__ */
|
|
391
|
+
}, /* @__PURE__ */ React9.createElement(Button2, {
|
|
305
392
|
className: "grow flex gap-1",
|
|
306
393
|
"data-testid": "show-qrcode"
|
|
307
|
-
}, /* @__PURE__ */
|
|
308
|
-
className:
|
|
309
|
-
weight: "bold"
|
|
310
|
-
}))), /* @__PURE__ */ React6.createElement(Button, {
|
|
311
|
-
className: "flex gap-1",
|
|
312
|
-
onClick: handleClickCopy,
|
|
313
|
-
"data-testid": "copy-invitation"
|
|
314
|
-
}, /* @__PURE__ */ React6.createElement("span", {
|
|
315
|
-
className: "pli-1"
|
|
316
|
-
}, t("copy invitation code label")), /* @__PURE__ */ React6.createElement(Copy, {
|
|
317
|
-
className: getSize2(4),
|
|
394
|
+
}, /* @__PURE__ */ React9.createElement("span", null, t("open share panel label")), /* @__PURE__ */ React9.createElement(QrCode, {
|
|
395
|
+
className: getSize4(4),
|
|
318
396
|
weight: "bold"
|
|
319
|
-
})))
|
|
397
|
+
}))), /* @__PURE__ */ React9.createElement(CopyButton, {
|
|
398
|
+
value: invitationUrl
|
|
399
|
+
})) : showAuthCode ? /* @__PURE__ */ React9.createElement("p", {
|
|
320
400
|
className: "grow text-xl text-center text-success-500 dark:text-success-300 font-mono"
|
|
321
|
-
}, authenticationCode) : /* @__PURE__ */
|
|
401
|
+
}, authenticationCode) : /* @__PURE__ */ React9.createElement("span", {
|
|
322
402
|
role: "none",
|
|
323
403
|
className: "grow"
|
|
324
|
-
}), isCancellable ? /* @__PURE__ */
|
|
404
|
+
}), isCancellable ? /* @__PURE__ */ React9.createElement(Button2, {
|
|
325
405
|
variant: "ghost",
|
|
326
406
|
className: "flex gap-1",
|
|
327
407
|
onClick: cancel,
|
|
328
408
|
"data-testid": "cancel-invitation"
|
|
329
|
-
}, /* @__PURE__ */
|
|
409
|
+
}, /* @__PURE__ */ React9.createElement("span", {
|
|
330
410
|
className: "sr-only"
|
|
331
|
-
}, t("cancel invitation label")), /* @__PURE__ */
|
|
332
|
-
className:
|
|
411
|
+
}, t("cancel invitation label")), /* @__PURE__ */ React9.createElement(ProhibitInset, {
|
|
412
|
+
className: getSize4(4),
|
|
333
413
|
weight: "bold"
|
|
334
|
-
})) : /* @__PURE__ */
|
|
414
|
+
})) : /* @__PURE__ */ React9.createElement(Button2, {
|
|
335
415
|
variant: "ghost",
|
|
336
416
|
className: "flex gap-1",
|
|
337
417
|
onClick: handleClickRemove,
|
|
338
418
|
"data-testid": "remove-invitation"
|
|
339
|
-
}, /* @__PURE__ */
|
|
419
|
+
}, /* @__PURE__ */ React9.createElement("span", {
|
|
340
420
|
className: "sr-only"
|
|
341
|
-
}, t("remove invitation label")), /* @__PURE__ */
|
|
342
|
-
className:
|
|
421
|
+
}, t("remove invitation label")), /* @__PURE__ */ React9.createElement(X, {
|
|
422
|
+
className: getSize4(4),
|
|
343
423
|
weight: "bold"
|
|
344
|
-
}))), showShare && invitationUrl && /* @__PURE__ */
|
|
424
|
+
}))), showShare && invitationUrl && /* @__PURE__ */ React9.createElement(AccordionPrimitive.Content, {
|
|
345
425
|
className: "flex gap-2 is-full radix-state-open:p-1 items-center"
|
|
346
|
-
}, /* @__PURE__ */
|
|
426
|
+
}, /* @__PURE__ */ React9.createElement(QRCodeSVG, {
|
|
347
427
|
bgColor: "transparent",
|
|
348
428
|
fgColor: "currentColor",
|
|
349
429
|
value: invitationUrl,
|
|
350
|
-
className:
|
|
430
|
+
className: mx5("grow-[2] aspect-square is-24 bs-auto"),
|
|
351
431
|
"aria-labelledby": qrLabel
|
|
352
|
-
}), /* @__PURE__ */
|
|
432
|
+
}), /* @__PURE__ */ React9.createElement("span", {
|
|
353
433
|
className: "pli-1 flex-1 font-system-normal text-sm text-center",
|
|
354
434
|
id: qrLabel
|
|
355
435
|
}, t("qr label"))));
|
|
356
436
|
};
|
|
357
437
|
|
|
358
438
|
// packages/apps/patterns/react-ui/src/components/InvitationList/InvitationListContainer.tsx
|
|
359
|
-
import
|
|
439
|
+
import React11, { useCallback as useCallback3 } from "react";
|
|
360
440
|
import { useSpace, useSpaceInvitations } from "@dxos/react-client";
|
|
361
441
|
|
|
362
442
|
// packages/apps/patterns/react-ui/src/components/InvitationList/InvitationList.tsx
|
|
363
443
|
import { Root as AccordionRoot } from "@radix-ui/react-accordion";
|
|
364
|
-
import
|
|
365
|
-
import { defaultDescription, DensityProvider, mx as
|
|
366
|
-
function
|
|
367
|
-
|
|
444
|
+
import React10 from "react";
|
|
445
|
+
import { defaultDescription, DensityProvider, mx as mx6, useTranslation as useTranslation4 } from "@dxos/react-components";
|
|
446
|
+
function _extends5() {
|
|
447
|
+
_extends5 = Object.assign || function(target) {
|
|
368
448
|
for (var i = 1; i < arguments.length; i++) {
|
|
369
449
|
var source = arguments[i];
|
|
370
450
|
for (var key in source) {
|
|
@@ -375,32 +455,32 @@ function _extends4() {
|
|
|
375
455
|
}
|
|
376
456
|
return target;
|
|
377
457
|
};
|
|
378
|
-
return
|
|
458
|
+
return _extends5.apply(this, arguments);
|
|
379
459
|
}
|
|
380
460
|
var InvitationList = ({ invitations, ...invitationProps }) => {
|
|
381
|
-
const { t } =
|
|
382
|
-
return invitations.length ? /* @__PURE__ */
|
|
461
|
+
const { t } = useTranslation4("os");
|
|
462
|
+
return invitations.length ? /* @__PURE__ */ React10.createElement(AccordionRoot, {
|
|
383
463
|
type: "single",
|
|
384
464
|
collapsible: true,
|
|
385
465
|
className: "flex flex-col gap-1"
|
|
386
|
-
}, /* @__PURE__ */
|
|
466
|
+
}, /* @__PURE__ */ React10.createElement(DensityProvider, {
|
|
387
467
|
density: "fine"
|
|
388
|
-
}, invitations.map((invitation, index) => {
|
|
468
|
+
}, /* @__PURE__ */ React10.createElement(ClipboardProvider, null, invitations.map((invitation, index) => {
|
|
389
469
|
var _a, _b;
|
|
390
470
|
const value = (_b = (_a = invitation.invitation) == null ? void 0 : _a.invitationId) != null ? _b : `inv_${index}`;
|
|
391
|
-
return /* @__PURE__ */
|
|
471
|
+
return /* @__PURE__ */ React10.createElement(InvitationListItem, _extends5({
|
|
392
472
|
key: value,
|
|
393
473
|
value,
|
|
394
474
|
invitation
|
|
395
475
|
}, invitationProps));
|
|
396
|
-
}))) : /* @__PURE__ */
|
|
397
|
-
className:
|
|
476
|
+
})))) : /* @__PURE__ */ React10.createElement("p", {
|
|
477
|
+
className: mx6(defaultDescription, "text-center p-2")
|
|
398
478
|
}, t("empty invitations message"));
|
|
399
479
|
};
|
|
400
480
|
|
|
401
481
|
// packages/apps/patterns/react-ui/src/components/InvitationList/InvitationListContainer.tsx
|
|
402
|
-
function
|
|
403
|
-
|
|
482
|
+
function _extends6() {
|
|
483
|
+
_extends6 = Object.assign || function(target) {
|
|
404
484
|
for (var i = 1; i < arguments.length; i++) {
|
|
405
485
|
var source = arguments[i];
|
|
406
486
|
for (var key in source) {
|
|
@@ -411,17 +491,17 @@ function _extends5() {
|
|
|
411
491
|
}
|
|
412
492
|
return target;
|
|
413
493
|
};
|
|
414
|
-
return
|
|
494
|
+
return _extends6.apply(this, arguments);
|
|
415
495
|
}
|
|
416
496
|
var InvitationListContainer = ({ spaceKey, createInvitationUrl }) => {
|
|
417
497
|
const space = useSpace(spaceKey);
|
|
418
498
|
const invitations = useSpaceInvitations(spaceKey);
|
|
419
|
-
const onClickRemove =
|
|
499
|
+
const onClickRemove = useCallback3(({ invitation }) => {
|
|
420
500
|
(invitation == null ? void 0 : invitation.invitationId) && (space == null ? void 0 : space.removeInvitation(invitation.invitationId));
|
|
421
501
|
}, [
|
|
422
502
|
space
|
|
423
503
|
]);
|
|
424
|
-
return /* @__PURE__ */
|
|
504
|
+
return /* @__PURE__ */ React11.createElement(InvitationList, _extends6({
|
|
425
505
|
invitations
|
|
426
506
|
}, {
|
|
427
507
|
onClickRemove,
|
|
@@ -430,10 +510,10 @@ var InvitationListContainer = ({ spaceKey, createInvitationUrl }) => {
|
|
|
430
510
|
};
|
|
431
511
|
|
|
432
512
|
// packages/apps/patterns/react-ui/src/components/PanelSeparator/PanelSeparator.tsx
|
|
433
|
-
import
|
|
434
|
-
import { mx as
|
|
435
|
-
function
|
|
436
|
-
|
|
513
|
+
import React12 from "react";
|
|
514
|
+
import { mx as mx7 } from "@dxos/react-components";
|
|
515
|
+
function _extends7() {
|
|
516
|
+
_extends7 = Object.assign || function(target) {
|
|
437
517
|
for (var i = 1; i < arguments.length; i++) {
|
|
438
518
|
var source = arguments[i];
|
|
439
519
|
for (var key in source) {
|
|
@@ -444,22 +524,22 @@ function _extends6() {
|
|
|
444
524
|
}
|
|
445
525
|
return target;
|
|
446
526
|
};
|
|
447
|
-
return
|
|
527
|
+
return _extends7.apply(this, arguments);
|
|
448
528
|
}
|
|
449
529
|
var PanelSeparator = ({ className, ...props }) => {
|
|
450
|
-
return /* @__PURE__ */
|
|
530
|
+
return /* @__PURE__ */ React12.createElement("span", _extends7({
|
|
451
531
|
role: "none"
|
|
452
532
|
}, props, {
|
|
453
|
-
className:
|
|
533
|
+
className: mx7("block bs-px mlb-1 bg-neutral-800/10 dark:bg-neutral-200/10", className)
|
|
454
534
|
}));
|
|
455
535
|
};
|
|
456
536
|
|
|
457
537
|
// packages/apps/patterns/react-ui/src/components/SpaceList/SpaceListItem.tsx
|
|
458
|
-
import
|
|
459
|
-
import { Avatar as Avatar2, mx as
|
|
538
|
+
import React13, { forwardRef } from "react";
|
|
539
|
+
import { Avatar as Avatar2, mx as mx8 } from "@dxos/react-components";
|
|
460
540
|
import { humanize } from "@dxos/util";
|
|
461
|
-
function
|
|
462
|
-
|
|
541
|
+
function _extends8() {
|
|
542
|
+
_extends8 = Object.assign || function(target) {
|
|
463
543
|
for (var i = 1; i < arguments.length; i++) {
|
|
464
544
|
var source = arguments[i];
|
|
465
545
|
for (var key in source) {
|
|
@@ -470,20 +550,20 @@ function _extends7() {
|
|
|
470
550
|
}
|
|
471
551
|
return target;
|
|
472
552
|
};
|
|
473
|
-
return
|
|
553
|
+
return _extends8.apply(this, arguments);
|
|
474
554
|
}
|
|
475
555
|
var SpaceListItem = /* @__PURE__ */ forwardRef(({ space, onClick }, ref) => {
|
|
476
556
|
var _a;
|
|
477
|
-
return /* @__PURE__ */
|
|
478
|
-
className:
|
|
557
|
+
return /* @__PURE__ */ React13.createElement("li", {
|
|
558
|
+
className: mx8("flex gap-2 items-center mbe-2", onClick && "cursor-pointer"),
|
|
479
559
|
onClick: () => onClick == null ? void 0 : onClick(),
|
|
480
560
|
ref,
|
|
481
561
|
"data-testid": "space-list-item"
|
|
482
|
-
}, /* @__PURE__ */
|
|
562
|
+
}, /* @__PURE__ */ React13.createElement(Avatar2, _extends8({}, {
|
|
483
563
|
variant: "circle",
|
|
484
564
|
size: 9,
|
|
485
565
|
fallbackValue: space.key.toHex(),
|
|
486
|
-
label: /* @__PURE__ */
|
|
566
|
+
label: /* @__PURE__ */ React13.createElement("p", {
|
|
487
567
|
className: "text-sm truncate"
|
|
488
568
|
}, (_a = space.properties.name) != null ? _a : humanize(space.key)),
|
|
489
569
|
slots: {
|
|
@@ -498,14 +578,14 @@ var SpaceListItem = /* @__PURE__ */ forwardRef(({ space, onClick }, ref) => {
|
|
|
498
578
|
});
|
|
499
579
|
|
|
500
580
|
// packages/apps/patterns/react-ui/src/composites/IdentityPopover/IdentityPopover.tsx
|
|
501
|
-
import
|
|
502
|
-
import { Avatar as Avatar5, mx as
|
|
581
|
+
import React31 from "react";
|
|
582
|
+
import { Avatar as Avatar5, mx as mx23 } from "@dxos/react-components";
|
|
503
583
|
|
|
504
584
|
// packages/apps/patterns/react-ui/src/layouts/PanelPopover/PanelPopover.tsx
|
|
505
|
-
import
|
|
506
|
-
import { mx as
|
|
507
|
-
function
|
|
508
|
-
|
|
585
|
+
import React14 from "react";
|
|
586
|
+
import { mx as mx9, Popover } from "@dxos/react-components";
|
|
587
|
+
function _extends9() {
|
|
588
|
+
_extends9 = Object.assign || function(target) {
|
|
509
589
|
for (var i = 1; i < arguments.length; i++) {
|
|
510
590
|
var source = arguments[i];
|
|
511
591
|
for (var key in source) {
|
|
@@ -516,25 +596,25 @@ function _extends8() {
|
|
|
516
596
|
}
|
|
517
597
|
return target;
|
|
518
598
|
};
|
|
519
|
-
return
|
|
599
|
+
return _extends9.apply(this, arguments);
|
|
520
600
|
}
|
|
521
601
|
var PanelPopover = ({ slots, children, ...popoverProps }) => {
|
|
522
602
|
var _a, _b, _c;
|
|
523
|
-
return /* @__PURE__ */
|
|
603
|
+
return /* @__PURE__ */ React14.createElement(Popover, _extends9({
|
|
524
604
|
slots: {
|
|
525
605
|
arrow: {
|
|
526
606
|
...slots == null ? void 0 : slots.arrow,
|
|
527
|
-
className:
|
|
607
|
+
className: mx9(defaultArrow, (_a = slots == null ? void 0 : slots.arrow) == null ? void 0 : _a.className)
|
|
528
608
|
},
|
|
529
609
|
content: {
|
|
530
610
|
collisionPadding: 8,
|
|
531
611
|
sideOffset: 4,
|
|
532
612
|
...slots == null ? void 0 : slots.content,
|
|
533
|
-
className:
|
|
613
|
+
className: mx9(defaultSurface, (_b = slots == null ? void 0 : slots.content) == null ? void 0 : _b.className)
|
|
534
614
|
},
|
|
535
615
|
trigger: {
|
|
536
616
|
...slots == null ? void 0 : slots.trigger,
|
|
537
|
-
className:
|
|
617
|
+
className: mx9("", (_c = slots == null ? void 0 : slots.trigger) == null ? void 0 : _c.className)
|
|
538
618
|
},
|
|
539
619
|
...slots
|
|
540
620
|
}
|
|
@@ -543,10 +623,10 @@ var PanelPopover = ({ slots, children, ...popoverProps }) => {
|
|
|
543
623
|
|
|
544
624
|
// packages/apps/patterns/react-ui/src/layouts/PanelSidebar/PanelSidebar.tsx
|
|
545
625
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
546
|
-
import
|
|
547
|
-
import { defaultOverlay as defaultOverlay2, mx as
|
|
548
|
-
function
|
|
549
|
-
|
|
626
|
+
import React15, { createContext as createContext2, useCallback as useCallback4, useContext as useContext2, useState as useState2 } from "react";
|
|
627
|
+
import { defaultOverlay as defaultOverlay2, mx as mx10, useMediaQuery, useTranslation as useTranslation5 } from "@dxos/react-components";
|
|
628
|
+
function _extends10() {
|
|
629
|
+
_extends10 = Object.assign || function(target) {
|
|
550
630
|
for (var i = 1; i < arguments.length; i++) {
|
|
551
631
|
var source = arguments[i];
|
|
552
632
|
for (var key in source) {
|
|
@@ -557,16 +637,16 @@ function _extends9() {
|
|
|
557
637
|
}
|
|
558
638
|
return target;
|
|
559
639
|
};
|
|
560
|
-
return
|
|
640
|
+
return _extends10.apply(this, arguments);
|
|
561
641
|
}
|
|
562
|
-
var PanelSidebarContext = /* @__PURE__ */
|
|
642
|
+
var PanelSidebarContext = /* @__PURE__ */ createContext2({
|
|
563
643
|
displayState: "hide",
|
|
564
644
|
setDisplayState: () => {
|
|
565
645
|
}
|
|
566
646
|
});
|
|
567
647
|
var useTogglePanelSidebar = () => {
|
|
568
|
-
const { displayState, setDisplayState } =
|
|
569
|
-
return
|
|
648
|
+
const { displayState, setDisplayState } = useContext2(PanelSidebarContext);
|
|
649
|
+
return useCallback4(() => {
|
|
570
650
|
setDisplayState(displayState === "hide" ? "show" : "hide");
|
|
571
651
|
}, [
|
|
572
652
|
displayState
|
|
@@ -574,14 +654,14 @@ var useTogglePanelSidebar = () => {
|
|
|
574
654
|
};
|
|
575
655
|
var PanelSidebarProvider = ({ children, slots }) => {
|
|
576
656
|
var _a, _b, _c;
|
|
577
|
-
const { t } =
|
|
657
|
+
const { t } = useTranslation5("os");
|
|
578
658
|
const [isLg] = useMediaQuery("lg", {
|
|
579
659
|
ssr: false
|
|
580
660
|
});
|
|
581
|
-
const [displayState, setInternalDisplayState] =
|
|
661
|
+
const [displayState, setInternalDisplayState] = useState2(isLg ? "show" : "hide");
|
|
582
662
|
const isOpen = displayState === "show";
|
|
583
|
-
const [transitionShow, setTransitionShow] =
|
|
584
|
-
const [domShow, setDomShow] =
|
|
663
|
+
const [transitionShow, setTransitionShow] = useState2(isOpen);
|
|
664
|
+
const [domShow, setDomShow] = useState2(isOpen);
|
|
585
665
|
const internalHide = () => {
|
|
586
666
|
setTransitionShow(false);
|
|
587
667
|
setInternalDisplayState("hide");
|
|
@@ -597,37 +677,37 @@ var PanelSidebarProvider = ({ children, slots }) => {
|
|
|
597
677
|
}, 0);
|
|
598
678
|
};
|
|
599
679
|
const setDisplayState = (displayState2) => displayState2 === "show" ? internalShow() : internalHide();
|
|
600
|
-
return /* @__PURE__ */
|
|
680
|
+
return /* @__PURE__ */ React15.createElement(PanelSidebarContext.Provider, {
|
|
601
681
|
value: {
|
|
602
682
|
setDisplayState,
|
|
603
683
|
displayState
|
|
604
684
|
}
|
|
605
|
-
}, /* @__PURE__ */
|
|
685
|
+
}, /* @__PURE__ */ React15.createElement(DialogPrimitive.Root, {
|
|
606
686
|
open: domShow,
|
|
607
687
|
modal: !isLg
|
|
608
|
-
}, /* @__PURE__ */
|
|
688
|
+
}, /* @__PURE__ */ React15.createElement(DialogPrimitive.Content, _extends10({
|
|
609
689
|
onOpenAutoFocus: (event) => isLg && event.preventDefault(),
|
|
610
690
|
onCloseAutoFocus: (event) => isLg && event.preventDefault()
|
|
611
691
|
}, slots == null ? void 0 : slots.content, {
|
|
612
|
-
className:
|
|
613
|
-
}), /* @__PURE__ */
|
|
692
|
+
className: mx10("fixed block-start-0 block-end-0 is-sidebar z-30 overscroll-contain overflow-x-hidden overflow-y-auto", "transition-[inset-inline-start,inset-inline-end] duration-200 ease-in-out", transitionShow ? "inline-start-0" : "-inline-start-sidebar", (_a = slots == null ? void 0 : slots.content) == null ? void 0 : _a.className)
|
|
693
|
+
}), /* @__PURE__ */ React15.createElement(DialogPrimitive.Title, {
|
|
614
694
|
className: "sr-only"
|
|
615
|
-
}, t("sidebar label")), (_b = slots == null ? void 0 : slots.content) == null ? void 0 : _b.children), !isLg && /* @__PURE__ */
|
|
616
|
-
className:
|
|
695
|
+
}, t("sidebar label")), (_b = slots == null ? void 0 : slots.content) == null ? void 0 : _b.children), !isLg && /* @__PURE__ */ React15.createElement(DialogPrimitive.Overlay, {
|
|
696
|
+
className: mx10(defaultOverlay2, "transition-opacity duration-200 ease-in-out", transitionShow ? "opacity-100" : "opacity-0"),
|
|
617
697
|
onClick: internalHide
|
|
618
|
-
}), /* @__PURE__ */
|
|
698
|
+
}), /* @__PURE__ */ React15.createElement("div", _extends10({
|
|
619
699
|
role: "none"
|
|
620
700
|
}, slots == null ? void 0 : slots.main, {
|
|
621
|
-
className:
|
|
701
|
+
className: mx10("transition-[padding-inline-start] duration-200 ease-in-out", isLg && isOpen ? "pis-sidebar" : "pis-0", (_c = slots == null ? void 0 : slots.main) == null ? void 0 : _c.className)
|
|
622
702
|
}), children)));
|
|
623
703
|
};
|
|
624
704
|
|
|
625
705
|
// packages/apps/patterns/react-ui/src/layouts/PanelAlertDialog/PanelAlertDialog.tsx
|
|
626
706
|
import * as AlertDialog from "@radix-ui/react-alert-dialog";
|
|
627
|
-
import
|
|
628
|
-
import { mx as
|
|
629
|
-
function
|
|
630
|
-
|
|
707
|
+
import React16 from "react";
|
|
708
|
+
import { mx as mx11 } from "@dxos/react-components";
|
|
709
|
+
function _extends11() {
|
|
710
|
+
_extends11 = Object.assign || function(target) {
|
|
631
711
|
for (var i = 1; i < arguments.length; i++) {
|
|
632
712
|
var source = arguments[i];
|
|
633
713
|
for (var key in source) {
|
|
@@ -638,28 +718,28 @@ function _extends10() {
|
|
|
638
718
|
}
|
|
639
719
|
return target;
|
|
640
720
|
};
|
|
641
|
-
return
|
|
721
|
+
return _extends11.apply(this, arguments);
|
|
642
722
|
}
|
|
643
723
|
var PanelAlertDialog = ({ titleId, slots = {}, children }) => {
|
|
644
724
|
var _a, _b;
|
|
645
|
-
return /* @__PURE__ */
|
|
725
|
+
return /* @__PURE__ */ React16.createElement(AlertDialog.Root, _extends11({
|
|
646
726
|
defaultOpen: true
|
|
647
|
-
}, slots.root), slots.trigger && /* @__PURE__ */
|
|
648
|
-
className:
|
|
649
|
-
}), /* @__PURE__ */
|
|
727
|
+
}, slots.root), slots.trigger && /* @__PURE__ */ React16.createElement(AlertDialog.Trigger, _extends11({}, slots.trigger)), /* @__PURE__ */ React16.createElement(AlertDialog.Overlay, _extends11({}, slots.overlay, {
|
|
728
|
+
className: mx11(defaultOverlay, "z-40", (_a = slots.overlay) == null ? void 0 : _a.className)
|
|
729
|
+
}), /* @__PURE__ */ React16.createElement(AlertDialog.Content, _extends11({
|
|
650
730
|
onEscapeKeyDown: (event) => event.preventDefault()
|
|
651
731
|
}, slots.content, {
|
|
652
732
|
"aria-labelledby": titleId,
|
|
653
|
-
className:
|
|
733
|
+
className: mx11(defaultDialogContent, (_b = slots.content) == null ? void 0 : _b.className)
|
|
654
734
|
}), children)));
|
|
655
735
|
};
|
|
656
736
|
|
|
657
737
|
// packages/apps/patterns/react-ui/src/layouts/PanelDialog/PanelDialog.tsx
|
|
658
738
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
659
|
-
import
|
|
660
|
-
import { mx as
|
|
661
|
-
function
|
|
662
|
-
|
|
739
|
+
import React17 from "react";
|
|
740
|
+
import { mx as mx12 } from "@dxos/react-components";
|
|
741
|
+
function _extends12() {
|
|
742
|
+
_extends12 = Object.assign || function(target) {
|
|
663
743
|
for (var i = 1; i < arguments.length; i++) {
|
|
664
744
|
var source = arguments[i];
|
|
665
745
|
for (var key in source) {
|
|
@@ -670,30 +750,30 @@ function _extends11() {
|
|
|
670
750
|
}
|
|
671
751
|
return target;
|
|
672
752
|
};
|
|
673
|
-
return
|
|
753
|
+
return _extends12.apply(this, arguments);
|
|
674
754
|
}
|
|
675
755
|
var PanelDialog = ({ titleId, slots = {}, children }) => {
|
|
676
756
|
var _a, _b;
|
|
677
|
-
return /* @__PURE__ */
|
|
757
|
+
return /* @__PURE__ */ React17.createElement(Dialog.Root, _extends12({
|
|
678
758
|
defaultOpen: true
|
|
679
|
-
}, slots.root), slots.trigger && /* @__PURE__ */
|
|
680
|
-
className:
|
|
681
|
-
}), /* @__PURE__ */
|
|
759
|
+
}, slots.root), slots.trigger && /* @__PURE__ */ React17.createElement(Dialog.Trigger, _extends12({}, slots.trigger)), /* @__PURE__ */ React17.createElement(Dialog.Overlay, _extends12({}, slots.overlay, {
|
|
760
|
+
className: mx12(defaultOverlay, "z-40", (_a = slots.overlay) == null ? void 0 : _a.className)
|
|
761
|
+
}), /* @__PURE__ */ React17.createElement(Dialog.Content, _extends12({
|
|
682
762
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
683
763
|
onCloseAutoFocus: (event) => event.preventDefault()
|
|
684
764
|
}, slots.content, {
|
|
685
765
|
"aria-labelledby": titleId,
|
|
686
|
-
className:
|
|
766
|
+
className: mx12(defaultDialogContent, (_b = slots.content) == null ? void 0 : _b.className)
|
|
687
767
|
}), children)));
|
|
688
768
|
};
|
|
689
769
|
|
|
690
770
|
// packages/apps/patterns/react-ui/src/panels/DevicesPanel/DevicesPanel.tsx
|
|
691
771
|
import { UserPlus, X as X2 } from "@phosphor-icons/react";
|
|
692
|
-
import
|
|
772
|
+
import React18, { cloneElement, useReducer } from "react";
|
|
693
773
|
import { useClient as useClient2, useDevices, useHaloInvitations, useIdentity } from "@dxos/react-client";
|
|
694
|
-
import { Button as
|
|
695
|
-
function
|
|
696
|
-
|
|
774
|
+
import { Button as Button3, DensityProvider as DensityProvider2, getSize as getSize5, mx as mx13, TooltipContent, TooltipRoot, TooltipTrigger, useTranslation as useTranslation6 } from "@dxos/react-components";
|
|
775
|
+
function _extends13() {
|
|
776
|
+
_extends13 = Object.assign || function(target) {
|
|
697
777
|
for (var i = 1; i < arguments.length; i++) {
|
|
698
778
|
var source = arguments[i];
|
|
699
779
|
for (var key in source) {
|
|
@@ -704,11 +784,11 @@ function _extends12() {
|
|
|
704
784
|
}
|
|
705
785
|
return target;
|
|
706
786
|
};
|
|
707
|
-
return
|
|
787
|
+
return _extends13.apply(this, arguments);
|
|
708
788
|
}
|
|
709
789
|
var DeviceListView = ({ createInvitationUrl, titleId, onDone, doneActionParent }) => {
|
|
710
790
|
var _a;
|
|
711
|
-
const { t } =
|
|
791
|
+
const { t } = useTranslation6("os");
|
|
712
792
|
const client = useClient2();
|
|
713
793
|
const identity = useIdentity();
|
|
714
794
|
const devices = useDevices();
|
|
@@ -717,42 +797,42 @@ var DeviceListView = ({ createInvitationUrl, titleId, onDone, doneActionParent }
|
|
|
717
797
|
if (!identity) {
|
|
718
798
|
return null;
|
|
719
799
|
}
|
|
720
|
-
const doneButton = /* @__PURE__ */
|
|
800
|
+
const doneButton = /* @__PURE__ */ React18.createElement(Button3, {
|
|
721
801
|
variant: "ghost",
|
|
722
802
|
onClick: () => onDone == null ? void 0 : onDone(),
|
|
723
803
|
"data-testid": "show-all-spaces"
|
|
724
|
-
}, /* @__PURE__ */
|
|
725
|
-
className:
|
|
804
|
+
}, /* @__PURE__ */ React18.createElement(X2, {
|
|
805
|
+
className: getSize5(4),
|
|
726
806
|
weight: "bold"
|
|
727
807
|
}));
|
|
728
|
-
return /* @__PURE__ */
|
|
808
|
+
return /* @__PURE__ */ React18.createElement("div", {
|
|
729
809
|
role: "none",
|
|
730
810
|
className: "flex flex-col"
|
|
731
|
-
}, /* @__PURE__ */
|
|
811
|
+
}, /* @__PURE__ */ React18.createElement("div", {
|
|
732
812
|
role: "none",
|
|
733
|
-
className:
|
|
734
|
-
}, /* @__PURE__ */
|
|
813
|
+
className: mx13(subduedSurface, "rounded-bs-md flex items-center p-2 gap-2")
|
|
814
|
+
}, /* @__PURE__ */ React18.createElement("h2", {
|
|
735
815
|
id: titleId,
|
|
736
|
-
className:
|
|
737
|
-
}, displayName != null ? displayName : identity.identityKey.truncate()), /* @__PURE__ */
|
|
816
|
+
className: mx13("grow font-system-medium", !displayName && "font-mono")
|
|
817
|
+
}, displayName != null ? displayName : identity.identityKey.truncate()), /* @__PURE__ */ React18.createElement(TooltipRoot, null, /* @__PURE__ */ React18.createElement(TooltipContent, {
|
|
738
818
|
className: "z-50"
|
|
739
|
-
}, t("close label")), /* @__PURE__ */
|
|
819
|
+
}, t("close label")), /* @__PURE__ */ React18.createElement(TooltipTrigger, {
|
|
740
820
|
asChild: true
|
|
741
|
-
}, doneActionParent ? /* @__PURE__ */ cloneElement(doneActionParent, {}, doneButton) : doneButton))), /* @__PURE__ */
|
|
821
|
+
}, doneActionParent ? /* @__PURE__ */ cloneElement(doneActionParent, {}, doneButton) : doneButton))), /* @__PURE__ */ React18.createElement("div", {
|
|
742
822
|
role: "region",
|
|
743
|
-
className:
|
|
744
|
-
}, /* @__PURE__ */
|
|
823
|
+
className: mx13(defaultSurface, "rounded-be-md p-2")
|
|
824
|
+
}, /* @__PURE__ */ React18.createElement(InvitationList, {
|
|
745
825
|
invitations,
|
|
746
826
|
onClickRemove: ({ invitation }) => invitation && client.halo.removeInvitation(invitation.invitationId),
|
|
747
827
|
createInvitationUrl
|
|
748
|
-
}), /* @__PURE__ */
|
|
828
|
+
}), /* @__PURE__ */ React18.createElement(Button3, {
|
|
749
829
|
className: "is-full flex gap-2 mbs-2",
|
|
750
830
|
onClick: () => client.halo.createInvitation(),
|
|
751
831
|
"data-testid": "devices-panel.create-invitation"
|
|
752
|
-
}, /* @__PURE__ */
|
|
753
|
-
className:
|
|
832
|
+
}, /* @__PURE__ */ React18.createElement("span", null, t("create device invitation label")), /* @__PURE__ */ React18.createElement(UserPlus, {
|
|
833
|
+
className: getSize5(4),
|
|
754
834
|
weight: "bold"
|
|
755
|
-
})), /* @__PURE__ */
|
|
835
|
+
})), /* @__PURE__ */ React18.createElement(PanelSeparator, null), /* @__PURE__ */ React18.createElement(DeviceList, {
|
|
756
836
|
devices
|
|
757
837
|
})));
|
|
758
838
|
};
|
|
@@ -769,56 +849,58 @@ var DevicesPanel = (props) => {
|
|
|
769
849
|
const [panelState] = useReducer(reducer, {
|
|
770
850
|
activeView: "device list"
|
|
771
851
|
});
|
|
772
|
-
return /* @__PURE__ */
|
|
852
|
+
return /* @__PURE__ */ React18.createElement(DensityProvider2, {
|
|
773
853
|
density: "fine"
|
|
774
|
-
}, panelState.activeView === "device list" ? /* @__PURE__ */
|
|
854
|
+
}, panelState.activeView === "device list" ? /* @__PURE__ */ React18.createElement(DeviceListView, _extends13({}, props)) : null);
|
|
775
855
|
};
|
|
776
856
|
|
|
777
857
|
// packages/apps/patterns/react-ui/src/panels/IdentityPanel/IdentityPanel.tsx
|
|
778
|
-
import
|
|
858
|
+
import React19 from "react";
|
|
779
859
|
import { useClient as useClient3 } from "@dxos/react-client";
|
|
780
|
-
import { Avatar as Avatar3, Button as
|
|
860
|
+
import { Avatar as Avatar3, Button as Button4, DensityProvider as DensityProvider3, ThemeContext, useThemeContext, useTranslation as useTranslation7 } from "@dxos/react-components";
|
|
781
861
|
var IdentityPanel = ({ identity, onClickManageProfile }) => {
|
|
782
862
|
var _a, _b;
|
|
783
|
-
const { t } =
|
|
863
|
+
const { t } = useTranslation7("os");
|
|
784
864
|
const client = useClient3();
|
|
865
|
+
const themeContextValue = useThemeContext();
|
|
785
866
|
const defaultManageProfile = () => {
|
|
786
867
|
const remoteSource = new URL((client == null ? void 0 : client.config.get("runtime.client.remoteSource")) || "https://halo.dxos.org");
|
|
787
868
|
const tab = window.open(remoteSource.origin, "_blank");
|
|
788
869
|
tab == null ? void 0 : tab.focus();
|
|
789
870
|
};
|
|
790
|
-
return /* @__PURE__ */
|
|
871
|
+
return /* @__PURE__ */ React19.createElement(ThemeContext.Provider, {
|
|
791
872
|
value: {
|
|
873
|
+
...themeContextValue,
|
|
792
874
|
themeVariant: "os"
|
|
793
875
|
}
|
|
794
|
-
}, /* @__PURE__ */
|
|
876
|
+
}, /* @__PURE__ */ React19.createElement(DensityProvider3, {
|
|
795
877
|
density: "fine"
|
|
796
|
-
}, /* @__PURE__ */
|
|
878
|
+
}, /* @__PURE__ */ React19.createElement("div", {
|
|
797
879
|
className: "flex flex-col gap-2 justify-center items-center"
|
|
798
|
-
}, /* @__PURE__ */
|
|
880
|
+
}, /* @__PURE__ */ React19.createElement(Avatar3, {
|
|
799
881
|
size: 16,
|
|
800
882
|
variant: "circle",
|
|
801
883
|
fallbackValue: identity.identityKey.toHex(),
|
|
802
884
|
label: (_b = (_a = identity.profile) == null ? void 0 : _a.displayName) != null ? _b : ""
|
|
803
|
-
}), /* @__PURE__ */
|
|
885
|
+
}), /* @__PURE__ */ React19.createElement(Button4, {
|
|
804
886
|
onClick: onClickManageProfile != null ? onClickManageProfile : defaultManageProfile,
|
|
805
887
|
className: "is-full"
|
|
806
888
|
}, t("manage profile label")))));
|
|
807
889
|
};
|
|
808
890
|
|
|
809
891
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinPanel.tsx
|
|
810
|
-
import
|
|
892
|
+
import React29, { useEffect as useEffect2 } from "react";
|
|
811
893
|
import { log as log2 } from "@dxos/log";
|
|
812
894
|
import { useClient as useClient5, useIdentity as useIdentity2 } from "@dxos/react-client";
|
|
813
|
-
import { DensityProvider as DensityProvider4, useId as useId4 } from "@dxos/react-components";
|
|
895
|
+
import { DensityProvider as DensityProvider4, useId as useId4, useThemeContext as useThemeContext2 } from "@dxos/react-components";
|
|
814
896
|
|
|
815
897
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinHeading.tsx
|
|
816
898
|
import { X as X3 } from "@phosphor-icons/react";
|
|
817
|
-
import
|
|
899
|
+
import React20, { cloneElement as cloneElement2, forwardRef as forwardRef2 } from "react";
|
|
818
900
|
import { useSpace as useSpace2 } from "@dxos/react-client";
|
|
819
|
-
import { Button as
|
|
820
|
-
function
|
|
821
|
-
|
|
901
|
+
import { Button as Button5, defaultDescription as defaultDescription2, getSize as getSize6, Heading, mx as mx14, useId as useId2, useTranslation as useTranslation8 } from "@dxos/react-components";
|
|
902
|
+
function _extends14() {
|
|
903
|
+
_extends14 = Object.assign || function(target) {
|
|
822
904
|
for (var i = 1; i < arguments.length; i++) {
|
|
823
905
|
var source = arguments[i];
|
|
824
906
|
for (var key in source) {
|
|
@@ -829,51 +911,49 @@ function _extends13() {
|
|
|
829
911
|
}
|
|
830
912
|
return target;
|
|
831
913
|
};
|
|
832
|
-
return
|
|
914
|
+
return _extends14.apply(this, arguments);
|
|
833
915
|
}
|
|
834
916
|
var JoinHeading = /* @__PURE__ */ forwardRef2(({ mode, titleId, joinState, onExit, exitActionParent, preventExit }, ref) => {
|
|
835
917
|
var _a, _b;
|
|
836
|
-
const { t } =
|
|
918
|
+
const { t } = useTranslation8("os");
|
|
837
919
|
const space = useSpace2((_a = joinState == null ? void 0 : joinState.context.space.invitation) == null ? void 0 : _a.spaceKey);
|
|
838
920
|
const name = space == null ? void 0 : space.properties.name;
|
|
839
921
|
const nameId = useId2(mode === "halo-only" ? "identityDisplayName" : "spaceDisplayName");
|
|
840
|
-
const
|
|
841
|
-
const
|
|
842
|
-
const exitButton = /* @__PURE__ */ React17.createElement(Button4, _extends13({
|
|
922
|
+
const invitationId = (_b = joinState == null ? void 0 : joinState.context[mode === "halo-only" ? "halo" : "space"].invitation) == null ? void 0 : _b.invitationId;
|
|
923
|
+
const exitButton = /* @__PURE__ */ React20.createElement(Button5, _extends14({
|
|
843
924
|
variant: "ghost"
|
|
844
925
|
}, onExit && {
|
|
845
926
|
onClick: onExit
|
|
846
927
|
}, {
|
|
847
|
-
className:
|
|
928
|
+
className: mx14(defaultDescription2, "plb-0 pli-2 absolute block-start-1.5 inline-end-2 z-[1]"),
|
|
848
929
|
"data-testid": "join-exit"
|
|
849
|
-
}), /* @__PURE__ */
|
|
930
|
+
}), /* @__PURE__ */ React20.createElement(X3, {
|
|
850
931
|
weight: "bold",
|
|
851
|
-
className:
|
|
852
|
-
}), /* @__PURE__ */
|
|
932
|
+
className: getSize6(4)
|
|
933
|
+
}), /* @__PURE__ */ React20.createElement("span", {
|
|
853
934
|
className: "sr-only"
|
|
854
935
|
}, t("exit label")));
|
|
855
|
-
return /* @__PURE__ */
|
|
936
|
+
return /* @__PURE__ */ React20.createElement("div", {
|
|
856
937
|
role: "none",
|
|
857
|
-
className:
|
|
938
|
+
className: mx14(defaultSurface, "pbs-3 pbe-1 rounded-bs-md relative"),
|
|
858
939
|
ref
|
|
859
|
-
}, !preventExit && mode !== "halo-only" && (exitActionParent ? /* @__PURE__ */ cloneElement2(exitActionParent, {}, exitButton) : exitButton), /* @__PURE__ */
|
|
940
|
+
}, !preventExit && mode !== "halo-only" && (exitActionParent ? /* @__PURE__ */ cloneElement2(exitActionParent, {}, exitButton) : exitButton), /* @__PURE__ */ React20.createElement(Heading, {
|
|
860
941
|
level: 1,
|
|
861
|
-
className:
|
|
942
|
+
className: mx14(defaultDescription2, "font-body font-system-normal text-center text-sm grow pbe-2", mode === "halo-only" && (preventExit ? "sr-only" : "opacity-0")),
|
|
862
943
|
id: titleId
|
|
863
|
-
}, t(mode === "halo-only" ? "selecting identity heading" : "joining space heading")), /* @__PURE__ */
|
|
944
|
+
}, t(mode === "halo-only" ? "selecting identity heading" : "joining space heading")), /* @__PURE__ */ React20.createElement("div", {
|
|
864
945
|
role: "group",
|
|
865
946
|
className: "flex items-center justify-center gap-2"
|
|
866
|
-
}, /* @__PURE__ */
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
}, invitationEmoji), name && /* @__PURE__ */ React17.createElement("p", {
|
|
947
|
+
}, /* @__PURE__ */ React20.createElement(InvitationEmoji, _extends14({}, {
|
|
948
|
+
invitationId
|
|
949
|
+
})), name && /* @__PURE__ */ React20.createElement("p", {
|
|
870
950
|
id: nameId
|
|
871
951
|
}, name)));
|
|
872
952
|
});
|
|
873
953
|
|
|
874
954
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/joinMachine.ts
|
|
875
955
|
import { useMachine } from "@xstate/react";
|
|
876
|
-
import { useCallback as
|
|
956
|
+
import { useCallback as useCallback5 } from "react";
|
|
877
957
|
import { assign, createMachine } from "xstate";
|
|
878
958
|
import { Invitation as Invitation4, InvitationEncoder } from "@dxos/client";
|
|
879
959
|
import { log } from "@dxos/log";
|
|
@@ -1255,7 +1335,7 @@ var defaultCodeFromUrl = (invitationType, text) => {
|
|
|
1255
1335
|
}
|
|
1256
1336
|
};
|
|
1257
1337
|
var useJoinMachine = (client, options) => {
|
|
1258
|
-
const redeemHaloInvitationCode =
|
|
1338
|
+
const redeemHaloInvitationCode = useCallback5(({ halo }) => {
|
|
1259
1339
|
if (halo.unredeemedCode) {
|
|
1260
1340
|
const invitationObservable = client.halo.acceptInvitation(InvitationEncoder.decode(defaultCodeFromUrl("halo", halo.unredeemedCode)));
|
|
1261
1341
|
return {
|
|
@@ -1269,7 +1349,7 @@ var useJoinMachine = (client, options) => {
|
|
|
1269
1349
|
}, [
|
|
1270
1350
|
client
|
|
1271
1351
|
]);
|
|
1272
|
-
const redeemSpaceInvitationCode =
|
|
1352
|
+
const redeemSpaceInvitationCode = useCallback5(({ space }) => {
|
|
1273
1353
|
if (space.unredeemedCode) {
|
|
1274
1354
|
const invitationObservable = client.acceptInvitation(InvitationEncoder.decode(defaultCodeFromUrl("space", space.unredeemedCode)));
|
|
1275
1355
|
return {
|
|
@@ -1299,17 +1379,17 @@ var useJoinMachine = (client, options) => {
|
|
|
1299
1379
|
|
|
1300
1380
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx
|
|
1301
1381
|
import { CaretRight, Plus, QrCode as QrCode2, Textbox } from "@phosphor-icons/react";
|
|
1302
|
-
import
|
|
1303
|
-
import { CompoundButton, getSize as
|
|
1382
|
+
import React22 from "react";
|
|
1383
|
+
import { CompoundButton, getSize as getSize8, useTranslation as useTranslation10 } from "@dxos/react-components";
|
|
1304
1384
|
|
|
1305
1385
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/ViewState.tsx
|
|
1306
1386
|
import { CheckCircle, HourglassSimple, X as X4 } from "@phosphor-icons/react";
|
|
1307
|
-
import
|
|
1387
|
+
import React21, { useMemo as useMemo2 } from "react";
|
|
1308
1388
|
import { Invitation as Invitation5 } from "@dxos/client";
|
|
1309
1389
|
import { useInvitationStatus as useInvitationStatus2 } from "@dxos/react-client";
|
|
1310
|
-
import { mx as
|
|
1311
|
-
function
|
|
1312
|
-
|
|
1390
|
+
import { mx as mx15, useTranslation as useTranslation9, useId as useId3, getSize as getSize7, strongShimmer } from "@dxos/react-components";
|
|
1391
|
+
function _extends15() {
|
|
1392
|
+
_extends15 = Object.assign || function(target) {
|
|
1313
1393
|
for (var i = 1; i < arguments.length; i++) {
|
|
1314
1394
|
var source = arguments[i];
|
|
1315
1395
|
for (var key in source) {
|
|
@@ -1320,30 +1400,30 @@ function _extends14() {
|
|
|
1320
1400
|
}
|
|
1321
1401
|
return target;
|
|
1322
1402
|
};
|
|
1323
|
-
return
|
|
1403
|
+
return _extends15.apply(this, arguments);
|
|
1324
1404
|
}
|
|
1325
|
-
var stripe =
|
|
1405
|
+
var stripe = mx15("rounded-full grow", getSize7(3));
|
|
1326
1406
|
var ViewStateHeading = ({ children, className, ...props }) => {
|
|
1327
|
-
return /* @__PURE__ */
|
|
1328
|
-
className:
|
|
1407
|
+
return /* @__PURE__ */ React21.createElement("h2", _extends15({}, props, {
|
|
1408
|
+
className: mx15("font-system-normal text-sm mbe-1 mli-1 text-center", className)
|
|
1329
1409
|
}), children);
|
|
1330
1410
|
};
|
|
1331
1411
|
var ViewState = ({ active, children, className, joinSend, joinState, ...props }) => {
|
|
1332
|
-
return /* @__PURE__ */
|
|
1412
|
+
return /* @__PURE__ */ React21.createElement("div", _extends15({
|
|
1333
1413
|
role: "none"
|
|
1334
1414
|
}, props, !active && {
|
|
1335
1415
|
"aria-hidden": true
|
|
1336
1416
|
}, {
|
|
1337
|
-
className:
|
|
1338
|
-
}), /* @__PURE__ */
|
|
1417
|
+
className: mx15("is-[50%] flex flex-col", active ? "order-2" : "order-4", className)
|
|
1418
|
+
}), /* @__PURE__ */ React21.createElement("div", {
|
|
1339
1419
|
role: "region",
|
|
1340
|
-
className:
|
|
1420
|
+
className: mx15(defaultSurface, "rounded-be-md grow shrink-0 flex flex-col gap-1 p-4 pbs-1")
|
|
1341
1421
|
}, children));
|
|
1342
1422
|
};
|
|
1343
1423
|
|
|
1344
1424
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx
|
|
1345
|
-
function
|
|
1346
|
-
|
|
1425
|
+
function _extends16() {
|
|
1426
|
+
_extends16 = Object.assign || function(target) {
|
|
1347
1427
|
for (var i = 1; i < arguments.length; i++) {
|
|
1348
1428
|
var source = arguments[i];
|
|
1349
1429
|
for (var key in source) {
|
|
@@ -1354,16 +1434,16 @@ function _extends15() {
|
|
|
1354
1434
|
}
|
|
1355
1435
|
return target;
|
|
1356
1436
|
};
|
|
1357
|
-
return
|
|
1437
|
+
return _extends16.apply(this, arguments);
|
|
1358
1438
|
}
|
|
1359
1439
|
var AdditionMethodSelector = (viewStateProps) => {
|
|
1360
1440
|
const disabled = !viewStateProps.active;
|
|
1361
1441
|
const { joinSend } = viewStateProps;
|
|
1362
|
-
const { t } =
|
|
1442
|
+
const { t } = useTranslation10("os");
|
|
1363
1443
|
const sharedButtonProps = {
|
|
1364
1444
|
disabled,
|
|
1365
|
-
after: /* @__PURE__ */
|
|
1366
|
-
className:
|
|
1445
|
+
after: /* @__PURE__ */ React22.createElement(CaretRight, {
|
|
1446
|
+
className: getSize8(4),
|
|
1367
1447
|
weight: "bold"
|
|
1368
1448
|
}),
|
|
1369
1449
|
slots: {
|
|
@@ -1372,34 +1452,34 @@ var AdditionMethodSelector = (viewStateProps) => {
|
|
|
1372
1452
|
}
|
|
1373
1453
|
}
|
|
1374
1454
|
};
|
|
1375
|
-
return /* @__PURE__ */
|
|
1455
|
+
return /* @__PURE__ */ React22.createElement(ViewState, _extends16({}, viewStateProps), /* @__PURE__ */ React22.createElement(ViewStateHeading, null, t("addition method selector title")), /* @__PURE__ */ React22.createElement("div", {
|
|
1376
1456
|
role: "none",
|
|
1377
1457
|
className: "flex flex-col gap-1 grow"
|
|
1378
|
-
}, /* @__PURE__ */
|
|
1458
|
+
}, /* @__PURE__ */ React22.createElement(CompoundButton, _extends16({}, sharedButtonProps, {
|
|
1379
1459
|
description: t("create identity description"),
|
|
1380
|
-
before: /* @__PURE__ */
|
|
1381
|
-
className:
|
|
1460
|
+
before: /* @__PURE__ */ React22.createElement(Plus, {
|
|
1461
|
+
className: getSize8(6)
|
|
1382
1462
|
}),
|
|
1383
1463
|
onClick: () => joinSend({
|
|
1384
1464
|
type: "createIdentity"
|
|
1385
1465
|
}),
|
|
1386
1466
|
"data-autofocus": "choosingAuthMethod",
|
|
1387
1467
|
"data-testid": "create-identity"
|
|
1388
|
-
}), t("create identity label")), /* @__PURE__ */
|
|
1468
|
+
}), t("create identity label")), /* @__PURE__ */ React22.createElement(CompoundButton, _extends16({}, sharedButtonProps, {
|
|
1389
1469
|
description: t("join identity description"),
|
|
1390
|
-
before: /* @__PURE__ */
|
|
1391
|
-
className:
|
|
1470
|
+
before: /* @__PURE__ */ React22.createElement(QrCode2, {
|
|
1471
|
+
className: getSize8(6)
|
|
1392
1472
|
}),
|
|
1393
1473
|
onClick: () => joinSend({
|
|
1394
1474
|
type: "acceptHaloInvitation"
|
|
1395
1475
|
}),
|
|
1396
1476
|
"data-testid": "join-identity"
|
|
1397
|
-
}), t("join identity label")), /* @__PURE__ */
|
|
1477
|
+
}), t("join identity label")), /* @__PURE__ */ React22.createElement(CompoundButton, _extends16({}, sharedButtonProps, {
|
|
1398
1478
|
// TODO(mykola): Implement recover.
|
|
1399
1479
|
disabled: true,
|
|
1400
1480
|
description: t("recover identity description"),
|
|
1401
|
-
before: /* @__PURE__ */
|
|
1402
|
-
className:
|
|
1481
|
+
before: /* @__PURE__ */ React22.createElement(Textbox, {
|
|
1482
|
+
className: getSize8(6)
|
|
1403
1483
|
}),
|
|
1404
1484
|
onClick: () => joinSend({
|
|
1405
1485
|
type: "recoverIdentity"
|
|
@@ -1409,11 +1489,11 @@ var AdditionMethodSelector = (viewStateProps) => {
|
|
|
1409
1489
|
};
|
|
1410
1490
|
|
|
1411
1491
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/IdentityAdded.tsx
|
|
1412
|
-
import { CaretLeft, CaretRight as CaretRight2, Check } from "@phosphor-icons/react";
|
|
1413
|
-
import
|
|
1414
|
-
import { Avatar as Avatar4, Button as
|
|
1415
|
-
function
|
|
1416
|
-
|
|
1492
|
+
import { CaretLeft, CaretRight as CaretRight2, Check as Check2 } from "@phosphor-icons/react";
|
|
1493
|
+
import React23, { cloneElement as cloneElement3 } from "react";
|
|
1494
|
+
import { Avatar as Avatar4, Button as Button6, getSize as getSize9, mx as mx16, useTranslation as useTranslation11 } from "@dxos/react-components";
|
|
1495
|
+
function _extends17() {
|
|
1496
|
+
_extends17 = Object.assign || function(target) {
|
|
1417
1497
|
for (var i = 1; i < arguments.length; i++) {
|
|
1418
1498
|
var source = arguments[i];
|
|
1419
1499
|
for (var key in source) {
|
|
@@ -1424,25 +1504,25 @@ function _extends16() {
|
|
|
1424
1504
|
}
|
|
1425
1505
|
return target;
|
|
1426
1506
|
};
|
|
1427
|
-
return
|
|
1507
|
+
return _extends17.apply(this, arguments);
|
|
1428
1508
|
}
|
|
1429
1509
|
var Done = ({ onDone, doneActionParent, active }) => {
|
|
1430
1510
|
const disabled = !active;
|
|
1431
|
-
const { t } =
|
|
1432
|
-
const doneButton = /* @__PURE__ */
|
|
1511
|
+
const { t } = useTranslation11("os");
|
|
1512
|
+
const doneButton = /* @__PURE__ */ React23.createElement(Button6, _extends17({}, onDone && {
|
|
1433
1513
|
onClick: () => onDone(null)
|
|
1434
1514
|
}, {
|
|
1435
1515
|
disabled,
|
|
1436
1516
|
className: "grow flex items-center gap-2 pli-2",
|
|
1437
1517
|
"data-autofocus": "confirmingAddedIdentity",
|
|
1438
1518
|
"data-testid": "identity-added-done"
|
|
1439
|
-
}), /* @__PURE__ */
|
|
1519
|
+
}), /* @__PURE__ */ React23.createElement(CaretLeft, {
|
|
1440
1520
|
weight: "bold",
|
|
1441
|
-
className:
|
|
1442
|
-
}), /* @__PURE__ */
|
|
1521
|
+
className: mx16(getSize9(2), "invisible")
|
|
1522
|
+
}), /* @__PURE__ */ React23.createElement("span", {
|
|
1443
1523
|
className: "grow"
|
|
1444
|
-
}, t("done label")), /* @__PURE__ */
|
|
1445
|
-
className:
|
|
1524
|
+
}, t("done label")), /* @__PURE__ */ React23.createElement(Check2, {
|
|
1525
|
+
className: getSize9(4)
|
|
1446
1526
|
}));
|
|
1447
1527
|
return doneActionParent ? /* @__PURE__ */ cloneElement3(doneActionParent, {}, doneButton) : doneButton;
|
|
1448
1528
|
};
|
|
@@ -1450,24 +1530,24 @@ var IdentityAdded = ({ mode, addedIdentity, onDone, doneActionParent, ...viewSta
|
|
|
1450
1530
|
var _a, _b, _c, _d, _e;
|
|
1451
1531
|
const disabled = !viewStateProps.active;
|
|
1452
1532
|
const { joinSend } = viewStateProps;
|
|
1453
|
-
const { t } =
|
|
1454
|
-
return /* @__PURE__ */
|
|
1533
|
+
const { t } = useTranslation11("os");
|
|
1534
|
+
return /* @__PURE__ */ React23.createElement(ViewState, _extends17({}, viewStateProps), /* @__PURE__ */ React23.createElement(ViewStateHeading, null, t("identity added label")), /* @__PURE__ */ React23.createElement("div", {
|
|
1455
1535
|
role: "none",
|
|
1456
1536
|
className: "grow flex flex-col items-center justify-center text-center gap-2"
|
|
1457
|
-
}, /* @__PURE__ */
|
|
1537
|
+
}, /* @__PURE__ */ React23.createElement(Avatar4, {
|
|
1458
1538
|
size: 20,
|
|
1459
1539
|
fallbackValue: (_a = addedIdentity == null ? void 0 : addedIdentity.identityKey.toHex()) != null ? _a : "",
|
|
1460
|
-
label: /* @__PURE__ */
|
|
1461
|
-
className:
|
|
1540
|
+
label: /* @__PURE__ */ React23.createElement("p", {
|
|
1541
|
+
className: mx16("text-lg", !((_b = addedIdentity == null ? void 0 : addedIdentity.profile) == null ? void 0 : _b.displayName) && "font-mono")
|
|
1462
1542
|
}, (_e = (_d = (_c = addedIdentity == null ? void 0 : addedIdentity.profile) == null ? void 0 : _c.displayName) != null ? _d : addedIdentity == null ? void 0 : addedIdentity.identityKey.truncate()) != null ? _e : "\xA0"),
|
|
1463
1543
|
variant: "circle",
|
|
1464
1544
|
status: "active"
|
|
1465
|
-
})), mode === "halo-only" ? /* @__PURE__ */
|
|
1545
|
+
})), mode === "halo-only" ? /* @__PURE__ */ React23.createElement(Done, _extends17({
|
|
1466
1546
|
onDone,
|
|
1467
1547
|
doneActionParent
|
|
1468
|
-
}, viewStateProps)) : /* @__PURE__ */
|
|
1548
|
+
}, viewStateProps)) : /* @__PURE__ */ React23.createElement("div", {
|
|
1469
1549
|
className: "flex gap-2"
|
|
1470
|
-
}, /* @__PURE__ */
|
|
1550
|
+
}, /* @__PURE__ */ React23.createElement(Button6, {
|
|
1471
1551
|
disabled: disabled || !addedIdentity,
|
|
1472
1552
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1473
1553
|
onClick: () => addedIdentity && joinSend({
|
|
@@ -1475,33 +1555,33 @@ var IdentityAdded = ({ mode, addedIdentity, onDone, doneActionParent, ...viewSta
|
|
|
1475
1555
|
identity: addedIdentity
|
|
1476
1556
|
}),
|
|
1477
1557
|
"data-autofocus": "confirmingAddedIdentity"
|
|
1478
|
-
}, /* @__PURE__ */
|
|
1558
|
+
}, /* @__PURE__ */ React23.createElement(CaretLeft, {
|
|
1479
1559
|
weight: "bold",
|
|
1480
|
-
className:
|
|
1481
|
-
}), /* @__PURE__ */
|
|
1560
|
+
className: mx16(getSize9(2), "invisible")
|
|
1561
|
+
}), /* @__PURE__ */ React23.createElement("span", {
|
|
1482
1562
|
className: "grow"
|
|
1483
|
-
}, t("continue label")), /* @__PURE__ */
|
|
1563
|
+
}, t("continue label")), /* @__PURE__ */ React23.createElement(CaretRight2, {
|
|
1484
1564
|
weight: "bold",
|
|
1485
|
-
className:
|
|
1486
|
-
})), /* @__PURE__ */
|
|
1565
|
+
className: getSize9(4)
|
|
1566
|
+
})), /* @__PURE__ */ React23.createElement(Button6, {
|
|
1487
1567
|
disabled,
|
|
1488
1568
|
onClick: () => joinSend({
|
|
1489
1569
|
type: "deselectAuthMethod"
|
|
1490
1570
|
}),
|
|
1491
1571
|
className: "flex items-center gap-2 pis-2 pie-4"
|
|
1492
|
-
}, /* @__PURE__ */
|
|
1572
|
+
}, /* @__PURE__ */ React23.createElement(CaretLeft, {
|
|
1493
1573
|
weight: "bold",
|
|
1494
|
-
className:
|
|
1495
|
-
}), /* @__PURE__ */
|
|
1574
|
+
className: getSize9(4)
|
|
1575
|
+
}), /* @__PURE__ */ React23.createElement("span", null, t("deselect identity label")))));
|
|
1496
1576
|
};
|
|
1497
1577
|
|
|
1498
1578
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/IdentityInput.tsx
|
|
1499
1579
|
import { CaretLeft as CaretLeft2, CaretRight as CaretRight3 } from "@phosphor-icons/react";
|
|
1500
|
-
import
|
|
1580
|
+
import React24, { useState as useState3 } from "react";
|
|
1501
1581
|
import { useClient as useClient4 } from "@dxos/react-client";
|
|
1502
|
-
import { Button as
|
|
1503
|
-
function
|
|
1504
|
-
|
|
1582
|
+
import { Button as Button7, getSize as getSize10, Input, mx as mx17, useTranslation as useTranslation12 } from "@dxos/react-components";
|
|
1583
|
+
function _extends18() {
|
|
1584
|
+
_extends18 = Object.assign || function(target) {
|
|
1505
1585
|
for (var i = 1; i < arguments.length; i++) {
|
|
1506
1586
|
var source = arguments[i];
|
|
1507
1587
|
for (var key in source) {
|
|
@@ -1512,15 +1592,15 @@ function _extends17() {
|
|
|
1512
1592
|
}
|
|
1513
1593
|
return target;
|
|
1514
1594
|
};
|
|
1515
|
-
return
|
|
1595
|
+
return _extends18.apply(this, arguments);
|
|
1516
1596
|
}
|
|
1517
1597
|
var IdentityInput = ({ method, ...viewStateProps }) => {
|
|
1518
1598
|
const disabled = !viewStateProps.active;
|
|
1519
1599
|
const { joinSend } = viewStateProps;
|
|
1520
|
-
const { t } =
|
|
1521
|
-
const [inputValue, setInputValue] =
|
|
1600
|
+
const { t } = useTranslation12("os");
|
|
1601
|
+
const [inputValue, setInputValue] = useState3("");
|
|
1522
1602
|
const client = useClient4();
|
|
1523
|
-
const [validationMessage, setValidationMessage] =
|
|
1603
|
+
const [validationMessage, setValidationMessage] = useState3("");
|
|
1524
1604
|
const isRecover = method === "recover identity";
|
|
1525
1605
|
const handleNext = () => {
|
|
1526
1606
|
void client.halo.createIdentity({
|
|
@@ -1534,9 +1614,9 @@ var IdentityInput = ({ method, ...viewStateProps }) => {
|
|
|
1534
1614
|
setValidationMessage(t(isRecover ? "failed to recover identity message" : "failed to create identity message"));
|
|
1535
1615
|
});
|
|
1536
1616
|
};
|
|
1537
|
-
return /* @__PURE__ */
|
|
1617
|
+
return /* @__PURE__ */ React24.createElement(ViewState, _extends18({}, viewStateProps), /* @__PURE__ */ React24.createElement(Input, _extends18({
|
|
1538
1618
|
disabled,
|
|
1539
|
-
label: /* @__PURE__ */
|
|
1619
|
+
label: /* @__PURE__ */ React24.createElement(ViewStateHeading, null, t(isRecover ? "recover identity input label" : "new identity input label")),
|
|
1540
1620
|
onChange: ({ target: { value } }) => setInputValue(value),
|
|
1541
1621
|
slots: {
|
|
1542
1622
|
root: {
|
|
@@ -1552,44 +1632,44 @@ var IdentityInput = ({ method, ...viewStateProps }) => {
|
|
|
1552
1632
|
validationMessage
|
|
1553
1633
|
}, {
|
|
1554
1634
|
"data-testid": "identity-input"
|
|
1555
|
-
})), /* @__PURE__ */
|
|
1635
|
+
})), /* @__PURE__ */ React24.createElement("div", {
|
|
1556
1636
|
role: "none",
|
|
1557
1637
|
className: "grow"
|
|
1558
|
-
}), /* @__PURE__ */
|
|
1638
|
+
}), /* @__PURE__ */ React24.createElement("div", {
|
|
1559
1639
|
className: "flex gap-2"
|
|
1560
|
-
}, /* @__PURE__ */
|
|
1640
|
+
}, /* @__PURE__ */ React24.createElement(Button7, {
|
|
1561
1641
|
disabled,
|
|
1562
1642
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1563
1643
|
onClick: handleNext,
|
|
1564
1644
|
"data-testid": `${method === "recover identity" ? "recover" : "create"}-identity-input-continue`
|
|
1565
|
-
}, /* @__PURE__ */
|
|
1645
|
+
}, /* @__PURE__ */ React24.createElement(CaretLeft2, {
|
|
1566
1646
|
weight: "bold",
|
|
1567
|
-
className:
|
|
1568
|
-
}), /* @__PURE__ */
|
|
1647
|
+
className: mx17(getSize10(2), "invisible")
|
|
1648
|
+
}), /* @__PURE__ */ React24.createElement("span", {
|
|
1569
1649
|
className: "grow"
|
|
1570
|
-
}, t("continue label")), /* @__PURE__ */
|
|
1650
|
+
}, t("continue label")), /* @__PURE__ */ React24.createElement(CaretRight3, {
|
|
1571
1651
|
weight: "bold",
|
|
1572
|
-
className:
|
|
1573
|
-
})), /* @__PURE__ */
|
|
1652
|
+
className: getSize10(4)
|
|
1653
|
+
})), /* @__PURE__ */ React24.createElement(Button7, {
|
|
1574
1654
|
disabled,
|
|
1575
1655
|
onClick: () => joinSend({
|
|
1576
1656
|
type: "deselectAuthMethod"
|
|
1577
1657
|
}),
|
|
1578
1658
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1579
1659
|
"data-testid": `${method === "recover identity" ? "recover" : "create"}-identity-input-back`
|
|
1580
|
-
}, /* @__PURE__ */
|
|
1660
|
+
}, /* @__PURE__ */ React24.createElement(CaretLeft2, {
|
|
1581
1661
|
weight: "bold",
|
|
1582
|
-
className:
|
|
1583
|
-
}), /* @__PURE__ */
|
|
1662
|
+
className: getSize10(4)
|
|
1663
|
+
}), /* @__PURE__ */ React24.createElement("span", null, t("back label")))));
|
|
1584
1664
|
};
|
|
1585
1665
|
|
|
1586
1666
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationAccepted.tsx
|
|
1587
|
-
import { CaretLeft as CaretLeft3, Check as
|
|
1588
|
-
import
|
|
1667
|
+
import { CaretLeft as CaretLeft3, Check as Check3 } from "@phosphor-icons/react";
|
|
1668
|
+
import React25, { cloneElement as cloneElement4 } from "react";
|
|
1589
1669
|
import { useInvitationStatus as useInvitationStatus3 } from "@dxos/react-client";
|
|
1590
|
-
import { Button as
|
|
1591
|
-
function
|
|
1592
|
-
|
|
1670
|
+
import { Button as Button8, getSize as getSize11, mx as mx18, useTranslation as useTranslation13 } from "@dxos/react-components";
|
|
1671
|
+
function _extends19() {
|
|
1672
|
+
_extends19 = Object.assign || function(target) {
|
|
1593
1673
|
for (var i = 1; i < arguments.length; i++) {
|
|
1594
1674
|
var source = arguments[i];
|
|
1595
1675
|
for (var key in source) {
|
|
@@ -1600,36 +1680,36 @@ function _extends18() {
|
|
|
1600
1680
|
}
|
|
1601
1681
|
return target;
|
|
1602
1682
|
};
|
|
1603
|
-
return
|
|
1683
|
+
return _extends19.apply(this, arguments);
|
|
1604
1684
|
}
|
|
1605
1685
|
var PureInvitationAcceptedContent = ({ onDone, result, Domain, doneActionParent, active }) => {
|
|
1606
1686
|
const disabled = !active;
|
|
1607
|
-
const { t } =
|
|
1608
|
-
const doneButton = /* @__PURE__ */
|
|
1687
|
+
const { t } = useTranslation13("os");
|
|
1688
|
+
const doneButton = /* @__PURE__ */ React25.createElement(Button8, _extends19({}, onDone && {
|
|
1609
1689
|
onClick: () => onDone(result)
|
|
1610
1690
|
}, {
|
|
1611
1691
|
disabled,
|
|
1612
1692
|
className: "flex items-center gap-2 pli-2",
|
|
1613
1693
|
"data-autofocus": `success${Domain}Invitation finishingJoining${Domain}`,
|
|
1614
1694
|
"data-testid": `${Domain.toLowerCase()}-invitation-accepted-done`
|
|
1615
|
-
}), /* @__PURE__ */
|
|
1695
|
+
}), /* @__PURE__ */ React25.createElement(CaretLeft3, {
|
|
1616
1696
|
weight: "bold",
|
|
1617
|
-
className:
|
|
1618
|
-
}), /* @__PURE__ */
|
|
1697
|
+
className: mx18(getSize11(2), "invisible")
|
|
1698
|
+
}), /* @__PURE__ */ React25.createElement("span", {
|
|
1619
1699
|
className: "grow"
|
|
1620
|
-
}, t("done label")), /* @__PURE__ */
|
|
1621
|
-
className:
|
|
1700
|
+
}, t("done label")), /* @__PURE__ */ React25.createElement(Check3, {
|
|
1701
|
+
className: getSize11(4)
|
|
1622
1702
|
}));
|
|
1623
|
-
return /* @__PURE__ */
|
|
1703
|
+
return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement("p", {
|
|
1624
1704
|
className: "text-center text-sm font-system-normal"
|
|
1625
|
-
}, t("welcome message")), /* @__PURE__ */
|
|
1705
|
+
}, t("welcome message")), /* @__PURE__ */ React25.createElement("div", {
|
|
1626
1706
|
role: "none",
|
|
1627
1707
|
className: "grow"
|
|
1628
1708
|
}), doneActionParent ? /* @__PURE__ */ cloneElement4(doneActionParent, {}, doneButton) : doneButton);
|
|
1629
1709
|
};
|
|
1630
1710
|
var InvitationAcceptedContent = (props) => {
|
|
1631
1711
|
const { result } = useInvitationStatus3(props.activeInvitation);
|
|
1632
|
-
return /* @__PURE__ */
|
|
1712
|
+
return /* @__PURE__ */ React25.createElement(PureInvitationAcceptedContent, _extends19({}, props, {
|
|
1633
1713
|
result
|
|
1634
1714
|
}));
|
|
1635
1715
|
};
|
|
@@ -1637,19 +1717,19 @@ var InvitationAccepted = (props) => {
|
|
|
1637
1717
|
var _a;
|
|
1638
1718
|
const { Domain, doneActionParent: _doneActionParent, onDone: _onDone, ...viewStateProps } = props;
|
|
1639
1719
|
const activeInvitation = (_a = viewStateProps.joinState) == null ? void 0 : _a.context[Domain.toLowerCase()].invitationObservable;
|
|
1640
|
-
return /* @__PURE__ */
|
|
1720
|
+
return /* @__PURE__ */ React25.createElement(ViewState, _extends19({}, viewStateProps), !activeInvitation ? /* @__PURE__ */ React25.createElement(PureInvitationAcceptedContent, _extends19({}, props, {
|
|
1641
1721
|
result: null
|
|
1642
|
-
})) : /* @__PURE__ */
|
|
1722
|
+
})) : /* @__PURE__ */ React25.createElement(InvitationAcceptedContent, _extends19({}, props, {
|
|
1643
1723
|
activeInvitation
|
|
1644
1724
|
})));
|
|
1645
1725
|
};
|
|
1646
1726
|
|
|
1647
1727
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationInput.tsx
|
|
1648
1728
|
import { CaretLeft as CaretLeft4, CaretRight as CaretRight4 } from "@phosphor-icons/react";
|
|
1649
|
-
import
|
|
1650
|
-
import { Button as
|
|
1651
|
-
function
|
|
1652
|
-
|
|
1729
|
+
import React26, { useEffect, useState as useState4 } from "react";
|
|
1730
|
+
import { Button as Button9, getSize as getSize12, Input as Input2, mx as mx19, useTranslation as useTranslation14 } from "@dxos/react-components";
|
|
1731
|
+
function _extends20() {
|
|
1732
|
+
_extends20 = Object.assign || function(target) {
|
|
1653
1733
|
for (var i = 1; i < arguments.length; i++) {
|
|
1654
1734
|
var source = arguments[i];
|
|
1655
1735
|
for (var key in source) {
|
|
@@ -1660,14 +1740,14 @@ function _extends19() {
|
|
|
1660
1740
|
}
|
|
1661
1741
|
return target;
|
|
1662
1742
|
};
|
|
1663
|
-
return
|
|
1743
|
+
return _extends20.apply(this, arguments);
|
|
1664
1744
|
}
|
|
1665
1745
|
var InvitationInput = ({ Domain, ...viewStateProps }) => {
|
|
1666
1746
|
const disabled = !viewStateProps.active;
|
|
1667
1747
|
const { joinSend, joinState } = viewStateProps;
|
|
1668
|
-
const { t } =
|
|
1748
|
+
const { t } = useTranslation14("os");
|
|
1669
1749
|
const contextUnredeemedCode = joinState == null ? void 0 : joinState.context[Domain.toLowerCase()].unredeemedCode;
|
|
1670
|
-
const [inputValue, setInputValue] =
|
|
1750
|
+
const [inputValue, setInputValue] = useState4(contextUnredeemedCode != null ? contextUnredeemedCode : "");
|
|
1671
1751
|
useEffect(() => {
|
|
1672
1752
|
contextUnredeemedCode && setInputValue(contextUnredeemedCode != null ? contextUnredeemedCode : "");
|
|
1673
1753
|
}, [
|
|
@@ -1677,9 +1757,9 @@ var InvitationInput = ({ Domain, ...viewStateProps }) => {
|
|
|
1677
1757
|
type: `set${Domain}InvitationCode`,
|
|
1678
1758
|
code: inputValue
|
|
1679
1759
|
});
|
|
1680
|
-
return /* @__PURE__ */
|
|
1760
|
+
return /* @__PURE__ */ React26.createElement(ViewState, _extends20({}, viewStateProps), /* @__PURE__ */ React26.createElement(Input2, {
|
|
1681
1761
|
disabled,
|
|
1682
|
-
label: /* @__PURE__ */
|
|
1762
|
+
label: /* @__PURE__ */ React26.createElement(ViewStateHeading, null, t("invitation input label")),
|
|
1683
1763
|
value: inputValue,
|
|
1684
1764
|
onChange: ({ target: { value } }) => setInputValue(value),
|
|
1685
1765
|
slots: {
|
|
@@ -1692,44 +1772,44 @@ var InvitationInput = ({ Domain, ...viewStateProps }) => {
|
|
|
1692
1772
|
onKeyUp: ({ key }) => key === "Enter" && handleNext()
|
|
1693
1773
|
}
|
|
1694
1774
|
}
|
|
1695
|
-
}), /* @__PURE__ */
|
|
1775
|
+
}), /* @__PURE__ */ React26.createElement("div", {
|
|
1696
1776
|
role: "none",
|
|
1697
1777
|
className: "grow"
|
|
1698
|
-
}), /* @__PURE__ */
|
|
1778
|
+
}), /* @__PURE__ */ React26.createElement("div", {
|
|
1699
1779
|
className: "flex gap-2"
|
|
1700
|
-
}, /* @__PURE__ */
|
|
1780
|
+
}, /* @__PURE__ */ React26.createElement(Button9, {
|
|
1701
1781
|
disabled,
|
|
1702
1782
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1703
1783
|
onClick: handleNext,
|
|
1704
1784
|
"data-testid": `${Domain.toLowerCase()}-invitation-input-continue`
|
|
1705
|
-
}, /* @__PURE__ */
|
|
1785
|
+
}, /* @__PURE__ */ React26.createElement(CaretLeft4, {
|
|
1706
1786
|
weight: "bold",
|
|
1707
|
-
className:
|
|
1708
|
-
}), /* @__PURE__ */
|
|
1787
|
+
className: mx19(getSize12(2), "invisible")
|
|
1788
|
+
}), /* @__PURE__ */ React26.createElement("span", {
|
|
1709
1789
|
className: "grow"
|
|
1710
|
-
}, t("continue label")), /* @__PURE__ */
|
|
1790
|
+
}, t("continue label")), /* @__PURE__ */ React26.createElement(CaretRight4, {
|
|
1711
1791
|
weight: "bold",
|
|
1712
|
-
className:
|
|
1713
|
-
})), /* @__PURE__ */
|
|
1792
|
+
className: getSize12(4)
|
|
1793
|
+
})), /* @__PURE__ */ React26.createElement(Button9, {
|
|
1714
1794
|
disabled: Domain === "Space",
|
|
1715
1795
|
onClick: () => joinSend({
|
|
1716
1796
|
type: "deselectAuthMethod"
|
|
1717
1797
|
}),
|
|
1718
1798
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1719
1799
|
"data-testid": `${Domain.toLowerCase()}-invitation-input-back`
|
|
1720
|
-
}, /* @__PURE__ */
|
|
1800
|
+
}, /* @__PURE__ */ React26.createElement(CaretLeft4, {
|
|
1721
1801
|
weight: "bold",
|
|
1722
|
-
className:
|
|
1723
|
-
}), /* @__PURE__ */
|
|
1802
|
+
className: getSize12(4)
|
|
1803
|
+
}), /* @__PURE__ */ React26.createElement("span", null, t("back label")))));
|
|
1724
1804
|
};
|
|
1725
1805
|
|
|
1726
1806
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationRescuer.tsx
|
|
1727
1807
|
import { ArrowsClockwise, CaretLeft as CaretLeft5, CaretRight as CaretRight5 } from "@phosphor-icons/react";
|
|
1728
|
-
import
|
|
1808
|
+
import React27 from "react";
|
|
1729
1809
|
import { Invitation as Invitation6 } from "@dxos/client";
|
|
1730
|
-
import { Button as
|
|
1731
|
-
function
|
|
1732
|
-
|
|
1810
|
+
import { Button as Button10, defaultDescription as defaultDescription3, getSize as getSize13, mx as mx20, useTranslation as useTranslation15 } from "@dxos/react-components";
|
|
1811
|
+
function _extends21() {
|
|
1812
|
+
_extends21 = Object.assign || function(target) {
|
|
1733
1813
|
for (var i = 1; i < arguments.length; i++) {
|
|
1734
1814
|
var source = arguments[i];
|
|
1735
1815
|
for (var key in source) {
|
|
@@ -1740,33 +1820,33 @@ function _extends20() {
|
|
|
1740
1820
|
}
|
|
1741
1821
|
return target;
|
|
1742
1822
|
};
|
|
1743
|
-
return
|
|
1823
|
+
return _extends21.apply(this, arguments);
|
|
1744
1824
|
}
|
|
1745
1825
|
var InvitationActions = ({ invitationState, disabled, joinSend, joinState, Domain }) => {
|
|
1746
|
-
const { t } =
|
|
1826
|
+
const { t } = useTranslation15("os");
|
|
1747
1827
|
const invitationType = Domain.toLowerCase();
|
|
1748
1828
|
switch (invitationState) {
|
|
1749
1829
|
case Invitation6.State.CONNECTING:
|
|
1750
|
-
return /* @__PURE__ */
|
|
1830
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(ViewStateHeading, {
|
|
1751
1831
|
className: defaultDescription3
|
|
1752
|
-
}, t("connecting status label")), /* @__PURE__ */
|
|
1832
|
+
}, t("connecting status label")), /* @__PURE__ */ React27.createElement("div", {
|
|
1753
1833
|
role: "none",
|
|
1754
1834
|
className: "grow"
|
|
1755
|
-
}), /* @__PURE__ */
|
|
1835
|
+
}), /* @__PURE__ */ React27.createElement("div", {
|
|
1756
1836
|
className: "flex gap-2"
|
|
1757
|
-
}, /* @__PURE__ */
|
|
1837
|
+
}, /* @__PURE__ */ React27.createElement(Button10, {
|
|
1758
1838
|
disabled: true,
|
|
1759
1839
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1760
1840
|
"data-testid": "next"
|
|
1761
|
-
}, /* @__PURE__ */
|
|
1841
|
+
}, /* @__PURE__ */ React27.createElement(CaretLeft5, {
|
|
1762
1842
|
weight: "bold",
|
|
1763
|
-
className:
|
|
1764
|
-
}), /* @__PURE__ */
|
|
1843
|
+
className: mx20(getSize13(2), "invisible")
|
|
1844
|
+
}), /* @__PURE__ */ React27.createElement("span", {
|
|
1765
1845
|
className: "grow"
|
|
1766
|
-
}, t("next label")), /* @__PURE__ */
|
|
1846
|
+
}, t("next label")), /* @__PURE__ */ React27.createElement(CaretRight5, {
|
|
1767
1847
|
weight: "bold",
|
|
1768
|
-
className:
|
|
1769
|
-
})), /* @__PURE__ */
|
|
1848
|
+
className: getSize13(4)
|
|
1849
|
+
})), /* @__PURE__ */ React27.createElement(Button10, {
|
|
1770
1850
|
disabled,
|
|
1771
1851
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1772
1852
|
onClick: () => {
|
|
@@ -1774,33 +1854,33 @@ var InvitationActions = ({ invitationState, disabled, joinSend, joinState, Domai
|
|
|
1774
1854
|
return (_a = joinState == null ? void 0 : joinState.context[invitationType].invitationObservable) == null ? void 0 : _a.cancel();
|
|
1775
1855
|
},
|
|
1776
1856
|
"data-testid": "invitation-rescuer-cancel"
|
|
1777
|
-
}, /* @__PURE__ */
|
|
1857
|
+
}, /* @__PURE__ */ React27.createElement(CaretLeft5, {
|
|
1778
1858
|
weight: "bold",
|
|
1779
|
-
className:
|
|
1780
|
-
}), /* @__PURE__ */
|
|
1859
|
+
className: getSize13(4)
|
|
1860
|
+
}), /* @__PURE__ */ React27.createElement("span", null, t("cancel label")))));
|
|
1781
1861
|
case Invitation6.State.TIMEOUT:
|
|
1782
1862
|
case Invitation6.State.CANCELLED:
|
|
1783
1863
|
case Invitation6.State.ERROR:
|
|
1784
1864
|
default:
|
|
1785
|
-
return /* @__PURE__ */
|
|
1865
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(ViewStateHeading, {
|
|
1786
1866
|
className: defaultDescription3
|
|
1787
|
-
}, t(invitationState === Invitation6.State.TIMEOUT ? "timeout status label" : invitationState === Invitation6.State.CANCELLED ? "cancelled status label" : "error status label")), /* @__PURE__ */
|
|
1867
|
+
}, t(invitationState === Invitation6.State.TIMEOUT ? "timeout status label" : invitationState === Invitation6.State.CANCELLED ? "cancelled status label" : "error status label")), /* @__PURE__ */ React27.createElement("div", {
|
|
1788
1868
|
role: "none",
|
|
1789
1869
|
className: "grow"
|
|
1790
|
-
}), /* @__PURE__ */
|
|
1870
|
+
}), /* @__PURE__ */ React27.createElement(Button10, {
|
|
1791
1871
|
disabled,
|
|
1792
1872
|
className: "flex items-center gap-2 pli-2",
|
|
1793
1873
|
onClick: () => joinSend({
|
|
1794
1874
|
type: `reset${Domain}Invitation`
|
|
1795
1875
|
}),
|
|
1796
1876
|
"data-testid": "invitation-rescuer-reset"
|
|
1797
|
-
}, /* @__PURE__ */
|
|
1877
|
+
}, /* @__PURE__ */ React27.createElement(CaretLeft5, {
|
|
1798
1878
|
weight: "bold",
|
|
1799
|
-
className:
|
|
1800
|
-
}), /* @__PURE__ */
|
|
1879
|
+
className: mx20(getSize13(5), "invisible")
|
|
1880
|
+
}), /* @__PURE__ */ React27.createElement("span", {
|
|
1801
1881
|
className: "grow"
|
|
1802
|
-
}, t("reset label")), /* @__PURE__ */
|
|
1803
|
-
className:
|
|
1882
|
+
}, t("reset label")), /* @__PURE__ */ React27.createElement(ArrowsClockwise, {
|
|
1883
|
+
className: getSize13(4)
|
|
1804
1884
|
})));
|
|
1805
1885
|
}
|
|
1806
1886
|
};
|
|
@@ -1809,11 +1889,11 @@ var InvitationRescuer = ({ Domain, ...viewStateProps }) => {
|
|
|
1809
1889
|
const disabled = !viewStateProps.active;
|
|
1810
1890
|
const { joinSend, joinState } = viewStateProps;
|
|
1811
1891
|
const invitationState = (_a = joinState == null ? void 0 : joinState.context[Domain.toLowerCase()].invitation) == null ? void 0 : _a.state;
|
|
1812
|
-
const { t } =
|
|
1813
|
-
return /* @__PURE__ */
|
|
1892
|
+
const { t } = useTranslation15("os");
|
|
1893
|
+
return /* @__PURE__ */ React27.createElement(ViewState, _extends21({}, viewStateProps), typeof invitationState === "undefined" ? /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement("div", {
|
|
1814
1894
|
role: "none",
|
|
1815
1895
|
className: "grow"
|
|
1816
|
-
}), /* @__PURE__ */
|
|
1896
|
+
}), /* @__PURE__ */ React27.createElement(Button10, {
|
|
1817
1897
|
disabled,
|
|
1818
1898
|
className: "flex items-center gap-2 pli-2",
|
|
1819
1899
|
"data-autofocus": `inputting${Domain}InvitationCode`,
|
|
@@ -1821,14 +1901,14 @@ var InvitationRescuer = ({ Domain, ...viewStateProps }) => {
|
|
|
1821
1901
|
onClick: () => joinSend({
|
|
1822
1902
|
type: `reset${Domain}Invitation`
|
|
1823
1903
|
})
|
|
1824
|
-
}, /* @__PURE__ */
|
|
1904
|
+
}, /* @__PURE__ */ React27.createElement(CaretLeft5, {
|
|
1825
1905
|
weight: "bold",
|
|
1826
|
-
className:
|
|
1827
|
-
}), /* @__PURE__ */
|
|
1906
|
+
className: mx20(getSize13(5), "invisible")
|
|
1907
|
+
}), /* @__PURE__ */ React27.createElement("span", {
|
|
1828
1908
|
className: "grow"
|
|
1829
|
-
}, t("reset label")), /* @__PURE__ */
|
|
1830
|
-
className:
|
|
1831
|
-
}))) : /* @__PURE__ */
|
|
1909
|
+
}, t("reset label")), /* @__PURE__ */ React27.createElement(ArrowsClockwise, {
|
|
1910
|
+
className: getSize13(5)
|
|
1911
|
+
}))) : /* @__PURE__ */ React27.createElement(InvitationActions, _extends21({}, {
|
|
1832
1912
|
invitationState,
|
|
1833
1913
|
disabled,
|
|
1834
1914
|
joinSend,
|
|
@@ -1839,11 +1919,11 @@ var InvitationRescuer = ({ Domain, ...viewStateProps }) => {
|
|
|
1839
1919
|
|
|
1840
1920
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx
|
|
1841
1921
|
import { CaretLeft as CaretLeft6, CaretRight as CaretRight6 } from "@phosphor-icons/react";
|
|
1842
|
-
import
|
|
1922
|
+
import React28, { useCallback as useCallback6, useState as useState5 } from "react";
|
|
1843
1923
|
import { useInvitationStatus as useInvitationStatus4 } from "@dxos/react-client";
|
|
1844
|
-
import { Button as
|
|
1845
|
-
function
|
|
1846
|
-
|
|
1924
|
+
import { Button as Button11, getSize as getSize14, Input as Input3, mx as mx21, useTranslation as useTranslation16 } from "@dxos/react-components";
|
|
1925
|
+
function _extends22() {
|
|
1926
|
+
_extends22 = Object.assign || function(target) {
|
|
1847
1927
|
for (var i = 1; i < arguments.length; i++) {
|
|
1848
1928
|
var source = arguments[i];
|
|
1849
1929
|
for (var key in source) {
|
|
@@ -1854,14 +1934,14 @@ function _extends21() {
|
|
|
1854
1934
|
}
|
|
1855
1935
|
return target;
|
|
1856
1936
|
};
|
|
1857
|
-
return
|
|
1937
|
+
return _extends22.apply(this, arguments);
|
|
1858
1938
|
}
|
|
1859
1939
|
var pinLength = 6;
|
|
1860
1940
|
var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinState, Domain, onChange, onAuthenticate }) => {
|
|
1861
|
-
const { t } =
|
|
1941
|
+
const { t } = useTranslation16("os");
|
|
1862
1942
|
const invitationType = Domain.toLowerCase();
|
|
1863
|
-
return /* @__PURE__ */
|
|
1864
|
-
label: /* @__PURE__ */
|
|
1943
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Input3, _extends22({
|
|
1944
|
+
label: /* @__PURE__ */ React28.createElement(ViewStateHeading, null, t("auth code input label")),
|
|
1865
1945
|
size: "pin",
|
|
1866
1946
|
length: pinLength,
|
|
1867
1947
|
onChange,
|
|
@@ -1879,6 +1959,7 @@ var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinStat
|
|
|
1879
1959
|
autoComplete: "off",
|
|
1880
1960
|
pattern: "\\d*",
|
|
1881
1961
|
"data-autofocus": `connecting${Domain}Invitation inputting${Domain}VerificationCode authenticationFailing${Domain}VerificationCode authenticating${Domain}VerificationCode`,
|
|
1962
|
+
"data-prevent-ios-autofocus": true,
|
|
1882
1963
|
"data-testid": `${invitationType}-auth-code-input`,
|
|
1883
1964
|
"data-1p-ignore": true
|
|
1884
1965
|
}
|
|
@@ -1886,26 +1967,26 @@ var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinStat
|
|
|
1886
1967
|
}, failed && {
|
|
1887
1968
|
validationValence: "error",
|
|
1888
1969
|
validationMessage: t("failed to authenticate message")
|
|
1889
|
-
})), /* @__PURE__ */
|
|
1970
|
+
})), /* @__PURE__ */ React28.createElement("div", {
|
|
1890
1971
|
role: "none",
|
|
1891
1972
|
className: "grow"
|
|
1892
|
-
}), /* @__PURE__ */
|
|
1973
|
+
}), /* @__PURE__ */ React28.createElement("div", {
|
|
1893
1974
|
className: "flex gap-2"
|
|
1894
|
-
}, /* @__PURE__ */
|
|
1975
|
+
}, /* @__PURE__ */ React28.createElement(Button11, {
|
|
1895
1976
|
disabled,
|
|
1896
1977
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1897
1978
|
onClick: onAuthenticate,
|
|
1898
1979
|
"data-autofocus-pinlength": invitationType,
|
|
1899
1980
|
"data-testid": `${invitationType}-invitation-authenticator-next`
|
|
1900
|
-
}, /* @__PURE__ */
|
|
1981
|
+
}, /* @__PURE__ */ React28.createElement(CaretLeft6, {
|
|
1901
1982
|
weight: "bold",
|
|
1902
|
-
className:
|
|
1903
|
-
}), /* @__PURE__ */
|
|
1983
|
+
className: mx21(getSize14(2), "invisible")
|
|
1984
|
+
}), /* @__PURE__ */ React28.createElement("span", {
|
|
1904
1985
|
className: "grow"
|
|
1905
|
-
}, t("next label")), /* @__PURE__ */
|
|
1986
|
+
}, t("next label")), /* @__PURE__ */ React28.createElement(CaretRight6, {
|
|
1906
1987
|
weight: "bold",
|
|
1907
|
-
className:
|
|
1908
|
-
})), /* @__PURE__ */
|
|
1988
|
+
className: getSize14(4)
|
|
1989
|
+
})), /* @__PURE__ */ React28.createElement(Button11, {
|
|
1909
1990
|
disabled,
|
|
1910
1991
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1911
1992
|
onClick: () => {
|
|
@@ -1913,16 +1994,16 @@ var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinStat
|
|
|
1913
1994
|
return (_a = joinState == null ? void 0 : joinState.context[invitationType].invitationObservable) == null ? void 0 : _a.cancel();
|
|
1914
1995
|
},
|
|
1915
1996
|
"data-testid": `${invitationType}-invitation-authenticator-cancel`
|
|
1916
|
-
}, /* @__PURE__ */
|
|
1997
|
+
}, /* @__PURE__ */ React28.createElement(CaretLeft6, {
|
|
1917
1998
|
weight: "bold",
|
|
1918
|
-
className:
|
|
1919
|
-
}), /* @__PURE__ */
|
|
1999
|
+
className: getSize14(4)
|
|
2000
|
+
}), /* @__PURE__ */ React28.createElement("span", null, t("cancel label")))));
|
|
1920
2001
|
};
|
|
1921
2002
|
var InvitationAuthenticatorContent = ({ joinSend, joinState, disabled, invitation, Domain, failed }) => {
|
|
1922
2003
|
const invitationType = Domain.toLowerCase();
|
|
1923
|
-
const [pinValue, setPinValue] =
|
|
2004
|
+
const [pinValue, setPinValue] = useState5("");
|
|
1924
2005
|
const { authenticate } = useInvitationStatus4(invitation);
|
|
1925
|
-
const onAuthenticate =
|
|
2006
|
+
const onAuthenticate = useCallback6(() => {
|
|
1926
2007
|
joinSend({
|
|
1927
2008
|
type: `authenticate${Domain}VerificationCode`
|
|
1928
2009
|
});
|
|
@@ -1932,7 +2013,7 @@ var InvitationAuthenticatorContent = ({ joinSend, joinState, disabled, invitatio
|
|
|
1932
2013
|
authenticate,
|
|
1933
2014
|
pinValue
|
|
1934
2015
|
]);
|
|
1935
|
-
const onChange =
|
|
2016
|
+
const onChange = useCallback6(({ target: { value } }) => {
|
|
1936
2017
|
var _a;
|
|
1937
2018
|
setPinValue(value);
|
|
1938
2019
|
if (value.length === pinLength) {
|
|
@@ -1942,7 +2023,7 @@ var InvitationAuthenticatorContent = ({ joinSend, joinState, disabled, invitatio
|
|
|
1942
2023
|
authenticate,
|
|
1943
2024
|
pinValue
|
|
1944
2025
|
]);
|
|
1945
|
-
return /* @__PURE__ */
|
|
2026
|
+
return /* @__PURE__ */ React28.createElement(PureInvitationAuthenticatorContent, _extends22({}, {
|
|
1946
2027
|
disabled,
|
|
1947
2028
|
failed,
|
|
1948
2029
|
joinSend,
|
|
@@ -1959,7 +2040,7 @@ var InvitationAuthenticator = ({ failed, Domain, ...viewStateProps }) => {
|
|
|
1959
2040
|
"authenticating"
|
|
1960
2041
|
].some((str) => joinState == null ? void 0 : joinState.configuration[0].id.includes(str));
|
|
1961
2042
|
const activeInvitation = joinState == null ? void 0 : joinState.context[Domain.toLowerCase()].invitationObservable;
|
|
1962
|
-
return /* @__PURE__ */
|
|
2043
|
+
return /* @__PURE__ */ React28.createElement(ViewState, _extends22({}, viewStateProps), !activeInvitation ? /* @__PURE__ */ React28.createElement(PureInvitationAuthenticatorContent, _extends22({}, {
|
|
1963
2044
|
disabled,
|
|
1964
2045
|
failed,
|
|
1965
2046
|
joinSend,
|
|
@@ -1969,7 +2050,7 @@ var InvitationAuthenticator = ({ failed, Domain, ...viewStateProps }) => {
|
|
|
1969
2050
|
},
|
|
1970
2051
|
onAuthenticate: () => {
|
|
1971
2052
|
}
|
|
1972
|
-
})) : /* @__PURE__ */
|
|
2053
|
+
})) : /* @__PURE__ */ React28.createElement(InvitationAuthenticatorContent, _extends22({}, {
|
|
1973
2054
|
disabled,
|
|
1974
2055
|
failed,
|
|
1975
2056
|
invitation: activeInvitation,
|
|
@@ -1980,8 +2061,8 @@ var InvitationAuthenticator = ({ failed, Domain, ...viewStateProps }) => {
|
|
|
1980
2061
|
};
|
|
1981
2062
|
|
|
1982
2063
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinPanel.tsx
|
|
1983
|
-
function
|
|
1984
|
-
|
|
2064
|
+
function _extends23() {
|
|
2065
|
+
_extends23 = Object.assign || function(target) {
|
|
1985
2066
|
for (var i = 1; i < arguments.length; i++) {
|
|
1986
2067
|
var source = arguments[i];
|
|
1987
2068
|
for (var key in source) {
|
|
@@ -1992,12 +2073,13 @@ function _extends22() {
|
|
|
1992
2073
|
}
|
|
1993
2074
|
return target;
|
|
1994
2075
|
};
|
|
1995
|
-
return
|
|
2076
|
+
return _extends23.apply(this, arguments);
|
|
1996
2077
|
}
|
|
1997
2078
|
var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, onExit, doneActionParent, onDone, preventExit }) => {
|
|
1998
2079
|
const client = useClient5();
|
|
1999
2080
|
const identity = useIdentity2();
|
|
2000
2081
|
const titleId = useId4("joinPanel__title");
|
|
2082
|
+
const { hasIosKeyboard } = useThemeContext2();
|
|
2001
2083
|
const [joinState, joinSend, joinService] = useJoinMachine(client, {
|
|
2002
2084
|
context: {
|
|
2003
2085
|
mode,
|
|
@@ -2013,7 +2095,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2013
2095
|
const subscription = joinService.subscribe((state) => {
|
|
2014
2096
|
log2("[state]", state, {
|
|
2015
2097
|
file: "JoinPanel.tsx",
|
|
2016
|
-
line:
|
|
2098
|
+
line: 49,
|
|
2017
2099
|
scope: void 0,
|
|
2018
2100
|
callSite: (f, a) => f(...a)
|
|
2019
2101
|
});
|
|
@@ -2027,49 +2109,50 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2027
2109
|
const innermostState = stateStack[stateStack.length - 1];
|
|
2028
2110
|
const autoFocusValue = innermostState === "finishingJoining" ? "successSpaceInvitation" : innermostState;
|
|
2029
2111
|
const $nextAutofocus = document.querySelector(`[data-autofocus~="${autoFocusValue}"]`);
|
|
2030
|
-
if ($nextAutofocus) {
|
|
2112
|
+
if ($nextAutofocus && !(hasIosKeyboard && $nextAutofocus.hasAttribute("data-prevent-ios-autofocus"))) {
|
|
2031
2113
|
$nextAutofocus.focus();
|
|
2032
2114
|
}
|
|
2033
2115
|
}, [
|
|
2034
|
-
joinState.value
|
|
2116
|
+
joinState.value,
|
|
2117
|
+
hasIosKeyboard
|
|
2035
2118
|
]);
|
|
2036
|
-
return /* @__PURE__ */
|
|
2119
|
+
return /* @__PURE__ */ React29.createElement(DensityProvider4, {
|
|
2037
2120
|
density: "fine"
|
|
2038
|
-
}, /* @__PURE__ */
|
|
2121
|
+
}, /* @__PURE__ */ React29.createElement(JoinHeading, _extends23({}, {
|
|
2039
2122
|
mode,
|
|
2040
2123
|
titleId,
|
|
2041
2124
|
joinState,
|
|
2042
2125
|
onExit,
|
|
2043
2126
|
exitActionParent,
|
|
2044
2127
|
preventExit
|
|
2045
|
-
})), /* @__PURE__ */
|
|
2128
|
+
})), /* @__PURE__ */ React29.createElement("div", {
|
|
2046
2129
|
role: "none",
|
|
2047
2130
|
className: "is-full overflow-hidden"
|
|
2048
|
-
}, /* @__PURE__ */
|
|
2131
|
+
}, /* @__PURE__ */ React29.createElement("div", {
|
|
2049
2132
|
role: "none",
|
|
2050
2133
|
className: "flex is-[1200%]",
|
|
2051
2134
|
"aria-live": "polite"
|
|
2052
|
-
}, /* @__PURE__ */
|
|
2135
|
+
}, /* @__PURE__ */ React29.createElement(AdditionMethodSelector, _extends23({}, {
|
|
2053
2136
|
joinState,
|
|
2054
2137
|
joinSend,
|
|
2055
2138
|
active: joinState.matches({
|
|
2056
2139
|
choosingIdentity: "choosingAuthMethod"
|
|
2057
2140
|
})
|
|
2058
|
-
})), /* @__PURE__ */
|
|
2141
|
+
})), /* @__PURE__ */ React29.createElement(IdentityInput, _extends23({}, {
|
|
2059
2142
|
joinState,
|
|
2060
2143
|
joinSend,
|
|
2061
2144
|
active: joinState.matches({
|
|
2062
2145
|
choosingIdentity: "creatingIdentity"
|
|
2063
2146
|
}),
|
|
2064
2147
|
method: "create identity"
|
|
2065
|
-
})), /* @__PURE__ */
|
|
2148
|
+
})), /* @__PURE__ */ React29.createElement(IdentityInput, _extends23({}, {
|
|
2066
2149
|
joinState,
|
|
2067
2150
|
joinSend,
|
|
2068
2151
|
active: joinState.matches({
|
|
2069
2152
|
choosingIdentity: "recoveringIdentity"
|
|
2070
2153
|
}),
|
|
2071
2154
|
method: "recover identity"
|
|
2072
|
-
})), /* @__PURE__ */
|
|
2155
|
+
})), /* @__PURE__ */ React29.createElement(InvitationInput, _extends23({}, {
|
|
2073
2156
|
joinState,
|
|
2074
2157
|
joinSend,
|
|
2075
2158
|
active: joinState.matches({
|
|
@@ -2078,7 +2161,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2078
2161
|
}
|
|
2079
2162
|
}),
|
|
2080
2163
|
Domain: "Halo"
|
|
2081
|
-
})), /* @__PURE__ */
|
|
2164
|
+
})), /* @__PURE__ */ React29.createElement(InvitationRescuer, _extends23({}, {
|
|
2082
2165
|
joinState,
|
|
2083
2166
|
joinSend,
|
|
2084
2167
|
active: [
|
|
@@ -2098,7 +2181,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2098
2181
|
}
|
|
2099
2182
|
].some(joinState.matches),
|
|
2100
2183
|
Domain: "Halo"
|
|
2101
|
-
})), /* @__PURE__ */
|
|
2184
|
+
})), /* @__PURE__ */ React29.createElement(InvitationAuthenticator, _extends23({}, {
|
|
2102
2185
|
joinState,
|
|
2103
2186
|
joinSend,
|
|
2104
2187
|
active: [
|
|
@@ -2132,7 +2215,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2132
2215
|
}) && {
|
|
2133
2216
|
failed: true
|
|
2134
2217
|
}
|
|
2135
|
-
})), /* @__PURE__ */
|
|
2218
|
+
})), /* @__PURE__ */ React29.createElement(InvitationAccepted, _extends23({}, {
|
|
2136
2219
|
joinState,
|
|
2137
2220
|
joinSend,
|
|
2138
2221
|
active: [
|
|
@@ -2148,7 +2231,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2148
2231
|
Domain: "Halo",
|
|
2149
2232
|
doneActionParent,
|
|
2150
2233
|
onDone
|
|
2151
|
-
})), /* @__PURE__ */
|
|
2234
|
+
})), /* @__PURE__ */ React29.createElement(IdentityAdded, _extends23({}, {
|
|
2152
2235
|
joinState,
|
|
2153
2236
|
joinSend,
|
|
2154
2237
|
mode,
|
|
@@ -2157,14 +2240,14 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2157
2240
|
}),
|
|
2158
2241
|
doneActionParent,
|
|
2159
2242
|
onDone
|
|
2160
|
-
})), /* @__PURE__ */
|
|
2243
|
+
})), /* @__PURE__ */ React29.createElement(InvitationInput, _extends23({}, {
|
|
2161
2244
|
joinState,
|
|
2162
2245
|
joinSend,
|
|
2163
2246
|
active: joinState.matches({
|
|
2164
2247
|
acceptingSpaceInvitation: "inputtingSpaceInvitationCode"
|
|
2165
2248
|
}),
|
|
2166
2249
|
Domain: "Space"
|
|
2167
|
-
})), /* @__PURE__ */
|
|
2250
|
+
})), /* @__PURE__ */ React29.createElement(InvitationRescuer, _extends23({}, {
|
|
2168
2251
|
joinState,
|
|
2169
2252
|
joinSend,
|
|
2170
2253
|
active: [
|
|
@@ -2180,7 +2263,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2180
2263
|
}
|
|
2181
2264
|
].some(joinState.matches),
|
|
2182
2265
|
Domain: "Space"
|
|
2183
|
-
})), /* @__PURE__ */
|
|
2266
|
+
})), /* @__PURE__ */ React29.createElement(InvitationAuthenticator, _extends23({}, {
|
|
2184
2267
|
joinState,
|
|
2185
2268
|
joinSend,
|
|
2186
2269
|
active: [
|
|
@@ -2208,7 +2291,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2208
2291
|
}) && {
|
|
2209
2292
|
failed: true
|
|
2210
2293
|
}
|
|
2211
|
-
})), /* @__PURE__ */
|
|
2294
|
+
})), /* @__PURE__ */ React29.createElement(InvitationAccepted, _extends23({}, {
|
|
2212
2295
|
joinState,
|
|
2213
2296
|
joinSend,
|
|
2214
2297
|
active: joinState.matches("finishingJoiningSpace"),
|
|
@@ -2220,11 +2303,11 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2220
2303
|
|
|
2221
2304
|
// packages/apps/patterns/react-ui/src/panels/SpacePanel/SpacePanel.tsx
|
|
2222
2305
|
import { UserPlus as UserPlus2 } from "@phosphor-icons/react";
|
|
2223
|
-
import
|
|
2306
|
+
import React30, { useReducer as useReducer2 } from "react";
|
|
2224
2307
|
import { useSpaceInvitations as useSpaceInvitations2, observer } from "@dxos/react-client";
|
|
2225
|
-
import { Button as
|
|
2226
|
-
function
|
|
2227
|
-
|
|
2308
|
+
import { Button as Button12, DensityProvider as DensityProvider5, getSize as getSize15, mx as mx22, useTranslation as useTranslation17 } from "@dxos/react-components";
|
|
2309
|
+
function _extends24() {
|
|
2310
|
+
_extends24 = Object.assign || function(target) {
|
|
2228
2311
|
for (var i = 1; i < arguments.length; i++) {
|
|
2229
2312
|
var source = arguments[i];
|
|
2230
2313
|
for (var key in source) {
|
|
@@ -2235,39 +2318,39 @@ function _extends23() {
|
|
|
2235
2318
|
}
|
|
2236
2319
|
return target;
|
|
2237
2320
|
};
|
|
2238
|
-
return
|
|
2321
|
+
return _extends24.apply(this, arguments);
|
|
2239
2322
|
}
|
|
2240
2323
|
var CurrentSpaceView = observer(({ space, createInvitationUrl, titleId }) => {
|
|
2241
|
-
const { t } =
|
|
2324
|
+
const { t } = useTranslation17("os");
|
|
2242
2325
|
const invitations = useSpaceInvitations2(space == null ? void 0 : space.key);
|
|
2243
2326
|
const name = space == null ? void 0 : space.properties.name;
|
|
2244
2327
|
if (!space) {
|
|
2245
2328
|
return null;
|
|
2246
2329
|
}
|
|
2247
|
-
return /* @__PURE__ */
|
|
2330
|
+
return /* @__PURE__ */ React30.createElement("div", {
|
|
2248
2331
|
role: "none",
|
|
2249
2332
|
className: "flex flex-col"
|
|
2250
|
-
}, /* @__PURE__ */
|
|
2333
|
+
}, /* @__PURE__ */ React30.createElement("div", {
|
|
2251
2334
|
role: "none",
|
|
2252
|
-
className:
|
|
2253
|
-
}, /* @__PURE__ */
|
|
2335
|
+
className: mx22(subduedSurface, "rounded-bs-md flex items-center p-2 gap-2")
|
|
2336
|
+
}, /* @__PURE__ */ React30.createElement("h2", {
|
|
2254
2337
|
id: titleId,
|
|
2255
|
-
className:
|
|
2256
|
-
}, name != null ? name : space.key.truncate())), /* @__PURE__ */
|
|
2338
|
+
className: mx22("grow font-system-medium", !name && "font-mono")
|
|
2339
|
+
}, name != null ? name : space.key.truncate())), /* @__PURE__ */ React30.createElement("div", {
|
|
2257
2340
|
role: "region",
|
|
2258
|
-
className:
|
|
2259
|
-
}, /* @__PURE__ */
|
|
2341
|
+
className: mx22(defaultSurface, "rounded-be-md p-2")
|
|
2342
|
+
}, /* @__PURE__ */ React30.createElement(InvitationList, {
|
|
2260
2343
|
invitations,
|
|
2261
2344
|
onClickRemove: ({ invitation }) => invitation && (space == null ? void 0 : space.removeInvitation(invitation.invitationId)),
|
|
2262
2345
|
createInvitationUrl
|
|
2263
|
-
}), /* @__PURE__ */
|
|
2346
|
+
}), /* @__PURE__ */ React30.createElement(Button12, {
|
|
2264
2347
|
className: "is-full flex gap-2 mbs-2",
|
|
2265
2348
|
onClick: () => space == null ? void 0 : space.createInvitation(),
|
|
2266
2349
|
"data-testid": "spaces-panel.create-invitation"
|
|
2267
|
-
}, /* @__PURE__ */
|
|
2268
|
-
className:
|
|
2350
|
+
}, /* @__PURE__ */ React30.createElement("span", null, t("create space invitation label")), /* @__PURE__ */ React30.createElement(UserPlus2, {
|
|
2351
|
+
className: getSize15(4),
|
|
2269
2352
|
weight: "bold"
|
|
2270
|
-
})), /* @__PURE__ */
|
|
2353
|
+
})), /* @__PURE__ */ React30.createElement(PanelSeparator, null), /* @__PURE__ */ React30.createElement(SpaceMemberListContainer, {
|
|
2271
2354
|
spaceKey: space.key,
|
|
2272
2355
|
includeSelf: true
|
|
2273
2356
|
})));
|
|
@@ -2285,14 +2368,14 @@ var SpacePanel = (props) => {
|
|
|
2285
2368
|
const [panelState] = useReducer2(reducer, {
|
|
2286
2369
|
activeView: "current space"
|
|
2287
2370
|
});
|
|
2288
|
-
return /* @__PURE__ */
|
|
2371
|
+
return /* @__PURE__ */ React30.createElement(DensityProvider5, {
|
|
2289
2372
|
density: "fine"
|
|
2290
|
-
}, panelState.activeView === "current space" ? /* @__PURE__ */
|
|
2373
|
+
}, panelState.activeView === "current space" ? /* @__PURE__ */ React30.createElement(CurrentSpaceView, _extends24({}, props)) : null);
|
|
2291
2374
|
};
|
|
2292
2375
|
|
|
2293
2376
|
// packages/apps/patterns/react-ui/src/composites/IdentityPopover/IdentityPopover.tsx
|
|
2294
|
-
function
|
|
2295
|
-
|
|
2377
|
+
function _extends25() {
|
|
2378
|
+
_extends25 = Object.assign || function(target) {
|
|
2296
2379
|
for (var i = 1; i < arguments.length; i++) {
|
|
2297
2380
|
var source = arguments[i];
|
|
2298
2381
|
for (var key in source) {
|
|
@@ -2303,12 +2386,12 @@ function _extends24() {
|
|
|
2303
2386
|
}
|
|
2304
2387
|
return target;
|
|
2305
2388
|
};
|
|
2306
|
-
return
|
|
2389
|
+
return _extends25.apply(this, arguments);
|
|
2307
2390
|
}
|
|
2308
2391
|
var IdentityPopover = ({ identity, openTrigger, slots, triggerIsInToolbar = true, onClickManageProfile, ...popoverProps }) => {
|
|
2309
2392
|
var _a, _b, _c;
|
|
2310
|
-
return /* @__PURE__ */
|
|
2311
|
-
openTrigger: openTrigger != null ? openTrigger : /* @__PURE__ */
|
|
2393
|
+
return /* @__PURE__ */ React31.createElement(PanelPopover, _extends25({}, popoverProps, {
|
|
2394
|
+
openTrigger: openTrigger != null ? openTrigger : /* @__PURE__ */ React31.createElement(Avatar5, {
|
|
2312
2395
|
size: 10,
|
|
2313
2396
|
variant: "circle",
|
|
2314
2397
|
fallbackValue: identity.identityKey.toHex(),
|
|
@@ -2318,11 +2401,11 @@ var IdentityPopover = ({ identity, openTrigger, slots, triggerIsInToolbar = true
|
|
|
2318
2401
|
...slots,
|
|
2319
2402
|
trigger: {
|
|
2320
2403
|
...slots == null ? void 0 : slots.trigger,
|
|
2321
|
-
className:
|
|
2404
|
+
className: mx23("flex justify-self-end pointer-events-auto bg-white dark:bg-neutral-700 p-0.5 button-elevation rounded-full", (_c = slots == null ? void 0 : slots.trigger) == null ? void 0 : _c.className)
|
|
2322
2405
|
}
|
|
2323
2406
|
},
|
|
2324
2407
|
triggerIsInToolbar
|
|
2325
|
-
}), /* @__PURE__ */
|
|
2408
|
+
}), /* @__PURE__ */ React31.createElement(IdentityPanel, _extends25({}, {
|
|
2326
2409
|
identity,
|
|
2327
2410
|
onClickManageProfile
|
|
2328
2411
|
})));
|
|
@@ -2330,10 +2413,10 @@ var IdentityPopover = ({ identity, openTrigger, slots, triggerIsInToolbar = true
|
|
|
2330
2413
|
|
|
2331
2414
|
// packages/apps/patterns/react-ui/src/composites/JoinDialog/JoinDialog.tsx
|
|
2332
2415
|
import { Action, Cancel } from "@radix-ui/react-alert-dialog";
|
|
2333
|
-
import
|
|
2334
|
-
import { ThemeContext as ThemeContext2, useId as useId5 } from "@dxos/react-components";
|
|
2335
|
-
function
|
|
2336
|
-
|
|
2416
|
+
import React32 from "react";
|
|
2417
|
+
import { ThemeContext as ThemeContext2, useId as useId5, useThemeContext as useThemeContext3 } from "@dxos/react-components";
|
|
2418
|
+
function _extends26() {
|
|
2419
|
+
_extends26 = Object.assign || function(target) {
|
|
2337
2420
|
for (var i = 1; i < arguments.length; i++) {
|
|
2338
2421
|
var source = arguments[i];
|
|
2339
2422
|
for (var key in source) {
|
|
@@ -2344,41 +2427,43 @@ function _extends25() {
|
|
|
2344
2427
|
}
|
|
2345
2428
|
return target;
|
|
2346
2429
|
};
|
|
2347
|
-
return
|
|
2430
|
+
return _extends26.apply(this, arguments);
|
|
2348
2431
|
}
|
|
2349
2432
|
var JoinDialog = ({ slots, ...joinPanelProps }) => {
|
|
2350
2433
|
const titleId = useId5("joinDialog__title");
|
|
2351
|
-
|
|
2434
|
+
const themeContextValue = useThemeContext3();
|
|
2435
|
+
return /* @__PURE__ */ React32.createElement(PanelAlertDialog, _extends26({}, {
|
|
2352
2436
|
slots,
|
|
2353
2437
|
titleId
|
|
2354
|
-
}), /* @__PURE__ */
|
|
2438
|
+
}), /* @__PURE__ */ React32.createElement(ThemeContext2.Provider, {
|
|
2355
2439
|
value: {
|
|
2440
|
+
...themeContextValue,
|
|
2356
2441
|
themeVariant: "os"
|
|
2357
2442
|
}
|
|
2358
|
-
}, /* @__PURE__ */
|
|
2443
|
+
}, /* @__PURE__ */ React32.createElement(JoinPanel, _extends26({}, {
|
|
2359
2444
|
...joinPanelProps,
|
|
2360
2445
|
titleId,
|
|
2361
|
-
exitActionParent: /* @__PURE__ */
|
|
2446
|
+
exitActionParent: /* @__PURE__ */ React32.createElement(Cancel, {
|
|
2362
2447
|
asChild: true
|
|
2363
2448
|
}),
|
|
2364
|
-
doneActionParent: /* @__PURE__ */
|
|
2449
|
+
doneActionParent: /* @__PURE__ */ React32.createElement(Action, {
|
|
2365
2450
|
asChild: true
|
|
2366
2451
|
})
|
|
2367
2452
|
}))));
|
|
2368
2453
|
};
|
|
2369
2454
|
|
|
2370
2455
|
// packages/apps/patterns/react-ui/src/composites/Shell/Shell.tsx
|
|
2371
|
-
import
|
|
2456
|
+
import React35, { useEffect as useEffect3, useState as useState6 } from "react";
|
|
2372
2457
|
import { log as log3 } from "@dxos/log";
|
|
2373
2458
|
import { ShellDisplay, ShellLayout } from "@dxos/protocols/proto/dxos/iframe";
|
|
2374
2459
|
import { useClient as useClient6, useSpace as useSpace3, useSpaces } from "@dxos/react-client";
|
|
2375
2460
|
|
|
2376
2461
|
// packages/apps/patterns/react-ui/src/composites/DevicesDialog/DevicesDialog.tsx
|
|
2377
2462
|
import { Close } from "@radix-ui/react-dialog";
|
|
2378
|
-
import
|
|
2379
|
-
import { ThemeContext as ThemeContext3, useId as useId6 } from "@dxos/react-components";
|
|
2380
|
-
function
|
|
2381
|
-
|
|
2463
|
+
import React33 from "react";
|
|
2464
|
+
import { ThemeContext as ThemeContext3, useId as useId6, useThemeContext as useThemeContext4 } from "@dxos/react-components";
|
|
2465
|
+
function _extends27() {
|
|
2466
|
+
_extends27 = Object.assign || function(target) {
|
|
2382
2467
|
for (var i = 1; i < arguments.length; i++) {
|
|
2383
2468
|
var source = arguments[i];
|
|
2384
2469
|
for (var key in source) {
|
|
@@ -2389,11 +2474,12 @@ function _extends26() {
|
|
|
2389
2474
|
}
|
|
2390
2475
|
return target;
|
|
2391
2476
|
};
|
|
2392
|
-
return
|
|
2477
|
+
return _extends27.apply(this, arguments);
|
|
2393
2478
|
}
|
|
2394
2479
|
var DevicesDialog = ({ slots, ...devicesDialogProps }) => {
|
|
2395
2480
|
const titleId = useId6("spaceDialog__title");
|
|
2396
|
-
|
|
2481
|
+
const themeContextValue = useThemeContext4();
|
|
2482
|
+
return /* @__PURE__ */ React33.createElement(PanelDialog, _extends27({}, {
|
|
2397
2483
|
slots: {
|
|
2398
2484
|
...slots,
|
|
2399
2485
|
root: {
|
|
@@ -2405,14 +2491,15 @@ var DevicesDialog = ({ slots, ...devicesDialogProps }) => {
|
|
|
2405
2491
|
}
|
|
2406
2492
|
},
|
|
2407
2493
|
titleId
|
|
2408
|
-
}), /* @__PURE__ */
|
|
2494
|
+
}), /* @__PURE__ */ React33.createElement(ThemeContext3.Provider, {
|
|
2409
2495
|
value: {
|
|
2496
|
+
...themeContextValue,
|
|
2410
2497
|
themeVariant: "os"
|
|
2411
2498
|
}
|
|
2412
|
-
}, /* @__PURE__ */
|
|
2499
|
+
}, /* @__PURE__ */ React33.createElement(DevicesPanel, _extends27({}, {
|
|
2413
2500
|
...devicesDialogProps,
|
|
2414
2501
|
titleId,
|
|
2415
|
-
doneActionParent: /* @__PURE__ */
|
|
2502
|
+
doneActionParent: /* @__PURE__ */ React33.createElement(Close, {
|
|
2416
2503
|
asChild: true
|
|
2417
2504
|
})
|
|
2418
2505
|
}))));
|
|
@@ -2420,10 +2507,10 @@ var DevicesDialog = ({ slots, ...devicesDialogProps }) => {
|
|
|
2420
2507
|
|
|
2421
2508
|
// packages/apps/patterns/react-ui/src/composites/SpaceDialog/SpaceDialog.tsx
|
|
2422
2509
|
import { Close as Close2 } from "@radix-ui/react-dialog";
|
|
2423
|
-
import
|
|
2424
|
-
import { ThemeContext as ThemeContext4, useId as useId7 } from "@dxos/react-components";
|
|
2425
|
-
function
|
|
2426
|
-
|
|
2510
|
+
import React34 from "react";
|
|
2511
|
+
import { ThemeContext as ThemeContext4, useId as useId7, useThemeContext as useThemeContext5 } from "@dxos/react-components";
|
|
2512
|
+
function _extends28() {
|
|
2513
|
+
_extends28 = Object.assign || function(target) {
|
|
2427
2514
|
for (var i = 1; i < arguments.length; i++) {
|
|
2428
2515
|
var source = arguments[i];
|
|
2429
2516
|
for (var key in source) {
|
|
@@ -2434,11 +2521,12 @@ function _extends27() {
|
|
|
2434
2521
|
}
|
|
2435
2522
|
return target;
|
|
2436
2523
|
};
|
|
2437
|
-
return
|
|
2524
|
+
return _extends28.apply(this, arguments);
|
|
2438
2525
|
}
|
|
2439
2526
|
var SpaceDialog = ({ slots, ...spacePanelProps }) => {
|
|
2440
2527
|
const titleId = useId7("spaceDialog__title");
|
|
2441
|
-
|
|
2528
|
+
const themeContextValue = useThemeContext5();
|
|
2529
|
+
return /* @__PURE__ */ React34.createElement(PanelDialog, _extends28({}, {
|
|
2442
2530
|
slots: {
|
|
2443
2531
|
...slots,
|
|
2444
2532
|
root: {
|
|
@@ -2450,14 +2538,15 @@ var SpaceDialog = ({ slots, ...spacePanelProps }) => {
|
|
|
2450
2538
|
}
|
|
2451
2539
|
},
|
|
2452
2540
|
titleId
|
|
2453
|
-
}), /* @__PURE__ */
|
|
2541
|
+
}), /* @__PURE__ */ React34.createElement(ThemeContext4.Provider, {
|
|
2454
2542
|
value: {
|
|
2543
|
+
...themeContextValue,
|
|
2455
2544
|
themeVariant: "os"
|
|
2456
2545
|
}
|
|
2457
|
-
}, /* @__PURE__ */
|
|
2546
|
+
}, /* @__PURE__ */ React34.createElement(SpacePanel, _extends28({}, {
|
|
2458
2547
|
...spacePanelProps,
|
|
2459
2548
|
titleId,
|
|
2460
|
-
doneActionParent: /* @__PURE__ */
|
|
2549
|
+
doneActionParent: /* @__PURE__ */ React34.createElement(Close2, {
|
|
2461
2550
|
asChild: true
|
|
2462
2551
|
})
|
|
2463
2552
|
}))));
|
|
@@ -2465,7 +2554,7 @@ var SpaceDialog = ({ slots, ...spacePanelProps }) => {
|
|
|
2465
2554
|
|
|
2466
2555
|
// packages/apps/patterns/react-ui/src/composites/Shell/Shell.tsx
|
|
2467
2556
|
var Shell = ({ runtime, origin }) => {
|
|
2468
|
-
const [{ layout, invitationCode, spaceKey }, setLayout] =
|
|
2557
|
+
const [{ layout, invitationCode, spaceKey }, setLayout] = useState6({
|
|
2469
2558
|
layout: runtime.layout,
|
|
2470
2559
|
invitationCode: runtime.invitationCode,
|
|
2471
2560
|
spaceKey: runtime.spaceKey
|
|
@@ -2501,7 +2590,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2501
2590
|
]);
|
|
2502
2591
|
switch (layout) {
|
|
2503
2592
|
case ShellLayout.INITIALIZE_IDENTITY:
|
|
2504
|
-
return /* @__PURE__ */
|
|
2593
|
+
return /* @__PURE__ */ React35.createElement(JoinDialog, {
|
|
2505
2594
|
mode: "halo-only",
|
|
2506
2595
|
initialInvitationCode: invitationCode,
|
|
2507
2596
|
onDone: async () => {
|
|
@@ -2513,7 +2602,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2513
2602
|
}
|
|
2514
2603
|
});
|
|
2515
2604
|
case ShellLayout.DEVICE_INVITATIONS:
|
|
2516
|
-
return /* @__PURE__ */
|
|
2605
|
+
return /* @__PURE__ */ React35.createElement(DevicesDialog, {
|
|
2517
2606
|
createInvitationUrl: (invitationCode2) => `${origin}?haloInvitationCode=${invitationCode2}`,
|
|
2518
2607
|
onDone: async () => {
|
|
2519
2608
|
await runtime.setAppContext({
|
|
@@ -2523,7 +2612,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2523
2612
|
}
|
|
2524
2613
|
});
|
|
2525
2614
|
case ShellLayout.SPACE_INVITATIONS:
|
|
2526
|
-
return space ? /* @__PURE__ */
|
|
2615
|
+
return space ? /* @__PURE__ */ React35.createElement(SpaceDialog, {
|
|
2527
2616
|
space,
|
|
2528
2617
|
createInvitationUrl: (invitationCode2) => `${origin}?spaceInvitationCode=${invitationCode2}`,
|
|
2529
2618
|
onDone: async () => {
|
|
@@ -2534,7 +2623,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2534
2623
|
}
|
|
2535
2624
|
}) : null;
|
|
2536
2625
|
case ShellLayout.JOIN_SPACE:
|
|
2537
|
-
return /* @__PURE__ */
|
|
2626
|
+
return /* @__PURE__ */ React35.createElement(JoinDialog, {
|
|
2538
2627
|
initialInvitationCode: invitationCode,
|
|
2539
2628
|
onDone: async (result) => {
|
|
2540
2629
|
var _a;
|
|
@@ -2557,15 +2646,15 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2557
2646
|
};
|
|
2558
2647
|
|
|
2559
2648
|
// packages/apps/patterns/react-ui/src/composites/Shell/ShellContext.tsx
|
|
2560
|
-
import
|
|
2649
|
+
import React36, { createContext as createContext3, useCallback as useCallback7, useContext as useContext3, useEffect as useEffect4, useMemo as useMemo3, useState as useState7 } from "react";
|
|
2561
2650
|
import { IFrameClientServicesProxy, ShellDisplay as ShellDisplay2, ShellLayout as ShellLayout2 } from "@dxos/client";
|
|
2562
2651
|
import { MemoryShellRuntime } from "@dxos/client-services";
|
|
2563
2652
|
import { useClient as useClient7, useIdentity as useIdentity3 } from "@dxos/react-client";
|
|
2564
|
-
import { mx as
|
|
2565
|
-
var ShellContext = /* @__PURE__ */
|
|
2653
|
+
import { mx as mx24 } from "@dxos/react-components";
|
|
2654
|
+
var ShellContext = /* @__PURE__ */ createContext3({});
|
|
2566
2655
|
var useShell = () => {
|
|
2567
2656
|
const client = useClient7();
|
|
2568
|
-
const { runtime, setDisplay } =
|
|
2657
|
+
const { runtime, setDisplay } = useContext3(ShellContext);
|
|
2569
2658
|
const setLayout = async (layout, options) => {
|
|
2570
2659
|
if (runtime) {
|
|
2571
2660
|
if (layout === ShellLayout2.DEFAULT) {
|
|
@@ -2598,7 +2687,7 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2598
2687
|
]);
|
|
2599
2688
|
const client = useClient7();
|
|
2600
2689
|
const identity = useIdentity3();
|
|
2601
|
-
const [display, setDisplay] =
|
|
2690
|
+
const [display, setDisplay] = useState7(!identity || spaceInvitationCode || haloInvitationCode ? ShellDisplay2.FULLSCREEN : ShellDisplay2.NONE);
|
|
2602
2691
|
const shellRuntime = useMemo3(() => {
|
|
2603
2692
|
if (client.config.get("runtime.app.env.DX_VAULT") === "true") {
|
|
2604
2693
|
return;
|
|
@@ -2619,7 +2708,7 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2619
2708
|
spaceInvitationCode,
|
|
2620
2709
|
haloInvitationCode
|
|
2621
2710
|
]);
|
|
2622
|
-
const handleKeyDown =
|
|
2711
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2623
2712
|
if (!space || !shellRuntime) {
|
|
2624
2713
|
return;
|
|
2625
2714
|
}
|
|
@@ -2658,12 +2747,12 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2658
2747
|
}, [
|
|
2659
2748
|
shellRuntime
|
|
2660
2749
|
]);
|
|
2661
|
-
return /* @__PURE__ */
|
|
2662
|
-
className:
|
|
2663
|
-
}, /* @__PURE__ */
|
|
2750
|
+
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, shellRuntime && /* @__PURE__ */ React36.createElement("div", {
|
|
2751
|
+
className: mx24(display === ShellDisplay2.NONE ? "hidden" : "")
|
|
2752
|
+
}, /* @__PURE__ */ React36.createElement(Shell, {
|
|
2664
2753
|
runtime: shellRuntime,
|
|
2665
2754
|
origin: window.location.origin
|
|
2666
|
-
})), /* @__PURE__ */
|
|
2755
|
+
})), /* @__PURE__ */ React36.createElement(ShellContext.Provider, {
|
|
2667
2756
|
value: {
|
|
2668
2757
|
runtime: shellRuntime,
|
|
2669
2758
|
setDisplay
|
|
@@ -2681,6 +2770,7 @@ var os = {
|
|
|
2681
2770
|
"identity offline description": "Offline",
|
|
2682
2771
|
"sidebar label": "DXOS sidebar",
|
|
2683
2772
|
"copy invitation code label": "Copy",
|
|
2773
|
+
"copy invitation code success label": "Copied",
|
|
2684
2774
|
"open share panel label": "Share",
|
|
2685
2775
|
"joining space heading": "Joining space",
|
|
2686
2776
|
"join space heading": "Join a space",
|
|
@@ -2746,11 +2836,15 @@ var osTranslations = {
|
|
|
2746
2836
|
"en-US": en_US_exports
|
|
2747
2837
|
};
|
|
2748
2838
|
export {
|
|
2839
|
+
ClipboardContext,
|
|
2840
|
+
ClipboardProvider,
|
|
2841
|
+
CopyButton,
|
|
2749
2842
|
DeviceList,
|
|
2750
2843
|
DevicesPanel,
|
|
2751
2844
|
IdentityListItem,
|
|
2752
2845
|
IdentityPanel,
|
|
2753
2846
|
IdentityPopover,
|
|
2847
|
+
InvitationEmoji,
|
|
2754
2848
|
InvitationList,
|
|
2755
2849
|
InvitationListContainer,
|
|
2756
2850
|
InvitationListItem,
|
|
@@ -2795,6 +2889,7 @@ export {
|
|
|
2795
2889
|
successBgColor,
|
|
2796
2890
|
successStrokeColor,
|
|
2797
2891
|
successTextColor,
|
|
2892
|
+
useClipboardContext,
|
|
2798
2893
|
useShell,
|
|
2799
2894
|
useTogglePanelSidebar
|
|
2800
2895
|
};
|