noph-ui 0.9.16 → 0.10.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/dist/button/SegmentedButton.svelte +2 -2
- package/dist/checkbox/Checkbox.svelte +2 -2
- package/dist/navigation-drawer/NavigationDrawer.svelte +83 -0
- package/dist/navigation-drawer/NavigationDrawer.svelte.d.ts +4 -0
- package/dist/navigation-drawer/NavigationDrawerItem.svelte +144 -0
- package/dist/navigation-drawer/NavigationDrawerItem.svelte.d.ts +4 -0
- package/dist/navigation-drawer/index.d.ts +2 -0
- package/dist/navigation-drawer/index.js +2 -0
- package/dist/navigation-drawer/types.d.ts +21 -0
- package/dist/navigation-drawer/types.js +1 -0
- package/dist/navigation-rail/{NavigationAction.svelte → NavigationRailItem.svelte} +3 -2
- package/dist/navigation-rail/NavigationRailItem.svelte.d.ts +4 -0
- package/dist/navigation-rail/index.d.ts +1 -1
- package/dist/navigation-rail/index.js +1 -1
- package/dist/navigation-rail/types.d.ts +3 -3
- package/dist/radio/Radio.svelte +1 -1
- package/dist/themes/defaultTheme.css +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/package.json +8 -8
- package/dist/navigation-rail/NavigationAction.svelte.d.ts +0 -4
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
{#if !option.disabled}
|
|
45
45
|
<Ripple forceHover={i === hoverState} />
|
|
46
46
|
{/if}
|
|
47
|
-
{#if group}
|
|
47
|
+
{#if group !== undefined}
|
|
48
48
|
{#if multiSelect}
|
|
49
49
|
<input
|
|
50
50
|
type="checkbox"
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
display: grid;
|
|
103
103
|
color: var(--np-color-on-surface);
|
|
104
104
|
border: 1px solid var(--np-color-outline);
|
|
105
|
-
border-radius:
|
|
105
|
+
border-radius: var(--np-shape-corner-full);
|
|
106
106
|
overflow-x: auto;
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<div {style} class={['np-host', attributes.class]} bind:this={element}>
|
|
16
16
|
<div class="np-container">
|
|
17
17
|
<label class="np-input-wrapper">
|
|
18
|
-
{#if group}
|
|
18
|
+
{#if group !== undefined}
|
|
19
19
|
<input
|
|
20
20
|
{...attributes}
|
|
21
21
|
class="np-input"
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
position: absolute;
|
|
90
90
|
width: 48px;
|
|
91
91
|
z-index: 1;
|
|
92
|
-
border-radius: var(--np-shape-corner-
|
|
92
|
+
border-radius: var(--np-shape-corner-full);
|
|
93
93
|
cursor: inherit;
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { NavigationDrawerProps } from './types.ts'
|
|
3
|
+
let {
|
|
4
|
+
modal = false,
|
|
5
|
+
backdrop = false,
|
|
6
|
+
element = $bindable(),
|
|
7
|
+
children,
|
|
8
|
+
...attributes
|
|
9
|
+
}: NavigationDrawerProps = $props()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<nav
|
|
13
|
+
{...attributes}
|
|
14
|
+
bind:this={element}
|
|
15
|
+
class={[
|
|
16
|
+
'np-navigation-drawer-container',
|
|
17
|
+
modal && 'np-navigation-drawer-shade',
|
|
18
|
+
backdrop && 'np-navigation-drawer-backdrop',
|
|
19
|
+
attributes.class,
|
|
20
|
+
]}
|
|
21
|
+
>
|
|
22
|
+
<div class="np-navigation-drawer">
|
|
23
|
+
{#if children}
|
|
24
|
+
{@render children()}
|
|
25
|
+
{/if}
|
|
26
|
+
</div>
|
|
27
|
+
</nav>
|
|
28
|
+
|
|
29
|
+
<style>
|
|
30
|
+
.np-navigation-drawer-container {
|
|
31
|
+
background-color: var(--np-navigation-drawer-background, var(--np-color-surface-container-low));
|
|
32
|
+
color: var(--np-color-on-surface-variant);
|
|
33
|
+
border-top-right-radius: var(--np-shape-corner-large);
|
|
34
|
+
border-bottom-right-radius: var(--np-shape-corner-large);
|
|
35
|
+
height: var(--np-navigation-drawer-height, 100dvh);
|
|
36
|
+
width: var(--np-navigation-drawer-width, 22.5rem);
|
|
37
|
+
scrollbar-width: thin;
|
|
38
|
+
overflow-y: auto;
|
|
39
|
+
border: 0;
|
|
40
|
+
margin: 0;
|
|
41
|
+
padding: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.np-navigation-drawer-container[popover] {
|
|
45
|
+
transition-property: transform;
|
|
46
|
+
transition-timing-function: ease-in;
|
|
47
|
+
transition:
|
|
48
|
+
transform 0.3s,
|
|
49
|
+
overlay 0.3s allow-discrete,
|
|
50
|
+
display 0.3s allow-discrete;
|
|
51
|
+
transform: translateX(-100%);
|
|
52
|
+
}
|
|
53
|
+
.np-navigation-drawer-container:popover-open {
|
|
54
|
+
transform: translateX(0);
|
|
55
|
+
@starting-style {
|
|
56
|
+
transform: translateX(-100%);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
.np-navigation-drawer {
|
|
60
|
+
display: flex;
|
|
61
|
+
padding: 0.75rem;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
}
|
|
64
|
+
.np-navigation-drawer-shade {
|
|
65
|
+
box-shadow: var(--np-elevation-1);
|
|
66
|
+
}
|
|
67
|
+
.np-navigation-drawer-backdrop::backdrop {
|
|
68
|
+
background-color: var(--np-color-scrim);
|
|
69
|
+
opacity: 0;
|
|
70
|
+
transition:
|
|
71
|
+
display 0.3s allow-discrete,
|
|
72
|
+
overlay 0.3s allow-discrete,
|
|
73
|
+
opacity 0.3s linear;
|
|
74
|
+
}
|
|
75
|
+
.np-navigation-drawer-backdrop:popover-open::backdrop {
|
|
76
|
+
opacity: 0.38;
|
|
77
|
+
}
|
|
78
|
+
@starting-style {
|
|
79
|
+
.np-navigation-drawer-backdrop:popover-open::backdrop {
|
|
80
|
+
opacity: 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
</style>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements'
|
|
3
|
+
import type { NavigationDrawerItemProps } from './types.ts'
|
|
4
|
+
import Ripple from '../ripple/Ripple.svelte'
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
selected = false,
|
|
8
|
+
label,
|
|
9
|
+
badgeLabelText,
|
|
10
|
+
icon,
|
|
11
|
+
...attributes
|
|
12
|
+
}: NavigationDrawerItemProps = $props()
|
|
13
|
+
|
|
14
|
+
const isButton = (obj: unknown): obj is HTMLButtonAttributes => {
|
|
15
|
+
return (obj as HTMLAnchorAttributes).href === undefined
|
|
16
|
+
}
|
|
17
|
+
const isLink = (obj: unknown): obj is HTMLAnchorAttributes => {
|
|
18
|
+
return (obj as HTMLAnchorAttributes).href !== undefined
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
{#snippet content()}
|
|
23
|
+
<Ripple />
|
|
24
|
+
<div class="np-navigation-drawer-item-icon">
|
|
25
|
+
{#if icon}
|
|
26
|
+
{@render icon()}
|
|
27
|
+
{/if}
|
|
28
|
+
</div>
|
|
29
|
+
<div class="np-navigation-drawer-item-label">{label}</div>
|
|
30
|
+
<div class="np-navigation-drawer-item-badge">{badgeLabelText}</div>
|
|
31
|
+
{/snippet}
|
|
32
|
+
|
|
33
|
+
{#if isButton(attributes)}
|
|
34
|
+
<button
|
|
35
|
+
{...attributes as HTMLButtonAttributes}
|
|
36
|
+
class:np-navigation-drawer-item-selected={selected}
|
|
37
|
+
class="np-navigation-drawer-item {attributes.class}"
|
|
38
|
+
>
|
|
39
|
+
{@render content()}
|
|
40
|
+
</button>
|
|
41
|
+
{:else if isLink(attributes)}
|
|
42
|
+
<a
|
|
43
|
+
{...attributes}
|
|
44
|
+
class:np-navigation-drawer-item-selected={selected}
|
|
45
|
+
class="np-navigation-drawer-item {attributes.class}"
|
|
46
|
+
>
|
|
47
|
+
{@render content()}
|
|
48
|
+
</a>
|
|
49
|
+
{/if}
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
.np-navigation-drawer-item {
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
border: 0;
|
|
55
|
+
background: none;
|
|
56
|
+
align-items: center;
|
|
57
|
+
gap: 0.75rem;
|
|
58
|
+
height: 3.5rem;
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
position: relative;
|
|
61
|
+
padding: 0 1.5rem 0 1rem;
|
|
62
|
+
border-radius: var(--np-navigation-drawer-item-container-shape, var(--np-shape-corner-full));
|
|
63
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
64
|
+
z-index: 1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.np-navigation-drawer-item::before {
|
|
68
|
+
content: '';
|
|
69
|
+
position: absolute;
|
|
70
|
+
left: 0;
|
|
71
|
+
width: 100%;
|
|
72
|
+
height: 100%;
|
|
73
|
+
opacity: 0;
|
|
74
|
+
transform: scaleX(0.32);
|
|
75
|
+
transition-duration: 0.2s;
|
|
76
|
+
transition-property: transform, opacity;
|
|
77
|
+
transition-timing-function: linear;
|
|
78
|
+
background-color: var(--np-color-secondary-container);
|
|
79
|
+
border-radius: var(--np-shape-corner-full);
|
|
80
|
+
z-index: -1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.np-navigation-drawer-item-selected.np-navigation-drawer-item::before {
|
|
84
|
+
opacity: 1;
|
|
85
|
+
transform: scaleX(1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.np-navigation-drawer-item:focus-visible {
|
|
89
|
+
outline-style: solid;
|
|
90
|
+
outline-color: var(--np-color-primary);
|
|
91
|
+
outline-width: 3px;
|
|
92
|
+
outline-offset: -3px;
|
|
93
|
+
animation: focusAnimation 0.3s ease forwards;
|
|
94
|
+
}
|
|
95
|
+
@keyframes focusAnimation {
|
|
96
|
+
0% {
|
|
97
|
+
outline-offset: -3px;
|
|
98
|
+
outline-width: 3px;
|
|
99
|
+
}
|
|
100
|
+
50% {
|
|
101
|
+
outline-offset: -6px;
|
|
102
|
+
outline-width: 6px;
|
|
103
|
+
}
|
|
104
|
+
100% {
|
|
105
|
+
outline-offset: -3px;
|
|
106
|
+
outline-width: 3px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
.np-navigation-drawer-item-icon {
|
|
110
|
+
color: var(--np-color-on-surface-variant);
|
|
111
|
+
display: flex;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
align-items: center;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.np-navigation-drawer-item-selected .np-navigation-drawer-item-icon {
|
|
117
|
+
color: var(--np-color-on-secondary-container);
|
|
118
|
+
--np-icon-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.np-navigation-drawer-item-label {
|
|
122
|
+
font-size: var(--np-navigation-drawer-font-size, 0.875rem);
|
|
123
|
+
line-height: 1.25rem;
|
|
124
|
+
font-weight: 500;
|
|
125
|
+
flex: 1;
|
|
126
|
+
text-align: left;
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
text-overflow: ellipsis;
|
|
129
|
+
text-wrap: nowrap;
|
|
130
|
+
color: var(--np-color-on-surface-variant);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.np-navigation-drawer-item-selected .np-navigation-drawer-item-label {
|
|
134
|
+
font-weight: 700;
|
|
135
|
+
color: var(--np-color-on-secondary-container);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.np-navigation-drawer-item-badge {
|
|
139
|
+
font-size: 0.875rem;
|
|
140
|
+
line-height: 1.25rem;
|
|
141
|
+
font-weight: 500;
|
|
142
|
+
color: var(--np-color-on-surface-variant);
|
|
143
|
+
}
|
|
144
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
+
export interface NavigationDrawerProps extends HTMLAttributes<HTMLElement> {
|
|
4
|
+
modal?: boolean;
|
|
5
|
+
backdrop?: boolean;
|
|
6
|
+
element?: HTMLElement;
|
|
7
|
+
}
|
|
8
|
+
interface NavigationDrawerItemButton extends HTMLButtonAttributes {
|
|
9
|
+
icon?: Snippet;
|
|
10
|
+
label: string;
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
badgeLabelText?: string;
|
|
13
|
+
}
|
|
14
|
+
interface NavigationDrawerItemLink extends HTMLAnchorAttributes {
|
|
15
|
+
icon?: Snippet;
|
|
16
|
+
label: string;
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
badgeLabelText?: string;
|
|
19
|
+
}
|
|
20
|
+
export type NavigationDrawerItemProps = NavigationDrawerItemButton | NavigationDrawerItemLink;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements'
|
|
3
|
-
import type {
|
|
3
|
+
import type { NavigationRailItemProps } from './types.ts'
|
|
4
4
|
import Ripple from '../ripple/Ripple.svelte'
|
|
5
5
|
|
|
6
|
-
let { selected, icon, label, ...attributes }:
|
|
6
|
+
let { selected, icon, label, ...attributes }: NavigationRailItemProps = $props()
|
|
7
7
|
let touchEl: HTMLSpanElement | undefined = $state()
|
|
8
8
|
|
|
9
9
|
const isButton = (obj: unknown): obj is HTMLButtonAttributes => {
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
width: 3.5rem;
|
|
81
81
|
height: 2rem;
|
|
82
82
|
align-items: center;
|
|
83
|
+
z-index: 1;
|
|
83
84
|
}
|
|
84
85
|
.np-navigation-action-label {
|
|
85
86
|
font-size: 0.75rem;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as NavigationRail } from './NavigationRail.svelte';
|
|
2
|
-
export { default as
|
|
2
|
+
export { default as NavigationRailItem } from './NavigationRailItem.svelte';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as NavigationRail } from './NavigationRail.svelte';
|
|
2
|
-
export { default as
|
|
2
|
+
export { default as NavigationRailItem } from './NavigationRailItem.svelte';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
3
3
|
export type NavigationRailProps = HTMLAttributes<HTMLElement>;
|
|
4
|
-
interface
|
|
4
|
+
interface NavigationRailItemButton extends HTMLButtonAttributes {
|
|
5
5
|
icon: Snippet;
|
|
6
6
|
label: string;
|
|
7
7
|
selected?: boolean;
|
|
8
8
|
}
|
|
9
|
-
interface
|
|
9
|
+
interface NavigationRailItemLink extends HTMLAnchorAttributes {
|
|
10
10
|
icon: Snippet;
|
|
11
11
|
label: string;
|
|
12
12
|
selected?: boolean;
|
|
13
13
|
}
|
|
14
|
-
export type
|
|
14
|
+
export type NavigationRailItemProps = NavigationRailItemButton | NavigationRailItemLink;
|
|
15
15
|
export {};
|
package/dist/radio/Radio.svelte
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<label {style} class={['np-host', attributes.class]} bind:this={element}>
|
|
18
|
-
{#if group}
|
|
18
|
+
{#if group !== undefined}
|
|
19
19
|
<input {...attributes} type="radio" class="np-input" {checked} {defaultChecked} bind:group />
|
|
20
20
|
{:else}
|
|
21
21
|
<input {...attributes} type="radio" class="np-input" {checked} {defaultChecked} />
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
--np-shape-corner-full: 9999px;
|
|
65
65
|
--np-shape-corner-extra-small: 0.25rem;
|
|
66
66
|
--np-shape-corner-medium: 0.75rem;
|
|
67
|
-
--np-shape-corner-large:
|
|
67
|
+
--np-shape-corner-large: 1rem;
|
|
68
68
|
--np-shape-corner-extra-large: 1.75rem;
|
|
69
69
|
--np-shape-corner-none: 0;
|
|
70
70
|
}
|
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-drawer/types.ts';
|
|
8
9
|
export * from './navigation-rail/types.ts';
|
|
9
10
|
export * from './progress/types.js';
|
|
10
11
|
export * from './radio/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-drawer/types.ts';
|
|
8
9
|
export * from './navigation-rail/types.ts';
|
|
9
10
|
export * from './progress/types.js';
|
|
10
11
|
export * from './radio/types.ts';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "noph-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://noph.dev",
|
|
6
6
|
"repository": {
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@material/material-color-utilities": "^0.3.0",
|
|
56
56
|
"@playwright/test": "^1.49.1",
|
|
57
|
-
"@sveltejs/adapter-vercel": "^5.5.
|
|
58
|
-
"@sveltejs/kit": "^2.
|
|
59
|
-
"@sveltejs/package": "^2.3.
|
|
57
|
+
"@sveltejs/adapter-vercel": "^5.5.3",
|
|
58
|
+
"@sveltejs/kit": "^2.16.1",
|
|
59
|
+
"@sveltejs/package": "^2.3.8",
|
|
60
60
|
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
61
61
|
"@types/eslint": "^9.6.1",
|
|
62
62
|
"eslint": "^9.18.0",
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"prettier": "^3.4.2",
|
|
67
67
|
"prettier-plugin-svelte": "^3.3.3",
|
|
68
68
|
"publint": "^0.3.2",
|
|
69
|
-
"svelte": "^5.
|
|
69
|
+
"svelte": "^5.19.1",
|
|
70
70
|
"svelte-check": "^4.1.4",
|
|
71
71
|
"typescript": "^5.7.3",
|
|
72
|
-
"typescript-eslint": "^8.
|
|
73
|
-
"vite": "^6.0.
|
|
74
|
-
"vitest": "^
|
|
72
|
+
"typescript-eslint": "^8.21.0",
|
|
73
|
+
"vite": "^6.0.11",
|
|
74
|
+
"vitest": "^3.0.3"
|
|
75
75
|
},
|
|
76
76
|
"svelte": "./dist/index.js",
|
|
77
77
|
"types": "./dist/index.d.ts",
|