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
|
@@ -1,117 +1,113 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
ref="wrapper"
|
|
4
|
+
class="wrapper grid"
|
|
5
|
+
:style="{ maxHeight: maxHeight + 'px' }"
|
|
6
|
+
>
|
|
3
7
|
<textarea
|
|
4
8
|
:value="modelValue"
|
|
5
9
|
:name="name"
|
|
6
10
|
:placeholder="placeholder"
|
|
11
|
+
:disabled="disabled"
|
|
12
|
+
class="resize-none"
|
|
13
|
+
:class="BASE_TEXTAREA_CLASSES"
|
|
14
|
+
:style="{ maxHeight: maxHeight + 'px', gridArea: BASE_GRID_AREA }"
|
|
7
15
|
rows="1"
|
|
8
|
-
class="focus:outline-none focus:ring-0"
|
|
9
16
|
@input="onInput"
|
|
10
17
|
@keyup="onKeyUp"
|
|
11
18
|
@keydown="onKeyDown"
|
|
12
19
|
@focus="onFocus"
|
|
13
20
|
/>
|
|
21
|
+
<div
|
|
22
|
+
class="invisible whitespace-pre-wrap"
|
|
23
|
+
:class="BASE_TEXTAREA_CLASSES"
|
|
24
|
+
:style="{
|
|
25
|
+
content: DIV_CONTENT,
|
|
26
|
+
maxHeight: maxHeight + 'px',
|
|
27
|
+
gridArea: BASE_GRID_AREA,
|
|
28
|
+
}"
|
|
29
|
+
>
|
|
30
|
+
{{ modelValue }} {{ ' ' }}
|
|
31
|
+
</div>
|
|
14
32
|
</div>
|
|
15
33
|
</template>
|
|
16
34
|
|
|
17
|
-
<script lang="ts">
|
|
18
|
-
|
|
19
|
-
import { defineComponent, inject } from 'vue';
|
|
35
|
+
<script lang="ts" setup>
|
|
36
|
+
import { Ref } from 'vue';
|
|
20
37
|
|
|
21
|
-
const
|
|
38
|
+
const BASE_TEXTAREA_CLASSES =
|
|
39
|
+
'py-2 px-3 font-normal text-base disabled:cursor-not-allowed disabled:text-slate-300 font-sans rounded leading-normal tracking-normal border border-slate-300';
|
|
40
|
+
|
|
41
|
+
const BASE_GRID_AREA = '1 / 1 / 2 / 2';
|
|
22
42
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
default: '',
|
|
31
|
-
type: String,
|
|
32
|
-
},
|
|
33
|
-
name: {
|
|
34
|
-
required: true,
|
|
35
|
-
type: String,
|
|
36
|
-
},
|
|
43
|
+
/* Note the weird space! Needed to prevent jumpy behavior */
|
|
44
|
+
const DIV_CONTENT = "attr(data-replicated-value) ' '";
|
|
45
|
+
|
|
46
|
+
const props = defineProps({
|
|
47
|
+
modelValue: {
|
|
48
|
+
default: '',
|
|
49
|
+
type: String,
|
|
37
50
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
mobile,
|
|
43
|
-
};
|
|
51
|
+
placeholder: {
|
|
52
|
+
default: '',
|
|
53
|
+
type: String,
|
|
44
54
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
55
|
+
name: {
|
|
56
|
+
required: true,
|
|
57
|
+
type: String,
|
|
49
58
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (keys['Enter'] && !keys['Shift'] && !this.mobile) {
|
|
66
|
-
this.$emit('submit');
|
|
67
|
-
event.preventDefault();
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
onKeyUp(event: any) {
|
|
71
|
-
delete keys[event.key];
|
|
72
|
-
},
|
|
73
|
-
onFocus(event: any) {
|
|
74
|
-
this.$emit('focus', event);
|
|
75
|
-
},
|
|
59
|
+
maxHeight: {
|
|
60
|
+
default: 100,
|
|
61
|
+
type: Number,
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Setting this to true will trigger the 'submit' event while pressing Enter.
|
|
65
|
+
* Users will be able to add a line break while pressing Shift + Enter.
|
|
66
|
+
*/
|
|
67
|
+
submitOnEnter: {
|
|
68
|
+
default: false,
|
|
69
|
+
type: Boolean,
|
|
70
|
+
},
|
|
71
|
+
disabled: {
|
|
72
|
+
default: false,
|
|
73
|
+
type: Boolean,
|
|
76
74
|
},
|
|
77
75
|
});
|
|
78
|
-
</script>
|
|
79
76
|
|
|
80
|
-
|
|
81
|
-
.wrapper {
|
|
82
|
-
/* easy way to plop the elements on top of each other and have them both sized based on the tallest one's height */
|
|
83
|
-
display: grid;
|
|
84
|
-
}
|
|
85
|
-
.wrapper::after {
|
|
86
|
-
/* Note the weird space! Needed to prevent jumpy behavior */
|
|
87
|
-
content: attr(data-replicated-value) ' ';
|
|
77
|
+
const emit = defineEmits(['update:modelValue', 'submit', 'focus', 'input']);
|
|
88
78
|
|
|
89
|
-
|
|
90
|
-
white-space: pre-wrap;
|
|
79
|
+
const wrapper = ref(null) as Ref<null | HTMLDivElement>;
|
|
91
80
|
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
const keys = {} as { [key: string]: boolean };
|
|
82
|
+
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
84
|
+
function onInput(e: any) {
|
|
85
|
+
const value = e.target.value ?? '';
|
|
86
|
+
emit('update:modelValue', value);
|
|
87
|
+
emit('input', e);
|
|
94
88
|
}
|
|
95
|
-
.wrapper > textarea {
|
|
96
|
-
/* You could leave this, but after a user resizes, then it ruins the auto sizing */
|
|
97
|
-
resize: none;
|
|
98
89
|
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
function onKeyDown(event: KeyboardEvent) {
|
|
91
|
+
keys[event.key] = true;
|
|
92
|
+
|
|
93
|
+
if (keys['Enter'] && !keys['Shift'] && props.submitOnEnter) {
|
|
94
|
+
// If submit triggers alert, Enter wont be delete from keys,
|
|
95
|
+
// manually remove it here
|
|
96
|
+
delete keys['Enter'];
|
|
97
|
+
|
|
98
|
+
// Submit event to listen to
|
|
99
|
+
emit('submit');
|
|
100
|
+
|
|
101
|
+
// Prevent adding an EOL the the textarea
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
}
|
|
101
104
|
}
|
|
102
|
-
.wrapper > textarea,
|
|
103
|
-
.wrapper::after {
|
|
104
|
-
/* Identical styling required!! */
|
|
105
|
-
padding: 0.5rem;
|
|
106
|
-
font: inherit;
|
|
107
105
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
@apply bg-slate-100;
|
|
112
|
-
@apply rounded-lg;
|
|
106
|
+
function onKeyUp(event: KeyboardEvent) {
|
|
107
|
+
delete keys[event.key];
|
|
108
|
+
}
|
|
113
109
|
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
function onFocus(event: FocusEvent) {
|
|
111
|
+
emit('focus', event);
|
|
116
112
|
}
|
|
117
|
-
</
|
|
113
|
+
</script>
|
package/src/components/index.ts
CHANGED
|
@@ -25,9 +25,32 @@ import BaseDialog from './BaseDialog.vue';
|
|
|
25
25
|
import BaseFilePicker from './BaseFilePicker.vue';
|
|
26
26
|
import BaseFileUploader from './BaseFileUploader.vue';
|
|
27
27
|
import { Icon as BaseIcon } from '@iconify/vue';
|
|
28
|
+
import BaseInput from './BaseInput.vue';
|
|
29
|
+
import BaseInputLabel from './BaseInputLabel.vue';
|
|
28
30
|
import BaseLoadingCover from './BaseLoadingCover.vue';
|
|
29
31
|
import BaseMenu from './BaseMenu.vue';
|
|
30
32
|
import BaseMenuItem from './BaseMenuItem.vue';
|
|
33
|
+
import BaseModalCenter from './BaseModalCenter.vue';
|
|
34
|
+
import BaseModalSide from './BaseModalSide.vue';
|
|
35
|
+
import BaseNavbar from './BaseNavbar.vue';
|
|
36
|
+
import BaseNavbarItem from './BaseNavbarItem.vue';
|
|
37
|
+
import BaseNavbarItemContent from './BaseNavbarItemContent.vue';
|
|
38
|
+
import BasePagination from './BasePagination.vue';
|
|
39
|
+
import BasePanel from './BasePanel.vue';
|
|
40
|
+
import BasePassword from './BasePassword.vue';
|
|
41
|
+
import BaseProcessRing from './BaseProcessRing.vue';
|
|
42
|
+
import BaseReadMore from './BaseReadMore.vue';
|
|
43
|
+
import BaseSelect from './BaseSelect.vue';
|
|
44
|
+
import BaseSideNavigation from './BaseSideNavigation.vue';
|
|
45
|
+
import BaseSideNavigationItem from './BaseSideNavigationItem.vue';
|
|
46
|
+
import BaseSkeleton from './BaseSkeleton.vue';
|
|
47
|
+
import BaseSwitch from './BaseSwitch.vue';
|
|
48
|
+
import BaseSystemAlert from './BaseSystemAlert.vue';
|
|
49
|
+
import BaseTextarea from './BaseTextarea.vue';
|
|
50
|
+
import BaseTextareaAutoresize from './BaseTextareaAutoresize.vue';
|
|
51
|
+
import BaseCharacterCounter from './BaseCharacterCounter.vue';
|
|
52
|
+
import BaseTabs from './BaseTabs.vue';
|
|
53
|
+
import BaseTabItem from './BaseTabItem.vue';
|
|
31
54
|
import BaseTable from './BaseTable.vue';
|
|
32
55
|
import BaseTableColumn from './BaseTableColumn.vue';
|
|
33
56
|
|
|
@@ -59,9 +82,32 @@ export {
|
|
|
59
82
|
BaseFilePicker,
|
|
60
83
|
BaseFileUploader,
|
|
61
84
|
BaseIcon,
|
|
85
|
+
BaseInput,
|
|
86
|
+
BaseInputLabel,
|
|
62
87
|
BaseLoadingCover,
|
|
63
88
|
BaseMenu,
|
|
64
89
|
BaseMenuItem,
|
|
90
|
+
BaseModalCenter,
|
|
91
|
+
BaseModalSide,
|
|
92
|
+
BaseNavbar,
|
|
93
|
+
BaseNavbarItem,
|
|
94
|
+
BaseNavbarItemContent,
|
|
95
|
+
BasePagination,
|
|
96
|
+
BasePanel,
|
|
97
|
+
BasePassword,
|
|
98
|
+
BaseProcessRing,
|
|
99
|
+
BaseReadMore,
|
|
100
|
+
BaseSelect,
|
|
101
|
+
BaseSideNavigation,
|
|
102
|
+
BaseSideNavigationItem,
|
|
103
|
+
BaseSkeleton,
|
|
104
|
+
BaseSwitch,
|
|
105
|
+
BaseSystemAlert,
|
|
106
|
+
BaseTextarea,
|
|
107
|
+
BaseTextareaAutoresize,
|
|
108
|
+
BaseCharacterCounter,
|
|
109
|
+
BaseTabs,
|
|
110
|
+
BaseTabItem,
|
|
65
111
|
BaseTable,
|
|
66
112
|
BaseTableColumn,
|
|
67
113
|
};
|
package/src/lang/en.json
CHANGED
package/src/lang/fr.json
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{
|
|
2
|
-
text: {
|
|
3
|
-
required: true;
|
|
4
|
-
type: StringConstructor;
|
|
5
|
-
};
|
|
6
|
-
min: {
|
|
7
|
-
default: undefined;
|
|
8
|
-
type: NumberConstructor;
|
|
9
|
-
};
|
|
10
|
-
max: {
|
|
11
|
-
default: undefined;
|
|
12
|
-
type: NumberConstructor;
|
|
13
|
-
};
|
|
14
|
-
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
-
text: {
|
|
16
|
-
required: true;
|
|
17
|
-
type: StringConstructor;
|
|
18
|
-
};
|
|
19
|
-
min: {
|
|
20
|
-
default: undefined;
|
|
21
|
-
type: NumberConstructor;
|
|
22
|
-
};
|
|
23
|
-
max: {
|
|
24
|
-
default: undefined;
|
|
25
|
-
type: NumberConstructor;
|
|
26
|
-
};
|
|
27
|
-
}>>, {
|
|
28
|
-
max: number;
|
|
29
|
-
min: number;
|
|
30
|
-
}>;
|
|
31
|
-
export default _default;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-if="max && (!min || text.length >= min)"
|
|
4
|
-
class="text-sm"
|
|
5
|
-
:class="{
|
|
6
|
-
'text-slate-500': text.length <= max,
|
|
7
|
-
'text-red-600': text.length > max,
|
|
8
|
-
}"
|
|
9
|
-
>
|
|
10
|
-
{{ text.length }}/{{ max }}
|
|
11
|
-
</div>
|
|
12
|
-
<div v-if="min && text.length < min" class="text-sm text-red-600">
|
|
13
|
-
{{ $t('sui.min_x_characters', { x: min }) }} ({{ text.length }}/{{ min }})
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script lang="ts">
|
|
18
|
-
import { defineComponent } from 'vue';
|
|
19
|
-
|
|
20
|
-
export default defineComponent({
|
|
21
|
-
props: {
|
|
22
|
-
text: {
|
|
23
|
-
required: true,
|
|
24
|
-
type: String,
|
|
25
|
-
},
|
|
26
|
-
min: {
|
|
27
|
-
default: undefined,
|
|
28
|
-
type: Number,
|
|
29
|
-
},
|
|
30
|
-
max: {
|
|
31
|
-
default: undefined,
|
|
32
|
-
type: Number,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
</script>
|