@q9labsai/chalk-react 5.4.1 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -30
- package/dist/Board-PPO62QTR.js +80 -0
- package/dist/CallCharts-7ZQLN47C.js +114 -0
- package/dist/CallDetails-IG57GXT2.js +200 -0
- package/dist/CallDialogContent-GST2I23W.js +177 -0
- package/dist/CameraBackgroundPicker-AZXKBGRF.js +72 -0
- package/dist/ConnectionNotice-NQUBBT46.js +55 -0
- package/dist/DeviceAccessCard-MLRBTPRP.js +238 -0
- package/dist/DeviceAccessWaiting-MQXXW45M.js +25 -0
- package/dist/DeviceSheet-GZTV44UW.js +118 -0
- package/dist/InviteQrCode-TNTZA3GS.js +54 -0
- package/dist/KnockNotice-CAW4CJ4S.js +181 -0
- package/dist/ReactionSheet-ZU6RWC66.js +132 -0
- package/dist/chunk-26PBFST5.js +25 -0
- package/dist/{chunk-K5DV2OTY.js → chunk-4RSCAIFK.js} +340 -165
- package/dist/chunk-ADIDI7AJ.js +10 -0
- package/dist/chunk-ALGD3RBI.js +10 -0
- package/dist/chunk-CQBYFA2W.js +73 -0
- package/dist/chunk-E6HPIMFO.js +44 -0
- package/dist/{chunk-LYZ7EBFF.js → chunk-F6QZY5SM.js} +4116 -4605
- package/dist/chunk-I6FSUWKG.js +51 -0
- package/dist/chunk-JDCFKSGV.js +95 -0
- package/dist/chunk-PH3RC6T6.js +476 -0
- package/dist/chunk-PMGIER77.js +92 -0
- package/dist/chunk-Q36UO2T2.js +363 -0
- package/dist/chunk-SBGC5DKV.js +114 -0
- package/dist/chunk-SZNV3J4B.js +9 -0
- package/dist/{chunk-4U7QZC72.js → chunk-TSBY6C5U.js} +1 -102
- package/dist/chunk-XY7WXXME.js +85 -0
- package/dist/chunk-YOWY22N7.js +148 -0
- package/dist/chunk-Z5AASN4L.js +34 -0
- package/dist/components/admission-panel/KnockNotice.d.ts +31 -0
- package/dist/components/admission-panel/answer-all.d.ts +2 -0
- package/dist/components/call-limbo/CallLimbo.d.ts +5 -1
- package/dist/components/chalk/Chalk.d.ts +2 -5
- package/dist/components/chalk/StatusSurface.d.ts +3 -3
- package/dist/components/chalk-ui/ChalkSheet.d.ts +6 -2
- package/dist/components/chalk-ui/InviteLinkButton.d.ts +5 -0
- package/dist/components/chalk-ui/InviteQR.d.ts +4 -0
- package/dist/components/chalk-ui/InviteQrCode.d.ts +3 -0
- package/dist/components/chalk-ui/MenuIcon.d.ts +17 -0
- package/dist/components/chalk-ui/invite-qr-path.d.ts +10 -0
- package/dist/components/chalk-ui/sheet-drag.d.ts +17 -0
- package/dist/components/chalk-ui/useCopyText.d.ts +6 -0
- package/dist/components/chalk-ui/useSheetDrag.d.ts +11 -0
- package/dist/components/composite/ReactionSheet.d.ts +5 -0
- package/dist/components/connection-notice/ConnectionBars.d.ts +4 -0
- package/dist/components/connection-notice/ConnectionNotice.d.ts +12 -0
- package/dist/components/connection-notice/shown-notice.d.ts +12 -0
- package/dist/components/connection-status/ConnectionRing.d.ts +2 -0
- package/dist/components/connection-status/ConnectionStatus.d.ts +24 -0
- package/dist/components/connection-status/LiveConnectionStatus.d.ts +9 -0
- package/dist/components/connection-status/use-connection-phase.d.ts +23 -0
- package/dist/components/control-bar/DockLayout.d.ts +2 -1
- package/dist/components/control-bar/ShareControl.d.ts +3 -1
- package/dist/components/control-bar/ShellIcon.d.ts +18 -6
- package/dist/components/control-bar/control-bar-behavior.d.ts +19 -8
- package/dist/components/control-bar/control-bar-devices.d.ts +8 -0
- package/dist/components/control-bar/useDeviceSheets.d.ts +7 -0
- package/dist/components/device-access/DeviceAccessCard.d.ts +17 -0
- package/dist/components/device-access/DeviceAccessStyles.d.ts +1 -0
- package/dist/components/device-access/DeviceAccessWaiting.d.ts +4 -0
- package/dist/components/device-access/LazyDeviceAccessCard.d.ts +7 -0
- package/dist/components/device-access/browser-marks.d.ts +5 -0
- package/dist/components/device-access/card-copy.d.ts +17 -0
- package/dist/components/device-access/load-card.d.ts +2 -0
- package/dist/components/device-access/model.d.ts +29 -0
- package/dist/components/device-access/ports.d.ts +21 -0
- package/dist/components/device-access/resolve.d.ts +31 -0
- package/dist/components/device-access/store.d.ts +32 -0
- package/dist/components/device-access/useDeviceAccess.d.ts +7 -0
- package/dist/components/device-popover/CameraBackgroundPicker.d.ts +23 -0
- package/dist/components/device-popover/DevicePopover.d.ts +7 -1
- package/dist/components/device-popover/DevicePreview.d.ts +12 -0
- package/dist/components/device-popover/DeviceSheet.d.ts +26 -0
- package/dist/components/index.js +30 -15
- package/dist/components/participant-grid/ParticipantGrid.d.ts +9 -0
- package/dist/components/participant-tile/ParticipantTile.d.ts +12 -1
- package/dist/components/participant-tile/TileConnection.d.ts +9 -0
- package/dist/components/participant-tile/TileShell.d.ts +2 -1
- package/dist/components/participant-tile/useFrozenFrame.d.ts +12 -0
- package/dist/components/participant-tile/useVideoTileVisibility.d.ts +6 -0
- package/dist/components/participants-panel/ParticipantsPanel.d.ts +5 -0
- package/dist/components/participants-panel/participant-options-menu.d.ts +4 -1
- package/dist/components/participants-panel/participant-order.d.ts +13 -0
- package/dist/components/participants-panel/participant-row.d.ts +5 -1
- package/dist/components/participants-panel/participant-search.d.ts +4 -0
- package/dist/components/space-header/CallCharts.d.ts +22 -0
- package/dist/components/space-header/CallDetails.d.ts +5 -13
- package/dist/components/space-header/CallDialog.d.ts +5 -0
- package/dist/components/space-header/CallDialogContent.d.ts +13 -0
- package/dist/components/space-header/CallMenuStyles.d.ts +2 -0
- package/dist/components/space-header/RowIcon.d.ts +12 -0
- package/dist/components/space-header/call-diagnostics.d.ts +2 -1
- package/dist/components/space-header/call-network.d.ts +18 -0
- package/dist/components/space-header/space-header-contract.d.ts +8 -1
- package/dist/components/space-view/SpacePresentation.d.ts +3 -1
- package/dist/components/space-view/SpaceView.d.ts +3 -5
- package/dist/components/space-view/useBoardNotices.d.ts +7 -0
- package/dist/components/space-view/useMicrophoneNotice.d.ts +11 -0
- package/dist/components/toast-stack/ToastStack.d.ts +3 -1
- package/dist/components/toast-stack/call-events.d.ts +4 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +298 -28
- package/dist/internal/call-width.d.ts +9 -0
- package/dist/internal/media-devices.d.ts +11 -0
- package/dist/internal/speaker-test.d.ts +2 -0
- package/dist/internal/useHandOrder.d.ts +2 -0
- package/dist/internal/useHeldWhile.d.ts +2 -0
- package/dist/internal/useInputLevel.d.ts +4 -0
- package/dist/internal/useLongPress.d.ts +15 -0
- package/dist/internal/useSeenConnected.d.ts +9 -0
- package/dist/internal/useSilentMicrophone.d.ts +4 -0
- package/dist/internal/useTrueFor.d.ts +4 -0
- package/dist/participant-options-menu-S3EL6K3M.js +330 -0
- package/dist/pre-join/remembered-devices.d.ts +12 -0
- package/dist/pre-join/usePreJoinDevices.d.ts +47 -0
- package/dist/public-surface.contract.d.ts +1 -1
- package/dist/test-support/index.d.ts +1 -1
- package/dist/test-support/index.js +41 -10
- package/dist/theme.d.ts +32 -32
- package/dist/toast.d.ts +1 -0
- package/dist/toast.js +7 -0
- package/dist/utils/formatClockTime.d.ts +2 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +20 -12
- package/package.json +24 -11
- package/dist/components/call-limbo/qr-code.d.ts +0 -4
- package/dist/components/offline-actions/OfflineActions.d.ts +0 -9
- package/dist/components/participants-panel/index.d.ts +0 -2
- package/dist/components/reconnecting-overlay/ReconnectingOverlay.d.ts +0 -12
- package/dist/components/space-header/share-qr.d.ts +0 -2
- package/dist/components/space-view/countdown.d.ts +0 -5
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import {
|
|
2
|
+
answerAll
|
|
3
|
+
} from "./chunk-ALGD3RBI.js";
|
|
4
|
+
import {
|
|
5
|
+
Avatar,
|
|
6
|
+
useCan,
|
|
7
|
+
useParticipants,
|
|
8
|
+
useSpaceClient
|
|
9
|
+
} from "./chunk-YOWY22N7.js";
|
|
10
|
+
import "./chunk-JDCFKSGV.js";
|
|
11
|
+
import {
|
|
12
|
+
Cancel01Icon
|
|
13
|
+
} from "./chunk-TSBY6C5U.js";
|
|
14
|
+
import {
|
|
15
|
+
ChalkButton
|
|
16
|
+
} from "./chunk-PH3RC6T6.js";
|
|
17
|
+
import "./chunk-I6FSUWKG.js";
|
|
18
|
+
import "./chunk-ADIDI7AJ.js";
|
|
19
|
+
|
|
20
|
+
// src/components/admission-panel/KnockNotice.tsx
|
|
21
|
+
import { useState } from "react";
|
|
22
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
var styles = `.chalk-knock-notice {
|
|
24
|
+
position: absolute;
|
|
25
|
+
z-index: 46;
|
|
26
|
+
top: 60px;
|
|
27
|
+
right: var(--space-3);
|
|
28
|
+
width: 348px;
|
|
29
|
+
display: grid;
|
|
30
|
+
gap: var(--space-3);
|
|
31
|
+
padding: var(--space-3);
|
|
32
|
+
border-radius: var(--corner-2xl);
|
|
33
|
+
background: var(--chalk-popover);
|
|
34
|
+
border: 1px solid var(--chalk-line-strong);
|
|
35
|
+
box-shadow: var(--chalk-shadow);
|
|
36
|
+
}
|
|
37
|
+
.chalk-knock-top {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: var(--space-3);
|
|
41
|
+
}
|
|
42
|
+
.chalk-knock-text {
|
|
43
|
+
display: grid;
|
|
44
|
+
min-width: 0;
|
|
45
|
+
flex: 1;
|
|
46
|
+
}
|
|
47
|
+
.chalk-knock-text b {
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
text-overflow: ellipsis;
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
font-size: var(--type-body-lg);
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
}
|
|
54
|
+
.chalk-knock-text span {
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
font-size: var(--type-body-sm);
|
|
59
|
+
color: var(--chalk-muted-text);
|
|
60
|
+
}
|
|
61
|
+
.chalk-knock-stack {
|
|
62
|
+
display: inline-flex;
|
|
63
|
+
flex: none;
|
|
64
|
+
}
|
|
65
|
+
.chalk-knock-stack > * + * {
|
|
66
|
+
margin-inline-start: calc(var(--space-2-5) * -1);
|
|
67
|
+
}
|
|
68
|
+
.chalk-knock-stack > * {
|
|
69
|
+
/* token-ratchet-ignore: ring drawn with box-shadow, the design system has no ring token */
|
|
70
|
+
box-shadow: 0 0 0 2px var(--chalk-popover);
|
|
71
|
+
}
|
|
72
|
+
.chalk-knock-hide {
|
|
73
|
+
align-self: start;
|
|
74
|
+
display: grid;
|
|
75
|
+
place-items: center;
|
|
76
|
+
width: 28px;
|
|
77
|
+
height: 28px;
|
|
78
|
+
flex: none;
|
|
79
|
+
border-radius: 50%;
|
|
80
|
+
color: var(--chalk-muted-text);
|
|
81
|
+
}
|
|
82
|
+
.chalk-knock-hide:hover {
|
|
83
|
+
background: var(--chalk-hover);
|
|
84
|
+
color: var(--chalk-text);
|
|
85
|
+
}
|
|
86
|
+
.chalk-knock-hide svg {
|
|
87
|
+
width: 16px;
|
|
88
|
+
height: 16px;
|
|
89
|
+
}
|
|
90
|
+
.chalk-knock-notice > p {
|
|
91
|
+
font-size: var(--type-body-sm);
|
|
92
|
+
color: var(--chalk-danger-text);
|
|
93
|
+
}
|
|
94
|
+
.chalk-knock-actions {
|
|
95
|
+
display: flex;
|
|
96
|
+
gap: var(--space-2);
|
|
97
|
+
}
|
|
98
|
+
.chalk-knock-actions .chalk-pill-button {
|
|
99
|
+
flex: 1;
|
|
100
|
+
height: 36px;
|
|
101
|
+
}
|
|
102
|
+
@media (max-width: 767px) {
|
|
103
|
+
.chalk-knock-notice {
|
|
104
|
+
left: var(--space-3);
|
|
105
|
+
right: var(--space-3);
|
|
106
|
+
width: auto;
|
|
107
|
+
top: 64px;
|
|
108
|
+
}
|
|
109
|
+
.chalk-knock-actions .chalk-pill-button {
|
|
110
|
+
height: 44px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
`;
|
|
114
|
+
function summarizeKnocks(requests) {
|
|
115
|
+
const [first] = requests;
|
|
116
|
+
if (!first) return null;
|
|
117
|
+
if (requests.length === 1) return { kind: "one", request: first };
|
|
118
|
+
return { kind: "several", count: requests.length, faces: requests.slice(0, 3), names: requests.map((request) => request.displayName).join(", ") };
|
|
119
|
+
}
|
|
120
|
+
function KnockNoticeSurface({ requests, onAdmit, onDeny, onReview, onHide }) {
|
|
121
|
+
const [busy, setBusy] = useState(false);
|
|
122
|
+
const [error, setError] = useState(null);
|
|
123
|
+
const summary = summarizeKnocks(requests);
|
|
124
|
+
if (!summary) return null;
|
|
125
|
+
const answer = async (action) => {
|
|
126
|
+
if (busy) return;
|
|
127
|
+
setBusy(true);
|
|
128
|
+
setError(null);
|
|
129
|
+
try {
|
|
130
|
+
await action();
|
|
131
|
+
} catch (cause) {
|
|
132
|
+
setError(cause instanceof Error ? cause.message : "Couldn\u2019t answer this request.");
|
|
133
|
+
} finally {
|
|
134
|
+
setBusy(false);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const ids = requests.map((request) => request.id);
|
|
138
|
+
return /* @__PURE__ */ jsxs("div", { className: "chalk-knock-notice", role: "status", "aria-live": "polite", "data-part": "knock-notice", children: [
|
|
139
|
+
/* @__PURE__ */ jsx("style", { children: styles }),
|
|
140
|
+
/* @__PURE__ */ jsxs("div", { className: "chalk-knock-top", children: [
|
|
141
|
+
summary.kind === "one" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
142
|
+
/* @__PURE__ */ jsx(Avatar, { name: summary.request.displayName, size: "md", generated: true }),
|
|
143
|
+
/* @__PURE__ */ jsxs("span", { className: "chalk-knock-text", children: [
|
|
144
|
+
/* @__PURE__ */ jsx("b", { dir: "auto", children: summary.request.displayName }),
|
|
145
|
+
/* @__PURE__ */ jsx("span", { children: "Wants to join" })
|
|
146
|
+
] })
|
|
147
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
148
|
+
/* @__PURE__ */ jsx("span", { className: "chalk-knock-stack", children: summary.faces.map((face) => /* @__PURE__ */ jsx(Avatar, { name: face.displayName, size: "sm", generated: true }, face.id)) }),
|
|
149
|
+
/* @__PURE__ */ jsxs("span", { className: "chalk-knock-text", children: [
|
|
150
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
|
151
|
+
summary.count,
|
|
152
|
+
" people want to join"
|
|
153
|
+
] }),
|
|
154
|
+
/* @__PURE__ */ jsx("span", { dir: "auto", children: summary.names })
|
|
155
|
+
] })
|
|
156
|
+
] }),
|
|
157
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "chalk-knock-hide", "aria-label": "Hide notice", onClick: onHide, children: /* @__PURE__ */ jsx(Cancel01Icon, { "aria-hidden": "true" }) })
|
|
158
|
+
] }),
|
|
159
|
+
error ? /* @__PURE__ */ jsx("p", { role: "alert", children: error }) : null,
|
|
160
|
+
/* @__PURE__ */ jsx("div", { className: "chalk-knock-actions", children: summary.kind === "one" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
161
|
+
/* @__PURE__ */ jsx(ChalkButton, { disabled: busy, onClick: () => void answer(() => onDeny(summary.request.id)), "aria-label": `Decline ${summary.request.displayName}`, children: "Decline" }),
|
|
162
|
+
/* @__PURE__ */ jsx(ChalkButton, { variant: "solid", disabled: busy, onClick: () => void answer(() => onAdmit(summary.request.id)), "aria-label": `Let ${summary.request.displayName} in`, children: "Let in" })
|
|
163
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
164
|
+
/* @__PURE__ */ jsx(ChalkButton, { onClick: onReview, children: "Review" }),
|
|
165
|
+
/* @__PURE__ */ jsx(ChalkButton, { variant: "solid", disabled: busy, onClick: () => void answer(() => answerAll(ids, onAdmit, "let in")), children: "Let everyone in" })
|
|
166
|
+
] }) })
|
|
167
|
+
] });
|
|
168
|
+
}
|
|
169
|
+
function KnockNotice({ hiddenIds, onReview, onHide }) {
|
|
170
|
+
const client = useSpaceClient();
|
|
171
|
+
const canManageAdmission = useCan("manageAdmission");
|
|
172
|
+
const { admissionQueue } = useParticipants();
|
|
173
|
+
const requests = admissionQueue.filter((request) => !hiddenIds.has(request.requestId)).map((request) => ({ id: request.requestId, displayName: request.displayName }));
|
|
174
|
+
if (!canManageAdmission || requests.length === 0) return null;
|
|
175
|
+
return /* @__PURE__ */ jsx(KnockNoticeSurface, { requests, onAdmit: (id) => client.participants.admit(id), onDeny: (id) => client.participants.deny(id), onReview, onHide: () => onHide(requests.map((request) => request.id)) });
|
|
176
|
+
}
|
|
177
|
+
export {
|
|
178
|
+
KnockNotice,
|
|
179
|
+
KnockNoticeSurface,
|
|
180
|
+
summarizeKnocks
|
|
181
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShellIcon
|
|
3
|
+
} from "./chunk-PMGIER77.js";
|
|
4
|
+
import {
|
|
5
|
+
ChalkSheet,
|
|
6
|
+
useHaptics
|
|
7
|
+
} from "./chunk-PH3RC6T6.js";
|
|
8
|
+
import "./chunk-I6FSUWKG.js";
|
|
9
|
+
import "./chunk-ADIDI7AJ.js";
|
|
10
|
+
|
|
11
|
+
// src/components/composite/ReactionSheet.tsx
|
|
12
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
13
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
var CLOSE_DELAY_MS = 120;
|
|
15
|
+
var FIRST_ROW = 6;
|
|
16
|
+
var NOTICE_GAP = 12;
|
|
17
|
+
var REACTION_SHEET_CSS = `.chalk-sheet-center {
|
|
18
|
+
justify-content: center;
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
}
|
|
21
|
+
.chalk-sheet-center[aria-pressed="true"] {
|
|
22
|
+
background: var(--chalk-warning);
|
|
23
|
+
color: var(--chalk-accent-text);
|
|
24
|
+
}
|
|
25
|
+
.chalk-sheet-emoji {
|
|
26
|
+
display: grid;
|
|
27
|
+
grid-auto-flow: column;
|
|
28
|
+
grid-auto-columns: 1fr;
|
|
29
|
+
margin-top: var(--space-2);
|
|
30
|
+
padding: var(--space-1);
|
|
31
|
+
background: var(--chalk-raised);
|
|
32
|
+
border-radius: var(--corner-2xl);
|
|
33
|
+
}
|
|
34
|
+
.chalk-sheet-emoji[data-expanded] {
|
|
35
|
+
grid-auto-flow: row;
|
|
36
|
+
grid-template-columns: repeat(7, 1fr);
|
|
37
|
+
}
|
|
38
|
+
.chalk-sheet-emoji > button {
|
|
39
|
+
display: grid;
|
|
40
|
+
place-items: center;
|
|
41
|
+
height: 56px;
|
|
42
|
+
border-radius: var(--corner-xl);
|
|
43
|
+
font:
|
|
44
|
+
var(--type-headline) / 1 "Apple Color Emoji",
|
|
45
|
+
"Segoe UI Emoji",
|
|
46
|
+
"Noto Color Emoji",
|
|
47
|
+
sans-serif;
|
|
48
|
+
}
|
|
49
|
+
.chalk-sheet-emoji > button:active,
|
|
50
|
+
.chalk-sheet-row:active {
|
|
51
|
+
background: var(--chalk-pressed);
|
|
52
|
+
}
|
|
53
|
+
.chalk-sheet[data-variant="reactions"] {
|
|
54
|
+
border-top: 1px solid var(--chalk-line-strong);
|
|
55
|
+
box-shadow: var(--elevation-menu);
|
|
56
|
+
}
|
|
57
|
+
[data-chalk][data-chalk-theme="light"] .chalk-sheet[data-variant="reactions"] {
|
|
58
|
+
box-shadow: var(--elevation-menu-light);
|
|
59
|
+
}`;
|
|
60
|
+
function ReactionSheet({ open, isHandRaised, onToggleHandRaise, reactions, onSelect, onClose }) {
|
|
61
|
+
const [more, setMore] = useState(false);
|
|
62
|
+
if (!open && more) setMore(false);
|
|
63
|
+
const [frame, setFrame] = useState(null);
|
|
64
|
+
const findFrame = useCallback((node) => setFrame(node?.closest("[data-part='call-frame']") ?? null), []);
|
|
65
|
+
const [sheet, setSheet] = useState(null);
|
|
66
|
+
const findSheet = useCallback((node) => setSheet(node?.closest(".chalk-sheet") ?? null), []);
|
|
67
|
+
const { trigger } = useHaptics();
|
|
68
|
+
useLayoutEffect(() => {
|
|
69
|
+
const notices = frame?.querySelector("[data-part='toast-stack']");
|
|
70
|
+
if (!open || !sheet || !frame || !notices) return;
|
|
71
|
+
const lift = () => {
|
|
72
|
+
if (!(notices.offsetParent instanceof HTMLElement) || !(sheet.offsetParent instanceof HTMLElement)) return;
|
|
73
|
+
const baseline = notices.offsetParent.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(notices).bottom);
|
|
74
|
+
const sheetTop = sheet.offsetParent.getBoundingClientRect().bottom - sheet.offsetHeight;
|
|
75
|
+
frame.style.setProperty("--chalk-reaction-toast-lift", `${Math.max(0, baseline - sheetTop + NOTICE_GAP)}px`);
|
|
76
|
+
};
|
|
77
|
+
lift();
|
|
78
|
+
const resize = new ResizeObserver(lift);
|
|
79
|
+
resize.observe(sheet);
|
|
80
|
+
return () => {
|
|
81
|
+
resize.disconnect();
|
|
82
|
+
frame.style.removeProperty("--chalk-reaction-toast-lift");
|
|
83
|
+
};
|
|
84
|
+
}, [open, sheet, frame]);
|
|
85
|
+
const closing = useRef(void 0);
|
|
86
|
+
useEffect(() => () => window.clearTimeout(closing.current), [open]);
|
|
87
|
+
const send = (emoji) => {
|
|
88
|
+
void trigger("success");
|
|
89
|
+
onSelect(emoji);
|
|
90
|
+
closing.current = window.setTimeout(onClose, CLOSE_DELAY_MS);
|
|
91
|
+
};
|
|
92
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
93
|
+
/* @__PURE__ */ jsx("span", { ref: findFrame, hidden: true }),
|
|
94
|
+
/* @__PURE__ */ jsxs(
|
|
95
|
+
ChalkSheet,
|
|
96
|
+
{
|
|
97
|
+
variant: "reactions",
|
|
98
|
+
open,
|
|
99
|
+
onOpenChange: (next) => {
|
|
100
|
+
if (!next) onClose();
|
|
101
|
+
},
|
|
102
|
+
title: "Reactions",
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsx("style", { href: "chalk-reaction-sheet", precedence: "default", children: REACTION_SHEET_CSS }),
|
|
105
|
+
onToggleHandRaise ? /* @__PURE__ */ jsx("div", { className: "chalk-sheet-group", children: /* @__PURE__ */ jsxs(
|
|
106
|
+
"button",
|
|
107
|
+
{
|
|
108
|
+
type: "button",
|
|
109
|
+
className: "chalk-sheet-row chalk-sheet-center",
|
|
110
|
+
"aria-pressed": isHandRaised,
|
|
111
|
+
onClick: () => {
|
|
112
|
+
onToggleHandRaise();
|
|
113
|
+
onClose();
|
|
114
|
+
},
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx(ShellIcon, { name: "hand" }),
|
|
117
|
+
/* @__PURE__ */ jsx("span", { children: isHandRaised ? "Lower hand" : "Raise hand" })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
) }) : null,
|
|
121
|
+
/* @__PURE__ */ jsxs("div", { ref: findSheet, className: "chalk-sheet-emoji", "data-expanded": more || void 0, role: "toolbar", "aria-label": "Reactions", children: [
|
|
122
|
+
(more ? reactions : reactions.slice(0, FIRST_ROW)).map((emoji) => /* @__PURE__ */ jsx("button", { type: "button", "aria-label": `React with ${emoji}`, onClick: () => send(emoji), children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: emoji }) }, emoji)),
|
|
123
|
+
!more && reactions.length > FIRST_ROW ? /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "More emoji", onClick: () => setMore(true), children: "\u2026" }) : null
|
|
124
|
+
] })
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] });
|
|
129
|
+
}
|
|
130
|
+
export {
|
|
131
|
+
ReactionSheet as default
|
|
132
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/components/connection-notice/ConnectionBars.tsx
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function ConnectionBars({ level }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("span", { className: "chalk-connection-bars", "data-level": level, "aria-hidden": "true", children: [
|
|
5
|
+
/* @__PURE__ */ jsx("style", { href: "chalk-connection-bars", precedence: "default", children: BARS_CSS }),
|
|
6
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
7
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
8
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
9
|
+
/* @__PURE__ */ jsx("i", {})
|
|
10
|
+
] });
|
|
11
|
+
}
|
|
12
|
+
var BARS_CSS = `.chalk-connection-bars {display:inline-flex;align-items:flex-end;gap:var(--space-0-5);height:14px;flex:none;}
|
|
13
|
+
.chalk-connection-bars i {width:3px;border-radius:var(--corner-xs);background:var(--chalk-line-strong);}
|
|
14
|
+
.chalk-connection-bars i:nth-child(1) {height:5px;}
|
|
15
|
+
.chalk-connection-bars i:nth-child(2) {height:8px;}
|
|
16
|
+
.chalk-connection-bars i:nth-child(3) {height:11px;}
|
|
17
|
+
.chalk-connection-bars i:nth-child(4) {height:14px;}
|
|
18
|
+
.chalk-connection-bars[data-level="4"] > i {background:var(--chalk-positive);}
|
|
19
|
+
.chalk-connection-bars[data-level="3"] > i:nth-child(-n+3),.chalk-connection-bars[data-level="2"] > i:nth-child(-n+2) {background:var(--chalk-warning);}
|
|
20
|
+
.chalk-connection-bars[data-level="1"] > i:nth-child(1) {background:var(--chalk-danger-text);}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
ConnectionBars
|
|
25
|
+
};
|