@jonmilner/ui 0.14.0 → 0.15.1

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 (78) hide show
  1. package/dist/Avatar/Avatar.css +2 -2
  2. package/dist/Avatar/Avatar.css.mjs +2 -2
  3. package/dist/Avatar/index.d.mts +2 -1
  4. package/dist/Avatar/index.mjs +29 -25
  5. package/dist/Avatar/tint.mjs +17 -0
  6. package/dist/Badge/Badge.css +1 -1
  7. package/dist/Box/Box.css +1 -1
  8. package/dist/Button/Button.css +1 -1
  9. package/dist/Checkbox/Checkbox.css +1 -1
  10. package/dist/Chip/Chip.css +1 -1
  11. package/dist/Clickable/Clickable.css +1 -1
  12. package/dist/ColorField/ColorField.css +1 -1
  13. package/dist/Combobox/Combobox.css +1 -1
  14. package/dist/Dialog/Dialog.css +1 -1
  15. package/dist/Field/Field.css +1 -1
  16. package/dist/Heading/Heading.css +1 -1
  17. package/dist/Icon/Icon.css +1 -1
  18. package/dist/IconButton/IconButton.css +1 -1
  19. package/dist/Inline/Inline.css +1 -1
  20. package/dist/Menu/Menu.css +1 -1
  21. package/dist/MultiSelect/MultiSelect.css +1 -1
  22. package/dist/NavList/NavList.css +2 -2
  23. package/dist/NavList/NavList.css.mjs +4 -2
  24. package/dist/NavList/client.mjs +36 -0
  25. package/dist/NavList/index.mjs +78 -57
  26. package/dist/RadioGroup/RadioGroup.css +1 -1
  27. package/dist/SearchField/SearchField.css +1 -1
  28. package/dist/Select/Select.css +1 -1
  29. package/dist/Sidebar/Sidebar.css +2 -2
  30. package/dist/SidebarLayout/SidebarLayout.css +2 -2
  31. package/dist/Stack/Stack.css +1 -1
  32. package/dist/Switch/Switch.css +1 -1
  33. package/dist/Table/Table.css +1 -1
  34. package/dist/Tabs/Tabs.css +1 -1
  35. package/dist/Tag/Tag.css +1 -1
  36. package/dist/Text/Text.css +2 -2
  37. package/dist/Text/Text.css.mjs +28 -26
  38. package/dist/Text/index.mjs +4 -4
  39. package/dist/TextField/TextField.css +1 -1
  40. package/dist/Textarea/Textarea.css +1 -1
  41. package/dist/Toast/Toast.css +1 -1
  42. package/dist/Tooltip/Tooltip.css +1 -1
  43. package/dist/Tooltip/base.d.mts +4 -0
  44. package/dist/Tooltip/base.mjs +38 -0
  45. package/dist/Tooltip/client.d.mts +0 -2
  46. package/dist/Tooltip/client.mjs +15 -77
  47. package/dist/Tooltip/index.d.mts +4 -8
  48. package/dist/Tooltip/index.mjs +12 -43
  49. package/dist/VisuallyHidden/VisuallyHidden.css +1 -1
  50. package/dist/base.css +3 -3
  51. package/dist/brands/default.mjs +3 -1
  52. package/dist/brands/font.d.mts +2 -0
  53. package/dist/brands/font.mjs +18 -18
  54. package/dist/docs/Avatar.md +19 -6
  55. package/dist/docs/Field.md +3 -3
  56. package/dist/docs/Heading.md +1 -1
  57. package/dist/docs/NavList.md +4 -4
  58. package/dist/docs/Sidebar.md +3 -3
  59. package/dist/docs/Table.md +2 -2
  60. package/dist/docs/Tabs.md +1 -1
  61. package/dist/docs/Text.md +3 -2
  62. package/dist/docs/llms.txt +1 -1
  63. package/dist/docs/manifest.json +43 -10
  64. package/dist/docs/migrations/0.15.0.md +94 -0
  65. package/dist/docs/theming.md +3 -1
  66. package/dist/index.d.mts +2 -1
  67. package/dist/popup/tooltip.d.mts +6 -0
  68. package/dist/popup/tooltip.mjs +81 -0
  69. package/dist/styles/atoms.css +1 -1
  70. package/dist/styles/custom-property.mjs +3 -0
  71. package/dist/styles/layers.css +1 -1
  72. package/dist/styles/responsive.css +1 -1
  73. package/dist/theme/define-theme.mjs +57 -51
  74. package/dist/tokens/contract.d.mts +4 -0
  75. package/dist/tokens/contract.mjs +3 -1
  76. package/dist/tokens/scales.d.mts +2 -0
  77. package/dist/tokens/scales.mjs +2 -0
  78. package/package.json +1 -1
@@ -2,12 +2,12 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Identifies a person, project or account by one or two letters in a circle, on a colour of the consumer's choosing or a neutral fill. A `span` with `role="img"`, named by `label`, around a `Text` in the `label` font. It is never focusable.
5
+ Identifies a person, project or account by one or two letters in a circle, tinted by a hue or filled with a colour of the consumer's choosing, or on a neutral fill. A `span` with `role="img"`, named by `label`, around a `Text` in the `label` font. It is never focusable.
6
6
 
7
7
  ## When to use
8
8
 
9
9
  - Beside a name in a list, row or header, where the letters help the eye find the person or project.
10
- - In place of a photo when there is none: the app has a name and, maybe, a colour for each person or project.
10
+ - In place of a photo when there is none: the app has a name and, maybe, a hue or colour for each person or project.
11
11
 
12
12
  ## When not to use
13
13
 
@@ -21,9 +21,10 @@ Identifies a person, project or account by one or two letters in a circle, on a
21
21
 
22
22
  - `initials`: one or two letters; the first two characters show. Upper-case them yourself ("JM", not "jm").
23
23
  - `label`: required, the accessible name: who or what the letters stand for ("Jon Milner"). There is no `title` tooltip: the name is never only in a tooltip, so show it in text nearby where sighted users need it.
