@tangible/ui 0.2.25 → 0.2.27

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.
@@ -0,0 +1,28 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo, useState } from 'react';
3
+ import { createHoverWarmth } from '../../utils/hover-intent.js';
4
+ import { useTooltipProviderContext, TooltipProviderContext } from './TooltipContext.js';
5
+ /**
6
+ * @internal Gives the tooltips inside a warmth group. Toolbar wraps its
7
+ * items in this, so toolbar tooltips warm up with no setup.
8
+ *
9
+ * Under an outer TooltipProvider it changes nothing: that provider's group
10
+ * and delays apply. Without one, it supplies the provider's defaults too, not
11
+ * the bare-tooltip fallback, whose 0ms close delay would make a toolbar's
12
+ * tooltips close before the pointer can cross into them (WCAG 1.4.13).
13
+ */
14
+ export function TooltipWarmthScope({ children }) {
15
+ const outer = useTooltipProviderContext();
16
+ const [warmth] = useState(createHoverWarmth);
17
+ const [activeClose] = useState(() => ({ current: null }));
18
+ const value = useMemo(() => ({
19
+ delayDuration: outer.delayDuration,
20
+ closeDelayDuration: 150,
21
+ skipDelayDuration: 300,
22
+ warmth,
23
+ activeClose,
24
+ }), [outer.delayDuration, warmth, activeClose]);
25
+ if (outer.warmth)
26
+ return _jsx(_Fragment, { children: children });
27
+ return _jsx(TooltipProviderContext.Provider, { value: value, children: children });
28
+ }
@@ -20,6 +20,16 @@ export type TooltipProviderProps = {
20
20
  * @default 150
21
21
  */
22
22
  closeDelayDuration?: number;
23
+ /**
24
+ * Warmth window in ms. Tooltips under one provider form a group: while one
25
+ * is showing, or for this long after it closes, the next opens at once
26
+ * instead of waiting out `delayDuration`. Gliding along a toolbar, each
27
+ * tooltip appears immediately, one at a time. Escape cools the group: a
28
+ * dismissed tooltip doesn't warm the next. Toolbar provides a group
29
+ * automatically.
30
+ * @default 300
31
+ */
32
+ skipDelayDuration?: number;
23
33
  children: React.ReactNode;
24
34
  };
