@mixd-id/web-scaffold 0.1.230406227 → 0.1.230406229

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406227",
4
+ "version": "0.1.230406229",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -0,0 +1,184 @@
1
+ <template>
2
+ <div :class="computedClass">
3
+ <slot name="start"></slot>
4
+ <textarea :maxlength="maxlength"
5
+ :placeholder="placeholder" :rows="rows" ref="input" @focus="isActive = true" @blur="onBlur" @input="onInput"
6
+ :value="modelValue" :readonly="Boolean(readonly)" />
7
+ <div v-if="state === -2 && !!(errors)">
8
+ <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
9
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 13.75C12.4142 13.75 12.75 13.4142 12.75 13V8.00001C12.75 7.5858 12.4142 7.25001 12 7.25001C11.5858 7.25001 11.25 7.5858 11.25 8.00001V13C11.25 13.4142 11.5858 13.75 12 13.75Z"/>
10
+ <path d="M13 16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16C11 15.4477 11.4477 15 12 15C12.5523 15 13 15.4477 13 16Z"/>
11
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 7.30558 16.6944 3.5 12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"/>
12
+ </svg>
13
+ </div>X
14
+ <slot name="end"></slot>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+
20
+ export default{
21
+
22
+ name: 'Textarea',
23
+
24
+ props: {
25
+
26
+ align: {
27
+ type: String
28
+ },
29
+
30
+ customClass: String,
31
+
32
+ state: {
33
+ type: Number,
34
+ default: 1 // 1:normal, -1:disabled, -2:error
35
+ },
36
+
37
+ variant: {
38
+ type: String,
39
+ default: ''
40
+ },
41
+
42
+ size: {
43
+ type: String,
44
+ default: ''
45
+ },
46
+
47
+ errors:{
48
+ type: [ String, Array ],
49
+ default: ''
50
+ },
51
+
52
+ modelValue: [ String, Number ],
53
+
54
+ placeholder: String,
55
+
56
+ readonly: undefined,
57
+
58
+ rows: String,
59
+
60
+ maxlength: undefined,
61
+
62
+ },
63
+
64
+ watch:{
65
+
66
+ modelValue(to, from){
67
+ this.$emit('update:modelValue', to)
68
+ this.$emit('change', to)
69
+ this.$nextTick(() => {
70
+ this.$el.style.height = '';
71
+ this.$el.style.height = this.$refs.input.scrollHeight + 'px'
72
+ })
73
+ }
74
+
75
+ },
76
+
77
+ emits: [ 'update:modelValue', 'change', 'submit', 'blur' ],
78
+
79
+ computed: {
80
+
81
+ computedState(){
82
+ if(this.errors){
83
+ return -2
84
+ }
85
+ else{
86
+ return this.state
87
+ }
88
+ },
89
+
90
+ computedClass(){
91
+ return this.customClass ?? [
92
+ this.$style.textarea,
93
+ this.$style['state-' + this.computedState],
94
+ this.isActive ? this.$style.active : '',
95
+ this.align ? this.$style['align-' + this.align] : '',
96
+ this.readonly ? this.$style.readonly : '',
97
+ this.size ? this.$style['size-' + this.size] : ''
98
+ ].join(' ')
99
+ },
100
+
101
+ isDisabled(){
102
+
103
+ }
104
+
105
+ },
106
+
107
+ data(){
108
+ return {
109
+ isActive: false
110
+ }
111
+ },
112
+
113
+ mounted() {
114
+ },
115
+
116
+ methods:{
117
+
118
+ select(){
119
+ this.$refs.input.select()
120
+ },
121
+
122
+ onInput(e){
123
+ this.$emit('update:modelValue', e.target.value)
124
+ },
125
+
126
+ onBlur(){
127
+ this.isActive = false
128
+ this.$emit('blur')
129
+ }
130
+
131
+ }
132
+
133
+ }
134
+
135
+ </script>
136
+
137
+ <style module>
138
+
139
+ .textarea{
140
+ @apply min-h-[var(--h-cp)];
141
+ @apply flex items-start border-[1px] border-text-200 bg-base-50 rounded-lg overflow-hidden;
142
+ @apply !max-h-[200px];
143
+ }
144
+ .textarea textarea{
145
+ @apply flex-1 outline-none p-2 bg-transparent resize-none;
146
+ @apply self-stretch;
147
+ scrollbar-width: none;
148
+ }
149
+ .textarea>textarea::-webkit-scrollbar{
150
+ display: none;
151
+ }
152
+ .textarea>textarea::placeholder{
153
+ @apply text-text-200;
154
+ }
155
+ .textarea.readonly{
156
+ @apply bg-text-50;
157
+ }
158
+
159
+ .size-sm{ @apply min-h-[var(--h-cp-sm)]; }
160
+ .size-sm textarea{ @apply text-sm; }
161
+
162
+ .size-lg{ @apply min-h-[var(--h-cp-lg)]; }
163
+ .size-lg textarea{ @apply text-lg p-2; }
164
+
165
+
166
+ .active{
167
+ @apply border-primary
168
+ }
169
+
170
+ .state--2{
171
+ @apply border-red-500
172
+ }
173
+
174
+ .align-left>input{
175
+ @apply text-left
176
+ }
177
+ .align-center>input{
178
+ @apply text-center
179
+ }
180
+ .align-right>input{
181
+ @apply text-right
182
+ }
183
+
184
+ </style>
package/src/index.js CHANGED
@@ -412,6 +412,7 @@ export default{
412
412
  app.component('Tabs', defineAsyncComponent(() => import("./components/Tabs.vue")))
413
413
  app.component('Textbox', defineAsyncComponent(() => import("./components/Textbox.vue")))
414
414
  app.component('Textarea', defineAsyncComponent(() => import("./components/Textarea.vue")))
415
+ app.component('TextareaX', defineAsyncComponent(() => import("./components/TextareaX.vue")))
415
416
  app.component('Timepicker', defineAsyncComponent(() => import("./components/Timepicker.vue")))
416
417
  app.component('Toast', defineAsyncComponent(() => import("./components/Toast.vue")))
417
418
  app.component('TreeView', defineAsyncComponent(() => import("./components/TreeView.vue")))