@liberation-data/desk 0.19.0 → 0.20.1
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 +3 -2
- package/dist/css/controls.css +18 -2
- package/dist/css/overlays.css +6 -18
- package/dist/desk.css +24 -20
- package/dist/react/overlays.d.ts.map +1 -1
- package/dist/react/overlays.js +56 -2
- package/dist/react/overlays.js.map +1 -1
- package/dist/react/tabs.d.ts +6 -1
- package/dist/react/tabs.d.ts.map +1 -1
- package/dist/react/tabs.js +5 -5
- package/dist/react/tabs.js.map +1 -1
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/src/css/controls.css +18 -2
- package/src/css/overlays.css +6 -18
- package/src/react/overlays.tsx +59 -3
- package/src/react/tabs.tsx +31 -23
package/README.md
CHANGED
|
@@ -263,7 +263,8 @@ Each control carries its own behaviour and accessibility; the look comes only fr
|
|
|
263
263
|
style props on purpose. `intent="default"` marks the one action a view leads with. A segmented control is one
|
|
264
264
|
tab stop whose arrow keys move the selection past disabled options. Tabs look similar and are not the same
|
|
265
265
|
thing: a segmented control chooses a value and what it governs stays on screen, while tabs switch the view
|
|
266
|
-
beneath them, which sits in a panel the selected tab names.
|
|
266
|
+
beneath them, which sits in a panel the selected tab names. `actions` puts controls for the whole window,
|
|
267
|
+
such as Refresh, at the end of the strip, so a window with tabs needs no header row above them. A toggle is a `switch` for settings that
|
|
267
268
|
apply at once — a checkbox is for one that waits for Save. A text field always has a label (`labelHidden`
|
|
268
269
|
keeps it for screen readers), and an `error` marks it invalid and replaces the help text. A choice group
|
|
269
270
|
is the handful of cards a setup step turns on — an icon, a label, a line of why — with native radios
|
|
@@ -535,7 +536,7 @@ const toast = useToast()
|
|
|
535
536
|
toast.show({ message: 'Ride deleted', action: { label: 'Undo', onSelect: restore } })
|
|
536
537
|
```
|
|
537
538
|
|
|
538
|
-
A **popover** belongs to one control and closes when you press outside. A **sheet** belongs to one window
|
|
539
|
+
A **popover** belongs to one control and closes when you press outside. It floats over its window rather than inside it, so opening one never resizes or scrolls the window; it stays within the window's edges and flips side when there is no room. A **sheet** belongs to one window
|
|
539
540
|
and blocks only that window — it renders inside it, so the rest of the desk stays usable. An **alert** stops
|
|
540
541
|
the app and is for what cannot be undone; Cancel comes before the action, and a destructive action is never
|
|
541
542
|
the default button. A **toast** interrupts nothing, carries Undo, and waits while the pointer or focus is on
|
package/dist/css/controls.css
CHANGED
|
@@ -722,14 +722,30 @@
|
|
|
722
722
|
* radius, so a tab's hover wash and its underline read as one rounded shape, and a look that
|
|
723
723
|
* rounds its buttons rounds its tabs to match.
|
|
724
724
|
*/
|
|
725
|
-
.desk-
|
|
725
|
+
.desk-tabbar {
|
|
726
726
|
display: flex;
|
|
727
727
|
flex-wrap: wrap;
|
|
728
|
-
|
|
728
|
+
align-items: flex-end;
|
|
729
|
+
gap: var(--desk-space-2);
|
|
729
730
|
border-bottom: 1px solid var(--desk-rule);
|
|
730
731
|
margin-bottom: var(--desk-space-3);
|
|
731
732
|
}
|
|
732
733
|
|
|
734
|
+
.desk-tablist {
|
|
735
|
+
display: flex;
|
|
736
|
+
flex-wrap: wrap;
|
|
737
|
+
gap: 2px;
|
|
738
|
+
margin-right: auto;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/* Sits on the strip's baseline, clear of the rule, without stretching the tabs to its height. */
|
|
742
|
+
.desk-tabs-actions {
|
|
743
|
+
display: flex;
|
|
744
|
+
align-items: center;
|
|
745
|
+
gap: var(--desk-space-2);
|
|
746
|
+
padding-bottom: var(--desk-space-1);
|
|
747
|
+
}
|
|
748
|
+
|
|
733
749
|
.desk-tab {
|
|
734
750
|
display: inline-flex;
|
|
735
751
|
align-items: center;
|
package/dist/css/overlays.css
CHANGED
|
@@ -7,10 +7,14 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.desk-popover {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/* Fixed, and placed by script beside its trigger: a popover overlaps its window, never grows it. */
|
|
11
|
+
position: fixed;
|
|
12
|
+
/* Above a sheet or an alert (1300): it is drawn in the body now, not inside the layer that opened it. */
|
|
13
|
+
z-index: 1350;
|
|
14
|
+
box-sizing: border-box;
|
|
12
15
|
min-width: 220px;
|
|
13
16
|
max-width: min(360px, calc(100vw - 24px));
|
|
17
|
+
overflow: auto;
|
|
14
18
|
padding: var(--desk-space-3);
|
|
15
19
|
border: 1px solid var(--desk-rule);
|
|
16
20
|
border-radius: 12px;
|
|
@@ -19,22 +23,6 @@
|
|
|
19
23
|
animation: desk-menu-in .14s var(--desk-ease);
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
.desk-popover[data-placement="below"] {
|
|
23
|
-
top: calc(100% + 6px);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.desk-popover[data-placement="above"] {
|
|
27
|
-
bottom: calc(100% + 6px);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.desk-popover[data-align="start"] {
|
|
31
|
-
left: 0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.desk-popover[data-align="end"] {
|
|
35
|
-
right: 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
26
|
/* A sheet belongs to its window: the scrim covers that window and nothing else. */
|
|
39
27
|
.desk-sheet-scrim,
|
|
40
28
|
.desk-alert-scrim {
|
package/dist/desk.css
CHANGED
|
@@ -1850,14 +1850,30 @@
|
|
|
1850
1850
|
* radius, so a tab's hover wash and its underline read as one rounded shape, and a look that
|
|
1851
1851
|
* rounds its buttons rounds its tabs to match.
|
|
1852
1852
|
*/
|
|
1853
|
-
.desk-
|
|
1853
|
+
.desk-tabbar {
|
|
1854
1854
|
display: flex;
|
|
1855
1855
|
flex-wrap: wrap;
|
|
1856
|
-
|
|
1856
|
+
align-items: flex-end;
|
|
1857
|
+
gap: var(--desk-space-2);
|
|
1857
1858
|
border-bottom: 1px solid var(--desk-rule);
|
|
1858
1859
|
margin-bottom: var(--desk-space-3);
|
|
1859
1860
|
}
|
|
1860
1861
|
|
|
1862
|
+
.desk-tablist {
|
|
1863
|
+
display: flex;
|
|
1864
|
+
flex-wrap: wrap;
|
|
1865
|
+
gap: 2px;
|
|
1866
|
+
margin-right: auto;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
/* Sits on the strip's baseline, clear of the rule, without stretching the tabs to its height. */
|
|
1870
|
+
.desk-tabs-actions {
|
|
1871
|
+
display: flex;
|
|
1872
|
+
align-items: center;
|
|
1873
|
+
gap: var(--desk-space-2);
|
|
1874
|
+
padding-bottom: var(--desk-space-1);
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1861
1877
|
.desk-tab {
|
|
1862
1878
|
display: inline-flex;
|
|
1863
1879
|
align-items: center;
|
|
@@ -2303,10 +2319,14 @@
|
|
|
2303
2319
|
}
|
|
2304
2320
|
|
|
2305
2321
|
.desk-popover {
|
|
2306
|
-
|
|
2307
|
-
|
|
2322
|
+
/* Fixed, and placed by script beside its trigger: a popover overlaps its window, never grows it. */
|
|
2323
|
+
position: fixed;
|
|
2324
|
+
/* Above a sheet or an alert (1300): it is drawn in the body now, not inside the layer that opened it. */
|
|
2325
|
+
z-index: 1350;
|
|
2326
|
+
box-sizing: border-box;
|
|
2308
2327
|
min-width: 220px;
|
|
2309
2328
|
max-width: min(360px, calc(100vw - 24px));
|
|
2329
|
+
overflow: auto;
|
|
2310
2330
|
padding: var(--desk-space-3);
|
|
2311
2331
|
border: 1px solid var(--desk-rule);
|
|
2312
2332
|
border-radius: 12px;
|
|
@@ -2315,22 +2335,6 @@
|
|
|
2315
2335
|
animation: desk-menu-in .14s var(--desk-ease);
|
|
2316
2336
|
}
|
|
2317
2337
|
|
|
2318
|
-
.desk-popover[data-placement="below"] {
|
|
2319
|
-
top: calc(100% + 6px);
|
|
2320
|
-
}
|
|
2321
|
-
|
|
2322
|
-
.desk-popover[data-placement="above"] {
|
|
2323
|
-
bottom: calc(100% + 6px);
|
|
2324
|
-
}
|
|
2325
|
-
|
|
2326
|
-
.desk-popover[data-align="start"] {
|
|
2327
|
-
left: 0;
|
|
2328
|
-
}
|
|
2329
|
-
|
|
2330
|
-
.desk-popover[data-align="end"] {
|
|
2331
|
-
right: 0;
|
|
2332
|
-
}
|
|
2333
|
-
|
|
2334
2338
|
/* A sheet belongs to its window: the scrim covers that window and nothing else. */
|
|
2335
2339
|
.desk-sheet-scrim,
|
|
2336
2340
|
.desk-alert-scrim {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlays.d.ts","sourceRoot":"","sources":["../../src/react/overlays.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAkB/D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IACjD,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAA;IAClC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAC7B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9C,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,YAAY,CAAA;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IAChC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAC7B;AAED,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EA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CAAA;IAC3E,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAErE,UAAU,QAAQ;IAChB,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,MAAM,CAAA;IACnC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9B;AAID,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAkB3E;AAED,wBAAgB,QAAQ,IAAI,QAAQ,CAInC"}
|
package/dist/react/overlays.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import { windowElement } from '../core/commands.js';
|
|
4
|
+
import { WINDOW_ATTRIBUTE, windowElement } from '../core/commands.js';
|
|
5
5
|
import { Button } from './controls.js';
|
|
6
6
|
import { useWindowId } from './context.js';
|
|
7
7
|
import { useFocusTrap, useLayer } from './layers.js';
|
|
@@ -23,7 +23,61 @@ export function Popover({ open, onOpenChange, label, trigger, placement = 'below
|
|
|
23
23
|
document.addEventListener('pointerdown', onPointerDown, true);
|
|
24
24
|
return () => document.removeEventListener('pointerdown', onPointerDown, true);
|
|
25
25
|
}, [open, onOpenChange]);
|
|
26
|
-
|
|
26
|
+
const place = useCallback(() => {
|
|
27
|
+
const anchor = button.current;
|
|
28
|
+
const element = panel.current;
|
|
29
|
+
if (anchor && element)
|
|
30
|
+
placePopover(anchor, element, placement, align);
|
|
31
|
+
}, [placement, align]);
|
|
32
|
+
// Measured once it exists, then kept beside its control while anything under it scrolls.
|
|
33
|
+
useLayoutEffect(() => {
|
|
34
|
+
if (!open)
|
|
35
|
+
return;
|
|
36
|
+
place();
|
|
37
|
+
addEventListener('resize', place);
|
|
38
|
+
document.addEventListener('scroll', place, true);
|
|
39
|
+
return () => {
|
|
40
|
+
removeEventListener('resize', place);
|
|
41
|
+
document.removeEventListener('scroll', place, true);
|
|
42
|
+
};
|
|
43
|
+
}, [open, place]);
|
|
44
|
+
return (_jsxs("span", { className: "desk-popover-anchor", children: [trigger({ ref: button, 'aria-haspopup': 'dialog', 'aria-expanded': open, onClick: () => onOpenChange(!open) }), open && typeof document !== 'undefined' && createPortal(_jsx("div", { ref: panel, role: "dialog", "aria-label": label, className: "desk-popover", "data-placement": placement, "data-align": align, children: children }), document.body)] }));
|
|
45
|
+
}
|
|
46
|
+
const POPOVER_GAP = 6;
|
|
47
|
+
const POPOVER_MARGIN = 8;
|
|
48
|
+
/*
|
|
49
|
+
* A popover floats OVER its window rather than inside it. Drawn in the window's content it made that
|
|
50
|
+
* content taller or wider, so opening an (i) grew a scrollbar or pushed the layout — the window
|
|
51
|
+
* changed size to make room for a note about it. Here it is fixed to the viewport, kept inside the
|
|
52
|
+
* window it belongs to, flipped to the other side when its side has no room, and scrolls within
|
|
53
|
+
* itself when neither side has.
|
|
54
|
+
*/
|
|
55
|
+
function placePopover(anchor, element, placement, align) {
|
|
56
|
+
const box = anchor.getBoundingClientRect();
|
|
57
|
+
const frame = anchor.closest(`[${WINDOW_ATTRIBUTE}]`)?.getBoundingClientRect();
|
|
58
|
+
const bounds = {
|
|
59
|
+
left: (frame?.left ?? 0) + POPOVER_MARGIN,
|
|
60
|
+
top: (frame?.top ?? 0) + POPOVER_MARGIN,
|
|
61
|
+
right: (frame?.right ?? innerWidth) - POPOVER_MARGIN,
|
|
62
|
+
bottom: (frame?.bottom ?? innerHeight) - POPOVER_MARGIN,
|
|
63
|
+
};
|
|
64
|
+
element.style.maxHeight = '';
|
|
65
|
+
const { width, height } = element.getBoundingClientRect();
|
|
66
|
+
const roomBelow = bounds.bottom - box.bottom - POPOVER_GAP;
|
|
67
|
+
const roomAbove = box.top - bounds.top - POPOVER_GAP;
|
|
68
|
+
const fits = (side) => height <= (side === 'below' ? roomBelow : roomAbove);
|
|
69
|
+
const other = placement === 'below' ? 'above' : 'below';
|
|
70
|
+
const side = fits(placement) ? placement : fits(other) ? other : roomBelow >= roomAbove ? 'below' : 'above';
|
|
71
|
+
const below = side === 'below';
|
|
72
|
+
const room = Math.max(below ? roomBelow : roomAbove, 0);
|
|
73
|
+
const shown = Math.min(height, room);
|
|
74
|
+
const preferred = align === 'start' ? box.left : box.right - width;
|
|
75
|
+
const left = Math.max(bounds.left, Math.min(preferred, bounds.right - width));
|
|
76
|
+
element.style.left = `${left}px`;
|
|
77
|
+
element.style.top = `${below ? box.bottom + POPOVER_GAP : box.top - POPOVER_GAP - shown}px`;
|
|
78
|
+
if (height > room)
|
|
79
|
+
element.style.maxHeight = `${room}px`;
|
|
80
|
+
element.dataset.side = side;
|
|
27
81
|
}
|
|
28
82
|
export function Sheet({ open, onDismiss, title, description, actions, children }) {
|
|
29
83
|
const id = useId();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlays.js","sourceRoot":"","sources":["../../src/react/overlays.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE5H,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"overlays.js","sourceRoot":"","sources":["../../src/react/overlays.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,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AC,KAAK,CAAC,CAAA;IAClC,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAA;IAEjC,OAAO,CACL,eACE,SAAS,EAAC,YAAY,eACX,KAAK,CAAC,IAAI,IAAI,SAAS,EAClC,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;QAC/C,4EAA4E;QAC5E,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EACrC,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EACtC,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EACrC,aAAa,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,aAErC,eAAM,SAAS,EAAC,oBAAoB,YAAE,KAAK,CAAC,OAAO,GAAQ,EAC1D,KAAK,CAAC,MAAM,IAAI,CACf,KAAC,MAAM,IACL,IAAI,EAAC,OAAO,EACZ,MAAM,EAAC,OAAO,EACd,OAAO,EAAE,GAAG,EAAE;oBACZ,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAA;oBACxB,SAAS,EAAE,CAAA;gBACb,CAAC,YAEA,KAAK,CAAC,MAAM,CAAC,KAAK,GACZ,CACV,EACD,KAAC,MAAM,IAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAC,OAAO,gBAAY,SAAS,EAAC,OAAO,EAAE,SAAS,uBAElE,IACL,CACP,CAAA;AACH,CAAC"}
|
package/dist/react/tabs.d.ts
CHANGED
|
@@ -13,9 +13,14 @@ export interface TabsProps<T extends string> {
|
|
|
13
13
|
readonly onChange: (value: T) => void;
|
|
14
14
|
/** The accessible name for the strip, usually the window's, e.g. "Model Router". */
|
|
15
15
|
readonly label: string;
|
|
16
|
+
/**
|
|
17
|
+
* Controls for the whole window rather than one view — Refresh, say — at the end of the strip.
|
|
18
|
+
* Outside the tablist, so they are ordinary tab stops and not tabs.
|
|
19
|
+
*/
|
|
20
|
+
readonly actions?: ReactNode;
|
|
16
21
|
/** The selected view. Rendered inside the tabpanel the selected tab controls. */
|
|
17
22
|
readonly children?: ReactNode;
|
|
18
23
|
readonly className?: string;
|
|
19
24
|
}
|
|
20
|
-
export declare function Tabs<T extends string>({ tabs, value, onChange, label, children, className }: TabsProps<T>): import("react").JSX.Element;
|
|
25
|
+
export declare function Tabs<T extends string>({ tabs, value, onChange, label, actions, children, className }: TabsProps<T>): import("react").JSX.Element;
|
|
21
26
|
//# sourceMappingURL=tabs.d.ts.map
|
package/dist/react/tabs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/react/tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAcrD,MAAM,WAAW,GAAG,CAAC,CAAC,SAAS,MAAM;IACnC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IACjB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,MAAM;IACzC,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAChC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IACjB,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;IACrC,oFAAoF;IACpF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,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E,EAAE,SAAS,CAAC,CAAC,CAAC,+BAqDlH"}
|
package/dist/react/tabs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId, useRef } from 'react';
|
|
3
3
|
const KEYS = { ArrowRight: 1, ArrowLeft: -1, Home: 'first', End: 'last' };
|
|
4
|
-
export function Tabs({ tabs, value, onChange, label, children, className }) {
|
|
4
|
+
export function Tabs({ tabs, value, onChange, label, actions, children, className }) {
|
|
5
5
|
const id = useId();
|
|
6
6
|
const strip = useRef(null);
|
|
7
7
|
const tabId = (v) => `${id}-tab-${v}`;
|
|
@@ -21,9 +21,9 @@ export function Tabs({ tabs, value, onChange, label, children, className }) {
|
|
|
21
21
|
onChange(next.value);
|
|
22
22
|
strip.current?.querySelector(`[data-value="${CSS.escape(next.value)}"]`)?.focus();
|
|
23
23
|
};
|
|
24
|
-
return (_jsxs("div", { className: ['desk-tabs', className].filter(Boolean).join(' '), children: [_jsx("div", { ref: strip, role: "tablist", "aria-label": label, className: "desk-tablist", onKeyDown: move, children: tabs.map(tab => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
return (_jsxs("div", { className: ['desk-tabs', className].filter(Boolean).join(' '), children: [_jsxs("div", { className: "desk-tabbar", children: [_jsx("div", { ref: strip, role: "tablist", "aria-label": label, className: "desk-tablist", onKeyDown: move, children: tabs.map(tab => {
|
|
25
|
+
const selected = tab.value === value;
|
|
26
|
+
return (_jsxs("button", { id: tabId(tab.value), type: "button", role: "tab", "aria-selected": selected, "aria-controls": selected ? panelId : undefined, "data-value": tab.value, className: "desk-tab", tabIndex: selected ? 0 : -1, disabled: tab.disabled, onClick: () => onChange(tab.value), children: [tab.label, tab.badge != null && _jsx("span", { className: "desk-tab-badge", children: tab.badge })] }, tab.value));
|
|
27
|
+
}) }), actions != null && _jsx("div", { className: "desk-tabs-actions", children: actions })] }), _jsx("div", { role: "tabpanel", id: panelId, "aria-labelledby": tabId(value), className: "desk-tabpanel", children: children })] }));
|
|
28
28
|
}
|
|
29
29
|
//# sourceMappingURL=tabs.js.map
|
package/dist/react/tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/react/tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/react/tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAwCrC,MAAM,IAAI,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAW,CAAA;AAElF,MAAM,UAAU,IAAI,CAAmB,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAgB;IACjH,MAAM,EAAE,GAAG,KAAK,EAAE,CAAA;IAClB,MAAM,KAAK,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC1C,MAAM,KAAK,GAAG,CAAC,CAAI,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAA;IACxC,MAAM,OAAO,GAAG,GAAG,EAAE,QAAQ,CAAA;IAE7B,MAAM,IAAI,GAAG,CAAC,KAAoC,EAAE,EAAE;QACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAwB,CAAC,CAAA;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;QAC5C,IAAI,GAAG,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM;YAAE,OAA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AAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,gBACjC,GAAG,CAAC,KAAK,EACrB,SAAS,EAAC,UAAU,EACpB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3B,QAAQ,EAAE,GAAG,CAAC,QAAQ,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,aAEjC,GAAG,CAAC,KAAK,EACT,GAAG,CAAC,KAAK,IAAI,IAAI,IAAI,eAAM,SAAS,EAAC,gBAAgB,YAAE,GAAG,CAAC,KAAK,GAAQ,KAbpE,GAAG,CAAC,KAAK,CAcP,CACV,CAAA;wBACH,CAAC,CAAC,GACE,EACL,OAAO,IAAI,IAAI,IAAI,cAAK,SAAS,EAAC,mBAAmB,YAAE,OAAO,GAAO,IAClE,EACN,cAAK,IAAI,EAAC,UAAU,EAAC,EAAE,EAAE,OAAO,qBAAmB,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAC,eAAe,YACvF,QAAQ,GACL,IACF,CACP,CAAA;AACH,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -376,7 +376,7 @@ SearchCommand = 'desk.search' // a menu item can open i
|
|
|
376
376
|
```tsx
|
|
377
377
|
<Button intent?={'normal'|'default'|'quiet'|'destructive'} size?={'regular'|'small'} icon? … />
|
|
378
378
|
<SegmentedControl options={{value,label,icon?,disabled?}[]} value onChange label size? disabled? width?={fit|fill} />
|
|
379
|
-
<Tabs tabs={{value,label,badge?,disabled?}[]} value onChange label
|
|
379
|
+
<Tabs tabs={{value,label,badge?,disabled?}[]} value onChange label actions?>{selected view}</Tabs>
|
|
380
380
|
// switches the view below; a segmented control chooses
|
|
381
381
|
<Toggle checked onChange label? description? disabled? aria-label? /> // applies at once
|
|
382
382
|
<Checkbox checked indeterminate? onChange label? description? disabled? /> // waits for Save
|
|
@@ -420,7 +420,7 @@ sortable headings. It renders what it is given — no paging, no fetching.
|
|
|
420
420
|
### Overlays
|
|
421
421
|
|
|
422
422
|
```tsx
|
|
423
|
-
<Popover open onOpenChange label trigger={(props) => <Button {...props} />} placement? align? />
|
|
423
|
+
<Popover open onOpenChange label trigger={(props) => <Button {...props} />} placement? align? /> // floats over its window, clamped to it; never resizes it
|
|
424
424
|
<Sheet open onDismiss title description? actions? /> // renders inside its own window
|
|
425
425
|
<Alert open title message? confirmLabel onConfirm onCancel cancelLabel? destructive? />
|
|
426
426
|
<ToastProvider>; useToast(): { show(toast): string; dismiss(id): void }
|
package/package.json
CHANGED
package/src/css/controls.css
CHANGED
|
@@ -721,14 +721,30 @@
|
|
|
721
721
|
* radius, so a tab's hover wash and its underline read as one rounded shape, and a look that
|
|
722
722
|
* rounds its buttons rounds its tabs to match.
|
|
723
723
|
*/
|
|
724
|
-
.desk-
|
|
724
|
+
.desk-tabbar {
|
|
725
725
|
display: flex;
|
|
726
726
|
flex-wrap: wrap;
|
|
727
|
-
|
|
727
|
+
align-items: flex-end;
|
|
728
|
+
gap: var(--desk-space-2);
|
|
728
729
|
border-bottom: 1px solid var(--desk-rule);
|
|
729
730
|
margin-bottom: var(--desk-space-3);
|
|
730
731
|
}
|
|
731
732
|
|
|
733
|
+
.desk-tablist {
|
|
734
|
+
display: flex;
|
|
735
|
+
flex-wrap: wrap;
|
|
736
|
+
gap: 2px;
|
|
737
|
+
margin-right: auto;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/* Sits on the strip's baseline, clear of the rule, without stretching the tabs to its height. */
|
|
741
|
+
.desk-tabs-actions {
|
|
742
|
+
display: flex;
|
|
743
|
+
align-items: center;
|
|
744
|
+
gap: var(--desk-space-2);
|
|
745
|
+
padding-bottom: var(--desk-space-1);
|
|
746
|
+
}
|
|
747
|
+
|
|
732
748
|
.desk-tab {
|
|
733
749
|
display: inline-flex;
|
|
734
750
|
align-items: center;
|
package/src/css/overlays.css
CHANGED
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.desk-popover {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/* Fixed, and placed by script beside its trigger: a popover overlaps its window, never grows it. */
|
|
10
|
+
position: fixed;
|
|
11
|
+
/* Above a sheet or an alert (1300): it is drawn in the body now, not inside the layer that opened it. */
|
|
12
|
+
z-index: 1350;
|
|
13
|
+
box-sizing: border-box;
|
|
11
14
|
min-width: 220px;
|
|
12
15
|
max-width: min(360px, calc(100vw - 24px));
|
|
16
|
+
overflow: auto;
|
|
13
17
|
padding: var(--desk-space-3);
|
|
14
18
|
border: 1px solid var(--desk-rule);
|
|
15
19
|
border-radius: 12px;
|
|
@@ -18,22 +22,6 @@
|
|
|
18
22
|
animation: desk-menu-in .14s var(--desk-ease);
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
.desk-popover[data-placement="below"] {
|
|
22
|
-
top: calc(100% + 6px);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.desk-popover[data-placement="above"] {
|
|
26
|
-
bottom: calc(100% + 6px);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.desk-popover[data-align="start"] {
|
|
30
|
-
left: 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.desk-popover[data-align="end"] {
|
|
34
|
-
right: 0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
25
|
/* A sheet belongs to its window: the scrim covers that window and nothing else. */
|
|
38
26
|
.desk-sheet-scrim,
|
|
39
27
|
.desk-alert-scrim {
|
package/src/react/overlays.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
|
2
2
|
import type { ReactElement, ReactNode, RefObject } from 'react'
|
|
3
3
|
import { createPortal } from 'react-dom'
|
|
4
|
-
import { windowElement } from '../core/commands.js'
|
|
4
|
+
import { WINDOW_ATTRIBUTE, windowElement } from '../core/commands.js'
|
|
5
5
|
import { Button } from './controls.js'
|
|
6
6
|
import { useWindowId } from './context.js'
|
|
7
7
|
import { useFocusTrap, useLayer } from './layers.js'
|
|
@@ -53,18 +53,74 @@ export function Popover({ open, onOpenChange, label, trigger, placement = 'below
|
|
|
53
53
|
return () => document.removeEventListener('pointerdown', onPointerDown, true)
|
|
54
54
|
}, [open, onOpenChange])
|
|
55
55
|
|
|
56
|
+
const place = useCallback(() => {
|
|
57
|
+
const anchor = button.current
|
|
58
|
+
const element = panel.current
|
|
59
|
+
if (anchor && element) placePopover(anchor, element, placement, align)
|
|
60
|
+
}, [placement, align])
|
|
61
|
+
|
|
62
|
+
// Measured once it exists, then kept beside its control while anything under it scrolls.
|
|
63
|
+
useLayoutEffect(() => {
|
|
64
|
+
if (!open) return
|
|
65
|
+
place()
|
|
66
|
+
addEventListener('resize', place)
|
|
67
|
+
document.addEventListener('scroll', place, true)
|
|
68
|
+
return () => {
|
|
69
|
+
removeEventListener('resize', place)
|
|
70
|
+
document.removeEventListener('scroll', place, true)
|
|
71
|
+
}
|
|
72
|
+
}, [open, place])
|
|
73
|
+
|
|
56
74
|
return (
|
|
57
75
|
<span className="desk-popover-anchor">
|
|
58
76
|
{trigger({ ref: button, 'aria-haspopup': 'dialog', 'aria-expanded': open, onClick: () => onOpenChange(!open) })}
|
|
59
|
-
{open && (
|
|
77
|
+
{open && typeof document !== 'undefined' && createPortal(
|
|
60
78
|
<div ref={panel} role="dialog" aria-label={label} className="desk-popover" data-placement={placement} data-align={align}>
|
|
61
79
|
{children}
|
|
62
|
-
</div
|
|
80
|
+
</div>,
|
|
81
|
+
document.body,
|
|
63
82
|
)}
|
|
64
83
|
</span>
|
|
65
84
|
)
|
|
66
85
|
}
|
|
67
86
|
|
|
87
|
+
const POPOVER_GAP = 6
|
|
88
|
+
const POPOVER_MARGIN = 8
|
|
89
|
+
|
|
90
|
+
/*
|
|
91
|
+
* A popover floats OVER its window rather than inside it. Drawn in the window's content it made that
|
|
92
|
+
* content taller or wider, so opening an (i) grew a scrollbar or pushed the layout — the window
|
|
93
|
+
* changed size to make room for a note about it. Here it is fixed to the viewport, kept inside the
|
|
94
|
+
* window it belongs to, flipped to the other side when its side has no room, and scrolls within
|
|
95
|
+
* itself when neither side has.
|
|
96
|
+
*/
|
|
97
|
+
function placePopover(anchor: HTMLElement, element: HTMLElement, placement: 'below' | 'above', align: 'start' | 'end') {
|
|
98
|
+
const box = anchor.getBoundingClientRect()
|
|
99
|
+
const frame = anchor.closest(`[${WINDOW_ATTRIBUTE}]`)?.getBoundingClientRect()
|
|
100
|
+
const bounds = {
|
|
101
|
+
left: (frame?.left ?? 0) + POPOVER_MARGIN,
|
|
102
|
+
top: (frame?.top ?? 0) + POPOVER_MARGIN,
|
|
103
|
+
right: (frame?.right ?? innerWidth) - POPOVER_MARGIN,
|
|
104
|
+
bottom: (frame?.bottom ?? innerHeight) - POPOVER_MARGIN,
|
|
105
|
+
}
|
|
106
|
+
element.style.maxHeight = ''
|
|
107
|
+
const { width, height } = element.getBoundingClientRect()
|
|
108
|
+
const roomBelow = bounds.bottom - box.bottom - POPOVER_GAP
|
|
109
|
+
const roomAbove = box.top - bounds.top - POPOVER_GAP
|
|
110
|
+
const fits = (side: 'below' | 'above') => height <= (side === 'below' ? roomBelow : roomAbove)
|
|
111
|
+
const other = placement === 'below' ? 'above' : 'below'
|
|
112
|
+
const side = fits(placement) ? placement : fits(other) ? other : roomBelow >= roomAbove ? 'below' : 'above'
|
|
113
|
+
const below = side === 'below'
|
|
114
|
+
const room = Math.max(below ? roomBelow : roomAbove, 0)
|
|
115
|
+
const shown = Math.min(height, room)
|
|
116
|
+
const preferred = align === 'start' ? box.left : box.right - width
|
|
117
|
+
const left = Math.max(bounds.left, Math.min(preferred, bounds.right - width))
|
|
118
|
+
element.style.left = `${left}px`
|
|
119
|
+
element.style.top = `${below ? box.bottom + POPOVER_GAP : box.top - POPOVER_GAP - shown}px`
|
|
120
|
+
if (height > room) element.style.maxHeight = `${room}px`
|
|
121
|
+
element.dataset.side = side
|
|
122
|
+
}
|
|
123
|
+
|
|
68
124
|
/* ── Sheet: a task that belongs to one window, and blocks only that window ── */
|
|
69
125
|
|
|
70
126
|
export interface SheetProps {
|
package/src/react/tabs.tsx
CHANGED
|
@@ -28,6 +28,11 @@ export interface TabsProps<T extends string> {
|
|
|
28
28
|
readonly onChange: (value: T) => void
|
|
29
29
|
/** The accessible name for the strip, usually the window's, e.g. "Model Router". */
|
|
30
30
|
readonly label: string
|
|
31
|
+
/**
|
|
32
|
+
* Controls for the whole window rather than one view — Refresh, say — at the end of the strip.
|
|
33
|
+
* Outside the tablist, so they are ordinary tab stops and not tabs.
|
|
34
|
+
*/
|
|
35
|
+
readonly actions?: ReactNode
|
|
31
36
|
/** The selected view. Rendered inside the tabpanel the selected tab controls. */
|
|
32
37
|
readonly children?: ReactNode
|
|
33
38
|
readonly className?: string
|
|
@@ -35,7 +40,7 @@ export interface TabsProps<T extends string> {
|
|
|
35
40
|
|
|
36
41
|
const KEYS = { ArrowRight: 1, ArrowLeft: -1, Home: 'first', End: 'last' } as const
|
|
37
42
|
|
|
38
|
-
export function Tabs<T extends string>({ tabs, value, onChange, label, children, className }: TabsProps<T>) {
|
|
43
|
+
export function Tabs<T extends string>({ tabs, value, onChange, label, actions, children, className }: TabsProps<T>) {
|
|
39
44
|
const id = useId()
|
|
40
45
|
const strip = useRef<HTMLDivElement>(null)
|
|
41
46
|
const tabId = (v: T) => `${id}-tab-${v}`
|
|
@@ -57,28 +62,31 @@ export function Tabs<T extends string>({ tabs, value, onChange, label, children,
|
|
|
57
62
|
|
|
58
63
|
return (
|
|
59
64
|
<div className={['desk-tabs', className].filter(Boolean).join(' ')}>
|
|
60
|
-
<div
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
65
|
+
<div className="desk-tabbar">
|
|
66
|
+
<div ref={strip} role="tablist" aria-label={label} className="desk-tablist" onKeyDown={move}>
|
|
67
|
+
{tabs.map(tab => {
|
|
68
|
+
const selected = tab.value === value
|
|
69
|
+
return (
|
|
70
|
+
<button
|
|
71
|
+
key={tab.value}
|
|
72
|
+
id={tabId(tab.value)}
|
|
73
|
+
type="button"
|
|
74
|
+
role="tab"
|
|
75
|
+
aria-selected={selected}
|
|
76
|
+
aria-controls={selected ? panelId : undefined}
|
|
77
|
+
data-value={tab.value}
|
|
78
|
+
className="desk-tab"
|
|
79
|
+
tabIndex={selected ? 0 : -1}
|
|
80
|
+
disabled={tab.disabled}
|
|
81
|
+
onClick={() => onChange(tab.value)}
|
|
82
|
+
>
|
|
83
|
+
{tab.label}
|
|
84
|
+
{tab.badge != null && <span className="desk-tab-badge">{tab.badge}</span>}
|
|
85
|
+
</button>
|
|
86
|
+
)
|
|
87
|
+
})}
|
|
88
|
+
</div>
|
|
89
|
+
{actions != null && <div className="desk-tabs-actions">{actions}</div>}
|
|
82
90
|
</div>
|
|
83
91
|
<div role="tabpanel" id={panelId} aria-labelledby={tabId(value)} className="desk-tabpanel">
|
|
84
92
|
{children}
|