@bagelink/vue 0.0.988 → 0.0.992
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/components/Btn.vue.d.ts.map +1 -1
- package/dist/components/Loading.vue.d.ts +16 -0
- package/dist/components/Loading.vue.d.ts.map +1 -0
- package/dist/components/form/BglField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/CodeEditor/Index.vue.d.ts +12 -57
- package/dist/components/form/inputs/CodeEditor/Index.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText/components/gridBox.vue.d.ts +3 -7
- package/dist/components/form/inputs/RichText/components/gridBox.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText/composables/useEditor.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText/index.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText/utils/table.d.ts +2 -1
- package/dist/components/form/inputs/RichText/utils/table.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/layout/TabsNav.vue.d.ts.map +1 -1
- package/dist/editor-a8DSbb6P.js +4 -0
- package/dist/editor-xBt_vIha.cjs +4 -0
- package/dist/index.cjs +10289 -48576
- package/dist/index.mjs +10290 -48577
- package/dist/style.css +815 -20218
- package/package.json +6 -34
- package/src/components/Btn.vue +110 -136
- package/src/components/Loading.vue +177 -0
- package/src/components/form/BglField.vue +2 -0
- package/src/components/form/inputs/CodeEditor/Index.vue +77 -400
- package/src/components/form/inputs/CodeEditor/format.ts +2 -2
- package/src/components/form/inputs/FileUpload.vue +2 -1
- package/src/components/form/inputs/RichText/components/gridBox.vue +37 -8
- package/src/components/form/inputs/RichText/composables/useEditor.ts +11 -4
- package/src/components/form/inputs/RichText/config.ts +1 -1
- package/src/components/form/inputs/RichText/editor.css +14 -14
- package/src/components/form/inputs/RichText/index.vue +11 -10
- package/src/components/form/inputs/RichText/utils/table.ts +60 -58
- package/src/components/index.ts +2 -2
- package/src/components/layout/TabsNav.vue +1 -0
- package/src/styles/theme.css +256 -256
- package/src/components/form/inputs/CodeEditor/themes/brown-papersq.png +0 -0
- package/src/components/form/inputs/CodeEditor/themes/pojoaque.jpg +0 -0
- package/src/components/form/inputs/CodeEditor/themes/themes-base16.css +0 -12809
- package/src/components/form/inputs/CodeEditor/themes/themes.css +0 -6740
- package/src/components/formkit/FileUploader.vue +0 -406
- package/src/components/formkit/MiscFields.vue +0 -74
- package/src/components/formkit/Toggle.vue +0 -149
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagelink/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.992",
|
|
5
5
|
"description": "Bagel core sdk packages",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Neveh Allon",
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"vue": "*",
|
|
63
63
|
"vue-draggable-next": "^2.2.1",
|
|
64
64
|
"vue-router": "*",
|
|
65
|
-
"vue3-charts": "^1.1.33"
|
|
65
|
+
"vue3-charts": "^1.1.33",
|
|
66
|
+
"@vuepic/vue-datepicker": "^8.8.1"
|
|
66
67
|
},
|
|
67
68
|
"peerDependenciesMeta": {
|
|
68
69
|
"@vuepic/vue-datepicker": {
|
|
@@ -71,50 +72,21 @@
|
|
|
71
72
|
"vue3-charts": {
|
|
72
73
|
"optional": true
|
|
73
74
|
},
|
|
74
|
-
"@formkit/vue": {
|
|
75
|
-
"optional": true
|
|
76
|
-
},
|
|
77
|
-
"@formkit/core": {
|
|
78
|
-
"optional": true
|
|
79
|
-
},
|
|
80
75
|
"vue-draggable-next": {
|
|
81
76
|
"optional": true
|
|
82
|
-
},
|
|
83
|
-
"prosemirror-commands": {
|
|
84
|
-
"optional": true
|
|
85
|
-
},
|
|
86
|
-
"prosemirror-history": {
|
|
87
|
-
"optional": true
|
|
88
|
-
},
|
|
89
|
-
"prosemirror-keymap": {
|
|
90
|
-
"optional": true
|
|
91
|
-
},
|
|
92
|
-
"prosemirror-model": {
|
|
93
|
-
"optional": true
|
|
94
|
-
},
|
|
95
|
-
"prosemirror-schema-basic": {
|
|
96
|
-
"optional": true
|
|
97
|
-
},
|
|
98
|
-
"prosemirror-state": {
|
|
99
|
-
"optional": true
|
|
100
|
-
},
|
|
101
|
-
"prosemirror-view": {
|
|
102
|
-
"optional": true
|
|
103
77
|
}
|
|
104
78
|
},
|
|
105
79
|
"publishConfig": {
|
|
106
80
|
"access": "public"
|
|
107
81
|
},
|
|
108
82
|
"dependencies": {
|
|
109
|
-
"
|
|
110
|
-
"
|
|
83
|
+
"@highlightjs/vue-plugin": "^2.1.0",
|
|
84
|
+
"heic2any": "^0.0.4",
|
|
111
85
|
"@vueuse/core": "^12.0.0",
|
|
112
86
|
"axios": "^1.7.9",
|
|
113
|
-
"heic2any": "^0.0.4",
|
|
114
87
|
"floating-vue": "^5.2.2",
|
|
115
88
|
"libphonenumber-js": "1.11.16",
|
|
116
|
-
"signature_pad": "^5.0.4"
|
|
117
|
-
"type-fest": "^4.30.0"
|
|
89
|
+
"signature_pad": "^5.0.4"
|
|
118
90
|
},
|
|
119
91
|
"scripts": {
|
|
120
92
|
"dev": "tsx watch src/index.ts",
|
package/src/components/Btn.vue
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { MaterialIcons, ThemeType } from '@bagelink/vue'
|
|
3
|
-
import { MaterialIcon } from '@bagelink/vue'
|
|
3
|
+
import { MaterialIcon, Loading } from '@bagelink/vue'
|
|
4
4
|
import { useSlots } from 'vue'
|
|
5
|
+
import { RouterLink } from 'vue-router'
|
|
5
6
|
|
|
6
7
|
const props = withDefaults(
|
|
7
8
|
defineProps<{
|
|
@@ -38,77 +39,44 @@ const props = withDefaults(
|
|
|
38
39
|
)
|
|
39
40
|
|
|
40
41
|
const isComponent = $computed(() => {
|
|
41
|
-
if (props.to) return
|
|
42
|
+
if (props.to) return RouterLink
|
|
42
43
|
if (props.href) return 'a'
|
|
43
44
|
return props.is
|
|
44
45
|
})
|
|
45
46
|
|
|
47
|
+
const bind = $computed(() => {
|
|
48
|
+
const obj: Record<string, any> = {}
|
|
49
|
+
if (props.to) obj.to = props.to
|
|
50
|
+
else if (props.href) obj.href = props.href
|
|
51
|
+
if (!props.to && !props.href) {
|
|
52
|
+
obj.role = props.role
|
|
53
|
+
obj.type = props.type
|
|
54
|
+
}
|
|
55
|
+
return obj
|
|
56
|
+
})
|
|
46
57
|
const slots = useSlots()
|
|
47
|
-
|
|
48
|
-
const computedTheme = $computed(
|
|
49
|
-
() => {
|
|
50
|
-
if (props.disabled) return 'gray-light'
|
|
51
|
-
return (props.color || props.theme)
|
|
52
|
-
},
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
const computedDefaultColors = $computed(
|
|
56
|
-
() => ({
|
|
57
|
-
backgroundColor: 'var(--bgl-primary)',
|
|
58
|
-
color: props.flat ? 'var(--bgl-text-color)' : 'var(--bgl-light-text)',
|
|
59
|
-
}),
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
function getThemeColors(theme: Partial<typeof computedDefaultColors>): typeof computedDefaultColors {
|
|
63
|
-
return ({
|
|
64
|
-
...computedDefaultColors,
|
|
65
|
-
...theme,
|
|
66
|
-
color: props.flat
|
|
67
|
-
? theme.backgroundColor as string
|
|
68
|
-
: theme.color as string,
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const themes: Partial<Record<ThemeType, typeof computedDefaultColors>> = {
|
|
73
|
-
'red': getThemeColors({ backgroundColor: 'var(--bgl-red)' }),
|
|
74
|
-
'white': getThemeColors({ backgroundColor: 'var(--bgl-white)', color: 'var(--bgl-black)' }),
|
|
75
|
-
'black': getThemeColors({ backgroundColor: 'var(--bgl-black)', color: 'var(--bgl-white)' }),
|
|
76
|
-
'green': getThemeColors({ backgroundColor: 'var(--bgl-green)', color: 'var(--bgl-white)' }),
|
|
77
|
-
'primary': getThemeColors({ backgroundColor: 'var(--bgl-primary)', color: 'var(--bgl-white)' }),
|
|
78
|
-
'yellow': getThemeColors({ backgroundColor: 'var(--bgl-yellow)', color: 'var(--bgl-black)' }),
|
|
79
|
-
'gray': getThemeColors({ backgroundColor: 'var(--bgl-gray-light)', color: 'var(--bgl-black)' }),
|
|
80
|
-
'light': getThemeColors({ backgroundColor: 'var(--bgl-primary-light)', color: 'var(--bgl-primary)' }),
|
|
81
|
-
'gray-light': getThemeColors({ backgroundColor: 'var(--bgl-gray-light)', color: 'var(--bgl-gray)' }),
|
|
82
|
-
'blue': getThemeColors({}),
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const cumputedTextColor = $computed(
|
|
86
|
-
() => (themes[computedTheme as ThemeType]?.color ?? computedDefaultColors.color),
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
const computedBackgroundColor = $computed(
|
|
90
|
-
() => (themes[computedTheme as ThemeType]?.backgroundColor ?? computedDefaultColors.backgroundColor),
|
|
91
|
-
)
|
|
92
58
|
</script>
|
|
93
59
|
|
|
94
60
|
<template>
|
|
95
61
|
<component
|
|
96
62
|
:is="isComponent"
|
|
97
|
-
v-ripple
|
|
63
|
+
v-ripple v-bind="bind" :disabled="disabled"
|
|
64
|
+
class="bgl_btn"
|
|
98
65
|
:class="{
|
|
99
66
|
'bgl_btn-icon': icon && !slots.default && !value,
|
|
100
|
-
'bgl_btn': !icon || slots.default || value,
|
|
101
67
|
thin,
|
|
102
68
|
round,
|
|
103
|
-
'
|
|
69
|
+
'bgl_btn_flat': flat,
|
|
104
70
|
'bgl_btn-border': border || outline,
|
|
71
|
+
[`bgl_btn-${color}`]: color,
|
|
72
|
+
[`bgl_btn-${theme}`]: theme,
|
|
105
73
|
}"
|
|
106
74
|
:tabindex="disabled ? -1 : 0"
|
|
107
75
|
@click.stop="onClick"
|
|
108
76
|
@keydown.enter="onClick"
|
|
109
77
|
@keydown.space="onClick"
|
|
110
78
|
>
|
|
111
|
-
<
|
|
79
|
+
<Loading v-if="loading" size="15" />
|
|
112
80
|
<div v-else class="bgl_btn-flex">
|
|
113
81
|
<MaterialIcon v-if="icon" :icon="icon" />
|
|
114
82
|
<slot />
|
|
@@ -121,51 +89,93 @@ const computedBackgroundColor = $computed(
|
|
|
121
89
|
</template>
|
|
122
90
|
|
|
123
91
|
<style scoped>
|
|
124
|
-
|
|
125
|
-
|
|
92
|
+
.bgl_btn {
|
|
93
|
+
--btn-bg: var(--bgl-primary);
|
|
94
|
+
--btn-color: var(--bgl-light-text);
|
|
95
|
+
--btn-flat-color: var(--bgl-text-color);
|
|
126
96
|
}
|
|
127
97
|
|
|
128
|
-
.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
border-radius: 100px;
|
|
133
|
-
width: 1rem;
|
|
134
|
-
height: 1rem;
|
|
135
|
-
margin: auto;
|
|
98
|
+
.bgl_btn-green {
|
|
99
|
+
--btn-bg: var(--bgl-green);
|
|
100
|
+
--btn-color: var(--bgl-light-text);
|
|
101
|
+
--btn-flat-color: var(--bgl-green);
|
|
136
102
|
}
|
|
137
103
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
104
|
+
.bgl_btn-yellow {
|
|
105
|
+
--btn-bg: var(--bgl-yellow);
|
|
106
|
+
--btn-color: var(--bgl-black);
|
|
107
|
+
--btn-flat-color: var(--bgl-yellow);
|
|
108
|
+
}
|
|
142
109
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
110
|
+
.bgl_btn-blue {
|
|
111
|
+
--btn-bg: var(--bgl-blue);
|
|
112
|
+
--btn-color: var(--bgl-light-text);
|
|
113
|
+
--btn-flat-color: var(--bgl-blue);
|
|
146
114
|
}
|
|
147
115
|
|
|
148
|
-
.bgl_btn-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
116
|
+
.bgl_btn-primary {
|
|
117
|
+
--btn-bg: var(--bgl-primary);
|
|
118
|
+
--btn-color: var(--bgl-light-text);
|
|
119
|
+
--btn-flat-color: var(--bgl-primary);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.bgl_btn-red {
|
|
123
|
+
--btn-bg: var(--bgl-red);
|
|
124
|
+
--btn-color: var(--bgl-light-text);
|
|
125
|
+
--btn-flat-color: var(--bgl-red);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.bgl_btn-white {
|
|
129
|
+
--btn-bg: var(--bgl-white);
|
|
130
|
+
--btn-color: var(--bgl-black);
|
|
131
|
+
--btn-flat-color: var(--bgl-white);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.bgl_btn-black {
|
|
135
|
+
--btn-bg: var(--bgl-black);
|
|
136
|
+
--btn-color: var(--bgl-light-text);
|
|
137
|
+
--btn-flat-color: var(--bgl-black);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.bgl_btn-gray {
|
|
141
|
+
--btn-bg: var(--bgl-gray-light);
|
|
142
|
+
--btn-color: var(--bgl-black);
|
|
143
|
+
--btn-flat-color: var(--bgl-gray);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.bgl_btn-light {
|
|
147
|
+
--btn-bg: var(--bgl-primary-light);
|
|
148
|
+
--btn-color: var(--bgl-primary);
|
|
149
|
+
--btn-flat-color: var(--bgl-primary-light);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.bgl_btn-gray-light {
|
|
153
|
+
--btn-bg: var(--bgl-gray-light);
|
|
154
|
+
--btn-color: var(--bgl-gray);
|
|
155
|
+
--btn-flat-color: var(--bgl-gray-light);
|
|
157
156
|
}
|
|
158
157
|
|
|
159
158
|
.bgl_btn {
|
|
160
159
|
padding-left: var(--btn-padding);
|
|
161
160
|
padding-right: var(--btn-padding);
|
|
162
161
|
transition: var(--bgl-transition);
|
|
162
|
+
background: var(--btn-bg);
|
|
163
|
+
color: var(--btn-color);
|
|
163
164
|
text-decoration: none;
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
.bgl_btn
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
.bgl_btn.bgl_btn-icon {
|
|
168
|
+
padding-left: 0;
|
|
169
|
+
padding-right: 0;
|
|
170
|
+
height: var(--btn-height);
|
|
171
|
+
width: var(--btn-height);
|
|
172
|
+
border-radius: 100%;
|
|
173
|
+
font-size: 1rem;
|
|
174
|
+
flex-shrink: 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
a {
|
|
178
|
+
text-decoration: none;
|
|
169
179
|
}
|
|
170
180
|
|
|
171
181
|
.bgl_btn-flex {
|
|
@@ -180,74 +190,34 @@ a {
|
|
|
180
190
|
font-size: calc(var(--input-font-size) * 1.3);
|
|
181
191
|
}
|
|
182
192
|
|
|
183
|
-
.bgl_btn,
|
|
184
|
-
.bgl_btn-icon {
|
|
185
|
-
background-color: v-bind(computedBackgroundColor);
|
|
186
|
-
color: v-bind(cumputedTextColor);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
193
|
.bgl_btn:hover,
|
|
190
194
|
.bgl_btn-icon:hover {
|
|
191
195
|
filter: var(--bgl-hover-filter);
|
|
192
196
|
}
|
|
193
197
|
|
|
194
|
-
.bgl_btn:active,
|
|
195
|
-
.bgl_btn-icon:active {
|
|
198
|
+
.bgl_btn:active:not(:disabled),
|
|
199
|
+
.bgl_btn-icon:active:not(:disabled) {
|
|
196
200
|
filter: var(--bgl-active-filter);
|
|
197
201
|
}
|
|
198
202
|
|
|
199
|
-
.bgl_btn.
|
|
200
|
-
padding-left: var(--btn-padding);
|
|
201
|
-
padding-right: var(--btn-padding);
|
|
202
|
-
background: transparent;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.bgl_btn-icon.bgl_flatBtn {
|
|
203
|
+
.bgl_btn.bgl_btn_flat {
|
|
206
204
|
background: transparent;
|
|
205
|
+
color: var(--btn-flat-color);
|
|
207
206
|
}
|
|
208
207
|
|
|
209
|
-
.
|
|
210
|
-
.bgl_btn-icon.
|
|
211
|
-
filter: var(--bgl-hover-filter);
|
|
208
|
+
.bgl_btn_flat:hover:not(:disabled),
|
|
209
|
+
.bgl_btn-icon.bgl_btn_flat:hover:not(:disabled) {
|
|
212
210
|
background: var(--bgl-gray-20);
|
|
213
|
-
color: var(--bgl-primary);
|
|
214
211
|
}
|
|
215
212
|
|
|
216
|
-
.bgl_btn.
|
|
217
|
-
.bgl_btn-icon.
|
|
213
|
+
.bgl_btn.bgl_btn_flat:active:not(:disabled),
|
|
214
|
+
.bgl_btn-icon.bgl_btn_flat:active:not(:disabled) {
|
|
218
215
|
background: var(--bgl-gray-40);
|
|
219
|
-
filter: var(--bgl-active-filter);
|
|
220
|
-
color: var(--bgl-primary);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.bgl_btn.bgl_flatBtn.red,
|
|
224
|
-
.bgl_btn-icon.bgl_flatBtn.red {
|
|
225
|
-
color: var(--bgl-red);
|
|
226
|
-
}
|
|
227
|
-
.bgl_btn.bgl_flatBtn.white,
|
|
228
|
-
.bgl_btn-icon.bgl_flatBtn.white {
|
|
229
|
-
color: var(--bgl-light-text);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
.bgl_btn.bgl_flatBtn.light,
|
|
233
|
-
.bgl_btn-icon.bgl_flatBtn.light {
|
|
234
|
-
color: var(--bgl-primary-tint);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.bgl_btn.bgl_flatBtn.black,
|
|
238
|
-
.bgl_btn-icon.bgl_flatBtn.black {
|
|
239
|
-
color: var(--bgl-text-color);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.bgl_btn.bgl_flatBtn.gray,
|
|
243
|
-
.bgl_btn-icon.bgl_flatBtn.gray {
|
|
244
|
-
color: var(--bgl-gray);
|
|
245
216
|
}
|
|
246
217
|
|
|
247
218
|
.bgl_btn.thin {
|
|
248
219
|
padding-inline: calc(var(--btn-padding) / 3);
|
|
249
220
|
border-radius: calc(var(--btn-border-radius) / 1.5);
|
|
250
|
-
|
|
251
221
|
}
|
|
252
222
|
|
|
253
223
|
.bgl_btn.round {
|
|
@@ -267,19 +237,23 @@ a {
|
|
|
267
237
|
transform: rotateY(180deg);
|
|
268
238
|
}
|
|
269
239
|
|
|
270
|
-
.bgl_btn-border {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
240
|
+
.bgl_btn-border, .bgl_btn-icon.bgl_btn_flat.bgl_btn-border {
|
|
241
|
+
border: 1px solid var(--btn-flat-color);
|
|
242
|
+
background: transparent;
|
|
243
|
+
color: var(--btn-flat-color);
|
|
274
244
|
}
|
|
275
245
|
|
|
276
246
|
.bgl_btn-border:hover {
|
|
277
|
-
|
|
278
|
-
background: v-bind(computedBackgroundColor);
|
|
279
|
-
filter: brightness(100%);
|
|
247
|
+
color: var(--btn-flat-color);
|
|
280
248
|
}
|
|
281
249
|
|
|
282
|
-
.bgl_btn-border:active {
|
|
250
|
+
.bgl_btn-border:active:not(:disabled) {
|
|
283
251
|
filter: brightness(80%);
|
|
284
252
|
}
|
|
253
|
+
|
|
254
|
+
.bgl_btn:disabled {
|
|
255
|
+
opacity: 0.6;
|
|
256
|
+
filter: grayscale(0.3);
|
|
257
|
+
cursor: not-allowed;
|
|
258
|
+
}
|
|
285
259
|
</style>
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
type LoadingType = 'ring' | 'ellipsis' | 'bar'
|
|
3
|
+
|
|
4
|
+
const { type: theme = 'ring', size = 64, thickness, duration = 1.2, color } = defineProps<{
|
|
5
|
+
size?: number | string
|
|
6
|
+
thickness?: number | string
|
|
7
|
+
duration?: number | string
|
|
8
|
+
type?: LoadingType
|
|
9
|
+
color?: string
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
// Ensure size and units are correctly formatted
|
|
13
|
+
function standardSize(value: number | string | undefined, unit = 'px') {
|
|
14
|
+
if (!value) return `${size}${unit}`
|
|
15
|
+
return typeof value === 'number' ? `${value}${unit}` : value.endsWith(unit) ? value : `${value}${unit}`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Computed Values
|
|
19
|
+
const computedSize = $computed(() => standardSize(size))
|
|
20
|
+
const animationDuration = $computed(() => `${duration}s`)
|
|
21
|
+
|
|
22
|
+
// Border size for ring theme (defaults to 1/8th of the size)
|
|
23
|
+
const computedBorder = $computed(() => {
|
|
24
|
+
const borderValue = thickness ?? Number.parseInt(computedSize) / 7
|
|
25
|
+
return standardSize(borderValue)
|
|
26
|
+
})
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div class="flex-center">
|
|
31
|
+
<!-- Bar Theme -->
|
|
32
|
+
<div v-if="theme === 'bar'" class="lds-bar" :style="{ animationDuration, color }" />
|
|
33
|
+
|
|
34
|
+
<!-- Ellipsis Theme -->
|
|
35
|
+
<div v-if="theme === 'ellipsis'" class="lds-ellipsis" :style="{ '--size': computedSize }">
|
|
36
|
+
<div v-for="n in 4" :key="n" :style="{ color, '--size': computedSize }" />
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<!-- Ring Theme -->
|
|
40
|
+
<div v-if="theme === 'ring'" class="lds-ring" :style="{ '--size': computedSize, '--thickness': computedBorder }">
|
|
41
|
+
<div
|
|
42
|
+
v-for="n in 4" :key="n"
|
|
43
|
+
:style="{
|
|
44
|
+
color,
|
|
45
|
+
'width':
|
|
46
|
+
computedSize,
|
|
47
|
+
'height': computedSize,
|
|
48
|
+
'borderWidth': computedBorder,
|
|
49
|
+
'--animation-duration': animationDuration,
|
|
50
|
+
'--size': computedSize,
|
|
51
|
+
'--thickness': computedBorder,
|
|
52
|
+
}"
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<style scoped>
|
|
59
|
+
/* Bar Theme */
|
|
60
|
+
.lds-bar {
|
|
61
|
+
height: 4px;
|
|
62
|
+
width: 100%;
|
|
63
|
+
max-width: 130px;
|
|
64
|
+
--c: no-repeat linear-gradient(currentColor 0 0);
|
|
65
|
+
background: var(--c), var(--c), #ddd;
|
|
66
|
+
background-size: 60% 100%;
|
|
67
|
+
animation: bar-animation 3s infinite ease-in-out;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@keyframes bar-animation {
|
|
71
|
+
0% { background-position: -150% 0, -150% 0 }
|
|
72
|
+
66% { background-position: 250% 0, -150% 0 }
|
|
73
|
+
100% { background-position: 250% 0, 250% 0 }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.lds-ring,
|
|
77
|
+
.lds-ring div {
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
}
|
|
80
|
+
.lds-ring {
|
|
81
|
+
position: relative;
|
|
82
|
+
width: var(--size);
|
|
83
|
+
height: var(--size);
|
|
84
|
+
transform: translate(calc(var(--thickness) * -1), calc(var(--thickness) * -1));
|
|
85
|
+
}
|
|
86
|
+
.lds-ring div {
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
display: block;
|
|
89
|
+
position: absolute;
|
|
90
|
+
width: calc(var(--size) / 1.25);
|
|
91
|
+
height: calc(var(--size) / 1.25);
|
|
92
|
+
margin: var(--thickness);
|
|
93
|
+
border: var(--thickness) solid currentColor;
|
|
94
|
+
border-radius: 50%;
|
|
95
|
+
animation: lds-ring var(--animation-duration) cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
|
96
|
+
border-color: currentColor transparent transparent transparent;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.lds-ring div:nth-child(1) {
|
|
100
|
+
animation-delay: calc(var(--animation-duration) * -0.38);
|
|
101
|
+
}
|
|
102
|
+
.lds-ring div:nth-child(2) {
|
|
103
|
+
animation-delay: calc(var(--animation-duration) / -4);
|
|
104
|
+
}
|
|
105
|
+
.lds-ring div:nth-child(3) {
|
|
106
|
+
animation-delay: calc(var(--animation-duration) / -8);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@keyframes lds-ring {
|
|
110
|
+
0% {
|
|
111
|
+
transform: rotate(0deg);
|
|
112
|
+
}
|
|
113
|
+
100% {
|
|
114
|
+
transform: rotate(360deg);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.lds-ellipsis,
|
|
119
|
+
.lds-ellipsis div {
|
|
120
|
+
box-sizing: border-box;
|
|
121
|
+
}
|
|
122
|
+
.lds-ellipsis {
|
|
123
|
+
display: inline-block;
|
|
124
|
+
position: relative;
|
|
125
|
+
width: var(--size);
|
|
126
|
+
height: var(--size);
|
|
127
|
+
}
|
|
128
|
+
.lds-ellipsis div {
|
|
129
|
+
position: absolute;
|
|
130
|
+
top: calc(var(--size) - 40%);
|
|
131
|
+
width: calc(var(--size) / 5);
|
|
132
|
+
height:calc(var(--size) / 5);
|
|
133
|
+
border-radius: 50%;
|
|
134
|
+
background: currentColor;
|
|
135
|
+
animation-timing-function: cubic-bezier(0, 1, 1, 0);
|
|
136
|
+
}
|
|
137
|
+
.lds-ellipsis div:nth-child(1) {
|
|
138
|
+
left: calc(var(--size) / 10);
|
|
139
|
+
animation: lds-ellipsis1 0.6s infinite;
|
|
140
|
+
}
|
|
141
|
+
.lds-ellipsis div:nth-child(2) {
|
|
142
|
+
left: calc(var(--size) / 10);
|
|
143
|
+
animation: lds-ellipsis2 0.6s infinite;
|
|
144
|
+
}
|
|
145
|
+
.lds-ellipsis div:nth-child(3) {
|
|
146
|
+
left: calc(var(--size) / 2.5);
|
|
147
|
+
animation: lds-ellipsis2 0.6s infinite;
|
|
148
|
+
}
|
|
149
|
+
.lds-ellipsis div:nth-child(4) {
|
|
150
|
+
left: calc(var(--size) / 1.42);
|
|
151
|
+
animation: lds-ellipsis3 0.6s infinite;
|
|
152
|
+
}
|
|
153
|
+
@keyframes lds-ellipsis1 {
|
|
154
|
+
0% {
|
|
155
|
+
transform: scale(0);
|
|
156
|
+
}
|
|
157
|
+
100% {
|
|
158
|
+
transform: scale(1);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
@keyframes lds-ellipsis3 {
|
|
162
|
+
0% {
|
|
163
|
+
transform: scale(1);
|
|
164
|
+
}
|
|
165
|
+
100% {
|
|
166
|
+
transform: scale(0);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
@keyframes lds-ellipsis2 {
|
|
170
|
+
0% {
|
|
171
|
+
transform: translate(0, 0);
|
|
172
|
+
}
|
|
173
|
+
100% {
|
|
174
|
+
transform: translate(calc(var(--size) / 3.33), 0);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
</style>
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
bindAttrs,
|
|
12
12
|
classify,
|
|
13
13
|
} from '@bagelink/vue'
|
|
14
|
+
import TabsNav from '../layout/TabsNav.vue'
|
|
14
15
|
|
|
15
16
|
const props = withDefaults(
|
|
16
17
|
defineProps<{
|
|
@@ -38,6 +39,7 @@ const is = $computed(() => {
|
|
|
38
39
|
if (props.field.$el === 'richtext') return RichText
|
|
39
40
|
if (props.field.$el === 'file') return FileUpload
|
|
40
41
|
if (props.field.$el === 'date') return DateInput
|
|
42
|
+
if (props.field.$el === 'tabs') return TabsNav
|
|
41
43
|
return props.field.$el ?? 'div'
|
|
42
44
|
})
|
|
43
45
|
|