@cloudgrid-io/ui 0.63.0 → 0.65.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/blocks/add-tile.d.ts +16 -1
- package/dist/blocks/add-tile.d.ts.map +1 -1
- package/dist/blocks/add-tile.js +20 -3
- package/dist/blocks/add-tile.js.map +1 -1
- package/dist/blocks/avatar-picker.d.ts +19 -1
- package/dist/blocks/avatar-picker.d.ts.map +1 -1
- package/dist/blocks/avatar-picker.js +16 -3
- package/dist/blocks/avatar-picker.js.map +1 -1
- package/dist/blocks/bento-card-hint.d.ts +16 -0
- package/dist/blocks/bento-card-hint.d.ts.map +1 -0
- package/dist/blocks/bento-card-hint.js +23 -0
- package/dist/blocks/bento-card-hint.js.map +1 -0
- package/dist/blocks/bento-card.d.ts +59 -0
- package/dist/blocks/bento-card.d.ts.map +1 -0
- package/dist/blocks/bento-card.js +59 -0
- package/dist/blocks/bento-card.js.map +1 -0
- package/dist/blocks/coming-soon-hint.d.ts.map +1 -1
- package/dist/blocks/coming-soon-hint.js +110 -7
- package/dist/blocks/coming-soon-hint.js.map +1 -1
- package/dist/blocks/creation-search.d.ts +147 -0
- package/dist/blocks/creation-search.d.ts.map +1 -0
- package/dist/blocks/creation-search.js +239 -0
- package/dist/blocks/creation-search.js.map +1 -0
- package/dist/blocks/entity-card.d.ts +80 -2
- package/dist/blocks/entity-card.d.ts.map +1 -1
- package/dist/blocks/entity-card.js +162 -17
- package/dist/blocks/entity-card.js.map +1 -1
- package/dist/blocks/from-your-grid.d.ts +66 -0
- package/dist/blocks/from-your-grid.d.ts.map +1 -0
- package/dist/blocks/from-your-grid.js +63 -0
- package/dist/blocks/from-your-grid.js.map +1 -0
- package/dist/blocks/grid-profile.d.ts +17 -1
- package/dist/blocks/grid-profile.d.ts.map +1 -1
- package/dist/blocks/grid-profile.js +66 -5
- package/dist/blocks/grid-profile.js.map +1 -1
- package/dist/blocks/home-bento.d.ts +86 -0
- package/dist/blocks/home-bento.d.ts.map +1 -0
- package/dist/blocks/home-bento.js +87 -0
- package/dist/blocks/home-bento.js.map +1 -0
- package/dist/blocks/home-empty-illustrations.d.ts +37 -0
- package/dist/blocks/home-empty-illustrations.d.ts.map +1 -0
- package/dist/blocks/home-empty-illustrations.js +47 -0
- package/dist/blocks/home-empty-illustrations.js.map +1 -0
- package/dist/blocks/home-pinned.d.ts +120 -0
- package/dist/blocks/home-pinned.d.ts.map +1 -0
- package/dist/blocks/home-pinned.js +58 -0
- package/dist/blocks/home-pinned.js.map +1 -0
- package/dist/blocks/icons.d.ts +39 -0
- package/dist/blocks/icons.d.ts.map +1 -1
- package/dist/blocks/icons.js +39 -0
- package/dist/blocks/icons.js.map +1 -1
- package/dist/blocks/image-adjust-dialog.d.ts +171 -0
- package/dist/blocks/image-adjust-dialog.d.ts.map +1 -0
- package/dist/blocks/image-adjust-dialog.js +396 -0
- package/dist/blocks/image-adjust-dialog.js.map +1 -0
- package/dist/blocks/inspiration-cards.d.ts +241 -0
- package/dist/blocks/inspiration-cards.d.ts.map +1 -0
- package/dist/blocks/inspiration-cards.js +234 -0
- package/dist/blocks/inspiration-cards.js.map +1 -0
- package/dist/blocks/liquid-glass.d.ts +106 -0
- package/dist/blocks/liquid-glass.d.ts.map +1 -0
- package/dist/blocks/liquid-glass.js +283 -0
- package/dist/blocks/liquid-glass.js.map +1 -0
- package/dist/blocks/meter.d.ts +5 -2
- package/dist/blocks/meter.d.ts.map +1 -1
- package/dist/blocks/meter.js +4 -0
- package/dist/blocks/meter.js.map +1 -1
- package/dist/blocks/motion.d.ts +46 -0
- package/dist/blocks/motion.d.ts.map +1 -0
- package/dist/blocks/motion.js +144 -0
- package/dist/blocks/motion.js.map +1 -0
- package/dist/blocks/needs-attention.d.ts +78 -0
- package/dist/blocks/needs-attention.d.ts.map +1 -0
- package/dist/blocks/needs-attention.js +29 -0
- package/dist/blocks/needs-attention.js.map +1 -0
- package/dist/blocks/phosphor-marks.d.ts +16 -0
- package/dist/blocks/phosphor-marks.d.ts.map +1 -1
- package/dist/blocks/phosphor-marks.js +24 -0
- package/dist/blocks/phosphor-marks.js.map +1 -1
- package/dist/blocks/ranked-list.d.ts +7 -1
- package/dist/blocks/ranked-list.d.ts.map +1 -1
- package/dist/blocks/ranked-list.js +8 -6
- package/dist/blocks/ranked-list.js.map +1 -1
- package/dist/blocks/recent-plugs.d.ts +66 -0
- package/dist/blocks/recent-plugs.d.ts.map +1 -0
- package/dist/blocks/recent-plugs.js +20 -0
- package/dist/blocks/recent-plugs.js.map +1 -0
- package/dist/blocks/shared-grid-illustration.d.ts +55 -0
- package/dist/blocks/shared-grid-illustration.d.ts.map +1 -0
- package/dist/blocks/shared-grid-illustration.js +81 -0
- package/dist/blocks/shared-grid-illustration.js.map +1 -0
- package/dist/blocks/shelf-strip.d.ts +36 -0
- package/dist/blocks/shelf-strip.d.ts.map +1 -0
- package/dist/blocks/shelf-strip.js +32 -0
- package/dist/blocks/shelf-strip.js.map +1 -0
- package/dist/blocks/stat-tile.d.ts +17 -1
- package/dist/blocks/stat-tile.d.ts.map +1 -1
- package/dist/blocks/stat-tile.js +4 -1
- package/dist/blocks/stat-tile.js.map +1 -1
- package/dist/blocks/top-creations.d.ts +76 -0
- package/dist/blocks/top-creations.d.ts.map +1 -0
- package/dist/blocks/top-creations.js +54 -0
- package/dist/blocks/top-creations.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/fit.d.ts +39 -0
- package/dist/lib/fit.d.ts.map +1 -0
- package/dist/lib/fit.js +92 -0
- package/dist/lib/fit.js.map +1 -0
- package/dist/lib/motion.d.ts +126 -0
- package/dist/lib/motion.d.ts.map +1 -0
- package/dist/lib/motion.js +132 -0
- package/dist/lib/motion.js.map +1 -0
- package/dist/ui/dialog.d.ts +7 -1
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +2 -2
- package/dist/ui/dialog.js.map +1 -1
- package/package.json +2 -1
|
@@ -14,10 +14,25 @@ import { type EntityCardTileSize } from "./entity-card.js";
|
|
|
14
14
|
* focus ring are the button's, as drawn. With `href` it renders as a link
|
|
15
15
|
* through `linkComponent` (Next's `Link`) and keeps the link role, the shape
|
|
16
16
|
* `EmptyCreations` uses; with only `onClick` it is a button.
|
|
17
|
+
*
|
|
18
|
+
* ## The Home look (#530)
|
|
19
|
+
*
|
|
20
|
+
* `look="home"` is the box of `EntityCard look="home"` (`ENTITY_CARD_HOME_BOX`,
|
|
21
|
+
* 302 x 238), and `span` is how many of those card slots it takes, so that on
|
|
22
|
+
* the new Home it fills the row when there are 1 to 3 creations (Asaf,
|
|
23
|
+
* 2026-11-20): `span={4 - creations}`. The widths count the Home row's 24px
|
|
24
|
+
* gap between slots, so pass `gap={24}` to the `ScrollRail` around it. The
|
|
25
|
+
* rail, its side arrows and when the tile shows at all are unchanged and the
|
|
26
|
+
* caller's, as today.
|
|
17
27
|
*/
|
|
18
|
-
declare
|
|
28
|
+
export declare const ADD_TILE_HOME_SPAN: Record<1 | 2 | 3, string>;
|
|
29
|
+
declare function AddTile({ size, look, span, label, href, linkComponent, onClick, className, ...props }: Omit<React.ComponentProps<"div">, "children" | "onClick"> & {
|
|
19
30
|
/** The card box it matches: `tile-lg` 329x242 (default) or `tile` 250x184. */
|
|
20
31
|
size?: EntityCardTileSize;
|
|
32
|
+
/** `"home"`: the Home card's box, 302 x 238, in place of `size` (#530). */
|
|
33
|
+
look?: "home";
|
|
34
|
+
/** With `look="home"`: how many card slots it fills, 1 to 3. Default 1. */
|
|
35
|
+
span?: 1 | 2 | 3;
|
|
21
36
|
/** The button's label, and so its accessible name. */
|
|
22
37
|
label?: string;
|
|
23
38
|
/** Where Add goes. Renders the control as a link. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-tile.d.ts","sourceRoot":"","sources":["../../src/blocks/add-tile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,
|
|
1
|
+
{"version":3,"file":"add-tile.d.ts","sourceRoot":"","sources":["../../src/blocks/add-tile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EAA8C,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAG/G;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,CAMxD,CAAA;AAED,iBAAS,OAAO,CAAC,EACf,IAAgB,EAChB,IAAI,EACJ,IAAQ,EACR,KAAa,EACb,IAAI,EACJ,aAAa,EACb,OAAO,EACP,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,GAAG;IAC7D,8EAA8E;IAC9E,IAAI,CAAC,EAAE,kBAAkB,CAAA;IACzB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2EAA2E;IAC3E,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAChB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mEAAmE;IACnE,aAAa,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACjC,kFAAkF;IAClF,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAA;CAC/C,qBAuCA;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
package/dist/blocks/add-tile.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { cn } from "../lib/cloudgrid-cn.js";
|
|
4
4
|
import { Button } from "../ui/button.js";
|
|
5
5
|
import { DASHED_LINE_CLASS } from "./dashed-line.js";
|
|
6
|
-
import { ENTITY_CARD_TILE_BOX } from "./entity-card.js";
|
|
6
|
+
import { ENTITY_CARD_HOME_BOX, ENTITY_CARD_TILE_BOX } from "./entity-card.js";
|
|
7
7
|
import { PlusIcon } from "./icons.js";
|
|
8
8
|
/**
|
|
9
9
|
* The dashed Add tile at the end of a row of cards (#382, spec §4.4, Figma
|
|
@@ -19,11 +19,28 @@ import { PlusIcon } from "./icons.js";
|
|
|
19
19
|
* focus ring are the button's, as drawn. With `href` it renders as a link
|
|
20
20
|
* through `linkComponent` (Next's `Link`) and keeps the link role, the shape
|
|
21
21
|
* `EmptyCreations` uses; with only `onClick` it is a button.
|
|
22
|
+
*
|
|
23
|
+
* ## The Home look (#530)
|
|
24
|
+
*
|
|
25
|
+
* `look="home"` is the box of `EntityCard look="home"` (`ENTITY_CARD_HOME_BOX`,
|
|
26
|
+
* 302 x 238), and `span` is how many of those card slots it takes, so that on
|
|
27
|
+
* the new Home it fills the row when there are 1 to 3 creations (Asaf,
|
|
28
|
+
* 2026-11-20): `span={4 - creations}`. The widths count the Home row's 24px
|
|
29
|
+
* gap between slots, so pass `gap={24}` to the `ScrollRail` around it. The
|
|
30
|
+
* rail, its side arrows and when the tile shows at all are unchanged and the
|
|
31
|
+
* caller's, as today.
|
|
22
32
|
*/
|
|
23
|
-
|
|
33
|
+
export const ADD_TILE_HOME_SPAN = {
|
|
34
|
+
1: ENTITY_CARD_HOME_BOX,
|
|
35
|
+
// 2 x 302 + 24
|
|
36
|
+
2: "w-157 h-59.5",
|
|
37
|
+
// 3 x 302 + 2 x 24
|
|
38
|
+
3: "w-238.5 h-59.5",
|
|
39
|
+
};
|
|
40
|
+
function AddTile({ size = "tile-lg", look, span = 1, label = "Add", href, linkComponent, onClick, className, ...props }) {
|
|
24
41
|
const Link = linkComponent ?? "a";
|
|
25
42
|
const content = (_jsxs(_Fragment, { children: [label, _jsx(PlusIcon, {})] }));
|
|
26
|
-
return (_jsx("div", { "data-slot": "add-tile", className: cn("flex shrink-0 items-center justify-center rounded-container", ENTITY_CARD_TILE_BOX[size], DASHED_LINE_CLASS, className), ...props, children: href !== undefined ? (_jsx(Button, { "data-slot": "add-tile-action", variant: "cta", size: "2xl", render: _jsx(Link, { href: href }), nativeButton: false, role: "link", onClick: onClick, children: content })) : (_jsx(Button, { "data-slot": "add-tile-action", variant: "cta", size: "2xl", type: "button", onClick: onClick, children: content })) }));
|
|
43
|
+
return (_jsx("div", { "data-slot": "add-tile", className: cn("flex shrink-0 items-center justify-center rounded-container", look === "home" ? ADD_TILE_HOME_SPAN[span] : ENTITY_CARD_TILE_BOX[size], DASHED_LINE_CLASS, className), ...props, children: href !== undefined ? (_jsx(Button, { "data-slot": "add-tile-action", variant: "cta", size: "2xl", render: _jsx(Link, { href: href }), nativeButton: false, role: "link", onClick: onClick, children: content })) : (_jsx(Button, { "data-slot": "add-tile-action", variant: "cta", size: "2xl", type: "button", onClick: onClick, children: content })) }));
|
|
27
44
|
}
|
|
28
45
|
export { AddTile };
|
|
29
46
|
//# sourceMappingURL=add-tile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-tile.js","sourceRoot":"","sources":["../../src/blocks/add-tile.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAA2B,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"add-tile.js","sourceRoot":"","sources":["../../src/blocks/add-tile.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAC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CAAC,CACF,KAAC,MAAM,iBAAW,iBAAiB,EAAC,OAAO,EAAC,KAAK,EAAC,IAAI,EAAC,KAAK,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,YACxF,OAAO,GACD,CACV,GACG,CACP,CAAA;AACH,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type AvatarDiameter } from "./avatar.js";
|
|
3
|
+
import { type ImageAdjustStepOptions } from "./image-adjust-dialog.js";
|
|
3
4
|
/**
|
|
4
5
|
* A person's own avatar, pressed to choose a new photo (#367).
|
|
5
6
|
*
|
|
@@ -56,6 +57,17 @@ import { type AvatarDiameter } from "./avatar.js";
|
|
|
56
57
|
* white, so the overlay reads the same over a white photo, the initials, a
|
|
57
58
|
* purple panel or ink. The ring is `ring-ring`, which flips per surface.
|
|
58
59
|
* Tokens only.
|
|
60
|
+
*
|
|
61
|
+
* ## The adjust step (ui#527), opt-in
|
|
62
|
+
*
|
|
63
|
+
* With `adjust`, a good file does not go straight to `onSelectFile`: it opens
|
|
64
|
+
* `ImageAdjustDialog` in the avatar's circle, the person moves and zooms it,
|
|
65
|
+
* and Save calls `onSelectFile` with the adjusted square (WebP, else PNG, at
|
|
66
|
+
* `outputSize`, 512 by default). Cancel calls nothing. The type and size
|
|
67
|
+
* checks run first, on the picked file, exactly as without it; a rejected
|
|
68
|
+
* file never opens the dialog. Without `adjust`, nothing changes: the markup
|
|
69
|
+
* and the behaviour are 0.63.0's, byte for byte, and so is the markup with it
|
|
70
|
+
* until a file is picked.
|
|
59
71
|
*/
|
|
60
72
|
/** The picker's default list: JPG, PNG and WebP. */
|
|
61
73
|
export declare const AVATAR_PICKER_ACCEPT = "image/jpeg,image/png,image/webp";
|
|
@@ -98,8 +110,14 @@ export type AvatarPickerProps = {
|
|
|
98
110
|
disabled?: boolean;
|
|
99
111
|
/** The button's accessible name. Defaults to "Change photo". */
|
|
100
112
|
label?: string;
|
|
113
|
+
/**
|
|
114
|
+
* ui#527: after a good pick, move and zoom the picture in the circle first;
|
|
115
|
+
* Save calls `onSelectFile` with the adjusted square. `true`, or the title
|
|
116
|
+
* ("Adjust photo") and the output's side (512).
|
|
117
|
+
*/
|
|
118
|
+
adjust?: boolean | ImageAdjustStepOptions;
|
|
101
119
|
className?: string;
|
|
102
120
|
};
|
|
103
|
-
declare function AvatarPicker({ name, seed, src, size, onSelectFile, onReject, accept, maxBytes, pending, disabled, label, className, }: AvatarPickerProps): React.JSX.Element;
|
|
121
|
+
declare function AvatarPicker({ name, seed, src, size, onSelectFile, onReject, accept, maxBytes, pending, disabled, label, adjust, className, }: AvatarPickerProps): React.JSX.Element;
|
|
104
122
|
export { AvatarPicker };
|
|
105
123
|
//# sourceMappingURL=avatar-picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar-picker.d.ts","sourceRoot":"","sources":["../../src/blocks/avatar-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"avatar-picker.d.ts","sourceRoot":"","sources":["../../src/blocks/avatar-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAElE,OAAO,EAAsB,KAAK,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAGnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,oCAAoC,CAAA;AAErE,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AAEjD,yCAAyC;AACzC,MAAM,MAAM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E,OAAO,GAAG,sBAAsB,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAKD,iBAAS,YAAY,CAAC,EACpB,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,IAAS,EACT,YAAY,EACZ,QAAQ,EACR,MAA6B,EAC7B,QAAQ,EACR,OAAe,EACf,QAAgB,EAChB,KAA2B,EAC3B,MAAM,EACN,SAAS,GACV,EAAE,iBAAiB,qBAmEnB;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -4,6 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { cn } from "../lib/cloudgrid-cn.js";
|
|
5
5
|
import { Avatar } from "./avatar.js";
|
|
6
6
|
import { ChangePhotoIcon } from "./icons.js";
|
|
7
|
+
import { useImageAdjustStep } from "./image-adjust-dialog.js";
|
|
7
8
|
import { Spinner } from "../ui/spinner.js";
|
|
8
9
|
/**
|
|
9
10
|
* A person's own avatar, pressed to choose a new photo (#367).
|
|
@@ -61,6 +62,17 @@ import { Spinner } from "../ui/spinner.js";
|
|
|
61
62
|
* white, so the overlay reads the same over a white photo, the initials, a
|
|
62
63
|
* purple panel or ink. The ring is `ring-ring`, which flips per surface.
|
|
63
64
|
* Tokens only.
|
|
65
|
+
*
|
|
66
|
+
* ## The adjust step (ui#527), opt-in
|
|
67
|
+
*
|
|
68
|
+
* With `adjust`, a good file does not go straight to `onSelectFile`: it opens
|
|
69
|
+
* `ImageAdjustDialog` in the avatar's circle, the person moves and zooms it,
|
|
70
|
+
* and Save calls `onSelectFile` with the adjusted square (WebP, else PNG, at
|
|
71
|
+
* `outputSize`, 512 by default). Cancel calls nothing. The type and size
|
|
72
|
+
* checks run first, on the picked file, exactly as without it; a rejected
|
|
73
|
+
* file never opens the dialog. Without `adjust`, nothing changes: the markup
|
|
74
|
+
* and the behaviour are 0.63.0's, byte for byte, and so is the markup with it
|
|
75
|
+
* until a file is picked.
|
|
64
76
|
*/
|
|
65
77
|
/** The picker's default list: JPG, PNG and WebP. */
|
|
66
78
|
export const AVATAR_PICKER_ACCEPT = "image/jpeg,image/png,image/webp";
|
|
@@ -100,9 +112,10 @@ export function routeAvatarFile(f, { accept = AVATAR_PICKER_ACCEPT, maxBytes, on
|
|
|
100
112
|
onSelectFile(f);
|
|
101
113
|
}
|
|
102
114
|
const OVERLAY = "absolute inset-0 grid place-items-center rounded-pill bg-scrim-strong text-ink";
|
|
103
|
-
function AvatarPicker({ name, seed, src, size = 56, onSelectFile, onReject, accept = AVATAR_PICKER_ACCEPT, maxBytes, pending = false, disabled = false, label = AVATAR_PICKER_LABEL, className, }) {
|
|
115
|
+
function AvatarPicker({ name, seed, src, size = 56, onSelectFile, onReject, accept = AVATAR_PICKER_ACCEPT, maxBytes, pending = false, disabled = false, label = AVATAR_PICKER_LABEL, adjust, className, }) {
|
|
104
116
|
const input = React.useRef(null);
|
|
105
117
|
const off = disabled || pending;
|
|
118
|
+
const adjusting = useImageAdjustStep(adjust, "circle", onSelectFile);
|
|
106
119
|
return (_jsxs("span", { "data-slot": "avatar-picker", "data-pending": pending || undefined, className: cn("relative inline-flex shrink-0", className), children: [_jsxs("button", { type: "button", "aria-label": label, "aria-busy": pending || undefined, disabled: off, onClick: () => {
|
|
107
120
|
if (off)
|
|
108
121
|
return;
|
|
@@ -113,8 +126,8 @@ function AvatarPicker({ name, seed, src, size = 56, onSelectFile, onReject, acce
|
|
|
113
126
|
// when a callback throws.
|
|
114
127
|
e.target.value = "";
|
|
115
128
|
if (picked)
|
|
116
|
-
routeAvatarFile(picked, { accept, maxBytes, onSelectFile, onReject });
|
|
117
|
-
} })] }));
|
|
129
|
+
routeAvatarFile(picked, { accept, maxBytes, onSelectFile: adjusting.pick, onReject });
|
|
130
|
+
} }), adjusting.dialog] }));
|
|
118
131
|
}
|
|
119
132
|
export { AvatarPicker };
|
|
120
133
|
//# sourceMappingURL=avatar-picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar-picker.js","sourceRoot":"","sources":["../../src/blocks/avatar-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAuB,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE/C
|
|
1
|
+
{"version":3,"file":"avatar-picker.js","sourceRoot":"","sources":["../../src/blocks/avatar-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAuB,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAA+B,MAAM,mCAAmC,CAAA;AACnG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,oDAAoD;AACpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,iCAAiC,CAAA;AAErE,uEAAuE;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAA;AAQjD;;;GAGG;AACH,SAAS,WAAW,CAAC,CAAa,EAAE,MAAc;IAChD,MAAM,QAAQ,GAAG,MAAM;SACpB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SAClC,MAAM,CAAC,OAAO,CAAC,CAAA;IAClB,IAAI,QAAQ,C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G,GAClE,CACR,IACM,EACT,gBACE,GAAG,EAAE,KAAK,EACV,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,GAAG,EACb,MAAM,QACN,QAAQ,EAAE,CAAC,CAAC,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;oBACd,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;oBAClC,oEAAoE;oBACpE,0BAA0B;oBAC1B,CAAC,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAA;oBACnB,IAAI,MAAM;wBAAE,eAAe,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;gBACnG,CAAC,GACD,EACD,SAAS,CAAC,MAAM,IACZ,CACR,CAAA;AACH,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* `BentoCard`'s hint place (ui#546), the card's one client piece, so the card
|
|
4
|
+
* itself stays a server component. The room is what a stretch gives the card:
|
|
5
|
+
* the place has a zero basis and no least height and takes back the card's 16
|
|
6
|
+
* gap, so it adds nothing to the card's height. With room for it (`useFits`),
|
|
7
|
+
* a hairline where the content ends and the hint centred below it, at least
|
|
8
|
+
* 16 under the hairline; under the hint the card's own 24 padding is the
|
|
9
|
+
* clearance. So the room it needs is the hint itself: the hairline, 16, and
|
|
10
|
+
* the hint (`StretchHint`, the round and its line side by side: about 58). Without that room, out of sight, out of the Tab
|
|
11
|
+
* order and silent.
|
|
12
|
+
*/
|
|
13
|
+
export declare function BentoCardHint({ children }: {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
//# sourceMappingURL=bento-card-hint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bento-card-hint.d.ts","sourceRoot":"","sources":["../../src/blocks/bento-card-hint.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAuBxE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/cloudgrid-cn.js";
|
|
5
|
+
import { useFits } from "../lib/fit.js";
|
|
6
|
+
/**
|
|
7
|
+
* `BentoCard`'s hint place (ui#546), the card's one client piece, so the card
|
|
8
|
+
* itself stays a server component. The room is what a stretch gives the card:
|
|
9
|
+
* the place has a zero basis and no least height and takes back the card's 16
|
|
10
|
+
* gap, so it adds nothing to the card's height. With room for it (`useFits`),
|
|
11
|
+
* a hairline where the content ends and the hint centred below it, at least
|
|
12
|
+
* 16 under the hairline; under the hint the card's own 24 padding is the
|
|
13
|
+
* clearance. So the room it needs is the hint itself: the hairline, 16, and
|
|
14
|
+
* the hint (`StretchHint`, the round and its line side by side: about 58). Without that room, out of sight, out of the Tab
|
|
15
|
+
* order and silent.
|
|
16
|
+
*/
|
|
17
|
+
export function BentoCardHint({ children }) {
|
|
18
|
+
const space = React.useRef(null);
|
|
19
|
+
const body = React.useRef(null);
|
|
20
|
+
const shown = useFits(space, body);
|
|
21
|
+
return (_jsx("div", { "data-slot": "bento-card-hint", "data-shown": shown, className: "-mt-4 flex min-h-0 flex-[1_1_0] flex-col overflow-hidden", children: _jsxs("div", { "data-slot": "bento-card-hint-shown", className: cn("flex min-h-0 flex-1 flex-col transition-[opacity,visibility] duration-200 ease-out motion-reduce:transition-none", shown ? "visible opacity-100" : "invisible opacity-0"), children: [_jsx("div", { "data-slot": "bento-card-hint-rule", className: "h-px shrink-0 bg-hairline" }), _jsx("div", { ref: space, "data-slot": "bento-card-hint-space", className: "flex min-h-0 flex-1 flex-col justify-center", children: _jsx("div", { ref: body, "data-slot": "bento-card-hint-body", className: "pt-4", children: children }) })] }) }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=bento-card-hint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bento-card-hint.js","sourceRoot":"","sources":["../../src/blocks/bento-card-hint.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAiC;IACvE,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAA;IAChD,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAElC,OAAO,CACL,2BAAe,iBAAiB,gBAAa,KAAK,EAAE,SAAS,EAAC,0DAA0D,YACtH,4BACY,uBAAuB,EACjC,SAAS,EAAE,EAAE,CACX,kHAAkH,EAClH,KAAK,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,qBAAqB,CACtD,aAED,2BAAe,sBAAsB,EAAC,SAAS,EAAC,2BAA2B,GAAG,EAC9E,cAAK,GAAG,EAAE,KAAK,eAAY,uBAAuB,EAAC,SAAS,EAAC,6CAA6C,YACxG,cAAK,GAAG,EAAE,IAAI,eAAY,sBAAsB,EAAC,SAAS,EAAC,MAAM,YAC9D,QAAQ,GACL,GACF,IACF,GACF,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The card every section of the Console's 2026 Home sits in (ui#533): "Pinned",
|
|
4
|
+
* "My statistics", "My top creations", "Needs attention", "Recent plugs". A
|
|
5
|
+
* white card with a hairline edge, a title, an optional action at the title's
|
|
6
|
+
* right (a "See all" link, a period select, a pager) and an optional line under
|
|
7
|
+
* the title. Everything else is the caller's children.
|
|
8
|
+
*
|
|
9
|
+
* ## It is as tall as its content
|
|
10
|
+
*
|
|
11
|
+
* No height, no clipping: the card grows when its content grows and shrinks
|
|
12
|
+
* when it shrinks. Its children stack 16 apart, so a spacer child with
|
|
13
|
+
* `flex-1` (the statistics card's footer) can push the last row down when a
|
|
14
|
+
* grid row stretches the card to its neighbour's height, which a CSS grid does
|
|
15
|
+
* by default.
|
|
16
|
+
*
|
|
17
|
+
* ## The values
|
|
18
|
+
*
|
|
19
|
+
* card `bg-card`, `border-hairline`, radius 12 (`rounded-md`),
|
|
20
|
+
* 24 padding (`p-6`), children 16 apart (`gap-4`)
|
|
21
|
+
* title 20 semibold (`text-heading-md font-bold`) on a 28 line
|
|
22
|
+
* (`leading-7`): the heading rung's own leading is 1.2, 24, and
|
|
23
|
+
* the design draws the title row 28 tall
|
|
24
|
+
* description Body (`text-body-sm`, 14 in the Console) in `text-faint-strong`
|
|
25
|
+
* action at the right of the title row, centred on it, never shrunk
|
|
26
|
+
*
|
|
27
|
+
* The roles flip on the panel and ink like every other card.
|
|
28
|
+
*
|
|
29
|
+
* ## The hint (ui#546)
|
|
30
|
+
*
|
|
31
|
+
* `hint` is shown only in room a stretch gives the card: when the Home bento
|
|
32
|
+
* (`HomeBento`) stretches it to meet the other column and the room is at least
|
|
33
|
+
* the hint's own height. Then a hairline sits where the content ends and the
|
|
34
|
+
* hint is centred in the space below it, at least 16 under the hairline (the
|
|
35
|
+
* card's own padding is the room under it).
|
|
36
|
+
* A card at its own height never shows it, and a full card never does either.
|
|
37
|
+
* The hint's place has a zero basis and no least height, and takes back the
|
|
38
|
+
* card's 16 gap, so a card with a hint is exactly as tall as one without. The
|
|
39
|
+
* room is measured by `useFits` (one ResizeObserver, no timers), in
|
|
40
|
+
* `BentoCardHint`, the one client piece, so the card stays a server component. It fades in
|
|
41
|
+
* over 200ms, at once under reduced motion; while hidden it is out of sight,
|
|
42
|
+
* out of the Tab order and silent to a screen reader. The Home's hint is
|
|
43
|
+
* `StretchHint`.
|
|
44
|
+
*
|
|
45
|
+
* ## Semantics
|
|
46
|
+
*
|
|
47
|
+
* A `section` named by its heading. The heading is an `h2` unless `level`
|
|
48
|
+
* says otherwise: Home's sections sit under the page's own `h1`.
|
|
49
|
+
*/
|
|
50
|
+
declare function BentoCard({ title, description, action, hint, level, className, children, ...props }: Omit<React.ComponentProps<"section">, "title"> & {
|
|
51
|
+
title: React.ReactNode;
|
|
52
|
+
description?: React.ReactNode;
|
|
53
|
+
action?: React.ReactNode;
|
|
54
|
+
/** Shown under the content only when a stretch gives the card room for it (ui#546). */
|
|
55
|
+
hint?: React.ReactNode;
|
|
56
|
+
level?: 2 | 3 | 4;
|
|
57
|
+
}): React.JSX.Element;
|
|
58
|
+
export { BentoCard };
|
|
59
|
+
//# sourceMappingURL=bento-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bento-card.d.ts","sourceRoot":"","sources":["../../src/blocks/bento-card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,WAAW,EACX,MAAM,EACN,IAAI,EACJ,KAAS,EACT,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,GAAG;IAClD,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,uFAAuF;IACvF,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;CAClB,qBA8BA;AAED,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../lib/cloudgrid-cn.js";
|
|
4
|
+
import { BentoCardHint } from "./bento-card-hint.js";
|
|
5
|
+
/**
|
|
6
|
+
* The card every section of the Console's 2026 Home sits in (ui#533): "Pinned",
|
|
7
|
+
* "My statistics", "My top creations", "Needs attention", "Recent plugs". A
|
|
8
|
+
* white card with a hairline edge, a title, an optional action at the title's
|
|
9
|
+
* right (a "See all" link, a period select, a pager) and an optional line under
|
|
10
|
+
* the title. Everything else is the caller's children.
|
|
11
|
+
*
|
|
12
|
+
* ## It is as tall as its content
|
|
13
|
+
*
|
|
14
|
+
* No height, no clipping: the card grows when its content grows and shrinks
|
|
15
|
+
* when it shrinks. Its children stack 16 apart, so a spacer child with
|
|
16
|
+
* `flex-1` (the statistics card's footer) can push the last row down when a
|
|
17
|
+
* grid row stretches the card to its neighbour's height, which a CSS grid does
|
|
18
|
+
* by default.
|
|
19
|
+
*
|
|
20
|
+
* ## The values
|
|
21
|
+
*
|
|
22
|
+
* card `bg-card`, `border-hairline`, radius 12 (`rounded-md`),
|
|
23
|
+
* 24 padding (`p-6`), children 16 apart (`gap-4`)
|
|
24
|
+
* title 20 semibold (`text-heading-md font-bold`) on a 28 line
|
|
25
|
+
* (`leading-7`): the heading rung's own leading is 1.2, 24, and
|
|
26
|
+
* the design draws the title row 28 tall
|
|
27
|
+
* description Body (`text-body-sm`, 14 in the Console) in `text-faint-strong`
|
|
28
|
+
* action at the right of the title row, centred on it, never shrunk
|
|
29
|
+
*
|
|
30
|
+
* The roles flip on the panel and ink like every other card.
|
|
31
|
+
*
|
|
32
|
+
* ## The hint (ui#546)
|
|
33
|
+
*
|
|
34
|
+
* `hint` is shown only in room a stretch gives the card: when the Home bento
|
|
35
|
+
* (`HomeBento`) stretches it to meet the other column and the room is at least
|
|
36
|
+
* the hint's own height. Then a hairline sits where the content ends and the
|
|
37
|
+
* hint is centred in the space below it, at least 16 under the hairline (the
|
|
38
|
+
* card's own padding is the room under it).
|
|
39
|
+
* A card at its own height never shows it, and a full card never does either.
|
|
40
|
+
* The hint's place has a zero basis and no least height, and takes back the
|
|
41
|
+
* card's 16 gap, so a card with a hint is exactly as tall as one without. The
|
|
42
|
+
* room is measured by `useFits` (one ResizeObserver, no timers), in
|
|
43
|
+
* `BentoCardHint`, the one client piece, so the card stays a server component. It fades in
|
|
44
|
+
* over 200ms, at once under reduced motion; while hidden it is out of sight,
|
|
45
|
+
* out of the Tab order and silent to a screen reader. The Home's hint is
|
|
46
|
+
* `StretchHint`.
|
|
47
|
+
*
|
|
48
|
+
* ## Semantics
|
|
49
|
+
*
|
|
50
|
+
* A `section` named by its heading. The heading is an `h2` unless `level`
|
|
51
|
+
* says otherwise: Home's sections sit under the page's own `h1`.
|
|
52
|
+
*/
|
|
53
|
+
function BentoCard({ title, description, action, hint, level = 2, className, children, ...props }) {
|
|
54
|
+
const id = React.useId();
|
|
55
|
+
const Heading = `h${level}`;
|
|
56
|
+
return (_jsxs("section", { "data-slot": "bento-card", "aria-labelledby": id, className: cn("flex min-w-0 flex-col gap-4 rounded-md border border-hairline bg-card p-6 text-ink", className), ...props, children: [_jsxs("div", { "data-slot": "bento-card-header", className: "flex min-w-0 items-center justify-between gap-3", children: [_jsx(Heading, { id: id, "data-slot": "bento-card-title", className: "m-0 min-w-0 text-heading-md leading-7 font-bold text-ink", children: title }), action !== undefined && action !== null ? (_jsx("div", { "data-slot": "bento-card-action", className: "shrink-0", children: action })) : null] }), description !== undefined && description !== null ? (_jsx("p", { "data-slot": "bento-card-description", className: "m-0 text-body-sm text-faint-strong", children: description })) : null, children, hint !== undefined && hint !== null ? _jsx(BentoCardHint, { children: hint }) : null] }));
|
|
57
|
+
}
|
|
58
|
+
export { BentoCard };
|
|
59
|
+
//# sourceMappingURL=bento-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bento-card.js","sourceRoot":"","sources":["../../src/blocks/bento-card.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,SAAS,SAAS,CAAC,EACjB,KAAK,EACL,WAAW,EACX,MAAM,EACN,IAAI,EACJ,KAAK,GAAG,CAAC,EACT,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EAQT;IACC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;IACxB,MAAM,OAAO,GAAG,IAAI,KAAK,EAAwB,CAAA;IAEjD,OAAO,CACL,gCACY,YAAY,qBACL,EAAE,EACnB,SAAS,EAAE,EAAE,CAAC,oFAAoF,EAAE,SAAS,CAAC,KAC1G,KAAK,aAET,4BAAe,mBAAmB,EAAC,SAAS,EAAC,iDAAiD,aAC5F,KAAC,OAAO,IAAC,EAAE,EAAE,EAAE,eAAY,kBAAkB,EAAC,SAAS,EAAC,0DAA0D,YAC/G,KAAK,GACE,EACT,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,CACzC,2BAAe,mBAAmB,EAAC,SAAS,EAAC,UAAU,YACpD,MAAM,GACH,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,CACnD,yBAAa,wBAAwB,EAAC,SAAS,EAAC,oCAAoC,YACjF,WAAW,GACV,CACL,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,EACR,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,KAAC,aAAa,cAAE,IAAI,GAAiB,CAAC,CAAC,CAAC,IAAI,IAC3E,CACX,CAAA;AACH,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coming-soon-hint.d.ts","sourceRoot":"","sources":["../../src/blocks/coming-soon-hint.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"coming-soon-hint.d.ts","sourceRoot":"","sources":["../../src/blocks/coming-soon-hint.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAmM9B,iBAAS,cAAc,CAAC,EACtB,KAAK,EACL,QAAQ,GACT,EAAE;IACD,+FAA+F;IAC/F,KAAK,EAAE,MAAM,CAAA;IACb,iHAAiH;IACjH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,qBAuOA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Checkbox } from "../ui/checkbox.js";
|
|
5
|
+
import { RadioGroup } from "../ui/radio-group.js";
|
|
6
|
+
import { SegmentedChoice } from "./segmented-choice.js";
|
|
5
7
|
import { Switch } from "../ui/switch.js";
|
|
6
8
|
import { Tooltip, TooltipContent } from "../ui/tooltip.js";
|
|
7
9
|
/**
|
|
@@ -37,6 +39,16 @@ import { Tooltip, TooltipContent } from "../ui/tooltip.js";
|
|
|
37
39
|
* caller hears nothing: the wrapper holds the switch's value itself, as
|
|
38
40
|
* `checked`, from the caller's `checked` or `defaultChecked`, and the
|
|
39
41
|
* caller's `onCheckedChange` is not passed on at all.
|
|
42
|
+
* - a radio group (`SegmentedChoice`, `RadioGroup`; ui#551) springs back the
|
|
43
|
+
* same way: the selection moves to the pressed option for the same 300 ms,
|
|
44
|
+
* with the group's own motion (the change a real choice makes), then returns
|
|
45
|
+
* to the caller's value, and the notice says why. Pressing the option already
|
|
46
|
+
* selected shows the notice and moves nothing; a second press during the
|
|
47
|
+
* spring starts it again from that press. The wrapper holds the group's
|
|
48
|
+
* `value`, from the caller's `value` or `defaultValue`, and the caller's
|
|
49
|
+
* `onValueChange` is not passed on. The pressed option is found from the
|
|
50
|
+
* radio Base UI draws and the hidden `<input type="radio">` it keeps beside
|
|
51
|
+
* it, whose `value` is the option's value: string values, as the Console's.
|
|
40
52
|
*
|
|
41
53
|
* ## Native controls (ui#523)
|
|
42
54
|
*
|
|
@@ -59,7 +71,10 @@ import { Tooltip, TooltipContent } from "../ui/tooltip.js";
|
|
|
59
71
|
* Tab, Shift+Tab and shortcuts with Ctrl, Cmd or Alt pass through. On a
|
|
60
72
|
* button, a switch or a pencil the arrow keys pass through too (they scroll
|
|
61
73
|
* the page); on a field, a select or a combobox, where a key would change or
|
|
62
|
-
* open it, every key is stopped and opens the notice.
|
|
74
|
+
* open it, every key is stopped and opens the notice. On a radio the keys that
|
|
75
|
+
* would choose are a press: Space and Enter on the focused option, an arrow on
|
|
76
|
+
* its neighbour (wrapping, and the other way round right to left). Focus stays
|
|
77
|
+
* where it was, as the selection comes back to where it was.
|
|
63
78
|
*
|
|
64
79
|
* ## Hover shows nothing
|
|
65
80
|
*
|
|
@@ -85,6 +100,12 @@ import { Tooltip, TooltipContent } from "../ui/tooltip.js";
|
|
|
85
100
|
* open, so the notice is announced when it appears. A live region that
|
|
86
101
|
* arrived with its text would not be announced reliably.
|
|
87
102
|
* - The notice itself is `role="tooltip"`, as every tooltip in this library.
|
|
103
|
+
* - **A radio group is not heard to change.** While an option is shown for the
|
|
104
|
+
* 300 ms, the radios' `aria-checked` is held on the caller's value: only the
|
|
105
|
+
* look moves (`data-checked`, what the group's style keys on). The flags are
|
|
106
|
+
* set back in the same commit, before a screen reader can read them, so what
|
|
107
|
+
* it hears is the notice, not "Not visible, selected". (A switch's flip is
|
|
108
|
+
* heard; a choice that seemed made would be the wrong thing to say.)
|
|
88
109
|
*
|
|
89
110
|
* ## Why a tooltip and not a popover
|
|
90
111
|
*
|
|
@@ -98,7 +119,7 @@ import { Tooltip, TooltipContent } from "../ui/tooltip.js";
|
|
|
98
119
|
*/
|
|
99
120
|
/** How long the notice stays open after a press. */
|
|
100
121
|
const NOTICE_MS = 2500;
|
|
101
|
-
/** How long a switch or a
|
|
122
|
+
/** How long a switch, a checkbox or a radio group shows the pressed value before it springs back. */
|
|
102
123
|
const SPRING_BACK_MS = 300;
|
|
103
124
|
/** What can take focus inside: the elements the description is added to, and the notice anchors on. */
|
|
104
125
|
const FOCUSABLE = 'a[href], button, input:not([type="hidden"]), select, textarea, [tabindex], [role="switch"], [role="checkbox"], [role="combobox"]';
|
|
@@ -108,6 +129,8 @@ const KEYED = 'input, select, textarea, [contenteditable=""], [contenteditable="
|
|
|
108
129
|
const ACTS_ON_MOUSE_DOWN = 'select, input[type="range"]';
|
|
109
130
|
/** The keys that pass through. */
|
|
110
131
|
const PASS = new Set(["Tab", "Shift", "Control", "Meta", "Alt", "CapsLock"]);
|
|
132
|
+
/** The keys that move a radio group's choice to the next or previous option. */
|
|
133
|
+
const ARROWS = new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
|
|
111
134
|
function focusables(root) {
|
|
112
135
|
return Array.from(root.querySelectorAll(FOCUSABLE)).filter((el) => el.tabIndex >= 0 && el.getAttribute("aria-hidden") !== "true");
|
|
113
136
|
}
|
|
@@ -116,17 +139,53 @@ function isToggle(el) {
|
|
|
116
139
|
const props = el.props;
|
|
117
140
|
return el.type === Switch || el.type === Checkbox || "checked" in props || "defaultChecked" in props || "onCheckedChange" in props;
|
|
118
141
|
}
|
|
142
|
+
/** A radio group: the library's `SegmentedChoice` or `RadioGroup`. */
|
|
143
|
+
function isChoice(el) {
|
|
144
|
+
return el.type === SegmentedChoice || el.type === RadioGroup;
|
|
145
|
+
}
|
|
146
|
+
/** The radio a press on `target` lands on: the radio itself, or the one its label holds. */
|
|
147
|
+
function radioOf(target) {
|
|
148
|
+
if (!(target instanceof Element))
|
|
149
|
+
return null;
|
|
150
|
+
return (target.closest('[role="radio"]') ??
|
|
151
|
+
target.closest("label")?.querySelector('[role="radio"]') ??
|
|
152
|
+
null);
|
|
153
|
+
}
|
|
154
|
+
/** A radio's value: Base UI keeps it on the hidden `<input type="radio">` it draws beside the radio. */
|
|
155
|
+
function radioValue(radio) {
|
|
156
|
+
const input = radio.nextElementSibling;
|
|
157
|
+
return input instanceof HTMLInputElement && input.type === "radio" ? input.value : undefined;
|
|
158
|
+
}
|
|
159
|
+
const isDisabled = (radio) => radio.hasAttribute("data-disabled") || radio.getAttribute("aria-disabled") === "true";
|
|
160
|
+
/** The option an arrow key would move the choice to from `radio`: the next or previous one, wrapping. */
|
|
161
|
+
function neighbour(radio, key) {
|
|
162
|
+
const group = radio.closest('[role="radiogroup"]');
|
|
163
|
+
if (!group)
|
|
164
|
+
return null;
|
|
165
|
+
const radios = Array.from(group.querySelectorAll('[role="radio"]')).filter((r) => r === radio || !isDisabled(r));
|
|
166
|
+
const at = radios.indexOf(radio);
|
|
167
|
+
if (at === -1 || radios.length < 2)
|
|
168
|
+
return null;
|
|
169
|
+
const rtl = getComputedStyle(group).direction === "rtl";
|
|
170
|
+
const forward = key === "ArrowDown" || key === (rtl ? "ArrowLeft" : "ArrowRight");
|
|
171
|
+
return radios[(at + (forward ? 1 : -1) + radios.length) % radios.length] ?? null;
|
|
172
|
+
}
|
|
119
173
|
const useIsoLayoutEffect = typeof document === "undefined" ? React.useEffect : React.useLayoutEffect;
|
|
120
174
|
function ComingSoonHint({ label, children, }) {
|
|
121
175
|
const root = React.useRef(null);
|
|
122
176
|
const [open, setOpen] = React.useState(false);
|
|
123
177
|
const [anchor, setAnchor] = React.useState(null);
|
|
124
178
|
const [flipped, setFlipped] = React.useState(false);
|
|
179
|
+
/** A radio group's option shown for the spring, by value; `undefined` at rest. */
|
|
180
|
+
const [picked, setPicked] = React.useState(undefined);
|
|
125
181
|
const closeTimer = React.useRef(undefined);
|
|
126
182
|
const springTimer = React.useRef(undefined);
|
|
127
183
|
const descriptionId = React.useId();
|
|
128
184
|
const child = React.isValidElement(children) ? children : null;
|
|
129
|
-
const
|
|
185
|
+
const choice = child !== null && isChoice(child);
|
|
186
|
+
const toggle = child !== null && !choice && isToggle(child);
|
|
187
|
+
/** The caller's answer, which a radio group rests on and springs back to. */
|
|
188
|
+
const resting = choice ? (child.props.value ?? child.props.defaultValue) : undefined;
|
|
130
189
|
React.useEffect(() => () => {
|
|
131
190
|
clearTimeout(closeTimer.current);
|
|
132
191
|
clearTimeout(springTimer.current);
|
|
@@ -135,14 +194,18 @@ function ComingSoonHint({ label, children, }) {
|
|
|
135
194
|
clearTimeout(closeTimer.current);
|
|
136
195
|
setOpen(false);
|
|
137
196
|
}, []);
|
|
138
|
-
/**
|
|
139
|
-
|
|
197
|
+
/**
|
|
198
|
+
* A press landed on `target`: show the notice above its control, flip a
|
|
199
|
+
* switch, and move a radio group to `radio` (the pressed option, or the one
|
|
200
|
+
* an arrow key chose).
|
|
201
|
+
*/
|
|
202
|
+
const press = (target, radio = radioOf(target)) => {
|
|
140
203
|
const el = root.current;
|
|
141
204
|
if (!el)
|
|
142
205
|
return;
|
|
143
206
|
const controls = focusables(el);
|
|
144
207
|
const hit = target instanceof Node ? controls.find((c) => c.contains(target)) : undefined;
|
|
145
|
-
setAnchor(hit ?? controls[0] ?? null);
|
|
208
|
+
setAnchor(radio ?? hit ?? controls[0] ?? null);
|
|
146
209
|
setOpen(true);
|
|
147
210
|
clearTimeout(closeTimer.current);
|
|
148
211
|
closeTimer.current = setTimeout(close, NOTICE_MS);
|
|
@@ -151,7 +214,33 @@ function ComingSoonHint({ label, children, }) {
|
|
|
151
214
|
clearTimeout(springTimer.current);
|
|
152
215
|
springTimer.current = setTimeout(() => setFlipped(false), SPRING_BACK_MS);
|
|
153
216
|
}
|
|
217
|
+
if (choice && radio && !isDisabled(radio)) {
|
|
218
|
+
const value = radioValue(radio);
|
|
219
|
+
if (value === undefined)
|
|
220
|
+
return;
|
|
221
|
+
// One timeline: a press during the spring starts it again from this press.
|
|
222
|
+
clearTimeout(springTimer.current);
|
|
223
|
+
if (value === resting) {
|
|
224
|
+
// The option already chosen: the notice, and the selection back where it is.
|
|
225
|
+
setPicked(undefined);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
setPicked(value);
|
|
229
|
+
springTimer.current = setTimeout(() => setPicked(undefined), SPRING_BACK_MS);
|
|
230
|
+
}
|
|
154
231
|
};
|
|
232
|
+
// While a radio group shows the pressed option, its radios still tell a
|
|
233
|
+
// screen reader the caller's answer: `aria-checked` is set back here, in the
|
|
234
|
+
// commit that moved it, so only the look (`data-checked`) changes. React
|
|
235
|
+
// sets the flags again itself when the option springs back.
|
|
236
|
+
useIsoLayoutEffect(() => {
|
|
237
|
+
const el = root.current;
|
|
238
|
+
if (!el || picked === undefined)
|
|
239
|
+
return;
|
|
240
|
+
for (const radio of el.querySelectorAll('[role="radio"]')) {
|
|
241
|
+
radio.setAttribute("aria-checked", String(radioValue(radio) === resting));
|
|
242
|
+
}
|
|
243
|
+
});
|
|
155
244
|
// The description, on every focusable control inside, after any it has.
|
|
156
245
|
// Each render, and again on focus, because a control may rewrite its own
|
|
157
246
|
// `aria-describedby` when it re-renders.
|
|
@@ -201,6 +290,13 @@ function ComingSoonHint({ label, children, }) {
|
|
|
201
290
|
return;
|
|
202
291
|
}
|
|
203
292
|
const keyed = event.target instanceof Element && event.target.closest(KEYED) !== null;
|
|
293
|
+
const radio = ARROWS.has(event.key) ? radioOf(event.target) : null;
|
|
294
|
+
if (radio) {
|
|
295
|
+
// An arrow would move the choice: a press on the option it would choose.
|
|
296
|
+
block(event);
|
|
297
|
+
press(event.target, neighbour(radio, event.key));
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
204
300
|
if (event.key === "Enter" || event.key === " " || keyed) {
|
|
205
301
|
block(event);
|
|
206
302
|
press(event.target);
|
|
@@ -248,7 +344,14 @@ function ComingSoonHint({ label, children, }) {
|
|
|
248
344
|
defaultChecked: undefined,
|
|
249
345
|
onCheckedChange: undefined,
|
|
250
346
|
})
|
|
251
|
-
:
|
|
347
|
+
: child && choice
|
|
348
|
+
? React.cloneElement(child, {
|
|
349
|
+
// `null`, not `undefined`, for a group with no answer: it stays controlled, with nothing chosen.
|
|
350
|
+
value: picked ?? resting ?? null,
|
|
351
|
+
defaultValue: undefined,
|
|
352
|
+
onValueChange: undefined,
|
|
353
|
+
})
|
|
354
|
+
: children;
|
|
252
355
|
return (_jsxs("span", { ref: root, "data-slot": "coming-soon-hint", className: "contents", onPointerDownCapture: stop, onPointerUpCapture: stop, onMouseDownCapture: onMouseDownCapture, onMouseUpCapture: stop, onClickCapture: (event) => {
|
|
253
356
|
block(event);
|
|
254
357
|
press(event.target);
|