@mixd-id/web-scaffold 0.1.2301231346 → 0.1.2301231348

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.2301231346",
4
+ "version": "0.1.2301231348",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -1,54 +1,28 @@
1
1
  <template>
2
- <a v-if="isExternalLink" :class="computedClass" v-bind="$attrs" :href="to" target="_blank">
2
+ <a v-if="isExternalLink" :href="href" :target="target">
3
3
  <slot />
4
4
  </a>
5
- <router-link v-else :="$props" :class="computedClass">
5
+ <router-link v-else :to="href" :target="target">
6
6
  <slot />
7
7
  </router-link>
8
8
  </template>
9
9
 
10
10
  <script>
11
- import { RouterLink } from 'vue-router'
12
11
 
13
12
  export default {
14
13
 
15
14
  props: {
16
- ...RouterLink.props,
17
- to: {
18
- type: String,
19
- required: true
20
- },
21
- variant: {
22
- type: [ String, Number ],
23
- default: "primary" // primary|secondary|outline, default:primary
24
- },
25
- size: {
26
- type: [ String ],
27
- default: '' // sm|md|lg, default: md
28
- },
29
- spacing: {
30
- type: [ String, Number ],
31
- default: '' // 0|1|2|3, default: 2
32
- },
33
- state: [ String, Number ],
15
+
16
+ href: String,
17
+
18
+ target: String
19
+
34
20
  },
35
21
 
36
22
  computed: {
37
23
 
38
24
  isExternalLink() {
39
- return typeof this.to === 'string' && (this.to.startsWith('http') || this.to.startsWith('tel:'))
40
- },
41
-
42
- computedClass(){
43
-
44
- return [
45
- this.$style.button,
46
- this.$style['variant-' + this.variant],
47
- this.$style['size-' + this.size],
48
- this.$style['spacing-' + this.spacing],
49
- parseInt(this.state) === 2 ? this.$style.loading : '',
50
- ]
51
- .join(' ')
25
+ return typeof this.href === 'string' && (this.href.startsWith('http') || this.href.startsWith('tel:'))
52
26
  }
53
27
  },
54
28
  }
@@ -57,152 +31,4 @@ export default {
57
31
  <style module>
58
32
 
59
33
 
60
- .button{
61
- @apply relative inline-flex items-center justify-center;
62
- @apply whitespace-nowrap text-ellipsis overflow-hidden;
63
- }
64
- .button>*:first-child{
65
- @apply flex items-center justify-center
66
- }
67
- .button:disabled{
68
- @apply opacity-50;
69
- }
70
-
71
- .variant-,
72
- .variant-primary{
73
- @apply bg-primary-500 text-white rounded-md border-[2px] border-primary-500;
74
- }
75
- .variant-:hover,
76
- .variant-primary:hover{
77
- @apply bg-primary-600 border-primary-600;
78
- }
79
- .variant-:active,
80
- .variant-primary:active{
81
- @apply top-[1px] left-[1px] relative;
82
- }
83
- .variant-:disabled,
84
- .variant-primary:disabled{
85
- @apply top-0 left-0 cursor-not-allowed;
86
- }
87
- .variant- *,
88
- .variant-primary *{
89
- @apply text-white fill-white;
90
- }
91
- .variant-.loading *,
92
- .variant-primary.loading *{
93
- @apply fill-transparent
94
- }
95
- .variant- .svgBg,
96
- .variant-primary .svgBg{
97
- stroke: #fff;
98
- stroke-opacity: 25%;
99
- }
100
- .variant- .svgHg,
101
- .variant-primary .svgHg{
102
- fill: #fff;
103
- fill-opacity: 75%;
104
- }
105
-
106
- .variant-outline{
107
- @apply bg-transparent text-primary-500 rounded-md border-[2px] border-primary-500;
108
- }
109
- .variant-outline:hover{
110
- @apply border-primary-300 text-primary-300;
111
- }
112
- .variant-outline:active{
113
- @apply top-[1px] left-[1px] active:relative;
114
- }
115
- .variant-outline:disabled{
116
- @apply opacity-50 top-0 left-0 cursor-not-allowed;
117
- @apply text-primary-500 border-primary-500;
118
- }
119
- .variant-outline *{
120
- @apply text-primary-500 fill-primary-500;
121
- }
122
- .variant-outline.loading *{
123
- @apply fill-transparent
124
- }
125
- .variant-outline .svgBg{
126
- stroke: var(--primary);
127
- stroke-opacity: 25%;
128
- }
129
- .variant-outline .svgHg{
130
- fill: var(--primary);
131
- fill-opacity: 75%;
132
- }
133
-
134
- .variant-secondary{
135
- @apply bg-secondary-500 text-primary rounded-md border-[2px] border-secondary-500;
136
- }
137
- .variant-secondary:hover{
138
- @apply bg-secondary-400 border-secondary-400;
139
- }
140
- .variant-secondary:active{
141
- @apply top-[1px] left-[1px] relative;
142
- }
143
- .variant-secondary:disabled{
144
- @apply bg-secondary-500 border-secondary-500 opacity-50 top-0 left-0 cursor-not-allowed;
145
- }
146
- .variant-secondary *{
147
- @apply text-white fill-white;
148
- }
149
- .variant-secondary.loading *{
150
- @apply fill-transparent
151
- }
152
- .variant-secondary .svgBg{
153
- stroke: var(--text);
154
- stroke-opacity: 25%;
155
- }
156
- .variant-secondary .svgHg{
157
- fill: #fff;
158
- fill-opacity: 75%;
159
- }
160
-
161
- .variant-minimal .svgBg{
162
- stroke: var(--base-500);
163
- stroke-opacity: 25%;
164
- }
165
- .variant-minimal .svgHg{
166
- fill: var(--text);
167
- fill-opacity: 75%;
168
- }
169
-
170
- .loadingPane{
171
- @apply absolute left-0 top-0 right-0 bottom-0 flex items-center justify-center
172
- }
173
- .loading>*:first-child{
174
- @apply opacity-0
175
- }
176
- .loading:hover{
177
- @apply bg-primary
178
- }
179
- .loading:active{
180
- @apply top-0 left-0;
181
- }
182
-
183
- .spacing-,
184
- .spacing-2{
185
- @apply p-2
186
- }
187
- .spacing-1{
188
- @apply p-1
189
- }
190
- .spacing-3{
191
- @apply p-3
192
- }
193
-
194
- .size-sm{
195
- @apply text-sm
196
- }
197
- .size-lg{
198
- @apply text-lg
199
- }
200
- .size-xl{
201
- @apply text-xl
202
- }
203
-
204
- .spinner{
205
- @apply animate-spin h-5 w-5;
206
- }
207
-
208
34
  </style>
@@ -17,7 +17,7 @@
17
17
  <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"/>
18
18
  </svg>
19
19
 
20
- <div class="my-4 text-center">
20
+ <div class="my-4 text-center flex-1 overflow-y-auto">
21
21
  <h5 class="my-1 break-all">{{ title }}</h5>
22
22
  <p class="break-all overflow-y-auto whitespace-pre-line text-left">{{ description }}</p>
23
23
  </div>
@@ -35,10 +35,8 @@
35
35
  {{ text }}
36
36
  </strong>
37
37
  </Button>
38
- <Button variant="minimal" @click="$emit('dismiss')" class="min-w-[88px]">
39
- <label class="px-4">
40
- Cancel
41
- </label>
38
+ <Button variant="minimal" @click="$emit('dismiss')" class="min-w-[88px] px-4 hover:text-primary">
39
+ Cancel
42
40
  </Button>
43
41
  </div>
44
42
  </div>
@@ -1,8 +1,6 @@
1
1
  <template>
2
2
  <button :class="computedClass" :disabled="isDisabled">
3
- <div>
4
- <slot></slot>
5
- </div>
3
+ <slot></slot>
6
4
  <div v-if="isLoading" :class="$style.loadingPane">
7
5
  <svg :class="$style.spinner" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
8
6
  <circle :class="$style.svgBg" cx="12" cy="12" r="10" stroke-width="4"></circle>
@@ -33,10 +31,7 @@ export default{
33
31
  default: '' // 0|1|2|3, default: 2
34
32
  },
35
33
 
36
- state: {
37
- type: [ String, Number ],
38
- default: 1 // -1:disabled, 1:normal, 2:loading, default: normal
39
- }
34
+ state: [ String, Number ], // -1:disabled, 1:normal, 2:loading, default: normal
40
35
 
41
36
  },
