@accelint/design-toolkit 9.11.0 → 9.11.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.
Files changed (253) hide show
  1. package/catalog-info.yaml +1 -1
  2. package/dist/components/accordion/context.d.ts +2 -2
  3. package/dist/components/accordion/group.d.ts +2 -2
  4. package/dist/components/accordion/header.d.ts +2 -2
  5. package/dist/components/accordion/index.d.ts +2 -2
  6. package/dist/components/accordion/panel.d.ts +2 -2
  7. package/dist/components/accordion/trigger.d.ts +2 -2
  8. package/dist/components/action-bar/index.d.ts +2 -2
  9. package/dist/components/avatar/context.d.ts +2 -2
  10. package/dist/components/avatar/index.d.ts +2 -2
  11. package/dist/components/badge/context.d.ts +4 -4
  12. package/dist/components/badge/index.d.ts +2 -2
  13. package/dist/components/breadcrumbs/index.d.ts +2 -2
  14. package/dist/components/breadcrumbs/item.d.ts +2 -2
  15. package/dist/components/button/context.d.ts +8 -8
  16. package/dist/components/button/index.d.ts +2 -2
  17. package/dist/components/button/link.d.ts +2 -2
  18. package/dist/components/button/toggle.d.ts +2 -2
  19. package/dist/components/carousel/context.d.ts +2 -2
  20. package/dist/components/carousel/gallery.d.ts +2 -2
  21. package/dist/components/carousel/index.d.ts +2 -2
  22. package/dist/components/carousel/navigation.d.ts +3 -3
  23. package/dist/components/carousel/viewer.d.ts +2 -2
  24. package/dist/components/checkbox/context.d.ts +3 -3
  25. package/dist/components/checkbox/group.d.ts +2 -2
  26. package/dist/components/checkbox/index.d.ts +2 -2
  27. package/dist/components/chip/context.d.ts +4 -4
  28. package/dist/components/chip/deletable.d.ts +2 -2
  29. package/dist/components/chip/index.d.ts +2 -2
  30. package/dist/components/chip/list.d.ts +4 -4
  31. package/dist/components/chip/selectable.d.ts +2 -2
  32. package/dist/components/classification-badge/context.d.ts +4 -4
  33. package/dist/components/classification-badge/index.d.ts +2 -2
  34. package/dist/components/classification-banner/context.d.ts +4 -4
  35. package/dist/components/classification-banner/index.d.ts +2 -2
  36. package/dist/components/clock/index.d.ts +2 -2
  37. package/dist/components/color-picker/index.d.ts +2 -2
  38. package/dist/components/combobox-field/context.d.ts +4 -4
  39. package/dist/components/combobox-field/index.d.ts +2 -2
  40. package/dist/components/combobox-field/styles.module.css +11 -2
  41. package/dist/components/coordinate-field/context.d.ts +6 -6
  42. package/dist/components/coordinate-field/coordinate-utils.js +2 -0
  43. package/dist/components/coordinate-field/coordinate-utils.js.map +1 -1
  44. package/dist/components/coordinate-field/index.d.ts +2 -2
  45. package/dist/components/coordinate-field/index.js +1 -0
  46. package/dist/components/coordinate-field/index.js.map +1 -1
  47. package/dist/components/coordinate-field/segment.d.ts +2 -2
  48. package/dist/components/date-field/index.d.ts +2 -2
  49. package/dist/components/deferred-collection/index.d.ts +2 -2
  50. package/dist/components/details-list/context.d.ts +4 -4
  51. package/dist/components/details-list/index.d.ts +2 -2
  52. package/dist/components/details-list/label.d.ts +2 -2
  53. package/dist/components/details-list/value.d.ts +2 -2
  54. package/dist/components/dialog/content.d.ts +2 -2
  55. package/dist/components/dialog/context.d.ts +2 -2
  56. package/dist/components/dialog/footer.d.ts +2 -2
  57. package/dist/components/dialog/index.d.ts +2 -2
  58. package/dist/components/dialog/title.d.ts +2 -2
  59. package/dist/components/divider/context.d.ts +4 -4
  60. package/dist/components/divider/index.d.ts +2 -2
  61. package/dist/components/drawer/back.d.ts +2 -2
  62. package/dist/components/drawer/close.d.ts +2 -2
  63. package/dist/components/drawer/content.d.ts +2 -2
  64. package/dist/components/drawer/context.d.ts +2 -2
  65. package/dist/components/drawer/footer.d.ts +2 -2
  66. package/dist/components/drawer/header-title.d.ts +2 -2
  67. package/dist/components/drawer/header.d.ts +2 -2
  68. package/dist/components/drawer/index.d.ts +2 -2
  69. package/dist/components/drawer/layout-main.d.ts +2 -2
  70. package/dist/components/drawer/layout.d.ts +2 -2
  71. package/dist/components/drawer/menu-item.d.ts +2 -2
  72. package/dist/components/drawer/menu.d.ts +2 -2
  73. package/dist/components/drawer/panel.d.ts +2 -2
  74. package/dist/components/drawer/styles.module.css +60 -113
  75. package/dist/components/drawer/trigger.d.ts +2 -2
  76. package/dist/components/drawer/view.d.ts +2 -2
  77. package/dist/components/flashcard/index.d.ts +9 -9
  78. package/dist/components/floating-card/context.d.ts +2 -2
  79. package/dist/components/floating-card/index.d.ts +2 -2
  80. package/dist/components/floating-card/provider.d.ts +2 -2
  81. package/dist/components/gantt/components/base-elements/point.d.ts +2 -2
  82. package/dist/components/gantt/components/base-elements/range.d.ts +2 -2
  83. package/dist/components/gantt/components/containers/external/gantt-content-container/index.d.ts +2 -2
  84. package/dist/components/gantt/components/containers/external/gantt-panel-container/index.d.ts +2 -2
  85. package/dist/components/gantt/components/containers/internal/index.d.ts +2 -2
  86. package/dist/components/gantt/components/containers/internal/layout-container/index.d.ts +2 -2
  87. package/dist/components/gantt/components/containers/internal/virtualized-content-height-container/index.d.ts +2 -2
  88. package/dist/components/gantt/components/content-row/block.d.ts +2 -2
  89. package/dist/components/gantt/components/content-row/bracket.d.ts +3 -3
  90. package/dist/components/gantt/components/content-row/icon-marker.d.ts +2 -2
  91. package/dist/components/gantt/components/content-row/index.d.ts +2 -2
  92. package/dist/components/gantt/components/content-row/marker.d.ts +2 -2
  93. package/dist/components/gantt/components/content-row/spacer.d.ts +2 -2
  94. package/dist/components/gantt/components/current-time/index.d.ts +2 -2
  95. package/dist/components/gantt/components/header/index.d.ts +3 -3
  96. package/dist/components/gantt/components/panel-row/index.d.ts +2 -2
  97. package/dist/components/gantt/components/rows-virtualizer/index.d.ts +3 -3
  98. package/dist/components/gantt/components/timeline/index.d.ts +2 -2
  99. package/dist/components/gantt/components/timeline-chunk/index.d.ts +3 -3
  100. package/dist/components/gantt/context/index.d.ts +4 -4
  101. package/dist/components/gantt/context/store/index.d.ts +4 -4
  102. package/dist/components/gantt/context/temporal-data/index.d.ts +2 -2
  103. package/dist/components/hero/context.d.ts +2 -2
  104. package/dist/components/hero/index.d.ts +2 -2
  105. package/dist/components/hero/subtitle.d.ts +3 -3
  106. package/dist/components/hero/title.d.ts +3 -3
  107. package/dist/components/hotkey/context.d.ts +4 -4
  108. package/dist/components/hotkey/index.d.ts +2 -2
  109. package/dist/components/hotkey/set.d.ts +2 -2
  110. package/dist/components/icon/context.d.ts +4 -4
  111. package/dist/components/icon/index.d.ts +2 -2
  112. package/dist/components/input/context.d.ts +2 -2
  113. package/dist/components/input/index.d.ts +2 -2
  114. package/dist/components/kanban/card-body.d.ts +2 -2
  115. package/dist/components/kanban/card-header-actions.d.ts +2 -2
  116. package/dist/components/kanban/card-header-title.d.ts +2 -2
  117. package/dist/components/kanban/card-header.d.ts +2 -2
  118. package/dist/components/kanban/card.d.ts +2 -2
  119. package/dist/components/kanban/column-actions.d.ts +2 -2
  120. package/dist/components/kanban/column-container.d.ts +2 -2
  121. package/dist/components/kanban/column-content.d.ts +2 -2
  122. package/dist/components/kanban/column-header-actions.d.ts +2 -2
  123. package/dist/components/kanban/column-header-drag-handle.d.ts +2 -2
  124. package/dist/components/kanban/column-header-title.d.ts +2 -2
  125. package/dist/components/kanban/column-header.d.ts +2 -2
  126. package/dist/components/kanban/column.d.ts +2 -2
  127. package/dist/components/kanban/context.d.ts +2 -2
  128. package/dist/components/kanban/header-actions.d.ts +2 -2
  129. package/dist/components/kanban/header-search.d.ts +2 -2
  130. package/dist/components/kanban/header-title.d.ts +2 -2
  131. package/dist/components/kanban/header.d.ts +2 -2
  132. package/dist/components/kanban/kanban.d.ts +4 -4
  133. package/dist/components/label/context.d.ts +4 -4
  134. package/dist/components/label/index.d.ts +2 -2
  135. package/dist/components/lines/index.d.ts +2 -2
  136. package/dist/components/link/context.d.ts +2 -2
  137. package/dist/components/link/index.d.ts +2 -2
  138. package/dist/components/list/context.d.ts +2 -2
  139. package/dist/components/list/index.d.ts +2 -2
  140. package/dist/components/list/item-content.d.ts +2 -2
  141. package/dist/components/list/item-description.d.ts +2 -2
  142. package/dist/components/list/item-title.d.ts +2 -2
  143. package/dist/components/list/item.d.ts +2 -2
  144. package/dist/components/media-controls/context.d.ts +4 -4
  145. package/dist/components/media-controls/fullscreen-button.d.ts +2 -2
  146. package/dist/components/media-controls/index.d.ts +2 -2
  147. package/dist/components/media-controls/mute-button.d.ts +2 -2
  148. package/dist/components/media-controls/play-button.d.ts +2 -2
  149. package/dist/components/media-controls/playback-rate.d.ts +2 -2
  150. package/dist/components/media-controls/seek-button.d.ts +2 -2
  151. package/dist/components/media-controls/time-display.d.ts +2 -2
  152. package/dist/components/media-controls/time-range.d.ts +2 -2
  153. package/dist/components/media-controls/volume-slider.d.ts +2 -2
  154. package/dist/components/menu/context.d.ts +2 -2
  155. package/dist/components/menu/index.d.ts +2 -2
  156. package/dist/components/menu/item-description.d.ts +2 -2
  157. package/dist/components/menu/item-label.d.ts +2 -2
  158. package/dist/components/menu/item.d.ts +2 -2
  159. package/dist/components/menu/section.d.ts +2 -2
  160. package/dist/components/menu/separator.d.ts +2 -2
  161. package/dist/components/menu/submenu.d.ts +2 -2
  162. package/dist/components/notice/index.d.ts +2 -2
  163. package/dist/components/notice/list.d.ts +2 -2
  164. package/dist/components/notice/notice-icon.d.ts +2 -2
  165. package/dist/components/options/context.d.ts +2 -2
  166. package/dist/components/options/index.d.ts +2 -2
  167. package/dist/components/options/item-content.d.ts +2 -2
  168. package/dist/components/options/item-description.d.ts +2 -2
  169. package/dist/components/options/item-label.d.ts +2 -2
  170. package/dist/components/options/item.d.ts +2 -2
  171. package/dist/components/options/section.d.ts +2 -2
  172. package/dist/components/pagination/context.d.ts +2 -2
  173. package/dist/components/pagination/index.d.ts +2 -2
  174. package/dist/components/pagination/next.d.ts +2 -2
  175. package/dist/components/pagination/pages.d.ts +2 -2
  176. package/dist/components/pagination/prev.d.ts +2 -2
  177. package/dist/components/popover/content.d.ts +2 -2
  178. package/dist/components/popover/footer.d.ts +2 -2
  179. package/dist/components/popover/index.d.ts +2 -2
  180. package/dist/components/popover/title.d.ts +2 -2
  181. package/dist/components/popover/trigger.d.ts +2 -2
  182. package/dist/components/query-builder/action-element.d.ts +2 -2
  183. package/dist/components/query-builder/actions.d.ts +4 -4
  184. package/dist/components/query-builder/combinator-selector.d.ts +2 -2
  185. package/dist/components/query-builder/index.d.ts +2 -2
  186. package/dist/components/query-builder/rule-group.d.ts +4 -4
  187. package/dist/components/query-builder/rule.d.ts +2 -2
  188. package/dist/components/query-builder/value-editor.d.ts +2 -2
  189. package/dist/components/query-builder/value-selector.d.ts +2 -2
  190. package/dist/components/radio/context.d.ts +3 -3
  191. package/dist/components/radio/group.d.ts +2 -2
  192. package/dist/components/radio/index.d.ts +2 -2
  193. package/dist/components/search-field/context.d.ts +4 -4
  194. package/dist/components/search-field/index.d.ts +2 -2
  195. package/dist/components/select-field/context.d.ts +4 -4
  196. package/dist/components/select-field/index.d.ts +2 -2
  197. package/dist/components/sidenav/avatar.d.ts +2 -2
  198. package/dist/components/sidenav/content.d.ts +2 -2
  199. package/dist/components/sidenav/context.d.ts +2 -2
  200. package/dist/components/sidenav/footer.d.ts +2 -2
  201. package/dist/components/sidenav/header.d.ts +2 -2
  202. package/dist/components/sidenav/index.d.ts +2 -2
  203. package/dist/components/sidenav/item.d.ts +2 -2
  204. package/dist/components/sidenav/link.d.ts +2 -2
  205. package/dist/components/sidenav/menu-item.d.ts +2 -2
  206. package/dist/components/sidenav/menu.d.ts +2 -2
  207. package/dist/components/sidenav/trigger.d.ts +2 -2
  208. package/dist/components/skeleton/index.d.ts +2 -2
  209. package/dist/components/slider/index.d.ts +2 -2
  210. package/dist/components/status-indicator/index.d.ts +2 -2
  211. package/dist/components/switch/context.d.ts +4 -4
  212. package/dist/components/switch/index.d.ts +2 -2
  213. package/dist/components/table/body.d.ts +2 -2
  214. package/dist/components/table/cell.d.ts +2 -2
  215. package/dist/components/table/context.d.ts +2 -2
  216. package/dist/components/table/header-cell.d.ts +2 -2
  217. package/dist/components/table/header.d.ts +2 -2
  218. package/dist/components/table/index.d.ts +2 -2
  219. package/dist/components/table/row.d.ts +2 -2
  220. package/dist/components/tabs/context.d.ts +6 -6
  221. package/dist/components/tabs/index.d.ts +2 -2
  222. package/dist/components/tabs/list.d.ts +2 -2
  223. package/dist/components/tabs/panel.d.ts +2 -2
  224. package/dist/components/tabs/tab.d.ts +2 -2
  225. package/dist/components/text-area-field/context.d.ts +4 -4
  226. package/dist/components/text-area-field/index.d.ts +2 -2
  227. package/dist/components/text-field/context.d.ts +4 -4
  228. package/dist/components/text-field/index.d.ts +2 -2
  229. package/dist/components/time-field/index.d.ts +2 -2
  230. package/dist/components/tooltip/context.d.ts +2 -2
  231. package/dist/components/tooltip/index.d.ts +2 -2
  232. package/dist/components/tooltip/trigger.d.ts +2 -2
  233. package/dist/components/tree/context.d.ts +3 -3
  234. package/dist/components/tree/index.d.ts +2 -2
  235. package/dist/components/tree/item-actions.d.ts +2 -2
  236. package/dist/components/tree/item-content.d.ts +2 -2
  237. package/dist/components/tree/item-description.d.ts +2 -2
  238. package/dist/components/tree/item-label.d.ts +2 -2
  239. package/dist/components/tree/item-prefix-icon.d.ts +2 -2
  240. package/dist/components/tree/item.d.ts +2 -2
  241. package/dist/components/tree/lines.d.ts +2 -2
  242. package/dist/components/video/index.d.ts +2 -2
  243. package/dist/components/view-stack/index.d.ts +2 -2
  244. package/dist/components/view-stack/trigger.d.ts +2 -2
  245. package/dist/components/view-stack/view.d.ts +2 -2
  246. package/dist/hooks/coordinate-field/use-coordinate-field-state.d.ts +2 -0
  247. package/dist/hooks/coordinate-field/use-coordinate-field-state.js +15 -2
  248. package/dist/hooks/coordinate-field/use-coordinate-field-state.js.map +1 -1
  249. package/dist/hooks/coordinate-field/use-coordinate-paste.js +27 -4
  250. package/dist/hooks/coordinate-field/use-coordinate-paste.js.map +1 -1
  251. package/dist/providers/portal.d.ts +2 -2
  252. package/dist/providers/theme-provider.d.ts +2 -2
  253. package/package.json +8 -8
