noph-ui 0.32.6 → 0.32.8
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/badge/Badge.svelte +1 -0
- package/dist/card/Card.svelte +8 -12
- package/dist/chip/FilterChip.svelte +8 -19
- package/dist/chip/InputChip.svelte +0 -11
- package/dist/dialog/Dialog.svelte +1 -1
- package/dist/menu/Menu.svelte +3 -14
- package/dist/navigation-rail/NavigationRailItem.svelte +2 -0
- package/dist/ripple/Ripple.svelte +19 -29
- package/dist/tooltip/Tooltip.svelte +11 -16
- package/package.json +10 -10
package/dist/badge/Badge.svelte
CHANGED
package/dist/card/Card.svelte
CHANGED
|
@@ -21,16 +21,15 @@
|
|
|
21
21
|
let focused = $state(false)
|
|
22
22
|
|
|
23
23
|
$effect(() => {
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
if (!element) return
|
|
25
|
+
// eslint-disable-next-line no-undef
|
|
26
|
+
const formElements: NodeListOf<
|
|
27
|
+
HTMLButtonElement | HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
|
|
28
|
+
> = element.querySelectorAll('input, button, select, textarea')
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
30
|
+
formElements.forEach((el) => {
|
|
31
|
+
el.disabled = disabled
|
|
32
|
+
})
|
|
34
33
|
})
|
|
35
34
|
</script>
|
|
36
35
|
|
|
@@ -167,7 +166,6 @@
|
|
|
167
166
|
}
|
|
168
167
|
.np-card-container {
|
|
169
168
|
font: inherit;
|
|
170
|
-
box-sizing: border-box;
|
|
171
169
|
text-align: start;
|
|
172
170
|
display: inline-flex;
|
|
173
171
|
flex-direction: column;
|
|
@@ -210,10 +208,8 @@
|
|
|
210
208
|
width: 100%;
|
|
211
209
|
height: 200px;
|
|
212
210
|
overflow: hidden;
|
|
213
|
-
justify-content: center;
|
|
214
211
|
background-size: cover;
|
|
215
212
|
background-position: 50%;
|
|
216
|
-
align-items: center;
|
|
217
213
|
border-radius: var(--border-radius);
|
|
218
214
|
}
|
|
219
215
|
.np-card-content {
|
|
@@ -25,25 +25,14 @@
|
|
|
25
25
|
let chipLabel: HTMLLabelElement | undefined = $state()
|
|
26
26
|
|
|
27
27
|
$effect(() => {
|
|
28
|
-
if (group
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
if (selected) {
|
|
37
|
-
if (index < 0) {
|
|
38
|
-
group?.push(value)
|
|
39
|
-
group = group
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
if (index >= 0) {
|
|
43
|
-
group.splice(index, 1)
|
|
44
|
-
group = group
|
|
45
|
-
}
|
|
46
|
-
}
|
|
28
|
+
if (!group || !value) return
|
|
29
|
+
const included = group.includes(value)
|
|
30
|
+
if (selected && !included) {
|
|
31
|
+
group = [...group, value]
|
|
32
|
+
} else if (!selected && included) {
|
|
33
|
+
group = group.filter((v) => v !== value)
|
|
34
|
+
} else if (included !== selected) {
|
|
35
|
+
selected = included
|
|
47
36
|
}
|
|
48
37
|
})
|
|
49
38
|
</script>
|
|
@@ -59,17 +59,6 @@
|
|
|
59
59
|
</div>
|
|
60
60
|
|
|
61
61
|
<style>
|
|
62
|
-
.np-skeleton {
|
|
63
|
-
height: 2rem;
|
|
64
|
-
line-height: 1.25rem;
|
|
65
|
-
font-size: 0.875rem;
|
|
66
|
-
font-weight: 500;
|
|
67
|
-
opacity: 0;
|
|
68
|
-
display: flex;
|
|
69
|
-
align-items: center;
|
|
70
|
-
padding-inline-start: 1rem;
|
|
71
|
-
padding-inline-end: 2rem;
|
|
72
|
-
}
|
|
73
62
|
.np-input-chip {
|
|
74
63
|
position: relative;
|
|
75
64
|
display: inline-flex;
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
role="dialog"
|
|
46
46
|
aria-modal="true"
|
|
47
47
|
aria-labelledby="{uid}-dialog-headline"
|
|
48
|
-
aria-describedby=
|
|
48
|
+
aria-describedby={supportingText ? '{uid}-dialog-supporting-text' : undefined}
|
|
49
49
|
>
|
|
50
50
|
{#if icon}
|
|
51
51
|
<div class="np-dialog-icon">
|
package/dist/menu/Menu.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onMount } from 'svelte'
|
|
3
2
|
import type { MenuProps } from './types.ts'
|
|
3
|
+
import { on } from 'svelte/events'
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
6
|
children,
|
|
@@ -79,23 +79,12 @@
|
|
|
79
79
|
return window
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
const onScroll = () => {
|
|
83
|
-
refreshValues()
|
|
84
|
-
}
|
|
85
|
-
|
|
86
82
|
const attachScrollableParent = (el: HTMLDivElement) => {
|
|
87
83
|
if (!('anchorName' in document.documentElement.style)) {
|
|
88
|
-
getScrollableParent(el)
|
|
84
|
+
const parent = getScrollableParent(el)
|
|
85
|
+
return on(parent, 'scroll', refreshValues, { passive: true })
|
|
89
86
|
}
|
|
90
87
|
}
|
|
91
|
-
|
|
92
|
-
onMount(() => {
|
|
93
|
-
return () => {
|
|
94
|
-
if (element && !('anchorName' in document.documentElement.style)) {
|
|
95
|
-
getScrollableParent(element).removeEventListener('scroll', onScroll)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
88
|
</script>
|
|
100
89
|
|
|
101
90
|
<svelte:window bind:innerHeight onresize={refreshValues} />
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
<a
|
|
21
21
|
{...attributes}
|
|
22
22
|
class={['np-navigation-action', selected && 'np-navigation-action-selected', attributes.class]}
|
|
23
|
+
aria-current={selected ? 'page' : undefined}
|
|
23
24
|
>
|
|
24
25
|
{@render content()}
|
|
25
26
|
</a>
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
<button
|
|
28
29
|
{...attributes as HTMLButtonAttributes}
|
|
29
30
|
class={['np-navigation-action', selected && 'np-navigation-action-selected', attributes.class]}
|
|
31
|
+
aria-pressed={selected ? 'true' : undefined}
|
|
30
32
|
>
|
|
31
33
|
{@render content()}
|
|
32
34
|
</button>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { on } from 'svelte/events'
|
|
2
3
|
import type { RippleProps } from './types.ts'
|
|
3
4
|
|
|
4
5
|
let {
|
|
@@ -258,43 +259,32 @@
|
|
|
258
259
|
endPressAnimation()
|
|
259
260
|
}
|
|
260
261
|
|
|
261
|
-
const removeEvents = (el: HTMLElement) => {
|
|
262
|
-
el.removeEventListener('click', handleClick)
|
|
263
|
-
el.removeEventListener('contextmenu', handleContextmenu)
|
|
264
|
-
el.removeEventListener('pointercancel', handlePointercancel)
|
|
265
|
-
el.removeEventListener('pointerdown', handlePointerdown)
|
|
266
|
-
el.removeEventListener('pointerenter', handlePointerenter)
|
|
267
|
-
el.removeEventListener('pointerleave', handlePointerleave)
|
|
268
|
-
el.removeEventListener('pointerup', handlePointerup)
|
|
269
|
-
}
|
|
270
|
-
|
|
271
262
|
const addEvents = (el: HTMLElement) => {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
el
|
|
275
|
-
el
|
|
276
|
-
el
|
|
277
|
-
el
|
|
278
|
-
el
|
|
279
|
-
|
|
280
|
-
|
|
263
|
+
const click = on(el, 'click', handleClick)
|
|
264
|
+
const contextmenu = on(el, 'contextmenu', handleContextmenu)
|
|
265
|
+
const pointercancel = on(el, 'pointercancel', handlePointercancel)
|
|
266
|
+
const pointerdown = on(el, 'pointerdown', handlePointerdown)
|
|
267
|
+
const pointerenter = on(el, 'pointerenter', handlePointerenter)
|
|
268
|
+
const pointerleave = on(el, 'pointerleave', handlePointerleave)
|
|
269
|
+
const pointerup = on(el, 'pointerup', handlePointerup)
|
|
270
|
+
return () => {
|
|
271
|
+
click()
|
|
272
|
+
contextmenu()
|
|
273
|
+
pointercancel()
|
|
274
|
+
pointerdown()
|
|
275
|
+
pointerenter()
|
|
276
|
+
pointerleave()
|
|
277
|
+
pointerup()
|
|
278
|
+
}
|
|
281
279
|
}
|
|
282
280
|
|
|
283
281
|
$effect(() => {
|
|
284
282
|
const forcedColors = window?.matchMedia('(forced-colors: active)')
|
|
285
283
|
if (!forcedColors.matches && forElement) {
|
|
286
|
-
addEvents(forElement)
|
|
284
|
+
return addEvents(forElement)
|
|
287
285
|
} else {
|
|
288
286
|
if (!forcedColors.matches && element) {
|
|
289
|
-
addEvents(element)
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
return () => {
|
|
293
|
-
if (forElement) {
|
|
294
|
-
removeEvents(forElement)
|
|
295
|
-
}
|
|
296
|
-
if (element) {
|
|
297
|
-
removeEvents(element)
|
|
287
|
+
return addEvents(element)
|
|
298
288
|
}
|
|
299
289
|
}
|
|
300
290
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onMount } from 'svelte'
|
|
3
2
|
import type { TooltipProps } from './types.ts'
|
|
4
3
|
import { MediaQuery } from 'svelte/reactivity'
|
|
4
|
+
import { on } from 'svelte/events'
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
children,
|
|
@@ -49,10 +49,16 @@
|
|
|
49
49
|
anchor.style.setProperty('anchor-name', generatedId)
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
anchor
|
|
53
|
-
anchor
|
|
54
|
-
anchor
|
|
55
|
-
anchor
|
|
52
|
+
const mouseEnter = on(anchor, 'mouseenter', showPopover)
|
|
53
|
+
const mouseLeave = on(anchor, 'mouseleave', onLeave)
|
|
54
|
+
const focus = on(anchor, 'focus', onAnchorFocus)
|
|
55
|
+
const blur = on(anchor, 'blur', hidePopover)
|
|
56
|
+
return () => {
|
|
57
|
+
mouseEnter()
|
|
58
|
+
mouseLeave()
|
|
59
|
+
focus()
|
|
60
|
+
blur()
|
|
61
|
+
}
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
const onAnchorFocus = (e: FocusEvent) => {
|
|
@@ -77,17 +83,6 @@
|
|
|
77
83
|
// hidePopover()
|
|
78
84
|
// }, 500)
|
|
79
85
|
}
|
|
80
|
-
|
|
81
|
-
onMount(() => {
|
|
82
|
-
return () => {
|
|
83
|
-
if (anchor) {
|
|
84
|
-
anchor.removeEventListener('mouseenter', showPopover)
|
|
85
|
-
anchor.removeEventListener('mouseleave', onLeave)
|
|
86
|
-
anchor.removeEventListener('focus', onAnchorFocus)
|
|
87
|
-
anchor.removeEventListener('blur', hidePopover)
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
86
|
</script>
|
|
92
87
|
|
|
93
88
|
<svelte:window bind:innerHeight />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "noph-ui",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://noph.dev",
|
|
6
6
|
"repository": {
|
|
@@ -72,23 +72,23 @@
|
|
|
72
72
|
"@materialx/material-color-utilities": "^0.4.8",
|
|
73
73
|
"@playwright/test": "^1.58.2",
|
|
74
74
|
"@sveltejs/adapter-auto": "^7.0.1",
|
|
75
|
-
"@sveltejs/kit": "^2.
|
|
75
|
+
"@sveltejs/kit": "^2.55.0",
|
|
76
76
|
"@sveltejs/package": "^2.5.7",
|
|
77
77
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
78
78
|
"@types/eslint": "^9.6.1",
|
|
79
|
-
"eslint": "^10.0
|
|
79
|
+
"eslint": "^10.1.0",
|
|
80
80
|
"eslint-config-prettier": "^10.1.8",
|
|
81
|
-
"eslint-plugin-svelte": "^3.
|
|
81
|
+
"eslint-plugin-svelte": "^3.16.0",
|
|
82
82
|
"globals": "^17.4.0",
|
|
83
83
|
"prettier": "^3.8.1",
|
|
84
84
|
"prettier-plugin-svelte": "^3.5.1",
|
|
85
85
|
"publint": "^0.3.18",
|
|
86
|
-
"svelte": "^5.
|
|
87
|
-
"svelte-check": "^4.4.
|
|
88
|
-
"typescript": "^
|
|
89
|
-
"typescript-eslint": "^8.
|
|
90
|
-
"vite": "8.0.
|
|
91
|
-
"vitest": "^4.
|
|
86
|
+
"svelte": "^5.55.0",
|
|
87
|
+
"svelte-check": "^4.4.5",
|
|
88
|
+
"typescript": "^6.0.2",
|
|
89
|
+
"typescript-eslint": "^8.57.2",
|
|
90
|
+
"vite": "8.0.3",
|
|
91
|
+
"vitest": "^4.1.2"
|
|
92
92
|
},
|
|
93
93
|
"svelte": "./dist/index.js",
|
|
94
94
|
"types": "./dist/index.d.ts",
|