@sincpro/web-ui 2.18.0 → 2.19.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.
Files changed (69) hide show
  1. package/README.md +6 -4
  2. package/dist/components/calendar/RecordCalendar.js +1 -1
  3. package/dist/components/flow/SetupCard.d.ts +21 -0
  4. package/dist/components/flow/SetupCard.js +16 -0
  5. package/dist/components/flow/index.d.ts +1 -0
  6. package/dist/components/flow/index.js +3 -0
  7. package/dist/components/form/Form.js +7 -5
  8. package/dist/components/listing/Pagination.js +28 -3
  9. package/dist/components/listing/Row.d.ts +5 -2
  10. package/dist/components/listing/Row.js +6 -5
  11. package/dist/components/listing/modelCells.js +1 -1
  12. package/dist/components/navigation/NavigationTree.d.ts +3 -0
  13. package/dist/components/navigation/NavigationTree.js +2 -1
  14. package/dist/components/record/ActionDock.d.ts +10 -3
  15. package/dist/components/record/ActionDock.js +15 -8
  16. package/dist/components/record/DirtyActions.d.ts +15 -7
  17. package/dist/components/record/DirtyActions.js +37 -13
  18. package/dist/components/record/DockMessage.d.ts +18 -0
  19. package/dist/components/record/DockMessage.js +31 -0
  20. package/dist/components/record/dock.d.ts +25 -0
  21. package/dist/components/record/index.d.ts +2 -1
  22. package/dist/components/record/index.js +1 -0
  23. package/dist/components/shell/Page.d.ts +12 -0
  24. package/dist/components/shell/Page.js +12 -0
  25. package/dist/components/shell/Sidebar.d.ts +22 -3
  26. package/dist/components/shell/Sidebar.js +88 -10
  27. package/dist/components/shell/index.d.ts +1 -0
  28. package/dist/components/shell/index.js +2 -0
  29. package/dist/foundations/copy.es.js +5 -0
  30. package/dist/foundations/grouping.d.ts +37 -0
  31. package/dist/foundations/grouping.js +0 -0
  32. package/dist/foundations/index.d.ts +1 -1
  33. package/dist/foundations/index.js +1 -1
  34. package/dist/foundations/uiCopy.d.ts +10 -0
  35. package/dist/foundations/uiCopy.js +5 -0
  36. package/dist/primitives/button/Button.d.ts +5 -1
  37. package/dist/primitives/button/Button.js +4 -4
  38. package/dist/primitives/button/classes.d.ts +1 -8
  39. package/dist/primitives/button/classes.js +12 -2
  40. package/dist/primitives/menu/Menu.d.ts +22 -1
  41. package/dist/primitives/menu/Menu.js +44 -18
  42. package/dist/primitives/table/DataTable.d.ts +16 -1
  43. package/dist/primitives/table/DataTable.js +62 -22
  44. package/dist/primitives/table/EditableTable.js +6 -7
  45. package/dist/primitives/table/PileFootLine.d.ts +4 -2
  46. package/dist/primitives/table/PileFootLine.js +16 -5
  47. package/dist/primitives/table/ReportTable.js +2 -2
  48. package/dist/primitives/table/RowActions.js +1 -1
  49. package/dist/primitives/table/SheetTable.d.ts +19 -1
  50. package/dist/primitives/table/SheetTable.js +22 -2
  51. package/dist/primitives/table/Table.js +9 -6
  52. package/dist/primitives/table/index.d.ts +1 -1
  53. package/dist/primitives/table/index.js +1 -1
  54. package/dist/primitives/tabs/Tabs.d.ts +21 -1
  55. package/dist/primitives/tabs/Tabs.js +26 -7
  56. package/dist/primitives/tabs/index.d.ts +1 -1
  57. package/dist/primitives/tag/Tag.d.ts +5 -0
  58. package/dist/primitives/tag/Tag.js +2 -1
  59. package/dist/primitives/tag/Tags.js +1 -1
  60. package/dist/primitives/value/Avatar.d.ts +7 -3
  61. package/dist/primitives/value/Avatar.js +17 -11
  62. package/dist/primitives/value/Person.js +9 -3
  63. package/dist/primitives/value/Value.js +4 -1
  64. package/dist/views/list/ListView.js +27 -7
  65. package/dist/views/list/derive.d.ts +15 -3
  66. package/dist/views/list/derive.js +48 -6
  67. package/dist/views/list/presentations.js +2 -1
  68. package/dist/views/list/types.d.ts +5 -1
  69. package/package.json +1 -1
@@ -6,6 +6,7 @@ export { ActionDock, } from "./ActionDock.js";
6
6
  export { Breadcrumb } from "./Breadcrumb.js";
7
7
  export { DirtyActions, } from "./DirtyActions.js";
8
8
  export { dockOption, dockPlan, moreGroups, } from "./dock.js";
9
+ export { DockMessage } from "./DockMessage.js";
9
10
  export { Pager } from "./Pager.js";
10
11
  export { RecordAudit } from "./RecordAudit.js";
