@noxlovette/material 0.1.37 → 0.2.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.
@@ -15,7 +15,14 @@ This component takes NavbarItems as its children
15
15
  import { navbar } from './theme.js';
16
16
  import type { NavBarProps } from './types.js';
17
17
 
18
- const { children, fab, ghost = false, class: className, ...restProps }: NavBarProps = $props();
18
+ const {
19
+ children,
20
+ fab,
21
+ trailing,
22
+ ghost = false,
23
+ class: className,
24
+ ...restProps
25
+ }: NavBarProps = $props();
19
26
  const { base, items, fab: fabCls, ghost: ghostCls } = $derived(navbar());
20
27
  </script>
21
28
 
@@ -36,6 +43,11 @@ This component takes NavbarItems as its children
36
43
  {/snippet}
37
44
  </NavigationMenu.List>
38
45
  </NavigationMenu.Root>
46
+ {#if trailing}
47
+ <div class="shrink-0 px-2">
48
+ {@render trailing()}
49
+ </div>
50
+ {/if}
39
51
  </div>
40
52
  {#if ghost}
41
53
  <div class={ghostCls()} aria-hidden="true"></div>
@@ -28,6 +28,8 @@ export type NavBarProps = NavBarVariants & HTMLAttributes<HTMLDivElement> & {
28
28
  children: Snippet;
29
29
  /** An optional Floating Action Button snippet. */
30
30
  fab?: Snippet;
31
+ /** An optional snippet rendered after the nav items (e.g. an avatar/settings shortcut). */
32
+ trailing?: Snippet;
31
33
  /** Renders an invisible same-height spacer after the fixed bar so page content isn't obscured. */
32
34
  ghost?: boolean;
33
35
  };
@@ -17,6 +17,7 @@ On mobile (< md) it automatically renders as a bottom navigation bar.
17
17
  import { NavigationMenu } from 'bits-ui';
18
18
  import { railStore } from './railStore.svelte.js';
19
19
  import RailNavContext from './RailNavContext.svelte';
20
+ import Navbar from '../navbar/Navbar.svelte';
20
21
 
21
22
  let {
22
23
  children,
@@ -27,7 +28,7 @@ On mobile (< md) it automatically renders as a bottom navigation bar.
27
28
  collapsed = $bindable(true),
28
29
  anchor = 'viewport',
29
30
  railTop = 0,
30
- mobileNav = true,
31
+ withNavbar = false,
31
32
  showMobileFab = true,
32
33
  showMobileFooter = false,
33
34
  class: className
@@ -99,34 +100,16 @@ On mobile (< md) it automatically renders as a bottom navigation bar.
99
100
  </div>
100
101
 
101
102
  <!-- Mobile bottom navbar (md:hidden) -->
102
- {#if mobileNav}
103
- {#if showMobileFab && fab}
104
- <div class="fixed right-4 bottom-24 z-30 md:hidden">
105
- {@render fab?.()}
106
- </div>
107
- {/if}
108
-
109
- <nav
110
- class="bg-md-sys-color-surface-container shadow-elevation-2 fixed right-0 bottom-0 left-0 z-20 flex h-20 items-center py-3 md:hidden"
111
- aria-label="Mobile navigation"
103
+ {#if withNavbar}
104
+ <Navbar
105
+ fab={showMobileFab ? fab : undefined}
106
+ trailing={showMobileFooter ? railFooter : undefined}
107
+ ghost
112
108
  >
113
- <NavigationMenu.Root orientation="horizontal" class="flex w-full">
114
- <NavigationMenu.List class="flex w-full justify-around">
115
- <RailNavContext mobile={true}>
116
- {@render children?.()}
117
- </RailNavContext>
118
- </NavigationMenu.List>
119
- </NavigationMenu.Root>
120
-
121
- {#if showMobileFooter && railFooter}
122
- <div class="shrink-0 px-2">
123
- {@render railFooter()}
124
- </div>
125
- {/if}
126
- </nav>
127
-
128
- <!-- Spacer so page content clears the fixed mobile navbar -->
129
- <div class="h-20 w-full shrink-0 md:hidden" aria-hidden="true"></div>
109
+ <RailNavContext mobile={true}>
110
+ {@render children?.()}
111
+ </RailNavContext>
112
+ </Navbar>
130
113
  {/if}
131
114
 
132
115
  <style>
@@ -43,8 +43,8 @@ export type RailProps = RailVariants & HTMLAttributes<HTMLDivElement> & {
43
43
  anchor?: RailVariants['anchor'];
44
44
  /** Top offset in px for viewport/parent anchor (e.g. height of a top bar). Default 0. */
45
45
  railTop?: number;
46
- /** Render a bottom navbar on mobile (< md). Default true. */
47
- mobileNav?: boolean;
46
+ /** Render a bottom navbar on mobile (< md). Default false — opt in, since consumers may render their own mobile nav. */
47
+ withNavbar?: boolean;
48
48
  /** Show the fab slot above the mobile navbar. Default true. */
49
49
  showMobileFab?: boolean;
50
50
  /** Show the railFooter slot inside the mobile navbar. Default false. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxlovette/material",
3
- "version": "0.1.37",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {