webcake-ui-kit 1.2.14 → 1.2.15

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,6 +1,6 @@
1
1
  {
2
2
  "name": "webcake-ui-kit",
3
- "version": "1.2.14",
3
+ "version": "1.2.15",
4
4
  "description": "UI Kit for Vue 2 && 3 - Pure Options API",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -35,6 +35,7 @@
35
35
  "./WkEmpty": "./src/components/empty/Empty.vue",
36
36
  "./WkEmptyIcon": "./src/components/empty-icon/EmptyIcon.vue",
37
37
  "./WkField": "./src/components/field/Field.vue",
38
+ "./WkFileTypeIcon": "./src/components/file-type-icon/FileTypeIcon.vue",
38
39
  "./WkHoverCard": "./src/components/hover-card/HoverCard.vue",
39
40
  "./WkInput": "./src/components/input/Input.vue",
40
41
  "./WkInputCounter": "./src/components/input-counter/InputCounter.vue",
@@ -0,0 +1,261 @@
1
+ <template>
2
+ <div
3
+ :class="['ui-file-type-icon', `ui-file-type-icon--variant-${variant}`, isFolder && 'ui-file-type-icon--is-folder']"
4
+ :style="{ width: iconWidth + 'px', height: iconHeight + 'px' }"
5
+ >
6
+ <template v-if="!isFolder">
7
+ <svg
8
+ v-if="variant == 'default'"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ :width="iconWidth"
11
+ :height="iconHeight"
12
+ viewBox="0 0 32 40"
13
+ fill="none"
14
+ >
15
+ <path
16
+ d="M0 4C0 1.79086 1.79086 0 4 0H20C20.3201 0 20.6272 0.127177 20.8536 0.353553L31.6464 11.1464C31.8728 11.3728 32 11.6799 32 12V36C32 38.2091 30.2091 40 28 40H4C1.79086 40 0 38.2091 0 36V4Z"
17
+ fill="white"
18
+ />
19
+ <path
20
+ d="M0 36V4C5.15405e-07 1.79086 1.79086 0 4 0H20C20.3201 0 20.6271 0.127163 20.8535 0.353516L31.6465 11.1465C31.8728 11.3729 32 11.6799 32 12V36C32 38.2091 30.2091 40 28 40V39C29.6569 39 31 37.6569 31 36V12C31 11.9451 30.9783 11.8924 30.9395 11.8535L20.1465 1.06055C20.1076 1.02173 20.0549 1 20 1H4C2.34315 1 1 2.34315 1 4V36C1 37.6569 2.34315 39 4 39V40C1.79086 40 0 38.2091 0 36ZM28 39V40H4V39H28Z"
21
+ fill="#D1D1D1"
22
+ />
23
+ <path
24
+ d="M19.5 8V0.5H20.5V8C20.5 9.933 22.067 11.5 24 11.5H31.5V12.5H24C21.5147 12.5 19.5 10.4853 19.5 8Z"
25
+ fill="#D1D1D1"
26
+ />
27
+ </svg>
28
+ <div v-if="variant == 'grey'">
29
+ <svg xmlns="http://www.w3.org/2000/svg" :width="iconWidth" :height="iconHeight" viewBox="0 0 32 40" fill="none">
30
+ <mask
31
+ id="mask0_5136_6089"
32
+ style="mask-type: alpha"
33
+ maskUnits="userSpaceOnUse"
34
+ x="0"
35
+ y="0"
36
+ width="32"
37
+ height="40"
38
+ >
39
+ <path d="M0 0H20L32 12V40H0V0Z" fill="url(#paint0_linear_5136_6089)" />
40
+ </mask>
41
+ <g mask="url(#mask0_5136_6089)">
42
+ <path
43
+ d="M0 4C0 1.79086 1.79086 0 4 0H20L32 12V36C32 38.2091 30.2091 40 28 40H4C1.79086 40 0 38.2091 0 36V4Z"
44
+ fill="#D1D1D1"
45
+ />
46
+ </g>
47
+ <defs>
48
+ <linearGradient id="paint0_linear_5136_6089" x1="16" y1="0" x2="16" y2="40" gradientUnits="userSpaceOnUse">
49
+ <stop stop-opacity="0.4" />
50
+ <stop offset="1" />
51
+ </linearGradient>
52
+ </defs>
53
+ </svg>
54
+ <svg
55
+ style="position: absolute; top: 0; right: 0"
56
+ xmlns="http://www.w3.org/2000/svg"
57
+ :width="iconWidth * 0.375"
58
+ :height="iconWidth * 0.375"
59
+ viewBox="0 0 12 12"
60
+ fill="none"
61
+ >
62
+ <path d="M0 0L12 12H4C1.79086 12 0 10.2091 0 8V0Z" fill="#A3A3A3" />
63
+ </svg>
64
+ </div>
65
+ <svg
66
+ v-if="variant == 'solid'"
67
+ xmlns="http://www.w3.org/2000/svg"
68
+ :width="iconWidth"
69
+ :height="iconHeight"
70
+ viewBox="0 0 32 40"
71
+ fill="none"
72
+ >
73
+ <path
74
+ d="M0 4C0 1.79086 1.79086 0 4 0H18.3431C19.404 0 20.4214 0.421427 21.1716 1.17157L30.8284 10.8284C31.5786 11.5786 32 12.596 32 13.6569V36C32 38.2091 30.2091 40 28 40H4C1.79086 40 0 38.2091 0 36V4Z"
75
+ :fill="fill"
76
+ />
77
+ <path opacity="0.3" d="M20 0L32 12H24C21.7909 12 20 10.2091 20 8V0Z" fill="white" />
78
+ </svg>
79
+
80
+ <div :class="['ui-file-type-icon--text-wrapper']" :style="textWrapperStyle">
81
+ <span class="ui-file-type-icon--text" :style="textStyle">{{ fileType.toUpperCase() }}</span>
82
+ </div>
83
+ </template>
84
+ <template v-else>
85
+ <svg
86
+ v-if="isFolderEmpty"
87
+ xmlns="http://www.w3.org/2000/svg"
88
+ :width="iconWidth"
89
+ :height="iconHeight"
90
+ viewBox="0 0 40 40"
91
+ fill="none"
92
+ >
93
+ <path
94
+ d="M1.17651 6.46483L1.17651 33.5493C1.17651 34.7243 2.12902 35.6768 3.304 35.6768H36.6961C37.8711 35.6768 38.8236 34.7243 38.8236 33.5493V10.4844C38.8236 9.30945 37.8711 8.35695 36.6961 8.35695H19.2617C18.4346 8.35695 17.6869 7.87454 17.249 7.17284C16.5092 5.98714 15.2188 4.33734 13.7666 4.33734H3.30289C2.12792 4.33734 1.17651 5.28985 1.17651 6.46483Z"
95
+ fill="#FFC531"
96
+ />
97
+ <path
98
+ d="M38.8236 13.172V32.8876C38.8236 34.0625 37.8711 35.0151 36.6961 35.0151H3.30399C2.12902 35.0151 1.17651 34.0625 1.17651 32.8876V15.1675C1.17651 13.9925 2.1289 13.04 3.30388 13.04H13.1014C16.4522 13.04 15.984 11.0444 18.2754 11.0445C24.4425 11.0448 32.8248 11.0446 36.6992 11.0445C37.8742 11.0445 38.8236 11.997 38.8236 13.172Z"
99
+ fill="url(#paint0_linear_4011_2428)"
100
+ />
101
+ <defs>
102
+ <linearGradient
103
+ id="paint0_linear_4011_2428"
104
+ x1="38.8236"
105
+ y1="11.0445"
106
+ x2="1.99669"
107
+ y2="36.215"
108
+ gradientUnits="userSpaceOnUse"
109
+ >
110
+ <stop offset="0.234375" stop-color="#FCF68D" />
111
+ <stop offset="1" stop-color="#FFC531" />
112
+ </linearGradient>
113
+ </defs>
114
+ </svg>
115
+ <svg
116
+ v-else
117
+ xmlns="http://www.w3.org/2000/svg"
118
+ :width="iconWidth"
119
+ :height="iconHeight"
120
+ viewBox="0 0 40 40"
121
+ fill="none"
122
+ >
123
+ <path
124
+ d="M1.17651 6.46483L1.17651 33.5493C1.17651 34.7243 2.12902 35.6768 3.304 35.6768H36.6961C37.8711 35.6768 38.8236 34.7243 38.8236 33.5493V10.4844C38.8236 9.30945 37.8711 8.35695 36.6961 8.35695H19.2617C18.4346 8.35695 17.6869 7.87454 17.249 7.17284C16.5092 5.98714 15.2188 4.33734 13.7666 4.33734H3.30289C2.12792 4.33734 1.17651 5.28985 1.17651 6.46483Z"
125
+ fill="#FFC531"
126
+ />
127
+ <path
128
+ d="M1.58411 12.1417C1.58411 11.0135 2.48261 10.099 3.59096 10.099H36.4089C37.5173 10.099 38.4158 11.0135 38.4158 12.1417V32.8088C38.4158 33.9369 37.5173 34.8515 36.4089 34.8515H3.59096C2.48261 34.8515 1.58411 33.9369 1.58411 32.8088V12.1417Z"
129
+ fill="white"
130
+ />
131
+ <path
132
+ d="M38.8236 13.172V32.8876C38.8236 34.0625 37.8711 35.0151 36.6961 35.0151H3.30399C2.12902 35.0151 1.17651 34.0625 1.17651 32.8876V15.1675C1.17651 13.9925 2.1289 13.04 3.30388 13.04H13.1014C16.4522 13.04 15.984 11.0444 18.2754 11.0445C24.4425 11.0448 32.8248 11.0446 36.6992 11.0445C37.8742 11.0445 38.8236 11.997 38.8236 13.172Z"
133
+ fill="url(#paint0_linear_4011_2429)"
134
+ />
135
+ <defs>
136
+ <linearGradient
137
+ id="paint0_linear_4011_2429"
138
+ x1="38.8236"
139
+ y1="11.0445"
140
+ x2="1.99669"
141
+ y2="36.215"
142
+ gradientUnits="userSpaceOnUse"
143
+ >
144
+ <stop offset="0.234375" stop-color="#FCF68D" />
145
+ <stop offset="1" stop-color="#FFC531" />
146
+ </linearGradient>
147
+ </defs>
148
+ </svg>
149
+ </template>
150
+ </div>
151
+ </template>
152
+
153
+ <script>
154
+ export default {
155
+ name: 'WkFileTypeIcon',
156
+ props: {
157
+ variant: {
158
+ type: String,
159
+ validator: v => ['default', 'grey', 'solid'].includes(v),
160
+ default: 'default'
161
+ },
162
+ isFolder: Boolean,
163
+ isFolderEmpty: Boolean,
164
+ fileType: {
165
+ type: String,
166
+ default: ''
167
+ },
168
+ width: {
169
+ type: Number,
170
+ default: 40
171
+ }
172
+ },
173
+ emits: [],
174
+ computed: {
175
+ iconWidth() {
176
+ if (this.isFolder) {
177
+ return this.width
178
+ }
179
+ // File icon aspect ratio: 32/40 = 0.8
180
+ return this.width * 0.8
181
+ },
182
+ iconHeight() {
183
+ if (this.isFolder) {
184
+ return this.width
185
+ }
186
+ // File icon aspect ratio: 40/32 = 1.25
187
+ return this.width
188
+ },
189
+ scaleFactor() {
190
+ return this.width / 40
191
+ },
192
+ textWrapperStyle() {
193
+ const baseBottom = 6
194
+ const basePadding = 2
195
+ const basePaddingX = 3
196
+ const baseBorderRadius = 2
197
+
198
+ const styles = {
199
+ padding: `${basePadding * this.scaleFactor}px ${basePaddingX * this.scaleFactor}px`,
200
+ bottom: `${baseBottom * this.scaleFactor}px`,
201
+ borderRadius: `${baseBorderRadius * this.scaleFactor}px`
202
+ }
203
+
204
+ if (this.variant === 'default') {
205
+ styles.left = `${-6 * this.scaleFactor}px`
206
+ }
207
+
208
+ if (['default', 'solid'].includes(this.variant)) {
209
+ styles.background = this.fill
210
+ }
211
+
212
+ return styles
213
+ },
214
+ textStyle() {
215
+ const baseFontSize = 10
216
+ return {
217
+ fontSize: `${baseFontSize * this.scaleFactor}px`
218
+ }
219
+ },
220
+ fill() {
221
+ switch (this.fileType.toLowerCase()) {
222
+ case 'pdf':
223
+ return 'var(--red-600, #DC2626)'
224
+ case 'doc':
225
+ case 'docx':
226
+ case 'psd':
227
+ case 'mp4':
228
+ case 'mpeg':
229
+ case 'avi':
230
+ case 'mkv':
231
+ return 'var(--blue-600, #2563EB)'
232
+ case 'txt':
233
+ case 'pig':
234
+ case 'zip':
235
+ case 'rar':
236
+ return 'var(--neutral-600, #5C5C5C)'
237
+ case 'csv':
238
+ case 'xls':
239
+ case 'xlsx':
240
+ return 'var(--green-600, #16A34A)'
241
+ case 'ppt':
242
+ case 'pptx':
243
+ case 'ai':
244
+ return 'var(--orange-600, #EA580C)'
245
+ case 'indd':
246
+ return 'var(--fuchsia-600, #C026D3)'
247
+ case 'aep':
248
+ return 'var(--purple-600, #9333EA)'
249
+ case 'mp3':
250
+ case 'wav':
251
+ return 'var(--pink-600, #DB2777)'
252
+ default:
253
+ return 'var(--indigo-600, #4F46E5)'
254
+ }
255
+ }
256
+ },
257
+ methods: {}
258
+ }
259
+ </script>
260
+
261
+ <style src="./file-type-icon.css" scoped></style>
@@ -0,0 +1,48 @@
1
+ .ui-file-type-icon {
2
+ position: relative;
3
+ height: 40px;
4
+ width: 32px;
5
+ }
6
+ .ui-file-type-icon--variant-grey,
7
+ .ui-file-type-icon--variant-solid {
8
+ overflow: hidden;
9
+ }
10
+ .ui-file-type-icon.ui-file-type-icon--is-folder {
11
+ width: 40px;
12
+ }
13
+ .ui-file-type-icon--text-wrapper {
14
+ position: absolute;
15
+ border-radius: 2px;
16
+ padding: 2px 3px;
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ }
21
+ .ui-file-type-icon--variant-default .ui-file-type-icon--text-wrapper {
22
+ left: -6px;
23
+ bottom: 6px;
24
+ }
25
+ .ui-file-type-icon--variant-grey .ui-file-type-icon--text-wrapper,
26
+ .ui-file-type-icon--variant-solid .ui-file-type-icon--text-wrapper {
27
+ left: 50%;
28
+ transform: translateX(-50%);
29
+ bottom: 6px;
30
+ }
31
+
32
+ .ui-file-type-icon--text {
33
+ font-size: 10px;
34
+ font-family: 'Inter';
35
+ text-align: center;
36
+ font-style: normal;
37
+ font-weight: 700;
38
+ line-height: normal;
39
+ user-select: none;
40
+ }
41
+
42
+ .ui-file-type-icon--variant-default .ui-file-type-icon--text,
43
+ .ui-file-type-icon--variant-solid .ui-file-type-icon--text {
44
+ color: white;
45
+ }
46
+ .ui-file-type-icon--variant-grey .ui-file-type-icon--text {
47
+ color: var(--neutral-700);
48
+ }
package/src/index.js CHANGED
@@ -17,6 +17,7 @@ export { default as WkDropdown } from './components/dropdown/Dropdown.vue'
17
17
  export { default as WkEmpty } from './components/empty/Empty.vue'
18
18
  export { default as WkEmptyIcon } from './components/empty-icon/EmptyIcon.vue'
19
19
  export { default as WkField } from './components/field/Field.vue'
20
+ export { default as WkFileTypeIcon } from './components/file-type-icon/FileTypeIcon.vue'
20
21
  export { default as WkHoverCard } from './components/hover-card/HoverCard.vue'
21
22
  export { default as WkInput } from './components/input/Input.vue'
22
23
  export { default as WkInputCounter } from './components/input-counter/InputCounter.vue'