@loomidev/bottom-nav 0.4.1 → 0.6.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/README.md +16 -18
- package/dist/generated/styles.css.js +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @loomidev/bottom-nav
|
|
2
2
|
|
|
3
|
-
`<loomi-bottom-nav>` and `<loomi-bottom-nav-item>`
|
|
3
|
+
`<loomi-bottom-nav>` and `<loomi-bottom-nav-item>` - a mobile bottom navigation bar with
|
|
4
4
|
icons, labels, badges, eight active-state styles, and a routing-agnostic click event so
|
|
5
5
|
any router (or plain `<a>` links) can drive it.
|
|
6
6
|
|
|
@@ -24,14 +24,13 @@ import "@loomidev/bottom-nav";
|
|
|
24
24
|
|
|
25
25
|
The bar's own bottom padding (or, in `floating` mode, its distance from the viewport edge)
|
|
26
26
|
accounts for `env(safe-area-inset-bottom)`, so it clears the home indicator on notched
|
|
27
|
-
phones automatically
|
|
27
|
+
phones automatically - no extra configuration needed.
|
|
28
28
|
|
|
29
29
|
## Flexible navigation
|
|
30
30
|
|
|
31
31
|
Each item decides how it navigates from the attributes you give it:
|
|
32
32
|
|
|
33
|
-
- **`href` set** → renders a real `<a>`. Native/SPA-router links, Laravel routes, anchors
|
|
34
|
-
all just work, including `target="_blank"` (always preserved — never intercepted).
|
|
33
|
+
- **`href` set** → renders a real `<a>`. Native/SPA-router links, Laravel routes, anchors - all just work, including `target="_blank"` (always preserved - never intercepted).
|
|
35
34
|
- **`href` omitted** → renders a `<button>`. Use this when a JS router owns navigation
|
|
36
35
|
entirely; the item still needs a `value` (or `name`) to identify itself.
|
|
37
36
|
- **Either way**, clicking always fires `loomi-change` on the parent, so a client-side
|
|
@@ -50,7 +49,7 @@ document.querySelector("loomi-bottom-nav").addEventListener("loomi-change", (eve
|
|
|
50
49
|
<loomi-bottom-nav-item value="orders" href="/orders" prevent-default>Orders</loomi-bottom-nav-item>
|
|
51
50
|
```
|
|
52
51
|
|
|
53
|
-
`active` on the parent is the controlled identifier
|
|
52
|
+
`active` on the parent is the controlled identifier - set it from your router (e.g. on
|
|
54
53
|
every route change) and the matching item recomputes its active state. Clicking an
|
|
55
54
|
(enabled) item also updates `active` locally first, for immediate visual feedback, before
|
|
56
55
|
`loomi-change` reaches your listener.
|
|
@@ -121,12 +120,11 @@ that one:
|
|
|
121
120
|
## Accessibility
|
|
122
121
|
|
|
123
122
|
`<loomi-bottom-nav>` renders a real `<nav>` landmark (`label` sets its `aria-label`,
|
|
124
|
-
default `"Primary"`). Each item renders a real `<a>` (when `href` is set) or `<button>`
|
|
125
|
-
never a clickable `<div>` — so screen readers and keyboard users get native semantics for
|
|
123
|
+
default `"Primary"`). Each item renders a real `<a>` (when `href` is set) or `<button>` - never a clickable `<div>` - so screen readers and keyboard users get native semantics for
|
|
126
124
|
free. The active item gets `aria-current="page"`.
|
|
127
125
|
|
|
128
126
|
- `Tab` / `Shift+Tab` reach every item in document order, like any row of links/buttons.
|
|
129
|
-
- `←`/`→` (or `↑`/`↓`) move focus between items without navigating
|
|
127
|
+
- `←`/`→` (or `↑`/`↓`) move focus between items without navigating - manual activation,
|
|
130
128
|
per the WAI-ARIA APG toolbar pattern, so arrowing through never triggers a page navigation
|
|
131
129
|
by accident. `Home`/`End` jump to the first/last enabled item. `Enter`/`Space` (or a
|
|
132
130
|
click) activate the focused item natively.
|
|
@@ -134,7 +132,7 @@ free. The active item gets `aria-current="page"`.
|
|
|
134
132
|
tab order (`tabindex="-1"` for links, native `disabled` for buttons).
|
|
135
133
|
- Focus is visible via `:focus-visible`, ringed with the component's accent color.
|
|
136
134
|
|
|
137
|
-
For the library-wide baseline, see [Foundations
|
|
135
|
+
For the library-wide baseline, see [Foundations - Accessibility](https://loomiui.com/foundations/#accessibility).
|
|
138
136
|
|
|
139
137
|
## Responsive behavior
|
|
140
138
|
|
|
@@ -142,10 +140,10 @@ Designed for mobile: `<loomi-bottom-nav>` docks itself with `position: fixed` at
|
|
|
142
140
|
viewport bottom (or floats, see `variant` below) so you don't need any wrapping layout.
|
|
143
141
|
Set `mobile-only` to hide it automatically at tablet width and up (768px), the common
|
|
144
142
|
pattern where a sidebar or top nav takes over on larger screens. Items share the available
|
|
145
|
-
width equally (`flex: 1`) and truncate long labels rather than wrapping
|
|
146
|
-
3
|
|
143
|
+
width equally (`flex: 1`) and truncate long labels rather than wrapping - designed for
|
|
144
|
+
3-5 items.
|
|
147
145
|
|
|
148
|
-
For the shared container and viewport rules, see [Foundations
|
|
146
|
+
For the shared container and viewport rules, see [Foundations - Responsive behavior](https://loomiui.com/foundations/#responsive-behavior).
|
|
149
147
|
|
|
150
148
|
## Dark mode
|
|
151
149
|
|
|
@@ -155,21 +153,21 @@ with `.dark` on `<html>` (via `@loomidev/theme-switcher` or your own theme toggl
|
|
|
155
153
|
active-state tokens (see **Styling hooks** below) default to the instance's `color`
|
|
156
154
|
accent, which is also dark-mode aware.
|
|
157
155
|
|
|
158
|
-
For theme activation, token overrides, and contrast guidance, see [Foundations
|
|
156
|
+
For theme activation, token overrides, and contrast guidance, see [Foundations - Dark mode](https://loomiui.com/foundations/#dark-mode).
|
|
159
157
|
|
|
160
|
-
## Attributes
|
|
158
|
+
## Attributes - `<loomi-bottom-nav>`
|
|
161
159
|
|
|
162
160
|
| Attribute | Default | Description |
|
|
163
161
|
| -------------- | ----------- | ----------------------------------------------------------------------------------------------------- |
|
|
164
|
-
| `active` | _(blank)_ | The active item's `value`/`name`. Controlled
|
|
162
|
+
| `active` | _(blank)_ | The active item's `value`/`name`. Controlled - set it from your router. |
|
|
165
163
|
| `active-style` | `pill` | `pill` \| `underline` \| `top-line` \| `background` \| `icon-only` \| `dot` \| `border` \| `minimal`. |
|
|
166
164
|
| `variant` | `fixed` | `fixed` (edge-to-edge dock) \| `floating` (rounded, elevated island). |
|
|
167
165
|
| `color` | `primary` | Accent for the active item's color/background/border/dot. Any loomi color. |
|
|
168
|
-
| `icon-source` | `heroicons` | Default icon set for every item
|
|
166
|
+
| `icon-source` | `heroicons` | Default icon set for every item - see `<loomi-icon>`'s `source`. |
|
|
169
167
|
| `label` | `Primary` | `aria-label` for the `<nav>` landmark. |
|
|
170
168
|
| `mobile-only` | `false` | Hides the bar at 768px and up. _(boolean)_ |
|
|
171
169
|
|
|
172
|
-
## Attributes
|
|
170
|
+
## Attributes - `<loomi-bottom-nav-item>`
|
|
173
171
|
|
|
174
172
|
| Attribute | Default | Description |
|
|
175
173
|
| ----------------- | --------- | --------------------------------------------------------------------------------------------- |
|
|
@@ -195,7 +193,7 @@ For theme activation, token overrides, and contrast guidance, see [Foundations
|
|
|
195
193
|
|
|
196
194
|
| Event | Detail |
|
|
197
195
|
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
198
|
-
| `loomi-change` | `{ item, value, name, href }`. Fired by the clicked item, bubbles through the parent. Cancelable
|
|
196
|
+
| `loomi-change` | `{ item, value, name, href }`. Fired by the clicked item, bubbles through the parent. Cancelable - `event.preventDefault()` suppresses real anchor navigation for that click. |
|
|
199
197
|
|
|
200
198
|
## Parts
|
|
201
199
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by @loomidev/bottom-nav — do not edit by hand. Run `pnpm build` to regenerate.
|
|
2
2
|
import { unsafeCSS } from "lit";
|
|
3
3
|
/** Compiled, Shadow-DOM-scoped styles. Colors resolve via `var(--loomi-*)`. */
|
|
4
|
-
export const componentStyles = unsafeCSS("/*! tailwindcss v4.3.
|
|
4
|
+
export const componentStyles = unsafeCSS("/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer theme,base,components,utilities;:host(loomi-bottom-nav){z-index:40;-webkit-tap-highlight-color:transparent;display:block;position:fixed;bottom:0;left:0;right:0}:host(loomi-bottom-nav[hidden]){display:none}:host(loomi-bottom-nav[variant=floating]){left:50%;right:auto;bottom:max(.75rem, calc(env(safe-area-inset-bottom,0px) + .5rem));width:min(30rem,100% - 2rem);transform:translate(-50%)}@media (min-width:768px){:host(loomi-bottom-nav[mobile-only]){display:none}}.loomi-bnav{box-sizing:border-box;background:var(--loomi-surface);align-items:stretch;width:100%;height:4rem;display:flex}:host([variant=fixed]) .loomi-bnav{border-top:1px solid var(--loomi-surface-border);padding-bottom:env(safe-area-inset-bottom,0px)}:host([variant=floating]) .loomi-bnav{border:1px solid var(--loomi-surface-border);border-radius:1.25rem;overflow:hidden;box-shadow:0 10px 30px -12px #0f172a47}:host(loomi-bottom-nav-item){flex:1 1 0;min-width:0;display:flex}:host(loomi-bottom-nav-item[hidden]){display:none}.loomi-bnavi-link{width:100%;min-width:0;color:var(--loomi-text-muted);text-align:center;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;background:0 0;border:none;flex-direction:column;justify-content:center;align-items:center;gap:.2rem;padding:.375rem .25rem;font-family:inherit;font-size:.6875rem;font-weight:500;line-height:1;text-decoration:none;transition:background-color .15s,color .15s,border-color .15s;display:flex;position:relative}.loomi-bnavi-link:hover{color:var(--loomi-text)}.loomi-bnavi-link:focus{outline:none}.loomi-bnavi-link:focus-visible{box-shadow:inset 0 0 0 2px var(--_loomi-accent-ring);outline:none}:host(loomi-bottom-nav-item[disabled]) .loomi-bnavi-link{opacity:.5;cursor:not-allowed;pointer-events:none}.loomi-bnavi-icon-wrap{display:inline-flex;position:relative}.loomi-bnavi-icon{color:inherit;flex:none}.loomi-bnavi-label{text-overflow:ellipsis;white-space:nowrap;max-width:100%;overflow:hidden}.loomi-bnavi-badge{box-sizing:border-box;background:var(--loomi-bottom-nav-badge-bg,var(--loomi-error-600,#dc2626));min-width:1rem;height:1rem;color:var(--loomi-bottom-nav-badge-color,var(--loomi-white));box-shadow:0 0 0 2px var(--loomi-surface);text-align:center;border-radius:999px;padding:0 .25rem;font-size:.625rem;font-weight:600;line-height:1rem;position:absolute;top:-.3rem;right:-.5rem}.loomi-bnavi-indicator{display:none}:host([active][active-style=pill]) .loomi-bnavi-link{background:var(--loomi-bottom-nav-active-bg,var(--_loomi-accent-soft));color:var(--loomi-bottom-nav-active-color,var(--_loomi-accent-fg));border-radius:var(--loomi-bottom-nav-active-radius,999px)}:host([active][active-style=background]) .loomi-bnavi-link{background:var(--loomi-bottom-nav-active-bg,var(--_loomi-accent-soft));color:var(--loomi-bottom-nav-active-color,var(--_loomi-accent-fg));border-radius:.75rem}:host([active][active-style=border]) .loomi-bnavi-link{color:var(--loomi-bottom-nav-active-color,var(--_loomi-accent-fg));border:1.5px solid var(--loomi-bottom-nav-active-border,var(--_loomi-accent));border-radius:var(--loomi-bottom-nav-active-radius,999px)}:host([active][active-style=icon-only]) .loomi-bnavi-icon,:host([active][active-style=minimal]) .loomi-bnavi-link,:host([active][active-style=underline]) .loomi-bnavi-link,:host([active][active-style=top-line]) .loomi-bnavi-link,:host([active][active-style=dot]) .loomi-bnavi-link{color:var(--loomi-bottom-nav-active-color,var(--_loomi-accent-fg))}:host([active][active-style=underline]) .loomi-bnavi-indicator{background:var(--loomi-bottom-nav-active-border,var(--_loomi-accent));border-radius:999px 999px 0 0;width:1.5rem;height:3px;display:block;position:absolute;bottom:0;left:50%;transform:translate(-50%)}:host([active][active-style=top-line]) .loomi-bnavi-indicator{background:var(--loomi-bottom-nav-active-border,var(--_loomi-accent));border-radius:0 0 999px 999px;width:1.5rem;height:3px;display:block;position:absolute;top:0;left:50%;transform:translate(-50%)}:host([active][active-style=dot]) .loomi-bnavi-indicator{width:var(--loomi-bottom-nav-active-dot-size,6px);height:var(--loomi-bottom-nav-active-dot-size,6px);background:var(--loomi-bottom-nav-active-border,var(--_loomi-accent));border-radius:50%;display:block;position:absolute;bottom:0;left:50%;transform:translate(-50%)}");
|
|
5
5
|
//# sourceMappingURL=styles.css.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomidev/bottom-nav",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "<loomi-bottom-nav>/<loomi-bottom-nav-item> — a mobile bottom navigation bar with badges, active-state styles, and framework-agnostic routing.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@loomidev/core": "^0.
|
|
34
|
-
"@loomidev/icon": "^0.
|
|
35
|
-
"@loomidev/icons": "^0.
|
|
33
|
+
"@loomidev/core": "^0.6.0",
|
|
34
|
+
"@loomidev/icon": "^0.6.0",
|
|
35
|
+
"@loomidev/icons": "^0.6.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"lit": "^3.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@tailwindcss/cli": "^4.
|
|
41
|
+
"@tailwindcss/cli": "^4.3.3",
|
|
42
42
|
"lit": "^3.3.3",
|
|
43
|
-
"tailwindcss": "^4.
|
|
43
|
+
"tailwindcss": "^4.3.3",
|
|
44
44
|
"typescript": "^5.6.3",
|
|
45
|
-
"@loomidev/theme": "^0.
|
|
45
|
+
"@loomidev/theme": "^0.6.0"
|
|
46
46
|
},
|
|
47
47
|
"keywords": [
|
|
48
48
|
"web-components",
|