@nurvus/ui 0.1.0-alpha.17 → 0.1.0-alpha.19

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 (48) hide show
  1. package/README.md +15 -3
  2. package/dist/icons.svg +1 -0
  3. package/dist/index.js +1 -1
  4. package/dist/nurvus.css +5 -2
  5. package/dist/respawn.js +1 -1
  6. package/dist/types/anchor.d.ts +10 -2
  7. package/dist/types/components/Anchor/Anchor.d.ts +8 -5
  8. package/dist/types/components/Kbd/Kbd.d.ts +16 -0
  9. package/dist/types/components/Menu/Menu.d.ts +13 -5
  10. package/dist/types/components/NavToggle/NavToggle.d.ts +27 -0
  11. package/dist/types/components/Tooltip/Tooltip.d.ts +27 -0
  12. package/dist/types/icons.d.ts +1 -0
  13. package/dist/types/index.d.ts +7 -0
  14. package/dist/types/menu.d.ts +30 -6
  15. package/dist/types/respawn/Anchor.d.ts +2 -0
  16. package/dist/types/respawn/Kbd.d.ts +10 -0
  17. package/dist/types/respawn/Menu.d.ts +5 -1
  18. package/dist/types/respawn/NavToggle.d.ts +22 -0
  19. package/dist/types/respawn/Tooltip.d.ts +20 -0
  20. package/dist/types/respawn/index.d.ts +7 -0
  21. package/dist/types/tooltip.d.ts +4 -0
  22. package/package.json +1 -1
  23. package/src/anchor.ts +30 -7
  24. package/src/components/Anchor/Anchor.scss +26 -3
  25. package/src/components/Anchor/Anchor.tsx +23 -14
  26. package/src/components/Kbd/Kbd.md +14 -0
  27. package/src/components/Kbd/Kbd.scss +30 -0
  28. package/src/components/Kbd/Kbd.tsx +28 -0
  29. package/src/components/Menu/Menu.md +31 -2
  30. package/src/components/Menu/Menu.scss +24 -0
  31. package/src/components/Menu/Menu.tsx +72 -65
  32. package/src/components/NavToggle/NavToggle.md +51 -0
  33. package/src/components/NavToggle/NavToggle.scss +162 -0
  34. package/src/components/NavToggle/NavToggle.tsx +68 -0
  35. package/src/components/Tooltip/Tooltip.md +19 -0
  36. package/src/components/Tooltip/Tooltip.scss +75 -0
  37. package/src/components/Tooltip/Tooltip.tsx +69 -0
  38. package/src/css.ts +3 -0
  39. package/src/icons.ts +1 -0
  40. package/src/index.ts +7 -0
  41. package/src/menu.ts +58 -12
  42. package/src/respawn/Anchor.ts +26 -17
  43. package/src/respawn/Kbd.ts +22 -0
  44. package/src/respawn/Menu.ts +18 -16
  45. package/src/respawn/NavToggle.ts +78 -0
  46. package/src/respawn/Tooltip.ts +63 -0
  47. package/src/respawn/index.ts +7 -0
  48. package/src/tooltip.ts +14 -0
package/README.md CHANGED
@@ -30,15 +30,15 @@ Or pin the range in `package.json`:
30
30
  ### Usage
31
31
  Use the following example after installation:
32
32
  ```jsx static
33
- import React from 'react';
34
- import ReactDOM from 'react-dom';
33
+ import { createRoot } from 'react-dom/client';
35
34
  import { Button } from '@nurvus/ui';
36
35
 
37
36
  function App() {
38
37
  return <Button type="primary">Hello, world!</Button>;
39
38
  }
40
39
 
41
- ReactDOM.render(<App />, document.querySelector('#root'));
40
+ createRoot(document.getElementById('root')).render(<App />);
41
+ // React 16.8 or 17: ReactDOM.render(<App />, document.getElementById('root'));
42
42
  ```
43
43
 
44
44
  ### Themes
