@cloudgrid-io/ui 0.53.1 → 0.54.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/avatar.d.ts +8 -2
- package/dist/blocks/avatar.d.ts.map +1 -1
- package/dist/blocks/avatar.js +17 -8
- package/dist/blocks/avatar.js.map +1 -1
- package/dist/blocks/confirm-delete-dialog.d.ts +37 -2
- package/dist/blocks/confirm-delete-dialog.d.ts.map +1 -1
- package/dist/blocks/confirm-delete-dialog.js +32 -7
- package/dist/blocks/confirm-delete-dialog.js.map +1 -1
- package/dist/blocks/danger-zone.d.ts +16 -0
- package/dist/blocks/danger-zone.d.ts.map +1 -0
- package/dist/blocks/danger-zone.js +30 -0
- package/dist/blocks/danger-zone.js.map +1 -0
- package/dist/blocks/filter-bar.d.ts +38 -0
- package/dist/blocks/filter-bar.d.ts.map +1 -0
- package/dist/blocks/filter-bar.js +37 -0
- package/dist/blocks/filter-bar.js.map +1 -0
- package/dist/blocks/grid-profile.d.ts +46 -0
- package/dist/blocks/grid-profile.d.ts.map +1 -0
- package/dist/blocks/grid-profile.js +41 -0
- package/dist/blocks/grid-profile.js.map +1 -0
- package/dist/blocks/icons.d.ts +29 -0
- package/dist/blocks/icons.d.ts.map +1 -1
- package/dist/blocks/icons.js +29 -0
- package/dist/blocks/icons.js.map +1 -1
- package/dist/blocks/impact-list.d.ts +28 -0
- package/dist/blocks/impact-list.d.ts.map +1 -0
- package/dist/blocks/impact-list.js +31 -0
- package/dist/blocks/impact-list.js.map +1 -0
- package/dist/blocks/meter.d.ts +42 -3
- package/dist/blocks/meter.d.ts.map +1 -1
- package/dist/blocks/meter.js +27 -2
- package/dist/blocks/meter.js.map +1 -1
- package/dist/blocks/phosphor-marks.d.ts +14 -0
- package/dist/blocks/phosphor-marks.d.ts.map +1 -1
- package/dist/blocks/phosphor-marks.js +21 -0
- package/dist/blocks/phosphor-marks.js.map +1 -1
- package/dist/blocks/section-heading.d.ts +20 -1
- package/dist/blocks/section-heading.d.ts.map +1 -1
- package/dist/blocks/section-heading.js +19 -2
- package/dist/blocks/section-heading.js.map +1 -1
- package/dist/blocks/segmented-choice.d.ts +41 -0
- package/dist/blocks/segmented-choice.d.ts.map +1 -0
- package/dist/blocks/segmented-choice.js +11 -0
- package/dist/blocks/segmented-choice.js.map +1 -0
- package/dist/blocks/settings-frame.d.ts +51 -0
- package/dist/blocks/settings-frame.d.ts.map +1 -0
- package/dist/blocks/settings-frame.js +53 -0
- package/dist/blocks/settings-frame.js.map +1 -0
- package/dist/blocks/settings-row.d.ts +102 -0
- package/dist/blocks/settings-row.d.ts.map +1 -0
- package/dist/blocks/settings-row.js +175 -0
- package/dist/blocks/settings-row.js.map +1 -0
- package/dist/blocks/side-nav.d.ts +51 -5
- package/dist/blocks/side-nav.d.ts.map +1 -1
- package/dist/blocks/side-nav.js +184 -12
- package/dist/blocks/side-nav.js.map +1 -1
- package/dist/blocks/theme-preview.d.ts +60 -0
- package/dist/blocks/theme-preview.d.ts.map +1 -0
- package/dist/blocks/theme-preview.js +31 -0
- package/dist/blocks/theme-preview.js.map +1 -0
- package/dist/blocks/usage-meter.d.ts +71 -0
- package/dist/blocks/usage-meter.d.ts.map +1 -0
- package/dist/blocks/usage-meter.js +65 -0
- package/dist/blocks/usage-meter.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/ui/accordion.d.ts +7 -1
- package/dist/ui/accordion.d.ts.map +1 -1
- package/dist/ui/accordion.js +3 -3
- package/dist/ui/accordion.js.map +1 -1
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +22 -3
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/combobox.js +1 -1
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/input-group.js +1 -1
- package/dist/ui/input-group.js.map +1 -1
- package/dist/ui/input.d.ts.map +1 -1
- package/dist/ui/input.js +3 -2
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/number-field.js +3 -3
- package/dist/ui/number-field.js.map +1 -1
- package/dist/ui/select.js +1 -1
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/table.d.ts +11 -1
- package/dist/ui/table.d.ts.map +1 -1
- package/dist/ui/table.js +16 -34
- package/dist/ui/table.js.map +1 -1
- package/dist/ui/tabs.d.ts +1 -1
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +8 -1
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/textarea.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* THE SEGMENTED CHOICE (ui#494): a setting with a few named answers, side by
|
|
4
|
+
* side in one box, one of them in force. General's "CloudGrid badge: Always /
|
|
5
|
+
* Builder decides / Never".
|
|
6
|
+
*
|
|
7
|
+
* ## A radio group, not FilterTabs
|
|
8
|
+
*
|
|
9
|
+
* `FilterTabs` looks close and means something else: it is a filter over a
|
|
10
|
+
* list, buttons with `aria-pressed`. A setting is one answer out of several, so
|
|
11
|
+
* this is a `radiogroup` of `radio`s (Base UI's): a screen reader hears "radio
|
|
12
|
+
* button, 2 of 3, checked", the arrow keys move the choice and Tab leaves the
|
|
13
|
+
* group in one step, which is what a reader of a settings page expects.
|
|
14
|
+
*
|
|
15
|
+
* ## The look
|
|
16
|
+
*
|
|
17
|
+
* One 40px box with a hairline and 3px of inner room, so it stands exactly as
|
|
18
|
+
* tall as the `Select`s and `Input`s in the rows around it (Asaf's rule: the
|
|
19
|
+
* controls in a row share one height). Each answer is a 32px segment, 16 aside,
|
|
20
|
+
* Regular 15 in body text. The answer in force is Medium in Primary press on
|
|
21
|
+
* Primary 20: the selected filter tab's pair (#436, ui#477, 5.34:1), so the
|
|
22
|
+
* library has one "this one" look. Those two are `:root` values and do not
|
|
23
|
+
* flip, the side nav chip's rule (#436). Hover is the surface's own wash.
|
|
24
|
+
* Keyboard focus draws the focus line, after keyboard use only (ui#441).
|
|
25
|
+
*/
|
|
26
|
+
export type SegmentedChoiceOption<Value extends string = string> = {
|
|
27
|
+
value: Value;
|
|
28
|
+
label: React.ReactNode;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
};
|
|
31
|
+
declare function SegmentedChoice<Value extends string = string>({ options, value, defaultValue, onValueChange, disabled, className, ...props }: Omit<React.ComponentProps<"div">, "defaultValue" | "onChange" | "children" | "role"> & {
|
|
32
|
+
options: readonly SegmentedChoiceOption<Value>[];
|
|
33
|
+
/** Controlled. Pass `onValueChange` with it. */
|
|
34
|
+
value?: Value;
|
|
35
|
+
/** Uncontrolled starting answer. */
|
|
36
|
+
defaultValue?: Value;
|
|
37
|
+
onValueChange?: (value: Value) => void;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
}): React.JSX.Element;
|
|
40
|
+
export { SegmentedChoice };
|
|
41
|
+
//# sourceMappingURL=segmented-choice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented-choice.d.ts","sourceRoot":"","sources":["../../src/blocks/segmented-choice.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,MAAM,qBAAqB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI;IACjE,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,iBAAS,eAAe,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,EACtD,OAAO,EACP,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC,GAAG;IACxF,OAAO,EAAE,SAAS,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAA;IAChD,gDAAgD;IAChD,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,oCAAoC;IACpC,YAAY,CAAC,EAAE,KAAK,CAAA;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,qBAgCA;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Radio as RadioPrimitive } from "@base-ui/react/radio";
|
|
5
|
+
import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
|
|
6
|
+
import { cn } from "../lib/cloudgrid-cn.js";
|
|
7
|
+
function SegmentedChoice({ options, value, defaultValue, onValueChange, disabled, className, ...props }) {
|
|
8
|
+
return (_jsx(RadioGroupPrimitive, { "data-slot": "segmented-choice", value: value, defaultValue: defaultValue, disabled: disabled, onValueChange: (next) => onValueChange?.(next), className: cn("inline-flex h-10 w-fit max-w-full items-center gap-0.5 rounded-md border border-hairline bg-card p-[3px] text-ink", className), ...props, children: options.map((option) => (_jsx(RadioPrimitive.Root, { value: option.value, disabled: option.disabled, "data-slot": "segmented-choice-option", className: cn("inline-flex h-8 min-w-0 cursor-pointer items-center justify-center rounded-sm px-4 font-ui text-body-sm leading-none whitespace-nowrap text-body transition-colors focus-line", "hover:bg-(--cg-hover) hover:text-ink", "data-checked:bg-brand-20 data-checked:font-medium data-checked:text-brand-press data-checked:hover:bg-brand-20 data-checked:hover:text-brand-press", "data-disabled:cursor-not-allowed data-disabled:opacity-50"), children: option.label }, option.value))) }));
|
|
9
|
+
}
|
|
10
|
+
export { SegmentedChoice };
|
|
11
|
+
//# sourceMappingURL=segmented-choice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented-choice.js","sourceRoot":"","sources":["../../src/blocks/segmented-choice.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,UAAU,IAAI,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAE9E,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAiCvC,SAAS,eAAe,CAAgC,EACtD,OAAO,EACP,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EAST;IACC,OAAO,CACL,KAAC,mBAAmB,iBACR,kBAAkB,EAC5B,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,EAAE,CAAC,IAAa,CAAC,EACvD,SAAS,EAAE,EAAE,CACX,mHAAmH,EACnH,SAAS,CACV,KACG,KAAK,YAER,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,KAAC,cAAc,CAAC,IAAI,IAElB,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,eACf,yBAAyB,EACnC,SAAS,EAAE,EAAE,CACX,+KAA+K,EAC/K,sCAAsC,EACtC,oJAAoJ,EACpJ,2DAA2D,CAC5D,YAEA,MAAM,CAAC,KAAK,IAXR,MAAM,CAAC,KAAK,CAYG,CACvB,CAAC,GACkB,CACvB,CAAA;AACH,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* THE SETTINGS FRAME (ui#494, the Grid settings redesign).
|
|
4
|
+
*
|
|
5
|
+
* One connected white panel: the settings menu on the left, a thin divider, the
|
|
6
|
+
* settings on the right. Not two floating boxes. The header above it is the
|
|
7
|
+
* caller's and is not part of the frame.
|
|
8
|
+
*
|
|
9
|
+
* ## The menu stays still; only the settings scroll
|
|
10
|
+
*
|
|
11
|
+
* From the tablet width up (`md`) the frame is a row, as tall as the box the
|
|
12
|
+
* caller gives it (`md:h-full`; the Console sizes that box to the window under
|
|
13
|
+
* its header). The settings column is the scroller (`overflow-y-auto`), so a
|
|
14
|
+
* long page scrolls under a menu that does not move. The menu column scrolls
|
|
15
|
+
* on its own only if the window is shorter than the menu.
|
|
16
|
+
*
|
|
17
|
+
* ## Phone width
|
|
18
|
+
*
|
|
19
|
+
* Below `md` the frame is a column and the page scrolls as usual. The menu
|
|
20
|
+
* folds behind a button at the top of the frame that names the page you are on
|
|
21
|
+
* ("Menu · General"); it opens the menu above the settings, and choosing a row
|
|
22
|
+
* (a link or a side-nav row) folds it again. Every column is `min-w-0`, so
|
|
23
|
+
* nothing in the frame can push the page sideways: a wide table scrolls in its
|
|
24
|
+
* own box, not the window.
|
|
25
|
+
*
|
|
26
|
+
* The fold is done with classes (`hidden` / `flex`, and `md:flex` always), not
|
|
27
|
+
* with the `hidden` attribute: Tailwind's preflight makes `[hidden]` an
|
|
28
|
+
* `!important` none, which would keep the menu hidden at desktop width too.
|
|
29
|
+
*
|
|
30
|
+
* ## The measures, on the 4px scale
|
|
31
|
+
*
|
|
32
|
+
* The menu column is 264 wide (`w-66`), 20 in on the sides and 32 from the top;
|
|
33
|
+
* the settings column is 56 in on the sides and 48 from the top. The panel is
|
|
34
|
+
* the card ground with the container radius and a hairline, and it flips with
|
|
35
|
+
* the surface like any card; `text-ink` because text does not flip by
|
|
36
|
+
* inheritance.
|
|
37
|
+
*/
|
|
38
|
+
declare function SettingsFrame({ menu, title, current, menuLabel, defaultMenuOpen, className, children, ...props }: Omit<React.ComponentProps<"div">, "title"> & {
|
|
39
|
+
/** The menu column's content: a `SideNav` with its search. */
|
|
40
|
+
menu: React.ReactNode;
|
|
41
|
+
/** The words over the menu: "Grid settings". */
|
|
42
|
+
title?: React.ReactNode;
|
|
43
|
+
/** The page you are on, named on the phone's fold button. */
|
|
44
|
+
current?: React.ReactNode;
|
|
45
|
+
/** The fold button's word. */
|
|
46
|
+
menuLabel?: string;
|
|
47
|
+
/** Start with the phone fold open. */
|
|
48
|
+
defaultMenuOpen?: boolean;
|
|
49
|
+
}): React.JSX.Element;
|
|
50
|
+
export { SettingsFrame };
|
|
51
|
+
//# sourceMappingURL=settings-frame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-frame.d.ts","sourceRoot":"","sources":["../../src/blocks/settings-frame.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,iBAAS,aAAa,CAAC,EACrB,IAAI,EACJ,KAAK,EACL,OAAO,EACP,SAAkB,EAClB,eAAuB,EACvB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,GAAG;IAC9C,8DAA8D;IAC9D,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,gDAAgD;IAChD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sCAAsC;IACtC,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,qBAiEA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { ChevronDownIcon, MenuIcon } from "./icons.js";
|
|
6
|
+
/**
|
|
7
|
+
* THE SETTINGS FRAME (ui#494, the Grid settings redesign).
|
|
8
|
+
*
|
|
9
|
+
* One connected white panel: the settings menu on the left, a thin divider, the
|
|
10
|
+
* settings on the right. Not two floating boxes. The header above it is the
|
|
11
|
+
* caller's and is not part of the frame.
|
|
12
|
+
*
|
|
13
|
+
* ## The menu stays still; only the settings scroll
|
|
14
|
+
*
|
|
15
|
+
* From the tablet width up (`md`) the frame is a row, as tall as the box the
|
|
16
|
+
* caller gives it (`md:h-full`; the Console sizes that box to the window under
|
|
17
|
+
* its header). The settings column is the scroller (`overflow-y-auto`), so a
|
|
18
|
+
* long page scrolls under a menu that does not move. The menu column scrolls
|
|
19
|
+
* on its own only if the window is shorter than the menu.
|
|
20
|
+
*
|
|
21
|
+
* ## Phone width
|
|
22
|
+
*
|
|
23
|
+
* Below `md` the frame is a column and the page scrolls as usual. The menu
|
|
24
|
+
* folds behind a button at the top of the frame that names the page you are on
|
|
25
|
+
* ("Menu · General"); it opens the menu above the settings, and choosing a row
|
|
26
|
+
* (a link or a side-nav row) folds it again. Every column is `min-w-0`, so
|
|
27
|
+
* nothing in the frame can push the page sideways: a wide table scrolls in its
|
|
28
|
+
* own box, not the window.
|
|
29
|
+
*
|
|
30
|
+
* The fold is done with classes (`hidden` / `flex`, and `md:flex` always), not
|
|
31
|
+
* with the `hidden` attribute: Tailwind's preflight makes `[hidden]` an
|
|
32
|
+
* `!important` none, which would keep the menu hidden at desktop width too.
|
|
33
|
+
*
|
|
34
|
+
* ## The measures, on the 4px scale
|
|
35
|
+
*
|
|
36
|
+
* The menu column is 264 wide (`w-66`), 20 in on the sides and 32 from the top;
|
|
37
|
+
* the settings column is 56 in on the sides and 48 from the top. The panel is
|
|
38
|
+
* the card ground with the container radius and a hairline, and it flips with
|
|
39
|
+
* the surface like any card; `text-ink` because text does not flip by
|
|
40
|
+
* inheritance.
|
|
41
|
+
*/
|
|
42
|
+
function SettingsFrame({ menu, title, current, menuLabel = "Menu", defaultMenuOpen = false, className, children, ...props }) {
|
|
43
|
+
const menuId = React.useId();
|
|
44
|
+
const [open, setOpen] = React.useState(defaultMenuOpen);
|
|
45
|
+
function closeOnChoice(event) {
|
|
46
|
+
const target = event.target;
|
|
47
|
+
if (target.closest('a[href],[data-slot="side-nav-item"],[data-slot="side-nav-result"]'))
|
|
48
|
+
setOpen(false);
|
|
49
|
+
}
|
|
50
|
+
return (_jsxs("div", { "data-slot": "settings-frame", className: cn("flex min-h-0 w-full min-w-0 flex-col overflow-hidden rounded-container border border-hairline bg-card text-ink md:h-full md:flex-row", className), ...props, children: [_jsxs("div", { "data-slot": "settings-frame-menu", className: "flex min-w-0 flex-col gap-4 border-b border-hairline p-5 md:w-66 md:shrink-0 md:overflow-y-auto md:border-r md:border-b-0 md:pt-8", children: [title ? (_jsx("div", { "data-slot": "settings-frame-title", className: "text-heading-lg font-medium text-ink", children: title })) : null, _jsxs("button", { type: "button", "data-slot": "settings-frame-toggle", "aria-expanded": open, "aria-controls": menuId, onClick: () => setOpen((v) => !v), className: "flex h-10 w-full min-w-0 items-center gap-3 rounded-md border border-hairline px-[19px] text-left text-body-sm text-ink transition-colors hover:bg-(--cg-hover) focus-line md:hidden", children: [_jsx(MenuIcon, { className: "size-5 shrink-0 text-steel in-data-[cg-surface=panel]:text-faint in-data-[cg-surface=ink]:text-faint" }), _jsxs("span", { className: "min-w-0 flex-1 truncate", children: [menuLabel, current ? _jsxs("span", { className: "text-faint-strong", children: [" \u00B7 ", current] }) : null] }), _jsx(ChevronDownIcon, { className: cn("size-4 shrink-0 transition-transform duration-(--cg-duration)", open ? "rotate-180" : "rotate-0") })] }), _jsx("div", { id: menuId, "data-slot": "settings-frame-menu-panel", onClick: closeOnChoice, className: cn("min-w-0 flex-col gap-4 md:flex", open ? "flex" : "hidden"), children: menu })] }), _jsx("div", { "data-slot": "settings-frame-content", className: "min-w-0 flex-1 p-5 md:overflow-y-auto md:px-14 md:py-12", children: children })] }));
|
|
51
|
+
}
|
|
52
|
+
export { SettingsFrame };
|
|
53
|
+
//# sourceMappingURL=settings-frame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-frame.js","sourceRoot":"","sources":["../../src/blocks/settings-frame.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,SAAS,aAAa,CAAC,EACrB,IAAI,EACJ,KAAK,EACL,OAAO,EACP,SAAS,GAAG,MAAM,EAClB,eAAe,GAAG,KAAK,EACvB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EAYT;IACC,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;IAC5B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;IAEvD,SAAS,aAAa,CAAC,KAAuC;QAC5D,MAAM,MAAM,GAAG,KAAK,CAAC,MAAqB,CAAA;QAC1C,IAAI,MAAM,CAAC,OAAO,CAAC,mEAAmE,CAAC;YAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IACzG,CAAC;IAED,OAAO,CACL,4BACY,gBAAgB,EAC1B,SAAS,EAAE,EAAE,CACX,sIAAsI,EACtI,SAAS,CACV,KACG,KAAK,aAET,4BACY,qBAAqB,EAC/B,SAAS,EAAC,mIAAmI,aAE5I,KAAK,CAAC,CAAC,CAAC,CACP,2BAAe,sBAAsB,EAAC,SAAS,EAAC,sCAAsC,YACnF,KAAK,GACF,CACP,CAAC,CAAC,CAAC,IAAI,EACR,kBACE,IAAI,EAAC,QAAQ,eACH,uBAAuB,mBAClB,IAAI,mBACJ,MAAM,EACrB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EACjC,SAAS,EAAC,sLAAsL,aAEhM,KAAC,QAAQ,IAAC,SAAS,EAAC,sGAAsG,GAAG,EAC7H,gBAAM,SAAS,EAAC,yBAAyB,aACtC,SAAS,EACT,OAAO,CAAC,CAAC,CAAC,gBAAM,SAAS,EAAC,mBAAmB,yBAAK,OAAO,IAAQ,CAAC,CAAC,CAAC,IAAI,IACpE,EACP,KAAC,eAAe,IACd,SAAS,EAAE,EAAE,CACX,+DAA+D,EAC/D,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CACjC,GACD,IACK,EAET,cACE,EAAE,EAAE,MAAM,eACA,2BAA2B,EACrC,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,EAAE,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,YAExE,IAAI,GACD,IACF,EACN,2BACY,wBAAwB,EAClC,SAAS,EAAC,yDAAyD,YAElE,QAAQ,GACL,IACF,CACP,CAAA;AACH,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
type SettingsRowControl = React.ReactNode | ((ids: {
|
|
4
|
+
labelId: string;
|
|
5
|
+
descriptionId: string | undefined;
|
|
6
|
+
}) => React.ReactNode);
|
|
7
|
+
declare function SettingsRow({ label, description, link, control, comingSoon, highlighted, align, className, ...props }: Omit<React.ComponentProps<"div">, "children" | "role"> & {
|
|
8
|
+
/**
|
|
9
|
+
* `center` (default): the control on the row's centre line. `start`: on the
|
|
10
|
+
* label's line, for a control taller than the text (the theme card).
|
|
11
|
+
*/
|
|
12
|
+
align?: "center" | "start";
|
|
13
|
+
/** The setting's name. Names the row's group. */
|
|
14
|
+
label: React.ReactNode;
|
|
15
|
+
/** The help line under the label, in the caption role. */
|
|
16
|
+
description?: React.ReactNode;
|
|
17
|
+
/** A link under the help ("Manage spaces"), usually a `SettingsLink`. */
|
|
18
|
+
link?: React.ReactNode;
|
|
19
|
+
/** The control on the right. A function receives the ids that name it. */
|
|
20
|
+
control?: SettingsRowControl;
|
|
21
|
+
/** Designed, not built: tagged, greyed, the control not usable. */
|
|
22
|
+
comingSoon?: boolean;
|
|
23
|
+
/** The search jumped here: draw the soft ground. */
|
|
24
|
+
highlighted?: boolean;
|
|
25
|
+
}): React.JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* A section of settings: its heading, then its rows. `title`, `icon`,
|
|
28
|
+
* `description` and `action` are `SectionHeading`'s; the heading level is the
|
|
29
|
+
* caller's, as there.
|
|
30
|
+
*/
|
|
31
|
+
declare function SettingsSection({ title, icon, description, action, level, comingSoon, className, children, ...props }: Omit<React.ComponentProps<"section">, "title"> & {
|
|
32
|
+
title: React.ReactNode;
|
|
33
|
+
icon?: React.ReactNode;
|
|
34
|
+
description?: React.ReactNode;
|
|
35
|
+
action?: React.ReactNode;
|
|
36
|
+
level?: 2 | 3 | 4;
|
|
37
|
+
/** Designed, not built: one tag on the heading, every row and the action unusable. */
|
|
38
|
+
comingSoon?: boolean;
|
|
39
|
+
}): React.JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* The brand text link with the leave-arrow: "Manage plan", "Manage spaces",
|
|
42
|
+
* "Manage budgets in Usage". The accent text role, so it is purple on the
|
|
43
|
+
* page, white on the panel and lime on ink; an underline on hover; the focus
|
|
44
|
+
* line after keyboard use only. `render` swaps the anchor for a router link.
|
|
45
|
+
*/
|
|
46
|
+
declare function SettingsLink({ render, className, children, ...props }: useRender.ComponentProps<"a">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
47
|
+
/**
|
|
48
|
+
* A value with an edit pencil: the administrative contact, the grid's name.
|
|
49
|
+
* The pencil is a 24px button whose name says what it edits ("Edit
|
|
50
|
+
* administrative contact"), so a screen reader that lands on it does not hear
|
|
51
|
+
* a bare "Edit". It sits 4px out past the value's right edge (`-me-1`), so the
|
|
52
|
+
* glyph, not the button's box, lines up with the right edge of the controls in
|
|
53
|
+
* the rows above and below. No `onEdit`, no pencil: a pencil that does nothing
|
|
54
|
+
* would say the value can be changed when it cannot.
|
|
55
|
+
*/
|
|
56
|
+
declare function EditableValue({ value, label, onEdit, valueClassName, className, ...props }: Omit<React.ComponentProps<"span">, "children"> & {
|
|
57
|
+
/** What is shown. */
|
|
58
|
+
value: React.ReactNode;
|
|
59
|
+
/** The value's type and colour, when it is not a row's 15px ink (the Grid's name). */
|
|
60
|
+
valueClassName?: string;
|
|
61
|
+
/** What the pencil edits, in words: "administrative contact". */
|
|
62
|
+
label: string;
|
|
63
|
+
onEdit?: () => void;
|
|
64
|
+
}): React.JSX.Element;
|
|
65
|
+
/**
|
|
66
|
+
* A SUMMARY BLOCK (ui#494): Billing's plan and payment method, as the design
|
|
67
|
+
* draws them. A glyph, a large title with a line under it, optionally a large
|
|
68
|
+
* figure in its own column with a note under it, and the action at the end.
|
|
69
|
+
*
|
|
70
|
+
* ```
|
|
71
|
+
* (●) Free plan $0 / month [ Manage plan ]
|
|
72
|
+
* Launch period
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* The title and the figure are the 24px title rung, Medium; the lines under
|
|
76
|
+
* them are body text. The glyph is decorative (the title says what it is). In
|
|
77
|
+
* a Coming soon section the action is inert and greyed, as a row's control is.
|
|
78
|
+
*/
|
|
79
|
+
declare function SettingsSummary({ glyph, title, description, figure, figureNote, action, size, className, ...props }: Omit<React.ComponentProps<"div">, "title" | "children"> & {
|
|
80
|
+
/** `lg`: the plan's 24px title. `md`: the payment method's 18px one. */
|
|
81
|
+
size?: "lg" | "md";
|
|
82
|
+
glyph?: React.ReactNode;
|
|
83
|
+
title: React.ReactNode;
|
|
84
|
+
description?: React.ReactNode;
|
|
85
|
+
figure?: React.ReactNode;
|
|
86
|
+
figureNote?: React.ReactNode;
|
|
87
|
+
action?: React.ReactNode;
|
|
88
|
+
}): React.JSX.Element;
|
|
89
|
+
/**
|
|
90
|
+
* Label and value pairs (ui#494): Billing details as the design draws them,
|
|
91
|
+
* two columns, the labels in the quiet tone, no rules between. A real
|
|
92
|
+
* description list, so a screen reader pairs each value with its label.
|
|
93
|
+
*/
|
|
94
|
+
declare function DetailList({ items, className, ...props }: Omit<React.ComponentProps<"dl">, "children"> & {
|
|
95
|
+
items: readonly {
|
|
96
|
+
label: React.ReactNode;
|
|
97
|
+
value: React.ReactNode;
|
|
98
|
+
}[];
|
|
99
|
+
}): React.JSX.Element;
|
|
100
|
+
export { DetailList, EditableValue, SettingsLink, SettingsRow, SettingsSection, SettingsSummary };
|
|
101
|
+
export type { SettingsRowControl };
|
|
102
|
+
//# sourceMappingURL=settings-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-row.d.ts","sourceRoot":"","sources":["../../src/blocks/settings-row.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AA8FrD,KAAK,kBAAkB,GACnB,KAAK,CAAC,SAAS,GACf,CAAC,CAAC,GAAG,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;AAEtF,iBAAS,WAAW,CAAC,EACnB,KAAK,EACL,WAAW,EACX,IAAI,EACJ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AChD,KAAK,EAAE,SAAS;QAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,EAAE,CAAA;CACrE,qBAeA;AAED,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,CAAA;AACjG,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
import { cn } from "../lib/cloudgrid-cn.js";
|
|
6
|
+
import { ComingSoonTag } from "./coming-soon-tag.js";
|
|
7
|
+
import { EditIcon, OpenLiveIcon } from "./icons.js";
|
|
8
|
+
import { SectionHeading } from "./section-heading.js";
|
|
9
|
+
/**
|
|
10
|
+
* THE SETTINGS PAGE'S ROWS (ui#494, the Grid settings redesign).
|
|
11
|
+
*
|
|
12
|
+
* Every Grid settings page (General, Permissions, Usage, Billing) is the same
|
|
13
|
+
* shape: a section heading, then rows with the label and its help on the left
|
|
14
|
+
* and the control on the right, a hairline between them.
|
|
15
|
+
*
|
|
16
|
+
* SettingsSection the heading (`SectionHeading`, with its optional glyph and
|
|
17
|
+
* subtitle) over a column of rows. The `<section>` is named
|
|
18
|
+
* by its heading.
|
|
19
|
+
* SettingsRow one setting. The control is the caller's: a `Select`, a
|
|
20
|
+
* `Switch`, a `SegmentedChoice`, an `EditableValue`, a
|
|
21
|
+
* `Button`, a `SettingsLink`. The row owns the arrangement.
|
|
22
|
+
* SettingsLink the brand text link with the leave-arrow ("Manage plan",
|
|
23
|
+
* "Manage spaces"). Not `Button variant="link"`: that one
|
|
24
|
+
* carries 10px of padding, which pulls the link's text off
|
|
25
|
+
* the label's left edge above it.
|
|
26
|
+
* EditableValue a value with an edit pencil (the administrative contact,
|
|
27
|
+
* the grid's name and description).
|
|
28
|
+
*
|
|
29
|
+
* ## The alignment rules (Asaf, 2026-11-16)
|
|
30
|
+
*
|
|
31
|
+
* Everything lines up even where the design screenshots do not:
|
|
32
|
+
*
|
|
33
|
+
* - The control is centred on the row's centre line (`sm:items-center`), at
|
|
34
|
+
* any height of the text column. A one-line row with a button beside it puts
|
|
35
|
+
* the button on the line, not under it.
|
|
36
|
+
* - The text column's left edge is the section heading's left edge: the row
|
|
37
|
+
* has no horizontal padding of its own, and the highlight is drawn OUTSIDE
|
|
38
|
+
* the text box (see below), so nothing moves when a row lights up.
|
|
39
|
+
* - Spacing comes from the 4px scale (`py-4`, `gap-1`, `gap-8`).
|
|
40
|
+
*
|
|
41
|
+
* ## A row is a named group
|
|
42
|
+
*
|
|
43
|
+
* `role="group"`, named by the label (`aria-labelledby`) and described by the
|
|
44
|
+
* help line. A control passed as a FUNCTION receives those two ids, so a
|
|
45
|
+
* `Select` or `Switch` can be named by the visible label rather than by a
|
|
46
|
+
* second, invisible one that could drift from it:
|
|
47
|
+
*
|
|
48
|
+
* <SettingsRow
|
|
49
|
+
* label="Grid timezone"
|
|
50
|
+
* description="Used for schedules and Grid summaries."
|
|
51
|
+
* control={({ labelId, descriptionId }) => (
|
|
52
|
+
* <SelectTrigger aria-labelledby={labelId} aria-describedby={descriptionId}>...
|
|
53
|
+
* )}
|
|
54
|
+
* />
|
|
55
|
+
*
|
|
56
|
+
* ## Coming soon (`comingSoon`)
|
|
57
|
+
*
|
|
58
|
+
* A setting that is designed and not built yet is SHOWN, never hidden and
|
|
59
|
+
* never faked (cloudgrid-console#1068's rule). The row keeps its label, help
|
|
60
|
+
* and control, and:
|
|
61
|
+
*
|
|
62
|
+
* - the `ComingSoonTag` sits after the label and is part of the group's name,
|
|
63
|
+
* so a screen reader hears "Grid theme, Coming soon";
|
|
64
|
+
* - the group carries `aria-disabled="true"`: it is announced as unavailable;
|
|
65
|
+
* - the control is `inert`: out of the tab order, no clicks, no hover, and it
|
|
66
|
+
* cannot be reached by a screen reader's virtual cursor either, so nothing
|
|
67
|
+
* there pretends to be operable. Its words are still on the page, greyed to
|
|
68
|
+
* 50% like `DisabledButton`'s, and the help line says what the setting does;
|
|
69
|
+
* - the label and help keep their colours. Greying them as well would put the
|
|
70
|
+
* help under 4.5:1, and it is the part a reader still needs.
|
|
71
|
+
*
|
|
72
|
+
* ## A whole section Coming soon (`SettingsSection comingSoon`)
|
|
73
|
+
*
|
|
74
|
+
* Billing during the launch period: every part of the page is designed and
|
|
75
|
+
* shown, none of it works yet. One tag on the section's heading rather than
|
|
76
|
+
* one per row; the section is named "Billing details, Coming soon"; every `SettingsRow` inside behaves as a Coming soon row
|
|
77
|
+
* without a tag of its own (each is `aria-disabled`); and the heading's
|
|
78
|
+
* `action` ("Edit details") is inert and greyed like the rows' controls. The
|
|
79
|
+
* section stays a region, so it carries no `aria-disabled` of its own; its
|
|
80
|
+
* name says Coming soon.
|
|
81
|
+
*
|
|
82
|
+
* ## The highlight (`highlighted`)
|
|
83
|
+
*
|
|
84
|
+
* The settings search opens a page and points at one row ("Timezone ·
|
|
85
|
+
* General"). The caller scrolls to the row (`id` is on it, `scroll-mt-6`
|
|
86
|
+
* leaves room above it) and sets `highlighted`; the row draws a soft ground
|
|
87
|
+
* that reaches 12px past the text on both sides, as a pseudo-element under the
|
|
88
|
+
* row, so the text does not move. The ground is the brand tint on the page and
|
|
89
|
+
* the surface's own wash on the panel and on ink, where the tint is a light
|
|
90
|
+
* colour under light text.
|
|
91
|
+
*/
|
|
92
|
+
/** True inside a `SettingsSection` that is Coming soon: its rows are unavailable. */
|
|
93
|
+
const SettingsSectionComingSoon = React.createContext(false);
|
|
94
|
+
function SettingsRow({ label, description, link, control, comingSoon = false, highlighted = false, align = "center", className, ...props }) {
|
|
95
|
+
const labelId = React.useId();
|
|
96
|
+
const tagId = React.useId();
|
|
97
|
+
const descriptionId = React.useId();
|
|
98
|
+
const sectionComingSoon = React.useContext(SettingsSectionComingSoon);
|
|
99
|
+
// Unavailable on its own (tagged) or because its section is (the tag is there).
|
|
100
|
+
const unavailable = comingSoon || sectionComingSoon;
|
|
101
|
+
const hasDescription = description !== undefined && description !== null && description !== false;
|
|
102
|
+
const describedBy = hasDescription ? descriptionId : undefined;
|
|
103
|
+
const rendered = typeof control === "function" ? control({ labelId, descriptionId: describedBy }) : control;
|
|
104
|
+
return (_jsxs("div", { "data-slot": "settings-row", role: "group", "aria-labelledby": comingSoon ? `${labelId} ${tagId}` : labelId, "aria-describedby": describedBy, "aria-disabled": unavailable ? "true" : undefined, "data-coming-soon": unavailable ? "" : undefined, "data-highlighted": highlighted ? "" : undefined, className: cn("relative isolate flex scroll-mt-6 flex-col gap-3 border-b border-hairline py-4 last:border-b-0", "sm:flex-row sm:justify-between sm:gap-8", align === "start" ? "sm:items-start" : "sm:items-center",
|
|
105
|
+
// The highlight, outside the text box: see the module note.
|
|
106
|
+
"before:pointer-events-none before:absolute before:inset-y-0 before:-inset-x-3 before:-z-10 before:rounded-md before:bg-brand-tint before:opacity-0 before:transition-opacity before:duration-(--cg-duration)", "in-data-[cg-surface=panel]:before:bg-(--cg-hover) in-data-[cg-surface=ink]:before:bg-(--cg-hover)", "data-highlighted:before:opacity-100", className), ...props, children: [_jsxs("div", { "data-slot": "settings-row-text", className: "grid min-w-0 flex-1 gap-1", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [_jsx("span", { id: labelId, "data-slot": "settings-row-label", className: "text-body-sm font-medium text-ink", children: label }), comingSoon ? _jsx(ComingSoonTag, { id: tagId }) : null] }), hasDescription ? (_jsx("p", { id: descriptionId, "data-slot": "settings-row-description", className: "m-0 text-caption text-faint-strong", children: description })) : null, link ? (_jsx("div", { "data-slot": "settings-row-link", className: "pt-1", children: link })) : null] }), rendered !== undefined && rendered !== null && rendered !== false ? (_jsx("div", { "data-slot": "settings-row-control", inert: unavailable, className: cn("flex min-w-0 shrink-0 items-center gap-3 sm:justify-end", unavailable && "opacity-50 select-none"), children: rendered })) : null] }));
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A section of settings: its heading, then its rows. `title`, `icon`,
|
|
110
|
+
* `description` and `action` are `SectionHeading`'s; the heading level is the
|
|
111
|
+
* caller's, as there.
|
|
112
|
+
*/
|
|
113
|
+
function SettingsSection({ title, icon, description, action, level = 2, comingSoon = false, className, children, ...props }) {
|
|
114
|
+
const headingId = React.useId();
|
|
115
|
+
const tagId = React.useId();
|
|
116
|
+
return (_jsxs("section", { "aria-labelledby": comingSoon ? `${headingId} ${tagId}` : headingId, "data-coming-soon": comingSoon ? "" : undefined, "data-slot": "settings-section", className: cn("grid min-w-0 scroll-mt-6 gap-2 text-ink", className), ...props, children: [_jsx(SectionHeading, { title: title, icon: icon, description: description, inline: comingSoon ? _jsx(ComingSoonTag, { id: tagId }) : undefined, action: action ? (_jsx("span", { "data-slot": "settings-section-action", inert: comingSoon, className: cn("inline-flex", comingSoon && "opacity-50 select-none"), children: action })) : undefined, level: level, headingId: headingId }), _jsx("div", { "data-slot": "settings-section-rows", className: "flex min-w-0 flex-col", children: _jsx(SettingsSectionComingSoon.Provider, { value: comingSoon, children: children }) })] }));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The brand text link with the leave-arrow: "Manage plan", "Manage spaces",
|
|
120
|
+
* "Manage budgets in Usage". The accent text role, so it is purple on the
|
|
121
|
+
* page, white on the panel and lime on ink; an underline on hover; the focus
|
|
122
|
+
* line after keyboard use only. `render` swaps the anchor for a router link.
|
|
123
|
+
*/
|
|
124
|
+
function SettingsLink({ render, className, children, ...props }) {
|
|
125
|
+
return useRender({
|
|
126
|
+
render,
|
|
127
|
+
defaultTagName: "a",
|
|
128
|
+
props: {
|
|
129
|
+
"data-slot": "settings-link",
|
|
130
|
+
className: cn("inline-flex w-fit items-center gap-1 rounded-xs text-caption font-medium whitespace-nowrap text-(--cg-text-accent) no-underline underline-offset-4 hover:underline focus-line", className),
|
|
131
|
+
children: (_jsxs(_Fragment, { children: [children, _jsx(OpenLiveIcon, { className: "size-3.5 shrink-0" })] })),
|
|
132
|
+
...props,
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* A value with an edit pencil: the administrative contact, the grid's name.
|
|
138
|
+
* The pencil is a 24px button whose name says what it edits ("Edit
|
|
139
|
+
* administrative contact"), so a screen reader that lands on it does not hear
|
|
140
|
+
* a bare "Edit". It sits 4px out past the value's right edge (`-me-1`), so the
|
|
141
|
+
* glyph, not the button's box, lines up with the right edge of the controls in
|
|
142
|
+
* the rows above and below. No `onEdit`, no pencil: a pencil that does nothing
|
|
143
|
+
* would say the value can be changed when it cannot.
|
|
144
|
+
*/
|
|
145
|
+
function EditableValue({ value, label, onEdit, valueClassName, className, ...props }) {
|
|
146
|
+
return (_jsxs("span", { "data-slot": "editable-value", className: cn("inline-flex min-w-0 items-center gap-2", className), ...props, children: [_jsx("span", { "data-slot": "editable-value-text", className: cn("min-w-0 truncate text-body-sm text-ink", valueClassName), children: value }), onEdit ? (_jsx("button", { type: "button", "aria-label": `Edit ${label}`, onClick: onEdit, className: "-me-1 inline-flex size-6 shrink-0 items-center justify-center rounded-xs text-body transition-colors hover:bg-(--cg-hover) hover:text-ink focus-line", children: _jsx(EditIcon, { className: "size-4" }) })) : null] }));
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A SUMMARY BLOCK (ui#494): Billing's plan and payment method, as the design
|
|
150
|
+
* draws them. A glyph, a large title with a line under it, optionally a large
|
|
151
|
+
* figure in its own column with a note under it, and the action at the end.
|
|
152
|
+
*
|
|
153
|
+
* ```
|
|
154
|
+
* (●) Free plan $0 / month [ Manage plan ]
|
|
155
|
+
* Launch period
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* The title and the figure are the 24px title rung, Medium; the lines under
|
|
159
|
+
* them are body text. The glyph is decorative (the title says what it is). In
|
|
160
|
+
* a Coming soon section the action is inert and greyed, as a row's control is.
|
|
161
|
+
*/
|
|
162
|
+
function SettingsSummary({ glyph, title, description, figure, figureNote, action, size = "lg", className, ...props }) {
|
|
163
|
+
const unavailable = React.useContext(SettingsSectionComingSoon);
|
|
164
|
+
return (_jsxs("div", { "data-slot": "settings-summary", className: cn("flex min-w-0 flex-wrap items-center gap-x-8 gap-y-4 py-4 text-ink", className), ...props, children: [_jsxs("div", { className: "flex min-w-0 items-center gap-5 sm:w-80", children: [glyph ? (_jsx("span", { "data-slot": "settings-summary-glyph", "aria-hidden": "true", className: "flex shrink-0 items-center justify-center", children: glyph })) : null, _jsxs("div", { className: "grid min-w-0 gap-1", children: [_jsx("span", { "data-slot": "settings-summary-title", className: cn(size === "md" ? "text-body-18" : "text-title-24", "font-medium tracking-normal"), children: title }), description ? (_jsx("span", { "data-slot": "settings-summary-description", className: "text-body-sm text-body", children: description })) : null] })] }), figure ? (_jsxs("div", { className: "grid min-w-0 gap-1", children: [_jsx("span", { "data-slot": "settings-summary-figure", className: "text-title-24 font-medium tracking-normal tabular-nums", children: figure }), figureNote ? (_jsx("span", { "data-slot": "settings-summary-figure-note", className: "text-body-sm text-body", children: figureNote })) : null] })) : null, action ? (_jsx("div", { "data-slot": "settings-summary-action", inert: unavailable, className: cn("ms-auto flex shrink-0 items-center gap-3", unavailable && "opacity-50 select-none"), children: action })) : null] }));
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Label and value pairs (ui#494): Billing details as the design draws them,
|
|
168
|
+
* two columns, the labels in the quiet tone, no rules between. A real
|
|
169
|
+
* description list, so a screen reader pairs each value with its label.
|
|
170
|
+
*/
|
|
171
|
+
function DetailList({ items, className, ...props }) {
|
|
172
|
+
return (_jsx("dl", { "data-slot": "detail-list", className: cn("m-0 grid min-w-0 grid-cols-1 gap-x-8 gap-y-2 py-4 text-ink sm:grid-cols-[16rem_minmax(0,1fr)] sm:gap-y-6", className), ...props, children: items.map((item, i) => (_jsxs(React.Fragment, { children: [_jsx("dt", { className: "text-body-md text-faint-strong", children: item.label }), _jsx("dd", { className: "m-0 text-body-md text-ink max-sm:pb-3", children: item.value })] }, i))) }));
|
|
173
|
+
}
|
|
174
|
+
export { DetailList, EditableValue, SettingsLink, SettingsRow, SettingsSection, SettingsSummary };
|
|
175
|
+
//# sourceMappingURL=settings-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-row.js","sourceRoot":"","sources":["../../src/blocks/settings-row.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AAEH,qFAAqF;AACrF,MAAM,yBAAyB,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;AAM5D,SAAS,WAAW,CAAC,EACnB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,OAAO,EACP,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,KAAK,EACnB,KAAK,GAAG,QAAQ,EAChB,SAAS,EACT,GAAG,KAAK,EAmBT;IACC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;IAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;IAC3B,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;IACnC,MAAM,iBAAiB,GAAG,KAA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AAgB,8BAA8B,EAAC,SAAS,EAAC,wBAAwB,YAC9E,UAAU,GACN,CACR,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC,CAAC,CAAC,IAAI,EACP,MAAM,CAAC,CAAC,CAAC,CACR,2BACY,yBAAyB,EACnC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,EAAE,CAAC,0CAA0C,EAAE,WAAW,IAAI,wBAAwB,CAAC,YAEjG,MAAM,GACH,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,EAClB,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EAGT;IACC,OAAO,CACL,0BACY,aAAa,EACvB,SAAS,EAAE,EAAE,CAAC,0GAA0G,EAAE,SAAS,CAAC,KAChI,KAAK,YAER,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACtB,MAAC,KAAK,CAAC,QAAQ,eACb,aAAI,SAAS,EAAC,gCAAgC,YAAE,IAAI,CAAC,KAAK,GAAM,EAChE,aAAI,SAAS,EAAC,uCAAuC,YAAE,IAAI,CAAC,KAAK,GAAM,KAFpD,CAAC,CAGL,CAClB,CAAC,GACC,CACN,CAAA;AACH,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Whether every word of the query is somewhere in the text, ignoring case,
|
|
5
|
+
* accents and order. An empty query matches everything.
|
|
6
|
+
*/
|
|
7
|
+
declare function matchesSideNavQuery(text: string, query: string): boolean;
|
|
8
|
+
/** One setting inside a page, for the search's results list. */
|
|
9
|
+
export type SideNavSearchResult = {
|
|
10
|
+
/** The row's id on its page: what the caller scrolls to. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** The setting's name: "Grid timezone". */
|
|
13
|
+
label: string;
|
|
14
|
+
/** The page's id: what the caller opens. */
|
|
15
|
+
page: string;
|
|
16
|
+
/** The page's name, shown after the dot: "General". */
|
|
17
|
+
pageLabel: string;
|
|
18
|
+
/** Other words that should find it: "time zone", "schedules". */
|
|
19
|
+
keywords?: readonly string[];
|
|
20
|
+
};
|
|
21
|
+
export type SideNavSearchProps = {
|
|
22
|
+
/** The box's accessible name and placeholder. */
|
|
23
|
+
label?: string;
|
|
24
|
+
/** The caller's index of settings inside pages. */
|
|
25
|
+
results?: readonly SideNavSearchResult[];
|
|
26
|
+
/** A result was chosen: open `page`, scroll to `id`, highlight it. */
|
|
27
|
+
onSelectResult?: (result: {
|
|
28
|
+
page: string;
|
|
29
|
+
id: string;
|
|
30
|
+
}) => void;
|
|
31
|
+
/** The query to start with. */
|
|
32
|
+
defaultQuery?: string;
|
|
33
|
+
/** Called on every change of the query. */
|
|
34
|
+
onQueryChange?: (query: string) => void;
|
|
35
|
+
/** The visible heading over the results. */
|
|
36
|
+
resultsLabel?: string;
|
|
37
|
+
/** The line when nothing matches. */
|
|
38
|
+
emptyText?: string;
|
|
39
|
+
/** At most this many results are listed. */
|
|
40
|
+
maxResults?: number;
|
|
41
|
+
};
|
|
42
|
+
declare function SideNav({ label, context, search, className, children, onKeyDown, ...props }: Omit<React.ComponentProps<"nav">, "ref"> & {
|
|
4
43
|
/**
|
|
5
44
|
* Names the landmark. Required, not optional: a page with two `<nav>`s and no
|
|
6
45
|
* names gives a screen-reader user two identical "navigation" entries and no
|
|
@@ -13,6 +52,8 @@ declare function SideNav({ label, context, className, children, onKeyDown, ...pr
|
|
|
13
52
|
* know that a grid contains an app.
|
|
14
53
|
*/
|
|
15
54
|
context?: React.ReactNode;
|
|
55
|
+
/** A search box above the groups (ui#494). See the module note. */
|
|
56
|
+
search?: SideNavSearchProps;
|
|
16
57
|
}): React.JSX.Element;
|
|
17
58
|
declare function SideNavGroup({ label, icon, collapsible, open, defaultOpen, onOpenChange, className, children, ...props }: Omit<React.ComponentProps<"div">, "ref" | "children"> & {
|
|
18
59
|
/** APP, MANAGE, or the header's words when `collapsible`. */
|
|
@@ -29,9 +70,14 @@ declare function SideNavGroup({ label, icon, collapsible, open, defaultOpen, onO
|
|
|
29
70
|
defaultOpen?: boolean;
|
|
30
71
|
onOpenChange?: (open: boolean) => void;
|
|
31
72
|
children?: React.ReactNode;
|
|
32
|
-
}): React.JSX.Element;
|
|
33
|
-
declare function SideNavItem({ label, caption, icon, activeIcon, count, active, render, className, onKeyDown, ...props }: Omit<useRender.ComponentProps<"button">, "children"> & {
|
|
73
|
+
}): React.JSX.Element | null;
|
|
74
|
+
declare function SideNavItem({ label, caption, icon, activeIcon, count, active, keywords, render, className, onKeyDown, ...props }: Omit<useRender.ComponentProps<"button">, "children"> & {
|
|
34
75
|
label: React.ReactNode;
|
|
76
|
+
/**
|
|
77
|
+
* Other words the menu search should find this row by (ui#494): Billing's
|
|
78
|
+
* "invoices". The label is always searched.
|
|
79
|
+
*/
|
|
80
|
+
keywords?: readonly string[];
|
|
35
81
|
/**
|
|
36
82
|
* A second line under the label (ui#476): one sentence saying what the page
|
|
37
83
|
* holds, as the Console's admin rail draws it. Muted, in the caption role,
|
|
@@ -66,6 +112,6 @@ declare function SideNavItem({ label, caption, icon, activeIcon, count, active,
|
|
|
66
112
|
*/
|
|
67
113
|
count?: number | string;
|
|
68
114
|
active?: boolean;
|
|
69
|
-
}): React.ReactElement<unknown, string | React.JSXElementConstructor<any
|
|
70
|
-
export { SideNav, SideNavGroup, SideNavItem };
|
|
115
|
+
}): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
116
|
+
export { SideNav, SideNavGroup, SideNavItem, matchesSideNavQuery };
|
|
71
117
|
//# sourceMappingURL=side-nav.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-nav.d.ts","sourceRoot":"","sources":["../../src/blocks/side-nav.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"side-nav.d.ts","sourceRoot":"","sources":["../../src/blocks/side-nav.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AA+LrD;;;GAGG;AACH,iBAAS,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAMjE;AAWD,gEAAgE;AAChE,MAAM,MAAM,mBAAmB,GAAG;IAChC,4DAA4D;IAC5D,EAAE,EAAE,MAAM,CAAA;IACV,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAA;IACjB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,OAAO,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAA;IACxC,sEAAsE;IACtE,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IAC/D,+BAA+B;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,qCAAqC;IACrC,SAA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