@sit-onyx/headless 0.10.0 → 0.11.0-dev-20260610140621
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/TestCalendar.d.vue.ts +3 -2
- package/dist/composables/comboBox/SelectOnlyCombobox.d.vue.ts +3 -4
- package/dist/composables/comboBox/TestCombobox.d.vue.ts +3 -4
- package/dist/composables/dataGrid/TestDataGrid.d.vue.ts +2 -1
- package/dist/composables/dataGrid/TestLazyDataGrid.d.vue.ts +2 -1
- package/dist/composables/listbox/TestListbox.d.vue.ts +2 -1
- package/dist/composables/menuButton/TestMenuButton.d.vue.ts +2 -1
- package/dist/composables/navigationMenu/TestMenu.d.vue.ts +2 -1
- package/dist/composables/slider/TestSlider.d.vue.ts +5 -4
- package/dist/composables/tabs/TestTabs.d.vue.ts +2 -1
- package/dist/composables/toggleButton/TestToggleButton.d.vue.ts +2 -1
- package/dist/composables/treeView/createTreeView.d.ts +15 -0
- package/dist/composables/treeView/createTreeView.spec.d.ts +1 -0
- package/dist/composables/treeView/createTreeViewItem.d.ts +41 -0
- package/dist/composables/treeView/createTreeViewItem.spec.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +180 -7
- package/dist/utils/FocusVisibleTest.d.vue.ts +2 -3
- package/dist/utils/TouchEventTest.d.vue.ts +2 -3
- package/package.json +7 -5
|
@@ -2,7 +2,8 @@ import { SelectionMode } from './createCalendar.js';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
mode?: SelectionMode;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
6
6
|
mode: SelectionMode;
|
|
7
|
-
}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, false, {},
|
|
7
|
+
}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
8
9
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<{}, {
|
|
2
2
|
comboBox: import('../../index.js', { with: { "resolution-mode": "import" } }).HeadlessComposable<{
|
|
3
3
|
option: import('@vue/reactivity').ComputedRef<(data: {
|
|
4
4
|
label: string;
|
|
@@ -230,7 +230,6 @@ declare const _default: import('@vue/runtime-core').DefineComponent<{}, {
|
|
|
230
230
|
getOptionValueById: (id: string) => string | undefined;
|
|
231
231
|
getOption: (value: string) => HTMLElement | null;
|
|
232
232
|
}>;
|
|
233
|
-
}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {
|
|
234
|
-
|
|
235
|
-
}, HTMLDivElement>;
|
|
233
|
+
}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {}, any>;
|
|
234
|
+
declare const _default: typeof __VLS_export;
|
|
236
235
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<{}, {
|
|
2
2
|
comboBox: import('../../index.js', { with: { "resolution-mode": "import" } }).HeadlessComposable<{
|
|
3
3
|
option: import('@vue/reactivity').ComputedRef<(data: {
|
|
4
4
|
label: string;
|
|
@@ -230,7 +230,6 @@ declare const _default: import('@vue/runtime-core').DefineComponent<{}, {
|
|
|
230
230
|
getOptionValueById: (id: string) => string | undefined;
|
|
231
231
|
getOption: (value: string) => HTMLElement | null;
|
|
232
232
|
}>;
|
|
233
|
-
}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {
|
|
234
|
-
|
|
235
|
-
}, HTMLDivElement>;
|
|
233
|
+
}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {}, any>;
|
|
234
|
+
declare const _default: typeof __VLS_export;
|
|
236
235
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<{}, {}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<{}, {}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<{}, {}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<{}, {}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<{}, {}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
type
|
|
1
|
+
type __VLS_ModelProps = {
|
|
2
2
|
modelValue: number | [number, number];
|
|
3
3
|
};
|
|
4
|
-
declare const
|
|
4
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {
|
|
5
5
|
"update:modelValue": (value: number | [number, number]) => any;
|
|
6
|
-
}, string, import('@vue/runtime-core').PublicProps, Readonly<
|
|
6
|
+
}, string, import('@vue/runtime-core').PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
7
7
|
"onUpdate:modelValue"?: ((value: number | [number, number]) => any) | undefined;
|
|
8
|
-
}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, false, {},
|
|
8
|
+
}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
9
10
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<{}, {}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<{}, {}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
export type UseTreeViewOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* The accessible label for the tree.
|
|
5
|
+
*/
|
|
6
|
+
label: MaybeRefOrGetter<string>;
|
|
7
|
+
};
|
|
8
|
+
export declare const createTreeView: (options: UseTreeViewOptions) => {
|
|
9
|
+
elements: {
|
|
10
|
+
tree: import('vue').ComputedRef<{
|
|
11
|
+
role: string;
|
|
12
|
+
"aria-label": string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
type UseTreeViewItemNavigationOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the tree view item has nested children.
|
|
5
|
+
*/
|
|
6
|
+
hasChildren: MaybeRefOrGetter<boolean>;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the children of the tree view item are open.
|
|
9
|
+
*/
|
|
10
|
+
isOpen: MaybeRef<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* The level of nesting that the item is placed inside the tree view.
|
|
13
|
+
*/
|
|
14
|
+
level: MaybeRefOrGetter<number>;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the item is disabled and can not be interacted with.
|
|
17
|
+
*/
|
|
18
|
+
disabled?: MaybeRefOrGetter<boolean | undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* Callback when the tree view item is selected.
|
|
21
|
+
*/
|
|
22
|
+
onSelect?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Callback when the open state is toggled.
|
|
25
|
+
*/
|
|
26
|
+
onToggle?: (open: boolean) => void;
|
|
27
|
+
};
|
|
28
|
+
export declare const createTreeViewItem: (options: UseTreeViewItemNavigationOptions) => {
|
|
29
|
+
elements: {
|
|
30
|
+
treeItem: import('vue').ComputedRef<{
|
|
31
|
+
role: string;
|
|
32
|
+
"aria-expanded": boolean | undefined;
|
|
33
|
+
"aria-level": number;
|
|
34
|
+
"aria-disabled": "true" | undefined;
|
|
35
|
+
tabindex: number;
|
|
36
|
+
onClick: () => void;
|
|
37
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export * from './composables/tabs/createTabs.js';
|
|
|
11
11
|
export * from './composables/toggleButton/createToggleButton.js';
|
|
12
12
|
export * from './composables/tooltip/createToggletip.js';
|
|
13
13
|
export * from './composables/tooltip/createTooltip.js';
|
|
14
|
+
export * from './composables/treeView/createTreeView.js';
|
|
15
|
+
export * from './composables/treeView/createTreeViewItem.js';
|
|
14
16
|
export * from './utils/builder.js';
|
|
15
17
|
export { isPrintableCharacter, wasKeyPressed } from './utils/keyboard.js';
|
|
16
18
|
export { debounce } from './utils/timer.js';
|
package/dist/index.js
CHANGED
|
@@ -331,9 +331,8 @@ var createCalendar = createBuilder((options) => {
|
|
|
331
331
|
"aria-disabled": isDisabled.value(cell.date)
|
|
332
332
|
})),
|
|
333
333
|
button: computed(() => (button) => {
|
|
334
|
-
const formatter = new Intl.DateTimeFormat(toValue(options.locale), { dateStyle: "full" });
|
|
335
334
|
const attributes = {
|
|
336
|
-
"aria-label":
|
|
335
|
+
"aria-label": new Intl.DateTimeFormat(toValue(options.locale), { dateStyle: "full" }).format(button.date),
|
|
337
336
|
"data-date": button.date.toDateString()
|
|
338
337
|
};
|
|
339
338
|
if (!toValue(options.selectionMode)) return attributes;
|
|
@@ -773,11 +772,18 @@ var createComboBox = createBuilder(({ autocomplete: autocompleteRef, onAutocompl
|
|
|
773
772
|
elements: {
|
|
774
773
|
option,
|
|
775
774
|
group,
|
|
775
|
+
/**
|
|
776
|
+
* The listbox associated with the combobox.
|
|
777
|
+
*/
|
|
776
778
|
listbox: computed(() => ({
|
|
777
779
|
...listbox.value,
|
|
778
780
|
id: controlsId,
|
|
779
781
|
onMousedown: (e) => e.preventDefault()
|
|
780
782
|
})),
|
|
783
|
+
/**
|
|
784
|
+
* An input that controls another element, that can dynamically pop-up to help the user set the value of the input.
|
|
785
|
+
* The input MAY be either a single-line text field that supports editing and typing or an element that only displays the current value of the combobox.
|
|
786
|
+
*/
|
|
781
787
|
input: computed(() => ({
|
|
782
788
|
role: "combobox",
|
|
783
789
|
"aria-expanded": isExpanded.value,
|
|
@@ -788,6 +794,9 @@ var createComboBox = createBuilder(({ autocomplete: autocompleteRef, onAutocompl
|
|
|
788
794
|
onKeydown: handleKeydown,
|
|
789
795
|
...autocompleteInput.value
|
|
790
796
|
})),
|
|
797
|
+
/**
|
|
798
|
+
* An optional button to control the visibility of the popup.
|
|
799
|
+
*/
|
|
791
800
|
button: computed(() => ({
|
|
792
801
|
tabindex: "-1",
|
|
793
802
|
onClick: () => onToggle?.()
|
|
@@ -1025,7 +1034,13 @@ var createDataGrid = createBuilder((options) => {
|
|
|
1025
1034
|
};
|
|
1026
1035
|
})
|
|
1027
1036
|
},
|
|
1028
|
-
state: {
|
|
1037
|
+
state: {
|
|
1038
|
+
/**
|
|
1039
|
+
* Indicates that the data grid expects a content change soon, e.g. because more or other data is loaded.
|
|
1040
|
+
* If `loading` is passed in via the options, this will mirror its value.
|
|
1041
|
+
* Otherwise it will be dynamically set based on the running state of the `requestLazyLoad` promises.
|
|
1042
|
+
*/
|
|
1043
|
+
busy },
|
|
1029
1044
|
internals: {}
|
|
1030
1045
|
};
|
|
1031
1046
|
});
|
|
@@ -1276,9 +1291,36 @@ var createMenuItems = createBuilder((options) => {
|
|
|
1276
1291
|
//#endregion
|
|
1277
1292
|
//#region src/utils/math.ts
|
|
1278
1293
|
var MathUtils = {
|
|
1294
|
+
/**
|
|
1295
|
+
* Ensures that a given `number` is or is between a given `min` and `max`.
|
|
1296
|
+
*/
|
|
1279
1297
|
clamp: (number, min, max) => Math.max(Math.min(number, max), min),
|
|
1298
|
+
/**
|
|
1299
|
+
* Returns the count of decimal places in a number.
|
|
1300
|
+
* @param number - The number to check.
|
|
1301
|
+
* @returns The count of decimal places.
|
|
1302
|
+
*
|
|
1303
|
+
* decimals(1.23); // 2
|
|
1304
|
+
* decimals(10); // 0
|
|
1305
|
+
*/
|
|
1280
1306
|
decimalsCount: (number) => String(number).split(".")[1]?.length ?? 0,
|
|
1307
|
+
/**
|
|
1308
|
+
* Converts a value within a range to a percentage (0-100).
|
|
1309
|
+
*
|
|
1310
|
+
* @param value - The value to convert.
|
|
1311
|
+
* @param min - The minimum allowed value.
|
|
1312
|
+
* @param max - The maximum allowed value.
|
|
1313
|
+
* @returns The percentage representation of the value.
|
|
1314
|
+
*/
|
|
1281
1315
|
valueToPercent: (value, min, max) => (value - min) * 100 / (max - min),
|
|
1316
|
+
/**
|
|
1317
|
+
* Converts a percentage (0-100) to a value within a range.
|
|
1318
|
+
*
|
|
1319
|
+
* @param percent - The percentage to convert.
|
|
1320
|
+
* @param min - The minimum allowed value.
|
|
1321
|
+
* @param max - The maximum allowed value.
|
|
1322
|
+
* @returns The value representation of the percentage.
|
|
1323
|
+
*/
|
|
1282
1324
|
percentToValue: (percent, min, max) => (max - min) * percent + min
|
|
1283
1325
|
};
|
|
1284
1326
|
//#endregion
|
|
@@ -1483,6 +1525,9 @@ var createSlider = createBuilder((options) => {
|
|
|
1483
1525
|
};
|
|
1484
1526
|
return {
|
|
1485
1527
|
elements: {
|
|
1528
|
+
/**
|
|
1529
|
+
* Root slider container element
|
|
1530
|
+
*/
|
|
1486
1531
|
root: computed(() => {
|
|
1487
1532
|
const events = { onPointerdown: handlePointerdown };
|
|
1488
1533
|
return {
|
|
@@ -1491,8 +1536,10 @@ var createSlider = createBuilder((options) => {
|
|
|
1491
1536
|
...toValue(options.disabled) ? void 0 : events
|
|
1492
1537
|
};
|
|
1493
1538
|
}),
|
|
1539
|
+
/**
|
|
1540
|
+
* Input inside each thumb for accessibility
|
|
1541
|
+
*/
|
|
1494
1542
|
thumbInput: computed(() => (data) => {
|
|
1495
|
-
const events = { onKeydown: (event) => handleKeydown(event, data.index) };
|
|
1496
1543
|
return {
|
|
1497
1544
|
min: min.value,
|
|
1498
1545
|
max: max.value,
|
|
@@ -1507,13 +1554,16 @@ var createSlider = createBuilder((options) => {
|
|
|
1507
1554
|
step: step.value,
|
|
1508
1555
|
disabled: toValue(options.disabled),
|
|
1509
1556
|
ref: data.index === 0 ? firstThumbRef : data.index === 1 ? secondThumbRef : void 0,
|
|
1510
|
-
...toValue(options.disabled) ? void 0 :
|
|
1557
|
+
...toValue(options.disabled) ? void 0 : { onKeydown: (event) => handleKeydown(event, data.index) }
|
|
1511
1558
|
};
|
|
1512
1559
|
})
|
|
1513
1560
|
},
|
|
1514
1561
|
state: {
|
|
1515
1562
|
normalizedValue,
|
|
1516
1563
|
shiftStep,
|
|
1564
|
+
/**
|
|
1565
|
+
* Track element representing the selected range
|
|
1566
|
+
*/
|
|
1517
1567
|
track: computed(() => {
|
|
1518
1568
|
const start = normalizedValue.value.length > 1 ? normalizedValue.value[0] : min.value;
|
|
1519
1569
|
const startPercentage = getValueInPercentage.value(start);
|
|
@@ -1633,7 +1683,11 @@ var createTabs = createBuilder((options) => {
|
|
|
1633
1683
|
* Based on https://www.w3.org/WAI/ARIA/apg/patterns/button/#:~:text=Toggle%20button
|
|
1634
1684
|
*/
|
|
1635
1685
|
var createToggleButton = createBuilder((options) => {
|
|
1636
|
-
return { elements: {
|
|
1686
|
+
return { elements: {
|
|
1687
|
+
/**
|
|
1688
|
+
* A html button element that is supposed to act as a toggle button.
|
|
1689
|
+
*/
|
|
1690
|
+
button: computed(() => ({
|
|
1637
1691
|
"aria-pressed": toValue(options.isPressed),
|
|
1638
1692
|
onClick: options.onToggle
|
|
1639
1693
|
})) } };
|
|
@@ -1667,11 +1721,19 @@ var createToggletip = createBuilder(({ toggleLabel, isVisible }) => {
|
|
|
1667
1721
|
const toggle = () => _isVisible.value = !_isVisible.value;
|
|
1668
1722
|
return {
|
|
1669
1723
|
elements: {
|
|
1724
|
+
/**
|
|
1725
|
+
* The element which controls the toggletip visibility:
|
|
1726
|
+
* Preferably a `button` element.
|
|
1727
|
+
*/
|
|
1670
1728
|
trigger: computed(() => ({
|
|
1671
1729
|
id: triggerId,
|
|
1672
1730
|
onClick: toggle,
|
|
1673
1731
|
"aria-label": toValue(toggleLabel)
|
|
1674
1732
|
})),
|
|
1733
|
+
/**
|
|
1734
|
+
* The element with the relevant toggletip content.
|
|
1735
|
+
* Only simple, textual content is allowed.
|
|
1736
|
+
*/
|
|
1675
1737
|
tooltip: {
|
|
1676
1738
|
onToggle: (e) => {
|
|
1677
1739
|
_isVisible.value = e.target.matches(":popover-open");
|
|
@@ -1718,10 +1780,17 @@ var createTooltip = createBuilder(({ debounce, isVisible }) => {
|
|
|
1718
1780
|
useDismissible({ isExpanded: _isVisible });
|
|
1719
1781
|
return {
|
|
1720
1782
|
elements: {
|
|
1783
|
+
/**
|
|
1784
|
+
* The element which controls the tooltip visibility on hover.
|
|
1785
|
+
*/
|
|
1721
1786
|
trigger: {
|
|
1722
1787
|
"aria-describedby": tooltipId,
|
|
1723
1788
|
...hoverEvents
|
|
1724
1789
|
},
|
|
1790
|
+
/**
|
|
1791
|
+
* The element describing the tooltip.
|
|
1792
|
+
* Only simple, textual and non-focusable content is allowed.
|
|
1793
|
+
*/
|
|
1725
1794
|
tooltip: {
|
|
1726
1795
|
popover: "manual",
|
|
1727
1796
|
role: "tooltip",
|
|
@@ -1734,4 +1803,108 @@ var createTooltip = createBuilder(({ debounce, isVisible }) => {
|
|
|
1734
1803
|
};
|
|
1735
1804
|
});
|
|
1736
1805
|
//#endregion
|
|
1737
|
-
|
|
1806
|
+
//#region src/composables/treeView/createTreeView.ts
|
|
1807
|
+
var createTreeView = createBuilder((options) => {
|
|
1808
|
+
return { elements: { tree: computed(() => ({
|
|
1809
|
+
role: "tree",
|
|
1810
|
+
"aria-label": toValue(options.label)
|
|
1811
|
+
})) } };
|
|
1812
|
+
});
|
|
1813
|
+
//#endregion
|
|
1814
|
+
//#region src/composables/treeView/createTreeViewItem.ts
|
|
1815
|
+
var createTreeViewItem = createBuilder((options) => {
|
|
1816
|
+
const disabled = computed(() => toValue(options.disabled));
|
|
1817
|
+
const level = computed(() => toValue(options.level));
|
|
1818
|
+
const hasChildren = computed(() => toValue(options.hasChildren));
|
|
1819
|
+
const isOpen = computed(() => toValue(options.isOpen));
|
|
1820
|
+
const toggleOpen = () => {
|
|
1821
|
+
if (disabled.value) return;
|
|
1822
|
+
if (hasChildren.value) options.onToggle?.(!isOpen.value);
|
|
1823
|
+
options.onSelect?.();
|
|
1824
|
+
};
|
|
1825
|
+
/**
|
|
1826
|
+
* Determines if a specific DOM element or its tree item wrapper is disabled.
|
|
1827
|
+
*/
|
|
1828
|
+
const isElementDisabled = (item) => {
|
|
1829
|
+
if (item.hasAttribute("disabled") || item.getAttribute("aria-disabled") === "true") return true;
|
|
1830
|
+
return (item.parentElement?.closest("[role=\"treeitem\"]"))?.getAttribute("aria-disabled") === "true";
|
|
1831
|
+
};
|
|
1832
|
+
/**
|
|
1833
|
+
* Crawls the parent tree structure to retrieve all currently visible, active tree items.
|
|
1834
|
+
*/
|
|
1835
|
+
const getVisibleTreeItems = (triggerEl) => {
|
|
1836
|
+
const rootTree = triggerEl.closest("[role=\"tree\"]");
|
|
1837
|
+
if (!rootTree) return [];
|
|
1838
|
+
return Array.from(rootTree.querySelectorAll("[role=\"treeitem\"]")).filter((item) => {
|
|
1839
|
+
if (!(item.offsetWidth > 0 || item.offsetHeight > 0 || item.getClientRects().length > 0)) return false;
|
|
1840
|
+
return !isElementDisabled(item);
|
|
1841
|
+
});
|
|
1842
|
+
};
|
|
1843
|
+
const handleKeyDown = (event) => {
|
|
1844
|
+
if (disabled.value) return;
|
|
1845
|
+
const currentTrigger = event.currentTarget;
|
|
1846
|
+
switch (event.key) {
|
|
1847
|
+
case "Enter":
|
|
1848
|
+
case " ":
|
|
1849
|
+
event.preventDefault();
|
|
1850
|
+
toggleOpen();
|
|
1851
|
+
break;
|
|
1852
|
+
case "ArrowRight":
|
|
1853
|
+
event.preventDefault();
|
|
1854
|
+
if (hasChildren.value) if (isOpen.value) {
|
|
1855
|
+
const items = getVisibleTreeItems(currentTrigger);
|
|
1856
|
+
const currentIndex = items.indexOf(currentTrigger);
|
|
1857
|
+
if (currentIndex !== -1 && currentIndex < items.length - 1) items[currentIndex + 1].focus();
|
|
1858
|
+
} else options.onToggle?.(true);
|
|
1859
|
+
break;
|
|
1860
|
+
case "ArrowLeft":
|
|
1861
|
+
event.preventDefault();
|
|
1862
|
+
if (hasChildren.value && isOpen.value) options.onToggle?.(false);
|
|
1863
|
+
else {
|
|
1864
|
+
const parentGroup = currentTrigger.closest("[role=\"group\"]");
|
|
1865
|
+
if (parentGroup) {
|
|
1866
|
+
const parentTrigger = parentGroup.closest("[role=\"treeitem\"]") || parentGroup.parentElement?.querySelector("[role=\"treeitem\"]");
|
|
1867
|
+
if (parentTrigger && parentTrigger !== currentTrigger) parentTrigger.focus();
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
break;
|
|
1871
|
+
case "ArrowDown": {
|
|
1872
|
+
event.preventDefault();
|
|
1873
|
+
const items = getVisibleTreeItems(currentTrigger);
|
|
1874
|
+
const currentIndex = items.indexOf(currentTrigger);
|
|
1875
|
+
if (currentIndex !== -1 && currentIndex < items.length - 1) items[currentIndex + 1].focus();
|
|
1876
|
+
break;
|
|
1877
|
+
}
|
|
1878
|
+
case "ArrowUp": {
|
|
1879
|
+
event.preventDefault();
|
|
1880
|
+
const items = getVisibleTreeItems(currentTrigger);
|
|
1881
|
+
const currentIndex = items.indexOf(currentTrigger);
|
|
1882
|
+
if (currentIndex > 0) items[currentIndex - 1].focus();
|
|
1883
|
+
break;
|
|
1884
|
+
}
|
|
1885
|
+
case "Home": {
|
|
1886
|
+
event.preventDefault();
|
|
1887
|
+
const items = getVisibleTreeItems(currentTrigger);
|
|
1888
|
+
if (items.length > 0) items[0].focus();
|
|
1889
|
+
break;
|
|
1890
|
+
}
|
|
1891
|
+
case "End": {
|
|
1892
|
+
event.preventDefault();
|
|
1893
|
+
const items = getVisibleTreeItems(currentTrigger);
|
|
1894
|
+
if (items.length > 0) items[items.length - 1].focus();
|
|
1895
|
+
break;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
};
|
|
1899
|
+
return { elements: { treeItem: computed(() => ({
|
|
1900
|
+
role: "treeitem",
|
|
1901
|
+
"aria-expanded": hasChildren.value ? isOpen.value : void 0,
|
|
1902
|
+
"aria-level": level.value,
|
|
1903
|
+
"aria-disabled": disabled.value ? "true" : void 0,
|
|
1904
|
+
tabindex: disabled.value ? -1 : 0,
|
|
1905
|
+
onClick: toggleOpen,
|
|
1906
|
+
onKeydown: handleKeyDown
|
|
1907
|
+
})) } };
|
|
1908
|
+
});
|
|
1909
|
+
//#endregion
|
|
1910
|
+
export { CLOSING_KEYS, OPENING_KEYS, createBuilder, createCalendar, createComboBox, createDataGrid, createElRef, createListbox, createMenuButton, createMenuItems, createNavigationMenu, createSlider, createTabs, createToggleButton, createToggletip, createTooltip, createTreeView, createTreeViewItem, debounce, getNativeElement, isPrintableCharacter, useGlobalEventListener, useOutsideClick, wasKeyPressed };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
|
|
3
|
-
}, HTMLDivElement>;
|
|
1
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<{}, {}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
4
3
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
|
|
3
|
-
}, HTMLDivElement>;
|
|
1
|
+
declare const __VLS_export: import('@vue/runtime-core').DefineComponent<{}, {}, {}, {}, {}, import('@vue/runtime-core').ComponentOptionsMixin, import('@vue/runtime-core').ComponentOptionsMixin, {}, string, import('@vue/runtime-core').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('@vue/runtime-core').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
4
3
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sit-onyx/headless",
|
|
3
3
|
"description": "Headless composables for Vue",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.11.0-dev-20260610140621",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Schwarz IT KG",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -32,14 +32,16 @@
|
|
|
32
32
|
"url": "https://github.com/SchwarzIT/onyx/issues"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@playwright/experimental-ct-vue": "1.
|
|
36
|
-
"@playwright/test": "1.
|
|
35
|
+
"@playwright/experimental-ct-vue": "1.60.0",
|
|
36
|
+
"@playwright/test": "1.60.0",
|
|
37
37
|
"typescript": ">= 5",
|
|
38
38
|
"vue": ">= 3.5.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@vue/compiler-dom": "3.5.
|
|
42
|
-
"
|
|
41
|
+
"@vue/compiler-dom": "3.5.35",
|
|
42
|
+
"unplugin-dts": "1.0.2",
|
|
43
|
+
"vite": "8.0.16",
|
|
44
|
+
"vue": "3.5.35",
|
|
43
45
|
"@sit-onyx/shared": "^0.1.0"
|
|
44
46
|
},
|
|
45
47
|
"scripts": {
|