@dolanske/vui 0.3.1 → 0.3.3

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@dolanske/vui",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.3.3",
5
5
  "private": false,
6
6
  "description": "Brother in Christ there's a new UI library ",
7
7
  "author": "dolanske",
package/src/App.vue CHANGED
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import { ref } from 'vue'
3
3
  import Avatar from './components/Avatar/Avatar.vue'
4
- import Button from './components/Button/Button.vue'
5
4
  import Divider from './components/Divider/Divider.vue'
5
+ import Flex from './components/Flex/Flex.vue'
6
6
  import Tab from './components/Tabs/Tab.vue'
7
7
 
8
8
  import Tabs from './components/Tabs/Tabs.vue'
@@ -30,7 +30,12 @@ const tab = ref('components')
30
30
  </h1>
31
31
  <p>I am down</p>
32
32
 
33
- <Avatar :size="80" />
33
+ <Flex>
34
+ <Avatar size="s" />
35
+ <Avatar size="m" />
36
+ <Avatar size="l" />
37
+ <Avatar :size="128" />
38
+ </Flex>
34
39
 
35
40
  <Divider />
36
41
 
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { Icon } from '@iconify/vue'
3
3
  import { useResizeObserver } from '@vueuse/core'
4
- import { ref, useTemplateRef, watch, watchEffect } from 'vue'
4
+ import { onMounted, ref, useTemplateRef, watch, watchEffect } from 'vue'
5
5
  import './accordion.scss'
6
6
 
