@alexandregme/zljs 3.10.0 → 3.12.0

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/CHANGELOG.md CHANGED
@@ -8,6 +8,43 @@ A change that needs action in an app has a **Migration** note. When updating, re
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [3.11.0] - 2026-11-12
12
+
13
+ ### Added
14
+
15
+ - `TopNav`, the navigation of a small screen, where `Sidebar` doesn't fit: a bar at the top of the page with a menu button on the left, the home link in the middle and an account button on the right. The menu button opens the links, and the account button opens the name and the email of the user with the logout button. It takes the same `sections`, `user`, `activeHref`, `homeHref`, `homeLabel`, `navLabel`, `logout` and `onLogout` as `Sidebar`, and `menuLabel` and `accountLabel` name its two buttons
16
+ - The type `TopNavProps`
17
+ - `Navigation`, the navigation of an app from one set of values: it shows `Sidebar` on a screen from 768px wide and `TopNav` under that, follows the screen as it is resized, and renders only one of the two. It takes the props of both. `mode` is for an app made for one kind of screen: `desktop` always shows `Sidebar` and `mobile` always shows `TopNav`. The app places it: its wrapper is a row from 768px and a column under it
18
+ - The types `NavigationProps` and `NavigationMode`
19
+ - `useIsDesktop`, the hook `Navigation` decides with: `true` on a screen from 768px wide, the `md` breakpoint of Tailwind, and `false` under that. It follows the screen as it is resized or turned, and is `null` on the server, where there is no screen
20
+ - `aria-expanded` on `Button`, for a button that opens and closes something, such as a menu
21
+ - `onClick` on `Link`, called on a click, before the navigation, such as to close the menu the link is in
22
+ - `size` on `SignOutButton`, the size of the button: `lg` is for a touch screen
23
+ - `variant` on `Link`: `inline`, the default, is the link as it was, and `nav` is a row of a menu, 40px tall, with no underline and a translucent background on hover that works on a light or a dark surface
24
+ - `active` on `Link`, which marks the link to the current page with `aria-current="page"`, and gives a `nav` link a background
25
+ - `aria-label` on `Link`, the name of a link whose children have no text, such as only an icon
26
+ - The type `LinkVariant`
27
+ - `onSignOut` on `SignOutButton`: the app's own function, called when the user confirms in the modal, instead of the adapter of `AuthProvider`. With it the button needs no `AuthProvider`, so an app whose auth doesn't come from zljs can use it. A function that throws or rejects shows the `errorMessage` toast
28
+ - `logout` on `Sidebar`, the texts of its logout button and of the modal it opens: `label`, `confirmTitle`, `confirmLabel`, `cancelLabel` and `errorMessage`, all with English defaults
29
+ - `navLabel` and `expandLabel` on `Sidebar`, the accessible names of the navigation and of the collapse button while collapsed. They were fixed in English, and those are now the defaults: `Main navigation` and `Expand sidebar`
30
+
31
+ ### Changed
32
+
33
+ - The logout button of `Sidebar` is a `SignOutButton`. A click opens a modal that asks first, and `onLogout` is called only when the user confirms. `onLogout` may return a promise, and one that rejects shows an error toast, so the app needs a `Toaster`. The default name of the button is `Sign out`, it was `Logout`
34
+ - The links of `Sidebar` are `Link` with `variant="nav"`. Their text takes the color of the sidebar, also on hover and when active, where it was gray and turned white. Collapsed, the labels are no longer rendered, where they faded out, and each link keeps its name
35
+ - `SignOutButton` takes the color of the text around it, so it works on a dark surface. It was gray
36
+ - The collapse button of `Sidebar` always has an `aria-label`: `collapseLabel` while expanded, `expandLabel` while collapsed
37
+
38
+ #### Migration
39
+
40
+ - A test of the app that finds the logout button of `Sidebar` by the name `Logout`: the name is now `Sign out`, or what the app passes in `logout.label`. To keep the old name, pass `logout={{ label: "Logout" }}`
41
+ - A test that clicks the logout button and expects `onLogout` to be called: also click the confirm button of the modal, named `Sign out` by default
42
+ - An `onLogout` that asks for confirmation on its own, such as with `window.confirm`: remove the question, the modal already asks
43
+
44
+ ### Fixed
45
+
46
+ - `Sidebar` is as tall as the visible part of the screen (`100dvh`). It was `100vh`, which on a phone is taller than what the browser shows, so the collapse button ended up under the browser's bar
47
+
11
48
  ## [3.10.0] - 2026-11-12
12
49
 
13
50
  ### Added
@@ -479,7 +516,8 @@ Replace the shade with the class of the `color` being tested, for example `/(^|\
479
516
 
480
517
  The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
481
518
 
482
- [Unreleased]: https://github.com/alexandregme/zljs/compare/v3.10.0...HEAD
519
+ [Unreleased]: https://github.com/alexandregme/zljs/compare/v3.11.0...HEAD
520
+ [3.11.0]: https://github.com/alexandregme/zljs/compare/v3.10.0...v3.11.0
483
521
  [3.10.0]: https://github.com/alexandregme/zljs/compare/v3.9.0...v3.10.0
484
522
  [3.9.0]: https://github.com/alexandregme/zljs/compare/v3.8.0...v3.9.0
485
523
  [3.8.0]: https://github.com/alexandregme/zljs/compare/v3.7.0...v3.8.0