24
- - `color`: a `#rrggbb` fill, the same in light and dark mode. The letters are black or white, whichever reads on it: black when the fill's relative luminance is above 0.18, where black and white tie at about 4.6:1. Unset, `null`, or anything that is not six-digit hex (`"red"`, `#fff`) takes the neutral fill: `fgMuted` on `bgMuted` with a `border` edge.
25
- - `size`: `sm` 20px, `med` (default) 28px, `lg` 40px. The letters are the `xs`, `sm` and `lg` `fontSize` steps. Two of the widest letters ("WW", "MW") can run past the `sm` circle's edge; most pairs fit.
26
- - The circle never shrinks in a flex row (`flexShrink` 0). Display (`inline-flex`), centering and radius (`full`) are default style props on the `span`; a consumer's win. `color` is the fill, so neither the text `color` nor the `backgroundColor` style prop is offered (nor `inlineSize` or `blockSize`: `size` sets the box), and a `backgroundColor` in `style` never replaces a `color` fill: the ink was picked for it. `className`, `style` and `ref` go to the `span`, `className` and `style` last.
24
+ - `hue`: an OKLCH hue in degrees (0 red, 150 green, 250 blue). The fill, letters and ring take it at fixed lightness and chroma, so every hue reads alike: in dark mode a deep fill (`oklch(0.3 0.07 h)`) under pale letters (`oklch(0.86 0.09 h)`), in light mode the two swapped, and the ring is the letters' colour at 45%. Every hue passes AA in both modes. Any finite number wraps into 0–360 (`-30` is `330`); `null`, `undefined` or `NaN` takes the neutral fill. Prefer `hue` for a new app: it follows the mode.
25
+ - `color`: a `#rrggbb` fill, the same in light and dark mode. The letters are black or white, whichever reads on it: black when the fill's relative luminance is above 0.18, where black and white tie at about 4.6:1. Unset, `null`, or anything that is not six-digit hex (`"red"`, `#fff`) takes the neutral fill: `fgMuted` on `bgMuted` with a `border` edge. Pass `hue` or `color`; with both, `hue` wins and `color` is ignored.
26
+ - `size`: `sm` 20px, `med` (default) 28px, `lg` 40px. The letters are semibold at 10px (2px under the `xs` step), the `sm` step and the `lg` step. At `sm` the two letters fit the 20px circle for most pairs ("AM", "JM"); only the widest ("MW", "WW") can touch its edge.
27
+ - The circle never shrinks in a flex row (`flexShrink` 0). Display (`inline-flex`), centering and radius (`full`) are default style props on the `span`; a consumer's win. `hue` or `color` is the fill, so neither the text `color` nor the `backgroundColor` style prop is offered (nor `inlineSize` or `blockSize`: `size` sets the box), and a `backgroundColor` or `background` in `style` never replaces a `hue` or `color` fill, which is set inline after it: the ink was picked for it. `className`, `style` and `ref` go to the `span`, `className` and `style` last.
27
28
  - The module has no hooks, so a server component can render it.
28
29
  - Migrating from the inbox's `Avatar`: `href` is gone (wrap it in `Clickable as="a"`), `title` is gone (show the name in text), and the circle is 20px at `sm`, not 22px.
29
30
 
@@ -36,6 +37,11 @@ Identifies a person, project or account by one or two letters in a circle, on a
36
37
  </Inline>
37
38
  ```
38
39
 
40
+ ```tsx
41
+ // One hue per person: the tint follows light and dark mode.
42
+ <Avatar hue={person.hue} initials="JM" label="Jon Milner" />
43
+ ```
44
+
39
45
  ```tsx
40
46
  // A linked avatar: the link takes its name from the avatar's label.
41
47
  <Clickable as="a" borderRadius="full" href="/people/jon">
@@ -50,6 +56,11 @@ Identifies a person, project or account by one or two letters in a circle, on a
50
56
  <Avatar initials="JM" label="JM" />
51
57
  ```
52
58
 
59
+ ```tsx
60
+ // One fill: with both, the hue wins and the colour is ignored.
61
+ <Avatar color="#0969da" hue={210} initials="JM" label="Jon Milner" />
62
+ ```
63
+
53
64
  ```tsx
54
65
  // An avatar is not a button; compose Clickable for anything pressable.
55
66
  <Avatar initials="JM" label="Jon Milner" onClick={openProfile} />
@@ -58,8 +69,9 @@ Identifies a person, project or account by one or two letters in a circle, on a
58
69
  ## Accessibility
59
70
 
60
71
  - `role="img"` with `aria-label`: screen readers read the label as one image ("Jon Milner, image") and skip the letters. Inside a `Clickable` link, the link takes the label as its name.
72
+ - Every hue passes AA (4.5:1) in both modes: a browser test samples every 5 degrees in light and dark.
61
73
  - Every fill passes AA (4.5:1): black or white letters, by WCAG relative luminance, read at 4.5:1 or more on any `#rrggbb`. The neutral fill is the `fgMuted` on `bgMuted` pair in `contrastPairs` (ADR 0033).
