orio-ui 1.16.2 → 1.18.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.
- package/dist/module.json +1 -1
- package/dist/runtime/assets/css/variables.css +1 -1
- package/dist/runtime/components/Badge.d.vue.ts +2 -0
- package/dist/runtime/components/Badge.vue +13 -4
- package/dist/runtime/components/Badge.vue.d.ts +2 -0
- package/dist/runtime/components/Button.d.vue.ts +2 -1
- package/dist/runtime/components/Button.vue +11 -5
- package/dist/runtime/components/Button.vue.d.ts +2 -1
- package/dist/runtime/components/CheckBox.d.vue.ts +2 -1
- package/dist/runtime/components/CheckBox.vue +11 -3
- package/dist/runtime/components/CheckBox.vue.d.ts +2 -1
- package/dist/runtime/components/ControlElement.vue +21 -11
- package/dist/runtime/components/Icon.d.vue.ts +0 -1
- package/dist/runtime/components/Icon.vue +7 -14
- package/dist/runtime/components/Icon.vue.d.ts +0 -1
- package/dist/runtime/components/Input.d.vue.ts +2 -2
- package/dist/runtime/components/Input.vue +14 -6
- package/dist/runtime/components/Input.vue.d.ts +2 -2
- package/dist/runtime/components/NavButton.d.vue.ts +2 -1
- package/dist/runtime/components/NavButton.vue +11 -5
- package/dist/runtime/components/NavButton.vue.d.ts +2 -1
- package/dist/runtime/components/NumberInput/Horizontal.d.vue.ts +1 -1
- package/dist/runtime/components/NumberInput/Horizontal.vue +7 -1
- package/dist/runtime/components/NumberInput/Horizontal.vue.d.ts +1 -1
- package/dist/runtime/components/NumberInput/Vertical.d.vue.ts +1 -1
- package/dist/runtime/components/NumberInput/Vertical.vue +7 -1
- package/dist/runtime/components/NumberInput/Vertical.vue.d.ts +1 -1
- package/dist/runtime/components/NumberInput/index.d.vue.ts +3 -2
- package/dist/runtime/components/NumberInput/index.vue +23 -3
- package/dist/runtime/components/NumberInput/index.vue.d.ts +3 -2
- package/dist/runtime/components/Popover.d.vue.ts +22 -51
- package/dist/runtime/components/Popover.vue +37 -65
- package/dist/runtime/components/Popover.vue.d.ts +22 -51
- package/dist/runtime/components/RadioButton.d.vue.ts +3 -2
- package/dist/runtime/components/RadioButton.vue +12 -5
- package/dist/runtime/components/RadioButton.vue.d.ts +3 -2
- package/dist/runtime/components/Selector.d.vue.ts +2 -1
- package/dist/runtime/components/Selector.vue +68 -10
- package/dist/runtime/components/Selector.vue.d.ts +2 -1
- package/dist/runtime/components/SwitchButton.d.vue.ts +2 -1
- package/dist/runtime/components/SwitchButton.vue +10 -2
- package/dist/runtime/components/SwitchButton.vue.d.ts +2 -1
- package/dist/runtime/components/Textarea.d.vue.ts +2 -1
- package/dist/runtime/components/Textarea.vue +10 -7
- package/dist/runtime/components/Textarea.vue.d.ts +2 -1
- package/dist/runtime/components/view/Text.d.vue.ts +1 -1
- package/dist/runtime/components/view/Text.vue.d.ts +1 -1
- package/dist/runtime/composables/useListKeyboard.d.ts +19 -0
- package/dist/runtime/composables/useListKeyboard.js +59 -0
- package/dist/runtime/composables/useValidation.d.ts +3 -3
- package/dist/runtime/composables/useValidation.js +5 -6
- package/package.json +1 -1
|
@@ -21,8 +21,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
21
21
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
22
22
|
}>, {
|
|
23
23
|
type: TextTypes;
|
|
24
|
-
icon: string | null;
|
|
25
24
|
size: "small" | "medium" | "large" | "extra-large";
|
|
25
|
+
icon: string | null;
|
|
26
26
|
uppercase: boolean;
|
|
27
27
|
lineClamp: number | string;
|
|
28
28
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -21,8 +21,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
21
21
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
22
22
|
}>, {
|
|
23
23
|
type: TextTypes;
|
|
24
|
-
icon: string | null;
|
|
25
24
|
size: "small" | "medium" | "large" | "extra-large";
|
|
25
|
+
icon: string | null;
|
|
26
26
|
uppercase: boolean;
|
|
27
27
|
lineClamp: number | string;
|
|
28
28
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Ref } from "vue";
|
|
2
|
+
export interface ListKeyboardOptions {
|
|
3
|
+
/** Total number of items in the list */
|
|
4
|
+
count: () => number;
|
|
5
|
+
/** Called when an item is confirmed (Enter/Space) */
|
|
6
|
+
onSelect: (index: number) => void;
|
|
7
|
+
/** Called to open the list (ArrowDown/ArrowUp/Enter/Space when closed) */
|
|
8
|
+
onOpen?: () => void;
|
|
9
|
+
/** Called to close the list (Escape) */
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
/** Find the index of the initially highlighted item (e.g. currently selected) */
|
|
12
|
+
initialIndex?: () => number;
|
|
13
|
+
}
|
|
14
|
+
export declare function useListKeyboard(options: ListKeyboardOptions): {
|
|
15
|
+
highlightedIndex: Ref<number, number>;
|
|
16
|
+
listRef: Ref<HTMLElement | null, HTMLElement | null>;
|
|
17
|
+
onKeydown: (e: KeyboardEvent, isOpen: boolean) => void;
|
|
18
|
+
reset: () => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ref, nextTick } from "vue";
|
|
2
|
+
export function useListKeyboard(options) {
|
|
3
|
+
const highlightedIndex = ref(-1);
|
|
4
|
+
const listRef = ref(null);
|
|
5
|
+
function scrollIntoView() {
|
|
6
|
+
const ul = listRef.value;
|
|
7
|
+
if (!ul || highlightedIndex.value < 0) return;
|
|
8
|
+
const li = ul.children[highlightedIndex.value];
|
|
9
|
+
li?.scrollIntoView({ block: "nearest" });
|
|
10
|
+
}
|
|
11
|
+
function highlight(index) {
|
|
12
|
+
const count = options.count();
|
|
13
|
+
if (count === 0) return;
|
|
14
|
+
highlightedIndex.value = Math.max(0, Math.min(index, count - 1));
|
|
15
|
+
scrollIntoView();
|
|
16
|
+
}
|
|
17
|
+
function reset() {
|
|
18
|
+
const initial = options.initialIndex?.() ?? 0;
|
|
19
|
+
highlightedIndex.value = Math.max(initial, 0);
|
|
20
|
+
nextTick(scrollIntoView);
|
|
21
|
+
}
|
|
22
|
+
const keyActions = {
|
|
23
|
+
ArrowDown(isOpen) {
|
|
24
|
+
if (!isOpen) return options.onOpen?.();
|
|
25
|
+
highlight(highlightedIndex.value + 1);
|
|
26
|
+
},
|
|
27
|
+
ArrowUp(isOpen) {
|
|
28
|
+
if (!isOpen) return options.onOpen?.();
|
|
29
|
+
highlight(highlightedIndex.value - 1);
|
|
30
|
+
},
|
|
31
|
+
Home(isOpen) {
|
|
32
|
+
if (!isOpen) return;
|
|
33
|
+
highlight(0);
|
|
34
|
+
},
|
|
35
|
+
End(isOpen) {
|
|
36
|
+
if (!isOpen) return;
|
|
37
|
+
highlight(options.count() - 1);
|
|
38
|
+
},
|
|
39
|
+
Enter(isOpen) {
|
|
40
|
+
if (!isOpen) return options.onOpen?.();
|
|
41
|
+
if (highlightedIndex.value >= 0) options.onSelect(highlightedIndex.value);
|
|
42
|
+
},
|
|
43
|
+
" "(isOpen) {
|
|
44
|
+
if (!isOpen) return options.onOpen?.();
|
|
45
|
+
if (highlightedIndex.value >= 0) options.onSelect(highlightedIndex.value);
|
|
46
|
+
},
|
|
47
|
+
Escape() {
|
|
48
|
+
highlightedIndex.value = -1;
|
|
49
|
+
options.onClose?.();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function onKeydown(e, isOpen) {
|
|
53
|
+
const action = keyActions[e.key];
|
|
54
|
+
if (!action) return;
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
action(isOpen);
|
|
57
|
+
}
|
|
58
|
+
return { highlightedIndex, listRef, onKeydown, reset };
|
|
59
|
+
}
|
|
@@ -2,11 +2,11 @@ import { type MaybeRef } from "vue";
|
|
|
2
2
|
export interface ValidationRule {
|
|
3
3
|
model: MaybeRef<any>;
|
|
4
4
|
id: string;
|
|
5
|
-
validator: (model:
|
|
5
|
+
validator: (model: any) => boolean;
|
|
6
6
|
message?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function isFilled(
|
|
9
|
-
export declare function isEmail(
|
|
8
|
+
export declare function isFilled(value: string | []): boolean;
|
|
9
|
+
export declare function isEmail(value: string): boolean;
|
|
10
10
|
export declare function useValidation(rules?: ValidationRule[]): {
|
|
11
11
|
checkValidity: () => boolean;
|
|
12
12
|
errors: Record<string, string | null>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { reactive,
|
|
2
|
-
export function isFilled(
|
|
3
|
-
return
|
|
1
|
+
import { reactive, ref, unref } from "vue";
|
|
2
|
+
export function isFilled(value) {
|
|
3
|
+
return !!value.length;
|
|
4
4
|
}
|
|
5
|
-
export function isEmail(
|
|
6
|
-
const value = isRef(model) ? model.value : model;
|
|
5
|
+
export function isEmail(value) {
|
|
7
6
|
if (!value) return true;
|
|
8
7
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
9
8
|
return emailRegex.test(value);
|
|
@@ -17,7 +16,7 @@ export function useValidation(rules) {
|
|
|
17
16
|
validator,
|
|
18
17
|
message
|
|
19
18
|
}) {
|
|
20
|
-
if (!validator(model)) {
|
|
19
|
+
if (!validator(unref(model))) {
|
|
21
20
|
if (!errors[id]) {
|
|
22
21
|
errors[id] = message || "Error on this field";
|
|
23
22
|
}
|