@@ -13,13 +13,13 @@
13
13
  import { ProviderProps } from "../../lib/types.js";
14
14
  import { TextAreaFieldProps } from "./types.js";
15
15
  import "client-only";
16
- import * as react49 from "react";
17
- import * as react_jsx_runtime196 from "react/jsx-runtime";
16
+ import * as react46 from "react";
17
+ import * as react_jsx_runtime191 from "react/jsx-runtime";
18
18
  import { ContextValue } from "react-aria-components/slots";
19
19
 
20
20
  //#region src/components/text-area-field/context.d.ts
21
21
  /** Context for sharing props across TextAreaField components */
22
- declare const TextAreaFieldContext: react49.Context<ContextValue<TextAreaFieldProps, HTMLDivElement>>;
22
+ declare const TextAreaFieldContext: react46.Context<ContextValue<TextAreaFieldProps, HTMLDivElement>>;
23
23
  /**
24
24
  * Sets default props for all TextAreaField components within.
25
25
  *
@@ -42,7 +42,7 @@ declare const TextAreaFieldContext: react49.Context<ContextValue<TextAreaFieldPr
42
42
  declare function TextAreaFieldProvider({
43
43
  children,
44
44
  ...props
45
- }: ProviderProps<TextAreaFieldProps>): react_jsx_runtime196.JSX.Element;
45
+ }: ProviderProps<TextAreaFieldProps>): react_jsx_runtime191.JSX.Element;
46
46
  //#endregion
47
47
  export { TextAreaFieldContext, TextAreaFieldProvider };
48
48
  //# sourceMappingURL=context.d.ts.map
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { TextAreaFieldProps } from "./types.js";
14
14
  import "client-only";
15
- import * as react_jsx_runtime197 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime192 from "react/jsx-runtime";
16
16
 
17
17
  //#region src/components/text-area-field/index.d.ts
18
18
 
@@ -44,7 +44,7 @@ import * as react_jsx_runtime197 from "react/jsx-runtime";
44
44
  declare function TextAreaField({
45
45
  ref,
46
46
  ...props
47
- }: TextAreaFieldProps): react_jsx_runtime197.JSX.Element;
47
+ }: TextAreaFieldProps): react_jsx_runtime192.JSX.Element;
48
48
  //#endregion
49
49
  export { TextAreaField };
50
50
  //# sourceMappingURL=index.d.ts.map
@@ -13,13 +13,13 @@
13
13
  import { ProviderProps } from "../../lib/types.js";
14
14
  import { TextFieldProps } from "./types.js";
15
15
  import "client-only";
16
- import * as react48 from "react";
17
- import * as react_jsx_runtime194 from "react/jsx-runtime";
16
+ import * as react45 from "react";
17
+ import * as react_jsx_runtime189 from "react/jsx-runtime";
18
18
  import { ContextValue } from "react-aria-components/slots";
19
19
 
20
20
  //#region src/components/text-field/context.d.ts
21
21
  /** Context for sharing props across TextField components */
