vueless 1.2.8-beta.14 → 1.2.8-beta.15
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/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export {
|
|
|
17
17
|
} from "./utils/helper";
|
|
18
18
|
export { isMac, isPWA, isIOS, isAndroid, isMobileApp, isWindows } from "./utils/platform";
|
|
19
19
|
export { cx, cva, compose, getDefaults, setVuelessConfig, setColor, vuelessConfig } from "./utils/ui";
|
|
20
|
-
export { getTheme, setTheme, resetTheme, normalizeThemeConfig, cssVar } from "./utils/theme";
|
|
20
|
+
export { getTheme, setTheme, resetTheme, normalizeThemeConfig, cssVar, setRootCSSVariables } from "./utils/theme";
|
|
21
21
|
export { getArgs, getArgTypes, getSlotNames, getSlotsFragment, getSource, getDocsDescription } from "./utils/storybook";
|
|
22
22
|
/* adapters */
|
|
23
23
|
export { default as defaultEnLocale } from "./adapter.locale/locales/en";
|
package/index.ts
CHANGED
|
@@ -23,7 +23,7 @@ export {
|
|
|
23
23
|
} from "./utils/helper";
|
|
24
24
|
export { isMac, isPWA, isIOS, isAndroid, isMobileApp, isWindows } from "./utils/platform";
|
|
25
25
|
export { cx, cva, compose, getDefaults, setVuelessConfig, setColor, vuelessConfig } from "./utils/ui";
|
|
26
|
-
export { getTheme, setTheme, resetTheme, normalizeThemeConfig, cssVar } from "./utils/theme";
|
|
26
|
+
export { getTheme, setTheme, resetTheme, normalizeThemeConfig, cssVar, setRootCSSVariables } from "./utils/theme";
|
|
27
27
|
export { getArgs, getArgTypes, getSlotNames, getSlotsFragment, getSource, getDocsDescription } from "./utils/storybook";
|
|
28
28
|
/* adapters */
|
|
29
29
|
export { default as defaultEnLocale } from "./adapter.locale/locales/en";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "1.2.8-beta.
|
|
3
|
+
"version": "1.2.8-beta.15",
|
|
4
4
|
"description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
|
|
5
5
|
"author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
|
|
6
6
|
"homepage": "https://vueless.com",
|
|
@@ -66,6 +66,7 @@ const emit = defineEmits([
|
|
|
66
66
|
type UListboxRef = InstanceType<typeof UListbox>;
|
|
67
67
|
|
|
68
68
|
const isShownOptions = ref(false);
|
|
69
|
+
const isClickingOption = ref(false);
|
|
69
70
|
const listboxRef = useTemplateRef<UListboxRef>("dropdown-list");
|
|
70
71
|
const wrapperRef = useTemplateRef<HTMLDivElement>("wrapper");
|
|
71
72
|
|
|
@@ -162,9 +163,23 @@ function hideOptions() {
|
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
function onClickOption(option: Option) {
|
|
166
|
+
isClickingOption.value = true;
|
|
167
|
+
|
|
165
168
|
emit("clickOption", option);
|
|
166
169
|
|
|
167
170
|
if (!props.multiple && props.closeOnSelect) hideOptions();
|
|
171
|
+
|
|
172
|
+
nextTick(() => {
|
|
173
|
+
setTimeout(() => {
|
|
174
|
+
isClickingOption.value = false;
|
|
175
|
+
}, 10);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function handleClickOutside() {
|
|
180
|
+
if (isClickingOption.value) return;
|
|
181
|
+
|
|
182
|
+
hideOptions();
|
|
168
183
|
}
|
|
169
184
|
|
|
170
185
|
defineExpose({
|
|
@@ -197,7 +212,7 @@ const { getDataTest, config, wrapperAttrs, dropdownBadgeAttrs, listboxAttrs, tog
|
|
|
197
212
|
<template>
|
|
198
213
|
<div
|
|
199
214
|
ref="wrapper"
|
|
200
|
-
v-click-outside="
|
|
215
|
+
v-click-outside="handleClickOutside"
|
|
201
216
|
v-bind="wrapperAttrs"
|
|
202
217
|
:data-test="getDataTest('wrapper')"
|
|
203
218
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { nextTick, computed,
|
|
2
|
+
import { nextTick, computed, ref, useId, useTemplateRef } from "vue";
|
|
3
3
|
import { isEqual } from "lodash-es";
|
|
4
4
|
|
|
5
5
|
import useUI from "../composables/useUI";
|
|
@@ -63,11 +63,10 @@ const emit = defineEmits([
|
|
|
63
63
|
"update:search",
|
|
64
64
|
]);
|
|
65
65
|
|
|
66
|
-
provide("hideDropdownOptions", hideOptions);
|
|
67
|
-
|
|
68
66
|
type UListboxRef = InstanceType<typeof UListbox>;
|
|
69
67
|
|
|
70
68
|
const isShownOptions = ref(false);
|
|
69
|
+
const isClickingOption = ref(false);
|
|
71
70
|
const listboxRef = useTemplateRef<UListboxRef>("dropdown-list");
|
|
72
71
|
const wrapperRef = useTemplateRef<HTMLDivElement>("wrapper");
|
|
73
72
|
|
|
@@ -148,9 +147,23 @@ function getFullOptionLabels(value: Option | Option[]) {
|
|
|
148
147
|
}
|
|
149
148
|
|
|
150
149
|
function onClickOption(option: Option) {
|
|
150
|
+
isClickingOption.value = true;
|
|
151
|
+
|
|
151
152
|
emit("clickOption", option);
|
|
152
153
|
|
|
153
154
|
if (!props.multiple && props.closeOnSelect) hideOptions();
|
|
155
|
+
|
|
156
|
+
nextTick(() => {
|
|
157
|
+
setTimeout(() => {
|
|
158
|
+
isClickingOption.value = false;
|
|
159
|
+
}, 10);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function handleClickOutside() {
|
|
164
|
+
if (isClickingOption.value) return;
|
|
165
|
+
|
|
166
|
+
hideOptions();
|
|
154
167
|
}
|
|
155
168
|
|
|
156
169
|
function onClickButton() {
|
|
@@ -199,7 +212,7 @@ const { getDataTest, config, dropdownButtonAttrs, listboxAttrs, toggleIconAttrs,
|
|
|
199
212
|
<template>
|
|
200
213
|
<div
|
|
201
214
|
ref="wrapper"
|
|
202
|
-
v-click-outside="
|
|
215
|
+
v-click-outside="handleClickOutside"
|
|
203
216
|
v-bind="wrapperAttrs"
|
|
204
217
|
:data-test="getDataTest('wrapper')"
|
|
205
218
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { nextTick, computed,
|
|
2
|
+
import { nextTick, computed, ref, useId, useTemplateRef } from "vue";
|
|
3
3
|
import { isEqual } from "lodash-es";
|
|
4
4
|
|
|
5
5
|
import useUI from "../composables/useUI";
|
|
@@ -63,11 +63,10 @@ const emit = defineEmits([
|
|
|
63
63
|
"update:search",
|
|
64
64
|
]);
|
|
65
65
|
|
|
66
|
-
provide("hideDropdownOptions", hideOptions);
|
|
67
|
-
|
|
68
66
|
type ULisboxRef = InstanceType<typeof ULisbox>;
|
|
69
67
|
|
|
70
68
|
const isShownOptions = ref(false);
|
|
69
|
+
const isClickingOption = ref(false);
|
|
71
70
|
const listboxRef = useTemplateRef<ULisboxRef>("dropdown-list");
|
|
72
71
|
const wrapperRef = useTemplateRef<HTMLDivElement>("wrapper");
|
|
73
72
|
|
|
@@ -166,9 +165,23 @@ function hideOptions() {
|
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
function onClickOption(option: Option) {
|
|
168
|
+
isClickingOption.value = true;
|
|
169
|
+
|
|
169
170
|
emit("clickOption", option);
|
|
170
171
|
|
|
171
172
|
if (!props.multiple && props.closeOnSelect) hideOptions();
|
|
173
|
+
|
|
174
|
+
nextTick(() => {
|
|
175
|
+
setTimeout(() => {
|
|
176
|
+
isClickingOption.value = false;
|
|
177
|
+
}, 10);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function handleClickOutside() {
|
|
182
|
+
if (isClickingOption.value) return;
|
|
183
|
+
|
|
184
|
+
hideOptions();
|
|
172
185
|
}
|
|
173
186
|
|
|
174
187
|
defineExpose({
|
|
@@ -201,7 +214,7 @@ const { config, getDataTest, wrapperAttrs, dropdownLinkAttrs, listboxAttrs, togg
|
|
|
201
214
|
<template>
|
|
202
215
|
<div
|
|
203
216
|
ref="wrapper"
|
|
204
|
-
v-click-outside="
|
|
217
|
+
v-click-outside="handleClickOutside"
|
|
205
218
|
tabindex="1"
|
|
206
219
|
v-bind="wrapperAttrs"
|
|
207
220
|
:data-test="getDataTest('wrapper')"
|
package/utils/theme.ts
CHANGED
|
@@ -334,10 +334,10 @@ export function setTheme(config: ThemeConfig = {}) {
|
|
|
334
334
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
335
335
|
export function normalizeThemeConfig(theme: any): MergedThemeConfig {
|
|
336
336
|
return {
|
|
337
|
-
colorMode: String(theme.colorMode) as ColorMode,
|
|
337
|
+
colorMode: String(theme.colorMode ?? "") as ColorMode,
|
|
338
338
|
isColorModeAuto: !!toNumber(theme.isColorModeAuto),
|
|
339
|
-
primary: String(theme.primary),
|
|
340
|
-
neutral: String(theme.neutral),
|
|
339
|
+
primary: String(theme.primary ?? ""),
|
|
340
|
+
neutral: String(theme.neutral ?? ""),
|
|
341
341
|
text: {
|
|
342
342
|
xs: toNumber(theme.text?.xs),
|
|
343
343
|
sm: toNumber(theme.text?.sm),
|
|
@@ -696,7 +696,7 @@ function getDarkTheme(darkTheme?: Partial<VuelessCssVariables>) {
|
|
|
696
696
|
* Generate and apply Vueless CSS variables.
|
|
697
697
|
* @return string - Vueless CSS variables string.
|
|
698
698
|
*/
|
|
699
|
-
function setRootCSSVariables(vars: RootCSSVariableOptions) {
|
|
699
|
+
export function setRootCSSVariables(vars: RootCSSVariableOptions) {
|
|
700
700
|
let darkVariables: Partial<VuelessCssVariables> = {};
|
|
701
701
|
|
|
702
702
|
let variables: Partial<VuelessCssVariables> = {
|