noph-ui 0.5.0 → 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 +1 -0
- package/dist/dialogs/index.d.ts +1 -0
- package/dist/dialogs/index.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/navigation-rail/NavigationAction.svelte +100 -0
- package/dist/navigation-rail/NavigationAction.svelte.d.ts +4 -0
- package/dist/navigation-rail/NavigationRail.svelte +23 -0
- package/dist/navigation-rail/NavigationRail.svelte.d.ts +4 -0
- package/dist/navigation-rail/index.d.ts +1 -0
- package/dist/navigation-rail/index.js +1 -0
- package/dist/navigation-rail/types.d.ts +15 -0
- package/dist/navigation-rail/types.js +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Dialog } from './Dialog.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Dialog } from './Dialog.svelte';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ export * from './button/index.js';
|
|
|
2
2
|
export * from './card/index.js';
|
|
3
3
|
export * from './checkbox/index.js';
|
|
4
4
|
export * from './chip/index.js';
|
|
5
|
+
export * from './dialogs/index.js';
|
|
5
6
|
export * from './divider/index.js';
|
|
6
7
|
export * from './list/index.js';
|
|
7
8
|
export * from './menu/index.js';
|
|
9
|
+
export * from './navigation-rail/index.js';
|
|
8
10
|
export * from './progress/index.js';
|
|
9
11
|
export * from './radio/index.js';
|
|
10
12
|
export * from './ripple/index.js';
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,11 @@ export * from './button/index.js';
|
|
|
2
2
|
export * from './card/index.js';
|
|
3
3
|
export * from './checkbox/index.js';
|
|
4
4
|
export * from './chip/index.js';
|
|
5
|
+
export * from './dialogs/index.js';
|
|
5
6
|
export * from './divider/index.js';
|
|
6
7
|
export * from './list/index.js';
|
|
7
8
|
export * from './menu/index.js';
|
|
9
|
+
export * from './navigation-rail/index.js';
|
|
8
10
|
export * from './progress/index.js';
|
|
9
11
|
export * from './radio/index.js';
|
|
10
12
|
export * from './ripple/index.js';
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements'
|
|
3
|
+
import type { NavigationAction } from './types.ts'
|
|
4
|
+
import Ripple from '../ripple/Ripple.svelte'
|
|
5
|
+
|
|
6
|
+
let { selected, icon, label, ...attributes }: NavigationAction = $props()
|
|
7
|
+
let touchEl: HTMLSpanElement | undefined = $state()
|
|
8
|
+
|
|
9
|
+
const isButton = (obj: unknown): obj is HTMLButtonAttributes => {
|
|
10
|
+
return (obj as HTMLAnchorAttributes).href === undefined
|
|
11
|
+
}
|
|
12
|
+
const isLink = (obj: unknown): obj is HTMLAnchorAttributes => {
|
|
13
|
+
return (obj as HTMLAnchorAttributes).href !== undefined
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
{#snippet content()}
|
|
18
|
+
<div class="np-navigation-action-icon">
|
|
19
|
+
<Ripple forElement={touchEl} />
|
|
20
|
+
{@render icon()}
|
|
21
|
+
</div>
|
|
22
|
+
<div class="np-navigation-action-label">{label}</div>
|
|
23
|
+
<span class="np-touch" bind:this={touchEl}></span>
|
|
24
|
+
{/snippet}
|
|
25
|
+
|
|
26
|
+
{#if isButton(attributes)}
|
|
27
|
+
<button
|
|
28
|
+
{...attributes as HTMLButtonAttributes}
|
|
29
|
+
class:np-navigation-action-selected={selected}
|
|
30
|
+
class="np-navigation-action {attributes.class}"
|
|
31
|
+
>
|
|
32
|
+
{@render content()}
|
|
33
|
+
</button>
|
|
34
|
+
{:else if isLink(attributes)}
|
|
35
|
+
<a {...attributes} class="np-navigation-action {attributes.class}">
|
|
36
|
+
{@render content()}
|
|
37
|
+
</a>
|
|
38
|
+
{/if}
|
|
39
|
+
|
|
40
|
+
<style>
|
|
41
|
+
.np-navigation-action {
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
border: 0;
|
|
44
|
+
background: none;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: 0.25rem;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
50
|
+
}
|
|
51
|
+
.np-navigation-action-icon {
|
|
52
|
+
position: relative;
|
|
53
|
+
color: var(--np-color-on-surface-variant);
|
|
54
|
+
display: flex;
|
|
55
|
+
border-radius: var(--np-shape-corner-full);
|
|
56
|
+
justify-content: center;
|
|
57
|
+
width: 3.5rem;
|
|
58
|
+
height: 2rem;
|
|
59
|
+
align-items: center;
|
|
60
|
+
}
|
|
61
|
+
.np-navigation-action-label {
|
|
62
|
+
font-size: 0.75rem;
|
|
63
|
+
line-height: 1rem;
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
transition: all;
|
|
66
|
+
color: var(--np-color-on-surface-variant);
|
|
67
|
+
}
|
|
68
|
+
.np-navigation-action-selected .np-navigation-action-icon {
|
|
69
|
+
color: var(--np-color-secondary-container);
|
|
70
|
+
--np-icon-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
71
|
+
}
|
|
72
|
+
.np-navigation-action-icon::before {
|
|
73
|
+
content: '';
|
|
74
|
+
position: absolute;
|
|
75
|
+
width: 100%;
|
|
76
|
+
height: 100%;
|
|
77
|
+
opacity: 0;
|
|
78
|
+
transform: scaleX(0.32);
|
|
79
|
+
transition-duration: 0.2s;
|
|
80
|
+
transition-property: transform, opacity;
|
|
81
|
+
transition-timing-function: linear;
|
|
82
|
+
background-color: var(--np-color-on-secondary-container);
|
|
83
|
+
border-radius: 100px;
|
|
84
|
+
z-index: -1;
|
|
85
|
+
}
|
|
86
|
+
.np-navigation-action-selected .np-navigation-action-icon::before {
|
|
87
|
+
opacity: 1;
|
|
88
|
+
transform: scaleX(1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.np-navigation-action-selected .np-navigation-action-label {
|
|
92
|
+
font-weight: 700;
|
|
93
|
+
color: var(--np-color-on-surface);
|
|
94
|
+
}
|
|
95
|
+
.np-touch {
|
|
96
|
+
height: 56px;
|
|
97
|
+
position: absolute;
|
|
98
|
+
width: 80px;
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { NavigationRail } from './types.ts'
|
|
3
|
+
|
|
4
|
+
let { children, ...attributes }: NavigationRail = $props()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<nav {...attributes} class="navigation-rail">
|
|
8
|
+
{#if children}
|
|
9
|
+
{@render children()}
|
|
10
|
+
{/if}
|
|
11
|
+
</nav>
|
|
12
|
+
|
|
13
|
+
<style>
|
|
14
|
+
.navigation-rail {
|
|
15
|
+
z-index: 8;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
width: 80px;
|
|
20
|
+
gap: 0.75rem;
|
|
21
|
+
background-color: var(--np-color-surface);
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NavigationRail } from './NavigationRail.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NavigationRail } from './NavigationRail.svelte';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
+
export type NavigationRail = HTMLAttributes<HTMLElement>;
|
|
4
|
+
interface NavigationActionButton extends HTMLButtonAttributes {
|
|
5
|
+
icon: Snippet;
|
|
6
|
+
label: string;
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface NavigationActionLink extends HTMLAnchorAttributes {
|
|
10
|
+
icon: Snippet;
|
|
11
|
+
label: string;
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type NavigationAction = NavigationActionButton | NavigationActionLink;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './chip/types.ts';
|
|
|
5
5
|
export * from './divider/types.js';
|
|
6
6
|
export * from './list/types.ts';
|
|
7
7
|
export * from './menu/types.ts';
|
|
8
|
+
export * from './navigation-rail/types.ts';
|
|
8
9
|
export * from './progress/types.js';
|
|
9
10
|
export * from './radio/types.ts';
|
|
10
11
|
export * from './ripple/types.ts';
|
package/dist/types.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from './chip/types.ts';
|
|
|
5
5
|
export * from './divider/types.js';
|
|
6
6
|
export * from './list/types.ts';
|
|
7
7
|
export * from './menu/types.ts';
|
|
8
|
+
export * from './navigation-rail/types.ts';
|
|
8
9
|
export * from './progress/types.js';
|
|
9
10
|
export * from './radio/types.ts';
|
|
10
11
|
export * from './ripple/types.ts';
|