@dolanske/vui 0.3.0 → 0.3.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@dolanske/vui",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.2",
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
@@ -26,7 +26,7 @@ const tab = ref('components')
26
26
  <div v-if="tab === 'components'">
27
27
  <h1 class="mb-xl">
28
28
  Hii
29
- <span class="counter text-color-accent">12</span>
29
+ <span class="counter text-color-accent">129</span>
30
30
  </h1>
31
31
  <p>I am down</p>
32
32
 
@@ -35,17 +35,13 @@ const tab = ref('components')
35
35
  <Divider />
36
36
 
37
37
  <Tooltip>
38
- <span>Hello world</span>
38
+ <span cl>Hello world</span>
39
39
  <template #tooltip>
40
40
  <p>
41
41
  Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro, animi! Nobis maxime neque cumque, in a amet voluptatibus tenetur dicta eos delectus illo soluta aliquam voluptatum nulla? In, incidunt asperiores?
42
42
  </p>
43
43
  </template>
44
44
  </Tooltip>
45
-
46
- <Button size="l">
47
- Hii
48
- </Button>
49
45
  </div>
50
46
  <div v-else-if="tab === 'typography'" class="typeset" :style="{ maxWidth: '688px', margin: 'auto' }">
51
47
  <h1>The Joke Tax Chronicles</h1>
@@ -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
 
@@ -27,7 +27,6 @@
27
27
  &:hover {
28
28
  text-decoration: inherit;
29
29
  text-underline-offset: inherit;
30
-
31
30
  background-color: var(--color-button-gray);
32
31
  }
33
32
  }
@@ -67,6 +66,7 @@
67
66
 
68
67
  svg {
69
68
  transition: var(--transition);
69
+ color: var(--color-text-light);
70
70
  }
71
71
  }
72
72
 
@@ -27,6 +27,10 @@
27
27
  background-color: var(--color-bg-raised);
28
28
  font-weight: 500;
29
29
 
30
+ svg {
31
+ color: var(--color-text-light);
32
+ }
33
+
30
34
  strong {
31
35
  display: block;
32
36
  font-size: var(--font-size-s);
@@ -12,6 +12,8 @@ interface Props {
12
12
  // Provide URL to turn button into anchor
13
13
  // href?: string
14
14
  // target?: string
15
+
16
+ // State props
15
17
  loading?: boolean
16
18
  expand?: boolean
17
19
  square?: boolean
@@ -67,6 +69,7 @@ const padding = computed(() => {
67
69
  class="vui-button"
68
70
  :class="[{ loading, expand, disabled, plain, active, icon, square, dashed }, `vui-button-variant-${variant}`]"
69
71
  :disabled
72
+ role="button"
70
73
  :style="{
71
74
  '--button-height': height,
72
75
  '--button-padding': padding,
@@ -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
  })
@@ -71,10 +71,15 @@ const w = computed(() => expand ? `${anchorWidth.value}px` : 'initial')
71
71
 
72
72
  <template>
73
73
  <div
74
- ref="anchor" class="vui-dropdown-trigger-wrap" :style="{
74
+ ref="anchor"
75
+ class="vui-dropdown-trigger-wrap"
76
+ :style="{
75
77
  minWidth: mW,
76
78
  width: w,
77
79
  }"
80
+ role="button"
81
+ :aria-expanded="showMenu"
82
+ :aria-haspopup="true"
78
83
  >
79
84
  <slot name="trigger" :open :is-open="showMenu" :close :toggle />
80
85
  </div>
@@ -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,4 +4,5 @@
4
4
  min-width: 80px;
5
5
  background-color: var(--color-bg-raised);
6
6
  border-radius: var(--border-radius-m);
7
+ z-index: 1000;
7
8
  }
@@ -32,6 +32,7 @@
32
32
  .vui-button-slot svg {
33
33
  width: 14px;
34
34
  height: 14px;
35
+ color: var(--color-text-light);
35
36
  }
36
37
  }
37
38
 
