@veeqo/ui 9.7.1 → 9.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/dist/components/ActionMenu/ActionMenu.cjs +1 -0
  2. package/dist/components/ActionMenu/ActionMenu.cjs.map +1 -1
  3. package/dist/components/ActionMenu/ActionMenu.js +1 -0
  4. package/dist/components/ActionMenu/ActionMenu.js.map +1 -1
  5. package/dist/components/DataGrid/DataGrid.cjs +104 -0
  6. package/dist/components/DataGrid/DataGrid.cjs.map +1 -0
  7. package/dist/components/DataGrid/DataGrid.d.ts +21 -0
  8. package/dist/components/DataGrid/DataGrid.js +98 -0
  9. package/dist/components/DataGrid/DataGrid.js.map +1 -0
  10. package/dist/components/DataGrid/components/Body/Body.cjs +21 -0
  11. package/dist/components/DataGrid/components/Body/Body.cjs.map +1 -0
  12. package/dist/components/DataGrid/components/Body/Body.d.ts +23 -0
  13. package/dist/components/DataGrid/components/Body/Body.js +14 -0
  14. package/dist/components/DataGrid/components/Body/Body.js.map +1 -0
  15. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.cjs +29 -0
  16. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.cjs.map +1 -0
  17. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.d.ts +18 -0
  18. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.js +23 -0
  19. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.js.map +1 -0
  20. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.cjs +11 -0
  21. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.cjs.map +1 -0
  22. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.js +9 -0
  23. package/dist/components/DataGrid/components/Body/BodyCell/BodyCell.module.css.js.map +1 -0
  24. package/dist/components/DataGrid/components/Body/BodyCell/index.d.ts +1 -0
  25. package/dist/components/DataGrid/components/Body/Row/Row.cjs +14 -0
  26. package/dist/components/DataGrid/components/Body/Row/Row.cjs.map +1 -0
  27. package/dist/components/DataGrid/components/Body/Row/Row.d.ts +18 -0
  28. package/dist/components/DataGrid/components/Body/Row/Row.js +8 -0
  29. package/dist/components/DataGrid/components/Body/Row/Row.js.map +1 -0
  30. package/dist/components/DataGrid/components/Body/Row/index.d.ts +1 -0
  31. package/dist/components/DataGrid/components/Body/index.d.ts +1 -0
  32. package/dist/components/DataGrid/components/CellContent/CellContent.cjs +21 -0
  33. package/dist/components/DataGrid/components/CellContent/CellContent.cjs.map +1 -0
  34. package/dist/components/DataGrid/components/CellContent/CellContent.d.ts +15 -0
  35. package/dist/components/DataGrid/components/CellContent/CellContent.js +15 -0
  36. package/dist/components/DataGrid/components/CellContent/CellContent.js.map +1 -0
  37. package/dist/components/DataGrid/components/CellContent/CellContent.module.css.cjs +11 -0
  38. package/dist/components/DataGrid/components/CellContent/CellContent.module.css.cjs.map +1 -0
  39. package/dist/components/DataGrid/components/CellContent/CellContent.module.css.js +9 -0
  40. package/dist/components/DataGrid/components/CellContent/CellContent.module.css.js.map +1 -0
  41. package/dist/components/DataGrid/components/CellContent/index.d.ts +1 -0
  42. package/dist/components/DataGrid/components/Columns/Columns.cjs +56 -0
  43. package/dist/components/DataGrid/components/Columns/Columns.cjs.map +1 -0
  44. package/dist/components/DataGrid/components/Columns/Columns.d.ts +17 -0
  45. package/dist/components/DataGrid/components/Columns/Columns.js +50 -0
  46. package/dist/components/DataGrid/components/Columns/Columns.js.map +1 -0
  47. package/dist/components/DataGrid/components/Columns/index.d.ts +1 -0
  48. package/dist/components/DataGrid/components/Footer/Footer.cjs +18 -0
  49. package/dist/components/DataGrid/components/Footer/Footer.cjs.map +1 -0
  50. package/dist/components/DataGrid/components/Footer/Footer.d.ts +15 -0
  51. package/dist/components/DataGrid/components/Footer/Footer.js +12 -0
  52. package/dist/components/DataGrid/components/Footer/Footer.js.map +1 -0
  53. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.cjs +25 -0
  54. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.cjs.map +1 -0
  55. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.d.ts +18 -0
  56. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.js +19 -0
  57. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.js.map +1 -0
  58. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.cjs +11 -0
  59. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.cjs.map +1 -0
  60. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.js +9 -0
  61. package/dist/components/DataGrid/components/Footer/FooterCell/FooterCell.module.css.js.map +1 -0
  62. package/dist/components/DataGrid/components/Footer/FooterCell/index.d.ts +1 -0
  63. package/dist/components/DataGrid/components/Footer/index.d.ts +1 -0
  64. package/dist/components/DataGrid/components/GridContainer/Container/Container.cjs +23 -0
  65. package/dist/components/DataGrid/components/GridContainer/Container/Container.cjs.map +1 -0
  66. package/dist/components/DataGrid/components/GridContainer/Container/Container.d.ts +21 -0
  67. package/dist/components/DataGrid/components/GridContainer/Container/Container.js +17 -0
  68. package/dist/components/DataGrid/components/GridContainer/Container/Container.js.map +1 -0
  69. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.cjs +17 -0
  70. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.cjs.map +1 -0
  71. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.js +12 -0
  72. package/dist/components/DataGrid/components/GridContainer/Container/Container.module.css.js.map +1 -0
  73. package/dist/components/DataGrid/components/GridContainer/Container/index.d.ts +1 -0
  74. package/dist/components/DataGrid/components/GridContainer/GridContainer.cjs +25 -0
  75. package/dist/components/DataGrid/components/GridContainer/GridContainer.cjs.map +1 -0
  76. package/dist/components/DataGrid/components/GridContainer/GridContainer.d.ts +49 -0
  77. package/dist/components/DataGrid/components/GridContainer/GridContainer.js +19 -0
  78. package/dist/components/DataGrid/components/GridContainer/GridContainer.js.map +1 -0
  79. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.cjs +11 -0
  80. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.cjs.map +1 -0
  81. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.js +9 -0
  82. package/dist/components/DataGrid/components/GridContainer/GridContainer.module.css.js.map +1 -0
  83. package/dist/components/DataGrid/components/GridContainer/index.d.ts +1 -0
  84. package/dist/components/DataGrid/components/Header/Header.cjs +20 -0
  85. package/dist/components/DataGrid/components/Header/Header.cjs.map +1 -0
  86. package/dist/components/DataGrid/components/Header/Header.d.ts +13 -0
  87. package/dist/components/DataGrid/components/Header/Header.js +14 -0
  88. package/dist/components/DataGrid/components/Header/Header.js.map +1 -0
  89. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.cjs +40 -0
  90. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.cjs.map +1 -0
  91. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.d.ts +22 -0
  92. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.js +34 -0
  93. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.js.map +1 -0
  94. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.cjs +15 -0
  95. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.cjs.map +1 -0
  96. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.js +11 -0
  97. package/dist/components/DataGrid/components/Header/HeaderCell/HeaderCell.module.css.js.map +1 -0
  98. package/dist/components/DataGrid/components/Header/HeaderCell/index.d.ts +1 -0
  99. package/dist/components/DataGrid/components/Header/Resizer/Resizer.cjs +25 -0
  100. package/dist/components/DataGrid/components/Header/Resizer/Resizer.cjs.map +1 -0
  101. package/dist/components/DataGrid/components/Header/Resizer/Resizer.d.ts +21 -0
  102. package/dist/components/DataGrid/components/Header/Resizer/Resizer.js +19 -0
  103. package/dist/components/DataGrid/components/Header/Resizer/Resizer.js.map +1 -0
  104. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.cjs +11 -0
  105. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.cjs.map +1 -0
  106. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.js +9 -0
  107. package/dist/components/DataGrid/components/Header/Resizer/Resizer.module.css.js.map +1 -0
  108. package/dist/components/DataGrid/components/Header/Resizer/index.d.ts +1 -0
  109. package/dist/components/DataGrid/components/Header/index.d.ts +1 -0
  110. package/dist/components/DataGrid/components/index.d.ts +5 -0
  111. package/dist/components/DataGrid/constants.cjs +12 -0
  112. package/dist/components/DataGrid/constants.cjs.map +1 -0
  113. package/dist/components/DataGrid/constants.d.ts +4 -0
  114. package/dist/components/DataGrid/constants.js +7 -0
  115. package/dist/components/DataGrid/constants.js.map +1 -0
  116. package/dist/components/DataGrid/index.d.ts +1 -0
  117. package/dist/components/DataGrid/types/AriaRoles.d.ts +4 -0
  118. package/dist/components/DataGrid/types/ColumnDefinition.d.ts +75 -0
  119. package/dist/components/DataGrid/types/DataGridProps.d.ts +70 -0
  120. package/dist/components/DataGrid/types/declarations.d.ts +9 -0
  121. package/dist/components/DataGrid/types/enums.d.ts +2 -0
  122. package/dist/components/DataGrid/types/index.d.ts +4 -0
  123. package/dist/components/DataGrid/utils/ColumnMapper.cjs +95 -0
  124. package/dist/components/DataGrid/utils/ColumnMapper.cjs.map +1 -0
  125. package/dist/components/DataGrid/utils/ColumnMapper.d.ts +10 -0
  126. package/dist/components/DataGrid/utils/ColumnMapper.js +93 -0
  127. package/dist/components/DataGrid/utils/ColumnMapper.js.map +1 -0
  128. package/dist/components/DataGrid/utils/getAriaRoles.cjs +11 -0
  129. package/dist/components/DataGrid/utils/getAriaRoles.cjs.map +1 -0
  130. package/dist/components/DataGrid/utils/getAriaRoles.d.ts +2 -0
  131. package/dist/components/DataGrid/utils/getAriaRoles.js +9 -0
  132. package/dist/components/DataGrid/utils/getAriaRoles.js.map +1 -0
  133. package/dist/components/DataGrid/utils/index.d.ts +3 -0
  134. package/dist/components/DataGrid/utils/isLastColumn.cjs +11 -0
  135. package/dist/components/DataGrid/utils/isLastColumn.cjs.map +1 -0
  136. package/dist/components/DataGrid/utils/isLastColumn.d.ts +2 -0
  137. package/dist/components/DataGrid/utils/isLastColumn.js +9 -0
  138. package/dist/components/DataGrid/utils/isLastColumn.js.map +1 -0
  139. package/dist/components/DataTable/DataTable.cjs +5 -2
  140. package/dist/components/DataTable/DataTable.cjs.map +1 -1
  141. package/dist/components/DataTable/DataTable.js +5 -2
  142. package/dist/components/DataTable/DataTable.js.map +1 -1
  143. package/dist/components/DataTable/hooks/index.d.ts +0 -1
  144. package/dist/components/DataTable/index.d.ts +1 -1
  145. package/dist/components/FilterTag/FilterTag.cjs +1 -0
  146. package/dist/components/FilterTag/FilterTag.cjs.map +1 -1
  147. package/dist/components/FilterTag/FilterTag.js +1 -0
  148. package/dist/components/FilterTag/FilterTag.js.map +1 -1
  149. package/dist/components/Modal/Modal.cjs +26 -6
  150. package/dist/components/Modal/Modal.cjs.map +1 -1
  151. package/dist/components/Modal/Modal.js +27 -7
  152. package/dist/components/Modal/Modal.js.map +1 -1
  153. package/dist/components/Modal/components/Dialog/Dialog.cjs.map +1 -1
  154. package/dist/components/Modal/components/Dialog/Dialog.d.ts +2 -1
  155. package/dist/components/Modal/components/Dialog/Dialog.js.map +1 -1
  156. package/dist/components/Modal/components/Dialog/styled.cjs +34 -11
  157. package/dist/components/Modal/components/Dialog/styled.cjs.map +1 -1
  158. package/dist/components/Modal/components/Dialog/styled.d.ts +4 -22
  159. package/dist/components/Modal/components/Dialog/styled.js +34 -11
  160. package/dist/components/Modal/components/Dialog/styled.js.map +1 -1
  161. package/dist/components/Modal/components/Dialog/styles/baseStyles.cjs +13 -0
  162. package/dist/components/Modal/components/Dialog/styles/baseStyles.cjs.map +1 -0
  163. package/dist/components/Modal/components/Dialog/styles/baseStyles.d.ts +4 -0
  164. package/dist/components/Modal/components/Dialog/styles/baseStyles.js +11 -0
  165. package/dist/components/Modal/components/Dialog/styles/baseStyles.js.map +1 -0
  166. package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.cjs +17 -0
  167. package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.cjs.map +1 -0
  168. package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.d.ts +6 -0
  169. package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.js +13 -0
  170. package/dist/components/Modal/components/Dialog/styles/modalTypeStyles.js.map +1 -0
  171. package/dist/components/Modal/types.cjs +7 -0
  172. package/dist/components/Modal/types.cjs.map +1 -1
  173. package/dist/components/Modal/types.d.ts +56 -7
  174. package/dist/components/Modal/types.js +7 -1
  175. package/dist/components/Modal/types.js.map +1 -1
  176. package/dist/components/SelectDropdown/ListItem/ListItem.cjs +1 -0
  177. package/dist/components/SelectDropdown/ListItem/ListItem.cjs.map +1 -1
  178. package/dist/components/SelectDropdown/ListItem/ListItem.js +1 -0
  179. package/dist/components/SelectDropdown/ListItem/ListItem.js.map +1 -1
  180. package/dist/components/VideoModal/VideoModal.cjs +1 -0
  181. package/dist/components/VideoModal/VideoModal.cjs.map +1 -1
  182. package/dist/components/VideoModal/VideoModal.js +1 -0
  183. package/dist/components/VideoModal/VideoModal.js.map +1 -1
  184. package/dist/components/View/View.cjs +1 -0
  185. package/dist/components/View/View.cjs.map +1 -1
  186. package/dist/components/View/View.js +1 -0
  187. package/dist/components/View/View.js.map +1 -1
  188. package/dist/components/ViewTab/ViewTab.cjs +1 -0
  189. package/dist/components/ViewTab/ViewTab.cjs.map +1 -1
  190. package/dist/components/ViewTab/ViewTab.js +1 -0
  191. package/dist/components/ViewTab/ViewTab.js.map +1 -1
  192. package/dist/components/index.d.ts +2 -1
  193. package/dist/hooks/index.d.ts +3 -0
  194. package/dist/{components/DataTable/hooks → hooks}/useDragToScroll.cjs +10 -2
  195. package/dist/hooks/useDragToScroll.cjs.map +1 -0
  196. package/dist/hooks/useDragToScroll.d.ts +12 -0
  197. package/dist/{components/DataTable/hooks → hooks}/useDragToScroll.js +10 -2
  198. package/dist/hooks/useDragToScroll.js.map +1 -0
  199. package/dist/hooks/useIntersectionObserver.cjs +57 -0
  200. package/dist/hooks/useIntersectionObserver.cjs.map +1 -0
  201. package/dist/hooks/useIntersectionObserver.d.ts +15 -0
  202. package/dist/hooks/useIntersectionObserver.js +51 -0
  203. package/dist/hooks/useIntersectionObserver.js.map +1 -0
  204. package/dist/hooks/useResizeObserver.cjs +67 -0
  205. package/dist/hooks/useResizeObserver.cjs.map +1 -0
  206. package/dist/hooks/useResizeObserver.d.ts +18 -0
  207. package/dist/hooks/useResizeObserver.js +61 -0
  208. package/dist/hooks/useResizeObserver.js.map +1 -0
  209. package/dist/index.cjs +8 -2
  210. package/dist/index.cjs.map +1 -1
  211. package/dist/index.js +4 -1
  212. package/dist/index.js.map +1 -1
  213. package/dist/theme/index.d.ts +1 -0
  214. package/dist/theme/modules/layers.cjs +1 -0
  215. package/dist/theme/modules/layers.cjs.map +1 -1
  216. package/dist/theme/modules/layers.d.ts +1 -0
  217. package/dist/theme/modules/layers.js +1 -0
  218. package/dist/theme/modules/layers.js.map +1 -1
  219. package/package.json +2 -1
  220. package/dist/components/DataTable/hooks/useDragToScroll.cjs.map +0 -1
  221. package/dist/components/DataTable/hooks/useDragToScroll.d.ts +0 -2
  222. package/dist/components/DataTable/hooks/useDragToScroll.js.map +0 -1
