@bolio-ui/core 1.0.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 (381) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/dist/avatar/index.js +901 -0
  4. package/dist/badge/index.js +899 -0
  5. package/dist/bolio-ui-provider/index.js +1883 -0
  6. package/dist/breadcrumbs/index.js +985 -0
  7. package/dist/button/index.js +1358 -0
  8. package/dist/button-dropdown/index.js +1111 -0
  9. package/dist/button-group/index.js +782 -0
  10. package/dist/capacity/index.js +780 -0
  11. package/dist/card/index.js +1275 -0
  12. package/dist/checkbox/index.js +1042 -0
  13. package/dist/code/index.js +803 -0
  14. package/dist/col/index.js +90 -0
  15. package/dist/collapse/index.js +1158 -0
  16. package/dist/container/index.js +444 -0
  17. package/dist/css-baseline/index.js +348 -0
  18. package/dist/description/index.js +741 -0
  19. package/dist/display/index.js +745 -0
  20. package/dist/divider/index.js +767 -0
  21. package/dist/dot/index.js +755 -0
  22. package/dist/drawer/index.js +1513 -0
  23. package/dist/fieldset/index.js +1089 -0
  24. package/dist/grid/index.js +870 -0
  25. package/dist/image/index.js +1094 -0
  26. package/dist/index.js +9970 -0
  27. package/dist/input/index.js +1275 -0
  28. package/dist/keyboard/index.js +711 -0
  29. package/dist/link/index.js +863 -0
  30. package/dist/loading/index.js +765 -0
  31. package/dist/mdx-widgets/index.js +438 -0
  32. package/dist/modal/index.js +2220 -0
  33. package/dist/note/index.js +773 -0
  34. package/dist/page/index.js +928 -0
  35. package/dist/pagination/index.js +1201 -0
  36. package/dist/popover/index.js +1502 -0
  37. package/dist/progress/index.js +804 -0
  38. package/dist/radio/index.js +1028 -0
  39. package/dist/rating/index.js +912 -0
  40. package/dist/row/index.js +442 -0
  41. package/dist/section/index.js +733 -0
  42. package/dist/select/index.js +1865 -0
  43. package/dist/slider/index.js +1097 -0
  44. package/dist/snippet/index.js +1207 -0
  45. package/dist/spacer/index.js +692 -0
  46. package/dist/spinner/index.js +763 -0
  47. package/dist/styled-jsx.cjs.js +766 -0
  48. package/dist/tabs/index.js +1125 -0
  49. package/dist/tag/index.js +749 -0
  50. package/dist/text/index.js +830 -0
  51. package/dist/textarea/index.js +915 -0
  52. package/dist/themes/index.js +319 -0
  53. package/dist/toggle/index.js +852 -0
  54. package/dist/tooltip/index.js +1353 -0
  55. package/dist/use-all-themes/index.js +335 -0
  56. package/dist/use-body-scroll/index.js +173 -0
  57. package/dist/use-classes/index.js +55 -0
  58. package/dist/use-click-away/index.js +28 -0
  59. package/dist/use-clipboard/index.js +188 -0
  60. package/dist/use-current-state/index.js +90 -0
  61. package/dist/use-input/index.js +129 -0
  62. package/dist/use-keyboard/index.js +214 -0
  63. package/dist/use-media-query/index.js +495 -0
  64. package/dist/use-modal/index.js +114 -0
  65. package/dist/use-scale/index.js +673 -0
  66. package/dist/use-tabs/index.js +112 -0
  67. package/dist/use-theme/index.js +333 -0
  68. package/dist/use-toasts/index.js +236 -0
  69. package/esm/avatar/avatar-group.js +29 -0
  70. package/esm/avatar/avatar.js +107 -0
  71. package/esm/avatar/avatar.skeleton.js +21 -0
  72. package/esm/avatar/helpers.js +16 -0
  73. package/esm/avatar/index.js +4 -0
  74. package/esm/avatar/stories.js +113 -0
  75. package/esm/badge/badge-anchor.js +70 -0
  76. package/esm/badge/badge.js +58 -0
  77. package/esm/badge/index.js +4 -0
  78. package/esm/badge/stories.js +92 -0
  79. package/esm/bolio-ui-provider/bolio-ui-provider.js +62 -0
  80. package/esm/bolio-ui-provider/index.js +2 -0
  81. package/esm/bolio-ui-provider/theme-provider.js +47 -0
  82. package/esm/breadcrumbs/breadcrumbs-item.js +49 -0
  83. package/esm/breadcrumbs/breadcrumbs-separator.js +25 -0
  84. package/esm/breadcrumbs/breadcrumbs.js +47 -0
  85. package/esm/breadcrumbs/index.js +6 -0
  86. package/esm/breadcrumbs/stories.js +51 -0
  87. package/esm/button/button-icon.js +29 -0
  88. package/esm/button/button-loading.js +17 -0
  89. package/esm/button/button.drip.js +57 -0
  90. package/esm/button/button.js +146 -0
  91. package/esm/button/index.js +2 -0
  92. package/esm/button/stories.js +221 -0
  93. package/esm/button/styles.js +232 -0
  94. package/esm/button/utils.js +46 -0
  95. package/esm/button-dropdown/button-dropdown-context.js +11 -0
  96. package/esm/button-dropdown/button-dropdown-item.js +52 -0
  97. package/esm/button-dropdown/button-dropdown.js +111 -0
  98. package/esm/button-dropdown/icon.js +30 -0
  99. package/esm/button-dropdown/index.js +4 -0
  100. package/esm/button-dropdown/stories.js +92 -0
  101. package/esm/button-dropdown/styles.js +60 -0
  102. package/esm/button-group/button-group-context.js +9 -0
  103. package/esm/button-group/button-group.js +75 -0
  104. package/esm/button-group/index.js +2 -0
  105. package/esm/button-group/stories.js +66 -0
  106. package/esm/capacity/capacity.js +52 -0
  107. package/esm/capacity/index.js +2 -0
  108. package/esm/capacity/stories.js +55 -0
  109. package/esm/card/card-content.js +28 -0
  110. package/esm/card/card-footer.js +36 -0
  111. package/esm/card/card.js +68 -0
  112. package/esm/card/index.js +8 -0
  113. package/esm/card/stories.js +126 -0
  114. package/esm/card/styles.js +45 -0
  115. package/esm/checkbox/checkbox-context.js +10 -0
  116. package/esm/checkbox/checkbox-group.js +70 -0
  117. package/esm/checkbox/checkbox.icon.js +50 -0
  118. package/esm/checkbox/checkbox.js +114 -0
  119. package/esm/checkbox/index.js +4 -0
  120. package/esm/checkbox/stories.js +84 -0
  121. package/esm/checkbox/styles.js +34 -0
  122. package/esm/code/code.js +57 -0
  123. package/esm/code/index.js +2 -0
  124. package/esm/code/stories.js +53 -0
  125. package/esm/col/col.js +29 -0
  126. package/esm/col/index.js +2 -0
  127. package/esm/collapse/collapse-context.js +8 -0
  128. package/esm/collapse/collapse-group.js +75 -0
  129. package/esm/collapse/collapse-icon.js +28 -0
  130. package/esm/collapse/collapse.js +93 -0
  131. package/esm/collapse/index.js +4 -0
  132. package/esm/collapse/stories.js +48 -0
  133. package/esm/container/container.js +62 -0
  134. package/esm/container/index.js +2 -0
  135. package/esm/css-baseline/css-baseline.js +18 -0
  136. package/esm/css-baseline/index.js +1 -0
  137. package/esm/description/description.js +39 -0
  138. package/esm/description/index.js +2 -0
  139. package/esm/description/stories.js +23 -0
  140. package/esm/display/display.js +43 -0
  141. package/esm/display/index.js +2 -0
  142. package/esm/divider/divider.js +65 -0
  143. package/esm/divider/index.js +2 -0
  144. package/esm/divider/stories.js +41 -0
  145. package/esm/dot/dot.js +53 -0
  146. package/esm/dot/index.js +2 -0
  147. package/esm/dot/stories.js +40 -0
  148. package/esm/drawer/drawer-wrapper.js +86 -0
  149. package/esm/drawer/drawer.js +77 -0
  150. package/esm/drawer/helper.js +27 -0
  151. package/esm/drawer/index.js +8 -0
  152. package/esm/drawer/stories.js +79 -0
  153. package/esm/fieldset/fieldset-content.js +29 -0
  154. package/esm/fieldset/fieldset-context.js +9 -0
  155. package/esm/fieldset/fieldset-footer.js +30 -0
  156. package/esm/fieldset/fieldset-group.js +88 -0
  157. package/esm/fieldset/fieldset-subtitle.js +21 -0
  158. package/esm/fieldset/fieldset-title.js +23 -0
  159. package/esm/fieldset/fieldset.js +96 -0
  160. package/esm/fieldset/index.js +13 -0
  161. package/esm/fieldset/stories.js +72 -0
  162. package/esm/grid/basic-item.js +96 -0
  163. package/esm/grid/grid-container.js +46 -0
  164. package/esm/grid/grid-types.js +6 -0
  165. package/esm/grid/grid.js +37 -0
  166. package/esm/grid/index.js +4 -0
  167. package/esm/grid/stories.js +212 -0
  168. package/esm/icon/stories.js +36 -0
  169. package/esm/image/helpers.js +16 -0
  170. package/esm/image/image-browser-https-icon.js +23 -0
  171. package/esm/image/image-browser.js +86 -0
  172. package/esm/image/image.js +91 -0
  173. package/esm/image/image.skeleton.js +21 -0
  174. package/esm/image/index.js +4 -0
  175. package/esm/image/stories.js +73 -0
  176. package/esm/image/styles.js +15 -0
  177. package/esm/index.js +69 -0
  178. package/esm/input/index.js +6 -0
  179. package/esm/input/input-block-label.js +18 -0
  180. package/esm/input/input-icon-clear.js +47 -0
  181. package/esm/input/input-icon.js +19 -0
  182. package/esm/input/input-label.js +18 -0
  183. package/esm/input/input-props.js +12 -0
  184. package/esm/input/input.js +179 -0
  185. package/esm/input/password-icon.js +30 -0
  186. package/esm/input/password.js +66 -0
  187. package/esm/input/stories.js +113 -0
  188. package/esm/input/styles.js +41 -0
  189. package/esm/keyboard/index.js +2 -0
  190. package/esm/keyboard/keyboard.js +48 -0
  191. package/esm/keyboard/stories.js +43 -0
  192. package/esm/link/icon.js +30 -0
  193. package/esm/link/index.js +2 -0
  194. package/esm/link/link.js +50 -0
  195. package/esm/link/stories.js +59 -0
  196. package/esm/loading/index.js +2 -0
  197. package/esm/loading/loading.js +63 -0
  198. package/esm/loading/stories.js +75 -0
  199. package/esm/mdx-widgets/index.js +2 -0
  200. package/esm/mdx-widgets/mock-page.js +37 -0
  201. package/esm/mdx-widgets/parsed-codes/index.js +1 -0
  202. package/esm/mdx-widgets/parsed-codes/wait-time.js +13 -0
  203. package/esm/modal/index.js +10 -0
  204. package/esm/modal/modal-action.js +76 -0
  205. package/esm/modal/modal-actions.js +39 -0
  206. package/esm/modal/modal-content.js +28 -0
  207. package/esm/modal/modal-context.js +6 -0
  208. package/esm/modal/modal-subtitle.js +30 -0
  209. package/esm/modal/modal-title.js +30 -0
  210. package/esm/modal/modal-wrapper.js +80 -0
  211. package/esm/modal/modal.js +104 -0
  212. package/esm/modal/stories.js +165 -0
  213. package/esm/note/index.js +2 -0
  214. package/esm/note/note.js +71 -0
  215. package/esm/note/stories.js +68 -0
  216. package/esm/page/index.js +9 -0
  217. package/esm/page/page-content.js +26 -0
  218. package/esm/page/page-footer.js +25 -0
  219. package/esm/page/page-header.js +33 -0
  220. package/esm/page/page.js +88 -0
  221. package/esm/page/stories.js +54 -0
  222. package/esm/pagination/index.js +6 -0
  223. package/esm/pagination/pagination-context.js +8 -0
  224. package/esm/pagination/pagination-ellipsis.js +73 -0
  225. package/esm/pagination/pagination-item.js +50 -0
  226. package/esm/pagination/pagination-next.js +25 -0
  227. package/esm/pagination/pagination-pages.js +90 -0
  228. package/esm/pagination/pagination-previous.js +25 -0
  229. package/esm/pagination/pagination.js +105 -0
  230. package/esm/pagination/stories.js +49 -0
  231. package/esm/popover/index.js +5 -0
  232. package/esm/popover/popover-context.js +9 -0
  233. package/esm/popover/popover-item.js +65 -0
  234. package/esm/popover/popover.js +83 -0
  235. package/esm/popover/stories.js +84 -0
  236. package/esm/progress/index.js +2 -0
  237. package/esm/progress/progress.js +76 -0
  238. package/esm/progress/stories.js +114 -0
  239. package/esm/radio/index.js +7 -0
  240. package/esm/radio/radio-context.js +9 -0
  241. package/esm/radio/radio-description.js +30 -0
  242. package/esm/radio/radio-group.js +61 -0
  243. package/esm/radio/radio.js +123 -0
  244. package/esm/radio/stories.js +98 -0
  245. package/esm/radio/styles.js +41 -0
  246. package/esm/rating/index.js +2 -0
  247. package/esm/rating/rating-icon.js +20 -0
  248. package/esm/rating/rating.js +115 -0
  249. package/esm/rating/stories.js +72 -0
  250. package/esm/row/index.js +2 -0
  251. package/esm/row/row.js +60 -0
  252. package/esm/section/index.js +2 -0
  253. package/esm/section/section.js +30 -0
  254. package/esm/select/index.js +4 -0
  255. package/esm/select/select-context.js +9 -0
  256. package/esm/select/select-dropdown.js +41 -0
  257. package/esm/select/select-icon-clear.js +41 -0
  258. package/esm/select/select-icon.js +23 -0
  259. package/esm/select/select-input.js +34 -0
  260. package/esm/select/select-multiple-value.js +23 -0
  261. package/esm/select/select-option.js +100 -0
  262. package/esm/select/select.js +244 -0
  263. package/esm/select/stories.js +239 -0
  264. package/esm/select/styles.js +48 -0
  265. package/esm/shared/backdrop.js +77 -0
  266. package/esm/shared/css-transition.js +71 -0
  267. package/esm/shared/dropdown.js +109 -0
  268. package/esm/shared/ellipsis.js +15 -0
  269. package/esm/shared/expand.js +95 -0
  270. package/esm/shared/highlight.js +47 -0
  271. package/esm/slider/index.js +2 -0
  272. package/esm/slider/slider-dot.js +27 -0
  273. package/esm/slider/slider-mark.js +38 -0
  274. package/esm/slider/slider.js +163 -0
  275. package/esm/slider/stories.js +134 -0
  276. package/esm/slider/styles.js +27 -0
  277. package/esm/snippet/index.js +2 -0
  278. package/esm/snippet/snippet-icon.js +27 -0
  279. package/esm/snippet/snippet.js +100 -0
  280. package/esm/snippet/stories.js +133 -0
  281. package/esm/snippet/styles.js +58 -0
  282. package/esm/spacer/index.js +2 -0
  283. package/esm/spacer/spacer.js +28 -0
  284. package/esm/spacer/stories.js +54 -0
  285. package/esm/spinner/index.js +2 -0
  286. package/esm/spinner/spinner.js +46 -0
  287. package/esm/spinner/stories.js +13 -0
  288. package/esm/styled-jsx-server.es.js +5 -0
  289. package/esm/styled-jsx.es.js +757 -0
  290. package/esm/tabs/index.js +5 -0
  291. package/esm/tabs/stories.js +92 -0
  292. package/esm/tabs/tabs-context.js +8 -0
  293. package/esm/tabs/tabs-item.js +80 -0
  294. package/esm/tabs/tabs.js +151 -0
  295. package/esm/tag/index.js +2 -0
  296. package/esm/tag/stories.js +58 -0
  297. package/esm/tag/tag.js +86 -0
  298. package/esm/text/child.js +78 -0
  299. package/esm/text/index.js +2 -0
  300. package/esm/text/stories.js +104 -0
  301. package/esm/text/text.js +94 -0
  302. package/esm/textarea/index.js +2 -0
  303. package/esm/textarea/stories.js +104 -0
  304. package/esm/textarea/textarea.js +116 -0
  305. package/esm/themes/index.js +2 -0
  306. package/esm/themes/presets/dark.js +67 -0
  307. package/esm/themes/presets/default.js +67 -0
  308. package/esm/themes/presets/index.js +1 -0
  309. package/esm/themes/presets/shared.js +42 -0
  310. package/esm/themes/themes.js +89 -0
  311. package/esm/toggle/index.js +2 -0
  312. package/esm/toggle/stories.js +55 -0
  313. package/esm/toggle/styles.js +27 -0
  314. package/esm/toggle/toggle.js +82 -0
  315. package/esm/tooltip/helper.js +21 -0
  316. package/esm/tooltip/index.js +2 -0
  317. package/esm/tooltip/placement.js +160 -0
  318. package/esm/tooltip/stories.js +183 -0
  319. package/esm/tooltip/styles.js +18 -0
  320. package/esm/tooltip/tooltip-content.js +83 -0
  321. package/esm/tooltip/tooltip-icon.js +32 -0
  322. package/esm/tooltip/tooltip.js +132 -0
  323. package/esm/use-all-themes/all-themes-context.js +9 -0
  324. package/esm/use-all-themes/index.js +2 -0
  325. package/esm/use-body-scroll/index.js +2 -0
  326. package/esm/use-body-scroll/use-body-scroll.js +70 -0
  327. package/esm/use-classes/index.js +2 -0
  328. package/esm/use-classes/use-classes.js +41 -0
  329. package/esm/use-click-away/index.js +2 -0
  330. package/esm/use-click-away/use-click-away.js +22 -0
  331. package/esm/use-clipboard/index.js +2 -0
  332. package/esm/use-clipboard/use-clipboard.js +46 -0
  333. package/esm/use-current-state/index.js +2 -0
  334. package/esm/use-current-state/use-current-state.js +26 -0
  335. package/esm/use-input/index.js +2 -0
  336. package/esm/use-input/use-input.js +32 -0
  337. package/esm/use-keyboard/codes.js +97 -0
  338. package/esm/use-keyboard/helper.js +26 -0
  339. package/esm/use-keyboard/index.js +4 -0
  340. package/esm/use-keyboard/use-keyboard.js +79 -0
  341. package/esm/use-media-query/index.js +2 -0
  342. package/esm/use-media-query/use-media-query.js +90 -0
  343. package/esm/use-modal/index.js +2 -0
  344. package/esm/use-modal/use-modal.js +26 -0
  345. package/esm/use-scale/index.js +6 -0
  346. package/esm/use-scale/scale-context.js +37 -0
  347. package/esm/use-scale/utils.js +62 -0
  348. package/esm/use-scale/with-scale.js +114 -0
  349. package/esm/use-tabs/index.js +2 -0
  350. package/esm/use-tabs/use-tabs.js +24 -0
  351. package/esm/use-theme/index.js +2 -0
  352. package/esm/use-theme/theme-context.js +7 -0
  353. package/esm/use-toasts/helpers.js +72 -0
  354. package/esm/use-toasts/index.js +2 -0
  355. package/esm/use-toasts/toast-container.js +127 -0
  356. package/esm/use-toasts/toast-item.js +48 -0
  357. package/esm/use-toasts/use-toast.js +124 -0
  358. package/esm/utils/calculations.js +27 -0
  359. package/esm/utils/collections.js +138 -0
  360. package/esm/utils/color.js +43 -0
  361. package/esm/utils/layouts.js +82 -0
  362. package/esm/utils/prop-types.js +22 -0
  363. package/esm/utils/types.js +1 -0
  364. package/esm/utils/use-body-scroll.js +2 -0
  365. package/esm/utils/use-bolio-ui-context.js +27 -0
  366. package/esm/utils/use-click-anywhere.js +16 -0
  367. package/esm/utils/use-click-away.js +2 -0
  368. package/esm/utils/use-clipboard.js +2 -0
  369. package/esm/utils/use-context-state/create-bolio-ui-context.js +57 -0
  370. package/esm/utils/use-context-state/use-context-state.js +44 -0
  371. package/esm/utils/use-current-state.js +2 -0
  372. package/esm/utils/use-default-props.js +22 -0
  373. package/esm/utils/use-dom-observer.js +28 -0
  374. package/esm/utils/use-drag.js +75 -0
  375. package/esm/utils/use-portal.js +40 -0
  376. package/esm/utils/use-previous.js +11 -0
  377. package/esm/utils/use-real-shape.js +53 -0
  378. package/esm/utils/use-resize.js +21 -0
  379. package/esm/utils/use-ssr.js +20 -0
  380. package/esm/utils/use-warning.js +17 -0
  381. package/package.json +140 -0