@@ -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 {
@@ -14,7 +14,13 @@ const id = computed(() => props.id ?? props.label)
14
14
  </script>
15
15
 
16
16
  <template>
17
- <button class="vui-tab" :data-tab-id="id" :class="{ disabled: props.disabled }" role="tab">
17
+ <button
18
+ class="vui-tab"
19
+ :data-tab-id="id"
20
+ :class="{ disabled: props.disabled }"
21
+ role="tab"
22
+ :name="id"
23
+ >
18
24
  <Icon v-if="props.icon" :icon="props.icon" />
19
25
  {{ props.label }}
20
26
  </button>
@@ -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>
@@ -60,6 +60,7 @@
60
60
  svg {
61
61
  width: 20px;
62
62
  height: 20px;
63
+ color: var(--color-text-light);
63
64
  }
64
65
 
65
66
  &:hover,
@@ -57,6 +57,7 @@ const id = useId()
57
57
  <template>
58
58
  <div
59
59
  ref="popoutAnchor"
60
+ class="inline-block"
60
61
  :aria-describedby="id"
61
62
  @mouseenter="hoverAnchor = true"
62
63
  @mouseleave="hoverAnchor = false"
@@ -131,6 +131,11 @@ body {
131
131
  min-height: 100dvh;
132
132
  }
133
133
 
134
+ // Set base icon color
135
+ .iconify {
136
+ color: var(--color-text-light);
137
+ }
138
+
134
139
  @include meta.load-css('typography.scss');
135
140
  @include meta.load-css('layout.scss');
136
141
  @include meta.load-css('animation.scss');
@@ -18,6 +18,36 @@ $colors: 'light', 'lighter', 'lightest', 'red', 'green', 'yellow', 'blue';
18
18
 
19
19
  @each $color in $colors {
20
20
  .text-color-#{$color} {
21
- font-size: var(--color-text-#{$color});
21
+ color: var(--color-text-#{$color});
22
22
  }
23
23
  }
24
+
25
+ // Font weights
26
+
27
+ .text-light {
28
+ font-weight: 300;
29
+ }
30
+
31
+ .text-regular {
32
+ font-weight: 400;
33
+ }
34
+
35
+ .text-medium {
36
+ font-weight: 500;
37
+ }
38
+
39
+ .text-semibold {
40
+ font-weight: 600;
41
+ }
42
+
43
+ .text-bold {
44
+ font-weight: 700;
45
+ }
46
+
47
+ .text-extra-bold {
48
+ font-weight: 800;
49
+ }
50
+
51
+ .text-black {
52
+ font-weight: 900;
53
+ }
@@ -19,10 +19,25 @@ $containers: 'xs', 's', 'm', 'l', 'xl', 'xxl';
19
19
  }
20
20
  }
21
21
 
22
- // Sizes
22
+ // Layout
23
+ .flex {
24
+ display: flex;
25
+ }
23
26
 
24
- // Paddings & margins
27
+ .inline-flex {
28
+ display: inline-flex;
29
+ }
30
+
31
+ .block {
32
+ display: block;
33
+ }
34
+
35
+ .inline-block {
36
+ display: inline-block;
37
+ }
25
38
 
39
+ // Sizes
40
+ // Paddings & margins
26
41
  .mx-auto {
27
42
  margin-inline: auto;
28
43
  }
@@ -112,30 +127,10 @@ $sizes: 'xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl';
112
127
  }
113
128
 
114
129
  // Z-index
115
- .z-0 {
116
- z-index: 0;
117
- }
130
+ $zindexes: 0, 10, 20, 30, 40, 50, auto;
118
131
 
119
- .z-10 {
120
- z-index: 10;
121
- }
122
-
123
- .z-20 {
124
- z-index: 20;
125
- }
126
-
127
- .z-30 {
128
- z-index: 30;
129
- }
130
-
131
- .z-40 {
132
- z-index: 40;
133
- }
134
-
135
- .z-50 {
136
- z-index: 50;
137
- }
138
-
139
- .z-auto {
140
- z-index: auto;
132
+ @each $zindex in $zindexes {
133
+ .z-#{$zindex} {
134
+ z-index: $zindex;
135
+ }
141
136
  }
@@ -223,7 +223,6 @@ dl {
223
223
  article,
224
224
  .typeset {
225
225
  width: 100%;
226
- // overflow: hidden;
227
226
 
228
227
  ol,
229
228
  ul {
@@ -236,7 +235,7 @@ article,
236
235
  margin-bottom: var(--space-m);
237
236
  font-size: var(--font-size-m);
238
237
  position: relative;
239
- padding-left: 32px;
238
+ padding-left: 28px;
240
239
 
241
240
  & > ul {
242
241
  margin-top: 0;
@@ -245,7 +244,7 @@ article,
245
244
  &:before {
246
245
  content: '';
247
246
  position: absolute;
248
- top: 3px;
247
+ top: 5px;
249
248
  left: 12px;
250
249
  }
251
250
 
@@ -261,7 +260,7 @@ article,
261
260
  width: 6px;
262
261
  height: 6px;
263
262
  border-radius: 100%;
264
- background-color: var(--color-text-light);
263
+ background-color: var(--color-text-lighter);
265
264
  }
266
265
  }
267
266
  }
@@ -32,4 +32,5 @@ mark {
32
32
  color: var(--color-text);
33
33
  background-color: var(--color-button-gray-hover);
34
34
  font-weight: 400;
35
+ padding-inline: 4px;
35
36
  }