hamzus-ui 0.0.164 → 0.0.166
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/package.json
CHANGED
|
@@ -8,34 +8,28 @@
|
|
|
8
8
|
export let style = '';
|
|
9
9
|
export let maxChar = null;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
$: {
|
|
12
12
|
if (maxChar && value.length > maxChar) {
|
|
13
13
|
value = value.slice(0, maxChar);
|
|
14
14
|
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function handleChange(event) {
|
|
18
|
-
value = event.target.value;
|
|
19
15
|
|
|
20
|
-
if (onChange !== undefined) {
|
|
21
|
-
onChange(value);
|
|
22
|
-
}
|
|
23
16
|
}
|
|
17
|
+
|
|
18
|
+
$: value, onChange?.(value);
|
|
24
19
|
</script>
|
|
25
20
|
|
|
26
21
|
<label class="parent-text-area {variant}">
|
|
27
22
|
<h5 class="label">{label}</h5>
|
|
28
23
|
<textarea
|
|
29
|
-
on:input={handleChange}
|
|
30
24
|
{...$$restProps}
|
|
31
25
|
style="--min-height:{minHeight};{style}"
|
|
32
26
|
class="text-area p"
|
|
33
27
|
{name}
|
|
34
28
|
bind:value
|
|
35
29
|
></textarea>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
{#if maxChar !== null}
|
|
31
|
+
<h5 class="max-char">{value.length}/{maxChar}</h5>
|
|
32
|
+
{/if}
|
|
39
33
|
</label>
|
|
40
34
|
|
|
41
35
|
<style>
|
|
@@ -44,7 +38,7 @@
|
|
|
44
38
|
width: 100%;
|
|
45
39
|
flex-direction: column;
|
|
46
40
|
row-gap: var(--pad-s);
|
|
47
|
-
|
|
41
|
+
position: relative;
|
|
48
42
|
}
|
|
49
43
|
|
|
50
44
|
.text-area {
|
|
@@ -54,16 +48,16 @@
|
|
|
54
48
|
min-height: var(--min-height);
|
|
55
49
|
}
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
.max-char {
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 0;
|
|
54
|
+
right: var(--pad-m);
|
|
55
|
+
color: var(--accent);
|
|
56
|
+
}
|
|
63
57
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
.parent-text-area.collapse .max-char {
|
|
59
|
+
top: var(--pad-m);
|
|
60
|
+
}
|
|
67
61
|
|
|
68
62
|
.parent-text-area.collapse {
|
|
69
63
|
border: 2px solid var(--bg-2);
|