@noxlovette/material 0.1.37 → 0.2.1
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 {
|
|
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,10 +28,9 @@ 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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class: className
|
|
31
|
+
withNavbar = false,
|
|
32
|
+
class: className,
|
|
33
|
+
navbarProps
|
|
34
34
|
}: RailProps = $props();
|
|
35
35
|
|
|
36
36
|
const expanded = $derived(!collapsed);
|
|
@@ -99,34 +99,12 @@ On mobile (< md) it automatically renders as a bottom navigation bar.
|
|
|
99
99
|
</div>
|
|
100
100
|
|
|
101
101
|
<!-- Mobile bottom navbar (md:hidden) -->
|
|
102
|
-
{#if
|
|
103
|
-
{
|
|
104
|
-
<
|
|
105
|
-
{@render
|
|
106
|
-
</
|
|
107
|
-
|
|
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"
|
|
112
|
-
>
|
|
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>
|
|
102
|
+
{#if withNavbar}
|
|
103
|
+
<Navbar {...navbarProps}>
|
|
104
|
+
<RailNavContext mobile={true}>
|
|
105
|
+
{@render children?.()}
|
|
106
|
+
</RailNavContext>
|
|
107
|
+
</Navbar>
|
|
130
108
|
{/if}
|
|
131
109
|
|
|
132
110
|
<style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IconProps } from '../../../utils/index.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import type { NavBarProps } from '../navbar/types.js';
|
|
4
5
|
import type { RailItemVariants, RailVariants } from './theme.js';
|
|
5
6
|
/**
|
|
6
7
|
* Props for the RailItem component.
|
|
@@ -43,10 +44,8 @@ export type RailProps = RailVariants & HTMLAttributes<HTMLDivElement> & {
|
|
|
43
44
|
anchor?: RailVariants['anchor'];
|
|
44
45
|
/** Top offset in px for viewport/parent anchor (e.g. height of a top bar). Default 0. */
|
|
45
46
|
railTop?: number;
|
|
46
|
-
/** Render a bottom navbar on mobile
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
/** Show the railFooter slot inside the mobile navbar. Default false. */
|
|
51
|
-
showMobileFooter?: boolean;
|
|
47
|
+
/** Render a bottom navbar on mobile. */
|
|
48
|
+
withNavbar?: boolean;
|
|
49
|
+
/** Customise the navbar inside the rail */
|
|
50
|
+
navbarProps?: NavBarProps;
|
|
52
51
|
};
|