noph-ui 0.11.5 → 0.11.7
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/card/Card.svelte +2 -25
- package/dist/chip/FilterChip.svelte +24 -32
- package/dist/chip/FilterChip.svelte.d.ts +1 -1
- package/dist/chip/types.d.ts +3 -2
- package/dist/list/Item.svelte +10 -34
- package/package.json +3 -3
package/dist/card/Card.svelte
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Ripple from '../ripple/Ripple.svelte'
|
|
3
|
-
import type { FocusEventHandler } from 'svelte/elements'
|
|
4
3
|
import type { CardProps } from './types.ts'
|
|
5
4
|
|
|
6
5
|
let {
|
|
@@ -13,8 +12,6 @@
|
|
|
13
12
|
supportingText,
|
|
14
13
|
action,
|
|
15
14
|
children,
|
|
16
|
-
onblur,
|
|
17
|
-
onfocus,
|
|
18
15
|
...attributes
|
|
19
16
|
}: CardProps = $props()
|
|
20
17
|
|
|
@@ -71,12 +68,6 @@
|
|
|
71
68
|
{...attributes}
|
|
72
69
|
bind:this={element}
|
|
73
70
|
aria-disabled={disabled}
|
|
74
|
-
onfocus={(event) => {
|
|
75
|
-
;(onfocus as FocusEventHandler<HTMLDivElement>)?.(event)
|
|
76
|
-
}}
|
|
77
|
-
onblur={(event) => {
|
|
78
|
-
;(onblur as FocusEventHandler<HTMLDivElement>)?.(event)
|
|
79
|
-
}}
|
|
80
71
|
class={[
|
|
81
72
|
'np-card-container',
|
|
82
73
|
`np-card-${variant}`,
|
|
@@ -91,14 +82,7 @@
|
|
|
91
82
|
aria-disabled={disabled}
|
|
92
83
|
{...attributes}
|
|
93
84
|
bind:this={element}
|
|
94
|
-
|
|
95
|
-
focused = true
|
|
96
|
-
;(onfocus as FocusEventHandler<HTMLButtonElement>)?.(event)
|
|
97
|
-
}}
|
|
98
|
-
onblur={(event) => {
|
|
99
|
-
focused = false
|
|
100
|
-
;(onblur as FocusEventHandler<HTMLButtonElement>)?.(event)
|
|
101
|
-
}}
|
|
85
|
+
bind:focused
|
|
102
86
|
{disabled}
|
|
103
87
|
class={[
|
|
104
88
|
'np-card-container',
|
|
@@ -116,14 +100,7 @@
|
|
|
116
100
|
aria-disabled={disabled}
|
|
117
101
|
tabindex={disabled ? -1 : undefined}
|
|
118
102
|
role="link"
|
|
119
|
-
|
|
120
|
-
focused = true
|
|
121
|
-
;(onfocus as FocusEventHandler<HTMLAnchorElement>)?.(event)
|
|
122
|
-
}}
|
|
123
|
-
onblur={(event) => {
|
|
124
|
-
focused = false
|
|
125
|
-
;(onblur as FocusEventHandler<HTMLAnchorElement>)?.(event)
|
|
126
|
-
}}
|
|
103
|
+
bind:focused
|
|
127
104
|
class={[
|
|
128
105
|
'np-card-container',
|
|
129
106
|
`np-card-${variant}`,
|
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
element = $bindable(),
|
|
16
16
|
ariaLabelRemove = 'Remove',
|
|
17
17
|
remove,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
name,
|
|
19
|
+
value,
|
|
20
|
+
group = $bindable(),
|
|
20
21
|
...attributes
|
|
21
22
|
}: FilterChipProps = $props()
|
|
22
23
|
|
|
23
|
-
let
|
|
24
|
+
let chipLabel: HTMLLabelElement | undefined = $state()
|
|
24
25
|
</script>
|
|
25
26
|
|
|
26
27
|
<div
|
|
@@ -36,20 +37,7 @@
|
|
|
36
37
|
attributes.class,
|
|
37
38
|
]}
|
|
38
39
|
>
|
|
39
|
-
<
|
|
40
|
-
bind:this={chipBtn}
|
|
41
|
-
class="np-filter-chip-btn"
|
|
42
|
-
{disabled}
|
|
43
|
-
onclick={() => {
|
|
44
|
-
if (element === undefined) return
|
|
45
|
-
if (selected) {
|
|
46
|
-
deselect?.(element)
|
|
47
|
-
} else {
|
|
48
|
-
select?.(element)
|
|
49
|
-
}
|
|
50
|
-
selected = !selected
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
40
|
+
<label bind:this={chipLabel} class="np-filter-chip-label">
|
|
53
41
|
{#if icon && !selected}
|
|
54
42
|
<div class="np-chip-icon">
|
|
55
43
|
{@render icon()}
|
|
@@ -59,9 +47,14 @@
|
|
|
59
47
|
<CheckIcon width={18} height={18} />
|
|
60
48
|
{/if}
|
|
61
49
|
<div class="np-chip-label">{label}</div>
|
|
62
|
-
|
|
50
|
+
{#if group !== undefined}
|
|
51
|
+
<input type="checkbox" bind:checked={selected} {value} {name} {disabled} bind:group />
|
|
52
|
+
{:else}
|
|
53
|
+
<input type="checkbox" bind:checked={selected} {value} {name} {disabled} />
|
|
54
|
+
{/if}
|
|
55
|
+
</label>
|
|
63
56
|
{#if !disabled}
|
|
64
|
-
<Ripple forElement={
|
|
57
|
+
<Ripple forElement={chipLabel} />
|
|
65
58
|
{/if}
|
|
66
59
|
{#if removable}
|
|
67
60
|
<IconButton
|
|
@@ -92,16 +85,15 @@
|
|
|
92
85
|
--np-icon-button-icon-color: var(--np-color-on-surface-variant);
|
|
93
86
|
--np-icon-size: 1.125rem;
|
|
94
87
|
}
|
|
95
|
-
.np-filter-chip-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
.np-filter-chip-label input {
|
|
89
|
+
opacity: 0;
|
|
90
|
+
position: absolute;
|
|
91
|
+
pointer-events: none;
|
|
92
|
+
}
|
|
93
|
+
.np-filter-chip-label {
|
|
101
94
|
cursor: pointer;
|
|
102
95
|
display: inline-flex;
|
|
103
96
|
align-items: center;
|
|
104
|
-
padding: 0;
|
|
105
97
|
height: 2rem;
|
|
106
98
|
color: var(--np-color-on-surface-variant);
|
|
107
99
|
fill: currentColor;
|
|
@@ -114,13 +106,13 @@
|
|
|
114
106
|
color: var(--np-color-primary);
|
|
115
107
|
display: flex;
|
|
116
108
|
}
|
|
117
|
-
.np-filter-chip-icon .np-filter-chip-
|
|
109
|
+
.np-filter-chip-icon .np-filter-chip-label {
|
|
118
110
|
padding-left: 0.5rem;
|
|
119
111
|
}
|
|
120
112
|
.np-filter-chip-removable {
|
|
121
113
|
padding-right: 2px;
|
|
122
114
|
}
|
|
123
|
-
.np-filter-chip-removable .np-filter-chip-
|
|
115
|
+
.np-filter-chip-removable .np-filter-chip-label {
|
|
124
116
|
padding-right: 2px;
|
|
125
117
|
}
|
|
126
118
|
.np-chip-label {
|
|
@@ -152,13 +144,13 @@
|
|
|
152
144
|
.np-filter-chip-selected {
|
|
153
145
|
--np-icon-button-icon-color: var(--np-color-on-secondary-container);
|
|
154
146
|
}
|
|
155
|
-
.np-filter-chip-selected .np-filter-chip-
|
|
147
|
+
.np-filter-chip-selected .np-filter-chip-label {
|
|
156
148
|
color: var(--np-color-on-secondary-container);
|
|
157
149
|
}
|
|
158
|
-
.np-filter-chip-
|
|
150
|
+
.np-filter-chip-label:focus-visible {
|
|
159
151
|
outline-width: 0;
|
|
160
152
|
}
|
|
161
|
-
.np-filter-chip:has(
|
|
153
|
+
.np-filter-chip:has(input:focus-visible) {
|
|
162
154
|
outline-style: solid;
|
|
163
155
|
outline-color: var(--np-color-primary);
|
|
164
156
|
outline-width: 3px;
|
|
@@ -177,7 +169,7 @@
|
|
|
177
169
|
}
|
|
178
170
|
}
|
|
179
171
|
|
|
180
|
-
.np-filter-chip-disabled .np-filter-chip-
|
|
172
|
+
.np-filter-chip-disabled .np-filter-chip-label {
|
|
181
173
|
cursor: default;
|
|
182
174
|
color: var(--np-color-on-surface);
|
|
183
175
|
opacity: 0.38;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { FilterChipProps } from './types.ts';
|
|
2
|
-
declare const FilterChip: import("svelte").Component<FilterChipProps, {}, "element" | "selected">;
|
|
2
|
+
declare const FilterChip: import("svelte").Component<FilterChipProps, {}, "element" | "group" | "selected">;
|
|
3
3
|
type FilterChip = ReturnType<typeof FilterChip>;
|
|
4
4
|
export default FilterChip;
|
package/dist/chip/types.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ export interface FilterChipProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
9
9
|
icon?: Snippet;
|
|
10
10
|
ariaLabelRemove?: string;
|
|
11
11
|
element?: HTMLDivElement;
|
|
12
|
+
name?: string;
|
|
13
|
+
value?: string;
|
|
14
|
+
group?: string | number | null;
|
|
12
15
|
remove?: (chip: HTMLDivElement) => void;
|
|
13
|
-
select?: (chip: HTMLDivElement) => void;
|
|
14
|
-
deselect?: (chip: HTMLDivElement) => void;
|
|
15
16
|
}
|
package/dist/list/Item.svelte
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Ripple from '../ripple/Ripple.svelte'
|
|
3
|
-
import type { FocusEventHandler } from 'svelte/elements'
|
|
4
3
|
import type { ItemProps } from './types.ts'
|
|
5
4
|
|
|
6
5
|
let {
|
|
@@ -9,8 +8,6 @@
|
|
|
9
8
|
end,
|
|
10
9
|
children,
|
|
11
10
|
supportingText,
|
|
12
|
-
onblur,
|
|
13
|
-
onfocus,
|
|
14
11
|
disabled = false,
|
|
15
12
|
...attributes
|
|
16
13
|
}: ItemProps = $props()
|
|
@@ -43,9 +40,6 @@
|
|
|
43
40
|
{@render end()}
|
|
44
41
|
</div>
|
|
45
42
|
{/if}
|
|
46
|
-
{#if !disabled && !(attributes.variant === 'text' || attributes.variant === undefined)}
|
|
47
|
-
<Ripple forceHover={focused} />
|
|
48
|
-
{/if}
|
|
49
43
|
{/snippet}
|
|
50
44
|
|
|
51
45
|
{#if disabled}
|
|
@@ -53,47 +47,29 @@
|
|
|
53
47
|
{@render content()}
|
|
54
48
|
</div>
|
|
55
49
|
{:else if attributes.variant === 'text' || attributes.variant === undefined}
|
|
56
|
-
<div
|
|
57
|
-
{...attributes}
|
|
58
|
-
onfocus={(event) => {
|
|
59
|
-
;(onfocus as FocusEventHandler<HTMLDivElement>)?.(event)
|
|
60
|
-
}}
|
|
61
|
-
onblur={(event) => {
|
|
62
|
-
;(onblur as FocusEventHandler<HTMLDivElement>)?.(event)
|
|
63
|
-
}}
|
|
64
|
-
class={['np-item', selected && 'selected', attributes.class]}
|
|
65
|
-
>
|
|
50
|
+
<div {...attributes} class={['np-item', selected && 'selected', attributes.class]}>
|
|
66
51
|
{@render content()}
|
|
67
52
|
</div>
|
|
68
53
|
{:else if attributes.variant === 'button'}
|
|
69
54
|
<button
|
|
70
55
|
{...attributes}
|
|
71
|
-
|
|
72
|
-
focused = true
|
|
73
|
-
;(onfocus as FocusEventHandler<HTMLButtonElement>)?.(event)
|
|
74
|
-
}}
|
|
75
|
-
onblur={(event) => {
|
|
76
|
-
focused = false
|
|
77
|
-
;(onblur as FocusEventHandler<HTMLButtonElement>)?.(event)
|
|
78
|
-
}}
|
|
56
|
+
bind:focused
|
|
79
57
|
class={['np-item', selected && 'selected', attributes.class]}
|
|
80
58
|
bind:this={element}
|
|
81
|
-
|
|
59
|
+
>
|
|
60
|
+
{@render content()}
|
|
61
|
+
<Ripple forceHover={focused} />
|
|
82
62
|
</button>
|
|
83
63
|
{:else if attributes.variant === 'link'}
|
|
84
64
|
<a
|
|
85
65
|
{...attributes}
|
|
86
|
-
|
|
87
|
-
focused = true
|
|
88
|
-
;(onfocus as FocusEventHandler<HTMLAnchorElement>)?.(event)
|
|
89
|
-
}}
|
|
90
|
-
onblur={(event) => {
|
|
91
|
-
focused = false
|
|
92
|
-
;(onblur as FocusEventHandler<HTMLAnchorElement>)?.(event)
|
|
93
|
-
}}
|
|
66
|
+
bind:focused
|
|
94
67
|
class={['np-item', selected && 'selected', attributes.class]}
|
|
95
|
-
bind:this={element}
|
|
68
|
+
bind:this={element}
|
|
96
69
|
>
|
|
70
|
+
{@render content()}
|
|
71
|
+
<Ripple forceHover={focused} />
|
|
72
|
+
</a>
|
|
97
73
|
{/if}
|
|
98
74
|
|
|
99
75
|
<style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "noph-ui",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://noph.dev",
|
|
6
6
|
"repository": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"!dist/**/*.spec.*"
|
|
50
50
|
],
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"svelte": "^5.
|
|
52
|
+
"svelte": "^5.19.4"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@material/material-color-utilities": "^0.3.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"prettier": "^3.4.2",
|
|
67
67
|
"prettier-plugin-svelte": "^3.3.3",
|
|
68
68
|
"publint": "^0.3.2",
|
|
69
|
-
"svelte": "^5.19.
|
|
69
|
+
"svelte": "^5.19.5",
|
|
70
70
|
"svelte-check": "^4.1.4",
|
|
71
71
|
"typescript": "^5.7.3",
|
|
72
72
|
"typescript-eslint": "^8.22.0",
|