@sit-onyx/headless 0.5.0-dev-20260111214528 → 0.5.0-dev-20260112084701
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/composables/calendar/createCalendar.d.ts +1 -1
- package/dist/composables/dataGrid/createDataGrid.d.ts +2 -2
- package/dist/composables/menuButton/createMenuButton.d.ts +2 -2
- package/dist/composables/slider/createSlider.d.ts +1 -1
- package/dist/index.js +8 -9
- package/dist/utils/builder.d.ts +2 -2
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@ export declare const _unstableCreateCalendar: (options: CreateCalendarOptions) =
|
|
|
33
33
|
table: {
|
|
34
34
|
role: string;
|
|
35
35
|
onKeydown: (event: KeyboardEvent) => Promise<void>;
|
|
36
|
-
ref: import('../../utils/builder.js').HeadlessElRef<HTMLElement>;
|
|
36
|
+
ref: import('../../utils/builder.js').HeadlessElRef<HTMLElement | null>;
|
|
37
37
|
};
|
|
38
38
|
cell: import('vue').ComputedRef<(cell: {
|
|
39
39
|
date: Date;
|
|
@@ -48,7 +48,7 @@ export declare const createDataGrid: <Lazy extends boolean = false>(options: Cre
|
|
|
48
48
|
id: string;
|
|
49
49
|
};
|
|
50
50
|
table: import('vue').ComputedRef<{
|
|
51
|
-
ref: import('../../utils/builder.js').HeadlessElRef<HTMLTableElement>;
|
|
51
|
+
ref: import('../../utils/builder.js').HeadlessElRef<HTMLTableElement | null>;
|
|
52
52
|
onFocusin: (event: FocusEvent) => void;
|
|
53
53
|
onKeydown: (event: KeyboardEvent) => void;
|
|
54
54
|
role: string;
|
|
@@ -64,7 +64,7 @@ export declare const createDataGrid: <Lazy extends boolean = false>(options: Cre
|
|
|
64
64
|
};
|
|
65
65
|
td: import('vue').ComputedRef<({ rowId, colKey, colIndex }: TdOptions<Lazy>) => {
|
|
66
66
|
tabindex: string;
|
|
67
|
-
ref: import('../../utils/builder.js').HeadlessElRef<HTMLElement> | undefined;
|
|
67
|
+
ref: import('../../utils/builder.js').HeadlessElRef<HTMLElement | null> | undefined;
|
|
68
68
|
"data-onyx-col-key": string;
|
|
69
69
|
"aria-colindex": number | undefined;
|
|
70
70
|
role: string;
|
|
@@ -33,7 +33,7 @@ export declare const createMenuButton: (options: CreateMenuButtonOptions) => {
|
|
|
33
33
|
onMouseleave?: (() => void) | undefined;
|
|
34
34
|
id: string;
|
|
35
35
|
onKeydown: (event: KeyboardEvent) => void;
|
|
36
|
-
ref: import('../../utils/builder.js').HeadlessElRef<HTMLElement>;
|
|
36
|
+
ref: import('../../utils/builder.js').HeadlessElRef<HTMLElement | null>;
|
|
37
37
|
}>;
|
|
38
38
|
button: import('vue').ComputedRef<{
|
|
39
39
|
readonly "aria-controls": string;
|
|
@@ -46,7 +46,7 @@ export declare const createMenuButton: (options: CreateMenuButtonOptions) => {
|
|
|
46
46
|
}>;
|
|
47
47
|
menu: {
|
|
48
48
|
id: string;
|
|
49
|
-
ref: import('../../utils/builder.js').HeadlessElRef<HTMLElement>;
|
|
49
|
+
ref: import('../../utils/builder.js').HeadlessElRef<HTMLElement | null>;
|
|
50
50
|
role: string;
|
|
51
51
|
"aria-labelledby": string;
|
|
52
52
|
onClick: () => void;
|
|
@@ -256,7 +256,7 @@ export declare const _unstableCreateSlider: <TValue extends SliderValue>(options
|
|
|
256
256
|
onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
|
|
257
257
|
onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
|
|
258
258
|
onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
|
|
259
|
-
ref: import('../../utils/builder.js').HeadlessElRef<HTMLElement>;
|
|
259
|
+
ref: import('../../utils/builder.js').HeadlessElRef<HTMLElement | null>;
|
|
260
260
|
}>;
|
|
261
261
|
/**
|
|
262
262
|
* Individual thumb elements for each value (span)
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { shallowRef, computed, toValue, ref, watch, nextTick, reactive, onBeforeMount, watchEffect, onBeforeUnmount, unref, useId, toRef } from "vue";
|
|
2
2
|
const createBuilder = (builder) => builder;
|
|
3
3
|
function createElRef() {
|
|
4
|
-
const elementRef = shallowRef();
|
|
4
|
+
const elementRef = shallowRef(null);
|
|
5
5
|
return computed({
|
|
6
|
-
set: (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} else if (element != null && "$el" in element) {
|
|
6
|
+
set: (ref2) => {
|
|
7
|
+
const element = Array.isArray(ref2) ? ref2.at(0) : ref2;
|
|
8
|
+
if (element != null && "$el" in element) {
|
|
10
9
|
elementRef.value = element.$el;
|
|
11
10
|
} else {
|
|
12
|
-
elementRef.value = element;
|
|
11
|
+
elementRef.value = element ?? null;
|
|
13
12
|
}
|
|
14
13
|
},
|
|
15
14
|
get: () => elementRef.value
|
|
@@ -986,7 +985,7 @@ const _unstableCreateSlider = createBuilder(
|
|
|
986
985
|
const draggingThumbIndex = ref();
|
|
987
986
|
watch(draggingThumbIndex, (newThumbIndex) => {
|
|
988
987
|
if (newThumbIndex == void 0) return;
|
|
989
|
-
Array.from(sliderRef.value
|
|
988
|
+
Array.from(sliderRef.value?.querySelectorAll('[role="slider"]') ?? []).at(newThumbIndex)?.focus();
|
|
990
989
|
});
|
|
991
990
|
const shiftStep = computed(() => {
|
|
992
991
|
const shiftStep2 = toValue(options.shiftStep);
|
|
@@ -1101,8 +1100,8 @@ const _unstableCreateSlider = createBuilder(
|
|
|
1101
1100
|
disabled: computed(() => draggingThumbIndex.value == void 0)
|
|
1102
1101
|
});
|
|
1103
1102
|
const getValueFromCoordinates = (x) => {
|
|
1104
|
-
const rect = sliderRef.value
|
|
1105
|
-
if (rect.width <= 0) return;
|
|
1103
|
+
const rect = sliderRef.value?.getBoundingClientRect();
|
|
1104
|
+
if (!rect || rect.width <= 0) return;
|
|
1106
1105
|
const percent = MathUtils.clamp((x - rect.left) / rect.width, 0, 1);
|
|
1107
1106
|
return MathUtils.percentToValue(percent, min.value, max.value);
|
|
1108
1107
|
};
|
package/dist/utils/builder.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ type VueTemplateRefElement<E extends Element> = E | (ComponentPublicInstance & {
|
|
|
61
61
|
}) | null;
|
|
62
62
|
type VueTemplateRef<E extends Element> = Ref<VueTemplateRefElement<E>>;
|
|
63
63
|
export declare const HeadlessElRefSymbol: unique symbol;
|
|
64
|
-
export type HeadlessElRef<E extends Element> = WritableComputedRef<E> & {
|
|
64
|
+
export type HeadlessElRef<E extends Element | null> = WritableComputedRef<E | null> & {
|
|
65
65
|
/**
|
|
66
66
|
* type differentiator
|
|
67
67
|
* ensures that only `createElRef` can be used for headless element ref bindings
|
|
@@ -85,5 +85,5 @@ export type HeadlessElRef<E extends Element> = WritableComputedRef<E> & {
|
|
|
85
85
|
* });
|
|
86
86
|
* ```
|
|
87
87
|
*/
|
|
88
|
-
export declare function createElRef<E extends Element>(): HeadlessElRef<E>;
|
|
88
|
+
export declare function createElRef<E extends Element>(): HeadlessElRef<E | null>;
|
|
89
89
|
export {};
|
package/package.json
CHANGED