22
- declare const TextFieldContext: react48.Context<ContextValue<TextFieldProps, HTMLDivElement>>;
22
+ declare const TextFieldContext: react45.Context<ContextValue<TextFieldProps, HTMLDivElement>>;
23
23
  /**
24
24
  * Sets default props for all TextField components within.
25
25
  *
@@ -42,7 +42,7 @@ declare const TextFieldContext: react48.Context<ContextValue<TextFieldProps, HTM
42
42
  declare function TextFieldProvider({
43
43
  children,
44
44
  ...props
45
- }: ProviderProps<TextFieldProps>): react_jsx_runtime194.JSX.Element;
45
+ }: ProviderProps<TextFieldProps>): react_jsx_runtime189.JSX.Element;
46
46
  //#endregion
47
47
  export { TextFieldContext, TextFieldProvider };
48
48
  //# sourceMappingURL=context.d.ts.map
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { TextFieldProps } from "./types.js";
14
14
  import "client-only";
15
- import * as react_jsx_runtime195 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime190 from "react/jsx-runtime";
16
16
 
17
17
  //#region src/components/text-field/index.d.ts
18
18
 
@@ -40,7 +40,7 @@ import * as react_jsx_runtime195 from "react/jsx-runtime";
40
40
  declare function TextField({
41
41
  ref,
42
42
  ...props
43
- }: TextFieldProps): react_jsx_runtime195.JSX.Element;
43
+ }: TextFieldProps): react_jsx_runtime190.JSX.Element;
44
44
  //#endregion
45
45
  export { TextField };
46
46
  //# sourceMappingURL=index.d.ts.map
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { TimeFieldProps as TimeFieldProps$1 } from "./types.js";
14
14
  import "client-only";
15
- import * as react_jsx_runtime201 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime193 from "react/jsx-runtime";
16
16
  import { TimeValue } from "react-aria-components/TimeField";
17
17
 
18
18
  //#region src/components/time-field/index.d.ts
@@ -58,7 +58,7 @@ declare function TimeField<T extends TimeValue>({
58
58
  isRequired,
59
59
  isReadOnly,
60
60
  ...rest
61
- }: TimeFieldProps$1<T>): react_jsx_runtime201.JSX.Element;
61
+ }: TimeFieldProps$1<T>): react_jsx_runtime193.JSX.Element;
62
62
  //#endregion
63
63
  export { TimeField };
64
64
  //# sourceMappingURL=index.d.ts.map
@@ -12,12 +12,12 @@
12
12
 
13
13
  import { TooltipTriggerProps } from "./types.js";
14
14
  import "client-only";
15
- import * as react50 from "react";
15
+ import * as react47 from "react";
16
16
  import { ContextValue } from "react-aria-components/slots";
17
17
 
18
18
  //#region src/components/tooltip/context.d.ts
19
19
  /** Context for sharing props across TooltipTrigger components */
20
- declare const TooltipContext: react50.Context<ContextValue<TooltipTriggerProps, HTMLDivElement>>;
20
+ declare const TooltipContext: react47.Context<ContextValue<TooltipTriggerProps, HTMLDivElement>>;
21
21
  //#endregion
22
22
  export { TooltipContext };
23
23
  //# sourceMappingURL=context.d.ts.map
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { TooltipProps } from "./types.js";
14
14
  import "client-only";
15
- import * as react_jsx_runtime71 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime194 from "react/jsx-runtime";
16
16
 
17
17
  //#region src/components/tooltip/index.d.ts
18
18
 
@@ -44,7 +44,7 @@ declare function Tooltip({
44
44
  offset,
45
45
  placement,
46
46
  ...props
47
- }: TooltipProps): react_jsx_runtime71.JSX.Element;
47
+ }: TooltipProps): react_jsx_runtime194.JSX.Element;
48
48
  //#endregion
49
49
  export { Tooltip };
50
50
  //# sourceMappingURL=index.d.ts.map
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { TooltipTriggerProps } from "./types.js";
14
14
  import "client-only";
15
- import * as react_jsx_runtime205 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime195 from "react/jsx-runtime";
16
16
 
17
17
  //#region src/components/tooltip/trigger.d.ts
18
18
 
@@ -38,7 +38,7 @@ import * as react_jsx_runtime205 from "react/jsx-runtime";
38
38
  declare function TooltipTrigger({
39
39
  ref,
40
40
  ...props
41
- }: TooltipTriggerProps): react_jsx_runtime205.JSX.Element;
41
+ }: TooltipTriggerProps): react_jsx_runtime195.JSX.Element;
42
42
  //#endregion
43
43
  export { TooltipTrigger };
44
44
  //# sourceMappingURL=trigger.d.ts.map
@@ -12,13 +12,13 @@
12
12
 
13
13
  import { TreeContextValue, TreeItemContextValue } from "./types.js";
14
14
  import "client-only";
15
- import * as react53 from "react";
15
+ import * as react48 from "react";
16
16
 
17
17
  //#region src/components/tree/context.d.ts
18
18
  /** Context for sharing state across Tree components */
19
- declare const TreeContext: react53.Context<TreeContextValue>;
19
+ declare const TreeContext: react48.Context<TreeContextValue>;
20
20
  /** Context for sharing state within a TreeItem */
21
- declare const TreeItemContext: react53.Context<TreeItemContextValue>;
21
+ declare const TreeItemContext: react48.Context<TreeItemContextValue>;
22
22
  //#endregion
23
23
  export { TreeContext, TreeItemContext };
24
24
  //# sourceMappingURL=context.d.ts.map
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { TreeProps } from "./types.js";
14
14
  import "client-only";
15
- import * as react_jsx_runtime211 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime196 from "react/jsx-runtime";
16
16
 
17
17
  //#region src/components/tree/index.d.ts
18
18
 
@@ -77,7 +77,7 @@ declare function Tree<T>({
77
77
  onVisibilityChange,
78
78
  onSelectionChange,
79
79
  ...rest
80
- }: TreeProps<T>): react_jsx_runtime211.JSX.Element;
80
+ }: TreeProps<T>): react_jsx_runtime196.JSX.Element;
81
81
  //#endregion
82
82
  export { Tree };
83
83
  //# sourceMappingURL=index.d.ts.map
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import { PropsWithChildren } from "react";
14
- import * as react_jsx_runtime213 from "react/jsx-runtime";
14
+ import * as react_jsx_runtime198 from "react/jsx-runtime";
15
15
 
16
16
  //#region src/components/tree/item-actions.d.ts
17
17
 
@@ -39,7 +39,7 @@ declare function TreeItemActions({
39
39
  className
40
40
  }: PropsWithChildren & {
41
41
  className?: string;
42
- }): react_jsx_runtime213.JSX.Element;
42
+ }): react_jsx_runtime198.JSX.Element;
43
43
  //#endregion
44
44
  export { TreeItemActions };
45
45
  //# sourceMappingURL=item-actions.d.ts.map
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import { TreeItemContentProps } from "./types.js";
14
- import * as react_jsx_runtime200 from "react/jsx-runtime";
14
+ import * as react_jsx_runtime201 from "react/jsx-runtime";
15
15
 
16
16
  //#region src/components/tree/item-content.d.ts
17
17
 
@@ -35,7 +35,7 @@ import * as react_jsx_runtime200 from "react/jsx-runtime";
35
35
  */
36
36
  declare function TreeItemContent({
37
37
  children
38
- }: TreeItemContentProps): react_jsx_runtime200.JSX.Element;
38
+ }: TreeItemContentProps): react_jsx_runtime201.JSX.Element;
39
39
  //#endregion
40
40
  export { TreeItemContent };
41
41
  //# sourceMappingURL=item-content.d.ts.map
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import * as react_jsx_runtime198 from "react/jsx-runtime";
13
+ import * as react_jsx_runtime203 from "react/jsx-runtime";
14
14
  import { TextProps } from "react-aria-components/Text";
15
15
 
16
16
  //#region src/components/tree/item-description.d.ts
@@ -33,7 +33,7 @@ import { TextProps } from "react-aria-components/Text";
33
33
  declare function TreeItemDescription({
34
34
  children,
35
35
  className
36
- }: TextProps): react_jsx_runtime198.JSX.Element | null;
36
+ }: TextProps): react_jsx_runtime203.JSX.Element | null;
37
37
  //#endregion
38
38
  export { TreeItemDescription };
39
39
  //# sourceMappingURL=item-description.d.ts.map
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import * as react_jsx_runtime203 from "react/jsx-runtime";
13
+ import * as react_jsx_runtime204 from "react/jsx-runtime";
14
14
  import { TextProps } from "react-aria-components/Text";
15
15
 
16
16
  //#region src/components/tree/item-label.d.ts
@@ -33,7 +33,7 @@ import { TextProps } from "react-aria-components/Text";
33
33
  declare function TreeItemLabel({
34
34
  children,
35
35
  className
36
- }: TextProps): react_jsx_runtime203.JSX.Element;
36
+ }: TextProps): react_jsx_runtime204.JSX.Element;
37
37
  //#endregion
38
38
  export { TreeItemLabel };
39
39
  //# sourceMappingURL=item-label.d.ts.map
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import { IconProps } from "../icon/types.js";
14
- import * as react_jsx_runtime202 from "react/jsx-runtime";
14
+ import * as react_jsx_runtime236 from "react/jsx-runtime";
15
15
 