42
37
 
@@ -49,29 +44,44 @@ export default{
49
44
  this.$style['variant-' + this.variant],
50
45
  this.$style['size-' + this.size],
51
46
  this.$style['spacing-' + this.spacing],
52
- parseInt(this.state) === 2 ? this.$style.loading : '',
47
+ parseInt(this.computedState) === 2 ? this.$style.loading : '',
53
48
  ]
54
49
  .join(' ')
55
50
  },
56
51
 
57
52
  isDisabled(){
58
- return parseInt(this.state) === -1
53
+ return parseInt(this.computedState) === -1
59
54
  },
60
55
 
61
56
  isNormal(){
62
- return parseInt(this.state) !== 2
57
+ return parseInt(this.computedState) !== 2
63
58
  },
64
59
 
65
60
  isLoading(){
66
- return parseInt(this.state) === 2
61
+ return parseInt(this.computedState) === 2
62
+ },
63
+
64
+ computedState(){
65
+ return this.state ?? this._state
67
66
  }
68
67
 
69
68
  },
70
69
 
70
+ data(){
71
+ return {
72
+ _state: null
73
+ }
74
+ },
75
+
71
76
  methods:{
72
77
 
73
78
  focus(){
74
79
  this.$el.focus()
80
+ },
81
+
82
+ setState(state){
83
+ console.log('setState', state)
84
+ this._state = state
75
85
  }
76
86
 
77
87
  }
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+ <component :is="components"></component>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+
9
+ import * as Vue from "vue/dist/vue.esm-bundler";
10
+
11
+ export default{
12
+
13
+ props: [ 'template' ],
14
+
15
+ data(){
16
+ return {
17
+ components: null
18
+ }
19
+ },
20
+
21
+ watch: {
22
+
23
+ template: {
24
+ immediate: true,
25
+ handler(to){
26
+ this.components = Vue.compile(to)
27
+ }
28
+ }
29
+
30
+ }
31
+
32
+
33
+
34
+ }
35
+
36
+ </script>
37
+
38
+ <style module>
39
+
40
+ .comp{
41
+
42
+ }
43
+
44
+ </style>