@featherk/composables 0.4.11 → 0.5.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/README.md +62 -122
- package/dist/date/index.d.ts +1 -0
- package/dist/date/useMaskedDateInput.d.ts +33 -0
- package/dist/featherk-composables.es.js +1140 -228
- package/dist/featherk-composables.umd.js +1 -1
- package/dist/grid/index.d.ts +1 -0
- package/dist/index.d.ts +8 -2
- package/dist/range/index.d.ts +1 -0
- package/dist/range/useMaskedDateRangeInput.d.ts +48 -0
- package/dist/time/index.d.ts +1 -0
- package/dist/time/useMaskedTimeInput.d.ts +42 -0
- package/dist/trap/index.d.ts +1 -0
- package/dist/trap/usePopupTrap.d.ts +20 -0
- package/docs/date/useMaskedDateInput.md +173 -0
- package/docs/grid/useGridA11y.md +243 -0
- package/docs/range/useMaskedDateRangeInput.md +213 -0
- package/docs/time/useMaskedTimeInput.md +197 -0
- package/docs/trap/usePopupTrap.md +138 -0
- package/package.json +53 -3
- package/dist/useGridComposableEx.d.ts +0 -11
package/README.md
CHANGED
|
@@ -1,153 +1,93 @@
|
|
|
1
1
|
# `@featherk/composables`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
>
|
|
5
|
-
> *This package is not affiliated with or approved by Telerik.*
|
|
3
|
+
Vue 3 composables that improve Kendo UI for Vue behavior and accessibility.
|
|
6
4
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
### BIG DISCLAIMER
|
|
10
|
-
|
|
11
|
-
> This package is experimental and **NOT READY FOR PRODUCTION**. Do not use this package in production environments. The API, types, and build output are unstable. Tests and documentation are incomplete. You may encounter breaking changes, missing features, or rough edges. Use only for local experimentation or as a reference.
|
|
12
|
-
|
|
13
|
-
### Compatibility
|
|
14
|
-
|
|
15
|
-
> The current version of `useGridA11y` composable was developed targeting Kendo UI for Vue version 6.4.1.
|
|
16
|
-
>*Use of Kendo UI for Vue Grid requires a paid [license](https://www.telerik.com/purchase/kendo-ui) from Telerik.*
|
|
17
|
-
>
|
|
18
|
-
>See [Kendo UI for Vue Grid Documentation](https://www.telerik.com/kendo-vue-ui/components/grid)
|
|
19
|
-
|
|
20
|
-
### Notes
|
|
5
|
+
## Importing Composables
|
|
21
6
|
|
|
22
|
-
|
|
23
|
-
- For row-level navigation, disable the Grid's cell-level dynamic tabindex behavior (omit or set `navigatable="false"` on the Grid).
|
|
24
|
-
- The composable returns helpers for keyboard handling, focus management, initialization (new `initA11y()`), and sort/filter interactions.
|
|
7
|
+
You can import directly from subpaths or from the package root.
|
|
25
8
|
|
|
26
|
-
|
|
9
|
+
Subpath imports (recommended for clarity):
|
|
27
10
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### Prerequisites
|
|
33
|
-
|
|
34
|
-
- Vue 3 (script setup)
|
|
35
|
-
- `@progress/kendo-vue-grid` installed
|
|
36
|
-
- `@featherk/composables` installed
|
|
37
|
-
|
|
38
|
-
Install (if needed)
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm install @featherk/composables
|
|
42
|
-
```
|
|
11
|
+
```ts
|
|
12
|
+
// Date input
|
|
13
|
+
import { useMaskedDateInput, DateChangePayload } from '@featherk/composables/date';
|
|
43
14
|
|
|
44
|
-
|
|
15
|
+
// Date range input
|
|
16
|
+
import { useMaskedDateRangeInput, RangeChangePayload } from '@featherk/composables/range';
|
|
45
17
|
|
|
46
|
-
|
|
18
|
+
// Time input
|
|
19
|
+
import { useMaskedTimeInput, TimeChangePayload } from '@featherk/composables/time';
|
|
47
20
|
|
|
48
|
-
|
|
49
|
-
import {
|
|
50
|
-
import { useGridA11y } from '@featherk/composables';
|
|
51
|
-
|
|
52
|
-
const gridRef = ref(null);
|
|
53
|
-
const dataResult = ref({ data: [] }); // example data container
|
|
54
|
-
|
|
55
|
-
const {
|
|
56
|
-
activeFilterButton,
|
|
57
|
-
handleGridKeyDown,
|
|
58
|
-
handleSortChange,
|
|
59
|
-
initA11y // NEW: must be called after Grid + data are present in DOM
|
|
60
|
-
} = useGridA11y(gridRef);
|
|
21
|
+
// Popup focus trap utilities
|
|
22
|
+
import { usePopupTrap } from '@featherk/composables/trap';
|
|
61
23
|
```
|
|
62
24
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Call `initA11y()` once the Grid element is in the DOM and the initial (non-empty) data set is ready. If data loads async, watch it. `initA11y()` performs initial attribute setup, internal bookkeeping, and prepares focus targets.
|
|
25
|
+
Root imports (types are aliased to avoid name collisions):
|
|
66
26
|
|
|
67
27
|
```ts
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{ immediate: true }
|
|
78
|
-
);
|
|
79
|
-
});
|
|
28
|
+
import {
|
|
29
|
+
useMaskedDateInput,
|
|
30
|
+
DateChangePayload,
|
|
31
|
+
useMaskedDateRangeInput,
|
|
32
|
+
RangeChangePayload,
|
|
33
|
+
useMaskedTimeInput,
|
|
34
|
+
TimeChangePayload,
|
|
35
|
+
usePopupTrap,
|
|
36
|
+
} from '@featherk/composables';
|
|
80
37
|
```
|
|
81
38
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### 3) Wire keyboard handler on the Grid
|
|
39
|
+
## useGridA11y — Integration Quick Reference
|
|
85
40
|
|
|
86
|
-
|
|
41
|
+
## Composables Overview
|
|
87
42
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
```
|
|
43
|
+
- **Grid**: `useGridA11y` — Accessible row-level navigation and column menu keyboard support.
|
|
44
|
+
- Guide: [docs/grid/useGridA11y.md](./docs/grid/useGridA11y.md)
|
|
45
|
+
- **Date**: `useMaskedDateInput` — Masked single-date input with steppers and validation.
|
|
46
|
+
- Guide: [docs/date/useMaskedDateInput.md](./docs/date/useMaskedDateInput.md)
|
|
47
|
+
- **Range**: `useMaskedDateRangeInput` — Masked date range input with validation, clamp, and optional popup coordination.
|
|
48
|
+
- Guide: [docs/range/useMaskedDateRangeInput.md](./docs/range/useMaskedDateRangeInput.md)
|
|
49
|
+
- **Time**: `useMaskedTimeInput` — Masked single-time input with AM/PM conveniences and bounds.
|
|
50
|
+
- Guide: [docs/time/useMaskedTimeInput.md](./docs/time/useMaskedTimeInput.md)
|
|
51
|
+
- **Trap**: `usePopupTrap` — Focus trap + Escape/Outside click close behavior for popups.
|
|
52
|
+
- Guide: [docs/trap/usePopupTrap.md](./docs/trap/usePopupTrap.md)
|
|
99
53
|
|
|
100
|
-
|
|
54
|
+
## Importing
|
|
101
55
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
Kendo Grid `rowRender` allows you to add an `aria-label` so screen readers announce row contents.
|
|
56
|
+
Subpath imports (recommended):
|
|
105
57
|
|
|
106
58
|
```ts
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
};
|
|
59
|
+
import { useGridA11y } from '@featherk/composables/grid';
|
|
60
|
+
import { useMaskedDateInput } from '@featherk/composables/date';
|
|
61
|
+
import { useMaskedDateRangeInput } from '@featherk/composables/range';
|
|
62
|
+
import { useMaskedTimeInput } from '@featherk/composables/time';
|
|
63
|
+
import { usePopupTrap } from '@featherk/composables/trap';
|
|
112
64
|
```
|
|
113
65
|
|
|
114
|
-
|
|
66
|
+
Root import (types are aliased to avoid collisions):
|
|
115
67
|
|
|
116
68
|
```ts
|
|
117
|
-
import {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
69
|
+
import {
|
|
70
|
+
useGridA11y,
|
|
71
|
+
useMaskedDateInput,
|
|
72
|
+
useMaskedDateRangeInput,
|
|
73
|
+
useMaskedTimeInput,
|
|
74
|
+
usePopupTrap,
|
|
75
|
+
} from '@featherk/composables';
|
|
127
76
|
```
|
|
128
77
|
|
|
129
|
-
|
|
78
|
+
## Peer Dependencies
|
|
130
79
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
function onSortChange(event: any) {
|
|
141
|
-
handleSortChange(event, optionalCustomSort);
|
|
142
|
-
}
|
|
80
|
+
- Required: `vue`
|
|
81
|
+
- Optional (for `usePopupTrap`): `@vueuse/core`, `@vueuse/integrations`, `focus-trap`
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm install vue
|
|
85
|
+
# If you use usePopupTrap
|
|
86
|
+
npm install @vueuse/core @vueuse/integrations focus-trap
|
|
143
87
|
```
|
|
144
88
|
|
|
145
|
-
|
|
89
|
+
> Note: VueUse and focus-trap are declared as optional peer dependencies so apps that don’t use `usePopupTrap` aren’t forced to install them. They are present as devDependencies in this repo to enable local type-checking and builds.
|
|
90
|
+
|
|
91
|
+
## Notes
|
|
146
92
|
|
|
147
|
-
-
|
|
148
|
-
- Wait for Grid mount + data, then call `initA11y()`
|
|
149
|
-
- Bind returned keyboard handler to `Grid` `@keydown`
|
|
150
|
-
- Bind returned sort handler to `Grid` `@sortchange` (optionally pass a custom callback)
|
|
151
|
-
- Use returned `activeFilterButton` to manage focus after filter updates
|
|
152
|
-
- Provide a `rowRender` that adds a descriptive `aria-label` for each row
|
|
153
|
-
- Set `navigatable="false"` on the `Grid` to prefer row-level navigation
|
|
93
|
+
- The runtime file `useGridA11y.ts` currently lives at the package root for compatibility. It may move to `src/grid` in a future release, but root exports will remain to avoid breaking imports.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useMaskedDateInput";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Ref } from "vue";
|
|
2
|
+
export type ChangePayload = {
|
|
3
|
+
value: Date | null;
|
|
4
|
+
event: any;
|
|
5
|
+
};
|
|
6
|
+
export declare function useMaskedDateInput(args: {
|
|
7
|
+
id: string;
|
|
8
|
+
onChange: (p: ChangePayload) => void;
|
|
9
|
+
onShowCalendar: (e: KeyboardEvent) => void;
|
|
10
|
+
externalValue?: Ref<string | Date | null | undefined>;
|
|
11
|
+
minDate?: Ref<Date | null | undefined>;
|
|
12
|
+
maxDate?: Ref<Date | null | undefined>;
|
|
13
|
+
dateFormat?: string;
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
}): {
|
|
16
|
+
raw: Ref<string, string>;
|
|
17
|
+
cursorPos: Ref<number, number>;
|
|
18
|
+
debugEnabled: Ref<boolean, boolean>;
|
|
19
|
+
debugLines: import("vue").ComputedRef<string[][]>;
|
|
20
|
+
placeholder: Ref<string, string>;
|
|
21
|
+
isValid: import("vue").ComputedRef<boolean>;
|
|
22
|
+
validationMessage: import("vue").ComputedRef<string>;
|
|
23
|
+
digitsOnly: import("vue").ComputedRef<string>;
|
|
24
|
+
month: Readonly<Ref<string, string>>;
|
|
25
|
+
day: Readonly<Ref<string, string>>;
|
|
26
|
+
year: Readonly<Ref<string, string>>;
|
|
27
|
+
datePart: (pos: number) => "mm" | "dd" | "yyyy";
|
|
28
|
+
handleChange: (event: any) => void;
|
|
29
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
30
|
+
handleWheel: (event: WheelEvent) => void;
|
|
31
|
+
handleKeyUp: (event: KeyboardEvent) => void;
|
|
32
|
+
handleClick: (event: MouseEvent) => void;
|
|
33
|
+
};
|