@bagelink/vue 0.0.466 → 0.0.473
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/Accordion.vue.d.ts.map +1 -1
- package/dist/components/AccordionItem.vue.d.ts.map +1 -1
- package/dist/components/Alert.vue.d.ts +2 -2
- package/dist/components/Alert.vue.d.ts.map +1 -1
- package/dist/components/Avatar.vue.d.ts.map +1 -1
- package/dist/components/Badge.vue.d.ts +2 -2
- package/dist/components/Badge.vue.d.ts.map +1 -1
- package/dist/components/BglVideo.vue.d.ts +2 -2
- package/dist/components/BglVideo.vue.d.ts.map +1 -1
- package/dist/components/Btn.vue.d.ts +2 -0
- package/dist/components/Btn.vue.d.ts.map +1 -1
- package/dist/components/Card.vue.d.ts.map +1 -1
- package/dist/components/Carousel.vue.d.ts +4 -2
- package/dist/components/Carousel.vue.d.ts.map +1 -1
- package/dist/components/DataPreview.vue.d.ts.map +1 -1
- package/dist/components/Drop.vue.d.ts +34 -0
- package/dist/components/Drop.vue.d.ts.map +1 -0
- package/dist/components/FileUploader.vue.d.ts +60 -0
- package/dist/components/FileUploader.vue.d.ts.map +1 -0
- package/dist/components/Flag.vue.d.ts +2 -2
- package/dist/components/Flag.vue.d.ts.map +1 -1
- package/dist/components/ListItem.vue.d.ts.map +1 -1
- package/dist/components/ListView.vue.d.ts.map +1 -1
- package/dist/components/MapEmbed.vue.d.ts +2 -2
- package/dist/components/MapEmbed.vue.d.ts.map +1 -1
- package/dist/components/MaterialIcon.vue.d.ts.map +1 -1
- package/dist/components/Modal.vue.d.ts +2 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/ModalConfirm.vue.d.ts.map +1 -1
- package/dist/components/ModalForm.vue.d.ts.map +1 -1
- package/dist/components/NavBar.vue.d.ts.map +1 -1
- package/dist/components/PageTitle.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/Title.vue.d.ts.map +1 -1
- package/dist/components/dashboard/Lineart.vue.d.ts.map +1 -1
- package/dist/components/dashboard/index.d.ts.map +1 -1
- package/dist/components/form/BglField.vue.d.ts.map +1 -1
- package/dist/components/form/BglForm.vue.d.ts +4 -2
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/ItemRef.vue.d.ts +1 -0
- package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/Checkbox.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ColorPicker.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts +2 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/JSONInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RadioPillsInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectField.vue.d.ts +1 -4
- package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SignaturePad.vue.d.ts +56 -0
- package/dist/components/form/inputs/SignaturePad.vue.d.ts.map +1 -0
- package/dist/components/form/inputs/TableField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TelInput.vue.d.ts +2 -2
- package/dist/components/form/inputs/TelInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ToggleInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/index.d.ts +1 -0
- package/dist/components/form/inputs/index.d.ts.map +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/layout/BottomMenu.vue.d.ts.map +1 -1
- package/dist/components/layout/Layout.vue.d.ts +2 -2
- package/dist/components/layout/Layout.vue.d.ts.map +1 -1
- package/dist/components/layout/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/components/layout/TabbedLayout.vue.d.ts.map +1 -1
- package/dist/components/layout/Tabs.vue.d.ts.map +1 -1
- package/dist/components/layout/TabsBody.vue.d.ts.map +1 -1
- package/dist/components/layout/TabsNav.vue.d.ts.map +1 -1
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/index.cjs +17617 -20818
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +17617 -20818
- package/dist/plugins/bagel.d.ts +1 -1
- package/dist/plugins/bagel.d.ts.map +1 -1
- package/dist/plugins/modal.d.ts +14 -14
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +333 -309
- package/dist/types/BagelForm.d.ts +16 -16
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/dist/types/BtnOptions.d.ts +1 -1
- package/dist/types/BtnOptions.d.ts.map +1 -1
- package/dist/types/NavLink.d.ts +2 -2
- package/dist/types/NavLink.d.ts.map +1 -1
- package/dist/types/file.d.ts +2 -2
- package/dist/types/file.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/materialIcons.d.ts.map +1 -1
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/dist/utils/allCountries.d.ts +2 -2
- package/dist/utils/allCountries.d.ts.map +1 -1
- package/dist/utils/clickOutside.d.ts.map +1 -1
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +19 -17
- package/src/components/Accordion.vue +10 -10
- package/src/components/AccordionItem.vue +47 -47
- package/src/components/Alert.vue +21 -21
- package/src/components/Avatar.vue +15 -15
- package/src/components/Badge.vue +17 -16
- package/src/components/BglVideo.vue +43 -43
- package/src/components/Btn.vue +67 -65
- package/src/components/Card.vue +26 -26
- package/src/components/Carousel.vue +130 -134
- package/src/components/DataPreview.vue +30 -30
- package/src/components/Flag.vue +26 -26
- package/src/components/ListItem.vue +13 -13
- package/src/components/ListView.vue +2 -2
- package/src/components/MapEmbed.vue +33 -33
- package/src/components/MaterialIcon.vue +12 -12
- package/src/components/Modal.vue +73 -66
- package/src/components/ModalConfirm.vue +18 -18
- package/src/components/ModalForm.vue +79 -76
- package/src/components/NavBar.vue +33 -30
- package/src/components/PageTitle.vue +10 -8
- package/src/components/TableSchema.vue +126 -113
- package/src/components/Title.vue +8 -8
- package/src/components/dashboard/Lineart.vue +103 -96
- package/src/components/dashboard/index.ts +1 -1
- package/src/components/form/BglField.vue +61 -61
- package/src/components/form/BglFieldSet.vue +9 -8
- package/src/components/form/BglForm.vue +71 -70
- package/src/components/form/index.ts +4 -4
- package/src/components/form/inputs/CheckInput.vue +25 -23
- package/src/components/form/inputs/Checkbox.vue +10 -10
- package/src/components/form/inputs/ColorPicker.vue +26 -24
- package/src/components/form/inputs/DateInput.vue +39 -39
- package/src/components/form/inputs/DatePicker.vue +37 -36
- package/src/components/form/inputs/FileUpload.vue +165 -161
- package/src/components/form/inputs/FileUploadURL.vue +134 -132
- package/src/components/form/inputs/JSONInput.vue +29 -29
- package/src/components/form/inputs/RadioPillsInput.vue +49 -49
- package/src/components/form/inputs/RichText.vue +62 -63
- package/src/components/form/inputs/SelectInput.vue +173 -167
- package/src/components/form/inputs/SignaturePad.vue +150 -0
- package/src/components/form/inputs/TableField.vue +77 -76
- package/src/components/form/inputs/TelInput.vue +280 -285
- package/src/components/form/inputs/TextInput.vue +81 -76
- package/src/components/form/inputs/ToggleInput.vue +13 -13
- package/src/components/form/inputs/index.ts +17 -15
- package/src/components/formkit/FileUploader.vue +162 -158
- package/src/components/formkit/MiscFields.vue +20 -20
- package/src/components/formkit/Toggle.vue +13 -13
- package/src/components/index.ts +28 -28
- package/src/components/layout/BottomMenu.vue +25 -21
- package/src/components/layout/Layout.vue +29 -29
- package/src/components/layout/SidebarMenu.vue +31 -27
- package/src/components/layout/TabbedLayout.vue +47 -45
- package/src/components/layout/Tabs.vue +32 -32
- package/src/components/layout/TabsBody.vue +10 -10
- package/src/components/layout/TabsNav.vue +44 -44
- package/src/components/layout/index.ts +7 -7
- package/src/components/layout/tabsManager.ts +6 -6
- package/src/index.ts +13 -8
- package/src/plugins/bagel.ts +37 -37
- package/src/plugins/modal.ts +66 -67
- package/src/styles/layout.css +5 -3
- package/src/styles/mobilLayout.css +7 -0
- package/src/types/BagelForm.ts +27 -27
- package/src/types/BtnOptions.ts +13 -13
- package/src/types/NavLink.ts +8 -8
- package/src/types/file.ts +11 -11
- package/src/types/index.ts +16 -12
- package/src/types/materialIcons.ts +3249 -3249
- package/src/utils/BagelFormUtils.ts +23 -23
- package/src/utils/allCountries.ts +11 -12
- package/src/utils/clickOutside.ts +6 -6
- package/src/utils/index.ts +39 -41
- package/src/utils/lang.ts +13 -13
- package/src/utils/strings.ts +9 -9
- package/tsconfig.json +0 -1
- package/vite.config.ts +8 -8
- package/dist/components/Popover.vue.d.ts +0 -10
- package/dist/components/Popover.vue.d.ts.map +0 -1
- package/dist/types/materialIcon.d.ts +0 -2
- package/dist/types/materialIcon.d.ts.map +0 -1
package/src/components/Alert.vue
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="alert" :class="[type]" v-if="!isDismissed" :dismissable="dismissable" >
|
|
3
|
-
<Icon v-if="icon !== 'none'" class="alert_icon" :icon="icon || type" :size="2" :color="color[type]"/>
|
|
4
|
-
<p class="m-0">
|
|
5
|
-
{{ message }}
|
|
6
|
-
</p>
|
|
7
|
-
<Btn @click="isDismissed = true" flat thin class="alert_close" icon="close"/>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
1
|
<script setup lang="ts">
|
|
12
|
-
import { Icon } from '@bagelink/vue'
|
|
13
|
-
import type { MaterialIcons } from '@bagelink/vue'
|
|
14
|
-
import Btn from './Btn.vue'
|
|
2
|
+
import { Icon } from '@bagelink/vue'
|
|
3
|
+
import type { MaterialIcons } from '@bagelink/vue'
|
|
4
|
+
import Btn from './Btn.vue'
|
|
15
5
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
interface Props {
|
|
7
|
+
message: string
|
|
8
|
+
dismissable?: boolean
|
|
9
|
+
type?: 'info' | 'warning' | 'error'
|
|
10
|
+
icon?: MaterialIcons | 'none'
|
|
21
11
|
}
|
|
22
12
|
|
|
23
13
|
withDefaults(
|
|
@@ -25,17 +15,27 @@ withDefaults(
|
|
|
25
15
|
{
|
|
26
16
|
type: 'info',
|
|
27
17
|
},
|
|
28
|
-
)
|
|
18
|
+
)
|
|
29
19
|
|
|
30
|
-
const isDismissed = $ref(false)
|
|
20
|
+
const isDismissed = $ref(false)
|
|
31
21
|
|
|
32
22
|
const color = {
|
|
33
23
|
info: 'var(--bgl-primary)',
|
|
34
24
|
warning: 'var(--bgl-yellow)',
|
|
35
25
|
error: 'var(--bgl-red)',
|
|
36
|
-
}
|
|
26
|
+
}
|
|
37
27
|
</script>
|
|
38
28
|
|
|
29
|
+
<template>
|
|
30
|
+
<div v-if="!isDismissed" class="alert" :class="[type]" :dismissable="dismissable">
|
|
31
|
+
<Icon v-if="icon !== 'none'" class="alert_icon" :icon="icon || type" :size="2" :color="color[type]" />
|
|
32
|
+
<p class="m-0">
|
|
33
|
+
{{ message }}
|
|
34
|
+
</p>
|
|
35
|
+
<Btn flat thin class="alert_close" icon="close" @click="isDismissed = true" />
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
39
|
<style scoped>
|
|
40
40
|
.alert {
|
|
41
41
|
padding: var(--btn-padding);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="avatar flex justify-content-center" :style="{ width: `${size}px`, height: `${size}px` }">
|
|
3
|
-
<img v-if="src" :src="src" :alt="name">
|
|
4
|
-
<p v-else :style="{ 'line-height': `${size}px`, 'font-size': `calc(1.5rem * ${size} / 50)` }">
|
|
5
|
-
{{ fallback || initials(name || '') }}
|
|
6
|
-
</p>
|
|
7
|
-
</div>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
1
|
<script setup lang="ts">
|
|
11
|
-
import { initials } from '@bagelink/vue'
|
|
2
|
+
import { initials } from '@bagelink/vue'
|
|
12
3
|
|
|
13
4
|
withDefaults(defineProps<{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}>(), { size: 50 })
|
|
5
|
+
fallback?: string
|
|
6
|
+
src?: string
|
|
7
|
+
name?: string
|
|
8
|
+
size?: number
|
|
9
|
+
}>(), { size: 50 })
|
|
19
10
|
</script>
|
|
20
11
|
|
|
12
|
+
<template>
|
|
13
|
+
<div class="avatar flex justify-content-center" :style="{ width: `${size}px`, height: `${size}px` }">
|
|
14
|
+
<img v-if="src" :src="src" :alt="name">
|
|
15
|
+
<p v-else :style="{ 'line-height': `${size}px`, 'font-size': `calc(1.5rem * ${size} / 50)` }">
|
|
16
|
+
{{ fallback || initials(name || '') }}
|
|
17
|
+
</p>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
21
|
<style scoped>
|
|
22
22
|
.avatar {
|
|
23
23
|
border-radius: 100%;
|
package/src/components/Badge.vue
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Icon } from '@bagelink/vue'
|
|
3
|
+
import type { MaterialIcons } from '@bagelink/vue'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
'color'?: 'green' | 'red' | 'blue' | 'light' | 'gray'
|
|
7
|
+
'size'?: string
|
|
8
|
+
'text': string
|
|
9
|
+
'icon'?: MaterialIcons
|
|
10
|
+
'icon.end'?: MaterialIcons
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = defineProps<Props>()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
1
16
|
<template>
|
|
2
17
|
<div class="pill" :class="[color]">
|
|
3
18
|
<Icon v-if="icon" class="inline" :icon="icon" />
|
|
4
19
|
{{ text }}
|
|
5
|
-
<Icon
|
|
20
|
+
<Icon v-if="props['icon.end']" class="inline" :icon="props['icon.end']" />
|
|
6
21
|
</div>
|
|
7
22
|
</template>
|
|
8
23
|
|
|
9
|
-
<script setup lang="ts">
|
|
10
|
-
import { Icon } from '@bagelink/vue';
|
|
11
|
-
import type { MaterialIcons } from '@bagelink/vue';
|
|
12
|
-
|
|
13
|
-
type Props = {
|
|
14
|
-
'color'?: 'green' | 'red' | 'blue' | 'light' | 'gray';
|
|
15
|
-
'size'?: string;
|
|
16
|
-
'text': string;
|
|
17
|
-
'icon'?: MaterialIcons;
|
|
18
|
-
'icon.end'?: MaterialIcons;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const props = defineProps<Props>();
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
24
|
<style scoped>
|
|
25
25
|
.inline {
|
|
26
26
|
display: inline;
|
|
27
27
|
}
|
|
28
28
|
</style>
|
|
29
|
+
|
|
29
30
|
<style>
|
|
30
31
|
.pill {
|
|
31
32
|
border-radius: 10px;
|
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
src?: string
|
|
4
|
+
autoplay?: boolean
|
|
5
|
+
mute?: boolean
|
|
6
|
+
aspectRatio?: string
|
|
7
|
+
controls?: boolean
|
|
8
|
+
loop?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = defineProps<Props>()
|
|
12
|
+
|
|
13
|
+
const aspectRatio = $computed(
|
|
14
|
+
() => props.aspectRatio?.replace(':', '/') || '16/9',
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
const embedType = $computed<'YouTube' | 'Vimeo' | null>(() => {
|
|
18
|
+
const youtubeRegex = /youtube\.com|youtu\.be/
|
|
19
|
+
if (youtubeRegex.test(props.src || '')) return 'YouTube'
|
|
20
|
+
const vimeoRegex = /vimeo\.com/
|
|
21
|
+
if (vimeoRegex.test(props.src || '')) return 'Vimeo'
|
|
22
|
+
return null
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const videoUrl = $computed(() => {
|
|
26
|
+
if (embedType) {
|
|
27
|
+
if (embedType === 'YouTube') {
|
|
28
|
+
const videoId = props.src?.split(/v=|youtu\.be\//)[1]?.split('&')?.[0]
|
|
29
|
+
return `https://www.youtube.com/embed/${videoId}`
|
|
30
|
+
}
|
|
31
|
+
if (embedType === 'Vimeo') {
|
|
32
|
+
const vimeoRegex
|
|
33
|
+
= /vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/
|
|
34
|
+
const videoId = props.src?.match(vimeoRegex)?.[3]
|
|
35
|
+
return `https://player.vimeo.com/video/${videoId}`
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return props.src
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
console.log('Video URL:', videoUrl)
|
|
42
|
+
</script>
|
|
43
|
+
|
|
1
44
|
<template>
|
|
2
45
|
<div class="bgl_vid" :class="{ vid_empty: !src }">
|
|
3
46
|
<iframe
|
|
@@ -21,49 +64,6 @@
|
|
|
21
64
|
</div>
|
|
22
65
|
</template>
|
|
23
66
|
|
|
24
|
-
<script setup lang="ts">
|
|
25
|
-
type Props = {
|
|
26
|
-
src?: string;
|
|
27
|
-
autoplay?: boolean;
|
|
28
|
-
mute?: boolean;
|
|
29
|
-
aspectRatio?: string;
|
|
30
|
-
controls?: boolean;
|
|
31
|
-
loop?: boolean;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const props = defineProps<Props>();
|
|
35
|
-
|
|
36
|
-
const aspectRatio = $computed(
|
|
37
|
-
() => props.aspectRatio?.replace(':', '/') || '16/9',
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const embedType = $computed<'YouTube' | 'Vimeo' | null>(() => {
|
|
41
|
-
const youtubeRegex = /youtube\.com|youtu\.be/;
|
|
42
|
-
if (youtubeRegex.test(props.src || '')) return 'YouTube';
|
|
43
|
-
const vimeoRegex = /vimeo\.com/;
|
|
44
|
-
if (vimeoRegex.test(props.src || '')) return 'Vimeo';
|
|
45
|
-
return null;
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const videoUrl = $computed(() => {
|
|
49
|
-
if (embedType) {
|
|
50
|
-
if (embedType === 'YouTube') {
|
|
51
|
-
const videoId = props.src?.split(/v=|youtu\.be\//)?.[1]?.split('&')?.[0];
|
|
52
|
-
return `https://www.youtube.com/embed/${videoId}`;
|
|
53
|
-
}
|
|
54
|
-
if (embedType === 'Vimeo') {
|
|
55
|
-
const vimeoRegex =
|
|
56
|
-
/vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/;
|
|
57
|
-
const videoId = props.src?.match(vimeoRegex)?.[3];
|
|
58
|
-
return `https://player.vimeo.com/video/${videoId}`;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return props.src;
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
console.log('Video URL:', videoUrl);
|
|
65
|
-
</script>
|
|
66
|
-
|
|
67
67
|
<style scoped>
|
|
68
68
|
.bgl_vid iframe,
|
|
69
69
|
.bgl_vid video {
|
package/src/components/Btn.vue
CHANGED
|
@@ -1,53 +1,29 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component
|
|
3
|
-
:is="to ? 'router-link' : is" :to="to" @click.stop="onClick" :type="type" :role="role" :disabled="disabled"
|
|
4
|
-
:class="{
|
|
5
|
-
'bgl_btn-icon': icon && !slots['default'] && !value,
|
|
6
|
-
bgl_btn: !icon || slots['default'] || value,
|
|
7
|
-
thin,
|
|
8
|
-
round,
|
|
9
|
-
'bgl_flatBtn': flat,
|
|
10
|
-
'bgl_btn-border': border
|
|
11
|
-
}"
|
|
12
|
-
>
|
|
13
|
-
<div class="loading" v-if="loading" />
|
|
14
|
-
<div v-else class="bgl_btn-flex">
|
|
15
|
-
<MaterialIcon v-if="icon" :icon="icon" />
|
|
16
|
-
<slot />
|
|
17
|
-
<template v-if="!slots['default'] && value">
|
|
18
|
-
{{ value }}
|
|
19
|
-
</template>
|
|
20
|
-
<MaterialIcon v-if="props['icon.end']" :icon="props['icon.end']" />
|
|
21
|
-
</div>
|
|
22
|
-
</component>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
1
|
<script setup lang="ts">
|
|
26
|
-
import { useSlots } from 'vue'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
import type { MaterialIcons, ThemeType } from '@bagelink/vue';
|
|
30
|
-
import { MaterialIcon } from '@bagelink/vue';
|
|
2
|
+
import { useSlots } from 'vue'
|
|
3
|
+
import type { MaterialIcons, ThemeType } from '@bagelink/vue'
|
|
4
|
+
import { MaterialIcon } from '@bagelink/vue'
|
|
31
5
|
|
|
32
6
|
const props = withDefaults(
|
|
33
7
|
defineProps<{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
8
|
+
'disabled'?: boolean
|
|
9
|
+
'icon'?: MaterialIcons
|
|
10
|
+
// eslint-disable-next-line vue/prop-name-casing TODO: remove/deprecate
|
|
11
|
+
'icon.end'?: MaterialIcons
|
|
12
|
+
'icon-end'?: MaterialIcons
|
|
13
|
+
'color'?: ThemeType
|
|
14
|
+
'theme'?: ThemeType
|
|
15
|
+
'flat'?: boolean
|
|
16
|
+
'border'?: boolean
|
|
17
|
+
'thin'?: boolean
|
|
18
|
+
'type'?: 'button' | 'submit' | 'reset'
|
|
19
|
+
'loading'?: boolean
|
|
20
|
+
'role'?: string
|
|
21
|
+
'value'?: string
|
|
22
|
+
'to'?: string
|
|
23
|
+
'round'?: boolean
|
|
24
|
+
'is'?: string
|
|
25
|
+
'onClick'?: (e: MouseEvent) => void
|
|
26
|
+
}>(),
|
|
51
27
|
{
|
|
52
28
|
onClick: () => '',
|
|
53
29
|
loading: false,
|
|
@@ -58,21 +34,23 @@ const props = withDefaults(
|
|
|
58
34
|
is: 'button',
|
|
59
35
|
border: false,
|
|
60
36
|
},
|
|
61
|
-
)
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
const slots = useSlots()
|
|
62
40
|
|
|
63
41
|
const computedTheme = $computed(
|
|
64
42
|
() => {
|
|
65
|
-
if (props.disabled) return 'gray-light'
|
|
66
|
-
return (props
|
|
43
|
+
if (props.disabled) return 'gray-light'
|
|
44
|
+
return (props.color || props.theme)
|
|
67
45
|
},
|
|
68
|
-
)
|
|
46
|
+
)
|
|
69
47
|
|
|
70
48
|
const computedDefaultColors = $computed(
|
|
71
49
|
() => ({
|
|
72
50
|
backgroundColor: 'var(--bgl-primary)',
|
|
73
51
|
color: props.flat ? 'var(--bgl-black)' : 'var(--bgl-white)',
|
|
74
52
|
}),
|
|
75
|
-
)
|
|
53
|
+
)
|
|
76
54
|
|
|
77
55
|
function getThemeColors(theme: Partial<typeof computedDefaultColors>): typeof computedDefaultColors {
|
|
78
56
|
return ({
|
|
@@ -81,30 +59,54 @@ function getThemeColors(theme: Partial<typeof computedDefaultColors>): typeof co
|
|
|
81
59
|
color: props.flat
|
|
82
60
|
? theme.backgroundColor as string
|
|
83
61
|
: theme.color as string,
|
|
84
|
-
})
|
|
62
|
+
})
|
|
85
63
|
}
|
|
86
64
|
|
|
87
65
|
const themes: { [key in ThemeType]: typeof computedDefaultColors } = {
|
|
88
|
-
red: getThemeColors({ backgroundColor: 'var(--bgl-red)' }),
|
|
89
|
-
white: getThemeColors({ backgroundColor: 'var(--bgl-white)' }),
|
|
90
|
-
black: getThemeColors({ backgroundColor: 'var(--bgl-black)' }),
|
|
91
|
-
green: getThemeColors({ backgroundColor: 'var(--bgl-green)', color: 'var(--bgl-white)' }),
|
|
92
|
-
primary: getThemeColors({ backgroundColor: 'var(--bgl-primary)', color: 'var(--bgl-white)' }),
|
|
93
|
-
gray: getThemeColors({ backgroundColor: 'var(--bgl-gray-light)', color: 'var(--bgl-black)' }),
|
|
94
|
-
light: getThemeColors({ backgroundColor: 'var(--bgl-primary-light)', color: 'var(--bgl-primary)' }),
|
|
66
|
+
'red': getThemeColors({ backgroundColor: 'var(--bgl-red)' }),
|
|
67
|
+
'white': getThemeColors({ backgroundColor: 'var(--bgl-white)' }),
|
|
68
|
+
'black': getThemeColors({ backgroundColor: 'var(--bgl-black)' }),
|
|
69
|
+
'green': getThemeColors({ backgroundColor: 'var(--bgl-green)', color: 'var(--bgl-white)' }),
|
|
70
|
+
'primary': getThemeColors({ backgroundColor: 'var(--bgl-primary)', color: 'var(--bgl-white)' }),
|
|
71
|
+
'gray': getThemeColors({ backgroundColor: 'var(--bgl-gray-light)', color: 'var(--bgl-black)' }),
|
|
72
|
+
'light': getThemeColors({ backgroundColor: 'var(--bgl-primary-light)', color: 'var(--bgl-primary)' }),
|
|
95
73
|
'gray-light': getThemeColors({ backgroundColor: 'var(--bgl-gray-light)', color: 'var(--bgl-gray)' }),
|
|
96
|
-
blue: getThemeColors({}),
|
|
97
|
-
}
|
|
74
|
+
'blue': getThemeColors({}),
|
|
75
|
+
}
|
|
98
76
|
|
|
99
77
|
const cumputedTextColor = $computed(
|
|
100
|
-
() => (themes
|
|
101
|
-
)
|
|
78
|
+
() => (themes[computedTheme as Partial<ThemeType>].color || computedDefaultColors.color),
|
|
79
|
+
)
|
|
102
80
|
|
|
103
81
|
const computedBackgroundColor = $computed(
|
|
104
|
-
() => (themes
|
|
105
|
-
)
|
|
82
|
+
() => (themes[computedTheme as Partial<ThemeType>].backgroundColor || computedDefaultColors.backgroundColor),
|
|
83
|
+
)
|
|
106
84
|
</script>
|
|
107
85
|
|
|
86
|
+
<template>
|
|
87
|
+
<component
|
|
88
|
+
:is="to ? 'router-link' : is" :to="to" :type="type" :role="role" :disabled="disabled" :class="{
|
|
89
|
+
'bgl_btn-icon': icon && !slots.default && !value,
|
|
90
|
+
'bgl_btn': !icon || slots.default || value,
|
|
91
|
+
thin,
|
|
92
|
+
round,
|
|
93
|
+
'bgl_flatBtn': flat,
|
|
94
|
+
'bgl_btn-border': border,
|
|
95
|
+
}"
|
|
96
|
+
@click.stop="onClick"
|
|
97
|
+
>
|
|
98
|
+
<div v-if="loading" class="loading" />
|
|
99
|
+
<div v-else class="bgl_btn-flex">
|
|
100
|
+
<MaterialIcon v-if="icon" :icon="icon" />
|
|
101
|
+
<slot />
|
|
102
|
+
<template v-if="!slots.default && value">
|
|
103
|
+
{{ value }}
|
|
104
|
+
</template>
|
|
105
|
+
<MaterialIcon v-if="props['icon.end']" :icon="props['icon.end']" />
|
|
106
|
+
</div>
|
|
107
|
+
</component>
|
|
108
|
+
</template>
|
|
109
|
+
|
|
108
110
|
<style scoped>
|
|
109
111
|
a {
|
|
110
112
|
text-decoration: none;
|
package/src/components/Card.vue
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
label?: string
|
|
4
|
+
thin?: boolean
|
|
5
|
+
outline?: boolean
|
|
6
|
+
h100?: boolean
|
|
7
|
+
to?: string
|
|
8
|
+
overflowX?: boolean
|
|
9
|
+
overflowY?: boolean
|
|
10
|
+
bg?:
|
|
11
|
+
| 'gray'
|
|
12
|
+
| 'light'
|
|
13
|
+
| 'dark'
|
|
14
|
+
| 'primary'
|
|
15
|
+
| 'secondary'
|
|
16
|
+
| 'success'
|
|
17
|
+
| 'danger'
|
|
18
|
+
| 'warning'
|
|
19
|
+
| 'info'
|
|
20
|
+
| 'white'
|
|
21
|
+
| 'transparent'
|
|
22
|
+
}>()
|
|
23
|
+
|
|
24
|
+
const is = $computed(() => (props.to ? 'router-link' : 'div'))
|
|
25
|
+
</script>
|
|
26
|
+
|
|
1
27
|
<template>
|
|
2
28
|
<component
|
|
3
29
|
:is="is"
|
|
@@ -19,32 +45,6 @@
|
|
|
19
45
|
</component>
|
|
20
46
|
</template>
|
|
21
47
|
|
|
22
|
-
<script setup lang="ts">
|
|
23
|
-
const props = defineProps<{
|
|
24
|
-
label?: string;
|
|
25
|
-
thin?: boolean;
|
|
26
|
-
outline?: boolean;
|
|
27
|
-
h100?: boolean;
|
|
28
|
-
to?: string;
|
|
29
|
-
overflowX?: boolean;
|
|
30
|
-
overflowY?: boolean;
|
|
31
|
-
bg?:
|
|
32
|
-
| 'gray'
|
|
33
|
-
| 'light'
|
|
34
|
-
| 'dark'
|
|
35
|
-
| 'primary'
|
|
36
|
-
| 'secondary'
|
|
37
|
-
| 'success'
|
|
38
|
-
| 'danger'
|
|
39
|
-
| 'warning'
|
|
40
|
-
| 'info'
|
|
41
|
-
| 'white'
|
|
42
|
-
| 'transparent';
|
|
43
|
-
}>();
|
|
44
|
-
|
|
45
|
-
const is = $computed(() => (props.to ? 'router-link' : 'div'));
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
48
|
<style>
|
|
49
49
|
.card_label {
|
|
50
50
|
font-size: 1rem;
|