@@ -3,6 +3,7 @@ import '../../hooks/useFocusVisible.js';
3
3
  import { useHover } from '../../hooks/useHover.js';
4
4
  import { buildClassnames } from '../../utils/buildClassnames.js';
5
5
  import 'uid/secure';
6
+ import 'lodash.throttle';
6
7
  import { colors } from '../../theme/modules/colors.js';
7
8
  import { ViewTabTypes } from './types.js';
8
9
  import { ViewButton, Contour, CustomIconWrapper, CounterContainer, CounterText, CrossIconStyling, IconStyling, ThreeDotsIconStyling } from './styled.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ViewTab.js","sources":["../../../src/components/ViewTab/ViewTab.tsx"],"sourcesContent":["import React, { Ref } from 'react';\n\nimport { useHover } from '../../hooks';\nimport { colors } from '../../theme/modules/colors';\n\nimport { ViewTabProps, ViewTabTypes } from './types';\n\nimport {\n Contour,\n CounterContainer,\n CounterText,\n CrossIconStyling,\n CustomIconWrapper,\n IconStyling,\n Text,\n ThreeDotsIconStyling,\n ViewButton,\n} from './styled';\nimport { buildClassnames } from '../../utils/buildClassnames';\n\nexport interface ClassNamesReturnPayload {\n delete?: string;\n edit?: string;\n container?: string;\n active?: string;\n counter?: string;\n}\n\nconst generateClassNames = (prefix?: string): ClassNamesReturnPayload => ({\n delete: prefix ? `${prefix}-delete` : undefined,\n edit: prefix ? `${prefix}-edit` : undefined,\n container: prefix ? `${prefix}-view` : undefined,\n active: prefix ? `${prefix}-active` : undefined,\n counter: prefix ? `${prefix}-counter` : undefined,\n});\n\nexport const ViewTab = React.forwardRef<HTMLButtonElement, ViewTabProps>(\n (\n {\n id,\n iconSlot,\n name,\n type,\n className,\n colourPalette = colors.secondary.blue,\n customTextColour,\n count,\n active = false,\n onClick,\n subAction,\n ariaContext,\n ...props\n }: ViewTabProps,\n ref: Ref<HTMLButtonElement>,\n ) => {\n const classNames = generateClassNames(className);\n const [isHovered, handleEnter, handleLeave] = useHover();\n\n const action = active && subAction ? subAction : onClick;\n const handleAction = () => action(id);\n\n const isDraft = type === ViewTabTypes.draft;\n const isSaved = type === ViewTabTypes.saved;\n\n const getLabelAction = () => {\n if (active && isDraft) return 'Delete';\n if (active && isSaved) return 'Edit';\n return '';\n };\n\n return (\n <ViewButton\n className={buildClassnames([classNames?.container])}\n onClick={handleAction}\n role=\"tab\"\n aria-selected={active}\n aria-label={`${getLabelAction()} ${name} view ${\n count ? `with ${count} ${ariaContext}` : ''\n }`}\n customTextColour={customTextColour}\n ref={ref}\n {...props}\n >\n <Contour\n active={active}\n onMouseEnter={handleEnter}\n onMouseLeave={handleLeave}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n {iconSlot && <CustomIconWrapper>{iconSlot}</CustomIconWrapper>}\n <Text variant=\"bodyBold\">{name}</Text>\n {count !== undefined && count !== null && (\n <CounterContainer\n data-testid=\"countContainer\"\n active={active || isHovered}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n <CounterText variant=\"subheadingSmall\">{count}</CounterText>\n </CounterContainer>\n )}\n {isDraft && <CrossIconStyling {...IconStyling} aria-label=\"delete icon\" />}\n {isSaved && active && <ThreeDotsIconStyling {...IconStyling} aria-label=\"edit icon\" />}\n </Contour>\n </ViewButton>\n );\n },\n);\n"],"names":["React"],"mappings":";;;;;;;;;;AA4BA,MAAM,kBAAkB,GAAG,CAAC,MAAe,MAA+B;IACxE,MAAM,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAS,OAAA,CAAA,GAAG,SAAS;IAC/C,IAAI,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAO,KAAA,CAAA,GAAG,SAAS;IAC3C,SAAS,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAO,KAAA,CAAA,GAAG,SAAS;IAChD,MAAM,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAS,OAAA,CAAA,GAAG,SAAS;IAC/C,OAAO,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAU,QAAA,CAAA,GAAG,SAAS;AAClD,CAAA,CAAC;MAEW,OAAO,GAAGA,cAAK,CAAC,UAAU,CACrC,CACE,EACE,EAAE,EACF,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,EACrC,gBAAgB,EAChB,KAAK,EACL,MAAM,GAAG,KAAK,EACd,OAAO,EACP,SAAS,EACT,WAAW,EACX,GAAG,KAAK,EACK,EACf,GAA2B,KACzB;AACF,IAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,SAAS,CAAC;IAChD,MAAM,CAAC,SAAS,EAAE,WAAW,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AA,CAAA,aAAA,CAAC,IAAI,EAAC,EAAA,OAAO,EAAC,UAAU,EAAA,EAAE,IAAI,CAAQ;YACrC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,KACpCA,cAAC,CAAA,aAAA,CAAA,gBAAgB,EACH,EAAA,aAAA,EAAA,gBAAgB,EAC5B,MAAM,EAAE,MAAM,IAAI,SAAS,EAC3B,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAAA;gBAElCA,cAAC,CAAA,aAAA,CAAA,WAAW,IAAC,OAAO,EAAC,iBAAiB,EAAE,EAAA,KAAK,CAAe,CAC3C,CACpB;AACA,YAAA,OAAO,IAAIA,cAAC,CAAA,aAAA,CAAA,gBAAgB,OAAK,WAAW,EAAA,YAAA,EAAa,aAAa,EAAG,CAAA;AACzE,YAAA,OAAO,IAAI,MAAM,IAAIA,cAAA,CAAA,aAAA,CAAC,oBAAoB,EAAA,EAAA,GAAK,WAAW,EAAA,YAAA,EAAa,WAAW,EAAA,CAAG,CAC9E,CACC;AAEjB,CAAC;;;;"}
