@dxos/react-ui 0.1.23 → 0.1.24

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.
Files changed (147) hide show
  1. package/dist/lib/browser/index.mjs +1781 -57
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/components/{IdentityListItem → IdentityList}/IdentityListItem.d.ts +0 -0
  5. package/dist/types/src/components/IdentityList/IdentityListItem.d.ts.map +1 -0
  6. package/dist/types/src/components/{IdentityListItem → IdentityList}/IdentityListItem.stories.d.ts +0 -0
  7. package/dist/types/src/components/IdentityList/IdentityListItem.stories.d.ts.map +1 -0
  8. package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts +6 -0
  9. package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts.map +1 -0
  10. package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts +7 -0
  11. package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts.map +1 -0
  12. package/dist/types/src/components/IdentityList/index.d.ts +4 -0
  13. package/dist/types/src/components/IdentityList/index.d.ts.map +1 -0
  14. package/dist/types/src/components/InvitationList/InvitationList.d.ts +7 -0
  15. package/dist/types/src/components/InvitationList/InvitationList.d.ts.map +1 -0
  16. package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts +10 -0
  17. package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts.map +1 -0
  18. package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts +7 -0
  19. package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts.map +1 -0
  20. package/dist/types/src/components/InvitationList/InvitationListItem.d.ts +9 -0
  21. package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +1 -0
  22. package/dist/types/src/components/InvitationList/InvitationListProps.d.ts +4 -0
  23. package/dist/types/src/components/InvitationList/InvitationListProps.d.ts.map +1 -0
  24. package/dist/types/src/components/InvitationList/InvitationStatusAvatar.d.ts +9 -0
  25. package/dist/types/src/components/InvitationList/InvitationStatusAvatar.d.ts.map +1 -0
  26. package/dist/types/src/components/InvitationList/InvitationStatusAvatar.stories.d.ts +9 -0
  27. package/dist/types/src/components/InvitationList/InvitationStatusAvatar.stories.d.ts.map +1 -0
  28. package/dist/types/src/components/InvitationList/index.d.ts +5 -0
  29. package/dist/types/src/components/InvitationList/index.d.ts.map +1 -0
  30. package/dist/types/src/components/PanelSeparator/PanelSeparator.d.ts +3 -0
  31. package/dist/types/src/components/PanelSeparator/PanelSeparator.d.ts.map +1 -0
  32. package/dist/types/src/components/PanelSeparator/index.d.ts +2 -0
  33. package/dist/types/src/components/PanelSeparator/index.d.ts.map +1 -0
  34. package/dist/types/src/components/index.d.ts +4 -0
  35. package/dist/types/src/components/index.d.ts.map +1 -0
  36. package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts +6 -0
  37. package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts.map +1 -0
  38. package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts +10 -0
  39. package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +1 -0
  40. package/dist/types/src/composites/JoinDialog/index.d.ts +2 -0
  41. package/dist/types/src/composites/JoinDialog/index.d.ts.map +1 -0
  42. package/dist/types/src/composites/index.d.ts +1 -0
  43. package/dist/types/src/composites/index.d.ts.map +1 -1
  44. package/dist/types/src/index.d.ts +1 -0
  45. package/dist/types/src/index.d.ts.map +1 -1
  46. package/dist/types/src/layouts/PanelAlertDialog/PanelAlertDialog.d.ts +14 -0
  47. package/dist/types/src/layouts/PanelAlertDialog/PanelAlertDialog.d.ts.map +1 -0
  48. package/dist/types/src/layouts/PanelAlertDialog/index.d.ts +2 -0
  49. package/dist/types/src/layouts/PanelAlertDialog/index.d.ts.map +1 -0
  50. package/dist/types/src/layouts/PanelSidebar/PanelSidebar.d.ts +2 -3
  51. package/dist/types/src/layouts/PanelSidebar/PanelSidebar.d.ts.map +1 -1
  52. package/dist/types/src/layouts/index.d.ts +1 -0
  53. package/dist/types/src/layouts/index.d.ts.map +1 -1
  54. package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts +10 -0
  55. package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts.map +1 -0
  56. package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +3 -0
  57. package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -0
  58. package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +53 -0
  59. package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -0
  60. package/dist/types/src/panels/JoinPanel/index.d.ts +3 -0
  61. package/dist/types/src/panels/JoinPanel/index.d.ts.map +1 -0
  62. package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts +7 -0
  63. package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts.map +1 -0
  64. package/dist/types/src/panels/JoinPanel/view-states/IdentityAdded.d.ts +7 -0
  65. package/dist/types/src/panels/JoinPanel/view-states/IdentityAdded.d.ts.map +1 -0
  66. package/dist/types/src/panels/JoinPanel/view-states/IdentityInput.d.ts +6 -0
  67. package/dist/types/src/panels/JoinPanel/view-states/IdentityInput.d.ts.map +1 -0
  68. package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts +7 -0
  69. package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts.map +1 -0
  70. package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts +10 -0
  71. package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts.map +1 -0
  72. package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts +7 -0
  73. package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts.map +1 -0
  74. package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts +6 -0
  75. package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts.map +1 -0
  76. package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts +6 -0
  77. package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts.map +1 -0
  78. package/dist/types/src/panels/JoinPanel/view-states/ViewState.d.ts +12 -0
  79. package/dist/types/src/panels/JoinPanel/view-states/ViewState.d.ts.map +1 -0
  80. package/dist/types/src/panels/JoinPanel/view-states/index.d.ts +9 -0
  81. package/dist/types/src/panels/JoinPanel/view-states/index.d.ts.map +1 -0
  82. package/dist/types/src/panels/index.d.ts +1 -0
  83. package/dist/types/src/panels/index.d.ts.map +1 -1
  84. package/dist/types/src/styles/index.d.ts +1 -0
  85. package/dist/types/src/styles/index.d.ts.map +1 -1
  86. package/dist/types/src/styles/invitationStatusStyles.d.ts +20 -0
  87. package/dist/types/src/styles/invitationStatusStyles.d.ts.map +1 -0
  88. package/dist/types/src/styles/panelStyles.d.ts +2 -1
  89. package/dist/types/src/styles/panelStyles.d.ts.map +1 -1
  90. package/dist/types/src/translations/locales/en-US.d.ts +41 -0
  91. package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
  92. package/dist/types/src/util/index.d.ts +2 -0
  93. package/dist/types/src/util/index.d.ts.map +1 -0
  94. package/dist/types/src/util/invitationStatusValue.d.ts +8 -0
  95. package/dist/types/src/util/invitationStatusValue.d.ts.map +1 -0
  96. package/package.json +18 -11
  97. package/src/components/{IdentityListItem → IdentityList}/IdentityListItem.stories.tsx +0 -0
  98. package/src/components/{IdentityListItem → IdentityList}/IdentityListItem.tsx +4 -3
  99. package/src/components/IdentityList/SpaceMemberList.tsx +31 -0
  100. package/src/components/IdentityList/SpaceMemberListContainer.tsx +27 -0
  101. package/src/components/IdentityList/index.ts +7 -0
  102. package/src/components/InvitationList/InvitationList.stories.tsx +65 -0
  103. package/src/components/InvitationList/InvitationList.tsx +24 -0
  104. package/src/components/InvitationList/InvitationListContainer.tsx +27 -0
  105. package/src/components/InvitationList/InvitationListItem.tsx +95 -0
  106. package/src/components/InvitationList/InvitationListProps.ts +7 -0
  107. package/src/components/InvitationList/InvitationStatusAvatar.stories.tsx +52 -0
  108. package/src/components/InvitationList/InvitationStatusAvatar.tsx +75 -0
  109. package/src/components/InvitationList/index.ts +8 -0
  110. package/src/components/PanelSeparator/PanelSeparator.tsx +17 -0
  111. package/src/components/PanelSeparator/index.ts +5 -0
  112. package/src/components/index.ts +7 -0
  113. package/src/composites/JoinDialog/JoinDialog.stories.tsx +80 -0
  114. package/src/composites/JoinDialog/JoinDialog.tsx +31 -0
  115. package/src/composites/JoinDialog/index.ts +5 -0
  116. package/src/composites/index.ts +1 -0
  117. package/src/index.ts +1 -0
  118. package/src/layouts/PanelAlertDialog/PanelAlertDialog.tsx +44 -0
  119. package/src/layouts/PanelAlertDialog/index.ts +5 -0
  120. package/src/layouts/PanelPopover/PanelPopover.tsx +2 -2
  121. package/src/layouts/PanelSidebar/PanelSidebar.tsx +17 -25
  122. package/src/layouts/index.ts +1 -0
  123. package/src/panels/JoinPanel/JoinHeading.tsx +57 -0
  124. package/src/panels/JoinPanel/JoinPanel.tsx +303 -0
  125. package/src/panels/JoinPanel/JoinPanelProps.ts +94 -0
  126. package/src/panels/JoinPanel/index.ts +6 -0
  127. package/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx +69 -0
  128. package/src/panels/JoinPanel/view-states/IdentityAdded.tsx +60 -0
  129. package/src/panels/JoinPanel/view-states/IdentityInput.tsx +72 -0
  130. package/src/panels/JoinPanel/view-states/IdentitySelector.tsx +98 -0
  131. package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +69 -0
  132. package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +139 -0
  133. package/src/panels/JoinPanel/view-states/InvitationInput.tsx +68 -0
  134. package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +95 -0
  135. package/src/panels/JoinPanel/view-states/ViewState.tsx +204 -0
  136. package/src/panels/JoinPanel/view-states/index.ts +12 -0
  137. package/src/panels/index.ts +1 -0
  138. package/src/styles/index.ts +1 -0
  139. package/src/styles/invitationStatusStyles.ts +42 -0
  140. package/src/styles/panelStyles.ts +2 -1
  141. package/src/testing/ClientProvider.tsx +1 -1
  142. package/src/translations/locales/en-US.ts +42 -1
  143. package/src/util/index.ts +5 -0
  144. package/src/util/invitationStatusValue.ts +21 -0
  145. package/theme-extensions.js +11 -0
  146. package/dist/types/src/components/IdentityListItem/IdentityListItem.d.ts.map +0 -1
  147. package/dist/types/src/components/IdentityListItem/IdentityListItem.stories.d.ts.map +0 -1
@@ -4,21 +4,398 @@ 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/composites/IdentityPopover/IdentityPopover.tsx
8
- import React4 from "react";
9
- import { Avatar as Avatar2, mx as mx3 } from "@dxos/react-components";
10
-
11
- // packages/apps/patterns/react-ui/src/layouts/PanelPopover/PanelPopover.tsx
7
+ // packages/apps/patterns/react-ui/src/components/IdentityList/IdentityListItem.tsx
12
8
  import React from "react";
13
- import { mx, Popover } from "@dxos/react-components";
9
+ import { SpaceMember } from "@dxos/client";
10
+ import { Avatar, useTranslation } from "@dxos/react-components";
11
+ function _extends() {
12
+ _extends = Object.assign || function(target) {
13
+ for (var i = 1; i < arguments.length; i++) {
14
+ var source = arguments[i];
15
+ for (var key in source) {
16
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
17
+ target[key] = source[key];
18
+ }
19
+ }
20
+ }
21
+ return target;
22
+ };
23
+ return _extends.apply(this, arguments);
24
+ }
25
+ var IdentityListItem = ({ identity, presence }) => {
26
+ var _a;
27
+ const { t } = useTranslation("os");
28
+ return /* @__PURE__ */ React.createElement("li", {
29
+ className: "flex gap-2 items-center"
30
+ }, /* @__PURE__ */ React.createElement(Avatar, _extends({}, {
31
+ variant: "circle",
32
+ size: 9,
33
+ fallbackValue: identity.identityKey.toHex(),
34
+ label: /* @__PURE__ */ React.createElement("p", {
35
+ className: "text-sm truncate"
36
+ }, (_a = identity.displayName) != null ? _a : identity.identityKey.truncate()),
37
+ ...presence === SpaceMember.PresenceState.OFFLINE && {
38
+ status: "inactive",
39
+ description: /* @__PURE__ */ React.createElement("p", {
40
+ className: "font-system-normal text-xs text-neutral-700 dark:text-neutral-300"
41
+ }, t("identity offline description"))
42
+ },
43
+ ...presence === SpaceMember.PresenceState.ONLINE && {
44
+ status: "active"
45
+ },
46
+ slots: {
47
+ labels: {
48
+ className: "block shrink overflow-hidden"
49
+ },
50
+ root: {
51
+ className: "shrink-0"
52
+ }
53
+ }
54
+ })));
55
+ };
56
+
57
+ // packages/apps/patterns/react-ui/src/components/IdentityList/SpaceMemberList.tsx
58
+ import React2 from "react";
59
+ var SpaceMemberList = ({ spaceMembers }) => {
60
+ return /* @__PURE__ */ React2.createElement("ul", {
61
+ className: "flex flex-col gap-2"
62
+ }, spaceMembers.filter((spaceMember) => spaceMember.profile).map((spaceMember) => {
63
+ return /* @__PURE__ */ React2.createElement(IdentityListItem, {
64
+ key: spaceMember.identityKey.toHex(),
65
+ identity: spaceMember.profile,
66
+ presence: spaceMember.presence
67
+ });
68
+ }));
69
+ };
70
+
71
+ // packages/apps/patterns/react-ui/src/components/IdentityList/SpaceMemberListContainer.tsx
72
+ import React3, { useMemo } from "react";
73
+ import { useClient, useMembers } from "@dxos/react-client";
74
+ var SpaceMemberListContainer = ({ spaceKey, includeSelf }) => {
75
+ const client = useClient();
76
+ const allUnsortedMembers = useMembers(spaceKey);
77
+ const spaceMembers = useMemo(() => includeSelf ? allUnsortedMembers.sort((a) => a.identityKey.equals(client.halo.profile.identityKey) ? -1 : 1) : allUnsortedMembers.filter((member) => !member.identityKey.equals(client.halo.profile.identityKey)), [
78
+ allUnsortedMembers
79
+ ]);
80
+ return /* @__PURE__ */ React3.createElement(SpaceMemberList, {
81
+ spaceMembers
82
+ });
83
+ };
84
+
85
+ // packages/apps/patterns/react-ui/src/components/InvitationList/InvitationStatusAvatar.tsx
86
+ import React4 from "react";
87
+ import { Invitation as Invitation3 } from "@dxos/client";
88
+ import { getSize } from "@dxos/react-components";
14
89
 