@@ -0,0 +1,1502 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var styledJsx_cjs = require('../styled-jsx.cjs.js');
6
+ var React = require('react');
7
+ var reactDom = require('react-dom');
8
+
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
+
13
+ function ownKeys(object, enumerableOnly) {
14
+ var keys = Object.keys(object);
15
+
16
+ if (Object.getOwnPropertySymbols) {
17
+ var symbols = Object.getOwnPropertySymbols(object);
18
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
19
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
20
+ })), keys.push.apply(keys, symbols);
21
+ }
22
+
23
+ return keys;
24
+ }
25
+
26
+ function _objectSpread2(target) {
27
+ for (var i = 1; i < arguments.length; i++) {
28
+ var source = null != arguments[i] ? arguments[i] : {};
29
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
30
+ _defineProperty(target, key, source[key]);
31
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
32
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
33
+ });
34
+ }
35
+
36
+ return target;
37
+ }
38
+
39
+ function _typeof(obj) {
40
+ "@babel/helpers - typeof";
41
+
42
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
43
+ return typeof obj;
44
+ } : function (obj) {
45
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
46
+ }, _typeof(obj);
47
+ }
48
+
49
+ function _defineProperty(obj, key, value) {
50
+ if (key in obj) {
51
+ Object.defineProperty(obj, key, {
52
+ value: value,
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true
56
+ });
57
+ } else {
58
+ obj[key] = value;
59
+ }
60
+
61
+ return obj;
62
+ }
63
+
64
+ function _extends() {
65
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
66
+ for (var i = 1; i < arguments.length; i++) {
67
+ var source = arguments[i];
68
+
69
+ for (var key in source) {
70
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
71
+ target[key] = source[key];
72
+ }
73
+ }
74
+ }
75
+
76
+ return target;
77
+ };
78
+ return _extends.apply(this, arguments);
79
+ }
80
+
81
+ function _objectWithoutPropertiesLoose(source, excluded) {
82
+ if (source == null) return {};
83
+ var target = {};
84
+ var sourceKeys = Object.keys(source);
85
+ var key, i;
86
+
87
+ for (i = 0; i < sourceKeys.length; i++) {
88
+ key = sourceKeys[i];
89
+ if (excluded.indexOf(key) >= 0) continue;
90
+ target[key] = source[key];
91
+ }
92
+
93
+ return target;
94
+ }
95
+
96
+ function _objectWithoutProperties(source, excluded) {
97
+ if (source == null) return {};
98
+
99
+ var target = _objectWithoutPropertiesLoose(source, excluded);
100
+
101
+ var key, i;
102
+
103
+ if (Object.getOwnPropertySymbols) {
104
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
105
+
106
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
107
+ key = sourceSymbolKeys[i];
108
+ if (excluded.indexOf(key) >= 0) continue;
109
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
110
+ target[key] = source[key];
111
+ }
112
+ }
113
+
114
+ return target;
115
+ }
116
+
117
+ function _slicedToArray(arr, i) {
118
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
119
+ }
120
+
121
+ function _arrayWithHoles(arr) {
122
+ if (Array.isArray(arr)) return arr;
123
+ }
124
+
125
+ function _iterableToArrayLimit(arr, i) {
126
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
127
+
128
+ if (_i == null) return;
129
+ var _arr = [];
130
+ var _n = true;
131
+ var _d = false;
132
+
133
+ var _s, _e;
134
+
135
+ try {
136
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
137
+ _arr.push(_s.value);
138
+
139
+ if (i && _arr.length === i) break;
140
+ }
141
+ } catch (err) {
142
+ _d = true;
143
+ _e = err;
144
+ } finally {
145
+ try {
146
+ if (!_n && _i["return"] != null) _i["return"]();
147
+ } finally {
148
+ if (_d) throw _e;
149
+ }
150
+ }
151
+
152
+ return _arr;
153
+ }
154
+
155
+ function _unsupportedIterableToArray(o, minLen) {
156
+ if (!o) return;
157
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
158
+ var n = Object.prototype.toString.call(o).slice(8, -1);
159
+ if (n === "Object" && o.constructor) n = o.constructor.name;
160
+ if (n === "Map" || n === "Set") return Array.from(o);
161
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
162
+ }
163
+
164
+ function _arrayLikeToArray(arr, len) {
165
+ if (len == null || len > arr.length) len = arr.length;
166
+
167
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
168
+
169
+ return arr2;
170
+ }
171
+
172
+ function _nonIterableRest() {
173
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
174
+ }
175
+
176
+ function _createForOfIteratorHelper(o, allowArrayLike) {
177
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
178
+
179
+ if (!it) {
180
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
181
+ if (it) o = it;
182
+ var i = 0;
183
+
184
+ var F = function () {};
185
+
186
+ return {
187
+ s: F,
188
+ n: function () {
189
+ if (i >= o.length) return {
190
+ done: true
191
+ };
192
+ return {
193
+ done: false,
194
+ value: o[i++]
195
+ };
196
+ },
197
+ e: function (e) {
198
+ throw e;
199
+ },
200
+ f: F
201
+ };
202
+ }
203
+
204
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
205
+ }
206
+
207
+ var normalCompletion = true,
208
+ didErr = false,
209
+ err;
210
+ return {
211
+ s: function () {
212
+ it = it.call(o);
213
+ },
214
+ n: function () {
215
+ var step = it.next();
216
+ normalCompletion = step.done;
217
+ return step;
218
+ },
219
+ e: function (e) {
220
+ didErr = true;
221
+ err = e;
222
+ },
223
+ f: function () {
224
+ try {
225
+ if (!normalCompletion && it.return != null) it.return();
226
+ } finally {
227
+ if (didErr) throw err;
228
+ }
229
+ }
230
+ };
231
+ }
232
+
233
+ var defaultFont = {
234
+ sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
235
+ mono: 'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace',
236
+ prism: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,"Liberation Mono", "Courier New", monospace'
237
+ };
238
+ var defaultBreakpoints = {
239
+ xs: {
240
+ min: '0',
241
+ max: '650px'
242
+ },
243
+ sm: {
244
+ min: '650px',
245
+ max: '900px'
246
+ },
247
+ md: {
248
+ min: '900px',
249
+ max: '1280px'
250
+ },
251
+ lg: {
252
+ min: '1280px',
253
+ max: '1920px'
254
+ },
255
+ xl: {
256
+ min: '1920px',
257
+ max: '10000px'
258
+ }
259
+ };
260
+ var defaultLayout = {
261
+ gap: '16pt',
262
+ gapNegative: '-16pt',
263
+ gapHalf: '8pt',
264
+ gapHalfNegative: '-8pt',
265
+ gapQuarter: '4pt',
266
+ gapQuarterNegative: '-4pt',
267
+ pageMargin: '16pt',
268
+ pageWidth: '900pt',
269
+ pageWidthWithMargin: '930pt',
270
+ breakpointMobile: defaultBreakpoints.xs.max,
271
+ breakpointTablet: defaultBreakpoints.sm.max,
272
+ radius: '6px',
273
+ unit: '16px'
274
+ };
275
+
276
+ var palette$1 = {
277
+ background: '#fff',
278
+ foreground: '#000',
279
+ accents_1: '#fafafa',
280
+ accents_2: '#eaeaea',
281
+ accents_3: '#999',
282
+ accents_4: '#888',
283
+ accents_5: '#666',
284
+ accents_6: '#444',
285
+ accents_7: '#333',
286
+ accents_8: '#111',
287
+ selection: '#cee4fe',
288
+ code: '#C25FFF',
289
+ border: '#eaeaea',
290
+ primary: '#0072F6',
291
+ primaryLight: '#96C1F3',
292
+ primaryLighter: '#CEE4FF',
293
+ primaryDark: '#00254E',
294
+ secondary: '#7828C9',
295
+ secondaryLighter: '#D1B1F1',
296
+ secondaryLight: '#EADCF9',
297
+ secondaryDark: '#290E45',
298
+ error: '#F31261',
299
+ errorLight: '#FAA8C6',
300
+ errorLighter: '#FDD8E6',
301
+ errorDark: '#4E041F',
302
+ success: '#17C965',
303
+ successLight: '#ADF5CD',
304
+ successLighter: '#DAFBE9',
305
+ successDark: '#06371C',
306
+ warning: '#F5A525',
307
+ warningLight: '#FBDBA8',
308
+ warningLighter: '#FDEFD9',
309
+ warningDark: '#4E3105',
310
+ info: '#06B7DC',
311
+ infoLighter: '#A5EEFE',
312
+ infoLight: '#D7F8FF',
313
+ infoDark: '#053B49',
314
+ purple: '#f81ce5',
315
+ alert: '#ff0080',
316
+ link: '#0070f3',
317
+ pre: '#363450'
318
+ };
319
+ var expressiveness$1 = {
320
+ linkStyle: 'none',
321
+ linkHoverStyle: 'none',
322
+ dropdownBoxShadow: '0 4px 4px 0 rgba(0, 0, 0, 0.02)',
323
+ scrollerStart: 'rgba(255, 255, 255, 1)',
324
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
325
+ shadowSmall: '0 5px 10px rgba(0, 0, 0, 0.12)',
326
+ shadowMedium: '0 8px 30px rgba(0, 0, 0, 0.12)',
327
+ shadowLarge: '0 30px 60px rgba(0, 0, 0, 0.12)',
328
+ portalOpacity: 0.25
329
+ };
330
+ var font$1 = defaultFont;
331
+ var breakpoints$1 = defaultBreakpoints;
332
+ var layout$1 = defaultLayout;
333
+ var themes$1 = {
334
+ type: 'light',
335
+ font: font$1,
336
+ layout: layout$1,
337
+ palette: palette$1,
338
+ breakpoints: breakpoints$1,
339
+ expressiveness: expressiveness$1
340
+ };
341
+ var lightTheme = themes$1;
342
+
343
+ var palette = {
344
+ background: '#000',
345
+ foreground: '#fff',
346
+ accents_1: '#111',
347
+ accents_2: '#333',
348
+ accents_3: '#444',
349
+ accents_4: '#666',
350
+ accents_5: '#888',
351
+ accents_6: '#999',
352
+ accents_7: '#eaeaea',
353
+ accents_8: '#fafafa',
354
+ selection: '#f81ce5',
355
+ code: '#C25FFF',
356
+ border: '#333',
357
+ primary: '#0072F6',
358
+ primaryLight: '#96C1F3',
359
+ primaryLighter: '#CEE4FF',
360
+ primaryDark: '#00254E',
361
+ secondary: '#7828C9',
362
+ secondaryLighter: '#D1B1F1',
363
+ secondaryLight: '#EADCF9',
364
+ secondaryDark: '#290E45',
365
+ error: '#F31261',
366
+ errorLight: '#FAA8C6',
367
+ errorLighter: '#FDD8E6',
368
+ errorDark: '#4E041F',
369
+ success: '#17C965',
370
+ successLight: '#ADF5CD',
371
+ successLighter: '#DAFBE9',
372
+ successDark: '#06371C',
373
+ warning: '#F5A525',
374
+ warningLight: '#FBDBA8',
375
+ warningLighter: '#FDEFD9',
376
+ warningDark: '#4E3105',
377
+ info: '#06B7DC',
378
+ infoLighter: '#A5EEFE',
379
+ infoLight: '#D7F8FF',
380
+ infoDark: '#053B49',
381
+ purple: '#f81ce5',
382
+ alert: '#ff0080',
383
+ link: '#3291ff',
384
+ pre: '#363450'
385
+ };
386
+ var expressiveness = {
387
+ linkStyle: 'none',
388
+ linkHoverStyle: 'none',
389
+ dropdownBoxShadow: '0 0 0 1px #333',
390
+ scrollerStart: 'rgba(255, 255, 255, 1)',
391
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
392
+ shadowSmall: '0 0 0 1px #333',
393
+ shadowMedium: '0 0 0 1px #333',
394
+ shadowLarge: '0 0 0 1px #333',
395
+ portalOpacity: 0.75
396
+ };
397
+ var font = defaultFont;
398
+ var breakpoints = defaultBreakpoints;
399
+ var layout = defaultLayout;
400
+ var themes = {
401
+ type: 'dark',
402
+ font: font,
403
+ layout: layout,
404
+ palette: palette,
405
+ breakpoints: breakpoints,
406
+ expressiveness: expressiveness
407
+ };
408
+ var darkTheme = themes;
409
+
410
+ var isObject = function isObject(target) {
411
+ return target && _typeof(target) === 'object';
412
+ };
413
+ var deepDuplicable = function deepDuplicable(source, target) {
414
+ if (!isObject(target) || !isObject(source)) return source;
415
+ var sourceKeys = Object.keys(source);
416
+ var result = {};
417
+
418
+ for (var _i = 0, _sourceKeys = sourceKeys; _i < _sourceKeys.length; _i++) {
419
+ var key = _sourceKeys[_i];
420
+ var sourceValue = source[key];
421
+ var targetValue = target[key];
422
+
423
+ if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
424
+ result[key] = targetValue.concat(sourceValue);
425
+ } else if (isObject(sourceValue) && isObject(targetValue)) {
426
+ result[key] = deepDuplicable(sourceValue, _objectSpread2({}, targetValue));
427
+ } else if (targetValue) {
428
+ result[key] = targetValue;
429
+ } else {
430
+ result[key] = sourceValue;
431
+ }
432
+ }
433
+
434
+ return result;
435
+ };
436
+
437
+ var getPresets = function getPresets() {
438
+ return [lightTheme, darkTheme];
439
+ };
440
+
441
+ var getPresetStaticTheme = function getPresetStaticTheme() {
442
+ return lightTheme;
443
+ };
444
+
445
+ var isAvailableThemeType = function isAvailableThemeType(type) {
446
+ if (!type) return false;
447
+ var presetThemes = getPresets();
448
+ var hasType = presetThemes.find(function (theme) {
449
+ return theme.type === type;
450
+ });
451
+ return !hasType;
452
+ };
453
+
454
+ var isPresetTheme = function isPresetTheme(themeOrType) {
455
+ if (!themeOrType) return false;
456
+ var isType = typeof themeOrType === 'string';
457
+ var type = isType ? themeOrType : themeOrType.type;
458
+ return !isAvailableThemeType(type);
459
+ };
460
+
461
+ var hasUserCustomTheme = function hasUserCustomTheme() {
462
+ var themes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
463
+ return !!themes.find(function (item) {
464
+ return isAvailableThemeType(item.type);
465
+ });
466
+ };
467
+
468
+ var create = function create(base, custom) {
469
+ if (!isAvailableThemeType(custom.type)) {
470
+ throw new Error('Duplicate or unavailable theme type');
471
+ }
472
+
473
+ return deepDuplicable(base, custom);
474
+ };
475
+
476
+ var createFromDark = function createFromDark(custom) {
477
+ return create(darkTheme, custom);
478
+ };
479
+
480
+ var createFromLight = function createFromLight(custom) {
481
+ return create(lightTheme, custom);
482
+ };
483
+
484
+ var Themes = {
485
+ isPresetTheme: isPresetTheme,
486
+ isAvailableThemeType: isAvailableThemeType,
487
+ hasUserCustomTheme: hasUserCustomTheme,
488
+ getPresets: getPresets,
489
+ getPresetStaticTheme: getPresetStaticTheme,
490
+ create: create,
491
+ createFromDark: createFromDark,
492
+ createFromLight: createFromLight
493
+ };
494
+ var Themes$1 = Themes;
495
+
496
+ var defaultTheme = Themes$1.getPresetStaticTheme();
497
+ var ThemeContext = /*#__PURE__*/React__default["default"].createContext(defaultTheme);
498
+ var useTheme$1 = function useTheme() {
499
+ return React__default["default"].useContext(ThemeContext);
500
+ };
501
+
502
+ var useTheme = useTheme$1;
503
+
504
+ var getId = function getId() {
505
+ return Math.random().toString(32).slice(2, 10);
506
+ };
507
+ var getReactNode = function getReactNode(node) {
508
+ if (!node) return null;
509
+ if (typeof node !== 'function') return node;
510
+ return node();
511
+ };
512
+ var isBrowser = function isBrowser() {
513
+ return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
514
+ };
515
+ var isCSSNumberValue = function isCSSNumberValue(value) {
516
+ return value !== undefined && !Number.isNaN(+value);
517
+ };
518
+
519
+ var useSSR = function useSSR() {
520
+ var _useState = React.useState(false),
521
+ _useState2 = _slicedToArray(_useState, 2),
522
+ browser = _useState2[0],
523
+ setBrowser = _useState2[1];
524
+
525
+ React.useEffect(function () {
526
+ setBrowser(isBrowser());
527
+ }, []);
528
+ return {
529
+ isBrowser: browser,
530
+ isServer: !browser
531
+ };
532
+ };
533
+
534
+ var useSSR$1 = useSSR;
535
+
536
+ var createElement = function createElement(id) {
537
+ var el = document.createElement('div');
538
+ el.setAttribute('id', id);
539
+ return el;
540
+ };
541
+
542
+ var usePortal = function usePortal() {
543
+ var selectId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getId();
544
+ var getContainer = arguments.length > 1 ? arguments[1] : undefined;
545
+ var id = "bolio-ui-".concat(selectId);
546
+
547
+ var _useSSR = useSSR$1(),
548
+ isBrowser = _useSSR.isBrowser;
549
+
550
+ var _useState = React.useState(isBrowser ? createElement(id) : null),
551
+ _useState2 = _slicedToArray(_useState, 2),
552
+ elSnapshot = _useState2[0],
553
+ setElSnapshot = _useState2[1];
554
+
555
+ React.useEffect(function () {
556
+ var customContainer = getContainer ? getContainer() : null;
557
+ var parentElement = customContainer || document.body;
558
+ var hasElement = parentElement.querySelector("#".concat(id));
559
+ var el = hasElement || createElement(id);
560
+
561
+ if (!hasElement) {
562
+ parentElement.appendChild(el);
563
+ }
564
+
565
+ setElSnapshot(el);
566
+ }, []);
567
+ return elSnapshot;
568
+ };
569
+
570
+ var usePortal$1 = usePortal;
571
+
572
+ var useResize = function useResize(callback) {
573
+ var immediatelyInvoke = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
574
+ React.useEffect(function () {
575
+ var fn = function fn() {
576
+ return callback();
577
+ };
578
+
579
+ if (immediatelyInvoke) {
580
+ fn();
581
+ }
582
+
583
+ window.addEventListener('resize', fn);
584
+ return function () {
585
+ return window.removeEventListener('resize', fn);
586
+ };
587
+ }, []);
588
+ };
589
+
590
+ var useResize$1 = useResize;
591
+
592
+ var _excluded$4 = ["children", "className", "visible", "enterTime", "leaveTime", "clearTime", "name"];
593
+ var defaultProps = {
594
+ visible: false,
595
+ enterTime: 60,
596
+ leaveTime: 60,
597
+ clearTime: 60,
598
+ className: '',
599
+ name: 'transition'
600
+ };
601
+
602
+ function CssTransition(_ref) {
603
+ var children = _ref.children,
604
+ className = _ref.className,
605
+ visible = _ref.visible,
606
+ enterTime = _ref.enterTime,
607
+ leaveTime = _ref.leaveTime,
608
+ clearTime = _ref.clearTime,
609
+ name = _ref.name,
610
+ props = _objectWithoutProperties(_ref, _excluded$4);
611
+
612
+ var _useState = React.useState(''),
613
+ _useState2 = _slicedToArray(_useState, 2),
614
+ classes = _useState2[0],
615
+ setClasses = _useState2[1];
616
+
617
+ var _useState3 = React.useState(visible),
618
+ _useState4 = _slicedToArray(_useState3, 2),
619
+ renderable = _useState4[0],
620
+ setRenderable = _useState4[1];
621
+
622
+ React.useEffect(function () {
623
+ var statusClassName = visible ? 'enter' : 'leave';
624
+ var time = visible ? enterTime : leaveTime;
625
+
626
+ if (visible && !renderable) {
627
+ setRenderable(true);
628
+ }
629
+
630
+ setClasses("".concat(name, "-").concat(statusClassName)); // set class to active
631
+
632
+ var timer = setTimeout(function () {
633
+ setClasses("".concat(name, "-").concat(statusClassName, " ").concat(name, "-").concat(statusClassName, "-active"));
634
+ clearTimeout(timer);
635
+ }, time); // remove classess when animation over
636
+
637
+ var clearClassesTimer = setTimeout(function () {
638
+ if (!visible) {
639
+ setClasses('');
640
+ setRenderable(false);
641
+ }
642
+
643
+ clearTimeout(clearClassesTimer);
644
+ }, time + clearTime);
645
+ return function () {
646
+ clearTimeout(timer);
647
+ clearTimeout(clearClassesTimer);
648
+ };
649
+ }, [visible, renderable]);
650
+ if (! /*#__PURE__*/React__default["default"].isValidElement(children) || !renderable) return null;
651
+ return /*#__PURE__*/React__default["default"].cloneElement(children, _objectSpread2(_objectSpread2({}, props), {}, {
652
+ className: "".concat(children.props.className, " ").concat(className, " ").concat(classes)
653
+ }));
654
+ }
655
+
656
+ CssTransition.defaultProps = defaultProps;
657
+ CssTransition.displayName = 'BolioUICssTransition';
658
+
659
+ var useClickAnyWhere = function useClickAnyWhere(handler) {
660
+ React.useEffect(function () {
661
+ var callback = function callback(event) {
662
+ return handler(event);
663
+ };
664
+
665
+ document.addEventListener('click', callback);
666
+ return function () {
667
+ return document.removeEventListener('click', callback);
668
+ };
669
+ }, [handler]);
670
+ };
671
+
672
+ var useClickAnyWhere$1 = useClickAnyWhere;
673
+
674
+ var getColors = function getColors(type, palette) {
675
+ var colors = {
676
+ "default": palette.background,
677
+ primary: palette.primary,
678
+ secondary: palette.secondary,
679
+ success: palette.success,
680
+ warning: palette.warning,
681
+ error: palette.error,
682
+ info: palette.info,
683
+ dark: palette.foreground,
684
+ lite: palette.background
685
+ };
686
+ var color = type === 'lite' || type === 'default' ? palette.foreground : palette.background;
687
+ return {
688
+ color: color,
689
+ bgColor: colors[type]
690
+ };
691
+ };
692
+
693
+ var defaultTooltipPosition = {
694
+ top: '-1000px',
695
+ left: '-1000px',
696
+ transform: 'none'
697
+ };
698
+ var getPosition = function getPosition(placement, rect, offset) {
699
+ var positions = {
700
+ top: {
701
+ top: "".concat(rect.top - offset, "px"),
702
+ left: "".concat(rect.left + rect.width / 2, "px"),
703
+ transform: 'translate(-50%, -100%)'
704
+ },
705
+ topStart: {
706
+ top: "".concat(rect.top - offset, "px"),
707
+ left: "".concat(rect.left, "px"),
708
+ transform: 'translate(0, -100%)'
709
+ },
710
+ topEnd: {
711
+ top: "".concat(rect.top - offset, "px"),
712
+ left: "".concat(rect.left + rect.width, "px"),
713
+ transform: 'translate(-100%, -100%)'
714
+ },
715
+ bottom: {
716
+ top: "".concat(rect.bottom + offset, "px"),
717
+ left: "".concat(rect.left + rect.width / 2, "px"),
718
+ transform: 'translate(-50%, 0)'
719
+ },
720
+ bottomStart: {
721
+ top: "".concat(rect.bottom + offset, "px"),
722
+ left: "".concat(rect.left, "px"),
723
+ transform: 'translate(0, 0)'
724
+ },
725
+ bottomEnd: {
726
+ top: "".concat(rect.bottom + offset, "px"),
727
+ left: "".concat(rect.left + rect.width, "px"),
728
+ transform: 'translate(-100%, 0)'
729
+ },
730
+ left: {
731
+ top: "".concat(rect.top + rect.height / 2, "px"),
732
+ left: "".concat(rect.left - offset, "px"),
733
+ transform: 'translate(-100%, -50%)'
734
+ },
735
+ leftStart: {
736
+ top: "".concat(rect.top, "px"),
737
+ left: "".concat(rect.left - offset, "px"),
738
+ transform: 'translate(-100%, 0)'
739
+ },
740
+ leftEnd: {
741
+ top: "".concat(rect.top + rect.height, "px"),
742
+ left: "".concat(rect.left - offset, "px"),
743
+ transform: 'translate(-100%, -100%)'
744
+ },
745
+ right: {
746
+ top: "".concat(rect.top + rect.height / 2, "px"),
747
+ left: "".concat(rect.right + offset, "px"),
748
+ transform: 'translate(0, -50%)'
749
+ },
750
+ rightStart: {
751
+ top: "".concat(rect.top, "px"),
752
+ left: "".concat(rect.right + offset, "px"),
753
+ transform: 'translate(0, 0)'
754
+ },
755
+ rightEnd: {
756
+ top: "".concat(rect.top + rect.height, "px"),
757
+ left: "".concat(rect.right + offset, "px"),
758
+ transform: 'translate(0, -100%)'
759
+ }
760
+ };
761
+ return positions[placement] || positions.top;
762
+ };
763
+ var getIconPosition = function getIconPosition(placement, offsetX, offsetY) {
764
+ var offsetAbsolute = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '3px';
765
+ var positions = {
766
+ top: {
767
+ top: 'auto',
768
+ right: 'auto',
769
+ left: '50%',
770
+ bottom: "".concat(offsetAbsolute),
771
+ transform: 'translate(-50%, 100%) rotate(-90deg)'
772
+ },
773
+ topStart: {
774
+ top: 'auto',
775
+ right: 'auto',
776
+ left: "".concat(offsetX),
777
+ bottom: "".concat(offsetAbsolute),
778
+ transform: 'translate(0, 100%) rotate(-90deg)'
779
+ },
780
+ topEnd: {
781
+ top: 'auto',
782
+ right: "".concat(offsetX),
783
+ left: 'auto',
784
+ bottom: "".concat(offsetAbsolute),
785
+ transform: 'translate(0, 100%) rotate(-90deg)'
786
+ },
787
+ bottom: {
788
+ top: "".concat(offsetAbsolute),
789
+ right: 'auto',
790
+ left: '50%',
791
+ bottom: 'auto',
792
+ transform: 'translate(-50%, -100%) rotate(90deg)'
793
+ },
794
+ bottomStart: {
795
+ top: "".concat(offsetAbsolute),
796
+ right: 'auto',
797
+ left: "".concat(offsetX),
798
+ bottom: 'auto',
799
+ transform: 'translate(0, -100%) rotate(90deg)'
800
+ },
801
+ bottomEnd: {
802
+ top: "".concat(offsetAbsolute),
803
+ right: "".concat(offsetX),
804
+ left: 'auto',
805
+ bottom: 'auto',
806
+ transform: 'translate(0, -100%) rotate(90deg)'
807
+ },
808
+ left: {
809
+ top: '50%',
810
+ right: '0',
811
+ left: 'auto',
812
+ bottom: 'auto',
813
+ transform: 'translate(100%, -50%) rotate(180deg)'
814
+ },
815
+ leftStart: {
816
+ top: "".concat(offsetY),
817
+ right: '0',
818
+ left: 'auto',
819
+ bottom: 'auto',
820
+ transform: 'translate(100%, -50%) rotate(180deg)'
821
+ },
822
+ leftEnd: {
823
+ top: 'auto',
824
+ right: '0',
825
+ left: 'auto',
826
+ bottom: "".concat(offsetY),
827
+ transform: 'translate(100%, 50%) rotate(180deg)'
828
+ },
829
+ right: {
830
+ top: '50%',
831
+ right: 'auto',
832
+ left: '0',
833
+ bottom: 'auto',
834
+ transform: 'translate(-100%, -50%) rotate(0deg)'
835
+ },
836
+ rightStart: {
837
+ top: "".concat(offsetY),
838
+ right: 'auto',
839
+ left: '0',
840
+ bottom: 'auto',
841
+ transform: 'translate(-100%, -50%) rotate(0deg)'
842
+ },
843
+ rightEnd: {
844
+ top: 'auto',
845
+ right: 'auto',
846
+ left: '0',
847
+ bottom: "".concat(offsetY),
848
+ transform: 'translate(-100%, 50%) rotate(0deg)'
849
+ }
850
+ };
851
+ return positions[placement] || positions.top;
852
+ };
853
+
854
+ var TooltipIcon = function TooltipIcon(_ref) {
855
+ var placement = _ref.placement,
856
+ shadow = _ref.shadow;
857
+ var theme = useTheme();
858
+
859
+ var _useMemo = React.useMemo(function () {
860
+ return getIconPosition(placement, 'var(--tooltip-icon-offset-x)', 'var(--tooltip-icon-offset-y)');
861
+ }, [placement]),
862
+ transform = _useMemo.transform,
863
+ top = _useMemo.top,
864
+ left = _useMemo.left,
865
+ right = _useMemo.right,
866
+ bottom = _useMemo.bottom;
867
+
868
+ var bgColorWithDark = React.useMemo(function () {
869
+ if (!shadow || theme.type !== 'dark') return 'var(--tooltip-content-bg)';
870
+ return theme.palette.accents_2;
871
+ }, [shadow, theme.type, theme.palette.accents_2]);
872
+ return /*#__PURE__*/React__default["default"].createElement("span", {
873
+ className: styledJsx_cjs.style.dynamic([["2440507693", [bgColorWithDark, left, top, right, bottom, transform]]])
874
+ }, /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
875
+ id: "2440507693",
876
+ dynamic: [bgColorWithDark, left, top, right, bottom, transform]
877
+ }, "span.__jsx-style-dynamic-selector{width:0;height:0;border-style:solid;border-width:6px 7px 6px 0;border-color:transparent ".concat(bgColorWithDark, " transparent transparent;position:absolute;left:").concat(left, ";top:").concat(top, ";right:").concat(right, ";bottom:").concat(bottom, ";-webkit-transform:").concat(transform, ";-ms-transform:").concat(transform, ";transform:").concat(transform, ";}")));
878
+ };
879
+
880
+ var TooltipIcon$1 = TooltipIcon;
881
+
882
+ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', 'pl', 'pr', 'pt', 'pb', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom', 'ml', 'mr', 'mt', 'mb', 'px', 'py', 'mx', 'my', 'font', 'unit', 'scale'];
883
+
884
+ var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
885
+ return "".concat(scale1x);
886
+ };
887
+
888
+ var defaultContext$1 = {
889
+ getScaleProps: function getScaleProps() {
890
+ return undefined;
891
+ },
892
+ getAllScaleProps: function getAllScaleProps() {
893
+ return {};
894
+ },
895
+ SCALES: {
896
+ pl: defaultDynamicLayoutPipe,
897
+ pr: defaultDynamicLayoutPipe,
898
+ pb: defaultDynamicLayoutPipe,
899
+ pt: defaultDynamicLayoutPipe,
900
+ px: defaultDynamicLayoutPipe,
901
+ py: defaultDynamicLayoutPipe,
902
+ mb: defaultDynamicLayoutPipe,
903
+ ml: defaultDynamicLayoutPipe,
904
+ mr: defaultDynamicLayoutPipe,
905
+ mt: defaultDynamicLayoutPipe,
906
+ mx: defaultDynamicLayoutPipe,
907
+ my: defaultDynamicLayoutPipe,
908
+ width: defaultDynamicLayoutPipe,
909
+ height: defaultDynamicLayoutPipe,
910
+ font: defaultDynamicLayoutPipe
911
+ },
912
+ unit: '16px'
913
+ };
914
+ var ScaleContext = /*#__PURE__*/React__default["default"].createContext(defaultContext$1);
915
+ var useScale$1 = function useScale() {
916
+ return React__default["default"].useContext(ScaleContext);
917
+ };
918
+
919
+ var generateGetScaleProps = function generateGetScaleProps(props) {
920
+ var getScaleProps = function getScaleProps(keyOrKeys) {
921
+ if (!Array.isArray(keyOrKeys)) return props[keyOrKeys];
922
+ var value = undefined;
923
+
924
+ var _iterator = _createForOfIteratorHelper(keyOrKeys),
925
+ _step;
926
+
927
+ try {
928
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
929
+ var key = _step.value;
930
+ var currentValue = props[key];
931
+
932
+ if (typeof currentValue !== 'undefined') {
933
+ value = currentValue;
934
+ }
935
+ }
936
+ } catch (err) {
937
+ _iterator.e(err);
938
+ } finally {
939
+ _iterator.f();
940
+ }
941
+
942
+ return value;
943
+ };
944
+
945
+ return getScaleProps;
946
+ };
947
+ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
948
+ var getAllScaleProps = function getAllScaleProps() {
949
+ var scaleProps = {};
950
+
951
+ var _iterator2 = _createForOfIteratorHelper(ScalePropKeys),
952
+ _step2;
953
+
954
+ try {
955
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
956
+ var key = _step2.value;
957
+ var value = props[key];
958
+
959
+ if (typeof value !== 'undefined') {
960
+ scaleProps[key] = value;
961
+ }
962
+ }
963
+ } catch (err) {
964
+ _iterator2.e(err);
965
+ } finally {
966
+ _iterator2.f();
967
+ }
968
+
969
+ return scaleProps;
970
+ };
971
+
972
+ return getAllScaleProps;
973
+ };
974
+
975
+ var _excluded$3 = ["children"],
976
+ _excluded2 = ["paddingLeft", "pl", "paddingRight", "pr", "paddingTop", "pt", "paddingBottom", "pb", "marginTop", "mt", "marginRight", "mr", "marginBottom", "mb", "marginLeft", "ml", "px", "py", "mx", "my", "width", "height", "font", "w", "h", "margin", "padding", "unit", "scale"];
977
+
978
+ var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
979
+ if (scale === 1) return scale;
980
+ var diff = Math.abs((scale - 1) / 2);
981
+ return scale > 1 ? 1 + diff : 1 - diff;
982
+ }; // eslint-disable-next-line @typescript-eslint/ban-types
983
+
984
+
985
+ var withScale = function withScale(Render) {
986
+ var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
987
+ var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31, _ref32, _ref33;
988
+
989
+ var children = _ref.children,
990
+ props = _objectWithoutProperties(_ref, _excluded$3);
991
+
992
+ var _useTheme = useTheme(),
993
+ layout = _useTheme.layout;
994
+
995
+ var paddingLeft = props.paddingLeft,
996
+ pl = props.pl,
997
+ paddingRight = props.paddingRight,
998
+ pr = props.pr,
999
+ paddingTop = props.paddingTop,
1000
+ pt = props.pt,
1001
+ paddingBottom = props.paddingBottom,
1002
+ pb = props.pb,
1003
+ marginTop = props.marginTop,
1004
+ mt = props.mt,
1005
+ marginRight = props.marginRight,
1006
+ mr = props.mr,
1007
+ marginBottom = props.marginBottom,
1008
+ mb = props.mb,
1009
+ marginLeft = props.marginLeft,
1010
+ ml = props.ml,
1011
+ px = props.px,
1012
+ py = props.py,
1013
+ mx = props.mx,
1014
+ my = props.my,
1015
+ width = props.width,
1016
+ height = props.height,
1017
+ font = props.font,
1018
+ w = props.w,
1019
+ h = props.h,
1020
+ margin = props.margin,
1021
+ padding = props.padding,
1022
+ _props$unit = props.unit,
1023
+ unit = _props$unit === void 0 ? layout.unit : _props$unit,
1024
+ _props$scale = props.scale,
1025
+ scale = _props$scale === void 0 ? 1 : _props$scale,
1026
+ innerProps = _objectWithoutProperties(props, _excluded2);
1027
+
1028
+ var makeScaleHandler = function makeScaleHandler(attrValue) {
1029
+ return function (scale1x, defaultValue) {
1030
+ // 0 means disable scale and the default value is 0
1031
+ if (scale1x === 0) {
1032
+ scale1x = 1;
1033
+ defaultValue = defaultValue || 0;
1034
+ }
1035
+
1036
+ var factor = reduceScaleCoefficient(scale) * scale1x;
1037
+
1038
+ if (typeof attrValue === 'undefined') {
1039
+ if (typeof defaultValue !== 'undefined') return "".concat(defaultValue);
1040
+ return "calc(".concat(factor, " * ").concat(unit, ")");
1041
+ }
1042
+
1043
+ if (!isCSSNumberValue(attrValue)) return "".concat(attrValue);
1044
+ var customFactor = factor * Number(attrValue);
1045
+ return "calc(".concat(customFactor, " * ").concat(unit, ")");
1046
+ };
1047
+ };
1048
+
1049
+ var value = {
1050
+ unit: unit,
1051
+ SCALES: {
1052
+ pt: makeScaleHandler((_ref2 = (_ref3 = paddingTop !== null && paddingTop !== void 0 ? paddingTop : pt) !== null && _ref3 !== void 0 ? _ref3 : py) !== null && _ref2 !== void 0 ? _ref2 : padding),
1053
+ pr: makeScaleHandler((_ref4 = (_ref5 = paddingRight !== null && paddingRight !== void 0 ? paddingRight : pr) !== null && _ref5 !== void 0 ? _ref5 : px) !== null && _ref4 !== void 0 ? _ref4 : padding),
1054
+ pb: makeScaleHandler((_ref6 = (_ref7 = paddingBottom !== null && paddingBottom !== void 0 ? paddingBottom : pb) !== null && _ref7 !== void 0 ? _ref7 : py) !== null && _ref6 !== void 0 ? _ref6 : padding),
1055
+ pl: makeScaleHandler((_ref8 = (_ref9 = paddingLeft !== null && paddingLeft !== void 0 ? paddingLeft : pl) !== null && _ref9 !== void 0 ? _ref9 : px) !== null && _ref8 !== void 0 ? _ref8 : padding),
1056
+ px: makeScaleHandler((_ref10 = (_ref11 = (_ref12 = (_ref13 = px !== null && px !== void 0 ? px : paddingLeft) !== null && _ref13 !== void 0 ? _ref13 : paddingRight) !== null && _ref12 !== void 0 ? _ref12 : pl) !== null && _ref11 !== void 0 ? _ref11 : pr) !== null && _ref10 !== void 0 ? _ref10 : padding),
1057
+ py: makeScaleHandler((_ref14 = (_ref15 = (_ref16 = (_ref17 = py !== null && py !== void 0 ? py : paddingTop) !== null && _ref17 !== void 0 ? _ref17 : paddingBottom) !== null && _ref16 !== void 0 ? _ref16 : pt) !== null && _ref15 !== void 0 ? _ref15 : pb) !== null && _ref14 !== void 0 ? _ref14 : padding),
1058
+ mt: makeScaleHandler((_ref18 = (_ref19 = marginTop !== null && marginTop !== void 0 ? marginTop : mt) !== null && _ref19 !== void 0 ? _ref19 : my) !== null && _ref18 !== void 0 ? _ref18 : margin),
1059
+ mr: makeScaleHandler((_ref20 = (_ref21 = marginRight !== null && marginRight !== void 0 ? marginRight : mr) !== null && _ref21 !== void 0 ? _ref21 : mx) !== null && _ref20 !== void 0 ? _ref20 : margin),
1060
+ mb: makeScaleHandler((_ref22 = (_ref23 = marginBottom !== null && marginBottom !== void 0 ? marginBottom : mb) !== null && _ref23 !== void 0 ? _ref23 : my) !== null && _ref22 !== void 0 ? _ref22 : margin),
1061
+ ml: makeScaleHandler((_ref24 = (_ref25 = marginLeft !== null && marginLeft !== void 0 ? marginLeft : ml) !== null && _ref25 !== void 0 ? _ref25 : mx) !== null && _ref24 !== void 0 ? _ref24 : margin),
1062
+ mx: makeScaleHandler((_ref26 = (_ref27 = (_ref28 = (_ref29 = mx !== null && mx !== void 0 ? mx : marginLeft) !== null && _ref29 !== void 0 ? _ref29 : marginRight) !== null && _ref28 !== void 0 ? _ref28 : ml) !== null && _ref27 !== void 0 ? _ref27 : mr) !== null && _ref26 !== void 0 ? _ref26 : margin),
1063
+ my: makeScaleHandler((_ref30 = (_ref31 = (_ref32 = (_ref33 = my !== null && my !== void 0 ? my : marginTop) !== null && _ref33 !== void 0 ? _ref33 : marginBottom) !== null && _ref32 !== void 0 ? _ref32 : mt) !== null && _ref31 !== void 0 ? _ref31 : mb) !== null && _ref30 !== void 0 ? _ref30 : margin),
1064
+ width: makeScaleHandler(width !== null && width !== void 0 ? width : w),
1065
+ height: makeScaleHandler(height !== null && height !== void 0 ? height : h),
1066
+ font: makeScaleHandler(font)
1067
+ },
1068
+ getScaleProps: generateGetScaleProps(props),
1069
+ getAllScaleProps: generateGetAllScaleProps(props)
1070
+ };
1071
+ return /*#__PURE__*/React__default["default"].createElement(ScaleContext.Provider, {
1072
+ value: value
1073
+ }, /*#__PURE__*/React__default["default"].createElement(Render, _extends({}, innerProps, {
1074
+ ref: ref
1075
+ }), children));
1076
+ });
1077
+ ScaleFC.displayName = "Scale".concat(Render.displayName || 'Wrapper');
1078
+ return ScaleFC;
1079
+ };
1080
+
1081
+ var withScale$1 = withScale;
1082
+
1083
+ var useScale = useScale$1;
1084
+
1085
+ var defaultRect = {
1086
+ top: -1000,
1087
+ left: -1000,
1088
+ right: -1000,
1089
+ bottom: -1000,
1090
+ width: 0,
1091
+ height: 0
1092
+ };
1093
+ var getRect = function getRect(ref) {
1094
+ if (!ref || !ref.current) return defaultRect;
1095
+ var rect = ref.current.getBoundingClientRect();
1096
+ return _objectSpread2(_objectSpread2({}, rect), {}, {
1097
+ width: rect.width || rect.right - rect.left,
1098
+ height: rect.height || rect.bottom - rect.top,
1099
+ top: rect.top + document.documentElement.scrollTop,
1100
+ bottom: rect.bottom + document.documentElement.scrollTop,
1101
+ left: rect.left + document.documentElement.scrollLeft,
1102
+ right: rect.right + document.documentElement.scrollLeft
1103
+ });
1104
+ };
1105
+
1106
+ var classObjectToString = function classObjectToString(className) {
1107
+ var keys = Object.keys(className);
1108
+ var len = keys.length;
1109
+ var str = '';
1110
+
1111
+ for (var index = 0; index < len; index++) {
1112
+ var key = keys[index];
1113
+ var val = className[keys[index]];
1114
+ if (!val) continue;
1115
+ str = str ? "".concat(str, " ").concat(String(key)) : String(key);
1116
+ }
1117
+
1118
+ return str;
1119
+ };
1120
+
1121
+ var isObjectClassName = function isObjectClassName(value) {
1122
+ return _typeof(value) === 'object' && !Array.isArray(value);
1123
+ };
1124
+
1125
+ var useClasses = function useClasses() {
1126
+ var len = arguments.length;
1127
+ var classes = '';
1128
+ if (len === 0) return classes;
1129
+
1130
+ for (var index = 0; index < len; index++) {
1131
+ var val = index < 0 || arguments.length <= index ? undefined : arguments[index];
1132
+ if (!val) continue;
1133
+
1134
+ if (isObjectClassName(val)) {
1135
+ classes += " ".concat(classObjectToString(val));
1136
+ } else {
1137
+ classes += " ".concat(String(val).trim());
1138
+ }
1139
+ }
1140
+
1141
+ return classes.trim();
1142
+ };
1143
+
1144
+ var useClasses$1 = useClasses;
1145
+
1146
+ var TooltipContent = function TooltipContent(_ref) {
1147
+ var children = _ref.children,
1148
+ parent = _ref.parent,
1149
+ visible = _ref.visible,
1150
+ offset = _ref.offset,
1151
+ iconOffset = _ref.iconOffset,
1152
+ placement = _ref.placement,
1153
+ type = _ref.type,
1154
+ className = _ref.className,
1155
+ hideArrow = _ref.hideArrow;
1156
+ var theme = useTheme();
1157
+
1158
+ var _useScale = useScale(),
1159
+ SCALES = _useScale.SCALES;
1160
+
1161
+ var el = usePortal$1('tooltip');
1162
+ var selfRef = React.useRef(null);
1163
+
1164
+ var _useState = React.useState(defaultTooltipPosition),
1165
+ _useState2 = _slicedToArray(_useState, 2),
1166
+ rect = _useState2[0],
1167
+ setRect = _useState2[1];
1168
+
1169
+ var colors = React.useMemo(function () {
1170
+ return getColors(type, theme.palette);
1171
+ }, [type, theme.palette]);
1172
+ var hasShadow = type === 'default';
1173
+ var classes = useClasses$1('tooltip-content', className);
1174
+ if (!parent) return null;
1175
+
1176
+ var updateRect = function updateRect() {
1177
+ var position = getPosition(placement, getRect(parent), offset);
1178
+ setRect(position);
1179
+ };
1180
+
1181
+ useResize$1(updateRect);
1182
+ useClickAnyWhere$1(function () {
1183
+ return updateRect();
1184
+ });
1185
+ React.useEffect(function () {
1186
+ updateRect();
1187
+ }, [visible]);
1188
+
1189
+ var preventHandler = function preventHandler(event) {
1190
+ event.stopPropagation();
1191
+ event.nativeEvent.stopImmediatePropagation();
1192
+ };
1193
+
1194
+ if (!el) return null;
1195
+ return /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default["default"].createElement(CssTransition, {
1196
+ visible: visible
1197
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
1198
+ ref: selfRef,
1199
+ onClick: preventHandler,
1200
+ className: styledJsx_cjs.style.dynamic([["3734161695", [iconOffset.x, iconOffset.y, colors.bgColor, rect.top, rect.left, rect.transform, colors.color, theme.layout.radius, hasShadow ? theme.expressiveness.shadowMedium : 'none', SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.font(1), SCALES.pt(0.65), SCALES.pr(0.9), SCALES.pb(0.65), SCALES.pl(0.9)]]]) + " " + (classes || "")
1201
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
1202
+ className: styledJsx_cjs.style.dynamic([["3734161695", [iconOffset.x, iconOffset.y, colors.bgColor, rect.top, rect.left, rect.transform, colors.color, theme.layout.radius, hasShadow ? theme.expressiveness.shadowMedium : 'none', SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.font(1), SCALES.pt(0.65), SCALES.pr(0.9), SCALES.pb(0.65), SCALES.pl(0.9)]]]) + " " + "inner"
1203
+ }, !hideArrow && /*#__PURE__*/React__default["default"].createElement(TooltipIcon$1, {
1204
+ placement: placement,
1205
+ shadow: hasShadow
1206
+ }), children), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1207
+ id: "3734161695",
1208
+ dynamic: [iconOffset.x, iconOffset.y, colors.bgColor, rect.top, rect.left, rect.transform, colors.color, theme.layout.radius, hasShadow ? theme.expressiveness.shadowMedium : 'none', SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.font(1), SCALES.pt(0.65), SCALES.pr(0.9), SCALES.pb(0.65), SCALES.pl(0.9)]
1209
+ }, ".tooltip-content.__jsx-style-dynamic-selector{--tooltip-icon-offset-x:".concat(iconOffset.x, ";--tooltip-icon-offset-y:").concat(iconOffset.y, ";--tooltip-content-bg:").concat(colors.bgColor, ";box-sizing:border-box;position:absolute;top:").concat(rect.top, ";left:").concat(rect.left, ";-webkit-transform:").concat(rect.transform, ";-ms-transform:").concat(rect.transform, ";transform:").concat(rect.transform, ";background-color:var(--tooltip-content-bg);color:").concat(colors.color, ";border-radius:").concat(theme.layout.radius, ";padding:0;z-index:1000;box-shadow:").concat(hasShadow ? theme.expressiveness.shadowMedium : 'none', ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";}.inner.__jsx-style-dynamic-selector{box-sizing:border-box;position:relative;font-size:").concat(SCALES.font(1), ";padding:").concat(SCALES.pt(0.65), " ").concat(SCALES.pr(0.9), " ").concat(SCALES.pb(0.65), " ").concat(SCALES.pl(0.9), ";height:100%;}")))), el);
1210
+ };
1211
+
1212
+ var TooltipContent$1 = TooltipContent;
1213
+
1214
+ var useClickAway = function useClickAway(ref, handler) {
1215
+ var handlerRef = React.useRef(handler);
1216
+ React.useEffect(function () {
1217
+ handlerRef.current = handler;
1218
+ }, [handler]);
1219
+ React.useEffect(function () {
1220
+ var callback = function callback(event) {
1221
+ var el = ref.current;
1222
+ if (!event || !el || el.contains(event.target)) return;
1223
+ handlerRef.current(event);
1224
+ };
1225
+
1226
+ document.addEventListener('click', callback);
1227
+ return function () {
1228
+ return document.removeEventListener('click', callback);
1229
+ };
1230
+ }, [ref]);
1231
+ };
1232
+
1233
+ var useClickAway$1 = useClickAway;
1234
+
1235
+ var _excluded$2 = ["children", "initialVisible", "text", "offset", "placement", "portalClassName", "enterDelay", "leaveDelay", "trigger", "type", "className", "onVisibleChange", "hideArrow", "visible"];
1236
+
1237
+ function TooltipComponent(_ref) {
1238
+ var children = _ref.children,
1239
+ _ref$initialVisible = _ref.initialVisible,
1240
+ initialVisible = _ref$initialVisible === void 0 ? false : _ref$initialVisible,
1241
+ _ref$text = _ref.text,
1242
+ text = _ref$text === void 0 ? '' : _ref$text,
1243
+ _ref$offset = _ref.offset,
1244
+ offset = _ref$offset === void 0 ? 12 : _ref$offset,
1245
+ _ref$placement = _ref.placement,
1246
+ placement = _ref$placement === void 0 ? 'top' : _ref$placement,
1247
+ _ref$portalClassName = _ref.portalClassName,
1248
+ portalClassName = _ref$portalClassName === void 0 ? '' : _ref$portalClassName,
1249
+ _ref$enterDelay = _ref.enterDelay,
1250
+ enterDelay = _ref$enterDelay === void 0 ? 100 : _ref$enterDelay,
1251
+ _ref$leaveDelay = _ref.leaveDelay,
1252
+ leaveDelay = _ref$leaveDelay === void 0 ? 150 : _ref$leaveDelay,
1253
+ _ref$trigger = _ref.trigger,
1254
+ trigger = _ref$trigger === void 0 ? 'hover' : _ref$trigger,
1255
+ _ref$type = _ref.type,
1256
+ type = _ref$type === void 0 ? 'default' : _ref$type,
1257
+ _ref$className = _ref.className,
1258
+ className = _ref$className === void 0 ? '' : _ref$className,
1259
+ _ref$onVisibleChange = _ref.onVisibleChange,
1260
+ onVisibleChange = _ref$onVisibleChange === void 0 ? function () {} : _ref$onVisibleChange,
1261
+ _ref$hideArrow = _ref.hideArrow,
1262
+ hideArrow = _ref$hideArrow === void 0 ? false : _ref$hideArrow,
1263
+ customVisible = _ref.visible,
1264
+ props = _objectWithoutProperties(_ref, _excluded$2);
1265
+
1266
+ var timer = React.useRef();
1267
+ var ref = React.useRef(null);
1268
+
1269
+ var _useState = React.useState(initialVisible),
1270
+ _useState2 = _slicedToArray(_useState, 2),
1271
+ visible = _useState2[0],
1272
+ setVisible = _useState2[1];
1273
+
1274
+ var iconOffset = React.useMemo(function () {
1275
+ if (!(ref !== null && ref !== void 0 && ref.current)) return {
1276
+ x: '0.75em',
1277
+ y: '0.75em'
1278
+ };
1279
+ var rect = getRect(ref);
1280
+ return {
1281
+ x: "".concat(rect.width ? rect.width / 2 : 0, "px"),
1282
+ y: "".concat(rect.height ? rect.height / 2 : 0, "px")
1283
+ };
1284
+ }, [ref === null || ref === void 0 ? void 0 : ref.current]);
1285
+ var contentProps = {
1286
+ type: type,
1287
+ visible: visible,
1288
+ offset: offset,
1289
+ placement: placement,
1290
+ hideArrow: hideArrow,
1291
+ iconOffset: iconOffset,
1292
+ parent: ref,
1293
+ className: portalClassName
1294
+ };
1295
+
1296
+ var changeVisible = function changeVisible(nextState) {
1297
+ var clear = function clear() {
1298
+ clearTimeout(timer.current);
1299
+ timer.current = undefined;
1300
+ };
1301
+
1302
+ var handler = function handler(nextState) {
1303
+ setVisible(nextState);
1304
+ onVisibleChange(nextState);
1305
+ clear();
1306
+ };
1307
+
1308
+ clear();
1309
+
1310
+ if (nextState) {
1311
+ timer.current = window.setTimeout(function () {
1312
+ return handler(true);
1313
+ }, enterDelay);
1314
+ return;
1315
+ }
1316
+
1317
+ var leaveDelayWithoutClick = trigger === 'click' ? 0 : leaveDelay;
1318
+ timer.current = window.setTimeout(function () {
1319
+ return handler(false);
1320
+ }, leaveDelayWithoutClick);
1321
+ };
1322
+
1323
+ var mouseEventHandler = function mouseEventHandler(next) {
1324
+ return trigger === 'hover' && changeVisible(next);
1325
+ };
1326
+
1327
+ var clickEventHandler = function clickEventHandler() {
1328
+ return trigger === 'click' && changeVisible(!visible);
1329
+ };
1330
+
1331
+ useClickAway$1(ref, function () {
1332
+ return trigger === 'click' && changeVisible(false);
1333
+ });
1334
+ React.useEffect(function () {
1335
+ if (customVisible === undefined) return;
1336
+ changeVisible(customVisible);
1337
+ }, [customVisible]);
1338
+ return /*#__PURE__*/React__default["default"].createElement("div", _extends({
1339
+ ref: ref,
1340
+ onClick: clickEventHandler,
1341
+ onMouseEnter: function onMouseEnter() {
1342
+ return mouseEventHandler(true);
1343
+ },
1344
+ onMouseLeave: function onMouseLeave() {
1345
+ return mouseEventHandler(false);
1346
+ }
1347
+ }, props, {
1348
+ className: "jsx-418573366" + " " + (props && props.className != null && props.className || useClasses$1('tooltip', className) || "")
1349
+ }), children, /*#__PURE__*/React__default["default"].createElement(TooltipContent$1, contentProps, text), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1350
+ id: "418573366"
1351
+ }, ".tooltip.jsx-418573366{width:-webkit-max-content;width:-moz-max-content;width:max-content;display:inline-block;}"));
1352
+ }
1353
+
1354
+ TooltipComponent.displayName = 'BolioUITooltip';
1355
+ var Tooltip = withScale$1(TooltipComponent);
1356
+ var Tooltip$1 = Tooltip;
1357
+
1358
+ var defaultContext = {
1359
+ disableItemsAutoClose: false,
1360
+ onItemClick: function onItemClick() {}
1361
+ };
1362
+ var PopoverContext = /*#__PURE__*/React__default["default"].createContext(defaultContext);
1363
+ var usePopoverContext = function usePopoverContext() {
1364
+ return React.useContext(PopoverContext);
1365
+ };
1366
+
1367
+ var _excluded$1 = ["content", "children", "disableItemsAutoClose", "trigger", "placement", "portalClassName", "type", "visible", "onVisibleChange"];
1368
+
1369
+ function PopoverComponent(_ref) {
1370
+ var content = _ref.content,
1371
+ children = _ref.children,
1372
+ _ref$disableItemsAuto = _ref.disableItemsAutoClose,
1373
+ disableItemsAutoClose = _ref$disableItemsAuto === void 0 ? false : _ref$disableItemsAuto,
1374
+ _ref$trigger = _ref.trigger,
1375
+ trigger = _ref$trigger === void 0 ? 'click' : _ref$trigger,
1376
+ _ref$placement = _ref.placement,
1377
+ placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,
1378
+ _ref$portalClassName = _ref.portalClassName,
1379
+ portalClassName = _ref$portalClassName === void 0 ? '' : _ref$portalClassName,
1380
+ _ref$type = _ref.type,
1381
+ type = _ref$type === void 0 ? 'default' : _ref$type,
1382
+ customVisible = _ref.visible,
1383
+ _ref$onVisibleChange = _ref.onVisibleChange,
1384
+ onVisibleChange = _ref$onVisibleChange === void 0 ? function () {} : _ref$onVisibleChange,
1385
+ props = _objectWithoutProperties(_ref, _excluded$1);
1386
+
1387
+ var _useScale = useScale(),
1388
+ SCALES = _useScale.SCALES;
1389
+
1390
+ var _useState = React.useState(false),
1391
+ _useState2 = _slicedToArray(_useState, 2),
1392
+ visible = _useState2[0],
1393
+ setVisible = _useState2[1];
1394
+
1395
+ var textNode = React.useMemo(function () {
1396
+ return getReactNode(content);
1397
+ }, [content]);
1398
+
1399
+ var onChildClick = function onChildClick() {
1400
+ onPopoverVisibleChange(false);
1401
+ };
1402
+
1403
+ var value = React.useMemo(function () {
1404
+ return {
1405
+ onItemClick: onChildClick,
1406
+ disableItemsAutoClose: disableItemsAutoClose
1407
+ };
1408
+ }, [disableItemsAutoClose]);
1409
+ var classes = useClasses$1('popover', portalClassName);
1410
+
1411
+ var onPopoverVisibleChange = function onPopoverVisibleChange(next) {
1412
+ setVisible(next);
1413
+ onVisibleChange(next);
1414
+ };
1415
+
1416
+ React.useEffect(function () {
1417
+ if (customVisible === undefined) return;
1418
+ onPopoverVisibleChange(customVisible);
1419
+ }, [customVisible]);
1420
+ return /*#__PURE__*/React__default["default"].createElement(PopoverContext.Provider, {
1421
+ value: value
1422
+ }, /*#__PURE__*/React__default["default"].createElement(Tooltip$1, _extends({
1423
+ initialVisible: false,
1424
+ text: textNode,
1425
+ trigger: trigger,
1426
+ placement: placement,
1427
+ portalClassName: classes,
1428
+ visible: visible,
1429
+ type: type,
1430
+ onVisibleChange: onPopoverVisibleChange
1431
+ }, props), children, /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1432
+ id: "421785314",
1433
+ dynamic: [SCALES.pt(0.9), SCALES.pr(0), SCALES.pb(0.9), SCALES.pl(0)]
1434
+ }, ".tooltip-content.popover > .inner{padding:".concat(SCALES.pt(0.9), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0.9), " ").concat(SCALES.pl(0), ";}"))));
1435
+ }
1436
+
1437
+ PopoverComponent.displayName = 'BolioUIPopover';
1438
+ var Popover = withScale$1(PopoverComponent);
1439
+ var Popover$1 = Popover;
1440
+
1441
+ var _excluded = ["children", "line", "title", "className", "onClick", "disableAutoClose"];
1442
+
1443
+ function PopoverItemComponent(_ref) {
1444
+ var children = _ref.children,
1445
+ _ref$line = _ref.line,
1446
+ line = _ref$line === void 0 ? false : _ref$line,
1447
+ _ref$title = _ref.title,
1448
+ title = _ref$title === void 0 ? false : _ref$title,
1449
+ _ref$className = _ref.className,
1450
+ className = _ref$className === void 0 ? '' : _ref$className,
1451
+ onClick = _ref.onClick,
1452
+ _ref$disableAutoClose = _ref.disableAutoClose,
1453
+ disableAutoClose = _ref$disableAutoClose === void 0 ? false : _ref$disableAutoClose,
1454
+ props = _objectWithoutProperties(_ref, _excluded);
1455
+
1456
+ var theme = useTheme();
1457
+
1458
+ var _useScale = useScale(),
1459
+ SCALES = _useScale.SCALES;
1460
+
1461
+ var _usePopoverContext = usePopoverContext(),
1462
+ disableItemsAutoClose = _usePopoverContext.disableItemsAutoClose,
1463
+ onItemClick = _usePopoverContext.onItemClick;
1464
+
1465
+ var hasHandler = Boolean(onClick);
1466
+ var dontCloseByClick = disableAutoClose || disableItemsAutoClose || title || line;
1467
+ var classes = useClasses$1('item', {
1468
+ line: line,
1469
+ title: title
1470
+ }, className);
1471
+
1472
+ var clickHandler = function clickHandler(event) {
1473
+ onClick && onClick(event);
1474
+
1475
+ if (dontCloseByClick) {
1476
+ return event.stopPropagation();
1477
+ }
1478
+
1479
+ onItemClick(event);
1480
+ };
1481
+
1482
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", _extends({
1483
+ onClick: clickHandler
1484
+ }, props, {
1485
+ className: styledJsx_cjs.style.dynamic([["2829879905", [theme.palette.accents_5, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]]]) + " " + (props && props.className != null && props.className || classes || "")
1486
+ }), children, /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1487
+ id: "2829879905",
1488
+ dynamic: [theme.palette.accents_5, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]
1489
+ }, ".item.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;box-sizing:border-box;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:".concat(theme.palette.accents_5, ";-webkit-transition:color,background-color 150ms linear;transition:color,background-color 150ms linear;line-height:1.25em;font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";padding:").concat(SCALES.pt(0.5), " ").concat(SCALES.pr(0.75), " ").concat(SCALES.pb(0.5), " ").concat(SCALES.pl(0.75), ";cursor:").concat(hasHandler ? 'pointer' : 'default', ";}.item.__jsx-style-dynamic-selector:hover{color:").concat(theme.palette.foreground, ";}.item.line.__jsx-style-dynamic-selector{line-height:0;padding:0;background-color:").concat(theme.palette.border, ";height:").concat(SCALES.height(0.0625), ";margin:").concat(SCALES.mt(0.35), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0.35), " ").concat(SCALES.ml(0), ";width:").concat(SCALES.width(1, '100%'), ";}.item.title.__jsx-style-dynamic-selector{font-weight:500;font-size:").concat(SCALES.font(0.925), ";color:").concat(theme.palette.foreground, ";}"))), title && /*#__PURE__*/React__default["default"].createElement(PopoverItem, {
1490
+ line: true,
1491
+ title: false
1492
+ }));
1493
+ }
1494
+
1495
+ PopoverItemComponent.displayName = 'BolioUIPopoverItem';
1496
+ var PopoverItem = withScale$1(PopoverItemComponent);
1497
+ var PopoverItem$1 = PopoverItem;
1498
+
1499
+ Popover$1.Item = PopoverItem$1;
1500
+ Popover$1.Option = PopoverItem$1;
1501
+
1502
+ exports["default"] = Popover$1;