@sincpro/web-ui 2.20.0 → 2.22.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 CHANGED
@@ -84,6 +84,8 @@ the tokens once — fonts, theme and Tailwind come with it:
84
84
  import { Field, installCopy, SPANISH_COPY, TextInput } from "@sincpro/web-ui";
85
85
 
86
86
  installCopy(SPANISH_COPY); // optional: the interface in Spanish — once, where the app starts
87
+ // SPANISH_COPY is written in vos («Elegí»); SPANISH_COPY_TU in tú («Elige»). Choose one, the
88
+ // same voice as the framework's and the composer's tables.
87
89
 
88
90
  export function CompanyName({
89
91
  value,
@@ -374,7 +376,7 @@ The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`
374
376
  `sidebar.user`, `sidebar.me` (the person at the foot, `account="menu"`), `sidebar.search`,
375
377
  `sidebar.nav`, `sidebar.account`, `navigation`, `navigation.item`, `menu.header`, `tabs` (with
376
378
  `data-look`), `tabs.tab`, `dirty.blocked`, `dirty.bar`, `field`, `field.label`, `form.section`,
377
- `form.card`, `form.index`, `dock`, `dock.pill`, `dock.bare`, `dock.message` (with `data-tone`),
379
+ `form.card`, `form.index`, `dock`, `dock.pill`, `dock.bare`, `dock.message` (with `data-tone`), `dock.sentence` (a button with the whole of it in a tooltip, when cut), `dock.text`, `dock.detail`,
378
380
  `setup`, `setup.step`, `setup.reason`, `setup.preview`, `page`, `pager`, `pagination`, `smart`, `guide`, `guide.veil`, `guide.spot`, `guide.card`,
379
381
  `guide.progress`, `guide.title`, `guide.body`, `guide.actions`. A part that is one of many
380
382
  carries `data-key` too (`navigation.item`). Put your rules in a cascade layer above web-ui's, or
@@ -20,6 +20,11 @@ export type LineItemColumn<T> = Pick<DataColumn<T>, "id" | "header" | "value" |
20
20
  * with `structure`; without it the section says nothing in this column. */
21
21
  subtotal?: (lines: readonly T[]) => ReactNode;
22
22
  };
23
+ /** Another way to add lines, beside «Agregar una línea»: its words, and what starts it. */
24
+ export type LineAdd = {
25
+ label: string;
26
+ onAdd: () => void;
27
+ };
23
28
  /** Which lines are sections or notes, and how their text is read and written. See
24
29
  * «Sections and notes» in the file's header. */
25
30
  export type LineStructure<T> = {
@@ -57,6 +62,13 @@ export type LineItemsProps<T> = {
57
62
  /** The blank line «Agregar una línea» starts from. Required for adding. It carries its
58
63
  * local key from here — `{ key: crypto.randomUUID(), … }` — since it has no server id. */
59
64
  newLine?: () => T;
65
+ /**
66
+ * Other ways to add, beside «Agregar una línea» and quieter than it: several at once («Agregar
67
+ * varios…», one line per record chosen), from a catalog. Each starts its own flow; the lines it
68
+ * makes arrive in `lines` as any other. In place they sit in the table's add row, beside a
69
+ * section and a note; with the dialog, beside the add button. None in `read`.
70
+ */
71
+ moreAdds?: readonly LineAdd[];
60
72
  /** A line was removed. It is gone at once; the notice offers to undo it. */
61
73
  onRemove?: (id: string) => void;
62
74
  /** Put a removed line back where it was. Without it the notice has no «Deshacer». */
@@ -122,4 +134,4 @@ export type LineItemsProps<T> = {
122
134
  * removing asked first, what an empty document said. One component, built on
123
135
  * `EditableTable` and `Dialog`, makes the one2many the same block everywhere.
124
136
  */
125
- export declare function LineItems<T>({ lines, columns, getLineId, lineLabel, mode, onChange, onAdd, newLine, onRemove, onRestore, editor, isValid, context, searchText, searchFrom, totals, layout, adding, onOpenLine, flag, cellState, rowState, structure, onReorder, visibleColumnIds, onVisibleColumnIdsChange, }: LineItemsProps<T>): import("react").JSX.Element;
137
+ export declare function LineItems<T>({ lines, columns, getLineId, lineLabel, mode, onChange, onAdd, newLine, moreAdds, onRemove, onRestore, editor, isValid, context, searchText, searchFrom, totals, layout, adding, onOpenLine, flag, cellState, rowState, structure, onReorder, visibleColumnIds, onVisibleColumnIdsChange, }: LineItemsProps<T>): import("react").JSX.Element;
@@ -38,7 +38,7 @@ function plain(v) {
38
38
  * removing asked first, what an empty document said. One component, built on
39
39
  * `EditableTable` and `Dialog`, makes the one2many the same block everywhere.
40
40
  */
41
- export function LineItems({ lines, columns, getLineId, lineLabel, mode, onChange, onAdd, newLine, onRemove, onRestore, editor, isValid, context, searchText, searchFrom = 8, totals, layout = "auto", adding, onOpenLine, flag, cellState, rowState, structure, onReorder, visibleColumnIds, onVisibleColumnIdsChange, }) {
41
+ export function LineItems({ lines, columns, getLineId, lineLabel, mode, onChange, onAdd, newLine, moreAdds, onRemove, onRestore, editor, isValid, context, searchText, searchFrom = 8, totals, layout = "auto", adding, onOpenLine, flag, cellState, rowState, structure, onReorder, visibleColumnIds, onVisibleColumnIdsChange, }) {
42
42
  const copy = useUiCopy();
43
43
  const toast = useOptionalToast();
44
44
  const read = useFormMode(mode) === "read";
@@ -185,6 +185,20 @@ export function LineItems({ lines, columns, getLineId, lineLabel, mode, onChange
185
185
  : [{ label: copy.lines.addNote, onAdd: () => addInline(structure.newNote) }]),
186
186
  ];
187
187
  const inPlace = inline || bandAdds.length > 0;
188
+ /* The other ways to add: in the table's add row in place, beside the button otherwise. Each
189
+ clears the search first, as adding a line does — what it adds would land out of sight —, and
190
+ answers nothing: its lines arrive through `lines`, never as the table's new draft row (which
191
+ the table would take back, with no «Deshacer», if left untouched). */
192
+ const others = read
193
+ ? []
194
+ : (moreAdds ?? []).map((other) => ({
195
+ label: other.label,
196
+ onAdd: () => {
197
+ setQuery("");
198
+ other.onAdd();
199
+ },
200
+ }));
201
+ const tableAdds = inline ? [...bandAdds, ...others] : bandAdds;
188
202
  const bands = structure === undefined
189
203
  ? undefined
190
204
  : {
@@ -271,7 +285,7 @@ export function LineItems({ lines, columns, getLineId, lineLabel, mode, onChange
271
285
  });
272
286
  }
273
287
  /* In place, «add» is the table's own row under the grid: where the line will appear. */
274
- const addButton = canAdd && !inline ? (_jsx(Button, { role: "secondary", size: "sm", icon: Plus, onClick: add, "data-line-add": "", children: copy.lines.add })) : null;
288
+ const addButton = canAdd && !inline ? (_jsxs("span", { className: "flex items-center gap-2", children: [others.map((other) => (_jsx(Button, { role: "ghost", size: "sm", onClick: other.onAdd, children: other.label }, other.label))), _jsx(Button, { role: "secondary", size: "sm", icon: Plus, onClick: add, "data-line-add": "", children: copy.lines.add })] })) : null;
275
289
  const count = q === ""
276
290
  ? fillCopy(lineCount === 1 ? copy.lineItems.one : copy.lineItems.many, {
277
291
  count: lineCount.toLocaleString(copy.locale),
@@ -293,7 +307,7 @@ export function LineItems({ lines, columns, getLineId, lineLabel, mode, onChange
293
307
  invalid: false,
294
308
  }, children: _jsx(SearchField, { value: query, onChange: setQuery, placeholder: copy.lines.search }) })] })) : null, _jsx("span", { className: "text-meta text-muted tabular-nums", "aria-live": "polite", children: count }), columnControl.hasOptional || addButton !== null ? (_jsxs("span", { className: "ml-auto flex items-center gap-2", children: [_jsx(ColumnsMenu, { control: columnControl }), addButton] })) : null] }), _jsx(EditableTable, { rows: shown, columns: tableColumns, getRowId: getLineId, empty: lines.length === 0
295
309
  ? copy.lines.empty
296
- : fillCopy(copy.lineItems.noMatch, { query: query.trim() }), layout: layout, ...(inline ? { onAdd: () => addInline(), addLabel: copy.lines.add } : {}), ...(bandAdds.length === 0 ? {} : { adds: bandAdds }), ...(bands === undefined ? {} : { bands }), ...(flag === undefined ? {} : { flag }), ...(cellState === undefined ? {} : { cellState }), ...(rowState === undefined ? {} : { rowState }), ...(onReorder === undefined || read ? {} : { onReorder }), ...(inPlace && onRemove !== undefined
310
+ : fillCopy(copy.lineItems.noMatch, { query: query.trim() }), layout: layout, ...(inline ? { onAdd: () => addInline(), addLabel: copy.lines.add } : {}), ...(tableAdds.length === 0 ? {} : { adds: tableAdds }), ...(bands === undefined ? {} : { bands }), ...(flag === undefined ? {} : { flag }), ...(cellState === undefined ? {} : { cellState }), ...(rowState === undefined ? {} : { rowState }), ...(onReorder === undefined || read ? {} : { onReorder }), ...(inPlace && onRemove !== undefined
297
311
  ? /* A blank row nobody wrote in is taken back without a notice: nobody
298
312
  removed anything, so there is nothing to undo. */
299
313
  { onDiscard: onRemove }
@@ -1 +1 @@
1
- export { type LineEditorState, type LineItemColumn, LineItems, type LineItemsProps, } from "./LineItems.js";
1
+ export { type LineAdd, type LineEditorState, type LineItemColumn, LineItems, type LineItemsProps, } from "./LineItems.js";
@@ -9,7 +9,9 @@ import type { DockMoment } from "./dock.js";
9
9
  * The visible part is keyed by its text: a new sentence enters with a short rise, so dirty → saved → the record's state reads as one place
10
10
  * changing, not as a pill rebuilt. The global reduced-motion rule flattens it.
11
11
  *
12
- * It gives way first: one row on a phone too, the sentence truncates and the buttons stay.
12
+ * It gives way first: one row on a phone too, the sentence truncates and the buttons stay —
13
+ * and, cut, it is still read whole: its text and help in a `Tooltip`, on hover and on keyboard
14
+ * focus (`Entero`). Nothing cut, nothing added: no tooltip, no extra Tab stop.
13
15
  */
14
16
  export declare function DockMessage({ moment, detailId, }: {
15
17
  moment: DockMoment | undefined;
@@ -1,7 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useSurface } from "../../foundations/surface.js";
4
+ import { Tooltip, TooltipTrigger } from "../../primitives/overlay/Tooltip.js";
4
5
  import { DOT_TONE } from "../../primitives/tag/Tag.js";
6
+ import { useLayoutEffect, useState } from "react";
5
7
  /* The mark in each tone when it is an icon; the dot is `Tag`'s own (`DOT_TONE`). */
6
8
  const INK = {
7
9
  neutral: { canvas: "text-muted", chrome: "text-chrome-muted" },
@@ -21,11 +23,42 @@ const INK = {
21
23
  * The visible part is keyed by its text: a new sentence enters with a short rise, so dirty → saved → the record's state reads as one place
22
24
  * changing, not as a pill rebuilt. The global reduced-motion rule flattens it.
23
25
  *
24
- * It gives way first: one row on a phone too, the sentence truncates and the buttons stay.
26
+ * It gives way first: one row on a phone too, the sentence truncates and the buttons stay —
27
+ * and, cut, it is still read whole: its text and help in a `Tooltip`, on hover and on keyboard
28
+ * focus (`Entero`). Nothing cut, nothing added: no tooltip, no extra Tab stop.
25
29
  */
26
30
  export function DockMessage({ moment, detailId, }) {
27
31
  const surface = useSurface() === "chrome" ? "chrome" : "canvas";
28
32
  const tone = moment?.tone ?? "neutral";
29
33
  const Icon = moment?.icon;
30
- return (_jsx(_Fragment, { children: moment === undefined ? null : (_jsxs("span", { "data-ui": "dock.message", "data-tone": tone, className: "flex min-w-0 shrink! items-center gap-2 px-2.5 transition-[opacity,translate] duration-(--duration-quick) ease-(--ease-out) starting:translate-y-0.5 starting:opacity-0", children: [Icon === undefined ? (_jsxs("span", { "aria-hidden": true, className: "relative flex size-1.5 shrink-0", children: [moment.busy === true ? (_jsx("span", { className: `absolute inline-flex size-full animate-ping rounded-pill opacity-70 ${DOT_TONE[tone][surface]}` })) : null, _jsx("span", { className: `relative inline-flex size-1.5 rounded-pill ${DOT_TONE[tone][surface]}` })] })) : (_jsx(Icon, { "aria-hidden": true, strokeWidth: 2.25, className: `size-(--size-icon-sm) shrink-0 ${INK[tone][surface]}` })), _jsxs("span", { className: "flex min-w-0 flex-col leading-tight", children: [_jsx("span", { className: `truncate text-meta font-medium ${surface === "chrome" ? "text-chrome-ink" : "text-ink"}`, children: moment.text }), moment.detail === undefined ? null : (_jsx("span", { ...(detailId === undefined ? {} : { id: detailId }), className: `truncate text-micro ${surface === "chrome" ? "text-chrome-muted" : "text-muted"}`, children: moment.detail }))] })] }, moment.text)) }));
34
+ return (_jsx(_Fragment, { children: moment === undefined ? null : (_jsxs("span", { "data-ui": "dock.message", "data-tone": tone, className: "flex min-w-0 shrink! items-center gap-2 px-2.5 transition-[opacity,translate] duration-(--duration-quick) ease-(--ease-out) starting:translate-y-0.5 starting:opacity-0", children: [Icon === undefined ? (_jsxs("span", { "aria-hidden": true, className: "relative flex size-1.5 shrink-0", children: [moment.busy === true ? (_jsx("span", { className: `absolute inline-flex size-full animate-ping rounded-pill opacity-70 ${DOT_TONE[tone][surface]}` })) : null, _jsx("span", { className: `relative inline-flex size-1.5 rounded-pill ${DOT_TONE[tone][surface]}` })] })) : (_jsx(Icon, { "aria-hidden": true, strokeWidth: 2.25, className: `size-(--size-icon-sm) shrink-0 ${INK[tone][surface]}` })), _jsxs(Entero, { text: moment.text, detail: moment.detail, children: [_jsx("span", { "data-ui": "dock.text", className: `truncate text-meta font-medium ${surface === "chrome" ? "text-chrome-ink" : "text-ink"}`, children: moment.text }), moment.detail === undefined ? null : (_jsx("span", { ...(detailId === undefined ? {} : { id: detailId }), "data-ui": "dock.detail", className: `truncate text-micro ${surface === "chrome" ? "text-chrome-muted" : "text-muted"}`, children: moment.detail }))] })] }, moment.text)) }));
35
+ }
36
+ /**
37
+ * The sentence and its help, and — only when one of them is cut — the whole of both in a
38
+ * `Tooltip`. Measured after layout and again on every resize: a pill that widens shows it all
39
+ * and drops the tooltip; one that narrows takes it.
40
+ *
41
+ * Context: cut, the block is a button — a tooltip's trigger must take focus and have a role —
42
+ * that shows it on hover and on keyboard focus, and pins it on a press: the pill is cut mostly
43
+ * on a phone, where nothing hovers. Not cut, it is plain text: no extra Tab stop.
44
+ */
45
+ function Entero({ text, detail, children, }) {
46
+ // The node by state, not by a ref object: becoming a button mounts a new one, and the
47
+ // measuring has to follow it.
48
+ const [nodo, setNodo] = useState(null);
49
+ const [cortado, setCortado] = useState(false);
50
+ const [abierto, setAbierto] = useState(false);
51
+ useLayoutEffect(() => {
52
+ if (nodo === null)
53
+ return;
54
+ const medir = () => setCortado([...nodo.children].some((linea) => linea.scrollWidth > linea.clientWidth));
55
+ medir();
56
+ const observador = new ResizeObserver(medir);
57
+ observador.observe(nodo);
58
+ return () => observador.disconnect();
59
+ }, [nodo, text, detail]);
60
+ const clase = "flex min-w-0 flex-col leading-tight";
61
+ if (!cortado)
62
+ return (_jsx("span", { ref: setNodo, "data-ui": "dock.sentence", className: clase, children: children }));
63
+ return (_jsxs(TooltipTrigger, { open: abierto, onOpenChange: setAbierto, closeOnPress: false, children: [_jsx("button", { ref: setNodo, type: "button", "data-ui": "dock.sentence", onClick: () => setAbierto((ahora) => !ahora), className: `${clase} cursor-default rounded-control text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`, children: children }), _jsxs(Tooltip, { children: [_jsx("span", { className: "block font-medium", children: text }), detail === undefined ? null : _jsx("span", { className: "mt-0.5 block", children: detail })] })] }));
31
64
  }
@@ -1,2 +1,12 @@
1
1
  import type { UiCopyOverride } from "./uiCopy.js";
2
2
  export declare const SPANISH_COPY: UiCopyOverride;
3
+ /**
4
+ * The same Spanish, in tú — what most of the region writes (Bolivia, Perú, México, Colombia…);
5
+ * `SPANISH_COPY` is in vos, as Argentina and Uruguay write. An application chooses once, with
6
+ * the framework's and the composer's tables in the same voice: three voices on one screen read
7
+ * as three authors.
8
+ *
9
+ * Only what is said TO the person changes — «Elegí» / «Elige», «podés» / «puedes» —; every other
10
+ * word is the vos table's. A new sentence that tells the person to do something goes in both.
11
+ */
12
+ export declare const SPANISH_COPY_TU: UiCopyOverride;
@@ -1,3 +1,4 @@
1
+ import { mergeCopyOver } from "./copyStore.js";
1
2
  /* ==================================================================== *
2
3
  * EL CASTELLANO DEL SISTEMA.
3
4
  *
@@ -882,3 +883,55 @@ export const SPANISH_COPY = {
882
883
  signature: "Firma",
883
884
  },
884
885
  };
886
+ /**
887
+ * The same Spanish, in tú — what most of the region writes (Bolivia, Perú, México, Colombia…);
888
+ * `SPANISH_COPY` is in vos, as Argentina and Uruguay write. An application chooses once, with
889
+ * the framework's and the composer's tables in the same voice: three voices on one screen read
890
+ * as three authors.
891
+ *
892
+ * Only what is said TO the person changes — «Elegí» / «Elige», «podés» / «puedes» —; every other
893
+ * word is the vos table's. A new sentence that tells the person to do something goes in both.
894
+ */
895
+ export const SPANISH_COPY_TU = mergeCopyOver(SPANISH_COPY, {
896
+ field: {
897
+ drop: "Suelta un archivo acá, o elige uno.",
898
+ dropMany: "Suelta archivos acá, o elígelos.",
899
+ tryAnother: "Prueba con otro",
900
+ },
901
+ search: { typeValue: "escribe el valor", askAttribute: "elige un atributo" },
902
+ activity: { messagePlaceholder: "Escribe un mensaje…" },
903
+ richText: {
904
+ badLink: "Escribe una web (empresa.bo), un correo o un teléfono.",
905
+ badVideo: "Pega el enlace de un video de {providers}.",
906
+ },
907
+ editable: { reorderHint: "Arrástrala, o Alt + ↑ / ↓" },
908
+ picker: { placeholder: "elige uno…", refine: "— afina el filtro" },
909
+ chart: { pieNegative: "Una torta no puede mostrar valores negativos: prueba con barras." },
910
+ board: { moveHint: "Arrástrala, o Alt + ← / → para pasarla a otra etapa" },
911
+ kiosk: { start: "Toca para empezar" },
912
+ timeline: {
913
+ moveHint: "Arrástrala para moverla, su borde derecho para estirarla; Alt + flechas con el teclado",
914
+ },
915
+ attachments: {
916
+ emptyAdd: "Todavía no hay archivos adjuntos. Suéltalos acá o elígelos.",
917
+ add: "Suelta más archivos acá o elígelos.",
918
+ },
919
+ fieldPath: {
920
+ failedHint: "Prueba de nuevo en un momento, o copia el error para quien mantiene el modelo.",
921
+ },
922
+ preview: {
923
+ unsupported: "No hay vista previa para este tipo de archivo. Igual lo puedes descargar.",
924
+ officeSentence: "Se ve mejor en su programa. Ábrelo o descárgalo.",
925
+ },
926
+ chat: {
927
+ empty: "Todavía no hay mensajes. Escribe el primero.",
928
+ placeholder: "Escribe un mensaje… Enter lo envía, Shift+Enter hace otro renglón",
929
+ },
930
+ assist: { noneChosen: "Elige al menos un cambio." },
931
+ media: {
932
+ dropImage: "Suelta una imagen acá, pégala o elígela.",
933
+ notImage: "El archivo no es una imagen. Elige un PNG, JPG o WebP.",
934
+ cropHelp: "Arrastra la imagen o muévela con las flechas; + y − acercan y alejan.",
935
+ signatureHelp: "Firma con el mouse o con el dedo sobre la línea.",
936
+ },
937
+ });
@@ -17,7 +17,7 @@ export { applyTheme, ThemeProvider, type ThemeProviderProps, useTheme, } from ".
17
17
  export { isTheme, type ResolvedTheme, resolveTheme, type Theme, THEME_ATTRIBUTE, THEMES, } from "./themeChoice.js";
18
18
  export type { Density, OpenTarget, Size, Surface, Tone, } from "./types.js";
19
19
  /** The system's Spanish, for whoever wants to install it whole. */
20
- export { SPANISH_COPY } from "./copy.es.js";
20
+ export { SPANISH_COPY, SPANISH_COPY_TU } 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
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, type PilePage, pilePage, pilesFoot, pilesFrom, pilesOf, type PilesPaging, } from "./grouping.js";
@@ -34,7 +34,7 @@ export { SurfaceProvider, useSurface } from "./surface.js";
34
34
  export { applyTheme, ThemeProvider, useTheme, } from "./theme.js";
35
35
  export { isTheme, resolveTheme, THEME_ATTRIBUTE, THEMES, } from "./themeChoice.js";
36
36
  /** The system's Spanish, for whoever wants to install it whole. */
37
- export { SPANISH_COPY } from "./copy.es.js";
37
+ export { SPANISH_COPY, SPANISH_COPY_TU } from "./copy.es.js";
38
38
  /* THE SLOTS — how an archetype is written as a TREE. It lives here and not inside
39
39
  one because all of them speak it: while it was hidden in
40
40
  `Record.tsx`, being a tree was a privilege of records. */
@@ -27,7 +27,7 @@ export declare function useInTooltipTrigger(): boolean;
27
27
  * with the system's own buttons — they forward `ref` and spread native props — or with a
28
28
  * plain `<button>`, and never has to know the adapter exists.
29
29
  */
30
- export declare function TooltipTrigger({ children, delay, closeDelay, disabled, }: {
30
+ export declare function TooltipTrigger({ children, delay, closeDelay, disabled, open, onOpenChange, closeOnPress, }: {
31
31
  /** The control — one element that forwards `ref` and spreads native props, like every
32
32
  * system button — then the `Tooltip`. */
33
33
  children: ReactNode;
@@ -35,4 +35,11 @@ export declare function TooltipTrigger({ children, delay, closeDelay, disabled,
35
35
  delay?: number;
36
36
  closeDelay?: number;
37
37
  disabled?: boolean;
38
+ /** Open by the consumer — a tooltip a press pins, for a screen with no pointer to hover —,
39
+ * told every change by `onOpenChange`. Absent, React Aria decides. */
40
+ open?: boolean;
41
+ onOpenChange?: (open: boolean) => void;
42
+ /** Pressing the control closes the tooltip (on by default): off when the press is what
43
+ * opens it. */
44
+ closeOnPress?: boolean;
38
45
  }): import("react").JSX.Element;
@@ -68,7 +68,7 @@ function isDisabledControl(control) {
68
68
  * with the system's own buttons — they forward `ref` and spread native props — or with a
69
69
  * plain `<button>`, and never has to know the adapter exists.
70
70
  */
71
- export function TooltipTrigger({ children, delay, closeDelay, disabled = false, }) {
71
+ export function TooltipTrigger({ children, delay, closeDelay, disabled = false, open, onOpenChange, closeOnPress = true, }) {
72
72
  const [control, ...tooltip] = Children.toArray(children);
73
- return (_jsxs(AriaTooltipTrigger, { delay: delay, closeDelay: closeDelay, isDisabled: disabled, children: [_jsx(InTooltipTrigger.Provider, { value: true, children: _jsx(Focusable, { isDisabled: isDisabledControl(control), children: control }) }), tooltip] }));
73
+ return (_jsxs(AriaTooltipTrigger, { delay: delay, closeDelay: closeDelay, isDisabled: disabled, shouldCloseOnPress: closeOnPress, ...(open === undefined ? {} : { isOpen: open }), ...(onOpenChange === undefined ? {} : { onOpenChange }), children: [_jsx(InTooltipTrigger.Provider, { value: true, children: _jsx(Focusable, { isDisabled: isDisabledControl(control), children: control }) }), tooltip] }));
74
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sincpro/web-ui",
3
- "version": "2.20.0",
3
+ "version": "2.22.0",
4
4
  "description": "An enterprise web design system for business software — ERPs, back offices, management tools — in React and Tailwind: tokens, primitives, components and the two views every management screen is made of.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",