62
- - Under forced colors the fill goes and the transparent border turns `CanvasText`, so the circle stays; the letters are `CanvasText`.
74
+ - Under forced colors the fill goes and the border (transparent, or a hue's ring) turns `CanvasText`, so the circle stays; the letters are `CanvasText`.
63
75
 
64
76
  ## Props
65
77
 
@@ -70,6 +82,7 @@ Generated from the TypeScript types.
70
82
  | Prop | Type | Required | Description |
71
83
  | --- | --- | --- | --- |
72
84
  | `color` | `string` | no | |
85
+ | `hue` | `number` | no | |
73
86
  | `initials` | `string` | yes | |
74
87
  | `label` | `string` | yes | |
75
88
  | `size` | `"lg" \| "med" \| "sm"` | no | |
@@ -109,7 +109,7 @@ Also accepts the style props (see `manifest.json` `styleProps`).
109
109
  | Prop | Type | Required | Description |
110
110
  | --- | --- | --- | --- |
111
111
  | `font` | `"body" \| "display" \| "heading" \| "label" \| "mono"` | no | |
112
- | `leading` | `"lg" \| "med" \| "sm"` | no | |
112
+ | `leading` | `"body" \| "lg" \| "med" \| "meta" \| "sm"` | no | |
113
113
  | `size` | `"2xl" \| "3xl" \| "4xl" \| "lg" \| "med" \| "sm" \| "xl" \| "xs"` | no | |
114
114
  | `tabularNums` | `boolean` | no | |
115
115
  | `truncate` | `"box" \| boolean` | no | |
@@ -123,7 +123,7 @@ Also accepts the style props (see `manifest.json` `styleProps`).
123
123
  | Prop | Type | Required | Description |
124
124
  | --- | --- | --- | --- |
125
125
  | `font` | `"body" \| "display" \| "heading" \| "label" \| "mono"` | no | |
126
- | `leading` | `"lg" \| "med" \| "sm"` | no | |
126
+ | `leading` | `"body" \| "lg" \| "med" \| "meta" \| "sm"` | no | |
127
127
  | `match` | `boolean \| keyof ValidityState` | no | Determines whether to show the error message according to the field's [ValidityState](https://developer.mozilla.org/en-US/docs/Web/API/ValidityState). Specifying `true` will always show the error message, and lets external libraries control the visibility. |
128
128
  | `size` | `"2xl" \| "3xl" \| "4xl" \| "lg" \| "med" \| "sm" \| "xl" \| "xs"` | no | |
129
129
  | `tabularNums` | `boolean` | no | |
@@ -138,7 +138,7 @@ Also accepts the style props (see `manifest.json` `styleProps`).
138
138
  | Prop | Type | Required | Description |
139
139
  | --- | --- | --- | --- |
140
140
  | `font` | `"body" \| "display" \| "heading" \| "label" \| "mono"` | no | |
141
- | `leading` | `"lg" \| "med" \| "sm"` | no | |
141
+ | `leading` | `"body" \| "lg" \| "med" \| "meta" \| "sm"` | no | |
142
142
  | `nativeLabel` | `boolean` | no | Whether the component renders a native `<label>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a label (for example, `<div>`). This is useful to avoid inheriting label behaviors on `<button>` controls (such as `<Select.Trigger>` and `<Combobox.Trigger>`), including avoiding `:hover` on the button when hovering the label, and preventing clicks on the label from firing on the button. |
143
143
  | `size` | `"2xl" \| "3xl" \| "4xl" \| "lg" \| "med" \| "sm" \| "xl" \| "xs"` | no | |
144
144
  | `tabularNums` | `boolean` | no | |
@@ -61,7 +61,7 @@ Generated from the TypeScript types.
61
61
  | --- | --- | --- | --- |
62
62
  | `as` | `"h1" \| "h2" \| "h3" \| "h4" \| "h5" \| "h6"` | no | |
63
63
  | `font` | `"body" \| "display" \| "heading" \| "label" \| "mono"` | no | |
64
- | `leading` | `"lg" \| "med" \| "sm"` | no | |
64
+ | `leading` | `"body" \| "lg" \| "med" \| "meta" \| "sm"` | no | |
65
65
  | `size` | `"2xl" \| "lg" \| "med" \| "sm" \| "xl"` | no | |
66
66
  | `tabularNums` | `boolean` | no | |
67
67
  | `truncate` | `"box" \| boolean` | no | |
@@ -22,15 +22,15 @@ A column of links to an app's pages, with the current page marked: a sidebar's o
22
22
 
23
23
  - `NavList` needs a name, and its type requires one: `aria-label` ("Main", "Settings") or `aria-labelledby` when a visible heading names it. A page with two navs tells them apart by these names.
24
24
  - Children are `NavList.Item` and `NavList.Group`, in any mix. `NavList.Group` takes `label`, a string: its heading's text, and its list's name. The heading is `h2` by default; set `headingLevel` to fit the page's outline. A group after another item or group gets `16` of room above it, and so does an item after a group.
25
- - `NavList.Item` is an `<a>` by default: pass `href`. With `as={Link}`, it takes the router's props instead (`to`, `prefetch`) and its type checks them. Every other prop, `ref` and the style props included, lands on the link; the `li` around it is bare. Use the router's plain `Link`, not a `NavLink` that sets `aria-current` itself: NavList draws the current item from `current`, so the two would disagree.
25
+ - `NavList.Item` is an `<a>` by default: pass `href`. With `as={Link}`, it takes the router's props instead (`to`, `prefetch`) and its type checks them. Every other prop, `ref` and the style props included, lands on the link; the `li` around it is bare. A custom `as` component must pass its props and `ref` on to the element it renders: the rail tooltip opens from the event handlers and `ref` it adds there. Use the router's plain `Link`, not a `NavLink` that sets `aria-current` itself: NavList draws the current item from `current`, so the two would disagree.
26
26
  - `current` marks the link to the page on screen: `aria-current="page"`, an `accentSubtle` fill with `accentSubtleFg` text, a semibold label and an accent bar at the inline-start edge. Set it on one item at most. It is the only way to set `aria-current`: the type omits the raw attribute.
27
27
  - `icon` takes an icon component (`icon={InboxIcon}`), drawn at `sm` before the label and hidden from assistive tech: the label names the link.
28
28
  - `avatar` takes an avatar in place of the icon, for a row that stands for a person, a team or a repository: `avatar={<Avatar initials="UI" label="" size="sm" />}`. It is hidden from assistive tech like the icon, so give the Avatar an empty `label`. An item takes `icon` or `avatar`, never both; the type rejects the pair.
29
- - Inside a `Sidebar` rail (`collapsed`), group headings, labels and counts are visually hidden and each item is a 40px square around its icon or avatar, centered. Their text stays in the accessible names. Every item in a rail needs an icon or an avatar.
29
+ - Inside a `Sidebar` rail (`collapsed`), group headings, labels and counts are visually hidden and each item is a 40px square around its icon or avatar, centered. Their text stays in the accessible names. Every item in a rail needs an icon or an avatar. In a SidebarLayout stacked below 48em a collapsed Sidebar is no rail: the items show open (ADR 0156). In the rail, hover or keyboard focus on an item shows its label and count in a tooltip past its inline end (right, or left right to left); Esc, blur and pointer leave close it, and the pointer can move onto it. Items in one NavList share the tooltip delay: once one has opened, the next opens at once. Outside a rail no tooltip shows (ADR 0159). The tooltip repeats the item's children, so keep them to text and a count: content with an `id` would repeat it.
30
30
  - `count` is a trailing subtle `Badge` at `xs`. It is part of the link's accessible name, read after the label, so a bare number says nothing ("Issues 12"). Give it its meaning with `VisuallyHidden`: `count={<>12<VisuallyHidden> open issues</VisuallyHidden></>}`. A nullish or empty count renders nothing.
31
31
  - Labels wrap onto a second line in a narrow column, breaking a long word if they must; they never truncate.
32
32
  - Items are `sm` text in `fg`, with `6` block and `8` inline padding, a `sm` radius and at least the `xs` (24px) block size, as default style props; the consumer's win. Hover tints a non-current item where hover is real (`(hover: hover)`).
33
- - No part has hooks, so a server component can render the whole list, router `Link` included.
33
+ - A server component can render the whole list, router `Link` included. `NavList` and `NavList.Group` have no hooks; each `NavList.Item` renders its link inside a client part, the rail tooltip (ADR 0159).
34
34
 
35
35
  ## Do
36
36
 
@@ -101,7 +101,7 @@ A column of links to an app's pages, with the current page marked: a sidebar's o
101
101
  - The current item has `aria-current="page"`, announced as "current page". Its fill, bar and heavier label show it without color alone (WCAG 1.4.1); under forced colors the fill is gone and the bar turns `Highlight`.
102
102
  - The current item's text is `accentSubtleFg` on `accentSubtle`, a checked pair (4.5:1, light and dark). Other items are `fg` on the page's surface; under the hover tint, `fg` over `bg`, `bgMuted` and `bgRaised` is checked in `contrast/mixes.ts` (the ghost Button's tint).
103
103
  - Links are in the tab order in reading order and show the shared focus ring. Every item is at least 24px high (WCAG 2.5.8, ADR 0124).
104
- - The icon or avatar is hidden; the label and the count, with its meaning, make the link's name, in a Sidebar rail too, where they are only visually hidden.
104
+ - The icon or avatar is hidden; the label and the count, with its meaning, make the link's name, in a Sidebar rail too, where they are only visually hidden. The rail tooltip repeats that name for sight only: it is `aria-hidden` and not the link's description, so the name is read once and there is no `aria-describedby`.
105
105
 
106
106
  ## Props
107
107
 
@@ -19,13 +19,13 @@ An app's sidebar: a named `aside` on the `bgPanel` surface, with a header row, t
19
19
 
20
20
  - The sidebar needs a name, and its type requires one: `aria-label` ("Sidebar", "Repositories") or `aria-labelledby`. It is an `aside`, a complementary landmark; put a named `NavList` inside it for the links.
21
21
  - Place it in `SidebarLayout.Sidebar` with `inlineSize="auto"`, so the column follows the sidebar's own width, open or collapsed. `padding` stays at its default of none on that column.
22
- - The rail is for a wide layout. Stacked, a collapsed sidebar still shows only icons, across the whole row: keep it open below the layout's 48em.
22
+ - The rail is for a wide layout. Stacked, below the layout's 48em, a collapsed sidebar shows open, labels and all, and the toggle changes nothing on screen there; it still flips `collapsed` and `aria-expanded`, so the rail returns when the layout widens (ADR 0156). Header and footer content you pick from `collapsed` (a brand without its name) still follows it there. The layout queries match the nearest SidebarLayout, so a Sidebar in an outer layout's `Main` shows open whenever that layout stacks: keep it in a `SidebarLayout.Sidebar`.
23
23
  - `collapsed` switches to the rail. The app keeps the state (and any persistence or shortcut): `collapsed={collapsed} onCollapsedChange={setCollapsed}`. Without `onCollapsedChange` there is no toggle, and `collapsed` alone draws a fixed rail.
24
24
  - The toggle is a ghost `sm` `IconButton` at the header's inline end, named `toggleLabel` ("Toggle sidebar" by default). Its name stays the same in both states and `aria-expanded` says which is on. Its panel icon points at the sidebar's edge, mirrored in a right-to-left page.
25
25
  - `header` sits before the toggle (a brand); `footer` sits after a rule at the bottom (theme, account). In the rail both stack in a column and center: pass what fits 40px (a mark, icon-only controls).
26
26
  - In the rail, every `NavList.Item` needs an `icon` or an `avatar`: it is the one part left in sight. Group headings, labels and counts are visually hidden, never removed.
27
27
  - In a wide SidebarLayout the sidebar fills the viewport's height, so the footer sits at the bottom; stacked, it takes the whole row and its own height, with its rule below it. Outside a SidebarLayout it is the width above and its content's height: size it yourself.
28
- - Its width is CSS keyed to the layout's container query, not a default style prop, and component CSS outranks style props: another width goes in your own `className`. `backgroundColor` (`bgPanel`), `display` and `flexDirection` are default style props; the consumer's win.
28
+ - Its width is CSS keyed to the layout's container query, not a default style prop, and component CSS outranks style props: another width goes in your own `className`. In the rail the sidebar is a size container, so a rail width of your own must be a fixed length, never `max-content`; it is also the containing block for its fixed and absolute descendants and a stacking context, so a popup inside it should portal out, as the library's do. `backgroundColor` (`bgPanel`), `display` and `flexDirection` are default style props; the consumer's win.
29
29
  - No hooks: a server component can render it. Pass `onCollapsedChange` from a client component; the toggle is the only client part.
30
30
 
31
31
  ## Do
@@ -81,7 +81,7 @@ const [collapsed, setCollapsed] = useState(false);
81
81
  - An `aside` landmark, named by its `aria-label` or `aria-labelledby`, so landmark navigation reaches it and tells it apart from the page's other regions.
82
82
  - The toggle is a button with a name and `aria-expanded` (true while open). It keeps focus when pressed, and its name never changes, so a screen reader hears the new state, not a new control.
83
83
  - In the rail, NavList's labels, counts and group headings are visually hidden, not removed: each link keeps its full name, count included, and each group's list keeps its name. Rows stay in the tab order in reading order; there is no roving tabindex.
84
- - Rail rows are 40px squares, above the 24px target floor (WCAG 2.5.8, ADR 0124). A rail row has no visible label: until a tooltip shows one on hover and focus, pair the rail with icons or avatars people recognise.
84
+ - Rail rows are 40px squares, above the 24px target floor (WCAG 2.5.8, ADR 0124). A rail row has no visible label until hover or focus shows it in a tooltip (NavList, ADR 0159), so pair the rail with icons or avatars people recognise; on touch there is no hover, and the label shows only to keyboard focus.
85
85
  - The `bgPanel` surface is checked with every text role on it (`contrast.ts`); `fg` and `fgMuted` pass 4.5:1 on it, as on every surface. Under forced colors it is `Canvas` and the edge rule stays.
86
86
  - Logical properties throughout: in a right-to-left page the sidebar, its rule and its toggle's icon mirror.
87
87
 
@@ -194,7 +194,7 @@ Also accepts the style props (see `manifest.json` `styleProps`).
194
194
  | Prop | Type | Required | Description |
195
195
  | --- | --- | --- | --- |
196
196
  | `font` | `"body" \| "display" \| "heading" \| "label" \| "mono"` | no | |
197
- | `leading` | `"lg" \| "med" \| "sm"` | no | |
197
+ | `leading` | `"body" \| "lg" \| "med" \| "meta" \| "sm"` | no | |
198
198
  | `numeric` | `boolean` | no | |
199
199
  | `size` | `"2xl" \| "3xl" \| "4xl" \| "lg" \| "med" \| "sm" \| "xl" \| "xs"` | no | |
200
200
  | `weight` | `"bold" \| "medium" \| "regular" \| "semibold"` | no | |
@@ -232,7 +232,7 @@ Also accepts the style props (see `manifest.json` `styleProps`).
232
232
  | --- | --- | --- | --- |
233
233
  | `font` | `"body" \| "display" \| "heading" \| "label" \| "mono"` | no | |
234
234
  | `hideLabel` | `boolean` | no | |
235
- | `leading` | `"lg" \| "med" \| "sm"` | no | |
235
+ | `leading` | `"body" \| "lg" \| "med" \| "meta" \| "sm"` | no | |
236
236
  | `numeric` | `boolean` | no | |
237
237
  | `onSort` | `((() => void) & (() => void))` | no | |
238
238
  | `size` | `"2xl" \| "3xl" \| "4xl" \| "lg" \| "med" \| "sm" \| "xl" \| "xs"` | no | |
package/dist/docs/Tabs.md CHANGED
@@ -121,7 +121,7 @@ Also accepts the style props (see `manifest.json` `styleProps`).
121
121
  | --- | --- | --- | --- |
122
122
  | `disabled` | `boolean` | no | Whether the Tab is disabled. If a first Tab on a `<Tabs.List>` is disabled, it won't initially be selected. Instead, the next enabled Tab will be selected. However, it does not work like this during server-side rendering, as it is not known during pre-rendering which Tabs are disabled. To work around it, ensure that `defaultValue` or `value` on `<Tabs.Root>` is set to an enabled Tab's value. |
123
123
  | `font` | `"body" \| "display" \| "heading" \| "label" \| "mono"` | no | |
124
- | `leading` | `"lg" \| "med" \| "sm"` | no | |
124
+ | `leading` | `"body" \| "lg" \| "med" \| "meta" \| "sm"` | no | |
125
125
  | `nativeButton` | `boolean` | no | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
126
126
  | `size` | `"2xl" \| "3xl" \| "4xl" \| "lg" \| "med" \| "sm" \| "xl" \| "xs"` | no | |
127
127
  | `tabularNums` | `boolean` | no | |
package/dist/docs/Text.md CHANGED
@@ -24,7 +24,8 @@ The base of all visible text, and the primitive every text component builds on.
24
24
  - `size` takes a `fontSize` step: `xs`, `sm`, `med`, `lg`, `xl`, `2xl`, `3xl`, `4xl`. The top-level default is `med`.
25
25
  - `font` takes a font role: `body` (default), `heading`, `display`, `label`, `mono`. The brand maps roles to fonts.
26
26
  - `weight` takes `regular` (default), `medium`, `semibold` or `bold`.
27
- - `leading` takes a unitless line height: `sm`, `med` (default) or `lg`. The trim follows it.
27
+ - `leading` takes a unitless line height: `sm`, `med` (default) or `lg`, plus two steps paired with a size: `body` (`size="sm" leading="body"`, 14/20, dense UI body text) and `meta` (`size="xs" weight="medium" leading="meta"`, 12/16, counts, timestamps and badges). On other sizes they land off the pixel grid. The trim follows it.
28
+ - `font` also sets the brand's tracking and font features for the role (the `default` brand tightens Inter by `-0.006em` and turns on `cv11` and `ss03`); a run inherits the outer Text's.
28
29
  - `tabularNums` gives every digit the same width, so figures in a column or a ticking count line up: amounts, durations, counts in a table. Prose numbers keep the font's own figures.
29
30
  - `color` takes a color role (`fg`, `fgMuted`, `accent`, …), never a raw color. Unset, it inherits.
30
31
  - `truncate` keeps one line and cuts it with an ellipsis, without clipping ascenders or descenders. It sets the block margins, so do not combine it with margin props.
@@ -114,7 +115,7 @@ Generated from the TypeScript types.
114
115
  | --- | --- | --- | --- |
115
116
  | `as` | `ElementType` | no | |
116
117
  | `font` | `"body" \| "display" \| "heading" \| "label" \| "mono"` | no | |
117
- | `leading` | `"lg" \| "med" \| "sm"` | no | |
118
+ | `leading` | `"body" \| "lg" \| "med" \| "meta" \| "sm"` | no | |
118
119
  | `size` | `"2xl" \| "3xl" \| "4xl" \| "lg" \| "med" \| "sm" \| "xl" \| "xs"` | no | |
119
120
  | `tabularNums` | `boolean` | no | |
120
121
  | `truncate` | `"box" \| boolean` | no | |
@@ -12,7 +12,7 @@
12
12
  ## Components
13
13
 
14
14
  - [AlertDialog](AlertDialog.md): Asks the user to confirm a consequential action before it runs: delete a project, discard unsaved changes, sign out every device. Built on Base UI's AlertDialog, which owns the behavior: `role="alertdialog"`, focus moves into the dialog and stays there, the page behind is inert, Esc closes it, and a click outside does not. It wears Dialog's panel at the `sm` width with a title, a description, Cancel and one confirm button, and Cancel takes focus on open.
15
- - [Avatar](Avatar.md): Identifies a person, project or account by one or two letters in a circle, on a colour of the consumer's choosing or a neutral fill. A `span` with `role="img"`, named by `label`, around a `Text` in the `label` font. It is never focusable.
15
+ - [Avatar](Avatar.md): Identifies a person, project or account by one or two letters in a circle, tinted by a hue or filled with a colour of the consumer's choosing, or on a neutral fill. A `span` with `role="img"`, named by `label`, around a `Text` in the `label` font. It is never focusable.
16
16
  - [Badge](Badge.md): A static label that states the status of, or a short fact about, the thing beside it: "Draft", "Failed", "Beta". A `span` with a fill from the color roles around a `Text` in the `label` font. It has no role and is never focusable.
17
17
  - [Box](Box.md): The base element every component builds on: one element, chosen with `as`, styled with style props. Style props are the token-backed classes from `@layer atoms`: layout (`display`, flex, `gap`, logical padding, margin and sizing), color roles, `borderRadius`, `boxShadow`, `position`, `zIndex`, `overflow` and `textAlign`.
18
18
  - [Button](Button.md): The labelled action: a `<button type="button">` with the house look, or a link styled as one with `as="a"` (or a router's link). Four variants (`primary`, `secondary`, `ghost`, `danger`), three sizes (`sm`, `med`, `lg`, 24, 32 and 40 px high, ADR 0124), a `loading` state that keeps its width, and icon slots before and after the label. It is a pill (`full` radius) with a bold uppercase label and a soft glow in its variant's color (ADR 0131). It is built on `Clickable`, so it has the shared focus ring, the 24px minimum target and `aria-disabled` / `aria-busy` states that block activation while the button stays focusable.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "./manifest.schema.json",
3
3
  "package": "@jonmilner/ui",
4
- "version": "0.14.0",
4
+ "version": "0.15.1",
5
5
  "components": [
6
6
  {
7
7
  "name": "AlertDialog",
@@ -138,6 +138,11 @@
138
138
  "type": "string",
139
139
  "required": false
140
140
  },
141
+ {
142
+ "name": "hue",
143
+ "type": "number",
144
+ "required": false
145
+ },
141
146
  {
142
147
  "name": "initials",
143
148
  "type": "string",
@@ -906,11 +911,13 @@
906
911
  },
907
912
  {
908
913
  "name": "leading",
909
- "type": "\"lg\" | \"med\" | \"sm\"",
914
+ "type": "\"body\" | \"lg\" | \"med\" | \"meta\" | \"sm\"",
910
915
  "required": false,
911
916
  "values": [
917
+ "body",
912
918
  "lg",
913
919
  "med",
920
+ "meta",
914
921
  "sm"
915
922
  ]
916
923
  },
@@ -980,11 +987,13 @@
980
987
  },
981
988
  {
982
989
  "name": "leading",
983
- "type": "\"lg\" | \"med\" | \"sm\"",
990
+ "type": "\"body\" | \"lg\" | \"med\" | \"meta\" | \"sm\"",
984
991
  "required": false,
985
992
  "values": [
993
+ "body",
986
994
  "lg",
987
995
  "med",
996
+ "meta",
988
997
  "sm"
989
998
  ]
990
999
  },
@@ -1060,11 +1069,13 @@
1060
1069
  },
1061
1070
  {
1062
1071
  "name": "leading",
1063
- "type": "\"lg\" | \"med\" | \"sm\"",
1072
+ "type": "\"body\" | \"lg\" | \"med\" | \"meta\" | \"sm\"",
1064
1073
  "required": false,
1065
1074
  "values": [
1075
+ "body",
1066
1076
  "lg",
1067
1077
  "med",
1078
+ "meta",
1068
1079
  "sm"
1069
1080
  ]
1070
1081
  },
@@ -1156,11 +1167,13 @@
1156
1167
  },
1157
1168
  {
1158
1169
  "name": "leading",
1159
- "type": "\"lg\" | \"med\" | \"sm\"",
1170
+ "type": "\"body\" | \"lg\" | \"med\" | \"meta\" | \"sm\"",
1160
1171
  "required": false,
1161
1172
  "values": [
1173
+ "body",
1162
1174
  "lg",
1163
1175
  "med",
1176
+ "meta",
1164
1177
  "sm"
1165
1178
  ]
1166
1179
  },
@@ -2464,11 +2477,13 @@
2464
2477
  },
2465
2478
  {
2466
2479
  "name": "leading",
2467
- "type": "\"lg\" | \"med\" | \"sm\"",
2480
+ "type": "\"body\" | \"lg\" | \"med\" | \"meta\" | \"sm\"",
2468
2481
  "required": false,
2469
2482
  "values": [
2483
+ "body",
2470
2484
  "lg",
2471
2485
  "med",
2486
+ "meta",
2472
2487
  "sm"
2473
2488
  ]
2474
2489
  },
@@ -2558,11 +2573,13 @@
2558
2573
  },
2559
2574
  {
2560
2575
  "name": "leading",
2561
- "type": "\"lg\" | \"med\" | \"sm\"",
2576
+ "type": "\"body\" | \"lg\" | \"med\" | \"meta\" | \"sm\"",
2562
2577
  "required": false,
2563
2578
  "values": [
2579
+ "body",
2564
2580
  "lg",
2565
2581
  "med",
2582
+ "meta",
2566
2583
  "sm"
2567
2584
  ]
2568
2585
  },
@@ -2756,11 +2773,13 @@
2756
2773
  },
2757
2774
  {
2758
2775
  "name": "leading",
2759
- "type": "\"lg\" | \"med\" | \"sm\"",
2776
+ "type": "\"body\" | \"lg\" | \"med\" | \"meta\" | \"sm\"",
2760
2777
  "required": false,
2761
2778
  "values": [
2779
+ "body",
2762
2780
  "lg",
2763
2781
  "med",
2782
+ "meta",
2764
2783
  "sm"
2765
2784
  ]
2766
2785
  },
@@ -2900,11 +2919,13 @@
2900
2919
  },
2901
2920
  {
2902
2921
  "name": "leading",
2903
- "type": "\"lg\" | \"med\" | \"sm\"",
2922
+ "type": "\"body\" | \"lg\" | \"med\" | \"meta\" | \"sm\"",
2904
2923
  "required": false,
2905
2924
  "values": [
2925
+ "body",
2906
2926
  "lg",
2907
2927
  "med",
2928
+ "meta",
2908
2929
  "sm"
2909
2930
  ]
2910
2931
  },
@@ -4181,6 +4202,8 @@
4181
4202
  "fontWeight.semibold": "var(--font-weight-semibold)",
4182
4203
  "fontWeight.bold": "var(--font-weight-bold)",
4183
4204
  "lineHeight.sm": "var(--line-height-sm)",
4205
+ "lineHeight.meta": "var(--line-height-meta)",
4206
+ "lineHeight.body": "var(--line-height-body)",
4184
4207
  "lineHeight.med": "var(--line-height-med)",
4185
4208
  "lineHeight.lg": "var(--line-height-lg)",
4186
4209
  "zIndex.base": "var(--z-index-base)",
@@ -4259,7 +4282,17 @@
4259
4282
  "fontTrim.label.cap": "var(--font-trim-label-cap)",
4260
4283
  "fontTrim.label.baseline": "var(--font-trim-label-baseline)",
4261
4284
  "fontTrim.mono.cap": "var(--font-trim-mono-cap)",
4262
- "fontTrim.mono.baseline": "var(--font-trim-mono-baseline)"
4285
+ "fontTrim.mono.baseline": "var(--font-trim-mono-baseline)",
4286
+ "fontTracking.body": "var(--font-tracking-body)",
4287
+ "fontTracking.heading": "var(--font-tracking-heading)",
4288
+ "fontTracking.display": "var(--font-tracking-display)",
4289
+ "fontTracking.label": "var(--font-tracking-label)",
4290
+ "fontTracking.mono": "var(--font-tracking-mono)",
4291
+ "fontFeatures.body": "var(--font-features-body)",
4292
+ "fontFeatures.heading": "var(--font-features-heading)",
4293
+ "fontFeatures.display": "var(--font-features-display)",
4294
+ "fontFeatures.label": "var(--font-features-label)",
4295
+ "fontFeatures.mono": "var(--font-features-mono)"
4263
4296
  },
4264
4297
  "deprecated": {}
4265
4298
  }
@@ -0,0 +1,94 @@
1
+ # 0.15.0
2
+
3
+ Two breaking changes. Apply both; each section has a part for each.
4
+
5
+ - The `default` brand's sans font roles (`body`, `heading`, `display`, `label`) now set `letter-spacing: -0.006em` and `font-feature-settings: "cv11", "ss03"` on every Text and Heading (decision 0157), so text is about 0.6% narrower and shows Inter's single-storey `a` and rounded quotes. `lineHeight` also gains `meta` and `body` steps for 12/16 and 14/20 text. Nothing stops compiling; an app that already set this tracking, these features or these line heights itself now applies them twice or can drop its override.
6
+ - A collapsed `Sidebar` in a `SidebarLayout` below 48em now shows open instead of a row of 40px icon squares, and `NavList` takes its rail from the collapsed Sidebar alone, no longer from any `data-rail` ancestor (decision 0156). A `SidebarLayout` with `gap="0"` now stacks below 48em too; before, its main stayed beside the sidebar there.
7
+
8
+ ## Find
9
+
10
+ ### Typography tracking and leading
11
+
12
+ In the app's styles and source (`*.css`, `*.css.ts`, `*.ts`, `*.tsx`), every tracking or feature override: regex `letter-?[sS]pacing|font-?[fF]eature-?[sS]ettings`. Keep the matches on a root, `body`, a provider or a wrapper around Text, the ones that re-create a brand-wide setting.
13
+
14
+ Then every hand-set 12/16 or 14/20 line height: regex `line-?[hH]eight:\s*["']?(16px|20px|1rem|1\.25rem|1\.33+|1\.428\d*)`, plus each `style={{ lineHeight` on a Text.
15
+
16
+ ### Sidebar rail
17
+
18
+ In the app's source (`*.ts`, `*.tsx`, `*.css`):
19
+
20
+ - A `data-rail` attribute the app sets itself, or a selector that reads it: regex `data-rail`. Sidebar's own `data-rail` needs no change; only one the app writes or styles against does.
21
+ - A stacked layout that hides the sidebar's labels or works around the old rail by clearing `collapsed` below 48em: regex `collapsed=\{[^}]*(matchMedia|isNarrow|isMobile|useMediaQuery)`.
22
+
23
+ ## Replace
24
+
25
+ ### Typography tracking and leading
26
+
27
+ Delete a root tracking or feature override that matches the brand's new values; Text sets them now.
28
+
29
+ ```css
30
+ /* before */
31
+ body {
32
+ letter-spacing: -0.006em;
33
+ font-feature-settings: "cv11", "ss03";
34
+ }
35
+ /* after: removed */
36
+ ```
37
+
38
+ Replace a hand-set meta or body line height with the leading step:
39
+
40
+ ```tsx
41
+ // before
42
+ <Text size="xs" weight="medium" style={{ lineHeight: "16px" }}>3 open</Text>
43
+ <Text size="sm" style={{ lineHeight: "20px" }}>{summary}</Text>
44
+ // after
45
+ <Text size="xs" weight="medium" leading="meta">3 open</Text>
46
+ <Text size="sm" leading="body">{summary}</Text>
47
+ ```
48
+
49
+ To keep the old look in a custom brand built from `default`, set its roles back to `normal`:
50
+
51
+ ```ts
52
+ const sans = { ...defaultBrand.font.body, tracking: "normal", features: "normal" };
53
+ const brand: Brand = {
54
+ ...defaultBrand,
55
+ name: "mine",
56
+ font: { ...defaultBrand.font, body: sans, heading: sans, display: sans, label: sans },
57
+ };
58
+ ```
59
+
60
+ ### Sidebar rail
61
+
62
+ A NavList inside the app's own `data-rail` wrapper no longer squares its rows. Use a collapsed `Sidebar`:
63
+
64
+ ```tsx
65
+ // before
66
+ <Box data-rail="" style={{ inlineSize: 56 }}>
67
+ <NavList aria-label="Pages">…</NavList>
68
+ </Box>
69
+ // after
70
+ <Sidebar aria-label="Pages" collapsed>
71
+ <NavList aria-label="Pages">…</NavList>
72
+ </Sidebar>
73
+ ```
74
+
75
+ A workaround that drops `collapsed` when the layout is narrow is no longer needed; pass the app's state as is:
76
+
77
+ ```tsx
78
+ // before
79
+ <Sidebar collapsed={collapsed && !isNarrow} onCollapsedChange={setCollapsed} … />
80
+ // after
81
+ <Sidebar collapsed={collapsed} onCollapsedChange={setCollapsed} … />
82
+ ```
83
+
84
+ CSS that read `[data-rail]` to style its own parts in the rail queries the rail container instead; the library keeps that query internal, so move the part into Sidebar's `header` or `footer`, or key it to the app's `collapsed` state.
85
+
86
+ ## Verify
87
+
88
+ ### Typography tracking and leading
89
+
90
+ The Find regexes match no root override that duplicates the brand's tracking or features, and no hand-set 16px or 20px line height on a Text. Then update the app's visual baselines: text in screenshots is slightly narrower, and a line that used to wrap may now fit. Chromium and WebKit drop optional ligatures (Inter's `fi`, `fl`) under any non-zero `letter-spacing`, so those pairs now render as separate glyphs.
91
+
92
+ ### Sidebar rail
93
+
94
+ Load a page with a collapsed Sidebar in a SidebarLayout: wider than 48em it is the 56px rail; narrower, it stacks above the page with every label and count in view.
@@ -54,7 +54,7 @@ Three overlay roles lay a tint over whatever surface is under them: `hover` for
54
54
  - **Contrast is checked in development.** Outside production, `defineTheme` throws when a text, fill or focus pair fails WCAG AA in either mode, and lists the pairs. It also checks text on component fills mixed from your roles, such as the dark-mode menu highlight (`fg` 10% into `bgRaised`), where `fg`, `fgMuted` and `danger` need 4.5:1 too, and Button's hover (`fg` 15% over each variant's fill), where `fg`, `accentFillFg` and `dangerFg` need 4.5:1 on `bg`, `accentFill` and `danger` tinted, and a pressed Chip's, where `accentFg` does on `accent`. The roles a fill mixes must be opaque. Colors must be literal: hex, `rgb()`, `oklab()`, `oklch()`, `color-mix()` or `light-dark()`. Named colors other than `white`, `black` and `transparent` are rejected, as is a translucent background (the overlays aside). `var()` may only reference another color role (`var(--color-accent)`).
55
55
  - **Override theme tokens in unlayered CSS or in the theme itself.** The theme is unlayered, so a token set in `@layer app` loses to it. Preset tokens live in `@layer tokens` and can be overridden from `@layer app`.
56
56
  - **Fallback faces are global.** A brand font's fallback faces are named for the web font and the local font, `"<Family> Fallback <Local>"` (`"Inter Fallback Arial"`). The theme declares only faces `base.css` lacks. A font reusing a family name must agree with every face it shares, weight and style included: a fallback listing fewer variants (such as capsize's per-font `arial` import) reuses the others' faces, but one that sizes a shared face differently, or adds a weight or style to a preset's family, throws.
57
- - **Values must be plain.** Color values and font names may not contain CSS syntax (`;`, braces, `<`, `>`, `\`, `!`, `/*`) or, for font names, quotes; `defineTheme` throws in every mode.
57
+ - **Values must be plain.** Color values and font names may not contain CSS syntax (`;`, braces, `<`, `>`, `\`, `!`, `/*`) or, for font names, quotes; `defineTheme` throws in every mode. A font's `tracking` must be a length (`-0.01em`, `0.5px`) or `normal`, and its `features` quoted four-letter tags with an optional `on`, `off` or number (`'"cv11", "ss03" on'`) or `normal`.
58
58
  - **Each change gets its own `href`.** The `href` hashes the CSS, so a theme rebuilt with new colors replaces the old one instead of being deduped away.
59
59
  - Under forced colors, every role maps to a system color, as for presets.
60
60
 
@@ -72,4 +72,6 @@ A provider's `color-scheme` stops at its `div`, so the page canvas and scrollbar
72
72
 
73
73
  A brand declares its fonts; the app loads them (fontsource or self-hosted `@font-face`) and owns preloading. The `default` brand uses Inter and JetBrains Mono. In development, `ThemeProvider` warns in the console when a brand font has no `@font-face` or fails to load; in production it renders no check and the check's body is dead code.
74
74
 
75
+ Each font role may also set `tracking` (letter-spacing, in `em` so it scales with the size) and `features` (`font-feature-settings`, such as Inter's `"cv11", "ss03"`); both default to `normal`. Text and Heading apply them from the role, so a brand tunes its type without touching components. The `default` brand sets `-0.006em` and `"cv11", "ss03"` on its sans roles; `mono` keeps the defaults.
76
+
75
77
  Until a web font loads, text renders in a fallback face sized to the web font's cap height, so the trim holds where a fallback font is installed (Arial for `sans`; Menlo, Consolas or Courier New for `mono`, tried in that order); elsewhere the generic family renders unadjusted. In a custom brand, `fallback` takes one font or an ordered list, and each gets its own faces. Bold, italic and bold italic text get their own fallback faces (`local("Arial Bold")` and so on), each sized to the web font's matching weight and style; in a custom brand, give `fallback` (and `metrics`, for the web font's own sizes) a `variants` map keyed `700`, `italic` and `700italic`, as `@capsizecss/metrics`' `entireMetricsCollection` has them. A fallback without `variants` gets only the regular face, and the browser synthesizes bold and italic from it. Widths still differ: in the `default` brand, `mono` text is about 0.5% wider than JetBrains Mono in Menlo (macOS), 4.8% in Consolas (Windows) and 28% in Courier New (elsewhere), so expect code to overflow or wrap until the font loads where Courier New stands in. Where width matters, preload the mono font and load it with `font-display: block` (or `optional`, which may keep the fallback for that page view); a custom brand's gap depends on its own fallback.
package/dist/index.d.mts CHANGED
@@ -37,8 +37,9 @@ import { TextField, TextFieldInputProps, TextFieldProps } from "./TextField/inde
37
37
  import { Textarea, TextareaInputProps, TextareaProps } from "./Textarea/index.mjs";
38
38
  import { ToastOptions, ToastProviderProps, ToastVariant, useToast } from "./Toast/client.mjs";
39
39
  import { Toast } from "./Toast/index.mjs";
40
+ import { TooltipPopupProps } from "./Tooltip/base.mjs";
40
41
  import { TooltipTriggerProps } from "./Tooltip/client.mjs";
41
- import { Tooltip, TooltipPopupProps, TooltipProps, TooltipProviderProps } from "./Tooltip/index.mjs";
42
+ import { Tooltip, TooltipProps, TooltipProviderProps } from "./Tooltip/index.mjs";
42
43
  import { VisuallyHidden, VisuallyHiddenProps } from "./VisuallyHidden/index.mjs";
43
44
  import { Theme, defineTheme } from "./theme/define-theme.mjs";
44
45
  import { ThemeProvider, ThemeProviderProps } from "./theme/ThemeProvider.mjs";
@@ -0,0 +1,6 @@
1
+ import { ReactElement, ReactNode } from "react";
2
+ import { Tooltip } from "@base-ui/react/tooltip";
3
+ export type TooltipRootScopeProps = Pick<Tooltip.Root.Props, "open" | "defaultOpen" | "onOpenChange" | "disabled"> & {
4
+ children?: ReactNode;
5
+ describes?: boolean;
6
+ };
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ import { join as e } from "../styles/join.mjs";
3
+ import { splitStyleProps as t } from "../styles/split-style-props.mjs";
4
+ import { Box as n } from "../Box/base.mjs";
5
+ import { createContext as r, use as i, useCallback as a, useId as o, useMemo as s, useState as c } from "react";
6
+ import { jsx as l } from "react/jsx-runtime";
7
+ import { Tooltip as u } from "@base-ui/react/tooltip";
8
+ // src/popup/tooltip.tsx
9
+ var d = r({
10
+ attach: () => {},
11
+ container: null,
12
+ describes: !0,
13
+ id: void 0
14
+ });
15
+ function f({ describes: e = !0, children: t, ...n }) {
16
+ let r = o(), [i, f] = c(null), p = a((e) => {
17
+ e && f(e.closest("[data-brand]") ?? e.ownerDocument.body);
18
+ }, []), m = s(() => ({
19
+ id: n.disabled || !e ? void 0 : r,
20
+ describes: e,
21
+ container: i,
22
+ attach: p
23
+ }), [
24
+ n.disabled,
25
+ e,
26
+ r,
27
+ i,
28
+ p
29
+ ]);
30
+ return /* @__PURE__ */ l(d, {
31
+ value: m,
32
+ children: /* @__PURE__ */ l(u.Root, {
33
+ ...n,
34
+ children: t
35
+ })
36
+ });
37
+ }
38
+ function p({ render: e }) {
39
+ let { attach: t } = i(d);
40
+ return /* @__PURE__ */ l(u.Trigger, {
41
+ id: e.props.id,
42
+ ref: t,
43
+ render: e
44
+ });
45
+ }
46
+ function m({ children: e }) {
47
+ let { container: t, describes: n } = i(d);
48
+ return /* @__PURE__ */ l(u.Portal, {
49
+ container: t,
50
+ keepMounted: n,
51
+ children: e
52
+ });
53
+ }
54
+ function h({ className: n, ...r }) {
55
+ return /* @__PURE__ */ l(u.Positioner, {
56
+ ...r,
57
+ collisionPadding: 8,
58
+ render: (r) => {
59
+ let [, i] = t(r);
60
+ return /* @__PURE__ */ l(g, {
61
+ ...i,
62
+ className: e(n, i.className)
63
+ });
64
+ },
65
+ sideOffset: 4
66
+ });
67
+ }
68
+ function g(e) {
69
+ return /* @__PURE__ */ l(n, {
70
+ ...e,
71
+ zIndex: "tooltip"
72
+ });
73
+ }
74
+ function _(e) {
75
+ return /* @__PURE__ */ l(u.Popup, {
76
+ ...e,
77
+ id: i(d).id,
78
+ role: "tooltip"
79
+ });
80
+ }
81
+ export { p as TooltipElementTrigger, d as TooltipLink, _ as TooltipPopupPart, m as TooltipPortal, h as TooltipPositioner, f as TooltipRootScope };