@dolanske/vui 0.1.5 → 0.3.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.
Files changed (67) hide show
  1. package/README.md +29 -98
  2. package/dist/components/Accordion/Accordion.vue.d.ts +1 -0
  3. package/dist/components/Avatar/Avatar.vue.d.ts +1 -1
  4. package/dist/components/Calendar/Calendar.vue.d.ts +1 -1
  5. package/dist/components/Divider/Divider.vue.d.ts +2 -4
  6. package/dist/components/Dropdown/Dropdown.vue.d.ts +105 -0
  7. package/dist/components/Flex/Flex.vue.d.ts +2 -2
  8. package/dist/components/Grid/Grid.vue.d.ts +2 -2
  9. package/dist/components/Input/Dropzone.vue.d.ts +1 -0
  10. package/dist/components/Input/Input.vue.d.ts +1 -0
  11. package/dist/components/Popout/Popout.vue.d.ts +3 -3
  12. package/dist/components/Radio/Radio.vue.d.ts +1 -1
  13. package/dist/components/Radio/RadioGroup.vue.d.ts +3 -12
  14. package/dist/components/Tooltip/Tooltip.vue.d.ts +1 -1
  15. package/dist/index.d.ts +3 -1
  16. package/dist/shared/helpers.d.ts +6 -0
  17. package/dist/shared/types.d.ts +14 -0
  18. package/dist/style.css +1 -1
  19. package/dist/vui.js +4617 -4470
  20. package/package.json +6 -2
  21. package/src/App.vue +24 -16
  22. package/src/components/Accordion/Accordion.vue +8 -4
  23. package/src/components/Accordion/accordion.scss +38 -2
  24. package/src/components/Alert/alert.scss +1 -1
  25. package/src/components/Avatar/Avatar.vue +10 -3
  26. package/src/components/Avatar/avatar.scss +5 -5
  27. package/src/components/Button/Button.vue +6 -9
  28. package/src/components/Calendar/Calendar.vue +10 -8
  29. package/src/components/Card/Card.vue +2 -2
  30. package/src/components/Checkbox/Checkbox.vue +4 -1
  31. package/src/components/Checkbox/checkbox.scss +12 -6
  32. package/src/components/Divider/Divider.vue +18 -8
  33. package/src/components/Drawer/Drawer.vue +14 -10
  34. package/src/components/Drawer/drawer.scss +1 -14
  35. package/src/components/Dropdown/Dropdown.vue +14 -9
  36. package/src/components/Dropdown/dropdown.scss +4 -0
  37. package/src/components/Flex/Flex.vue +14 -17
  38. package/src/components/Grid/Grid.vue +9 -14
  39. package/src/components/Input/Input.vue +4 -1
  40. package/src/components/Input/Textarea.vue +7 -4
  41. package/src/components/Input/input.scss +13 -4
  42. package/src/components/OTP/otp.scss +1 -2
  43. package/src/components/Popout/Popout.vue +3 -3
  44. package/src/components/Progress/Progress.vue +13 -7
  45. package/src/components/Progress/progress.scss +1 -1
  46. package/src/components/Radio/Radio.vue +1 -1
  47. package/src/components/Radio/RadioGroup.vue +10 -5
  48. package/src/components/Sheet/Sheet.vue +16 -15
  49. package/src/components/Sheet/sheet.scss +4 -0
  50. package/src/components/Skeleton/Skeleton.vue +13 -16
  51. package/src/components/Spinner/Spinner.vue +9 -11
  52. package/src/components/Table/table.scss +1 -1
  53. package/src/components/Table/table.ts +2 -1
  54. package/src/components/Tabs/Tab.vue +1 -1
  55. package/src/components/Tabs/Tabs.vue +1 -0
  56. package/src/components/Toast/toast.ts +0 -24
  57. package/src/components/Tooltip/Tooltip.vue +6 -3
  58. package/src/index.ts +4 -0
  59. package/src/shared/helpers.ts +15 -0
  60. package/src/shared/types.ts +18 -0
  61. package/src/style/core.scss +28 -15
  62. package/src/style/fonts.scss +23 -0
  63. package/src/style/layout.scss +133 -1
  64. package/src/style/typography.scss +9 -9
  65. package/src/style/utils.scss +13 -0
  66. package/dist/shared/composables.d.ts +0 -3
  67. package/src/shared/composables.ts +0 -18
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dolanske/vui",
3
3
  "type": "module",