@@ -78,6 +78,18 @@ Themes nest (`<nav data-theme="tokyo-neon">` inside a light page), and your own
78
78
  ### New in 0.1.0-alpha.15
79
79
  - **`Icon`**: icons drawn for NURVUS on a 24-unit grid, in the text color, **1em by default** so an icon is as big as the text it sits in (`<Icon name="search" />`; `label` for an icon that stands alone). Names are typed (`IconName`); `ICONS` / `ICON_NAMES` list them. Same markup in `@nurvus/ui/respawn`.
80
80
 
81
+ ### New in 0.1.0-alpha.19
82
+ - **`Menu` nested groups**: any navigation item can have its own `items`, as deep as you like (Tree's shape). A group opens and closes like a section (its chevron between the guide line and the words, its title lined up with the items around it, its own guide line); with an `href` its title is a link too. → opens a group, ← closes it or goes up; the current page opens every group it is in. Same markup in Respawn.
83
+ - **`Menu`: Space follows a link** as Enter does (the WAI-ARIA navigation tree), so every row answers both keys; a section title that is the current page is now `aria-current="page"` too.
84
+ - Quick start: `createRoot` (React 18 and 19; `ReactDOM.render` is gone in React 19).
85
+
86
+ ### New in 0.1.0-alpha.18
87
+ - **`NavToggle`**: the button that shows and hides navigation. The hamburger (even or asymmetric lines; eight ways to turn into a close mark: slide, cross, squeeze, elastic, spin, arrow, chevron, collapse) or the sidebar icon (its pane fills while the sidebar shows; closed, it shrinks away and the divider slides left). Says what it will do and whether it is open.
88
+ - **`Tooltip`**: a short label for a control, on hover (after a short rest) and keyboard focus, with an optional shortcut as key caps. WCAG 1.4.13: Esc hides it, the pointer can move onto it, it stays while hovered or focused. Describes the control (`aria-describedby`).
89
+ - **`Kbd`**: key caps for shortcuts (`<kbd>` per key), sized in em. `modKey()` returns ⌘ on Apple devices and Ctrl elsewhere.
90
+ - **`Anchor`**: the list icon before its title, a dot at each end of the rail, the highlight over every section in view (the first is `aria-current`), and `fade`: a soft wash behind the row being read.
91
+ - **`align-left` icon** (72).
92
+
81
93
  ### New in 0.1.0-alpha.17
82
94
  - **`Dropdown`**: a button that opens a menu of actions (the WAI-ARIA menu button: `aria-haspopup`, ↓ / ↑ / Enter / Space open it, Esc and choosing put focus back on the button, a click outside or Tab closes it).
83
95
  - **`Anchor`**: "On this page". A rail beside the rows bends in and out with the nesting, and a highlight slides along it to the section in view (scroll-spy on the page or inside `scrollRoot`); picking a row scrolls there and moves focus. Drawn from the items alone (rows are 1.75rem), so it renders the same on the server.
package/dist/icons.svg CHANGED
@@ -62,6 +62,7 @@
62
62
  <symbol id="heart" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20s-8-4.6-8-10.2A4.3 4.3 0 0 1 12 7.4a4.3 4.3 0 0 1 8 2.4C20 15.4 12 20 12 20z"/></symbol>
63
63
  <symbol id="grid" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="6" height="6" rx="1"/><rect x="14" y="4" width="6" height="6" rx="1"/><rect x="4" y="14" width="6" height="6" rx="1"/><rect x="14" y="14" width="6" height="6" rx="1"/></symbol>
64
64
  <symbol id="list" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6h11M9 12h11M9 18h11"/><path d="M4.5 6h.01"/><path d="M4.5 12h.01"/><path d="M4.5 18h.01"/></symbol>
65
+ <symbol id="align-left" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h16M4 12h10M4 18h13"/></symbol>
65
66
  <symbol id="link" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1"/><path d="M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1"/></symbol>
66
67
  <symbol id="sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></symbol>
67
68
  <symbol id="moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z"/></symbol>