@tangible/ui 0.2.24 → 0.2.26
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/components/NavMenu/NavMenu.d.ts +9 -2
- package/components/NavMenu/NavMenu.js +296 -11
- package/components/NavMenu/index.d.ts +2 -1
- package/components/NavMenu/index.js +1 -0
- package/components/NavMenu/types.d.ts +44 -3
- package/components/NavMenu/types.js +3 -1
- package/components/Toolbar/Toolbar.js +2 -1
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +53 -7
- package/components/Tooltip/TooltipContext.d.ts +12 -0
- package/components/Tooltip/TooltipContext.js +3 -0
- package/components/Tooltip/TooltipWarmthScope.d.ts +13 -0
- package/components/Tooltip/TooltipWarmthScope.js +28 -0
- package/components/Tooltip/types.d.ts +12 -0
- package/components/index.d.ts +2 -2
- package/components/index.js +1 -1
- package/figma-tokens.json +1 -1
- package/package.json +1 -1
- package/skills/building-with-tui/SKILL.md +3 -1
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +113 -0
- package/styles/all.expanded.unlayered.css +113 -0
- package/styles/all.unlayered.css +1 -1
- package/styles/components/nav-menu.scss +173 -2
- package/tui-manifest.json +27 -3
- package/utils/hover-intent.d.ts +38 -0
- package/utils/hover-intent.js +67 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @internal Gives the tooltips inside a warmth group. Toolbar wraps its
|
|
4
|
+
* items in this, so toolbar tooltips warm up with no setup.
|
|
5
|
+
*
|
|
6
|
+
* Under an outer TooltipProvider it changes nothing: that provider's group
|
|
7
|
+
* and delays apply. Without one, it supplies the provider's defaults too, not
|
|
8
|
+
* the bare-tooltip fallback, whose 0ms close delay would make a toolbar's
|
|
9
|
+
* tooltips close before the pointer can cross into them (WCAG 1.4.13).
|
|
10
|
+
*/
|
|
11
|
+
export declare function TooltipWarmthScope({ children }: {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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.
|
package/components/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export { Rating } from './Rating';
|
|
|
33
33
|
export { SegmentedControl } from './SegmentedControl';
|
|
34
34
|
export { Slider } from './Slider';
|
|
35
35
|
export { Sidebar, defaultSidebarToggleLabels } from './Sidebar';
|
|
36
|
-
export { NavMenu } from './NavMenu';
|
|
36
|
+
export { NavMenu, defaultNavMenuLabels } from './NavMenu';
|
|
37
37
|
export { StepIndicator } from './StepIndicator';
|
|
38
38
|
export { StepList } from './StepList';
|
|
39
39
|
export { DataTable } from './Table';
|
|
@@ -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, 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/components/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export { Rating } from './Rating/index.js';
|
|
|
31
31
|
export { SegmentedControl } from './SegmentedControl/index.js';
|
|
32
32
|
export { Slider } from './Slider/index.js';
|
|
33
33
|
export { Sidebar, defaultSidebarToggleLabels } from './Sidebar/index.js';
|
|
34
|
-
export { NavMenu } from './NavMenu/index.js';
|
|
34
|
+
export { NavMenu, defaultNavMenuLabels } from './NavMenu/index.js';
|
|
35
35
|
export { StepIndicator } from './StepIndicator/index.js';
|
|
36
36
|
export { StepList } from './StepList/index.js';
|
|
37
37
|
export { DataTable } from './Table/index.js';
|
package/figma-tokens.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
2
|
+
"version": "0.2.26",
|
|
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
|
@@ -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 → `NavMenu`** (inside `Sidebar.Nav
|
|
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 — 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
|