@darajs/ui-components 0.4.8

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 (278) hide show
  1. package/LICENSE +201 -0
  2. package/dist/accordion/accordion-item.d.ts +24 -0
  3. package/dist/accordion/accordion-item.d.ts.map +1 -0
  4. package/dist/accordion/accordion-item.js +92 -0
  5. package/dist/accordion/accordion-item.js.map +1 -0
  6. package/dist/accordion/accordion.d.ts +32 -0
  7. package/dist/accordion/accordion.d.ts.map +1 -0
  8. package/dist/accordion/accordion.js +87 -0
  9. package/dist/accordion/accordion.js.map +1 -0
  10. package/dist/badge/badge.d.ts +20 -0
  11. package/dist/badge/badge.d.ts.map +1 -0
  12. package/dist/badge/badge.js +42 -0
  13. package/dist/badge/badge.js.map +1 -0
  14. package/dist/button/button.d.ts +35 -0
  15. package/dist/button/button.d.ts.map +1 -0
  16. package/dist/button/button.js +169 -0
  17. package/dist/button/button.js.map +1 -0
  18. package/dist/button-bar/button-bar.d.ts +19 -0
  19. package/dist/button-bar/button-bar.d.ts.map +1 -0
  20. package/dist/button-bar/button-bar.js +124 -0
  21. package/dist/button-bar/button-bar.js.map +1 -0
  22. package/dist/carousel/carousel.d.ts +23 -0
  23. package/dist/carousel/carousel.d.ts.map +1 -0
  24. package/dist/carousel/carousel.js +178 -0
  25. package/dist/carousel/carousel.js.map +1 -0
  26. package/dist/chat/chat.d.ts +28 -0
  27. package/dist/chat/chat.d.ts.map +1 -0
  28. package/dist/chat/chat.js +182 -0
  29. package/dist/chat/chat.js.map +1 -0
  30. package/dist/chat/message.d.ts +28 -0
  31. package/dist/chat/message.d.ts.map +1 -0
  32. package/dist/chat/message.js +220 -0
  33. package/dist/chat/message.js.map +1 -0
  34. package/dist/checkbox/checkbox-group.d.ts +35 -0
  35. package/dist/checkbox/checkbox-group.d.ts.map +1 -0
  36. package/dist/checkbox/checkbox-group.js +116 -0
  37. package/dist/checkbox/checkbox-group.js.map +1 -0
  38. package/dist/checkbox/checkbox.d.ts +27 -0
  39. package/dist/checkbox/checkbox.d.ts.map +1 -0
  40. package/dist/checkbox/checkbox.js +164 -0
  41. package/dist/checkbox/checkbox.js.map +1 -0
  42. package/dist/checkbox/tri-state-checkbox.d.ts +22 -0
  43. package/dist/checkbox/tri-state-checkbox.d.ts.map +1 -0
  44. package/dist/checkbox/tri-state-checkbox.js +87 -0
  45. package/dist/checkbox/tri-state-checkbox.js.map +1 -0
  46. package/dist/code-viewer/code-viewer.d.ts +31 -0
  47. package/dist/code-viewer/code-viewer.d.ts.map +1 -0
  48. package/dist/code-viewer/code-viewer.js +115 -0
  49. package/dist/code-viewer/code-viewer.js.map +1 -0
  50. package/dist/combo-box/combo-box.d.ts +39 -0
  51. package/dist/combo-box/combo-box.d.ts.map +1 -0
  52. package/dist/combo-box/combo-box.js +176 -0
  53. package/dist/combo-box/combo-box.js.map +1 -0
  54. package/dist/component-select-list/component-select-list.d.ts +27 -0
  55. package/dist/component-select-list/component-select-list.d.ts.map +1 -0
  56. package/dist/component-select-list/component-select-list.js +131 -0
  57. package/dist/component-select-list/component-select-list.js.map +1 -0
  58. package/dist/constants.d.ts +33 -0
  59. package/dist/constants.d.ts.map +1 -0
  60. package/dist/constants.js +47 -0
  61. package/dist/constants.js.map +1 -0
  62. package/dist/context-menu/context-menu.d.ts +24 -0
  63. package/dist/context-menu/context-menu.d.ts.map +1 -0
  64. package/dist/context-menu/context-menu.js +116 -0
  65. package/dist/context-menu/context-menu.js.map +1 -0
  66. package/dist/datepicker/datepicker-select.d.ts +48 -0
  67. package/dist/datepicker/datepicker-select.d.ts.map +1 -0
  68. package/dist/datepicker/datepicker-select.js +219 -0
  69. package/dist/datepicker/datepicker-select.js.map +1 -0
  70. package/dist/datepicker/datepicker.d.ts +56 -0
  71. package/dist/datepicker/datepicker.d.ts.map +1 -0
  72. package/dist/datepicker/datepicker.js +669 -0
  73. package/dist/datepicker/datepicker.js.map +1 -0
  74. package/dist/dropzone/dropzone.d.ts +21 -0
  75. package/dist/dropzone/dropzone.d.ts.map +1 -0
  76. package/dist/dropzone/dropzone.js +80 -0
  77. package/dist/dropzone/dropzone.js.map +1 -0
  78. package/dist/error-boundary/error-boundary.d.ts +33 -0
  79. package/dist/error-boundary/error-boundary.d.ts.map +1 -0
  80. package/dist/error-boundary/error-boundary.js +72 -0
  81. package/dist/error-boundary/error-boundary.js.map +1 -0
  82. package/dist/filter/categorical-filter.d.ts +26 -0
  83. package/dist/filter/categorical-filter.d.ts.map +1 -0
  84. package/dist/filter/categorical-filter.js +153 -0
  85. package/dist/filter/categorical-filter.js.map +1 -0
  86. package/dist/filter/datetime-filter.d.ts +28 -0
  87. package/dist/filter/datetime-filter.d.ts.map +1 -0
  88. package/dist/filter/datetime-filter.js +174 -0
  89. package/dist/filter/datetime-filter.js.map +1 -0
  90. package/dist/filter/numeric-filter.d.ts +24 -0
  91. package/dist/filter/numeric-filter.d.ts.map +1 -0
  92. package/dist/filter/numeric-filter.js +148 -0
  93. package/dist/filter/numeric-filter.js.map +1 -0
  94. package/dist/hierarchy-selector/hierarchy-selector.d.ts +31 -0
  95. package/dist/hierarchy-selector/hierarchy-selector.d.ts.map +1 -0
  96. package/dist/hierarchy-selector/hierarchy-selector.js +65 -0
  97. package/dist/hierarchy-selector/hierarchy-selector.js.map +1 -0
  98. package/dist/hierarchy-selector/node/branch.d.ts +47 -0
  99. package/dist/hierarchy-selector/node/branch.d.ts.map +1 -0
  100. package/dist/hierarchy-selector/node/branch.js +132 -0
  101. package/dist/hierarchy-selector/node/branch.js.map +1 -0
  102. package/dist/index.d.ts +57 -0
  103. package/dist/index.d.ts.map +1 -0
  104. package/dist/index.js +55 -0
  105. package/dist/index.js.map +1 -0
  106. package/dist/input/input.d.ts +44 -0
  107. package/dist/input/input.d.ts.map +1 -0
  108. package/dist/input/input.js +91 -0
  109. package/dist/input/input.js.map +1 -0
  110. package/dist/jest-setup.d.ts +18 -0
  111. package/dist/jest-setup.d.ts.map +1 -0
  112. package/dist/jest-setup.js +18 -0
  113. package/dist/jest-setup.js.map +1 -0
  114. package/dist/markdown/markdown.d.ts +18 -0
  115. package/dist/markdown/markdown.d.ts.map +1 -0
  116. package/dist/markdown/markdown.js +356 -0
  117. package/dist/markdown/markdown.js.map +1 -0
  118. package/dist/modal/modal.d.ts +37 -0
  119. package/dist/modal/modal.d.ts.map +1 -0
  120. package/dist/modal/modal.js +121 -0
  121. package/dist/modal/modal.js.map +1 -0
  122. package/dist/multiselect/multiselect.d.ts +31 -0
  123. package/dist/multiselect/multiselect.d.ts.map +1 -0
  124. package/dist/multiselect/multiselect.js +231 -0
  125. package/dist/multiselect/multiselect.js.map +1 -0
  126. package/dist/numeric-input/input-stepper.d.ts +33 -0
  127. package/dist/numeric-input/input-stepper.d.ts.map +1 -0
  128. package/dist/numeric-input/input-stepper.js +54 -0
  129. package/dist/numeric-input/input-stepper.js.map +1 -0
  130. package/dist/numeric-input/numeric-input.d.ts +42 -0
  131. package/dist/numeric-input/numeric-input.d.ts.map +1 -0
  132. package/dist/numeric-input/numeric-input.js +234 -0
  133. package/dist/numeric-input/numeric-input.js.map +1 -0
  134. package/dist/progress-bar/progress-bar.d.ts +23 -0
  135. package/dist/progress-bar/progress-bar.d.ts.map +1 -0
  136. package/dist/progress-bar/progress-bar.js +90 -0
  137. package/dist/progress-bar/progress-bar.js.map +1 -0
  138. package/dist/radio/radio-group.d.ts +19 -0
  139. package/dist/radio/radio-group.d.ts.map +1 -0
  140. package/dist/radio/radio-group.js +160 -0
  141. package/dist/radio/radio-group.js.map +1 -0
  142. package/dist/search-bar/search-bar.d.ts +34 -0
  143. package/dist/search-bar/search-bar.d.ts.map +1 -0
  144. package/dist/search-bar/search-bar.js +39 -0
  145. package/dist/search-bar/search-bar.js.map +1 -0
  146. package/dist/sectioned-list/sectioned-list.d.ts +29 -0
  147. package/dist/sectioned-list/sectioned-list.d.ts.map +1 -0
  148. package/dist/sectioned-list/sectioned-list.js +205 -0
  149. package/dist/sectioned-list/sectioned-list.js.map +1 -0
  150. package/dist/select/select.d.ts +54 -0
  151. package/dist/select/select.d.ts.map +1 -0
  152. package/dist/select/select.js +143 -0
  153. package/dist/select/select.js.map +1 -0
  154. package/dist/shared/chevron-button.d.ts +13 -0
  155. package/dist/shared/chevron-button.d.ts.map +1 -0
  156. package/dist/shared/chevron-button.js +35 -0
  157. package/dist/shared/chevron-button.js.map +1 -0
  158. package/dist/shared/dropdown-list.d.ts +34 -0
  159. package/dist/shared/dropdown-list.d.ts.map +1 -0
  160. package/dist/shared/dropdown-list.js +33 -0
  161. package/dist/shared/dropdown-list.js.map +1 -0
  162. package/dist/shared/list-item.d.ts +35 -0
  163. package/dist/shared/list-item.d.ts.map +1 -0
  164. package/dist/shared/list-item.js +69 -0
  165. package/dist/shared/list-item.js.map +1 -0
  166. package/dist/slider/slider-inputs.d.ts +36 -0
  167. package/dist/slider/slider-inputs.d.ts.map +1 -0
  168. package/dist/slider/slider-inputs.js +88 -0
  169. package/dist/slider/slider-inputs.js.map +1 -0
  170. package/dist/slider/slider.d.ts +53 -0
  171. package/dist/slider/slider.d.ts.map +1 -0
  172. package/dist/slider/slider.js +273 -0
  173. package/dist/slider/slider.js.map +1 -0
  174. package/dist/spinner/spinner.d.ts +19 -0
  175. package/dist/spinner/spinner.d.ts.map +1 -0
  176. package/dist/spinner/spinner.js +144 -0
  177. package/dist/spinner/spinner.js.map +1 -0
  178. package/dist/switch/sun-icon.d.ts +3 -0
  179. package/dist/switch/sun-icon.d.ts.map +1 -0
  180. package/dist/switch/sun-icon.js +24 -0
  181. package/dist/switch/sun-icon.js.map +1 -0
  182. package/dist/switch/switch.d.ts +16 -0
  183. package/dist/switch/switch.d.ts.map +1 -0
  184. package/dist/switch/switch.js +92 -0
  185. package/dist/switch/switch.js.map +1 -0
  186. package/dist/table/cells/action-cell.d.ts +34 -0
  187. package/dist/table/cells/action-cell.d.ts.map +1 -0
  188. package/dist/table/cells/action-cell.js +68 -0
  189. package/dist/table/cells/action-cell.js.map +1 -0
  190. package/dist/table/cells/datetime-cell.d.ts +12 -0
  191. package/dist/table/cells/datetime-cell.d.ts.map +1 -0
  192. package/dist/table/cells/datetime-cell.js +36 -0
  193. package/dist/table/cells/datetime-cell.js.map +1 -0
  194. package/dist/table/cells/edit-cell-utils.d.ts +32 -0
  195. package/dist/table/cells/edit-cell-utils.d.ts.map +1 -0
  196. package/dist/table/cells/edit-cell-utils.js +2 -0
  197. package/dist/table/cells/edit-cell-utils.js.map +1 -0
  198. package/dist/table/cells/edit-input-cell.d.ts +10 -0
  199. package/dist/table/cells/edit-input-cell.d.ts.map +1 -0
  200. package/dist/table/cells/edit-input-cell.js +61 -0
  201. package/dist/table/cells/edit-input-cell.js.map +1 -0
  202. package/dist/table/cells/edit-select-cell.d.ts +12 -0
  203. package/dist/table/cells/edit-select-cell.d.ts.map +1 -0
  204. package/dist/table/cells/edit-select-cell.js +55 -0
  205. package/dist/table/cells/edit-select-cell.js.map +1 -0
  206. package/dist/table/filters.d.ts +46 -0
  207. package/dist/table/filters.d.ts.map +1 -0
  208. package/dist/table/filters.js +226 -0
  209. package/dist/table/filters.js.map +1 -0
  210. package/dist/table/headers/select-header.d.ts +14 -0
  211. package/dist/table/headers/select-header.d.ts.map +1 -0
  212. package/dist/table/headers/select-header.js +41 -0
  213. package/dist/table/headers/select-header.js.map +1 -0
  214. package/dist/table/options-menu.d.ts +25 -0
  215. package/dist/table/options-menu.d.ts.map +1 -0
  216. package/dist/table/options-menu.js +123 -0
  217. package/dist/table/options-menu.js.map +1 -0
  218. package/dist/table/render-row.d.ts +25 -0
  219. package/dist/table/render-row.d.ts.map +1 -0
  220. package/dist/table/render-row.js +163 -0
  221. package/dist/table/render-row.js.map +1 -0
  222. package/dist/table/table.d.ts +95 -0
  223. package/dist/table/table.d.ts.map +1 -0
  224. package/dist/table/table.js +422 -0
  225. package/dist/table/table.js.map +1 -0
  226. package/dist/table/types.d.ts +30 -0
  227. package/dist/table/types.d.ts.map +1 -0
  228. package/dist/table/types.js +2 -0
  229. package/dist/table/types.js.map +1 -0
  230. package/dist/tabs/tabs.d.ts +22 -0
  231. package/dist/tabs/tabs.d.ts.map +1 -0
  232. package/dist/tabs/tabs.js +91 -0
  233. package/dist/tabs/tabs.js.map +1 -0
  234. package/dist/textarea/textarea.d.ts +47 -0
  235. package/dist/textarea/textarea.d.ts.map +1 -0
  236. package/dist/textarea/textarea.js +121 -0
  237. package/dist/textarea/textarea.js.map +1 -0
  238. package/dist/tooltip/tooltip.d.ts +48 -0
  239. package/dist/tooltip/tooltip.d.ts.map +1 -0
  240. package/dist/tooltip/tooltip.js +116 -0
  241. package/dist/tooltip/tooltip.js.map +1 -0
  242. package/dist/types.d.ts +94 -0
  243. package/dist/types.d.ts.map +1 -0
  244. package/dist/types.js +2 -0
  245. package/dist/types.js.map +1 -0
  246. package/dist/utils/chevron.d.ts +34 -0
  247. package/dist/utils/chevron.d.ts.map +1 -0
  248. package/dist/utils/chevron.js +38 -0
  249. package/dist/utils/chevron.js.map +1 -0
  250. package/dist/utils/index.d.ts +22 -0
  251. package/dist/utils/index.d.ts.map +1 -0
  252. package/dist/utils/index.js +22 -0
  253. package/dist/utils/index.js.map +1 -0
  254. package/dist/utils/label.d.ts +3 -0
  255. package/dist/utils/label.d.ts.map +1 -0
  256. package/dist/utils/label.js +24 -0
  257. package/dist/utils/label.js.map +1 -0
  258. package/dist/utils/list-styles.d.ts +8 -0
  259. package/dist/utils/list-styles.d.ts.map +1 -0
  260. package/dist/utils/list-styles.js +43 -0
  261. package/dist/utils/list-styles.js.map +1 -0
  262. package/dist/utils/match-width-to-reference.d.ts +24 -0
  263. package/dist/utils/match-width-to-reference.d.ts.map +1 -0
  264. package/dist/utils/match-width-to-reference.js +30 -0
  265. package/dist/utils/match-width-to-reference.js.map +1 -0
  266. package/dist/utils/syncKbdHighlightIdx.d.ts +23 -0
  267. package/dist/utils/syncKbdHighlightIdx.d.ts.map +1 -0
  268. package/dist/utils/syncKbdHighlightIdx.js +41 -0
  269. package/dist/utils/syncKbdHighlightIdx.js.map +1 -0
  270. package/dist/utils/use-infinite-loader.d.ts +32 -0
  271. package/dist/utils/use-infinite-loader.d.ts.map +1 -0
  272. package/dist/utils/use-infinite-loader.js +119 -0
  273. package/dist/utils/use-infinite-loader.js.map +1 -0
  274. package/dist/utils/use-on-click-outside.d.ts +3 -0
  275. package/dist/utils/use-on-click-outside.d.ts.map +1 -0
  276. package/dist/utils/use-on-click-outside.js +36 -0
  277. package/dist/utils/use-on-click-outside.js.map +1 -0
  278. package/package.json +106 -0
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright 2023 Impulse Innovations Limited
3
+ *
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export { default as Chevron } from './chevron';
18
+ export { default as SubtleLabel } from './label';
19
+ export { List, NoItemsLabel } from './list-styles';
20
+ export { default as useInfiniteLoader, InfiniteLoader } from './use-infinite-loader';
21
+ export { default as matchWidthToReference } from './match-width-to-reference';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright 2023 Impulse Innovations Limited
3
+ *
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export { default as Chevron } from './chevron';
18
+ export { default as SubtleLabel } from './label';
19
+ export { List, NoItemsLabel } from './list-styles';
20
+ export { default as useInfiniteLoader } from './use-infinite-loader';
21
+ export { default as matchWidthToReference } from './match-width-to-reference';
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAkB,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const SubtleLabel: import("styled-components").StyledComponent<"label", import("@darajs/styled-components").DefaultTheme, {}, never>;
2
+ export default SubtleLabel;
3
+ //# sourceMappingURL=label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/utils/label.tsx"],"names":[],"mappings":"AAkBA,QAAA,MAAM,WAAW,mHAIhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright 2023 Impulse Innovations Limited
3
+ *
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import styled from '@darajs/styled-components';
18
+ const SubtleLabel = styled.label `
19
+ margin-bottom: 0;
20
+ font-size: 11px;
21
+ color: ${(props) => props.theme.colors.grey6};
22
+ `;
23
+ export default SubtleLabel;
24
+ //# sourceMappingURL=label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/utils/label.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAE/C,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAA;;;aAGnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;CAC/C,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ interface ListProps {
2
+ isOpen: boolean;
3
+ maxItems?: number;
4
+ }
5
+ declare const List: import("styled-components").StyledComponent<"div", import("@darajs/styled-components").DefaultTheme, ListProps, never>;
6
+ declare const NoItemsLabel: import("styled-components").StyledComponent<"span", import("@darajs/styled-components").DefaultTheme, {}, never>;
7
+ export { List, NoItemsLabel };
8
+ //# sourceMappingURL=list-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-styles.d.ts","sourceRoot":"","sources":["../../src/utils/list-styles.tsx"],"names":[],"mappings":"AAkBA,UAAU,SAAS;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,IAAI,wHAUT,CAAC;AAEF,QAAA,MAAM,YAAY,kHAYjB,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright 2023 Impulse Innovations Limited
3
+ *
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import styled from '@darajs/styled-components';
18
+ const List = styled.div `
19
+ z-index: 5000;
20
+
21
+ overflow-y: auto;
22
+ display: ${(props) => (props.isOpen ? 'flex' : 'none')};
23
+ flex-direction: column;
24
+
25
+ max-height: calc(${(props) => (props.maxItems || 5) * 2}em + 2px);
26
+
27
+ border: 1px solid ${(props) => props.theme.colors.grey3};
28
+ `;
29
+ const NoItemsLabel = styled.span `
30
+ display: flex;
31
+ flex: 1 1 auto;
32
+ align-items: center;
33
+ justify-content: center;
34
+
35
+ height: 2rem;
36
+
37
+ font-size: 1rem;
38
+ color: ${(props) => props.theme.colors.text};
39
+
40
+ background-color: ${(props) => props.theme.colors.blue1};
41
+ `;
42
+ export { List, NoItemsLabel };
43
+ //# sourceMappingURL=list-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-styles.js","sourceRoot":"","sources":["../../src/utils/list-styles.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAO/C,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAW;;;;eAInB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;;;uBAGnC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC;;wBAEnC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;CAC1D,CAAC;AAEF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAA;;;;;;;;;aASnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI;;wBAEvB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;CAC1D,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright 2023 Impulse Innovations Limited
3
+ *
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Middleware } from '@floating-ui/react';
18
+ /**
19
+ * A middleware for Floating UI that auto sizes the floating content to be the same as the reference element.
20
+ * Optionally, a delta can be added to the width.
21
+ */
22
+ declare const matchWidthToReference: (delta?: number) => Middleware;
23
+ export default matchWidthToReference;
24
+ //# sourceMappingURL=match-width-to-reference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-width-to-reference.d.ts","sourceRoot":"","sources":["../../src/utils/match-width-to-reference.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAoC,UAAU,EAAQ,MAAM,oBAAoB,CAAC;AAExF;;;GAGG;AACH,QAAA,MAAM,qBAAqB,sBAAgB,UAOrC,CAAC;AAEP,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright 2023 Impulse Innovations Limited
3
+ *
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { size } from '@floating-ui/react';
18
+ /**
19
+ * A middleware for Floating UI that auto sizes the floating content to be the same as the reference element.
20
+ * Optionally, a delta can be added to the width.
21
+ */
22
+ const matchWidthToReference = (delta = 0) => size({
23
+ apply({ rects, elements }) {
24
+ Object.assign(elements.floating.style, {
25
+ width: `${rects.reference.width + delta}px`,
26
+ });
27
+ },
28
+ });
29
+ export default matchWidthToReference;
30
+ //# sourceMappingURL=match-width-to-reference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-width-to-reference.js","sourceRoot":"","sources":["../../src/utils/match-width-to-reference.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAgD,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAExF;;;GAGG;AACH,MAAM,qBAAqB,GAAG,CAAC,KAAK,GAAG,CAAC,EAAc,EAAE,CACpD,IAAI,CAAC;IACD,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,EAA+C;QAClE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE;YACnC,KAAK,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,GAAG,KAAK,IAAI;SAC9C,CAAC,CAAC;IACP,CAAC;CACJ,CAAC,CAAC;AAEP,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Synchronizes the highlighted index with keyboard navigation and resets it for mouse movements.
3
+ *
4
+ * This function returns an object with an `onHighlightedIndexChange` method that handles changes to the highlighted index.
5
+ * It updates the `setKbdHighlightIdx` callback to force a rerender when the element is highlighted using the keyboard,
6
+ * and resets the index when the mouse is used to let CSS :hover take over the styling.
7
+ *
8
+ * @param {function} setKbdHighlightIdx - Callback function to set the highlighted index for keyboard navigation.
9
+ * @returns {object} An object containing the `onHighlightedIndexChange` method.
10
+ *
11
+ * @example
12
+ * const { onHighlightedIndexChange } = syncKbdHighlightIdx(setKbdHighlightIdx);
13
+ *
14
+ * // Use this method in the Downshift hook to handle highlighted index changes
15
+ * useSelect({
16
+ * items,
17
+ * onHighlightedIndexChange
18
+ * });
19
+ */
20
+ export declare const syncKbdHighlightIdx: (setKbdHighlightIdx: (idx: number) => void) => {
21
+ onHighlightedIndexChange: ({ highlightedIndex, type }: any) => void;
22
+ };
23
+ //# sourceMappingURL=syncKbdHighlightIdx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncKbdHighlightIdx.d.ts","sourceRoot":"","sources":["../../src/utils/syncKbdHighlightIdx.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,uBACR,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAC1C;IAAE,wBAAwB,EAAE,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,IAAI,CAAA;CAWtE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { useCombobox, useSelect } from 'downshift';
2
+ const { stateChangeTypes: useSelectChangeTypes } = useSelect;
3
+ const { stateChangeTypes: useComboboxChangeTypes } = useCombobox;
4
+ const setTypes = new Set([
5
+ useSelectChangeTypes.ToggleButtonKeyDownArrowDown,
6
+ useSelectChangeTypes.ToggleButtonKeyDownArrowUp,
7
+ useComboboxChangeTypes.InputKeyDownArrowDown,
8
+ useComboboxChangeTypes.InputKeyDownArrowUp,
9
+ ]);
10
+ /**
11
+ * Synchronizes the highlighted index with keyboard navigation and resets it for mouse movements.
12
+ *
13
+ * This function returns an object with an `onHighlightedIndexChange` method that handles changes to the highlighted index.
14
+ * It updates the `setKbdHighlightIdx` callback to force a rerender when the element is highlighted using the keyboard,
15
+ * and resets the index when the mouse is used to let CSS :hover take over the styling.
16
+ *
17
+ * @param {function} setKbdHighlightIdx - Callback function to set the highlighted index for keyboard navigation.
18
+ * @returns {object} An object containing the `onHighlightedIndexChange` method.
19
+ *
20
+ * @example
21
+ * const { onHighlightedIndexChange } = syncKbdHighlightIdx(setKbdHighlightIdx);
22
+ *
23
+ * // Use this method in the Downshift hook to handle highlighted index changes
24
+ * useSelect({
25
+ * items,
26
+ * onHighlightedIndexChange
27
+ * });
28
+ */
29
+ export const syncKbdHighlightIdx = (setKbdHighlightIdx) => ({
30
+ onHighlightedIndexChange: ({ highlightedIndex, type }) => {
31
+ // Hack to force a rerender of an element when highlighted with a keyboard
32
+ if (setTypes.has(type)) {
33
+ setKbdHighlightIdx(highlightedIndex);
34
+ }
35
+ // Reset the highlighted index to let CSS :hover take over the styling
36
+ if (type === useSelectChangeTypes.ItemMouseMove) {
37
+ setKbdHighlightIdx(undefined);
38
+ }
39
+ },
40
+ });
41
+ //# sourceMappingURL=syncKbdHighlightIdx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncKbdHighlightIdx.js","sourceRoot":"","sources":["../../src/utils/syncKbdHighlightIdx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEnD,MAAM,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,GAAG,SAAS,CAAC;AAC7D,MAAM,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,GAAG,WAAW,CAAC;AAEjE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACrB,oBAAoB,CAAC,4BAA4B;IACjD,oBAAoB,CAAC,0BAA0B;IAC/C,sBAAsB,CAAC,qBAAqB;IAC5C,sBAAsB,CAAC,mBAAmB;CAC7C,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAC/B,kBAAyC,EAC8B,EAAE,CAAC,CAAC;IAC3E,wBAAwB,EAAE,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAO,EAAE,EAAE;QAC1D,0EAA0E;QAC1E,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;QACzC,CAAC;QACD,sEAAsE;QACtE,IAAI,IAAI,KAAK,oBAAoB,CAAC,aAAa,EAAE,CAAC;YAC9C,kBAAkB,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC;IACL,CAAC;CACJ,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ interface LoadReturn<T> {
2
+ data: Array<T>;
3
+ totalCount: number;
4
+ }
5
+ export interface ItemsRenderedPayload {
6
+ overscanStartIndex: number;
7
+ overscanStopIndex: number;
8
+ }
9
+ export interface InfiniteLoader<T> {
10
+ /** A function to get the actual value of an item, based on it's absolute index in the list */
11
+ getItem: (index: number) => T;
12
+ /** The total count of items in the list */
13
+ itemCount: number;
14
+ /** A handler for the onItemsRendered function exposed by the react-window components */
15
+ onItemsRendered: (payload: ItemsRenderedPayload) => Promise<void>;
16
+ /**
17
+ * A function to force a refresh of the data, will trigger a refetch of the current window and discard anything
18
+ * outside that window
19
+ */
20
+ refresh: () => void;
21
+ }
22
+ /**
23
+ * This is a helper hook that plugs into the react-window components and allows them to load data infinitely by simply
24
+ * passing a load data function to the constructor and passing the returned props into the virtualized list components.
25
+ * The key difference between this and the infinite loader library is that this hook allows for polling, simply by
26
+ * calling the refresh function that it exposes in a useEffect hook.
27
+ *
28
+ * @param onLoadData a function that should load the data between startIndex and stopIndex
29
+ */
30
+ declare function useInfiniteLoader<T>(onLoadData: (startIndex: number, stopIndex: number) => Promise<LoadReturn<T>>, onError?: (err: Error) => void | Promise<void>, batchSize?: number): InfiniteLoader<T>;
31
+ export default useInfiniteLoader;
32
+ //# sourceMappingURL=use-infinite-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-infinite-loader.d.ts","sourceRoot":"","sources":["../../src/utils/use-infinite-loader.tsx"],"names":[],"mappings":"AAoBA,UAAU,UAAU,CAAC,CAAC;IAClB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc,CAAC,CAAC;IAC7B,8FAA8F;IAC9F,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,CAAC;IAC9B,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,wFAAwF;IACxF,eAAe,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE;;;OAGG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,iBAAS,iBAAiB,CAAC,CAAC,EACxB,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAC7E,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC9C,SAAS,SAAK,GACf,cAAc,CAAC,CAAC,CAAC,CAmGnB;AAED,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,119 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ /**
11
+ * Copyright 2023 Impulse Innovations Limited
12
+ *
13
+ *
14
+ * Licensed under the Apache License, Version 2.0 (the "License");
15
+ * you may not use this file except in compliance with the License.
16
+ * You may obtain a copy of the License at
17
+ *
18
+ * http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software
21
+ * distributed under the License is distributed on an "AS IS" BASIS,
22
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
+ * See the License for the specific language governing permissions and
24
+ * limitations under the License.
25
+ */
26
+ import { useCallback, useEffect, useRef, useState } from 'react';
27
+ import { useDeepCompare } from '@darajs/ui-utils';
28
+ /**
29
+ * This is a helper hook that plugs into the react-window components and allows them to load data infinitely by simply
30
+ * passing a load data function to the constructor and passing the returned props into the virtualized list components.
31
+ * The key difference between this and the infinite loader library is that this hook allows for polling, simply by
32
+ * calling the refresh function that it exposes in a useEffect hook.
33
+ *
34
+ * @param onLoadData a function that should load the data between startIndex and stopIndex
35
+ */
36
+ function useInfiniteLoader(onLoadData, onError, batchSize = 50) {
37
+ // Use a ref on the onLoadData function to get the updated version into the onItemsRendered function as only the
38
+ // first instance passed is ever called by react-window
39
+ const onLoadRef = useRef(onLoadData);
40
+ const [internalData, setInternalData] = useState([]);
41
+ const [itemCount, setItemCount] = useState(0);
42
+ const [currentStartIdx, setStartIdx] = useState(0);
43
+ const [currentStopIdx, setStopIdx] = useState(0);
44
+ const [currentRange, setCurrentRange] = useState({
45
+ overscanStartIndex: 0,
46
+ overscanStopIndex: 50,
47
+ });
48
+ const getItem = useCallback((index) => {
49
+ const adjustedIndex = index - currentStartIdx;
50
+ if (adjustedIndex < 0 || adjustedIndex > internalData.length) {
51
+ return;
52
+ }
53
+ return internalData[adjustedIndex];
54
+ },
55
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56
+ useDeepCompare([currentStartIdx, internalData]));
57
+ const onItemsRendered = useCallback((_a, forceRefresh_1) => __awaiter(this, [_a, forceRefresh_1], void 0, function* ({ overscanStartIndex, overscanStopIndex }, forceRefresh) {
58
+ try {
59
+ const isFirstItemLoaded = overscanStartIndex >= currentStartIdx && overscanStartIndex <= currentStopIdx;
60
+ const isLastItemLoaded = overscanStopIndex >= currentStartIdx && overscanStopIndex <= currentStopIdx;
61
+ setCurrentRange({ overscanStartIndex, overscanStopIndex });
62
+ // Nothing to do if everything is loaded and it's not a forced refresh
63
+ if (isFirstItemLoaded && isLastItemLoaded && !forceRefresh) {
64
+ return;
65
+ }
66
+ // If both are loaded then forceRefresh is true or both are not loaded and we're starting from nothing. In
67
+ // either case we need to calculate the window to fetch from the backend.
68
+ if (isFirstItemLoaded === isLastItemLoaded) {
69
+ const mid = Math.floor((overscanStopIndex - overscanStartIndex) / 2 + overscanStartIndex);
70
+ const start = Math.max(mid - batchSize / 2, 0);
71
+ const end = mid + batchSize / 2;
72
+ setStartIdx(start);
73
+ setStopIdx(end);
74
+ const { data, totalCount } = yield onLoadRef.current(start, end);
75
+ setInternalData(data);
76
+ setItemCount(totalCount);
77
+ return;
78
+ }
79
+ // This branch covers scrolling up from the bottom of the list and loading as it goes
80
+ if (!isFirstItemLoaded) {
81
+ const start = Math.max(currentStartIdx - batchSize, 0);
82
+ const res = onLoadRef.current(start, currentStartIdx);
83
+ setStartIdx(start);
84
+ const { data, totalCount } = yield res;
85
+ setInternalData((current) => [...data, ...current]);
86
+ setItemCount(totalCount);
87
+ return;
88
+ }
89
+ // This branch covers scrolling down from the top and loading as it goes
90
+ const end = currentStopIdx + batchSize;
91
+ const res = onLoadRef.current(currentStopIdx, end);
92
+ setStopIdx(end);
93
+ const { data, totalCount } = yield res;
94
+ setInternalData((current) => [...current, ...data]);
95
+ setItemCount(totalCount);
96
+ }
97
+ catch (err) {
98
+ onError === null || onError === void 0 ? void 0 : onError(err);
99
+ }
100
+ }), [batchSize, currentStartIdx, currentStopIdx, onError]);
101
+ useEffect(() => {
102
+ onLoadRef.current = onLoadData;
103
+ onItemsRendered(currentRange, true);
104
+ // eslint-disable-next-line react-hooks/exhaustive-deps
105
+ }, [onLoadData]);
106
+ const refresh = useCallback(() => {
107
+ onItemsRendered(currentRange, true);
108
+ },
109
+ // eslint-disable-next-line react-hooks/exhaustive-deps
110
+ useDeepCompare([currentRange]));
111
+ return {
112
+ getItem,
113
+ itemCount,
114
+ onItemsRendered,
115
+ refresh,
116
+ };
117
+ }
118
+ export default useInfiniteLoader;
119
+ //# sourceMappingURL=use-infinite-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-infinite-loader.js","sourceRoot":"","sources":["../../src/utils/use-infinite-loader.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ declare function useOnClickOutside(element: any, handler: () => void): void;
2
+ export default useOnClickOutside;
3
+ //# sourceMappingURL=use-on-click-outside.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-on-click-outside.d.ts","sourceRoot":"","sources":["../../src/utils/use-on-click-outside.tsx"],"names":[],"mappings":"AAkBA,iBAAS,iBAAiB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAgBlE;AAED,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Copyright 2023 Impulse Innovations Limited
3
+ *
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { useEffect } from 'react';
18
+ function useOnClickOutside(element, handler) {
19
+ useEffect(() => {
20
+ const listener = (event) => {
21
+ // Do nothing if clicking ref's element or descendent elements
22
+ if (!element || element.contains(event.target)) {
23
+ return;
24
+ }
25
+ handler();
26
+ };
27
+ document.addEventListener('mousedown', listener);
28
+ document.addEventListener('touchstart', listener);
29
+ return () => {
30
+ document.removeEventListener('mousedown', listener);
31
+ document.removeEventListener('touchstart', listener);
32
+ };
33
+ }, [element, handler]);
34
+ }
35
+ export default useOnClickOutside;
36
+ //# sourceMappingURL=use-on-click-outside.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-on-click-outside.js","sourceRoot":"","sources":["../../src/utils/use-on-click-outside.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,SAAS,iBAAiB,CAAC,OAAY,EAAE,OAAmB;IACxD,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,QAAQ,GAAG,CAAC,KAAiB,EAAQ,EAAE;YACzC,8DAA8D;YAC9D,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC7C,OAAO;YACX,CAAC;YACD,OAAO,EAAE,CAAC;QACd,CAAC,CAAC;QACF,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjD,QAAQ,CAAC,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAClD,OAAO,GAAG,EAAE;YACR,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YACpD,QAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACzD,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3B,CAAC;AAED,eAAe,iBAAiB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,106 @@
1
+ {
2
+ "name": "@darajs/ui-components",
3
+ "version": "0.4.8",
4
+ "description": "The core React UI kit for Dara",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "jsnext:main": "dist/index.js",
8
+ "scripts": {
9
+ "build": "rimraf dist && tsc",
10
+ "format": "prettier src --write",
11
+ "format:check": "prettier src --check",
12
+ "lint": "tsc --noemit && eslint src --ext .tsx --max-warnings 0 && stylelint './src/**/*.tsx'",
13
+ "lint:fix": "eslint src --ext .tsx --max-warnings 0 --fix && stylelint './src/**/*.tsx' --fix",
14
+ "test-watch": "jest --watch",
15
+ "test": "jest",
16
+ "storybook": "start-storybook -p 6006",
17
+ "build-storybook": "build-storybook"
18
+ },
19
+ "author": "Krzysztof Bielikowicz <krzysztof@causalens.com>",
20
+ "license": "Apache-2.0",
21
+ "prettier": "@darajs/prettier-config",
22
+ "devDependencies": {
23
+ "@babel/core": "^7.15.5",
24
+ "@babel/preset-env": "^7.15.6",
25
+ "@babel/preset-react": "^7.14.5",
26
+ "@babel/preset-typescript": "^7.15.0",
27
+ "@darajs/eslint-config": "0.4.8",
28
+ "@darajs/prettier-config": "0.4.8",
29
+ "@darajs/stylelint-config": "0.4.8",
30
+ "@storybook/addon-a11y": "^6.5.16",
31
+ "@storybook/addon-actions": "^6.5.16",
32
+ "@storybook/addon-essentials": "^6.5.16",
33
+ "@storybook/addon-links": "^6.5.16",
34
+ "@storybook/addon-styling": "^0.3.2",
35
+ "@storybook/builder-webpack5": "^6.5.16",
36
+ "@storybook/manager-webpack5": "^6.5.16",
37
+ "@storybook/react": "^6.5.16",
38
+ "@storybook/theming": "^6.5.16",
39
+ "@testing-library/dom": "^9.3.0",
40
+ "@testing-library/jest-dom": "^5.16.5",
41
+ "@testing-library/react": "^14.0.0",
42
+ "@testing-library/user-event": "^13.2.1",
43
+ "@types/jest": "^27.0.0",
44
+ "@types/lodash": "^4.14.155",
45
+ "@types/react": "^18.0",
46
+ "@types/react-collapse": "^5.0.1",
47
+ "@types/react-datepicker": "^4.0.0",
48
+ "@types/react-dom": "^18.0",
49
+ "@types/react-table": "^7.0.19",
50
+ "@types/react-virtualized-auto-sizer": "^1.0.0",
51
+ "@types/react-window": "^1.8.2",
52
+ "@types/styled-components": "^5.1.26",
53
+ "babel-jest": "^29.5.0",
54
+ "babel-loader": "^8.2.2",
55
+ "babel-plugin-styled-components": "^1.13.2",
56
+ "eslint": "^7.2.0",
57
+ "eslint-plugin-jest": "^26.1.1",
58
+ "jest": "^29.5.0",
59
+ "jest-css-modules": "^2.1.0",
60
+ "jest-environment-jsdom": "^29.5.0",
61
+ "prettier": "^3.0.0",
62
+ "react-docgen-typescript-plugin": "^1.0.5",
63
+ "react-test-renderer": "^17.0",
64
+ "rimraf": "^3.0.2",
65
+ "storybook-dark-mode": "^2.1.1",
66
+ "stylelint": "^15.0.0",
67
+ "typescript": "^5.0.4"
68
+ },
69
+ "dependencies": {
70
+ "@darajs/styled-components": "0.4.8",
71
+ "@darajs/ui-icons": "0.4.8",
72
+ "@darajs/ui-utils": "0.4.8",
73
+ "@floating-ui/react": "^0.26.12",
74
+ "@fortawesome/free-regular-svg-icons": "~6.4.0",
75
+ "@fortawesome/free-solid-svg-icons": "~6.4.0",
76
+ "@fortawesome/react-fontawesome": "^0.2.0",
77
+ "@tippyjs/react": "4.1.0",
78
+ "date-fns": "2.9.0",
79
+ "downshift": "^7.0.0",
80
+ "lodash": "4.17.21",
81
+ "memoize-one": "^6.0.0",
82
+ "nanoid": "^3.3.0",
83
+ "polished": "3.6.4",
84
+ "prism-react-renderer": "^1.2.0",
85
+ "react": "^18.0",
86
+ "react-collapse": "^5.1.1",
87
+ "react-compound-slider": "3.3.0",
88
+ "react-datepicker": "4.8.0",
89
+ "react-dom": "^18.0",
90
+ "react-dropzone": "11.0.1",
91
+ "react-markdown": "^9.0.1",
92
+ "react-table": "7.7.0",
93
+ "react-table-sticky": "^1.1.3",
94
+ "react-virtualized-auto-sizer": "1.0.6",
95
+ "react-window": "1.8.10",
96
+ "remark-gfm": "^4.0.0",
97
+ "tippy.js": "6.2.6"
98
+ },
99
+ "files": [
100
+ "dist"
101
+ ],
102
+ "publishConfig": {
103
+ "access": "public"
104
+ },
105
+ "gitHead": "28ec9380d883a6f5f0fcd05f27beda7e412fa95f"
106
+ }