@featherk/composables 0.7.5 → 0.8.1

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 CHANGED
@@ -16,6 +16,8 @@ Vue 3 composables that improve Kendo UI for Vue behavior and accessibility.
16
16
  - Guide: [docs/time/useMaskedTimeInput.md](https://github.com/NantHealth/featherk/blob/integration/packages/composables/docs/time/useMaskedTimeInput.md)
17
17
  - **Trap**: `usePopupTrap` — Focus trap + Escape/Outside click close behavior for popups.
18
18
  - Guide: [docs/trap/usePopupTrap.md](https://github.com/NantHealth/featherk/blob/integration/packages/composables/docs/trap/usePopupTrap.md)
19
+ - **Address**: `useZipTextBox` — Dynamic multi-mask ZIP code input (5-digit and ZIP+4) for Kendo Vue `TextBox`, with caret preservation, submit-gated validation, and focus-on-error support.
20
+ - Guide: [docs/address/useZipTextBox.md](https://github.com/NantHealth/featherk/blob/integration/packages/composables/docs/address/useZipTextBox.md)
19
21
 
20
22
  ## Importing Composables
21
23
 
@@ -38,6 +40,9 @@ import { useMaskedTimeInput, type TimeChangePayload } from '@featherk/composable
38
40
 
39
41
  // Popup focus trap utilities
40
42
  import { usePopupTrap } from '@featherk/composables/trap';
43
+
44
+ // Address utilities
45
+ import { useZipTextBox } from '@featherk/composables/address';
41
46
  ```
42
47
 
43
48
  Root imports (types are aliased to avoid name collisions):
@@ -53,6 +58,7 @@ import {
53
58
  useMaskedTimeInput,
54
59
  type TimeChangePayload,
55
60
  usePopupTrap,
61
+ useZipTextBox,
56
62
  } from '@featherk/composables';
57
63
  ```
58
64
 
@@ -0,0 +1,2 @@
1
+ export { useZipTextBox } from "./useZipTextBox";
2
+ export type { ZipPayload, UseZipTextBoxOptions, UseZipTextBoxState, UseZipTextBoxBindings, UseZipTextBoxDerived, UseZipTextBoxActions, UseZipTextBoxApi, } from "./useZipTextBox";
@@ -0,0 +1,38 @@
1
+ import type { ComputedRef, Ref } from "vue";
2
+ export type ZipPayload = {
3
+ zip: string;
4
+ };
5
+ export type UseZipTextBoxOptions = {
6
+ /** The `id` of the Kendo `TextBox` input element. Must match the `id` prop
7
+ * passed to `<TextBox>`. Used by `submitAndValidate({ focus: true })` to focus
8
+ * the field when validation fails. */
9
+ id: string;
10
+ initialValue?: string;
11
+ errorMessage?: string;
12
+ };
13
+ export type UseZipTextBoxState = {
14
+ zipDisplay: Ref<string>;
15
+ submitted: Ref<boolean>;
16
+ errorMessage: Ref<string>;
17
+ };
18
+ export type UseZipTextBoxBindings = {
19
+ /** Bind to `:wrapperClass` on `<TextBox>` so Kendo applies `fk-zip-textbox`
20
+ * to its wrapper element on every render — no manual DOM manipulation needed. */
21
+ readonly wrapperClass: string;
22
+ };
23
+ export type UseZipTextBoxDerived = {
24
+ readonly zipRaw: ComputedRef<string>;
25
+ readonly isZipValid: ComputedRef<boolean>;
26
+ readonly showZipError: ComputedRef<boolean>;
27
+ readonly textBoxValid: ComputedRef<boolean>;
28
+ readonly textBoxValidate: ComputedRef<boolean>;
29
+ };
30
+ export type UseZipTextBoxActions = {
31
+ handleZipInput: (...args: unknown[]) => void;
32
+ submitAndValidate: (opts?: {
33
+ focus?: boolean;
34
+ }) => boolean;
35
+ buildPayload: () => ZipPayload;
36
+ };
37
+ export type UseZipTextBoxApi = {} & UseZipTextBoxState & UseZipTextBoxBindings & UseZipTextBoxDerived & UseZipTextBoxActions;
38
+ export declare const useZipTextBox: (options: UseZipTextBoxOptions) => UseZipTextBoxApi;
@@ -0,0 +1 @@
1
+ export {};