@sincpro/web-ui 2.1.0 → 2.3.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/README.md +111 -0
- package/dist/components/attachments/Attachments.d.ts +7 -1
- package/dist/components/attachments/Attachments.js +8 -2
- package/dist/components/board/Board.d.ts +32 -2
- package/dist/components/board/Board.js +27 -4
- package/dist/components/board/index.d.ts +1 -1
- package/dist/components/board/index.js +2 -1
- package/dist/components/listing/GroupingLevels.js +11 -9
- package/dist/components/listing/RecordCard.js +1 -1
- package/dist/components/listing/Row.js +2 -2
- package/dist/components/navigation/NavigationTree.js +37 -10
- package/dist/components/search/CriteriaBuilder.js +3 -2
- package/dist/components/search/CriteriaChips.js +6 -5
- package/dist/components/search/JoinWord.js +1 -1
- package/dist/components/search/SearchBar.js +68 -29
- package/dist/components/shell/AppFrame.d.ts +18 -2
- package/dist/components/shell/AppFrame.js +143 -12
- package/dist/components/shell/Sidebar.d.ts +39 -0
- package/dist/components/shell/Sidebar.js +57 -0
- package/dist/components/shell/TopBar.d.ts +10 -1
- package/dist/components/shell/TopBar.js +18 -13
- package/dist/components/shell/brandMark.d.ts +17 -0
- package/dist/components/shell/brandMark.js +9 -0
- package/dist/components/shell/index.d.ts +3 -0
- package/dist/components/shell/index.js +6 -0
- package/dist/components/shell/sidebarDrawer.d.ts +26 -0
- package/dist/components/shell/sidebarDrawer.js +22 -0
- package/dist/foundations/copy.d.ts +13 -0
- package/dist/foundations/copy.es.js +12 -5
- package/dist/foundations/copy.js +12 -5
- package/dist/foundations/variants.js +19 -2
- package/dist/primitives/block/Block.js +1 -1
- package/dist/primitives/button/Button.d.ts +3 -1
- package/dist/primitives/button/Button.js +6 -6
- package/dist/primitives/choice/SegmentedControl.d.ts +4 -1
- package/dist/primitives/choice/SegmentedControl.js +35 -7
- package/dist/primitives/dialog/Dialog.d.ts +1 -1
- package/dist/primitives/dialog/Dialog.js +2 -2
- package/dist/primitives/field/CardNumberInput.js +1 -1
- package/dist/primitives/field/Checks.d.ts +14 -0
- package/dist/primitives/field/Checks.js +12 -4
- package/dist/primitives/field/DropZone.d.ts +22 -3
- package/dist/primitives/field/DropZone.js +33 -12
- package/dist/primitives/field/DurationInput.js +1 -1
- package/dist/primitives/field/Field.js +7 -7
- package/dist/primitives/field/PatternInput.js +1 -1
- package/dist/primitives/field/RichTextEditor.js +2 -2
- package/dist/primitives/field/SignatureInput.js +1 -1
- package/dist/primitives/field/aria.d.ts +2 -2
- package/dist/primitives/field/aria.js +5 -5
- package/dist/primitives/field/index.d.ts +1 -1
- package/dist/primitives/field/index.js +1 -1
- package/dist/primitives/menu/Menu.d.ts +29 -9
- package/dist/primitives/menu/Menu.js +77 -22
- package/dist/primitives/overlay/Popover.js +2 -2
- package/dist/primitives/picker/Picker.js +3 -3
- package/dist/primitives/picker/TagsField.js +1 -1
- package/dist/primitives/table/EditableTable.js +2 -2
- package/dist/primitives/table/ReportTable.js +1 -1
- package/dist/primitives/table/Table.js +2 -2
- package/dist/primitives/tabs/Tabs.js +2 -28
- package/dist/primitives/tag/Count.d.ts +23 -0
- package/dist/primitives/tag/Count.js +59 -0
- package/dist/primitives/tag/Tag.d.ts +9 -0
- package/dist/primitives/tag/Tag.js +14 -1
- package/dist/primitives/tag/Tags.js +6 -7
- package/dist/primitives/tag/index.d.ts +1 -0
- package/dist/primitives/tag/index.js +3 -0
- package/dist/primitives/value/Metric.d.ts +7 -2
- package/dist/primitives/value/Metric.js +14 -6
- package/dist/tokens.css +306 -72
- package/package.json +1 -1
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { BrandMark } from "./brandMark.js";
|
|
4
|
+
import { SidebarToggle } from "./sidebarDrawer.js";
|
|
3
5
|
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
6
|
import { SurfaceProvider } from "../../foundations/surface.js";
|
|
5
7
|
import { Menu } from "../../primitives/menu/Menu.js";
|
|
8
|
+
import { Count, countText } from "../../primitives/tag/Count.js";
|
|
6
9
|
import { Avatar } from "../../primitives/value/Person.js";
|
|
7
10
|
import { Grid3x3 } from "lucide-react";
|
|
8
|
-
import { useState } from "react";
|
|
9
|
-
export function TopBar({ app, apps, currentApp, onAppSelect, menus, onMenuSelect, systray, user, onUserSelect, userGroups, }) {
|
|
11
|
+
import { useMemo, useState } from "react";
|
|
12
|
+
export function TopBar({ app, apps, currentApp, onAppSelect, menus, currentMenu, onMenuSelect, systray, user, onUserSelect, userGroups, }) {
|
|
10
13
|
const copy = useUiCopy();
|
|
11
14
|
const actual = apps?.find((a) => a.id === currentApp);
|
|
12
15
|
const brand = app ?? actual;
|
|
13
|
-
return (_jsx(SurfaceProvider, { value: "chrome", children: _jsxs("header", { className: "flex h-(--size-appbar) min-w-0 items-center gap-1 border-b border-chrome-edge bg-chrome px-2", children: [apps === undefined || apps.length === 0 ? null : (_jsx(AppSwitcher, { apps: apps, current: currentApp, ...(onAppSelect === undefined ? {} : { onSelect: onAppSelect }) })), brand === undefined ? null : (_jsxs("span", { className: "flex shrink-0 items-center gap-2 pr-2 pl-1", children: [brand.icon === undefined ? null : (_jsx(brand.icon, { className: "size-(--size-icon-md) text-chrome-link", strokeWidth: 2, "aria-hidden": true })), _jsx("span", { className: "text-lead font-medium text-chrome-ink", children: brand.label })] })), menus === undefined ? null : (_jsx("nav", { className: "scroll-quiet flex min-w-0 items-center gap-0.5", "aria-label": copy.shell.menus, children: menus.map((m) => (_jsx(Menu, { label: m.label, groups: m.groups, surface: "chrome", variant: "text", chevron: false, onSelect: (id) => onMenuSelect?.(m.id, id) }, m.id))) })), _jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-1 pl-2", children: [systray, user === undefined ? null : (_jsx(UserMenu, { name: user.name, ...(user.detail === undefined ? {} : { detail: user.detail }), groups: userGroups ?? [], ...(onUserSelect === undefined ? {} : { onSelect: onUserSelect }) }))] })] }) }));
|
|
16
|
+
return (_jsx(SurfaceProvider, { value: "chrome", children: _jsxs("header", { "data-ui": "topbar", className: "flex h-(--size-appbar) min-w-0 items-center gap-1 border-b border-chrome-edge bg-chrome px-2", children: [_jsx(SidebarToggle, {}), apps === undefined || apps.length === 0 ? null : (_jsx(AppSwitcher, { apps: apps, current: currentApp, ...(onAppSelect === undefined ? {} : { onSelect: onAppSelect }) })), brand === undefined ? null : (_jsxs("span", { "data-ui": "topbar.brand", className: "flex shrink-0 items-center gap-2 pr-2 pl-1", children: ["logo" in brand && brand.logo !== undefined ? (_jsx(BrandMark, { logo: brand.logo, className: "size-(--size-control-sm) shrink-0" })) : brand.icon === undefined ? null : (_jsx(brand.icon, { className: "size-(--size-icon-md) text-chrome-link", strokeWidth: 2, "aria-hidden": true })), _jsx("span", { className: "text-lead font-medium text-chrome-ink", children: brand.label })] })), menus === undefined ? null : (_jsx("nav", { "data-ui": "topbar.menus", className: "scroll-quiet flex min-w-0 items-center gap-0.5", "aria-label": copy.shell.menus, children: menus.map((m) => (_jsx(Menu, { label: m.label, groups: m.groups, surface: "chrome", variant: "text", chevron: false, current: m.id === currentMenu, ...(m.layout === undefined ? {} : { layout: m.layout }), ...(m.count === undefined ? {} : { count: m.count }), onSelect: (id) => onMenuSelect?.(m.id, id) }, m.id))) })), _jsxs("div", { "data-ui": "topbar.actions", className: "ml-auto flex shrink-0 items-center gap-1 pl-2", children: [systray, user === undefined ? null : (_jsx(UserMenu, { name: user.name, ...(user.detail === undefined ? {} : { detail: user.detail }), groups: userGroups ?? [], ...(onUserSelect === undefined ? {} : { onSelect: onUserSelect }) }))] })] }) }));
|
|
14
17
|
}
|
|
15
18
|
/** The app switcher: a grid, not a list.
|
|
16
19
|
*
|
|
@@ -23,32 +26,34 @@ export function AppSwitcher({ apps, current, onSelect, }) {
|
|
|
23
26
|
const copy = useUiCopy();
|
|
24
27
|
return (_jsxs("div", { className: "relative shrink-0", children: [_jsx("button", { type: "button", onClick: () => setOpen((v) => !v), "aria-expanded": open, "aria-haspopup": "menu", "aria-label": copy.shell.modules, title: copy.shell.modules, className: `inline-flex size-(--size-control-md) items-center justify-center rounded-pill transition-colors duration-(--duration-instant) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-chrome-link ${open
|
|
25
28
|
? "bg-chrome-ink/12 text-chrome-ink"
|
|
26
|
-
: "text-chrome-muted hover:bg-chrome-ink/10 hover:text-chrome-ink"}`, children: _jsx(Grid3x3, { className: "size-(--size-icon-md)", strokeWidth: 2 }) }), !open ? null : (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40", onClick: () => setOpen(false), role: "presentation" }), _jsx("div", { role: "menu", className: "absolute top-full left-0 z-50 mt-1 grid w-(--container-apps) grid-cols-3 gap-1 rounded-
|
|
29
|
+
: "text-chrome-muted hover:bg-chrome-ink/10 hover:text-chrome-ink"}`, children: _jsx(Grid3x3, { className: "size-(--size-icon-md)", strokeWidth: 2 }) }), !open ? null : (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40", onClick: () => setOpen(false), role: "presentation" }), _jsx("div", { role: "menu", className: "absolute top-full left-0 z-50 mt-1 grid w-(--container-apps) grid-cols-3 gap-1 rounded-ui-popover border border-ui-popover-border bg-ui-popover p-1 shadow-ui-popover", children: apps.map((a) => {
|
|
27
30
|
const here = a.id === current;
|
|
28
31
|
return (_jsxs("button", { type: "button", role: "menuitem", title: a.hint, onClick: () => {
|
|
29
32
|
onSelect?.(a.id);
|
|
30
33
|
setOpen(false);
|
|
31
|
-
}, className: `flex flex-col items-center gap-1.5 rounded-
|
|
34
|
+
}, className: `flex flex-col items-center gap-1.5 rounded-control px-2 py-3 text-center transition-colors duration-(--duration-instant) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary ${here ? "bg-primary/8 text-primary" : "text-ink hover:bg-ink/5"}`, children: [_jsx(a.icon, { className: "size-(--size-icon-lg)", strokeWidth: 1.75, "aria-hidden": true }), _jsx("span", { className: "text-micro leading-tight", children: a.label })] }, a.id));
|
|
32
35
|
}) })] }))] }));
|
|
33
36
|
}
|
|
37
|
+
/** A badge over an icon is read in a glance: past two digits it says «a lot». */
|
|
38
|
+
const SYSTRAY_MAX = 99;
|
|
34
39
|
/** A systray icon with its count.
|
|
35
40
|
*
|
|
36
41
|
* Zero is NOT drawn: a bell with a «0» next to it forces you to read a number
|
|
37
42
|
* to discover there is nothing. With no count you can already see there is
|
|
38
43
|
* nothing. */
|
|
39
44
|
export function SystrayButton({ icon: Icon, label, count = 0, tone = "info", onClick, active = false, }) {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return (_jsxs("button", { type: "button", onClick: onClick, title: count > 0 ? `${label} (${
|
|
45
|
+
const copy = useUiCopy();
|
|
46
|
+
const number = useMemo(() => new Intl.NumberFormat(copy.locale), [copy.locale]);
|
|
47
|
+
/* The button says the number in its name, so the badge is only seen — and both say the
|
|
48
|
+
same «99+», not a badge that is cut and a name that is not. */
|
|
49
|
+
const said = countText(count, number.format, SYSTRAY_MAX);
|
|
50
|
+
return (_jsxs("button", { type: "button", onClick: onClick, title: count > 0 ? `${label} (${said})` : label, "aria-label": count > 0 ? `${label}: ${said}` : label, className: `relative inline-flex size-(--size-control-md) items-center justify-center rounded-pill transition-colors duration-(--duration-instant) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-chrome-link ${active
|
|
46
51
|
? "bg-chrome-ink/12 text-chrome-ink"
|
|
47
|
-
: "text-chrome-muted hover:bg-chrome-ink/10 hover:text-chrome-ink"}`, children: [_jsx(Icon, { className: "size-(--size-icon-md)", strokeWidth: 2, "aria-hidden": true }), count <= 0 ? null : (_jsx("span", {
|
|
52
|
+
: "text-chrome-muted hover:bg-chrome-ink/10 hover:text-chrome-ink"}`, children: [_jsx(Icon, { className: "size-(--size-icon-md)", strokeWidth: 2, "aria-hidden": true }), count <= 0 ? null : (_jsx("span", { className: "absolute -top-0.5 -right-0.5 flex", children: _jsx(Count, { value: count, tone: tone, solid: true, max: SYSTRAY_MAX, surface: "chrome", "aria-hidden": true }) }))] }));
|
|
48
53
|
}
|
|
49
54
|
/** Who I am and how I leave. The name is drawn when there is width; when narrow
|
|
50
55
|
* only the avatar stays, which is what gets recognised without reading. */
|
|
51
56
|
export function UserMenu({ name, detail, groups, onSelect, }) {
|
|
52
57
|
const copy = useUiCopy();
|
|
53
|
-
return (_jsxs("span", { className: "flex shrink-0 items-center gap-2 pl-1", children: [_jsx(Avatar, { name: name, size: "md" }), _jsxs("span", { className: "hidden min-w-0 flex-col leading-tight sm:flex", children: [_jsx("span", { className: "truncate text-meta text-chrome-ink", children: name }), detail === undefined ? null : (_jsx("span", { className: "truncate text-micro text-chrome-muted", children: detail }))] }), _jsx(Menu, { label: copy.shell.account, groups: groups, surface: "chrome", variant: "text", align: "end", iconOnly: true, ...(onSelect === undefined ? {} : { onSelect }) })] }));
|
|
58
|
+
return (_jsxs("span", { "data-ui": "topbar.user", className: "flex shrink-0 items-center gap-2 pl-1", children: [_jsx(Avatar, { name: name, size: "md" }), _jsxs("span", { className: "hidden min-w-0 flex-col leading-tight sm:flex", children: [_jsx("span", { className: "truncate text-meta text-chrome-ink", children: name }), detail === undefined ? null : (_jsx("span", { className: "truncate text-micro text-chrome-muted", children: detail }))] }), _jsx(Menu, { label: copy.shell.account, groups: groups, surface: "chrome", variant: "text", align: "end", iconOnly: true, ...(onSelect === undefined ? {} : { onSelect }) })] }));
|
|
54
59
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A product's mark: the URL of an image, or an element drawn inline.
|
|
4
|
+
*
|
|
5
|
+
* Context: an image paints with the colours baked into its file, so it cannot follow the
|
|
6
|
+
* theme nor the surface it sits on — a navy crest disappears on a navy sidebar and glares in
|
|
7
|
+
* the dark theme. An inline `<svg>` that paints with `currentColor` or the tokens
|
|
8
|
+
* (`var(--color-chrome-accent)`) follows both. A string stays a URL, so `logo: "/logo.svg"`
|
|
9
|
+
* keeps working.
|
|
10
|
+
*/
|
|
11
|
+
export type BrandLogo = string | ReactElement;
|
|
12
|
+
/** Draws a `BrandLogo` in a box the host sizes. Decorative: the product's name is written
|
|
13
|
+
* beside it, and saying it twice is noise for a screen reader. */
|
|
14
|
+
export declare function BrandMark({ logo, className }: {
|
|
15
|
+
logo: BrandLogo;
|
|
16
|
+
className: string;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** Draws a `BrandLogo` in a box the host sizes. Decorative: the product's name is written
|
|
3
|
+
* beside it, and saying it twice is noise for a screen reader. */
|
|
4
|
+
export function BrandMark({ logo, className }) {
|
|
5
|
+
if (typeof logo === "string") {
|
|
6
|
+
return _jsx("img", { src: logo, alt: "", className: `${className} object-contain` });
|
|
7
|
+
}
|
|
8
|
+
return (_jsx("span", { "aria-hidden": true, className: `${className} flex items-center justify-center *:size-full`, children: logo }));
|
|
9
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { AppFrame } from "./AppFrame.js";
|
|
2
|
+
export { type BrandLogo } from "./brandMark.js";
|
|
3
|
+
export { Sidebar, type SidebarAction, type SidebarProps, } from "./Sidebar.js";
|
|
4
|
+
export { type SidebarDrawer, SidebarToggle, useSidebarDrawer, } from "./sidebarDrawer.js";
|
|
2
5
|
export { type AppEntry, SystrayButton, TopBar, type TopMenu, } from "./TopBar.js";
|
|
3
6
|
export { Pane, Panes } from "./Panes.js";
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/* THE APPLICATION FRAME — what sits above every view. */
|
|
2
2
|
export { AppFrame } from "./AppFrame.js";
|
|
3
|
+
/* A product's mark: an image's URL, or an inline <svg> that paints with the tokens. */
|
|
4
|
+
export {} from "./brandMark.js";
|
|
5
|
+
/* The whole chrome in one column, for a back office with no bar on top. */
|
|
6
|
+
export { Sidebar, } from "./Sidebar.js";
|
|
7
|
+
/* The sidebar's phone drawer, for a bar an application writes itself. */
|
|
8
|
+
export { SidebarToggle, useSidebarDrawer, } from "./sidebarDrawer.js";
|
|
3
9
|
export { SystrayButton, TopBar, } from "./TopBar.js";
|
|
4
10
|
/* A screen of N sets side by side — the reconciliation: each pane scrolls on its own. */
|
|
5
11
|
export { Pane, Panes } from "./Panes.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context: **the sidebar on a phone.** Below `sm` (`--container-handheld`) a 15 rem column
|
|
3
|
+
* beside the view is two thirds of a 390 px screen, so `AppFrame` hides it and offers the
|
|
4
|
+
* SAME sidebar as a drawer from the start edge. What opens the drawer lives in the bar on
|
|
5
|
+
* top — the application's `TopBar`, or the bar the frame draws when the sidebar is the
|
|
6
|
+
* only chrome — and the frame is the one that knows there is a drawer. This is that
|
|
7
|
+
* contract: `null` outside a frame with a sidebar, so a `TopBar` without one draws no
|
|
8
|
+
* button that opens nothing.
|
|
9
|
+
*/
|
|
10
|
+
export type SidebarDrawer = {
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
open: () => void;
|
|
13
|
+
close: () => void;
|
|
14
|
+
/** The drawer's id, for `aria-controls`. */
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const SidebarDrawerContext: import("react").Context<SidebarDrawer | null>;
|
|
18
|
+
/** The phone drawer of the frame's sidebar, for a bar or a control an application writes
|
|
19
|
+
* itself. `null` when the frame has no sidebar. */
|
|
20
|
+
export declare function useSidebarDrawer(): SidebarDrawer | null;
|
|
21
|
+
/** The button that opens the sidebar on a phone. It draws nothing on a wider screen — the
|
|
22
|
+
* sidebar is in view there — nor outside a frame with a sidebar. `TopBar` draws it first
|
|
23
|
+
* on its own; write it only in a bar of your own. */
|
|
24
|
+
export declare function SidebarToggle({ surface }: {
|
|
25
|
+
surface?: "canvas" | "chrome";
|
|
26
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
|
+
import { IconButton } from "../../primitives/button/Button.js";
|
|
5
|
+
import { Menu as Hamburger } from "lucide-react";
|
|
6
|
+
import { createContext, useContext } from "react";
|
|
7
|
+
export const SidebarDrawerContext = createContext(null);
|
|
8
|
+
/** The phone drawer of the frame's sidebar, for a bar or a control an application writes
|
|
9
|
+
* itself. `null` when the frame has no sidebar. */
|
|
10
|
+
export function useSidebarDrawer() {
|
|
11
|
+
return useContext(SidebarDrawerContext);
|
|
12
|
+
}
|
|
13
|
+
/** The button that opens the sidebar on a phone. It draws nothing on a wider screen — the
|
|
14
|
+
* sidebar is in view there — nor outside a frame with a sidebar. `TopBar` draws it first
|
|
15
|
+
* on its own; write it only in a bar of your own. */
|
|
16
|
+
export function SidebarToggle({ surface = "chrome" }) {
|
|
17
|
+
const copy = useUiCopy();
|
|
18
|
+
const drawer = useSidebarDrawer();
|
|
19
|
+
if (drawer === null)
|
|
20
|
+
return null;
|
|
21
|
+
return (_jsx("span", { className: "flex shrink-0 sm:hidden", children: _jsx(IconButton, { icon: Hamburger, label: copy.shell.openNavigation, size: "md", surface: surface, expanded: drawer.isOpen, haspopup: "dialog", ...(drawer.isOpen ? { "aria-controls": drawer.id } : {}), onClick: drawer.open }) }));
|
|
22
|
+
}
|
|
@@ -104,10 +104,19 @@ export type UiCopy = {
|
|
|
104
104
|
closePreview: string;
|
|
105
105
|
account: string;
|
|
106
106
|
openAsPanel: string;
|
|
107
|
+
/** The button that opens the sidebar as a drawer on a phone. */
|
|
108
|
+
openNavigation: string;
|
|
109
|
+
/** The drawer's name: what a screen reader hears when it opens. */
|
|
110
|
+
navigation: string;
|
|
107
111
|
};
|
|
108
112
|
field: {
|
|
109
113
|
drop: string;
|
|
114
|
+
/** The drop zone's sentence when it takes several files at once. */
|
|
115
|
+
dropMany: string;
|
|
110
116
|
chooseFile: string;
|
|
117
|
+
chooseFiles: string;
|
|
118
|
+
/** A batch over the zone's `max`: `{max}` were taken out of `{count}`. */
|
|
119
|
+
tooManyFiles: string;
|
|
111
120
|
cancel: string;
|
|
112
121
|
uploadProgress: string;
|
|
113
122
|
fileUnreadable: string;
|
|
@@ -751,6 +760,10 @@ export type UiCopy = {
|
|
|
751
760
|
};
|
|
752
761
|
/** The board by stages (`BoardColumns`). */
|
|
753
762
|
board: {
|
|
763
|
+
/** A board tile that could not be read. `{title}` is the tile's. */
|
|
764
|
+
tileFailed: string;
|
|
765
|
+
/** The board's own reading (its headline numbers) failed. */
|
|
766
|
+
failed: string;
|
|
754
767
|
emptyLane: string;
|
|
755
768
|
moveHint: string;
|
|
756
769
|
moved: string;
|
|
@@ -97,10 +97,15 @@ export const SPANISH_COPY = {
|
|
|
97
97
|
closePreview: "Cerrar la vista previa",
|
|
98
98
|
account: "Mi cuenta",
|
|
99
99
|
openAsPanel: "Abrir como panel",
|
|
100
|
+
openNavigation: "Abrir la navegación",
|
|
101
|
+
navigation: "Navegación",
|
|
100
102
|
},
|
|
101
103
|
field: {
|
|
102
104
|
drop: "Soltá un archivo acá, o elegí uno.",
|
|
105
|
+
dropMany: "Soltá archivos acá, o elegilos.",
|
|
103
106
|
chooseFile: "Elegir archivo",
|
|
107
|
+
chooseFiles: "Elegir archivos",
|
|
108
|
+
tooManyFiles: "Se tomaron los primeros {max} de {count}: se pueden subir hasta {max} a la vez.",
|
|
104
109
|
cancel: "Cancelar",
|
|
105
110
|
uploadProgress: "progreso de la subida",
|
|
106
111
|
fileUnreadable: "No pudimos leer el archivo",
|
|
@@ -175,9 +180,9 @@ export const SPANISH_COPY = {
|
|
|
175
180
|
askOp: "comparado cómo",
|
|
176
181
|
askJoin: "tienen que coincidir",
|
|
177
182
|
askValue: "contra qué",
|
|
178
|
-
filters: "
|
|
179
|
-
groupBy: "
|
|
180
|
-
favorites: "
|
|
183
|
+
filters: "Filtros",
|
|
184
|
+
groupBy: "Agrupar por",
|
|
185
|
+
favorites: "Favoritos",
|
|
181
186
|
unreadable: "No podemos leer este filtro como árbol — así es como queda. Se puede seguir editando en el JSON de abajo.",
|
|
182
187
|
},
|
|
183
188
|
ops: {
|
|
@@ -509,6 +514,8 @@ export const SPANISH_COPY = {
|
|
|
509
514
|
none: "sin prioridad",
|
|
510
515
|
},
|
|
511
516
|
board: {
|
|
517
|
+
tileFailed: "No se pudo leer «{title}»",
|
|
518
|
+
failed: "No se pudieron leer los números del tablero",
|
|
512
519
|
emptyLane: "Nada en esta etapa.",
|
|
513
520
|
moveHint: "Arrastrala, o Alt + ← / → para pasarla a otra etapa",
|
|
514
521
|
moved: "{name} pasó a {column}",
|
|
@@ -566,8 +573,8 @@ export const SPANISH_COPY = {
|
|
|
566
573
|
attachments: {
|
|
567
574
|
label: "Adjuntos",
|
|
568
575
|
empty: "Todavía no hay archivos adjuntos.",
|
|
569
|
-
emptyAdd: "Todavía no hay archivos adjuntos.
|
|
570
|
-
add: "Soltá
|
|
576
|
+
emptyAdd: "Todavía no hay archivos adjuntos. Soltalos acá o elegilos.",
|
|
577
|
+
add: "Soltá más archivos acá o elegilos.",
|
|
571
578
|
download: "Descargar",
|
|
572
579
|
remove: "Quitar el archivo",
|
|
573
580
|
removed: "Se quitó «{name}».",
|
package/dist/foundations/copy.js
CHANGED
|
@@ -73,10 +73,15 @@ export const ENGLISH_COPY = {
|
|
|
73
73
|
closePreview: "Close preview",
|
|
74
74
|
account: "My account",
|
|
75
75
|
openAsPanel: "Open as panel",
|
|
76
|
+
openNavigation: "Open the navigation",
|
|
77
|
+
navigation: "Navigation",
|
|
76
78
|
},
|
|
77
79
|
field: {
|
|
78
80
|
drop: "Drop a file here, or choose one.",
|
|
81
|
+
dropMany: "Drop files here, or choose them.",
|
|
79
82
|
chooseFile: "Choose file",
|
|
83
|
+
chooseFiles: "Choose files",
|
|
84
|
+
tooManyFiles: "Only the first {max} of {count} were taken: up to {max} at a time.",
|
|
80
85
|
cancel: "Cancel",
|
|
81
86
|
uploadProgress: "upload progress",
|
|
82
87
|
fileUnreadable: "We could not read the file",
|
|
@@ -138,9 +143,9 @@ export const ENGLISH_COPY = {
|
|
|
138
143
|
condition: "{field} {op} {value}",
|
|
139
144
|
andMore: "and {count} more",
|
|
140
145
|
placeholder: "search…",
|
|
141
|
-
filters: "
|
|
142
|
-
groupBy: "
|
|
143
|
-
favorites: "
|
|
146
|
+
filters: "Filters",
|
|
147
|
+
groupBy: "Group by",
|
|
148
|
+
favorites: "Favorites",
|
|
144
149
|
},
|
|
145
150
|
failed: {
|
|
146
151
|
operation: "We could not complete the operation",
|
|
@@ -499,6 +504,8 @@ export const ENGLISH_COPY = {
|
|
|
499
504
|
none: "no priority",
|
|
500
505
|
},
|
|
501
506
|
board: {
|
|
507
|
+
tileFailed: "«{title}» could not be read",
|
|
508
|
+
failed: "The board's numbers could not be read",
|
|
502
509
|
emptyLane: "Nothing in this stage.",
|
|
503
510
|
moveHint: "Drag it, or Alt + ← / → to move it to another stage",
|
|
504
511
|
moved: "{name} moved to {column}",
|
|
@@ -561,8 +568,8 @@ export const ENGLISH_COPY = {
|
|
|
561
568
|
attachments: {
|
|
562
569
|
label: "Attachments",
|
|
563
570
|
empty: "No files attached yet.",
|
|
564
|
-
emptyAdd: "No files attached yet. Drop
|
|
565
|
-
add: "Drop
|
|
571
|
+
emptyAdd: "No files attached yet. Drop them here, or choose them.",
|
|
572
|
+
add: "Drop more files here, or choose them.",
|
|
566
573
|
download: "Download",
|
|
567
574
|
remove: "Remove the file",
|
|
568
575
|
removed: "Removed «{name}».",
|
|
@@ -15,8 +15,25 @@ const twMergeConfig = {
|
|
|
15
15
|
extend: {
|
|
16
16
|
theme: {
|
|
17
17
|
text: ["micro", "meta", "body", "lead", "title", "display"],
|
|
18
|
-
radius: [
|
|
19
|
-
|
|
18
|
+
radius: [
|
|
19
|
+
"mark",
|
|
20
|
+
"control",
|
|
21
|
+
"box",
|
|
22
|
+
"panel",
|
|
23
|
+
"pill",
|
|
24
|
+
/* The component tokens (`tokens.css`, `@theme inline`). */
|
|
25
|
+
"ui-button",
|
|
26
|
+
"ui-icon-button",
|
|
27
|
+
"ui-control",
|
|
28
|
+
"ui-popover",
|
|
29
|
+
"ui-option",
|
|
30
|
+
"ui-dialog",
|
|
31
|
+
"ui-card",
|
|
32
|
+
"ui-tag",
|
|
33
|
+
"ui-search",
|
|
34
|
+
"ui-nav",
|
|
35
|
+
],
|
|
36
|
+
shadow: ["raised", "float", "window", "ui-popover"],
|
|
20
37
|
},
|
|
21
38
|
},
|
|
22
39
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Tag } from "../tag/Tag.js";
|
|
3
3
|
export function Block({ title, count, aside, actions, status, flush = false, children, }) {
|
|
4
4
|
const withHeader = title !== undefined || actions !== undefined || status !== undefined;
|
|
5
|
-
return (_jsxs("section", { className: "min-w-0 rounded-
|
|
5
|
+
return (_jsxs("section", { "data-ui": "block", className: "min-w-0 rounded-ui-card border border-ui-card-border bg-ui-card", children: [!withHeader ? null : (_jsxs("header", { className: "flex min-w-0 flex-wrap items-baseline gap-x-3 gap-y-1 border-b border-line px-3 py-2", children: [title === undefined ? null : (_jsx(SectionHeader, { title: title, count: count, aside: aside })), status === undefined ? null : (_jsx(Tag, { tone: status.tone ?? "neutral", children: status.label })), actions === undefined ? null : (_jsx("div", { className: "ml-auto flex flex-wrap items-center gap-1", children: actions }))] })), _jsx("div", { className: flush ? "" : "px-3 py-2.5", children: children })] }));
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* A cut in the page: between two groups of fields, or between a sheet of
|
|
@@ -31,7 +31,9 @@ export type ButtonPopup = "menu" | "dialog" | "listbox";
|
|
|
31
31
|
*
|
|
32
32
|
* What stays out on purpose: `className` and `style` — the look is the role, the size and
|
|
33
33
|
* the surface, and a primitive that takes classes from outside stops being the one place
|
|
34
|
-
* where a button is decided
|
|
34
|
+
* where a button is decided. An application changes it through its tokens
|
|
35
|
+
* (`--ui-button-radius`) and its part (`data-ui="button"`, `data-emphasis`), which keep
|
|
36
|
+
* every button of the product changing together; `role`, because here it is the button's ROLE in the hierarchy
|
|
35
37
|
* (`primary`…), not an ARIA role; and the attributes the props below already own. */
|
|
36
38
|
type NativeProps<E extends "button" | "a", Own extends string> = Omit<ComponentPropsWithRef<E>, "children" | "className" | "style" | "role" | Own>;
|
|
37
39
|
export type ButtonProps = NativeProps<"button", "type" | "disabled" | "title" | "aria-haspopup" | "aria-expanded"> & {
|
|
@@ -129,7 +129,7 @@ const ROLE = {
|
|
|
129
129
|
* with «+ Crear», which was the only primary button in the product with a
|
|
130
130
|
* different height. */
|
|
131
131
|
export function buttonClasses(role = "secondary", size = "md", surface = "canvas") {
|
|
132
|
-
return `inline-flex shrink-0 items-center justify-center rounded-
|
|
132
|
+
return `inline-flex shrink-0 items-center justify-center rounded-ui-button whitespace-nowrap transition-[background-color,border-color,filter,color] duration-(--duration-instant) ease-(--ease-out) disabled:pointer-events-none disabled:opacity-45 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary ${SIZE[size]} ${WEIGHT[role]} ${ROLE[role][surface]}`;
|
|
133
133
|
}
|
|
134
134
|
const ICON = {
|
|
135
135
|
sm: { size: "size-(--size-icon-sm)", stroke: 2 },
|
|
@@ -157,7 +157,7 @@ export function Button({ children, role = "secondary", size = "md", surface: sur
|
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
159
|
onClick?.(event);
|
|
160
|
-
}, ...popupAttrs(expanded, haspopup), "data-emphasis": role, className: busy
|
|
160
|
+
}, ...popupAttrs(expanded, haspopup), "data-ui": "button", "data-emphasis": role, "data-size": size, "data-surface": surface, className: busy
|
|
161
161
|
? `${buttonClasses(role, size, surface)} cursor-progress`
|
|
162
162
|
: buttonClasses(role, size, surface), children: [Mark === undefined ? null : (_jsx(Mark, { className: `${ic.size} shrink-0 ${busy ? "motion-safe:animate-spin" : ""}`, strokeWidth: ic.stroke, "aria-hidden": true })), children] }));
|
|
163
163
|
}
|
|
@@ -177,7 +177,7 @@ export function Button({ children, role = "secondary", size = "md", surface: sur
|
|
|
177
177
|
export function ButtonLink({ children, href, role = "secondary", size = "md", surface: surfaceProp, icon: Icon, download, title, ref, ...native }) {
|
|
178
178
|
const surface = useSurface(surfaceProp);
|
|
179
179
|
const ic = ICON[size];
|
|
180
|
-
return (_jsxs("a", { ...native, ref: ref, "data-emphasis": role, href: href, title: title, ...(download === undefined ? {} : { download }), className: `${buttonClasses(role, size, surface)} no-underline`, children: [Icon === undefined ? null : (_jsx(Icon, { className: `${ic.size} shrink-0`, strokeWidth: ic.stroke, "aria-hidden": true })), children] }));
|
|
180
|
+
return (_jsxs("a", { ...native, ref: ref, "data-ui": "button", "data-emphasis": role, "data-size": size, "data-surface": surface, href: href, title: title, ...(download === undefined ? {} : { download }), className: `${buttonClasses(role, size, surface)} no-underline`, children: [Icon === undefined ? null : (_jsx(Icon, { className: `${ic.size} shrink-0`, strokeWidth: ic.stroke, "aria-hidden": true })), children] }));
|
|
181
181
|
}
|
|
182
182
|
/** Outside the component because the button and the link share it: the same
|
|
183
183
|
* icon has to look the same whether it leads to an action or to a file. */
|
|
@@ -197,7 +197,7 @@ const TONE = {
|
|
|
197
197
|
};
|
|
198
198
|
/* `aria-pressed` is a TOGGLE's state — bold on, a filter applied: it reads as the action
|
|
199
199
|
tint, the same as a chosen option, so «on» is seen and not only heard. */
|
|
200
|
-
const BOX = "inline-flex shrink-0 items-center justify-center rounded-
|
|
200
|
+
const BOX = "inline-flex shrink-0 items-center justify-center rounded-ui-icon-button transition-colors duration-(--duration-instant) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-pressed:bg-primary/12 aria-pressed:text-primary";
|
|
201
201
|
const SQUARE = {
|
|
202
202
|
sm: "size-(--size-control-sm)",
|
|
203
203
|
md: "size-(--size-control-md)",
|
|
@@ -229,7 +229,7 @@ function Labelled({ label, tooltip, children, }) {
|
|
|
229
229
|
export function IconButton({ icon: Icon, label, size = "sm", surface: surfaceProp, tone = "normal", disabled = false, type = "button", expanded, haspopup, tooltip = true, ref, ...native }) {
|
|
230
230
|
const surface = useSurface(surfaceProp);
|
|
231
231
|
const ic = ICON[size];
|
|
232
|
-
return (_jsx(Labelled, { label: label, tooltip: tooltip, children: (title) => (_jsx("button", { ...native, ref: ref, type: type, title: title, "aria-label": label, disabled: disabled, ...popupAttrs(expanded, haspopup), className: `${BOX} disabled:pointer-events-none disabled:opacity-45 ${SQUARE[size]} ${TONE[tone][surface]}`, children: _jsx(Icon, { className: ic.size, strokeWidth: ic.stroke, "aria-hidden": true }) })) }));
|
|
232
|
+
return (_jsx(Labelled, { label: label, tooltip: tooltip, children: (title) => (_jsx("button", { ...native, ref: ref, type: type, title: title, "aria-label": label, disabled: disabled, ...popupAttrs(expanded, haspopup), "data-ui": "icon-button", "data-tone": tone, "data-size": size, "data-surface": surface, className: `${BOX} disabled:pointer-events-none disabled:opacity-45 ${SQUARE[size]} ${TONE[tone][surface]}`, children: _jsx(Icon, { className: ic.size, strokeWidth: ic.stroke, "aria-hidden": true }) })) }));
|
|
233
233
|
}
|
|
234
234
|
/**
|
|
235
235
|
* The same icon, but it is a real link.
|
|
@@ -242,5 +242,5 @@ export function IconButton({ icon: Icon, label, size = "sm", surface: surfacePro
|
|
|
242
242
|
export function IconLink({ icon: Icon, label, href, download, size = "sm", surface: surfaceProp, tone = "action", tooltip = true, ref, ...native }) {
|
|
243
243
|
const surface = useSurface(surfaceProp);
|
|
244
244
|
const ic = ICON[size];
|
|
245
|
-
return (_jsx(Labelled, { label: label, tooltip: tooltip, children: (title) => (_jsx("a", { ...native, ref: ref, href: href, ...(download === undefined ? {} : { download }), title: title, "aria-label": label, className: `${BOX} ${SQUARE[size]} ${TONE[tone][surface]}`, children: _jsx(Icon, { className: ic.size, strokeWidth: ic.stroke, "aria-hidden": true }) })) }));
|
|
245
|
+
return (_jsx(Labelled, { label: label, tooltip: tooltip, children: (title) => (_jsx("a", { ...native, ref: ref, href: href, ...(download === undefined ? {} : { download }), title: title, "aria-label": label, "data-ui": "icon-button", "data-tone": tone, "data-size": size, "data-surface": surface, className: `${BOX} ${SQUARE[size]} ${TONE[tone][surface]}`, children: _jsx(Icon, { className: ic.size, strokeWidth: ic.stroke, "aria-hidden": true }) })) }));
|
|
246
246
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type FormMode } from "../../foundations/form.js";
|
|
2
|
+
import type { Surface } from "../../foundations/types.js";
|
|
2
3
|
import { type SegmentOption } from "./options.js";
|
|
3
4
|
export type SegmentedControlProps = {
|
|
4
5
|
value: string;
|
|
@@ -12,5 +13,7 @@ export type SegmentedControlProps = {
|
|
|
12
13
|
mode?: FormMode;
|
|
13
14
|
/** The name of the group when it is not inside a `Field` — "Período". */
|
|
14
15
|
"aria-label"?: string;
|
|
16
|
+
/** By default it inherits it from the surface that wraps it. */
|
|
17
|
+
surface?: Surface;
|
|
15
18
|
};
|
|
16
|
-
export declare function SegmentedControl({ value, onChange, options, size, disabled, describedBy: ownDescribedBy, mode, "aria-label": ariaLabel, }: SegmentedControlProps): import("react").JSX.Element;
|
|
19
|
+
export declare function SegmentedControl({ value, onChange, options, size, disabled, describedBy: ownDescribedBy, mode, "aria-label": ariaLabel, surface, }: SegmentedControlProps): import("react").JSX.Element;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { controlName, useFieldIds } from "../../foundations/form.js";
|
|
4
4
|
import { useFormMode } from "../../foundations/form.js";
|
|
5
|
+
import { useSurface } from "../../foundations/surface.js";
|
|
5
6
|
import { tv } from "../../foundations/variants.js";
|
|
6
7
|
import { labelOf } from "./options.js";
|
|
7
8
|
import { ReadValue } from "../field/Field.js";
|
|
@@ -20,25 +21,36 @@ import { ToggleButton, ToggleButtonGroup } from "react-aria-components";
|
|
|
20
21
|
* instead (the kind of a contact: Persona · Empresa), and then it follows the form: in read
|
|
21
22
|
* mode it draws the chosen label.
|
|
22
23
|
*/
|
|
24
|
+
/* On the chrome (the `ThemeSwitcher` at the foot of a sidebar in the brand's colour) the
|
|
25
|
+
control speaks the chrome's palette: a white box on the navy was the mix the surface
|
|
26
|
+
context exists to prevent. The hairline is ink at 25 %, the selection ink at 15 %. */
|
|
23
27
|
const group = tv({
|
|
24
|
-
base: "inline-flex w-fit max-w-full min-w-0 shrink-0 items-stretch overflow-hidden rounded-control border
|
|
28
|
+
base: "inline-flex w-fit max-w-full min-w-0 shrink-0 items-stretch overflow-hidden rounded-control border forced-colors:border-[ButtonBorder]",
|
|
25
29
|
variants: {
|
|
26
30
|
size: {
|
|
27
31
|
sm: "h-(--size-control-sm)",
|
|
28
32
|
md: "h-(--size-control-md)",
|
|
29
33
|
},
|
|
34
|
+
surface: {
|
|
35
|
+
canvas: "border-line-strong bg-surface",
|
|
36
|
+
chrome: "border-chrome-ink/25 bg-chrome-ink/6",
|
|
37
|
+
},
|
|
30
38
|
},
|
|
31
39
|
});
|
|
32
40
|
const segment = tv({
|
|
33
|
-
base: "inline-flex min-w-0 cursor-pointer items-center justify-center gap-1.5 border-l
|
|
41
|
+
base: "inline-flex min-w-0 cursor-pointer items-center justify-center gap-1.5 border-l text-meta whitespace-nowrap transition-colors duration-(--duration-instant) outline-0 first:border-l-0 forced-color-adjust-none forced-colors:border-[ButtonBorder]",
|
|
34
42
|
variants: {
|
|
35
43
|
size: {
|
|
36
44
|
sm: "px-2.5",
|
|
37
45
|
md: "px-3.5",
|
|
38
46
|
},
|
|
47
|
+
surface: {
|
|
48
|
+
canvas: "border-line-strong",
|
|
49
|
+
chrome: "border-chrome-ink/25",
|
|
50
|
+
},
|
|
39
51
|
isSelected: {
|
|
40
|
-
false: "
|
|
41
|
-
true: "
|
|
52
|
+
false: "",
|
|
53
|
+
true: "forced-colors:bg-[Highlight] forced-colors:text-[HighlightText]",
|
|
42
54
|
},
|
|
43
55
|
isFocusVisible: {
|
|
44
56
|
true: "outline-2 -outline-offset-2 outline-primary forced-colors:outline-[Highlight]",
|
|
@@ -47,8 +59,24 @@ const segment = tv({
|
|
|
47
59
|
true: "cursor-not-allowed opacity-45",
|
|
48
60
|
},
|
|
49
61
|
},
|
|
62
|
+
compoundVariants: [
|
|
63
|
+
{
|
|
64
|
+
surface: "canvas",
|
|
65
|
+
isSelected: false,
|
|
66
|
+
class: "bg-surface text-muted hover:bg-ink/5 hover:text-ink pressed:bg-ink/10",
|
|
67
|
+
},
|
|
68
|
+
{ surface: "canvas", isSelected: true, class: "bg-ink/8 text-ink" },
|
|
69
|
+
{
|
|
70
|
+
surface: "chrome",
|
|
71
|
+
isSelected: false,
|
|
72
|
+
class: "text-chrome-muted hover:bg-chrome-ink/10 hover:text-chrome-ink pressed:bg-chrome-ink/15",
|
|
73
|
+
},
|
|
74
|
+
{ surface: "chrome", isSelected: true, class: "bg-chrome-ink/15 text-chrome-ink" },
|
|
75
|
+
{ surface: "chrome", isFocusVisible: true, class: "outline-chrome-link" },
|
|
76
|
+
],
|
|
50
77
|
});
|
|
51
|
-
export function SegmentedControl({ value, onChange, options, size = "md", disabled = false, describedBy: ownDescribedBy, mode, "aria-label": ariaLabel, }) {
|
|
78
|
+
export function SegmentedControl({ value, onChange, options, size = "md", disabled = false, describedBy: ownDescribedBy, mode, "aria-label": ariaLabel, surface, }) {
|
|
79
|
+
const sup = useSurface(surface);
|
|
52
80
|
/* No `id`: a group of buttons is not something a `<label for>` can point at; the field
|
|
53
81
|
names it through `aria-labelledby`. */
|
|
54
82
|
const { labelledBy, describedBy } = useFieldIds({ describedBy: ownDescribedBy });
|
|
@@ -62,8 +90,8 @@ export function SegmentedControl({ value, onChange, options, size = "md", disabl
|
|
|
62
90
|
const [next] = keys;
|
|
63
91
|
if (next !== undefined && String(next) !== value)
|
|
64
92
|
onChange?.(String(next));
|
|
65
|
-
}, isDisabled: disabled, className: group({ size }), children: options.map((o) => {
|
|
93
|
+
}, isDisabled: disabled, className: group({ size, surface: sup }), children: options.map((o) => {
|
|
66
94
|
const Icon = o.icon;
|
|
67
|
-
return (_jsxs(ToggleButton, { id: o.value, isDisabled: o.disabled, className: (state) => segment({ ...state, size }), children: [Icon === undefined ? null : (_jsx(Icon, { "aria-hidden": true, className: "size-(--size-icon-md) shrink-0", strokeWidth: 2 })), o.label] }, o.value));
|
|
95
|
+
return (_jsxs(ToggleButton, { id: o.value, isDisabled: o.disabled, className: (state) => segment({ ...state, size, surface: sup }), children: [Icon === undefined ? null : (_jsx(Icon, { "aria-hidden": true, className: "size-(--size-icon-md) shrink-0", strokeWidth: 2 })), o.label] }, o.value));
|
|
68
96
|
}) }));
|
|
69
97
|
}
|
|
@@ -33,7 +33,7 @@ export declare const dialogStyles: {
|
|
|
33
33
|
isExiting: {
|
|
34
34
|
true: string;
|
|
35
35
|
};
|
|
36
|
-
}, undefined, "flex max-h-full w-full flex-col overflow-hidden rounded-
|
|
36
|
+
}, undefined, "flex max-h-full w-full flex-col overflow-hidden rounded-ui-dialog border border-line-strong bg-ui-dialog text-ink shadow-window outline-0 transition-[opacity,translate] duration-(--duration-panel) ease-(--ease-out) forced-colors:bg-[Canvas] max-sm:max-h-(--size-sheet) max-sm:max-w-none max-sm:rounded-b-none max-sm:border-x-0 max-sm:border-b-0", undefined, undefined, undefined>;
|
|
37
37
|
};
|
|
38
38
|
export type DialogWidth = "sm" | "md" | "lg";
|
|
39
39
|
export interface DialogProps {
|
|
@@ -23,7 +23,7 @@ const overlay = tv({
|
|
|
23
23
|
* are rounded (the bottom ones sit on the screen's edge), it stops at `--size-sheet`,
|
|
24
24
|
* and it enters from below — the motion says where it lives. */
|
|
25
25
|
const modal = tv({
|
|
26
|
-
base: "flex max-h-full w-full flex-col overflow-hidden rounded-
|
|
26
|
+
base: "flex max-h-full w-full flex-col overflow-hidden rounded-ui-dialog border border-line-strong bg-ui-dialog text-ink shadow-window outline-0 transition-[opacity,translate] duration-(--duration-panel) ease-(--ease-out) forced-colors:bg-[Canvas] max-sm:max-h-(--size-sheet) max-sm:max-w-none max-sm:rounded-b-none max-sm:border-x-0 max-sm:border-b-0",
|
|
27
27
|
variants: {
|
|
28
28
|
width: { sm: "max-w-md", md: "max-w-2xl", lg: "max-w-4xl" },
|
|
29
29
|
isEntering: { true: "translate-y-2 opacity-0 max-sm:translate-y-full" },
|
|
@@ -97,7 +97,7 @@ export function Dialog({ open, width = "md", onClose, movable = false, ...surfac
|
|
|
97
97
|
return (_jsx(ModalOverlay, { isOpen: open, onOpenChange: (next) => {
|
|
98
98
|
if (!next)
|
|
99
99
|
onClose();
|
|
100
|
-
}, isDismissable: true, className: overlay, children: _jsx(Modal, { className: (state) => modal({ ...state, width }), ...(movable
|
|
100
|
+
}, isDismissable: true, className: overlay, children: _jsx(Modal, { "data-ui": "dialog", "data-width": width, className: (state) => modal({ ...state, width }), ...(movable
|
|
101
101
|
? { style: { transform: `translate(${offset.x}px, ${offset.y}px)` } }
|
|
102
102
|
: {}), children: _jsx(DialogSurface, { onClose: onClose, ...surface, ...(movable ? { onDragStart: drag } : {}) }) }) }));
|
|
103
103
|
}
|
|
@@ -64,7 +64,7 @@ function CardDatumBox({ id: ownId, value, onChange, placeholder, describedBy: ow
|
|
|
64
64
|
describedBy: ownDescribedBy,
|
|
65
65
|
invalid: ownInvalid,
|
|
66
66
|
});
|
|
67
|
-
return (_jsx(AriaTextField, { id: id, "aria-labelledby": labelledBy, "aria-label": nameOf(labelledBy, ariaLabel, placeholder), value: value, onChange: onChange, inputMode: "numeric", autoComplete: autoComplete, isInvalid: invalid, isDisabled: disabled, className: "w-full min-w-0", children: _jsx(Input, { ...(inputRef === undefined ? {} : { ref: inputRef }), "aria-describedby": describedBy, placeholder: placeholder, spellCheck: false, className: `${controlClasses(invalid)} font-mono tabular-nums` }) }));
|
|
67
|
+
return (_jsx(AriaTextField, { id: id, "aria-labelledby": labelledBy, "aria-label": nameOf(labelledBy, ariaLabel, placeholder), value: value, onChange: onChange, inputMode: "numeric", autoComplete: autoComplete, isInvalid: invalid, isDisabled: disabled, className: "w-full min-w-0", children: _jsx(Input, { ...(inputRef === undefined ? {} : { ref: inputRef }), "aria-describedby": describedBy, placeholder: placeholder, spellCheck: false, "data-ui": "control", className: `${controlClasses(invalid)} font-mono tabular-nums` }) }));
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* The expiry of a card, «MM/AA». The value is the four digits («1228»); the slash is drawn.
|
|
@@ -6,6 +6,20 @@ export interface CheckItem {
|
|
|
6
6
|
detail?: string;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* The drawn box of a check, with no behaviour of its own.
|
|
11
|
+
*
|
|
12
|
+
* Context: exported for the rows that ARE a multiple choice without being a form input —
|
|
13
|
+
* the filters of the search panel, a grouping level — so they mark «on» with the same box
|
|
14
|
+
* as `Checkbox`. The host carries the semantics (`aria-pressed`, a listbox option); this
|
|
15
|
+
* is `aria-hidden`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function CheckMark({ on, mixed, focus, invalid, }: {
|
|
18
|
+
on: boolean;
|
|
19
|
+
mixed?: boolean;
|
|
20
|
+
focus?: boolean;
|
|
21
|
+
invalid?: boolean;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
9
23
|
/**
|
|
10
24
|
* One yes/no answer of a form: «Exento de IVA», «Enviar la factura por correo al
|
|
11
25
|
* publicar».
|