@sesamehr/react-design-system 2.0.0-beta.20 → 2.0.0-beta.21
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,27 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Moves the selected pill over whichever tab is active.
|
|
4
|
+
*
|
|
5
|
+
* The selected state used to be a background on the trigger itself, which is
|
|
6
|
+
* why it could not travel: two elements cannot transition into one another. So
|
|
7
|
+
* the pill is a single element in the track, taken out of flow, and what moves
|
|
8
|
+
* is its geometry — published as custom properties on the track
|
|
9
|
+
* (`--toggle-tabs-pill-x/y/width/height`) for the stylesheet to spend.
|
|
10
|
+
*
|
|
11
|
+
* The handoff is the point. Nothing here decides how the pill is drawn: no
|
|
12
|
+
* `transform` string, no radius, no colour, no orientation branch. This writes
|
|
13
|
+
* four numbers and the component's own rule composes them, which keeps a
|
|
14
|
+
* measurement out of the stylesheet's job and the stylesheet's job out of here
|
|
15
|
+
* — and means the vertical orientation needs no code, only the `y` that is
|
|
16
|
+
* already being written.
|
|
17
|
+
*
|
|
18
|
+
* Both axes always, for that reason: `data-orientation="vertical"` turns the
|
|
19
|
+
* track into a column and the pill then travels down it, measured by exactly
|
|
20
|
+
* the same two rectangles.
|
|
21
|
+
*
|
|
22
|
+
* The whole of it runs off observers rather than off the render, which is what
|
|
23
|
+
* lets it be a single effect with no dependency on the active value: a tab
|
|
24
|
+
* changing, a tab arriving and a tab being resized are all DOM events by the
|
|
25
|
+
* time they matter here.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useToggleTabsPill(track: RefObject<HTMLElement | null>): void;
|