@cloudgrid-io/ui 0.57.0 → 0.58.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/badge/shared.d.ts +6 -0
- package/dist/badge/shared.d.ts.map +1 -1
- package/dist/badge/shared.js +6 -0
- package/dist/badge/shared.js.map +1 -1
- package/dist/blocks/grid-profile.d.ts +19 -43
- package/dist/blocks/grid-profile.d.ts.map +1 -1
- package/dist/blocks/grid-profile.js +64 -10
- package/dist/blocks/grid-profile.js.map +1 -1
- package/dist/ui/select.d.ts +16 -0
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +18 -2
- package/dist/ui/select.js.map +1 -1
- package/package.json +1 -1
package/dist/badge/shared.d.ts
CHANGED
|
@@ -47,6 +47,12 @@ export interface SelectOptions {
|
|
|
47
47
|
* Select's look (`ui/select.tsx`): a 32px trigger with a chevron, and a list
|
|
48
48
|
* that opens with the selected option laid over the trigger, as Select's
|
|
49
49
|
* `alignItemWithTrigger` places it. Items are 30px, so the offset is exact.
|
|
50
|
+
*
|
|
51
|
+
* Since ui#504 that is Select's opt-in placement, not its default (the
|
|
52
|
+
* library's menu now opens under its field, on its left edge). The badge keeps
|
|
53
|
+
* it: this is not the library Select but an HTML string in the badge's own
|
|
54
|
+
* small panel, its list end-aligned on its trigger (`right: 0`), and it ships
|
|
55
|
+
* with the live badge, so moving it is the badge's own decision.
|
|
50
56
|
*/
|
|
51
57
|
export declare function select({ label, options, value, action, open, attrs }: SelectOptions): string;
|
|
52
58
|
/** A switch: `role="switch"` with `aria-checked`, the library Switch's 32x18 track. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/badge/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;AAExC,MAAM,WAAW,YAAY;IAC3B,oCAAoC;IACpC,KA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AK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAc,EAAE,UAAoB,EAAE,KAAU,EAAE,EAAE,YAAY,GAAG,MAAM,CAO7G;AAED,4FAA4F;AAC5F,eAAO,MAAM,KAAK,QAAO,MAAgF,CAAA;AAEzG,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,SAAS,YAAY,EAAE,CAAA;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,yGAAyG;IACzG,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,4EAA4E;IAC5E,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAiB,EAAE,IAAY,EAAE,KAAU,EAAE,EAAE,aAAa,GAAG,MAAM,CAuBpH;AAED,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,MAAM,CAEvG;AAED,iGAAiG;AACjG,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAK,GAAG,MAAM,CAE3F"}
|
package/dist/badge/shared.js
CHANGED
|
@@ -25,6 +25,12 @@ export const scrim = () => `<div class="cgb-scrim" data-action="close" aria-hidd
|
|
|
25
25
|
* Select's look (`ui/select.tsx`): a 32px trigger with a chevron, and a list
|
|
26
26
|
* that opens with the selected option laid over the trigger, as Select's
|
|
27
27
|
* `alignItemWithTrigger` places it. Items are 30px, so the offset is exact.
|
|
28
|
+
*
|
|
29
|
+
* Since ui#504 that is Select's opt-in placement, not its default (the
|
|
30
|
+
* library's menu now opens under its field, on its left edge). The badge keeps
|
|
31
|
+
* it: this is not the library Select but an HTML string in the badge's own
|
|
32
|
+
* small panel, its list end-aligned on its trigger (`right: 0`), and it ships
|
|
33
|
+
* with the live badge, so moving it is the badge's own decision.
|
|
28
34
|
*/
|
|
29
35
|
export function select({ label, options, value, action = "select", open = false, attrs = "" }) {
|
|
30
36
|
const index = Math.max(0, options.findIndex((o) => o.value === value));
|
package/dist/badge/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/badge/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAiBhD;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,EAAE,UAAU,GAAG,OAAO,EAAE,KAAK,GAAG,EAAE,EAAgB;IACnG,OAAO,CACL,oDAAoD,GAAG,CAAC,KAAK,CAAC,gBAAgB,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG;QACjH,yBAAyB,QAAQ,EAAE,8EAA8E,GAAG,CAAC,UAAU,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,iBAAiB;QAC9J,IAAI;QACJ,QAAQ,CACT,CAAA;AACH,CAAC;AAED,4FAA4F;AAC5F,MAAM,CAAC,MAAM,KAAK,GAAG,GAAW,EAAE,CAAC,sEAAsE,CAAA;AAoBzG
|
|
1
|
+
{"version":3,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OAAO,EAAE,MAAM,CAAC,UAAU,CAAA;AACtI,CAAC"}
|
|
@@ -1,46 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* page.
|
|
5
|
-
*
|
|
6
|
-
* ```
|
|
7
|
-
* ┌──────┐
|
|
8
|
-
* │ A │ Atomic Labs ✎
|
|
9
|
-
* │ ✎│ A shared home for our team's creations. ✎
|
|
10
|
-
* └──────┘
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* - The logo tile is the library `Avatar`: the 80px rung, square, the pastel
|
|
14
|
-
* look (the grid avatar of the header, #381), so a grid has one colour and
|
|
15
|
-
* one letter everywhere. `logoSrc` draws the grid's picture in it, and a
|
|
16
|
-
* picture that fails to load falls back to the letter (Avatar's own rule).
|
|
17
|
-
* - The pencil badge at the tile's lower right is a 28px round button named
|
|
18
|
-
* "Change the Grid logo". The upload is the platform's and comes later
|
|
19
|
-
* (cloudgrid#6538); the caller passes `onEditLogo` when it can do something.
|
|
20
|
-
* Not `AvatarPicker`: that is a person's photo, a round picture with a camera
|
|
21
|
-
* over it on hover and a file input of its own; the grid's tile is a square
|
|
22
|
-
* with a pencil, and what pressing it opens is the caller's.
|
|
23
|
-
* - The name (H4 role, 22) and the description (body text, 15, in the body
|
|
24
|
-
* tone) are `EditableValue`s, so each pencil is named for what it edits
|
|
25
|
-
* ("Edit Grid name", "Edit Grid description").
|
|
26
|
-
*
|
|
27
|
-
* With no handler a pencil is not drawn at all: a pencil that does nothing
|
|
28
|
-
* would say the value can be changed when it cannot. The tile and the text are
|
|
29
|
-
* centred on one line, 24 apart.
|
|
30
|
-
*
|
|
31
|
-
* ui#500:
|
|
32
|
-
*
|
|
33
|
-
* - `logoComingSoon`: the logo upload is designed and not built. The pencil
|
|
34
|
-
* badge is drawn, as the design draws it, greyed to 50% and `inert`, with
|
|
35
|
-
* `aria-disabled`, the way a Coming soon row's control is; a handler does not
|
|
36
|
-
* make it live. The section's heading carries the tag
|
|
37
|
-
* (`SettingsSection comingSoon="partial"`).
|
|
38
|
-
* - No description, and `onEditDescription`: the line reads "Add description"
|
|
39
|
-
* in the faint tone, with its pencil, so one can be added. No handler, no line.
|
|
40
|
-
* - The description wraps onto more lines rather than being cut with an
|
|
41
|
-
* ellipsis (it was cut on one line at phone width). The name stays one line.
|
|
42
|
-
*/
|
|
43
|
-
declare function GridProfile({ name, description, logoSrc, seed, onEditLogo, onEditName, onEditDescription, logoComingSoon, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
|
|
2
|
+
import { type AvatarPickerRejection } from "./avatar-picker.js";
|
|
3
|
+
declare function GridProfile({ name, description, logoSrc, seed, onEditLogo, onSelectLogoFile, onRejectLogoFile, onRemoveLogo, logoAccept, logoMaxBytes, logoPending, onEditName, onEditDescription, logoComingSoon, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
|
|
44
4
|
/** The grid's name: the tile's letter, and the large line. */
|
|
45
5
|
name: string;
|
|
46
6
|
/** The line under the name. */
|
|
@@ -49,8 +9,24 @@ declare function GridProfile({ name, description, logoSrc, seed, onEditLogo, onE
|
|
|
49
9
|
logoSrc?: string;
|
|
50
10
|
/** What the tile's colour is derived from: the grid's id, so a rename keeps it. */
|
|
51
11
|
seed?: string;
|
|
52
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* The badge on the tile was pressed. No handler, no badge.
|
|
14
|
+
* @deprecated Pass `onSelectLogoFile` (and `onRemoveLogo`): the tile becomes
|
|
15
|
+
* the picker and the badge a menu (ui#505).
|
|
16
|
+
*/
|
|
53
17
|
onEditLogo?: () => void;
|
|
18
|
+
/** A good logo file, after the type and size checks. The caller uploads it. Makes the tile the picker. */
|
|
19
|
+
onSelectLogoFile?: (file: File) => void;
|
|
20
|
+
/** A picked file that failed a check, and which one. */
|
|
21
|
+
onRejectLogoFile?: (file: File, reason: AvatarPickerRejection) => void;
|
|
22
|
+
/** "Remove logo" in the badge's menu, shown only while there is a `logoSrc`. */
|
|
23
|
+
onRemoveLogo?: () => void;
|
|
24
|
+
/** The native attribute's syntax. Defaults to JPG, PNG and WebP. */
|
|
25
|
+
logoAccept?: string;
|
|
26
|
+
/** The largest logo file accepted, in bytes, inclusive. No limit when omitted. */
|
|
27
|
+
logoMaxBytes?: number;
|
|
28
|
+
/** The caller's upload or removal is running: a spinner, `aria-busy`, and no picker. */
|
|
29
|
+
logoPending?: boolean;
|
|
54
30
|
/** The upload is not built yet: the badge is drawn, greyed and inert. */
|
|
55
31
|
logoComingSoon?: boolean;
|
|
56
32
|
onEditName?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-profile.d.ts","sourceRoot":"","sources":["../../src/blocks/grid-profile.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"grid-profile.d.ts","sourceRoot":"","sources":["../../src/blocks/grid-profile.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,6BAA6B,CAAA;AAkFpC,iBAAS,WAAW,CAAC,EACnB,IAAI,EACJ,WAAW,EACX,OAAO,EACP,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,UAAiC,EACjC,YAAY,EACZ,WAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,cAAsB,EACtB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACjD,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAA;IACZ,+BAA+B;IAC/B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,0GAA0G;IAC1G,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACvC,wDAAwD;IACxD,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAA;IACtE,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wFAAwF;IACxF,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,yEAAyE;IACzE,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAA;CAC/B,qBA+HA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cn } from "../lib/cloudgrid-cn.js";
|
|
5
5
|
import { Avatar } from "./avatar.js";
|
|
6
|
-
import {
|
|
6
|
+
import { AVATAR_PICKER_ACCEPT, routeAvatarFile, } from "./avatar-picker.js";
|
|
7
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../ui/dropdown-menu.js";
|
|
8
|
+
import { ChangePhotoIcon, EditIcon } from "./icons.js";
|
|
7
9
|
import { EditableValue } from "./settings-row.js";
|
|
10
|
+
import { Spinner } from "../ui/spinner.js";
|
|
8
11
|
/**
|
|
9
12
|
* THE GRID PROFILE (ui#494): the block at the top of the Grid settings General
|
|
10
13
|
* page.
|
|
@@ -20,12 +23,10 @@ import { EditableValue } from "./settings-row.js";
|
|
|
20
23
|
* look (the grid avatar of the header, #381), so a grid has one colour and
|
|
21
24
|
* one letter everywhere. `logoSrc` draws the grid's picture in it, and a
|
|
22
25
|
* picture that fails to load falls back to the letter (Avatar's own rule).
|
|
23
|
-
* - The pencil badge at the tile's lower right is a 28px round button
|
|
24
|
-
* "Change the Grid logo"
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* over it on hover and a file input of its own; the grid's tile is a square
|
|
28
|
-
* with a pencil, and what pressing it opens is the caller's.
|
|
26
|
+
* - The pencil badge at the tile's lower right is a 28px round button. Before
|
|
27
|
+
* ui#505 it was named "Change the Grid logo" and called `onEditLogo`, and
|
|
28
|
+
* what it opened was the caller's; that path still works (deprecated). The
|
|
29
|
+
* logo picker is below.
|
|
29
30
|
* - The name (H4 role, 22) and the description (body text, 15, in the body
|
|
30
31
|
* tone) are `EditableValue`s, so each pencil is named for what it edits
|
|
31
32
|
* ("Edit Grid name", "Edit Grid description").
|
|
@@ -45,9 +46,62 @@ import { EditableValue } from "./settings-row.js";
|
|
|
45
46
|
* in the faint tone, with its pencil, so one can be added. No handler, no line.
|
|
46
47
|
* - The description wraps onto more lines rather than being cut with an
|
|
47
48
|
* ellipsis (it was cut on one line at phone width). The name stays one line.
|
|
49
|
+
*
|
|
50
|
+
* ui#505, the logo picked like the profile photo (`AvatarPicker`), adapted to
|
|
51
|
+
* a grid. With `onSelectLogoFile`:
|
|
52
|
+
*
|
|
53
|
+
* - The tile is a button, "Change the Grid logo": pressing it calls `click()`
|
|
54
|
+
* on a hidden file input (`hidden`, `tabIndex={-1}`), so the native picker
|
|
55
|
+
* opens with no pop-up and the tile is one tab stop. A camera fades in over
|
|
56
|
+
* the strong scrim on hover and on keyboard focus, on the tile's own corner.
|
|
57
|
+
* - The pencil badge, "Edit Grid logo", opens a small menu: "Upload new logo",
|
|
58
|
+
* and "Remove logo" only when there is a logo (`logoSrc`) and the caller can
|
|
59
|
+
* remove it (`onRemoveLogo`). Its hover is the other pencils' (`EditableValue`):
|
|
60
|
+
* the hover wash and ink. The badge keeps its white ground on the tile, so the
|
|
61
|
+
* wash is laid over it rather than replacing it.
|
|
62
|
+
* - A picked file goes through `routeAvatarFile`: a type outside `logoAccept`
|
|
63
|
+
* or a file over `logoMaxBytes` goes to `onRejectLogoFile(file, reason)`,
|
|
64
|
+
* anything else to `onSelectLogoFile(file)`. The input is cleared after
|
|
65
|
+
* every pick, so the same file can be chosen again.
|
|
66
|
+
* - `logoPending`: a spinner over the tile, the tile `aria-busy`, and the tile,
|
|
67
|
+
* the pencil and the input disabled, so nothing opens a second picker.
|
|
68
|
+
*
|
|
69
|
+
* The block makes no network call: the upload and the removal are the
|
|
70
|
+
* caller's. `logoComingSoon` wins over a handler and draws what it drew before.
|
|
71
|
+
* `onEditLogo` (deprecated) still draws the old pencil that calls it, so a
|
|
72
|
+
* caller that has not moved keeps working.
|
|
73
|
+
*/
|
|
74
|
+
/** The scrim over the tile, on its 80px corner. */
|
|
75
|
+
const LOGO_OVERLAY = "absolute inset-0 grid place-items-center rounded-container bg-scrim-strong text-ink";
|
|
76
|
+
/**
|
|
77
|
+
* The 28px badge at the tile's lower right. Its hover is `EditableValue`'s
|
|
78
|
+
* pencil's (ui#505): the hover wash and ink. The wash is laid over the badge's
|
|
79
|
+
* white ground as an image, because `--cg-hover` is translucent and replacing
|
|
80
|
+
* the ground would let the tile show through.
|
|
48
81
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
82
|
+
const BADGE = "absolute -right-1.5 -bottom-1.5 inline-flex size-7 items-center justify-center rounded-pill border border-hairline bg-card text-body shadow-sm transition-colors hover:[background-image:linear-gradient(var(--cg-hover),var(--cg-hover))] hover:text-ink focus-line";
|
|
83
|
+
function GridProfile({ name, description, logoSrc, seed, onEditLogo, onSelectLogoFile, onRejectLogoFile, onRemoveLogo, logoAccept = AVATAR_PICKER_ACCEPT, logoMaxBytes, logoPending = false, onEditName, onEditDescription, logoComingSoon = false, className, ...props }) {
|
|
84
|
+
const input = React.useRef(null);
|
|
85
|
+
const picker = Boolean(onSelectLogoFile) && !logoComingSoon;
|
|
86
|
+
const tile = _jsx(Avatar, { name: name, seed: seed, src: logoSrc, size: 80, shape: "square", look: "pastel" });
|
|
87
|
+
const pick = () => {
|
|
88
|
+
if (!logoPending)
|
|
89
|
+
input.current?.click();
|
|
90
|
+
};
|
|
91
|
+
return (_jsxs("div", { "data-slot": "grid-profile", className: cn("flex min-w-0 flex-wrap items-center gap-6 text-ink", className), ...props, children: [_jsx("span", { "data-slot": "grid-profile-logo", "data-pending": (picker && logoPending) || undefined, className: "relative inline-flex shrink-0", children: picker ? (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", "aria-label": "Change the Grid logo", "aria-busy": logoPending || undefined, disabled: logoPending, onClick: pick, className: "group/grid-logo relative inline-flex shrink-0 cursor-pointer rounded-container outline-none focus-line disabled:cursor-not-allowed", children: [tile, logoPending ? (_jsx("span", { "data-cg-surface": "ink", "aria-hidden": "true", className: LOGO_OVERLAY, children: _jsx(Spinner, { decorative: true, size: "lg" }) })) : (_jsx("span", { "data-slot": "grid-profile-logo-mark", "data-cg-surface": "ink", "aria-hidden": "true", className: cn(LOGO_OVERLAY, "opacity-0 transition-opacity duration-150 motion-reduce:transition-none", "group-hover/grid-logo:opacity-100 group-focus-visible/grid-logo:opacity-100"), children: _jsx(ChangePhotoIcon, { className: "size-[40%] shrink-0" }) }))] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { "aria-label": "Edit Grid logo", disabled: logoPending, className: cn(BADGE, "disabled:pointer-events-none"), children: _jsx(EditIcon, { className: "size-3.5" }) }), _jsxs(DropdownMenuContent, { "data-slot": "grid-profile-logo-menu", className: "w-max", children: [_jsx(DropdownMenuItem, { onClick: pick, children: "Upload new logo" }), logoSrc && onRemoveLogo ? (_jsx(DropdownMenuItem, { onClick: onRemoveLogo, children: "Remove logo" })) : null] })] }), _jsx("input", { ref: input, type: "file", accept: logoAccept, disabled: logoPending, hidden: true, tabIndex: -1, onChange: (e) => {
|
|
92
|
+
const picked = e.target.files?.[0];
|
|
93
|
+
// Cleared before routing, so the same file can be picked again even
|
|
94
|
+
// when a callback throws.
|
|
95
|
+
e.target.value = "";
|
|
96
|
+
if (picked && onSelectLogoFile) {
|
|
97
|
+
routeAvatarFile(picked, {
|
|
98
|
+
accept: logoAccept,
|
|
99
|
+
maxBytes: logoMaxBytes,
|
|
100
|
+
onSelectFile: onSelectLogoFile,
|
|
101
|
+
onReject: onRejectLogoFile,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
} })] })) : (_jsxs(_Fragment, { children: [tile, onEditLogo || logoComingSoon ? (_jsx("button", { type: "button", "aria-label": "Change the Grid logo", onClick: logoComingSoon ? undefined : onEditLogo, inert: logoComingSoon, "aria-disabled": logoComingSoon ? "true" : undefined, className: cn(BADGE, logoComingSoon && "opacity-50 select-none"), children: _jsx(EditIcon, { className: "size-3.5" }) })) : null] })) }), _jsxs("div", { className: "grid min-w-0 flex-1 gap-2", children: [_jsx(EditableValue, { "data-slot": "grid-profile-name", value: name, label: "Grid name", onEdit: onEditName, valueClassName: "text-heading-lg font-normal leading-tight" }), description || onEditDescription ? (_jsx(EditableValue, { "data-slot": "grid-profile-description", value: description || _jsx("span", { className: "text-faint-strong", children: "Add description" }), label: "Grid description", onEdit: onEditDescription, valueClassName: "text-body", wrap: true })) : null] })] }));
|
|
51
105
|
}
|
|
52
106
|
export { GridProfile };
|
|
53
107
|
//# sourceMappingURL=grid-profile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-profile.js","sourceRoot":"","sources":["../../src/blocks/grid-profile.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAA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AAS,EAAE,EAAE,CAAC,KAAK,EAAE,cAAc,IAAI,wBAAwB,CAAC,YAEhE,KAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,GAAG,GAC1B,CACV,CAAC,CAAC,CAAC,IAAI,IACP,CACJ,GACI,EACP,eAAK,SAAS,EAAC,2BAA2B,aACxC,KAAC,aAAa,iBACF,mBAAmB,EAC7B,KAAK,EAAE,IAAI,EACX,KAAK,EAAC,WAAW,EACjB,MAAM,EAAE,UAAU,EAClB,cAAc,EAAC,2CAA2C,GAC1D,EACD,WAAW,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAClC,KAAC,aAAa,iBACF,0BAA0B,EACpC,KAAK,EAAE,WAAW,IAAI,eAAM,SAAS,EAAC,mBAAmB,gCAAuB,EAChF,KAAK,EAAC,kBAAkB,EACxB,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAC,WAAW,EAC1B,IAAI,SACJ,CACH,CAAC,CAAC,CAAC,IAAI,IACJ,IACF,CACP,CAAA;AACH,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
package/dist/ui/select.d.ts
CHANGED
|
@@ -12,6 +12,22 @@ declare function SelectTrigger({ className, size, variant, children, ...props }:
|
|
|
12
12
|
*/
|
|
13
13
|
variant?: "field" | "inline" | "settings";
|
|
14
14
|
}): React.JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* ## Where the menu opens (ui#504)
|
|
17
|
+
*
|
|
18
|
+
* Under its field, 4 below it (the gap `DropdownMenu` and `Tooltip` use), with
|
|
19
|
+
* the field's left edge and width. With no room below, Base UI flips it above,
|
|
20
|
+
* 4 over the field, on the same edge. An option longer than the field widens
|
|
21
|
+
* the menu to the right rather than being cut (`w-max`, never narrower than
|
|
22
|
+
* the field, never wider than the window).
|
|
23
|
+
*
|
|
24
|
+
* It used to default to `alignItemWithTrigger`: the menu was moved so the
|
|
25
|
+
* selected option's text sat on the field's text. An option's text is 6 in,
|
|
26
|
+
* and the field's 20 (15 in the filter row and the settings field, 13 in
|
|
27
|
+
* `md`, 11 in `sm`), so every menu opened that far to the right of its field
|
|
28
|
+
* and, as wide as the field or a 144 floor, stuck out past its right edge.
|
|
29
|
+
* A caller can still opt back in with `alignItemWithTrigger`.
|
|
30
|
+
*/
|
|
15
31
|
declare function SelectContent({ className, children, side, sideOffset, align, alignOffset, alignItemWithTrigger, ...props }: SelectPrimitive.Popup.Props & Pick<SelectPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset" | "alignItemWithTrigger">): React.JSX.Element;
|
|
16
32
|
declare function SelectLabel({ className, ...props }: SelectPrimitive.GroupLabel.Props): React.JSX.Element;
|
|
17
33
|
declare function SelectItem({ className, children, ...props }: SelectPrimitive.Item.Props): React.JSX.Element;
|
package/dist/ui/select.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/ui/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAKjE,QAAA,MAAM,MAAM,6BAAuB,CAAA;AAEnC,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,qBAQxE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,qBAQxE;AAqDD,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,IAAgB,EAChB,OAAiB,EACjB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,GAAG;IACjC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAA;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAA;CA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AQlC;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,qBAsB5B;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,SAAS,CAAC,KAAK,qBAQjC;AAED,iBAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,aAAa,CAAC,qBAa5D;AAED,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,eAAe,CAAC,qBAa9D;AAED,OAAO,EACL,MAAM,EACN,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,WAAW,GACZ,CAAA"}
|
package/dist/ui/select.js
CHANGED
|
@@ -61,8 +61,24 @@ function SelectTrigger({ className, size = "default", variant = "field", childre
|
|
|
61
61
|
const settings = variant === "settings";
|
|
62
62
|
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, "data-variant": inline ? "inline" : settings ? "settings" : undefined, className: cn(inline ? INLINE_TRIGGER : "flex w-fit items-center justify-between gap-4 rounded-md border border-hairline bg-card px-[19px] py-[11px] text-body-sm text-foreground whitespace-nowrap transition-colors outline-none select-none focus-halo disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-steel in-data-[cg-surface=panel]:data-placeholder:text-muted-foreground in-data-[cg-surface=ink]:data-placeholder:text-muted-foreground data-[size=default]:h-10 data-[size=sm]:h-7 data-[size=sm]:gap-1.5 data-[size=sm]:py-2 data-[size=sm]:pr-2 data-[size=sm]:pl-2.5 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", !inline && size === "md" && MD_TRIGGER, settings && SETTINGS_TRIGGER, className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { render: _jsx(ChevronDownIcon, { className: inline ? "pointer-events-none size-4 text-current" : "pointer-events-none size-4 text-muted-foreground" }) })] }));
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
/**
|
|
65
|
+
* ## Where the menu opens (ui#504)
|
|
66
|
+
*
|
|
67
|
+
* Under its field, 4 below it (the gap `DropdownMenu` and `Tooltip` use), with
|
|
68
|
+
* the field's left edge and width. With no room below, Base UI flips it above,
|
|
69
|
+
* 4 over the field, on the same edge. An option longer than the field widens
|
|
70
|
+
* the menu to the right rather than being cut (`w-max`, never narrower than
|
|
71
|
+
* the field, never wider than the window).
|
|
72
|
+
*
|
|
73
|
+
* It used to default to `alignItemWithTrigger`: the menu was moved so the
|
|
74
|
+
* selected option's text sat on the field's text. An option's text is 6 in,
|
|
75
|
+
* and the field's 20 (15 in the filter row and the settings field, 13 in
|
|
76
|
+
* `md`, 11 in `sm`), so every menu opened that far to the right of its field
|
|
77
|
+
* and, as wide as the field or a 144 floor, stuck out past its right edge.
|
|
78
|
+
* A caller can still opt back in with `alignItemWithTrigger`.
|
|
79
|
+
*/
|
|
80
|
+
function SelectContent({ className, children, side = "bottom", sideOffset = 4, align = "start", alignOffset = 0, alignItemWithTrigger = false, ...props }) {
|
|
81
|
+
return (_jsx(SelectPrimitive.Portal, { children: _jsx(SelectPrimitive.Positioner, { side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset, alignItemWithTrigger: alignItemWithTrigger, className: "isolate z-50", children: _jsxs(SelectPrimitive.Popup, { "data-slot": "select-content", "data-align-trigger": alignItemWithTrigger, className: cn("relative isolate z-50 max-h-(--available-height) w-max max-w-(--available-width) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className), ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.List, { children: children }), _jsx(SelectScrollDownButton, {})] }) }) }));
|
|
66
82
|
}
|
|
67
83
|
function SelectLabel({ className, ...props }) {
|
|
68
84
|
return (_jsx(SelectPrimitive.GroupLabel, { "data-slot": "select-label", className: cn("px-1.5 py-1 text-caption text-muted-foreground", className), ...props }));
|
package/dist/ui/select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/ui/select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAE/E,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAA;AAEnC,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IACvE,OAAO,CACL,KAAC,eAAe,CAAC,KAAK,iBACV,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,iBAAiB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