@servicetitan/anvil2-ext-common 0.1.25 → 0.2.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/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useInputGuards/index.d.ts +1 -0
- package/dist/hooks/useInputGuards/useInputGuards.d.ts +29 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/useInputGuards-DhT8mdGl.js +161 -0
- package/dist/useInputGuards-DhT8mdGl.js.map +1 -0
- package/dist/useInputGuards.d.ts +6 -0
- package/dist/useInputGuards.js +2 -0
- package/dist/useInputGuards.js.map +1 -0
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @servicetitan/anvil2-ext-common
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1999](https://github.com/servicetitan/hammer/pull/1999) [`b7de3d5`](https://github.com/servicetitan/hammer/commit/b7de3d511bb9984c680d4f638509c0e2d356d803) Thanks [@jsphstls](https://github.com/jsphstls)! - [useInputGuards] Add `useInputGuards` hook — debounced text input with rate-limited commits, paste handling, and deduplication
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`a3f4962`](https://github.com/servicetitan/hammer/commit/a3f4962710f4c776159094f29aa070dc92708aa2), [`51e2b40`](https://github.com/servicetitan/hammer/commit/51e2b40dcf95874b481f8e0d17bda7afb082aed5), [`ce5c420`](https://github.com/servicetitan/hammer/commit/ce5c420445f38cefcb50dfa3d111fe782e3cdefe), [`5a2092d`](https://github.com/servicetitan/hammer/commit/5a2092d097fd28c99b4a53a12d5c96ca1b42db18), [`a3f4962`](https://github.com/servicetitan/hammer/commit/a3f4962710f4c776159094f29aa070dc92708aa2), [`a3f4962`](https://github.com/servicetitan/hammer/commit/a3f4962710f4c776159094f29aa070dc92708aa2), [`cee79b8`](https://github.com/servicetitan/hammer/commit/cee79b85f6aa1ea37c20e17f8fe39f316ede5e85), [`a3f4962`](https://github.com/servicetitan/hammer/commit/a3f4962710f4c776159094f29aa070dc92708aa2), [`ac35fc7`](https://github.com/servicetitan/hammer/commit/ac35fc7ca029ed4a0983f08ee581f8a8df7a5a6c), [`b3ba2a2`](https://github.com/servicetitan/hammer/commit/b3ba2a20ef977d0e5701aaed858656f4075922e8), [`ac35fc7`](https://github.com/servicetitan/hammer/commit/ac35fc7ca029ed4a0983f08ee581f8a8df7a5a6c), [`fb6afdd`](https://github.com/servicetitan/hammer/commit/fb6afdd5438c2a0658ced6021751a40e64f06899), [`9401a15`](https://github.com/servicetitan/hammer/commit/9401a151d2afa1a27a67e31438e6f8028d82dbe6), [`51c1a9e`](https://github.com/servicetitan/hammer/commit/51c1a9e240810841f21bf9e180109c690c5db7dc), [`51e2b40`](https://github.com/servicetitan/hammer/commit/51e2b40dcf95874b481f8e0d17bda7afb082aed5)]:
|
|
12
|
+
- @servicetitan/anvil2@2.1.0
|
|
13
|
+
|
|
14
|
+
## 0.1.26
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`c1546dc`](https://github.com/servicetitan/hammer/commit/c1546dc569207a73b610719fe027fb4e187b42e4), [`860d2c7`](https://github.com/servicetitan/hammer/commit/860d2c737d93cff96f1a93f4b16b2457e613dc6f)]:
|
|
19
|
+
- @servicetitan/anvil2@2.0.4
|
|
20
|
+
|
|
3
21
|
## 0.1.25
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ The Design System team intends to give guidance and help with maintaining contri
|
|
|
37
37
|
|
|
38
38
|
## Prerequisites
|
|
39
39
|
|
|
40
|
-
This monorepo requires Node >=
|
|
40
|
+
This monorepo requires Node >= 22 and [pnpm](https://pnpm.io/) >= 10.
|
|
41
41
|
<br />
|
|
42
42
|
To install `pnpm`, please follow the installation instructions at: https://pnpm.io/installation
|
|
43
43
|
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useInputGuards, useInputGuards as default, type UseInputGuardsConfig, type UseInputGuardsProps, } from './useInputGuards';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChangeEventHandler, ClipboardEventHandler, KeyboardEventHandler } from 'react';
|
|
2
|
+
export interface UseInputGuardsProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: ChangeEventHandler<HTMLInputElement>;
|
|
5
|
+
onPaste: ClipboardEventHandler<HTMLInputElement>;
|
|
6
|
+
onKeyDown: KeyboardEventHandler<HTMLInputElement>;
|
|
7
|
+
onClear: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface UseInputGuardsConfig {
|
|
10
|
+
value: string;
|
|
11
|
+
delay: number;
|
|
12
|
+
onCommit: (value: string) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Manages a debounced text input with rate-limited commits.
|
|
16
|
+
*
|
|
17
|
+
* - Typing: visible value updates immediately; `onCommit` fires after `delay` ms of inactivity
|
|
18
|
+
* - Paste / Enter: commits immediately via a commit guard (rate-limited to one per `delay` ms)
|
|
19
|
+
* - Repeated keys: held-key keydown events suppressed with `preventDefault()`
|
|
20
|
+
* - Clear: commits `''` immediately and deactivates the guard
|
|
21
|
+
* - Deduplication: consecutive identical values never committed twice
|
|
22
|
+
* - External sync: when `value` changes externally, local state re-syncs and stale timers cancelled
|
|
23
|
+
* - Unmount: all pending timers cancelled; no trailing commit fires
|
|
24
|
+
*
|
|
25
|
+
* @returns An object with `inputProps` to spread onto the input element.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useInputGuards({ value, delay, onCommit, }: UseInputGuardsConfig): {
|
|
28
|
+
inputProps: UseInputGuardsProps;
|
|
29
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as ExampleComponent } from './ExampleComponent.js';
|
|
2
2
|
export { u as useConfirmDialog } from './useConfirmDialog-DaQ5Golt.js';
|
|
3
|
+
export { u as useInputGuards } from './useInputGuards-DhT8mdGl.js';
|
|
3
4
|
export { default as ExampleProvider } from './ExampleProvider.js';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
function clearTypingTimer(stateRef) {
|
|
4
|
+
if (stateRef.current.typingTimer !== null) {
|
|
5
|
+
clearTimeout(stateRef.current.typingTimer);
|
|
6
|
+
stateRef.current.typingTimer = null;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function clearDeferredTimer(stateRef) {
|
|
10
|
+
if (stateRef.current.deferredTimer !== null) {
|
|
11
|
+
clearTimeout(stateRef.current.deferredTimer);
|
|
12
|
+
stateRef.current.deferredTimer = null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function clearGuardTimer(stateRef) {
|
|
16
|
+
if (stateRef.current.guardTimer !== null) {
|
|
17
|
+
clearTimeout(stateRef.current.guardTimer);
|
|
18
|
+
stateRef.current.guardTimer = null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function clearAllTimers(stateRef) {
|
|
22
|
+
clearTypingTimer(stateRef);
|
|
23
|
+
clearDeferredTimer(stateRef);
|
|
24
|
+
clearGuardTimer(stateRef);
|
|
25
|
+
}
|
|
26
|
+
function activateGuard(stateRef) {
|
|
27
|
+
stateRef.current.guardActive = true;
|
|
28
|
+
clearGuardTimer(stateRef);
|
|
29
|
+
stateRef.current.guardTimer = setTimeout(() => {
|
|
30
|
+
stateRef.current.guardTimer = null;
|
|
31
|
+
stateRef.current.guardActive = false;
|
|
32
|
+
}, stateRef.current.delay);
|
|
33
|
+
}
|
|
34
|
+
function deactivateGuard(stateRef) {
|
|
35
|
+
stateRef.current.guardActive = false;
|
|
36
|
+
clearGuardTimer(stateRef);
|
|
37
|
+
}
|
|
38
|
+
function doCommit(stateRef, val) {
|
|
39
|
+
if (stateRef.current.lastCommitted === val) return;
|
|
40
|
+
stateRef.current.lastCommitted = val;
|
|
41
|
+
activateGuard(stateRef);
|
|
42
|
+
stateRef.current.onCommit(val);
|
|
43
|
+
}
|
|
44
|
+
function guardedCommit(stateRef, val) {
|
|
45
|
+
const wasDeferred = stateRef.current.deferredTimer !== null;
|
|
46
|
+
clearDeferredTimer(stateRef);
|
|
47
|
+
if (!wasDeferred && !stateRef.current.guardActive) {
|
|
48
|
+
doCommit(stateRef, val);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
stateRef.current.deferredTimer = setTimeout(() => {
|
|
52
|
+
stateRef.current.deferredTimer = null;
|
|
53
|
+
doCommit(stateRef, val);
|
|
54
|
+
}, stateRef.current.delay);
|
|
55
|
+
}
|
|
56
|
+
function handleValueChange(stateRef, setLocalValue, newValue) {
|
|
57
|
+
setLocalValue(newValue);
|
|
58
|
+
stateRef.current.localValue = newValue;
|
|
59
|
+
if (newValue === "") {
|
|
60
|
+
clearAllTimers(stateRef);
|
|
61
|
+
doCommit(stateRef, newValue);
|
|
62
|
+
deactivateGuard(stateRef);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
clearTypingTimer(stateRef);
|
|
66
|
+
stateRef.current.typingTimer = setTimeout(() => {
|
|
67
|
+
stateRef.current.typingTimer = null;
|
|
68
|
+
guardedCommit(stateRef, newValue);
|
|
69
|
+
}, stateRef.current.delay);
|
|
70
|
+
}
|
|
71
|
+
function handlePasteValue(stateRef, setLocalValue, pastedValue) {
|
|
72
|
+
setLocalValue(pastedValue);
|
|
73
|
+
stateRef.current.localValue = pastedValue;
|
|
74
|
+
clearTypingTimer(stateRef);
|
|
75
|
+
guardedCommit(stateRef, pastedValue);
|
|
76
|
+
}
|
|
77
|
+
function useInputGuards({
|
|
78
|
+
value,
|
|
79
|
+
delay,
|
|
80
|
+
onCommit
|
|
81
|
+
}) {
|
|
82
|
+
const [localValue, setLocalValue] = useState(value);
|
|
83
|
+
const stateRef = useRef({
|
|
84
|
+
localValue: value,
|
|
85
|
+
renderedLocalValue: value,
|
|
86
|
+
lastCommitted: null,
|
|
87
|
+
guardActive: false,
|
|
88
|
+
externalValue: value,
|
|
89
|
+
onCommit,
|
|
90
|
+
delay,
|
|
91
|
+
typingTimer: null,
|
|
92
|
+
deferredTimer: null,
|
|
93
|
+
guardTimer: null
|
|
94
|
+
});
|
|
95
|
+
stateRef.current.renderedLocalValue = localValue;
|
|
96
|
+
stateRef.current.onCommit = onCommit;
|
|
97
|
+
stateRef.current.delay = delay;
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (value === stateRef.current.externalValue) return;
|
|
100
|
+
stateRef.current.externalValue = value;
|
|
101
|
+
if (value === stateRef.current.lastCommitted) return;
|
|
102
|
+
clearAllTimers(stateRef);
|
|
103
|
+
deactivateGuard(stateRef);
|
|
104
|
+
setLocalValue(value);
|
|
105
|
+
stateRef.current.localValue = value;
|
|
106
|
+
}, [value]);
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
return () => {
|
|
109
|
+
clearAllTimers(stateRef);
|
|
110
|
+
};
|
|
111
|
+
}, []);
|
|
112
|
+
const onChange = useCallback(
|
|
113
|
+
(event) => {
|
|
114
|
+
const newValue = event.target.value;
|
|
115
|
+
if (newValue === stateRef.current.localValue) return;
|
|
116
|
+
if (newValue === stateRef.current.renderedLocalValue) return;
|
|
117
|
+
handleValueChange(stateRef, setLocalValue, newValue);
|
|
118
|
+
},
|
|
119
|
+
[]
|
|
120
|
+
);
|
|
121
|
+
const onPaste = useCallback(
|
|
122
|
+
(event) => {
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
if (!event.clipboardData) return;
|
|
125
|
+
const pastedText = event.clipboardData.getData("text");
|
|
126
|
+
const { selectionStart, selectionEnd } = event.currentTarget;
|
|
127
|
+
const currentValue = stateRef.current.localValue;
|
|
128
|
+
const beforeCursor = currentValue.slice(0, selectionStart ?? 0);
|
|
129
|
+
const afterCursor = currentValue.slice(
|
|
130
|
+
selectionEnd ?? currentValue.length
|
|
131
|
+
);
|
|
132
|
+
handlePasteValue(
|
|
133
|
+
stateRef,
|
|
134
|
+
setLocalValue,
|
|
135
|
+
beforeCursor + pastedText + afterCursor
|
|
136
|
+
);
|
|
137
|
+
},
|
|
138
|
+
[]
|
|
139
|
+
);
|
|
140
|
+
const onKeyDown = useCallback(
|
|
141
|
+
(event) => {
|
|
142
|
+
if (event.repeat) {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (event.key !== "Enter") return;
|
|
147
|
+
clearTypingTimer(stateRef);
|
|
148
|
+
guardedCommit(stateRef, stateRef.current.localValue);
|
|
149
|
+
},
|
|
150
|
+
[]
|
|
151
|
+
);
|
|
152
|
+
const onClear = useCallback(() => {
|
|
153
|
+
handleValueChange(stateRef, setLocalValue, "");
|
|
154
|
+
}, []);
|
|
155
|
+
return {
|
|
156
|
+
inputProps: { value: localValue, onChange, onPaste, onKeyDown, onClear }
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export { useInputGuards as u };
|
|
161
|
+
//# sourceMappingURL=useInputGuards-DhT8mdGl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInputGuards-DhT8mdGl.js","sources":["../src/hooks/useInputGuards/useInputGuards.ts"],"sourcesContent":["import {\n useCallback,\n useEffect,\n useRef,\n useState,\n type ChangeEventHandler,\n type ClipboardEventHandler,\n type KeyboardEventHandler,\n} from \"react\";\n\nexport interface UseInputGuardsProps {\n value: string;\n onChange: ChangeEventHandler<HTMLInputElement>;\n onPaste: ClipboardEventHandler<HTMLInputElement>;\n onKeyDown: KeyboardEventHandler<HTMLInputElement>;\n onClear: () => void;\n}\n\nexport interface UseInputGuardsConfig {\n value: string;\n delay: number;\n onCommit: (value: string) => void;\n}\n\ninterface State {\n localValue: string;\n renderedLocalValue: string;\n lastCommitted: string | null;\n guardActive: boolean;\n externalValue: string;\n onCommit: (value: string) => void;\n delay: number;\n typingTimer: ReturnType<typeof setTimeout> | null;\n deferredTimer: ReturnType<typeof setTimeout> | null;\n guardTimer: ReturnType<typeof setTimeout> | null;\n}\n\ninterface StateRef {\n current: State;\n}\n\nfunction clearTypingTimer(stateRef: StateRef) {\n if (stateRef.current.typingTimer !== null) {\n clearTimeout(stateRef.current.typingTimer);\n stateRef.current.typingTimer = null;\n }\n}\n\nfunction clearDeferredTimer(stateRef: StateRef) {\n if (stateRef.current.deferredTimer !== null) {\n clearTimeout(stateRef.current.deferredTimer);\n stateRef.current.deferredTimer = null;\n }\n}\n\nfunction clearGuardTimer(stateRef: StateRef) {\n if (stateRef.current.guardTimer !== null) {\n clearTimeout(stateRef.current.guardTimer);\n stateRef.current.guardTimer = null;\n }\n}\n\nfunction clearAllTimers(stateRef: StateRef) {\n clearTypingTimer(stateRef);\n clearDeferredTimer(stateRef);\n clearGuardTimer(stateRef);\n}\n\nfunction activateGuard(stateRef: StateRef) {\n stateRef.current.guardActive = true;\n clearGuardTimer(stateRef);\n\n stateRef.current.guardTimer = setTimeout(() => {\n stateRef.current.guardTimer = null;\n stateRef.current.guardActive = false;\n }, stateRef.current.delay);\n}\n\nfunction deactivateGuard(stateRef: StateRef) {\n stateRef.current.guardActive = false;\n clearGuardTimer(stateRef);\n}\n\nfunction doCommit(stateRef: StateRef, val: string) {\n if (stateRef.current.lastCommitted === val) return;\n\n stateRef.current.lastCommitted = val;\n activateGuard(stateRef);\n stateRef.current.onCommit(val);\n}\n\nfunction guardedCommit(stateRef: StateRef, val: string) {\n const wasDeferred = stateRef.current.deferredTimer !== null;\n clearDeferredTimer(stateRef);\n\n if (!wasDeferred && !stateRef.current.guardActive) {\n doCommit(stateRef, val);\n return;\n }\n\n stateRef.current.deferredTimer = setTimeout(() => {\n stateRef.current.deferredTimer = null;\n doCommit(stateRef, val);\n }, stateRef.current.delay);\n}\n\nfunction handleValueChange(\n stateRef: StateRef,\n setLocalValue: (value: string) => void,\n newValue: string,\n) {\n setLocalValue(newValue);\n stateRef.current.localValue = newValue;\n\n if (newValue === \"\") {\n clearAllTimers(stateRef);\n doCommit(stateRef, newValue);\n deactivateGuard(stateRef);\n return;\n }\n\n clearTypingTimer(stateRef);\n stateRef.current.typingTimer = setTimeout(() => {\n stateRef.current.typingTimer = null;\n guardedCommit(stateRef, newValue);\n }, stateRef.current.delay);\n}\n\nfunction handlePasteValue(\n stateRef: StateRef,\n setLocalValue: (value: string) => void,\n pastedValue: string,\n) {\n setLocalValue(pastedValue);\n stateRef.current.localValue = pastedValue;\n\n clearTypingTimer(stateRef);\n guardedCommit(stateRef, pastedValue);\n}\n\n/**\n * Manages a debounced text input with rate-limited commits.\n *\n * - Typing: visible value updates immediately; `onCommit` fires after `delay` ms of inactivity\n * - Paste / Enter: commits immediately via a commit guard (rate-limited to one per `delay` ms)\n * - Repeated keys: held-key keydown events suppressed with `preventDefault()`\n * - Clear: commits `''` immediately and deactivates the guard\n * - Deduplication: consecutive identical values never committed twice\n * - External sync: when `value` changes externally, local state re-syncs and stale timers cancelled\n * - Unmount: all pending timers cancelled; no trailing commit fires\n *\n * @returns An object with `inputProps` to spread onto the input element.\n */\nexport function useInputGuards({\n value,\n delay,\n onCommit,\n}: UseInputGuardsConfig): { inputProps: UseInputGuardsProps } {\n const [localValue, setLocalValue] = useState(value);\n\n const stateRef = useRef<State>({\n localValue: value,\n renderedLocalValue: value,\n lastCommitted: null,\n guardActive: false,\n externalValue: value,\n onCommit,\n delay,\n typingTimer: null,\n deferredTimer: null,\n guardTimer: null,\n });\n\n stateRef.current.renderedLocalValue = localValue;\n stateRef.current.onCommit = onCommit;\n stateRef.current.delay = delay;\n\n useEffect(() => {\n if (value === stateRef.current.externalValue) return;\n\n stateRef.current.externalValue = value;\n\n if (value === stateRef.current.lastCommitted) return; // own commit bouncing back\n\n clearAllTimers(stateRef);\n deactivateGuard(stateRef);\n setLocalValue(value);\n stateRef.current.localValue = value;\n }, [value]);\n\n useEffect(() => {\n return () => {\n clearAllTimers(stateRef);\n };\n }, []);\n\n const onChange: ChangeEventHandler<HTMLInputElement> = useCallback(\n (event) => {\n const newValue = event.target.value;\n\n if (newValue === stateRef.current.localValue) return;\n if (newValue === stateRef.current.renderedLocalValue) return; // spurious post-paste event\n\n handleValueChange(stateRef, setLocalValue, newValue);\n },\n [],\n );\n\n const onPaste: ClipboardEventHandler<HTMLInputElement> = useCallback(\n (event) => {\n event.preventDefault();\n\n if (!event.clipboardData) return;\n\n const pastedText = event.clipboardData.getData(\"text\");\n const { selectionStart, selectionEnd } = event.currentTarget;\n const currentValue = stateRef.current.localValue;\n const beforeCursor = currentValue.slice(0, selectionStart ?? 0);\n const afterCursor = currentValue.slice(\n selectionEnd ?? currentValue.length,\n );\n\n handlePasteValue(\n stateRef,\n setLocalValue,\n beforeCursor + pastedText + afterCursor,\n );\n },\n [],\n );\n\n const onKeyDown: KeyboardEventHandler<HTMLInputElement> = useCallback(\n (event) => {\n if (event.repeat) {\n event.preventDefault();\n return;\n }\n if (event.key !== \"Enter\") return;\n\n clearTypingTimer(stateRef);\n guardedCommit(stateRef, stateRef.current.localValue);\n },\n [],\n );\n\n const onClear = useCallback(() => {\n handleValueChange(stateRef, setLocalValue, \"\");\n }, []);\n\n return {\n inputProps: { value: localValue, onChange, onPaste, onKeyDown, onClear },\n };\n}\n"],"names":[],"mappings":";;AAyCA,SAAS,iBAAiB,QAAA,EAAoB;AAC5C,EAAA,IAAI,QAAA,CAAS,OAAA,CAAQ,WAAA,KAAgB,IAAA,EAAM;AACzC,IAAA,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gBAAA;AAAA,QACE,QAAA;AAAA,QACA,aAAA;AAAA,QACA,eAAe,UAAA,GAAa;AAAA,OAC9B;AAAA,IACF,CAAA;AAAA,IACA;AAAC,GACH;AAEA,EAAA,MAAM,SAAA,GAAoD,WAAA;AAAA,IACxD,CAAC,KAAA,KAAU;AACT,MAAA,IAAI,MAAM,MAAA,EAAQ;AAChB,QAAA,KAAA,CAAM,cAAA,EAAe;AACrB,QAAA;AAAA,MACF;AACA,MAAA,IAAI,KAAA,CAAM,QAAQ,OAAA,EAAS;AAE3B,MAAA,gBAAA,CAAiB,QAAQ,CAAA;AACzB,MAAA,aAAA,CAAc,QAAA,EAAU,QAAA,CAAS,OAAA,CAAQ,UAAU,CAAA;AAAA,IACrD,CAAA;AAAA,IACA;AAAC,GACH;AAEA,EAAA,MAAM,OAAA,GAAU,YAAY,MAAM;AAChC,IAAA,iBAAA,CAAkB,QAAA,EAAU,eAAe,EAAE,CAAA;AAAA,EAC/C,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO;AAAA,IACL,YAAY,EAAE,KAAA,EAAO,YAAY,QAAA,EAAU,OAAA,EAAS,WAAW,OAAA;AAAQ,GACzE;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInputGuards.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/anvil2-ext-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"tabbable": "^6.2.0",
|
|
32
32
|
"tinycolor2": "^1.6.0",
|
|
33
33
|
"uuid": "^10.0.0",
|
|
34
|
-
"@servicetitan/anvil2": "2.0
|
|
34
|
+
"@servicetitan/anvil2": "2.1.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@types/react": "^18 || ^19",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"react-dom": "^18 || ^19"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@chromatic-com/storybook": "^
|
|
44
|
-
"@storybook/addon-a11y": "
|
|
45
|
-
"@storybook/addon-docs": "
|
|
46
|
-
"@storybook/addon-links": "
|
|
47
|
-
"@storybook/addon-vitest": "
|
|
48
|
-
"@storybook/react-vite": "
|
|
43
|
+
"@chromatic-com/storybook": "^5.0.1",
|
|
44
|
+
"@storybook/addon-a11y": "10.2.9",
|
|
45
|
+
"@storybook/addon-docs": "10.2.9",
|
|
46
|
+
"@storybook/addon-links": "10.2.9",
|
|
47
|
+
"@storybook/addon-vitest": "10.2.9",
|
|
48
|
+
"@storybook/react-vite": "10.2.9",
|
|
49
49
|
"@testing-library/jest-dom": "^5.17.0",
|
|
50
50
|
"@testing-library/react": "^16.1.0",
|
|
51
51
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"remark-parse": "^11.0.0",
|
|
74
74
|
"remark-stringify": "^11.0.0",
|
|
75
75
|
"sass": "1.87.0",
|
|
76
|
-
"storybook": "
|
|
76
|
+
"storybook": "10.2.9",
|
|
77
77
|
"svgo": "^3.3.2",
|
|
78
78
|
"typescript": "~5.7.2",
|
|
79
79
|
"unified": "^11.0.5",
|