@dxos/react-ui 0.1.32-next.77d513e → 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 +611 -527
- 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/panels/JoinPanel/JoinHeading.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/panels/JoinPanel/JoinHeading.tsx +3 -12
- 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,18 +849,18 @@ 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();
|
|
785
865
|
const themeContextValue = useThemeContext();
|
|
786
866
|
const defaultManageProfile = () => {
|
|
@@ -788,39 +868,39 @@ var IdentityPanel = ({ identity, onClickManageProfile }) => {
|
|
|
788
868
|
const tab = window.open(remoteSource.origin, "_blank");
|
|
789
869
|
tab == null ? void 0 : tab.focus();
|
|
790
870
|
};
|
|
791
|
-
return /* @__PURE__ */
|
|
871
|
+
return /* @__PURE__ */ React19.createElement(ThemeContext.Provider, {
|
|
792
872
|
value: {
|
|
793
873
|
...themeContextValue,
|
|
794
874
|
themeVariant: "os"
|
|
795
875
|
}
|
|
796
|
-
}, /* @__PURE__ */
|
|
876
|
+
}, /* @__PURE__ */ React19.createElement(DensityProvider3, {
|
|
797
877
|
density: "fine"
|
|
798
|
-
}, /* @__PURE__ */
|
|
878
|
+
}, /* @__PURE__ */ React19.createElement("div", {
|
|
799
879
|
className: "flex flex-col gap-2 justify-center items-center"
|
|
800
|
-
}, /* @__PURE__ */
|
|
880
|
+
}, /* @__PURE__ */ React19.createElement(Avatar3, {
|
|
801
881
|
size: 16,
|
|
802
882
|
variant: "circle",
|
|
803
883
|
fallbackValue: identity.identityKey.toHex(),
|
|
804
884
|
label: (_b = (_a = identity.profile) == null ? void 0 : _a.displayName) != null ? _b : ""
|
|
805
|
-
}), /* @__PURE__ */
|
|
885
|
+
}), /* @__PURE__ */ React19.createElement(Button4, {
|
|
806
886
|
onClick: onClickManageProfile != null ? onClickManageProfile : defaultManageProfile,
|
|
807
887
|
className: "is-full"
|
|
808
888
|
}, t("manage profile label")))));
|
|
809
889
|
};
|
|
810
890
|
|
|
811
891
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinPanel.tsx
|
|
812
|
-
import
|
|
892
|
+
import React29, { useEffect as useEffect2 } from "react";
|
|
813
893
|
import { log as log2 } from "@dxos/log";
|
|
814
894
|
import { useClient as useClient5, useIdentity as useIdentity2 } from "@dxos/react-client";
|
|
815
895
|
import { DensityProvider as DensityProvider4, useId as useId4, useThemeContext as useThemeContext2 } from "@dxos/react-components";
|
|
816
896
|
|
|
817
897
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinHeading.tsx
|
|
818
898
|
import { X as X3 } from "@phosphor-icons/react";
|
|
819
|
-
import
|
|
899
|
+
import React20, { cloneElement as cloneElement2, forwardRef as forwardRef2 } from "react";
|
|
820
900
|
import { useSpace as useSpace2 } from "@dxos/react-client";
|
|
821
|
-
import { Button as
|
|
822
|
-
function
|
|
823
|
-
|
|
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) {
|
|
824
904
|
for (var i = 1; i < arguments.length; i++) {
|
|
825
905
|
var source = arguments[i];
|
|
826
906
|
for (var key in source) {
|
|
@@ -831,51 +911,49 @@ function _extends13() {
|
|
|
831
911
|
}
|
|
832
912
|
return target;
|
|
833
913
|
};
|
|
834
|
-
return
|
|
914
|
+
return _extends14.apply(this, arguments);
|
|
835
915
|
}
|
|
836
916
|
var JoinHeading = /* @__PURE__ */ forwardRef2(({ mode, titleId, joinState, onExit, exitActionParent, preventExit }, ref) => {
|
|
837
917
|
var _a, _b;
|
|
838
|
-
const { t } =
|
|
918
|
+
const { t } = useTranslation8("os");
|
|
839
919
|
const space = useSpace2((_a = joinState == null ? void 0 : joinState.context.space.invitation) == null ? void 0 : _a.spaceKey);
|
|
840
920
|
const name = space == null ? void 0 : space.properties.name;
|
|
841
921
|
const nameId = useId2(mode === "halo-only" ? "identityDisplayName" : "spaceDisplayName");
|
|
842
|
-
const
|
|
843
|
-
const
|
|
844
|
-
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({
|
|
845
924
|
variant: "ghost"
|
|
846
925
|
}, onExit && {
|
|
847
926
|
onClick: onExit
|
|
848
927
|
}, {
|
|
849
|
-
className:
|
|
928
|
+
className: mx14(defaultDescription2, "plb-0 pli-2 absolute block-start-1.5 inline-end-2 z-[1]"),
|
|
850
929
|
"data-testid": "join-exit"
|
|
851
|
-
}), /* @__PURE__ */
|
|
930
|
+
}), /* @__PURE__ */ React20.createElement(X3, {
|
|
852
931
|
weight: "bold",
|
|
853
|
-
className:
|
|
854
|
-
}), /* @__PURE__ */
|
|
932
|
+
className: getSize6(4)
|
|
933
|
+
}), /* @__PURE__ */ React20.createElement("span", {
|
|
855
934
|
className: "sr-only"
|
|
856
935
|
}, t("exit label")));
|
|
857
|
-
return /* @__PURE__ */
|
|
936
|
+
return /* @__PURE__ */ React20.createElement("div", {
|
|
858
937
|
role: "none",
|
|
859
|
-
className:
|
|
938
|
+
className: mx14(defaultSurface, "pbs-3 pbe-1 rounded-bs-md relative"),
|
|
860
939
|
ref
|
|
861
|
-
}, !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, {
|
|
862
941
|
level: 1,
|
|
863
|
-
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")),
|
|
864
943
|
id: titleId
|
|
865
|
-
}, 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", {
|
|
866
945
|
role: "group",
|
|
867
946
|
className: "flex items-center justify-center gap-2"
|
|
868
|
-
}, /* @__PURE__ */
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
}, invitationEmoji), name && /* @__PURE__ */ React17.createElement("p", {
|
|
947
|
+
}, /* @__PURE__ */ React20.createElement(InvitationEmoji, _extends14({}, {
|
|
948
|
+
invitationId
|
|
949
|
+
})), name && /* @__PURE__ */ React20.createElement("p", {
|
|
872
950
|
id: nameId
|
|
873
951
|
}, name)));
|
|
874
952
|
});
|
|
875
953
|
|
|
876
954
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/joinMachine.ts
|
|
877
955
|
import { useMachine } from "@xstate/react";
|
|
878
|
-
import { useCallback as
|
|
956
|
+
import { useCallback as useCallback5 } from "react";
|
|
879
957
|
import { assign, createMachine } from "xstate";
|
|
880
958
|
import { Invitation as Invitation4, InvitationEncoder } from "@dxos/client";
|
|
881
959
|
import { log } from "@dxos/log";
|
|
@@ -1257,7 +1335,7 @@ var defaultCodeFromUrl = (invitationType, text) => {
|
|
|
1257
1335
|
}
|
|
1258
1336
|
};
|
|
1259
1337
|
var useJoinMachine = (client, options) => {
|
|
1260
|
-
const redeemHaloInvitationCode =
|
|
1338
|
+
const redeemHaloInvitationCode = useCallback5(({ halo }) => {
|
|
1261
1339
|
if (halo.unredeemedCode) {
|
|
1262
1340
|
const invitationObservable = client.halo.acceptInvitation(InvitationEncoder.decode(defaultCodeFromUrl("halo", halo.unredeemedCode)));
|
|
1263
1341
|
return {
|
|
@@ -1271,7 +1349,7 @@ var useJoinMachine = (client, options) => {
|
|
|
1271
1349
|
}, [
|
|
1272
1350
|
client
|
|
1273
1351
|
]);
|
|
1274
|
-
const redeemSpaceInvitationCode =
|
|
1352
|
+
const redeemSpaceInvitationCode = useCallback5(({ space }) => {
|
|
1275
1353
|
if (space.unredeemedCode) {
|
|
1276
1354
|
const invitationObservable = client.acceptInvitation(InvitationEncoder.decode(defaultCodeFromUrl("space", space.unredeemedCode)));
|
|
1277
1355
|
return {
|
|
@@ -1301,17 +1379,17 @@ var useJoinMachine = (client, options) => {
|
|
|
1301
1379
|
|
|
1302
1380
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx
|
|
1303
1381
|
import { CaretRight, Plus, QrCode as QrCode2, Textbox } from "@phosphor-icons/react";
|
|
1304
|
-
import
|
|
1305
|
-
import { CompoundButton, getSize as
|
|
1382
|
+
import React22 from "react";
|
|
1383
|
+
import { CompoundButton, getSize as getSize8, useTranslation as useTranslation10 } from "@dxos/react-components";
|
|
1306
1384
|
|
|
1307
1385
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/ViewState.tsx
|
|
1308
1386
|
import { CheckCircle, HourglassSimple, X as X4 } from "@phosphor-icons/react";
|
|
1309
|
-
import
|
|
1387
|
+
import React21, { useMemo as useMemo2 } from "react";
|
|
1310
1388
|
import { Invitation as Invitation5 } from "@dxos/client";
|
|
1311
1389
|
import { useInvitationStatus as useInvitationStatus2 } from "@dxos/react-client";
|
|
1312
|
-
import { mx as
|
|
1313
|
-
function
|
|
1314
|
-
|
|
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) {
|
|
1315
1393
|
for (var i = 1; i < arguments.length; i++) {
|
|
1316
1394
|
var source = arguments[i];
|
|
1317
1395
|
for (var key in source) {
|
|
@@ -1322,30 +1400,30 @@ function _extends14() {
|
|
|
1322
1400
|
}
|
|
1323
1401
|
return target;
|
|
1324
1402
|
};
|
|
1325
|
-
return
|
|
1403
|
+
return _extends15.apply(this, arguments);
|
|
1326
1404
|
}
|
|
1327
|
-
var stripe =
|
|
1405
|
+
var stripe = mx15("rounded-full grow", getSize7(3));
|
|
1328
1406
|
var ViewStateHeading = ({ children, className, ...props }) => {
|
|
1329
|
-
return /* @__PURE__ */
|
|
1330
|
-
className:
|
|
1407
|
+
return /* @__PURE__ */ React21.createElement("h2", _extends15({}, props, {
|
|
1408
|
+
className: mx15("font-system-normal text-sm mbe-1 mli-1 text-center", className)
|
|
1331
1409
|
}), children);
|
|
1332
1410
|
};
|
|
1333
1411
|
var ViewState = ({ active, children, className, joinSend, joinState, ...props }) => {
|
|
1334
|
-
return /* @__PURE__ */
|
|
1412
|
+
return /* @__PURE__ */ React21.createElement("div", _extends15({
|
|
1335
1413
|
role: "none"
|
|
1336
1414
|
}, props, !active && {
|
|
1337
1415
|
"aria-hidden": true
|
|
1338
1416
|
}, {
|
|
1339
|
-
className:
|
|
1340
|
-
}), /* @__PURE__ */
|
|
1417
|
+
className: mx15("is-[50%] flex flex-col", active ? "order-2" : "order-4", className)
|
|
1418
|
+
}), /* @__PURE__ */ React21.createElement("div", {
|
|
1341
1419
|
role: "region",
|
|
1342
|
-
className:
|
|
1420
|
+
className: mx15(defaultSurface, "rounded-be-md grow shrink-0 flex flex-col gap-1 p-4 pbs-1")
|
|
1343
1421
|
}, children));
|
|
1344
1422
|
};
|
|
1345
1423
|
|
|
1346
1424
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx
|
|
1347
|
-
function
|
|
1348
|
-
|
|
1425
|
+
function _extends16() {
|
|
1426
|
+
_extends16 = Object.assign || function(target) {
|
|
1349
1427
|
for (var i = 1; i < arguments.length; i++) {
|
|
1350
1428
|
var source = arguments[i];
|
|
1351
1429
|
for (var key in source) {
|
|
@@ -1356,16 +1434,16 @@ function _extends15() {
|
|
|
1356
1434
|
}
|
|
1357
1435
|
return target;
|
|
1358
1436
|
};
|
|
1359
|
-
return
|
|
1437
|
+
return _extends16.apply(this, arguments);
|
|
1360
1438
|
}
|
|
1361
1439
|
var AdditionMethodSelector = (viewStateProps) => {
|
|
1362
1440
|
const disabled = !viewStateProps.active;
|
|
1363
1441
|
const { joinSend } = viewStateProps;
|
|
1364
|
-
const { t } =
|
|
1442
|
+
const { t } = useTranslation10("os");
|
|
1365
1443
|
const sharedButtonProps = {
|
|
1366
1444
|
disabled,
|
|
1367
|
-
after: /* @__PURE__ */
|
|
1368
|
-
className:
|
|
1445
|
+
after: /* @__PURE__ */ React22.createElement(CaretRight, {
|
|
1446
|
+
className: getSize8(4),
|
|
1369
1447
|
weight: "bold"
|
|
1370
1448
|
}),
|
|
1371
1449
|
slots: {
|
|
@@ -1374,34 +1452,34 @@ var AdditionMethodSelector = (viewStateProps) => {
|
|
|
1374
1452
|
}
|
|
1375
1453
|
}
|
|
1376
1454
|
};
|
|
1377
|
-
return /* @__PURE__ */
|
|
1455
|
+
return /* @__PURE__ */ React22.createElement(ViewState, _extends16({}, viewStateProps), /* @__PURE__ */ React22.createElement(ViewStateHeading, null, t("addition method selector title")), /* @__PURE__ */ React22.createElement("div", {
|
|
1378
1456
|
role: "none",
|
|
1379
1457
|
className: "flex flex-col gap-1 grow"
|
|
1380
|
-
}, /* @__PURE__ */
|
|
1458
|
+
}, /* @__PURE__ */ React22.createElement(CompoundButton, _extends16({}, sharedButtonProps, {
|
|
1381
1459
|
description: t("create identity description"),
|
|
1382
|
-
before: /* @__PURE__ */
|
|
1383
|
-
className:
|
|
1460
|
+
before: /* @__PURE__ */ React22.createElement(Plus, {
|
|
1461
|
+
className: getSize8(6)
|
|
1384
1462
|
}),
|
|
1385
1463
|
onClick: () => joinSend({
|
|
1386
1464
|
type: "createIdentity"
|
|
1387
1465
|
}),
|
|
1388
1466
|
"data-autofocus": "choosingAuthMethod",
|
|
1389
1467
|
"data-testid": "create-identity"
|
|
1390
|
-
}), t("create identity label")), /* @__PURE__ */
|
|
1468
|
+
}), t("create identity label")), /* @__PURE__ */ React22.createElement(CompoundButton, _extends16({}, sharedButtonProps, {
|
|
1391
1469
|
description: t("join identity description"),
|
|
1392
|
-
before: /* @__PURE__ */
|
|
1393
|
-
className:
|
|
1470
|
+
before: /* @__PURE__ */ React22.createElement(QrCode2, {
|
|
1471
|
+
className: getSize8(6)
|
|
1394
1472
|
}),
|
|
1395
1473
|
onClick: () => joinSend({
|
|
1396
1474
|
type: "acceptHaloInvitation"
|
|
1397
1475
|
}),
|
|
1398
1476
|
"data-testid": "join-identity"
|
|
1399
|
-
}), t("join identity label")), /* @__PURE__ */
|
|
1477
|
+
}), t("join identity label")), /* @__PURE__ */ React22.createElement(CompoundButton, _extends16({}, sharedButtonProps, {
|
|
1400
1478
|
// TODO(mykola): Implement recover.
|
|
1401
1479
|
disabled: true,
|
|
1402
1480
|
description: t("recover identity description"),
|
|
1403
|
-
before: /* @__PURE__ */
|
|
1404
|
-
className:
|
|
1481
|
+
before: /* @__PURE__ */ React22.createElement(Textbox, {
|
|
1482
|
+
className: getSize8(6)
|
|
1405
1483
|
}),
|
|
1406
1484
|
onClick: () => joinSend({
|
|
1407
1485
|
type: "recoverIdentity"
|
|
@@ -1411,11 +1489,11 @@ var AdditionMethodSelector = (viewStateProps) => {
|
|
|
1411
1489
|
};
|
|
1412
1490
|
|
|
1413
1491
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/IdentityAdded.tsx
|
|
1414
|
-
import { CaretLeft, CaretRight as CaretRight2, Check } from "@phosphor-icons/react";
|
|
1415
|
-
import
|
|
1416
|
-
import { Avatar as Avatar4, Button as
|
|
1417
|
-
function
|
|
1418
|
-
|
|
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) {
|
|
1419
1497
|
for (var i = 1; i < arguments.length; i++) {
|
|
1420
1498
|
var source = arguments[i];
|
|
1421
1499
|
for (var key in source) {
|
|
@@ -1426,25 +1504,25 @@ function _extends16() {
|
|
|
1426
1504
|
}
|
|
1427
1505
|
return target;
|
|
1428
1506
|
};
|
|
1429
|
-
return
|
|
1507
|
+
return _extends17.apply(this, arguments);
|
|
1430
1508
|
}
|
|
1431
1509
|
var Done = ({ onDone, doneActionParent, active }) => {
|
|
1432
1510
|
const disabled = !active;
|
|
1433
|
-
const { t } =
|
|
1434
|
-
const doneButton = /* @__PURE__ */
|
|
1511
|
+
const { t } = useTranslation11("os");
|
|
1512
|
+
const doneButton = /* @__PURE__ */ React23.createElement(Button6, _extends17({}, onDone && {
|
|
1435
1513
|
onClick: () => onDone(null)
|
|
1436
1514
|
}, {
|
|
1437
1515
|
disabled,
|
|
1438
1516
|
className: "grow flex items-center gap-2 pli-2",
|
|
1439
1517
|
"data-autofocus": "confirmingAddedIdentity",
|
|
1440
1518
|
"data-testid": "identity-added-done"
|
|
1441
|
-
}), /* @__PURE__ */
|
|
1519
|
+
}), /* @__PURE__ */ React23.createElement(CaretLeft, {
|
|
1442
1520
|
weight: "bold",
|
|
1443
|
-
className:
|
|
1444
|
-
}), /* @__PURE__ */
|
|
1521
|
+
className: mx16(getSize9(2), "invisible")
|
|
1522
|
+
}), /* @__PURE__ */ React23.createElement("span", {
|
|
1445
1523
|
className: "grow"
|
|
1446
|
-
}, t("done label")), /* @__PURE__ */
|
|
1447
|
-
className:
|
|
1524
|
+
}, t("done label")), /* @__PURE__ */ React23.createElement(Check2, {
|
|
1525
|
+
className: getSize9(4)
|
|
1448
1526
|
}));
|
|
1449
1527
|
return doneActionParent ? /* @__PURE__ */ cloneElement3(doneActionParent, {}, doneButton) : doneButton;
|
|
1450
1528
|
};
|
|
@@ -1452,24 +1530,24 @@ var IdentityAdded = ({ mode, addedIdentity, onDone, doneActionParent, ...viewSta
|
|
|
1452
1530
|
var _a, _b, _c, _d, _e;
|
|
1453
1531
|
const disabled = !viewStateProps.active;
|
|
1454
1532
|
const { joinSend } = viewStateProps;
|
|
1455
|
-
const { t } =
|
|
1456
|
-
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", {
|
|
1457
1535
|
role: "none",
|
|
1458
1536
|
className: "grow flex flex-col items-center justify-center text-center gap-2"
|
|
1459
|
-
}, /* @__PURE__ */
|
|
1537
|
+
}, /* @__PURE__ */ React23.createElement(Avatar4, {
|
|
1460
1538
|
size: 20,
|
|
1461
1539
|
fallbackValue: (_a = addedIdentity == null ? void 0 : addedIdentity.identityKey.toHex()) != null ? _a : "",
|
|
1462
|
-
label: /* @__PURE__ */
|
|
1463
|
-
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")
|
|
1464
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"),
|
|
1465
1543
|
variant: "circle",
|
|
1466
1544
|
status: "active"
|
|
1467
|
-
})), mode === "halo-only" ? /* @__PURE__ */
|
|
1545
|
+
})), mode === "halo-only" ? /* @__PURE__ */ React23.createElement(Done, _extends17({
|
|
1468
1546
|
onDone,
|
|
1469
1547
|
doneActionParent
|
|
1470
|
-
}, viewStateProps)) : /* @__PURE__ */
|
|
1548
|
+
}, viewStateProps)) : /* @__PURE__ */ React23.createElement("div", {
|
|
1471
1549
|
className: "flex gap-2"
|
|
1472
|
-
}, /* @__PURE__ */
|
|
1550
|
+
}, /* @__PURE__ */ React23.createElement(Button6, {
|
|
1473
1551
|
disabled: disabled || !addedIdentity,
|
|
1474
1552
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1475
1553
|
onClick: () => addedIdentity && joinSend({
|
|
@@ -1477,33 +1555,33 @@ var IdentityAdded = ({ mode, addedIdentity, onDone, doneActionParent, ...viewSta
|
|
|
1477
1555
|
identity: addedIdentity
|
|
1478
1556
|
}),
|
|
1479
1557
|
"data-autofocus": "confirmingAddedIdentity"
|
|
1480
|
-
}, /* @__PURE__ */
|
|
1558
|
+
}, /* @__PURE__ */ React23.createElement(CaretLeft, {
|
|
1481
1559
|
weight: "bold",
|
|
1482
|
-
className:
|
|
1483
|
-
}), /* @__PURE__ */
|
|
1560
|
+
className: mx16(getSize9(2), "invisible")
|
|
1561
|
+
}), /* @__PURE__ */ React23.createElement("span", {
|
|
1484
1562
|
className: "grow"
|
|
1485
|
-
}, t("continue label")), /* @__PURE__ */
|
|
1563
|
+
}, t("continue label")), /* @__PURE__ */ React23.createElement(CaretRight2, {
|
|
1486
1564
|
weight: "bold",
|
|
1487
|
-
className:
|
|
1488
|
-
})), /* @__PURE__ */
|
|
1565
|
+
className: getSize9(4)
|
|
1566
|
+
})), /* @__PURE__ */ React23.createElement(Button6, {
|
|
1489
1567
|
disabled,
|
|
1490
1568
|
onClick: () => joinSend({
|
|
1491
1569
|
type: "deselectAuthMethod"
|
|
1492
1570
|
}),
|
|
1493
1571
|
className: "flex items-center gap-2 pis-2 pie-4"
|
|
1494
|
-
}, /* @__PURE__ */
|
|
1572
|
+
}, /* @__PURE__ */ React23.createElement(CaretLeft, {
|
|
1495
1573
|
weight: "bold",
|
|
1496
|
-
className:
|
|
1497
|
-
}), /* @__PURE__ */
|
|
1574
|
+
className: getSize9(4)
|
|
1575
|
+
}), /* @__PURE__ */ React23.createElement("span", null, t("deselect identity label")))));
|
|
1498
1576
|
};
|
|
1499
1577
|
|
|
1500
1578
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/IdentityInput.tsx
|
|
1501
1579
|
import { CaretLeft as CaretLeft2, CaretRight as CaretRight3 } from "@phosphor-icons/react";
|
|
1502
|
-
import
|
|
1580
|
+
import React24, { useState as useState3 } from "react";
|
|
1503
1581
|
import { useClient as useClient4 } from "@dxos/react-client";
|
|
1504
|
-
import { Button as
|
|
1505
|
-
function
|
|
1506
|
-
|
|
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) {
|
|
1507
1585
|
for (var i = 1; i < arguments.length; i++) {
|
|
1508
1586
|
var source = arguments[i];
|
|
1509
1587
|
for (var key in source) {
|
|
@@ -1514,15 +1592,15 @@ function _extends17() {
|
|
|
1514
1592
|
}
|
|
1515
1593
|
return target;
|
|
1516
1594
|
};
|
|
1517
|
-
return
|
|
1595
|
+
return _extends18.apply(this, arguments);
|
|
1518
1596
|
}
|
|
1519
1597
|
var IdentityInput = ({ method, ...viewStateProps }) => {
|
|
1520
1598
|
const disabled = !viewStateProps.active;
|
|
1521
1599
|
const { joinSend } = viewStateProps;
|
|
1522
|
-
const { t } =
|
|
1523
|
-
const [inputValue, setInputValue] =
|
|
1600
|
+
const { t } = useTranslation12("os");
|
|
1601
|
+
const [inputValue, setInputValue] = useState3("");
|
|
1524
1602
|
const client = useClient4();
|
|
1525
|
-
const [validationMessage, setValidationMessage] =
|
|
1603
|
+
const [validationMessage, setValidationMessage] = useState3("");
|
|
1526
1604
|
const isRecover = method === "recover identity";
|
|
1527
1605
|
const handleNext = () => {
|
|
1528
1606
|
void client.halo.createIdentity({
|
|
@@ -1536,9 +1614,9 @@ var IdentityInput = ({ method, ...viewStateProps }) => {
|
|
|
1536
1614
|
setValidationMessage(t(isRecover ? "failed to recover identity message" : "failed to create identity message"));
|
|
1537
1615
|
});
|
|
1538
1616
|
};
|
|
1539
|
-
return /* @__PURE__ */
|
|
1617
|
+
return /* @__PURE__ */ React24.createElement(ViewState, _extends18({}, viewStateProps), /* @__PURE__ */ React24.createElement(Input, _extends18({
|
|
1540
1618
|
disabled,
|
|
1541
|
-
label: /* @__PURE__ */
|
|
1619
|
+
label: /* @__PURE__ */ React24.createElement(ViewStateHeading, null, t(isRecover ? "recover identity input label" : "new identity input label")),
|
|
1542
1620
|
onChange: ({ target: { value } }) => setInputValue(value),
|
|
1543
1621
|
slots: {
|
|
1544
1622
|
root: {
|
|
@@ -1554,44 +1632,44 @@ var IdentityInput = ({ method, ...viewStateProps }) => {
|
|
|
1554
1632
|
validationMessage
|
|
1555
1633
|
}, {
|
|
1556
1634
|
"data-testid": "identity-input"
|
|
1557
|
-
})), /* @__PURE__ */
|
|
1635
|
+
})), /* @__PURE__ */ React24.createElement("div", {
|
|
1558
1636
|
role: "none",
|
|
1559
1637
|
className: "grow"
|
|
1560
|
-
}), /* @__PURE__ */
|
|
1638
|
+
}), /* @__PURE__ */ React24.createElement("div", {
|
|
1561
1639
|
className: "flex gap-2"
|
|
1562
|
-
}, /* @__PURE__ */
|
|
1640
|
+
}, /* @__PURE__ */ React24.createElement(Button7, {
|
|
1563
1641
|
disabled,
|
|
1564
1642
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1565
1643
|
onClick: handleNext,
|
|
1566
1644
|
"data-testid": `${method === "recover identity" ? "recover" : "create"}-identity-input-continue`
|
|
1567
|
-
}, /* @__PURE__ */
|
|
1645
|
+
}, /* @__PURE__ */ React24.createElement(CaretLeft2, {
|
|
1568
1646
|
weight: "bold",
|
|
1569
|
-
className:
|
|
1570
|
-
}), /* @__PURE__ */
|
|
1647
|
+
className: mx17(getSize10(2), "invisible")
|
|
1648
|
+
}), /* @__PURE__ */ React24.createElement("span", {
|
|
1571
1649
|
className: "grow"
|
|
1572
|
-
}, t("continue label")), /* @__PURE__ */
|
|
1650
|
+
}, t("continue label")), /* @__PURE__ */ React24.createElement(CaretRight3, {
|
|
1573
1651
|
weight: "bold",
|
|
1574
|
-
className:
|
|
1575
|
-
})), /* @__PURE__ */
|
|
1652
|
+
className: getSize10(4)
|
|
1653
|
+
})), /* @__PURE__ */ React24.createElement(Button7, {
|
|
1576
1654
|
disabled,
|
|
1577
1655
|
onClick: () => joinSend({
|
|
1578
1656
|
type: "deselectAuthMethod"
|
|
1579
1657
|
}),
|
|
1580
1658
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1581
1659
|
"data-testid": `${method === "recover identity" ? "recover" : "create"}-identity-input-back`
|
|
1582
|
-
}, /* @__PURE__ */
|
|
1660
|
+
}, /* @__PURE__ */ React24.createElement(CaretLeft2, {
|
|
1583
1661
|
weight: "bold",
|
|
1584
|
-
className:
|
|
1585
|
-
}), /* @__PURE__ */
|
|
1662
|
+
className: getSize10(4)
|
|
1663
|
+
}), /* @__PURE__ */ React24.createElement("span", null, t("back label")))));
|
|
1586
1664
|
};
|
|
1587
1665
|
|
|
1588
1666
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationAccepted.tsx
|
|
1589
|
-
import { CaretLeft as CaretLeft3, Check as
|
|
1590
|
-
import
|
|
1667
|
+
import { CaretLeft as CaretLeft3, Check as Check3 } from "@phosphor-icons/react";
|
|
1668
|
+
import React25, { cloneElement as cloneElement4 } from "react";
|
|
1591
1669
|
import { useInvitationStatus as useInvitationStatus3 } from "@dxos/react-client";
|
|
1592
|
-
import { Button as
|
|
1593
|
-
function
|
|
1594
|
-
|
|
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) {
|
|
1595
1673
|
for (var i = 1; i < arguments.length; i++) {
|
|
1596
1674
|
var source = arguments[i];
|
|
1597
1675
|
for (var key in source) {
|
|
@@ -1602,36 +1680,36 @@ function _extends18() {
|
|
|
1602
1680
|
}
|
|
1603
1681
|
return target;
|
|
1604
1682
|
};
|
|
1605
|
-
return
|
|
1683
|
+
return _extends19.apply(this, arguments);
|
|
1606
1684
|
}
|
|
1607
1685
|
var PureInvitationAcceptedContent = ({ onDone, result, Domain, doneActionParent, active }) => {
|
|
1608
1686
|
const disabled = !active;
|
|
1609
|
-
const { t } =
|
|
1610
|
-
const doneButton = /* @__PURE__ */
|
|
1687
|
+
const { t } = useTranslation13("os");
|
|
1688
|
+
const doneButton = /* @__PURE__ */ React25.createElement(Button8, _extends19({}, onDone && {
|
|
1611
1689
|
onClick: () => onDone(result)
|
|
1612
1690
|
}, {
|
|
1613
1691
|
disabled,
|
|
1614
1692
|
className: "flex items-center gap-2 pli-2",
|
|
1615
1693
|
"data-autofocus": `success${Domain}Invitation finishingJoining${Domain}`,
|
|
1616
1694
|
"data-testid": `${Domain.toLowerCase()}-invitation-accepted-done`
|
|
1617
|
-
}), /* @__PURE__ */
|
|
1695
|
+
}), /* @__PURE__ */ React25.createElement(CaretLeft3, {
|
|
1618
1696
|
weight: "bold",
|
|
1619
|
-
className:
|
|
1620
|
-
}), /* @__PURE__ */
|
|
1697
|
+
className: mx18(getSize11(2), "invisible")
|
|
1698
|
+
}), /* @__PURE__ */ React25.createElement("span", {
|
|
1621
1699
|
className: "grow"
|
|
1622
|
-
}, t("done label")), /* @__PURE__ */
|
|
1623
|
-
className:
|
|
1700
|
+
}, t("done label")), /* @__PURE__ */ React25.createElement(Check3, {
|
|
1701
|
+
className: getSize11(4)
|
|
1624
1702
|
}));
|
|
1625
|
-
return /* @__PURE__ */
|
|
1703
|
+
return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement("p", {
|
|
1626
1704
|
className: "text-center text-sm font-system-normal"
|
|
1627
|
-
}, t("welcome message")), /* @__PURE__ */
|
|
1705
|
+
}, t("welcome message")), /* @__PURE__ */ React25.createElement("div", {
|
|
1628
1706
|
role: "none",
|
|
1629
1707
|
className: "grow"
|
|
1630
1708
|
}), doneActionParent ? /* @__PURE__ */ cloneElement4(doneActionParent, {}, doneButton) : doneButton);
|
|
1631
1709
|
};
|
|
1632
1710
|
var InvitationAcceptedContent = (props) => {
|
|
1633
1711
|
const { result } = useInvitationStatus3(props.activeInvitation);
|
|
1634
|
-
return /* @__PURE__ */
|
|
1712
|
+
return /* @__PURE__ */ React25.createElement(PureInvitationAcceptedContent, _extends19({}, props, {
|
|
1635
1713
|
result
|
|
1636
1714
|
}));
|
|
1637
1715
|
};
|
|
@@ -1639,19 +1717,19 @@ var InvitationAccepted = (props) => {
|
|
|
1639
1717
|
var _a;
|
|
1640
1718
|
const { Domain, doneActionParent: _doneActionParent, onDone: _onDone, ...viewStateProps } = props;
|
|
1641
1719
|
const activeInvitation = (_a = viewStateProps.joinState) == null ? void 0 : _a.context[Domain.toLowerCase()].invitationObservable;
|
|
1642
|
-
return /* @__PURE__ */
|
|
1720
|
+
return /* @__PURE__ */ React25.createElement(ViewState, _extends19({}, viewStateProps), !activeInvitation ? /* @__PURE__ */ React25.createElement(PureInvitationAcceptedContent, _extends19({}, props, {
|
|
1643
1721
|
result: null
|
|
1644
|
-
})) : /* @__PURE__ */
|
|
1722
|
+
})) : /* @__PURE__ */ React25.createElement(InvitationAcceptedContent, _extends19({}, props, {
|
|
1645
1723
|
activeInvitation
|
|
1646
1724
|
})));
|
|
1647
1725
|
};
|
|
1648
1726
|
|
|
1649
1727
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationInput.tsx
|
|
1650
1728
|
import { CaretLeft as CaretLeft4, CaretRight as CaretRight4 } from "@phosphor-icons/react";
|
|
1651
|
-
import
|
|
1652
|
-
import { Button as
|
|
1653
|
-
function
|
|
1654
|
-
|
|
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) {
|
|
1655
1733
|
for (var i = 1; i < arguments.length; i++) {
|
|
1656
1734
|
var source = arguments[i];
|
|
1657
1735
|
for (var key in source) {
|
|
@@ -1662,14 +1740,14 @@ function _extends19() {
|
|
|
1662
1740
|
}
|
|
1663
1741
|
return target;
|
|
1664
1742
|
};
|
|
1665
|
-
return
|
|
1743
|
+
return _extends20.apply(this, arguments);
|
|
1666
1744
|
}
|
|
1667
1745
|
var InvitationInput = ({ Domain, ...viewStateProps }) => {
|
|
1668
1746
|
const disabled = !viewStateProps.active;
|
|
1669
1747
|
const { joinSend, joinState } = viewStateProps;
|
|
1670
|
-
const { t } =
|
|
1748
|
+
const { t } = useTranslation14("os");
|
|
1671
1749
|
const contextUnredeemedCode = joinState == null ? void 0 : joinState.context[Domain.toLowerCase()].unredeemedCode;
|
|
1672
|
-
const [inputValue, setInputValue] =
|
|
1750
|
+
const [inputValue, setInputValue] = useState4(contextUnredeemedCode != null ? contextUnredeemedCode : "");
|
|
1673
1751
|
useEffect(() => {
|
|
1674
1752
|
contextUnredeemedCode && setInputValue(contextUnredeemedCode != null ? contextUnredeemedCode : "");
|
|
1675
1753
|
}, [
|
|
@@ -1679,9 +1757,9 @@ var InvitationInput = ({ Domain, ...viewStateProps }) => {
|
|
|
1679
1757
|
type: `set${Domain}InvitationCode`,
|
|
1680
1758
|
code: inputValue
|
|
1681
1759
|
});
|
|
1682
|
-
return /* @__PURE__ */
|
|
1760
|
+
return /* @__PURE__ */ React26.createElement(ViewState, _extends20({}, viewStateProps), /* @__PURE__ */ React26.createElement(Input2, {
|
|
1683
1761
|
disabled,
|
|
1684
|
-
label: /* @__PURE__ */
|
|
1762
|
+
label: /* @__PURE__ */ React26.createElement(ViewStateHeading, null, t("invitation input label")),
|
|
1685
1763
|
value: inputValue,
|
|
1686
1764
|
onChange: ({ target: { value } }) => setInputValue(value),
|
|
1687
1765
|
slots: {
|
|
@@ -1694,44 +1772,44 @@ var InvitationInput = ({ Domain, ...viewStateProps }) => {
|
|
|
1694
1772
|
onKeyUp: ({ key }) => key === "Enter" && handleNext()
|
|
1695
1773
|
}
|
|
1696
1774
|
}
|
|
1697
|
-
}), /* @__PURE__ */
|
|
1775
|
+
}), /* @__PURE__ */ React26.createElement("div", {
|
|
1698
1776
|
role: "none",
|
|
1699
1777
|
className: "grow"
|
|
1700
|
-
}), /* @__PURE__ */
|
|
1778
|
+
}), /* @__PURE__ */ React26.createElement("div", {
|
|
1701
1779
|
className: "flex gap-2"
|
|
1702
|
-
}, /* @__PURE__ */
|
|
1780
|
+
}, /* @__PURE__ */ React26.createElement(Button9, {
|
|
1703
1781
|
disabled,
|
|
1704
1782
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1705
1783
|
onClick: handleNext,
|
|
1706
1784
|
"data-testid": `${Domain.toLowerCase()}-invitation-input-continue`
|
|
1707
|
-
}, /* @__PURE__ */
|
|
1785
|
+
}, /* @__PURE__ */ React26.createElement(CaretLeft4, {
|
|
1708
1786
|
weight: "bold",
|
|
1709
|
-
className:
|
|
1710
|
-
}), /* @__PURE__ */
|
|
1787
|
+
className: mx19(getSize12(2), "invisible")
|
|
1788
|
+
}), /* @__PURE__ */ React26.createElement("span", {
|
|
1711
1789
|
className: "grow"
|
|
1712
|
-
}, t("continue label")), /* @__PURE__ */
|
|
1790
|
+
}, t("continue label")), /* @__PURE__ */ React26.createElement(CaretRight4, {
|
|
1713
1791
|
weight: "bold",
|
|
1714
|
-
className:
|
|
1715
|
-
})), /* @__PURE__ */
|
|
1792
|
+
className: getSize12(4)
|
|
1793
|
+
})), /* @__PURE__ */ React26.createElement(Button9, {
|
|
1716
1794
|
disabled: Domain === "Space",
|
|
1717
1795
|
onClick: () => joinSend({
|
|
1718
1796
|
type: "deselectAuthMethod"
|
|
1719
1797
|
}),
|
|
1720
1798
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1721
1799
|
"data-testid": `${Domain.toLowerCase()}-invitation-input-back`
|
|
1722
|
-
}, /* @__PURE__ */
|
|
1800
|
+
}, /* @__PURE__ */ React26.createElement(CaretLeft4, {
|
|
1723
1801
|
weight: "bold",
|
|
1724
|
-
className:
|
|
1725
|
-
}), /* @__PURE__ */
|
|
1802
|
+
className: getSize12(4)
|
|
1803
|
+
}), /* @__PURE__ */ React26.createElement("span", null, t("back label")))));
|
|
1726
1804
|
};
|
|
1727
1805
|
|
|
1728
1806
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationRescuer.tsx
|
|
1729
1807
|
import { ArrowsClockwise, CaretLeft as CaretLeft5, CaretRight as CaretRight5 } from "@phosphor-icons/react";
|
|
1730
|
-
import
|
|
1808
|
+
import React27 from "react";
|
|
1731
1809
|
import { Invitation as Invitation6 } from "@dxos/client";
|
|
1732
|
-
import { Button as
|
|
1733
|
-
function
|
|
1734
|
-
|
|
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) {
|
|
1735
1813
|
for (var i = 1; i < arguments.length; i++) {
|
|
1736
1814
|
var source = arguments[i];
|
|
1737
1815
|
for (var key in source) {
|
|
@@ -1742,33 +1820,33 @@ function _extends20() {
|
|
|
1742
1820
|
}
|
|
1743
1821
|
return target;
|
|
1744
1822
|
};
|
|
1745
|
-
return
|
|
1823
|
+
return _extends21.apply(this, arguments);
|
|
1746
1824
|
}
|
|
1747
1825
|
var InvitationActions = ({ invitationState, disabled, joinSend, joinState, Domain }) => {
|
|
1748
|
-
const { t } =
|
|
1826
|
+
const { t } = useTranslation15("os");
|
|
1749
1827
|
const invitationType = Domain.toLowerCase();
|
|
1750
1828
|
switch (invitationState) {
|
|
1751
1829
|
case Invitation6.State.CONNECTING:
|
|
1752
|
-
return /* @__PURE__ */
|
|
1830
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(ViewStateHeading, {
|
|
1753
1831
|
className: defaultDescription3
|
|
1754
|
-
}, t("connecting status label")), /* @__PURE__ */
|
|
1832
|
+
}, t("connecting status label")), /* @__PURE__ */ React27.createElement("div", {
|
|
1755
1833
|
role: "none",
|
|
1756
1834
|
className: "grow"
|
|
1757
|
-
}), /* @__PURE__ */
|
|
1835
|
+
}), /* @__PURE__ */ React27.createElement("div", {
|
|
1758
1836
|
className: "flex gap-2"
|
|
1759
|
-
}, /* @__PURE__ */
|
|
1837
|
+
}, /* @__PURE__ */ React27.createElement(Button10, {
|
|
1760
1838
|
disabled: true,
|
|
1761
1839
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1762
1840
|
"data-testid": "next"
|
|
1763
|
-
}, /* @__PURE__ */
|
|
1841
|
+
}, /* @__PURE__ */ React27.createElement(CaretLeft5, {
|
|
1764
1842
|
weight: "bold",
|
|
1765
|
-
className:
|
|
1766
|
-
}), /* @__PURE__ */
|
|
1843
|
+
className: mx20(getSize13(2), "invisible")
|
|
1844
|
+
}), /* @__PURE__ */ React27.createElement("span", {
|
|
1767
1845
|
className: "grow"
|
|
1768
|
-
}, t("next label")), /* @__PURE__ */
|
|
1846
|
+
}, t("next label")), /* @__PURE__ */ React27.createElement(CaretRight5, {
|
|
1769
1847
|
weight: "bold",
|
|
1770
|
-
className:
|
|
1771
|
-
})), /* @__PURE__ */
|
|
1848
|
+
className: getSize13(4)
|
|
1849
|
+
})), /* @__PURE__ */ React27.createElement(Button10, {
|
|
1772
1850
|
disabled,
|
|
1773
1851
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1774
1852
|
onClick: () => {
|
|
@@ -1776,33 +1854,33 @@ var InvitationActions = ({ invitationState, disabled, joinSend, joinState, Domai
|
|
|
1776
1854
|
return (_a = joinState == null ? void 0 : joinState.context[invitationType].invitationObservable) == null ? void 0 : _a.cancel();
|
|
1777
1855
|
},
|
|
1778
1856
|
"data-testid": "invitation-rescuer-cancel"
|
|
1779
|
-
}, /* @__PURE__ */
|
|
1857
|
+
}, /* @__PURE__ */ React27.createElement(CaretLeft5, {
|
|
1780
1858
|
weight: "bold",
|
|
1781
|
-
className:
|
|
1782
|
-
}), /* @__PURE__ */
|
|
1859
|
+
className: getSize13(4)
|
|
1860
|
+
}), /* @__PURE__ */ React27.createElement("span", null, t("cancel label")))));
|
|
1783
1861
|
case Invitation6.State.TIMEOUT:
|
|
1784
1862
|
case Invitation6.State.CANCELLED:
|
|
1785
1863
|
case Invitation6.State.ERROR:
|
|
1786
1864
|
default:
|
|
1787
|
-
return /* @__PURE__ */
|
|
1865
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(ViewStateHeading, {
|
|
1788
1866
|
className: defaultDescription3
|
|
1789
|
-
}, 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", {
|
|
1790
1868
|
role: "none",
|
|
1791
1869
|
className: "grow"
|
|
1792
|
-
}), /* @__PURE__ */
|
|
1870
|
+
}), /* @__PURE__ */ React27.createElement(Button10, {
|
|
1793
1871
|
disabled,
|
|
1794
1872
|
className: "flex items-center gap-2 pli-2",
|
|
1795
1873
|
onClick: () => joinSend({
|
|
1796
1874
|
type: `reset${Domain}Invitation`
|
|
1797
1875
|
}),
|
|
1798
1876
|
"data-testid": "invitation-rescuer-reset"
|
|
1799
|
-
}, /* @__PURE__ */
|
|
1877
|
+
}, /* @__PURE__ */ React27.createElement(CaretLeft5, {
|
|
1800
1878
|
weight: "bold",
|
|
1801
|
-
className:
|
|
1802
|
-
}), /* @__PURE__ */
|
|
1879
|
+
className: mx20(getSize13(5), "invisible")
|
|
1880
|
+
}), /* @__PURE__ */ React27.createElement("span", {
|
|
1803
1881
|
className: "grow"
|
|
1804
|
-
}, t("reset label")), /* @__PURE__ */
|
|
1805
|
-
className:
|
|
1882
|
+
}, t("reset label")), /* @__PURE__ */ React27.createElement(ArrowsClockwise, {
|
|
1883
|
+
className: getSize13(4)
|
|
1806
1884
|
})));
|
|
1807
1885
|
}
|
|
1808
1886
|
};
|
|
@@ -1811,11 +1889,11 @@ var InvitationRescuer = ({ Domain, ...viewStateProps }) => {
|
|
|
1811
1889
|
const disabled = !viewStateProps.active;
|
|
1812
1890
|
const { joinSend, joinState } = viewStateProps;
|
|
1813
1891
|
const invitationState = (_a = joinState == null ? void 0 : joinState.context[Domain.toLowerCase()].invitation) == null ? void 0 : _a.state;
|
|
1814
|
-
const { t } =
|
|
1815
|
-
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", {
|
|
1816
1894
|
role: "none",
|
|
1817
1895
|
className: "grow"
|
|
1818
|
-
}), /* @__PURE__ */
|
|
1896
|
+
}), /* @__PURE__ */ React27.createElement(Button10, {
|
|
1819
1897
|
disabled,
|
|
1820
1898
|
className: "flex items-center gap-2 pli-2",
|
|
1821
1899
|
"data-autofocus": `inputting${Domain}InvitationCode`,
|
|
@@ -1823,14 +1901,14 @@ var InvitationRescuer = ({ Domain, ...viewStateProps }) => {
|
|
|
1823
1901
|
onClick: () => joinSend({
|
|
1824
1902
|
type: `reset${Domain}Invitation`
|
|
1825
1903
|
})
|
|
1826
|
-
}, /* @__PURE__ */
|
|
1904
|
+
}, /* @__PURE__ */ React27.createElement(CaretLeft5, {
|
|
1827
1905
|
weight: "bold",
|
|
1828
|
-
className:
|
|
1829
|
-
}), /* @__PURE__ */
|
|
1906
|
+
className: mx20(getSize13(5), "invisible")
|
|
1907
|
+
}), /* @__PURE__ */ React27.createElement("span", {
|
|
1830
1908
|
className: "grow"
|
|
1831
|
-
}, t("reset label")), /* @__PURE__ */
|
|
1832
|
-
className:
|
|
1833
|
-
}))) : /* @__PURE__ */
|
|
1909
|
+
}, t("reset label")), /* @__PURE__ */ React27.createElement(ArrowsClockwise, {
|
|
1910
|
+
className: getSize13(5)
|
|
1911
|
+
}))) : /* @__PURE__ */ React27.createElement(InvitationActions, _extends21({}, {
|
|
1834
1912
|
invitationState,
|
|
1835
1913
|
disabled,
|
|
1836
1914
|
joinSend,
|
|
@@ -1841,11 +1919,11 @@ var InvitationRescuer = ({ Domain, ...viewStateProps }) => {
|
|
|
1841
1919
|
|
|
1842
1920
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx
|
|
1843
1921
|
import { CaretLeft as CaretLeft6, CaretRight as CaretRight6 } from "@phosphor-icons/react";
|
|
1844
|
-
import
|
|
1922
|
+
import React28, { useCallback as useCallback6, useState as useState5 } from "react";
|
|
1845
1923
|
import { useInvitationStatus as useInvitationStatus4 } from "@dxos/react-client";
|
|
1846
|
-
import { Button as
|
|
1847
|
-
function
|
|
1848
|
-
|
|
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) {
|
|
1849
1927
|
for (var i = 1; i < arguments.length; i++) {
|
|
1850
1928
|
var source = arguments[i];
|
|
1851
1929
|
for (var key in source) {
|
|
@@ -1856,14 +1934,14 @@ function _extends21() {
|
|
|
1856
1934
|
}
|
|
1857
1935
|
return target;
|
|
1858
1936
|
};
|
|
1859
|
-
return
|
|
1937
|
+
return _extends22.apply(this, arguments);
|
|
1860
1938
|
}
|
|
1861
1939
|
var pinLength = 6;
|
|
1862
1940
|
var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinState, Domain, onChange, onAuthenticate }) => {
|
|
1863
|
-
const { t } =
|
|
1941
|
+
const { t } = useTranslation16("os");
|
|
1864
1942
|
const invitationType = Domain.toLowerCase();
|
|
1865
|
-
return /* @__PURE__ */
|
|
1866
|
-
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")),
|
|
1867
1945
|
size: "pin",
|
|
1868
1946
|
length: pinLength,
|
|
1869
1947
|
onChange,
|
|
@@ -1889,26 +1967,26 @@ var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinStat
|
|
|
1889
1967
|
}, failed && {
|
|
1890
1968
|
validationValence: "error",
|
|
1891
1969
|
validationMessage: t("failed to authenticate message")
|
|
1892
|
-
})), /* @__PURE__ */
|
|
1970
|
+
})), /* @__PURE__ */ React28.createElement("div", {
|
|
1893
1971
|
role: "none",
|
|
1894
1972
|
className: "grow"
|
|
1895
|
-
}), /* @__PURE__ */
|
|
1973
|
+
}), /* @__PURE__ */ React28.createElement("div", {
|
|
1896
1974
|
className: "flex gap-2"
|
|
1897
|
-
}, /* @__PURE__ */
|
|
1975
|
+
}, /* @__PURE__ */ React28.createElement(Button11, {
|
|
1898
1976
|
disabled,
|
|
1899
1977
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1900
1978
|
onClick: onAuthenticate,
|
|
1901
1979
|
"data-autofocus-pinlength": invitationType,
|
|
1902
1980
|
"data-testid": `${invitationType}-invitation-authenticator-next`
|
|
1903
|
-
}, /* @__PURE__ */
|
|
1981
|
+
}, /* @__PURE__ */ React28.createElement(CaretLeft6, {
|
|
1904
1982
|
weight: "bold",
|
|
1905
|
-
className:
|
|
1906
|
-
}), /* @__PURE__ */
|
|
1983
|
+
className: mx21(getSize14(2), "invisible")
|
|
1984
|
+
}), /* @__PURE__ */ React28.createElement("span", {
|
|
1907
1985
|
className: "grow"
|
|
1908
|
-
}, t("next label")), /* @__PURE__ */
|
|
1986
|
+
}, t("next label")), /* @__PURE__ */ React28.createElement(CaretRight6, {
|
|
1909
1987
|
weight: "bold",
|
|
1910
|
-
className:
|
|
1911
|
-
})), /* @__PURE__ */
|
|
1988
|
+
className: getSize14(4)
|
|
1989
|
+
})), /* @__PURE__ */ React28.createElement(Button11, {
|
|
1912
1990
|
disabled,
|
|
1913
1991
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1914
1992
|
onClick: () => {
|
|
@@ -1916,16 +1994,16 @@ var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinStat
|
|
|
1916
1994
|
return (_a = joinState == null ? void 0 : joinState.context[invitationType].invitationObservable) == null ? void 0 : _a.cancel();
|
|
1917
1995
|
},
|
|
1918
1996
|
"data-testid": `${invitationType}-invitation-authenticator-cancel`
|
|
1919
|
-
}, /* @__PURE__ */
|
|
1997
|
+
}, /* @__PURE__ */ React28.createElement(CaretLeft6, {
|
|
1920
1998
|
weight: "bold",
|
|
1921
|
-
className:
|
|
1922
|
-
}), /* @__PURE__ */
|
|
1999
|
+
className: getSize14(4)
|
|
2000
|
+
}), /* @__PURE__ */ React28.createElement("span", null, t("cancel label")))));
|
|
1923
2001
|
};
|
|
1924
2002
|
var InvitationAuthenticatorContent = ({ joinSend, joinState, disabled, invitation, Domain, failed }) => {
|
|
1925
2003
|
const invitationType = Domain.toLowerCase();
|
|
1926
|
-
const [pinValue, setPinValue] =
|
|
2004
|
+
const [pinValue, setPinValue] = useState5("");
|
|
1927
2005
|
const { authenticate } = useInvitationStatus4(invitation);
|
|
1928
|
-
const onAuthenticate =
|
|
2006
|
+
const onAuthenticate = useCallback6(() => {
|
|
1929
2007
|
joinSend({
|
|
1930
2008
|
type: `authenticate${Domain}VerificationCode`
|
|
1931
2009
|
});
|
|
@@ -1935,7 +2013,7 @@ var InvitationAuthenticatorContent = ({ joinSend, joinState, disabled, invitatio
|
|
|
1935
2013
|
authenticate,
|
|
1936
2014
|
pinValue
|
|
1937
2015
|
]);
|
|
1938
|
-
const onChange =
|
|
2016
|
+
const onChange = useCallback6(({ target: { value } }) => {
|
|
1939
2017
|
var _a;
|
|
1940
2018
|
setPinValue(value);
|
|
1941
2019
|
if (value.length === pinLength) {
|
|
@@ -1945,7 +2023,7 @@ var InvitationAuthenticatorContent = ({ joinSend, joinState, disabled, invitatio
|
|
|
1945
2023
|
authenticate,
|
|
1946
2024
|
pinValue
|
|
1947
2025
|
]);
|
|
1948
|
-
return /* @__PURE__ */
|
|
2026
|
+
return /* @__PURE__ */ React28.createElement(PureInvitationAuthenticatorContent, _extends22({}, {
|
|
1949
2027
|
disabled,
|
|
1950
2028
|
failed,
|
|
1951
2029
|
joinSend,
|
|
@@ -1962,7 +2040,7 @@ var InvitationAuthenticator = ({ failed, Domain, ...viewStateProps }) => {
|
|
|
1962
2040
|
"authenticating"
|
|
1963
2041
|
].some((str) => joinState == null ? void 0 : joinState.configuration[0].id.includes(str));
|
|
1964
2042
|
const activeInvitation = joinState == null ? void 0 : joinState.context[Domain.toLowerCase()].invitationObservable;
|
|
1965
|
-
return /* @__PURE__ */
|
|
2043
|
+
return /* @__PURE__ */ React28.createElement(ViewState, _extends22({}, viewStateProps), !activeInvitation ? /* @__PURE__ */ React28.createElement(PureInvitationAuthenticatorContent, _extends22({}, {
|
|
1966
2044
|
disabled,
|
|
1967
2045
|
failed,
|
|
1968
2046
|
joinSend,
|
|
@@ -1972,7 +2050,7 @@ var InvitationAuthenticator = ({ failed, Domain, ...viewStateProps }) => {
|
|
|
1972
2050
|
},
|
|
1973
2051
|
onAuthenticate: () => {
|
|
1974
2052
|
}
|
|
1975
|
-
})) : /* @__PURE__ */
|
|
2053
|
+
})) : /* @__PURE__ */ React28.createElement(InvitationAuthenticatorContent, _extends22({}, {
|
|
1976
2054
|
disabled,
|
|
1977
2055
|
failed,
|
|
1978
2056
|
invitation: activeInvitation,
|
|
@@ -1983,8 +2061,8 @@ var InvitationAuthenticator = ({ failed, Domain, ...viewStateProps }) => {
|
|
|
1983
2061
|
};
|
|
1984
2062
|
|
|
1985
2063
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinPanel.tsx
|
|
1986
|
-
function
|
|
1987
|
-
|
|
2064
|
+
function _extends23() {
|
|
2065
|
+
_extends23 = Object.assign || function(target) {
|
|
1988
2066
|
for (var i = 1; i < arguments.length; i++) {
|
|
1989
2067
|
var source = arguments[i];
|
|
1990
2068
|
for (var key in source) {
|
|
@@ -1995,7 +2073,7 @@ function _extends22() {
|
|
|
1995
2073
|
}
|
|
1996
2074
|
return target;
|
|
1997
2075
|
};
|
|
1998
|
-
return
|
|
2076
|
+
return _extends23.apply(this, arguments);
|
|
1999
2077
|
}
|
|
2000
2078
|
var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, onExit, doneActionParent, onDone, preventExit }) => {
|
|
2001
2079
|
const client = useClient5();
|
|
@@ -2038,43 +2116,43 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2038
2116
|
joinState.value,
|
|
2039
2117
|
hasIosKeyboard
|
|
2040
2118
|
]);
|
|
2041
|
-
return /* @__PURE__ */
|
|
2119
|
+
return /* @__PURE__ */ React29.createElement(DensityProvider4, {
|
|
2042
2120
|
density: "fine"
|
|
2043
|
-
}, /* @__PURE__ */
|
|
2121
|
+
}, /* @__PURE__ */ React29.createElement(JoinHeading, _extends23({}, {
|
|
2044
2122
|
mode,
|
|
2045
2123
|
titleId,
|
|
2046
2124
|
joinState,
|
|
2047
2125
|
onExit,
|
|
2048
2126
|
exitActionParent,
|
|
2049
2127
|
preventExit
|
|
2050
|
-
})), /* @__PURE__ */
|
|
2128
|
+
})), /* @__PURE__ */ React29.createElement("div", {
|
|
2051
2129
|
role: "none",
|
|
2052
2130
|
className: "is-full overflow-hidden"
|
|
2053
|
-
}, /* @__PURE__ */
|
|
2131
|
+
}, /* @__PURE__ */ React29.createElement("div", {
|
|
2054
2132
|
role: "none",
|
|
2055
2133
|
className: "flex is-[1200%]",
|
|
2056
2134
|
"aria-live": "polite"
|
|
2057
|
-
}, /* @__PURE__ */
|
|
2135
|
+
}, /* @__PURE__ */ React29.createElement(AdditionMethodSelector, _extends23({}, {
|
|
2058
2136
|
joinState,
|
|
2059
2137
|
joinSend,
|
|
2060
2138
|
active: joinState.matches({
|
|
2061
2139
|
choosingIdentity: "choosingAuthMethod"
|
|
2062
2140
|
})
|
|
2063
|
-
})), /* @__PURE__ */
|
|
2141
|
+
})), /* @__PURE__ */ React29.createElement(IdentityInput, _extends23({}, {
|
|
2064
2142
|
joinState,
|
|
2065
2143
|
joinSend,
|
|
2066
2144
|
active: joinState.matches({
|
|
2067
2145
|
choosingIdentity: "creatingIdentity"
|
|
2068
2146
|
}),
|
|
2069
2147
|
method: "create identity"
|
|
2070
|
-
})), /* @__PURE__ */
|
|
2148
|
+
})), /* @__PURE__ */ React29.createElement(IdentityInput, _extends23({}, {
|
|
2071
2149
|
joinState,
|
|
2072
2150
|
joinSend,
|
|
2073
2151
|
active: joinState.matches({
|
|
2074
2152
|
choosingIdentity: "recoveringIdentity"
|
|
2075
2153
|
}),
|
|
2076
2154
|
method: "recover identity"
|
|
2077
|
-
})), /* @__PURE__ */
|
|
2155
|
+
})), /* @__PURE__ */ React29.createElement(InvitationInput, _extends23({}, {
|
|
2078
2156
|
joinState,
|
|
2079
2157
|
joinSend,
|
|
2080
2158
|
active: joinState.matches({
|
|
@@ -2083,7 +2161,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2083
2161
|
}
|
|
2084
2162
|
}),
|
|
2085
2163
|
Domain: "Halo"
|
|
2086
|
-
})), /* @__PURE__ */
|
|
2164
|
+
})), /* @__PURE__ */ React29.createElement(InvitationRescuer, _extends23({}, {
|
|
2087
2165
|
joinState,
|
|
2088
2166
|
joinSend,
|
|
2089
2167
|
active: [
|
|
@@ -2103,7 +2181,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2103
2181
|
}
|
|
2104
2182
|
].some(joinState.matches),
|
|
2105
2183
|
Domain: "Halo"
|
|
2106
|
-
})), /* @__PURE__ */
|
|
2184
|
+
})), /* @__PURE__ */ React29.createElement(InvitationAuthenticator, _extends23({}, {
|
|
2107
2185
|
joinState,
|
|
2108
2186
|
joinSend,
|
|
2109
2187
|
active: [
|
|
@@ -2137,7 +2215,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2137
2215
|
}) && {
|
|
2138
2216
|
failed: true
|
|
2139
2217
|
}
|
|
2140
|
-
})), /* @__PURE__ */
|
|
2218
|
+
})), /* @__PURE__ */ React29.createElement(InvitationAccepted, _extends23({}, {
|
|
2141
2219
|
joinState,
|
|
2142
2220
|
joinSend,
|
|
2143
2221
|
active: [
|
|
@@ -2153,7 +2231,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2153
2231
|
Domain: "Halo",
|
|
2154
2232
|
doneActionParent,
|
|
2155
2233
|
onDone
|
|
2156
|
-
})), /* @__PURE__ */
|
|
2234
|
+
})), /* @__PURE__ */ React29.createElement(IdentityAdded, _extends23({}, {
|
|
2157
2235
|
joinState,
|
|
2158
2236
|
joinSend,
|
|
2159
2237
|
mode,
|
|
@@ -2162,14 +2240,14 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2162
2240
|
}),
|
|
2163
2241
|
doneActionParent,
|
|
2164
2242
|
onDone
|
|
2165
|
-
})), /* @__PURE__ */
|
|
2243
|
+
})), /* @__PURE__ */ React29.createElement(InvitationInput, _extends23({}, {
|
|
2166
2244
|
joinState,
|
|
2167
2245
|
joinSend,
|
|
2168
2246
|
active: joinState.matches({
|
|
2169
2247
|
acceptingSpaceInvitation: "inputtingSpaceInvitationCode"
|
|
2170
2248
|
}),
|
|
2171
2249
|
Domain: "Space"
|
|
2172
|
-
})), /* @__PURE__ */
|
|
2250
|
+
})), /* @__PURE__ */ React29.createElement(InvitationRescuer, _extends23({}, {
|
|
2173
2251
|
joinState,
|
|
2174
2252
|
joinSend,
|
|
2175
2253
|
active: [
|
|
@@ -2185,7 +2263,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2185
2263
|
}
|
|
2186
2264
|
].some(joinState.matches),
|
|
2187
2265
|
Domain: "Space"
|
|
2188
|
-
})), /* @__PURE__ */
|
|
2266
|
+
})), /* @__PURE__ */ React29.createElement(InvitationAuthenticator, _extends23({}, {
|
|
2189
2267
|
joinState,
|
|
2190
2268
|
joinSend,
|
|
2191
2269
|
active: [
|
|
@@ -2213,7 +2291,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2213
2291
|
}) && {
|
|
2214
2292
|
failed: true
|
|
2215
2293
|
}
|
|
2216
|
-
})), /* @__PURE__ */
|
|
2294
|
+
})), /* @__PURE__ */ React29.createElement(InvitationAccepted, _extends23({}, {
|
|
2217
2295
|
joinState,
|
|
2218
2296
|
joinSend,
|
|
2219
2297
|
active: joinState.matches("finishingJoiningSpace"),
|
|
@@ -2225,11 +2303,11 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2225
2303
|
|
|
2226
2304
|
// packages/apps/patterns/react-ui/src/panels/SpacePanel/SpacePanel.tsx
|
|
2227
2305
|
import { UserPlus as UserPlus2 } from "@phosphor-icons/react";
|
|
2228
|
-
import
|
|
2306
|
+
import React30, { useReducer as useReducer2 } from "react";
|
|
2229
2307
|
import { useSpaceInvitations as useSpaceInvitations2, observer } from "@dxos/react-client";
|
|
2230
|
-
import { Button as
|
|
2231
|
-
function
|
|
2232
|
-
|
|
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) {
|
|
2233
2311
|
for (var i = 1; i < arguments.length; i++) {
|
|
2234
2312
|
var source = arguments[i];
|
|
2235
2313
|
for (var key in source) {
|
|
@@ -2240,39 +2318,39 @@ function _extends23() {
|
|
|
2240
2318
|
}
|
|
2241
2319
|
return target;
|
|
2242
2320
|
};
|
|
2243
|
-
return
|
|
2321
|
+
return _extends24.apply(this, arguments);
|
|
2244
2322
|
}
|
|
2245
2323
|
var CurrentSpaceView = observer(({ space, createInvitationUrl, titleId }) => {
|
|
2246
|
-
const { t } =
|
|
2324
|
+
const { t } = useTranslation17("os");
|
|
2247
2325
|
const invitations = useSpaceInvitations2(space == null ? void 0 : space.key);
|
|
2248
2326
|
const name = space == null ? void 0 : space.properties.name;
|
|
2249
2327
|
if (!space) {
|
|
2250
2328
|
return null;
|
|
2251
2329
|
}
|
|
2252
|
-
return /* @__PURE__ */
|
|
2330
|
+
return /* @__PURE__ */ React30.createElement("div", {
|
|
2253
2331
|
role: "none",
|
|
2254
2332
|
className: "flex flex-col"
|
|
2255
|
-
}, /* @__PURE__ */
|
|
2333
|
+
}, /* @__PURE__ */ React30.createElement("div", {
|
|
2256
2334
|
role: "none",
|
|
2257
|
-
className:
|
|
2258
|
-
}, /* @__PURE__ */
|
|
2335
|
+
className: mx22(subduedSurface, "rounded-bs-md flex items-center p-2 gap-2")
|
|
2336
|
+
}, /* @__PURE__ */ React30.createElement("h2", {
|
|
2259
2337
|
id: titleId,
|
|
2260
|
-
className:
|
|
2261
|
-
}, 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", {
|
|
2262
2340
|
role: "region",
|
|
2263
|
-
className:
|
|
2264
|
-
}, /* @__PURE__ */
|
|
2341
|
+
className: mx22(defaultSurface, "rounded-be-md p-2")
|
|
2342
|
+
}, /* @__PURE__ */ React30.createElement(InvitationList, {
|
|
2265
2343
|
invitations,
|
|
2266
2344
|
onClickRemove: ({ invitation }) => invitation && (space == null ? void 0 : space.removeInvitation(invitation.invitationId)),
|
|
2267
2345
|
createInvitationUrl
|
|
2268
|
-
}), /* @__PURE__ */
|
|
2346
|
+
}), /* @__PURE__ */ React30.createElement(Button12, {
|
|
2269
2347
|
className: "is-full flex gap-2 mbs-2",
|
|
2270
2348
|
onClick: () => space == null ? void 0 : space.createInvitation(),
|
|
2271
2349
|
"data-testid": "spaces-panel.create-invitation"
|
|
2272
|
-
}, /* @__PURE__ */
|
|
2273
|
-
className:
|
|
2350
|
+
}, /* @__PURE__ */ React30.createElement("span", null, t("create space invitation label")), /* @__PURE__ */ React30.createElement(UserPlus2, {
|
|
2351
|
+
className: getSize15(4),
|
|
2274
2352
|
weight: "bold"
|
|
2275
|
-
})), /* @__PURE__ */
|
|
2353
|
+
})), /* @__PURE__ */ React30.createElement(PanelSeparator, null), /* @__PURE__ */ React30.createElement(SpaceMemberListContainer, {
|
|
2276
2354
|
spaceKey: space.key,
|
|
2277
2355
|
includeSelf: true
|
|
2278
2356
|
})));
|
|
@@ -2290,14 +2368,14 @@ var SpacePanel = (props) => {
|
|
|
2290
2368
|
const [panelState] = useReducer2(reducer, {
|
|
2291
2369
|
activeView: "current space"
|
|
2292
2370
|
});
|
|
2293
|
-
return /* @__PURE__ */
|
|
2371
|
+
return /* @__PURE__ */ React30.createElement(DensityProvider5, {
|
|
2294
2372
|
density: "fine"
|
|
2295
|
-
}, panelState.activeView === "current space" ? /* @__PURE__ */
|
|
2373
|
+
}, panelState.activeView === "current space" ? /* @__PURE__ */ React30.createElement(CurrentSpaceView, _extends24({}, props)) : null);
|
|
2296
2374
|
};
|
|
2297
2375
|
|
|
2298
2376
|
// packages/apps/patterns/react-ui/src/composites/IdentityPopover/IdentityPopover.tsx
|
|
2299
|
-
function
|
|
2300
|
-
|
|
2377
|
+
function _extends25() {
|
|
2378
|
+
_extends25 = Object.assign || function(target) {
|
|
2301
2379
|
for (var i = 1; i < arguments.length; i++) {
|
|
2302
2380
|
var source = arguments[i];
|
|
2303
2381
|
for (var key in source) {
|
|
@@ -2308,12 +2386,12 @@ function _extends24() {
|
|
|
2308
2386
|
}
|
|
2309
2387
|
return target;
|
|
2310
2388
|
};
|
|
2311
|
-
return
|
|
2389
|
+
return _extends25.apply(this, arguments);
|
|
2312
2390
|
}
|
|
2313
2391
|
var IdentityPopover = ({ identity, openTrigger, slots, triggerIsInToolbar = true, onClickManageProfile, ...popoverProps }) => {
|
|
2314
2392
|
var _a, _b, _c;
|
|
2315
|
-
return /* @__PURE__ */
|
|
2316
|
-
openTrigger: openTrigger != null ? openTrigger : /* @__PURE__ */
|
|
2393
|
+
return /* @__PURE__ */ React31.createElement(PanelPopover, _extends25({}, popoverProps, {
|
|
2394
|
+
openTrigger: openTrigger != null ? openTrigger : /* @__PURE__ */ React31.createElement(Avatar5, {
|
|
2317
2395
|
size: 10,
|
|
2318
2396
|
variant: "circle",
|
|
2319
2397
|
fallbackValue: identity.identityKey.toHex(),
|
|
@@ -2323,11 +2401,11 @@ var IdentityPopover = ({ identity, openTrigger, slots, triggerIsInToolbar = true
|
|
|
2323
2401
|
...slots,
|
|
2324
2402
|
trigger: {
|
|
2325
2403
|
...slots == null ? void 0 : slots.trigger,
|
|
2326
|
-
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)
|
|
2327
2405
|
}
|
|
2328
2406
|
},
|
|
2329
2407
|
triggerIsInToolbar
|
|
2330
|
-
}), /* @__PURE__ */
|
|
2408
|
+
}), /* @__PURE__ */ React31.createElement(IdentityPanel, _extends25({}, {
|
|
2331
2409
|
identity,
|
|
2332
2410
|
onClickManageProfile
|
|
2333
2411
|
})));
|
|
@@ -2335,10 +2413,10 @@ var IdentityPopover = ({ identity, openTrigger, slots, triggerIsInToolbar = true
|
|
|
2335
2413
|
|
|
2336
2414
|
// packages/apps/patterns/react-ui/src/composites/JoinDialog/JoinDialog.tsx
|
|
2337
2415
|
import { Action, Cancel } from "@radix-ui/react-alert-dialog";
|
|
2338
|
-
import
|
|
2416
|
+
import React32 from "react";
|
|
2339
2417
|
import { ThemeContext as ThemeContext2, useId as useId5, useThemeContext as useThemeContext3 } from "@dxos/react-components";
|
|
2340
|
-
function
|
|
2341
|
-
|
|
2418
|
+
function _extends26() {
|
|
2419
|
+
_extends26 = Object.assign || function(target) {
|
|
2342
2420
|
for (var i = 1; i < arguments.length; i++) {
|
|
2343
2421
|
var source = arguments[i];
|
|
2344
2422
|
for (var key in source) {
|
|
@@ -2349,43 +2427,43 @@ function _extends25() {
|
|
|
2349
2427
|
}
|
|
2350
2428
|
return target;
|
|
2351
2429
|
};
|
|
2352
|
-
return
|
|
2430
|
+
return _extends26.apply(this, arguments);
|
|
2353
2431
|
}
|
|
2354
2432
|
var JoinDialog = ({ slots, ...joinPanelProps }) => {
|
|
2355
2433
|
const titleId = useId5("joinDialog__title");
|
|
2356
2434
|
const themeContextValue = useThemeContext3();
|
|
2357
|
-
return /* @__PURE__ */
|
|
2435
|
+
return /* @__PURE__ */ React32.createElement(PanelAlertDialog, _extends26({}, {
|
|
2358
2436
|
slots,
|
|
2359
2437
|
titleId
|
|
2360
|
-
}), /* @__PURE__ */
|
|
2438
|
+
}), /* @__PURE__ */ React32.createElement(ThemeContext2.Provider, {
|
|
2361
2439
|
value: {
|
|
2362
2440
|
...themeContextValue,
|
|
2363
2441
|
themeVariant: "os"
|
|
2364
2442
|
}
|
|
2365
|
-
}, /* @__PURE__ */
|
|
2443
|
+
}, /* @__PURE__ */ React32.createElement(JoinPanel, _extends26({}, {
|
|
2366
2444
|
...joinPanelProps,
|
|
2367
2445
|
titleId,
|
|
2368
|
-
exitActionParent: /* @__PURE__ */
|
|
2446
|
+
exitActionParent: /* @__PURE__ */ React32.createElement(Cancel, {
|
|
2369
2447
|
asChild: true
|
|
2370
2448
|
}),
|
|
2371
|
-
doneActionParent: /* @__PURE__ */
|
|
2449
|
+
doneActionParent: /* @__PURE__ */ React32.createElement(Action, {
|
|
2372
2450
|
asChild: true
|
|
2373
2451
|
})
|
|
2374
2452
|
}))));
|
|
2375
2453
|
};
|
|
2376
2454
|
|
|
2377
2455
|
// packages/apps/patterns/react-ui/src/composites/Shell/Shell.tsx
|
|
2378
|
-
import
|
|
2456
|
+
import React35, { useEffect as useEffect3, useState as useState6 } from "react";
|
|
2379
2457
|
import { log as log3 } from "@dxos/log";
|
|
2380
2458
|
import { ShellDisplay, ShellLayout } from "@dxos/protocols/proto/dxos/iframe";
|
|
2381
2459
|
import { useClient as useClient6, useSpace as useSpace3, useSpaces } from "@dxos/react-client";
|
|
2382
2460
|
|
|
2383
2461
|
// packages/apps/patterns/react-ui/src/composites/DevicesDialog/DevicesDialog.tsx
|
|
2384
2462
|
import { Close } from "@radix-ui/react-dialog";
|
|
2385
|
-
import
|
|
2463
|
+
import React33 from "react";
|
|
2386
2464
|
import { ThemeContext as ThemeContext3, useId as useId6, useThemeContext as useThemeContext4 } from "@dxos/react-components";
|
|
2387
|
-
function
|
|
2388
|
-
|
|
2465
|
+
function _extends27() {
|
|
2466
|
+
_extends27 = Object.assign || function(target) {
|
|
2389
2467
|
for (var i = 1; i < arguments.length; i++) {
|
|
2390
2468
|
var source = arguments[i];
|
|
2391
2469
|
for (var key in source) {
|
|
@@ -2396,12 +2474,12 @@ function _extends26() {
|
|
|
2396
2474
|
}
|
|
2397
2475
|
return target;
|
|
2398
2476
|
};
|
|
2399
|
-
return
|
|
2477
|
+
return _extends27.apply(this, arguments);
|
|
2400
2478
|
}
|
|
2401
2479
|
var DevicesDialog = ({ slots, ...devicesDialogProps }) => {
|
|
2402
2480
|
const titleId = useId6("spaceDialog__title");
|
|
2403
2481
|
const themeContextValue = useThemeContext4();
|
|
2404
|
-
return /* @__PURE__ */
|
|
2482
|
+
return /* @__PURE__ */ React33.createElement(PanelDialog, _extends27({}, {
|
|
2405
2483
|
slots: {
|
|
2406
2484
|
...slots,
|
|
2407
2485
|
root: {
|
|
@@ -2413,15 +2491,15 @@ var DevicesDialog = ({ slots, ...devicesDialogProps }) => {
|
|
|
2413
2491
|
}
|
|
2414
2492
|
},
|
|
2415
2493
|
titleId
|
|
2416
|
-
}), /* @__PURE__ */
|
|
2494
|
+
}), /* @__PURE__ */ React33.createElement(ThemeContext3.Provider, {
|
|
2417
2495
|
value: {
|
|
2418
2496
|
...themeContextValue,
|
|
2419
2497
|
themeVariant: "os"
|
|
2420
2498
|
}
|
|
2421
|
-
}, /* @__PURE__ */
|
|
2499
|
+
}, /* @__PURE__ */ React33.createElement(DevicesPanel, _extends27({}, {
|
|
2422
2500
|
...devicesDialogProps,
|
|
2423
2501
|
titleId,
|
|
2424
|
-
doneActionParent: /* @__PURE__ */
|
|
2502
|
+
doneActionParent: /* @__PURE__ */ React33.createElement(Close, {
|
|
2425
2503
|
asChild: true
|
|
2426
2504
|
})
|
|
2427
2505
|
}))));
|
|
@@ -2429,10 +2507,10 @@ var DevicesDialog = ({ slots, ...devicesDialogProps }) => {
|
|
|
2429
2507
|
|
|
2430
2508
|
// packages/apps/patterns/react-ui/src/composites/SpaceDialog/SpaceDialog.tsx
|
|
2431
2509
|
import { Close as Close2 } from "@radix-ui/react-dialog";
|
|
2432
|
-
import
|
|
2510
|
+
import React34 from "react";
|
|
2433
2511
|
import { ThemeContext as ThemeContext4, useId as useId7, useThemeContext as useThemeContext5 } from "@dxos/react-components";
|
|
2434
|
-
function
|
|
2435
|
-
|
|
2512
|
+
function _extends28() {
|
|
2513
|
+
_extends28 = Object.assign || function(target) {
|
|
2436
2514
|
for (var i = 1; i < arguments.length; i++) {
|
|
2437
2515
|
var source = arguments[i];
|
|
2438
2516
|
for (var key in source) {
|
|
@@ -2443,12 +2521,12 @@ function _extends27() {
|
|
|
2443
2521
|
}
|
|
2444
2522
|
return target;
|
|
2445
2523
|
};
|
|
2446
|
-
return
|
|
2524
|
+
return _extends28.apply(this, arguments);
|
|
2447
2525
|
}
|
|
2448
2526
|
var SpaceDialog = ({ slots, ...spacePanelProps }) => {
|
|
2449
2527
|
const titleId = useId7("spaceDialog__title");
|
|
2450
2528
|
const themeContextValue = useThemeContext5();
|
|
2451
|
-
return /* @__PURE__ */
|
|
2529
|
+
return /* @__PURE__ */ React34.createElement(PanelDialog, _extends28({}, {
|
|
2452
2530
|
slots: {
|
|
2453
2531
|
...slots,
|
|
2454
2532
|
root: {
|
|
@@ -2460,15 +2538,15 @@ var SpaceDialog = ({ slots, ...spacePanelProps }) => {
|
|
|
2460
2538
|
}
|
|
2461
2539
|
},
|
|
2462
2540
|
titleId
|
|
2463
|
-
}), /* @__PURE__ */
|
|
2541
|
+
}), /* @__PURE__ */ React34.createElement(ThemeContext4.Provider, {
|
|
2464
2542
|
value: {
|
|
2465
2543
|
...themeContextValue,
|
|
2466
2544
|
themeVariant: "os"
|
|
2467
2545
|
}
|
|
2468
|
-
}, /* @__PURE__ */
|
|
2546
|
+
}, /* @__PURE__ */ React34.createElement(SpacePanel, _extends28({}, {
|
|
2469
2547
|
...spacePanelProps,
|
|
2470
2548
|
titleId,
|
|
2471
|
-
doneActionParent: /* @__PURE__ */
|
|
2549
|
+
doneActionParent: /* @__PURE__ */ React34.createElement(Close2, {
|
|
2472
2550
|
asChild: true
|
|
2473
2551
|
})
|
|
2474
2552
|
}))));
|
|
@@ -2476,7 +2554,7 @@ var SpaceDialog = ({ slots, ...spacePanelProps }) => {
|
|
|
2476
2554
|
|
|
2477
2555
|
// packages/apps/patterns/react-ui/src/composites/Shell/Shell.tsx
|
|
2478
2556
|
var Shell = ({ runtime, origin }) => {
|
|
2479
|
-
const [{ layout, invitationCode, spaceKey }, setLayout] =
|
|
2557
|
+
const [{ layout, invitationCode, spaceKey }, setLayout] = useState6({
|
|
2480
2558
|
layout: runtime.layout,
|
|
2481
2559
|
invitationCode: runtime.invitationCode,
|
|
2482
2560
|
spaceKey: runtime.spaceKey
|
|
@@ -2512,7 +2590,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2512
2590
|
]);
|
|
2513
2591
|
switch (layout) {
|
|
2514
2592
|
case ShellLayout.INITIALIZE_IDENTITY:
|
|
2515
|
-
return /* @__PURE__ */
|
|
2593
|
+
return /* @__PURE__ */ React35.createElement(JoinDialog, {
|
|
2516
2594
|
mode: "halo-only",
|
|
2517
2595
|
initialInvitationCode: invitationCode,
|
|
2518
2596
|
onDone: async () => {
|
|
@@ -2524,7 +2602,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2524
2602
|
}
|
|
2525
2603
|
});
|
|
2526
2604
|
case ShellLayout.DEVICE_INVITATIONS:
|
|
2527
|
-
return /* @__PURE__ */
|
|
2605
|
+
return /* @__PURE__ */ React35.createElement(DevicesDialog, {
|
|
2528
2606
|
createInvitationUrl: (invitationCode2) => `${origin}?haloInvitationCode=${invitationCode2}`,
|
|
2529
2607
|
onDone: async () => {
|
|
2530
2608
|
await runtime.setAppContext({
|
|
@@ -2534,7 +2612,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2534
2612
|
}
|
|
2535
2613
|
});
|
|
2536
2614
|
case ShellLayout.SPACE_INVITATIONS:
|
|
2537
|
-
return space ? /* @__PURE__ */
|
|
2615
|
+
return space ? /* @__PURE__ */ React35.createElement(SpaceDialog, {
|
|
2538
2616
|
space,
|
|
2539
2617
|
createInvitationUrl: (invitationCode2) => `${origin}?spaceInvitationCode=${invitationCode2}`,
|
|
2540
2618
|
onDone: async () => {
|
|
@@ -2545,7 +2623,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2545
2623
|
}
|
|
2546
2624
|
}) : null;
|
|
2547
2625
|
case ShellLayout.JOIN_SPACE:
|
|
2548
|
-
return /* @__PURE__ */
|
|
2626
|
+
return /* @__PURE__ */ React35.createElement(JoinDialog, {
|
|
2549
2627
|
initialInvitationCode: invitationCode,
|
|
2550
2628
|
onDone: async (result) => {
|
|
2551
2629
|
var _a;
|
|
@@ -2568,15 +2646,15 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2568
2646
|
};
|
|
2569
2647
|
|
|
2570
2648
|
// packages/apps/patterns/react-ui/src/composites/Shell/ShellContext.tsx
|
|
2571
|
-
import
|
|
2649
|
+
import React36, { createContext as createContext3, useCallback as useCallback7, useContext as useContext3, useEffect as useEffect4, useMemo as useMemo3, useState as useState7 } from "react";
|
|
2572
2650
|
import { IFrameClientServicesProxy, ShellDisplay as ShellDisplay2, ShellLayout as ShellLayout2 } from "@dxos/client";
|
|
2573
2651
|
import { MemoryShellRuntime } from "@dxos/client-services";
|
|
2574
2652
|
import { useClient as useClient7, useIdentity as useIdentity3 } from "@dxos/react-client";
|
|
2575
|
-
import { mx as
|
|
2576
|
-
var ShellContext = /* @__PURE__ */
|
|
2653
|
+
import { mx as mx24 } from "@dxos/react-components";
|
|
2654
|
+
var ShellContext = /* @__PURE__ */ createContext3({});
|
|
2577
2655
|
var useShell = () => {
|
|
2578
2656
|
const client = useClient7();
|
|
2579
|
-
const { runtime, setDisplay } =
|
|
2657
|
+
const { runtime, setDisplay } = useContext3(ShellContext);
|
|
2580
2658
|
const setLayout = async (layout, options) => {
|
|
2581
2659
|
if (runtime) {
|
|
2582
2660
|
if (layout === ShellLayout2.DEFAULT) {
|
|
@@ -2609,7 +2687,7 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2609
2687
|
]);
|
|
2610
2688
|
const client = useClient7();
|
|
2611
2689
|
const identity = useIdentity3();
|
|
2612
|
-
const [display, setDisplay] =
|
|
2690
|
+
const [display, setDisplay] = useState7(!identity || spaceInvitationCode || haloInvitationCode ? ShellDisplay2.FULLSCREEN : ShellDisplay2.NONE);
|
|
2613
2691
|
const shellRuntime = useMemo3(() => {
|
|
2614
2692
|
if (client.config.get("runtime.app.env.DX_VAULT") === "true") {
|
|
2615
2693
|
return;
|
|
@@ -2630,7 +2708,7 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2630
2708
|
spaceInvitationCode,
|
|
2631
2709
|
haloInvitationCode
|
|
2632
2710
|
]);
|
|
2633
|
-
const handleKeyDown =
|
|
2711
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2634
2712
|
if (!space || !shellRuntime) {
|
|
2635
2713
|
return;
|
|
2636
2714
|
}
|
|
@@ -2669,12 +2747,12 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2669
2747
|
}, [
|
|
2670
2748
|
shellRuntime
|
|
2671
2749
|
]);
|
|
2672
|
-
return /* @__PURE__ */
|
|
2673
|
-
className:
|
|
2674
|
-
}, /* @__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, {
|
|
2675
2753
|
runtime: shellRuntime,
|
|
2676
2754
|
origin: window.location.origin
|
|
2677
|
-
})), /* @__PURE__ */
|
|
2755
|
+
})), /* @__PURE__ */ React36.createElement(ShellContext.Provider, {
|
|
2678
2756
|
value: {
|
|
2679
2757
|
runtime: shellRuntime,
|
|
2680
2758
|
setDisplay
|
|
@@ -2692,6 +2770,7 @@ var os = {
|
|
|
2692
2770
|
"identity offline description": "Offline",
|
|
2693
2771
|
"sidebar label": "DXOS sidebar",
|
|
2694
2772
|
"copy invitation code label": "Copy",
|
|
2773
|
+
"copy invitation code success label": "Copied",
|
|
2695
2774
|
"open share panel label": "Share",
|
|
2696
2775
|
"joining space heading": "Joining space",
|
|
2697
2776
|
"join space heading": "Join a space",
|
|
@@ -2757,11 +2836,15 @@ var osTranslations = {
|
|
|
2757
2836
|
"en-US": en_US_exports
|
|
2758
2837
|
};
|
|
2759
2838
|
export {
|
|
2839
|
+
ClipboardContext,
|
|
2840
|
+
ClipboardProvider,
|
|
2841
|
+
CopyButton,
|
|
2760
2842
|
DeviceList,
|
|
2761
2843
|
DevicesPanel,
|
|
2762
2844
|
IdentityListItem,
|
|
2763
2845
|
IdentityPanel,
|
|
2764
2846
|
IdentityPopover,
|
|
2847
|
+
InvitationEmoji,
|
|
2765
2848
|
InvitationList,
|
|
2766
2849
|
InvitationListContainer,
|
|
2767
2850
|
InvitationListItem,
|
|
@@ -2806,6 +2889,7 @@ export {
|
|
|
2806
2889
|
successBgColor,
|
|
2807
2890
|
successStrokeColor,
|
|
2808
2891
|
successTextColor,
|
|
2892
|
+
useClipboardContext,
|
|
2809
2893
|
useShell,
|
|
2810
2894
|
useTogglePanelSidebar
|
|
2811
2895
|
};
|