vueless 0.0.706 → 0.0.707
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 +1 -1
- package/ui.form-input/storybook/stories.ts +3 -7
- package/ui.form-input-rating/storybook/stories.ts +6 -4
- package/ui.form-input-search/storybook/stories.ts +3 -7
- package/ui.form-textarea/UTextarea.vue +2 -2
- package/ui.form-textarea/storybook/stories.ts +86 -42
- package/ui.form-textarea/types.ts +1 -1
package/package.json
CHANGED
|
@@ -43,11 +43,7 @@ const DefaultTemplate: StoryFn<UInputArgs> = (args: UInputArgs) => ({
|
|
|
43
43
|
components: { UInput, UIcon },
|
|
44
44
|
setup() {
|
|
45
45
|
const slots = getSlotNames(UInput.__name);
|
|
46
|
-
const errorMessage = computed(() =>
|
|
47
|
-
args.modelValue === "" && args.error !== ""
|
|
48
|
-
? "This field is required. Please enter a value."
|
|
49
|
-
: "",
|
|
50
|
-
);
|
|
46
|
+
const errorMessage = computed(() => (args.modelValue === "" ? args.error : ""));
|
|
51
47
|
|
|
52
48
|
return { args, slots, errorMessage };
|
|
53
49
|
},
|
|
@@ -127,13 +123,13 @@ export const Default = DefaultTemplate.bind({});
|
|
|
127
123
|
Default.args = {};
|
|
128
124
|
|
|
129
125
|
export const Placeholder = DefaultTemplate.bind({});
|
|
130
|
-
Placeholder.args = { modelValue: "", placeholder: "Type something here..."
|
|
126
|
+
Placeholder.args = { modelValue: "", placeholder: "Type something here..." };
|
|
131
127
|
|
|
132
128
|
export const Description = DefaultTemplate.bind({});
|
|
133
129
|
Description.args = { description: "Provide additional details if necessary." };
|
|
134
130
|
|
|
135
131
|
export const Error = DefaultTemplate.bind({});
|
|
136
|
-
Error.args = {
|
|
132
|
+
Error.args = { error: "This field is required. Please enter a value." };
|
|
137
133
|
|
|
138
134
|
export const Readonly = DefaultTemplate.bind({});
|
|
139
135
|
Readonly.args = {
|
|
@@ -40,9 +40,7 @@ const DefaultTemplate: StoryFn<UInputRatingArgs> = (args: UInputRatingArgs) => (
|
|
|
40
40
|
components: { UInputRating, UBadge },
|
|
41
41
|
setup() {
|
|
42
42
|
const slots = getSlotNames(UInputRating.__name);
|
|
43
|
-
const errorMessage = computed(() =>
|
|
44
|
-
!args.modelValue && args.error !== "" ? "Your review helps us improve our services." : "",
|
|
45
|
-
);
|
|
43
|
+
const errorMessage = computed(() => (!args.modelValue ? args.error : ""));
|
|
46
44
|
|
|
47
45
|
return { args, slots, errorMessage };
|
|
48
46
|
},
|
|
@@ -87,7 +85,11 @@ export const Description = DefaultTemplate.bind({});
|
|
|
87
85
|
Description.args = { description: "Your review helps us improve our services." };
|
|
88
86
|
|
|
89
87
|
export const Error = DefaultTemplate.bind({});
|
|
90
|
-
Error.args = {
|
|
88
|
+
Error.args = {
|
|
89
|
+
selectable: true,
|
|
90
|
+
modelValue: 0,
|
|
91
|
+
error: "Please select a rating before submitting your review.",
|
|
92
|
+
};
|
|
91
93
|
|
|
92
94
|
export const Disabled = DefaultTemplate.bind({});
|
|
93
95
|
Disabled.args = { disabled: true };
|
|
@@ -43,11 +43,7 @@ const DefaultTemplate: StoryFn<UInputSearchArgs> = (args: UInputSearchArgs) => (
|
|
|
43
43
|
components: { UInputSearch, UButton, UIcon },
|
|
44
44
|
setup() {
|
|
45
45
|
const slots = getSlotNames(UInputSearch.__name);
|
|
46
|
-
const errorMessage = computed(() =>
|
|
47
|
-
args.modelValue === "" && args.error !== ""
|
|
48
|
-
? "This field is required. Please enter a value."
|
|
49
|
-
: "",
|
|
50
|
-
);
|
|
46
|
+
const errorMessage = computed(() => (args.modelValue === "" ? args.error : ""));
|
|
51
47
|
|
|
52
48
|
return { args, slots, errorMessage };
|
|
53
49
|
},
|
|
@@ -102,13 +98,13 @@ export const Label = DefaultTemplate.bind({});
|
|
|
102
98
|
Label.args = { label: "Search for product or brand" };
|
|
103
99
|
|
|
104
100
|
export const Placeholder = DefaultTemplate.bind({});
|
|
105
|
-
Placeholder.args = { modelValue: "", placeholder: "Type to search..."
|
|
101
|
+
Placeholder.args = { modelValue: "", placeholder: "Type to search..." };
|
|
106
102
|
|
|
107
103
|
export const Description = DefaultTemplate.bind({});
|
|
108
104
|
Description.args = { description: "Search for additional details." };
|
|
109
105
|
|
|
110
106
|
export const Error = DefaultTemplate.bind({});
|
|
111
|
-
Error.args = {
|
|
107
|
+
Error.args = { error: "This field is required. Please enter a value." };
|
|
112
108
|
|
|
113
109
|
export const Disabled = DefaultTemplate.bind({});
|
|
114
110
|
Disabled.args = { disabled: true };
|
|
@@ -99,7 +99,7 @@ function getNewRowCount() {
|
|
|
99
99
|
function onEnter() {
|
|
100
100
|
const newRowCount = getNewRowCount();
|
|
101
101
|
|
|
102
|
-
if (newRowCount > currentRows.value) {
|
|
102
|
+
if (newRowCount > currentRows.value && !props.readonly) {
|
|
103
103
|
currentRows.value = newRowCount;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -107,7 +107,7 @@ function onEnter() {
|
|
|
107
107
|
function onBackspace() {
|
|
108
108
|
const newRowCount = getNewRowCount() - 1;
|
|
109
109
|
|
|
110
|
-
if (newRowCount < currentRows.value) {
|
|
110
|
+
if (newRowCount < currentRows.value && !props.readonly) {
|
|
111
111
|
currentRows.value = newRowCount;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
1
2
|
import {
|
|
2
3
|
getArgTypes,
|
|
3
4
|
getSlotNames,
|
|
@@ -8,6 +9,9 @@ import {
|
|
|
8
9
|
import UTextarea from "../../ui.form-textarea/UTextarea.vue";
|
|
9
10
|
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
10
11
|
import UCol from "../../ui.container-col/UCol.vue";
|
|
12
|
+
import URow from "../../ui.container-row/URow.vue";
|
|
13
|
+
import UAvatar from "../../ui.image-avatar/UAvatar.vue";
|
|
14
|
+
import tooltip from "../../directives/tooltip/vTooltip.ts";
|
|
11
15
|
|
|
12
16
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
13
17
|
import type { Props } from "../types.ts";
|
|
@@ -22,7 +26,9 @@ export default {
|
|
|
22
26
|
title: "Form Inputs & Controls / Textarea",
|
|
23
27
|
component: UTextarea,
|
|
24
28
|
args: {
|
|
25
|
-
label: "
|
|
29
|
+
label: "Your message",
|
|
30
|
+
modelValue:
|
|
31
|
+
"Hi there! I'd like to learn more about your services. When you have a moment, could you share some details?",
|
|
26
32
|
},
|
|
27
33
|
argTypes: {
|
|
28
34
|
...getArgTypes(UTextarea.__name),
|
|
@@ -38,11 +44,17 @@ const DefaultTemplate: StoryFn<UTextareaArgs> = (args: UTextareaArgs) => ({
|
|
|
38
44
|
components: { UTextarea, UIcon },
|
|
39
45
|
setup() {
|
|
40
46
|
const slots = getSlotNames(UTextarea.__name);
|
|
47
|
+
const errorMessage = computed(() => (args.modelValue === "" ? args.error : ""));
|
|
41
48
|
|
|
42
|
-
return { args, slots };
|
|
49
|
+
return { args, slots, errorMessage };
|
|
43
50
|
},
|
|
44
51
|
template: `
|
|
45
|
-
<UTextarea
|
|
52
|
+
<UTextarea
|
|
53
|
+
v-bind="args"
|
|
54
|
+
v-model="args.modelValue"
|
|
55
|
+
:error="errorMessage"
|
|
56
|
+
class="max-w-96"
|
|
57
|
+
>
|
|
46
58
|
${args.slotTemplate || getSlotsFragment("")}
|
|
47
59
|
</UTextarea>
|
|
48
60
|
`,
|
|
@@ -51,18 +63,28 @@ const DefaultTemplate: StoryFn<UTextareaArgs> = (args: UTextareaArgs) => ({
|
|
|
51
63
|
const EnumVariantTemplate: StoryFn<UTextareaArgs> = (args: UTextareaArgs, { argTypes }) => ({
|
|
52
64
|
components: { UTextarea, UCol },
|
|
53
65
|
setup() {
|
|
66
|
+
let filteredOptions = argTypes?.[args.enum]?.options;
|
|
67
|
+
|
|
68
|
+
if (args.enum === "labelAlign") {
|
|
69
|
+
filteredOptions = argTypes?.[args.enum]?.options?.filter(
|
|
70
|
+
(item) => item !== "right" && item !== "topWithDesc",
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
54
74
|
return {
|
|
55
75
|
args,
|
|
56
|
-
|
|
76
|
+
filteredOptions,
|
|
57
77
|
};
|
|
58
78
|
},
|
|
59
79
|
template: `
|
|
60
80
|
<UCol>
|
|
61
|
-
<div class="w-1/3" v-for="(option, index) in
|
|
81
|
+
<div class="w-1/3" v-for="(option, index) in filteredOptions" :key="index">
|
|
62
82
|
<UTextarea
|
|
63
83
|
v-bind="args"
|
|
64
84
|
:[args.enum]="option"
|
|
65
|
-
:
|
|
85
|
+
:description="option"
|
|
86
|
+
rows="3"
|
|
87
|
+
class="max-w-96"
|
|
66
88
|
/>
|
|
67
89
|
</div>
|
|
68
90
|
</UCol>
|
|
@@ -72,53 +94,75 @@ const EnumVariantTemplate: StoryFn<UTextareaArgs> = (args: UTextareaArgs, { argT
|
|
|
72
94
|
export const Default = DefaultTemplate.bind({});
|
|
73
95
|
Default.args = {};
|
|
74
96
|
|
|
75
|
-
export const LabelPlacement = EnumVariantTemplate.bind({});
|
|
76
|
-
LabelPlacement.args = { enum: "labelAlign" };
|
|
77
|
-
|
|
78
97
|
export const Placeholder = DefaultTemplate.bind({});
|
|
79
|
-
Placeholder.args = {
|
|
98
|
+
Placeholder.args = { modelValue: "", placeholder: "Enter text here..." };
|
|
99
|
+
|
|
100
|
+
export const Description = DefaultTemplate.bind({});
|
|
101
|
+
Description.args = { description: "Provide additional details in this field." };
|
|
102
|
+
|
|
103
|
+
export const Error = DefaultTemplate.bind({});
|
|
104
|
+
Error.args = { modelValue: "", error: "This field is required. Please enter a value." };
|
|
80
105
|
|
|
81
106
|
export const Disabled = DefaultTemplate.bind({});
|
|
82
107
|
Disabled.args = { disabled: true };
|
|
83
108
|
|
|
84
|
-
export const
|
|
85
|
-
|
|
109
|
+
export const LabelPlacement = EnumVariantTemplate.bind({});
|
|
110
|
+
LabelPlacement.args = { enum: "labelAlign" };
|
|
86
111
|
|
|
87
|
-
export const
|
|
88
|
-
|
|
112
|
+
export const Sizes = EnumVariantTemplate.bind({});
|
|
113
|
+
Sizes.args = { enum: "size" };
|
|
89
114
|
|
|
90
|
-
export const
|
|
91
|
-
|
|
115
|
+
export const Resizable = DefaultTemplate.bind({});
|
|
116
|
+
Resizable.args = { resizable: true };
|
|
117
|
+
|
|
118
|
+
export const RowsNumber = DefaultTemplate.bind({});
|
|
119
|
+
RowsNumber.args = { rows: "6" };
|
|
120
|
+
RowsNumber.parameters = {
|
|
121
|
+
docs: {
|
|
122
|
+
description: {
|
|
123
|
+
story: "You can set the number of visible rows via the `rows` prop.",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
92
127
|
|
|
93
128
|
export const Readonly = DefaultTemplate.bind({});
|
|
94
|
-
Readonly.args = { readonly: true, modelValue: "
|
|
129
|
+
Readonly.args = { readonly: true, modelValue: "Meeting scheduled for Monday at 10 AM." };
|
|
95
130
|
|
|
96
131
|
export const NoAutocomplete = DefaultTemplate.bind({});
|
|
97
|
-
NoAutocomplete.args = {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
color="black"
|
|
109
|
-
/>
|
|
110
|
-
</template>
|
|
111
|
-
`,
|
|
132
|
+
NoAutocomplete.args = {
|
|
133
|
+
noAutocomplete: true,
|
|
134
|
+
modelValue: "",
|
|
135
|
+
placeholder: "Try typing something here...",
|
|
136
|
+
};
|
|
137
|
+
NoAutocomplete.parameters = {
|
|
138
|
+
docs: {
|
|
139
|
+
description: {
|
|
140
|
+
story: "Disable browser's autocomplete.",
|
|
141
|
+
},
|
|
142
|
+
},
|
|
112
143
|
};
|
|
113
144
|
|
|
114
|
-
export const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
145
|
+
export const Slots: StoryFn<UTextareaArgs> = (args) => ({
|
|
146
|
+
components: { UTextarea, URow, UIcon, UAvatar },
|
|
147
|
+
directives: { tooltip },
|
|
148
|
+
setup() {
|
|
149
|
+
const switchModel = ref(false);
|
|
150
|
+
|
|
151
|
+
return { args, switchModel };
|
|
152
|
+
},
|
|
153
|
+
template: `
|
|
154
|
+
<URow no-mobile>
|
|
155
|
+
<UTextarea v-bind="args">
|
|
156
|
+
<template #left>
|
|
157
|
+
<UAvatar />
|
|
158
|
+
</template>
|
|
159
|
+
</UTextarea>
|
|
160
|
+
|
|
161
|
+
<UTextarea v-bind="args">
|
|
162
|
+
<template #right>
|
|
163
|
+
<UIcon name="send" color="green" v-tooltip="'Send message'" />
|
|
164
|
+
</template>
|
|
165
|
+
</UTextarea>
|
|
166
|
+
</URow>
|
|
123
167
|
`,
|
|
124
|
-
};
|
|
168
|
+
});
|