11
12
  export { RecordRibbon } from "./RecordRibbon.js";
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * The page's margin, for content that is not a view.
4
+ *
5
+ * Context: a `Record` and a `List` bring their own margin; a page made of other pieces — a
6
+ * `SetupCard` under a section's tab, an `Empty` that is the whole page, a dashboard — did not
7
+ * have one, and each piece adding its own doubled it inside a padded frame. The frame holds
8
+ * the page; this gives it the side margin and the reading width, once.
9
+ */
10
+ export declare function Page({ children }: {
11
+ children: ReactNode;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * The page's margin, for content that is not a view.
4
+ *
5
+ * Context: a `Record` and a `List` bring their own margin; a page made of other pieces — a
6
+ * `SetupCard` under a section's tab, an `Empty` that is the whole page, a dashboard — did not
7
+ * have one, and each piece adding its own doubled it inside a padded frame. The frame holds
8
+ * the page; this gives it the side margin and the reading width, once.
9
+ */
10
+ export function Page({ children }) {
11
+ return (_jsx("div", { "data-ui": "page", className: "mx-auto flex w-full max-w-(--container-sheet) min-w-0 flex-col gap-4 p-4 sm:p-6", children: children }));
12
+ }
@@ -1,7 +1,7 @@
1
1
  import { type BrandLogo } from "./brandMark.js";
2
2
  import { type SearchEntryProps } from "./SearchEntry.js";
3
3
  import type { Surface } from "../../foundations/types.js";
4
- import type { LucideIcon } from "lucide-react";
4
+ import { type LucideIcon } from "lucide-react";
5
5
  import type { ReactNode } from "react";
6
6
  export type SidebarAction = {
7
7
  id: string;
@@ -11,6 +11,13 @@ export type SidebarAction = {
11
11
  href?: string;
12
12
  /** The link opens in another tab; a screen reader is told so. */
13
13
  external?: boolean;
14
+ /** Choosing it copies this text — «Copiar código de soporte CR-00CED9» — and is reported
15
+ * too, so the application can say «Copiado». */
16
+ copy?: string;
17
+ /** A hairline above it in the account menu: «Salir» apart from the rest. */
18
+ apart?: boolean;
19
+ /** It ends something — «Salir», «Cerrar todas las sesiones»: in the danger tone. */
20
+ danger?: boolean;
14
21
  };
15
22
  export type SidebarProps = {
16
23
  /** The product, at the top: its name and its mark — an icon, or its logo: the URL of an
@@ -19,13 +26,25 @@ export type SidebarProps = {
19
26
  label: string;
20
27
  icon?: LucideIcon;
21
28
  logo?: BrandLogo;
29
+ /** A word beside the name — the plan, the environment: «Avanzado», «Pruebas». */
30
+ badge?: string;
22
31
  };
23
- /** Who is signed in. */
32
+ /** Who is signed in. `detail` is the role under the name; `org` names whose account it is,
33
+ * in the menu's header. */
24
34
  user?: {
25
35
  name: string;
26
36
  detail?: string;
27
37
  avatar?: string;
38
+ org?: string;
28
39
  };
40
+ /** `menu` (default): the person at the bottom, a button that opens the account's menu.
41
+ * `list`: the person at the top and the account's verbs listed at the bottom. */
42
+ account?: "menu" | "list";
43
+ /** The theme (system / light / dark) as one row of the account menu. */
44
+ theme?: boolean;
45
+ /** Beside the person — at the foot with `account="menu"`, beside the name on top with
46
+ * `"list"`: the notifications (`SystrayButton`, `Notifications`). */
47
+ bell?: ReactNode;
29
48
  /** «Buscar… ⌘K» under the product and the user: the application's palette, made visible.
30
49
  * `onSearch` opens it; the palette keeps listening for its own key. */
31
50
  search?: Omit<SearchEntryProps, "layout" | "surface">;
@@ -40,4 +59,4 @@ export type SidebarProps = {
40
59
  /** `chrome` wears the brand's colour. By default the frame's `sidebarSurface`. */
41
60
  surface?: Surface;
42
61
  };
43
- export declare function Sidebar({ brand, user, search, children, actions, onAction, footer, surface, }: SidebarProps): import("react").JSX.Element;
62
+ export declare function Sidebar({ brand, user, search, children, actions, onAction, footer, surface, account, theme, bell, }: SidebarProps): import("react").JSX.Element;
@@ -5,7 +5,11 @@ import { SearchEntry, } from "./SearchEntry.js";
5
5
  import { useSidebarDrawer } from "./sidebarDrawer.js";
6
6
  import { useUiCopy } from "../../foundations/copy.js";
7
7
  import { SurfaceProvider, useSurface } from "../../foundations/surface.js";
8
+ import { useTheme } from "../../foundations/theme.js";
9
+ import { Menu } from "../../primitives/menu/Menu.js";
10
+ import { Tag } from "../../primitives/tag/Tag.js";
8
11
  import { Avatar } from "../../primitives/value/Person.js";
12
+ import { ChevronsUpDown, Monitor, Moon, Sun } from "lucide-react";
9
13
  /* Each surface's colours in one place: the column is ONE surface, and a row drawn with the
10
14
  other palette is the bug the surface context exists to prevent. The hairlines are ink at a
11
15
  low alpha on the chrome: `chrome-edge` is the chrome itself on light, an invisible line. */
@@ -17,6 +21,8 @@ const SKIN = {
17
21
  mark: "text-primary",
18
22
  line: "border-line",
19
23
  row: "text-ink hover:bg-ink/6 focus-visible:outline-primary",
24
+ /* «Salir» in the danger tone: the word is what warns, the colour helps. */
25
+ danger: "text-danger hover:bg-danger/10 focus-visible:outline-primary",
20
26
  },
21
27
  chrome: {
22
28
  root: "bg-chrome",
@@ -25,34 +31,106 @@ const SKIN = {
25
31
  mark: "text-chrome-link",
26
32
  line: "border-chrome-ink/12",
27
33
  row: "text-chrome-ink hover:bg-chrome-ink/10 focus-visible:outline-chrome-link",
34
+ danger: "text-chrome-bad hover:bg-chrome-bad/10 focus-visible:outline-chrome-link",
28
35
  },
29
36
  };
30
37
  const ROW = "flex h-(--size-control-sm) w-full min-w-0 cursor-pointer items-center gap-2 rounded-control px-2 text-meta no-underline transition-colors duration-(--duration-instant) focus-visible:outline-2 focus-visible:-outline-offset-2";
31
- function Brand({ brand, skin }) {
38
+ function Brand({ brand, skin, surface, }) {
32
39
  const Icon = brand.icon;
33
- return (_jsxs("div", { "data-ui": "sidebar.brand", className: "flex min-w-0 items-center gap-2 px-4 pt-4 pb-2", children: [brand.logo === undefined ? (Icon === undefined ? null : (_jsx(Icon, { className: `size-(--size-icon-lg) shrink-0 ${skin.mark}`, strokeWidth: 1.75, "aria-hidden": true }))) : (_jsx(BrandMark, { logo: brand.logo, className: "size-(--size-control-md) shrink-0" })), _jsx("span", { className: `min-w-0 truncate text-lead font-semibold ${skin.ink}`, children: brand.label })] }));
40
+ return (_jsxs("div", { "data-ui": "sidebar.brand", className: "flex min-w-0 items-center gap-2 px-4 pt-4 pb-2", children: [brand.logo === undefined ? (Icon === undefined ? null : (_jsx(Icon, { className: `size-(--size-icon-lg) shrink-0 ${skin.mark}`, strokeWidth: 1.75, "aria-hidden": true }))) : (_jsx(BrandMark, { logo: brand.logo, className: "size-(--size-control-md) shrink-0" })), _jsx("span", { className: `min-w-0 truncate text-lead font-semibold ${skin.ink}`, children: brand.label }), brand.badge === undefined ? null : _jsx(Tag, { surface: surface, children: brand.badge })] }));
34
41
  }
35
42
  function User({ user, skin }) {
36
43
  return (_jsxs("div", { "data-ui": "sidebar.user", className: "flex min-w-0 items-center gap-2 px-4 py-2", children: [_jsx(Avatar, { name: user.name, size: "md", ...(user.avatar === undefined ? {} : { src: user.avatar }) }), _jsxs("span", { className: "flex min-w-0 flex-col leading-tight", children: [_jsx("span", { className: `truncate text-meta ${skin.ink}`, children: user.name }), user.detail === undefined ? null : (_jsx("span", { className: `truncate text-micro ${skin.muted}`, children: user.detail }))] })] }));
37
44
  }
45
+ /** What choosing an account action does, in the list and in the menu alike: copy what it
46
+ * carries, then report it. */
47
+ function run(action, onAction) {
48
+ if (action.copy !== undefined)
49
+ void navigator.clipboard?.writeText(action.copy);
50
+ onAction?.(action.id);
51
+ }
38
52
  function Action({ action, skin, onAction, }) {
39
53
  const copy = useUiCopy();
40
54
  const drawer = useSidebarDrawer();
41
55
  const Icon = action.icon;
42
- const content = (_jsxs(_Fragment, { children: [Icon === undefined ? null : (_jsx(Icon, { className: `size-(--size-icon-md) shrink-0 ${skin.muted}`, strokeWidth: 2, "aria-hidden": true })), _jsx("span", { className: "min-w-0 truncate", children: action.label })] }));
56
+ const row = `${ROW} ${action.danger === true ? skin.danger : skin.row}`;
57
+ const content = (_jsxs(_Fragment, { children: [Icon === undefined ? null : (_jsx(Icon, { className: `size-(--size-icon-md) shrink-0 ${action.danger === true ? "" : skin.muted}`, strokeWidth: 2, "aria-hidden": true })), _jsx("span", { className: "min-w-0 truncate", children: action.label })] }));
43
58
  if (action.href !== undefined) {
44
- return (_jsxs("a", { href: action.href, className: `${ROW} ${skin.row}`, ...(action.external === true ? { target: "_blank", rel: "noreferrer" } : {}), children: [content, action.external === true ? (_jsx("span", { className: "sr-only", children: ` (${copy.field.newTab})` })) : null] }));
59
+ return (_jsxs("a", { href: action.href, className: row, ...(action.external === true ? { target: "_blank", rel: "noreferrer" } : {}), children: [content, action.external === true ? (_jsx("span", { className: "sr-only", children: ` (${copy.field.newTab})` })) : null] }));
45
60
  }
46
- return (_jsx("button", { type: "button", className: `${ROW} ${skin.row}`, onClick: () => {
47
- onAction?.(action.id);
61
+ return (_jsx("button", { type: "button", className: row, onClick: () => {
62
+ run(action, onAction);
48
63
  drawer?.close();
49
64
  }, children: content }));
50
65
  }
51
- export function Sidebar({ brand, user, search, children, actions, onAction, footer, surface, }) {
66
+ /** Who the person is, as the account row and the menu's header draw it. */
67
+ function Who({ user, skin, line, }) {
68
+ return (_jsxs(_Fragment, { children: [_jsx(Avatar, { name: user.name, size: "md", decorative: true, ...(user.avatar === undefined ? {} : { src: user.avatar }) }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col leading-tight", children: [_jsx("span", { className: `truncate text-meta font-medium ${skin.ink}`, children: user.name }), line === undefined ? null : (_jsx("span", { className: `truncate text-micro ${skin.muted}`, children: line }))] })] }));
69
+ }
70
+ /** The account at the foot: one button — the person — that opens what is done with the
71
+ * account, the bell beside it. */
72
+ function Account({ user, actions, onAction, theme, bell, skin, surface, }) {
73
+ const copy = useUiCopy();
74
+ const drawer = useSidebarDrawer();
75
+ const { theme: chosen, setTheme } = useTheme();
76
+ const option = (action) => ({
77
+ id: action.id,
78
+ label: action.label,
79
+ ...(action.icon === undefined ? {} : { icon: action.icon }),
80
+ ...(action.apart === true ? { divider: true } : {}),
81
+ ...(action.danger === true ? { danger: true } : {}),
82
+ /* A link stays a link: the row is an `<a>` (new tab, the router, «copy link»). */
83
+ ...(action.href === undefined
84
+ ? {}
85
+ : {
86
+ href: action.href,
87
+ ...(action.external === true ? { target: "_blank" } : {}),
88
+ }),
89
+ ...(action.href === undefined || action.external !== true
90
+ ? {}
91
+ : { hint: copy.field.newTab }),
92
+ onSelect: () => {
93
+ if (action.href !== undefined)
94
+ return;
95
+ run(action, onAction);
96
+ drawer?.close();
97
+ },
98
+ });
99
+ const groups = [
100
+ ...(theme
101
+ ? [
102
+ {
103
+ label: copy.theme.label,
104
+ inline: true,
105
+ options: [
106
+ ["light", copy.theme.light, Sun],
107
+ ["dark", copy.theme.dark, Moon],
108
+ ["system", copy.theme.system, Monitor],
109
+ ].map(([value, label, icon]) => ({
110
+ id: `\u0000theme:${value}`,
111
+ label,
112
+ icon,
113
+ checked: chosen === value,
114
+ onSelect: () => setTheme(value),
115
+ })),
116
+ },
117
+ ]
118
+ : []),
119
+ ...(actions.length === 0 ? [] : [{ options: actions.map(option) }]),
120
+ ];
121
+ return (_jsxs("div", { "data-ui": "sidebar.me", className: "flex min-w-0 items-center gap-1", children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsx(Menu, { label: copy.shell.account, groups: groups, surface: surface === "chrome" ? "chrome" : "canvas", placement: "top start", header: _jsx("span", { className: "flex min-w-0 items-center gap-2", children: _jsx(Who, { user: user, skin: { ink: "text-ink", muted: "text-muted" }, line: user.org ?? user.detail }) }), trigger: _jsxs(_Fragment, { children: [_jsx(Who, { user: user, skin: skin, line: user.detail }), _jsx(ChevronsUpDown, { className: `size-(--size-icon-sm) shrink-0 ${skin.muted}`, strokeWidth: 2, "aria-hidden": true })] }) }) }), bell] }));
122
+ }
123
+ export function Sidebar({ brand, user, search, children, actions, onAction, footer, surface, account = "menu", theme = false, bell, }) {
52
124
  const copy = useUiCopy();
53
125
  const sup = useSurface(surface);
54
126
  const skin = SKIN[sup];
55
- const head = brand !== undefined || user !== undefined || search !== undefined;
56
- const foot = (actions !== undefined && actions.length > 0) || footer !== undefined;
57
- return (_jsx(SurfaceProvider, { value: sup, children: _jsxs("div", { "data-ui": "sidebar", "data-surface": sup, className: `flex h-full min-h-0 min-w-0 flex-col ${skin.root}`, children: [head ? (_jsxs("div", { className: `shrink-0 border-b pb-2 ${skin.line}`, children: [brand === undefined ? null : _jsx(Brand, { brand: brand, skin: skin }), user === undefined ? null : _jsx(User, { user: user, skin: skin }), search === undefined ? null : (_jsx("div", { "data-ui": "sidebar.search", className: "px-2 pt-2", children: _jsx(SearchEntry, { ...search }) }))] })) : null, _jsx("div", { "data-ui": "sidebar.nav", className: "min-h-0 flex-1 overflow-y-auto overscroll-contain", children: children }), foot ? (_jsxs("div", { "data-ui": "sidebar.account", className: `flex shrink-0 flex-col gap-2 border-t p-2 ${skin.line}`, children: [actions === undefined || actions.length === 0 ? null : (_jsx("ul", { "aria-label": copy.shell.account, className: "flex flex-col gap-px", children: actions.map((action) => (_jsx("li", { children: _jsx(Action, { action: action, skin: skin, ...(onAction === undefined ? {} : { onAction }) }) }, action.id))) })), footer] })) : null] }) }));
127
+ /* The person goes to the foot as a menu only when there is a person AND something to put
128
+ in it: verbs and no user stay listed, and a person with nothing to choose stays a name —
129
+ a button that opens «nothing matches» is a door to an empty room. */
130
+ const asMenu = account === "menu" && user !== undefined && ((actions?.length ?? 0) > 0 || theme);
131
+ const head = brand !== undefined || (user !== undefined && !asMenu) || search !== undefined;
132
+ const foot = asMenu || (actions !== undefined && actions.length > 0) || footer !== undefined;
133
+ return (_jsx(SurfaceProvider, { value: sup, children: _jsxs("div", { "data-ui": "sidebar", "data-surface": sup, className: `flex h-full min-h-0 min-w-0 flex-col ${skin.root}`, children: [head ? (_jsxs("div", { className: `shrink-0 border-b pb-2 ${skin.line}`, children: [brand === undefined ? null : (_jsx(Brand, { brand: brand, skin: skin, surface: sup === "chrome" ? "chrome" : "canvas" })), user === undefined || asMenu ? null : (_jsxs("div", { className: "flex min-w-0 items-center pr-2", children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsx(User, { user: user, skin: skin }) }), bell] })), search === undefined ? null : (_jsx("div", { "data-ui": "sidebar.search", className: "px-2 pt-2", children: _jsx(SearchEntry, { ...search }) }))] })) : null, _jsx("div", { "data-ui": "sidebar.nav", className: "min-h-0 flex-1 overflow-y-auto overscroll-contain", children: children }), foot ? (_jsxs("div", { "data-ui": "sidebar.account", className: `flex shrink-0 flex-col gap-2 border-t p-2 ${skin.line}`, children: [asMenu ? (_jsxs(_Fragment, { children: [footer, _jsx(Account, { user: user, actions: actions ?? [], onAction: onAction, theme: theme, bell: bell, skin: skin, surface: sup })] })) : actions === undefined || actions.length === 0 ? null : (_jsx("ul", { "aria-label": copy.shell.account, className: "flex flex-col gap-px", children: actions.map((action) => (_jsx("li", { ...(action.apart === true
134
+ ? { className: `mt-1 border-t pt-1 ${skin.line}` }
135
+ : {}), children: _jsx(Action, { action: action, skin: skin, ...(onAction === undefined ? {} : { onAction }) }) }, action.id))) })), asMenu ? null : footer] })) : null] }) }));
58
136
  }
@@ -1,4 +1,5 @@
1
1
  export { AppFrame } from "./AppFrame.js";
2
+ export { Page } from "./Page.js";
2
3
  export { type BrandLogo } from "./brandMark.js";
3
4
  export { Sidebar, type SidebarAction, type SidebarProps, } from "./Sidebar.js";
4
5
  export { SearchEntry, type SearchEntryProps, } from "./SearchEntry.js";
@@ -1,5 +1,7 @@
1
1
  /* THE APPLICATION FRAME — what sits above every view. */
2
2
  export { AppFrame } from "./AppFrame.js";
3
+ /* The page's margin and reading width, for a page that is not a Record or a List. */
4
+ export { Page } from "./Page.js";
3
5
  /* A product's mark: an image's URL, or an inline <svg> that paints with the tokens. */
4
6
  export {} from "./brandMark.js";
5
7
  /* The whole chrome in one column, for a back office with no bar on top. */
@@ -79,6 +79,7 @@ export const SPANISH_COPY = {
79
79
  unsaved: "sin guardar",
80
80
  unsavedOne: "1 cambio sin guardar",
81
81
  unsavedMany: "{count} cambios sin guardar",
82
+ unsavedAny: "Cambios sin guardar",
82
83
  save: "Guardar",
83
84
  saving: "Guardando…",
84
85
  saved: "Guardado",
@@ -263,6 +264,9 @@ export const SPANISH_COPY = {
263
264
  pileMore: "Ver {count} más",
264
265
  pileMoreOf: "Ver {count} más de {left}",
265
266
  pileShown: "Se muestran {shown} de {count}",
267
+ pilesMore: "Ver {count} grupos más",
268
+ pilesMoreOf: "Ver {count} grupos más de {left}",
269
+ pilesShown: "Se muestran {shown} de {count} grupos",
266
270
  },
267
271
  menu: { empty: "Nada coincide." },
268
272
  list: {
@@ -430,6 +434,7 @@ export const SPANISH_COPY = {
430
434
  stepFlow: {
431
435
  steps: "Pasos",
432
436
  position: "Paso {index} de {total}",
437
+ where: "Paso {index} de {total} · {label}",
433
438
  announce: "{position}: {title}",
434
439
  done: "hecho",
435
440
  pending: "pendiente",
@@ -122,6 +122,16 @@ export type Pile<T> = {
122
122
  * it shows. Absent, the button counts what is left, as it did before this existed.
123
123
  */
124
124
  more?: number | false;
125
+ /**
126
+ * How many piles the level BELOW holds — all of them, not the ones in `piles`.
127
+ *
128
+ * A pile split by surname inside a province can hold 800 surnames and bring 40: the 40 are
129
+ * `piles`, the 800 is this, and the foot under the 40th says «Ver 50 grupos más». Absent,
130
+ * `piles` is the whole level.
131
+ */
132
+ pilesCount?: number;
133
+ /** What the next «more groups» brings, as `more` does for rows: `false` = no next page. */
134
+ morePiles?: number | false;
125
135
  };
126
136
  /**
127
137
  * The identity of a LEVEL: the field and, if it is a date, its grain.
@@ -220,6 +230,20 @@ export type Grouping<T> = {
220
230
  * `pile.items`.
221
231
  */
222
232
  onMore?: (pile: Pile<T>) => void;
233
+ /**
234
+ * How many piles the FIRST level holds over the whole set — a register grouped by surname
235
+ * has ~800, and the server brings the first page of them. Absent, `piles` is all of it.
236
+ * The levels below say theirs in `Pile.pilesCount`.
237
+ */
238
+ pilesCount?: number;
239
+ /** What the next «more groups» at the first level brings: `false` = no next page. */
240
+ morePiles?: number | false;
241
+ /**
242
+ * Asks for the next page of piles: under `parent`, or of the first level when `null`.
243
+ * With this, each presentation offers «Ver N grupos más» after the last pile of a level
244
+ * that holds fewer than it counts; whoever stores the data adds the ones that arrive.
245
+ */
246
+ onMorePiles?: (parent: Pile<T> | null) => void;
223
247
  };
224
248
  /**
225
249
  * The tree to draw, or `null` if nothing is grouped.
@@ -317,6 +341,19 @@ export type PileFoot = {
317
341
  count: number;
318
342
  };
319
343
  export declare function pileFoot<T>(pile: Pile<T>, canAsk: boolean): PileFoot | null;
344
+ /** Where a level's piles say how many there are and how the next page is asked for: the
345
+ * first level in the grouping, the rest in the pile above them. */
346
+ export type PilesPaging<T> = Pick<Grouping<T>, "pilesCount" | "morePiles" | "onMorePiles">;
347
+ /**
348
+ * The foot of a LEVEL of piles: «Ver 50 grupos más de 760», or «Se muestran 40 de 800
349
+ * grupos» with no next page — drawn after the last pile of the level, indented like them.
350
+ *
351
+ * Context: the same question as `pileFoot`, one step up — `pileFoot` pages the rows of a
352
+ * pile, this pages the piles themselves. `parent` is the pile whose sub-piles these are, or
353
+ * `null` for the first level, whose count lives in the grouping (`root` are its piles).
354
+ * `null` when the level holds every pile it counts, or when nobody counted.
355
+ */
356
+ export declare function pilesFoot<T>(parent: Pile<T> | null, root: readonly Pile<T>[], paging: PilesPaging<T> | undefined): PileFoot | null;
320
357
  /** How many rows there are in total. Adds up the counts of the first level, which already
321
358
  * include those below — it does not walk the rows, because it may not have them. */
322
359
  export declare function pileCount<T>(piles: readonly Pile<T>[]): number;
Binary file
@@ -20,7 +20,7 @@ export type { Density, OpenTarget, Size, Surface, Tone, } from "./types.js";
20
20
  export { SPANISH_COPY } from "./copy.es.js";
21
21
  export { flatten, loose, pick, pickAll, propsOf, slot, slotOf, type Slotted, } from "./slots.js";
22
22
  export { dateKey, dateKeysBetween, dateKeyYear, dateLabel, dateTick, grainName, monthName, nextDateKey, } from "./calendar.js";
23
- export { GRAIN_ORDER, type GroupableField, type GroupGrain, type Grouping, type GroupLevel, itemPath, levelKey, moveLevel, normalizeLevels, pathKey, pathLabels, type Pile, pileCount, type PileFoot, pileFoot, pileIsOpen, pileItems, pileLabel, type PileLabelOf, type PileOf, pilesFrom, pilesOf, } from "./grouping.js";
23
+ export { GRAIN_ORDER, type GroupableField, type GroupGrain, type Grouping, type GroupLevel, itemPath, levelKey, moveLevel, normalizeLevels, pathKey, pathLabels, type Pile, pileCount, type PileFoot, pileFoot, pileIsOpen, pileItems, pileLabel, type PileLabelOf, type PileOf, pilesFoot, pilesFrom, pilesOf, type PilesPaging, } from "./grouping.js";
24
24
  export { axisLabels, axisSpans, keyStarts, type Pivot, type PivotAxis, type PivotCell, type PivotCrossing, type PivotFold, pivotFrom, pivotIsEmpty, type PivotKey, type PivotLevel, type PivotMargin, type PivotMeasure, pivotOf, type PivotSource, type PivotSpec, } from "./pivot.js";
25
25
  export { chartCompare, type ChartData, chartFromPivot, chartFromRecord, type ChartKind, type ChartMeasure, chartMeasures, type ChartOrder, type ChartPoint, type ChartReading, COUNT_MEASURE, orderChart, SERIES_COLORS, } from "./chart.js";
26
26
  export { downloadPivot, pivotSheet, type PivotSheetOptions, pivotXlsx, } from "./pivotSheet.js";
@@ -46,7 +46,7 @@ export { dateKey, dateKeysBetween, dateKeyYear, dateLabel, dateTick, grainName,
46
46
  /* THE GROUPING — the vocabulary, which both layers speak: the list builds the
47
47
  tree of buckets and the table draws it. It lives here and not in `contexts/list`
48
48
  because a primitive cannot import from a context. */
49
- export { GRAIN_ORDER, itemPath, levelKey, moveLevel, normalizeLevels, pathKey, pathLabels, pileCount, pileFoot, pileIsOpen, pileItems, pileLabel, pilesFrom, pilesOf, } from "./grouping.js";
49
+ export { GRAIN_ORDER, itemPath, levelKey, moveLevel, normalizeLevels, pathKey, pathLabels, pileCount, pileFoot, pileIsOpen, pileItems, pileLabel, pilesFoot, pilesFrom, pilesOf, } from "./grouping.js";
50
50
  /* THE PIVOT — the same split: the vocabulary here, the grid in `primitives`.
51
51
  That margins come from the base and that a hole is not a zero are rules
52
52
  of the CONTRACT, not of the drawing, and that is why they live on this side. */
@@ -85,6 +85,8 @@ export type UiCopy = {
85
85
  /** How many fields changed — the Save button's description, for a screen reader. */
86
86
  unsavedOne: string;
87
87
  unsavedMany: string;
88
+ /** The floating pill's sentence when nobody counted the changes. */
89
+ unsavedAny: string;
88
90
  save: string;
89
91
  saving: string;
90
92
  /** Said, briefly, once what was saved is saved. */
@@ -342,6 +344,12 @@ export type UiCopy = {
342
344
  pileMoreOf: string;
343
345
  /** Under a short pile with no next page: what it shows of what it counts. */
344
346
  pileShown: string;
347
+ /** After the last pile of a level that holds fewer piles than it counts. */
348
+ pilesMore: string;
349
+ /** The same, saying what one press brings: «Show 50 more groups of 760». */
350
+ pilesMoreOf: string;
351
+ /** After a short level with no next page: what it shows of the piles it counts. */
352
+ pilesShown: string;
345
353
  };
346
354
  menu: {
347
355
  empty: string;
@@ -649,6 +657,8 @@ export type UiCopy = {
649
657
  steps: string;
650
658
  /** Over the step's title: «Step 2 of 3». */
651
659
  position: string;
660
+ /** A `SetupCard`'s step with its name: «Step 1 of 2 · Connect Slack». */
661
+ where: string;
652
662
  /** Read by the live region on every move: `{position}` is the line above, `{title}`
653
663
  * the step's. */
654
664
  announce: string;
@@ -54,6 +54,7 @@ export const ENGLISH_COPY = {
54
54
  unsaved: "unsaved",
55
55
  unsavedOne: "1 change unsaved",
56
56
  unsavedMany: "{count} changes unsaved",
57
+ unsavedAny: "Unsaved changes",
57
58
  save: "Save",
58
59
  saving: "Saving…",
59
60
  saved: "Saved",
@@ -208,6 +209,9 @@ export const ENGLISH_COPY = {
208
209
  pileMore: "Show {count} more",
209
210
  pileMoreOf: "Show {count} more of {left}",
210
211
  pileShown: "Showing {shown} of {count}",
212
+ pilesMore: "Show {count} more groups",
213
+ pilesMoreOf: "Show {count} more groups of {left}",
214
+ pilesShown: "Showing {shown} of {count} groups",
211
215
  },
212
216
  menu: {
213
217
  empty: "Nothing matches.",
@@ -415,6 +419,7 @@ export const ENGLISH_COPY = {
415
419
  stepFlow: {
416
420
  steps: "Steps",
417
421
  position: "Step {index} of {total}",
422
+ where: "Step {index} of {total} · {label}",
418
423
  announce: "{position}: {title}",
419
424
  done: "done",
420
425
  pending: "to do",
@@ -53,8 +53,12 @@ export type ButtonProps = NativeProps<"button", "type" | "disabled" | "title" |
53
53
  * ignores presses until it is done.
54
54
  */
55
55
  busy?: boolean;
56
+ /** It throws work away — «Descartar» beside «Guardar». A `secondary` or `ghost` takes the
57
+ * soft red: the loss reads before the press without a second solid button. It is not a
58
+ * fifth role: the weight stays the role's, this only says what pressing it costs. */
59
+ destructive?: boolean;
56
60
  };
57
- export declare function Button({ children, role, size, surface: surfaceProp, icon: Icon, disabled, title, type, expanded, haspopup, busy, ref, onClick, ...native }: ButtonProps): import("react").JSX.Element;
61
+ export declare function Button({ children, role, size, surface: surfaceProp, icon: Icon, disabled, title, type, expanded, haspopup, busy, destructive, ref, onClick, ...native }: ButtonProps): import("react").JSX.Element;
58
62
  export type ButtonLinkProps = NativeProps<"a", "href" | "download" | "title"> & {
59
63
  children: ReactNode;
60
64
  href: string;
@@ -84,7 +84,7 @@ function popupAttrs(expanded, haspopup) {
84
84
  ...(expanded === undefined ? {} : { "aria-expanded": expanded }),
85
85
  };
86
86
  }
87
- export function Button({ children, role = "secondary", size = "md", surface: surfaceProp, icon: Icon, disabled = false, title, type = "button", expanded, haspopup, busy = false, ref, onClick, ...native }) {
87
+ export function Button({ children, role = "secondary", size = "md", surface: surfaceProp, icon: Icon, disabled = false, title, type = "button", expanded, haspopup, busy = false, destructive = false, ref, onClick, ...native }) {
88
88
  const surface = useSurface(surfaceProp);
89
89
  const ic = ICON[size];
90
90
  const Mark = busy ? LoaderCircle : Icon;
@@ -94,9 +94,9 @@ export function Button({ children, role = "secondary", size = "md", surface: sur
94
94
  return;
95
95
  }
96
96
  onClick?.(event);
97
- }, ...popupAttrs(expanded, haspopup), "data-ui": "button", "data-emphasis": role, "data-size": size, "data-surface": surface, className: busy
98
- ? `${buttonClasses(role, size, surface)} cursor-progress`
99
- : 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] }));
97
+ }, ...popupAttrs(expanded, haspopup), "data-ui": "button", "data-emphasis": role, "data-size": size, "data-surface": surface, ...(destructive ? { "data-destructive": true } : {}), className: busy
98
+ ? `${buttonClasses(role, size, surface, destructive)} cursor-progress`
99
+ : buttonClasses(role, size, surface, destructive), children: [Mark === undefined ? null : (_jsx(Mark, { className: `${ic.size} shrink-0 ${busy ? "motion-safe:animate-spin" : ""}`, strokeWidth: ic.stroke, "aria-hidden": true })), children] }));
100
100
  }
101
101
  /**
102
102
  * The same button, but it is a real link.
@@ -11,11 +11,4 @@ import type { Surface } from "../../foundations/types.js";
11
11
  */
12
12
  export type ButtonRole = "primary" | "secondary" | "ghost" | "danger";
13
13
  export type ButtonSize = "sm" | "md" | "lg";
14
- /** The look of a button, without the button.
15
- *
16
- * Context: it exists because there are things that LOOK like a button and are
17
- * not — a menu trigger is the case. Without this, each one copies the classes
18
- * and by the third copy they no longer match: that is exactly what happened
19
- * with «+ Crear», which was the only primary button in the product with a
20
- * different height. */
21
- export declare function buttonClasses(role?: ButtonRole, size?: ButtonSize, surface?: Surface): string;
14
+ export declare function buttonClasses(role?: ButtonRole, size?: ButtonSize, surface?: Surface, destructive?: boolean): string;
@@ -60,6 +60,16 @@ const ROLE = {
60
60
  * and by the third copy they no longer match: that is exactly what happened
61
61
  * with «+ Crear», which was the only primary button in the product with a
62
62
  * different height. */
63
- export function buttonClasses(role = "secondary", size = "md", surface = "canvas") {
64
- 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]}`;
63
+ /* A quiet role that throws work away: «Descartar» beside «Guardar». Soft red, so the loss
64
+ reads before the press, and still under the gold — it is not the screen's last word, and
65
+ it is not `danger`, which is solid and cannot be undone. */
66
+ const LOSES = {
67
+ canvas: "border border-transparent bg-bad/8 text-bad hover:bg-bad/14",
68
+ chrome: "border border-transparent bg-chrome-bad/12 text-chrome-bad hover:bg-chrome-bad/20",
69
+ };
70
+ export function buttonClasses(role = "secondary", size = "md", surface = "canvas", destructive = false) {
71
+ const look = destructive && (role === "secondary" || role === "ghost")
72
+ ? LOSES[surface]
73
+ : ROLE[role][surface];
74
+ 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]} ${look}`;
65
75
  }
@@ -38,6 +38,11 @@ export interface MenuOption {
38
38
  /** It destroys or undoes — «Anular», «Eliminar»: the label and its icon in the danger tone,
39
39
  * so it is read before it is pressed. Put such options in a group of their own, last. */
40
40
  danger?: boolean;
41
+ /** A real link: the row is an `<a>` — a new tab with the middle button or ⌘, the
42
+ * application's router (React Aria's `RouterProvider`), «copy link». «Ver el sitio». */
43
+ href?: string;
44
+ /** With `href`, where it opens: `_blank` for another tab (`rel="noreferrer"` is added). */
45
+ target?: "_blank";
41
46
  /** The option opens a SUBMENU with these options instead of running. Its own `onSelect`
42
47
  * and `checked` are ignored — a row that opens something does not also do something.
43
48
  * Children may carry `items` too, but a third level is usually a dialog in disguise. */
@@ -64,6 +69,12 @@ export interface MenuGroup {
64
69
  * would hide what the search finds.
65
70
  */
66
71
  collapsible?: boolean;
72
+ /**
73
+ * The options in ONE row beside the label, as icon toggles: «Tema ☀ ☾ 🖥». For a short
74
+ * choice of three that reads faster as marks than as three rows — the theme in an account
75
+ * menu. Each option needs its `icon`; its `label` names it (title and accessible name).
76
+ */
77
+ inline?: boolean;
67
78
  options: MenuOption[];
68
79
  }
69
80
  declare const WIDTH: {
@@ -79,7 +90,7 @@ export { menuTriggerClasses };
79
90
  export declare function Menu({ label, groups, onSelect, surface, align, icon: Trigger,
80
91
  /** The menu as a control of a list ("filters ▾") carries the chevron; the
81
92
  * actions `⋯` does not, because the icon already says there is more. */
82
- chevron, active, iconOnly, variant, searchPlaceholder, emptyText, width, role, size, title, closeOnSelect, count, current, layout, }: {
93
+ chevron, active, iconOnly, variant, searchPlaceholder, emptyText, width, role, size, title, closeOnSelect, count, current, layout, header, trigger, placement, }: {
83
94
  label: string;
84
95
  groups: readonly MenuGroup[];
85
96
  onSelect?: (id: string) => void;
@@ -130,6 +141,16 @@ chevron, active, iconOnly, variant, searchPlaceholder, emptyText, width, role, s
130
141
  /** `columns` lays the sections side by side: a big menu of an application bar, seen
131
142
  * whole. Stacked on a phone. */
132
143
  layout?: "list" | "columns";
144
+ /** Above the options, not one of them: who the account menu belongs to — the avatar, the
145
+ * name, the organization. Read, not pressed. */
146
+ header?: ReactNode;
147
+ /** The trigger's content in place of the icon and the label — a whole row («(AG) Ana
148
+ * Gutiérrez · Admin ⌃⌄») that opens the menu. It names the button by what it shows;
149
+ * `label` names the panel. */
150
+ trigger?: ReactNode;
151
+ /** Where the panel opens. Below by default (`align` picks the side); a trigger at the
152
+ * bottom of the window — the account at the foot of a sidebar — opens it above. */
153
+ placement?: "bottom start" | "bottom end" | "top start" | "top end";
133
154
  }): import("react").JSX.Element;
134
155
  /**
135
156
  * The panel of a `Menu`: its groups and rows, and the submenus hanging from them. Internal —