@softwarity/rail-nav 1.0.1 → 1.0.2

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 (2) hide show
  1. package/README.md +47 -26
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -19,6 +19,15 @@ Material Design 3 Navigation Rail component for Angular. Extends Angular Materia
19
19
 
20
20
  **[Live Demo](https://softwarity.github.io/rail-nav/)**
21
21
 
22
+ <p align="center">
23
+ <a href="https://softwarity.github.io/rail-nav/">
24
+ <img src="assets/collapsed.png" alt="Rail Nav Collapsed" height="300">
25
+ </a>
26
+ <a href="https://softwarity.github.io/rail-nav/">
27
+ <img src="assets/expanded.png" alt="Rail Nav Expanded" height="300">
28
+ </a>
29
+ </p>
30
+
22
31
  ## Features
23
32
 
24
33
  - **Material Design 3** - Implements the Navigation Rail pattern from MD3
@@ -91,13 +100,11 @@ The main navigation rail component. Extends `MatSidenav`.
91
100
 
92
101
  | Input | Type | Default | Description |
93
102
  |-------|------|---------|-------------|
94
- | `collapsedWidth` | `number` | `72` | Width in pixels when collapsed (icon-only mode) |
95
- | `expandedWidth` | `number \| 'auto'` | `'auto'` | Width when expanded. Use `'auto'` for content-based width |
96
103
  | `position` | `'start' \| 'end'` | `'start'` | Position of the rail (left or right) |
97
104
  | `title` | `string` | - | Title displayed next to burger when expanded |
98
105
  | `subtitle` | `string` | - | Subtitle displayed below title when expanded |
99
- | `headerHeight` | `number` | `56` | Header height in pixels (to match toolbar) |
100
106
  | `hideDefaultHeader` | `boolean` | `false` | Hide the default header to provide custom content |
107
+ | `autoCollapse` | `boolean` | `true` | Auto-collapse the rail when an item is clicked |
101
108
 
102
109
  | Property/Method | Type | Description |
103
110
  |-----------------|------|-------------|
@@ -118,12 +125,7 @@ Container component. Extends `MatSidenavContainer`.
118
125
 
119
126
  Content area component. Extends `MatSidenavContent`.
120
127
 
121
- | Input | Type | Default | Description |
122
- |-------|------|---------|-------------|
123
- | `collapsedWidth` | `number` | `auto` | Width of collapsed rail. Auto-detected from sibling `rail-nav` if not set |
124
- | `position` | `'start' \| 'end'` | `auto` | Position of rail. Auto-detected from sibling `rail-nav` if not set |
125
-
126
- **Note:** Both inputs are optional. When placed inside a `rail-nav-container` alongside a `rail-nav`, the component automatically reads `collapsedWidth` and `position` from the sibling rail.
128
+ **Note:** When placed inside a `rail-nav-container` alongside a `rail-nav`, the component automatically detects the rail position and applies the correct margin using the `--rail-nav-collapsed-width` CSS variable.
127
129
 
128
130
  ### RailnavItemComponent
129
131
 
@@ -158,30 +160,49 @@ Use the SCSS mixin to customize colors following the Angular Material pattern:
158
160
 
159
161
  ### Available Tokens
160
162
 
161
- | Token | Description |
162
- |-------|-------------|
163
- | `backdrop-color` | Background color for the backdrop overlay |
164
- | `surface-color` | Background color for the rail |
165
- | `surface-container-high` | Background color for hover states |
166
- | `on-surface` | Text color for primary content |
167
- | `on-surface-variant` | Text color for secondary content |
168
- | `secondary-container` | Background color for active items |
169
- | `on-secondary-container` | Text color for active items |
170
- | `primary` | Focus ring color |
171
- | `error` | Badge background color |
172
- | `on-error` | Badge text color |
163
+ | Token | Default | Description |
164
+ |-------|---------|-------------|
165
+ | `collapsed-width` | `72px` | Width of the rail when collapsed |
166
+ | `expanded-width` | `fit-content` | Width of the rail when expanded |
167
+ | `header-height` | `56px` | Height of the header area |
168
+ | `backdrop-color` | - | Background color for the backdrop overlay |
169
+ | `surface-color` | - | Background color for the rail |
170
+ | `surface-container-high` | - | Background color for hover states |
171
+ | `on-surface` | - | Text color for primary content |
172
+ | `on-surface-variant` | - | Text color for secondary content |
173
+ | `secondary-container` | - | Background color for active items |
174
+ | `on-secondary-container` | - | Text color for active items |
175
+ | `primary` | - | Focus ring color |
176
+ | `error` | - | Badge background color |
177
+ | `on-error` | - | Badge text color |
173
178
 
174
179
  ## CSS Custom Properties
175
180
 
176
- You can also use CSS custom properties directly:
181
+ You can also use CSS custom properties directly.
182
+
183
+ ### Size Properties
177
184
 
178
185
  ```css
179
186
  :root {
180
- --rail-nav-backdrop-color: rgba(0, 0, 0, 0.5);
187
+ --rail-nav-collapsed-width: 72px;
188
+ --rail-nav-expanded-width: fit-content;
189
+ --rail-nav-header-height: 56px;
190
+ }
191
+ ```
192
+
193
+ ### Color Properties
194
+
195
+ Color properties support the CSS `light-dark()` function for automatic light/dark theme adaptation:
196
+
197
+ ```css
198
+ :root {
199
+ /* Static colors (single theme) */
181
200
  --rail-nav-surface-color: #ffffff;
182
- --rail-nav-on-surface: #1c1b1f;
183
201
  --rail-nav-primary: #6750a4;
184
- --rail-nav-error: #b3261e;
202
+
203
+ /* Or use light-dark() for automatic theme adaptation */
204
+ --rail-nav-surface-color: light-dark(#ffffff, #1e1e1e);
205
+ --rail-nav-primary: light-dark(#6750a4, #d0bcff);
185
206
  }
186
207
  ```
187
208
 
@@ -189,7 +210,7 @@ The component uses Material Design 3 system tokens (`--mat-sys-*`) as fallbacks.
189
210
 
190
211
  ## Light/Dark Theme Support
191
212
 
192
- Use the CSS `light-dark()` function to define colors that automatically adapt to the user's color scheme:
213
+ Use the CSS `light-dark()` function to define colors that automatically adapt to the user's color scheme. The first value is for light mode, the second for dark mode.
193
214
 
194
215
  ### With SCSS mixin
195
216
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwarity/rail-nav",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "author": "Softwarity",
5
5
  "license": "MIT",
6
6
  "description": "Angular Material Navigation Rail component - Material Design 3 compliant",