natura11y 4.2.2 → 5.0.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +206 -0
  2. package/README.md +2 -2
  3. package/dist/natura11y.css +1 -1
  4. package/dist/natura11y.js +1 -1
  5. package/package.json +2 -2
  6. package/src/index.js +11 -3
  7. package/src/js/accordion.js +13 -32
  8. package/src/js/alert.js +11 -30
  9. package/src/js/collapse.js +98 -73
  10. package/src/js/{navigation.js → dropdown.js} +91 -53
  11. package/src/js/flyout.js +169 -0
  12. package/src/js/lightbox.js +29 -9
  13. package/src/js/main-menu.js +31 -0
  14. package/src/js/modal.js +9 -1
  15. package/src/js/track.js +4 -30
  16. package/src/js/utilities/focus.js +17 -10
  17. package/src/js/utilities/overlay.js +2 -2
  18. package/src/scss/_accordion.scss +53 -15
  19. package/src/scss/_alert.scss +59 -55
  20. package/src/scss/_assistive.scss +4 -1
  21. package/src/scss/_backdrop.scss +2 -4
  22. package/src/scss/_badge.scss +86 -0
  23. package/src/scss/_border.scss +2 -3
  24. package/src/scss/_breadcrumb.scss +60 -0
  25. package/src/scss/_button.scss +4 -3
  26. package/src/scss/_caret.scss +46 -0
  27. package/src/scss/_collapse.scss +113 -7
  28. package/src/scss/_container.scss +13 -17
  29. package/src/scss/_document.scss +9 -1
  30. package/src/scss/_dropdown.scss +232 -0
  31. package/src/scss/_flyout.scss +197 -0
  32. package/src/scss/_form.scss +9 -5
  33. package/src/scss/_grid.scss +5 -1
  34. package/src/scss/_lightbox.scss +100 -20
  35. package/src/scss/_main-menu.scss +475 -0
  36. package/src/scss/_modal.scss +77 -28
  37. package/src/scss/_navigation.scss +67 -758
  38. package/src/scss/_nested-nav.scss +117 -0
  39. package/src/scss/_pagination.scss +88 -0
  40. package/src/scss/_shadow.scss +38 -2
  41. package/src/scss/_table.scss +2 -3
  42. package/src/scss/_track.scss +59 -61
  43. package/src/scss/_typography.scss +10 -4
  44. package/src/scss/index.scss +7 -1
  45. package/.claude/settings.local.json +0 -13
  46. package/src/scss/_article.scss +0 -99
