sprintify-ui 0.0.11 → 0.0.12
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/dist/sprintify-ui.es.js +4906 -3570
- package/dist/style.css +1 -1
- package/dist/types/src/components/BaseCharacterCounter.vue.d.ts +143 -0
- package/dist/types/src/components/BaseInput.vue.d.ts +39 -5
- package/dist/types/src/components/BaseLoadingCover.vue.d.ts +72 -0
- package/dist/types/src/components/BaseModalCenter.vue.d.ts +8 -8
- package/dist/types/src/components/BaseModalSide.vue.d.ts +8 -8
- package/dist/types/src/components/BasePagination.vue.d.ts +105 -13
- package/dist/types/src/components/BasePaginationSimple.vue.d.ts +2 -2
- package/dist/types/src/components/BaseSelect.vue.d.ts +130 -26
- package/dist/types/src/components/BaseSwitch.vue.d.ts +15 -8
- package/dist/types/src/components/BaseTabItem.vue.d.ts +26 -4
- package/dist/types/src/components/BaseTextareaAutoresize.vue.d.ts +175 -21
- package/dist/types/src/components/index.d.ts +24 -1
- package/dist/types/src/index.d.ts +4 -0
- package/package.json +1 -1
- package/src/components/BaseCharacterCounter.stories.js +30 -0
- package/src/components/BaseCharacterCounter.vue +60 -0
- package/src/components/BaseDataIterator.stories.js +2 -2
- package/src/components/BaseDataIterator.vue +32 -38
- package/src/components/BaseDataTable.stories.js +2 -2
- package/src/components/BaseFileUploader.vue +4 -0
- package/src/components/BaseInput.stories.js +46 -0
- package/src/components/BaseInput.vue +10 -2
- package/src/components/BaseInputLabel.stories.js +31 -0
- package/src/components/BaseInputLabel.vue +1 -1
- package/src/components/BaseLoadingCover.stories.js +55 -0
- package/src/components/BaseLoadingCover.vue +19 -1
- package/src/components/BaseMenu.stories.js +125 -0
- package/src/components/BaseModalCenter.stories.js +61 -0
- package/src/components/BaseModalCenter.vue +2 -2
- package/src/components/BaseModalSide.stories.js +55 -0
- package/src/components/BaseModalSide.vue +2 -2
- package/src/components/BaseNavbar.stories.js +150 -0
- package/src/components/BaseNavbar.vue +3 -0
- package/src/components/BaseNavbarItem.vue +1 -0
- package/src/components/BaseNavbarItemContent.vue +3 -0
- package/src/components/BasePagination.stories.js +32 -0
- package/src/components/BasePagination.vue +126 -40
- package/src/components/BasePaginationSimple.vue +3 -3
- package/src/components/BasePanel.stories.js +56 -0
- package/src/components/BasePassword.stories.js +36 -0
- package/src/components/BasePassword.vue +11 -5
- package/src/components/BaseProcessRing.stories.js +27 -0
- package/src/components/BaseReadMore.stories.js +30 -0
- package/src/components/BaseReadMore.vue +1 -1
- package/src/components/BaseSelect.stories.js +67 -0
- package/src/components/BaseSelect.vue +144 -44
- package/src/components/BaseSideNavigation.stories.js +55 -0
- package/src/components/BaseSideNavigation.vue +7 -2
- package/src/components/BaseSideNavigationItem.vue +11 -3
- package/src/components/BaseSkeleton.stories.js +36 -0
- package/src/components/BaseSwitch.stories.js +101 -0
- package/src/components/BaseSwitch.vue +90 -12
- package/src/components/BaseSystemAlert.stories.js +63 -0
- package/src/components/BaseTabItem.vue +19 -6
- package/src/components/BaseTabs.stories.js +54 -0
- package/src/components/BaseTabs.vue +3 -3
- package/src/components/BaseTextarea.stories.js +35 -0
- package/src/components/BaseTextarea.vue +1 -1
- package/src/components/BaseTextareaAutoresize.stories.js +49 -0
- package/src/components/BaseTextareaAutoresize.vue +83 -87
- package/src/components/index.ts +46 -0
- package/src/lang/en.json +1 -0
- package/src/lang/fr.json +1 -0
- package/dist/types/src/components/BaseWordCount.vue.d.ts +0 -31
- package/src/components/BaseWordCount.vue +0 -36
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import BaseSwitch from './BaseSwitch.vue';
|
|
2
|
+
import BaseContainer from './BaseContainer.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Form/BaseSwitch',
|
|
6
|
+
component: BaseSwitch,
|
|
7
|
+
args: {},
|
|
8
|
+
argTypes: {
|
|
9
|
+
color: {
|
|
10
|
+
control: { type: 'select' },
|
|
11
|
+
options: [
|
|
12
|
+
'primary',
|
|
13
|
+
'success',
|
|
14
|
+
'info',
|
|
15
|
+
'warning',
|
|
16
|
+
'danger',
|
|
17
|
+
'light',
|
|
18
|
+
'dark',
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
control: { type: 'select' },
|
|
23
|
+
options: ['xs', 'sm', 'base', 'lg', 'xl'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const Template = (args) => ({
|
|
29
|
+
components: {
|
|
30
|
+
BaseSwitch,
|
|
31
|
+
BaseContainer,
|
|
32
|
+
},
|
|
33
|
+
setup() {
|
|
34
|
+
const value = ref(true);
|
|
35
|
+
return { args, value };
|
|
36
|
+
},
|
|
37
|
+
template: `
|
|
38
|
+
<BaseSwitch v-model="value" v-bind="args">
|
|
39
|
+
<span class="text-slate-600">Label</span>
|
|
40
|
+
</BaseSwitch>
|
|
41
|
+
`,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const Demo = Template.bind({});
|
|
45
|
+
Demo.args = {};
|
|
46
|
+
|
|
47
|
+
const colors = [
|
|
48
|
+
'primary',
|
|
49
|
+
'info',
|
|
50
|
+
'success',
|
|
51
|
+
'warning',
|
|
52
|
+
'danger',
|
|
53
|
+
'light',
|
|
54
|
+
'dark',
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
const Colors = (args) => ({
|
|
58
|
+
components: {
|
|
59
|
+
BaseSwitch,
|
|
60
|
+
BaseContainer,
|
|
61
|
+
},
|
|
62
|
+
setup() {
|
|
63
|
+
const value = ref(true);
|
|
64
|
+
return { args, value, colors };
|
|
65
|
+
},
|
|
66
|
+
template: `
|
|
67
|
+
<div v-for="color in colors" class="mb-1">
|
|
68
|
+
<p class="text-xs text-slate-600 leading-tight mb-1">{{ color }}</p>
|
|
69
|
+
<BaseSwitch v-model="value" :color="color">
|
|
70
|
+
<span class="text-slate-600">Label</span>
|
|
71
|
+
</BaseSwitch>
|
|
72
|
+
</div>
|
|
73
|
+
`,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const AllColors = Colors.bind({});
|
|
77
|
+
AllColors.args = {};
|
|
78
|
+
|
|
79
|
+
const sizes = ['xs', 'sm', 'base', 'lg', 'xl'];
|
|
80
|
+
|
|
81
|
+
const Sizes = (args) => ({
|
|
82
|
+
components: {
|
|
83
|
+
BaseSwitch,
|
|
84
|
+
BaseContainer,
|
|
85
|
+
},
|
|
86
|
+
setup() {
|
|
87
|
+
const value = ref(true);
|
|
88
|
+
return { args, value, sizes };
|
|
89
|
+
},
|
|
90
|
+
template: `
|
|
91
|
+
<div v-for="size in sizes" class="mb-1">
|
|
92
|
+
<p class="text-xs text-slate-600 leading-tight mb-1">{{ size }}</p>
|
|
93
|
+
<BaseSwitch v-model="value" :size="size">
|
|
94
|
+
<span class="text-slate-600">Label</span>
|
|
95
|
+
</BaseSwitch>
|
|
96
|
+
</div>
|
|
97
|
+
`,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export const AllSizes = Sizes.bind({});
|
|
101
|
+
AllSizes.args = {};
|
|
@@ -5,17 +5,23 @@
|
|
|
5
5
|
:model-value="modelValue"
|
|
6
6
|
:class="[
|
|
7
7
|
modelValue ? bg : 'bg-slate-200',
|
|
8
|
-
'relative inline-flex
|
|
8
|
+
'relative inline-flex shrink-0 cursor-pointer items-center rounded-full transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-offset-2 ',
|
|
9
9
|
focus,
|
|
10
10
|
]"
|
|
11
|
+
:style="{
|
|
12
|
+
width: width + 'px',
|
|
13
|
+
height: height + 'px',
|
|
14
|
+
}"
|
|
11
15
|
@update:model-value="update"
|
|
12
16
|
>
|
|
13
17
|
<span
|
|
14
18
|
aria-hidden="true"
|
|
15
|
-
:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
:style="{
|
|
20
|
+
height: sizePx + 'px',
|
|
21
|
+
width: sizePx + 'px',
|
|
22
|
+
transform: `translateX(${translateX}px)`,
|
|
23
|
+
}"
|
|
24
|
+
class="pointer-events-none inline-block rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"
|
|
19
25
|
/>
|
|
20
26
|
</Switch>
|
|
21
27
|
<SwitchLabel v-if="$slots.default" class="cursor-pointer">
|
|
@@ -27,7 +33,7 @@
|
|
|
27
33
|
|
|
28
34
|
<script lang="ts">
|
|
29
35
|
import { Switch, SwitchGroup, SwitchLabel } from '@headlessui/vue';
|
|
30
|
-
import { defineComponent } from 'vue';
|
|
36
|
+
import { defineComponent, PropType } from 'vue';
|
|
31
37
|
|
|
32
38
|
export default defineComponent({
|
|
33
39
|
components: {
|
|
@@ -43,11 +49,13 @@ export default defineComponent({
|
|
|
43
49
|
},
|
|
44
50
|
color: {
|
|
45
51
|
default: 'primary',
|
|
46
|
-
type: String
|
|
52
|
+
type: String as PropType<
|
|
53
|
+
'primary' | 'info' | 'danger' | 'warning' | 'success' | 'dark' | 'light'
|
|
54
|
+
>,
|
|
47
55
|
},
|
|
48
56
|
size: {
|
|
49
57
|
default: 'base',
|
|
50
|
-
type: String
|
|
58
|
+
type: String as PropType<'xs' | 'sm' | 'base' | 'lg' | 'xl'>,
|
|
51
59
|
},
|
|
52
60
|
},
|
|
53
61
|
emits: ['update:modelValue'],
|
|
@@ -56,26 +64,96 @@ export default defineComponent({
|
|
|
56
64
|
if (this.color == 'primary') {
|
|
57
65
|
return 'bg-primary-500';
|
|
58
66
|
}
|
|
59
|
-
if (this.color == '
|
|
67
|
+
if (this.color == 'info') {
|
|
68
|
+
return 'bg-blue-500';
|
|
69
|
+
}
|
|
70
|
+
if (this.color == 'danger') {
|
|
60
71
|
return 'bg-red-500';
|
|
61
72
|
}
|
|
62
|
-
if (this.color == '
|
|
73
|
+
if (this.color == 'warning') {
|
|
74
|
+
return 'bg-yellow-500';
|
|
75
|
+
}
|
|
76
|
+
if (this.color == 'success') {
|
|
63
77
|
return 'bg-green-500';
|
|
64
78
|
}
|
|
79
|
+
if (this.color == 'light') {
|
|
80
|
+
return 'bg-slate-500';
|
|
81
|
+
}
|
|
65
82
|
return 'bg-slate-900';
|
|
66
83
|
},
|
|
67
84
|
focus() {
|
|
68
85
|
if (this.color == 'primary') {
|
|
69
86
|
return 'focus:ring-primary-500';
|
|
70
87
|
}
|
|
71
|
-
if (this.color == '
|
|
88
|
+
if (this.color == 'info') {
|
|
89
|
+
return 'focus:ring-blue-500';
|
|
90
|
+
}
|
|
91
|
+
if (this.color == 'danger') {
|
|
72
92
|
return 'focus:ring-red-500';
|
|
73
93
|
}
|
|
74
|
-
if (this.color == '
|
|
94
|
+
if (this.color == 'warning') {
|
|
95
|
+
return 'focus:ring-yellow-500';
|
|
96
|
+
}
|
|
97
|
+
if (this.color == 'success') {
|
|
75
98
|
return 'focus:ring-green-500';
|
|
76
99
|
}
|
|
100
|
+
if (this.color == 'light') {
|
|
101
|
+
return 'focus:ring-slate-500';
|
|
102
|
+
}
|
|
77
103
|
return 'focus:ring-slate-900';
|
|
78
104
|
},
|
|
105
|
+
sizePx() {
|
|
106
|
+
if (this.size == 'xs') {
|
|
107
|
+
return 12;
|
|
108
|
+
}
|
|
109
|
+
if (this.size == 'sm') {
|
|
110
|
+
return 16;
|
|
111
|
+
}
|
|
112
|
+
if (this.size == 'base') {
|
|
113
|
+
return 20;
|
|
114
|
+
}
|
|
115
|
+
if (this.size == 'lg') {
|
|
116
|
+
return 24;
|
|
117
|
+
}
|
|
118
|
+
if (this.size == 'xl') {
|
|
119
|
+
return 32;
|
|
120
|
+
}
|
|
121
|
+
return 16;
|
|
122
|
+
},
|
|
123
|
+
padding() {
|
|
124
|
+
if (this.size == 'xs') {
|
|
125
|
+
return 2;
|
|
126
|
+
}
|
|
127
|
+
if (this.size == 'sm') {
|
|
128
|
+
return 2.5;
|
|
129
|
+
}
|
|
130
|
+
if (this.size == 'base') {
|
|
131
|
+
return 3;
|
|
132
|
+
}
|
|
133
|
+
if (this.size == 'lg') {
|
|
134
|
+
return 3;
|
|
135
|
+
}
|
|
136
|
+
if (this.size == 'xl') {
|
|
137
|
+
return 4;
|
|
138
|
+
}
|
|
139
|
+
return 2;
|
|
140
|
+
},
|
|
141
|
+
height() {
|
|
142
|
+
return this.sizePx + 2 * this.padding;
|
|
143
|
+
},
|
|
144
|
+
distance() {
|
|
145
|
+
return 2 * this.sizePx;
|
|
146
|
+
},
|
|
147
|
+
width() {
|
|
148
|
+
return this.distance + 2 * this.padding;
|
|
149
|
+
},
|
|
150
|
+
translateX() {
|
|
151
|
+
if (this.modelValue) {
|
|
152
|
+
return this.padding + this.distance - this.sizePx;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return this.padding;
|
|
156
|
+
},
|
|
79
157
|
},
|
|
80
158
|
methods: {
|
|
81
159
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import BaseSystemAlert from './BaseSystemAlert.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Layout/BaseSystemAlert',
|
|
5
|
+
component: BaseSystemAlert,
|
|
6
|
+
args: {
|
|
7
|
+
to: 'https://google.com',
|
|
8
|
+
},
|
|
9
|
+
argTypes: {
|
|
10
|
+
color: {
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: ['success', 'info', 'warning', 'danger'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const Template = (args) => ({
|
|
18
|
+
components: {
|
|
19
|
+
BaseSystemAlert,
|
|
20
|
+
},
|
|
21
|
+
setup() {
|
|
22
|
+
function onClose() {
|
|
23
|
+
alert('close');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return { args, onClose };
|
|
27
|
+
},
|
|
28
|
+
template: `
|
|
29
|
+
<BaseSystemAlert v-bind="args" @close="onClose">
|
|
30
|
+
Tempor nisi ut ea sit pariatur aute irure magna id id ullamco cupidatat enim.
|
|
31
|
+
</BaseSystemAlert>
|
|
32
|
+
`,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const Demo = Template.bind({});
|
|
36
|
+
Demo.args = {};
|
|
37
|
+
|
|
38
|
+
export const Closable = Template.bind({});
|
|
39
|
+
Closable.args = {
|
|
40
|
+
closable: true,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const colors = ['info', 'success', 'warning', 'danger'];
|
|
44
|
+
|
|
45
|
+
const Colors = (args) => ({
|
|
46
|
+
components: {
|
|
47
|
+
BaseSystemAlert,
|
|
48
|
+
},
|
|
49
|
+
setup() {
|
|
50
|
+
return { args, colors };
|
|
51
|
+
},
|
|
52
|
+
template: `
|
|
53
|
+
<div v-for="color in colors" class="mb-1">
|
|
54
|
+
<p class="text-xs text-slate-600 leading-tight mb-1">{{ color }}</p>
|
|
55
|
+
<BaseSystemAlert v-bind="args" :color="color">
|
|
56
|
+
Tempor nisi ut ea sit pariatur aute irure magna id id ullamco cupidatat enim.
|
|
57
|
+
</BaseSystemAlert>
|
|
58
|
+
</div>
|
|
59
|
+
`,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const AllColors = Colors.bind({});
|
|
63
|
+
AllColors.args = {};
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<li role="presentation">
|
|
3
|
-
<router-link v-slot="{ href, navigate,
|
|
3
|
+
<router-link v-slot="{ href, navigate, isActive }" :to="to" custom>
|
|
4
4
|
<a
|
|
5
5
|
:href="href"
|
|
6
|
-
class="relative inline-block
|
|
6
|
+
class="group relative inline-block rounded-t-lg px-2 py-3 font-medium"
|
|
7
7
|
:class="[
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
: 'border-transparent hover:border-slate-300 hover:text-slate-600',
|
|
8
|
+
isActive ? 'text-blue-600' : 'text-slate-600 hover:text-slate-900',
|
|
9
|
+
disabled ? 'cursor-not-allowed opacity-60' : '',
|
|
11
10
|
]"
|
|
12
11
|
@click="navigate"
|
|
13
12
|
>
|
|
14
|
-
<
|
|
13
|
+
<div
|
|
14
|
+
class="absolute left-0 bottom-0 w-full"
|
|
15
|
+
:class="[
|
|
16
|
+
isActive
|
|
17
|
+
? 'h-[2px] bg-blue-600'
|
|
18
|
+
: 'group-hover:h-px group-hover:bg-slate-700',
|
|
19
|
+
]"
|
|
20
|
+
></div>
|
|
21
|
+
<div class="whitespace-nowrap">
|
|
22
|
+
<slot />
|
|
23
|
+
</div>
|
|
15
24
|
</a>
|
|
16
25
|
</router-link>
|
|
17
26
|
</li>
|
|
@@ -26,5 +35,9 @@ defineProps({
|
|
|
26
35
|
required: true,
|
|
27
36
|
type: [Object, String] as PropType<RouteLocationRaw>,
|
|
28
37
|
},
|
|
38
|
+
disabled: {
|
|
39
|
+
default: false,
|
|
40
|
+
type: Boolean,
|
|
41
|
+
},
|
|
29
42
|
});
|
|
30
43
|
</script>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import BaseTabs from './BaseTabs.vue';
|
|
2
|
+
import BaseTabItem from './BaseTabItem.vue';
|
|
3
|
+
import BaseContainer from './BaseContainer.vue';
|
|
4
|
+
import BaseCard from './BaseCard.vue';
|
|
5
|
+
import BaseCardRow from './BaseCardRow.vue';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Layout/BaseTabs',
|
|
9
|
+
component: BaseTabs,
|
|
10
|
+
args: {},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Template = (args) => ({
|
|
14
|
+
components: {
|
|
15
|
+
BaseTabs,
|
|
16
|
+
BaseTabItem,
|
|
17
|
+
BaseContainer,
|
|
18
|
+
BaseCard,
|
|
19
|
+
BaseCardRow,
|
|
20
|
+
},
|
|
21
|
+
setup() {
|
|
22
|
+
return { args };
|
|
23
|
+
},
|
|
24
|
+
template: `
|
|
25
|
+
<div class="bg-slate-100 py-10">
|
|
26
|
+
<BaseContainer>
|
|
27
|
+
<BaseTabs v-bind="args">
|
|
28
|
+
<BaseTabItem to="/">
|
|
29
|
+
Home
|
|
30
|
+
</BaseTabItem>
|
|
31
|
+
<BaseTabItem to="/setup">
|
|
32
|
+
Setup
|
|
33
|
+
</BaseTabItem>
|
|
34
|
+
<BaseTabItem to="/settings">
|
|
35
|
+
Settings
|
|
36
|
+
</BaseTabItem>
|
|
37
|
+
<BaseTabItem to="/misc">
|
|
38
|
+
Miscellaneous
|
|
39
|
+
</BaseTabItem>
|
|
40
|
+
</BaseTabs>
|
|
41
|
+
<div class="mt-10">
|
|
42
|
+
<BaseCard>
|
|
43
|
+
<BaseCardRow>
|
|
44
|
+
{{ $route.path }}
|
|
45
|
+
</BaseCardRow>
|
|
46
|
+
</BaseCard>
|
|
47
|
+
</div>
|
|
48
|
+
</BaseContainer>
|
|
49
|
+
</div>
|
|
50
|
+
`,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const Demo = Template.bind({});
|
|
54
|
+
Demo.args = {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="relative">
|
|
3
|
-
<div class="absolute bottom-0 left-0 h-
|
|
4
|
-
<div class="overflow-x-auto overflow-y-hidden">
|
|
5
|
-
<ul class="flex space-x-
|
|
3
|
+
<div class="absolute bottom-0 left-0 h-px w-full bg-slate-300" />
|
|
4
|
+
<div class="relative overflow-x-auto overflow-y-hidden">
|
|
5
|
+
<ul class="flex space-x-4 text-center">
|
|
6
6
|
<slot />
|
|
7
7
|
</ul>
|
|
8
8
|
</div>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import BaseTextarea from './BaseTextarea.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form/BaseTextarea',
|
|
5
|
+
component: BaseTextarea,
|
|
6
|
+
args: {
|
|
7
|
+
name: 'bio',
|
|
8
|
+
required: true,
|
|
9
|
+
placeholder: 'Describe your complete life in 4 sentences...',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Template = (args) => ({
|
|
14
|
+
components: {
|
|
15
|
+
BaseTextarea,
|
|
16
|
+
},
|
|
17
|
+
setup() {
|
|
18
|
+
const value = ref('');
|
|
19
|
+
return { args, value };
|
|
20
|
+
},
|
|
21
|
+
template: `
|
|
22
|
+
<form @submit.prevent="" class="border-none">
|
|
23
|
+
<BaseTextarea v-model="value" v-bind="args" class="w-full"></BaseTextarea>
|
|
24
|
+
</form>
|
|
25
|
+
`,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const Demo = Template.bind({});
|
|
29
|
+
Demo.args = {};
|
|
30
|
+
|
|
31
|
+
export const Disabled = Template.bind({});
|
|
32
|
+
Disabled.args = {
|
|
33
|
+
modelValue: 'Lorem ipsum...',
|
|
34
|
+
disabled: true,
|
|
35
|
+
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:disabled="disabled"
|
|
8
8
|
:required="required"
|
|
9
9
|
:rows="rows"
|
|
10
|
-
class="mb-0 block rounded"
|
|
10
|
+
class="mb-0 block rounded border-slate-300 disabled:cursor-not-allowed disabled:text-slate-300"
|
|
11
11
|
@input="$emit('update:modelValue', transformInputValue($event))"
|
|
12
12
|
/>
|
|
13
13
|
</template>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import BaseTextareaAutoresize from './BaseTextareaAutoresize.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form/BaseTextareaAutoresize',
|
|
5
|
+
component: BaseTextareaAutoresize,
|
|
6
|
+
args: {
|
|
7
|
+
name: 'bio',
|
|
8
|
+
placeholder: 'Describe your complete life in 4 sentences...',
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Template = (args) => ({
|
|
13
|
+
components: {
|
|
14
|
+
BaseTextareaAutoresize,
|
|
15
|
+
},
|
|
16
|
+
setup() {
|
|
17
|
+
function onSubmit() {
|
|
18
|
+
alert('submit');
|
|
19
|
+
}
|
|
20
|
+
const value = ref('');
|
|
21
|
+
return { args, value, onSubmit };
|
|
22
|
+
},
|
|
23
|
+
template: `
|
|
24
|
+
<form @submit.prevent="onSubmit" class="border-none">
|
|
25
|
+
<BaseTextareaAutoresize
|
|
26
|
+
v-model="value"
|
|
27
|
+
v-bind="args"
|
|
28
|
+
class="w-full"
|
|
29
|
+
@submit="onSubmit"
|
|
30
|
+
></BaseTextareaAutoresize>
|
|
31
|
+
</form>
|
|
32
|
+
|
|
33
|
+
<pre class="mt-4 bg-slate-800 font-light text-xs p-3 rounded whitespace-pre-wrap text-white">{{ {value} }}</pre>
|
|
34
|
+
`,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const Demo = Template.bind({});
|
|
38
|
+
Demo.args = {};
|
|
39
|
+
|
|
40
|
+
export const SubmitOnEnter = Template.bind({});
|
|
41
|
+
SubmitOnEnter.args = {
|
|
42
|
+
submitOnEnter: true,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Disabled = Template.bind({});
|
|
46
|
+
Disabled.args = {
|
|
47
|
+
modelValue: 'Lorem ipsum...',
|
|
48
|
+
disabled: true,
|
|
49
|
+
};
|