1
+ {"version":3,"file":"ViewTab.js","sources":["../../../src/components/ViewTab/ViewTab.tsx"],"sourcesContent":["import React, { Ref } from 'react';\n\nimport { useHover } from '../../hooks';\nimport { colors } from '../../theme/modules/colors';\n\nimport { ViewTabProps, ViewTabTypes } from './types';\n\nimport {\n Contour,\n CounterContainer,\n CounterText,\n CrossIconStyling,\n CustomIconWrapper,\n IconStyling,\n Text,\n ThreeDotsIconStyling,\n ViewButton,\n} from './styled';\nimport { buildClassnames } from '../../utils/buildClassnames';\n\nexport interface ClassNamesReturnPayload {\n delete?: string;\n edit?: string;\n container?: string;\n active?: string;\n counter?: string;\n}\n\nconst generateClassNames = (prefix?: string): ClassNamesReturnPayload => ({\n delete: prefix ? `${prefix}-delete` : undefined,\n edit: prefix ? `${prefix}-edit` : undefined,\n container: prefix ? `${prefix}-view` : undefined,\n active: prefix ? `${prefix}-active` : undefined,\n counter: prefix ? `${prefix}-counter` : undefined,\n});\n\nexport const ViewTab = React.forwardRef<HTMLButtonElement, ViewTabProps>(\n (\n {\n id,\n iconSlot,\n name,\n type,\n className,\n colourPalette = colors.secondary.blue,\n customTextColour,\n count,\n active = false,\n onClick,\n subAction,\n ariaContext,\n ...props\n }: ViewTabProps,\n ref: Ref<HTMLButtonElement>,\n ) => {\n const classNames = generateClassNames(className);\n const [isHovered, handleEnter, handleLeave] = useHover();\n\n const action = active && subAction ? subAction : onClick;\n const handleAction = () => action(id);\n\n const isDraft = type === ViewTabTypes.draft;\n const isSaved = type === ViewTabTypes.saved;\n\n const getLabelAction = () => {\n if (active && isDraft) return 'Delete';\n if (active && isSaved) return 'Edit';\n return '';\n };\n\n return (\n <ViewButton\n className={buildClassnames([classNames?.container])}\n onClick={handleAction}\n role=\"tab\"\n aria-selected={active}\n aria-label={`${getLabelAction()} ${name} view ${\n count ? `with ${count} ${ariaContext}` : ''\n }`}\n customTextColour={customTextColour}\n ref={ref}\n {...props}\n >\n <Contour\n active={active}\n onMouseEnter={handleEnter}\n onMouseLeave={handleLeave}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n {iconSlot && <CustomIconWrapper>{iconSlot}</CustomIconWrapper>}\n <Text variant=\"bodyBold\">{name}</Text>\n {count !== undefined && count !== null && (\n <CounterContainer\n data-testid=\"countContainer\"\n active={active || isHovered}\n colourPalette={colourPalette}\n customTextColour={customTextColour}\n >\n <CounterText variant=\"subheadingSmall\">{count}</CounterText>\n </CounterContainer>\n )}\n {isDraft && <CrossIconStyling {...IconStyling} aria-label=\"delete icon\" />}\n {isSaved && active && <ThreeDotsIconStyling {...IconStyling} aria-label=\"edit icon\" />}\n </Contour>\n </ViewButton>\n );\n },\n);\n"],"names":["React"],"mappings":";;;;;;;;;;;AA4BA,MAAM,kBAAkB,GAAG,CAAC,MAAe,MAA+B;IACxE,MAAM,EAAE,MAAM,GAAG,CAAG,EAAA,MAAM,CAAS,OAAA,CAAA,GAAG,SAAS;IA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AM,IAAIA,cAAA,CAAA,aAAA,CAAC,oBAAoB,EAAA,EAAA,GAAK,WAAW,EAAA,YAAA,EAAa,WAAW,EAAA,CAAG,CAC9E,CACC;AAEjB,CAAC;;;;"}
@@ -20,7 +20,7 @@ export { CopyToClipboard } from './CopyToClipboard';
20
20
  export { DateInputField } from './DateInputField';
21
21
  export { DatePicker } from './DatePicker';
22
22
  export { DateRangePicker, DATE_RANGE_OPTIONS, DEFAULT_PRESET, DEFAULT_RANGE, DateRanges, getDateRange, } from './DateRangePicker';
23
- export { DataTable, useCellWidths, useColumns, useDragToScroll, useNested, useScrollPosition, useSelection, } from './DataTable';
23
+ export { DataTable, useCellWidths, useColumns, useNested, useScrollPosition, useSelection, } from './DataTable';
24
24
  export { DescriptionList } from './DescriptionList';
25
25
  export { DetailPage } from './DetailPage';
26
26
  export { DimensionsInput } from './DimensionsInput';
@@ -64,3 +64,4 @@ export { WeightInput } from './WeightInput';
64
64
  export { Indicator } from './Indicator';
65
65
  export { SelectDropdown } from './SelectDropdown';
66
66
  export { ThemeInjector } from './ThemeInjector';
67
+ export { DataGrid } from './DataGrid';
@@ -6,3 +6,6 @@ export { useHover } from './useHover';
6
6
  export { useIsOverflowing } from './useIsOverflowing';
7
7
  export { useTabs } from './useTabs';
8
8
  export { useId } from './useId';
9
+ export { useDragToScroll } from './useDragToScroll';
10
+ export { useResizeObserver } from './useResizeObserver';
11
+ export { useIntersectionObserver } from './useIntersectionObserver';
@@ -2,7 +2,12 @@
2
2
 
3
3
  var React = require('react');
4
4
 