package/CHANGELOG.md ADDED
@@ -0,0 +1,206 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ---
6
+
7
+ ## [5.0.0] — 2026-03-09
8
+
9
+ ### New Components
10
+
11
+ #### Badge
12
+ - New component: `_badge.scss`
13
+ - Class: `.badge`
14
+ - CSS variables: `--badge-font-size`, `--badge-padding-x`, `--badge-padding-y`, `--badge-border-radius`
15
+
16
+ #### Nested Nav
17
+ - New component: `_nested-nav.scss`
18
+ - Class: `.nested-nav`
19
+ - Supports up to three levels of indented navigation with bordered structure and active indicator bar
20
+ - CSS variables: `--nav-nested-padding-x`, `--nav-nested-padding-y`, `--nav-nested-parent-font-size`, `--nav-nested-child-font-size`, `--nav-nested-indicator-width`, `--nav-nested-indicator-color`
21
+
22
+ ---
23
+
24
+ ### Templates
25
+
26
+ - Added landing page template
27
+ - Added two-column layout template
28
+ - Added three-column layout template
29
+ - Added form page template
30
+
31
+ ---
32
+
33
+ ### Bug Fixes & Polish
34
+
35
+ - Fixed CSS variable name: `--nav-nested-decendent-font-size` → `--nav-nested-child-font-size`
36
+ - `package.json` `main` field updated to point to `dist/natura11y.js`
37
+
38
+ ---
39
+
40
+ ## [5.0.0-alpha.1] — 2026-03-05
41
+
42
+ ### New Components
43
+
44
+ #### Flyout
45
+ - Full-height overlay panel that slides in from the side
46
+ - Supports simple nav or drill-down panel navigation for multi-level menus
47
+ - New files: `flyout.js`, `_flyout.scss`
48
+ - Trigger: `data-open="flyout"` on a button with `aria-controls` pointing to the flyout ID
49
+ - Internal controls: `data-flyout-close`, `data-flyout-back`, `data-flyout-next`
50
+ - `inert` is managed by JS — do not add it manually
51
+
52
+ #### Pagination
53
+ - New component: `_pagination.scss`
54
+ - Class: `.pagination`
55
+ - `[aria-current="page"]` receives a subtle fill background automatically
56
+ - CSS variables: `--pagination-font-size`, `--pagination-item-size`, `--pagination-border-radius`
57
+
58
+ #### Breadcrumb
59
+ - Separated from `_navigation.scss` into its own partial: `_breadcrumb.scss`
60
+ - **Class renamed:** `.nav-breadcrumb` → `.breadcrumb`
61
+ - CSS variable: `--breadcrumb-font-size`
62
+
63
+ ---
64
+
65
+ ### New Utilities
66
+
67
+ #### Drop Shadow
68
+ - New utility classes: `.drop-shadow-1`, `.drop-shadow-2`, `.drop-shadow-3` with responsive modifiers `--{bp}`
69
+ - Uses CSS `filter: drop-shadow()` — works with transparent and cutout shapes, unlike `box-shadow`
70
+ - Includes a Safari/Firefox `translateZ(0)` workaround
71
+
72
+ #### Container Breakpoint Modifiers
73
+ - `.container` now supports responsive modifiers: `.container--{bp}`
74
+ - Defers container padding and centering until a specific breakpoint
75
+
76
+ ---
77
+
78
+ ### Breaking Changes
79
+
80
+ #### `Navigation` class removed
81
+
82
+ The `Navigation` class (`navigation.js`), which handled `primary-nav` dropdown behavior, has been removed and replaced by two dedicated classes:
83
+
84
+ - `Dropdown` (`dropdown.js`) — handles dropdown and mega menu behavior
85
+ - `MainMenu` (`main-menu.js`) — handles the global site header navigation
86
+
87
+ `Flyout` (`flyout.js`) is a brand new class for the off-canvas panel component and is unrelated to this change.
88
+
89
+ #### `primary-nav` is now the `Main Menu` component
90
+
91
+ What was previously `primary-nav` is now a fully named component: **Main Menu**. All classes, CSS variables, and the dedicated JS class reflect this.
92
+
93
+ | v4 | v5 |
94
+ |---|---|
95
+ | `primary-nav--inline--{bp}` | `main-menu--bar--{bp}` |
96
+ | `primary-nav--below--{bp}` | `main-menu--stack--{bp}` |
97
+ | `primary-nav__logo` | `main-menu__logo` |
98
+ | `primary-nav__menu` | `main-menu__nav` |
99
+ | `primary-nav__toggle` | `main-menu__toggle` |
100
+ | `primary-nav__search` | `main-menu__search` |
101
+ | `primary-nav__actions` | `main-menu__actions` |
102
+ | `mobile-menu-toggle` *(extra class on toggle buttons)* | removed |
103
+ | `--primary-nav-padding-x` | `--main-menu-padding-x` |
104
+ | `--primary-nav-padding-y` | `--main-menu-padding-y` |
105
+
106
+ #### `nav__dropdown` renamed to `dropdown__menu`
107
+ Any element previously using `.nav__dropdown` must be updated to `.dropdown__menu`.
108
+
109
+ #### `.nav-breadcrumb` renamed to `.breadcrumb`
110
+
111
+ #### `.nav--has-icons` removed
112
+ Icon styles are now applied automatically when nav items contain icon elements — no modifier class required. Also: `.nav__text` → `.text` (generic text wrapper class).
113
+
114
+ #### Navigation SCSS restructured
115
+ `_navigation.scss` was significantly reduced. Styles have moved to dedicated component partials:
116
+ - `_main-menu.scss` — global site header (the renamed `primary-nav`)
117
+ - `_dropdown.scss` — dropdown menus, mega menus, `nav-dropdown`, `nav-link-dropdown`
118
+ - `_breadcrumb.scss` — breadcrumb (new dedicated partial)
119
+ - `_pagination.scss` — pagination (new dedicated partial)
120
+ - `_flyout.scss` — off-canvas panel (new component)
121
+
122
+ ---
123
+
124
+ ### Dropdown Updates
125
+
126
+ - `.nav-dropdown` — new component wrapper class for dropdown trigger buttons
127
+ - `.nav-link-dropdown` — updated; inner `.text` element now uses `.link-expanded` automatically
128
+ - `.dropdown__menu` — renamed from `.nav__dropdown`; now sets explicit `background-color: var(--background-color)`
129
+ - Indicator icon (caret) now uses an icon font character via CSS `::after` pseudo-element
130
+ - `[data-toggle="dropdown"][aria-expanded="true"]::after` rotates the indicator 180deg
131
+
132
+ ---
133
+
134
+ ### Accessibility Improvements
135
+
136
+ #### `inert` attribute adoption
137
+ Replaced `aria-hidden` + manual `tabindex` management with the native `inert` attribute across all interactive components:
138
+ - **Accordion** — panels use `inert` instead of `aria-hidden` + tabindex manipulation
139
+ - **Modal** — all modals initialized with `inert`; toggled on open/close
140
+ - **Collapse** — `inert` set at init only when the element is not already visible; `ResizeObserver` handles responsive transitions
141
+ - **Lightbox** — replaced `aria-hidden`/`aria-live` with `inert` + CSS `.shown` class
142
+
143
+ #### Focus utility (`focus.js`)
144
+ - `getFocusableElements` now filters out elements inside `[inert]` and `[hidden]` ancestors
145
+ - `focusTrap` queries focusable elements dynamically — respects `inert`/`hidden` state changes during flyout panel navigation
146
+ - Focus trap no longer overwrites `tabindex` on natively focusable elements
147
+ - Optional chaining on first/last element to prevent null errors
148
+
149
+ #### Track component
150
+ - `scroll-behavior: smooth` is now always on by default
151
+ - Previous approach was inverted (opt-in via `no-preference`) — corrected per WCAG motion guidance
152
+
153
+ ---
154
+
155
+ ### Component Enhancements
156
+
157
+ #### Accordion
158
+ - New CSS variable: `--accordion-animation-duration` (default `0.3s`)
159
+ - Separate asymmetric enter/exit durations (exit is 0.75x, enter is 1x)
160
+ - Uses logical properties: `padding-block` (was `padding-top`/`padding-bottom`)
161
+
162
+ #### Collapse
163
+ - Full rewrite
164
+ - `data-focus-first` attribute: focuses the first focusable element on open
165
+ - Keyboard activation (`event.detail === 0`) focuses the panel with `tabIndex = -1`
166
+ - Escape key closes the panel and returns focus to the trigger
167
+ - `data-target-close`: close a sibling collapse when opening this one
168
+ - CSS: `grid-template-rows: 0fr → 1fr` as fallback; `@supports (interpolate-size)` uses `height: 0 → auto`
169
+ - New CSS variable: `--collapse-animation-duration`
170
+ - `interpolate-size: allow-keywords` on `:root` enables `height: auto` animation
171
+
172
+ #### Modal
173
+ - New enter/exit animation variables:
174
+ - `--modal-animation-duration` (default `0.35s`)
175
+ - `--modal-animation-scale` (default `0.85`; set to `1` to disable scale)
176
+ - `--modal-animation-translate-y` (default `2rem`)
177
+
178
+ #### Lightbox
179
+ - New slide direction animation on prev/next (`data-entering="next|prev"` on container)
180
+ - New open/close animation variables:
181
+ - `--lightbox-animation-duration` (default `0.35s`)
182
+ - `--lightbox-animation-translate-x` (default `2rem`)
183
+ - Overlay fades in/out separately from content
184
+ - DOM removal now waits for `transitionend` for a clean exit animation
185
+
186
+ ---
187
+
188
+ ### `prefers-reduced-motion` Support
189
+
190
+ All animations and transitions now explicitly respect `prefers-reduced-motion: reduce`:
191
+
192
+ | Component | What is disabled |
193
+ |---|---|
194
+ | Track | `scroll-behavior` set to `auto` |
195
+ | Modal | All transitions |
196
+ | Lightbox | All transitions; DOM element removed immediately |
197
+ | Collapse | All transitions; `data-active` removed immediately |
198
+ | Accordion | All transitions |
199
+ | Flyout | All transitions and panel animations |
200
+ | Alert | `.dismissed` fade-out animation |
201
+ | Form | Toggle switch slider transition |
202
+ | Document | `--html-scroll-behavior` set to `auto` (disables smooth page scrolling) |
203
+
204
+ ---
205
+
206
+ *Previous public release: [4.2.2](https://github.com/cavidano/natura11y/releases/tag/v4.2.2)*
package/README.md CHANGED
@@ -16,11 +16,11 @@ Natura11y Icons:
16
16
 
17
17
  Natura11y Stylesheet:
18
18
 
19
- `https://cdn.jsdelivr.net/gh/cavidano/natura11y@4.0/dist/css/natura11y.min.css`
19
+ `https://cdn.jsdelivr.net/npm/natura11y@5.0.0-alpha.1/dist/natura11y.min.css`
20
20
 
21
21
  Natura11y JS:
22
22
 
23
- `https://cdn.jsdelivr.net/gh/cavidano/natura11y@4.0/dist/js/natura11y.min.js`
23
+ `https://cdn.jsdelivr.net/npm/natura11y@5.0.0-alpha.1/dist/natura11y.min.js`
24
24
 
25
25
  ---
26
26