@dbcdk/react-components 0.0.103 → 0.0.104

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 (354) hide show
  1. package/dist/assets/logo.cjs +87 -0
  2. package/dist/assets/logo.js +85 -0
  3. package/dist/client.cjs +587 -0
  4. package/dist/client.d.ts +83 -0
  5. package/dist/client.js +84 -0
  6. package/dist/components/accordion/Accordion.cjs +103 -0
  7. package/dist/components/accordion/Accordion.js +97 -0
  8. package/dist/components/accordion/Accordion.module.css +41 -0
  9. package/dist/components/accordion/components/AccordionRow.cjs +115 -0
  10. package/dist/components/accordion/components/AccordionRow.js +109 -0
  11. package/dist/components/accordion/components/AccordionRow.module.css +99 -0
  12. package/dist/components/alert/Alert.cjs +52 -0
  13. package/dist/components/alert/Alert.d.ts +2 -1
  14. package/dist/components/alert/Alert.js +46 -0
  15. package/dist/components/alert/Alert.module.css +97 -0
  16. package/dist/components/app-header/AppHeader.cjs +14 -0
  17. package/dist/components/app-header/AppHeader.js +8 -0
  18. package/dist/components/app-header/AppHeader.module.css +74 -0
  19. package/dist/components/attribute-chip/AttributeChip.cjs +22 -0
  20. package/dist/components/attribute-chip/AttributeChip.js +16 -0
  21. package/dist/components/attribute-chip/AttributeChip.module.css +65 -0
  22. package/dist/components/avatar/Avatar.cjs +111 -0
  23. package/dist/components/avatar/Avatar.js +86 -0
  24. package/dist/components/avatar/Avatar.module.css +91 -0
  25. package/dist/components/breadcrumbs/Breadcrumbs.cjs +24 -0
  26. package/dist/components/breadcrumbs/Breadcrumbs.js +18 -0
  27. package/dist/components/breadcrumbs/Breadcrumbs.module.css +80 -0
  28. package/dist/components/button/Button.cjs +149 -0
  29. package/dist/components/button/Button.js +124 -0
  30. package/dist/components/button/Button.module.css +260 -0
  31. package/dist/components/button-select/ButtonSelect.cjs +35 -0
  32. package/dist/components/button-select/ButtonSelect.js +29 -0
  33. package/dist/components/button-select/ButtonSelect.module.css +40 -0
  34. package/dist/components/card/Card.cjs +112 -0
  35. package/dist/components/card/Card.d.ts +2 -1
  36. package/dist/components/card/Card.js +106 -0
  37. package/dist/components/card/Card.module.css +187 -0
  38. package/dist/components/card/components/CardMeta.cjs +62 -0
  39. package/dist/components/card/components/CardMeta.js +55 -0
  40. package/dist/components/card/components/CardMeta.module.css +55 -0
  41. package/dist/components/card-container/CardContainer.cjs +34 -0
  42. package/dist/components/card-container/CardContainer.js +28 -0
  43. package/dist/components/card-container/CardContainer.module.css +63 -0
  44. package/dist/components/chip/Chip.cjs +65 -0
  45. package/dist/components/chip/Chip.js +59 -0
  46. package/dist/components/chip/Chip.module.css +236 -0
  47. package/dist/components/circle/Circle.cjs +33 -0
  48. package/dist/components/circle/Circle.js +27 -0
  49. package/dist/components/circle/Circle.module.css +128 -0
  50. package/dist/components/clear-button/ClearButton.cjs +33 -0
  51. package/dist/components/clear-button/ClearButton.d.ts +2 -1
  52. package/dist/components/clear-button/ClearButton.js +27 -0
  53. package/dist/components/clear-button/ClearButton.module.css +26 -0
  54. package/dist/components/code-block/CodeBlock.cjs +97 -0
  55. package/dist/components/code-block/CodeBlock.js +91 -0
  56. package/dist/components/code-block/CodeBlock.module.css +124 -0
  57. package/dist/components/copy-button/CopyButton.cjs +139 -0
  58. package/dist/components/copy-button/CopyButton.js +133 -0
  59. package/dist/components/copy-button/CopyButton.module.css +22 -0
  60. package/dist/components/datetime-picker/DateTimePicker.cjs +559 -0
  61. package/dist/components/datetime-picker/DateTimePicker.js +553 -0
  62. package/dist/components/datetime-picker/DateTimePicker.module.css +155 -0
  63. package/dist/components/datetime-picker/dateTimeHelpers.cjs +179 -0
  64. package/dist/components/datetime-picker/dateTimeHelpers.js +160 -0
  65. package/dist/components/divider/Divider.cjs +22 -0
  66. package/dist/components/divider/Divider.js +20 -0
  67. package/dist/components/filter-field/FilterField.cjs +296 -0
  68. package/dist/components/filter-field/FilterField.js +289 -0
  69. package/dist/components/filter-field/FilterField.module.css +379 -0
  70. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.cjs +115 -0
  71. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +108 -0
  72. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +59 -0
  73. package/dist/components/forms/checkbox/Checkbox.cjs +88 -0
  74. package/dist/components/forms/checkbox/Checkbox.js +82 -0
  75. package/dist/components/forms/checkbox/Checkbox.module.css +104 -0
  76. package/dist/components/forms/checkbox-group/CheckboxGroup.cjs +121 -0
  77. package/dist/components/forms/checkbox-group/CheckboxGroup.js +115 -0
  78. package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +115 -0
  79. package/dist/components/forms/form-select/FormSelect.cjs +191 -0
  80. package/dist/components/forms/form-select/FormSelect.js +166 -0
  81. package/dist/components/forms/form-select/FormSelect.module.css +236 -0
  82. package/dist/components/forms/input/Input.cjs +188 -0
  83. package/dist/components/forms/input/Input.d.ts +1 -0
  84. package/dist/components/forms/input/Input.js +182 -0
  85. package/dist/components/forms/input/Input.module.css +468 -0
  86. package/dist/components/forms/input-container/InputContainer.cjs +72 -0
  87. package/dist/components/forms/input-container/InputContainer.js +66 -0
  88. package/dist/components/forms/input-container/InputContainer.module.css +59 -0
  89. package/dist/components/forms/multi-select/MultiSelect.cjs +227 -0
  90. package/dist/components/forms/multi-select/MultiSelect.js +225 -0
  91. package/dist/components/forms/radio-buttons/RadioButton.cjs +91 -0
  92. package/dist/components/forms/radio-buttons/RadioButton.js +85 -0
  93. package/dist/components/forms/radio-buttons/RadioButtonGroup.cjs +74 -0
  94. package/dist/components/forms/radio-buttons/RadioButtonGroup.js +72 -0
  95. package/dist/components/forms/radio-buttons/RadioButtons.module.css +118 -0
  96. package/dist/components/forms/select/Select.cjs +286 -0
  97. package/dist/components/forms/select/Select.js +280 -0
  98. package/dist/components/forms/select/Select.module.css +32 -0
  99. package/dist/components/forms/text-area/Textarea.cjs +116 -0
  100. package/dist/components/forms/text-area/Textarea.js +110 -0
  101. package/dist/components/forms/text-area/Textarea.module.css +70 -0
  102. package/dist/components/forms/typeahead/Typeahead.cjs +792 -0
  103. package/dist/components/forms/typeahead/Typeahead.js +768 -0
  104. package/dist/components/forms/typeahead/Typeahead.module.css +38 -0
  105. package/dist/components/grid/Grid.cjs +45 -0
  106. package/dist/components/grid/Grid.js +38 -0
  107. package/dist/components/grid/Grid.module.css +35 -0
  108. package/dist/components/headline/CollapsibleHeadline.cjs +80 -0
  109. package/dist/components/headline/CollapsibleHeadline.js +74 -0
  110. package/dist/components/headline/Headline.cjs +59 -0
  111. package/dist/components/headline/Headline.js +53 -0
  112. package/dist/components/headline/Headline.module.css +185 -0
  113. package/dist/components/hyperlink/Hyperlink.cjs +107 -0
  114. package/dist/components/hyperlink/Hyperlink.js +82 -0
  115. package/dist/components/hyperlink/Hyperlink.module.css +121 -0
  116. package/dist/components/icon/Icon.cjs +27 -0
  117. package/dist/components/icon/Icon.js +20 -0
  118. package/dist/components/icon/Icon.module.css +36 -0
  119. package/dist/components/inline-status/InlineStatus.cjs +39 -0
  120. package/dist/components/inline-status/InlineStatus.js +33 -0
  121. package/dist/components/inline-status/InlineStatus.module.css +92 -0
  122. package/dist/components/interval-select/IntervalSelect.cjs +203 -0
  123. package/dist/components/interval-select/IntervalSelect.js +201 -0
  124. package/dist/components/json-viewer/HighlightedText.cjs +13 -0
  125. package/dist/components/json-viewer/HighlightedText.js +11 -0
  126. package/dist/components/json-viewer/JsonNode.cjs +124 -0
  127. package/dist/components/json-viewer/JsonNode.js +118 -0
  128. package/dist/components/json-viewer/JsonViewer.cjs +164 -0
  129. package/dist/components/json-viewer/JsonViewer.js +158 -0
  130. package/dist/components/json-viewer/JsonViewer.module.css +346 -0
  131. package/dist/components/json-viewer/types.cjs +2 -0
  132. package/dist/components/json-viewer/types.js +1 -0
  133. package/dist/components/json-viewer/useClipboardStatus.cjs +15 -0
  134. package/dist/components/json-viewer/useClipboardStatus.js +13 -0
  135. package/dist/components/json-viewer/utils.cjs +126 -0
  136. package/dist/components/json-viewer/utils.js +111 -0
  137. package/dist/components/media-card/MediaCard.cjs +60 -0
  138. package/dist/components/media-card/MediaCard.d.ts +19 -0
  139. package/dist/components/media-card/MediaCard.js +54 -0
  140. package/dist/components/media-card/MediaCard.module.css +92 -0
  141. package/dist/components/menu/Menu.cjs +287 -0
  142. package/dist/components/menu/Menu.js +262 -0
  143. package/dist/components/menu/Menu.module.css +220 -0
  144. package/dist/components/meta-bar/MetaBar.cjs +28 -0
  145. package/dist/components/meta-bar/MetaBar.js +22 -0
  146. package/dist/components/meta-bar/MetaBar.module.css +27 -0
  147. package/dist/components/nav-bar/NavBar.cjs +95 -0
  148. package/dist/components/nav-bar/NavBar.d.ts +1 -1
  149. package/dist/components/nav-bar/NavBar.js +89 -0
  150. package/dist/components/nav-bar/NavBar.module.css +225 -0
  151. package/dist/components/overlay/fade-overlay/FadeOverlay.cjs +30 -0
  152. package/dist/components/overlay/fade-overlay/FadeOverlay.js +24 -0
  153. package/dist/components/overlay/fade-overlay/FadeOverlay.module.css +54 -0
  154. package/dist/components/overlay/modal/Modal.cjs +189 -0
  155. package/dist/components/overlay/modal/Modal.d.ts +2 -1
  156. package/dist/components/overlay/modal/Modal.js +183 -0
  157. package/dist/components/overlay/modal/Modal.module.css +112 -0
  158. package/dist/components/overlay/modal/provider/ModalProvider.cjs +98 -0
  159. package/dist/components/overlay/modal/provider/ModalProvider.js +95 -0
  160. package/dist/components/overlay/side-panel/SidePanel.cjs +173 -0
  161. package/dist/components/overlay/side-panel/SidePanel.js +167 -0
  162. package/dist/components/overlay/side-panel/SidePanel.module.css +177 -0
  163. package/dist/components/overlay/side-panel/useSidePanel.cjs +16 -0
  164. package/dist/components/overlay/side-panel/useSidePanel.js +14 -0
  165. package/dist/components/overlay/tooltip/Tooltip.cjs +34 -0
  166. package/dist/components/overlay/tooltip/Tooltip.js +32 -0
  167. package/dist/components/overlay/tooltip/Tooltip.module.css +104 -0
  168. package/dist/components/overlay/tooltip/TooltipProvider.cjs +238 -0
  169. package/dist/components/overlay/tooltip/TooltipProvider.js +231 -0
  170. package/dist/components/overlay/tooltip/useTooltipTrigger.cjs +117 -0
  171. package/dist/components/overlay/tooltip/useTooltipTrigger.js +115 -0
  172. package/dist/components/page/Page.cjs +63 -0
  173. package/dist/components/page/Page.js +57 -0
  174. package/dist/components/page/Page.module.css +95 -0
  175. package/dist/components/page-layout/PageLayout.cjs +97 -0
  176. package/dist/components/page-layout/PageLayout.d.ts +0 -5
  177. package/dist/components/page-layout/PageLayout.js +91 -0
  178. package/dist/components/page-layout/PageLayout.module.css +236 -0
  179. package/dist/components/page-layout/components/footer/Footer.cjs +53 -0
  180. package/dist/components/page-layout/components/footer/Footer.js +47 -0
  181. package/dist/components/page-layout/components/footer/Footer.module.css +89 -0
  182. package/dist/components/pagination/Pagination.cjs +160 -0
  183. package/dist/components/pagination/Pagination.js +154 -0
  184. package/dist/components/pagination/Pagination.module.css +25 -0
  185. package/dist/components/panel/Panel.cjs +38 -0
  186. package/dist/components/panel/Panel.js +32 -0
  187. package/dist/components/panel/Panel.module.css +30 -0
  188. package/dist/components/popover/Popover.cjs +331 -0
  189. package/dist/components/popover/Popover.js +307 -0
  190. package/dist/components/popover/Popover.module.css +52 -0
  191. package/dist/components/search-box/SearchBox.cjs +274 -0
  192. package/dist/components/search-box/SearchBox.js +268 -0
  193. package/dist/components/search-box/SearchBox.module.css +27 -0
  194. package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +127 -0
  195. package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +121 -0
  196. package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +174 -0
  197. package/dist/components/sidebar/Sidebar.cjs +39 -0
  198. package/dist/components/sidebar/Sidebar.js +37 -0
  199. package/dist/components/sidebar/components/SidebarItem.cjs +29 -0
  200. package/dist/components/sidebar/components/SidebarItem.js +27 -0
  201. package/dist/components/sidebar/components/SidebarItem.module.css +0 -0
  202. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +133 -0
  203. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +127 -0
  204. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +29 -0
  205. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +214 -0
  206. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +207 -0
  207. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +260 -0
  208. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +54 -0
  209. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +47 -0
  210. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +106 -0
  211. package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +61 -0
  212. package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +55 -0
  213. package/dist/components/sidebar/components/sidebar-items/SidebarItems.module.css +20 -0
  214. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +97 -0
  215. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +91 -0
  216. package/dist/components/sidebar/providers/SidebarProvider.cjs +223 -0
  217. package/dist/components/sidebar/providers/SidebarProvider.js +220 -0
  218. package/dist/components/skeleton-loader/SkeletonLoader.cjs +442 -0
  219. package/dist/components/skeleton-loader/SkeletonLoader.js +440 -0
  220. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +42 -0
  221. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +36 -0
  222. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +51 -0
  223. package/dist/components/split-button/SplitButton.cjs +46 -0
  224. package/dist/components/split-button/SplitButton.js +40 -0
  225. package/dist/components/split-button/SplitButton.module.css +32 -0
  226. package/dist/components/split-pane/SplitPane.cjs +177 -0
  227. package/dist/components/split-pane/SplitPane.js +168 -0
  228. package/dist/components/split-pane/SplitPane.module.css +111 -0
  229. package/dist/components/split-pane/provider/SplitPaneContext.cjs +129 -0
  230. package/dist/components/split-pane/provider/SplitPaneContext.js +121 -0
  231. package/dist/components/stack/Stack.cjs +47 -0
  232. package/dist/components/stack/Stack.d.ts +1 -1
  233. package/dist/components/stack/Stack.js +41 -0
  234. package/dist/components/stack/Stack.module.css +61 -0
  235. package/dist/components/state-page/StatePage.cjs +48 -0
  236. package/dist/components/state-page/StatePage.js +42 -0
  237. package/dist/components/state-page/StatePage.module.css +9 -0
  238. package/dist/components/state-page/empty.cjs +664 -0
  239. package/dist/components/state-page/empty.js +662 -0
  240. package/dist/components/state-page/error.cjs +310 -0
  241. package/dist/components/state-page/error.js +308 -0
  242. package/dist/components/state-page/notFound.cjs +243 -0
  243. package/dist/components/state-page/notFound.js +241 -0
  244. package/dist/components/sticky-footer-layout/StickyFooterLayout.cjs +98 -0
  245. package/dist/components/sticky-footer-layout/StickyFooterLayout.js +96 -0
  246. package/dist/components/table/Table.cjs +216 -0
  247. package/dist/components/table/Table.js +210 -0
  248. package/dist/components/table/Table.module.css +534 -0
  249. package/dist/components/table/Table.types.cjs +2 -0
  250. package/dist/components/table/Table.types.js +1 -0
  251. package/dist/components/table/TanstackTable.cjs +172 -0
  252. package/dist/components/table/TanstackTable.js +147 -0
  253. package/dist/components/table/components/TableBody.cjs +50 -0
  254. package/dist/components/table/components/TableBody.js +44 -0
  255. package/dist/components/table/components/TableHeader.cjs +56 -0
  256. package/dist/components/table/components/TableHeader.js +50 -0
  257. package/dist/components/table/components/TableHeaderCell.cjs +69 -0
  258. package/dist/components/table/components/TableHeaderCell.js +63 -0
  259. package/dist/components/table/components/TableLoadingBody.cjs +35 -0
  260. package/dist/components/table/components/TableLoadingBody.js +29 -0
  261. package/dist/components/table/components/TablePagination.cjs +2 -0
  262. package/dist/components/table/components/TablePagination.js +1 -0
  263. package/dist/components/table/components/TableRow.cjs +151 -0
  264. package/dist/components/table/components/TableRow.js +145 -0
  265. package/dist/components/table/components/TableSelectionCell.cjs +41 -0
  266. package/dist/components/table/components/TableSelectionCell.js +35 -0
  267. package/dist/components/table/components/column-resizer/ColumnResizer.cjs +25 -0
  268. package/dist/components/table/components/column-resizer/ColumnResizer.js +19 -0
  269. package/dist/components/table/components/column-resizer/ColumnResizer.module.css +22 -0
  270. package/dist/components/table/components/empty-state/EmptyState.cjs +33 -0
  271. package/dist/components/table/components/empty-state/EmptyState.js +31 -0
  272. package/dist/components/table/components/empty-state/EmptyState.module.css +4 -0
  273. package/dist/components/table/components/table-settings/TableSettings.cjs +139 -0
  274. package/dist/components/table/components/table-settings/TableSettings.js +137 -0
  275. package/dist/components/table/hooks/useTableRowInteractions.cjs +46 -0
  276. package/dist/components/table/hooks/useTableRowInteractions.js +44 -0
  277. package/dist/components/table/table.classes.cjs +49 -0
  278. package/dist/components/table/table.classes.js +40 -0
  279. package/dist/components/table/table.utils.cjs +57 -0
  280. package/dist/components/table/table.utils.js +45 -0
  281. package/dist/components/table/tanstackTable.utils.cjs +166 -0
  282. package/dist/components/table/tanstackTable.utils.js +159 -0
  283. package/dist/components/tabs/Tabs.cjs +172 -0
  284. package/dist/components/tabs/Tabs.js +166 -0
  285. package/dist/components/tabs/Tabs.module.css +261 -0
  286. package/dist/components/theme-button/ThemeButton.cjs +78 -0
  287. package/dist/components/theme-button/ThemeButton.js +75 -0
  288. package/dist/components/toast/Toast.cjs +68 -0
  289. package/dist/components/toast/Toast.js +62 -0
  290. package/dist/components/toast/Toast.module.css +161 -0
  291. package/dist/components/toast/provider/ToastProvider.cjs +105 -0
  292. package/dist/components/toast/provider/ToastProvider.js +97 -0
  293. package/dist/components/user-display/UserDisplay.cjs +22 -0
  294. package/dist/components/user-display/UserDisplay.js +16 -0
  295. package/dist/components/user-display/UserDisplay.module.css +25 -0
  296. package/dist/constants/chart-colors.cjs +10 -0
  297. package/dist/constants/chart-colors.js +8 -0
  298. package/dist/constants/chart-colors.types.cjs +2 -0
  299. package/dist/constants/chart-colors.types.js +1 -0
  300. package/dist/constants/severity.cjs +30 -0
  301. package/dist/constants/severity.js +26 -0
  302. package/dist/constants/severity.types.cjs +2 -0
  303. package/dist/constants/severity.types.js +1 -0
  304. package/dist/constants/sizes.cjs +11 -0
  305. package/dist/constants/sizes.js +9 -0
  306. package/dist/hooks/useDeviceSize.cjs +35 -0
  307. package/dist/hooks/useDeviceSize.js +33 -0
  308. package/dist/hooks/useListNavigation.cjs +237 -0
  309. package/dist/hooks/useListNavigation.js +235 -0
  310. package/dist/hooks/usePagination.cjs +144 -0
  311. package/dist/hooks/usePagination.js +142 -0
  312. package/dist/hooks/useSorting.cjs +119 -0
  313. package/dist/hooks/useSorting.js +117 -0
  314. package/dist/hooks/useTableData.cjs +53 -0
  315. package/dist/hooks/useTableData.js +51 -0
  316. package/dist/hooks/useTableSelection.cjs +172 -0
  317. package/dist/hooks/useTableSelection.js +170 -0
  318. package/dist/hooks/useTableSettings.cjs +90 -0
  319. package/dist/hooks/useTableSettings.js +87 -0
  320. package/dist/hooks/useTheme.cjs +64 -0
  321. package/dist/hooks/useTheme.js +62 -0
  322. package/dist/hooks/useTimeDuration.cjs +72 -0
  323. package/dist/hooks/useTimeDuration.js +70 -0
  324. package/dist/hooks/useViewportFill.cjs +82 -0
  325. package/dist/hooks/useViewportFill.js +80 -0
  326. package/dist/index.cjs +161 -12908
  327. package/dist/index.css +67 -7357
  328. package/dist/index.d.ts +0 -58
  329. package/dist/index.js +24 -12809
  330. package/dist/styles/animation.cjs +9 -0
  331. package/dist/styles/animation.js +7 -0
  332. package/dist/styles/themes/dbc/colors.css +5 -0
  333. package/dist/styles/themes/types.cjs +2 -0
  334. package/dist/styles/themes/types.js +1 -0
  335. package/dist/tanstack.cjs +18 -2717
  336. package/dist/tanstack.js +3 -2701
  337. package/dist/types/a11y-props.types.cjs +2 -0
  338. package/dist/types/a11y-props.types.js +1 -0
  339. package/dist/types/assets.d.cjs +2 -0
  340. package/dist/types/assets.d.js +1 -0
  341. package/dist/types/css.d.cjs +2 -0
  342. package/dist/types/css.d.js +1 -0
  343. package/dist/types/sizes.types.cjs +2 -0
  344. package/dist/types/sizes.types.js +1 -0
  345. package/dist/utils/arrays/nested-filtering.cjs +40 -0
  346. package/dist/utils/arrays/nested-filtering.js +38 -0
  347. package/dist/utils/date/formatDate.cjs +35 -0
  348. package/dist/utils/date/formatDate.js +33 -0
  349. package/dist/utils/localStorage.utils.cjs +53 -0
  350. package/dist/utils/localStorage.utils.js +49 -0
  351. package/dist/utils/text/get-highlighted-segments.cjs +49 -0
  352. package/dist/utils/text/get-highlighted-segments.js +47 -0
  353. package/package.json +8 -3
  354. package/dist/tanstack.css +0 -1385