16
16
  //#region src/components/tree/item-prefix-icon.d.ts
17
17
  /**
@@ -33,7 +33,7 @@ import * as react_jsx_runtime202 from "react/jsx-runtime";
33
33
  declare function TreeItemPrefixIcon({
34
34
  children,
35
35
  className
36
- }: IconProps): react_jsx_runtime202.JSX.Element;
36
+ }: IconProps): react_jsx_runtime236.JSX.Element;
37
37
  //#endregion
38
38
  export { TreeItemPrefixIcon };
39
39
  //# sourceMappingURL=item-prefix-icon.d.ts.map
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { TreeItemProps } from "./types.js";
14
14
  import "client-only";
15
- import * as react_jsx_runtime204 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime218 from "react/jsx-runtime";
16
16
 
17
17
  //#region src/components/tree/item.d.ts
18
18
 
@@ -44,7 +44,7 @@ declare function TreeItem({
44
44
  className,
45
45
  id,
46
46
  ...rest
47
- }: TreeItemProps): react_jsx_runtime204.JSX.Element;
47
+ }: TreeItemProps): react_jsx_runtime218.JSX.Element;
48
48
  //#endregion
49
49
  export { TreeItem };
50
50
  //# sourceMappingURL=item.d.ts.map
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import * as react51 from "react";
13
+ import * as react53 from "react";
14
14
 
15
15
  //#region src/components/tree/lines.d.ts
16
16
  /**
@@ -22,7 +22,7 @@ import * as react51 from "react";
22
22
  * @param props.ancestorLastOfSet - Array tracking which ancestors are last of set at each level.
23
23
  * @returns An array of Line components representing the tree structure.
24
24
  */
25
- declare const TreeLines: react51.NamedExoticComponent<{
25
+ declare const TreeLines: react53.NamedExoticComponent<{
26
26
  level: number;
27
27
  isLastOfSet: boolean;
28
28
  ancestorLastOfSet: boolean[];
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { VideoProps } from "./types.js";
14
14
  import "client-only";
15
- import * as react_jsx_runtime209 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime237 from "react/jsx-runtime";
16
16
 
17
17
  //#region src/components/video/index.d.ts
18
18
 
@@ -91,7 +91,7 @@ declare function Video({
91
91
  noMutedPref,
92
92
  lang,
93
93
  ...rest
94
- }: VideoProps): react_jsx_runtime209.JSX.Element;
94
+ }: VideoProps): react_jsx_runtime237.JSX.Element;
95
95
  //#endregion
96
96
  export { Video };
97
97
  //# sourceMappingURL=index.d.ts.map
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { ViewStackProps } from "./types.js";
14
14
  import "client-only";
15
- import * as react_jsx_runtime212 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime209 from "react/jsx-runtime";
16
16
 
17
17
  //#region src/components/view-stack/index.d.ts
18
18
 
@@ -47,7 +47,7 @@ declare function ViewStack({
47
47
  children,
48
48
  defaultView,
49
49
  onChange
50
- }: ViewStackProps): react_jsx_runtime212.JSX.Element;
50
+ }: ViewStackProps): react_jsx_runtime209.JSX.Element;
51
51
  //#endregion
52
52
  export { ViewStack };
53
53
  //# sourceMappingURL=index.d.ts.map
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { ViewStackTriggerProps } from "./types.js";
14
14
  import "client-only";
15
- import * as react_jsx_runtime214 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime211 from "react/jsx-runtime";
16
16
 
17
17
  //#region src/components/view-stack/trigger.d.ts
18
18
 
@@ -45,7 +45,7 @@ import * as react_jsx_runtime214 from "react/jsx-runtime";
45
45
  declare function ViewStackTrigger({
46
46
  children,
47
47
  for: types
48
- }: ViewStackTriggerProps): react_jsx_runtime214.JSX.Element;
48
+ }: ViewStackTriggerProps): react_jsx_runtime211.JSX.Element;
49
49
  //#endregion
50
50
  export { ViewStackTrigger };
51
51
  //# sourceMappingURL=trigger.d.ts.map
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { ViewStackViewProps } from "./types.js";
14
14
  import "client-only";
15
- import * as react_jsx_runtime199 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime212 from "react/jsx-runtime";
16
16
 
17
17
  //#region src/components/view-stack/view.d.ts
18
18
 
@@ -43,7 +43,7 @@ import * as react_jsx_runtime199 from "react/jsx-runtime";
43
43
  declare function ViewStackView({
44
44
  id,
45
45
  children
46
- }: ViewStackViewProps): react_jsx_runtime199.JSX.Element | null;
46
+ }: ViewStackViewProps): react_jsx_runtime212.JSX.Element | null;
47
47
  //#endregion
48
48
  export { ViewStackView };
49
49
  //# sourceMappingURL=view.d.ts.map