5
- function useDragToScroll(targetRef) {
5
+ /**
6
+ * Hook which allows the user to scroll horizontally by dragging on a given target element.
7
+ * @param targetRef - The ref of the element to scroll.
8
+ * @param ignoreClassName - The className of any elements which should be excluded from the dragging behaviour.
9
+ */
10
+ function useDragToScroll({ targetRef, ignoreClassName }) {
6
11
  React.useEffect(() => {
7
12
  if (!targetRef.current)
8
13
  return;
@@ -40,8 +45,11 @@ function useDragToScroll(targetRef) {
40
45
  * unable to use event.stopPropogation as event is a react Synthetic event which treats the event as the same, as they are on the same node, is discussed here
41
46
  * https://dev.to/dvnrsn/why-isn-t-event-stoppropagation-working-1bnm.
42
47
  */
43
- if (e.target instanceof HTMLElement && ((_c = (_b = (_a = e.target) === null || _a === undefined ? undefined : _a.classList) === null || _b === undefined ? undefined : _b.contains) === null || _c === undefined ? undefined : _c.call(_b, 'th-divider')))
48
+ if (ignoreClassName &&
49
+ e.target instanceof HTMLElement &&
50
+ ((_c = (_b = (_a = e.target) === null || _a === undefined ? undefined : _a.classList) === null || _b === undefined ? undefined : _b.contains) === null || _c === undefined ? undefined : _c.call(_b, ignoreClassName))) {
44
51
  return;
52
+ }
45
53
  position.left = scrollTarget.scrollLeft;
46
54
  position.x = e.clientX;
47
55
  document.addEventListener('mousemove', mouseMoveHandler);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDragToScroll.cjs","sources":["../../src/hooks/useDragToScroll.ts"],"sourcesContent":["import { useEffect, RefObject } from 'react';\n\ntype UseDragToScrollProps = {\n targetRef: RefObject<HTMLElement>;\n ignoreClassName?: string;\n};\n\n/**\n * Hook which allows the user to scroll horizontally by dragging on a given target element.\n * @param targetRef - The ref of the element to scroll.\n * @param ignoreClassName - The className of any elements which should be excluded from the dragging behaviour.\n */\nexport function useDragToScroll({ targetRef, ignoreClassName }: UseDragToScrollProps) {\n useEffect(() => {\n if (!targetRef.current) return;\n\n let isDragging = false;\n const scrollTarget = targetRef.current;\n const position = {\n left: 0,\n x: 0,\n };\n\n const mouseMoveHandler = (e: MouseEvent) => {\n if (!scrollTarget) return;\n const dx = e.clientX - position.x;\n scrollTarget.scrollLeft = position.left - dx;\n if (!isDragging) {\n scrollTarget.style.cursor = 'grabbing';\n scrollTarget.style.userSelect = 'none';\n }\n isDragging = true;\n };\n\n const mouseUpHandler = () => {\n document.removeEventListener('mousemove', mouseMoveHandler);\n document.removeEventListener('mouseup', mouseUpHandler);\n isDragging = false;\n if (!scrollTarget) return;\n scrollTarget.style.removeProperty('cursor');\n scrollTarget.style.removeProperty('user-select');\n };\n\n const mouseDownHandler = (e: MouseEvent) => {\n if (!scrollTarget) return;\n /** NOTE: prevents table scroll when resizing columns,\n * unable to use event.stopPropogation as event is a react Synthetic event which treats the event as the same, as they are on the same node, is discussed here\n * https://dev.to/dvnrsn/why-isn-t-event-stoppropagation-working-1bnm.\n */\n if (\n ignoreClassName &&\n e.target instanceof HTMLElement &&\n e.target?.classList?.contains?.(ignoreClassName)\n ) {\n return;\n }\n\n position.left = scrollTarget.scrollLeft;\n position.x = e.clientX;\n document.addEventListener('mousemove', mouseMoveHandler);\n document.addEventListener('mouseup', mouseUpHandler);\n };\n\n scrollTarget.addEventListener('mousedown', mouseDownHandler);\n\n /* eslint-disable-next-line consistent-return */\n return () => scrollTarget?.removeEventListener('mousedown', mouseDownHandler);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [targetRef.current]);\n}\n"],"names":["useEffect"],"mappings":";;;;AAOA;;;;AAIG;SACa,eAAe,CAAC,EAAE,SAAS,EAAE,eAAe,EAAwB,EAAA;IAClFA,eAAS,CAAC,MAAK;QACb,IAAI,CAAC,SAAS,CAAC,OAAO;YAAE;QAExB,IAAI,UAAU,GAAG,KAAK;AACtB,QAAA,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO;AACtC,QAAA,MAAM,QAAQ,GAAG;AACf,YAAA,IAAI,EAAE,CAAC;AACP,YAAA,CAAC,EAAE,CAAC;SACL;AAED,QAAA,MAAM,gBAAgB,GAAG,CAAC,CAAa,KAAI;AACzC,YAAA,IAAI,CAAC,YAAY;gBAAE;YACnB,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC;YACjC,YAAY,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,GAAG,EAAE;YAC5C,IAAI,CAAC,UAAU,EAAE;AACf,gBAAA,YAAY,CAAC,KAAK,CAAC,MAAM,GAAG,UAAU;AACtC,gBAAA,YAAY,CAA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AAC,WAAW,EAAE,gBAAgB,CAAC;;AAG5D,QAAA,OAAO,MAAM,YAAY,aAAZ,YAAY,KAAA,SAAA,GAAA,SAAA,GAAZ,YAAY,CAAE,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC;;AAE/E,KAAC,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACzB;;;;"}
@@ -0,0 +1,12 @@
1
+ import { RefObject } from 'react';
2
+ type UseDragToScrollProps = {
3
+ targetRef: RefObject<HTMLElement>;
4
+ ignoreClassName?: string;
5
+ };
6
+ /**
7
+ * Hook which allows the user to scroll horizontally by dragging on a given target element.
8
+ * @param targetRef - The ref of the element to scroll.
9
+ * @param ignoreClassName - The className of any elements which should be excluded from the dragging behaviour.
10
+ */
11
+ export declare function useDragToScroll({ targetRef, ignoreClassName }: UseDragToScrollProps): void;
12
+ export {};
@@ -1,6 +1,11 @@
1
1
  import { useEffect } from 'react';
2
2
 
3
- function useDragToScroll(targetRef) {
3
+ /**
4
+ * Hook which allows the user to scroll horizontally by dragging on a given target element.
5
+ * @param targetRef - The ref of the element to scroll.
6
+ * @param ignoreClassName - The className of any elements which should be excluded from the dragging behaviour.
7
+ */
8
+ function useDragToScroll({ targetRef, ignoreClassName }) {
4
9
  useEffect(() => {
5
10
  if (!targetRef.current)
6
11
  return;
@@ -38,8 +43,11 @@ function useDragToScroll(targetRef) {
38
43
  * unable to use event.stopPropogation as event is a react Synthetic event which treats the event as the same, as they are on the same node, is discussed here
39
44
  * https://dev.to/dvnrsn/why-isn-t-event-stoppropagation-working-1bnm.
40
45
  */
41
- if (e.target instanceof HTMLElement && ((_c = (_b = (_a = e.target) === null || _a === undefined ? undefined : _a.classList) === null || _b === undefined ? undefined : _b.contains) === null || _c === undefined ? undefined : _c.call(_b, 'th-divider')))
46
+ if (ignoreClassName &&
47
+ e.target instanceof HTMLElement &&
48
+ ((_c = (_b = (_a = e.target) === null || _a === undefined ? undefined : _a.classList) === null || _b === undefined ? undefined : _b.contains) === null || _c === undefined ? undefined : _c.call(_b, ignoreClassName))) {
42
49
  return;
50
+ }
43
51
  position.left = scrollTarget.scrollLeft;
44
52
  position.x = e.clientX;
45
53
  document.addEventListener('mousemove', mouseMoveHandler);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDragToScroll.js","sources":["../../src/hooks/useDragToScroll.ts"],"sourcesContent":["import { useEffect, RefObject } from 'react';\n\ntype UseDragToScrollProps = {\n targetRef: RefObject<HTMLElement>;\n ignoreClassName?: string;\n};\n\n/**\n * Hook which allows the user to scroll horizontally by dragging on a given target element.\n * @param targetRef - The ref of the element to scroll.\n * @param ignoreClassName - The className of any elements which should be excluded from the dragging behaviour.\n */\nexport function useDragToScroll({ targetRef, ignoreClassName }: UseDragToScrollProps) {\n useEffect(() => {\n if (!targetRef.current) return;\n\n let isDragging = false;\n const scrollTarget = targetRef.current;\n const position = {\n left: 0,\n x: 0,\n };\n\n const mouseMoveHandler = (e: MouseEvent) => {\n if (!scrollTarget) return;\n const dx = e.clientX - position.x;\n scrollTarget.scrollLeft = position.left - dx;\n if (!isDragging) {\n scrollTarget.style.cursor = 'grabbing';\n scrollTarget.style.userSelect = 'none';\n }\n isDragging = true;\n };\n\n const mouseUpHandler = () => {\n document.removeEventListener('mousemove', mouseMoveHandler);\n document.removeEventListener('mouseup', mouseUpHandler);\n isDragging = false;\n if (!scrollTarget) return;\n scrollTarget.style.removeProperty('cursor');\n scrollTarget.style.removeProperty('user-select');\n };\n\n const mouseDownHandler = (e: MouseEvent) => {\n if (!scrollTarget) return;\n /** NOTE: prevents table scroll when resizing columns,\n * unable to use event.stopPropogation as event is a react Synthetic event which treats the event as the same, as they are on the same node, is discussed here\n * https://dev.to/dvnrsn/why-isn-t-event-stoppropagation-working-1bnm.\n */\n if (\n ignoreClassName &&\n e.target instanceof HTMLElement &&\n e.target?.classList?.contains?.(ignoreClassName)\n ) {\n return;\n }\n\n position.left = scrollTarget.scrollLeft;\n position.x = e.clientX;\n document.addEventListener('mousemove', mouseMoveHandler);\n document.addEventListener('mouseup', mouseUpHandler);\n };\n\n scrollTarget.addEventListener('mousedown', mouseDownHandler);\n\n /* eslint-disable-next-line consistent-return */\n return () => scrollTarget?.removeEventListener('mousedown', mouseDownHandler);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [targetRef.current]);\n}\n"],"names":[],"mappings":";;AAOA;;;;AAIG;SACa,eAAe,CAAC,EAAE,SAAS,EAAE,eAAe,EAAwB,EAAA;IAClF,SAAS,CAAC,MAAK;QACb,IAAI,CAAC,SAAS,CAAC,OAAO;YAAE;QAExB,IAAI,UAAU,GAAG,KAAK;AACtB,QAAA,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO;AACtC,QAAA,MAAM,QAAQ,GAAG;AACf,YAAA,IAAI,EAAE,CAAC;AACP,YAAA,CAAC,EAAE,CAAC;SACL;AAED,QAAA,MAAM,gBAAgB,GAAG,CAAC,CAAa,KAAI;AACzC,YAAA,IAAI,CAAC,YAAY;gBAAE;YACnB,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC;YACjC,YAAY,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,GAAG,EAAE;YAC5C,IAAI,CAAC,UAAU,EAAE;AACf,gBAAA,YAAY,CAAC,KAAK,CAAC,MAAM,GAAG,UAAU;AACtC,gBAAA,YAAY,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM;AACvC;YACD,UAAU,GAAG,IAAI;AACnB,SAAC;QAED,MAAM,cAAc,GAAG,MAAK;AAC1B,YAAA,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC;AAC3D,YAAA,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,cAAc,CAAC;YACvD,UAAU,GAAG,KAAK;AAClB,YAAA,IAAI,CAAC,YAAY;gBAAE;AACnB,YAAA,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC;AAC3C,YAAA,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC;AAClD,SAAC;AAED,QAAA,MAAM,gBAAgB,GAAG,CAAC,CAAa,KAAI;;AACzC,YAAA,IAAI,CAAC,YAAY;gBAAE;AACnB;;;AAGG;AACH,YAAA,IACE,eAAe;gBACf,CAAC,CAAC,MAAM,YAAY,WAAW;AAC/B,iBAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,CAAC,CAAC,MAAM,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,SAAS,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,QAAQ,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,EAAG,eAAe,CAAC,CAAA,EAChD;gBACA;AACD;AAED,YAAA,QAAQ,CAAC,IAAI,GAAG,YAAY,CAAC,UAAU;AACvC,YAAA,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO;AACtB,YAAA,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,gBAAgB,CAAC;AACxD,YAAA,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,cAAc,CAAC;AACtD,SAAC;AAED,QAAA,YAAY,CAAC,gBAAgB,CAAC,WAAW,EAAE,gBAAgB,CAAC;;AAG5D,QAAA,OAAO,MAAM,YAAY,aAAZ,YAAY,KAAA,SAAA,GAAA,SAAA,GAAZ,YAAY,CAAE,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC;;AAE/E,KAAC,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACzB;;;;"}
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var throttle = require('lodash.throttle');
5
+
6
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
+
8
+ var throttle__default = /*#__PURE__*/_interopDefaultCompat(throttle);
9
+
10
+ /**
11
+ * Hook which sets up an `IntersectionObserver` for a given element, and fires a callback when an intersection occurs.
12
+ * @param targetRef The element to observe.
13
+ * @param intersectionHandler The callback to invoke when an intersection occurs.
14
+ * @param throttleMs (Optional) the number of ms to throttle the observer callback.
15
+ */
16
+ const useIntersectionObserver = ({ targetRef, intersectionHandler, throttleMs, }) => {
17
+ const intersectionHandlerRef = React.useRef();
18
+ intersectionHandlerRef.current = intersectionHandler;
19
+ const intersectionObserverRef = React.useRef();
20
+ const isIntersectingRef = React.useRef();
21
+ const currentTargetRef = React.useRef();
22
+ React.useEffect(() => {
23
+ const observerCallback = (entries) => {
24
+ const [entry] = entries;
25
+ const { isIntersecting } = entry;
26
+ if (isIntersectingRef.current && isIntersectingRef.current === isIntersecting) {
27
+ return;
28
+ }
29
+ isIntersectingRef.current = isIntersecting;
30
+ if (intersectionHandlerRef.current) {
31
+ intersectionHandlerRef.current(isIntersecting);
32
+ }
33
+ };
34
+ intersectionObserverRef.current = new IntersectionObserver(throttleMs ? throttle__default.default(observerCallback, throttleMs) : observerCallback);
35
+ return () => {
36
+ if (intersectionObserverRef.current) {
37
+ intersectionObserverRef.current.disconnect();
38
+ }
39
+ };
40
+ }, [throttleMs]);
41
+ React.useEffect(() => {
42
+ if (intersectionObserverRef.current) {
43
+ if (targetRef.current &&
44
+ currentTargetRef.current &&
45
+ targetRef.current === currentTargetRef.current) {
46
+ return;
47
+ }
48
+ intersectionObserverRef.current.disconnect();
49
+ if (targetRef.current) {
50
+ intersectionObserverRef.current.observe(targetRef.current);
51
+ }
52
+ }
53
+ });
54
+ };
55
+
56
+ exports.useIntersectionObserver = useIntersectionObserver;
57
+ //# sourceMappingURL=useIntersectionObserver.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntersectionObserver.cjs","sources":["../../src/hooks/useIntersectionObserver.ts"],"sourcesContent":["import { RefObject, useEffect, useRef } from 'react';\n\nimport throttle from 'lodash.throttle';\n\ntype IntersectionHandler = (intersecting: boolean) => void;\n\ntype UseIntersectionObserverProps = {\n targetRef: RefObject<HTMLElement | null>;\n intersectionHandler: IntersectionHandler;\n throttleMs?: number;\n};\n\n/**\n * Hook which sets up an `IntersectionObserver` for a given element, and fires a callback when an intersection occurs.\n * @param targetRef The element to observe.\n * @param intersectionHandler The callback to invoke when an intersection occurs.\n * @param throttleMs (Optional) the number of ms to throttle the observer callback.\n */\nexport const useIntersectionObserver = ({\n targetRef,\n intersectionHandler,\n throttleMs,\n}: UseIntersectionObserverProps) => {\n const intersectionHandlerRef = useRef<IntersectionHandler>();\n intersectionHandlerRef.current = intersectionHandler;\n\n const intersectionObserverRef = useRef<IntersectionObserver>();\n const isIntersectingRef = useRef<boolean>();\n\n const currentTargetRef = useRef();\n\n useEffect(() => {\n const observerCallback = (entries: IntersectionObserverEntry[]) => {\n const [entry] = entries;\n const { isIntersecting } = entry;\n\n if (isIntersectingRef.current && isIntersectingRef.current === isIntersecting) {\n return;\n }\n\n isIntersectingRef.current = isIntersecting;\n\n if (intersectionHandlerRef.current) {\n intersectionHandlerRef.current(isIntersecting);\n }\n };\n\n intersectionObserverRef.current = new IntersectionObserver(\n throttleMs ? throttle(observerCallback, throttleMs) : observerCallback,\n );\n\n return () => {\n if (intersectionObserverRef.current) {\n intersectionObserverRef.current.disconnect();\n }\n };\n }, [throttleMs]);\n\n useEffect(() => {\n if (intersectionObserverRef.current) {\n if (\n targetRef.current &&\n currentTargetRef.current &&\n targetRef.current === currentTargetRef.current\n ) {\n return;\n }\n\n intersectionObserverRef.current.disconnect();\n\n if (targetRef.current) {\n intersectionObserverRef.current.observe(targetRef.current);\n }\n }\n });\n};\n"],"names":["useRef","useEffect","throttle"],"mappings":";;;;;;;;;AAYA;;;;;AAKG;AACI,MAAM,uBAAuB,GAAG,CAAC,EACtC,SAAS,EACT,mBAAmB,EACnB,UAAU,GACmB,KAAI;AACjC,IAAA,MAAM,sBAAsB,GAAGA,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O,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;AAC3D;AACF;AACH,KAAC,CAAC;AACJ;;;;"}
@@ -0,0 +1,15 @@
1
+ import { RefObject } from 'react';
2
+ type IntersectionHandler = (intersecting: boolean) => void;
3
+ type UseIntersectionObserverProps = {
4
+ targetRef: RefObject<HTMLElement | null>;
5
+ intersectionHandler: IntersectionHandler;
6
+ throttleMs?: number;
7
+ };
8
+ /**
9
+ * Hook which sets up an `IntersectionObserver` for a given element, and fires a callback when an intersection occurs.
10
+ * @param targetRef The element to observe.
11
+ * @param intersectionHandler The callback to invoke when an intersection occurs.
12
+ * @param throttleMs (Optional) the number of ms to throttle the observer callback.
13
+ */
14
+ export declare const useIntersectionObserver: ({ targetRef, intersectionHandler, throttleMs, }: UseIntersectionObserverProps) => void;
15
+ export {};
@@ -0,0 +1,51 @@
1
+ import { useRef, useEffect } from 'react';
2
+ import throttle from 'lodash.throttle';
3
+
4
+ /**
5
+ * Hook which sets up an `IntersectionObserver` for a given element, and fires a callback when an intersection occurs.
6
+ * @param targetRef The element to observe.
7
+ * @param intersectionHandler The callback to invoke when an intersection occurs.
8
+ * @param throttleMs (Optional) the number of ms to throttle the observer callback.
9
+ */
10
+ const useIntersectionObserver = ({ targetRef, intersectionHandler, throttleMs, }) => {
11
+ const intersectionHandlerRef = useRef();
12
+ intersectionHandlerRef.current = intersectionHandler;
13
+ const intersectionObserverRef = useRef();
14
+ const isIntersectingRef = useRef();
15
+ const currentTargetRef = useRef();
16
+ useEffect(() => {
17
+ const observerCallback = (entries) => {
18
+ const [entry] = entries;
19
+ const { isIntersecting } = entry;
20
+ if (isIntersectingRef.current && isIntersectingRef.current === isIntersecting) {
21
+ return;
22
+ }
23
+ isIntersectingRef.current = isIntersecting;
24
+ if (intersectionHandlerRef.current) {
25
+ intersectionHandlerRef.current(isIntersecting);
26
+ }
27
+ };
28
+ intersectionObserverRef.current = new IntersectionObserver(throttleMs ? throttle(observerCallback, throttleMs) : observerCallback);
29
+ return () => {
30
+ if (intersectionObserverRef.current) {
31
+ intersectionObserverRef.current.disconnect();
32
+ }
33
+ };
34
+ }, [throttleMs]);
35
+ useEffect(() => {
36
+ if (intersectionObserverRef.current) {
37
+ if (targetRef.current &&
38
+ currentTargetRef.current &&
39
+ targetRef.current === currentTargetRef.current) {
40
+ return;
41
+ }
42
+ intersectionObserverRef.current.disconnect();
43
+ if (targetRef.current) {
44
+ intersectionObserverRef.current.observe(targetRef.current);
45
+ }
46
+ }
47
+ });
48
+ };
49
+
50
+ export { useIntersectionObserver };
51
+ //# sourceMappingURL=useIntersectionObserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntersectionObserver.js","sources":["../../src/hooks/useIntersectionObserver.ts"],"sourcesContent":["import { RefObject, useEffect, useRef } from 'react';\n\nimport throttle from 'lodash.throttle';\n\ntype IntersectionHandler = (intersecting: boolean) => void;\n\ntype UseIntersectionObserverProps = {\n targetRef: RefObject<HTMLElement | null>;\n intersectionHandler: IntersectionHandler;\n throttleMs?: number;\n};\n\n/**\n * Hook which sets up an `IntersectionObserver` for a given element, and fires a callback when an intersection occurs.\n * @param targetRef The element to observe.\n * @param intersectionHandler The callback to invoke when an intersection occurs.\n * @param throttleMs (Optional) the number of ms to throttle the observer callback.\n */\nexport const useIntersectionObserver = ({\n targetRef,\n intersectionHandler,\n throttleMs,\n}: UseIntersectionObserverProps) => {\n const intersectionHandlerRef = useRef<IntersectionHandler>();\n intersectionHandlerRef.current = intersectionHandler;\n\n const intersectionObserverRef = useRef<IntersectionObserver>();\n const isIntersectingRef = useRef<boolean>();\n\n const currentTargetRef = useRef();\n\n useEffect(() => {\n const observerCallback = (entries: IntersectionObserverEntry[]) => {\n const [entry] = entries;\n const { isIntersecting } = entry;\n\n if (isIntersectingRef.current && isIntersectingRef.current === isIntersecting) {\n return;\n }\n\n isIntersectingRef.current = isIntersecting;\n\n if (intersectionHandlerRef.current) {\n intersectionHandlerRef.current(isIntersecting);\n }\n };\n\n intersectionObserverRef.current = new IntersectionObserver(\n throttleMs ? throttle(observerCallback, throttleMs) : observerCallback,\n );\n\n return () => {\n if (intersectionObserverRef.current) {\n intersectionObserverRef.current.disconnect();\n }\n };\n }, [throttleMs]);\n\n useEffect(() => {\n if (intersectionObserverRef.current) {\n if (\n targetRef.current &&\n currentTargetRef.current &&\n targetRef.current === currentTargetRef.current\n ) {\n return;\n }\n\n intersectionObserverRef.current.disconnect();\n\n if (targetRef.current) {\n intersectionObserverRef.current.observe(targetRef.current);\n }\n }\n });\n};\n"],"names":[],"mappings":";;;AAYA;;;;;AAKG;AACI,MAAM,uBAAuB,GAAG,CAAC,EACtC,SAAS,EACT,mBAAmB,EACnB,UAAU,GACmB,KAAI;AACjC,IAAA,MAAM,sBAAsB,GAAG,MAAM,EAAuB;AAC5D,IAAA,sBAAsB,CAAC,OAAO,GAAG,mBAAmB;AAEpD,IAAA,MAAM,uBAAuB,GAAG,MAAM,EAAwB;AAC9D,IAAA,MAAM,iBAAiB,GAAG,MAAM,EAAW;AAE3C,IAAA,MAAM,gBAAgB,GAAG,MAAM,EAAE;IAEjC,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,gBAAgB,GAAG,CAAC,OAAoC,KAAI;AAChE,YAAA,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO;AACvB,YAAA,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK;YAEhC,IAAI,iBAAiB,CAAC,OAAO,IAAI,iBAAiB,CAAC,OAAO,KAAK,cAAc,EAAE;gBAC7E;AACD;AAED,YAAA,iBAAiB,CAAC,OAAO,GAAG,cAAc;YAE1C,IAAI,sBAAsB,CAAC,OAAO,EAAE;AAClC,gBAAA,sBAAsB,CAAC,OAAO,CAAC,cAAc,CAAC;AAC/C;AACH,SAAC;QAED,uBAAuB,CAAC,OAAO,GAAG,IAAI,oBAAoB,CACxD,UAAU,GAAG,QAAQ,CAAC,gBAAgB,EAAE,UAAU,CAAC,GAAG,gBAAgB,CACvE;AAED,QAAA,OAAO,MAAK;YACV,IAAI,uBAAuB,CAAC,OAAO,EAAE;AACnC,gBAAA,uBAAuB,CAAC,OAAO,CAAC,UAAU,EAAE;AAC7C;AACH,SAAC;AACH,KAAC,EAAE,CAAC,UAAU,CAAC,CAAC;IAEhB,SAAS,CAAC,MAAK;QACb,IAAI,uBAAuB,CAAC,OAAO,EAAE;YACnC,IACE,SAAS,CAAC,OAAO;AACjB,gBAAA,gBAAgB,CAAC,OAAO;AACxB,gBAAA,SAAS,CAAC,OAAO,KAAK,gBAAgB,CAAC,OAAO,EAC9C;gBACA;AACD;AAED,YAAA,uBAAuB,CAAC,OAAO,CAAC,UAAU,EAAE;YAE5C,IAAI,SAAS,CAAC,OAAO,EAAE;gBACrB,uBAAuB,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;AAC3D;AACF;AACH,KAAC,CAAC;AACJ;;;;"}
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var throttle = require('lodash.throttle');
5
+
6
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
+
8
+ var throttle__default = /*#__PURE__*/_interopDefaultCompat(throttle);
9
+
10
+ /**
11
+ * Hook which sets up a `ResizeObserver` for a given element, and fires a callback when the element is resized.
12
+ * @param targetRef The element to observe.
13
+ * @param resizeHandler The callback to invoke when the element is resized.
14
+ * @param throttleMs (Optional) the number of ms to throttle the observer callback.
15
+ */
16
+ const useResizeObserver = ({ targetRef, resizeHandler, throttleMs, }) => {
17
+ // Use a ref to store the resizeHandler to avoid re-rendering when the callback changes.
18
+ const resizeHandlerRef = React.useRef(undefined);
19
+ resizeHandlerRef.current = resizeHandler;
20
+ const resizeObserverRef = React.useRef();
21
+ const previousSizeRef = React.useRef(undefined);
22
+ const currentTargetRef = React.useRef();
23
+ // Setup the resize observer when the hook is mounted.
24
+ React.useEffect(() => {
25
+ const observerCallback = (entries) => {
26
+ // We'll only ever be monitoring one element, so we'll only have one entry.
27
+ const entry = entries[0];
28
+ const { inlineSize: width, blockSize: height } = entry.contentBoxSize[0];
29
+ // Avoid unecessary callbacks by checking to see if the dimensions have actually changed.
30
+ if (previousSizeRef.current &&
31
+ previousSizeRef.current.width === width &&
32
+ previousSizeRef.current.height === height) {
33
+ return;
34
+ }
35
+ previousSizeRef.current = { width, height };
36
+ if (resizeHandlerRef.current) {
37
+ resizeHandlerRef.current({ width, height });
38
+ }
39
+ };
40
+ resizeObserverRef.current = new ResizeObserver(throttleMs ? throttle__default.default(observerCallback, throttleMs) : observerCallback);
41
+ // Cleanup the resizer observer on unmount
42
+ return () => {
43
+ if (resizeObserverRef.current) {
44
+ resizeObserverRef.current.disconnect();
45
+ }
46
+ };
47
+ }, [throttleMs]);
48
+ // Ensure we're always observing the latest element referenced in 'ref'.
49
+ React.useEffect(() => {
50
+ if (resizeObserverRef.current) {
51
+ // Check to see if the ref has actually changed. If it hasn't we can skip resetting the ResizeObserver.
52
+ if ((targetRef === null || targetRef === undefined ? undefined : targetRef.current) &&
53
+ currentTargetRef.current &&
54
+ targetRef.current === currentTargetRef.current) {
55
+ return;
56
+ }
57
+ resizeObserverRef.current.disconnect();
58
+ if (targetRef === null || targetRef === undefined ? undefined : targetRef.current) {
59
+ resizeObserverRef.current.observe(targetRef.current);
60
+ currentTargetRef.current = targetRef.current;
61
+ }
62
+ }
63
+ });
64
+ };
65
+
66
+ exports.useResizeObserver = useResizeObserver;
67
+ //# sourceMappingURL=useResizeObserver.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResizeObserver.cjs","sources":["../../src/hooks/useResizeObserver.ts"],"sourcesContent":["import { RefObject, useEffect, useRef } from 'react';\n\nimport throttle from 'lodash.throttle';\n\ntype ResizeHandler = (size: { width: number; height: number }) => void;\n\ntype UseResizeObserverCustomProps = {\n targetRef: RefObject<HTMLElement | null>;\n resizeHandler: ResizeHandler;\n throttleMs?: number;\n};\n\n/**\n * Hook which sets up a `ResizeObserver` for a given element, and fires a callback when the element is resized.\n * @param targetRef The element to observe.\n * @param resizeHandler The callback to invoke when the element is resized.\n * @param throttleMs (Optional) the number of ms to throttle the observer callback.\n */\nexport const useResizeObserver = ({\n targetRef,\n resizeHandler,\n throttleMs,\n}: UseResizeObserverCustomProps) => {\n // Use a ref to store the resizeHandler to avoid re-rendering when the callback changes.\n const resizeHandlerRef = useRef<ResizeHandler | undefined>(undefined);\n resizeHandlerRef.current = resizeHandler;\n\n const resizeObserverRef = useRef<ResizeObserver>();\n const previousSizeRef = useRef<{ width: number; height: number } | undefined>(undefined);\n\n const currentTargetRef = useRef<HTMLElement>();\n\n // Setup the resize observer when the hook is mounted.\n useEffect(() => {\n const observerCallback = (entries: ResizeObserverEntry[]) => {\n // We'll only ever be monitoring one element, so we'll only have one entry.\n const entry = entries[0];\n\n const { inlineSize: width, blockSize: height } = entry.contentBoxSize[0];\n\n // Avoid unecessary callbacks by checking to see if the dimensions have actually changed.\n if (\n previousSizeRef.current &&\n previousSizeRef.current.width === width &&\n previousSizeRef.current.height === height\n ) {\n return;\n }\n\n previousSizeRef.current = { width, height };\n\n if (resizeHandlerRef.current) {\n resizeHandlerRef.current({ width, height });\n }\n };\n\n resizeObserverRef.current = new ResizeObserver(\n throttleMs ? throttle(observerCallback, throttleMs) : observerCallback,\n );\n\n // Cleanup the resizer observer on unmount\n return () => {\n if (resizeObserverRef.current) {\n resizeObserverRef.current.disconnect();\n }\n };\n }, [throttleMs]);\n\n // Ensure we're always observing the latest element referenced in 'ref'.\n useEffect(() => {\n if (resizeObserverRef.current) {\n // Check to see if the ref has actually changed. If it hasn't we can skip resetting the ResizeObserver.\n if (\n targetRef?.current &&\n currentTargetRef.current &&\n targetRef.current === currentTargetRef.current\n ) {\n return;\n }\n\n resizeObserverRef.current.disconnect();\n\n if (targetRef?.current) {\n resizeObserverRef.current.observe(targetRef.current);\n currentTargetRef.current = targetRef.current;\n }\n }\n });\n};\n"],"names":["useRef","useEffect","throttle"],"mappings":";;;;;;;;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CAAC,CAAC;;IAGhBD,eAAS,CAAC,MAAK;QACb,IAAI,iBAAiB,CAAC,OAAO,EAAE;;AAE7B,YAAA,IACE,CAAA,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,SAAA,GAAA,SAAA,GAAA,SAAS,CAAE,OAAO;AAClB,gBAAA,gBAAgB,CAAC,OAAO;AACxB,gBAAA,SAAS,CAAC,OAAO,KAAK,gBAAgB,CAAC,OAAO,EAC9C;gBACA;AACD;AAED,YAAA,iBAAiB,CAAC,OAAO,CAAC,UAAU,EAAE;AAEtC,YAAA,IAAI,SAAS,KAAT,IAAA,IAAA,SAAS,6BAAT,SAAS,CAAE,OAAO,EAAE;gBACtB,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;AACpD,gBAAA,gBAAgB,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO;AAC7C;AACF;AACH,KAAC,CAAC;AACJ;;;;"}
@@ -0,0 +1,18 @@
1
+ import { RefObject } from 'react';
2
+ type ResizeHandler = (size: {
3
+ width: number;
4
+ height: number;
5
+ }) => void;
6
+ type UseResizeObserverCustomProps = {
7
+ targetRef: RefObject<HTMLElement | null>;
8
+ resizeHandler: ResizeHandler;
9
+ throttleMs?: number;
10
+ };
11
+ /**
12
+ * Hook which sets up a `ResizeObserver` for a given element, and fires a callback when the element is resized.
13
+ * @param targetRef The element to observe.
14
+ * @param resizeHandler The callback to invoke when the element is resized.
15
+ * @param throttleMs (Optional) the number of ms to throttle the observer callback.
16
+ */
17
+ export declare const useResizeObserver: ({ targetRef, resizeHandler, throttleMs, }: UseResizeObserverCustomProps) => void;
18
+ export {};
@@ -0,0 +1,61 @@
1
+ import { useRef, useEffect } from 'react';
2
+ import throttle from 'lodash.throttle';
3
+
4
+ /**
5
+ * Hook which sets up a `ResizeObserver` for a given element, and fires a callback when the element is resized.
6
+ * @param targetRef The element to observe.
7
+ * @param resizeHandler The callback to invoke when the element is resized.
8
+ * @param throttleMs (Optional) the number of ms to throttle the observer callback.
9
+ */
10
+ const useResizeObserver = ({ targetRef, resizeHandler, throttleMs, }) => {
11
+ // Use a ref to store the resizeHandler to avoid re-rendering when the callback changes.
12
+ const resizeHandlerRef = useRef(undefined);
13
+ resizeHandlerRef.current = resizeHandler;
14
+ const resizeObserverRef = useRef();
15
+ const previousSizeRef = useRef(undefined);
16
+ const currentTargetRef = useRef();
17
+ // Setup the resize observer when the hook is mounted.
18
+ useEffect(() => {
19
+ const observerCallback = (entries) => {
20
+ // We'll only ever be monitoring one element, so we'll only have one entry.
21
+ const entry = entries[0];
22
+ const { inlineSize: width, blockSize: height } = entry.contentBoxSize[0];
23
+ // Avoid unecessary callbacks by checking to see if the dimensions have actually changed.
24
+ if (previousSizeRef.current &&
25
+ previousSizeRef.current.width === width &&
26
+ previousSizeRef.current.height === height) {
27
+ return;
28
+ }
29
+ previousSizeRef.current = { width, height };
30
+ if (resizeHandlerRef.current) {
31
+ resizeHandlerRef.current({ width, height });
32
+ }
33
+ };
34
+ resizeObserverRef.current = new ResizeObserver(throttleMs ? throttle(observerCallback, throttleMs) : observerCallback);
35
+ // Cleanup the resizer observer on unmount
36
+ return () => {
37
+ if (resizeObserverRef.current) {
38
+ resizeObserverRef.current.disconnect();
39
+ }
40
+ };
41
+ }, [throttleMs]);
42
+ // Ensure we're always observing the latest element referenced in 'ref'.
43
+ useEffect(() => {
44
+ if (resizeObserverRef.current) {
45
+ // Check to see if the ref has actually changed. If it hasn't we can skip resetting the ResizeObserver.
46
+ if ((targetRef === null || targetRef === undefined ? undefined : targetRef.current) &&
47
+ currentTargetRef.current &&
48
+ targetRef.current === currentTargetRef.current) {
49
+ return;
50
+ }
51
+ resizeObserverRef.current.disconnect();
52
+ if (targetRef === null || targetRef === undefined ? undefined : targetRef.current) {
53
+ resizeObserverRef.current.observe(targetRef.current);
54
+ currentTargetRef.current = targetRef.current;
55
+ }
56
+ }
57
+ });
58
+ };
59
+
60
+ export { useResizeObserver };
61
+ //# sourceMappingURL=useResizeObserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResizeObserver.js","sources":["../../src/hooks/useResizeObserver.ts"],"sourcesContent":["import { RefObject, useEffect, useRef } from 'react';\n\nimport throttle from 'lodash.throttle';\n\ntype ResizeHandler = (size: { width: number; height: number }) => void;\n\ntype UseResizeObserverCustomProps = {\n targetRef: RefObject<HTMLElement | null>;\n resizeHandler: ResizeHandler;\n throttleMs?: number;\n};\n\n/**\n * Hook which sets up a `ResizeObserver` for a given element, and fires a callback when the element is resized.\n * @param targetRef The element to observe.\n * @param resizeHandler The callback to invoke when the element is resized.\n * @param throttleMs (Optional) the number of ms to throttle the observer callback.\n */\nexport const useResizeObserver = ({\n targetRef,\n resizeHandler,\n throttleMs,\n}: UseResizeObserverCustomProps) => {\n // Use a ref to store the resizeHandler to avoid re-rendering when the callback changes.\n const resizeHandlerRef = useRef<ResizeHandler | undefined>(undefined);\n resizeHandlerRef.current = resizeHandler;\n\n const resizeObserverRef = useRef<ResizeObserver>();\n const previousSizeRef = useRef<{ width: number; height: number } | undefined>(undefined);\n\n const currentTargetRef = useRef<HTMLElement>();\n\n // Setup the resize observer when the hook is mounted.\n useEffect(() => {\n const observerCallback = (entries: ResizeObserverEntry[]) => {\n // We'll only ever be monitoring one element, so we'll only have one entry.\n const entry = entries[0];\n\n const { inlineSize: width, blockSize: height } = entry.contentBoxSize[0];\n\n // Avoid unecessary callbacks by checking to see if the dimensions have actually changed.\n if (\n previousSizeRef.current &&\n previousSizeRef.current.width === width &&\n previousSizeRef.current.height === height\n ) {\n return;\n }\n\n previousSizeRef.current = { width, height };\n\n if (resizeHandlerRef.current) {\n resizeHandlerRef.current({ width, height });\n }\n };\n\n resizeObserverRef.current = new ResizeObserver(\n throttleMs ? throttle(observerCallback, throttleMs) : observerCallback,\n );\n\n // Cleanup the resizer observer on unmount\n return () => {\n if (resizeObserverRef.current) {\n resizeObserverRef.current.disconnect();\n }\n };\n }, [throttleMs]);\n\n // Ensure we're always observing the latest element referenced in 'ref'.\n useEffect(() => {\n if (resizeObserverRef.current) {\n // Check to see if the ref has actually changed. If it hasn't we can skip resetting the ResizeObserver.\n if (\n targetRef?.current &&\n currentTargetRef.current &&\n targetRef.current === currentTargetRef.current\n ) {\n return;\n }\n\n resizeObserverRef.current.disconnect();\n\n if (targetRef?.current) {\n resizeObserverRef.current.observe(targetRef.current);\n currentTargetRef.current = targetRef.current;\n }\n }\n });\n};\n"],"names":[],"mappings":";;;AAYA;;;;;AAKG;AACI,MAAM,iBAAiB,GAAG,CAAC,EAChC,SAAS,EACT,aAAa,EACb,UAAU,GACmB,KAAI;;AAEjC,IAAA,MAAM,gBAAgB,GAAG,MAAM,CAA4B,SAAS,CAAC;AACrE,IAAA,gBAAgB,CAAC,OAAO,GAAG,aAAa;AAExC,IAAA,MAAM,iBAAiB,GAAG,MAAM,EAAkB;AAClD,IAAA,MAAM,eAAe,GAAG,MAAM,CAAgD,SAAS,CAAC;AAExF,IAAA,MAAM,gBAAgB,GAAG,MAAM,EAAe;;IAG9C,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,gBAAgB,GAAG,CAAC,OAA8B,KAAI;;AAE1D,YAAA,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;AAExB,YAAA,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;;YAGxE,IACE,eAAe,CAAC,OAAO;AACvB,gBAAA,eAAe,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK;AACvC,gBAAA,eAAe,CAAC,OAAO,CAAC,MAAM,KAAK,MAAM,EACzC;gBACA;AACD;YAED,eAAe,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE;YAE3C,IAAI,gBAAgB,CAAC,OAAO,EAAE;gBAC5B,gBAAgB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC5C;AACH,SAAC;QAED,iBAAiB,CAAC,OAAO,GAAG,IAAI,cAAc,CAC5C,UAAU,GAAG,QAAQ,CAAC,gBAAgB,EAAE,UAAU,CAAC,GAAG,gBAAgB,CACvE;;AAGD,QAAA,OAAO,MAAK;YACV,IAAI,iBAAiB,CAAC,OAAO,EAAE;AAC7B,gBAAA,iBAAiB,CAAC,OAAO,CAAC,UAAU,EAAE;AACvC;AACH,SAAC;AACH,KAAC,EAAE,CAAC,UAAU,CAAC,CAAC;;IAGhB,SAAS,CAAC,MAAK;QACb,IAAI,iBAAiB,CAAC,OAAO,EAAE;;AAE7B,YAAA,IACE,CAAA,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,SAAA,GAAA,SAAA,GAAA,SAAS,CAAE,OAAO;AAClB,gBAAA,gBAAgB,CAAC,OAAO;AACxB,gBAAA,SAAS,CAAC,OAAO,KAAK,gBAAgB,CAAC,OAAO,EAC9C;gBACA;AACD;AAED,YAAA,iBAAiB,CAAC,OAAO,CAAC,UAAU,EAAE;AAEtC,YAAA,IAAI,SAAS,KAAT,IAAA,IAAA,SAAS,6BAAT,SAAS,CAAE,OAAO,EAAE;gBACtB,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;AACpD,gBAAA,gBAAgB,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO;AAC7C;AACF;AACH,KAAC,CAAC;AACJ;;;;"}
package/dist/index.cjs CHANGED
@@ -28,7 +28,6 @@ var constants = require('./components/DateRangePicker/constants.cjs');
28
28
  var DataTable = require('./components/DataTable/DataTable.cjs');
29
29
  var useCellWidths = require('./components/DataTable/hooks/useCellWidths.cjs');
30
30
  var useColumns = require('./components/DataTable/hooks/useColumns.cjs');
31
- var useDragToScroll = require('./components/DataTable/hooks/useDragToScroll.cjs');
32
31
  var useNested = require('./components/DataTable/hooks/useNested.cjs');
33
32
  var useScrollPosition = require('./components/DataTable/hooks/useScrollPosition.cjs');
34
33
  var useSelection = require('./components/DataTable/hooks/useSelection.cjs');
@@ -77,6 +76,7 @@ var index$5 = require('./components/WeightInput/index.cjs');
77
76
  var Indicator = require('./components/Indicator/Indicator.cjs');
78
77
  var index$6 = require('./components/SelectDropdown/index.cjs');
79
78
  var ThemeInjector = require('./components/ThemeInjector/ThemeInjector.cjs');
79
+ var DataGrid = require('./components/DataGrid/DataGrid.cjs');
80
80
  var useClickOutside = require('./hooks/useClickOutside.cjs');
81
81
  var useDebounce = require('./hooks/useDebounce.cjs');
82
82
  var useDropdown = require('./hooks/useDropdown.cjs');
@@ -85,6 +85,9 @@ var useHover = require('./hooks/useHover.cjs');
85
85
  var useIsOverflowing = require('./hooks/useIsOverflowing.cjs');
86
86
  var useTabs = require('./hooks/useTabs.cjs');
87
87
  var useId = require('./hooks/useId.cjs');
88
+ var useDragToScroll = require('./hooks/useDragToScroll.cjs');
89
+ var useResizeObserver = require('./hooks/useResizeObserver.cjs');
90
+ var useIntersectionObserver = require('./hooks/useIntersectionObserver.cjs');
88
91
  var withLabels = require('./hoc/withLabels/withLabels.cjs');
89
92
  var withDeprecated = require('./hoc/withDeprecated.cjs');
90
93
  var buildClassnames = require('./utils/buildClassnames.cjs');
@@ -168,7 +171,6 @@ exports.getDateRange = constants.getDateRange;
168
171
  exports.DataTable = DataTable.DataTable;
169
172
  exports.useCellWidths = useCellWidths.useCellWidths;
170
173
  exports.useColumns = useColumns.useColumns;
171
- exports.useDragToScroll = useDragToScroll.useDragToScroll;
172
174
  exports.useNested = useNested.useNested;
173
175
  exports.useScrollPosition = useScrollPosition.useScrollPosition;
174
176
  exports.useSelection = useSelection.useSelection;
@@ -224,6 +226,7 @@ exports.WeightInput = index$5.WeightInput;
224
226
  exports.Indicator = Indicator.Indicator;
225
227
  exports.SelectDropdown = index$6.SelectDropdown;
226
228
  exports.ThemeInjector = ThemeInjector.ThemeInjector;
229
+ exports.DataGrid = DataGrid.DataGrid;
227
230
  exports.useClickOutside = useClickOutside.useClickOutside;
228
231
  exports.useDebounce = useDebounce.useDebounce;
229
232
  exports.useDropdown = useDropdown.useDropdown;
@@ -233,6 +236,9 @@ exports.useHover = useHover.useHover;
233
236
  exports.useIsOverflowing = useIsOverflowing.useIsOverflowing;
234
237
  exports.useTabs = useTabs.useTabs;
235
238
  exports.useId = useId.useId;
239
+ exports.useDragToScroll = useDragToScroll.useDragToScroll;
240
+ exports.useResizeObserver = useResizeObserver.useResizeObserver;
241
+ exports.useIntersectionObserver = useIntersectionObserver.useIntersectionObserver;
236
242
  exports.withLabels = withLabels.withLabels;
237
243
  exports.withDeprecated = withDeprecated.withDeprecated;
238
244
  exports.buildClassnames = buildClassnames.buildClassnames;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -26,7 +26,6 @@ export { DATE_RANGE_OPTIONS, DEFAULT_PRESET, DEFAULT_RANGE, DateRanges, getDateR
26
26
  export { DataTable } from './components/DataTable/DataTable.js';
27
27
  export { useCellWidths } from './components/DataTable/hooks/useCellWidths.js';
28
28
  export { useColumns } from './components/DataTable/hooks/useColumns.js';
29
- export { useDragToScroll } from './components/DataTable/hooks/useDragToScroll.js';
30
29
  export { useNested } from './components/DataTable/hooks/useNested.js';
31
30
  export { useScrollPosition } from './components/DataTable/hooks/useScrollPosition.js';
32
31
  export { useSelection } from './components/DataTable/hooks/useSelection.js';
@@ -75,6 +74,7 @@ export { WeightInput } from './components/WeightInput/index.js';
75
74
  export { Indicator } from './components/Indicator/Indicator.js';
76
75
  export { SelectDropdown } from './components/SelectDropdown/index.js';
77
76
  export { ThemeInjector } from './components/ThemeInjector/ThemeInjector.js';
77
+ export { DataGrid } from './components/DataGrid/DataGrid.js';
78
78
  export { useClickOutside } from './hooks/useClickOutside.js';
79
79
  export { useDebounce } from './hooks/useDebounce.js';
80
80
  export { useDropdown } from './hooks/useDropdown.js';
@@ -83,6 +83,9 @@ export { useHover } from './hooks/useHover.js';
83
83
  export { useIsOverflowing } from './hooks/useIsOverflowing.js';
84
84
  export { useTabs } from './hooks/useTabs.js';
85
85
  export { useId } from './hooks/useId.js';
86
+ export { useDragToScroll } from './hooks/useDragToScroll.js';
87
+ export { useResizeObserver } from './hooks/useResizeObserver.js';
88
+ export { useIntersectionObserver } from './hooks/useIntersectionObserver.js';
86
89
  export { withLabels } from './hoc/withLabels/withLabels.js';
87
90
  export { withDeprecated } from './hoc/withDeprecated.js';
88
91
  export { buildClassnames } from './utils/buildClassnames.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -126,6 +126,7 @@ export declare const theme: {
126
126
  };
127
127
  layers: {
128
128
  base: number;
129
+ gridResizer: number;
129
130
  popup: number;
130
131
  modal: number;
131
132
  tooltip: number;
@@ -2,6 +2,7 @@
2
2
 
3
3
  const layers = {
4
4
  base: 0,
5
+ gridResizer: 10,
5
6
  popup: 1000,
6
7
  modal: 2000,
7
8
  tooltip: 3000,
@@ -1 +1 @@
1
- {"version":3,"file":"layers.cjs","sources":["../../../src/theme/modules/layers.ts"],"sourcesContent":["export const layers = {\n base: 0,\n popup: 1000,\n modal: 2000,\n tooltip: 3000,\n};\n"],"names":[],"mappings":";;AAAa,MAAA,MAAM,GAAG;AACpB,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,OAAO,EAAE,IAAI;;;;;"}
1
+ {"version":3,"file":"layers.cjs","sources":["../../../src/theme/modules/layers.ts"],"sourcesContent":["export const layers = {\n base: 0,\n gridResizer: 10,\n popup: 1000,\n modal: 2000,\n tooltip: 3000,\n};\n"],"names":[],"mappings":";;AAAa,MAAA,MAAM,GAAG;AACpB,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,OAAO,EAAE,IAAI;;;;;"}
@@ -1,5 +1,6 @@
1
1
  export declare const layers: {
2
2
  base: number;
3
+ gridResizer: number;
3
4
  popup: number;
4
5
  modal: number;
5
6
  tooltip: number;
@@ -1,5 +1,6 @@
1
1
  const layers = {
2
2
  base: 0,
3
+ gridResizer: 10,
3
4
  popup: 1000,
4
5
  modal: 2000,
5
6
  tooltip: 3000,
@@ -1 +1 @@
1
- {"version":3,"file":"layers.js","sources":["../../../src/theme/modules/layers.ts"],"sourcesContent":["export const layers = {\n base: 0,\n popup: 1000,\n modal: 2000,\n tooltip: 3000,\n};\n"],"names":[],"mappings":"AAAa,MAAA,MAAM,GAAG;AACpB,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,OAAO,EAAE,IAAI;;;;;"}
1
+ {"version":3,"file":"layers.js","sources":["../../../src/theme/modules/layers.ts"],"sourcesContent":["export const layers = {\n base: 0,\n gridResizer: 10,\n popup: 1000,\n modal: 2000,\n tooltip: 3000,\n};\n"],"names":[],"mappings":"AAAa,MAAA,MAAM,GAAG;AACpB,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,OAAO,EAAE,IAAI;;;;;"}