noph-ui 0.26.0 → 0.26.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.
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
value = $bindable(),
|
|
19
19
|
label,
|
|
20
20
|
disabled,
|
|
21
|
+
required,
|
|
22
|
+
noAsterisk,
|
|
21
23
|
children,
|
|
22
24
|
onchange,
|
|
23
25
|
oninvalid,
|
|
@@ -27,8 +29,8 @@
|
|
|
27
29
|
const selectId = id ?? `select-${uid}`
|
|
28
30
|
|
|
29
31
|
let animateLabel = $state(false)
|
|
30
|
-
let errorTextRaw = $
|
|
31
|
-
let errorRaw = $
|
|
32
|
+
let errorTextRaw = $derived(errorText)
|
|
33
|
+
let errorRaw = $derived(error)
|
|
32
34
|
</script>
|
|
33
35
|
|
|
34
36
|
<div
|
|
@@ -37,8 +39,10 @@
|
|
|
37
39
|
variant,
|
|
38
40
|
errorRaw && 'error',
|
|
39
41
|
disabled && 'disabled',
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
required && !noAsterisk && 'asterisk',
|
|
43
|
+
!value && 'is-empty',
|
|
44
|
+
animateLabel && 'animate-label',
|
|
45
|
+
attributes.class,
|
|
42
46
|
]}
|
|
43
47
|
aria-disabled={disabled}
|
|
44
48
|
>
|
|
@@ -64,8 +68,10 @@
|
|
|
64
68
|
<polygon stroke="none" fill-rule="evenodd" points="7 10 12 15 17 10"></polygon>
|
|
65
69
|
</svg>
|
|
66
70
|
<select
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
oninput={(event) => {
|
|
72
|
+
if ((!value && event.currentTarget.value) || (value && !event.currentTarget.value)) {
|
|
73
|
+
animateLabel = true
|
|
74
|
+
}
|
|
69
75
|
onchange?.(event)
|
|
70
76
|
}}
|
|
71
77
|
oninvalid={(event) => {
|
|
@@ -78,10 +84,12 @@
|
|
|
78
84
|
oninvalid?.(event)
|
|
79
85
|
}}
|
|
80
86
|
{disabled}
|
|
87
|
+
{required}
|
|
81
88
|
id={selectId}
|
|
82
89
|
aria-invalid={error}
|
|
83
90
|
bind:value
|
|
84
91
|
{...attributes}
|
|
92
|
+
class="np-select"
|
|
85
93
|
>
|
|
86
94
|
{@render children?.()}
|
|
87
95
|
</select>
|
|
@@ -99,11 +107,10 @@
|
|
|
99
107
|
position: relative;
|
|
100
108
|
font-size: 1rem;
|
|
101
109
|
display: inline-block;
|
|
102
|
-
min-width: 200px;
|
|
103
110
|
color: var(--np-color-on-surface-variant);
|
|
104
111
|
}
|
|
105
112
|
|
|
106
|
-
select {
|
|
113
|
+
.np-select {
|
|
107
114
|
all: unset;
|
|
108
115
|
&,
|
|
109
116
|
&::picker(select) {
|
|
@@ -277,6 +284,10 @@
|
|
|
277
284
|
font-size: 0.75rem;
|
|
278
285
|
}
|
|
279
286
|
|
|
287
|
+
.asterisk label::after {
|
|
288
|
+
content: '*';
|
|
289
|
+
}
|
|
290
|
+
|
|
280
291
|
.np-select-outline label {
|
|
281
292
|
transform: translateY(-0.5rem);
|
|
282
293
|
}
|
|
@@ -286,7 +297,7 @@
|
|
|
286
297
|
transform: translateY(0.5rem);
|
|
287
298
|
}
|
|
288
299
|
|
|
289
|
-
.label
|
|
300
|
+
.animate-label label {
|
|
290
301
|
transition-property: font-size;
|
|
291
302
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
292
303
|
transition-duration: 150ms;
|
|
@@ -296,7 +307,7 @@
|
|
|
296
307
|
color: var(--np-color-primary);
|
|
297
308
|
}
|
|
298
309
|
|
|
299
|
-
.label
|
|
310
|
+
.animate-label:not(.is-empty) .np-select-outline label {
|
|
300
311
|
animation: slideUpOutline 150ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
301
312
|
}
|
|
302
313
|
|
|
@@ -309,7 +320,7 @@
|
|
|
309
320
|
}
|
|
310
321
|
}
|
|
311
322
|
|
|
312
|
-
.label
|
|
323
|
+
.animate-label:not(.is-empty) .np-select-filled label {
|
|
313
324
|
animation: slideUpFilled 150ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
314
325
|
}
|
|
315
326
|
|
|
@@ -329,7 +340,7 @@
|
|
|
329
340
|
position: absolute;
|
|
330
341
|
}
|
|
331
342
|
|
|
332
|
-
.is-empty.label
|
|
343
|
+
.is-empty.animate-label .np-select-outline label {
|
|
333
344
|
animation: slideDownOutline 150ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
334
345
|
}
|
|
335
346
|
|
|
@@ -347,7 +358,7 @@
|
|
|
347
358
|
transform: translateY(1.25rem);
|
|
348
359
|
}
|
|
349
360
|
|
|
350
|
-
.is-empty.label
|
|
361
|
+
.is-empty.animate-label .np-select-filled label {
|
|
351
362
|
animation: slideDownFilled 150ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
352
363
|
}
|
|
353
364
|
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
<style>
|
|
26
26
|
option {
|
|
27
|
+
all: unset;
|
|
27
28
|
cursor: pointer;
|
|
28
29
|
position: relative;
|
|
29
30
|
display: flex;
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
gap: 0.75rem;
|
|
32
33
|
height: 2rem;
|
|
33
34
|
background: var(--np-surface);
|
|
35
|
+
align-items: center;
|
|
34
36
|
|
|
35
37
|
&:checked {
|
|
36
38
|
background-color: var(--np-color-secondary-container);
|