7
7
  export interface AccordionProps {
@@ -58,10 +58,12 @@ defineExpose({
58
58
  isOpen,
59
59
  })
60
60
 
61
- useResizeObserver(contentRef, ([entry]) => {
62
- if (isOpen.value && contentMaxHeight.value !== entry.contentRect.height) {
63
- contentMaxHeight.value = entry.contentRect.height || 0
64
- }
61
+ onMounted(() => {
62
+ useResizeObserver(contentRef, ([entry]) => {
63
+ if (isOpen.value && contentMaxHeight.value !== entry.contentRect.height) {
64
+ contentMaxHeight.value = entry.contentRect.height || 0
65
+ }
66
+ })
65
67
  })
66
68
  </script>
67
69
 
@@ -25,7 +25,7 @@ const showFallback = ref(false)
25
25
  <template>
26
26
  <div
27
27
  class="vui-avatar"
28
- :class="[`vui-avatar-size-${typeof size === 'number' ? 'm' : size}`]"
28
+ :class="[`vui-avatar-size-${typeof size === 'number' ? 'l' : size}`]"
29
29
  :style="{
30
30
  ...(typeof size === 'number' && {
31
31
  '--avatar-size': formatUnitValue(size),
@@ -13,7 +13,7 @@
13
13
  --avatar-size: 48px;
14
14
 
15
15
  strong {
16
- font-size: var(--font-size-m);
16
+ font-size: var(--font-size-l);
17
17
  }
18
18
  }
19
19
 
@@ -29,11 +29,13 @@
29
29
 
30
30
  svg {
31
31
  color: var(--color-text-light);
32
+ font-size: inherit;
32
33
  }
33
34
 
34
35
  strong {
35
36
  display: block;
36
- font-size: var(--font-size-s);
37
+ font-size: var(--font-size-ms);
38
+ line-height: 1;
37
39
  }
38
40
 
39
41
  img {
@@ -2,7 +2,7 @@
2
2
  import { autoUpdate, flip, offset, shift, useFloating } from '@floating-ui/vue'
3
3
  import { Icon } from '@iconify/vue'
4
4
  import { useClipboard } from '@vueuse/core'
5
- import { onBeforeMount, useSlots, useTemplateRef } from 'vue'
5
+ import { onMounted, useSlots, useTemplateRef } from 'vue'
6
6
  import Flex from '../Flex/Flex.vue'
7
7
  import './copy-clipboard.scss'
8
8
 
@@ -36,7 +36,7 @@ const {
36
36
  })
37
37
  const slots = useSlots()
38
38
 
39
- onBeforeMount(() => {
39
+ onMounted(() => {
40
40
  if (!isSupported.value) {
41
41
  console.error('Clipboard API is not supported. This component will not work')
42
42
  }
@@ -53,7 +53,7 @@ onClickOutside(dropdownRef, (event) => {
53
53
  })
54
54
 
55
55
  const anchorWidth = computed(() => {
56
- if (!expand)
56
+ if (!expand || !window)
57
57
  return 0
58
58
  return anchorRef.value?.getBoundingClientRect().width
59
59
  })
@@ -2,7 +2,7 @@
2
2
  import type { InputProps } from './Input.vue'
3
3
  import { Icon } from '@iconify/vue'
4
4
  import { useEventListener } from '@vueuse/core'
5
- import { ref, useTemplateRef } from 'vue'
5
+ import { onMounted, ref, useTemplateRef } from 'vue'
6
6
  import Flex from '../Flex/Flex.vue'
7
7
  import Input from './Input.vue'
8
8
 
@@ -25,11 +25,13 @@ function onSubmitHandler(e: any, isFromField?: boolean) {
25
25
 
26
26
  const dropzoneRef = useTemplateRef<HTMLDivElement>('dropzone')
27
27
 
28
- useEventListener(dropzoneRef, 'dragenter', onSubmitHandler, false)
29
- useEventListener(dropzoneRef, 'dragleave', onSubmitHandler, false)
30
- useEventListener(dropzoneRef, 'dragover', onSubmitHandler, false)
31
- useEventListener(dropzoneRef, 'drop', onSubmitHandler, false)
32
- useEventListener(dropzoneRef, 'input', e => onSubmitHandler(e, true), false)
28
+ onMounted(() => {
29
+ useEventListener(dropzoneRef, 'dragenter', onSubmitHandler, false)
30
+ useEventListener(dropzoneRef, 'dragleave', onSubmitHandler, false)
31
+ useEventListener(dropzoneRef, 'dragover', onSubmitHandler, false)
32
+ useEventListener(dropzoneRef, 'drop', onSubmitHandler, false)
33
+ useEventListener(dropzoneRef, 'input', e => onSubmitHandler(e, true), false)
34
+ })
33
35
  </script>
34
36
 
35
37
  <template>
@@ -4,7 +4,7 @@ import { computed, useSlots, useTemplateRef } from 'vue'
4
4
  const slots = useSlots()
5
5
  const contextRef = useTemplateRef<HTMLTableCellElement>('context')
6
6
  const computedStyle = computed(() => {
7
- if (!slots.context)
7
+ if (!slots.context || !window)
8
8
  return {}
9
9
  const width = contextRef.value?.getBoundingClientRect().width ?? 0
10
10
  return {
@@ -27,6 +27,9 @@ const underlineRef = useTemplateRef('underline')
27
27
  const tabsRef = useTemplateRef('tabs')
28
28
 
29
29
  function computeUnderlinePosition() {
30
+ if (!window)
31
+ return
32
+
30
33
  if (tabsRef.value && underlineRef.value) {
31
34
  const activeBounds = tabsRef.value.querySelector('.vui-tab.active')?.getBoundingClientRect()
32
35
  const parentBounds = tabsRef.value.getBoundingClientRect()
@@ -39,6 +42,8 @@ function computeUnderlinePosition() {
39
42
  }
40
43
 
41
44
  onMounted(() => {
45
+ useEventListener(window, 'resize', computeUnderlinePosition)
46
+
42
47
  watch(
43
48
  [active, () => expand],
44
49
  computeUnderlinePosition,
@@ -48,8 +53,6 @@ onMounted(() => {
48
53
  },
49
54
  )
50
55
  })
51
-
52
- useEventListener(window, 'resize', computeUnderlinePosition)
53
56
  </script>
54
57
 
55
58
  <template>
@@ -72,6 +75,8 @@ useEventListener(window, 'resize', computeUnderlinePosition)
72
75
  @click="active = vnode.props.id"
73
76
  />
74
77
 
75
- <div ref="underline" class="vui-tab-underline" />
78
+ <Transition name="fade" appear>
79
+ <div ref="underline" class="vui-tab-underline" />
80
+ </Transition>
76
81
  </div>
77
82
  </template>