25
35
  export type TooltipProps = {
@@ -105,6 +115,8 @@ export type TooltipContextValue = {
105
115
  handleClose: () => void;
106
116
  /** Cancel any pending close timeout (for WCAG 1.4.13 hover persistence). */
107
117
  cancelClose: () => void;
118
+ /** Close now as a dismissal (Escape): it doesn't warm the group. */
119
+ dismiss: () => void;
108
120
  };
109
121
  /**
110
122
  * Convert side + align to Floating UI placement.
@@ -78,7 +78,7 @@ export type { RadioGroupProps, RadioProps } from './Radio';
78
78
  export type { RatingProps } from './Rating';
79
79
  export type { SegmentedControlProps, SegmentedControlItemProps, SegmentedControlValue, SegmentedControlVariant, SegmentedControlSize, SegmentedControlOrientation, } from './SegmentedControl';
80
80
  export type { SidebarProps, SidebarHeaderProps, SidebarFooterProps, SidebarNavProps, SidebarToggleProps, SidebarToggleLabels, } from './Sidebar';
81
- export type { NavMenuProps, NavMenuOrientation, NavMenuLabels, NavMenuGroupProps, NavMenuGroupLabelElement, NavMenuItemProps, NavMenuItemAsLink, NavMenuItemAsButton, NavMenuItemAsChild, NavMenuCurrent, NavMenuSubProps, } from './NavMenu';
81
+ export type { NavMenuProps, NavMenuOrientation, NavMenuFlyoutTrigger, NavMenuLabels, NavMenuGroupProps, NavMenuGroupLabelElement, NavMenuItemProps, NavMenuItemAsLink, NavMenuItemAsButton, NavMenuItemAsChild, NavMenuCurrent, NavMenuSubProps, } from './NavMenu';
82
82
  export type { StepIndicatorProps, StepStatus } from './StepIndicator';
83
83
  export type { StepListProps, StepListItemProps } from './StepList';
84
84
  export type { DataTableProps } from './Table';
package/figma-tokens.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.25",
2
+ "version": "0.2.27",
3
3
  "source": "publish/styles/all.expanded.css",
4
4
  "prefix": "tui-",
5
5
  "note": "Layer 1 primitives only. Component API tokens (--tui-{component}-*) are never defined in CSS — they exist only as fallback reads — so they have no Figma representation. CONTRACT: consumers read TUI defaults from this file at build time (variables[].cssVar, the \"Light\"/\"Dark\" mode names, and alias chains into TUI/Primitives). Renaming a cssVar or a mode is a breaking change to those consumers even when the CSS value is unchanged — a rename silently becomes an undefined default downstream — so treat it as at least a minor bump and call it out in the CHANGELOG.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangible/ui",
3
- "version": "0.2.25",
3
+ "version": "0.2.27",
4
4
  "description": "Tangible Design System",
5
5
  "type": "module",
6
6
  "main": "./components/index.js",
@@ -258,6 +258,8 @@ the text defaults to the panel's own fg, which is tuned for TUI's default fills.
258
258
 
259
259
  **Fonts:** TUI inherits the host's font. If your page has none (you see the browser's serif), add `tui-font-sans` next to `tui-interface`, or set `--tui-font-family-base` anywhere. `--tui-font-family-sans` / `-mono` replace the stacks those utilities use.
260
260
 
261
+ **Tooltips warm up in groups:** wrap a set of tooltips in `TooltipProvider` (a `Toolbar` does it for you), and after the first shows, the rest appear at once while you move between them (`skipDelayDuration`, default 300ms). Don't hand-roll delay logic per tooltip.
262
+
261
263
  `className` is for layout integration (margin, grid placement), not appearance. Beyond the token
262
264
  API the sanctioned escape hatch is to **swizzle** — copy the component source and own the fork.
263
265
 
@@ -397,7 +399,7 @@ synthesise a second toggle. For a second control that toggles the same item (an
397
399
  ## Component names, and what isn't there
398
400
 
399
401
  46 components. If you are hunting for a name: **Alert → `Notice`**, **Menu → `Dropdown`**,
400
- **Table → `DataTable`**, **Pagination → `Pager`**, **Drawer → `Sidebar`** (drawer mode), **Nav menu / sidebar links / top nav bar → `NavMenu`** (inside `Sidebar.Nav` or your `<nav>`; `asChild` for router links, `current` for `aria-current`; `orientation="horizontal"` for a bar whose items open flyouts — don't hand-roll menus with `role="menu"` or hover-open),
402
+ **Table → `DataTable`**, **Pagination → `Pager`**, **Drawer → `Sidebar`** (drawer mode), **Nav menu / sidebar links / top nav bar → `NavMenu`** (inside `Sidebar.Nav` or your `<nav>`; `asChild` for router links, `current` for `aria-current`; `orientation="horizontal"` for a bar whose items open flyouts, `flyoutTrigger="hover"` to also open on mouse hover; `suffix` for a row badge/count — a `Chip`, with visually hidden context for bare numbers, never interactive; row states restyle via `--tui-nav-menu-item-*`, per level via `--tui-nav-menu-{sub,bar,flyout}-item-*` — set `bar-item-*` for a dark header so flyout rows keep the panel's colours; don't hand-roll menus with `role="menu"`),
401
403
  **Badge → `Chip`** or `ContentIndicator`, **Spinner → `Progress`** or `Button loading`,
402
404
  **ConfirmDialog / AlertDialog → `Modal role="alertdialog"`** (needs both `aria-labelledby` and
403
405
  `aria-describedby`; the backdrop stops dismissing by default, Escape still cancels; put the actions in