@redseed/redseed-ui-vue3 8.13.0 → 8.13.2

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": "@redseed/redseed-ui-vue3",
3
- "version": "8.13.0",
3
+ "version": "8.13.2",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/redseedtraining/redseed-ui",
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { computed, ref, toRefs } from 'vue'
2
+ import { computed, ref, toRefs, useAttrs } from 'vue'
3
3
  import ButtonTertiary from '../Button/ButtonTertiary.vue'
4
4
  import Icon from '../Icon/Icon.vue'
5
5
  import { useResponsiveWidth } from '../../helpers'
@@ -46,6 +46,10 @@ const props = defineProps({
46
46
 
47
47
  const { showDivider, headerOnlyCard } = toRefs(props)
48
48
 
49
+ const attrs = useAttrs()
50
+
51
+ const isClickable = computed(() => !!attrs.onClick)
52
+
49
53
  const cardHeaderElement = ref(null)
50
54
 
51
55
  const { responsiveWidth } = useResponsiveWidth(cardHeaderElement, 640)
@@ -67,6 +71,7 @@ function handleMoreActionsClick() {
67
71
  {
68
72
  'rsui-card-header--divider': showDivider,
69
73
  'rsui-card-header--padded-bottom': shouldPadBottom,
74
+ 'rsui-card-header--clickable': isClickable,
70
75
  }
71
76
  ]"
72
77
  >
@@ -51,15 +51,32 @@ async function resetContentMaxHeight() {
51
51
  contentRef.value.style.removeProperty('min-height')
52
52
  }
53
53
 
54
+ // After open transition ends, remove inline min-height so h-auto handles dynamic content
55
+ function handleContentTransitionEnd(e) {
56
+ if (e.propertyName !== 'min-height' || !contentRef.value) return
57
+
58
+ if (isOpen.value) {
59
+ contentRef.value.style.removeProperty('min-height')
60
+ }
61
+ }
62
+
54
63
  watchEffect(() => {
55
64
  if (isOpen.value) {
56
65
  setContentMaxHeight()
57
66
  return
58
67
  }
59
68
 
69
+ // Removing inline min-height after class change triggers the closing transition
60
70
  resetContentMaxHeight()
61
71
  })
62
72
 
73
+ // Before closing: synchronously set min-height to current height so closing transition has a start value
74
+ watch(isOpen, (open, wasOpen) => {
75
+ if (!open && wasOpen && contentRef.value) {
76
+ contentRef.value.style.minHeight = contentRef.value.offsetHeight + 'px'
77
+ }
78
+ }, { flush: 'sync' })
79
+
63
80
  const canTeleportTrigger = ref(false)
64
81
  const canTeleportContent = ref(false)
65
82
 
@@ -133,6 +150,7 @@ onMounted(() => {
133
150
  'rsui-disclosure__content--open': isOpen,
134
151
  }
135
152
  ]"
153
+ @transitionend="handleContentTransitionEnd"
136
154
  >
137
155
  <slot name="content"></slot>
138
156
  </div>
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { ref, computed, useSlots } from 'vue'
2
+ import { ref, computed, useAttrs, useSlots } from 'vue'
3
3
  import ButtonTertiary from '../Button/ButtonTertiary.vue'
4
4
  import Icon from '../Icon/Icon.vue'
5
5
  import { useResponsiveWidth } from '../../helpers'
@@ -38,6 +38,10 @@ function handleMoreActionsClick() {
38
38
  emit('click:more-actions')
39
39
  }
40
40
 
41
+ const attrs = useAttrs()
42
+
43
+ const isClickable = computed(() => !!attrs.onClick)
44
+
41
45
  const slots = useSlots()
42
46
 
43
47
  const showToolbar = computed(() => {
@@ -51,7 +55,10 @@ const showToolbar = computed(() => {
51
55
  <div ref="sectionHeaderElement"
52
56
  :class="[
53
57
  'rsui-section-header',
54
- { 'rsui-section-header--divider': showDivider }
58
+ {
59
+ 'rsui-section-header--divider': showDivider,
60
+ 'rsui-section-header--clickable': isClickable,
61
+ }
55
62
  ]"
56
63
  >
57
64
  <div class="rsui-section-header__header">