15
90
  // packages/apps/patterns/react-ui/src/styles/panelStyles.ts
16
- var defaultPanel = "p-2 backdrop-blur-md bg-neutral-50/[.66] dark:bg-neutral-950/[.66]";
91
+ var defaultSurface = "bg-neutral-50/[.72] dark:bg-neutral-950/[.72]";
92
+ var subduedSurface = "bg-neutral-100/[.66] dark:bg-neutral-900/[.66]";
17
93
  var defaultArrow = "text-neutral-50/[.66] dark:text-neutral-950/[.66]";
18
94
 
95
+ // packages/apps/patterns/react-ui/src/styles/invitationStatusStyles.ts
96
+ import { Invitation } from "@dxos/client";
97
+ var inactiveBgColor = "bg-neutral-100 dark:bg-neutral-600";
98
+ var activeBgColor = "bg-primary-500 dark:bg-primary-400";
99
+ var successBgColor = "bg-success-500 dark:bg-success-400";
100
+ var errorBgColor = "bg-error-500 dark:bg-error-400";
101
+ var cancelledBgColor = "bg-warning-500 dark:bg-warning-400";
102
+ var inactiveTextColor = "text-neutral-100 dark:text-neutral-600";
103
+ var activeTextColor = "text-primary-400 dark:text-primary-500";
104
+ var successTextColor = "text-success-400 dark:text-success-500";
105
+ var errorTextColor = "text-error-400 dark:text-error-500";
106
+ var cancelledTextColor = "text-warning-400 dark:text-warning-500";
107
+ var inactiveStrokeColor = "stroke-neutral-100 dark:stroke-neutral-700";
108
+ var activeStrokeColor = "stroke-primary-500 dark:stroke-primary-150";
109
+ var successStrokeColor = "stroke-success-400 dark:stroke-primary-400";
110
+ var errorStrokeColor = "stroke-error-400 dark:stroke-error-500";
111
+ var cancelledStrokeColor = "stroke-warning-400 dark:stroke-warning-500";
112
+ var resolvedStrokeColor = (status) => status === Invitation.State.ERROR ? errorStrokeColor : status === Invitation.State.CANCELLED || status === Invitation.State.TIMEOUT ? cancelledStrokeColor : successStrokeColor;
113
+ var resolvedBgColor = (status) => status === Invitation.State.ERROR ? errorBgColor : status === Invitation.State.CANCELLED || status === Invitation.State.TIMEOUT ? cancelledBgColor : successBgColor;
114
+ var resolvedTextColor = (status) => status === Invitation.State.ERROR ? errorTextColor : status === Invitation.State.CANCELLED || status === Invitation.State.TIMEOUT ? cancelledTextColor : successTextColor;
115
+
116
+ // packages/apps/patterns/react-ui/src/util/invitationStatusValue.ts
117
+ import { Invitation as Invitation2 } from "@dxos/client";
118
+ var invitationStatusValue = /* @__PURE__ */ new Map([
119
+ [
120
+ Invitation2.State.ERROR,
121
+ -3
122
+ ],
123
+ [
124
+ Invitation2.State.TIMEOUT,
125
+ -2
126
+ ],
127
+ [
128
+ Invitation2.State.CANCELLED,
129
+ -1
130
+ ],
131
+ [
132
+ Invitation2.State.INIT,
133
+ 0
134
+ ],
135
+ [
136
+ Invitation2.State.CONNECTING,
137
+ 1
138
+ ],
139
+ [
140
+ Invitation2.State.CONNECTED,
141
+ 2
142
+ ],
143
+ [
144
+ Invitation2.State.AUTHENTICATING,
145
+ 3
146
+ ],
147
+ [
148
+ Invitation2.State.SUCCESS,
149
+ 4
150
+ ]
151
+ ]);
152
+
153
+ // packages/apps/patterns/react-ui/src/components/InvitationList/InvitationStatusAvatar.tsx
154
+ function _extends2() {
155
+ _extends2 = Object.assign || function(target) {
156
+ for (var i = 1; i < arguments.length; i++) {
157
+ var source = arguments[i];
158
+ for (var key in source) {
159
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
160
+ target[key] = source[key];
161
+ }
162
+ }
163
+ }
164
+ return target;
165
+ };
166
+ return _extends2.apply(this, arguments);
167
+ }
168
+ var svgSize = 32;
169
+ var strokeWidth = 4;
170
+ var radius = (svgSize - strokeWidth) / 2;
171
+ var circumference = Math.PI * 2 * radius;
172
+ var gap = circumference / 12;
173
+ var nSegments = 3;
174
+ var segment = circumference / nSegments;
175
+ var baseOffset = 2 * circumference / 3 - (segment - gap) / 2;
176
+ var circleProps = {
177
+ fill: "none",
178
+ strokeLinecap: "round",
179
+ cx: svgSize / 2,
180
+ cy: svgSize / 2,
181
+ r: radius,
182
+ strokeWidth: 4,
183
+ strokeDasharray: `${segment - gap} ${2 * segment + gap}`
184
+ };
185
+ var InvitationStatusAvatar = ({ size = 10, status, haltedAt }) => {
186
+ const resolvedColor = resolvedStrokeColor(status);
187
+ const halted = status === Invitation3.State.CANCELLED || status === Invitation3.State.TIMEOUT || status === Invitation3.State.ERROR;
188
+ const cursor = invitationStatusValue.get(halted ? haltedAt : status);
189
+ return /* @__PURE__ */ React4.createElement("svg", {
190
+ viewBox: `0 0 ${svgSize} ${svgSize}`,
191
+ className: getSize(size)
192
+ }, [
193
+ ...Array(nSegments)
194
+ ].map((_, index) => /* @__PURE__ */ React4.createElement("circle", _extends2({
195
+ key: index
196
+ }, circleProps, {
197
+ strokeDashoffset: index * segment + baseOffset,
198
+ 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
199
+ }))));
200
+ };
201
+
202
+ // packages/apps/patterns/react-ui/src/components/InvitationList/InvitationListItem.tsx
203
+ import * as AccordionPrimitive from "@radix-ui/react-accordion";
204
+ import { Copy, ProhibitInset, QrCode, X } from "phosphor-react";
205
+ import { QRCodeSVG } from "qrcode.react";
206
+ import React5, { useCallback } from "react";
207
+ import { useInvitationStatus } from "@dxos/react-client";
208
+ import { Button, getSize as getSize2, mx, useTranslation as useTranslation2 } from "@dxos/react-components";
209
+ function _extends3() {
210
+ _extends3 = Object.assign || function(target) {
211
+ for (var i = 1; i < arguments.length; i++) {
212
+ var source = arguments[i];
213
+ for (var key in source) {
214
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
215
+ target[key] = source[key];
216
+ }
217
+ }
218
+ }
219
+ return target;
220
+ };
221
+ return _extends3.apply(this, arguments);
222
+ }
223
+ var InvitationListItem = ({ invitation, value, onClickRemove, createInvitationUrl }) => {
224
+ var _a;
225
+ const { t } = useTranslation2("os");
226
+ const { cancel, status, haltedAt, invitationCode, authenticationCode } = useInvitationStatus(invitation);
227
+ const statusValue = (_a = invitationStatusValue.get(status)) != null ? _a : 0;
228
+ const isCancellable = statusValue < 4 && statusValue >= 0;
229
+ const showShare = statusValue < 3 && statusValue >= 0;
230
+ const showPin = statusValue === 3;
231
+ const handleClickRemove = useCallback(() => onClickRemove(invitation), [
232
+ invitation,
233
+ onClickRemove
234
+ ]);
235
+ const invitationUrl = invitationCode && createInvitationUrl(invitationCode);
236
+ const handleCLickCopy = useCallback(() => {
237
+ if (invitationUrl) {
238
+ void navigator.clipboard.writeText(invitationUrl);
239
+ }
240
+ }, [
241
+ invitationUrl
242
+ ]);
243
+ return /* @__PURE__ */ React5.createElement(AccordionPrimitive.Item, {
244
+ value
245
+ }, /* @__PURE__ */ React5.createElement(AccordionPrimitive.Header, {
246
+ className: "flex gap-2 items-center"
247
+ }, /* @__PURE__ */ React5.createElement(InvitationStatusAvatar, _extends3({}, {
248
+ status,
249
+ haltedAt
250
+ })), showShare && invitationUrl ? /* @__PURE__ */ React5.createElement(AccordionPrimitive.Trigger, {
251
+ asChild: true
252
+ }, /* @__PURE__ */ React5.createElement(Button, {
253
+ className: "grow flex gap-1"
254
+ }, /* @__PURE__ */ React5.createElement("span", null, t("open share panel label")), /* @__PURE__ */ React5.createElement(QrCode, {
255
+ className: getSize2(4),
256
+ weight: "bold"
257
+ }))) : showPin ? /* @__PURE__ */ React5.createElement("p", {
258
+ className: "grow text-xl text-center text-success-500 dark:text-success-300 font-mono"
259
+ }, authenticationCode) : /* @__PURE__ */ React5.createElement("span", {
260
+ role: "none",
261
+ className: "grow"
262
+ }), isCancellable ? /* @__PURE__ */ React5.createElement(Button, {
263
+ variant: "ghost",
264
+ compact: true,
265
+ className: "flex gap-1",
266
+ onClick: cancel
267
+ }, /* @__PURE__ */ React5.createElement("span", {
268
+ className: "sr-only"
269
+ }, t("cancel invitation label")), /* @__PURE__ */ React5.createElement(ProhibitInset, {
270
+ className: getSize2(4),
271
+ weight: "bold"
272
+ })) : /* @__PURE__ */ React5.createElement(Button, {
273
+ variant: "ghost",
274
+ compact: true,
275
+ className: "flex gap-1",
276
+ onClick: handleClickRemove
277
+ }, /* @__PURE__ */ React5.createElement("span", {
278
+ className: "sr-only"
279
+ }, t("remove invitation label")), /* @__PURE__ */ React5.createElement(X, {
280
+ className: getSize2(4),
281
+ weight: "bold"
282
+ }))), showShare && invitationUrl && /* @__PURE__ */ React5.createElement(AccordionPrimitive.Content, null, /* @__PURE__ */ React5.createElement(Button, {
283
+ className: "flex gap-2 is-full p-2",
284
+ onClick: handleCLickCopy
285
+ }, /* @__PURE__ */ React5.createElement(QRCodeSVG, {
286
+ bgColor: "transparent",
287
+ fgColor: "currentColor",
288
+ value: invitationUrl,
289
+ className: mx("grow aspect-square is-24 bs-auto")
290
+ }), /* @__PURE__ */ React5.createElement("span", {
291
+ className: "pli-1"
292
+ }, t("copy invitation code label"), /* @__PURE__ */ React5.createElement(Copy, {
293
+ className: mx(getSize2(4), "inline mis-1"),
294
+ weight: "bold"
295
+ })))));
296
+ };
297
+
298
+ // packages/apps/patterns/react-ui/src/components/InvitationList/InvitationListContainer.tsx
299
+ import React7, { useCallback as useCallback2 } from "react";
300
+ import { useSpace, useSpaceInvitations } from "@dxos/react-client";
301
+
302
+ // packages/apps/patterns/react-ui/src/components/InvitationList/InvitationList.tsx
303
+ import { Root as AccordionRoot } from "@radix-ui/react-accordion";
304
+ import React6 from "react";
305
+ function _extends4() {
306
+ _extends4 = Object.assign || function(target) {
307
+ for (var i = 1; i < arguments.length; i++) {
308
+ var source = arguments[i];
309
+ for (var key in source) {
310
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
311
+ target[key] = source[key];
312
+ }
313
+ }
314
+ }
315
+ return target;
316
+ };
317
+ return _extends4.apply(this, arguments);
318
+ }
319
+ var InvitationList = ({ invitations, ...invitationProps }) => {
320
+ return /* @__PURE__ */ React6.createElement(AccordionRoot, {
321
+ type: "single",
322
+ collapsible: true
323
+ }, invitations.map((invitation, index) => {
324
+ var _a, _b;
325
+ const value = (_b = (_a = invitation.invitation) == null ? void 0 : _a.invitationId) != null ? _b : `inv_${index}`;
326
+ return /* @__PURE__ */ React6.createElement(InvitationListItem, _extends4({
327
+ key: value,
328
+ value,
329
+ invitation
330
+ }, invitationProps));
331
+ }));
332
+ };
333
+
334
+ // packages/apps/patterns/react-ui/src/components/InvitationList/InvitationListContainer.tsx
335
+ function _extends5() {
336
+ _extends5 = Object.assign || function(target) {
337
+ for (var i = 1; i < arguments.length; i++) {
338
+ var source = arguments[i];
339
+ for (var key in source) {
340
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
341
+ target[key] = source[key];
342
+ }
343
+ }
344
+ }
345
+ return target;
346
+ };
347
+ return _extends5.apply(this, arguments);
348
+ }
349
+ var InvitationListContainer = ({ spaceKey, createInvitationUrl }) => {
350
+ const space = useSpace(spaceKey);
351
+ const invitations = useSpaceInvitations(spaceKey);
352
+ const onClickRemove = useCallback2(({ invitation }) => {
353
+ (invitation == null ? void 0 : invitation.invitationId) && (space == null ? void 0 : space.removeInvitation(invitation.invitationId));
354
+ }, [
355
+ space
356
+ ]);
357
+ return /* @__PURE__ */ React7.createElement(InvitationList, _extends5({
358
+ invitations
359
+ }, {
360
+ onClickRemove,
361
+ createInvitationUrl
362
+ }));
363
+ };
364
+
365
+ // packages/apps/patterns/react-ui/src/components/PanelSeparator/PanelSeparator.tsx
366
+ import React8 from "react";
367
+ import { mx as mx2 } from "@dxos/react-components";
368
+ function _extends6() {
369
+ _extends6 = Object.assign || function(target) {
370
+ for (var i = 1; i < arguments.length; i++) {
371
+ var source = arguments[i];
372
+ for (var key in source) {
373
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
374
+ target[key] = source[key];
375
+ }
376
+ }
377
+ }
378
+ return target;
379
+ };
380
+ return _extends6.apply(this, arguments);
381
+ }
382
+ var PanelSeparator = ({ className, ...props }) => {
383
+ return /* @__PURE__ */ React8.createElement("span", _extends6({
384
+ role: "none"
385
+ }, props, {
386
+ className: mx2("block bs-px mlb-1 bg-neutral-800/10 dark:bg-neutral-200/10", className)
387
+ }));
388
+ };
389
+
390
+ // packages/apps/patterns/react-ui/src/composites/IdentityPopover/IdentityPopover.tsx
391
+ import React24 from "react";
392
+ import { Avatar as Avatar7, mx as mx16 } from "@dxos/react-components";
393
+
19
394
  // packages/apps/patterns/react-ui/src/layouts/PanelPopover/PanelPopover.tsx
