@dolanske/vui 0.1.1 → 0.1.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/dist/components/Accordion/AccordionGroup.vue.d.ts +1 -1
- package/dist/components/CopyClipboard/CopyClipboard.vue.d.ts +4 -4
- package/dist/components/Input/Dropzone.vue.d.ts +2 -2
- package/dist/components/Input/Input.vue.d.ts +2 -2
- package/dist/components/Popout/Popout.vue.d.ts +2 -2
- package/dist/components/Progress/Progress.vue.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/vui.js +199 -214
- package/package.json +1 -1
- package/src/App.vue +5 -1
- package/src/components/Accordion/Accordion.vue +2 -2
- package/src/components/Accordion/AccordionGroup.vue +2 -2
- package/src/components/CopyClipboard/CopyClipboard.vue +4 -4
- package/src/components/Dropdown/Dropdown.vue +4 -4
- package/src/components/Input/Dropzone.vue +2 -2
- package/src/components/Input/Input.vue +2 -2
- package/src/components/Popout/Popout.vue +2 -2
- package/src/components/Progress/Progress.vue +2 -2
- package/src/components/Select/Select.vue +2 -2
- package/src/components/Table/Cell.vue +2 -2
- package/src/components/Tabs/Tabs.vue +7 -7
- package/src/components/Tooltip/Tooltip.vue +2 -2
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -3,10 +3,12 @@ import { ref } from 'vue'
|
|
|
3
3
|
import Accordion from './components/Accordion/Accordion.vue'
|
|
4
4
|
import Button from './components/Button/Button.vue'
|
|
5
5
|
import Flex from './components/Flex/Flex.vue'
|
|
6
|
+
import Input from './components/Input/Input.vue'
|
|
6
7
|
import Tab from './components/Tabs/Tab.vue'
|
|
7
8
|
import Tabs from './components/Tabs/Tabs.vue'
|
|
8
9
|
|
|
9
10
|
const tab = ref('components')
|
|
11
|
+
const value = ref('')
|
|
10
12
|
</script>
|
|
11
13
|
|
|
12
14
|
<template>
|
|
@@ -32,13 +34,15 @@ const tab = ref('components')
|
|
|
32
34
|
Hello
|
|
33
35
|
</Button>
|
|
34
36
|
|
|
37
|
+
{{ value }}
|
|
38
|
+
|
|
35
39
|
<Button variant="success" disabled>
|
|
36
40
|
Hello
|
|
37
41
|
</Button>
|
|
38
42
|
</Flex>
|
|
39
43
|
|
|
40
44
|
<Accordion label="Hi">
|
|
41
|
-
|
|
45
|
+
<Input v-model="value" />
|
|
42
46
|
</Accordion>
|
|
43
47
|
</div>
|
|
44
48
|
<div v-else-if="tab === 'typography'" class="typeset" :style="{ maxWidth: '688px', margin: 'auto' }">
|
|
@@ -15,7 +15,7 @@ const emits = defineEmits<{
|
|
|
15
15
|
}>()
|
|
16
16
|
|
|
17
17
|
const isOpen = ref(false)
|
|
18
|
-
const
|
|
18
|
+
const contentRef = useTemplateRef('content')
|
|
19
19
|
const contentMaxHeight = ref(0)
|
|
20
20
|
|
|
21
21
|
watchEffect(() => {
|
|
@@ -27,7 +27,7 @@ watchEffect(() => {
|
|
|
27
27
|
watch(isOpen, (value) => {
|
|
28
28
|
if (value) {
|
|
29
29
|
emits('open')
|
|
30
|
-
contentMaxHeight.value =
|
|
30
|
+
contentMaxHeight.value = contentRef.value?.scrollHeight || 0
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
33
|
emits('close')
|
|
@@ -18,7 +18,7 @@ const slots = defineSlots<{
|
|
|
18
18
|
default: () => Array<VNode & { props: AccordionProps }>
|
|
19
19
|
}>()
|
|
20
20
|
|
|
21
|
-
const accordionRefs = useTemplateRef<InstanceType<typeof Accordion>[]>('
|
|
21
|
+
const accordionRefs = useTemplateRef<InstanceType<typeof Accordion>[]>('accordion')
|
|
22
22
|
|
|
23
23
|
function handleAccordionOpen(newIndex: number) {
|
|
24
24
|
if (!accordionRefs.value || !props.single)
|
|
@@ -36,7 +36,7 @@ function handleAccordionOpen(newIndex: number) {
|
|
|
36
36
|
<component
|
|
37
37
|
:is="item"
|
|
38
38
|
v-for="(item, index) of slots.default()"
|
|
39
|
-
ref="
|
|
39
|
+
ref="accordion"
|
|
40
40
|
:key="item"
|
|
41
41
|
@open="handleAccordionOpen(index)"
|
|
42
42
|
/>
|
|
@@ -46,8 +46,8 @@ onBeforeMount(() => {
|
|
|
46
46
|
}
|
|
47
47
|
})
|
|
48
48
|
|
|
49
|
-
const anchorRef = useTemplateRef('
|
|
50
|
-
const tooltipRef = useTemplateRef('
|
|
49
|
+
const anchorRef = useTemplateRef('anchor')
|
|
50
|
+
const tooltipRef = useTemplateRef('tooltip')
|
|
51
51
|
|
|
52
52
|
const { floatingStyles } = useFloating(anchorRef, tooltipRef, {
|
|
53
53
|
whileElementsMounted: autoUpdate,
|
|
@@ -62,12 +62,12 @@ const { floatingStyles } = useFloating(anchorRef, tooltipRef, {
|
|
|
62
62
|
</script>
|
|
63
63
|
|
|
64
64
|
<template>
|
|
65
|
-
<div ref="
|
|
65
|
+
<div ref="anchor" class="vui-clipboard-copy-wrap" role="button" @click="copy(text)">
|
|
66
66
|
<slot :copy :copied />
|
|
67
67
|
</div>
|
|
68
68
|
|
|
69
69
|
<Transition name="fade-up" mode="in-out">
|
|
70
|
-
<div v-if="copied && (confirm || $slots.confirm)" ref="
|
|
70
|
+
<div v-if="copied && (confirm || $slots.confirm)" ref="tooltip" class="vui-clipboard-tooltip" :style="floatingStyles">
|
|
71
71
|
<slot name="confirm">
|
|
72
72
|
<template v-if="confirm">
|
|
73
73
|
{{ confirm }}
|
|
@@ -27,8 +27,8 @@ const {
|
|
|
27
27
|
minWidth,
|
|
28
28
|
} = defineProps<Props>()
|
|
29
29
|
|
|
30
|
-
const anchorRef = useTemplateRef<HTMLDivElement>('
|
|
31
|
-
const dropdownRef = useTemplateRef<MaybeElement>('
|
|
30
|
+
const anchorRef = useTemplateRef<HTMLDivElement>('anchor')
|
|
31
|
+
const dropdownRef = useTemplateRef<MaybeElement>('dropdown')
|
|
32
32
|
|
|
33
33
|
const showMenu = ref(false)
|
|
34
34
|
|
|
@@ -66,14 +66,14 @@ defineExpose({
|
|
|
66
66
|
</script>
|
|
67
67
|
|
|
68
68
|
<template>
|
|
69
|
-
<div ref="
|
|
69
|
+
<div ref="anchor" class="vui-dropdown-trigger-wrap">
|
|
70
70
|
<slot name="trigger" :open :is-open="showMenu" :close :toggle />
|
|
71
71
|
</div>
|
|
72
72
|
|
|
73
73
|
<Transition appear name="dropdown">
|
|
74
74
|
<Popout
|
|
75
75
|
v-if="showMenu"
|
|
76
|
-
ref="
|
|
76
|
+
ref="dropdown"
|
|
77
77
|
:anchor="anchorRef"
|
|
78
78
|
class="vui-dropdown"
|
|
79
79
|
:placement
|
|
@@ -23,7 +23,7 @@ function onSubmitHandler(e: any, isFromField?: boolean) {
|
|
|
23
23
|
emits('files', files)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const dropzoneRef = useTemplateRef<HTMLDivElement>('
|
|
26
|
+
const dropzoneRef = useTemplateRef<HTMLDivElement>('dropzone')
|
|
27
27
|
|
|
28
28
|
useEventListener(dropzoneRef, 'dragenter', onSubmitHandler, false)
|
|
29
29
|
useEventListener(dropzoneRef, 'dragleave', onSubmitHandler, false)
|
|
@@ -35,7 +35,7 @@ useEventListener(dropzoneRef, 'input', e => onSubmitHandler(e, true), false)
|
|
|
35
35
|
<template>
|
|
36
36
|
<Input
|
|
37
37
|
v-bind="props"
|
|
38
|
-
ref="
|
|
38
|
+
ref="dropzone"
|
|
39
39
|
type="file"
|
|
40
40
|
class="vui-dropzone"
|
|
41
41
|
:class="{ dragging }"
|
|
@@ -57,7 +57,7 @@ const model = defineModel<string | number>({
|
|
|
57
57
|
})
|
|
58
58
|
const id = useId()
|
|
59
59
|
|
|
60
|
-
const inputRef = useTemplateRef('
|
|
60
|
+
const inputRef = useTemplateRef('input')
|
|
61
61
|
|
|
62
62
|
watchEffect(() => {
|
|
63
63
|
if (focus)
|
|
@@ -89,7 +89,7 @@ const renderLimit = computed(() => {
|
|
|
89
89
|
<input
|
|
90
90
|
v-if="!$slots.__internal_replace_input"
|
|
91
91
|
:id
|
|
92
|
-
ref="
|
|
92
|
+
ref="input"
|
|
93
93
|
v-model="model"
|
|
94
94
|
:readonly
|
|
95
95
|
:type
|
|
@@ -20,7 +20,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
20
20
|
offset: 8,
|
|
21
21
|
})
|
|
22
22
|
|
|
23
|
-
const popoutRef = useTemplateRef('
|
|
23
|
+
const popoutRef = useTemplateRef('popout')
|
|
24
24
|
const anchorRef = toRef(props.anchor)
|
|
25
25
|
|
|
26
26
|
const { floatingStyles } = useFloating(anchorRef, popoutRef, {
|
|
@@ -33,7 +33,7 @@ const { floatingStyles } = useFloating(anchorRef, popoutRef, {
|
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
35
|
<template>
|
|
36
|
-
<div ref="
|
|
36
|
+
<div ref="popout" :style="floatingStyles" class="vui-popout">
|
|
37
37
|
<slot />
|
|
38
38
|
</div>
|
|
39
39
|
</template>
|
|
@@ -38,7 +38,7 @@ const progressAmount = defineModel<number>({
|
|
|
38
38
|
})
|
|
39
39
|
|
|
40
40
|
// Set height programatically
|
|
41
|
-
const progressRef = useTemplateRef('
|
|
41
|
+
const progressRef = useTemplateRef('progress')
|
|
42
42
|
|
|
43
43
|
watchEffect(() => {
|
|
44
44
|
if (progressRef.value && !isNil(height)) {
|
|
@@ -67,7 +67,7 @@ onMounted(fakeIncrement)
|
|
|
67
67
|
|
|
68
68
|
<template>
|
|
69
69
|
<div
|
|
70
|
-
ref="
|
|
70
|
+
ref="progress"
|
|
71
71
|
class="vui-progress"
|
|
72
72
|
:class="{
|
|
73
73
|
fixed,
|
|
@@ -111,7 +111,7 @@ onMounted(() => {
|
|
|
111
111
|
}
|
|
112
112
|
})
|
|
113
113
|
|
|
114
|
-
const dropdownRef = useTemplateRef('
|
|
114
|
+
const dropdownRef = useTemplateRef('dropdown')
|
|
115
115
|
|
|
116
116
|
function clearValue() {
|
|
117
117
|
selected.value = undefined
|
|
@@ -121,7 +121,7 @@ function clearValue() {
|
|
|
121
121
|
|
|
122
122
|
<template>
|
|
123
123
|
<div class="vui-input-container vui-select" :class="{ expand, required, readonly }">
|
|
124
|
-
<Dropdown ref="
|
|
124
|
+
<Dropdown ref="dropdown" :expand>
|
|
125
125
|
<template #trigger="{ toggle, isOpen }">
|
|
126
126
|
<div class="vui-input vui-select-trigger-content">
|
|
127
127
|
<label v-if="label" for="id">{{ label }}</label>
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { computed, useSlots, useTemplateRef } from 'vue'
|
|
3
3
|
|
|
4
4
|
const slots = useSlots()
|
|
5
|
-
const
|
|
5
|
+
const contextRef = useTemplateRef<HTMLTableCellElement>('context')
|
|
6
6
|
const computedStyle = computed(() => {
|
|
7
7
|
if (!slots.context)
|
|
8
8
|
return {}
|
|
9
|
-
const width =
|
|
9
|
+
const width = contextRef.value?.getBoundingClientRect().width ?? 0
|
|
10
10
|
return {
|
|
11
11
|
paddingRight: `${width}px`,
|
|
12
12
|
}
|
|
@@ -23,18 +23,18 @@ const slots = defineSlots<{
|
|
|
23
23
|
const active = defineModel()
|
|
24
24
|
|
|
25
25
|
// Underline calculation
|
|
26
|
-
const
|
|
27
|
-
const
|
|
26
|
+
const underlineRef = useTemplateRef('underline')
|
|
27
|
+
const tabsRef = useTemplateRef('tabs')
|
|
28
28
|
|
|
29
29
|
function computeUnderlinePosition() {
|
|
30
|
-
if (
|
|
31
|
-
const activeBounds =
|
|
32
|
-
const parentBounds =
|
|
30
|
+
if (tabsRef.value && underlineRef.value) {
|
|
31
|
+
const activeBounds = tabsRef.value.querySelector('.vui-tab.active')?.getBoundingClientRect()
|
|
32
|
+
const parentBounds = tabsRef.value.getBoundingClientRect()
|
|
33
33
|
if (!activeBounds || !parentBounds)
|
|
34
34
|
return
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
underlineRef.value.style.width = `${activeBounds.width}px`
|
|
37
|
+
underlineRef.value.style.left = `${activeBounds.left - parentBounds.left}px`
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -20,7 +20,7 @@ const {
|
|
|
20
20
|
delay = 0,
|
|
21
21
|
} = defineProps<Props>()
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const popoutAnchorRef = useTemplateRef('popoutAnchor')
|
|
24
24
|
// Track if user is hovering the anchor
|
|
25
25
|
const hoverAnchor = ref(false)
|
|
26
26
|
|
|
@@ -61,7 +61,7 @@ watch(hoverAnchor, (isHovering) => {
|
|
|
61
61
|
<slot />
|
|
62
62
|
</div>
|
|
63
63
|
<Transition appear name="tooltip">
|
|
64
|
-
<Popout v-if="showTooltip" :anchor="
|
|
64
|
+
<Popout v-if="showTooltip" :anchor="popoutAnchorRef" class="vui-tooltip" :placement>
|
|
65
65
|
<slot name="tooltip" />
|
|
66
66
|
</Popout>
|
|
67
67
|
</Transition>
|