@redseed/redseed-ui-vue3 2.23.6 → 2.24.0
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/index.js +6 -3
- package/package.json +2 -1
- package/src/components/Breadcrumbs/Breadcrumbs.vue +3 -3
- package/src/components/Empty/Empty.vue +1 -1
- package/src/components/HTML/ReadMore.vue +86 -0
- package/src/components/{BodyText → HTML}/index.js +2 -0
- /package/src/components/{BodyText → HTML}/BodyText.vue +0 -0
package/index.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
window._ = _
|
|
3
|
+
|
|
1
4
|
export * from './src/components/Avatar'
|
|
2
5
|
export * from './src/components/Badge'
|
|
3
|
-
export * from './src/components/BodyText'
|
|
4
6
|
export * from './src/components/Breadcrumbs'
|
|
5
7
|
export * from './src/components/Button'
|
|
6
8
|
export * from './src/components/ButtonGroup'
|
|
7
9
|
export * from './src/components/Card'
|
|
8
10
|
export * from './src/components/CardGroup'
|
|
11
|
+
export * from './src/components/ColumnLayout'
|
|
9
12
|
export * from './src/components/DropdownMenu'
|
|
10
13
|
export * from './src/components/Empty'
|
|
11
14
|
export * from './src/components/Form'
|
|
12
15
|
export * from './src/components/FormField'
|
|
16
|
+
export * from './src/components/HTML'
|
|
13
17
|
export * from './src/components/Image'
|
|
14
18
|
export * from './src/components/Link'
|
|
15
19
|
export * from './src/components/LinkedList'
|
|
@@ -26,5 +30,4 @@ export * from './src/components/SectionHeading'
|
|
|
26
30
|
export * from './src/components/Social'
|
|
27
31
|
export * from './src/components/Sorting'
|
|
28
32
|
export * from './src/components/Switcher'
|
|
29
|
-
export * from './src/components/Toggle'
|
|
30
|
-
export * from './src/components/ColumnLayout'
|
|
33
|
+
export * from './src/components/Toggle'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redseed/redseed-ui-vue3",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.0",
|
|
4
4
|
"description": "RedSeed UI Vue 3 components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"@heroicons/vue": "^2.1.5",
|
|
14
14
|
"@vueuse/components": "^10.11.0",
|
|
15
15
|
"@vueuse/core": "^10.11.0",
|
|
16
|
+
"lodash": "^4.17.21",
|
|
16
17
|
"lottie-web": "^5.12.2",
|
|
17
18
|
"vue": "^3.4.36"
|
|
18
19
|
}
|
|
@@ -38,11 +38,11 @@ function clickItem(item) {
|
|
|
38
38
|
@apply flex flex-wrap items-center gap-x-2 gap-y-2;
|
|
39
39
|
&__item {
|
|
40
40
|
@apply relative select-none pr-4 last:pr-0 last:after:hidden;
|
|
41
|
-
@apply
|
|
41
|
+
@apply text-sm text-rsui-light leading-6;
|
|
42
42
|
@apply after:absolute after:right-0.5 after:content-['\007C'];
|
|
43
|
-
@apply after:
|
|
43
|
+
@apply after:w-0.5 after:h-full after:text-rsui-light;
|
|
44
44
|
&--action {
|
|
45
|
-
@apply cursor-pointer;
|
|
45
|
+
@apply cursor-pointer hover:text-rsui-default transition-colors duration-200;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -3,7 +3,7 @@ import { ref, computed } from 'vue'
|
|
|
3
3
|
import ButtonPrimary from '../Button/ButtonPrimary.vue'
|
|
4
4
|
import ButtonSecondary from '../Button/ButtonSecondary.vue'
|
|
5
5
|
import ButtonTertiary from '../Button/ButtonTertiary.vue'
|
|
6
|
-
import BodyText from '../
|
|
6
|
+
import BodyText from '../HTML/BodyText.vue'
|
|
7
7
|
import { ExclamationCircleIcon } from '@heroicons/vue/24/outline'
|
|
8
8
|
import { useResponsiveWidth } from '../../helpers/ResponsiveWidth'
|
|
9
9
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, onMounted, watch } from 'vue'
|
|
3
|
+
import { useElementBounding } from '@vueuse/core'
|
|
4
|
+
import LinkPrimary from '../Link/LinkPrimary.vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
html: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const readMoreId = _.uniqueId('read_more_')
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Custom interpolate to allow for
|
|
17
|
+
* {{read_more}}, {{ read_more }}, {{ ReadMore }} interpolation
|
|
18
|
+
*/
|
|
19
|
+
const customInterpolate = /{{([\s\S]+?)}}/g
|
|
20
|
+
|
|
21
|
+
const compiled = _.template(props.html, { interpolate: customInterpolate })
|
|
22
|
+
const result = compiled({ read_more: `<a id="${readMoreId}"></a>` })
|
|
23
|
+
|
|
24
|
+
const showMore = ref(false)
|
|
25
|
+
|
|
26
|
+
watch(showMore, () => {
|
|
27
|
+
if (showMore.value) {
|
|
28
|
+
htmlContentElement.value.style.maxHeight = `${htmlContentElementMoreHeight.value}px`
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
htmlContentElement.value.style.maxHeight = `${htmlContentElementLessHeight.value}px`
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const htmlContentElement = ref(null)
|
|
36
|
+
const htmlContentElementBounding = useElementBounding(htmlContentElement)
|
|
37
|
+
|
|
38
|
+
const htmlContentElementLessHeight = ref(0)
|
|
39
|
+
const htmlContentElementMoreHeight = ref(0)
|
|
40
|
+
|
|
41
|
+
const readMoreElement = ref(null)
|
|
42
|
+
|
|
43
|
+
const hasReadMore = computed(() => !!readMoreElement.value)
|
|
44
|
+
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
if (!document.getElementById(readMoreId)) return
|
|
47
|
+
|
|
48
|
+
readMoreElement.value = document.getElementById(readMoreId)
|
|
49
|
+
const readMoreElementBounding = readMoreElement.value.getBoundingClientRect()
|
|
50
|
+
|
|
51
|
+
if (htmlContentElement.value && readMoreElement.value) {
|
|
52
|
+
htmlContentElementMoreHeight.value = htmlContentElementBounding.height.value
|
|
53
|
+
|
|
54
|
+
htmlContentElementLessHeight.value = readMoreElementBounding.top - htmlContentElementBounding.top.value
|
|
55
|
+
|
|
56
|
+
htmlContentElement.value.style.maxHeight = `${htmlContentElementLessHeight.value}px`
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
</script>
|
|
60
|
+
<template>
|
|
61
|
+
<div class="rsui-read-more-html">
|
|
62
|
+
<div ref="htmlContentElement"
|
|
63
|
+
class="rsui-read-more-html__content"
|
|
64
|
+
v-html="result"
|
|
65
|
+
></div>
|
|
66
|
+
<div v-if="hasReadMore" class="rsui-read-more-html__link">
|
|
67
|
+
<LinkPrimary md v-if="!showMore" @click="showMore = true">
|
|
68
|
+
<slot name="more-label">More details</slot>
|
|
69
|
+
</LinkPrimary>
|
|
70
|
+
<LinkPrimary md v-if="showMore" @click="showMore = false">
|
|
71
|
+
<slot name="less-label">Less details</slot>
|
|
72
|
+
</LinkPrimary>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</template>
|
|
76
|
+
<style lang="scss" scoped>
|
|
77
|
+
.rsui-read-more-html {
|
|
78
|
+
&__content {
|
|
79
|
+
@apply transition-all overflow-hidden;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&__link {
|
|
83
|
+
@apply mt-4;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
</style>
|
|
File without changes
|