4
- "version": "0.1.5",
4
+ "version": "0.3.0",
5
5
  "private": false,
6
6
  "description": "Brother in Christ there's a new UI library ",
7
7
  "author": "dolanske",
@@ -11,7 +11,11 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/dolanske/vui.git"
13
13
  },
14
- "keywords": ["vue", "vue3", "component"],
14
+ "keywords": [
15
+ "vue",
16
+ "vue3",
17
+ "component"
18
+ ],
15
19
  "exports": {
16
20
  ".": {
17
21
  "types": "./dist/index.d.ts",
package/src/App.vue CHANGED
@@ -1,20 +1,19 @@
1
1
  <script setup lang="ts">
2
2
  import { ref } from 'vue'
3
- import Accordion from './components/Accordion/Accordion.vue'
3
+ import Avatar from './components/Avatar/Avatar.vue'
4
4
  import Button from './components/Button/Button.vue'
5
-
5
+ import Divider from './components/Divider/Divider.vue'
6
6
  import Tab from './components/Tabs/Tab.vue'
7
7
 
8
8
  import Tabs from './components/Tabs/Tabs.vue'
9
+ import Tooltip from './components/Tooltip/Tooltip.vue'
9
10
 
10
11
  const tab = ref('components')
11
-
12
- const count = ref(10)
13
12
  </script>
14
13
 
15
14
  <template>
16
15
  <main vaul-drawer-wrapper>
17
- <Tabs v-model="tab" expand variant="filled">
16
+ <Tabs v-model="tab" expand>
18
17
  <Tab id="home" label="Home" icon="ph:house" />
19
18
  <Tab id="components" label="Components" />
20
19
  <Tab id="typography" label="Typography" />
@@ -23,21 +22,30 @@ const count = ref(10)
23
22
  <div v-if="tab === 'home'">
24
23
  home
25
24
  </div>
25
+
26
26
  <div v-if="tab === 'components'">
27
- <Button @click="count += 10">
28
- Increase!!!
29
- </Button>
27
+ <h1 class="mb-xl">
28
+ Hii
29
+ <span class="counter text-color-accent">12</span>
30
+ </h1>
31
+ <p>I am down</p>
30
32
 
31
- <Accordion>
32
- <template #header>
33
- Hiiii
33
+ <Avatar :size="80" />
34
+
35
+ <Divider />
36
+
37
+ <Tooltip>
38
+ <span>Hello world</span>
39
+ <template #tooltip>
40
+ <p>
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
+ </p>
34
43
  </template>
35
- <p v-for="item in count" :key="item">
36
- I am a bro
37
- </p>
38
- </Accordion>
44
+ </Tooltip>
39
45
 
40
- <br>
46
+ <Button size="l">
47
+ Hii
48
+ </Button>
41
49
  </div>
42
50
  <div v-else-if="tab === 'typography'" class="typeset" :style="{ maxWidth: '688px', margin: 'auto' }">
43
51
  <h1>The Joke Tax Chronicles</h1>
@@ -7,6 +7,7 @@ import './accordion.scss'
7
7
  export interface AccordionProps {
8
8
  open?: boolean
9
9
  label?: string
10
+ card?: boolean
10
11
  }
11
12
 
12
13
  const props = defineProps<AccordionProps>()
@@ -17,7 +18,6 @@ const emits = defineEmits<{
17
18
 
18
19
  const isOpen = ref(false)
19
20
  const contentRef = useTemplateRef('content')
20
- // const contentChild = useTemplateRef('content-child')
21
21
  const contentMaxHeight = ref(0)
22
22
 
23
23
  watchEffect(() => {
@@ -66,7 +66,7 @@ useResizeObserver(contentRef, ([entry]) => {
66
66
  </script>
67
67
 
68
68
  <template>
69
- <div class="vui-accordion" :class="{ open: isOpen }">
69
+ <div class="vui-accordion" :class="{ 'open': isOpen, 'is-card': !!props.card }">
70
70
  <!-- Completely custom header which needs to be styled and implemented by the developer -->
71
71
  <slot v-if="$slots.trigger" name="trigger" :open :close :toggle :is-open />
72
72
  <button v-else class="vui-accordion-header" @click="isOpen = !isOpen">
@@ -76,8 +76,12 @@ useResizeObserver(contentRef, ([entry]) => {
76
76
  <Icon icon="ph:caret-down" />
77
77
  </button>
78
78
 
79
- <div class="vui-accordion-content" :style="{ 'max-height': isOpen ? `${contentMaxHeight}px` : '0px' }">
80
- <div ref="content">
79
+ <div
80
+ class="vui-accordion-content"
81
+ :aria-hidden="!isOpen"
82
+ :style="{ 'max-height': isOpen ? `${contentMaxHeight}px` : '0px' }"
83
+ >
84
+ <div ref="content" class="vui-accordtion-content-inner">
81
85
  <slot />
82
86
  </div>
83
87
  </div>
@@ -4,12 +4,49 @@
4
4
  border-bottom: 1px solid var(--color-border);
5
5
  padding-bottom: 0;
6
6
 
7
+ &.is-card {
8
+ border: 1px solid var(--color-border);
9
+ border-radius: var(--border-radius-m);
10
+
11
+ &.open {
12
+ padding-bottom: 0;
13
+
14
+ .vui-accordion-header {
15
+ border-block-width: 1px;
16
+ border-bottom-left-radius: 0;
17
+ border-bottom-right-radius: 0;
18
+ }
19
+ }
20
+
21
+ .vui-accordion-header {
22
+ padding-inline: var(--space-m);
23
+ border-bottom: 0px solid var(--color-border);
24
+ text-decoration: inherit;
25
+ border-radius: var(--border-radius-m);
26
+
27
+ &:hover {
28
+ text-decoration: inherit;
29
+ text-underline-offset: inherit;
30
+
31
+ background-color: var(--color-button-gray);
32
+ }
33
+ }
34
+
35
+ .vui-accordtion-content-inner {
36
+ padding: var(--space-m);
37
+ }
38
+ }
39
+
7
40
  &.open {
8
41
  padding-bottom: var(--space-m);
9
42
 
10
43
  .vui-accordion-header svg {
11
44
  transform: rotate(180deg);
12
45
  }
46
+
47
+ .vui-accordion-content {
48
+ visibility: visible;
49
+ }
13
50
  }
14
51
 
15
52
  .vui-accordion-header {
@@ -31,8 +68,6 @@
31
68
  svg {
32
69
  transition: var(--transition);
33
70
  }
34
-
35
- // padding-bottom: var(--w);
36
71
  }
37
72
 
38
73
  .vui-accordion-content {
@@ -40,5 +75,6 @@
40
75
  width: 100%;
41
76
  max-height: 0;
42
77
  overflow: hidden;
78
+ visibility: hidden;
43
79
  }
44
80
  }
@@ -22,7 +22,7 @@
22
22
 
23
23
  strong {
24
24
  display: block;
25
- font-size: var(--font-size-l);
25
+ font-size: var(--font-size-m);
26
26
  font-weight: 550;
27
27
  margin-bottom: 6px;
28
28
  }
@@ -2,17 +2,19 @@
2
2
  import type { Sizes } from '../../shared/types'
3
3
  import { Icon } from '@iconify/vue'
4
4
  import { ref } from 'vue'
5
+ import { formatUnitValue } from '../../shared/helpers'
6
+ import { Size } from '../../shared/types'
5
7
  import './avatar.scss'
6
8
 
7
9
  interface Props {
8
- size?: Sizes
10
+ size?: Sizes | number
9
11
  url?: string
10
12
  fallback?: string
11
13
  icon?: string
12
14
  }
13
15
 
14
16
  const {
15
- size = 'm',
17
+ size = Size.m,
16
18
  url,
17
19
  fallback,
18
20
  } = defineProps<Props>()
@@ -23,7 +25,12 @@ const showFallback = ref(false)
23
25
  <template>
24
26
  <div
25
27
  class="vui-avatar"
26
- :class="[`vui-avatar-size-${size}`]"
28
+ :class="[`vui-avatar-size-${typeof size === 'number' ? 'm' : size}`]"
29
+ :style="{
30
+ ...(typeof size === 'number' && {
31
+ '--avatar-size': formatUnitValue(size),
32
+ }),
33
+ }"
27
34
  >
28
35
  <img v-if="url && !showFallback" :src="url" @error="showFallback = true">
29
36
  <strong v-else>
@@ -1,8 +1,8 @@
1
1
  .vui-avatar {
2
- --button-size: 36px;
2
+ --avatar-size: 36px;
3
3
 
4
4
  &.vui-avatar-size-s {
5
- --button-size: 28px;
5
+ --avatar-size: 28px;
6
6
 
7
7
  strong {
8
8
  font-size: var(--font-size-xs);
@@ -10,15 +10,15 @@
10
10
  }
11
11
 
12
12
  &.vui-avatar-size-l {
13
- --button-size: 48px;
13
+ --avatar-size: 48px;
14
14
 
15
15
  strong {
16
16
  font-size: var(--font-size-m);
17
17
  }
18
18
  }
19
19
 
20
- width: var(--button-size);
21
- height: var(--button-size);
20
+ width: var(--avatar-size);
21
+ height: var(--avatar-size);
22
22
  border-radius: 100%;
23
23
  display: flex;
24
24
  align-items: center;
@@ -43,7 +43,7 @@ const {
43
43
  dashed,
44
44
  } = defineProps<Props>()
45
45
 
46
- const actualHeight = computed(() => {
46
+ const height = computed(() => {
47
47
  switch (size) {
48
48
  case Size.s: return '24px'
49
49
  case Size.l: return '40px'
@@ -52,7 +52,7 @@ const actualHeight = computed(() => {
52
52
  }
53
53
  })
54
54
 
55
- const actualPadding = computed(() => {
55
+ const padding = computed(() => {
56
56
  switch (size) {
57
57
  case Size.s: return '5px'
58
58
  case Size.l: return '16px'
@@ -67,6 +67,10 @@ const actualPadding = computed(() => {
67
67
  class="vui-button"
68
68
  :class="[{ loading, expand, disabled, plain, active, icon, square, dashed }, `vui-button-variant-${variant}`]"
69
69
  :disabled
70
+ :style="{
71
+ '--button-height': height,
72
+ '--button-padding': padding,
73
+ }"
70
74
  >
71
75
  <Spinner size="s" />
72
76
  <div class="vui-button-slot">
@@ -81,10 +85,3 @@ const actualPadding = computed(() => {
81
85
  </div>
82
86
  </button>
83
87
  </template>
84
-
85
- <style scoped>
86
- .vui-button {
87
- --button-height: v-bind(actualHeight);
88
- --button-padding: v-bind(actualPadding);
89
- }
90
- </style>
@@ -14,6 +14,8 @@ const props = withDefaults(defineProps<VueDatePickerProps & {
14
14
  format: 'dd/MM/yyyy HH:mm',
15
15
  expand: false,
16
16
  })
17
+
18
+ const ICON_SIZE = 18
17
19
  </script>
18
20
 
19
21
  <template>
@@ -26,28 +28,28 @@ const props = withDefaults(defineProps<VueDatePickerProps & {
26
28
  >
27
29
  <!-- Icon slots -->
28
30
  <template #input-icon>
29
- <Icon :width="18" :height="18" icon="ph:calendar-blank" />
31
+ <Icon :width="ICON_SIZE" :height="ICON_SIZE" icon="ph:calendar-blank" />
30
32
  </template>
31
33
  <template #calendar-icon>
32
- <Icon :width="18" :height="18" icon="ph:calendar-blank" />
34
+ <Icon :width="ICON_SIZE" :height="ICON_SIZE" icon="ph:calendar-blank" />
33
35
  </template>
34
36
  <template #clear-icon>
35
- <Icon :width="18" :height="18" icon="ph:x" />
37
+ <Icon :width="ICON_SIZE" :height="ICON_SIZE" icon="ph:x" />
36
38
  </template>
37
39
  <template #clock-icon>
38
- <Icon :width="18" :height="18" icon="ph:clock" />
40
+ <Icon :width="ICON_SIZE" :height="ICON_SIZE" icon="ph:clock" />
39
41
  </template>
40
42
  <template #arrow-left>
41
- <Icon :width="18" :height="18" icon="ph:caret-left" />
43
+ <Icon :width="ICON_SIZE" :height="ICON_SIZE" icon="ph:caret-left" />
42
44
  </template>
43
45
  <template #arrow-right>
44
- <Icon :width="18" :height="18" icon="ph:caret-right" />
46
+ <Icon :width="ICON_SIZE" :height="ICON_SIZE" icon="ph:caret-right" />
45
47
  </template>
46
48
  <template #arrow-up>
47
- <Icon :width="18" :height="18" icon="ph:caret-up" />
49
+ <Icon :width="ICON_SIZE" :height="ICON_SIZE" icon="ph:caret-up" />
48
50
  </template>
49
51
  <template #arrow-down>
50
- <Icon :width="18" :height="18" icon="ph:caret-down" />
52
+ <Icon :width="ICON_SIZE" :height="ICON_SIZE" icon="ph:caret-down" />
51
53
  </template>
52
54
 
53
55
  <!-- Content slots -->
@@ -33,13 +33,13 @@ const {
33
33
  <slot name="header-end" />
34
34
  </div>
35
35
 
36
- <Divider v-if="(separators || headerSeparator) && ($slots.header || $slots['header-end'])" :size="1" />
36
+ <Divider v-if="(separators || headerSeparator) && ($slots.header || $slots['header-end'])" :space="1" />
37
37
 
38
38
  <div v-if="$slots.default" class="vui-card-content">
39
39
  <slot />
40
40
  </div>
41
41
 
42
- <Divider v-if="(separators || footerSeparator) && $slots.footer" :size="1" />
42
+ <Divider v-if="(separators || footerSeparator) && $slots.footer" :space="1" />
43
43
 
44
44
  <div v-if="$slots.footer" class="vui-card-footer">
45
45
  <slot name="footer" />
@@ -34,7 +34,10 @@ const id = useId()
34
34
  type="checkbox"
35
35
  :disabled
36
36
  :checked="checkedProp"
37
- @change="emit('change', ($event.target as HTMLInputElement).checked)"
37
+ @change="(e) => {
38
+ if (disabled) return
39
+ emit('change', (e.target as HTMLInputElement).checked)
40
+ }"
38
41
  >
39
42
  <label :for="id">
40
43
  <span class="vui-checkbox-icon">
@@ -9,19 +9,24 @@
9
9
 
10
10
  &.disabled {
11
11
  cursor: not-allowed;
12
- pointer-events: none;
13
12
 
14
- .vui-checkbox-icon svg path {
15
- color: var(--color-text-lighter);
13
+ .vui-checkbox-icon {
14
+ pointer-events: none;
15
+ svg path {
16
+ color: var(--color-text-lighter);
17
+ }
16
18
  }
17
19
 
18
- input + label p {
19
- color: var(--color-text-lighter);
20
+ input + label {
21
+ cursor: not-allowed;
22
+
23
+ p {
24
+ color: var(--color-text-lighter);
25
+ }
20
26
  }
21
27
  }
22
28
 
23
29
  .vui-checkbox-icon {
24
- cursor: pointer;
25
30
  width: var(--checkbox-size);
26
31
  height: var(--checkbox-size);
27
32
 
@@ -52,6 +57,7 @@
52
57
  align-items: center;
53
58
  min-height: var(--checkbox-size);
54
59
  font-size: var(--font-size-ms);
60
+ align-self: flex-start;
55
61
  // line-height: var(--checkbox-size);
56
62
  }
57
63
  }
@@ -1,13 +1,13 @@
1
1
  <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { formatUnitValue } from '../../shared/helpers'
2
4
  import './divider.scss'
3
5
 
4
6
  interface Props {
5
7
  thickness?: number
6
- size?: number
8
+ size?: number | string
7
9
  vertical?: boolean
8
- width?: number
9
- height?: number
10
- margin?: string
10
+ margin?: string | number
11
11
  }
12
12
 
13
13
  const {
@@ -16,15 +16,19 @@ const {
16
16
  vertical,
17
17
  margin = '0',
18
18
  } = defineProps<Props>()
19
+
20
+ const h = computed(() => formatUnitValue(size))
21
+ const w = computed(() => vertical ? h.value : 'initial')
22
+ const bW = computed(() => `${thickness}px`)
23
+ const m = computed(() => formatUnitValue(margin))
19
24
  </script>
20
25
 
21
26
  <template>
22
27
  <div
23
28
  class="vui-divider" :class="{ vertical }" :style="{
24
- ...(vertical && { width: `${size}px` }),
25
- height: `${size}px`,
26
- borderWidth: `${thickness}px`,
27
- margin,
29
+ margin: m,
30
+ width: w,
31
+ height: h,
28
32
  }"
29
33
  >
30
34
  <div v-if="$slots.default" class="vui-divider-slot">
@@ -32,3 +36,9 @@ const {
32
36
  </div>
33
37
  </div>
34
38
  </template>
39
+
40
+ <style lang="scss" scoped>
41
+ .vui-divider:before {
42
+ border-width: v-bind(bW);
43
+ }
44
+ </style>
@@ -2,7 +2,7 @@
2
2
  import type { DrawerPortalProps, DrawerRootProps } from 'vaul-vue'
3
3
  import type { Sizes, VueClass } from '../../shared/types'
4
4
  import { DrawerContent, DrawerOverlay, DrawerPortal, DrawerRoot, DrawerTitle } from 'vaul-vue'
5
- import { computed, useId } from 'vue'
5
+ import { computed, onMounted, useId } from 'vue'
6
6
  import './drawer.scss'
7
7
 
8
8
  interface Props {
@@ -40,15 +40,17 @@ const {
40
40
  portalProps,
41
41
  handle = true,
42
42
  } = defineProps<Props>()
43
+
43
44
  const open = defineModel<boolean>()
44
45
 
45
- const containerMaxWidth = computed(() => {
46
+ const mW = computed(() => {
46
47
  if (typeof containerSize === 'string') {
47
48
  if (containerClass === 'full') {
48
49
  return '100%'
49
50
  }
50
51
  else {
51
- return `var(--container-${containerSize})`
52
+ return getComputedStyle(document.documentElement)
53
+ .getPropertyValue(`--container-${containerSize}`)
52
54
  }
53
55
  }
54
56
  else {
@@ -57,6 +59,12 @@ const containerMaxWidth = computed(() => {
57
59
  })
58
60
 
59
61
  const id = useId()
62
+
63
+ onMounted(() => {
64
+ if (!document.querySelector('vaul-drawer-wrapper')) {
65
+ console.error('Your root component is missing \'vaul-drawer-wrapper\' attribute. \n Without it the <Drawer /> component will not be functional.')
66
+ }
67
+ })
60
68
  </script>
61
69
 
62
70
  <template>
@@ -69,12 +77,8 @@ const id = useId()
69
77
  >
70
78
  <DrawerPortal v-bind="portalProps">
71
79
  <DrawerOverlay class="vui-drawer-overlay" />
72
- <DrawerContent class="vui-drawer-content" :class="{ 'hide-handlk': handle === false }" :aria-describedby="id">
73
- <div
74
- class="vui-drawer-container container" :class="containerClass" :style="{
75
- maxWidth: containerMaxWidth,
76
- }"
77
- >
80
+ <DrawerContent class="vui-drawer-content" :class="{ 'hide-handle': handle === false }" :aria-describedby="id">
81
+ <div :key="mW" class="vui-drawer-container container" :class="containerClass" :style="{ 'max-width': mW }">
78
82
  <DrawerTitle class="visually-hidden" :name="id">
79
83
  {{ title }}
80
84
  </DrawerTitle>
@@ -87,7 +91,7 @@ const id = useId()
87
91
 
88
92
  <style lang="scss" scoped>
89
93
  :global(body) {
90
- transition: var(--transition-quick);
94
+ transition: var(--transition-fast);
91
95
  background-color: var(--color-bg);
92
96
  }
93
97
  </style>
@@ -31,19 +31,6 @@
31
31
  top: 12px;
32
32
  border-radius: 3px;
33
33
  background-color: var(--color-border-strong);
34
- transition: var(--transition-quick);
34
+ transition: var(--transition-fast);
35
35
  }
36
-
37
- // .vui-drawer-container {
38
- // width: 100%;
39
- // max-width: 756px;
40
- // margin-inline: auto;
41
- // }
42
- }
43
-
44
- .vui-drawer-overlay {
45
- // opacity: 0.4;
46
- // position: fixed;
47
- // inset: 0;
48
- // background-color: var(--color-bg-lowered);
49
36
  }
@@ -1,12 +1,13 @@
1
1
  <script setup lang='ts'>
2
- import type { Placement } from '@floating-ui/vue'
3
2
  import type { MaybeElement } from '@vueuse/core'
3
+ import type { Placement } from '../../shared/types'
4
4
  import { onClickOutside } from '@vueuse/core'
5
5
  import { computed, ref, useTemplateRef } from 'vue'
6
+ import { formatUnitValue } from '../../shared/helpers'
6
7
  import Popout from '../Popout/Popout.vue'
7
8
  import './dropdown.scss'
8
9
 
9
- interface Props {
10
+ export interface Props {
10
11
  /**
11
12
  * Tooltip placement related to the anchor
12
13
  */
@@ -24,7 +25,7 @@ interface Props {
24
25
  const {
25
26
  placement = 'bottom-start',
26
27
  expand,
27
- minWidth,
28
+ minWidth = 156,
28
29
  } = defineProps<Props>()
29
30
 
30
31
  const anchorRef = useTemplateRef<HTMLDivElement>('anchor')
@@ -63,10 +64,18 @@ defineExpose({
63
64
  toggle,
64
65
  isOpen: showMenu,
65
66
  })
67
+
68
+ const mW = computed(() => formatUnitValue(minWidth))
69
+ const w = computed(() => expand ? `${anchorWidth.value}px` : 'initial')
66
70
  </script>
67
71
 
68
72
  <template>
69
- <div ref="anchor" class="vui-dropdown-trigger-wrap">
73
+ <div
74
+ ref="anchor" class="vui-dropdown-trigger-wrap" :style="{
75
+ minWidth: mW,
76
+ width: w,
77
+ }"
78
+ >
70
79
  <slot name="trigger" :open :is-open="showMenu" :close :toggle />
71
80
  </div>
72
81
 
@@ -77,17 +86,13 @@ defineExpose({
77
86
  :anchor="anchorRef"
78
87
  class="vui-dropdown"
79
88
  :placement
80
- :style="{
81
- minWidth: `${minWidth ?? 156}px`,
82
- ...(expand && { width: `${anchorWidth}px` }),
83
- }"
84
89
  >
85
90
  <slot :open :close :toggle :is-open="showMenu" />
86
91
  </Popout>
87
92
  </Transition>
88
93
  </template>
89
94
 
90
- <style scoped>
95
+ <style scoped lang="scss">
91
96
  .dropdown-enter-active,
92
97
  .dropdown-leave-active {
93
98
  transition: 0.1s opacity ease-in-out;
@@ -58,6 +58,10 @@
58
58
  svg {
59
59
  width: 16px;
60
60
  height: 16px;
61
+
62
+ path {
63
+ color: var(--color-text-light);
64
+ }
61
65
  }
62
66
  }
63
67