noph-ui 0.10.0 → 0.10.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.
|
@@ -73,23 +73,18 @@
|
|
|
73
73
|
opacity: 0;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
.np-dialog::backdrop {
|
|
76
|
+
.np-dialog[popover]::backdrop {
|
|
77
77
|
background-color: var(--np-color-scrim);
|
|
78
78
|
opacity: 0;
|
|
79
|
-
transition:
|
|
80
|
-
display 0.2s allow-discrete,
|
|
81
|
-
overlay 0.2s allow-discrete,
|
|
82
|
-
opacity 0.2s linear;
|
|
79
|
+
transition: opacity 0.2s linear;
|
|
83
80
|
}
|
|
84
|
-
.np-dialog:popover-open::backdrop {
|
|
81
|
+
.np-dialog[popover]:popover-open::backdrop {
|
|
85
82
|
opacity: 0.38;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
@starting-style {
|
|
89
|
-
.np-dialog:popover-open::backdrop {
|
|
83
|
+
@starting-style {
|
|
90
84
|
opacity: 0;
|
|
91
85
|
}
|
|
92
86
|
}
|
|
87
|
+
|
|
93
88
|
.np-dialog-icon {
|
|
94
89
|
color: var(--np-color-secondary);
|
|
95
90
|
display: flex;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './dialog/index.js';
|
|
|
6
6
|
export * from './divider/index.js';
|
|
7
7
|
export * from './list/index.js';
|
|
8
8
|
export * from './menu/index.js';
|
|
9
|
+
export * from './navigation-drawer/index.js';
|
|
9
10
|
export * from './navigation-rail/index.js';
|
|
10
11
|
export * from './progress/index.js';
|
|
11
12
|
export * from './radio/index.js';
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from './dialog/index.js';
|
|
|
6
6
|
export * from './divider/index.js';
|
|
7
7
|
export * from './list/index.js';
|
|
8
8
|
export * from './menu/index.js';
|
|
9
|
+
export * from './navigation-drawer/index.js';
|
|
9
10
|
export * from './navigation-rail/index.js';
|
|
10
11
|
export * from './progress/index.js';
|
|
11
12
|
export * from './radio/index.js';
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
modal = false,
|
|
5
5
|
backdrop = false,
|
|
6
6
|
element = $bindable(),
|
|
7
|
+
popover,
|
|
7
8
|
children,
|
|
8
9
|
...attributes
|
|
9
10
|
}: NavigationDrawerProps = $props()
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
<nav
|
|
13
14
|
{...attributes}
|
|
14
15
|
bind:this={element}
|
|
16
|
+
popover={modal ? popover || 'auto' : undefined}
|
|
15
17
|
class={[
|
|
16
18
|
'np-navigation-drawer-container',
|
|
17
19
|
modal && 'np-navigation-drawer-shade',
|
|
@@ -19,38 +21,53 @@
|
|
|
19
21
|
attributes.class,
|
|
20
22
|
]}
|
|
21
23
|
>
|
|
22
|
-
<div class="np-navigation-
|
|
23
|
-
|
|
24
|
-
{
|
|
25
|
-
|
|
24
|
+
<div class="np-navigation-wrapper">
|
|
25
|
+
<div class="np-navigation-drawer">
|
|
26
|
+
{#if children}
|
|
27
|
+
{@render children()}
|
|
28
|
+
{/if}
|
|
29
|
+
</div>
|
|
26
30
|
</div>
|
|
27
31
|
</nav>
|
|
28
32
|
|
|
29
33
|
<style>
|
|
30
34
|
.np-navigation-drawer-container {
|
|
31
|
-
background-color: var(--np-navigation-drawer-background, var(--np-color-surface-container-low));
|
|
32
35
|
color: var(--np-color-on-surface-variant);
|
|
33
36
|
border-top-right-radius: var(--np-shape-corner-large);
|
|
34
37
|
border-bottom-right-radius: var(--np-shape-corner-large);
|
|
35
|
-
|
|
36
|
-
width: var(--np-navigation-drawer-width, 22.5rem);
|
|
38
|
+
overflow: hidden;
|
|
37
39
|
scrollbar-width: thin;
|
|
38
40
|
overflow-y: auto;
|
|
39
41
|
border: 0;
|
|
40
42
|
margin: 0;
|
|
41
43
|
padding: 0;
|
|
44
|
+
background-color: transparent;
|
|
45
|
+
}
|
|
46
|
+
.np-navigation-wrapper {
|
|
47
|
+
background-color: var(--np-navigation-drawer-background, var(--np-color-surface-container-low));
|
|
48
|
+
width: var(--np-navigation-drawer-width, 22.5rem);
|
|
49
|
+
height: var(--np-navigation-drawer-height, 100dvh);
|
|
50
|
+
overflow-y: auto;
|
|
42
51
|
}
|
|
43
|
-
|
|
44
52
|
.np-navigation-drawer-container[popover] {
|
|
45
|
-
|
|
46
|
-
transition-timing-function: ease-in;
|
|
53
|
+
width: 0;
|
|
47
54
|
transition:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
transform: translateX(-100%);
|
|
55
|
+
overlay 0.2s allow-discrete,
|
|
56
|
+
display 0.2s allow-discrete,
|
|
57
|
+
width 0.2s ease-in;
|
|
52
58
|
}
|
|
53
59
|
.np-navigation-drawer-container:popover-open {
|
|
60
|
+
width: var(--np-navigation-drawer-width, 22.5rem);
|
|
61
|
+
@starting-style {
|
|
62
|
+
width: 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.np-navigation-drawer-container[popover] .np-navigation-wrapper {
|
|
67
|
+
transform: translateX(-100%);
|
|
68
|
+
transition: transform 0.2s ease-in;
|
|
69
|
+
}
|
|
70
|
+
.np-navigation-drawer-container:popover-open .np-navigation-wrapper {
|
|
54
71
|
transform: translateX(0);
|
|
55
72
|
@starting-style {
|
|
56
73
|
transform: translateX(-100%);
|
|
@@ -63,20 +80,16 @@
|
|
|
63
80
|
}
|
|
64
81
|
.np-navigation-drawer-shade {
|
|
65
82
|
box-shadow: var(--np-elevation-1);
|
|
83
|
+
z-index: 100;
|
|
66
84
|
}
|
|
67
|
-
.np-navigation-drawer-backdrop::backdrop {
|
|
85
|
+
.np-navigation-drawer-backdrop[popover]::backdrop {
|
|
68
86
|
background-color: var(--np-color-scrim);
|
|
69
87
|
opacity: 0;
|
|
70
|
-
transition:
|
|
71
|
-
display 0.3s allow-discrete,
|
|
72
|
-
overlay 0.3s allow-discrete,
|
|
73
|
-
opacity 0.3s linear;
|
|
88
|
+
transition: opacity 0.2s linear;
|
|
74
89
|
}
|
|
75
|
-
.np-navigation-drawer-backdrop:popover-open::backdrop {
|
|
90
|
+
.np-navigation-drawer-backdrop[popover]:popover-open::backdrop {
|
|
76
91
|
opacity: 0.38;
|
|
77
|
-
|
|
78
|
-
@starting-style {
|
|
79
|
-
.np-navigation-drawer-backdrop:popover-open::backdrop {
|
|
92
|
+
@starting-style {
|
|
80
93
|
opacity: 0;
|
|
81
94
|
}
|
|
82
95
|
}
|
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
anchor = (document.querySelector(`[aria-describedby="${id}"]`) as HTMLElement) ?? undefined
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
const isTouch = (event: PointerEvent) => {
|
|
42
|
+
return event.pointerType === 'touch'
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
$effect(() => {
|
|
42
46
|
if (anchor && element) {
|
|
43
47
|
if ('anchorName' in document.documentElement.style) {
|
|
@@ -48,15 +52,21 @@
|
|
|
48
52
|
anchor.style.setProperty('anchor-name', generatedId)
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
|
-
anchor.addEventListener('
|
|
52
|
-
|
|
55
|
+
anchor.addEventListener('pointerenter', (event: PointerEvent) => {
|
|
56
|
+
if (!isTouch(event)) {
|
|
57
|
+
element?.showPopover()
|
|
58
|
+
}
|
|
53
59
|
})
|
|
54
|
-
anchor.addEventListener('
|
|
55
|
-
|
|
60
|
+
anchor.addEventListener('pointerleave', (event: PointerEvent) => {
|
|
61
|
+
if (!isTouch(event)) {
|
|
62
|
+
element?.hidePopover()
|
|
63
|
+
}
|
|
56
64
|
})
|
|
57
65
|
if (!keepTooltipOnClick) {
|
|
58
|
-
anchor.addEventListener('
|
|
59
|
-
|
|
66
|
+
anchor.addEventListener('pointerup', (event: PointerEvent) => {
|
|
67
|
+
if (!isTouch(event)) {
|
|
68
|
+
element?.hidePopover()
|
|
69
|
+
}
|
|
60
70
|
})
|
|
61
71
|
}
|
|
62
72
|
}
|