@@ -0,0 +1,177 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var react = require('react');
6
+ var SplitPaneContext = require('./provider/SplitPaneContext');
7
+ var styles = require('./SplitPane.module.css');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var styles__default = /*#__PURE__*/_interopDefault(styles);
12
+
13
+ function clamp(n, min, max) {
14
+ return Math.max(min, Math.min(max, n));
15
+ }
16
+ function SplitPane({
17
+ children,
18
+ initialPrimarySize = 300,
19
+ minPrimarySize = 160,
20
+ minSecondarySize = 160,
21
+ direction = "horizontal",
22
+ showDivider = "hover",
23
+ gutterSize = 16,
24
+ storageKey
25
+ }) {
26
+ return /* @__PURE__ */ jsxRuntime.jsx(
27
+ SplitPaneContext.SplitPaneProvider,
28
+ {
29
+ direction,
30
+ initialPrimarySize,
31
+ minPrimarySize,
32
+ minSecondarySize,
33
+ storageKey,
34
+ children: /* @__PURE__ */ jsxRuntime.jsx(SplitPaneContainer, { showDivider, gutterSize, children })
35
+ }
36
+ );
37
+ }
38
+ function SplitPaneContainer({
39
+ children,
40
+ showDivider,
41
+ gutterSize
42
+ }) {
43
+ const { direction, primarySize, containerRef } = SplitPaneContext.useSplitPaneContext();
44
+ const style = react.useMemo(
45
+ () => ({
46
+ "--split-pane-primary-size": `${primarySize}px`,
47
+ "--split-pane-gutter": `${gutterSize}px`
48
+ }),
49
+ [primarySize, gutterSize]
50
+ );
51
+ return /* @__PURE__ */ jsxRuntime.jsx(
52
+ "div",
53
+ {
54
+ ref: containerRef,
55
+ className: styles__default.default.container,
56
+ "data-direction": direction,
57
+ "data-divider": showDivider,
58
+ style,
59
+ children
60
+ }
61
+ );
62
+ }
63
+ function SplitPanePrimary({ children }) {
64
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.primary, children });
65
+ }
66
+ function SplitPaneSecondary({ children }) {
67
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.secondary, children });
68
+ }
69
+ function SplitPaneGutter() {
70
+ const {
71
+ direction,
72
+ primarySize,
73
+ setPrimarySize,
74
+ minPrimarySize,
75
+ minSecondarySize,
76
+ containerRef,
77
+ resetDefault
78
+ } = SplitPaneContext.useSplitPaneContext();
79
+ const draggingRef = react.useRef(false);
80
+ const pointerIdRef = react.useRef(null);
81
+ const startPosRef = react.useRef(0);
82
+ const startSizeRef = react.useRef(primarySize);
83
+ const maxPrimaryRef = react.useRef(Infinity);
84
+ const getClientPos = react.useCallback(
85
+ (e) => direction === "horizontal" ? e.clientX : e.clientY,
86
+ [direction]
87
+ );
88
+ const computeClamp = react.useCallback(() => {
89
+ const el = containerRef.current;
90
+ if (!el) return { maxPrimary: Infinity, total: 0 };
91
+ const rect = el.getBoundingClientRect();
92
+ const total = direction === "horizontal" ? rect.width : rect.height;
93
+ const maxPrimary2 = Math.max(minPrimarySize, total - minSecondarySize);
94
+ return { maxPrimary: maxPrimary2, total };
95
+ }, [containerRef, direction, minPrimarySize, minSecondarySize]);
96
+ const onPointerDown = react.useCallback(
97
+ (e) => {
98
+ const el = containerRef.current;
99
+ if (!el) return;
100
+ e.currentTarget.setPointerCapture(e.pointerId);
101
+ const { maxPrimary: maxPrimary2 } = computeClamp();
102
+ maxPrimaryRef.current = maxPrimary2;
103
+ draggingRef.current = true;
104
+ pointerIdRef.current = e.pointerId;
105
+ startPosRef.current = getClientPos(e);
106
+ startSizeRef.current = primarySize;
107
+ document.body.style.userSelect = "none";
108
+ document.body.style.cursor = direction === "horizontal" ? "col-resize" : "row-resize";
109
+ },
110
+ [computeClamp, containerRef, direction, getClientPos, primarySize]
111
+ );
112
+ const onPointerMove = react.useCallback(
113
+ (e) => {
114
+ if (!draggingRef.current) return;
115
+ if (pointerIdRef.current !== null && e.pointerId !== pointerIdRef.current) return;
116
+ const delta = getClientPos(e) - startPosRef.current;
117
+ const next = startSizeRef.current + delta;
118
+ const maxPrimary2 = maxPrimaryRef.current;
119
+ setPrimarySize(clamp(next, minPrimarySize, maxPrimary2));
120
+ },
121
+ [getClientPos, minPrimarySize, setPrimarySize]
122
+ );
123
+ const endDrag = react.useCallback(() => {
124
+ if (!draggingRef.current) return;
125
+ draggingRef.current = false;
126
+ pointerIdRef.current = null;
127
+ document.body.style.cursor = "";
128
+ document.body.style.userSelect = "";
129
+ }, []);
130
+ const onPointerUp = react.useCallback(() => endDrag(), [endDrag]);
131
+ const onPointerCancel = react.useCallback(() => endDrag(), [endDrag]);
132
+ const onKeyDown = react.useCallback(
133
+ (e) => {
134
+ const { maxPrimary: maxPrimary2 } = computeClamp();
135
+ const step = e.shiftKey ? 32 : 8;
136
+ let next = null;
137
+ if (direction === "horizontal") {
138
+ if (e.key === "ArrowLeft") next = primarySize - step;
139
+ if (e.key === "ArrowRight") next = primarySize + step;
140
+ } else {
141
+ if (e.key === "ArrowUp") next = primarySize - step;
142
+ if (e.key === "ArrowDown") next = primarySize + step;
143
+ }
144
+ if (e.key === "Home") next = minPrimarySize;
145
+ if (e.key === "End") next = maxPrimary2;
146
+ if (next === null) return;
147
+ e.preventDefault();
148
+ setPrimarySize(clamp(next, minPrimarySize, maxPrimary2));
149
+ },
150
+ [computeClamp, direction, minPrimarySize, primarySize, setPrimarySize]
151
+ );
152
+ const ariaOrientation = direction === "horizontal" ? "vertical" : "horizontal";
153
+ const { maxPrimary } = computeClamp();
154
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.gutter, children: /* @__PURE__ */ jsxRuntime.jsx(
155
+ "div",
156
+ {
157
+ className: styles__default.default.resizer,
158
+ role: "separator",
159
+ "aria-orientation": ariaOrientation,
160
+ "aria-valuemin": Math.round(minPrimarySize),
161
+ "aria-valuemax": Number.isFinite(maxPrimary) ? Math.round(maxPrimary) : void 0,
162
+ "aria-valuenow": Math.round(primarySize),
163
+ tabIndex: 0,
164
+ onPointerDown,
165
+ onPointerMove,
166
+ onPointerUp,
167
+ onPointerCancel,
168
+ onDoubleClick: resetDefault,
169
+ onKeyDown
170
+ }
171
+ ) });
172
+ }
173
+
174
+ exports.SplitPane = SplitPane;
175
+ exports.SplitPaneGutter = SplitPaneGutter;
176
+ exports.SplitPanePrimary = SplitPanePrimary;
177
+ exports.SplitPaneSecondary = SplitPaneSecondary;
@@ -0,0 +1,168 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useMemo, useRef, useCallback } from 'react';
4
+ import { SplitPaneProvider, useSplitPaneContext } from './provider/SplitPaneContext';
5
+ import styles from './SplitPane.module.css';
6
+
7
+ function clamp(n, min, max) {
8
+ return Math.max(min, Math.min(max, n));
9
+ }
10
+ function SplitPane({
11
+ children,
12
+ initialPrimarySize = 300,
13
+ minPrimarySize = 160,
14
+ minSecondarySize = 160,
15
+ direction = "horizontal",
16
+ showDivider = "hover",
17
+ gutterSize = 16,
18
+ storageKey
19
+ }) {
20
+ return /* @__PURE__ */ jsx(
21
+ SplitPaneProvider,
22
+ {
23
+ direction,
24
+ initialPrimarySize,
25
+ minPrimarySize,
26
+ minSecondarySize,
27
+ storageKey,
28
+ children: /* @__PURE__ */ jsx(SplitPaneContainer, { showDivider, gutterSize, children })
29
+ }
30
+ );
31
+ }
32
+ function SplitPaneContainer({
33
+ children,
34
+ showDivider,
35
+ gutterSize
36
+ }) {
37
+ const { direction, primarySize, containerRef } = useSplitPaneContext();
38
+ const style = useMemo(
39
+ () => ({
40
+ "--split-pane-primary-size": `${primarySize}px`,
41
+ "--split-pane-gutter": `${gutterSize}px`
42
+ }),
43
+ [primarySize, gutterSize]
44
+ );
45
+ return /* @__PURE__ */ jsx(
46
+ "div",
47
+ {
48
+ ref: containerRef,
49
+ className: styles.container,
50
+ "data-direction": direction,
51
+ "data-divider": showDivider,
52
+ style,
53
+ children
54
+ }
55
+ );
56
+ }
57
+ function SplitPanePrimary({ children }) {
58
+ return /* @__PURE__ */ jsx("div", { className: styles.primary, children });
59
+ }
60
+ function SplitPaneSecondary({ children }) {
61
+ return /* @__PURE__ */ jsx("div", { className: styles.secondary, children });
62
+ }
63
+ function SplitPaneGutter() {
64
+ const {
65
+ direction,
66
+ primarySize,
67
+ setPrimarySize,
68
+ minPrimarySize,
69
+ minSecondarySize,
70
+ containerRef,
71
+ resetDefault
72
+ } = useSplitPaneContext();
73
+ const draggingRef = useRef(false);
74
+ const pointerIdRef = useRef(null);
75
+ const startPosRef = useRef(0);
76
+ const startSizeRef = useRef(primarySize);
77
+ const maxPrimaryRef = useRef(Infinity);
78
+ const getClientPos = useCallback(
79
+ (e) => direction === "horizontal" ? e.clientX : e.clientY,
80
+ [direction]
81
+ );
82
+ const computeClamp = useCallback(() => {
83
+ const el = containerRef.current;
84
+ if (!el) return { maxPrimary: Infinity, total: 0 };
85
+ const rect = el.getBoundingClientRect();
86
+ const total = direction === "horizontal" ? rect.width : rect.height;
87
+ const maxPrimary2 = Math.max(minPrimarySize, total - minSecondarySize);
88
+ return { maxPrimary: maxPrimary2, total };
89
+ }, [containerRef, direction, minPrimarySize, minSecondarySize]);
90
+ const onPointerDown = useCallback(
91
+ (e) => {
92
+ const el = containerRef.current;
93
+ if (!el) return;
94
+ e.currentTarget.setPointerCapture(e.pointerId);
95
+ const { maxPrimary: maxPrimary2 } = computeClamp();
96
+ maxPrimaryRef.current = maxPrimary2;
97
+ draggingRef.current = true;
98
+ pointerIdRef.current = e.pointerId;
99
+ startPosRef.current = getClientPos(e);
100
+ startSizeRef.current = primarySize;
101
+ document.body.style.userSelect = "none";
102
+ document.body.style.cursor = direction === "horizontal" ? "col-resize" : "row-resize";
103
+ },
104
+ [computeClamp, containerRef, direction, getClientPos, primarySize]
105
+ );
106
+ const onPointerMove = useCallback(
107
+ (e) => {
108
+ if (!draggingRef.current) return;
109
+ if (pointerIdRef.current !== null && e.pointerId !== pointerIdRef.current) return;
110
+ const delta = getClientPos(e) - startPosRef.current;
111
+ const next = startSizeRef.current + delta;
112
+ const maxPrimary2 = maxPrimaryRef.current;
113
+ setPrimarySize(clamp(next, minPrimarySize, maxPrimary2));
114
+ },
115
+ [getClientPos, minPrimarySize, setPrimarySize]
116
+ );
117
+ const endDrag = useCallback(() => {
118
+ if (!draggingRef.current) return;
119
+ draggingRef.current = false;
120
+ pointerIdRef.current = null;
121
+ document.body.style.cursor = "";
122
+ document.body.style.userSelect = "";
123
+ }, []);
124
+ const onPointerUp = useCallback(() => endDrag(), [endDrag]);
125
+ const onPointerCancel = useCallback(() => endDrag(), [endDrag]);
126
+ const onKeyDown = useCallback(
127
+ (e) => {
128
+ const { maxPrimary: maxPrimary2 } = computeClamp();
129
+ const step = e.shiftKey ? 32 : 8;
130
+ let next = null;
131
+ if (direction === "horizontal") {
132
+ if (e.key === "ArrowLeft") next = primarySize - step;
133
+ if (e.key === "ArrowRight") next = primarySize + step;
134
+ } else {
135
+ if (e.key === "ArrowUp") next = primarySize - step;
136
+ if (e.key === "ArrowDown") next = primarySize + step;
137
+ }
138
+ if (e.key === "Home") next = minPrimarySize;
139
+ if (e.key === "End") next = maxPrimary2;
140
+ if (next === null) return;
141
+ e.preventDefault();
142
+ setPrimarySize(clamp(next, minPrimarySize, maxPrimary2));
143
+ },
144
+ [computeClamp, direction, minPrimarySize, primarySize, setPrimarySize]
145
+ );
146
+ const ariaOrientation = direction === "horizontal" ? "vertical" : "horizontal";
147
+ const { maxPrimary } = computeClamp();
148
+ return /* @__PURE__ */ jsx("div", { className: styles.gutter, children: /* @__PURE__ */ jsx(
149
+ "div",
150
+ {
151
+ className: styles.resizer,
152
+ role: "separator",
153
+ "aria-orientation": ariaOrientation,
154
+ "aria-valuemin": Math.round(minPrimarySize),
155
+ "aria-valuemax": Number.isFinite(maxPrimary) ? Math.round(maxPrimary) : void 0,
156
+ "aria-valuenow": Math.round(primarySize),
157
+ tabIndex: 0,
158
+ onPointerDown,
159
+ onPointerMove,
160
+ onPointerUp,
161
+ onPointerCancel,
162
+ onDoubleClick: resetDefault,
163
+ onKeyDown
164
+ }
165
+ ) });
166
+ }
167
+
168
+ export { SplitPane, SplitPaneGutter, SplitPanePrimary, SplitPaneSecondary };
@@ -0,0 +1,111 @@
1
+ .container {
2
+ display: flex;
3
+ inline-size: 100%;
4
+ overflow: hidden;
5
+ min-inline-size: 0;
6
+ min-block-size: 0;
7
+ }
8
+
9
+ .container[data-direction='horizontal'] {
10
+ flex-direction: row;
11
+ }
12
+
13
+ .container[data-direction='vertical'] {
14
+ flex-direction: column;
15
+ }
16
+
17
+ /* ===== Primary pane ===== */
18
+ .primary {
19
+ flex: 0 0 var(--split-pane-primary-size, 300px);
20
+ min-inline-size: 0;
21
+ min-block-size: 0;
22
+ overflow: auto;
23
+ display: flex;
24
+ flex-direction: column;
25
+ }
26
+
27
+ /* ===== Secondary pane ===== */
28
+ .secondary {
29
+ flex: 1 1 auto;
30
+ min-inline-size: 0;
31
+ min-block-size: 0;
32
+ overflow: auto;
33
+ display: flex;
34
+ flex-direction: column;
35
+ }
36
+
37
+ /* ===== Gutter (spacing + hit area wrapper) ===== */
38
+ .gutter {
39
+ position: relative;
40
+ flex: 0 0 var(--split-pane-gutter, 8px);
41
+ background: transparent;
42
+ z-index: 1;
43
+ }
44
+
45
+ .container[data-direction='vertical'] .gutter {
46
+ inline-size: 100%;
47
+ block-size: var(--split-pane-gutter, 8px);
48
+ }
49
+
50
+ /* ===== Resizer (interaction element) ===== */
51
+ .resizer {
52
+ position: absolute;
53
+ inset: 0;
54
+ cursor: col-resize;
55
+ user-select: none;
56
+ touch-action: none;
57
+ outline: none;
58
+ }
59
+
60
+ .container[data-direction='vertical'] .resizer {
61
+ cursor: row-resize;
62
+ }
63
+
64
+ /* Focus ring for keyboard resizing */
65
+ .resizer:focus-visible {
66
+ box-shadow: var(--focus-ring);
67
+ }
68
+
69
+ /* ===== Divider line ===== */
70
+ .resizer::after {
71
+ content: '';
72
+ position: absolute;
73
+ inset-block: 0;
74
+ inset-inline: 50%;
75
+ inline-size: var(--border-width-thin);
76
+ background-color: var(--color-border-subtle);
77
+ opacity: 0;
78
+ transform: translateX(-50%);
79
+ transition:
80
+ opacity var(--transition-fast) var(--ease-standard),
81
+ background-color var(--transition-fast) var(--ease-standard);
82
+ }
83
+
84
+ /* Vertical divider */
85
+ .container[data-direction='vertical'] .resizer::after {
86
+ inset-inline: 0;
87
+ inset-block: 50%;
88
+ inline-size: 100%;
89
+ block-size: var(--border-width-thin);
90
+ transform: translateY(-50%);
91
+ }
92
+
93
+ /* ===== Divider visibility modes ===== */
94
+ .container[data-divider='hover'] .resizer:hover::after,
95
+ .container[data-divider='hover'] .resizer:active::after {
96
+ opacity: 1;
97
+ background-color: var(--color-border-strong);
98
+ }
99
+
100
+ .container[data-divider='always'] .resizer::after {
101
+ opacity: 1;
102
+ }
103
+
104
+ .container[data-divider='never'] .resizer::after {
105
+ display: none;
106
+ }
107
+
108
+ .container[data-divider='hover'] .resizer:active::after,
109
+ .container[data-divider='always'] .resizer:active::after {
110
+ background-color: var(--color-brand);
111
+ }
@@ -0,0 +1,129 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var React__default = /*#__PURE__*/_interopDefault(React);
9
+
10
+ const SplitPaneContext = React__default.default.createContext(null);
11
+ function clamp(n, min, max) {
12
+ return Math.max(min, Math.min(max, n));
13
+ }
14
+ function readStoredSize(key) {
15
+ try {
16
+ const raw = localStorage.getItem(key);
17
+ if (!raw) return null;
18
+ const num = Number(raw);
19
+ return Number.isFinite(num) ? num : null;
20
+ } catch {
21
+ return null;
22
+ }
23
+ }
24
+ function writeStoredSize(key, value) {
25
+ try {
26
+ localStorage.setItem(key, String(Math.round(value)));
27
+ } catch {
28
+ }
29
+ }
30
+ function removeStoredSize(key) {
31
+ try {
32
+ localStorage.removeItem(key);
33
+ } catch {
34
+ }
35
+ }
36
+ function useSplitPaneContext() {
37
+ const ctx = React__default.default.useContext(SplitPaneContext);
38
+ if (!ctx) throw new Error("SplitPane components must be used within <SplitPane />");
39
+ return ctx;
40
+ }
41
+ function SplitPaneProvider({
42
+ children,
43
+ direction,
44
+ initialPrimarySize,
45
+ minPrimarySize,
46
+ minSecondarySize,
47
+ storageKey
48
+ }) {
49
+ const containerRef = React.useRef(null);
50
+ const [primarySize, setPrimarySize] = React.useState(initialPrimarySize);
51
+ const [manualPrimarySize, setManualPrimarySize] = React.useState(null);
52
+ const getMaxPrimary = React.useCallback(() => {
53
+ const el = containerRef.current;
54
+ if (!el) return null;
55
+ const rect = el.getBoundingClientRect();
56
+ const total = direction === "horizontal" ? rect.width : rect.height;
57
+ if (!Number.isFinite(total) || total <= 0) return null;
58
+ return Math.max(minPrimarySize, total - minSecondarySize);
59
+ }, [direction, minPrimarySize, minSecondarySize]);
60
+ React.useEffect(() => {
61
+ if (!storageKey) return;
62
+ const stored = readStoredSize(storageKey);
63
+ if (stored === null) return;
64
+ setManualPrimarySize(stored);
65
+ setPrimarySize(stored);
66
+ }, [storageKey]);
67
+ React.useEffect(() => {
68
+ const el = containerRef.current;
69
+ if (!el) return;
70
+ if (typeof ResizeObserver === "undefined") return;
71
+ const clampToContainer = () => {
72
+ const maxPrimary = getMaxPrimary();
73
+ if (maxPrimary === null) return;
74
+ const targetSize = manualPrimarySize != null ? manualPrimarySize : initialPrimarySize;
75
+ setPrimarySize(clamp(targetSize, minPrimarySize, maxPrimary));
76
+ };
77
+ clampToContainer();
78
+ const ro = new ResizeObserver(clampToContainer);
79
+ ro.observe(el);
80
+ return () => ro.disconnect();
81
+ }, [getMaxPrimary, initialPrimarySize, manualPrimarySize]);
82
+ React.useEffect(() => {
83
+ if (!storageKey) return;
84
+ if (manualPrimarySize === null) {
85
+ removeStoredSize(storageKey);
86
+ return;
87
+ }
88
+ writeStoredSize(storageKey, manualPrimarySize);
89
+ }, [manualPrimarySize, storageKey]);
90
+ const handleSizeChange = React.useCallback((newSize) => {
91
+ setManualPrimarySize(newSize);
92
+ setPrimarySize(newSize);
93
+ }, []);
94
+ const resetDefault = React.useCallback(() => {
95
+ setManualPrimarySize(null);
96
+ const maxPrimary = getMaxPrimary();
97
+ if (maxPrimary === null) {
98
+ setPrimarySize(initialPrimarySize);
99
+ return;
100
+ }
101
+ setPrimarySize(clamp(initialPrimarySize, minPrimarySize, maxPrimary));
102
+ }, [getMaxPrimary, initialPrimarySize, minPrimarySize]);
103
+ const value = React.useMemo(
104
+ () => ({
105
+ direction,
106
+ primarySize,
107
+ setPrimarySize: handleSizeChange,
108
+ resetDefault,
109
+ minPrimarySize,
110
+ minSecondarySize,
111
+ containerRef,
112
+ storageKey
113
+ }),
114
+ [
115
+ direction,
116
+ primarySize,
117
+ handleSizeChange,
118
+ resetDefault,
119
+ minPrimarySize,
120
+ minSecondarySize,
121
+ storageKey
122
+ ]
123
+ );
124
+ return /* @__PURE__ */ jsxRuntime.jsx(SplitPaneContext.Provider, { value, children });
125
+ }
126
+
127
+ exports.SplitPaneContext = SplitPaneContext;
128
+ exports.SplitPaneProvider = SplitPaneProvider;
129
+ exports.useSplitPaneContext = useSplitPaneContext;
@@ -0,0 +1,121 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import React, { useRef, useState, useCallback, useEffect, useMemo } from 'react';
3
+
4
+ const SplitPaneContext = React.createContext(null);
5
+ function clamp(n, min, max) {
6
+ return Math.max(min, Math.min(max, n));
7
+ }
8
+ function readStoredSize(key) {
9
+ try {
10
+ const raw = localStorage.getItem(key);
11
+ if (!raw) return null;
12
+ const num = Number(raw);
13
+ return Number.isFinite(num) ? num : null;
14
+ } catch {
15
+ return null;
16
+ }
17
+ }
18
+ function writeStoredSize(key, value) {
19
+ try {
20
+ localStorage.setItem(key, String(Math.round(value)));
21
+ } catch {
22
+ }
23
+ }
24
+ function removeStoredSize(key) {
25
+ try {
26
+ localStorage.removeItem(key);
27
+ } catch {
28
+ }
29
+ }
30
+ function useSplitPaneContext() {
31
+ const ctx = React.useContext(SplitPaneContext);
32
+ if (!ctx) throw new Error("SplitPane components must be used within <SplitPane />");
33
+ return ctx;
34
+ }
35
+ function SplitPaneProvider({
36
+ children,
37
+ direction,
38
+ initialPrimarySize,
39
+ minPrimarySize,
40
+ minSecondarySize,
41
+ storageKey
42
+ }) {
43
+ const containerRef = useRef(null);
44
+ const [primarySize, setPrimarySize] = useState(initialPrimarySize);
45
+ const [manualPrimarySize, setManualPrimarySize] = useState(null);
46
+ const getMaxPrimary = useCallback(() => {
47
+ const el = containerRef.current;
48
+ if (!el) return null;
49
+ const rect = el.getBoundingClientRect();
50
+ const total = direction === "horizontal" ? rect.width : rect.height;
51
+ if (!Number.isFinite(total) || total <= 0) return null;
52
+ return Math.max(minPrimarySize, total - minSecondarySize);
53
+ }, [direction, minPrimarySize, minSecondarySize]);
54
+ useEffect(() => {
55
+ if (!storageKey) return;
56
+ const stored = readStoredSize(storageKey);
57
+ if (stored === null) return;
58
+ setManualPrimarySize(stored);
59
+ setPrimarySize(stored);
60
+ }, [storageKey]);
61
+ useEffect(() => {
62
+ const el = containerRef.current;
63
+ if (!el) return;
64
+ if (typeof ResizeObserver === "undefined") return;
65
+ const clampToContainer = () => {
66
+ const maxPrimary = getMaxPrimary();
67
+ if (maxPrimary === null) return;
68
+ const targetSize = manualPrimarySize != null ? manualPrimarySize : initialPrimarySize;
69
+ setPrimarySize(clamp(targetSize, minPrimarySize, maxPrimary));
70
+ };
71
+ clampToContainer();
72
+ const ro = new ResizeObserver(clampToContainer);
73
+ ro.observe(el);
74
+ return () => ro.disconnect();
75
+ }, [getMaxPrimary, initialPrimarySize, manualPrimarySize]);
76
+ useEffect(() => {
77
+ if (!storageKey) return;
78
+ if (manualPrimarySize === null) {
79
+ removeStoredSize(storageKey);
80
+ return;
81
+ }
82
+ writeStoredSize(storageKey, manualPrimarySize);
83
+ }, [manualPrimarySize, storageKey]);
84
+ const handleSizeChange = useCallback((newSize) => {
85
+ setManualPrimarySize(newSize);
86
+ setPrimarySize(newSize);
87
+ }, []);
88
+ const resetDefault = useCallback(() => {
89
+ setManualPrimarySize(null);
90
+ const maxPrimary = getMaxPrimary();
91
+ if (maxPrimary === null) {
92
+ setPrimarySize(initialPrimarySize);
93
+ return;
94
+ }
95
+ setPrimarySize(clamp(initialPrimarySize, minPrimarySize, maxPrimary));
96
+ }, [getMaxPrimary, initialPrimarySize, minPrimarySize]);
97
+ const value = useMemo(
98
+ () => ({
99
+ direction,
100
+ primarySize,
101
+ setPrimarySize: handleSizeChange,
102
+ resetDefault,
103
+ minPrimarySize,
104
+ minSecondarySize,
105
+ containerRef,
106
+ storageKey
107
+ }),
108
+ [
109
+ direction,
110
+ primarySize,
111
+ handleSizeChange,
112
+ resetDefault,
113
+ minPrimarySize,
114
+ minSecondarySize,
115
+ storageKey
116
+ ]
117
+ );
118
+ return /* @__PURE__ */ jsx(SplitPaneContext.Provider, { value, children });
119
+ }
120
+
121
+ export { SplitPaneContext, SplitPaneProvider, useSplitPaneContext };