@dolanske/vui 1.1.3 → 1.1.5
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 +1 -1
- package/src/components/Alert/alert.scss +1 -0
- package/src/components/Button/button.scss +5 -0
- package/src/components/Divider/divider.scss +1 -1
- package/src/components/Select/Select.vue +3 -3
- package/src/components/Select/select.scss +1 -0
- package/src/components/Sidebar/Sidebar.vue +7 -6
- package/src/examples/ExampleButtons.vue +11 -3
- package/src/examples/ExampleInputs.vue +4 -2
- package/src/examples/ExamplePopouts.vue +2 -2
package/package.json
CHANGED
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
opacity: 0;
|
|
96
96
|
position: absolute;
|
|
97
97
|
pointer-events: none;
|
|
98
|
+
--spinner-color: var(--color-text);
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
// Variants
|
|
@@ -166,6 +167,10 @@
|
|
|
166
167
|
color: var(--color-text-invert);
|
|
167
168
|
background-color: var(--color-button-fill);
|
|
168
169
|
|
|
170
|
+
.vui-spinner {
|
|
171
|
+
--spinner-color: var(--color-text-invert);
|
|
172
|
+
}
|
|
173
|
+
|
|
169
174
|
svg,
|
|
170
175
|
path {
|
|
171
176
|
color: var(--color-text-invert);
|
|
@@ -48,7 +48,7 @@ const {
|
|
|
48
48
|
} = defineProps<Props>()
|
|
49
49
|
|
|
50
50
|
const selected = defineModel<SelectOption[] | undefined>()
|
|
51
|
-
const
|
|
51
|
+
const triggerRef = useTemplateRef('trigger')
|
|
52
52
|
|
|
53
53
|
//
|
|
54
54
|
function setValue(option: SelectOption) {
|
|
@@ -128,7 +128,7 @@ const id = useId()
|
|
|
128
128
|
|
|
129
129
|
<template>
|
|
130
130
|
<div class="vui-input-container vui-select" :class="{ expand, required, readonly, disabled, 'has-errors': errors.length > 0 }">
|
|
131
|
-
<Dropdown ref="dropdown" :expand @close="
|
|
131
|
+
<Dropdown ref="dropdown" :expand min-width="192px" @close="triggerRef?.focus({ preventScroll: true })">
|
|
132
132
|
<template #trigger="{ toggle, isOpen }">
|
|
133
133
|
<div class="vui-input vui-select-trigger-content">
|
|
134
134
|
<label v-if="label" :for="id">{{ label }}</label>
|
|
@@ -147,7 +147,7 @@ const id = useId()
|
|
|
147
147
|
<span>
|
|
148
148
|
{{ renderPlaceholder }}
|
|
149
149
|
</span>
|
|
150
|
-
<template v-if="showClear && !required && selected">
|
|
150
|
+
<template v-if="showClear && !required && (selected && selected.length > 0)">
|
|
151
151
|
<div class="flex-1" />
|
|
152
152
|
<Button
|
|
153
153
|
plain
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang='ts'>
|
|
2
2
|
import { useCssVar, useMouseInElement, useTimeoutFn, watchThrottled } from '@vueuse/core'
|
|
3
|
-
import { computed,
|
|
3
|
+
import { computed, onBeforeMount, useSlots, useTemplateRef } from 'vue'
|
|
4
4
|
import { isNil } from '../../shared/helpers'
|
|
5
5
|
import './sidebar.scss'
|
|
6
6
|
|
|
@@ -26,12 +26,12 @@ interface Props {
|
|
|
26
26
|
floaty?: boolean
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const sidebarRef = useTemplateRef('sidebar')
|
|
30
30
|
const open = defineModel<boolean>({
|
|
31
31
|
default: true,
|
|
32
32
|
})
|
|
33
33
|
const slots = useSlots()
|
|
34
|
-
const offset = useCssVar('--vui-sidebar-float-offset',
|
|
34
|
+
const offset = useCssVar('--vui-sidebar-float-offset', sidebarRef, {
|
|
35
35
|
initialValue: '8px',
|
|
36
36
|
})
|
|
37
37
|
|
|
@@ -61,10 +61,10 @@ const { start, stop, isPending } = useTimeoutFn(() => {
|
|
|
61
61
|
|
|
62
62
|
const APPEAR_OFFSET = 32
|
|
63
63
|
|
|
64
|
-
const
|
|
65
|
-
const { elementX } = useMouseInElement(
|
|
64
|
+
const wrapEl = useTemplateRef('wrap')
|
|
65
|
+
const { elementX } = useMouseInElement(wrapEl)
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
onBeforeMount(() => {
|
|
68
68
|
if (props.appear && open.value) {
|
|
69
69
|
open.value = false
|
|
70
70
|
}
|
|
@@ -92,6 +92,7 @@ watchThrottled(elementX, (pos) => {
|
|
|
92
92
|
}
|
|
93
93
|
}, {
|
|
94
94
|
throttle: 100,
|
|
95
|
+
immediate: true,
|
|
95
96
|
})
|
|
96
97
|
</script>
|
|
97
98
|
|
|
@@ -75,7 +75,7 @@ const variants = ['gray', 'fill', 'danger', 'success', 'link', 'accent'] as cons
|
|
|
75
75
|
</td>
|
|
76
76
|
</tr>
|
|
77
77
|
<tr>
|
|
78
|
-
<th>
|
|
78
|
+
<th>Square + icon</th>
|
|
79
79
|
<td>
|
|
80
80
|
<Flex gap="s">
|
|
81
81
|
<Button v-for="btn in variants" :key="btn" :variant="btn" square icon="ph:info" />
|
|
@@ -83,7 +83,7 @@ const variants = ['gray', 'fill', 'danger', 'success', 'link', 'accent'] as cons
|
|
|
83
83
|
</td>
|
|
84
84
|
</tr>
|
|
85
85
|
<tr>
|
|
86
|
-
<th>
|
|
86
|
+
<th>Square + icon + small</th>
|
|
87
87
|
<td>
|
|
88
88
|
<Flex gap="s">
|
|
89
89
|
<Button v-for="btn in variants" :key="btn" :variant="btn" square icon="ph:info" size="s" />
|
|
@@ -91,13 +91,21 @@ const variants = ['gray', 'fill', 'danger', 'success', 'link', 'accent'] as cons
|
|
|
91
91
|
</td>
|
|
92
92
|
</tr>
|
|
93
93
|
<tr>
|
|
94
|
-
<th>
|
|
94
|
+
<th>Square + icon + large</th>
|
|
95
95
|
<td>
|
|
96
96
|
<Flex gap="s">
|
|
97
97
|
<Button v-for="btn in variants" :key="btn" :variant="btn" square icon="ph:info" size="l" />
|
|
98
98
|
</Flex>
|
|
99
99
|
</td>
|
|
100
100
|
</tr>
|
|
101
|
+
<tr>
|
|
102
|
+
<th>Loading</th>
|
|
103
|
+
<td>
|
|
104
|
+
<Flex gap="s">
|
|
105
|
+
<Button v-for="btn in variants" :key="btn" :variant="btn" loading size="l" />
|
|
106
|
+
</Flex>
|
|
107
|
+
</td>
|
|
108
|
+
</tr>
|
|
101
109
|
<tr>
|
|
102
110
|
<th>Icon + text</th>
|
|
103
111
|
<td>
|
|
@@ -166,7 +166,7 @@ const selected2 = ref([])
|
|
|
166
166
|
<Select :options="options" label="Required (single)" expand required />
|
|
167
167
|
<Select :options="options" label="Base + errors" expand :errors="['Hello bro']" />
|
|
168
168
|
<Select v-model="selected" :options="options" label="Base multi" expand :single="false" />
|
|
169
|
-
<Select v-model="selected2" :options="options" label="Multi, max options 2" expand :single="false" :max-active-options="2" />
|
|
169
|
+
<Select v-model="selected2" :options="options" label="Multi, max options 2, showClear" show-clear expand :single="false" :max-active-options="2" />
|
|
170
170
|
<Select v-model="selected1" :options="options" label="Multi required" required expand :single="false" hint="Must always have at least one option selected" />
|
|
171
171
|
|
|
172
172
|
<select>
|
|
@@ -184,8 +184,10 @@ const selected2 = ref([])
|
|
|
184
184
|
</option>
|
|
185
185
|
</select>
|
|
186
186
|
</Grid>
|
|
187
|
+
<div class="inline-block">
|
|
188
|
+
<Select :options="longOptions" label="Short" show-clear />
|
|
189
|
+
</div>
|
|
187
190
|
<Divider :size="48" />
|
|
188
|
-
|
|
189
191
|
<h6 class="mb-l">
|
|
190
192
|
OTP
|
|
191
193
|
</h6>
|
|
@@ -4,7 +4,7 @@ import Button from '../components/Button/Button.vue'
|
|
|
4
4
|
import Flex from '../components/Flex/Flex.vue'
|
|
5
5
|
import Popout from '../components/Popout/Popout.vue'
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const anchRef = useTemplateRef('anch')
|
|
8
8
|
const open = ref(false)
|
|
9
9
|
</script>
|
|
10
10
|
|
|
@@ -26,7 +26,7 @@ const open = ref(false)
|
|
|
26
26
|
This popout has offset of <code>32</code> and its placement is <code>bottom-start</code>. It also has an attached event to <code>clickOutside</code> which is fired when user clicks outside of the popout. In that case, we manually close it.
|
|
27
27
|
</p>
|
|
28
28
|
</Flex>
|
|
29
|
-
<Popout v-if="open" :anchor="
|
|
29
|
+
<Popout v-if="open" :anchor="anchRef" class="test-popout" :offset="32" placement="bottom-start" @click-outside="open = false">
|
|
30
30
|
<h3>Popout content</h3>
|
|
31
31
|
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dolorem facere eligendi ex, alias itaque molestiae, vero animi, vitae vel fuga corporis aut consectetur temporibus ipsum placeat dolores perferendis. Deleniti, et!</p>
|
|
32
32
|
</Popout>
|