20
- function _extends() {
21
- _extends = Object.assign || function(target) {
395
+ import React9 from "react";
396
+ import { mx as mx3, Popover } from "@dxos/react-components";
397
+ function _extends7() {
398
+ _extends7 = Object.assign || function(target) {
22
399
  for (var i = 1; i < arguments.length; i++) {
23
400
  var source = arguments[i];
24
401
  for (var key in source) {
@@ -29,25 +406,25 @@ function _extends() {
29
406
  }
30
407
  return target;
31
408
  };
32
- return _extends.apply(this, arguments);
409
+ return _extends7.apply(this, arguments);
33
410
  }
34
411
  var PanelPopover = ({ slots, children, ...popoverProps }) => {
35
412
  var _a, _b, _c;
36
- return /* @__PURE__ */ React.createElement(Popover, _extends({
413
+ return /* @__PURE__ */ React9.createElement(Popover, _extends7({
37
414
  slots: {
38
415
  arrow: {
39
416
  ...slots == null ? void 0 : slots.arrow,
40
- className: mx(defaultArrow, (_a = slots == null ? void 0 : slots.arrow) == null ? void 0 : _a.className)
417
+ className: mx3(defaultArrow, (_a = slots == null ? void 0 : slots.arrow) == null ? void 0 : _a.className)
41
418
  },
42
419
  content: {
43
420
  collisionPadding: 8,
44
421
  sideOffset: 4,
45
422
  ...slots == null ? void 0 : slots.content,
46
- className: mx(defaultPanel, (_b = slots == null ? void 0 : slots.content) == null ? void 0 : _b.className)
423
+ className: mx3(defaultSurface, (_b = slots == null ? void 0 : slots.content) == null ? void 0 : _b.className)
47
424
  },
48
425
  trigger: {
49
426
  ...slots == null ? void 0 : slots.trigger,
50
- className: mx("", (_c = slots == null ? void 0 : slots.trigger) == null ? void 0 : _c.className)
427
+ className: mx3("", (_c = slots == null ? void 0 : slots.trigger) == null ? void 0 : _c.className)
51
428
  },
52
429
  ...slots
53
430
  }
@@ -56,10 +433,10 @@ var PanelPopover = ({ slots, children, ...popoverProps }) => {
56
433
 
57
434
  // packages/apps/patterns/react-ui/src/layouts/PanelSidebar/PanelSidebar.tsx
58
435
  import * as DialogPrimitive from "@radix-ui/react-dialog";
59
- import React2, { createContext, useCallback, useContext, useState } from "react";
60
- import { defaultOverlay, mx as mx2, useMediaQuery, useTranslation } from "@dxos/react-components";
61
- function _extends2() {
62
- _extends2 = Object.assign || function(target) {
436
+ import React10, { createContext, useCallback as useCallback3, useContext, useState } from "react";
437
+ import { defaultOverlay, mx as mx4, useMediaQuery, useTranslation as useTranslation3 } from "@dxos/react-components";
438
+ function _extends8() {
439
+ _extends8 = Object.assign || function(target) {
63
440
  for (var i = 1; i < arguments.length; i++) {
64
441
  var source = arguments[i];
65
442
  for (var key in source) {
@@ -70,7 +447,7 @@ function _extends2() {
70
447
  }
71
448
  return target;
72
449
  };
73
- return _extends2.apply(this, arguments);
450
+ return _extends8.apply(this, arguments);
74
451
  }
75
452
  var PanelSidebarContext = /* @__PURE__ */ createContext({
76
453
  displayState: "hide",
@@ -79,16 +456,18 @@ var PanelSidebarContext = /* @__PURE__ */ createContext({
79
456
  });
80
457
  var useTogglePanelSidebar = () => {
81
458
  const { displayState, setDisplayState } = useContext(PanelSidebarContext);
82
- return useCallback(() => {
459
+ return useCallback3(() => {
83
460
  setDisplayState(displayState === "hide" ? "show" : "hide");
84
461
  }, [
85
462
  displayState
86
463
  ]);
87
464
  };
88
- var PanelSidebarProvider = ({ children, inlineStart, slots }) => {
89
- var _a, _b, _c, _d;
90
- const { t } = useTranslation("os");
91
- const [isLg] = useMediaQuery("lg");
465
+ var PanelSidebarProvider = ({ children, slots }) => {
466
+ var _a, _b, _c;
467
+ const { t } = useTranslation3("os");
468
+ const [isLg] = useMediaQuery("lg", {
469
+ ssr: false
470
+ });
92
471
  const [displayState, setInternalDisplayState] = useState(isLg ? "show" : "hide");
93
472
  const isOpen = displayState === "show";
94
473
  const [transitionShow, setTransitionShow] = useState(isOpen);
@@ -108,65 +487,1300 @@ var PanelSidebarProvider = ({ children, inlineStart, slots }) => {
108
487
  }, 0);
109
488
  };
110
489
  const setDisplayState = (displayState2) => displayState2 === "show" ? internalShow() : internalHide();
111
- return /* @__PURE__ */ React2.createElement(PanelSidebarContext.Provider, {
490
+ return /* @__PURE__ */ React10.createElement(PanelSidebarContext.Provider, {
112
491
  value: {
113
492
  setDisplayState,
114
493
  displayState
115
494
  }
116
- }, /* @__PURE__ */ React2.createElement(DialogPrimitive.Root, {
495
+ }, /* @__PURE__ */ React10.createElement(DialogPrimitive.Root, {
117
496
  open: domShow,
118
497
  modal: !isLg
119
- }, /* @__PURE__ */ React2.createElement(DialogPrimitive.Content, _extends2({}, slots == null ? void 0 : slots.content, {
120
- className: mx2("fixed block-start-0 block-end-0 is-[272px] z-50 transition-[inset-inline-start,inset-inline-end] duration-200 ease-in-out overflow-x-hidden overflow-y-auto", transitionShow ? "inline-start-0" : "inline-start-[-272px]", (_a = slots == null ? void 0 : slots.content) == null ? void 0 : _a.className)
121
- }), /* @__PURE__ */ React2.createElement(DialogPrimitive.Title, {
498
+ }, /* @__PURE__ */ React10.createElement(DialogPrimitive.Content, _extends8({
499
+ onOpenAutoFocus: (event) => isLg && event.preventDefault(),
500
+ onCloseAutoFocus: (event) => isLg && event.preventDefault()
501
+ }, slots == null ? void 0 : slots.content, {
502
+ className: mx4("fixed block-start-0 block-end-0 is-sidebar z-50 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)
503
+ }), /* @__PURE__ */ React10.createElement(DialogPrimitive.Title, {
122
504
  className: "sr-only"
123
- }, t("sidebar label")), (_b = slots == null ? void 0 : slots.content) == null ? void 0 : _b.children), (slots == null ? void 0 : slots.fixedBlockStart) && /* @__PURE__ */ React2.createElement("div", _extends2({
124
- role: "none"
125
- }, slots == null ? void 0 : slots.fixedBlockStart, {
126
- className: mx2("fixed inline-end-0 block-start-0 z-[49] transition-[inset-inline-start,inset-inline-end] duration-200 ease-in-out", transitionShow ? "inline-start-[272px]" : "inline-start-0", (_c = slots == null ? void 0 : slots.fixedBlockStart) == null ? void 0 : _c.className)
127
- }), (_d = slots == null ? void 0 : slots.fixedBlockStart) == null ? void 0 : _d.children), !isLg && /* @__PURE__ */ React2.createElement(DialogPrimitive.Overlay, {
128
- className: mx2(defaultOverlay, "transition-opacity duration-200 ease-in-out", transitionShow ? "opacity-100" : "opacity-0"),
505
+ }, t("sidebar label")), (_b = slots == null ? void 0 : slots.content) == null ? void 0 : _b.children), !isLg && /* @__PURE__ */ React10.createElement(DialogPrimitive.Overlay, {
506
+ className: mx4(defaultOverlay, "transition-opacity duration-200 ease-in-out", transitionShow ? "opacity-100" : "opacity-0"),
129
507
  onClick: internalHide
130
- }), /* @__PURE__ */ React2.createElement("div", {
131
- role: "none",
132
- className: mx2("bs-full transition-[padding-inline-start] duration-200 ease-in-out", isLg && isOpen ? "pis-[272px]" : "pis-0")
133
- }, children)));
508
+ }), /* @__PURE__ */ React10.createElement("div", _extends8({
509
+ role: "none"
510
+ }, slots == null ? void 0 : slots.main, {
511
+ className: mx4("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)
512
+ }), children)));
513
+ };
514
+
515
+ // packages/apps/patterns/react-ui/src/layouts/PanelAlertDialog/PanelAlertDialog.tsx
516
+ import * as AlertDialog from "@radix-ui/react-alert-dialog";
517
+ import React11 from "react";
518
+ import { mx as mx5 } from "@dxos/react-components";
519
+ function _extends9() {
520
+ _extends9 = Object.assign || function(target) {
521
+ for (var i = 1; i < arguments.length; i++) {
522
+ var source = arguments[i];
523
+ for (var key in source) {
524
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
525
+ target[key] = source[key];
526
+ }
527
+ }
528
+ }
529
+ return target;
530
+ };
531
+ return _extends9.apply(this, arguments);
532
+ }
533
+ var PanelAlertDialog = ({ titleId, slots = {}, children }) => {
534
+ var _a, _b;
535
+ return /* @__PURE__ */ React11.createElement(AlertDialog.Root, _extends9({
536
+ defaultOpen: true
537
+ }, slots.root), slots.trigger && /* @__PURE__ */ React11.createElement(AlertDialog.Trigger, _extends9({}, slots.trigger)), /* @__PURE__ */ React11.createElement(AlertDialog.Overlay, _extends9({}, slots.overlay, {
538
+ className: mx5("fixed inset-0 backdrop-blur z-50 overflow-auto grid place-items-center p-2 md:p-4 lg:p-8", (_a = slots.overlay) == null ? void 0 : _a.className)
539
+ }), /* @__PURE__ */ React11.createElement(AlertDialog.Content, _extends9({
540
+ onEscapeKeyDown: (event) => event.preventDefault()
541
+ }, slots.content, {
542
+ "aria-labelledby": titleId,
543
+ className: mx5("is-full min-is-[260px] max-is-[320px] shadow-md backdrop-blur-md", (_b = slots.content) == null ? void 0 : _b.className)
544
+ }), children)));
134
545
  };
135
546
 
136
547
  // packages/apps/patterns/react-ui/src/panels/IdentityPanel/IdentityPanel.tsx
137
- import React3 from "react";
138
- import { useClient } from "@dxos/react-client";
139
- import { Avatar, Button, ThemeContext, useTranslation as useTranslation2 } from "@dxos/react-components";
548
+ import React12 from "react";
549
+ import { useClient as useClient2 } from "@dxos/react-client";
550
+ import { Avatar as Avatar2, Button as Button2, ThemeContext, useTranslation as useTranslation4 } from "@dxos/react-components";
140
551
  var IdentityPanel = ({ identity, onClickManageProfile }) => {
141
552
  var _a;
142
- const { t } = useTranslation2("os");
143
- const client = useClient();
553
+ const { t } = useTranslation4("os");
554
+ const client = useClient2();
144
555
  const defaultManageProfile = () => {
145
556
  const remoteSource = new URL((client == null ? void 0 : client.config.get("runtime.client.remoteSource")) || "https://halo.dxos.org");
146
557
  const tab = window.open(remoteSource.origin, "_blank");
147
558
  tab == null ? void 0 : tab.focus();
148
559
  };
149
- return /* @__PURE__ */ React3.createElement(ThemeContext.Provider, {
560
+ return /* @__PURE__ */ React12.createElement(ThemeContext.Provider, {
150
561
  value: {
151
562
  themeVariant: "os"
152
563
  }
153
- }, /* @__PURE__ */ React3.createElement("div", {
564
+ }, /* @__PURE__ */ React12.createElement("div", {
154
565
  className: "flex flex-col gap-2 justify-center items-center"
155
- }, /* @__PURE__ */ React3.createElement(Avatar, {
566
+ }, /* @__PURE__ */ React12.createElement(Avatar2, {
156
567
  size: 16,
157
568
  variant: "circle",
158
569
  fallbackValue: identity.identityKey.toHex(),
159
570
  label: (_a = identity.displayName) != null ? _a : ""
160
- }), /* @__PURE__ */ React3.createElement(Button, {
571
+ }), /* @__PURE__ */ React12.createElement(Button2, {
161
572
  compact: true,
162
573
  onClick: onClickManageProfile != null ? onClickManageProfile : defaultManageProfile,
163
574
  className: "is-full"
164
575
  }, t("manage profile label"))));
165
576
  };
166
577
 
578
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinPanel.tsx
579
+ import React23, { useEffect, useReducer } from "react";
580
+ import { InvitationEncoder as InvitationEncoder2 } from "@dxos/client";
581
+ import { log } from "@dxos/log";
582
+ import { useClient as useClient5, useIdentity } from "@dxos/react-client";
583
+ import { useId as useId3 } from "@dxos/react-components";
584
+
585
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinHeading.tsx
586
+ import { ProhibitInset as ProhibitInset2 } from "phosphor-react";
587
+ import React13, { cloneElement, forwardRef } from "react";
588
+ import { useSpace as useSpace2 } from "@dxos/react-client";
589
+ import { Avatar as Avatar3, Button as Button3, getSize as getSize3, Heading, mx as mx6, Trans, useId, useTranslation as useTranslation5 } from "@dxos/react-components";
590
+ function _extends10() {
591
+ _extends10 = Object.assign || function(target) {
592
+ for (var i = 1; i < arguments.length; i++) {
593
+ var source = arguments[i];
594
+ for (var key in source) {
595
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
596
+ target[key] = source[key];
597
+ }
598
+ }
599
+ }
600
+ return target;
601
+ };
602
+ return _extends10.apply(this, arguments);
603
+ }
604
+ var JoinHeading = /* @__PURE__ */ forwardRef(({ titleId, invitation, onExit, exitActionParent }, ref) => {
605
+ var _a, _b, _c, _d, _e;
606
+ const { t } = useTranslation5("os");
607
+ const space = useSpace2((_a = invitation == null ? void 0 : invitation.invitation) == null ? void 0 : _a.spaceKey);
608
+ const spaceTitle = (_b = space == null ? void 0 : space.properties.name) != null ? _b : "(Space not available)";
609
+ const nameId = useId("spaceDisplayName");
610
+ const exitButton = /* @__PURE__ */ React13.createElement(Button3, _extends10({
611
+ compact: true,
612
+ variant: "ghost"
613
+ }, onExit && {
614
+ onClick: onExit
615
+ }, {
616
+ className: "grow-0 shrink-0"
617
+ }), /* @__PURE__ */ React13.createElement(ProhibitInset2, {
618
+ className: getSize3(5)
619
+ }), /* @__PURE__ */ React13.createElement("span", {
620
+ className: "sr-only"
621
+ }, t("exit label")));
622
+ return /* @__PURE__ */ React13.createElement("div", {
623
+ role: "none",
624
+ className: mx6(subduedSurface, "p-2 rounded-bs-md"),
625
+ ref
626
+ }, /* @__PURE__ */ React13.createElement("div", {
627
+ role: "group",
628
+ className: "flex items-center gap-2"
629
+ }, /* @__PURE__ */ React13.createElement(Avatar3, {
630
+ fallbackValue: (_e = (_d = (_c = invitation == null ? void 0 : invitation.invitation) == null ? void 0 : _c.spaceKey) == null ? void 0 : _d.toHex()) != null ? _e : "",
631
+ labelId: nameId
632
+ }), /* @__PURE__ */ React13.createElement(Heading, {
633
+ level: 1,
634
+ className: "font-body font-normal text-base grow",
635
+ id: titleId
636
+ }, /* @__PURE__ */ React13.createElement(Trans, _extends10({}, {
637
+ defaults: t("join space heading"),
638
+ components: {
639
+ small: /* @__PURE__ */ React13.createElement("span", {
640
+ className: "block leading-none mbe-1 font-system-medium text-sm"
641
+ }),
642
+ large: /* @__PURE__ */ React13.createElement("span", {
643
+ className: "block leading-none",
644
+ id: nameId
645
+ })
646
+ },
647
+ values: {
648
+ spaceTitle
649
+ }
650
+ }))), exitActionParent ? /* @__PURE__ */ cloneElement(exitActionParent, {}, exitButton) : exitButton));
651
+ });
652
+
653
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx
654
+ import { CaretLeft, CaretRight, Plus, QrCode as QrCode2, Textbox } from "phosphor-react";
655
+ import React15 from "react";
656
+ import { Button as Button4, CompoundButton, getSize as getSize5, mx as mx8, useTranslation as useTranslation7 } from "@dxos/react-components";
657
+
658
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/ViewState.tsx
659
+ import { CheckCircle, HourglassSimple, X as X2 } from "phosphor-react";
660
+ import React14, { useMemo as useMemo2 } from "react";
661
+ import { Invitation as Invitation4 } from "@dxos/client";
662
+ import { useInvitationStatus as useInvitationStatus2 } from "@dxos/react-client";
663
+ import { mx as mx7, useTranslation as useTranslation6, Trans as Trans2, Avatar as Avatar4, useId as useId2, getSize as getSize4, strongShimmer } from "@dxos/react-components";
664
+ function _extends11() {
665
+ _extends11 = Object.assign || function(target) {
666
+ for (var i = 1; i < arguments.length; i++) {
667
+ var source = arguments[i];
668
+ for (var key in source) {
669
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
670
+ target[key] = source[key];
671
+ }
672
+ }
673
+ }
674
+ return target;
675
+ };
676
+ return _extends11.apply(this, arguments);
677
+ }
678
+ var stripe = mx7("rounded-full grow", getSize4(3));
679
+ var ViewStateHeading = ({ children, className, ...props }) => {
680
+ return /* @__PURE__ */ React14.createElement("h2", _extends11({}, props, {
681
+ className: mx7("font-system-medium text-sm md:text-base mbe-1 mli-1 text-center", className)
682
+ }), children);
683
+ };
684
+ var PureViewStateInvitation = ({ halted, cursor, label, resolvedColor }) => {
685
+ const labelId = useId2("invitationState");
686
+ return /* @__PURE__ */ React14.createElement("div", {
687
+ role: "none",
688
+ className: mx7(defaultSurface, "pli-2 pbs-2")
689
+ }, /* @__PURE__ */ React14.createElement("div", {
690
+ role: "status",
691
+ "aria-labelledby": labelId,
692
+ className: "flex gap-2 items-center mlb-1"
693
+ }, /* @__PURE__ */ React14.createElement("div", {
694
+ role: "none",
695
+ className: mx7(stripe, !halted && cursor === 1 && strongShimmer, cursor === 2 ? halted ? resolvedColor : activeBgColor : cursor > 1 ? resolvedColor : inactiveBgColor)
696
+ }), /* @__PURE__ */ React14.createElement("div", {
697
+ role: "none",
698
+ className: mx7(stripe, !halted && cursor === 3 && strongShimmer, cursor === 3 ? halted ? resolvedColor : activeBgColor : cursor > 3 ? resolvedColor : inactiveBgColor)
699
+ }), /* @__PURE__ */ React14.createElement("div", {
700
+ role: "none",
701
+ className: mx7(stripe, cursor > 3 ? halted ? resolvedColor : resolvedColor : inactiveBgColor)
702
+ })), /* @__PURE__ */ React14.createElement(ViewStateHeading, {
703
+ id: labelId,
704
+ className: "mbs-2 flex justify-center items-center gap-2"
705
+ }, label));
706
+ };
707
+ var ViewStateInvitationStatus = ({ activeInvitation }) => {
708
+ const { t } = useTranslation6("os");
709
+ const { status, haltedAt } = useInvitationStatus2(activeInvitation);
710
+ const halted = status === Invitation4.State.CANCELLED || status === Invitation4.State.TIMEOUT || status === Invitation4.State.ERROR;
711
+ const cursor = invitationStatusValue.get(halted ? haltedAt : status);
712
+ const resolvedColor = resolvedBgColor(status);
713
+ const statusLabelMap = useMemo2(() => /* @__PURE__ */ new Map([
714
+ [
715
+ Invitation4.State.ERROR,
716
+ /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(X2, {
717
+ weight: "bold",
718
+ className: mx7(getSize4(4), "text-error-600 dark:text-error-400")
719
+ }), /* @__PURE__ */ React14.createElement("span", null, t("error status label")))
720
+ ],
721
+ [
722
+ Invitation4.State.TIMEOUT,
723
+ /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(HourglassSimple, {
724
+ weight: "fill",
725
+ className: mx7(getSize4(4), "text-warning-600 dark:text-warning-400")
726
+ }), /* @__PURE__ */ React14.createElement("span", null, t("timeout status label")))
727
+ ],
728
+ [
729
+ Invitation4.State.CANCELLED,
730
+ /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(X2, {
731
+ weight: "bold",
732
+ className: mx7(getSize4(4), "text-warning-600 dark:text-warning-400")
733
+ }), /* @__PURE__ */ React14.createElement("span", null, t("cancelled status label")))
734
+ ],
735
+ [
736
+ Invitation4.State.INIT,
737
+ t("init status label")
738
+ ],
739
+ [
740
+ Invitation4.State.CONNECTING,
741
+ t("connecting status label")
742
+ ],
743
+ [
744
+ Invitation4.State.CONNECTED,
745
+ t("connected status label")
746
+ ],
747
+ [
748
+ Invitation4.State.AUTHENTICATING,
749
+ t("authenticating status label")
750
+ ],
751
+ [
752
+ Invitation4.State.SUCCESS,
753
+ /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(CheckCircle, {
754
+ weight: "fill",
755
+ className: mx7(getSize4(4), "text-success-600 dark:text-success-400")
756
+ }), /* @__PURE__ */ React14.createElement("span", null, t("success status label")))
757
+ ]
758
+ ]), [
759
+ t
760
+ ]);
761
+ return /* @__PURE__ */ React14.createElement(PureViewStateInvitation, _extends11({}, {
762
+ label: statusLabelMap.get(status),
763
+ resolvedColor,
764
+ cursor,
765
+ halted
766
+ }));
767
+ };
768
+ var ViewState = ({ active, children, className, dispatch, selectedIdentity, activeInvitation, ...props }) => {
769
+ var _a;
770
+ const { t } = useTranslation6("os");
771
+ const identityLabel = useId2("selectedIdentityLabel");
772
+ return /* @__PURE__ */ React14.createElement("div", _extends11({
773
+ role: "none"
774
+ }, props, !active && {
775
+ "aria-hidden": true
776
+ }, {
777
+ className: mx7("is-[50%] flex flex-col", active ? "order-2" : "order-4", className)
778
+ }), selectedIdentity && /* @__PURE__ */ React14.createElement("div", {
779
+ role: "none",
780
+ className: mx7(subduedSurface, "flex-none flex items-center gap-1 pli-2 pbe-1.5")
781
+ }, /* @__PURE__ */ React14.createElement(Trans2, _extends11({}, {
782
+ defaults: t("join space as identity heading"),
783
+ components: {
784
+ icon: /* @__PURE__ */ React14.createElement(Avatar4, {
785
+ size: 4,
786
+ fallbackValue: selectedIdentity === true ? "" : selectedIdentity.identityKey.toHex(),
787
+ labelId: identityLabel
788
+ }),
789
+ label: /* @__PURE__ */ React14.createElement("span", {
790
+ id: identityLabel
791
+ }),
792
+ part: /* @__PURE__ */ React14.createElement("span", {
793
+ role: "none",
794
+ className: "flex items-center gap-1 leading-none"
795
+ })
796
+ },
797
+ values: {
798
+ labelValue: selectedIdentity === true ? "\xA0" : (_a = selectedIdentity.displayName) != null ? _a : selectedIdentity.identityKey.truncate()
799
+ }
800
+ }))), activeInvitation && (activeInvitation === true ? /* @__PURE__ */ React14.createElement(PureViewStateInvitation, _extends11({}, {
801
+ halted: false,
802
+ status: Invitation4.State.INIT,
803
+ label: t("invitation input label"),
804
+ cursor: 0,
805
+ resolvedColor: inactiveBgColor
806
+ })) : /* @__PURE__ */ React14.createElement(ViewStateInvitationStatus, _extends11({}, {
807
+ activeInvitation
808
+ }))), /* @__PURE__ */ React14.createElement("div", {
809
+ role: "region",
810
+ className: mx7(defaultSurface, "rounded-be-md grow shrink-0 flex flex-col gap-1 p-2")
811
+ }, children));
812
+ };
813
+
814
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx
815
+ function _extends12() {
816
+ _extends12 = Object.assign || function(target) {
817
+ for (var i = 1; i < arguments.length; i++) {
818
+ var source = arguments[i];
819
+ for (var key in source) {
820
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
821
+ target[key] = source[key];
822
+ }
823
+ }
824
+ }
825
+ return target;
826
+ };
827
+ return _extends12.apply(this, arguments);
828
+ }
829
+ var AdditionMethodSelector = ({ availableIdentities, ...viewStateProps }) => {
830
+ const disabled = !viewStateProps.active;
831
+ const { dispatch } = viewStateProps;
832
+ const { t } = useTranslation7("os");
833
+ const sharedButtonProps = {
834
+ disabled,
835
+ after: /* @__PURE__ */ React15.createElement(CaretRight, {
836
+ className: getSize5(4),
837
+ weight: "bold"
838
+ }),
839
+ slots: {
840
+ label: {
841
+ className: "text-sm"
842
+ }
843
+ }
844
+ };
845
+ return /* @__PURE__ */ React15.createElement(ViewState, _extends12({}, viewStateProps), /* @__PURE__ */ React15.createElement(ViewStateHeading, null, t("addition method selector title")), /* @__PURE__ */ React15.createElement("div", {
846
+ role: "none",
847
+ className: "flex flex-col gap-1 grow"
848
+ }, /* @__PURE__ */ React15.createElement(CompoundButton, _extends12({}, sharedButtonProps, {
849
+ description: t("create identity description"),
850
+ before: /* @__PURE__ */ React15.createElement(Plus, {
851
+ className: getSize5(6)
852
+ }),
853
+ onClick: () => dispatch({
854
+ type: "select addition method",
855
+ method: "create identity"
856
+ }),
857
+ "data-autofocus": "addition method selector"
858
+ }), t("create identity label")), /* @__PURE__ */ React15.createElement(CompoundButton, _extends12({}, sharedButtonProps, {
859
+ description: t("join identity description"),
860
+ before: /* @__PURE__ */ React15.createElement(QrCode2, {
861
+ className: getSize5(6)
862
+ }),
863
+ onClick: () => dispatch({
864
+ type: "select addition method",
865
+ method: "accept device invitation"
866
+ })
867
+ }), t("join identity label")), /* @__PURE__ */ React15.createElement(CompoundButton, _extends12({}, sharedButtonProps, {
868
+ description: t("recover identity description"),
869
+ before: /* @__PURE__ */ React15.createElement(Textbox, {
870
+ className: getSize5(6)
871
+ }),
872
+ onClick: () => dispatch({
873
+ type: "select addition method",
874
+ method: "recover identity"
875
+ })
876
+ }), t("recover identity label"))), /* @__PURE__ */ React15.createElement(Button4, {
877
+ disabled: disabled || availableIdentities.length < 1,
878
+ onClick: () => dispatch({
879
+ type: "deselect identity"
880
+ })
881
+ }, /* @__PURE__ */ React15.createElement(CaretLeft, {
882
+ className: getSize5(4),
883
+ weight: "bold"
884
+ }), /* @__PURE__ */ React15.createElement("span", {
885
+ className: "grow"
886
+ }, t("deselect identity label")), /* @__PURE__ */ React15.createElement(CaretRight, {
887
+ className: mx8(getSize5(4), "invisible"),
888
+ weight: "bold"
889
+ })));
890
+ };
891
+
892
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/IdentityAdded.tsx
893
+ import { CaretLeft as CaretLeft2, CaretRight as CaretRight2 } from "phosphor-react";
894
+ import React16 from "react";
895
+ import { Avatar as Avatar5, Button as Button5, getSize as getSize6, mx as mx9, useTranslation as useTranslation8 } from "@dxos/react-components";
896
+ function _extends13() {
897
+ _extends13 = Object.assign || function(target) {
898
+ for (var i = 1; i < arguments.length; i++) {
899
+ var source = arguments[i];
900
+ for (var key in source) {
901
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
902
+ target[key] = source[key];
903
+ }
904
+ }
905
+ }
906
+ return target;
907
+ };
908
+ return _extends13.apply(this, arguments);
909
+ }
910
+ var IdentityAdded = ({ addedIdentity, ...viewStateProps }) => {
911
+ var _a, _b, _c;
912
+ const disabled = !viewStateProps.active;
913
+ const { dispatch } = viewStateProps;
914
+ const { t } = useTranslation8("os");
915
+ return /* @__PURE__ */ React16.createElement(ViewState, _extends13({}, viewStateProps), /* @__PURE__ */ React16.createElement(ViewStateHeading, null, t("identity added label")), /* @__PURE__ */ React16.createElement("div", {
916
+ role: "none",
917
+ className: "grow flex flex-col items-center justify-center text-center gap-2"
918
+ }, /* @__PURE__ */ React16.createElement(Avatar5, {
919
+ size: 20,
920
+ fallbackValue: (_a = addedIdentity == null ? void 0 : addedIdentity.identityKey.toHex()) != null ? _a : "",
921
+ label: /* @__PURE__ */ React16.createElement("p", {
922
+ className: mx9("text-lg", !(addedIdentity == null ? void 0 : addedIdentity.displayName) && "font-mono")
923
+ }, (_c = (_b = addedIdentity == null ? void 0 : addedIdentity.displayName) != null ? _b : addedIdentity == null ? void 0 : addedIdentity.identityKey.truncate()) != null ? _c : "\xA0"),
924
+ variant: "circle",
925
+ status: "active"
926
+ })), /* @__PURE__ */ React16.createElement("div", {
927
+ className: "flex gap-2"
928
+ }, /* @__PURE__ */ React16.createElement(Button5, {
929
+ disabled: disabled || !addedIdentity,
930
+ className: "grow flex items-center gap-2 pli-2 order-2",
931
+ onClick: () => addedIdentity && dispatch({
932
+ type: "select identity",
933
+ identity: addedIdentity
934
+ }),
935
+ "data-autofocus": "identity added"
936
+ }, /* @__PURE__ */ React16.createElement(CaretLeft2, {
937
+ weight: "bold",
938
+ className: mx9(getSize6(2), "invisible")
939
+ }), /* @__PURE__ */ React16.createElement("span", {
940
+ className: "grow"
941
+ }, t("continue label")), /* @__PURE__ */ React16.createElement(CaretRight2, {
942
+ weight: "bold",
943
+ className: getSize6(4)
944
+ })), /* @__PURE__ */ React16.createElement(Button5, {
945
+ disabled,
946
+ onClick: () => dispatch({
947
+ type: "deselect identity"
948
+ }),
949
+ className: "flex items-center gap-2 pis-2 pie-4"
950
+ }, /* @__PURE__ */ React16.createElement(CaretLeft2, {
951
+ weight: "bold",
952
+ className: getSize6(4)
953
+ }), /* @__PURE__ */ React16.createElement("span", null, t("deselect identity label")))));
954
+ };
955
+
956
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/IdentitySelector.tsx
957
+ import * as RadioGroup from "@radix-ui/react-radio-group";
958
+ import { CaretLeft as CaretLeft3, CaretRight as CaretRight3, UserPlus } from "phosphor-react";
959
+ import React17, { useCallback as useCallback4, useState as useState2 } from "react";
960
+ import { Avatar as Avatar6, Button as Button6, themeVariantFocus, getSize as getSize7, mx as mx10, useTranslation as useTranslation9 } from "@dxos/react-components";
961
+ function _extends14() {
962
+ _extends14 = Object.assign || function(target) {
963
+ for (var i = 1; i < arguments.length; i++) {
964
+ var source = arguments[i];
965
+ for (var key in source) {
966
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
967
+ target[key] = source[key];
968
+ }
969
+ }
970
+ }
971
+ return target;
972
+ };
973
+ return _extends14.apply(this, arguments);
974
+ }
975
+ var IdentitySelector = ({ availableIdentities, ...viewStateProps }) => {
976
+ const { dispatch } = viewStateProps;
977
+ const disabled = !viewStateProps.active;
978
+ const { t } = useTranslation9("os");
979
+ const [activeIdentity, setActiveIdentity] = useState2(availableIdentities[0]);
980
+ const onValueChange = useCallback4((nextHex) => setActiveIdentity(availableIdentities.find((identity) => identity.identityKey.toHex() === nextHex) || activeIdentity), [
981
+ availableIdentities
982
+ ]);
983
+ return /* @__PURE__ */ React17.createElement(ViewState, _extends14({}, viewStateProps), /* @__PURE__ */ React17.createElement(ViewStateHeading, null, t("identity selector title")), /* @__PURE__ */ React17.createElement(RadioGroup.Root, {
984
+ disabled,
985
+ value: activeIdentity == null ? void 0 : activeIdentity.identityKey.toHex(),
986
+ onValueChange,
987
+ className: "overflow-y-auto grow shrink min-bs-10 pli-1 -mli-1",
988
+ "aria-label": t("identity radio group title"),
989
+ "data-autofocus": "identity selector"
990
+ }, availableIdentities.map(({ displayName, identityKey }) => {
991
+ var _a;
992
+ const hex = identityKey.toHex();
993
+ const inputId = `identitySelector__item--${hex}`;
994
+ const labelId = `identitySelector__itemLabel--${hex}`;
995
+ return /* @__PURE__ */ React17.createElement("label", {
996
+ htmlFor: inputId,
997
+ key: hex,
998
+ className: "flex items-center mbe-2 gap-2 cursor-pointer"
999
+ }, /* @__PURE__ */ React17.createElement(RadioGroup.Item, {
1000
+ id: inputId,
1001
+ "aria-labelledby": labelId,
1002
+ value: hex,
1003
+ className: mx10("peer relative w-4 h-4 rounded-full", "border border-transparent text-white", "radix-state-checked:bg-primary-600", "radix-state-unchecked:bg-neutral-100 dark:radix-state-unchecked:bg-neutral-900", themeVariantFocus("os"))
1004
+ }, /* @__PURE__ */ React17.createElement(RadioGroup.Indicator, {
1005
+ className: "absolute inset-0 flex items-center justify-center leading-0"
1006
+ }, /* @__PURE__ */ React17.createElement("div", {
1007
+ className: "w-1.5 h-1.5 rounded-full bg-white"
1008
+ }))), /* @__PURE__ */ React17.createElement(Avatar6, {
1009
+ fallbackValue: hex,
1010
+ labelId,
1011
+ variant: "circle"
1012
+ }), /* @__PURE__ */ React17.createElement("span", {
1013
+ id: labelId,
1014
+ className: mx10(!displayName && "font-mono")
1015
+ }, (_a = displayName != null ? displayName : identityKey.truncate()) != null ? _a : ""));
1016
+ })), /* @__PURE__ */ React17.createElement(Button6, {
1017
+ disabled,
1018
+ compact: true,
1019
+ onClick: () => dispatch({
1020
+ type: "add identity"
1021
+ }),
1022
+ className: "flex items-center gap-2 pli-2"
1023
+ }, /* @__PURE__ */ React17.createElement("span", null, t("add identity label")), /* @__PURE__ */ React17.createElement(UserPlus, {
1024
+ weight: "bold",
1025
+ className: getSize7(3.5)
1026
+ })), /* @__PURE__ */ React17.createElement(Button6, {
1027
+ disabled: disabled || !activeIdentity,
1028
+ className: "flex items-center gap-2 pli-2",
1029
+ onClick: () => dispatch({
1030
+ type: "select identity",
1031
+ identity: activeIdentity
1032
+ })
1033
+ }, /* @__PURE__ */ React17.createElement(CaretLeft3, {
1034
+ weight: "bold",
1035
+ className: mx10(getSize7(4), "invisible")
1036
+ }), /* @__PURE__ */ React17.createElement("span", {
1037
+ className: "grow"
1038
+ }, t("continue label")), /* @__PURE__ */ React17.createElement(CaretRight3, {
1039
+ weight: "bold",
1040
+ className: getSize7(4)
1041
+ })));
1042
+ };
1043
+
1044
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/IdentityInput.tsx
1045
+ import { CaretLeft as CaretLeft4, CaretRight as CaretRight4 } from "phosphor-react";
1046
+ import React18, { useState as useState3 } from "react";
1047
+ import { useClient as useClient3 } from "@dxos/react-client";
1048
+ import { Button as Button7, getSize as getSize8, Input, mx as mx11, useTranslation as useTranslation10 } from "@dxos/react-components";
1049
+ function _extends15() {
1050
+ _extends15 = Object.assign || function(target) {
1051
+ for (var i = 1; i < arguments.length; i++) {
1052
+ var source = arguments[i];
1053
+ for (var key in source) {
1054
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1055
+ target[key] = source[key];
1056
+ }
1057
+ }
1058
+ }
1059
+ return target;
1060
+ };
1061
+ return _extends15.apply(this, arguments);
1062
+ }
1063
+ var IdentityInput = ({ method, ...viewStateProps }) => {
1064
+ const disabled = !viewStateProps.active;
1065
+ const { dispatch } = viewStateProps;
1066
+ const { t } = useTranslation10("os");
1067
+ const [inputValue, setInputValue] = useState3("");
1068
+ const client = useClient3();
1069
+ const [validationMessage, setValidationMessage] = useState3("");
1070
+ const isRecover = method === "recover identity";
1071
+ const handleNext = () => {
1072
+ void client.halo.createProfile({
1073
+ [isRecover ? "seedphrase" : "displayName"]: inputValue
1074
+ }).then((identity) => {
1075
+ dispatch({
1076
+ type: "added identity",
1077
+ identity
1078
+ });
1079
+ }, (_error) => {
1080
+ setValidationMessage(t(isRecover ? "failed to recover identity message" : "failed to create identity message"));
1081
+ });
1082
+ };
1083
+ return /* @__PURE__ */ React18.createElement(ViewState, _extends15({}, viewStateProps), /* @__PURE__ */ React18.createElement(Input, _extends15({
1084
+ disabled,
1085
+ label: /* @__PURE__ */ React18.createElement(ViewStateHeading, null, t(isRecover ? "recover identity input label" : "new identity input label")),
1086
+ onChange: ({ target: { value } }) => setInputValue(value),
1087
+ slots: {
1088
+ root: {
1089
+ className: "m-0"
1090
+ },
1091
+ input: {
1092
+ "data-autofocus": isRecover ? "identity input; recover identity" : "identity input; create identity",
1093
+ onKeyUp: ({ key }) => key === "Enter" && handleNext()
1094
+ }
1095
+ }
1096
+ }, validationMessage.length && {
1097
+ validationValence: "error",
1098
+ validationMessage
1099
+ })), /* @__PURE__ */ React18.createElement("div", {
1100
+ role: "none",
1101
+ className: "grow"
1102
+ }), /* @__PURE__ */ React18.createElement("div", {
1103
+ className: "flex gap-2"
1104
+ }, /* @__PURE__ */ React18.createElement(Button7, {
1105
+ disabled,
1106
+ className: "grow flex items-center gap-2 pli-2 order-2",
1107
+ onClick: handleNext
1108
+ }, /* @__PURE__ */ React18.createElement(CaretLeft4, {
1109
+ weight: "bold",
1110
+ className: mx11(getSize8(2), "invisible")
1111
+ }), /* @__PURE__ */ React18.createElement("span", {
1112
+ className: "grow"
1113
+ }, t("continue label")), /* @__PURE__ */ React18.createElement(CaretRight4, {
1114
+ weight: "bold",
1115
+ className: getSize8(4)
1116
+ })), /* @__PURE__ */ React18.createElement(Button7, {
1117
+ disabled,
1118
+ onClick: () => dispatch({
1119
+ type: "add identity"
1120
+ }),
1121
+ className: "flex items-center gap-2 pis-2 pie-4"
1122
+ }, /* @__PURE__ */ React18.createElement(CaretLeft4, {
1123
+ weight: "bold",
1124
+ className: getSize8(4)
1125
+ }), /* @__PURE__ */ React18.createElement("span", null, t("back label")))));
1126
+ };
1127
+
1128
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationAccepted.tsx
1129
+ import { CaretLeft as CaretLeft5, Check } from "phosphor-react";
1130
+ import React19, { cloneElement as cloneElement2 } from "react";
1131
+ import { useInvitationStatus as useInvitationStatus3 } from "@dxos/react-client";
1132
+ import { Button as Button8, getSize as getSize9, mx as mx12, useTranslation as useTranslation11 } from "@dxos/react-components";
1133
+ function _extends16() {
1134
+ _extends16 = Object.assign || function(target) {
1135
+ for (var i = 1; i < arguments.length; i++) {
1136
+ var source = arguments[i];
1137
+ for (var key in source) {
1138
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1139
+ target[key] = source[key];
1140
+ }
1141
+ }
1142
+ }
1143
+ return target;
1144
+ };
1145
+ return _extends16.apply(this, arguments);
1146
+ }
1147
+ var PureInvitationAcceptedContent = ({ onDone, result, invitationType, doneActionParent, active }) => {
1148
+ const disabled = !active;
1149
+ const { t } = useTranslation11("os");
1150
+ const doneButton = /* @__PURE__ */ React19.createElement(Button8, _extends16({}, onDone && {
1151
+ onClick: () => onDone(result)
1152
+ }, {
1153
+ disabled,
1154
+ className: "grow flex items-center gap-2 pli-2",
1155
+ "data-autofocus": `${invitationType} invitation acceptor; invitation accepted`
1156
+ }), /* @__PURE__ */ React19.createElement(CaretLeft5, {
1157
+ weight: "bold",
1158
+ className: mx12(getSize9(2), "invisible")
1159
+ }), /* @__PURE__ */ React19.createElement("span", {
1160
+ className: "grow"
1161
+ }, t("done label")), /* @__PURE__ */ React19.createElement(Check, {
1162
+ weight: "bold",
1163
+ className: getSize9(4)
1164
+ }));
1165
+ return doneActionParent ? /* @__PURE__ */ cloneElement2(doneActionParent, {}, doneButton) : doneButton;
1166
+ };
1167
+ var InvitationAcceptedContent = (props) => {
1168
+ const { result } = useInvitationStatus3(props.activeInvitation);
1169
+ return /* @__PURE__ */ React19.createElement(PureInvitationAcceptedContent, _extends16({}, props, {
1170
+ result
1171
+ }));
1172
+ };
1173
+ var InvitationAccepted = (props) => {
1174
+ const { invitationType: _invitationType, doneActionParent: _doneActionParent, onDone: _onDone, ...viewStateProps } = props;
1175
+ const { activeInvitation } = viewStateProps;
1176
+ return /* @__PURE__ */ React19.createElement(ViewState, _extends16({}, viewStateProps), !activeInvitation || activeInvitation === true ? /* @__PURE__ */ React19.createElement(PureInvitationAcceptedContent, _extends16({}, props, {
1177
+ result: null
1178
+ })) : /* @__PURE__ */ React19.createElement(InvitationAcceptedContent, _extends16({}, props)));
1179
+ };
1180
+
1181
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationInput.tsx
1182
+ import { CaretLeft as CaretLeft6, CaretRight as CaretRight5 } from "phosphor-react";
1183
+ import React20, { useState as useState4 } from "react";
1184
+ import { InvitationEncoder } from "@dxos/client";
1185
+ import { useClient as useClient4 } from "@dxos/react-client";
1186
+ import { Button as Button9, getSize as getSize10, Input as Input2, mx as mx13, useTranslation as useTranslation12 } from "@dxos/react-components";
1187
+ function _extends17() {
1188
+ _extends17 = Object.assign || function(target) {
1189
+ for (var i = 1; i < arguments.length; i++) {
1190
+ var source = arguments[i];
1191
+ for (var key in source) {
1192
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1193
+ target[key] = source[key];
1194
+ }
1195
+ }
1196
+ }
1197
+ return target;
1198
+ };
1199
+ return _extends17.apply(this, arguments);
1200
+ }
1201
+ var InvitationInput = ({ invitationType, ...viewStateProps }) => {
1202
+ const client = useClient4();
1203
+ const disabled = !viewStateProps.active;
1204
+ const { dispatch } = viewStateProps;
1205
+ const { t } = useTranslation12("os");
1206
+ const [inputValue, setInputValue] = useState4("");
1207
+ const handleNext = () => dispatch({
1208
+ type: "connecting invitation",
1209
+ from: invitationType,
1210
+ invitation: client[invitationType === "halo" ? "halo" : "echo"].acceptInvitation(InvitationEncoder.decode(inputValue))
1211
+ });
1212
+ return /* @__PURE__ */ React20.createElement(ViewState, _extends17({}, viewStateProps), /* @__PURE__ */ React20.createElement(Input2, {
1213
+ disabled,
1214
+ label: /* @__PURE__ */ React20.createElement(ViewStateHeading, null, t("invitation input label")),
1215
+ onChange: ({ target: { value } }) => setInputValue(value),
1216
+ slots: {
1217
+ root: {
1218
+ className: "m-0"
1219
+ },
1220
+ label: {
1221
+ className: "sr-only"
1222
+ },
1223
+ input: {
1224
+ "data-autofocus": `${invitationType} invitation acceptor; invitation input`,
1225
+ onKeyUp: ({ key }) => key === "Enter" && handleNext()
1226
+ }
1227
+ }
1228
+ }), /* @__PURE__ */ React20.createElement("div", {
1229
+ role: "none",
1230
+ className: "grow"
1231
+ }), /* @__PURE__ */ React20.createElement("div", {
1232
+ className: "flex gap-2"
1233
+ }, /* @__PURE__ */ React20.createElement(Button9, {
1234
+ disabled,
1235
+ className: "grow flex items-center gap-2 pli-2 order-2",
1236
+ onClick: handleNext
1237
+ }, /* @__PURE__ */ React20.createElement(CaretLeft6, {
1238
+ weight: "bold",
1239
+ className: mx13(getSize10(2), "invisible")
1240
+ }), /* @__PURE__ */ React20.createElement("span", {
1241
+ className: "grow"
1242
+ }, t("continue label")), /* @__PURE__ */ React20.createElement(CaretRight5, {
1243
+ weight: "bold",
1244
+ className: getSize10(4)
1245
+ })), /* @__PURE__ */ React20.createElement(Button9, {
1246
+ disabled,
1247
+ onClick: () => dispatch({
1248
+ type: "add identity"
1249
+ }),
1250
+ className: "flex items-center gap-2 pis-2 pie-4"
1251
+ }, /* @__PURE__ */ React20.createElement(CaretLeft6, {
1252
+ weight: "bold",
1253
+ className: getSize10(4)
1254
+ }), /* @__PURE__ */ React20.createElement("span", null, t("back label")))));
1255
+ };
1256
+
1257
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationRescuer.tsx
1258
+ import { ArrowsClockwise, CaretLeft as CaretLeft7, CaretRight as CaretRight6 } from "phosphor-react";
1259
+ import React21 from "react";
1260
+ import { Invitation as Invitation5 } from "@dxos/client";
1261
+ import { useInvitationStatus as useInvitationStatus4 } from "@dxos/react-client";
1262
+ import { Button as Button10, getSize as getSize11, mx as mx14, useTranslation as useTranslation13 } from "@dxos/react-components";
1263
+ function _extends18() {
1264
+ _extends18 = Object.assign || function(target) {
1265
+ for (var i = 1; i < arguments.length; i++) {
1266
+ var source = arguments[i];
1267
+ for (var key in source) {
1268
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1269
+ target[key] = source[key];
1270
+ }
1271
+ }
1272
+ }
1273
+ return target;
1274
+ };
1275
+ return _extends18.apply(this, arguments);
1276
+ }
1277
+ var InvitationActions = ({ activeInvitation, disabled, dispatch, invitationType }) => {
1278
+ const { status, cancel } = useInvitationStatus4(activeInvitation);
1279
+ const { t } = useTranslation13("os");
1280
+ switch (status) {
1281
+ case Invitation5.State.CONNECTING:
1282
+ return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement("div", {
1283
+ role: "none",
1284
+ className: "grow"
1285
+ }), /* @__PURE__ */ React21.createElement("div", {
1286
+ className: "flex gap-2"
1287
+ }, /* @__PURE__ */ React21.createElement(Button10, {
1288
+ disabled: true,
1289
+ className: "grow flex items-center gap-2 pli-2 order-2"
1290
+ }, /* @__PURE__ */ React21.createElement(CaretLeft7, {
1291
+ weight: "bold",
1292
+ className: mx14(getSize11(2), "invisible")
1293
+ }), /* @__PURE__ */ React21.createElement("span", {
1294
+ className: "grow"
1295
+ }, t("next label")), /* @__PURE__ */ React21.createElement(CaretRight6, {
1296
+ weight: "bold",
1297
+ className: getSize11(4)
1298
+ })), /* @__PURE__ */ React21.createElement(Button10, {
1299
+ disabled,
1300
+ className: "flex items-center gap-2 pis-2 pie-4",
1301
+ onClick: cancel,
1302
+ "data-autofocus": `${invitationType} invitation acceptor; invitation rescuer`
1303
+ }, /* @__PURE__ */ React21.createElement(CaretLeft7, {
1304
+ weight: "bold",
1305
+ className: getSize11(4)
1306
+ }), /* @__PURE__ */ React21.createElement("span", null, t("cancel label")))));
1307
+ case Invitation5.State.TIMEOUT:
1308
+ case Invitation5.State.CANCELLED:
1309
+ case Invitation5.State.ERROR:
1310
+ default:
1311
+ return /* @__PURE__ */ React21.createElement(Button10, {
1312
+ disabled,
1313
+ className: "grow flex items-center gap-2 pli-2",
1314
+ onClick: () => dispatch({
1315
+ type: "reset invitation",
1316
+ from: invitationType
1317
+ }),
1318
+ "data-autofocus": `${invitationType} invitation acceptor; invitation rescuer`
1319
+ }, /* @__PURE__ */ React21.createElement(CaretLeft7, {
1320
+ weight: "bold",
1321
+ className: mx14(getSize11(5), "invisible")
1322
+ }), /* @__PURE__ */ React21.createElement("span", {
1323
+ className: "grow"
1324
+ }, t("reset label")), /* @__PURE__ */ React21.createElement(ArrowsClockwise, {
1325
+ weight: "bold",
1326
+ className: getSize11(5)
1327
+ }));
1328
+ }
1329
+ };
1330
+ var InvitationRescuer = ({ invitationType, ...viewStateProps }) => {
1331
+ const disabled = !viewStateProps.active;
1332
+ const { dispatch, activeInvitation } = viewStateProps;
1333
+ const { t } = useTranslation13("os");
1334
+ return /* @__PURE__ */ React21.createElement(ViewState, _extends18({}, viewStateProps), activeInvitation === true || !activeInvitation ? /* @__PURE__ */ React21.createElement(Button10, {
1335
+ disabled,
1336
+ className: "grow flex items-center gap-2 pli-2",
1337
+ "data-autofocus": "space invitation acceptor; invitation rescuer"
1338
+ }, /* @__PURE__ */ React21.createElement(CaretLeft7, {
1339
+ weight: "bold",
1340
+ className: mx14(getSize11(5), "invisible")
1341
+ }), /* @__PURE__ */ React21.createElement("span", {
1342
+ className: "grow"
1343
+ }, t("connect label")), /* @__PURE__ */ React21.createElement(ArrowsClockwise, {
1344
+ weight: "bold",
1345
+ className: getSize11(5)
1346
+ })) : /* @__PURE__ */ React21.createElement(InvitationActions, _extends18({}, {
1347
+ activeInvitation,
1348
+ disabled,
1349
+ dispatch,
1350
+ invitationType
1351
+ })));
1352
+ };
1353
+
1354
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx
1355
+ import { CaretLeft as CaretLeft8, CaretRight as CaretRight7 } from "phosphor-react";
1356
+ import React22, { useCallback as useCallback5, useState as useState5 } from "react";
1357
+ import { useInvitationStatus as useInvitationStatus5 } from "@dxos/react-client";
1358
+ import { Button as Button11, getSize as getSize12, Input as Input3, mx as mx15, useTranslation as useTranslation14 } from "@dxos/react-components";
1359
+ function _extends19() {
1360
+ _extends19 = Object.assign || function(target) {
1361
+ for (var i = 1; i < arguments.length; i++) {
1362
+ var source = arguments[i];
1363
+ for (var key in source) {
1364
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1365
+ target[key] = source[key];
1366
+ }
1367
+ }
1368
+ }
1369
+ return target;
1370
+ };
1371
+ return _extends19.apply(this, arguments);
1372
+ }
1373
+ var pinLength = 6;
1374
+ var PureInvitationAuthenticatorContent = ({ disabled, failed, dispatch, invitationType, onChange, onAuthenticate }) => {
1375
+ const { t } = useTranslation14("os");
1376
+ return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(Input3, _extends19({
1377
+ label: t("pin input label"),
1378
+ size: "pin",
1379
+ length: pinLength,
1380
+ onChange,
1381
+ disabled,
1382
+ slots: {
1383
+ root: {
1384
+ className: "m-0"
1385
+ },
1386
+ label: {
1387
+ className: "sr-only"
1388
+ },
1389
+ description: {
1390
+ className: "text-center"
1391
+ },
1392
+ input: {
1393
+ disabled,
1394
+ inputMode: "numeric",
1395
+ pattern: "\\d*",
1396
+ "data-autofocus": `${invitationType} invitation acceptor; invitation authenticator`
1397
+ }
1398
+ }
1399
+ }, failed && {
1400
+ validationValence: "error",
1401
+ validationMessage: t("failed to authenticate message")
1402
+ })), /* @__PURE__ */ React22.createElement("div", {
1403
+ role: "none",
1404
+ className: "grow"
1405
+ }), /* @__PURE__ */ React22.createElement("div", {
1406
+ className: "flex gap-2"
1407
+ }, /* @__PURE__ */ React22.createElement(Button11, {
1408
+ disabled,
1409
+ className: "grow flex items-center gap-2 pli-2 order-2",
1410
+ onClick: onAuthenticate,
1411
+ "data-autofocus-pinlength": invitationType
1412
+ }, /* @__PURE__ */ React22.createElement(CaretLeft8, {
1413
+ weight: "bold",
1414
+ className: mx15(getSize12(2), "invisible")
1415
+ }), /* @__PURE__ */ React22.createElement("span", {
1416
+ className: "grow"
1417
+ }, t("next label")), /* @__PURE__ */ React22.createElement(CaretRight7, {
1418
+ weight: "bold",
1419
+ className: getSize12(4)
1420
+ })), /* @__PURE__ */ React22.createElement(Button11, {
1421
+ disabled,
1422
+ className: "flex items-center gap-2 pis-2 pie-4",
1423
+ onClick: () => dispatch({
1424
+ type: "cancel invitation",
1425
+ from: invitationType
1426
+ })
1427
+ }, /* @__PURE__ */ React22.createElement(CaretLeft8, {
1428
+ weight: "bold",
1429
+ className: getSize12(4)
1430
+ }), /* @__PURE__ */ React22.createElement("span", null, t("cancel label")))));
1431
+ };
1432
+ var InvitationAuthenticatorContent = ({ disabled, invitation, dispatch, invitationType, failed }) => {
1433
+ const [pinValue, setPinValue] = useState5("");
1434
+ const { authenticate } = useInvitationStatus5(invitation);
1435
+ const onAuthenticate = useCallback5(() => {
1436
+ dispatch({
1437
+ type: "authenticating invitation",
1438
+ from: invitationType
1439
+ });
1440
+ void authenticate(pinValue);
1441
+ }, [
1442
+ dispatch,
1443
+ invitationType,
1444
+ authenticate,
1445
+ pinValue
1446
+ ]);
1447
+ const onChange = useCallback5(({ target: { value } }) => {
1448
+ var _a;
1449
+ setPinValue(value);
1450
+ if (value.length === pinLength) {
1451
+ (_a = document.querySelector(`[data-autofocus-pinlength="${invitationType}"]`)) == null ? void 0 : _a.focus();
1452
+ }
1453
+ }, [
1454
+ authenticate,
1455
+ pinValue
1456
+ ]);
1457
+ return /* @__PURE__ */ React22.createElement(PureInvitationAuthenticatorContent, _extends19({}, {
1458
+ disabled,
1459
+ failed,
1460
+ dispatch,
1461
+ invitationType,
1462
+ onChange,
1463
+ onAuthenticate
1464
+ }));
1465
+ };
1466
+ var InvitationAuthenticator = ({ invitationType, failed, ...viewStateProps }) => {
1467
+ const disabled = !viewStateProps.active;
1468
+ const { activeInvitation, dispatch } = viewStateProps;
1469
+ return /* @__PURE__ */ React22.createElement(ViewState, _extends19({}, viewStateProps), !activeInvitation || activeInvitation === true ? /* @__PURE__ */ React22.createElement(PureInvitationAuthenticatorContent, _extends19({}, {
1470
+ disabled,
1471
+ failed,
1472
+ dispatch,
1473
+ invitationType,
1474
+ onChange: () => {
1475
+ },
1476
+ onAuthenticate: () => {
1477
+ }
1478
+ })) : /* @__PURE__ */ React22.createElement(InvitationAuthenticatorContent, _extends19({}, {
1479
+ disabled,
1480
+ failed,
1481
+ invitation: activeInvitation,
1482
+ dispatch,
1483
+ invitationType
1484
+ })));
1485
+ };
1486
+
1487
+ // packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinPanel.tsx
1488
+ function _extends20() {
1489
+ _extends20 = Object.assign || function(target) {
1490
+ for (var i = 1; i < arguments.length; i++) {
1491
+ var source = arguments[i];
1492
+ for (var key in source) {
1493
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1494
+ target[key] = source[key];
1495
+ }
1496
+ }
1497
+ }
1498
+ return target;
1499
+ };
1500
+ return _extends20.apply(this, arguments);
1501
+ }
1502
+ var JoinPanel = ({ initialInvitationCode, titleId: propsTitleId, exitActionParent, onExit, doneActionParent, onDone }) => {
1503
+ const client = useClient5();
1504
+ const internalTitleId = useId3("joinPanel__title");
1505
+ const titleId = propsTitleId != null ? propsTitleId : internalTitleId;
1506
+ const identity = useIdentity();
1507
+ const availableIdentities = identity ? [
1508
+ identity
1509
+ ] : [];
1510
+ const reducer = (state, action) => {
1511
+ var _a, _b, _c, _d;
1512
+ const nextState = {
1513
+ ...state
1514
+ };
1515
+ switch (action.type) {
1516
+ case "added identity":
1517
+ nextState.activeView = "identity added";
1518
+ nextState.selectedIdentity = action.identity;
1519
+ break;
1520
+ case "add identity":
1521
+ nextState.activeView = "addition method selector";
1522
+ break;
1523
+ case "select addition method":
1524
+ if (action.method === "accept device invitation") {
1525
+ nextState.activeView = "halo invitation acceptor";
1526
+ if (state.unredeemedHaloInvitationCode) {
1527
+ nextState.haloInvitation = client.echo.acceptInvitation(InvitationEncoder2.decode(state.unredeemedHaloInvitationCode));
1528
+ nextState.unredeemedHaloInvitationCode = void 0;
1529
+ nextState.haloViewState = "invitation authenticator";
1530
+ } else {
1531
+ nextState.haloViewState = "invitation input";
1532
+ }
1533
+ } else {
1534
+ nextState.activeView = "identity input";
1535
+ nextState.additionMethod = action.method;
1536
+ }
1537
+ break;
1538
+ case "select identity":
1539
+ nextState.selectedIdentity = action.identity;
1540
+ nextState.activeView = "space invitation acceptor";
1541
+ if (state.unredeemedSpaceInvitationCode) {
1542
+ nextState.spaceInvitation = client.echo.acceptInvitation(InvitationEncoder2.decode(state.unredeemedSpaceInvitationCode));
1543
+ nextState.unredeemedSpaceInvitationCode = void 0;
1544
+ nextState.spaceViewState = "invitation authenticator";
1545
+ } else {
1546
+ nextState.spaceViewState = "invitation input";
1547
+ }
1548
+ break;
1549
+ case "deselect identity":
1550
+ nextState.selectedIdentity = void 0;
1551
+ nextState.activeView = "identity selector";
1552
+ break;
1553
+ case "cancel invitation":
1554
+ if (action.from === "space" && ((_a = state.spaceInvitation) == null ? void 0 : _a.invitation)) {
1555
+ void ((_b = state.spaceInvitation) == null ? void 0 : _b.cancel());
1556
+ }
1557
+ if (action.from === "halo" && ((_c = state.haloInvitation) == null ? void 0 : _c.invitation)) {
1558
+ void ((_d = state.haloInvitation) == null ? void 0 : _d.cancel());
1559
+ }
1560
+ break;
1561
+ case "authenticating invitation":
1562
+ nextState[action.from === "halo" ? "haloInvitationAnnotation" : "spaceInvitationAnnotation"] = "authenticating";
1563
+ break;
1564
+ case "connecting invitation":
1565
+ nextState[action.from === "halo" ? "haloInvitation" : "spaceInvitation"] = action.invitation;
1566
+ case "cancelled invitation":
1567
+ case "fail invitation":
1568
+ case "timeout invitation":
1569
+ nextState[action.from === "halo" ? "haloViewState" : "spaceViewState"] = "invitation rescuer";
1570
+ break;
1571
+ case "connect invitation":
1572
+ case "authenticate invitation":
1573
+ if (action.from === "halo" && state.haloInvitationAnnotation === "authenticating") {
1574
+ nextState.haloInvitationAnnotation = "authentication failed";
1575
+ }
1576
+ if (action.from === "space" && state.spaceInvitationAnnotation === "authenticating") {
1577
+ nextState.spaceInvitationAnnotation = "authentication failed";
1578
+ }
1579
+ nextState[action.from === "halo" ? "haloViewState" : "spaceViewState"] = "invitation authenticator";
1580
+ break;
1581
+ case "accepted invitation":
1582
+ nextState[action.from === "halo" ? "haloViewState" : "spaceViewState"] = "invitation accepted";
1583
+ break;
1584
+ case "reset invitation":
1585
+ nextState[action.from === "halo" ? "haloInvitation" : "spaceInvitation"] = void 0;
1586
+ nextState[action.from === "halo" ? "haloInvitationAnnotation" : "spaceInvitationAnnotation"] = void 0;
1587
+ nextState[action.from === "halo" ? "unredeemedHaloInvitationCode" : "unredeemedSpaceInvitationCode"] = void 0;
1588
+ nextState[action.from === "halo" ? "haloViewState" : "spaceViewState"] = "invitation input";
1589
+ break;
1590
+ }
1591
+ log.debug("[join panel reducer]", {
1592
+ action,
1593
+ nextState
1594
+ }, {
1595
+ file: "JoinPanel.tsx",
1596
+ line: 123,
1597
+ scope: void 0,
1598
+ callSite: (f, a) => f(...a)
1599
+ });
1600
+ return nextState;
1601
+ };
1602
+ const [joinState, dispatch] = useReducer(reducer, {
1603
+ unredeemedHaloInvitationCode: void 0,
1604
+ unredeemedSpaceInvitationCode: initialInvitationCode,
1605
+ spaceInvitation: void 0,
1606
+ haloInvitation: void 0,
1607
+ activeView: availableIdentities.length > 0 ? "identity selector" : "addition method selector",
1608
+ selectedIdentity: void 0,
1609
+ additionMethod: void 0,
1610
+ spaceViewState: "invitation input",
1611
+ haloViewState: "invitation input"
1612
+ });
1613
+ useEffect(() => {
1614
+ const attrValue = joinState.activeView === "identity input" ? `${joinState.activeView}; ${joinState.additionMethod}` : joinState.activeView === "space invitation acceptor" ? `${joinState.activeView}; ${joinState.spaceViewState}` : joinState.activeView === "halo invitation acceptor" ? `${joinState.activeView}; ${joinState.haloViewState}` : joinState.activeView;
1615
+ log.debug("[autofocus value]", {
1616
+ attrValue
1617
+ }, {
1618
+ file: "JoinPanel.tsx",
1619
+ line: 149,
1620
+ scope: void 0,
1621
+ callSite: (f, a) => f(...a)
1622
+ });
1623
+ const $nextAutofocus = document.querySelector(`[data-autofocus="${attrValue}"]`);
1624
+ if ($nextAutofocus) {
1625
+ $nextAutofocus.focus();
1626
+ }
1627
+ }, [
1628
+ joinState.activeView,
1629
+ joinState.spaceViewState,
1630
+ joinState.haloViewState
1631
+ ]);
1632
+ useEffect(() => {
1633
+ var _a;
1634
+ return (_a = joinState.spaceInvitation) == null ? void 0 : _a.subscribe({
1635
+ onAuthenticating: () => dispatch({
1636
+ type: "authenticate invitation",
1637
+ from: "space"
1638
+ }),
1639
+ onCancelled: () => dispatch({
1640
+ type: "cancelled invitation",
1641
+ from: "space"
1642
+ }),
1643
+ onConnected: () => dispatch({
1644
+ type: "connect invitation",
1645
+ from: "space"
1646
+ }),
1647
+ onError: () => dispatch({
1648
+ type: "fail invitation",
1649
+ from: "space"
1650
+ }),
1651
+ onSuccess: () => dispatch({
1652
+ type: "accepted invitation",
1653
+ from: "space"
1654
+ }),
1655
+ onTimeout: () => dispatch({
1656
+ type: "timeout invitation",
1657
+ from: "space"
1658
+ })
1659
+ });
1660
+ }, [
1661
+ joinState.spaceInvitation
1662
+ ]);
1663
+ useEffect(() => {
1664
+ var _a;
1665
+ return (_a = joinState.haloInvitation) == null ? void 0 : _a.subscribe({
1666
+ onAuthenticating: () => dispatch({
1667
+ type: "authenticate invitation",
1668
+ from: "halo"
1669
+ }),
1670
+ onCancelled: () => dispatch({
1671
+ type: "cancelled invitation",
1672
+ from: "halo"
1673
+ }),
1674
+ onConnected: () => dispatch({
1675
+ type: "connect invitation",
1676
+ from: "halo"
1677
+ }),
1678
+ onError: () => dispatch({
1679
+ type: "fail invitation",
1680
+ from: "halo"
1681
+ }),
1682
+ onSuccess: () => dispatch({
1683
+ type: "accepted invitation",
1684
+ from: "halo"
1685
+ }),
1686
+ onTimeout: () => dispatch({
1687
+ type: "timeout invitation",
1688
+ from: "halo"
1689
+ })
1690
+ });
1691
+ }, [
1692
+ joinState.haloInvitation
1693
+ ]);
1694
+ return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(JoinHeading, _extends20({}, {
1695
+ titleId,
1696
+ invitation: joinState.spaceInvitation,
1697
+ onExit,
1698
+ exitActionParent
1699
+ })), /* @__PURE__ */ React23.createElement("div", {
1700
+ role: "none",
1701
+ className: "is-full overflow-hidden"
1702
+ }, /* @__PURE__ */ React23.createElement("div", {
1703
+ role: "none",
1704
+ className: "flex is-[1300%]",
1705
+ "aria-live": "polite"
1706
+ }, /* @__PURE__ */ React23.createElement(IdentitySelector, _extends20({}, {
1707
+ dispatch,
1708
+ availableIdentities,
1709
+ active: joinState.activeView === "identity selector"
1710
+ })), /* @__PURE__ */ React23.createElement(AdditionMethodSelector, _extends20({}, {
1711
+ dispatch,
1712
+ availableIdentities,
1713
+ active: joinState.activeView === "addition method selector"
1714
+ })), /* @__PURE__ */ React23.createElement(IdentityInput, _extends20({}, {
1715
+ dispatch,
1716
+ active: joinState.activeView === "identity input" && joinState.additionMethod === "create identity",
1717
+ method: "create identity"
1718
+ })), /* @__PURE__ */ React23.createElement(IdentityInput, _extends20({}, {
1719
+ dispatch,
1720
+ active: joinState.activeView === "identity input" && joinState.additionMethod === "recover identity",
1721
+ method: "recover identity"
1722
+ })), /* @__PURE__ */ React23.createElement(InvitationInput, _extends20({}, {
1723
+ dispatch,
1724
+ activeInvitation: joinState.haloInvitation || true,
1725
+ active: joinState.activeView === "halo invitation acceptor" && joinState.haloViewState === "invitation input",
1726
+ invitationType: "halo"
1727
+ })), /* @__PURE__ */ React23.createElement(InvitationRescuer, _extends20({}, {
1728
+ dispatch,
1729
+ activeInvitation: joinState.haloInvitation || true,
1730
+ active: joinState.activeView === "halo invitation acceptor" && joinState.haloViewState === "invitation rescuer",
1731
+ invitationType: "halo"
1732
+ })), /* @__PURE__ */ React23.createElement(InvitationAuthenticator, _extends20({}, {
1733
+ dispatch,
1734
+ activeInvitation: joinState.haloInvitation || true,
1735
+ active: joinState.activeView === "halo invitation acceptor" && joinState.haloViewState === "invitation authenticator",
1736
+ invitationType: "halo",
1737
+ ...joinState.spaceInvitationAnnotation === "authentication failed" && {
1738
+ failed: true
1739
+ }
1740
+ })), /* @__PURE__ */ React23.createElement(InvitationAccepted, _extends20({}, {
1741
+ dispatch,
1742
+ activeInvitation: joinState.haloInvitation || true,
1743
+ active: joinState.activeView === "halo invitation acceptor" && joinState.haloViewState === "invitation accepted",
1744
+ invitationType: "halo"
1745
+ })), /* @__PURE__ */ React23.createElement(IdentityAdded, _extends20({}, {
1746
+ dispatch,
1747
+ addedIdentity: joinState.selectedIdentity,
1748
+ active: joinState.activeView === "identity added"
1749
+ })), /* @__PURE__ */ React23.createElement(InvitationInput, _extends20({}, {
1750
+ dispatch,
1751
+ activeInvitation: joinState.spaceInvitation || true,
1752
+ selectedIdentity: joinState.selectedIdentity,
1753
+ active: joinState.activeView === "space invitation acceptor" && joinState.spaceViewState === "invitation input",
1754
+ invitationType: "space"
1755
+ })), /* @__PURE__ */ React23.createElement(InvitationRescuer, _extends20({}, {
1756
+ dispatch,
1757
+ activeInvitation: joinState.spaceInvitation || true,
1758
+ selectedIdentity: joinState.selectedIdentity,
1759
+ active: joinState.activeView === "space invitation acceptor" && joinState.spaceViewState === "invitation rescuer",
1760
+ invitationType: "space"
1761
+ })), /* @__PURE__ */ React23.createElement(InvitationAuthenticator, _extends20({}, {
1762
+ dispatch,
1763
+ activeInvitation: joinState.spaceInvitation || true,
1764
+ selectedIdentity: joinState.selectedIdentity,
1765
+ active: joinState.activeView === "space invitation acceptor" && joinState.spaceViewState === "invitation authenticator",
1766
+ invitationType: "space",
1767
+ ...joinState.spaceInvitationAnnotation === "authentication failed" && {
1768
+ failed: true
1769
+ }
1770
+ })), /* @__PURE__ */ React23.createElement(InvitationAccepted, _extends20({}, {
1771
+ dispatch,
1772
+ activeInvitation: joinState.spaceInvitation || true,
1773
+ selectedIdentity: joinState.selectedIdentity,
1774
+ active: joinState.activeView === "space invitation acceptor" && joinState.spaceViewState === "invitation accepted",
1775
+ invitationType: "space",
1776
+ doneActionParent,
1777
+ onDone
1778
+ })))));
1779
+ };
1780
+
167
1781
  // packages/apps/patterns/react-ui/src/composites/IdentityPopover/IdentityPopover.tsx
168
- function _extends3() {
169
- _extends3 = Object.assign || function(target) {
1782
+ function _extends21() {
1783
+ _extends21 = Object.assign || function(target) {
170
1784
  for (var i = 1; i < arguments.length; i++) {
171
1785
  var source = arguments[i];
172
1786
  for (var key in source) {
@@ -177,12 +1791,12 @@ function _extends3() {
177
1791
  }
178
1792
  return target;
179
1793
  };
180
- return _extends3.apply(this, arguments);
1794
+ return _extends21.apply(this, arguments);
181
1795
  }
182
1796
  var IdentityPopover = ({ identity, openTrigger, slots, triggerIsInToolbar = true, onClickManageProfile, ...popoverProps }) => {
183
1797
  var _a, _b;
184
- return /* @__PURE__ */ React4.createElement(PanelPopover, _extends3({}, popoverProps, {
185
- openTrigger: openTrigger != null ? openTrigger : /* @__PURE__ */ React4.createElement(Avatar2, {
1798
+ return /* @__PURE__ */ React24.createElement(PanelPopover, _extends21({}, popoverProps, {
1799
+ openTrigger: openTrigger != null ? openTrigger : /* @__PURE__ */ React24.createElement(Avatar7, {
186
1800
  size: 10,
187
1801
  variant: "circle",
188
1802
  fallbackValue: identity.identityKey.toHex(),
@@ -192,16 +1806,55 @@ var IdentityPopover = ({ identity, openTrigger, slots, triggerIsInToolbar = true
192
1806
  ...slots,
193
1807
  trigger: {
194
1808
  ...slots == null ? void 0 : slots.trigger,
195
- className: mx3("flex justify-self-end pointer-events-auto bg-white dark:bg-neutral-700 p-0.5 button-elevation rounded-full", (_b = slots == null ? void 0 : slots.trigger) == null ? void 0 : _b.className)
1809
+ className: mx16("flex justify-self-end pointer-events-auto bg-white dark:bg-neutral-700 p-0.5 button-elevation rounded-full", (_b = slots == null ? void 0 : slots.trigger) == null ? void 0 : _b.className)
196
1810
  }
197
1811
  },
198
1812
  triggerIsInToolbar
199
- }), /* @__PURE__ */ React4.createElement(IdentityPanel, _extends3({}, {
1813
+ }), /* @__PURE__ */ React24.createElement(IdentityPanel, _extends21({}, {
200
1814
  identity,
201
1815
  onClickManageProfile
202
1816
  })));
203
1817
  };
204
1818
 
1819
+ // packages/apps/patterns/react-ui/src/composites/JoinDialog/JoinDialog.tsx
1820
+ import { Action, Cancel } from "@radix-ui/react-alert-dialog";
1821
+ import React25 from "react";
1822
+ import { ThemeContext as ThemeContext2, useId as useId4 } from "@dxos/react-components";
1823
+ function _extends22() {
1824
+ _extends22 = Object.assign || function(target) {
1825
+ for (var i = 1; i < arguments.length; i++) {
1826
+ var source = arguments[i];
1827
+ for (var key in source) {
1828
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1829
+ target[key] = source[key];
1830
+ }
1831
+ }
1832
+ }
1833
+ return target;
1834
+ };
1835
+ return _extends22.apply(this, arguments);
1836
+ }
1837
+ var JoinDialog = ({ slots, ...joinPanelProps }) => {
1838
+ const titleId = useId4("joinDialog__title");
1839
+ return /* @__PURE__ */ React25.createElement(PanelAlertDialog, _extends22({}, {
1840
+ slots,
1841
+ titleId
1842
+ }), /* @__PURE__ */ React25.createElement(ThemeContext2.Provider, {
1843
+ value: {
1844
+ themeVariant: "os"
1845
+ }
1846
+ }, /* @__PURE__ */ React25.createElement(JoinPanel, _extends22({}, {
1847
+ ...joinPanelProps,
1848
+ titleId,
1849
+ exitActionParent: /* @__PURE__ */ React25.createElement(Cancel, {
1850
+ asChild: true
1851
+ }),
1852
+ doneActionParent: /* @__PURE__ */ React25.createElement(Action, {
1853
+ asChild: true
1854
+ })
1855
+ }))));
1856
+ };
1857
+
205
1858
  // packages/apps/patterns/react-ui/src/translations/locales/en-US.ts
206
1859
  var en_US_exports = {};
207
1860
  __export(en_US_exports, {
@@ -210,7 +1863,48 @@ __export(en_US_exports, {
210
1863
  var os = {
211
1864
  "manage profile label": "Manage identity",
212
1865
  "identity offline description": "Offline",
213
- "sidebar label": "DXOS sidebar"
1866
+ "sidebar label": "DXOS sidebar",
1867
+ "copy invitation code label": "Copy",
1868
+ "open share panel label": "Share",
1869
+ "join space heading": "<small>Joining</small><large>{{spaceTitle}}</large>",
1870
+ "exit label": "Exit",
1871
+ "identity selector title": "Join as",
1872
+ "identity radio group title": "Select an identity you\u2019ve associated with this device already",
1873
+ "add identity label": "Add",
1874
+ "continue label": "Continue",
1875
+ "back label": "Back",
1876
+ "next label": "Next",
1877
+ "auth choices label": "Choose an identity",
1878
+ "create identity label": "Create an identity",
1879
+ "create identity description": "Create a new identity.",
1880
+ "recover identity label": "Use a seed phrase",
1881
+ "recover identity description": "Enter your seed phrase to log in manually.",
1882
+ "join identity label": "Use an authed device",
1883
+ "join identity description": "Add this device to an identity you\u2019re already logged into on another device.",
1884
+ "deselect identity label": "Back to identities",
1885
+ "addition method selector title": "Add an identity to this device",
1886
+ "new identity input label": "Add a display name",
1887
+ "recover identity input label": "Type or paste your seed phrase",
1888
+ "failed to create identity message": "Failed to create an identity.",
1889
+ "failed to recover identity message": "Failed to recover an identity from the provided seed phrase.",
1890
+ "failed to authenticate message": "Incorrect PIN.",
1891
+ "identity added label": "Created identity & added to this device:",
1892
+ "join space as identity heading": "<part>as </part><part><icon/><label>{{labelValue}}</label></part>",
1893
+ "error status label": "Failed",
1894
+ "timeout status label": "Timed out",
1895
+ "cancelled status label": "Cancelled",
1896
+ "init status label": "Ready to connect",
1897
+ "connecting status label": "Connecting\u2026",
1898
+ "connected status label": "Enter confirmation PIN",
1899
+ "authenticating status label": "Enter confirmation PIN",
1900
+ "success status label": "Success",
1901
+ "connect label": "Connect",
1902
+ "reconnect label": "Reconnect",
1903
+ "cancel label": "Cancel",
1904
+ "done label": "Done",
1905
+ "reset label": "Start over",
1906
+ "pin input label": "The PIN provided by the invitation sender",
1907
+ "invitation input label": "Paste an invitation code or URL"
214
1908
  };
215
1909
 
216
1910
  // packages/apps/patterns/react-ui/src/translations/index.ts
@@ -218,14 +1912,44 @@ var osTranslations = {
218
1912
  "en-US": en_US_exports
219
1913
  };
220
1914
  export {
1915
+ IdentityListItem,
221
1916
  IdentityPanel,
222
1917
  IdentityPopover,
1918
+ InvitationList,
1919
+ InvitationListContainer,
1920
+ InvitationListItem,
1921
+ InvitationStatusAvatar,
1922
+ JoinDialog,
1923
+ JoinPanel,
1924
+ PanelAlertDialog,
223
1925
  PanelPopover,
1926
+ PanelSeparator,
224
1927
  PanelSidebarContext,
225
1928
  PanelSidebarProvider,
1929
+ SpaceMemberList,
1930
+ SpaceMemberListContainer,
1931
+ activeBgColor,
1932
+ activeStrokeColor,
1933
+ activeTextColor,
1934
+ cancelledBgColor,
1935
+ cancelledStrokeColor,
1936
+ cancelledTextColor,
226
1937
  defaultArrow,
227
- defaultPanel,
1938
+ defaultSurface,
1939
+ errorBgColor,
1940
+ errorStrokeColor,
1941
+ errorTextColor,
1942
+ inactiveBgColor,
1943
+ inactiveStrokeColor,
1944
+ inactiveTextColor,
228
1945
  osTranslations,
1946
+ resolvedBgColor,
1947
+ resolvedStrokeColor,
1948
+ resolvedTextColor,
1949
+ subduedSurface,
1950
+ successBgColor,
1951
+ successStrokeColor,
1952
+ successTextColor,
229
1953
  useTogglePanelSidebar
230
1954
  };
231
1955
  //# sourceMappingURL=index.mjs.map