@mixd-id/web-scaffold 0.1.230406036 → 0.1.230406038

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.230406036",
4
+ "version": "0.1.230406038",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -106,7 +106,10 @@ export default{
106
106
  @apply flex items-center justify-center
107
107
  }
108
108
  .button:disabled{
109
- @apply opacity-50;
109
+ @apply opacity-60;
110
+ }
111
+ .button:active{
112
+ @apply top-[1px] left-[1px] relative;
110
113
  }
111
114
 
112
115
  .size-sm{
@@ -118,19 +121,21 @@ export default{
118
121
 
119
122
  .variant-,
120
123
  .variant-primary{
121
- @apply bg-primary-500 text-white border-[2px] border-primary-500;
124
+ @apply bg-primary-500 text-white rounded-lg;
125
+ box-shadow: 0 2px 1px rgba(0, 0, 0, .05);
126
+ outline: solid 1px rgb(var(--primary-700));
127
+ border: solid 1px rgb(var(--primary-400));
122
128
  }
123
129
  .variant-:hover,
124
130
  .variant-primary:hover{
125
- @apply bg-primary-600 border-primary-600;
126
- }
127
- .variant-:active,
128
- .variant-primary:active{
129
- @apply top-[1px] left-[1px] relative;
131
+ @apply bg-primary-600;
132
+ outline-color: rgb(var(--primary-800))
130
133
  }
131
134
  .variant-:disabled,
132
135
  .variant-primary:disabled{
133
- @apply top-0 left-0 cursor-not-allowed;
136
+ @apply bg-primary-500 opacity-50 top-0 left-0 cursor-not-allowed;
137
+ @apply top-0 left-0;
138
+ outline: solid 1px rgb(var(--primary-700));
134
139
  }
135
140
  .variant- *,
136
141
  .variant-primary *{
@@ -150,18 +155,13 @@ export default{
150
155
  fill: #fff;
151
156
  fill-opacity: 75%;
152
157
  }
153
- .variant-primary:disabled{
154
- @apply bg-primary-500 border-primary-500 opacity-50 top-0 left-0 cursor-not-allowed;
155
- }
156
158
 
157
159
  .variant-outline{
158
- @apply bg-transparent text-primary-500 border-[2px] border-primary-500;
160
+ @apply bg-transparent text-primary-500;
161
+ outline: solid 1px rgb(var(--primary-700));
159
162
  }
160
163
  .variant-outline:hover{
161
- @apply border-primary-500 text-text;
162
- }
163
- .variant-outline:active{
164
- @apply top-[1px] left-[1px] active:relative;
164
+ outline-color: rgb(var(--primary-800))
165
165
  }
166
166
  .variant-outline:disabled{
167
167
  @apply opacity-50 top-0 left-0 cursor-not-allowed;
@@ -174,55 +174,78 @@ export default{
174
174
  @apply fill-transparent
175
175
  }
176
176
  .variant-outline .svgBg{
177
- stroke: var(--primary);
178
- stroke-opacity: 25%;
177
+ stroke: rgb(var(--primary-600));
178
+ stroke-opacity: 50%;
179
179
  }
180
180
  .variant-outline .svgHg{
181
- fill: var(--primary);
182
- fill-opacity: 75%;
181
+ fill: rgb(var(--primary));
182
+ fill-opacity: 100%;
183
183
  }
184
184
 
185
185
  .variant-secondary{
186
- @apply bg-secondary text-white rounded-md border-[2px] border-secondary-600;
186
+ @apply bg-secondary text-text-500 rounded-lg;
187
+ box-shadow: 0 2px 1px rgba(0, 0, 0, .05);
188
+ outline: solid 1px rgb(var(--secondary-700));
189
+ border: solid 1px rgb(var(--secondary-400));
187
190
  }
188
191
  .variant-secondary:hover{
189
- @apply bg-secondary-600 border-secondary-600;
190
- }
191
- .variant-secondary:active{
192
- @apply top-[1px] left-[1px] relative;
192
+ @apply bg-secondary-600;
193
+ outline-color: rgb(var(--secondary-800))
193
194
  }
194
195
  .variant-secondary:disabled{
195
- @apply bg-secondary-500 border-secondary-500 opacity-50 top-0 left-0 cursor-not-allowed;
196
+ @apply bg-secondary-500 opacity-50 top-0 left-0 cursor-not-allowed;
197
+ outline: solid 1px rgb(var(--secondary-700));
196
198
  }
197
199
  .variant-secondary *{
198
- @apply text-white fill-white;
200
+ @apply text-text-500 fill-white;
199
201
  }
200
202
  .variant-secondary.loading *{
201
203
  @apply fill-transparent
202
204
  }
203
205
  .variant-secondary .svgBg{
204
- stroke: var(--text);
206
+ stroke: rgb(var(--text-400));
205
207
  stroke-opacity: 25%;
206
208
  }
207
209
  .variant-secondary .svgHg{
208
- fill: #fff;
210
+ fill: rgb(var(--text-500));
209
211
  fill-opacity: 75%;
210
212
  }
211
213
 
214
+ .variant-red{
215
+ @apply bg-red-500 text-white rounded-md border-[2px] border-red-500;
216
+ }
217
+ .variant-red:hover{
218
+ @apply bg-red-600 border-red-600;
219
+ }
220
+ .variant-red:disabled{
221
+ @apply bg-red-500 border-red-500 opacity-50 top-0 left-0 cursor-not-allowed;
222
+ }
223
+ .variant-red *{
224
+ @apply text-white fill-white;
225
+ }
226
+ .variant-red.loading *{
227
+ @apply fill-transparent
228
+ }
229
+ .variant-red .svgBg{
230
+ @apply stroke-red-400;
231
+ stroke-opacity: 50%;
232
+ }
233
+ .variant-red .svgHg{
234
+ @apply fill-text-500;
235
+ fill-opacity: 100%;
236
+ }
237
+
212
238
  .variant-minimal{
213
239
  @apply border-[2px] border-transparent;
214
240
  }
215
241
  .variant-minimal:hover{
216
242
  }
217
- .variant-minimal:active{
218
- @apply top-[1px] left-[1px] relative;
219
- }
220
243
  .variant-minimal .svgBg{
221
- stroke: var(--base-500);
244
+ stroke: rgb(var(--text-500));
222
245
  stroke-opacity: 25%;
223
246
  }
224
247
  .variant-minimal .svgHg{
225
- fill: var(--text);
248
+ fill: rgb(var(--text));
226
249
  fill-opacity: 75%;
227
250
  }
228
251
 
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <div :class="$style.comp">
3
- <input :id="id" type="checkbox" :checked="computedChecked" @change="onChange" />
3
+ <input :id="id" type="checkbox" :checked="checked" @change="onChange" :disabled="isDisabled"/>
4
4
  <label :for="id">
5
5
  <div :class="$style.indicator">
6
6
  <Transition name="checkbox">
7
- <div v-if="computedChecked">
7
+ <div v-if="checked">
8
8
  <svg width="14" height="14" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M470.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L192 338.7 425.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>
9
9
  </div>
10
10
  </Transition>
@@ -18,19 +18,14 @@
18
18
 
19
19
  import { parseBoolean } from "../utils/helpers.mjs";
20
20
 
21
- export default{
21
+ export default {
22
22
 
23
23
  props:{
24
- name: String,
25
- checked: undefined,
26
- value: undefined,
27
-
28
24
  modelValue: undefined,
25
+ value: undefined,
29
26
  trueValue: undefined,
30
27
  falseValue: undefined,
31
-
32
- customClass: String,
33
- variant: String, // default
28
+ disabled: undefined
34
29
  },
35
30
 
36
31
  computed: {
@@ -39,28 +34,25 @@ export default{
39
34
  return this.$style.comp + this.uniqid()
40
35
  },
41
36
 
42
- computedChecked(){
43
- let checked
44
- if(this.modelValue){
45
-
46
- const isArray = Array.isArray(this.modelValue)
37
+ isDisabled(){
38
+ return parseBoolean(this.disabled)
39
+ },
47
40
 
48
- if(this.value !== undefined){
49
- checked = isArray ? this.modelValue.includes(this.value) :
50
- this.modelValue === this.value
51
- }
52
- else if(this.trueValue){
53
- checked = isArray ? this.modelValue.includes(this.trueValue) :
54
- this.modelValue === this.trueValue
41
+ checked(){
42
+ if(this.value !== undefined){
43
+ if(Array.isArray(this.modelValue)){
44
+ return this.modelValue.includes(this.value)
55
45
  }
56
- else{
57
- checked = parseBoolean(this.modelValue)
46
+ else{
47
+ return this.value === this.modelValue
58
48
  }
59
49
  }
60
- else{
61
- checked = !!this.checked
62
- }
63
- return checked
50
+ else if(this.trueValue && this.falseValue) {
51
+ return this.modelValue === this.trueValue
52
+ }
53
+ else {
54
+ return parseBoolean(this.modelValue)
55
+ }
64
56
  }
65
57
 
66
58
  },
@@ -69,30 +61,40 @@ export default{
69
61
 
70
62
  onChange(e){
71
63
 
72
- let value
73
- if(e.target.checked){
74
- if(this.value !== undefined) value = this.value
75
- else if(this.trueValue) value = this.trueValue
76
- else value = true
77
-
78
- if(this.modelValue && Array.isArray(this.modelValue)){
79
- value = [ ...this.modelValue, value ].filter((v, idx, arr) => {
80
- return arr.indexOf(v) === idx
81
- })
64
+ let value
65
+
66
+ if(this.value !== undefined){
67
+ if(Array.isArray(this.modelValue)){
68
+ if(e.target.checked){
69
+ this.modelValue.push(this.value)
70
+ this.modelValue.filter((value, index, self) => self.indexOf(value) === index)
71
+ }
72
+ else{
73
+ this.modelValue.splice(this.modelValue.indexOf(this.value), 1)
74
+ }
82
75
  }
83
- }
84
- else{
85
- if(this.value !== undefined) value = null
86
- else if(this.falseValue) value = this.falseValue
87
- else value = false
88
-
89
- if(this.modelValue && Array.isArray(this.modelValue)){
90
- value = this.modelValue.filter((v) => {
91
- return v !== this.value ?? (this.falseValue ?? false)
92
- })
76
+ else if(e.target.checked){
77
+ value = this.value
93
78
  }
94
79
  }
95
- this.$emit('update:modelValue', value)
80
+ else if(this.trueValue !== undefined && this.falseValue !== undefined) {
81
+ if(Array.isArray(this.modelValue)){
82
+ if(e.target.checked){
83
+ this.modelValue.push(this.trueValue)
84
+ this.modelValue.filter((value, index, self) => self.indexOf(value) === index)
85
+ }
86
+ }
87
+ else{
88
+ value = e.target.checked ? this.trueValue : this.falseValue
89
+ }
90
+ }
91
+ else{
92
+ value = e.target.checked
93
+ }
94
+
95
+ if(value !== undefined){
96
+ this.$emit('update:modelValue', value)
97
+ }
96
98
  }
97
99
 
98
100
  }
@@ -118,13 +120,17 @@ export default{
118
120
  .comp input{
119
121
  @apply hidden;
120
122
  }
123
+ .comp input[disabled] + label{
124
+ @apply opacity-70;
125
+ @apply cursor-not-allowed;
126
+ }
121
127
 
122
128
  .indicator{
123
129
  @apply w-[21px] h-[21px] border-[1px] rounded-lg border-text-200 bg-base-50;
124
130
  @apply flex items-center justify-center overflow-hidden;
125
131
  transition: border 300ms cubic-bezier(0.25, 1, 0.5, 1);
126
132
  }
127
- .comp:hover .indicator{
133
+ .comp:hover input:not([disabled]) + label>.indicator{
128
134
  @apply border-primary;
129
135
  }
130
136
 
@@ -153,4 +159,4 @@ export default{
153
159
  opacity: 0;
154
160
  }
155
161
 
156
- </style>
162
+ </style>
@@ -64,14 +64,23 @@
64
64
 
65
65
  <div class="flex-1 flex items-center justify-center" v-else-if="step === 3">
66
66
  <div class="flex flex-col items-center justify-center gap-1">
67
- <svg width="96" height="96" viewBox="0 0 24 24" class="fill-green-600" xmlns="http://www.w3.org/2000/svg">
67
+ <svg width="84" height="84" viewBox="0 0 24 24" class="fill-green-600" xmlns="http://www.w3.org/2000/svg">
68
68
  <path fill-rule="evenodd" clip-rule="evenodd" d="M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12ZM20.5 12C20.5 16.6944 16.6944 20.5 12 20.5C7.30558 20.5 3.5 16.6944 3.5 12C3.5 7.30558 7.30558 3.5 12 3.5C14.5863 3.5 16.9028 4.65509 18.4618 6.47753L11.1768 13.7626C11.0791 13.8602 10.9209 13.8602 10.8232 13.7626L8.03033 10.9697C7.73744 10.6768 7.26256 10.6768 6.96967 10.9697C6.67678 11.2626 6.67678 11.7374 6.96967 12.0303L9.76256 14.8232C10.446 15.5066 11.554 15.5066 12.2374 14.8232L19.3437 7.717C20.0787 8.97466 20.5 10.4381 20.5 12Z" />
69
69
  </svg>
70
70
  <h3>{{ importData.result.title ?? 'Data berhasil diimport' }}</h3>
71
71
  <p class="mb-4 text-text-400 text-center" v-html="importData.result.description"></p>
72
- <div class="p-2 text-sm text-green-500 border-green-500 border-[1px] rounded-lg">
73
- Total Data: {{ importData.result.count }}
72
+ <div v-if="Object.keys(importData.result.count).length > 0" class="p-2 border-green-500 border-[1px] rounded-lg">
73
+ <table>
74
+ <tr v-for="(count, key) in importData.result.count">
75
+ <td class="text-sm text-green-500">{{ key }}</td>
76
+ <td class="text-sm text-green-500 px-2">:</td>
77
+ <td class="text-sm text-green-500">{{ count }}</td>
78
+ </tr>
79
+ </table>
74
80
  </div>
81
+ <div v-else class="p-2 text-sm text-green-500 border-green-500 border-[1px] rounded-lg">
82
+ Total Data: {{ importData.result.count }}
83
+ </div>
75
84
  <div class="px-6 my-4">
76
85
  <VirtualTable v-if="warnings.length > 0" :columns="warningColumns" :items="warnings" class="h-[200px]"></VirtualTable>
77
86
  </div>
@@ -244,4 +253,4 @@ export default{
244
253
 
245
254
  }
246
255
 
247
- </style>
256
+ </style>
@@ -1,34 +1,26 @@
1
1
  <template>
2
- <div :class="$style.comp">
3
- <input :id="id" type="radio" :name="name" :checked="computedChecked" @change="onChange" />
4
- <label :for="id">
5
- <div :class="$style.indicator">
6
- <div>
7
- <svg width="14" height="14" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M470.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L192 338.7 425.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>
8
- </div>
9
- </div>
10
- <slot></slot>
11
- </label>
2
+ <div :class="$style.comp + (cChecked ? ' ' + $style.checked : '') + (isDisabled ? ' ' + $style.disabled : '')" @click="onChange">
3
+ <div :class="$style.indicator">
4
+ <div>
5
+ <svg width="14" height="14" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M470.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L192 338.7 425.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>
6
+ </div>
7
+ </div>
8
+ <slot></slot>
12
9
  </div>
13
10
  </template>
14
11
 
15
12
  <script>
16
13
 
17
- import { parseBoolean } from "../utils/helpers.mjs";
14
+ import {parseBoolean} from "../utils/helpers.mjs";
18
15
 
19
16
  export default{
20
17
 
21
18
  props:{
22
- name: String,
19
+ name: String,
23
20
  checked: undefined,
24
- value: undefined,
25
-
26
21
  modelValue: undefined,
27
- trueValue: undefined,
28
- falseValue: undefined,
29
-
30
- customClass: String,
31
- variant: String, // default
22
+ value: undefined,
23
+ disabled: undefined
32
24
  },
33
25
 
34
26
  computed: {
@@ -37,58 +29,22 @@ export default{
37
29
  return this.$style.comp + this.uniqid()
38
30
  },
39
31
 
40
- computedChecked(){
41
- let checked
42
- if(this.modelValue){
43
- if(this.value){
44
- checked = this.modelValue === this.value
45
- }
46
- else if(this.trueValue){
47
- checked = this.trueValue === this.value
48
- }
49
- else{
50
- checked = parseBoolean(this.modelValue)
51
- }
52
- }
53
- else{
54
- checked = !!this.checked
55
- }
56
-
57
- return checked
58
- }
32
+ isDisabled(){
33
+ return parseBoolean(this.disabled)
34
+ },
35
+
36
+ cChecked(){
37
+ return this.$props.checked === undefined ? this.modelValue === this.value : parseBoolean(this.checked)
38
+ }
59
39
 
60
40
  },
61
41
 
62
42
  methods: {
63
43
 
64
- onChange(e){
65
- let value
66
- if(e.target.checked){
67
- if(this.value) value = this.value
68
- else if(this.trueValue) value = this.trueValue
69
- else value = true
70
-
71
- if(this.modelValue && Array.isArray(this.modelValue)){
72
- value = [ ...this.modelValue, value ].filter((v, idx, arr) => {
73
- return arr.indexOf(v) === idx
74
- })
75
- }
76
- }
77
- else{
78
- if(this.value) value = null
79
- else if(this.falseValue) value = this.falseValue
80
- else value = false
81
-
82
-
83
-
84
- if(this.modelValue && Array.isArray(this.modelValue)){
85
- value = this.modelValue.filter((v) => {
86
- return v !== this.value ?? (this.falseValue ?? false)
87
- })
88
- }
89
- }
90
- this.$emit('update:modelValue', value)
91
- }
44
+ onChange(){
45
+ if(this.isDisabled) return
46
+ this.$emit('update:modelValue', this.value)
47
+ }
92
48
 
93
49
  }
94
50
 
@@ -99,36 +55,30 @@ export default{
99
55
  <style module>
100
56
 
101
57
  .comp{
102
- @apply h-[var(--h-cp)] flex items-center;
58
+ @apply h-[var(--h-cp)] flex items-center cursor-pointer;
59
+ @apply flex flex-row items-center gap-2
103
60
  }
104
61
 
105
- .comp label{
106
- @apply flex flex-row items-center gap-2;
107
- }
108
-
109
- .comp input{
110
- @apply hidden;
62
+ .comp.checked .indicator>div{
63
+ transform: scale(1);
111
64
  }
112
65
 
113
66
  .indicator{
114
- @apply w-[21px] h-[21px] border-[1px] rounded-full border-text-200 bg-base-50;
115
- @apply flex items-center justify-center overflow-hidden;
116
- transition: border 300ms cubic-bezier(0.25, 1, 0.5, 1);
117
- }
118
- .comp:hover .indicator{
119
- @apply border-primary;
67
+ @apply w-[21px] h-[21px] border-[1px] rounded-full border-text-200 bg-base-50;
68
+ @apply flex items-center justify-center overflow-hidden;
69
+ transition: border 300ms cubic-bezier(0.25, 1, 0.5, 1);
120
70
  }
121
-
122
71
  .indicator>div{
123
- @apply w-[21px] h-[21px] flex rounded-full items-center justify-center bg-primary;
124
- transition: all 300ms cubic-bezier(0.25, 1, 0.5, 1);
125
- transform: scale(0);
72
+ @apply w-[21px] h-[21px] flex rounded-full items-center justify-center bg-primary;
73
+ transition: all 300ms cubic-bezier(0.25, 1, 0.5, 1);
74
+ transform: scale(0);
126
75
  }
127
76
  .indicator>div>*{
128
- @apply fill-white;
77
+ @apply fill-white;
129
78
  }
130
- .comp input:checked + label>.indicator>div{
131
- transform: scale(1);
79
+
80
+ .comp:not(.disabled):hover .indicator{
81
+ @apply border-primary;
132
82
  }
133
83
 
134
- </style>
84
+ </style>
@@ -85,9 +85,9 @@ export default{
85
85
  <style module>
86
86
 
87
87
  .toast{
88
- @apply max-w-[90vw] md:max-w-[640px] bg-base-300 mt-4 mx-auto rounded-xl border-[1px] border-text-200;
88
+ @apply max-w-[90vw] md:max-w-[480px] bg-base-500 mt-[64px] mx-auto rounded-xl border-[1px] border-text-100;
89
89
  @apply min-h-[var(--h-cp)];
90
90
  z-index: 61;
91
91
  }
92
92
 
93
- </style>
93
+ </style>
@@ -213,4 +213,4 @@ function observeInit(){
213
213
  once,
214
214
  always
215
215
  }
216
- }
216
+ }