vueless 1.4.7-beta.1 → 1.4.7-beta.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.
- package/icons/storybook/cloud_sync.svg +1 -0
- package/icons/storybook/date_range.svg +1 -0
- package/icons/storybook/event.svg +1 -0
- package/icons/storybook/folder.svg +1 -0
- package/icons/storybook/format_quote.svg +1 -0
- package/icons/storybook/local_shipping.svg +1 -0
- package/icons/storybook/location_city.svg +1 -0
- package/icons/storybook/mark_email_unread.svg +1 -0
- package/icons/storybook/notifications.svg +1 -0
- package/icons/storybook/shield.svg +1 -0
- package/icons/storybook/workspace_premium.svg +1 -0
- package/package.json +1 -1
- package/ui.form-checkbox/UCheckbox.vue +0 -5
- package/ui.form-checkbox/storybook/stories.ts +56 -18
- package/ui.form-checkbox/tests/UCheckbox.test.ts +0 -17
- package/ui.form-checkbox-group/storybook/stories.ts +61 -0
- package/ui.form-date-picker/storybook/stories.ts +85 -37
- package/ui.form-date-picker-range/storybook/stories.ts +97 -38
- package/ui.form-input/storybook/stories.ts +75 -37
- package/ui.form-input-file/storybook/stories.ts +44 -5
- package/ui.form-input-number/storybook/stories.ts +66 -28
- package/ui.form-input-password/storybook/stories.ts +94 -50
- package/ui.form-input-search/storybook/stories.ts +40 -4
- package/ui.form-label/ULabel.vue +0 -6
- package/ui.form-label/storybook/stories.ts +46 -24
- package/ui.form-label/tests/ULabel.test.ts +0 -12
- package/ui.form-radio/URadio.vue +0 -5
- package/ui.form-radio/storybook/stories.ts +65 -25
- package/ui.form-radio/tests/URadio.test.ts +0 -17
- package/ui.form-radio-group/storybook/stories.ts +67 -0
- package/ui.form-select/storybook/stories.ts +99 -44
- package/ui.form-switch/storybook/stories.ts +35 -11
- package/ui.form-textarea/storybook/stories.ts +61 -20
- package/ui.text-files/storybook/stories.ts +30 -13
|
@@ -114,29 +114,51 @@ Sizes.args = { enum: "size" };
|
|
|
114
114
|
export const LabelAlign = EnumTemplate.bind({});
|
|
115
115
|
LabelAlign.args = { enum: "align" };
|
|
116
116
|
|
|
117
|
-
export const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
117
|
+
export const Slots: StoryFn<ULabelArgs> = () => ({
|
|
118
|
+
components: { ULabel, UText, URow, ULink, UIcon, UCol, UChip },
|
|
119
|
+
template: `
|
|
120
|
+
<UCol gap="3xl">
|
|
121
|
+
<ULabel label="Work email">
|
|
122
|
+
<UText label="johndoe@example.com" />
|
|
123
|
+
<template #label="{ label }">
|
|
124
|
+
<URow align="center" gap="xs">
|
|
125
|
+
<UIcon name="mail" size="sm" class="text-primary" />
|
|
126
|
+
<UChip icon="asterisk" color="error" size="xs">
|
|
127
|
+
<UText :label="label" class="mr-2" />
|
|
128
|
+
</UChip>
|
|
129
|
+
</URow>
|
|
130
|
+
</template>
|
|
131
|
+
</ULabel>
|
|
131
132
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
133
|
+
<ULabel label="Work email">
|
|
134
|
+
<UText label="johndoe@example.com" />
|
|
135
|
+
<template #description>
|
|
136
|
+
<URow align="center" gap="2xs" class="text-neutral">
|
|
137
|
+
<UIcon name="mark_email_unread" size="xs" color="primary" />
|
|
138
|
+
<UText size="sm">
|
|
139
|
+
We will send a
|
|
140
|
+
<ULink label="confirmation link" underlined size="sm" />
|
|
141
|
+
to this address.
|
|
142
|
+
</UText>
|
|
143
|
+
</URow>
|
|
144
|
+
</template>
|
|
145
|
+
</ULabel>
|
|
146
|
+
|
|
147
|
+
<ULabel label="Email" :error="true">
|
|
148
|
+
<UText label="not-an-email" />
|
|
149
|
+
<template #error>
|
|
150
|
+
<URow align="center" gap="2xs">
|
|
151
|
+
<UIcon name="error" size="xs" color="error" />
|
|
152
|
+
<UText size="sm" color="error">
|
|
153
|
+
<ul>
|
|
154
|
+
<li>Email address format is invalid</li>
|
|
155
|
+
<li>Use a name@domain.com style address</li>
|
|
156
|
+
<li>Remove spaces and special characters from the local part</li>
|
|
157
|
+
</ul>
|
|
158
|
+
</UText>
|
|
159
|
+
</URow>
|
|
160
|
+
</template>
|
|
161
|
+
</ULabel>
|
|
162
|
+
</UCol>
|
|
141
163
|
`,
|
|
142
|
-
};
|
|
164
|
+
});
|
|
@@ -369,18 +369,6 @@ describe("ULabel.vue", () => {
|
|
|
369
369
|
|
|
370
370
|
expect(component.find("[vl-key='label']").text()).toBe(slotContent);
|
|
371
371
|
});
|
|
372
|
-
|
|
373
|
-
it("Bottom – renders content from bottom slot", () => {
|
|
374
|
-
const testClass = "custom-bottom";
|
|
375
|
-
|
|
376
|
-
const component = mount(ULabel, {
|
|
377
|
-
slots: {
|
|
378
|
-
bottom: `<div class="${testClass}">Bottom Slot Content</div>`,
|
|
379
|
-
},
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
expect(component.find(`.${testClass}`).exists()).toBe(true);
|
|
383
|
-
});
|
|
384
372
|
});
|
|
385
373
|
|
|
386
374
|
describe("Events", () => {
|
package/ui.form-radio/URadio.vue
CHANGED
|
@@ -151,10 +151,5 @@ const { getDataTest, radioLabelAttrs, radioAttrs } = useUI<Config>(defaultConfig
|
|
|
151
151
|
:data-test="getDataTest()"
|
|
152
152
|
@change="onChange"
|
|
153
153
|
/>
|
|
154
|
-
|
|
155
|
-
<template #bottom>
|
|
156
|
-
<!-- @slot Use it to add something below the radio. -->
|
|
157
|
-
<slot name="bottom" />
|
|
158
|
-
</template>
|
|
159
154
|
</ULabel>
|
|
160
155
|
</template>
|
|
@@ -15,6 +15,8 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
|
15
15
|
|
|
16
16
|
import type { Meta, StoryFn } from "@storybook/vue3-vite";
|
|
17
17
|
import type { Props } from "../types";
|
|
18
|
+
import { ref } from "vue";
|
|
19
|
+
import UCol from "../../ui.container-col/UCol.vue";
|
|
18
20
|
|
|
19
21
|
interface URadioArgs extends Props {
|
|
20
22
|
slotTemplate?: string;
|
|
@@ -107,30 +109,68 @@ Sizes.args = { name: "Sizes", enum: "size", label: "{enumValue}", modelValue: 1
|
|
|
107
109
|
export const Colors = EnumTemplate.bind({});
|
|
108
110
|
Colors.args = { name: "Colors", enum: "color", label: "{enumValue}", modelValue: 1 };
|
|
109
111
|
|
|
110
|
-
export const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
export const Slots: StoryFn<URadioArgs> = (args) => ({
|
|
113
|
+
components: { URadio, UCol, UText, URow, ULink, UIcon },
|
|
114
|
+
setup: () => ({
|
|
115
|
+
args,
|
|
116
|
+
labelModel: ref(""),
|
|
117
|
+
descriptionModel: ref(""),
|
|
118
|
+
errorModel: ref(""),
|
|
119
|
+
}),
|
|
120
|
+
template: `
|
|
121
|
+
<UCol gap="3xl">
|
|
122
|
+
<URadio
|
|
123
|
+
v-bind="args"
|
|
124
|
+
v-model="labelModel"
|
|
125
|
+
name="LabelSlot"
|
|
126
|
+
value="courier"
|
|
127
|
+
>
|
|
128
|
+
<template #label>
|
|
129
|
+
<URow align="center" gap="2xs">
|
|
130
|
+
<UText>Courier delivery</UText>
|
|
131
|
+
<UIcon name="local_shipping" size="xs" color="neutral" />
|
|
132
|
+
</URow>
|
|
133
|
+
</template>
|
|
134
|
+
</URadio>
|
|
124
135
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
<URadio
|
|
137
|
+
v-bind="args"
|
|
138
|
+
v-model="descriptionModel"
|
|
139
|
+
name="DescriptionSlot"
|
|
140
|
+
value="pro"
|
|
141
|
+
>
|
|
142
|
+
<template #description>
|
|
143
|
+
<URow align="center" gap="2xs" class="text-neutral">
|
|
144
|
+
<UIcon name="workspace_premium" size="xs" class="mt-0.5" color="primary" />
|
|
145
|
+
<UText size="sm">
|
|
146
|
+
Includes all core features.
|
|
147
|
+
<ULink label="Compare plans" underlined size="sm" />.
|
|
148
|
+
</UText>
|
|
149
|
+
</URow>
|
|
150
|
+
</template>
|
|
151
|
+
</URadio>
|
|
152
|
+
|
|
153
|
+
<URadio
|
|
154
|
+
v-bind="args"
|
|
155
|
+
v-model="errorModel"
|
|
156
|
+
name="ErrorSlot"
|
|
157
|
+
label="Select"
|
|
158
|
+
value="1"
|
|
159
|
+
:error="true"
|
|
160
|
+
>
|
|
161
|
+
<template #error>
|
|
162
|
+
<URow align="center" gap="2xs">
|
|
163
|
+
<UIcon name="error" size="xs" color="error" />
|
|
164
|
+
<UText size="sm" color="error">
|
|
165
|
+
<ul>
|
|
166
|
+
<li>You must select one of the available options</li>
|
|
167
|
+
<li>This field is required to proceed</li>
|
|
168
|
+
<li>Choose an option above to clear this error</li>
|
|
169
|
+
</ul>
|
|
170
|
+
</UText>
|
|
171
|
+
</URow>
|
|
172
|
+
</template>
|
|
173
|
+
</URadio>
|
|
174
|
+
</UCol>
|
|
135
175
|
`,
|
|
136
|
-
};
|
|
176
|
+
});
|
|
@@ -241,22 +241,5 @@ describe("URadio.vue", () => {
|
|
|
241
241
|
|
|
242
242
|
expect(errorElement.text()).toBe(customError);
|
|
243
243
|
});
|
|
244
|
-
|
|
245
|
-
it("Bottom – renders custom content from bottom slot", () => {
|
|
246
|
-
const customBottomContent = "Custom Bottom Content";
|
|
247
|
-
|
|
248
|
-
const component = mount(URadio, {
|
|
249
|
-
props: {
|
|
250
|
-
label: "Test Label",
|
|
251
|
-
},
|
|
252
|
-
slots: {
|
|
253
|
-
bottom: customBottomContent,
|
|
254
|
-
},
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
const labelComponent = component.getComponent(ULabel);
|
|
258
|
-
|
|
259
|
-
expect(labelComponent.text()).toContain(customBottomContent);
|
|
260
|
-
});
|
|
261
244
|
});
|
|
262
245
|
});
|
|
@@ -13,9 +13,12 @@ import UCol from "../../ui.container-col/UCol.vue";
|
|
|
13
13
|
import URow from "../../ui.container-row/URow.vue";
|
|
14
14
|
import UBadge from "../../ui.text-badge/UBadge.vue";
|
|
15
15
|
import UText from "../../ui.text-block/UText.vue";
|
|
16
|
+
import ULink from "../../ui.button-link/ULink.vue";
|
|
17
|
+
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
16
18
|
|
|
17
19
|
import type { Meta, StoryFn } from "@storybook/vue3-vite";
|
|
18
20
|
import type { Props } from "../types";
|
|
21
|
+
import { ref } from "vue";
|
|
19
22
|
|
|
20
23
|
interface URadioGroupArgs extends Props {
|
|
21
24
|
slotTemplate?: string;
|
|
@@ -170,3 +173,67 @@ CustomKeys.parameters = {
|
|
|
170
173
|
},
|
|
171
174
|
},
|
|
172
175
|
};
|
|
176
|
+
|
|
177
|
+
export const Slots: StoryFn<URadioGroupArgs> = (args) => ({
|
|
178
|
+
components: { URadioGroup, UCol, UText, URow, ULink, UIcon },
|
|
179
|
+
setup: () => ({
|
|
180
|
+
args,
|
|
181
|
+
modelValueLabel: ref(null),
|
|
182
|
+
modelValueDescription: ref(null),
|
|
183
|
+
modelValueError: ref(null),
|
|
184
|
+
}),
|
|
185
|
+
template: `
|
|
186
|
+
<UCol gap="3xl">
|
|
187
|
+
<URadioGroup
|
|
188
|
+
v-bind="args"
|
|
189
|
+
v-model="modelValueLabel"
|
|
190
|
+
name="LabelSlot"
|
|
191
|
+
>
|
|
192
|
+
<template #label>
|
|
193
|
+
<URow align="center" gap="2xs">
|
|
194
|
+
<UText>Choose a delivery option</UText>
|
|
195
|
+
<UIcon name="local_shipping" size="xs" color="neutral" />
|
|
196
|
+
</URow>
|
|
197
|
+
</template>
|
|
198
|
+
</URadioGroup>
|
|
199
|
+
|
|
200
|
+
<URadioGroup
|
|
201
|
+
v-bind="args"
|
|
202
|
+
v-model="modelValueDescription"
|
|
203
|
+
name="SlotsDescription"
|
|
204
|
+
label="Delivery"
|
|
205
|
+
>
|
|
206
|
+
<template #description>
|
|
207
|
+
<URow align="center" gap="2xs" class="text-neutral">
|
|
208
|
+
<UIcon name="local_shipping" size="xs" color="primary" />
|
|
209
|
+
<UText size="sm">
|
|
210
|
+
Shipping times are estimates.
|
|
211
|
+
<ULink label="Full policy" underlined size="sm" />.
|
|
212
|
+
</UText>
|
|
213
|
+
</URow>
|
|
214
|
+
</template>
|
|
215
|
+
</URadioGroup>
|
|
216
|
+
|
|
217
|
+
<URadioGroup
|
|
218
|
+
v-bind="args"
|
|
219
|
+
v-model="modelValueError"
|
|
220
|
+
name="SlotsError"
|
|
221
|
+
label="Delivery"
|
|
222
|
+
:error="true"
|
|
223
|
+
>
|
|
224
|
+
<template #error>
|
|
225
|
+
<URow align="center" gap="2xs">
|
|
226
|
+
<UIcon name="error" size="xs" color="error" />
|
|
227
|
+
<UText size="sm" color="error">
|
|
228
|
+
<ul>
|
|
229
|
+
<li>Please choose one option from the group</li>
|
|
230
|
+
<li>At least one selection is required</li>
|
|
231
|
+
<li>Review the labels and pick a valid answer</li>
|
|
232
|
+
</ul>
|
|
233
|
+
</UText>
|
|
234
|
+
</URow>
|
|
235
|
+
</template>
|
|
236
|
+
</URadioGroup>
|
|
237
|
+
</UCol>
|
|
238
|
+
`,
|
|
239
|
+
});
|
|
@@ -334,54 +334,109 @@ export const IconProps: StoryFn<USelectArgs> = (args) => ({
|
|
|
334
334
|
});
|
|
335
335
|
|
|
336
336
|
export const Slots: StoryFn<USelectArgs> = (args) => ({
|
|
337
|
-
components: { USelect, URow, UIcon, UText },
|
|
338
|
-
setup: () => ({
|
|
337
|
+
components: { USelect, URow, UCol, UIcon, UText, ULink },
|
|
338
|
+
setup: () => ({
|
|
339
|
+
args,
|
|
340
|
+
leftSlotModel: ref("paypal"),
|
|
341
|
+
rightSlotModel: ref("bank"),
|
|
342
|
+
descriptionSlotModel: ref(null),
|
|
343
|
+
errorSlotModel: ref(null),
|
|
344
|
+
}),
|
|
339
345
|
template: `
|
|
340
|
-
<
|
|
341
|
-
<
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
<
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
346
|
+
<UCol gap="3xl">
|
|
347
|
+
<URow block>
|
|
348
|
+
<USelect
|
|
349
|
+
v-model="leftSlotModel"
|
|
350
|
+
label="Select Payment Method"
|
|
351
|
+
:options="[
|
|
352
|
+
{ label: 'Visa', value: 'visa', icon: 'credit_card', details: '•••• 4242' },
|
|
353
|
+
{ label: 'PayPal', value: 'paypal', icon: 'payments', details: 'user@example.com' },
|
|
354
|
+
{ label: 'Bank Transfer', value: 'bank', icon: 'account_balance', details: 'Acct **** 1234' },
|
|
355
|
+
{ label: 'Apple Pay', value: 'apple', icon: 'phone_iphone', details: 'iPhone 15' },
|
|
356
|
+
]"
|
|
357
|
+
>
|
|
358
|
+
<template #left="{ options }">
|
|
359
|
+
<UIcon
|
|
360
|
+
v-if="leftSlotModel"
|
|
361
|
+
:name="options?.icon"
|
|
362
|
+
color="primary"
|
|
363
|
+
size="sm"
|
|
364
|
+
/>
|
|
365
|
+
</template>
|
|
366
|
+
</USelect>
|
|
367
|
+
|
|
368
|
+
<USelect
|
|
369
|
+
v-model="rightSlotModel"
|
|
370
|
+
label="Select Payment Method"
|
|
371
|
+
:options="[
|
|
372
|
+
{ label: 'Visa', value: 'visa', icon: 'credit_card', details: '•••• 4242' },
|
|
373
|
+
{ label: 'PayPal', value: 'paypal', icon: 'payments', details: 'user@example.com' },
|
|
374
|
+
{ label: 'Bank Transfer', value: 'bank', icon: 'account_balance', details: 'Acct **** 1234' },
|
|
375
|
+
{ label: 'Apple Pay', value: 'apple', icon: 'phone_iphone', details: 'iPhone 15' },
|
|
376
|
+
]"
|
|
377
|
+
>
|
|
378
|
+
<template #right="{ options }">
|
|
379
|
+
<UText
|
|
380
|
+
v-if="rightSlotModel"
|
|
381
|
+
size="sm"
|
|
382
|
+
variant="lifted"
|
|
383
|
+
class="text-nowrap"
|
|
384
|
+
>
|
|
385
|
+
{{ options?.details }}
|
|
386
|
+
</UText>
|
|
387
|
+
</template>
|
|
388
|
+
</USelect>
|
|
389
|
+
</URow>
|
|
360
390
|
|
|
361
|
-
<
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
391
|
+
<URow block>
|
|
392
|
+
<USelect
|
|
393
|
+
v-bind="args"
|
|
394
|
+
v-model="descriptionSlotModel"
|
|
395
|
+
label="City"
|
|
396
|
+
:options="args.options"
|
|
397
|
+
>
|
|
398
|
+
<template #description>
|
|
399
|
+
<URow align="center" gap="2xs" class="text-neutral">
|
|
400
|
+
<UIcon name="location_city" size="xs" color="primary" />
|
|
401
|
+
<UText size="sm">
|
|
402
|
+
Only cities we ship to.
|
|
403
|
+
<ULink label="Shipping zones" underlined size="sm" />.
|
|
404
|
+
</UText>
|
|
405
|
+
</URow>
|
|
406
|
+
</template>
|
|
407
|
+
</USelect>
|
|
408
|
+
|
|
409
|
+
<USelect
|
|
410
|
+
v-bind="args"
|
|
411
|
+
v-model="errorSlotModel"
|
|
412
|
+
label="City"
|
|
413
|
+
:options="args.options"
|
|
414
|
+
:error="true"
|
|
415
|
+
>
|
|
416
|
+
<template #error>
|
|
417
|
+
<URow align="center" gap="2xs">
|
|
418
|
+
<UIcon name="error" size="xs" color="error" />
|
|
419
|
+
<UText size="sm" color="error">
|
|
420
|
+
<ul>
|
|
421
|
+
<li>Please select an option from the list</li>
|
|
422
|
+
<li>The current value is not available anymore</li>
|
|
423
|
+
<li>Pick a valid choice to continue</li>
|
|
424
|
+
</ul>
|
|
425
|
+
</UText>
|
|
426
|
+
</URow>
|
|
427
|
+
</template>
|
|
428
|
+
</USelect>
|
|
429
|
+
</URow>
|
|
430
|
+
</UCol>
|
|
383
431
|
`,
|
|
384
432
|
});
|
|
433
|
+
Slots.parameters = {
|
|
434
|
+
docs: {
|
|
435
|
+
story: {
|
|
436
|
+
height: "400px",
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
};
|
|
385
440
|
|
|
386
441
|
export const ToggleSlots: StoryFn<USelectArgs> = (args) => ({
|
|
387
442
|
components: { USelect, URow, UIcon },
|
|
@@ -15,6 +15,7 @@ import ULink from "../../ui.button-link/ULink.vue";
|
|
|
15
15
|
|
|
16
16
|
import type { Meta, StoryFn } from "@storybook/vue3-vite";
|
|
17
17
|
import type { Props } from "../types";
|
|
18
|
+
import { ref } from "vue";
|
|
18
19
|
|
|
19
20
|
interface USwitchArgs extends Props {
|
|
20
21
|
slotTemplate?: string;
|
|
@@ -89,15 +90,38 @@ ToggleIcon.args = { toggleIcon: true };
|
|
|
89
90
|
export const Disabled = DefaultTemplate.bind({});
|
|
90
91
|
Disabled.args = { disabled: true };
|
|
91
92
|
|
|
92
|
-
export const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
export const Slots: StoryFn<USwitchArgs> = (args) => ({
|
|
94
|
+
components: { USwitch, UCol, UText, URow, ULink, UIcon },
|
|
95
|
+
setup: () => ({ args, labelSlotValue: ref(false), descriptionSlotValue: ref(false) }),
|
|
96
|
+
template: `
|
|
97
|
+
<UCol gap="3xl">
|
|
98
|
+
<USwitch
|
|
99
|
+
v-bind="args"
|
|
100
|
+
v-model="labelSlotValue"
|
|
101
|
+
label="Enable Notifications"
|
|
102
|
+
>
|
|
103
|
+
<template #label="{ label }">
|
|
104
|
+
<URow gap="2xs" align="center">
|
|
105
|
+
<UText :label="label" />
|
|
106
|
+
<UIcon name="notifications" size="xs" />
|
|
107
|
+
</URow>
|
|
108
|
+
</template>
|
|
109
|
+
</USwitch>
|
|
110
|
+
|
|
111
|
+
<USwitch
|
|
112
|
+
v-model="descriptionSlotValue"
|
|
113
|
+
label="Auto-save drafts"
|
|
114
|
+
>
|
|
115
|
+
<template #description>
|
|
116
|
+
<URow align="center" gap="2xs" class="text-neutral">
|
|
117
|
+
<UIcon name="cloud_sync" size="xs" class="mt-0.5" color="primary" />
|
|
118
|
+
<UText size="sm">
|
|
119
|
+
Drafts sync across devices.
|
|
120
|
+
<ULink label="Learn more" underlined size="sm" />.
|
|
121
|
+
</UText>
|
|
122
|
+
</URow>
|
|
123
|
+
</template>
|
|
124
|
+
</USwitch>
|
|
125
|
+
</UCol>
|
|
102
126
|
`,
|
|
103
|
-
};
|
|
127
|
+
});
|
|
@@ -12,9 +12,11 @@ import UCol from "../../ui.container-col/UCol.vue";
|
|
|
12
12
|
import URow from "../../ui.container-row/URow.vue";
|
|
13
13
|
import tooltip from "../../v.tooltip/vTooltip";
|
|
14
14
|
import UText from "../../ui.text-block/UText.vue";
|
|
15
|
+
import ULink from "../../ui.button-link/ULink.vue";
|
|
15
16
|
|
|
16
17
|
import type { Meta, StoryFn } from "@storybook/vue3-vite";
|
|
17
18
|
import type { Props } from "../types";
|
|
19
|
+
import { ref } from "vue";
|
|
18
20
|
|
|
19
21
|
interface UTextareaArgs extends Props {
|
|
20
22
|
slotTemplate?: string;
|
|
@@ -138,27 +140,66 @@ NoAutocomplete.parameters = {
|
|
|
138
140
|
};
|
|
139
141
|
|
|
140
142
|
export const Slots: StoryFn<UTextareaArgs> = (args) => ({
|
|
141
|
-
components: { UTextarea, URow, UIcon, UText },
|
|
143
|
+
components: { UTextarea, URow, UCol, UIcon, UText, ULink },
|
|
142
144
|
directives: { tooltip },
|
|
143
|
-
setup: () => ({
|
|
145
|
+
setup: () => ({
|
|
146
|
+
args,
|
|
147
|
+
descriptionSlotValue: ref(""),
|
|
148
|
+
errorSlotValue: ref(""),
|
|
149
|
+
}),
|
|
144
150
|
template: `
|
|
145
|
-
<
|
|
146
|
-
<
|
|
147
|
-
<
|
|
148
|
-
<
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
<
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
151
|
+
<UCol gap="3xl">
|
|
152
|
+
<URow block>
|
|
153
|
+
<UTextarea v-bind="args" v-model="args.modelValue" :max-length="300">
|
|
154
|
+
<template #left>
|
|
155
|
+
<UText :label="args.modelValue?.length + '/300'" variant="lifted" />
|
|
156
|
+
</template>
|
|
157
|
+
</UTextarea>
|
|
158
|
+
|
|
159
|
+
<UTextarea v-bind="args">
|
|
160
|
+
<template #right>
|
|
161
|
+
<UIcon
|
|
162
|
+
name="send"
|
|
163
|
+
color="success"
|
|
164
|
+
v-tooltip="'Send message'"
|
|
165
|
+
interactive
|
|
166
|
+
/>
|
|
167
|
+
</template>
|
|
168
|
+
</UTextarea>
|
|
169
|
+
</URow>
|
|
170
|
+
|
|
171
|
+
<URow block>
|
|
172
|
+
<UTextarea v-model="descriptionSlotValue" label="Feedback">
|
|
173
|
+
<template #description>
|
|
174
|
+
<URow align="center" gap="2xs" class="text-neutral">
|
|
175
|
+
<UIcon name="format_quote" size="xs" class="mt-0.5" color="primary" />
|
|
176
|
+
<UText size="sm">
|
|
177
|
+
Markdown is not supported. See
|
|
178
|
+
<ULink label="content guidelines" underlined size="sm" />.
|
|
179
|
+
</UText>
|
|
180
|
+
</URow>
|
|
181
|
+
</template>
|
|
182
|
+
</UTextarea>
|
|
183
|
+
|
|
184
|
+
<UTextarea
|
|
185
|
+
v-model="errorSlotValue"
|
|
186
|
+
label="Message"
|
|
187
|
+
:error="true"
|
|
188
|
+
>
|
|
189
|
+
<template #error>
|
|
190
|
+
<URow align="center" gap="2xs">
|
|
191
|
+
<UIcon name="error" size="xs" color="error" />
|
|
192
|
+
<UText size="sm" color="error">
|
|
193
|
+
<ul>
|
|
194
|
+
<li>Message is too short (minimum 10 characters)</li>
|
|
195
|
+
<li>Remove disallowed characters from your text</li>
|
|
196
|
+
<li>Try again after fixing the issues above</li>
|
|
197
|
+
</ul>
|
|
198
|
+
</UText>
|
|
199
|
+
</URow>
|
|
200
|
+
</template>
|
|
201
|
+
</UTextarea>
|
|
202
|
+
</URow>
|
|
203
|
+
</UCol>
|
|
163
204
|
`,
|
|
164
205
|
});
|