cursedbelt 5.32.0 → 5.34.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/dist/react/Toast.d.ts +1 -1
- package/dist/react/Toast.d.ts.map +1 -1
- package/dist/react/Toast.js +19 -4
- package/dist/react/Toast.js.map +1 -1
- package/dist/react/components/Button.d.ts +16 -1
- package/dist/react/components/Button.d.ts.map +1 -1
- package/dist/react/components/Button.js +34 -5
- package/dist/react/components/Button.js.map +1 -1
- package/dist/react/components/ChoiceGroup.d.ts +20 -1
- package/dist/react/components/ChoiceGroup.d.ts.map +1 -1
- package/dist/react/components/ChoiceGroup.js +15 -2
- package/dist/react/components/ChoiceGroup.js.map +1 -1
- package/dist/react/components/CopyButton.d.ts +10 -1
- package/dist/react/components/CopyButton.d.ts.map +1 -1
- package/dist/react/components/CopyButton.js +2 -2
- package/dist/react/components/CopyButton.js.map +1 -1
- package/dist/react/components/DataTable/DataTable.d.ts +27 -2
- package/dist/react/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/react/components/DataTable/DataTable.js +168 -44
- package/dist/react/components/DataTable/DataTable.js.map +1 -1
- package/dist/react/components/DataTable/RowActions.d.ts +4 -1
- package/dist/react/components/DataTable/RowActions.d.ts.map +1 -1
- package/dist/react/components/DataTable/RowActions.js +2 -2
- package/dist/react/components/DataTable/RowActions.js.map +1 -1
- package/dist/react/components/DataTable/columnPriority.d.ts +30 -0
- package/dist/react/components/DataTable/columnPriority.d.ts.map +1 -0
- package/dist/react/components/DataTable/columnPriority.js +45 -0
- package/dist/react/components/DataTable/columnPriority.js.map +1 -0
- package/dist/react/components/DataTable/types.d.ts +14 -0
- package/dist/react/components/DataTable/types.d.ts.map +1 -1
- package/dist/react/components/DataTable/types.js.map +1 -1
- package/dist/react/components/EmptyState.d.ts.map +1 -1
- package/dist/react/components/EmptyState.js +2 -2
- package/dist/react/components/EmptyState.js.map +1 -1
- package/dist/react/components/ErrorCard.d.ts +13 -1
- package/dist/react/components/ErrorCard.d.ts.map +1 -1
- package/dist/react/components/ErrorCard.js +3 -2
- package/dist/react/components/ErrorCard.js.map +1 -1
- package/dist/react/components/Field.d.ts +37 -12
- package/dist/react/components/Field.d.ts.map +1 -1
- package/dist/react/components/Field.js +19 -8
- package/dist/react/components/Field.js.map +1 -1
- package/dist/react/components/Menu.d.ts +58 -0
- package/dist/react/components/Menu.d.ts.map +1 -0
- package/dist/react/components/Menu.js +86 -0
- package/dist/react/components/Menu.js.map +1 -0
- package/dist/react/components/Modal.d.ts +1 -0
- package/dist/react/components/Modal.d.ts.map +1 -1
- package/dist/react/components/Modal.js +3 -2
- package/dist/react/components/Modal.js.map +1 -1
- package/dist/react/components/SaveIndicator.d.ts +36 -0
- package/dist/react/components/SaveIndicator.d.ts.map +1 -0
- package/dist/react/components/SaveIndicator.js +48 -0
- package/dist/react/components/SaveIndicator.js.map +1 -0
- package/dist/react/components/SelectionBar.d.ts +26 -0
- package/dist/react/components/SelectionBar.d.ts.map +1 -0
- package/dist/react/components/SelectionBar.js +21 -0
- package/dist/react/components/SelectionBar.js.map +1 -0
- package/dist/react/components/Switch.d.ts +16 -2
- package/dist/react/components/Switch.d.ts.map +1 -1
- package/dist/react/components/Switch.js +10 -3
- package/dist/react/components/Switch.js.map +1 -1
- package/dist/react/components/Tooltip.d.ts +1 -1
- package/dist/react/components/Tooltip.d.ts.map +1 -1
- package/dist/react/components/Tooltip.js +14 -1
- package/dist/react/components/Tooltip.js.map +1 -1
- package/dist/react/components/TooltipImpl.d.ts.map +1 -1
- package/dist/react/components/TooltipImpl.js +37 -7
- package/dist/react/components/TooltipImpl.js.map +1 -1
- package/dist/react/components/UnstyledButton.d.ts +37 -0
- package/dist/react/components/UnstyledButton.d.ts.map +1 -0
- package/dist/react/components/UnstyledButton.js +46 -0
- package/dist/react/components/UnstyledButton.js.map +1 -0
- package/dist/react/components/auth/SignInCard.d.ts +15 -1
- package/dist/react/components/auth/SignInCard.d.ts.map +1 -1
- package/dist/react/components/auth/SignInCard.js +6 -2
- package/dist/react/components/auth/SignInCard.js.map +1 -1
- package/dist/react/components/dialog.d.ts.map +1 -1
- package/dist/react/components/dialog.js +35 -3
- package/dist/react/components/dialog.js.map +1 -1
- package/dist/react/hooks/useCopyToClipboard.d.ts +10 -2
- package/dist/react/hooks/useCopyToClipboard.d.ts.map +1 -1
- package/dist/react/hooks/useCopyToClipboard.js +13 -4
- package/dist/react/hooks/useCopyToClipboard.js.map +1 -1
- package/dist/react/icons.d.ts +12 -1
- package/dist/react/icons.d.ts.map +1 -1
- package/dist/react/icons.js +12 -22
- package/dist/react/icons.js.map +1 -1
- package/dist/react/index.d.ts +8 -4
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +7 -3
- package/dist/react/index.js.map +1 -1
- package/dist/react/lib/hoverIntent.d.ts +21 -0
- package/dist/react/lib/hoverIntent.d.ts.map +1 -1
- package/dist/react/lib/hoverIntent.js +24 -0
- package/dist/react/lib/hoverIntent.js.map +1 -1
- package/dist/react/lib/openDialogs.d.ts +5 -0
- package/dist/react/lib/openDialogs.d.ts.map +1 -0
- package/dist/react/lib/openDialogs.js +45 -0
- package/dist/react/lib/openDialogs.js.map +1 -0
- package/dist/styles-areas/analytics.css +16 -16
- package/dist/styles-areas/calendar.css +7 -7
- package/dist/styles-areas/chat.css +9 -10
- package/dist/styles-areas/core.css +69 -62
- package/dist/styles-areas/data-table.css +16 -16
- package/dist/styles-areas/disk-usage.css +7 -7
- package/dist/styles-areas/emoji.css +3 -3
- package/dist/styles-areas/fields.css +10 -10
- package/dist/styles-areas/filter-rail.css +7 -8
- package/dist/styles-areas/layout-engine.css +5 -6
- package/dist/styles-areas/master-detail.css +6 -7
- package/dist/styles-areas/media-gallery.css +2 -2
- package/dist/styles-areas/media.css +2 -2
- package/dist/styles-areas/nav.css +17 -18
- package/dist/styles-areas/notifications.css +5 -5
- package/dist/styles-areas/overlays.css +5 -5
- package/dist/styles-areas/sharing.css +2 -2
- package/dist/styles-areas/stats.css +4 -4
- package/dist/styles-areas/wizard.css +3 -3
- package/dist/styles-areas/workbench.css +18 -19
- package/dist/styles-utilities.css +72 -0
- package/dist/testing/tooltip.d.ts.map +1 -1
- package/dist/testing/tooltip.js +8 -18
- package/dist/testing/tooltip.js.map +1 -1
- package/package.json +81 -3
- package/scripts/guardrails-baseline.json +1 -1
- package/scripts/styleAreas.ts +4 -0
- package/src/react/Toast.spec.tsx +17 -1
- package/src/react/Toast.tsx +20 -3
- package/src/react/components/Button.spec.tsx +49 -1
- package/src/react/components/Button.tsx +63 -6
- package/src/react/components/ChoiceGroup.spec.tsx +32 -0
- package/src/react/components/ChoiceGroup.tsx +78 -23
- package/src/react/components/CopyButton.spec.tsx +35 -0
- package/src/react/components/CopyButton.tsx +11 -2
- package/src/react/components/DataTable/DataTable.spec.tsx +16 -0
- package/src/react/components/DataTable/DataTable.tsx +266 -37
- package/src/react/components/DataTable/RowActions.tsx +5 -2
- package/src/react/components/DataTable/columnPriority.spec.ts +97 -0
- package/src/react/components/DataTable/columnPriority.ts +54 -0
- package/src/react/components/DataTable/types.ts +14 -0
- package/src/react/components/DataTable/virtualize.spec.tsx +47 -2
- package/src/react/components/EmptyState.spec.tsx +7 -0
- package/src/react/components/EmptyState.tsx +3 -0
- package/src/react/components/ErrorCard.spec.tsx +32 -0
- package/src/react/components/ErrorCard.tsx +17 -1
- package/src/react/components/Field.spec.tsx +61 -0
- package/src/react/components/Field.tsx +84 -27
- package/src/react/components/Menu.spec.tsx +90 -0
- package/src/react/components/Menu.tsx +204 -0
- package/src/react/components/Modal.spec.tsx +84 -0
- package/src/react/components/Modal.tsx +4 -1
- package/src/react/components/SaveIndicator.spec.tsx +35 -0
- package/src/react/components/SaveIndicator.tsx +85 -0
- package/src/react/components/SelectionBar.spec.tsx +32 -0
- package/src/react/components/SelectionBar.tsx +49 -0
- package/src/react/components/Switch.spec.tsx +25 -0
- package/src/react/components/Switch.tsx +49 -4
- package/src/react/components/Tooltip.spec.tsx +183 -2
- package/src/react/components/Tooltip.tsx +14 -2
- package/src/react/components/TooltipImpl.tsx +42 -8
- package/src/react/components/UnstyledButton.spec.tsx +61 -0
- package/src/react/components/UnstyledButton.tsx +83 -0
- package/src/react/components/auth/SignInCard.spec.tsx +34 -0
- package/src/react/components/auth/SignInCard.tsx +36 -3
- package/src/react/components/dialog.tsx +49 -9
- package/src/react/hooks/useCopyToClipboard.ts +17 -4
- package/src/react/icons.spec.ts +32 -1
- package/src/react/icons.tsx +59 -0
- package/src/react/index.ts +23 -2
- package/src/react/lib/hoverIntent.ts +28 -0
- package/src/react/lib/openDialogs.ts +48 -0
- package/src/styles-areas/analytics.css +16 -16
- package/src/styles-areas/calendar.css +7 -7
- package/src/styles-areas/chat.css +9 -10
- package/src/styles-areas/core.css +69 -62
- package/src/styles-areas/data-table.css +16 -16
- package/src/styles-areas/disk-usage.css +7 -7
- package/src/styles-areas/emoji.css +3 -3
- package/src/styles-areas/fields.css +10 -10
- package/src/styles-areas/filter-rail.css +7 -8
- package/src/styles-areas/layout-engine.css +5 -6
- package/src/styles-areas/master-detail.css +6 -7
- package/src/styles-areas/media-gallery.css +2 -2
- package/src/styles-areas/media.css +2 -2
- package/src/styles-areas/nav.css +17 -18
- package/src/styles-areas/notifications.css +5 -5
- package/src/styles-areas/overlays.css +5 -5
- package/src/styles-areas/sharing.css +2 -2
- package/src/styles-areas/stats.css +4 -4
- package/src/styles-areas/wizard.css +3 -3
- package/src/styles-areas/workbench.css +18 -19
- package/src/styles-utilities.css +72 -0
- package/src/testing/tooltip.spec.ts +19 -0
- package/src/testing/tooltip.ts +17 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { cloneElement, isValidElement, useEffect, useRef, useState, } from 'react';
|
|
3
3
|
import { useHasHover } from '../hooks/useHasHover.js';
|
|
4
|
+
export { TooltipDelay } from '../lib/hoverIntent.js';
|
|
4
5
|
/**
|
|
5
6
|
* The props this component consumes. Everything else it is handed belongs to the TRIGGER
|
|
6
7
|
* and is forwarded onto the child — see {@link forwardToChild}.
|
|
@@ -192,6 +193,7 @@ export function Tooltip(props) {
|
|
|
192
193
|
// `useState(fn)` would CALL it as a lazy initializer.
|
|
193
194
|
const [Impl, setImpl] = useState(() => loadedImpl);
|
|
194
195
|
const armRef = useRef(null);
|
|
196
|
+
const hintedRef = useRef(false);
|
|
195
197
|
// 🔴 No content is a PASS-THROUGH, not an empty bubble. A conditional hint —
|
|
196
198
|
// `content={isBye ? 'Advances unopposed' : undefined}` — is the natural way to write
|
|
197
199
|
// "explain this only when there is something to explain", and without this it painted
|
|
@@ -215,7 +217,18 @@ export function Tooltip(props) {
|
|
|
215
217
|
}, [enabled, Impl]);
|
|
216
218
|
// 🔴 `children`, not `props.children` — the forwarded child, and `props` is spread FIRST so
|
|
217
219
|
// it cannot put the untouched one back.
|
|
218
|
-
|
|
220
|
+
//
|
|
221
|
+
//
|
|
222
|
+
// 🔴 Once a trigger HAS had a hint it keeps the implementation, and `TooltipImpl` keeps an
|
|
223
|
+
// empty one shut. A hint that comes and goes — desk's `unavailableReason`,
|
|
224
|
+
// `tooltip={busy ? 'Saving…' : undefined}` — used to flip this return between the Radix
|
|
225
|
+
// tree and a bare child, and React reconciles that as a REMOUNT: the button's DOM node was
|
|
226
|
+
// replaced under the pointer and the keyboard focus, exactly the swap the header above
|
|
227
|
+
// spends its length avoiding. Sticky rather than always-on, so a control that never had a
|
|
228
|
+
// hint (most of the fleet's Buttons) stays the plain pass-through it has always been.
|
|
229
|
+
if (hasContent)
|
|
230
|
+
hintedRef.current = true;
|
|
231
|
+
if (Impl && hintedRef.current)
|
|
219
232
|
return _jsx(Impl, { ...props, arm: armRef.current, children: children });
|
|
220
233
|
if (!enabled)
|
|
221
234
|
return _jsx(_Fragment, { children: children });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/react/components/Tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EAEZ,cAAc,EAGd,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/react/components/Tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EAEZ,cAAc,EAGd,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAyCrD;;;;;;;;;GASG;AACH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,UAAU;IACV,SAAS;IACT,MAAM;IACN,WAAW;IACX,WAAW;IACX,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,eAAe;IACf,WAAW;IACX,KAAK;CACN,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAS,cAAc,CACrB,QAAmB,EACnB,KAAwC;IAExC,2FAA2F;IAC3F,4FAA4F;IAC5F,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC/C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAEvC,MAAM,KAAK,GAAG,QAAuD,CAAC;IACtE,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC;IACxB,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1B,MAAM,IAAI,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I,CAAC;QAC9D,CAAC,CAAC;KACH,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipImpl.d.ts","sourceRoot":"","sources":["../../../src/react/components/TooltipImpl.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TooltipImpl.d.ts","sourceRoot":"","sources":["../../../src/react/components/TooltipImpl.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;GAMG;AACH,UAAU,gBAAiB,SAAQ,YAAY;IAC7C;;;qCAGiC;IACjC,GAAG,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,MAAc,EACd,UAAU,EACV,aAAa,EACb,SAAS,EACT,GAAG,GACJ,EAAE,gBAAgB,+BA2XlB"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as RTooltip from '@radix-ui/react-tooltip';
|
|
3
3
|
import { cloneElement, isValidElement, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { flushSync } from 'react-dom';
|
|
4
5
|
import { useHasHover } from '../hooks/useHasHover.js';
|
|
5
6
|
import { cn } from '../lib/cn.js';
|
|
6
7
|
import { useFloatingContainer } from '../lib/floatingContainer.js';
|
|
7
8
|
import { FLOATING_COLLISION_PADDING } from '../lib/floatingStyles.js';
|
|
8
|
-
import {
|
|
9
|
+
import { HOVER_HINT_INSTANT_MS, useHoverHintDelay } from '../lib/hoverIntent.js';
|
|
9
10
|
/**
|
|
10
11
|
* Portal-based tooltip (Radix) — never clipped by overflow ancestors, flips +
|
|
11
12
|
* shifts to stay on-screen, keyboard-reachable via focus. On touch devices (no
|
|
@@ -13,7 +14,11 @@ import { HOVER_HINT_DELAY_MS, HOVER_HINT_INSTANT_MS } from '../lib/hoverIntent.j
|
|
|
13
14
|
*/
|
|
14
15
|
export default function TooltipImpl({ children, content, side, placement, multiline, maxWidth, mobile = 'off', mobileIcon, iconClassName, className, arm, }) {
|
|
15
16
|
const hasHover = useHasHover();
|
|
17
|
+
// An empty hint is rendered (so the tree is the same shape whether or not there is one —
|
|
18
|
+
// see `Tooltip`) and never opened.
|
|
19
|
+
const hasContent = content != null && content !== false && content !== '';
|
|
16
20
|
const container = useFloatingContainer();
|
|
21
|
+
const delay = useHoverHintDelay();
|
|
17
22
|
const [open, setOpen] = useState(false);
|
|
18
23
|
const resolvedSide = placement ?? side ?? 'top';
|
|
19
24
|
const triggerRef = useRef(null);
|
|
@@ -118,7 +123,7 @@ export default function TooltipImpl({ children, content, side, placement, multil
|
|
|
118
123
|
? children.props.disabled === true
|
|
119
124
|
: false;
|
|
120
125
|
useEffect(() => {
|
|
121
|
-
if (!disabled)
|
|
126
|
+
if (!disabled || !hasContent)
|
|
122
127
|
return;
|
|
123
128
|
const node = triggerRef.current;
|
|
124
129
|
const host = node?.parentElement;
|
|
@@ -166,7 +171,7 @@ export default function TooltipImpl({ children, content, side, placement, multil
|
|
|
166
171
|
timer = null;
|
|
167
172
|
shown = true;
|
|
168
173
|
setOpen(true);
|
|
169
|
-
},
|
|
174
|
+
}, delay);
|
|
170
175
|
};
|
|
171
176
|
const onLeave = () => close();
|
|
172
177
|
host.addEventListener('pointermove', onMove);
|
|
@@ -178,7 +183,32 @@ export default function TooltipImpl({ children, content, side, placement, multil
|
|
|
178
183
|
setOpen(false);
|
|
179
184
|
};
|
|
180
185
|
// `open` is deliberately absent: see `shown` above.
|
|
181
|
-
}, [disabled]);
|
|
186
|
+
}, [disabled, hasContent, delay]);
|
|
187
|
+
/*
|
|
188
|
+
* 🔴 A hint never takes an Escape for itself.
|
|
189
|
+
*
|
|
190
|
+
* Radix draws the bubble as a DismissableLayer, and only the TOPMOST layer answers Escape —
|
|
191
|
+
* so a hint showing over an open menu, popover or dialog took the keypress, and the panel
|
|
192
|
+
* the person was pressing Escape AT stayed up behind it. Measured in desk (forge task
|
|
193
|
+
* 2406): hover a refused menu item to read why, press Escape, and the menu did not close;
|
|
194
|
+
* the programmatic-focus case of the same trap is the `:focus-visible` gate further down.
|
|
195
|
+
*
|
|
196
|
+
* So on Escape the bubble shuts FIRST — from a window capture listener, which runs before
|
|
197
|
+
* every layer's own listener on the document — and synchronously (`flushSync`: a discrete
|
|
198
|
+
* update flushes its passive effects too, which is where the layer takes itself off Radix's
|
|
199
|
+
* stack). By the time Radix asks "who is topmost" the hint is gone, and the same keypress
|
|
200
|
+
* closes what is under it. A hint over nothing costs nothing: Escape still reaches the page.
|
|
201
|
+
*/
|
|
202
|
+
useEffect(() => {
|
|
203
|
+
if (!open)
|
|
204
|
+
return;
|
|
205
|
+
const onKeyDown = (event) => {
|
|
206
|
+
if (event.key === 'Escape')
|
|
207
|
+
flushSync(() => setOpen(false));
|
|
208
|
+
};
|
|
209
|
+
window.addEventListener('keydown', onKeyDown, true);
|
|
210
|
+
return () => window.removeEventListener('keydown', onKeyDown, true);
|
|
211
|
+
}, [open]);
|
|
182
212
|
const bubble = (_jsx(RTooltip.Portal, { container: container, children: _jsxs(RTooltip.Content, { "data-cb-tooltip": '', side: resolvedSide, sideOffset: 6, collisionPadding: FLOATING_COLLISION_PADDING, style: maxWidth != null ? { maxWidth } : undefined, onPointerDownOutside: (e) => {
|
|
183
213
|
// A touch disclosure's OWN trigger is outside the bubble, but a tap on it is the
|
|
184
214
|
// toggle's business (it closes an open bubble on its click). Letting the layer
|
|
@@ -198,7 +228,7 @@ export default function TooltipImpl({ children, content, side, placement, multil
|
|
|
198
228
|
'z-50 rounded-md border border-border bg-popover px-2 py-1 text-xs text-popover-foreground shadow-[var(--shadow-overlay)]', multiline || maxWidth != null ? 'max-w-xs' : 'whitespace-nowrap', className), children: [content, _jsx(RTooltip.Arrow, { className: 'fill-[var(--color-popover)]' })] }) }));
|
|
199
229
|
// Hover-capable: the standard hover/focus tooltip.
|
|
200
230
|
if (hasHover) {
|
|
201
|
-
return (_jsx(RTooltip.Provider, { delayDuration:
|
|
231
|
+
return (_jsx(RTooltip.Provider, { delayDuration: delay, disableHoverableContent: true, children: _jsxs(RTooltip.Root, { open: open && hasContent, onOpenChange: setOpen, children: [_jsx(RTooltip.Trigger, { asChild: true,
|
|
202
232
|
// Radix opens the tooltip on ANY focus — including PROGRAMMATIC focus, e.g. a
|
|
203
233
|
// Dialog auto-focusing its Close button on open. That phantom tooltip is noise,
|
|
204
234
|
// and worse: its DismissableLayer becomes the topmost layer and swallows the
|
|
@@ -212,8 +242,8 @@ export default function TooltipImpl({ children, content, side, placement, multil
|
|
|
212
242
|
e.preventDefault();
|
|
213
243
|
}, children: child }), bubble] }) }));
|
|
214
244
|
}
|
|
215
|
-
// Touch device.
|
|
216
|
-
if (mobile === 'off')
|
|
245
|
+
// Touch device. No hint on a touch device is no ⓘ either.
|
|
246
|
+
if (mobile === 'off' || !hasContent)
|
|
217
247
|
return _jsx(_Fragment, { children: children });
|
|
218
248
|
const toggle = () => setOpen((o) => !o);
|
|
219
249
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipImpl.js","sourceRoot":"","sources":["../../../src/react/components/TooltipImpl.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,M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YACrD,MAAC,QAAQ,CAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,iBAAiB,aACxD,KAAC,QAAQ,CAAC,OAAO,IAAC,OAAO,WAAK,iBAAiB,YAC7C;oCACE,0EAA0E;oCAC1E,2EAA2E;oCAC3E,gDAAgD;oCAChD,IAAI,EAAC,QAAQ,gBACF,kBAAkB,EAC7B,OAAO,EAAE,MAAM;oCACf,mEAAmE;oCACnE,mEAAmE;oCACnE,iEAAiE;oCACjE,iDAAiD;oCACjD,SAAS,EAAE,EAAE,CACX,uGAAuG,EACvG,aAAa,CACd,YAED,eAAM,SAAS,EAAC,6GAA6G,YAC1H,UAAU,IAAI,GAAG,GACb,GACA,GACQ,EAClB,MAAM,IACO,GACE,IACf,CACR,CAAC;IACJ,CAAC;IAED,qFAAqF;IACrF,uDAAuD;IACvD,OAAO,CACL,KAAC,QAAQ,CAAC,QAAQ,IAAC,aAAa,EAAE,qBAAqB,YACrD,MAAC,QAAQ,CAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,iBAAiB,aACxD,KAAC,QAAQ,CAAC,OAAO,IAAC,OAAO,WAAK,iBAAiB,YAM7C,eAAM,OAAO,EAAE,MAAM,YAAG,QAAQ,GAAQ,GACvB,EAClB,MAAM,IACO,GACE,CACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TooltipPlacement } from './Tooltip.js';
|
|
3
|
+
export interface UnstyledButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
/** Hover/focus hint, drawn by the belt's {@link Tooltip}. Optional: the caller's own look usually names the control. */
|
|
5
|
+
tooltip?: ReactNode;
|
|
6
|
+
/** Preferred tooltip side (auto-flips to stay on-screen). Default `'top'`. */
|
|
7
|
+
tooltipSide?: TooltipPlacement;
|
|
8
|
+
/**
|
|
9
|
+
* Why this control cannot work HERE — and supplying it refuses the press, exactly as
|
|
10
|
+
* {@link Button}'s does: `aria-disabled`, still focusable and hoverable, turned away on
|
|
11
|
+
* click and on Enter/Space, with the reason as its hint. `disabled` wins when both are given.
|
|
12
|
+
*/
|
|
13
|
+
unavailableReason?: string;
|
|
14
|
+
ref?: Ref<HTMLButtonElement>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A `<button>` that brings none of the belt's look and all of its behaviour.
|
|
18
|
+
*
|
|
19
|
+
* Mantine's name for the same thing. For a control whose look is the caller's own — a tab
|
|
20
|
+
* in a deck, a pin in a sidebar, a breadcrumb step — that still has to explain itself and
|
|
21
|
+
* still has to refuse a press it cannot honour. {@link Button} with `asChild` would restyle
|
|
22
|
+
* the child with the button's variants; this adds no class at all, so `className` is the
|
|
23
|
+
* whole of its look.
|
|
24
|
+
*
|
|
25
|
+
* What it carries, and every call site otherwise re-implements:
|
|
26
|
+
* - `type="button"` by default, so it never submits a form by accident;
|
|
27
|
+
* - the hint through the belt's {@link Tooltip}, never the browser's `title` (which waits a
|
|
28
|
+
* fixed second and never appears on keyboard focus) — a `title` given here becomes the hint;
|
|
29
|
+
* - `unavailableReason`, refused rather than inert.
|
|
30
|
+
*
|
|
31
|
+
* The caller's `onClick`/`onKeyDown` run after the refusal check, never instead of it — and
|
|
32
|
+
* every other handler (a drag on `onPointerDown`) is the caller's, untouched.
|
|
33
|
+
*
|
|
34
|
+
* Came from desk's `TipButton` (forge task 2415).
|
|
35
|
+
*/
|
|
36
|
+
export declare function UnstyledButton({ tooltip, tooltipSide, unavailableReason, title, type, disabled, onClick, onKeyDown, children, ...rest }: UnstyledButtonProps): import("react").JSX.Element;
|
|
37
|
+
//# sourceMappingURL=UnstyledButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnstyledButton.d.ts","sourceRoot":"","sources":["../../../src/react/components/UnstyledButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAA6B,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,EAAW,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE9D,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IAClF,wHAAwH;IACxH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,mBAAmB,+BAkCrB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip } from './Tooltip.js';
|
|
3
|
+
/**
|
|
4
|
+
* A `<button>` that brings none of the belt's look and all of its behaviour.
|
|
5
|
+
*
|
|
6
|
+
* Mantine's name for the same thing. For a control whose look is the caller's own — a tab
|
|
7
|
+
* in a deck, a pin in a sidebar, a breadcrumb step — that still has to explain itself and
|
|
8
|
+
* still has to refuse a press it cannot honour. {@link Button} with `asChild` would restyle
|
|
9
|
+
* the child with the button's variants; this adds no class at all, so `className` is the
|
|
10
|
+
* whole of its look.
|
|
11
|
+
*
|
|
12
|
+
* What it carries, and every call site otherwise re-implements:
|
|
13
|
+
* - `type="button"` by default, so it never submits a form by accident;
|
|
14
|
+
* - the hint through the belt's {@link Tooltip}, never the browser's `title` (which waits a
|
|
15
|
+
* fixed second and never appears on keyboard focus) — a `title` given here becomes the hint;
|
|
16
|
+
* - `unavailableReason`, refused rather than inert.
|
|
17
|
+
*
|
|
18
|
+
* The caller's `onClick`/`onKeyDown` run after the refusal check, never instead of it — and
|
|
19
|
+
* every other handler (a drag on `onPointerDown`) is the caller's, untouched.
|
|
20
|
+
*
|
|
21
|
+
* Came from desk's `TipButton` (forge task 2415).
|
|
22
|
+
*/
|
|
23
|
+
export function UnstyledButton({ tooltip, tooltipSide, unavailableReason, title, type, disabled, onClick, onKeyDown, children, ...rest }) {
|
|
24
|
+
const reason = unavailableReason?.trim() || undefined;
|
|
25
|
+
const refused = reason !== undefined && !disabled;
|
|
26
|
+
const words = reason ?? tooltip ?? title;
|
|
27
|
+
return (_jsx(Tooltip, { content: typeof words === 'string' ? words.trim() || undefined : words, side: tooltipSide, multiline: true, children: _jsx("button", {
|
|
28
|
+
// guardrails-ignore no-raw-action-button: task 2415 — this IS the unstyled button primitive.
|
|
29
|
+
type: type ?? 'button', ...rest, disabled: refused ? undefined : disabled, "aria-disabled": refused ? true : rest['aria-disabled'], onClick: (event) => {
|
|
30
|
+
// Refused before anything else runs, so a caller's handler cannot fire behind it.
|
|
31
|
+
if (refused) {
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
onClick?.(event);
|
|
37
|
+
}, onKeyDown: (event) => {
|
|
38
|
+
// Enter and Space are a button's click; a focusable refused control turns them away too.
|
|
39
|
+
if (refused && (event.key === 'Enter' || event.key === ' ')) {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
onKeyDown?.(event);
|
|
44
|
+
}, children: children }) }));
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=UnstyledButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnstyledButton.js","sourceRoot":"","sources":["../../../src/react/components/UnstyledButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAyB,MAAM,cAAc,CAAC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AK,CAAC,cAAc,EAAE,CAAC;oBACvB,OAAO;gBACT,CAAC;gBACD,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC,YAEA,QAAQ,GACF,GACD,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -27,6 +27,20 @@ export interface SignInCardProps {
|
|
|
27
27
|
label?: ReactNode;
|
|
28
28
|
/** Button tooltip. Default "Sign in with your account". */
|
|
29
29
|
tooltip?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Sign in as somebody ELSE — a single-sign-on app passes
|
|
32
|
+
* `() => startSsoSignIn({ addAccount: true })`, which opens the accounts chooser.
|
|
33
|
+
*
|
|
34
|
+
* 🔴 It exists for the refusal (2026-09-30). The owner, locked out of collections by a
|
|
35
|
+
* test account Safari was still signed into: *"It forgot to offer an option for me to
|
|
36
|
+
* sign in with a different account."* "Sign in" on its own re-sends the browser as the
|
|
37
|
+
* account that was just refused, so with a refusal showing this becomes the PRIMARY
|
|
38
|
+
* action and "Try again" steps down beside it. Without a refusal it is a quiet second
|
|
39
|
+
* button under "Sign in".
|
|
40
|
+
*/
|
|
41
|
+
onUseAnotherAccount?: () => void;
|
|
42
|
+
/** The other-account button's label. Default "Use a different account". */
|
|
43
|
+
anotherAccountLabel?: ReactNode;
|
|
30
44
|
/** Anything the app must say between the warning and the button. */
|
|
31
45
|
children?: ReactNode;
|
|
32
46
|
/** A line under the card, outside it. */
|
|
@@ -45,5 +59,5 @@ export interface SignInCardProps {
|
|
|
45
59
|
* It knows nothing about HOW signing in works — `onSignIn` and `refusal` are the
|
|
46
60
|
* app's — so it has no dependency on cursedauth and a password app can use it too.
|
|
47
61
|
*/
|
|
48
|
-
export declare function SignInCard({ title, subtitle, logo, onSignIn, refusal, refusalTitle, busy, disabledReason, label, tooltip, children, footer, }: SignInCardProps): import("react").JSX.Element;
|
|
62
|
+
export declare function SignInCard({ title, subtitle, logo, onSignIn, refusal, refusalTitle, busy, disabledReason, label, tooltip, onUseAnotherAccount, anotherAccountLabel, children, footer, }: SignInCardProps): import("react").JSX.Element;
|
|
49
63
|
//# sourceMappingURL=SignInCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignInCard.d.ts","sourceRoot":"","sources":["../../../../src/react/components/auth/SignInCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,WAAW,eAAe;IAC9B,2CAA2C;IAC3C,KAAK,EAAE,SAAS,CAAC;IACjB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oCAAoC;IACpC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,mFAAmF;IACnF,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,wEAAwE;IACxE,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,iFAAiF;IACjF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,yCAAyC;IACzC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,YAAgD,EAChD,IAAY,EACZ,cAAc,EACd,KAAiB,EACjB,OAAqC,EACrC,QAAQ,EACR,MAAM,GACP,EAAE,eAAe,+
|
|
1
|
+
{"version":3,"file":"SignInCard.d.ts","sourceRoot":"","sources":["../../../../src/react/components/auth/SignInCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,WAAW,eAAe;IAC9B,2CAA2C;IAC3C,KAAK,EAAE,SAAS,CAAC;IACjB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oCAAoC;IACpC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,mFAAmF;IACnF,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,wEAAwE;IACxE,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,iFAAiF;IACjF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,2EAA2E;IAC3E,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAChC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,yCAAyC;IACzC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,YAAgD,EAChD,IAAY,EACZ,cAAc,EACd,KAAiB,EACjB,OAAqC,EACrC,mBAAmB,EACnB,mBAA+C,EAC/C,QAAQ,EACR,MAAM,GACP,EAAE,eAAe,+BAyCjB"}
|
|
@@ -15,7 +15,11 @@ import { AuthCard } from './AuthCard.js';
|
|
|
15
15
|
* It knows nothing about HOW signing in works — `onSignIn` and `refusal` are the
|
|
16
16
|
* app's — so it has no dependency on cursedauth and a password app can use it too.
|
|
17
17
|
*/
|
|
18
|
-
export function SignInCard({ title, subtitle, logo, onSignIn, refusal, refusalTitle = 'That sign-in did not go through', busy = false, disabledReason, label = 'Sign in', tooltip = 'Sign in with your account', children, footer, }) {
|
|
19
|
-
|
|
18
|
+
export function SignInCard({ title, subtitle, logo, onSignIn, refusal, refusalTitle = 'That sign-in did not go through', busy = false, disabledReason, label = 'Sign in', tooltip = 'Sign in with your account', onUseAnotherAccount, anotherAccountLabel = 'Use a different account', children, footer, }) {
|
|
19
|
+
// A refusal plus somewhere else to go: the other account leads, because retrying as the
|
|
20
|
+
// account that was just refused would be refused again.
|
|
21
|
+
const anotherLeads = Boolean(refusal) && onUseAnotherAccount !== undefined;
|
|
22
|
+
const another = onUseAnotherAccount ? (_jsx(Button, { className: 'w-full', variant: anotherLeads ? 'primary' : 'ghost', disabled: busy || disabledReason !== undefined, tooltip: disabledReason ?? 'Choose a saved account or sign in with another one', tooltipMobile: disabledReason ? 'icon' : 'off', onClick: onUseAnotherAccount, children: anotherAccountLabel })) : null;
|
|
23
|
+
return (_jsx(AuthCard, { aurora: true, title: title, subtitle: subtitle, logo: logo, footer: footer, children: _jsxs("div", { className: 'flex flex-col gap-4', children: [refusal ? (_jsx(Alert, { tone: 'warning', title: refusalTitle, children: refusal })) : null, children, anotherLeads ? another : null, _jsx(Button, { className: 'w-full', variant: anotherLeads ? 'ghost' : 'primary', loading: busy, disabled: disabledReason !== undefined, tooltip: disabledReason ?? (anotherLeads ? 'Try the same account again' : tooltip), tooltipMobile: disabledReason ? 'icon' : 'off', onClick: onSignIn, children: anotherLeads && label === 'Sign in' ? 'Try again' : label }), anotherLeads ? null : another] }) }));
|
|
20
24
|
}
|
|
21
25
|
//# sourceMappingURL=SignInCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignInCard.js","sourceRoot":"","sources":["../../../../src/react/components/auth/SignInCard.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;A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M,EAAE,MAAM,YAC3E,eAAK,SAAS,EAAC,qBAAqB,aACjC,OAAO,CAAC,CAAC,CAAC,CACT,KAAC,KAAK,IAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAE,YAAY,YACtC,OAAO,GACF,CACT,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,EACR,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAC9B,KAAC,MAAM,IACL,SAAS,EAAC,QAAQ,EAClB,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAC3C,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,cAAc,KAAK,SAAS,EACtC,OAAO,EAAE,cAAc,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,OAAO,CAAC,EAClF,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EAC9C,OAAO,EAAE,QAAQ,YAEhB,YAAY,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,GACnD,EACR,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,IAC1B,GACG,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/react/components/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,KAAK,wBAAwB,
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/react/components/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,KAAK,wBAAwB,EAAyB,MAAM,OAAO,CAAC;AAK7E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,iDAAuB,CAAC;AAC3C,eAAO,MAAM,aAAa,kIAA0B,CAAC;AACrD,eAAO,MAAM,YAAY,uDAAyB,CAAC;AACnD,eAAO,MAAM,WAAW,gIAAwB,CAAC;AACjD,eAAO,MAAM,WAAW,iIAAwB,CAAC;AACjD,eAAO,MAAM,iBAAiB,yIAA8B,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,GAAI,GAAG,KAAK,KAAG,IAG3C,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,aAAa,4LAexB,CAAC;AAGH,MAAM,WAAW,kBACf,SAAQ,wBAAwB,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC;IAChE,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAYD;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,+GAoCzB,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
3
|
+
import { forwardRef, useEffect } from 'react';
|
|
4
4
|
import { cn } from '../lib/cn.js';
|
|
5
|
+
import { useFloatingContainer } from '../lib/floatingContainer.js';
|
|
6
|
+
import { noteDialogOpen } from '../lib/openDialogs.js';
|
|
5
7
|
/**
|
|
6
8
|
* The vendored shadcn/Radix Dialog base — the shared portal + scrim + focus-trapped
|
|
7
9
|
* content panel that the whole overlay family (Modal, Drawer, ConfirmDialog, Lightbox)
|
|
@@ -36,8 +38,17 @@ export const focusPanelOnOpen = (e) => {
|
|
|
36
38
|
e.currentTarget?.focus();
|
|
37
39
|
};
|
|
38
40
|
/** Shared dimmer behind every overlay: a fixed, blurred scrim that fades with state. */
|
|
39
|
-
export const DialogOverlay = forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn('fixed inset-0 z-40 bg-black/50 backdrop-blur-sm', 'data-[state=open]:animate-in data-[state=open]:fade-in-0', 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0', className), ...props })));
|
|
41
|
+
export const DialogOverlay = forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, "data-cb-dialog-overlay": '', className: cn('fixed inset-0 z-40 bg-black/50 backdrop-blur-sm', 'data-[state=open]:animate-in data-[state=open]:fade-in-0', 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0', className), ...props })));
|
|
40
42
|
DialogOverlay.displayName = 'DialogOverlay';
|
|
43
|
+
/**
|
|
44
|
+
* Radix mounts a dialog's content only while it is open (and through its exit animation), so a
|
|
45
|
+
* child of the content being mounted IS the dialog being open. `DialogContent` itself renders
|
|
46
|
+
* whether or not it is — the portal is what gates — so the mark cannot live on it.
|
|
47
|
+
*/
|
|
48
|
+
function CountsAsOpen() {
|
|
49
|
+
useEffect(() => noteDialogOpen(), []);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
41
52
|
/**
|
|
42
53
|
* Portal + dimmer + the focus-trapped content panel. The caller owns positioning and
|
|
43
54
|
* animation via `className`; the base only adds the z-index and the outline reset.
|
|
@@ -48,6 +59,27 @@ DialogOverlay.displayName = 'DialogOverlay';
|
|
|
48
59
|
* silences the dev warning). A panel WITH a `DialogDescription` must NOT pass it, so
|
|
49
60
|
* Radix's context wiring links the description.
|
|
50
61
|
*/
|
|
51
|
-
export const DialogContent = forwardRef(({ className, overlayClassName, children, ...props }, ref) =>
|
|
62
|
+
export const DialogContent = forwardRef(({ className, overlayClassName, children, onPointerDownOutside, ...props }, ref) => {
|
|
63
|
+
/*
|
|
64
|
+
🔴 Where the dialog mounts is the app's, exactly as for a Popover or a DropdownMenu. An app
|
|
65
|
+
whose tokens live on its own root (desk keeps every variable on `.cs-root`) got a dialog in
|
|
66
|
+
`document.body` drawn with no colours at all, and a full-screen element hid it outright.
|
|
67
|
+
*/
|
|
68
|
+
const container = useFloatingContainer();
|
|
69
|
+
return (_jsxs(DialogPortal, { container: container, children: [_jsx(DialogOverlay, { className: overlayClassName }), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn('z-50 outline-none', className), onPointerDownOutside: (event) => {
|
|
70
|
+
/*
|
|
71
|
+
🔴 A press on a TOAST is not a press outside the dialog. The toast stack sits above
|
|
72
|
+
every dialog on purpose (a toast is usually about what the dialog just did), so
|
|
73
|
+
dismissing "3 unsaved" or pressing its Undo landed "outside" and threw the dialog —
|
|
74
|
+
and whatever was typed in it — away. desk task 2413, when its toasts became the belt's.
|
|
75
|
+
*/
|
|
76
|
+
const target = event.target;
|
|
77
|
+
if (target?.closest?.('[data-sonner-toaster]')) {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
onPointerDownOutside?.(event);
|
|
82
|
+
}, ...props, children: [_jsx(CountsAsOpen, {}), children] })] }));
|
|
83
|
+
});
|
|
52
84
|
DialogContent.displayName = 'DialogContent';
|
|
53
85
|
//# sourceMappingURL=dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../src/react/components/dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAiC,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../src/react/components/dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAiC,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;;;;;GAW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;IACjF;;;;MAIE;IACF,MAAM,SAAS,GAAG,oBAAoB,EAAE,CAAC;IACzC,OAAO,CACL,MAAC,YAAY,IAAC,SAAS,EAAE,SAAS,aAChC,KAAC,aAAa,IAAC,SAAS,EAAE,gBAAgB,GAAI,EAC9C,MAAC,eAAe,CAAC,OAAO,IACtB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC,EAC7C,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE;oBAC9B;;;;;sBAKE;oBACF,MAAM,MAAM,GAAG,KAAK,CAAC,MAAwB,CAAC;oBAC9C,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC,uBAAuB,CAAC,EAAE,CAAC;wBAC/C,KAAK,CAAC,cAAc,EAAE,CAAC;wBACvB,OAAO;oBACT,CAAC;oBACD,oBAAoB,EAAE,CAAC,KAAK,CAAC,CAAC;gBAChC,CAAC,KACG,KAAK,aAET,KAAC,YAAY,KAAG,EACf,QAAQ,IACe,IACb,CAChB,CAAC;AACJ,CAAC,CACF,CAAC;AACF,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
|
@@ -6,6 +6,14 @@ export interface UseCopyToClipboard {
|
|
|
6
6
|
/** Clear the pending reset timer and force `copied` back to false. */
|
|
7
7
|
reset: () => void;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* An app-owned clipboard write: resolve `true` for a copy, `false` (or throw) for a failed one. The vault
|
|
11
|
+
* passes one that wipes the clipboard ~45s later, so the confirmation still lives here.
|
|
12
|
+
*/
|
|
13
|
+
export type ClipboardWriter = (text: string) => boolean | Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Clipboard write with a transient `copied` flag (auto-resets after `resetMs`).
|
|
16
|
+
* `write` replaces the plain `navigator.clipboard.writeText` with the app's own.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useCopyToClipboard(resetMs?: number, write?: ClipboardWriter): UseCopyToClipboard;
|
|
11
19
|
//# sourceMappingURL=useCopyToClipboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useCopyToClipboard.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,oFAAoF;IACpF,MAAM,EAAE,OAAO,CAAC;IAChB,oFAAoF;IACpF,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,sEAAsE;IACtE,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,
|
|
1
|
+
{"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useCopyToClipboard.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,oFAAoF;IACpF,MAAM,EAAE,OAAO,CAAC;IAChB,oFAAoF;IACpF,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,sEAAsE;IACtE,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE3E;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,SAAO,EAAE,KAAK,CAAC,EAAE,eAAe,GAAG,kBAAkB,CAsC9F"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Clipboard write with a transient `copied` flag (auto-resets after `resetMs`).
|
|
4
|
+
* `write` replaces the plain `navigator.clipboard.writeText` with the app's own.
|
|
5
|
+
*/
|
|
6
|
+
export function useCopyToClipboard(resetMs = 1200, write) {
|
|
4
7
|
const [copied, setCopied] = useState(false);
|
|
5
8
|
const timer = useRef(null);
|
|
6
9
|
const clear = useCallback(() => {
|
|
@@ -16,7 +19,13 @@ export function useCopyToClipboard(resetMs = 1200) {
|
|
|
16
19
|
}, [clear]);
|
|
17
20
|
const copy = useCallback(async (text) => {
|
|
18
21
|
try {
|
|
19
|
-
|
|
22
|
+
if (write) {
|
|
23
|
+
if (!(await write(text)))
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
await navigator.clipboard?.writeText(text);
|
|
28
|
+
}
|
|
20
29
|
setCopied(true);
|
|
21
30
|
clear();
|
|
22
31
|
timer.current = setTimeout(() => setCopied(false), resetMs);
|
|
@@ -25,7 +34,7 @@ export function useCopyToClipboard(resetMs = 1200) {
|
|
|
25
34
|
catch {
|
|
26
35
|
return false;
|
|
27
36
|
}
|
|
28
|
-
}, [clear, resetMs]);
|
|
37
|
+
}, [clear, resetMs, write]);
|
|
29
38
|
return { copied, copy, reset };
|
|
30
39
|
}
|
|
31
40
|
//# sourceMappingURL=useCopyToClipboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCopyToClipboard.js","sourceRoot":"","sources":["../../../src/react/hooks/useCopyToClipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useCopyToClipboard.js","sourceRoot":"","sources":["../../../src/react/hooks/useCopyToClipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAiBjE;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAO,GAAG,IAAI,EAAE,KAAuB;IACxE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC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dist/react/icons.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import type { JSX } from 'react';
|
|
2
3
|
/** The icon vocabulary plugins/builder reference by token. */
|
|
3
4
|
export declare const IconRegistry: {
|
|
4
5
|
readonly search: 1;
|
|
@@ -104,5 +105,15 @@ export interface DynamicIconProps {
|
|
|
104
105
|
* day it adopted the component. A registry that was never passed is not a registry that was
|
|
105
106
|
* cleared; only an explicit map may leave a token unresolved.
|
|
106
107
|
*/
|
|
107
|
-
export
|
|
108
|
+
export type HandDrawnIconProps = {
|
|
109
|
+
size?: number;
|
|
110
|
+
className?: string;
|
|
111
|
+
};
|
|
112
|
+
/** The sidebar collapse/expand glyph — a panel split by a vertical divider. */
|
|
113
|
+
export declare const IconSidebar: ({ size, className }: HandDrawnIconProps) => JSX.Element;
|
|
114
|
+
/** The search / magnifier glyph. */
|
|
115
|
+
export declare const IconSearch: ({ size, className }: HandDrawnIconProps) => JSX.Element;
|
|
116
|
+
/** The table / rows glyph — three horizontal lines. */
|
|
117
|
+
export declare const IconTable: ({ size, className }: HandDrawnIconProps) => JSX.Element;
|
|
118
|
+
export declare function DynamicIcon({ token, iconMap, className }: DynamicIconProps): JSX.Element | null;
|
|
108
119
|
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/react/icons.tsx"],"names":[],"mappings":"AAyDA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/react/icons.tsx"],"names":[],"mappings":"AAyDA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,GAAG,EAAa,MAAM,OAAO,CAAC;AAI5C,8DAA8D;AAC9D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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E,OAAO,EAAE,SAAS,EAAE,EAAE,gBAAgB,sBAoB1E"}
|
package/dist/react/icons.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { BadgeInfo, BarChart3, Bell, Blocks, Bot, BrainCircuit, Calendar, Camera, Clock, Database, File, FileDiff, Film, Filter, Folder, FolderOpen, FolderSearch, Gamepad2, GitBranch, Globe, HardDrive, Home, Image as ImageIcon, Inbox, LayoutDashboard, ListTree, Link as LinkIcon, List, LockOpen, Mail, MessageSquare, Mic, MonitorSmartphone, NotebookPen, Package, PenLine, Plus, Rocket, Route, ScanText, Search, Settings, Shield, Sparkles, SquareCheck, SquareKanban, Table, Terminal, Timer, TrendingUp, User, Vault, Video, Wand2, Wrench, } from 'lucide-react';
|
|
3
3
|
import { cn } from './lib/cn.js';
|
|
4
4
|
import { Tooltip } from './components/Tooltip.js';
|
|
@@ -156,27 +156,17 @@ export function createIconMapRegistry() {
|
|
|
156
156
|
},
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
*
|
|
171
|
-
* The `iconMap` is typically the `runtime.icons` registry from the host shell.
|
|
172
|
-
*
|
|
173
|
-
* 🔴 Omitted, it is `defaultIconMap` — NOT "nothing registered". Until 5.15.1 a missing
|
|
174
|
-
* `iconMap` resolved every token to the letter fallback, so vault's header, which renders
|
|
175
|
-
* `<DynamicIcon token="unlock" />` and its neighbours with no map, painted the letters
|
|
176
|
-
* "U W S" where its lock, generator and settings icons belonged, on every screen, from the
|
|
177
|
-
* day it adopted the component. A registry that was never passed is not a registry that was
|
|
178
|
-
* cleared; only an explicit map may leave a token unresolved.
|
|
179
|
-
*/
|
|
159
|
+
function handDrawnIcon(path) {
|
|
160
|
+
return function Icon({ size = 20, className }) {
|
|
161
|
+
return (_jsx("svg", { "aria-hidden": "true", className: className, fill: "none", focusable: "false", height: size, stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.7", viewBox: "0 0 24 24", width: size, children: path }));
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/** The sidebar collapse/expand glyph — a panel split by a vertical divider. */
|
|
165
|
+
export const IconSidebar = handDrawnIcon(_jsxs(_Fragment, { children: [_jsx("rect", { height: "18", rx: "2", width: "18", x: "3", y: "3" }), _jsx("path", { d: "M9 3v18" })] }));
|
|
166
|
+
/** The search / magnifier glyph. */
|
|
167
|
+
export const IconSearch = handDrawnIcon(_jsxs(_Fragment, { children: [_jsx("circle", { cx: "11", cy: "11", r: "7" }), _jsx("path", { d: "m20 20-3.5-3.5" })] }));
|
|
168
|
+
/** The table / rows glyph — three horizontal lines. */
|
|
169
|
+
export const IconTable = handDrawnIcon(_jsxs(_Fragment, { children: [_jsx("path", { d: "M4 6h16" }), _jsx("path", { d: "M4 12h16" }), _jsx("path", { d: "M4 18h16" })] }));
|
|
180
170
|
export function DynamicIcon({ token, iconMap, className }) {
|
|
181
171
|
if (!token)
|
|
182
172
|
return null;
|