vueless 0.0.642 → 0.0.643
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
package/ui.form-label/config.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: {
|
|
3
|
-
base: "flex
|
|
3
|
+
base: "flex w-full",
|
|
4
4
|
variants: {
|
|
5
5
|
align: {
|
|
6
|
-
top: "flex-col",
|
|
6
|
+
top: "flex-col gap-2",
|
|
7
7
|
topInside: "flex-col gap-0 relative",
|
|
8
8
|
topWithDesc: "flex-col-reverse w-fit",
|
|
9
9
|
right: "flex-row w-fit",
|
|
@@ -14,14 +14,12 @@ export default /*tw*/ {
|
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
compoundVariants: [
|
|
17
|
-
{ align: "left", size: "sm", class: "gap-2" },
|
|
18
|
-
{ align: "left", size: "md", class: "gap-3" },
|
|
19
|
-
{ align: "left", size: "lg", class: "gap-
|
|
20
|
-
{ align: "right",
|
|
21
|
-
{ align: "
|
|
22
|
-
{ align: "right",
|
|
23
|
-
{ align: "left", centred: true, class: "items-center justify-end w-auto" },
|
|
24
|
-
{ align: "right", centred: true, class: "items-center justify-start w-auto" },
|
|
17
|
+
{ align: ["left", "right"], size: "sm", class: "gap-2.5" },
|
|
18
|
+
{ align: ["left", "right"], size: "md", class: "gap-3" },
|
|
19
|
+
{ align: ["left", "right"], size: "lg", class: "gap-3.5" },
|
|
20
|
+
{ align: ["left", "right"], centred: true, class: "items-center w-auto" },
|
|
21
|
+
{ align: "left", centred: true, class: "justify-end" },
|
|
22
|
+
{ align: "right", centred: true, class: "justify-start" },
|
|
25
23
|
],
|
|
26
24
|
},
|
|
27
25
|
content: "flex",
|
|
@@ -55,14 +53,10 @@ export default /*tw*/ {
|
|
|
55
53
|
{ align: "topWithDesc", size: "sm", class: "-mt-px" },
|
|
56
54
|
{ align: "topWithDesc", size: "md", class: "" },
|
|
57
55
|
{ align: "topWithDesc", size: "lg", class: "mt-px" },
|
|
58
|
-
{ align: "left", size: "sm", class: "-mt-px text-sm" },
|
|
59
|
-
{ align: "left", size: "md", class: "text-sm" },
|
|
60
|
-
{ align: "left", size: "lg", class: "mt-px text-base" },
|
|
61
|
-
{ align: "right",
|
|
62
|
-
{ align: "right", size: "md", class: "text-sm" },
|
|
63
|
-
{ align: "right", size: "lg", class: "mt-px text-base" },
|
|
64
|
-
{ align: "left", centred: false, class: "pt-1" },
|
|
65
|
-
{ align: "right", centred: false, class: "pt-1" },
|
|
56
|
+
{ align: ["left", "right"], size: "sm", class: "-mt-px text-sm" },
|
|
57
|
+
{ align: ["left", "right"], size: "md", class: "text-sm" },
|
|
58
|
+
{ align: ["left", "right"], size: "lg", class: "mt-px text-base" },
|
|
59
|
+
{ align: ["left", "right"], centred: false, class: "pt-1" },
|
|
66
60
|
],
|
|
67
61
|
},
|
|
68
62
|
description: {
|
|
@@ -63,7 +63,7 @@ const elementId = props.id || useId();
|
|
|
63
63
|
const textareaRef = ref<HTMLTextAreaElement | null>(null);
|
|
64
64
|
const labelComponentRef = ref<{ labelElement: HTMLElement | null } | null>(null);
|
|
65
65
|
const leftSlotWrapperRef = ref<HTMLElement | null>(null);
|
|
66
|
-
const
|
|
66
|
+
const wrapperRef = ref<HTMLElement | null>(null);
|
|
67
67
|
|
|
68
68
|
const currentRows = ref(Number(props.rows));
|
|
69
69
|
|
|
@@ -74,36 +74,43 @@ watch(
|
|
|
74
74
|
},
|
|
75
75
|
);
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
77
|
+
const localValue = computed({
|
|
78
|
+
get() {
|
|
79
|
+
return props.modelValue;
|
|
80
|
+
},
|
|
81
|
+
set(value) {
|
|
82
|
+
emit("update:modelValue", value);
|
|
83
|
+
},
|
|
84
|
+
});
|
|
82
85
|
|
|
83
|
-
|
|
86
|
+
onMounted(() => toggleReadonly(true));
|
|
87
|
+
|
|
88
|
+
function getNewRowCount() {
|
|
84
89
|
const textarea = textareaRef.value;
|
|
85
90
|
|
|
86
|
-
if (!textarea) return;
|
|
91
|
+
if (!textarea) return 0;
|
|
87
92
|
|
|
88
93
|
const content = textarea.value;
|
|
89
94
|
const newlineCount = (content.match(/\n/g) || []).length;
|
|
90
|
-
const newRowCount = Math.max(Number(props.rows), newlineCount + 1);
|
|
91
95
|
|
|
92
|
-
|
|
96
|
+
return Math.max(Number(props.rows), newlineCount + 2);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function onEnter() {
|
|
100
|
+
const newRowCount = getNewRowCount();
|
|
101
|
+
|
|
102
|
+
if (newRowCount > currentRows.value) {
|
|
93
103
|
currentRows.value = newRowCount;
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
106
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return props.modelValue;
|
|
100
|
-
},
|
|
101
|
-
set(value) {
|
|
102
|
-
emit("update:modelValue", value);
|
|
103
|
-
},
|
|
104
|
-
});
|
|
107
|
+
function onBackspace() {
|
|
108
|
+
const newRowCount = getNewRowCount() - 1;
|
|
105
109
|
|
|
106
|
-
|
|
110
|
+
if (newRowCount < currentRows.value) {
|
|
111
|
+
currentRows.value = newRowCount;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
107
114
|
|
|
108
115
|
function onChange() {
|
|
109
116
|
emit("change");
|
|
@@ -154,14 +161,10 @@ useMutationObserver(leftSlotWrapperRef, (mutations) => {
|
|
|
154
161
|
function setLabelPosition() {
|
|
155
162
|
if (props.labelAlign === "top" || !hasSlotContent(slots["left"])) return;
|
|
156
163
|
|
|
157
|
-
if (
|
|
158
|
-
leftSlotWrapperRef.value &&
|
|
159
|
-
textareaWrapperRef.value &&
|
|
160
|
-
labelComponentRef.value?.labelElement
|
|
161
|
-
) {
|
|
164
|
+
if (leftSlotWrapperRef.value && wrapperRef.value && labelComponentRef.value?.labelElement) {
|
|
162
165
|
const leftSlotWidth = leftSlotWrapperRef.value.getBoundingClientRect().width;
|
|
163
166
|
|
|
164
|
-
const textareaPaddingLeft = parseFloat(getComputedStyle(
|
|
167
|
+
const textareaPaddingLeft = parseFloat(getComputedStyle(wrapperRef.value).paddingLeft);
|
|
165
168
|
|
|
166
169
|
labelComponentRef.value.labelElement.style.left = `${leftSlotWidth + textareaPaddingLeft}px`;
|
|
167
170
|
}
|
|
@@ -186,7 +189,7 @@ const mutatedProps = computed(() => ({
|
|
|
186
189
|
label: Boolean(props.label),
|
|
187
190
|
}));
|
|
188
191
|
|
|
189
|
-
const { textareaAttrs, textareaLabelAttrs,
|
|
192
|
+
const { textareaAttrs, textareaLabelAttrs, wrapperAttrs, leftSlotAttrs, rightSlotAttrs } =
|
|
190
193
|
useUI<Config>(defaultConfig, mutatedProps);
|
|
191
194
|
</script>
|
|
192
195
|
|
|
@@ -204,7 +207,7 @@ const { textareaAttrs, textareaLabelAttrs, textareaWrapperAttrs, leftSlotAttrs,
|
|
|
204
207
|
v-bind="textareaLabelAttrs"
|
|
205
208
|
:data-test="dataTest"
|
|
206
209
|
>
|
|
207
|
-
<label ref="
|
|
210
|
+
<label ref="wrapperRef" :for="elementId" v-bind="wrapperAttrs">
|
|
208
211
|
<div
|
|
209
212
|
v-if="hasSlotContent($slots['left'])"
|
|
210
213
|
ref="leftSlotWrapperRef"
|
|
@@ -233,7 +236,7 @@ const { textareaAttrs, textareaLabelAttrs, textareaWrapperAttrs, leftSlotAttrs,
|
|
|
233
236
|
@mousedown="onMousedown"
|
|
234
237
|
@click="onClick"
|
|
235
238
|
@keydown.enter="onEnter"
|
|
236
|
-
@
|
|
239
|
+
@keyup.delete="onBackspace"
|
|
237
240
|
/>
|
|
238
241
|
|
|
239
242
|
<div v-if="hasSlotContent($slots['right'])" :for="elementId" v-bind="rightSlotAttrs">
|
|
@@ -2,9 +2,9 @@ export default /*tw*/ {
|
|
|
2
2
|
textareaLabel: "{ULabel}",
|
|
3
3
|
leftSlot: "flex items-center justify-center whitespace-nowrap pr-2.5 gap-1 rounded-dynamic rounded-r-none",
|
|
4
4
|
rightSlot: "flex items-center justify-center whitespace-nowrap pl-2.5 gap-1 rounded-dynamic rounded-l-none",
|
|
5
|
-
|
|
5
|
+
wrapper: {
|
|
6
6
|
base: `
|
|
7
|
-
flex
|
|
7
|
+
flex bg-white transition w-full
|
|
8
8
|
rounded-dynamic border border-gray-300 hover:border-gray-400 hover:focus-within:border-brand-500
|
|
9
9
|
focus-within:border-brand-500 focus-within:ring-dynamic focus-within:ring-offset-dynamic
|
|
10
10
|
focus-within:ring-brand-700/15 focus-within:outline-none
|
|
@@ -27,7 +27,7 @@ export default /*tw*/ {
|
|
|
27
27
|
},
|
|
28
28
|
textarea: {
|
|
29
29
|
base: `
|
|
30
|
-
|
|
30
|
+
px-3 pt-2 pb-1.5 block w-full bg-transparent border-none font-normal text-gray-900
|
|
31
31
|
placeholder:text-gray-400 placeholder:font-normal placeholder:leading-none
|
|
32
32
|
focus:border-none focus:outline-none focus:ring-0 disabled:cursor-not-allowed
|
|
33
33
|
`,
|
|
@@ -45,13 +45,13 @@ export default /*tw*/ {
|
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
compoundVariants: [
|
|
48
|
-
{ labelAlign: "topInside", label: true, size: "sm", class: "pt-
|
|
49
|
-
{ labelAlign: "topInside", label: true, size: "md", class: "pt-
|
|
50
|
-
{ labelAlign: "topInside", label: true, size: "lg", class: "pt-
|
|
48
|
+
{ labelAlign: "topInside", label: true, size: "sm", class: "pt-[1.2rem]" },
|
|
49
|
+
{ labelAlign: "topInside", label: true, size: "md", class: "pt-[1.4rem]" },
|
|
50
|
+
{ labelAlign: "topInside", label: true, size: "lg", class: "pt-[1.6rem]" },
|
|
51
51
|
],
|
|
52
52
|
},
|
|
53
53
|
defaults: {
|
|
54
|
-
rows: "
|
|
54
|
+
rows: "1",
|
|
55
55
|
size: "md",
|
|
56
56
|
inputmode: "text",
|
|
57
57
|
labelAlign: "topInside",
|
package/ui.text-alert/config.ts
CHANGED
|
@@ -24,6 +24,10 @@ export default /*tw*/ {
|
|
|
24
24
|
{ color: "grayscale", variant: "secondary", class: "text-gray-900 border-gray-900" },
|
|
25
25
|
{ color: "grayscale", variant: "thirdary", class: "text-gray-900 bg-gray-50" },
|
|
26
26
|
{ color: "grayscale", variant: "thirdary", bordered: true, class: "border-gray-200" },
|
|
27
|
+
{ color: "gray", variant: "primary", class: "bg-gray-500" },
|
|
28
|
+
{ color: "gray", variant: "secondary", class: "text-gray-500 border-gray-500" },
|
|
29
|
+
{ color: "gray", variant: "thirdary", class: "text-gray-500 bg-gray-50" },
|
|
30
|
+
{ color: "gray", variant: "thirdary", bordered: true, class: "border-gray-500" },
|
|
27
31
|
],
|
|
28
32
|
},
|
|
29
33
|
body: "flex items-start justify-between",
|