noph-ui 0.24.17 → 0.25.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/checkbox/Checkbox.svelte +36 -49
- package/dist/menu/Menu.svelte +20 -26
- package/dist/menu/types.d.ts +0 -1
- package/package.json +1 -1
|
@@ -8,21 +8,22 @@
|
|
|
8
8
|
element = $bindable(),
|
|
9
9
|
group = $bindable(),
|
|
10
10
|
style,
|
|
11
|
+
value,
|
|
11
12
|
...attributes
|
|
12
13
|
}: CheckboxProps = $props()
|
|
13
14
|
|
|
14
15
|
$effect(() => {
|
|
15
|
-
if (group &&
|
|
16
|
-
checked = group.includes(
|
|
16
|
+
if (group && value) {
|
|
17
|
+
checked = group.includes(value)
|
|
17
18
|
}
|
|
18
19
|
})
|
|
19
20
|
|
|
20
21
|
$effect(() => {
|
|
21
|
-
if (
|
|
22
|
-
const index = group.indexOf(
|
|
22
|
+
if (value && group) {
|
|
23
|
+
const index = group.indexOf(value)
|
|
23
24
|
if (checked) {
|
|
24
25
|
if (index < 0) {
|
|
25
|
-
group?.push(
|
|
26
|
+
group?.push(value)
|
|
26
27
|
group = group
|
|
27
28
|
}
|
|
28
29
|
} else {
|
|
@@ -36,59 +37,48 @@
|
|
|
36
37
|
let inputEl: HTMLInputElement | undefined = $state()
|
|
37
38
|
</script>
|
|
38
39
|
|
|
39
|
-
<div {style} class={['np-
|
|
40
|
-
<div class="np-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</label>
|
|
55
|
-
|
|
56
|
-
<div class="np-outline"></div>
|
|
57
|
-
<div class="np-background"></div>
|
|
58
|
-
<svg class="np-icon" viewBox="0 0 18 18" aria-hidden="true">
|
|
59
|
-
<rect class="mark short" />
|
|
60
|
-
<rect class="mark long" />
|
|
61
|
-
</svg>
|
|
40
|
+
<div {style} class={['np-container', attributes.class]} bind:this={element}>
|
|
41
|
+
<div class="np-input-wrapper">
|
|
42
|
+
{#if !attributes.disabled}
|
|
43
|
+
<Ripple forElement={inputEl} />
|
|
44
|
+
{/if}
|
|
45
|
+
<input
|
|
46
|
+
{...attributes}
|
|
47
|
+
{value}
|
|
48
|
+
class="np-input"
|
|
49
|
+
type="checkbox"
|
|
50
|
+
bind:indeterminate
|
|
51
|
+
bind:checked
|
|
52
|
+
bind:this={inputEl}
|
|
53
|
+
aria-checked={indeterminate ? 'mixed' : undefined}
|
|
54
|
+
/>
|
|
62
55
|
</div>
|
|
56
|
+
<div class="np-outline"></div>
|
|
57
|
+
<div class="np-background"></div>
|
|
58
|
+
<svg class="np-icon" viewBox="0 0 18 18" aria-hidden="true">
|
|
59
|
+
<rect class="mark short" />
|
|
60
|
+
<rect class="mark long" />
|
|
61
|
+
</svg>
|
|
63
62
|
</div>
|
|
64
63
|
|
|
65
64
|
<style>
|
|
66
|
-
.np-
|
|
67
|
-
border-
|
|
68
|
-
border-start-end-radius: var(--np-checkbox-container-shape, 2px);
|
|
69
|
-
border-end-end-radius: var(--np-checkbox-container-shape, 2px);
|
|
70
|
-
border-end-start-radius: var(--np-checkbox-container-shape, 2px);
|
|
65
|
+
.np-container {
|
|
66
|
+
border-radius: var(--np-checkbox-container-shape, 2px);
|
|
71
67
|
display: inline-flex;
|
|
68
|
+
place-content: center;
|
|
69
|
+
place-items: center;
|
|
70
|
+
position: relative;
|
|
72
71
|
height: 18px;
|
|
73
72
|
position: relative;
|
|
74
73
|
vertical-align: top;
|
|
75
74
|
width: 18px;
|
|
76
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
77
75
|
cursor: pointer;
|
|
76
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
78
77
|
margin: var(--np-checkbox-margin, max(0px, (48px - 18px)/2));
|
|
79
78
|
}
|
|
80
|
-
.np-
|
|
79
|
+
.np-container:has(input:disabled) {
|
|
81
80
|
cursor: default;
|
|
82
81
|
}
|
|
83
|
-
.np-container {
|
|
84
|
-
border-radius: inherit;
|
|
85
|
-
display: flex;
|
|
86
|
-
height: 100%;
|
|
87
|
-
place-content: center;
|
|
88
|
-
place-items: center;
|
|
89
|
-
position: relative;
|
|
90
|
-
width: 100%;
|
|
91
|
-
}
|
|
92
82
|
.np-input {
|
|
93
83
|
height: 48px;
|
|
94
84
|
width: 48px;
|
|
@@ -144,11 +134,8 @@
|
|
|
144
134
|
border-width: 2px;
|
|
145
135
|
box-sizing: border-box;
|
|
146
136
|
}
|
|
147
|
-
:
|
|
148
|
-
|
|
149
|
-
border-width: 2px;
|
|
150
|
-
}
|
|
151
|
-
:where(:focus-within) .np-outline {
|
|
137
|
+
.np-container:focus-within .np-outline,
|
|
138
|
+
.np-container:hover .np-outline {
|
|
152
139
|
border-color: var(--np-color-on-surface);
|
|
153
140
|
border-width: 2px;
|
|
154
141
|
}
|
package/dist/menu/Menu.svelte
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
showPopover = $bindable(),
|
|
9
9
|
hidePopover = $bindable(),
|
|
10
10
|
open = $bindable(),
|
|
11
|
-
quick = false,
|
|
12
11
|
style,
|
|
13
12
|
popover = 'auto',
|
|
14
13
|
anchor,
|
|
@@ -112,7 +111,7 @@
|
|
|
112
111
|
attributes.ontoggle?.(event)
|
|
113
112
|
}}
|
|
114
113
|
{popover}
|
|
115
|
-
class={['np-menu-container',
|
|
114
|
+
class={['np-menu-container', attributes.class]}
|
|
116
115
|
{style}
|
|
117
116
|
>
|
|
118
117
|
<div class="np-menu">
|
|
@@ -121,7 +120,18 @@
|
|
|
121
120
|
</div>
|
|
122
121
|
|
|
123
122
|
<style>
|
|
124
|
-
.np-menu
|
|
123
|
+
.np-menu {
|
|
124
|
+
overflow-y: auto;
|
|
125
|
+
overflow-x: hidden;
|
|
126
|
+
flex: 1;
|
|
127
|
+
padding: 0.5rem 0;
|
|
128
|
+
scrollbar-color: var(--np-color-on-surface-variant) transparent;
|
|
129
|
+
scrollbar-width: thin;
|
|
130
|
+
}
|
|
131
|
+
:global(.np-menu .np-divider) {
|
|
132
|
+
margin-block: 0.5rem;
|
|
133
|
+
}
|
|
134
|
+
.np-menu-container[popover] {
|
|
125
135
|
color: var(--np-menu-text-color, var(--np-color-on-surface));
|
|
126
136
|
background-color: var(--np-menu-container-color, var(--np-color-surface-container));
|
|
127
137
|
border: none;
|
|
@@ -130,37 +140,21 @@
|
|
|
130
140
|
box-shadow: var(--np-elevation-2);
|
|
131
141
|
margin: var(--np-menu-margin, 2px);
|
|
132
142
|
inset: auto;
|
|
133
|
-
|
|
134
|
-
|
|
143
|
+
transition:
|
|
144
|
+
display 0.2s allow-discrete,
|
|
145
|
+
opacity 0.2s linear;
|
|
146
|
+
opacity: 0;
|
|
135
147
|
justify-self: var(--np-menu-justify-self, anchor-center);
|
|
136
148
|
position-area: var(--np-menu-position-area, bottom center);
|
|
137
149
|
position-try: normal flip-block;
|
|
138
150
|
z-index: 1000;
|
|
139
151
|
}
|
|
140
152
|
|
|
141
|
-
.np-
|
|
153
|
+
.np-menu-container:popover-open {
|
|
142
154
|
opacity: 1;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
@keyframes fadeIn {
|
|
147
|
-
from {
|
|
155
|
+
display: flex;
|
|
156
|
+
@starting-style {
|
|
148
157
|
opacity: 0;
|
|
149
158
|
}
|
|
150
|
-
to {
|
|
151
|
-
opacity: 1;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.np-menu {
|
|
156
|
-
overflow-y: auto;
|
|
157
|
-
overflow-x: hidden;
|
|
158
|
-
flex: 1;
|
|
159
|
-
padding: 0.5rem 0;
|
|
160
|
-
scrollbar-color: var(--np-color-on-surface-variant) transparent;
|
|
161
|
-
scrollbar-width: thin;
|
|
162
|
-
}
|
|
163
|
-
:global(.np-menu .np-divider) {
|
|
164
|
-
margin-block: 0.5rem;
|
|
165
159
|
}
|
|
166
160
|
</style>
|
package/dist/menu/types.d.ts
CHANGED