@@ -43,6 +43,8 @@ interface UseCoordinateFieldStateResult {
43
43
  editableSegmentConfigs: SegmentConfig[];
44
44
  /** Handle change of a single segment */
45
45
  handleSegmentChange: (index: number, newValue: string) => void;
46
+ /** Handle blur event for a segment */
47
+ handleSegmentBlur: (index: number) => void;
46
48
  /** Set all segment values at once */
47
49
  setSegmentValues: (values: string[]) => void;
48
50
  /** Set validation errors */
@@ -146,12 +146,14 @@ function useCoordinateFieldState({ value, defaultValue, format, onChange, onErro
146
146
  };
147
147
  const handleSegmentChange = (index, newValue) => {
148
148
  const updatedValues = [...segmentValues];
149
- updatedValues[index] = newValue;
149
+ if (format === "mgrs" && (index === 1 || index === 2) && /^[a-zA-Z]+$/.test(newValue)) updatedValues[index] = newValue.toUpperCase();
150
+ else updatedValues[index] = newValue;
150
151
  setSegmentValues(updatedValues);
151
152
  if (areAllSegmentsFilled(updatedValues)) {
152
153
  clearValidationTimeout();
154
+ const capturedValues = [...updatedValues];
153
155
  const timeoutId = setTimeout(() => {
154
- validateAndUpdateCoordinate(updatedValues);
156
+ validateAndUpdateCoordinate(capturedValues);
155
157
  validationTimeoutRef.current = null;
156
158
  }, 400);
157
159
  validationTimeoutRef.current = timeoutId;
@@ -162,6 +164,16 @@ function useCoordinateFieldState({ value, defaultValue, format, onChange, onErro
162
164
  if (currentValue !== null) handleChange(null);
163
165
  }
164
166
  };
167
+ const handleSegmentBlur = (index) => {
168
+ if (format === "mgrs" && index === 0) {
169
+ const currentVal = segmentValues[0];
170
+ if (currentVal && currentVal.length === 1 && /^\d$/.test(currentVal)) {
171
+ const updatedValues = [...segmentValues];
172
+ updatedValues[0] = currentVal.padStart(2, "0");
173
+ setSegmentValues(updatedValues);
174
+ }
175
+ }
176
+ };
165
177
  const applyPastedCoordinate = (pastedValue) => {
166
178
  clearValidationTimeout();
167
179
  const segments = convertDDToDisplaySegments(pastedValue, format);
@@ -184,6 +196,7 @@ function useCoordinateFieldState({ value, defaultValue, format, onChange, onErro
184
196
  segmentConfigs,
185
197
  editableSegmentConfigs,
186
198
  handleSegmentChange,
199
+ handleSegmentBlur,
187
200
  setSegmentValues,
188
201
  setValidationErrors,
189
202
  effectiveErrorMessage: useMemo(() => validationErrors[0] || null, [validationErrors]),
@@ -1 +1 @@
1
- {"version":3,"file":"use-coordinate-field-state.js","names":[],"sources":["../../../src/hooks/coordinate-field/use-coordinate-field-state.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n type Dispatch,\n type SetStateAction,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n areAllSegmentsFilled,\n convertDDToDisplaySegments,\n convertDisplaySegmentsToDD,\n validateCoordinateSegments,\n} from '../../components/coordinate-field/coordinate-utils';\nimport { getSegmentConfigs } from '../../components/coordinate-field/segment-configs';\nimport type {\n CoordinateSystem,\n CoordinateValue,\n SegmentConfig,\n} from '../../components/coordinate-field/types';\n\n/** Options for the useCoordinateFieldState hook */\nexport interface UseCoordinateFieldStateOptions {\n /** Controlled coordinate value */\n value?: CoordinateValue | null;\n /** Default value for uncontrolled mode */\n defaultValue?: CoordinateValue;\n /** Coordinate format system (dd, ddm, dms, mgrs, utm) */\n format: CoordinateSystem;\n /** Callback when coordinate value changes */\n onChange?:\n | Dispatch<SetStateAction<CoordinateValue | null>>\n | ((value: CoordinateValue | null) => void);\n /** Callback for validation errors */\n onError?: (message: string, context?: Record<string, unknown>) => void;\n /** Register timeouts for cleanup on unmount */\n registerTimeout?: (timeoutId: NodeJS.Timeout) => void;\n}\n\n/** Return value from the useCoordinateFieldState hook */\nexport interface UseCoordinateFieldStateResult {\n /** Current coordinate value (null if incomplete/invalid) */\n currentValue: CoordinateValue | null;\n /** Array of display values for each segment */\n segmentValues: string[];\n /** Array of validation error messages */\n validationErrors: string[];\n /** All segment configurations including literals */\n segmentConfigs: SegmentConfig[];\n /** Only editable segment configurations */\n editableSegmentConfigs: SegmentConfig[];\n /** Handle change of a single segment */\n handleSegmentChange: (index: number, newValue: string) => void;\n /** Set all segment values at once */\n setSegmentValues: (values: string[]) => void;\n /** Set validation errors */\n setValidationErrors: (errors: string[]) => void;\n /** First validation error or null */\n effectiveErrorMessage: string | null;\n /** Apply a pasted coordinate value */\n applyPastedCoordinate: (pastedValue: CoordinateValue) => void;\n /** Immediately run pending validation */\n flushPendingValidation: () => void;\n}\n\n/**\n * Manages coordinate segment values, validation, and format conversion\n *\n * @example\n * ```tsx\n * function CoordinateInputs() {\n * const [value, setValue] = useState<CoordinateValue | null>(null);\n * const { registerTimeout } = useTimeoutCleanup();\n *\n * const {\n * currentValue,\n * segmentValues,\n * validationErrors,\n * editableSegmentConfigs,\n * handleSegmentChange,\n * } = useCoordinateFieldState({\n * value,\n * format: 'ddm',\n * onChange: setValue,\n * onError: (msg) => console.error(msg),\n * registerTimeout,\n * });\n *\n * return (\n * <div>\n * {editableSegmentConfigs.map((config, i) => (\n * <input\n * key={i}\n * value={segmentValues[i]}\n * onChange={(e) => handleSegmentChange(i, e.target.value)}\n * placeholder={config.placeholder}\n * />\n * ))}\n * {validationErrors.map((error, i) => (\n * <span key={i}>{error}</span>\n * ))}\n * </div>\n * );\n * }\n * ```\n *\n * @param options - {@link UseCoordinateFieldStateOptions}\n * @param options.value - Controlled coordinate value.\n * @param options.defaultValue - Default value for uncontrolled mode.\n * @param options.format - Coordinate format system (dd, ddm, dms, mgrs, utm).\n * @param options.onChange - Callback when coordinate value changes.\n * @param options.onError - Callback for validation errors.\n * @param options.registerTimeout - Register timeouts for cleanup on unmount.\n * @returns {@link UseCoordinateFieldStateResult} Segment state, validation, and change handlers.\n */\nexport function useCoordinateFieldState({\n value,\n defaultValue,\n format,\n onChange,\n onError,\n registerTimeout,\n}: UseCoordinateFieldStateOptions): UseCoordinateFieldStateResult {\n const [internalValue, setInternalValue] = useState<CoordinateValue | null>(\n defaultValue || null,\n );\n const [validationErrors, setValidationErrors] = useState<string[]>([]);\n const validationTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n const currentValue = value !== undefined ? value : internalValue;\n\n const clearValidationTimeout = () => {\n if (validationTimeoutRef.current) {\n clearTimeout(validationTimeoutRef.current);\n validationTimeoutRef.current = null;\n }\n };\n\n const handleChange = (newValue: CoordinateValue | null) => {\n if (value === undefined) {\n setInternalValue(newValue);\n }\n onChange?.(newValue);\n };\n\n const segmentConfigs = useMemo(() => getSegmentConfigs(format), [format]);\n\n const editableSegmentConfigs = useMemo(\n () => segmentConfigs.flat().filter((config) => config.type !== 'literal'),\n [segmentConfigs],\n );\n\n const [segmentValues, setSegmentValues] = useState<string[]>(() => {\n const initialValue = value !== undefined ? value : defaultValue;\n if (!initialValue) {\n return new Array(editableSegmentConfigs.length).fill('');\n }\n\n const segments = convertDDToDisplaySegments(initialValue, format);\n if (!segments) {\n return new Array(editableSegmentConfigs.length).fill('');\n }\n\n return segments;\n });\n\n const convertValueToSegmentsOrClear = useCallback(\n (valueToConvert: CoordinateValue | null) => {\n // Clear any pending validation when value changes\n clearValidationTimeout();\n\n const segments = valueToConvert\n ? convertDDToDisplaySegments(valueToConvert, format)\n : null;\n\n setSegmentValues(\n segments || new Array(editableSegmentConfigs.length).fill(''),\n );\n setValidationErrors([]);\n },\n [format, editableSegmentConfigs.length],\n );\n\n const prevFormatRef = useRef(format);\n\n useEffect(() => {\n if (prevFormatRef.current !== format) {\n prevFormatRef.current = format;\n const valueToConvert = value !== undefined ? value : internalValue;\n convertValueToSegmentsOrClear(valueToConvert);\n }\n }, [format, value, internalValue, convertValueToSegmentsOrClear]);\n\n useEffect(() => {\n if (value !== undefined) {\n convertValueToSegmentsOrClear(value);\n }\n }, [value, convertValueToSegmentsOrClear]);\n\n /**\n * Validates segment values and updates the coordinate state\n *\n * When validation fails, calls onError with \"Invalid coordinate value\" message\n * and context containing the detailed validation errors from @accelint/geo.\n *\n * @param updatedValues - Array of segment values to validate\n */\n const validateAndUpdateCoordinate = (updatedValues: string[]) => {\n const errors = validateCoordinateSegments(updatedValues, format);\n\n if (errors.length > 0) {\n setValidationErrors(errors);\n onError?.('Invalid coordinate value', {\n errors,\n format,\n segments: updatedValues,\n });\n handleChange(null);\n return;\n }\n\n const ddValue = convertDisplaySegmentsToDD(updatedValues, format);\n if (!ddValue) {\n const errorMsg = 'Invalid coordinate value';\n setValidationErrors([errorMsg]);\n onError?.(errorMsg, { format, segments: updatedValues });\n handleChange(null);\n return;\n }\n\n setValidationErrors([]);\n handleChange(ddValue);\n };\n\n const handleSegmentChange = (index: number, newValue: string) => {\n const updatedValues = [...segmentValues];\n updatedValues[index] = newValue;\n setSegmentValues(updatedValues);\n\n if (areAllSegmentsFilled(updatedValues)) {\n // Clear any pending validation timeout\n clearValidationTimeout();\n\n // Debounce validation by 400ms when all segments are full\n const timeoutId = setTimeout(() => {\n validateAndUpdateCoordinate(updatedValues);\n validationTimeoutRef.current = null;\n }, 400);\n\n validationTimeoutRef.current = timeoutId;\n registerTimeout?.(timeoutId);\n } else {\n // Clear any pending validation when segments become incomplete\n clearValidationTimeout();\n setValidationErrors([]);\n if (currentValue !== null) {\n handleChange(null);\n }\n }\n };\n\n const applyPastedCoordinate = (pastedValue: CoordinateValue) => {\n // Clear any pending validation when applying pasted coordinate\n clearValidationTimeout();\n\n const segments = convertDDToDisplaySegments(pastedValue, format);\n\n if (segments) {\n setSegmentValues(segments);\n setValidationErrors([]);\n handleChange(pastedValue);\n }\n };\n\n const flushPendingValidation = () => {\n if (validationTimeoutRef.current) {\n clearValidationTimeout();\n\n // Immediately validate if all segments are filled\n if (areAllSegmentsFilled(segmentValues)) {\n validateAndUpdateCoordinate(segmentValues);\n }\n }\n };\n\n const effectiveErrorMessage = useMemo(\n () => validationErrors[0] || null,\n [validationErrors],\n );\n\n return {\n currentValue,\n segmentValues,\n validationErrors,\n segmentConfigs,\n editableSegmentConfigs,\n handleSegmentChange,\n setSegmentValues,\n setValidationErrors,\n effectiveErrorMessage,\n applyPastedCoordinate,\n flushPendingValidation,\n };\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"use-coordinate-field-state.js","names":[],"sources":["../../../src/hooks/coordinate-field/use-coordinate-field-state.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n type Dispatch,\n type SetStateAction,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n areAllSegmentsFilled,\n convertDDToDisplaySegments,\n convertDisplaySegmentsToDD,\n validateCoordinateSegments,\n} from '../../components/coordinate-field/coordinate-utils';\nimport { getSegmentConfigs } from '../../components/coordinate-field/segment-configs';\nimport type {\n CoordinateSystem,\n CoordinateValue,\n SegmentConfig,\n} from '../../components/coordinate-field/types';\n\n/** Options for the useCoordinateFieldState hook */\nexport interface UseCoordinateFieldStateOptions {\n /** Controlled coordinate value */\n value?: CoordinateValue | null;\n /** Default value for uncontrolled mode */\n defaultValue?: CoordinateValue;\n /** Coordinate format system (dd, ddm, dms, mgrs, utm) */\n format: CoordinateSystem;\n /** Callback when coordinate value changes */\n onChange?:\n | Dispatch<SetStateAction<CoordinateValue | null>>\n | ((value: CoordinateValue | null) => void);\n /** Callback for validation errors */\n onError?: (message: string, context?: Record<string, unknown>) => void;\n /** Register timeouts for cleanup on unmount */\n registerTimeout?: (timeoutId: NodeJS.Timeout) => void;\n}\n\n/** Return value from the useCoordinateFieldState hook */\nexport interface UseCoordinateFieldStateResult {\n /** Current coordinate value (null if incomplete/invalid) */\n currentValue: CoordinateValue | null;\n /** Array of display values for each segment */\n segmentValues: string[];\n /** Array of validation error messages */\n validationErrors: string[];\n /** All segment configurations including literals */\n segmentConfigs: SegmentConfig[];\n /** Only editable segment configurations */\n editableSegmentConfigs: SegmentConfig[];\n /** Handle change of a single segment */\n handleSegmentChange: (index: number, newValue: string) => void;\n /** Handle blur event for a segment */\n handleSegmentBlur: (index: number) => void;\n /** Set all segment values at once */\n setSegmentValues: (values: string[]) => void;\n /** Set validation errors */\n setValidationErrors: (errors: string[]) => void;\n /** First validation error or null */\n effectiveErrorMessage: string | null;\n /** Apply a pasted coordinate value */\n applyPastedCoordinate: (pastedValue: CoordinateValue) => void;\n /** Immediately run pending validation */\n flushPendingValidation: () => void;\n}\n\n/**\n * Manages coordinate segment values, validation, and format conversion\n *\n * @example\n * ```tsx\n * function CoordinateInputs() {\n * const [value, setValue] = useState<CoordinateValue | null>(null);\n * const { registerTimeout } = useTimeoutCleanup();\n *\n * const {\n * currentValue,\n * segmentValues,\n * validationErrors,\n * editableSegmentConfigs,\n * handleSegmentChange,\n * } = useCoordinateFieldState({\n * value,\n * format: 'ddm',\n * onChange: setValue,\n * onError: (msg) => console.error(msg),\n * registerTimeout,\n * });\n *\n * return (\n * <div>\n * {editableSegmentConfigs.map((config, i) => (\n * <input\n * key={i}\n * value={segmentValues[i]}\n * onChange={(e) => handleSegmentChange(i, e.target.value)}\n * placeholder={config.placeholder}\n * />\n * ))}\n * {validationErrors.map((error, i) => (\n * <span key={i}>{error}</span>\n * ))}\n * </div>\n * );\n * }\n * ```\n *\n * @param options - {@link UseCoordinateFieldStateOptions}\n * @param options.value - Controlled coordinate value.\n * @param options.defaultValue - Default value for uncontrolled mode.\n * @param options.format - Coordinate format system (dd, ddm, dms, mgrs, utm).\n * @param options.onChange - Callback when coordinate value changes.\n * @param options.onError - Callback for validation errors.\n * @param options.registerTimeout - Register timeouts for cleanup on unmount.\n * @returns {@link UseCoordinateFieldStateResult} Segment state, validation, and change handlers.\n */\nexport function useCoordinateFieldState({\n value,\n defaultValue,\n format,\n onChange,\n onError,\n registerTimeout,\n}: UseCoordinateFieldStateOptions): UseCoordinateFieldStateResult {\n const [internalValue, setInternalValue] = useState<CoordinateValue | null>(\n defaultValue || null,\n );\n const [validationErrors, setValidationErrors] = useState<string[]>([]);\n const validationTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n const currentValue = value !== undefined ? value : internalValue;\n\n const clearValidationTimeout = () => {\n if (validationTimeoutRef.current) {\n clearTimeout(validationTimeoutRef.current);\n validationTimeoutRef.current = null;\n }\n };\n\n const handleChange = (newValue: CoordinateValue | null) => {\n if (value === undefined) {\n setInternalValue(newValue);\n }\n onChange?.(newValue);\n };\n\n const segmentConfigs = useMemo(() => getSegmentConfigs(format), [format]);\n\n const editableSegmentConfigs = useMemo(\n () => segmentConfigs.flat().filter((config) => config.type !== 'literal'),\n [segmentConfigs],\n );\n\n const [segmentValues, setSegmentValues] = useState<string[]>(() => {\n const initialValue = value !== undefined ? value : defaultValue;\n if (!initialValue) {\n return new Array(editableSegmentConfigs.length).fill('');\n }\n\n const segments = convertDDToDisplaySegments(initialValue, format);\n if (!segments) {\n return new Array(editableSegmentConfigs.length).fill('');\n }\n\n return segments;\n });\n\n const convertValueToSegmentsOrClear = useCallback(\n (valueToConvert: CoordinateValue | null) => {\n // Clear any pending validation when value changes\n clearValidationTimeout();\n\n const segments = valueToConvert\n ? convertDDToDisplaySegments(valueToConvert, format)\n : null;\n\n setSegmentValues(\n segments || new Array(editableSegmentConfigs.length).fill(''),\n );\n setValidationErrors([]);\n },\n [format, editableSegmentConfigs.length],\n );\n\n const prevFormatRef = useRef(format);\n\n useEffect(() => {\n if (prevFormatRef.current !== format) {\n prevFormatRef.current = format;\n const valueToConvert = value !== undefined ? value : internalValue;\n convertValueToSegmentsOrClear(valueToConvert);\n }\n }, [format, value, internalValue, convertValueToSegmentsOrClear]);\n\n useEffect(() => {\n if (value !== undefined) {\n convertValueToSegmentsOrClear(value);\n }\n }, [value, convertValueToSegmentsOrClear]);\n\n /**\n * Validates segment values and updates the coordinate state\n *\n * When validation fails, calls onError with \"Invalid coordinate value\" message\n * and context containing the detailed validation errors from @accelint/geo.\n *\n * @param updatedValues - Array of segment values to validate\n */\n const validateAndUpdateCoordinate = (updatedValues: string[]) => {\n const errors = validateCoordinateSegments(updatedValues, format);\n\n if (errors.length > 0) {\n setValidationErrors(errors);\n onError?.('Invalid coordinate value', {\n errors,\n format,\n segments: updatedValues,\n });\n handleChange(null);\n return;\n }\n\n const ddValue = convertDisplaySegmentsToDD(updatedValues, format);\n if (!ddValue) {\n const errorMsg = 'Invalid coordinate value';\n setValidationErrors([errorMsg]);\n onError?.(errorMsg, { format, segments: updatedValues });\n handleChange(null);\n return;\n }\n\n setValidationErrors([]);\n handleChange(ddValue);\n };\n\n const handleSegmentChange = (index: number, newValue: string) => {\n const updatedValues = [...segmentValues];\n\n // Normalize MGRS letter inputs (Band/Grid): uppercase only\n if (\n format === 'mgrs' &&\n (index === 1 || index === 2) &&\n /^[a-zA-Z]+$/.test(newValue)\n ) {\n updatedValues[index] = newValue.toUpperCase();\n } else {\n updatedValues[index] = newValue;\n }\n\n setSegmentValues(updatedValues);\n\n if (areAllSegmentsFilled(updatedValues)) {\n // Clear any pending validation timeout\n clearValidationTimeout();\n\n // Capture segment values at timeout creation\n const capturedValues = [...updatedValues];\n\n // Debounce validation by 400ms when all segments are full\n const timeoutId = setTimeout(() => {\n validateAndUpdateCoordinate(capturedValues);\n validationTimeoutRef.current = null;\n }, 400);\n\n validationTimeoutRef.current = timeoutId;\n registerTimeout?.(timeoutId);\n } else {\n // Clear any pending validation when segments become incomplete\n clearValidationTimeout();\n setValidationErrors([]);\n if (currentValue !== null) {\n handleChange(null);\n }\n }\n };\n\n const handleSegmentBlur = (index: number) => {\n // MGRS zone field: add leading zero to single-digit values on blur\n if (format === 'mgrs' && index === 0) {\n const currentVal = segmentValues[0];\n if (currentVal && currentVal.length === 1 && /^\\d$/.test(currentVal)) {\n const updatedValues = [...segmentValues];\n updatedValues[0] = currentVal.padStart(2, '0');\n setSegmentValues(updatedValues);\n }\n }\n };\n\n const applyPastedCoordinate = (pastedValue: CoordinateValue) => {\n // Clear any pending validation when applying pasted coordinate\n clearValidationTimeout();\n\n const segments = convertDDToDisplaySegments(pastedValue, format);\n\n if (segments) {\n setSegmentValues(segments);\n setValidationErrors([]);\n handleChange(pastedValue);\n }\n };\n\n const flushPendingValidation = () => {\n if (validationTimeoutRef.current) {\n clearValidationTimeout();\n\n // Immediately validate if all segments are filled\n if (areAllSegmentsFilled(segmentValues)) {\n validateAndUpdateCoordinate(segmentValues);\n }\n }\n };\n\n const effectiveErrorMessage = useMemo(\n () => validationErrors[0] || null,\n [validationErrors],\n );\n\n return {\n currentValue,\n segmentValues,\n validationErrors,\n segmentConfigs,\n editableSegmentConfigs,\n handleSegmentChange,\n handleSegmentBlur,\n setSegmentValues,\n setValidationErrors,\n effectiveErrorMessage,\n applyPastedCoordinate,\n flushPendingValidation,\n };\n}\n"],"mappings":"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"}
@@ -86,6 +86,26 @@ function useCoordinatePaste({ onValueApplied, onError }) {
86
86
  if (firstMatch) setSelectedDisambiguationFormat(firstMatch.format);
87
87
  setShowDisambiguationModal(true);
88
88
  };
89
+ /**
90
+ * Normalizes MGRS coordinate input to a standard format.
91
+ *
92
+ * - Converts all letters to uppercase
93
+ * - Adds leading zero to single-digit grid zones (e.g., "6R" → "06R")
94
+ * - Handles both spaced ("6R YP 12345 67890") and compact ("6RYP1234567890") formats
95
+ *
96
+ * @param input - Raw MGRS coordinate string
97
+ * @returns Normalized MGRS coordinate string
98
+ *
99
+ * @example
100
+ * normalizeMgrsInput("6r yp 12345 67890") // → "06R YP 12345 67890"
101
+ * normalizeMgrsInput("6ryp1234567890") // → "06RYP1234567890"
102
+ */
103
+ const normalizeMgrsInput = (input) => {
104
+ let normalized = input.toUpperCase();
105
+ const match = normalized.match(/^(\d)([A-Z])/);
106
+ if (match?.[1]) normalized = match[1].padStart(2, "0") + normalized.slice(1);
107
+ return normalized;
108
+ };
89
109
  const handleCoordinatePaste = (pastedText) => {
90
110
  const allMatches = parseCoordinatePaste(pastedText);
91
111
  if (allMatches.length === 0) {
@@ -97,10 +117,13 @@ function useCoordinatePaste({ onValueApplied, onError }) {
97
117
  else handlePasteMultipleMatches(matches);
98
118
  };
99
119
  const handleInputPaste = (e) => {
100
- const pastedText = e.clipboardData?.getData("text/plain");
101
- if (pastedText && isCompleteCoordinate(pastedText)) {
102
- e.preventDefault();
103
- handleCoordinatePaste(pastedText);
120
+ const rawPastedText = e.clipboardData?.getData("text/plain");
121
+ if (rawPastedText) {
122
+ const pastedText = normalizeMgrsInput(rawPastedText);
123
+ if (isCompleteCoordinate(pastedText)) {
124
+ e.preventDefault();
125
+ handleCoordinatePaste(pastedText);
126
+ }
104
127
  }
105
128
  };
106
129
  const cleanupDisambiguationModal = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"use-coordinate-paste.js","names":[],"sources":["../../../src/hooks/coordinate-field/use-coordinate-paste.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { useState } from 'react';\nimport {\n deduplicateMatchesByLocation,\n isCompleteCoordinate,\n parseCoordinatePaste,\n} from '../../components/coordinate-field/coordinate-utils';\nimport type {\n CoordinateSystem,\n CoordinateValue,\n ParsedCoordinateMatch,\n} from '../../components/coordinate-field/types';\n\n/** Options for the useCoordinatePaste hook */\nexport interface UseCoordinatePasteOptions {\n /** Callback when a coordinate value is successfully parsed and applied */\n onValueApplied: (value: CoordinateValue) => void;\n /** Optional error callback for invalid paste attempts */\n onError?: (message: string, context?: Record<string, unknown>) => void;\n}\n\n/** Return value from the useCoordinatePaste hook */\nexport interface UseCoordinatePasteResult {\n /** Array of parsed coordinate matches for disambiguation */\n disambiguationMatches: ParsedCoordinateMatch[];\n /** Whether the disambiguation modal is visible */\n showDisambiguationModal: boolean;\n /** Currently selected format in disambiguation modal */\n selectedDisambiguationFormat: CoordinateSystem | null;\n /** Paste event handler for coordinate input */\n handleInputPaste: (e: React.ClipboardEvent<HTMLDivElement>) => void;\n /** Confirm selection in disambiguation modal */\n handleDisambiguationSelect: () => void;\n /** Control disambiguation modal visibility */\n setShowDisambiguationModal: (show: boolean) => void;\n /** Set the selected format in disambiguation modal */\n setSelectedDisambiguationFormat: (format: CoordinateSystem | null) => void;\n /** Reset disambiguation modal state */\n cleanupDisambiguationModal: () => void;\n}\n\n/**\n * Handles paste events with coordinate parsing and disambiguation when multiple formats match\n *\n * @example\n * ```tsx\n * function CoordinateFieldWithPaste() {\n * const [value, setValue] = useState<CoordinateValue | null>(null);\n *\n * const {\n * disambiguationMatches,\n * showDisambiguationModal,\n * selectedDisambiguationFormat,\n * handleInputPaste,\n * handleDisambiguationSelect,\n * setShowDisambiguationModal,\n * setSelectedDisambiguationFormat,\n * } = useCoordinatePaste({\n * onValueApplied: setValue,\n * onError: (msg) => console.error(msg),\n * });\n *\n * return (\n * <>\n * <div onPaste={handleInputPaste}>\n * // ...Coordinate input segments\n * </div>\n * {showDisambiguationModal && (\n * <Dialog onClose={() => setShowDisambiguationModal(false)}>\n * {disambiguationMatches.map((match) => (\n * <Radio\n * key={match.format}\n * value={match.format}\n * isSelected={selectedDisambiguationFormat === match.format}\n * onChange={() => setSelectedDisambiguationFormat(match.format)}\n * >\n * {match.format}: {match.matched}\n * </Radio>\n * ))}\n * <Button onPress={handleDisambiguationSelect}>Confirm</Button>\n * </Dialog>\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @param options - {@link UseCoordinatePasteOptions}\n * @param options.onValueApplied - Callback when a coordinate value is successfully parsed and applied.\n * @param options.onError - Optional error callback for invalid paste attempts.\n * @returns {@link UseCoordinatePasteResult} Paste handling utilities and disambiguation state.\n */\nexport function useCoordinatePaste({\n onValueApplied,\n onError,\n}: UseCoordinatePasteOptions): UseCoordinatePasteResult {\n const [disambiguationMatches, setDisambiguationMatches] = useState<\n ParsedCoordinateMatch[]\n >([]);\n const [showDisambiguationModal, setShowDisambiguationModal] = useState(false);\n const [selectedDisambiguationFormat, setSelectedDisambiguationFormat] =\n useState<CoordinateSystem | null>(null);\n\n /**\n * Handles paste failure when no coordinate formats match\n * Calls onError with \"Invalid coordinate format\" message\n */\n const handlePasteNoMatches = (pastedText: string) => {\n const errorMsg = 'Invalid coordinate format';\n onError?.(errorMsg, { pastedText });\n };\n\n const handlePasteSingleMatch = (match: ParsedCoordinateMatch | undefined) => {\n if (match) {\n onValueApplied(match.value);\n }\n };\n\n const handlePasteMultipleMatches = (matches: ParsedCoordinateMatch[]) => {\n setDisambiguationMatches(matches);\n const firstMatch = matches[0];\n if (firstMatch) {\n setSelectedDisambiguationFormat(firstMatch.format);\n }\n setShowDisambiguationModal(true);\n };\n\n const handleCoordinatePaste = (pastedText: string) => {\n const allMatches = parseCoordinatePaste(pastedText);\n\n if (allMatches.length === 0) {\n handlePasteNoMatches(pastedText);\n return;\n }\n\n // Deduplicate matches by location - only show modal for different locations\n const matches = deduplicateMatchesByLocation(allMatches);\n\n if (matches.length === 1) {\n handlePasteSingleMatch(matches[0]);\n } else {\n handlePasteMultipleMatches(matches);\n }\n };\n\n const handleInputPaste = (e: React.ClipboardEvent<HTMLDivElement>) => {\n const pastedText = e.clipboardData?.getData('text/plain');\n if (pastedText && isCompleteCoordinate(pastedText)) {\n e.preventDefault();\n handleCoordinatePaste(pastedText);\n }\n };\n\n const cleanupDisambiguationModal = () => {\n setShowDisambiguationModal(false);\n setDisambiguationMatches([]);\n setSelectedDisambiguationFormat(null);\n };\n\n const handleDisambiguationSelect = () => {\n if (selectedDisambiguationFormat) {\n const match = disambiguationMatches.find(\n (m) => m.format === selectedDisambiguationFormat,\n );\n if (match) {\n onValueApplied(match.value);\n }\n }\n cleanupDisambiguationModal();\n };\n\n return {\n disambiguationMatches,\n showDisambiguationModal,\n selectedDisambiguationFormat,\n handleInputPaste,\n handleDisambiguationSelect,\n setShowDisambiguationModal,\n setSelectedDisambiguationFormat,\n cleanupDisambiguationModal,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuGA,SAAgB,mBAAmB,EACjC,gBACA,WACsD;CACtD,MAAM,CAAC,uBAAuB,4BAA4B,SAExD,EAAE,CAAC;CACL,MAAM,CAAC,yBAAyB,8BAA8B,SAAS,MAAM;CAC7E,MAAM,CAAC,8BAA8B,mCACnC,SAAkC,KAAK;;;;;CAMzC,MAAM,wBAAwB,eAAuB;AAEnD,YADiB,6BACG,EAAE,YAAY,CAAC;;CAGrC,MAAM,0BAA0B,UAA6C;AAC3E,MAAI,MACF,gBAAe,MAAM,MAAM;;CAI/B,MAAM,8BAA8B,YAAqC;AACvE,2BAAyB,QAAQ;EACjC,MAAM,aAAa,QAAQ;AAC3B,MAAI,WACF,iCAAgC,WAAW,OAAO;AAEpD,6BAA2B,KAAK;;CAGlC,MAAM,yBAAyB,eAAuB;EACpD,MAAM,aAAa,qBAAqB,WAAW;AAEnD,MAAI,WAAW,WAAW,GAAG;AAC3B,wBAAqB,WAAW;AAChC;;EAIF,MAAM,UAAU,6BAA6B,WAAW;AAExD,MAAI,QAAQ,WAAW,EACrB,wBAAuB,QAAQ,GAAG;MAElC,4BAA2B,QAAQ;;CAIvC,MAAM,oBAAoB,MAA4C;EACpE,MAAM,aAAa,EAAE,eAAe,QAAQ,aAAa;AACzD,MAAI,cAAc,qBAAqB,WAAW,EAAE;AAClD,KAAE,gBAAgB;AAClB,yBAAsB,WAAW;;;CAIrC,MAAM,mCAAmC;AACvC,6BAA2B,MAAM;AACjC,2BAAyB,EAAE,CAAC;AAC5B,kCAAgC,KAAK;;CAGvC,MAAM,mCAAmC;AACvC,MAAI,8BAA8B;GAChC,MAAM,QAAQ,sBAAsB,MACjC,MAAM,EAAE,WAAW,6BACrB;AACD,OAAI,MACF,gBAAe,MAAM,MAAM;;AAG/B,8BAA4B;;AAG9B,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"use-coordinate-paste.js","names":[],"sources":["../../../src/hooks/coordinate-field/use-coordinate-paste.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { useState } from 'react';\nimport {\n deduplicateMatchesByLocation,\n isCompleteCoordinate,\n parseCoordinatePaste,\n} from '../../components/coordinate-field/coordinate-utils';\nimport type {\n CoordinateSystem,\n CoordinateValue,\n ParsedCoordinateMatch,\n} from '../../components/coordinate-field/types';\n\n/** Options for the useCoordinatePaste hook */\nexport interface UseCoordinatePasteOptions {\n /** Callback when a coordinate value is successfully parsed and applied */\n onValueApplied: (value: CoordinateValue) => void;\n /** Optional error callback for invalid paste attempts */\n onError?: (message: string, context?: Record<string, unknown>) => void;\n}\n\n/** Return value from the useCoordinatePaste hook */\nexport interface UseCoordinatePasteResult {\n /** Array of parsed coordinate matches for disambiguation */\n disambiguationMatches: ParsedCoordinateMatch[];\n /** Whether the disambiguation modal is visible */\n showDisambiguationModal: boolean;\n /** Currently selected format in disambiguation modal */\n selectedDisambiguationFormat: CoordinateSystem | null;\n /** Paste event handler for coordinate input */\n handleInputPaste: (e: React.ClipboardEvent<HTMLDivElement>) => void;\n /** Confirm selection in disambiguation modal */\n handleDisambiguationSelect: () => void;\n /** Control disambiguation modal visibility */\n setShowDisambiguationModal: (show: boolean) => void;\n /** Set the selected format in disambiguation modal */\n setSelectedDisambiguationFormat: (format: CoordinateSystem | null) => void;\n /** Reset disambiguation modal state */\n cleanupDisambiguationModal: () => void;\n}\n\n/**\n * Handles paste events with coordinate parsing and disambiguation when multiple formats match\n *\n * @example\n * ```tsx\n * function CoordinateFieldWithPaste() {\n * const [value, setValue] = useState<CoordinateValue | null>(null);\n *\n * const {\n * disambiguationMatches,\n * showDisambiguationModal,\n * selectedDisambiguationFormat,\n * handleInputPaste,\n * handleDisambiguationSelect,\n * setShowDisambiguationModal,\n * setSelectedDisambiguationFormat,\n * } = useCoordinatePaste({\n * onValueApplied: setValue,\n * onError: (msg) => console.error(msg),\n * });\n *\n * return (\n * <>\n * <div onPaste={handleInputPaste}>\n * // ...Coordinate input segments\n * </div>\n * {showDisambiguationModal && (\n * <Dialog onClose={() => setShowDisambiguationModal(false)}>\n * {disambiguationMatches.map((match) => (\n * <Radio\n * key={match.format}\n * value={match.format}\n * isSelected={selectedDisambiguationFormat === match.format}\n * onChange={() => setSelectedDisambiguationFormat(match.format)}\n * >\n * {match.format}: {match.matched}\n * </Radio>\n * ))}\n * <Button onPress={handleDisambiguationSelect}>Confirm</Button>\n * </Dialog>\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @param options - {@link UseCoordinatePasteOptions}\n * @param options.onValueApplied - Callback when a coordinate value is successfully parsed and applied.\n * @param options.onError - Optional error callback for invalid paste attempts.\n * @returns {@link UseCoordinatePasteResult} Paste handling utilities and disambiguation state.\n */\nexport function useCoordinatePaste({\n onValueApplied,\n onError,\n}: UseCoordinatePasteOptions): UseCoordinatePasteResult {\n const [disambiguationMatches, setDisambiguationMatches] = useState<\n ParsedCoordinateMatch[]\n >([]);\n const [showDisambiguationModal, setShowDisambiguationModal] = useState(false);\n const [selectedDisambiguationFormat, setSelectedDisambiguationFormat] =\n useState<CoordinateSystem | null>(null);\n\n /**\n * Handles paste failure when no coordinate formats match\n * Calls onError with \"Invalid coordinate format\" message\n */\n const handlePasteNoMatches = (pastedText: string) => {\n const errorMsg = 'Invalid coordinate format';\n onError?.(errorMsg, { pastedText });\n };\n\n const handlePasteSingleMatch = (match: ParsedCoordinateMatch | undefined) => {\n if (match) {\n onValueApplied(match.value);\n }\n };\n\n const handlePasteMultipleMatches = (matches: ParsedCoordinateMatch[]) => {\n setDisambiguationMatches(matches);\n const firstMatch = matches[0];\n if (firstMatch) {\n setSelectedDisambiguationFormat(firstMatch.format);\n }\n setShowDisambiguationModal(true);\n };\n\n /**\n * Normalizes MGRS coordinate input to a standard format.\n *\n * - Converts all letters to uppercase\n * - Adds leading zero to single-digit grid zones (e.g., \"6R\" → \"06R\")\n * - Handles both spaced (\"6R YP 12345 67890\") and compact (\"6RYP1234567890\") formats\n *\n * @param input - Raw MGRS coordinate string\n * @returns Normalized MGRS coordinate string\n *\n * @example\n * normalizeMgrsInput(\"6r yp 12345 67890\") // → \"06R YP 12345 67890\"\n * normalizeMgrsInput(\"6ryp1234567890\") // → \"06RYP1234567890\"\n */\n const normalizeMgrsInput = (input: string): string => {\n let normalized = input.toUpperCase();\n\n const match = normalized.match(/^(\\d)([A-Z])/);\n\n if (match?.[1]) {\n // Add leading zero to single-digit grid zones\n normalized = match[1].padStart(2, '0') + normalized.slice(1);\n }\n\n return normalized;\n };\n\n const handleCoordinatePaste = (pastedText: string) => {\n const allMatches = parseCoordinatePaste(pastedText);\n\n if (allMatches.length === 0) {\n handlePasteNoMatches(pastedText);\n return;\n }\n\n // Deduplicate matches by location - only show modal for different locations\n const matches = deduplicateMatchesByLocation(allMatches);\n\n if (matches.length === 1) {\n handlePasteSingleMatch(matches[0]);\n } else {\n handlePasteMultipleMatches(matches);\n }\n };\n\n const handleInputPaste = (e: React.ClipboardEvent<HTMLDivElement>) => {\n const rawPastedText = e.clipboardData?.getData('text/plain');\n if (rawPastedText) {\n const pastedText = normalizeMgrsInput(rawPastedText);\n\n if (isCompleteCoordinate(pastedText)) {\n e.preventDefault();\n handleCoordinatePaste(pastedText);\n }\n }\n };\n\n const cleanupDisambiguationModal = () => {\n setShowDisambiguationModal(false);\n setDisambiguationMatches([]);\n setSelectedDisambiguationFormat(null);\n };\n\n const handleDisambiguationSelect = () => {\n if (selectedDisambiguationFormat) {\n const match = disambiguationMatches.find(\n (m) => m.format === selectedDisambiguationFormat,\n );\n if (match) {\n onValueApplied(match.value);\n }\n }\n cleanupDisambiguationModal();\n };\n\n return {\n disambiguationMatches,\n showDisambiguationModal,\n selectedDisambiguationFormat,\n handleInputPaste,\n handleDisambiguationSelect,\n setShowDisambiguationModal,\n setSelectedDisambiguationFormat,\n cleanupDisambiguationModal,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuGA,SAAgB,mBAAmB,EACjC,gBACA,WACsD;CACtD,MAAM,CAAC,uBAAuB,4BAA4B,SAExD,EAAE,CAAC;CACL,MAAM,CAAC,yBAAyB,8BAA8B,SAAS,MAAM;CAC7E,MAAM,CAAC,8BAA8B,mCACnC,SAAkC,KAAK;;;;;CAMzC,MAAM,wBAAwB,eAAuB;AAEnD,YADiB,6BACG,EAAE,YAAY,CAAC;;CAGrC,MAAM,0BAA0B,UAA6C;AAC3E,MAAI,MACF,gBAAe,MAAM,MAAM;;CAI/B,MAAM,8BAA8B,YAAqC;AACvE,2BAAyB,QAAQ;EACjC,MAAM,aAAa,QAAQ;AAC3B,MAAI,WACF,iCAAgC,WAAW,OAAO;AAEpD,6BAA2B,KAAK;;;;;;;;;;;;;;;;CAiBlC,MAAM,sBAAsB,UAA0B;EACpD,IAAI,aAAa,MAAM,aAAa;EAEpC,MAAM,QAAQ,WAAW,MAAM,eAAe;AAE9C,MAAI,QAAQ,GAEV,cAAa,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,WAAW,MAAM,EAAE;AAG9D,SAAO;;CAGT,MAAM,yBAAyB,eAAuB;EACpD,MAAM,aAAa,qBAAqB,WAAW;AAEnD,MAAI,WAAW,WAAW,GAAG;AAC3B,wBAAqB,WAAW;AAChC;;EAIF,MAAM,UAAU,6BAA6B,WAAW;AAExD,MAAI,QAAQ,WAAW,EACrB,wBAAuB,QAAQ,GAAG;MAElC,4BAA2B,QAAQ;;CAIvC,MAAM,oBAAoB,MAA4C;EACpE,MAAM,gBAAgB,EAAE,eAAe,QAAQ,aAAa;AAC5D,MAAI,eAAe;GACjB,MAAM,aAAa,mBAAmB,cAAc;AAEpD,OAAI,qBAAqB,WAAW,EAAE;AACpC,MAAE,gBAAgB;AAClB,0BAAsB,WAAW;;;;CAKvC,MAAM,mCAAmC;AACvC,6BAA2B,MAAM;AACjC,2BAAyB,EAAE,CAAC;AAC5B,kCAAgC,KAAK;;CAGvC,MAAM,mCAAmC;AACvC,MAAI,8BAA8B;GAChC,MAAM,QAAQ,sBAAsB,MACjC,MAAM,EAAE,WAAW,6BACrB;AACD,OAAI,MACF,gBAAe,MAAM,MAAM;;AAG/B,8BAA4B;;AAG9B,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import { PropsWithChildren, RefObject } from "react";
14
- import * as react_jsx_runtime0 from "react/jsx-runtime";
14
+ import * as react_jsx_runtime208 from "react/jsx-runtime";
15
15
 
16
16
  //#region src/providers/portal.d.ts
17
17
  /**
@@ -30,7 +30,7 @@ declare function PortalProvider({
30
30
  }: PropsWithChildren<{
31
31
  parentRef?: RefObject<HTMLElement | null>;
32
32
  inject?: HTMLElement | null;
33
- }>): react_jsx_runtime0.JSX.Element;
33
+ }>): react_jsx_runtime208.JSX.Element;
34
34
  //#endregion
35
35
  export { PortalProvider };
36
36
  //# sourceMappingURL=portal.d.ts.map