@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,2220 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var reactDom = require('react-dom');
7
+ var styledJsx_cjs = require('../styled-jsx.cjs.js');
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 getId = function getId() {
234
+ return Math.random().toString(32).slice(2, 10);
235
+ };
236
+ var pickChild = function pickChild(children, targetChild) {
237
+ var target = [];
238
+ var withoutTargetChildren = React__default["default"].Children.map(children, function (item) {
239
+ if (! /*#__PURE__*/React__default["default"].isValidElement(item)) return item;
240
+
241
+ if (item.type === targetChild) {
242
+ target.push(item);
243
+ return null;
244
+ }
245
+
246
+ return item;
247
+ });
248
+ var targetChildren = target.length >= 0 ? target : undefined;
249
+ return [withoutTargetChildren, targetChildren];
250
+ };
251
+ var isChildElement = function isChildElement(parent, child) {
252
+ if (!parent || !child) return false;
253
+ var node = child;
254
+
255
+ while (node) {
256
+ if (node === parent) return true;
257
+ node = node.parentNode;
258
+ }
259
+
260
+ return false;
261
+ };
262
+ var isBrowser = function isBrowser() {
263
+ return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
264
+ };
265
+ var isMac = function isMac() {
266
+ if (!isBrowser()) return false;
267
+ return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
268
+ };
269
+ var isCSSNumberValue = function isCSSNumberValue(value) {
270
+ return value !== undefined && !Number.isNaN(+value);
271
+ };
272
+
273
+ var useSSR = function useSSR() {
274
+ var _useState = React.useState(false),
275
+ _useState2 = _slicedToArray(_useState, 2),
276
+ browser = _useState2[0],
277
+ setBrowser = _useState2[1];
278
+
279
+ React.useEffect(function () {
280
+ setBrowser(isBrowser());
281
+ }, []);
282
+ return {
283
+ isBrowser: browser,
284
+ isServer: !browser
285
+ };
286
+ };
287
+
288
+ var useSSR$1 = useSSR;
289
+
290
+ var createElement = function createElement(id) {
291
+ var el = document.createElement('div');
292
+ el.setAttribute('id', id);
293
+ return el;
294
+ };
295
+
296
+ var usePortal = function usePortal() {
297
+ var selectId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getId();
298
+ var getContainer = arguments.length > 1 ? arguments[1] : undefined;
299
+ var id = "bolio-ui-".concat(selectId);
300
+
301
+ var _useSSR = useSSR$1(),
302
+ isBrowser = _useSSR.isBrowser;
303
+
304
+ var _useState = React.useState(isBrowser ? createElement(id) : null),
305
+ _useState2 = _slicedToArray(_useState, 2),
306
+ elSnapshot = _useState2[0],
307
+ setElSnapshot = _useState2[1];
308
+
309
+ React.useEffect(function () {
310
+ var customContainer = getContainer ? getContainer() : null;
311
+ var parentElement = customContainer || document.body;
312
+ var hasElement = parentElement.querySelector("#".concat(id));
313
+ var el = hasElement || createElement(id);
314
+
315
+ if (!hasElement) {
316
+ parentElement.appendChild(el);
317
+ }
318
+
319
+ setElSnapshot(el);
320
+ }, []);
321
+ return elSnapshot;
322
+ };
323
+
324
+ var usePortal$1 = usePortal;
325
+
326
+ var defaultFont = {
327
+ sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
328
+ mono: 'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace',
329
+ prism: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,"Liberation Mono", "Courier New", monospace'
330
+ };
331
+ var defaultBreakpoints = {
332
+ xs: {
333
+ min: '0',
334
+ max: '650px'
335
+ },
336
+ sm: {
337
+ min: '650px',
338
+ max: '900px'
339
+ },
340
+ md: {
341
+ min: '900px',
342
+ max: '1280px'
343
+ },
344
+ lg: {
345
+ min: '1280px',
346
+ max: '1920px'
347
+ },
348
+ xl: {
349
+ min: '1920px',
350
+ max: '10000px'
351
+ }
352
+ };
353
+ var defaultLayout = {
354
+ gap: '16pt',
355
+ gapNegative: '-16pt',
356
+ gapHalf: '8pt',
357
+ gapHalfNegative: '-8pt',
358
+ gapQuarter: '4pt',
359
+ gapQuarterNegative: '-4pt',
360
+ pageMargin: '16pt',
361
+ pageWidth: '900pt',
362
+ pageWidthWithMargin: '930pt',
363
+ breakpointMobile: defaultBreakpoints.xs.max,
364
+ breakpointTablet: defaultBreakpoints.sm.max,
365
+ radius: '6px',
366
+ unit: '16px'
367
+ };
368
+
369
+ var palette$1 = {
370
+ background: '#fff',
371
+ foreground: '#000',
372
+ accents_1: '#fafafa',
373
+ accents_2: '#eaeaea',
374
+ accents_3: '#999',
375
+ accents_4: '#888',
376
+ accents_5: '#666',
377
+ accents_6: '#444',
378
+ accents_7: '#333',
379
+ accents_8: '#111',
380
+ selection: '#cee4fe',
381
+ code: '#C25FFF',
382
+ border: '#eaeaea',
383
+ primary: '#0072F6',
384
+ primaryLight: '#96C1F3',
385
+ primaryLighter: '#CEE4FF',
386
+ primaryDark: '#00254E',
387
+ secondary: '#7828C9',
388
+ secondaryLighter: '#D1B1F1',
389
+ secondaryLight: '#EADCF9',
390
+ secondaryDark: '#290E45',
391
+ error: '#F31261',
392
+ errorLight: '#FAA8C6',
393
+ errorLighter: '#FDD8E6',
394
+ errorDark: '#4E041F',
395
+ success: '#17C965',
396
+ successLight: '#ADF5CD',
397
+ successLighter: '#DAFBE9',
398
+ successDark: '#06371C',
399
+ warning: '#F5A525',
400
+ warningLight: '#FBDBA8',
401
+ warningLighter: '#FDEFD9',
402
+ warningDark: '#4E3105',
403
+ info: '#06B7DC',
404
+ infoLighter: '#A5EEFE',
405
+ infoLight: '#D7F8FF',
406
+ infoDark: '#053B49',
407
+ purple: '#f81ce5',
408
+ alert: '#ff0080',
409
+ link: '#0070f3',
410
+ pre: '#363450'
411
+ };
412
+ var expressiveness$1 = {
413
+ linkStyle: 'none',
414
+ linkHoverStyle: 'none',
415
+ dropdownBoxShadow: '0 4px 4px 0 rgba(0, 0, 0, 0.02)',
416
+ scrollerStart: 'rgba(255, 255, 255, 1)',
417
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
418
+ shadowSmall: '0 5px 10px rgba(0, 0, 0, 0.12)',
419
+ shadowMedium: '0 8px 30px rgba(0, 0, 0, 0.12)',
420
+ shadowLarge: '0 30px 60px rgba(0, 0, 0, 0.12)',
421
+ portalOpacity: 0.25
422
+ };
423
+ var font$1 = defaultFont;
424
+ var breakpoints$1 = defaultBreakpoints;
425
+ var layout$1 = defaultLayout;
426
+ var themes$1 = {
427
+ type: 'light',
428
+ font: font$1,
429
+ layout: layout$1,
430
+ palette: palette$1,
431
+ breakpoints: breakpoints$1,
432
+ expressiveness: expressiveness$1
433
+ };
434
+ var lightTheme = themes$1;
435
+
436
+ var palette = {
437
+ background: '#000',
438
+ foreground: '#fff',
439
+ accents_1: '#111',
440
+ accents_2: '#333',
441
+ accents_3: '#444',
442
+ accents_4: '#666',
443
+ accents_5: '#888',
444
+ accents_6: '#999',
445
+ accents_7: '#eaeaea',
446
+ accents_8: '#fafafa',
447
+ selection: '#f81ce5',
448
+ code: '#C25FFF',
449
+ border: '#333',
450
+ primary: '#0072F6',
451
+ primaryLight: '#96C1F3',
452
+ primaryLighter: '#CEE4FF',
453
+ primaryDark: '#00254E',
454
+ secondary: '#7828C9',
455
+ secondaryLighter: '#D1B1F1',
456
+ secondaryLight: '#EADCF9',
457
+ secondaryDark: '#290E45',
458
+ error: '#F31261',
459
+ errorLight: '#FAA8C6',
460
+ errorLighter: '#FDD8E6',
461
+ errorDark: '#4E041F',
462
+ success: '#17C965',
463
+ successLight: '#ADF5CD',
464
+ successLighter: '#DAFBE9',
465
+ successDark: '#06371C',
466
+ warning: '#F5A525',
467
+ warningLight: '#FBDBA8',
468
+ warningLighter: '#FDEFD9',
469
+ warningDark: '#4E3105',
470
+ info: '#06B7DC',
471
+ infoLighter: '#A5EEFE',
472
+ infoLight: '#D7F8FF',
473
+ infoDark: '#053B49',
474
+ purple: '#f81ce5',
475
+ alert: '#ff0080',
476
+ link: '#3291ff',
477
+ pre: '#363450'
478
+ };
479
+ var expressiveness = {
480
+ linkStyle: 'none',
481
+ linkHoverStyle: 'none',
482
+ dropdownBoxShadow: '0 0 0 1px #333',
483
+ scrollerStart: 'rgba(255, 255, 255, 1)',
484
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
485
+ shadowSmall: '0 0 0 1px #333',
486
+ shadowMedium: '0 0 0 1px #333',
487
+ shadowLarge: '0 0 0 1px #333',
488
+ portalOpacity: 0.75
489
+ };
490
+ var font = defaultFont;
491
+ var breakpoints = defaultBreakpoints;
492
+ var layout = defaultLayout;
493
+ var themes = {
494
+ type: 'dark',
495
+ font: font,
496
+ layout: layout,
497
+ palette: palette,
498
+ breakpoints: breakpoints,
499
+ expressiveness: expressiveness
500
+ };
501
+ var darkTheme = themes;
502
+
503
+ var isObject = function isObject(target) {
504
+ return target && _typeof(target) === 'object';
505
+ };
506
+ var deepDuplicable = function deepDuplicable(source, target) {
507
+ if (!isObject(target) || !isObject(source)) return source;
508
+ var sourceKeys = Object.keys(source);
509
+ var result = {};
510
+
511
+ for (var _i = 0, _sourceKeys = sourceKeys; _i < _sourceKeys.length; _i++) {
512
+ var key = _sourceKeys[_i];
513
+ var sourceValue = source[key];
514
+ var targetValue = target[key];
515
+
516
+ if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
517
+ result[key] = targetValue.concat(sourceValue);
518
+ } else if (isObject(sourceValue) && isObject(targetValue)) {
519
+ result[key] = deepDuplicable(sourceValue, _objectSpread2({}, targetValue));
520
+ } else if (targetValue) {
521
+ result[key] = targetValue;
522
+ } else {
523
+ result[key] = sourceValue;
524
+ }
525
+ }
526
+
527
+ return result;
528
+ };
529
+
530
+ var getPresets = function getPresets() {
531
+ return [lightTheme, darkTheme];
532
+ };
533
+
534
+ var getPresetStaticTheme = function getPresetStaticTheme() {
535
+ return lightTheme;
536
+ };
537
+
538
+ var isAvailableThemeType = function isAvailableThemeType(type) {
539
+ if (!type) return false;
540
+ var presetThemes = getPresets();
541
+ var hasType = presetThemes.find(function (theme) {
542
+ return theme.type === type;
543
+ });
544
+ return !hasType;
545
+ };
546
+
547
+ var isPresetTheme = function isPresetTheme(themeOrType) {
548
+ if (!themeOrType) return false;
549
+ var isType = typeof themeOrType === 'string';
550
+ var type = isType ? themeOrType : themeOrType.type;
551
+ return !isAvailableThemeType(type);
552
+ };
553
+
554
+ var hasUserCustomTheme = function hasUserCustomTheme() {
555
+ var themes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
556
+ return !!themes.find(function (item) {
557
+ return isAvailableThemeType(item.type);
558
+ });
559
+ };
560
+
561
+ var create = function create(base, custom) {
562
+ if (!isAvailableThemeType(custom.type)) {
563
+ throw new Error('Duplicate or unavailable theme type');
564
+ }
565
+
566
+ return deepDuplicable(base, custom);
567
+ };
568
+
569
+ var createFromDark = function createFromDark(custom) {
570
+ return create(darkTheme, custom);
571
+ };
572
+
573
+ var createFromLight = function createFromLight(custom) {
574
+ return create(lightTheme, custom);
575
+ };
576
+
577
+ var Themes = {
578
+ isPresetTheme: isPresetTheme,
579
+ isAvailableThemeType: isAvailableThemeType,
580
+ hasUserCustomTheme: hasUserCustomTheme,
581
+ getPresets: getPresets,
582
+ getPresetStaticTheme: getPresetStaticTheme,
583
+ create: create,
584
+ createFromDark: createFromDark,
585
+ createFromLight: createFromLight
586
+ };
587
+ var Themes$1 = Themes;
588
+
589
+ var defaultTheme = Themes$1.getPresetStaticTheme();
590
+ var ThemeContext = /*#__PURE__*/React__default["default"].createContext(defaultTheme);
591
+ var useTheme$1 = function useTheme() {
592
+ return React__default["default"].useContext(ThemeContext);
593
+ };
594
+
595
+ var useTheme = useTheme$1;
596
+
597
+ var _excluded$b = ["children", "className", "visible", "enterTime", "leaveTime", "clearTime", "name"];
598
+ var defaultProps$3 = {
599
+ visible: false,
600
+ enterTime: 60,
601
+ leaveTime: 60,
602
+ clearTime: 60,
603
+ className: '',
604
+ name: 'transition'
605
+ };
606
+
607
+ function CssTransition(_ref) {
608
+ var children = _ref.children,
609
+ className = _ref.className,
610
+ visible = _ref.visible,
611
+ enterTime = _ref.enterTime,
612
+ leaveTime = _ref.leaveTime,
613
+ clearTime = _ref.clearTime,
614
+ name = _ref.name,
615
+ props = _objectWithoutProperties(_ref, _excluded$b);
616
+
617
+ var _useState = React.useState(''),
618
+ _useState2 = _slicedToArray(_useState, 2),
619
+ classes = _useState2[0],
620
+ setClasses = _useState2[1];
621
+
622
+ var _useState3 = React.useState(visible),
623
+ _useState4 = _slicedToArray(_useState3, 2),
624
+ renderable = _useState4[0],
625
+ setRenderable = _useState4[1];
626
+
627
+ React.useEffect(function () {
628
+ var statusClassName = visible ? 'enter' : 'leave';
629
+ var time = visible ? enterTime : leaveTime;
630
+
631
+ if (visible && !renderable) {
632
+ setRenderable(true);
633
+ }
634
+
635
+ setClasses("".concat(name, "-").concat(statusClassName)); // set class to active
636
+
637
+ var timer = setTimeout(function () {
638
+ setClasses("".concat(name, "-").concat(statusClassName, " ").concat(name, "-").concat(statusClassName, "-active"));
639
+ clearTimeout(timer);
640
+ }, time); // remove classess when animation over
641
+
642
+ var clearClassesTimer = setTimeout(function () {
643
+ if (!visible) {
644
+ setClasses('');
645
+ setRenderable(false);
646
+ }
647
+
648
+ clearTimeout(clearClassesTimer);
649
+ }, time + clearTime);
650
+ return function () {
651
+ clearTimeout(timer);
652
+ clearTimeout(clearClassesTimer);
653
+ };
654
+ }, [visible, renderable]);
655
+ if (! /*#__PURE__*/React__default["default"].isValidElement(children) || !renderable) return null;
656
+ return /*#__PURE__*/React__default["default"].cloneElement(children, _objectSpread2(_objectSpread2({}, props), {}, {
657
+ className: "".concat(children.props.className, " ").concat(className, " ").concat(classes)
658
+ }));
659
+ }
660
+
661
+ CssTransition.defaultProps = defaultProps$3;
662
+ CssTransition.displayName = 'BolioUICssTransition';
663
+
664
+ 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'];
665
+
666
+ var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
667
+ return "".concat(scale1x);
668
+ };
669
+
670
+ var defaultContext$2 = {
671
+ getScaleProps: function getScaleProps() {
672
+ return undefined;
673
+ },
674
+ getAllScaleProps: function getAllScaleProps() {
675
+ return {};
676
+ },
677
+ SCALES: {
678
+ pl: defaultDynamicLayoutPipe,
679
+ pr: defaultDynamicLayoutPipe,
680
+ pb: defaultDynamicLayoutPipe,
681
+ pt: defaultDynamicLayoutPipe,
682
+ px: defaultDynamicLayoutPipe,
683
+ py: defaultDynamicLayoutPipe,
684
+ mb: defaultDynamicLayoutPipe,
685
+ ml: defaultDynamicLayoutPipe,
686
+ mr: defaultDynamicLayoutPipe,
687
+ mt: defaultDynamicLayoutPipe,
688
+ mx: defaultDynamicLayoutPipe,
689
+ my: defaultDynamicLayoutPipe,
690
+ width: defaultDynamicLayoutPipe,
691
+ height: defaultDynamicLayoutPipe,
692
+ font: defaultDynamicLayoutPipe
693
+ },
694
+ unit: '16px'
695
+ };
696
+ var ScaleContext = /*#__PURE__*/React__default["default"].createContext(defaultContext$2);
697
+ var useScale$1 = function useScale() {
698
+ return React__default["default"].useContext(ScaleContext);
699
+ };
700
+
701
+ var generateGetScaleProps = function generateGetScaleProps(props) {
702
+ var getScaleProps = function getScaleProps(keyOrKeys) {
703
+ if (!Array.isArray(keyOrKeys)) return props[keyOrKeys];
704
+ var value = undefined;
705
+
706
+ var _iterator = _createForOfIteratorHelper(keyOrKeys),
707
+ _step;
708
+
709
+ try {
710
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
711
+ var key = _step.value;
712
+ var currentValue = props[key];
713
+
714
+ if (typeof currentValue !== 'undefined') {
715
+ value = currentValue;
716
+ }
717
+ }
718
+ } catch (err) {
719
+ _iterator.e(err);
720
+ } finally {
721
+ _iterator.f();
722
+ }
723
+
724
+ return value;
725
+ };
726
+
727
+ return getScaleProps;
728
+ };
729
+ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
730
+ var getAllScaleProps = function getAllScaleProps() {
731
+ var scaleProps = {};
732
+
733
+ var _iterator2 = _createForOfIteratorHelper(ScalePropKeys),
734
+ _step2;
735
+
736
+ try {
737
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
738
+ var key = _step2.value;
739
+ var value = props[key];
740
+
741
+ if (typeof value !== 'undefined') {
742
+ scaleProps[key] = value;
743
+ }
744
+ }
745
+ } catch (err) {
746
+ _iterator2.e(err);
747
+ } finally {
748
+ _iterator2.f();
749
+ }
750
+
751
+ return scaleProps;
752
+ };
753
+
754
+ return getAllScaleProps;
755
+ };
756
+
757
+ var _excluded$a = ["children"],
758
+ _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"];
759
+
760
+ var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
761
+ if (scale === 1) return scale;
762
+ var diff = Math.abs((scale - 1) / 2);
763
+ return scale > 1 ? 1 + diff : 1 - diff;
764
+ }; // eslint-disable-next-line @typescript-eslint/ban-types
765
+
766
+
767
+ var withScale = function withScale(Render) {
768
+ var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
769
+ 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;
770
+
771
+ var children = _ref.children,
772
+ props = _objectWithoutProperties(_ref, _excluded$a);
773
+
774
+ var _useTheme = useTheme(),
775
+ layout = _useTheme.layout;
776
+
777
+ var paddingLeft = props.paddingLeft,
778
+ pl = props.pl,
779
+ paddingRight = props.paddingRight,
780
+ pr = props.pr,
781
+ paddingTop = props.paddingTop,
782
+ pt = props.pt,
783
+ paddingBottom = props.paddingBottom,
784
+ pb = props.pb,
785
+ marginTop = props.marginTop,
786
+ mt = props.mt,
787
+ marginRight = props.marginRight,
788
+ mr = props.mr,
789
+ marginBottom = props.marginBottom,
790
+ mb = props.mb,
791
+ marginLeft = props.marginLeft,
792
+ ml = props.ml,
793
+ px = props.px,
794
+ py = props.py,
795
+ mx = props.mx,
796
+ my = props.my,
797
+ width = props.width,
798
+ height = props.height,
799
+ font = props.font,
800
+ w = props.w,
801
+ h = props.h,
802
+ margin = props.margin,
803
+ padding = props.padding,
804
+ _props$unit = props.unit,
805
+ unit = _props$unit === void 0 ? layout.unit : _props$unit,
806
+ _props$scale = props.scale,
807
+ scale = _props$scale === void 0 ? 1 : _props$scale,
808
+ innerProps = _objectWithoutProperties(props, _excluded2);
809
+
810
+ var makeScaleHandler = function makeScaleHandler(attrValue) {
811
+ return function (scale1x, defaultValue) {
812
+ // 0 means disable scale and the default value is 0
813
+ if (scale1x === 0) {
814
+ scale1x = 1;
815
+ defaultValue = defaultValue || 0;
816
+ }
817
+
818
+ var factor = reduceScaleCoefficient(scale) * scale1x;
819
+
820
+ if (typeof attrValue === 'undefined') {
821
+ if (typeof defaultValue !== 'undefined') return "".concat(defaultValue);
822
+ return "calc(".concat(factor, " * ").concat(unit, ")");
823
+ }
824
+
825
+ if (!isCSSNumberValue(attrValue)) return "".concat(attrValue);
826
+ var customFactor = factor * Number(attrValue);
827
+ return "calc(".concat(customFactor, " * ").concat(unit, ")");
828
+ };
829
+ };
830
+
831
+ var value = {
832
+ unit: unit,
833
+ SCALES: {
834
+ pt: makeScaleHandler((_ref2 = (_ref3 = paddingTop !== null && paddingTop !== void 0 ? paddingTop : pt) !== null && _ref3 !== void 0 ? _ref3 : py) !== null && _ref2 !== void 0 ? _ref2 : padding),
835
+ pr: makeScaleHandler((_ref4 = (_ref5 = paddingRight !== null && paddingRight !== void 0 ? paddingRight : pr) !== null && _ref5 !== void 0 ? _ref5 : px) !== null && _ref4 !== void 0 ? _ref4 : padding),
836
+ pb: makeScaleHandler((_ref6 = (_ref7 = paddingBottom !== null && paddingBottom !== void 0 ? paddingBottom : pb) !== null && _ref7 !== void 0 ? _ref7 : py) !== null && _ref6 !== void 0 ? _ref6 : padding),
837
+ pl: makeScaleHandler((_ref8 = (_ref9 = paddingLeft !== null && paddingLeft !== void 0 ? paddingLeft : pl) !== null && _ref9 !== void 0 ? _ref9 : px) !== null && _ref8 !== void 0 ? _ref8 : padding),
838
+ 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),
839
+ 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),
840
+ mt: makeScaleHandler((_ref18 = (_ref19 = marginTop !== null && marginTop !== void 0 ? marginTop : mt) !== null && _ref19 !== void 0 ? _ref19 : my) !== null && _ref18 !== void 0 ? _ref18 : margin),
841
+ mr: makeScaleHandler((_ref20 = (_ref21 = marginRight !== null && marginRight !== void 0 ? marginRight : mr) !== null && _ref21 !== void 0 ? _ref21 : mx) !== null && _ref20 !== void 0 ? _ref20 : margin),
842
+ mb: makeScaleHandler((_ref22 = (_ref23 = marginBottom !== null && marginBottom !== void 0 ? marginBottom : mb) !== null && _ref23 !== void 0 ? _ref23 : my) !== null && _ref22 !== void 0 ? _ref22 : margin),
843
+ ml: makeScaleHandler((_ref24 = (_ref25 = marginLeft !== null && marginLeft !== void 0 ? marginLeft : ml) !== null && _ref25 !== void 0 ? _ref25 : mx) !== null && _ref24 !== void 0 ? _ref24 : margin),
844
+ 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),
845
+ 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),
846
+ width: makeScaleHandler(width !== null && width !== void 0 ? width : w),
847
+ height: makeScaleHandler(height !== null && height !== void 0 ? height : h),
848
+ font: makeScaleHandler(font)
849
+ },
850
+ getScaleProps: generateGetScaleProps(props),
851
+ getAllScaleProps: generateGetAllScaleProps(props)
852
+ };
853
+ return /*#__PURE__*/React__default["default"].createElement(ScaleContext.Provider, {
854
+ value: value
855
+ }, /*#__PURE__*/React__default["default"].createElement(Render, _extends({}, innerProps, {
856
+ ref: ref
857
+ }), children));
858
+ });
859
+ ScaleFC.displayName = "Scale".concat(Render.displayName || 'Wrapper');
860
+ return ScaleFC;
861
+ };
862
+
863
+ var withScale$1 = withScale;
864
+
865
+ var useScale = useScale$1;
866
+
867
+ var classObjectToString = function classObjectToString(className) {
868
+ var keys = Object.keys(className);
869
+ var len = keys.length;
870
+ var str = '';
871
+
872
+ for (var index = 0; index < len; index++) {
873
+ var key = keys[index];
874
+ var val = className[keys[index]];
875
+ if (!val) continue;
876
+ str = str ? "".concat(str, " ").concat(String(key)) : String(key);
877
+ }
878
+
879
+ return str;
880
+ };
881
+
882
+ var isObjectClassName = function isObjectClassName(value) {
883
+ return _typeof(value) === 'object' && !Array.isArray(value);
884
+ };
885
+
886
+ var useClasses = function useClasses() {
887
+ var len = arguments.length;
888
+ var classes = '';
889
+ if (len === 0) return classes;
890
+
891
+ for (var index = 0; index < len; index++) {
892
+ var val = index < 0 || arguments.length <= index ? undefined : arguments[index];
893
+ if (!val) continue;
894
+
895
+ if (isObjectClassName(val)) {
896
+ classes += " ".concat(classObjectToString(val));
897
+ } else {
898
+ classes += " ".concat(String(val).trim());
899
+ }
900
+ }
901
+
902
+ return classes.trim();
903
+ };
904
+
905
+ var useClasses$1 = useClasses;
906
+
907
+ var _excluded$9 = ["className", "children", "visible"];
908
+
909
+ function ModalWrapper(_ref) {
910
+ var _ref$className = _ref.className,
911
+ className = _ref$className === void 0 ? '' : _ref$className,
912
+ children = _ref.children,
913
+ _ref$visible = _ref.visible,
914
+ visible = _ref$visible === void 0 ? false : _ref$visible,
915
+ props = _objectWithoutProperties(_ref, _excluded$9);
916
+
917
+ var theme = useTheme();
918
+
919
+ var _useScale = useScale(),
920
+ SCALES = _useScale.SCALES;
921
+
922
+ var modalContent = React.useRef(null);
923
+ var tabStart = React.useRef(null);
924
+ var tabEnd = React.useRef(null);
925
+ React.useEffect(function () {
926
+ if (!visible) return;
927
+ var activeElement = document.activeElement;
928
+ var isChild = isChildElement(modalContent.current, activeElement);
929
+ if (isChild) return;
930
+ tabStart.current && tabStart.current.focus();
931
+ }, [visible]);
932
+
933
+ var onKeyDown = function onKeyDown(event) {
934
+ var isTabDown = event.keyCode === 9;
935
+ if (!visible || !isTabDown) return;
936
+ var activeElement = document.activeElement;
937
+
938
+ if (event.shiftKey) {
939
+ if (activeElement === tabStart.current) {
940
+ tabEnd.current && tabEnd.current.focus();
941
+ }
942
+ } else {
943
+ if (activeElement === tabEnd.current) {
944
+ tabStart.current && tabStart.current.focus();
945
+ }
946
+ }
947
+ };
948
+
949
+ return /*#__PURE__*/React__default["default"].createElement(CssTransition, {
950
+ name: "wrapper",
951
+ visible: visible,
952
+ clearTime: 300
953
+ }, /*#__PURE__*/React__default["default"].createElement("div", _extends({
954
+ role: "dialog",
955
+ tabIndex: -1,
956
+ onKeyDown: onKeyDown,
957
+ ref: modalContent
958
+ }, props, {
959
+ className: styledJsx_cjs.style.dynamic([["212284330", [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, SCALES.font(1), SCALES.height(1, 'auto'), SCALES.pl(1.3125), SCALES.pr(1.3125), SCALES.pt(1.3125), SCALES.pb(1.3125), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || useClasses$1('wrapper', className) || "")
960
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
961
+ tabIndex: 0,
962
+ "aria-hidden": "true",
963
+ ref: tabStart,
964
+ className: styledJsx_cjs.style.dynamic([["212284330", [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, SCALES.font(1), SCALES.height(1, 'auto'), SCALES.pl(1.3125), SCALES.pr(1.3125), SCALES.pt(1.3125), SCALES.pb(1.3125), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + "hide-tab"
965
+ }), children, /*#__PURE__*/React__default["default"].createElement("div", {
966
+ tabIndex: 0,
967
+ "aria-hidden": "true",
968
+ ref: tabEnd,
969
+ className: styledJsx_cjs.style.dynamic([["212284330", [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, SCALES.font(1), SCALES.height(1, 'auto'), SCALES.pl(1.3125), SCALES.pr(1.3125), SCALES.pt(1.3125), SCALES.pb(1.3125), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + "hide-tab"
970
+ }), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
971
+ id: "212284330",
972
+ dynamic: [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, SCALES.font(1), SCALES.height(1, 'auto'), SCALES.pl(1.3125), SCALES.pr(1.3125), SCALES.pt(1.3125), SCALES.pb(1.3125), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
973
+ }, ".wrapper.__jsx-style-dynamic-selector{max-width:100%;vertical-align:middle;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:relative;box-sizing:border-box;background-color:".concat(theme.palette.background, ";color:").concat(theme.palette.foreground, ";border-radius:").concat(theme.layout.radius, ";box-shadow:").concat(theme.expressiveness.shadowLarge, ";opacity:0;outline:none;-webkit-transform:translate3d(0px,-30px,0px);-ms-transform:translate3d(0px,-30px,0px);transform:translate3d(0px,-30px,0px);-webkit-transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1) 0s, -webkit-transform 0.35s cubic-bezier(0.4,0,0.2,1) 0s;-webkit-transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1) 0s, transform 0.35s cubic-bezier(0.4,0,0.2,1) 0s;transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1) 0s, transform 0.35s cubic-bezier(0.4,0,0.2,1) 0s;width:100%;font-size:").concat(SCALES.font(1), ";height:").concat(SCALES.height(1, 'auto'), ";--modal-wrapper-padding-left:").concat(SCALES.pl(1.3125), ";--modal-wrapper-padding-right:").concat(SCALES.pr(1.3125), ";padding:").concat(SCALES.pt(1.3125), " var(--modal-wrapper-padding-right) ").concat(SCALES.pb(1.3125), " var(--modal-wrapper-padding-left);margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.wrapper-enter.__jsx-style-dynamic-selector{opacity:0;-webkit-transform:translate3d(0px,-30px,0px);-ms-transform:translate3d(0px,-30px,0px);transform:translate3d(0px,-30px,0px);}.wrapper-enter-active.__jsx-style-dynamic-selector{opacity:1;-webkit-transform:translate3d(0px,0px,0px);-ms-transform:translate3d(0px,0px,0px);transform:translate3d(0px,0px,0px);}.wrapper-leave.__jsx-style-dynamic-selector{opacity:1;-webkit-transform:translate3d(0px,0px,0px);-ms-transform:translate3d(0px,0px,0px);transform:translate3d(0px,0px,0px);}.wrapper-leave-active.__jsx-style-dynamic-selector{opacity:0;-webkit-transform:translate3d(0px,-30px,0px);-ms-transform:translate3d(0px,-30px,0px);transform:translate3d(0px,-30px,0px);}.hide-tab.__jsx-style-dynamic-selector{outline:none;overflow:hidden;width:0;height:0;opacity:0;}"))));
974
+ }
975
+
976
+ ModalWrapper.displayName = 'BolioUIModalWrapper';
977
+
978
+ var defaultContext$1 = {};
979
+ var ModalContext = /*#__PURE__*/React__default["default"].createContext(defaultContext$1);
980
+ var useModalContext = function useModalContext() {
981
+ return React__default["default"].useContext(ModalContext);
982
+ };
983
+
984
+ var defaultProps$2 = {
985
+ x: 0,
986
+ y: 0
987
+ };
988
+
989
+ var ButtonDrip = function ButtonDrip(_ref) {
990
+ var x = _ref.x,
991
+ y = _ref.y,
992
+ color = _ref.color,
993
+ onCompleted = _ref.onCompleted;
994
+ var dripRef = React.useRef(null);
995
+ var top = Number.isNaN(+y) ? 0 : y - 10;
996
+ var left = Number.isNaN(+x) ? 0 : x - 10;
997
+ React.useEffect(function () {
998
+ if (!dripRef.current) return;
999
+ dripRef.current.addEventListener('animationend', onCompleted);
1000
+ return function () {
1001
+ if (!dripRef.current) return;
1002
+ dripRef.current.removeEventListener('animationend', onCompleted);
1003
+ };
1004
+ });
1005
+ return /*#__PURE__*/React__default["default"].createElement("div", {
1006
+ ref: dripRef,
1007
+ className: "jsx-3424889537" + " " + "drip"
1008
+ }, /*#__PURE__*/React__default["default"].createElement("svg", {
1009
+ width: "20",
1010
+ height: "20",
1011
+ viewBox: "0 0 20 20",
1012
+ style: {
1013
+ top: top,
1014
+ left: left
1015
+ },
1016
+ className: "jsx-3424889537"
1017
+ }, /*#__PURE__*/React__default["default"].createElement("g", {
1018
+ stroke: "none",
1019
+ strokeWidth: "1",
1020
+ fill: "none",
1021
+ fillRule: "evenodd",
1022
+ className: "jsx-3424889537"
1023
+ }, /*#__PURE__*/React__default["default"].createElement("g", {
1024
+ fill: color,
1025
+ className: "jsx-3424889537"
1026
+ }, /*#__PURE__*/React__default["default"].createElement("rect", {
1027
+ width: "100%",
1028
+ height: "100%",
1029
+ rx: "10",
1030
+ className: "jsx-3424889537"
1031
+ })))), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1032
+ id: "3424889537"
1033
+ }, ".drip.jsx-3424889537{position:absolute;left:0;right:0;top:0;bottom:0;}svg.jsx-3424889537{position:absolute;-webkit-animation:350ms ease-in expand-jsx-3424889537;animation:350ms ease-in expand-jsx-3424889537;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;width:1rem;height:1rem;}@-webkit-keyframes expand-jsx-3424889537{0%{opacity:0;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}30%{opacity:1;}80%{opacity:0.5;}100%{-webkit-transform:scale(28);-ms-transform:scale(28);transform:scale(28);opacity:0;}}@keyframes expand-jsx-3424889537{0%{opacity:0;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}30%{opacity:1;}80%{opacity:0.5;}100%{-webkit-transform:scale(28);-ms-transform:scale(28);transform:scale(28);opacity:0;}}"));
1034
+ };
1035
+
1036
+ ButtonDrip.defaultProps = defaultProps$2;
1037
+ ButtonDrip.displayName = 'BolioUItButtonDrip';
1038
+ var ButtonDrip$1 = ButtonDrip;
1039
+
1040
+ var _excluded$8 = ["children", "type", "color", "className", "spaceRatio"];
1041
+
1042
+ var getIconBgColor = function getIconBgColor(type, palette, color) {
1043
+ var colors = {
1044
+ "default": palette.accents_6,
1045
+ primary: palette.primary,
1046
+ secondary: palette.secondary,
1047
+ success: palette.success,
1048
+ warning: palette.warning,
1049
+ error: palette.error,
1050
+ info: palette.info
1051
+ };
1052
+ return color ? color : colors[type];
1053
+ };
1054
+
1055
+ function LoadingComponent(_ref) {
1056
+ var children = _ref.children,
1057
+ _ref$type = _ref.type,
1058
+ type = _ref$type === void 0 ? 'default' : _ref$type,
1059
+ color = _ref.color,
1060
+ _ref$className = _ref.className,
1061
+ className = _ref$className === void 0 ? '' : _ref$className,
1062
+ _ref$spaceRatio = _ref.spaceRatio,
1063
+ spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
1064
+ props = _objectWithoutProperties(_ref, _excluded$8);
1065
+
1066
+ var theme = useTheme();
1067
+
1068
+ var _useScale = useScale(),
1069
+ SCALES = _useScale.SCALES;
1070
+
1071
+ var classes = useClasses$1('loading-container', className);
1072
+ var bgColor = React.useMemo(function () {
1073
+ return getIconBgColor(type, theme.palette, color);
1074
+ }, [type, theme.palette, color]);
1075
+ return /*#__PURE__*/React__default["default"].createElement("div", _extends({}, props, {
1076
+ className: styledJsx_cjs.style.dynamic([["3790031813", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme.palette.accents_5, bgColor, spaceRatio]]]) + " " + (props && props.className != null && props.className || classes || "")
1077
+ }), /*#__PURE__*/React__default["default"].createElement("span", {
1078
+ className: styledJsx_cjs.style.dynamic([["3790031813", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme.palette.accents_5, bgColor, spaceRatio]]]) + " " + "loading"
1079
+ }, children && /*#__PURE__*/React__default["default"].createElement("label", {
1080
+ className: styledJsx_cjs.style.dynamic([["3790031813", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme.palette.accents_5, bgColor, spaceRatio]]])
1081
+ }, children), /*#__PURE__*/React__default["default"].createElement("i", {
1082
+ className: styledJsx_cjs.style.dynamic([["3790031813", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme.palette.accents_5, bgColor, spaceRatio]]])
1083
+ }), /*#__PURE__*/React__default["default"].createElement("i", {
1084
+ className: styledJsx_cjs.style.dynamic([["3790031813", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme.palette.accents_5, bgColor, spaceRatio]]])
1085
+ }), /*#__PURE__*/React__default["default"].createElement("i", {
1086
+ className: styledJsx_cjs.style.dynamic([["3790031813", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme.palette.accents_5, bgColor, spaceRatio]]])
1087
+ })), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1088
+ id: "3790031813",
1089
+ dynamic: [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, '100%'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme.palette.accents_5, bgColor, spaceRatio]
1090
+ }, ".loading-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:relative;font-size:".concat(SCALES.font(1), ";width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, '100%'), ";min-height:1em;padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}label.__jsx-style-dynamic-selector{margin-right:0.5em;color:").concat(theme.palette.accents_5, ";line-height:1;}label.__jsx-style-dynamic-selector *{margin:0;}.loading.__jsx-style-dynamic-selector{position:absolute;top:50%;left:50%;width:100%;height:100%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}i.__jsx-style-dynamic-selector{width:0.25em;height:0.25em;border-radius:50%;background-color:").concat(bgColor, ";margin:0 calc(0.25em / 2 * ").concat(spaceRatio, ");display:inline-block;-webkit-animation:loading-blink-__jsx-style-dynamic-selector 1.4s infinite both;animation:loading-blink-__jsx-style-dynamic-selector 1.4s infinite both;}i.__jsx-style-dynamic-selector:nth-child(2){-webkit-animation-delay:0.2s;animation-delay:0.2s;}i.__jsx-style-dynamic-selector:nth-child(3){-webkit-animation-delay:0.4s;animation-delay:0.4s;}@-webkit-keyframes loading-blink-__jsx-style-dynamic-selector{0%{opacity:0.2;}20%{opacity:1;}100%{opacity:0.2;}}@keyframes loading-blink-__jsx-style-dynamic-selector{0%{opacity:0.2;}20%{opacity:1;}100%{opacity:0.2;}}")));
1091
+ }
1092
+
1093
+ LoadingComponent.displayName = 'BolioUILoading';
1094
+ var Loading = withScale$1(LoadingComponent);
1095
+ var Loading$1 = Loading;
1096
+
1097
+ function ButtonLoading(_ref) {
1098
+ var color = _ref.color;
1099
+ return /*#__PURE__*/React__default["default"].createElement("div", {
1100
+ className: "jsx-412966635" + " " + "btn-loading"
1101
+ }, /*#__PURE__*/React__default["default"].createElement(Loading$1, {
1102
+ color: color
1103
+ }), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1104
+ id: "412966635"
1105
+ }, ".btn-loading.jsx-412966635{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;background-color:var(--bolio-ui-button-bg);}"));
1106
+ }
1107
+
1108
+ ButtonLoading.displayName = 'BolioUIButtonLoading';
1109
+
1110
+ var _excluded$7 = ["isRight", "isSingle", "children", "className"];
1111
+
1112
+ function ButtonIcon(_ref) {
1113
+ var _ref$isRight = _ref.isRight,
1114
+ isRight = _ref$isRight === void 0 ? false : _ref$isRight,
1115
+ isSingle = _ref.isSingle,
1116
+ children = _ref.children,
1117
+ _ref$className = _ref.className,
1118
+ className = _ref$className === void 0 ? '' : _ref$className,
1119
+ props = _objectWithoutProperties(_ref, _excluded$7);
1120
+
1121
+ var classes = useClasses$1('icon', {
1122
+ right: isRight,
1123
+ single: isSingle
1124
+ }, className);
1125
+ return /*#__PURE__*/React__default["default"].createElement("span", _extends({}, props, {
1126
+ className: "jsx-2499243154" + " " + (props && props.className != null && props.className || classes || "")
1127
+ }), children, /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1128
+ id: "2499243154"
1129
+ }, ".icon.jsx-2499243154{position:absolute;left:var(--bolio-ui-button-icon-padding);right:auto;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--bolio-ui-button-color);z-index:1;}.right.jsx-2499243154{right:var(--bolio-ui-button-icon-padding);left:auto;}.icon.jsx-2499243154 svg{background:transparent;height:calc(var(--bolio-ui-button-height) / 2.35);width:calc(var(--bolio-ui-button-height) / 2.35);}.single.jsx-2499243154{position:static;-webkit-transform:none;-ms-transform:none;transform:none;}"));
1130
+ }
1131
+
1132
+ ButtonIcon.displayName = 'BolioUIButtonIcon';
1133
+
1134
+ var getButtonChildrenWithIcon = function getButtonChildrenWithIcon() {
1135
+ var auto = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1136
+ var children = arguments.length > 1 ? arguments[1] : undefined;
1137
+ var icons = arguments.length > 2 ? arguments[2] : undefined;
1138
+ var icon = icons.icon,
1139
+ iconRight = icons.iconRight;
1140
+ var hasIcon = icon || iconRight;
1141
+ var isRight = Boolean(iconRight);
1142
+ var paddingForAutoMode = auto ? "calc(var(--bolio-ui-button-height) / 2 + var(--bolio-ui-button-icon-padding) * .5)" : 0; // eslint-disable-next-line react-hooks/rules-of-hooks
1143
+
1144
+ var classes = useClasses$1('text', isRight ? 'right' : 'left');
1145
+ if (!hasIcon) return /*#__PURE__*/React__default["default"].createElement("div", {
1146
+ className: "text"
1147
+ }, children);
1148
+
1149
+ if (React__default["default"].Children.count(children) === 0) {
1150
+ return /*#__PURE__*/React__default["default"].createElement(ButtonIcon, {
1151
+ isRight: isRight,
1152
+ isSingle: true
1153
+ }, hasIcon);
1154
+ }
1155
+
1156
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(ButtonIcon, {
1157
+ isRight: isRight
1158
+ }, hasIcon), /*#__PURE__*/React__default["default"].createElement("div", {
1159
+ className: styledJsx_cjs.style.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || "")
1160
+ }, children, /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1161
+ id: "3568181479",
1162
+ dynamic: [paddingForAutoMode, paddingForAutoMode]
1163
+ }, ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}"))));
1164
+ };
1165
+ var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
1166
+ if (!config.isButtonGroup) return props;
1167
+ return _objectSpread2(_objectSpread2({}, props), {}, {
1168
+ auto: true,
1169
+ shadow: false,
1170
+ ghost: config.ghost || props.ghost,
1171
+ type: config.type || props.type,
1172
+ disabled: config.disabled || props.disabled
1173
+ });
1174
+ };
1175
+
1176
+ var defaultContext = {
1177
+ isButtonGroup: false,
1178
+ disabled: false
1179
+ };
1180
+ var ButtonGroupContext = /*#__PURE__*/React__default["default"].createContext(defaultContext);
1181
+ var useButtonGroupContext = function useButtonGroupContext() {
1182
+ return React__default["default"].useContext(ButtonGroupContext);
1183
+ };
1184
+
1185
+ var hexToRgb = function hexToRgb(color) {
1186
+ var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
1187
+ var full = color.replace(fullReg, function (_, r, g, b) {
1188
+ return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
1189
+ });
1190
+ var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
1191
+
1192
+ if (!values) {
1193
+ throw new Error("Bolio UI: Unsupported ".concat(color, " color."));
1194
+ }
1195
+
1196
+ return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
1197
+ };
1198
+
1199
+ var colorToRgbValues = function colorToRgbValues(color) {
1200
+ if (color.charAt(0) === '#') return hexToRgb(color);
1201
+ var safeColor = color.replace(/ /g, '');
1202
+ var colorType = color.substr(0, 4);
1203
+ var regArray = safeColor.match(/\((.+)\)/);
1204
+
1205
+ if (!colorType.startsWith('rgb') || !regArray) {
1206
+ console.log(color);
1207
+ throw new Error("Bolio UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
1208
+ }
1209
+
1210
+ return regArray[1].split(',').map(function (str) {
1211
+ return Number.parseFloat(str);
1212
+ });
1213
+ };
1214
+ var addColorAlpha = function addColorAlpha(color, alpha) {
1215
+ if (!/^#|rgb|RGB/.test(color)) return color;
1216
+
1217
+ var _colorToRgbValues = colorToRgbValues(color),
1218
+ _colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
1219
+ r = _colorToRgbValues2[0],
1220
+ g = _colorToRgbValues2[1],
1221
+ b = _colorToRgbValues2[2];
1222
+
1223
+ var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
1224
+ return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
1225
+ };
1226
+
1227
+ var getButtonGhostColors = function getButtonGhostColors(palette, type) {
1228
+ var colors = {
1229
+ primary: {
1230
+ bg: palette.background,
1231
+ border: palette.primary,
1232
+ color: palette.primary
1233
+ },
1234
+ secondary: {
1235
+ bg: palette.background,
1236
+ border: palette.secondary,
1237
+ color: palette.secondary
1238
+ },
1239
+ success: {
1240
+ bg: palette.background,
1241
+ border: palette.success,
1242
+ color: palette.success
1243
+ },
1244
+ warning: {
1245
+ bg: palette.background,
1246
+ border: palette.warning,
1247
+ color: palette.warning
1248
+ },
1249
+ error: {
1250
+ bg: palette.background,
1251
+ border: palette.error,
1252
+ color: palette.error
1253
+ },
1254
+ info: {
1255
+ bg: palette.background,
1256
+ border: palette.info,
1257
+ color: palette.info
1258
+ }
1259
+ };
1260
+ return colors[type] || null;
1261
+ };
1262
+ var getButtonColors = function getButtonColors(palette, props) {
1263
+ var type = props.type,
1264
+ disabled = props.disabled,
1265
+ ghost = props.ghost;
1266
+ var colors = {
1267
+ "default": {
1268
+ bg: palette.background,
1269
+ border: palette.border,
1270
+ color: palette.accents_5
1271
+ },
1272
+ primary: {
1273
+ bg: palette.primary,
1274
+ border: palette.primary,
1275
+ color: '#fff'
1276
+ },
1277
+ secondary: {
1278
+ bg: palette.secondary,
1279
+ border: palette.secondary,
1280
+ color: '#fff'
1281
+ },
1282
+ success: {
1283
+ bg: palette.success,
1284
+ border: palette.success,
1285
+ color: '#fff'
1286
+ },
1287
+ warning: {
1288
+ bg: palette.warning,
1289
+ border: palette.warning,
1290
+ color: '#fff'
1291
+ },
1292
+ error: {
1293
+ bg: palette.error,
1294
+ border: palette.error,
1295
+ color: '#fff'
1296
+ },
1297
+ info: {
1298
+ bg: palette.info,
1299
+ border: palette.info,
1300
+ color: '#fff'
1301
+ },
1302
+ abort: {
1303
+ bg: 'transparent',
1304
+ border: 'transparent',
1305
+ color: palette.accents_5
1306
+ }
1307
+ };
1308
+ if (disabled) return {
1309
+ bg: palette.accents_1,
1310
+ border: palette.accents_2,
1311
+ color: '#ccc'
1312
+ };
1313
+ /**
1314
+ * The '-light' type is the same color as the common type,
1315
+ * only hover's color is different.
1316
+ * e.g.
1317
+ * Color['success'] === Color['success-light']
1318
+ * Color['warning'] === Color['warning-light']
1319
+ */
1320
+
1321
+ var withoutLightType = type === null || type === void 0 ? void 0 : type.replace('-light', '');
1322
+ var defaultColor = colors["default"];
1323
+ if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
1324
+ return colors[withoutLightType] || defaultColor;
1325
+ };
1326
+ var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, type) {
1327
+ var colors = {
1328
+ primary: {
1329
+ bg: palette.primary,
1330
+ border: palette.background,
1331
+ color: 'white'
1332
+ },
1333
+ secondary: {
1334
+ bg: palette.secondary,
1335
+ border: palette.background,
1336
+ color: 'white'
1337
+ },
1338
+ success: {
1339
+ bg: palette.success,
1340
+ border: palette.background,
1341
+ color: 'white'
1342
+ },
1343
+ warning: {
1344
+ bg: palette.warning,
1345
+ border: palette.background,
1346
+ color: 'white'
1347
+ },
1348
+ error: {
1349
+ bg: palette.error,
1350
+ border: palette.background,
1351
+ color: 'white'
1352
+ },
1353
+ info: {
1354
+ bg: palette.info,
1355
+ border: palette.background,
1356
+ color: 'white'
1357
+ }
1358
+ };
1359
+ var withoutLightType = type.replace('-light', '');
1360
+ return colors[withoutLightType] || null;
1361
+ };
1362
+ var getButtonHoverColors = function getButtonHoverColors(palette, props) {
1363
+ var type = props.type,
1364
+ disabled = props.disabled,
1365
+ loading = props.loading,
1366
+ shadow = props.shadow,
1367
+ ghost = props.ghost;
1368
+ var defaultColor = getButtonColors(palette, props);
1369
+ var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
1370
+ var colors = {
1371
+ "default": {
1372
+ bg: palette.background,
1373
+ border: palette.foreground
1374
+ },
1375
+ primary: {
1376
+ bg: palette.background,
1377
+ border: palette.primary
1378
+ },
1379
+ secondary: {
1380
+ bg: palette.background,
1381
+ border: palette.secondary
1382
+ },
1383
+ success: {
1384
+ bg: palette.background,
1385
+ border: palette.success
1386
+ },
1387
+ warning: {
1388
+ bg: palette.background,
1389
+ border: palette.warning
1390
+ },
1391
+ error: {
1392
+ bg: palette.background,
1393
+ border: palette.error
1394
+ },
1395
+ info: {
1396
+ bg: palette.background,
1397
+ border: palette.info
1398
+ },
1399
+ abort: {
1400
+ bg: 'transparent',
1401
+ border: 'transparent',
1402
+ color: palette.accents_5
1403
+ },
1404
+ 'primary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1405
+ bg: alphaBackground
1406
+ }),
1407
+ 'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1408
+ bg: alphaBackground
1409
+ }),
1410
+ 'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1411
+ bg: alphaBackground
1412
+ }),
1413
+ 'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1414
+ bg: alphaBackground
1415
+ }),
1416
+ 'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1417
+ bg: alphaBackground
1418
+ }),
1419
+ 'info-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1420
+ bg: alphaBackground
1421
+ })
1422
+ };
1423
+ if (disabled) return {
1424
+ bg: palette.accents_1,
1425
+ border: palette.accents_2,
1426
+ color: '#ccc'
1427
+ };
1428
+ if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1429
+ color: 'transparent'
1430
+ });
1431
+ if (shadow) return defaultColor;
1432
+ var hoverColor = (ghost ? getButtonGhostHoverColors(palette, type) : colors[type]) || colors["default"];
1433
+ return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
1434
+ color: hoverColor.color || hoverColor.border
1435
+ });
1436
+ };
1437
+ var getButtonCursor = function getButtonCursor(disabled, loading) {
1438
+ if (disabled) return {
1439
+ cursor: 'not-allowed',
1440
+ events: 'auto'
1441
+ };
1442
+ if (loading) return {
1443
+ cursor: 'default',
1444
+ events: 'none'
1445
+ };
1446
+ return {
1447
+ cursor: 'pointer',
1448
+ events: 'auto'
1449
+ };
1450
+ };
1451
+ var getButtonDripColor = function getButtonDripColor(palette, props) {
1452
+ var type = props.type;
1453
+ var isLightHover = type === null || type === void 0 ? void 0 : type.endsWith('light');
1454
+ var hoverColors = getButtonHoverColors(palette, props);
1455
+ return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
1456
+ };
1457
+
1458
+ var _excluded$6 = ["children", "disabled", "type", "loading", "shadow", "ghost", "rounded", "effect", "onClick", "auto", "icon", "htmlType", "iconRight", "className"];
1459
+ var defaultProps$1 = {
1460
+ type: 'default',
1461
+ htmlType: 'button',
1462
+ ghost: false,
1463
+ rounded: false,
1464
+ loading: false,
1465
+ shadow: false,
1466
+ auto: false,
1467
+ effect: true,
1468
+ disabled: false,
1469
+ className: ''
1470
+ };
1471
+ var ButtonComponent = /*#__PURE__*/React__default["default"].forwardRef(function (btnProps, ref) {
1472
+ var theme = useTheme();
1473
+
1474
+ var _useScale = useScale(),
1475
+ SCALES = _useScale.SCALES;
1476
+
1477
+ var buttonRef = React.useRef(null);
1478
+ React.useImperativeHandle(ref, function () {
1479
+ return buttonRef.current;
1480
+ });
1481
+
1482
+ var _useState = React.useState(false),
1483
+ _useState2 = _slicedToArray(_useState, 2),
1484
+ dripShow = _useState2[0],
1485
+ setDripShow = _useState2[1];
1486
+
1487
+ var _useState3 = React.useState(0),
1488
+ _useState4 = _slicedToArray(_useState3, 2),
1489
+ dripX = _useState4[0],
1490
+ setDripX = _useState4[1];
1491
+
1492
+ var _useState5 = React.useState(0),
1493
+ _useState6 = _slicedToArray(_useState5, 2),
1494
+ dripY = _useState6[0],
1495
+ setDripY = _useState6[1];
1496
+
1497
+ var groupConfig = useButtonGroupContext();
1498
+ var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
1499
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1500
+
1501
+ var children = filteredProps.children,
1502
+ disabled = filteredProps.disabled;
1503
+ filteredProps.type;
1504
+ var loading = filteredProps.loading,
1505
+ shadow = filteredProps.shadow;
1506
+ filteredProps.ghost;
1507
+ var rounded = filteredProps.rounded,
1508
+ effect = filteredProps.effect,
1509
+ onClick = filteredProps.onClick,
1510
+ auto = filteredProps.auto,
1511
+ icon = filteredProps.icon,
1512
+ htmlType = filteredProps.htmlType,
1513
+ iconRight = filteredProps.iconRight,
1514
+ className = filteredProps.className,
1515
+ props = _objectWithoutProperties(filteredProps, _excluded$6);
1516
+ /* eslint-enable @typescript-eslint/no-unused-vars */
1517
+
1518
+
1519
+ var _useMemo = React.useMemo(function () {
1520
+ return getButtonColors(theme.palette, filteredProps);
1521
+ }, [theme.palette, filteredProps]),
1522
+ bg = _useMemo.bg,
1523
+ border = _useMemo.border,
1524
+ color = _useMemo.color;
1525
+
1526
+ var hover = React.useMemo(function () {
1527
+ return getButtonHoverColors(theme.palette, filteredProps);
1528
+ }, [theme.palette, filteredProps]);
1529
+
1530
+ var _useMemo2 = React.useMemo(function () {
1531
+ return getButtonCursor(disabled, loading);
1532
+ }, [disabled, loading]),
1533
+ cursor = _useMemo2.cursor,
1534
+ events = _useMemo2.events;
1535
+
1536
+ var dripColor = React.useMemo(function () {
1537
+ return getButtonDripColor(theme.palette, filteredProps);
1538
+ }, [theme.palette, filteredProps]);
1539
+
1540
+ var dripCompletedHandle = function dripCompletedHandle() {
1541
+ setDripShow(false);
1542
+ setDripX(0);
1543
+ setDripY(0);
1544
+ };
1545
+
1546
+ var clickHandler = function clickHandler(event) {
1547
+ if (disabled || loading) return;
1548
+ var showDrip = effect;
1549
+
1550
+ if (showDrip && buttonRef.current) {
1551
+ var rect = buttonRef.current.getBoundingClientRect();
1552
+ setDripShow(true);
1553
+ setDripX(event.clientX - rect.left);
1554
+ setDripY(event.clientY - rect.top);
1555
+ }
1556
+
1557
+ onClick && onClick(event);
1558
+ };
1559
+
1560
+ var childrenWithIcon = React.useMemo(function () {
1561
+ return getButtonChildrenWithIcon(auto, children, {
1562
+ icon: icon,
1563
+ iconRight: iconRight
1564
+ });
1565
+ }, [auto, children, icon, iconRight]);
1566
+ var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.15),
1567
+ paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.15);
1568
+ return /*#__PURE__*/React__default["default"].createElement("button", _extends({
1569
+ ref: buttonRef,
1570
+ type: htmlType,
1571
+ disabled: disabled,
1572
+ onClick: clickHandler
1573
+ }, props, {
1574
+ className: styledJsx_cjs.style.dynamic([["3337261033", [rounded ? '25px' : theme.layout.radius, SCALES.font(0.875), color, bg, border, cursor, events, shadow ? '0 4px 10px 0' + bg : 'none', SCALES.pl(0.75), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events]]]) + " " + (props && props.className != null && props.className || useClasses$1('btn', className) || "")
1575
+ }), loading && /*#__PURE__*/React__default["default"].createElement(ButtonLoading, {
1576
+ color: color
1577
+ }), childrenWithIcon, dripShow && /*#__PURE__*/React__default["default"].createElement(ButtonDrip$1, {
1578
+ x: dripX,
1579
+ y: dripY,
1580
+ color: dripColor,
1581
+ onCompleted: dripCompletedHandle
1582
+ }), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1583
+ id: "3337261033",
1584
+ dynamic: [rounded ? '25px' : theme.layout.radius, SCALES.font(0.875), color, bg, border, cursor, events, shadow ? '0 4px 10px 0' + bg : 'none', SCALES.pl(0.75), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events]
1585
+ }, ".btn.__jsx-style-dynamic-selector{box-sizing:border-box;display:inline-block;border-radius:".concat(rounded ? '25px' : theme.layout.radius, ";font-weight:500;font-size:").concat(SCALES.font(0.875), ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;text-transform:capitalize;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;white-space:nowrap;-webkit-transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;position:relative;overflow:hidden;color:").concat(color, ";background-color:").concat(bg, ";border:1px solid ").concat(border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ? '0 4px 10px 0' + bg : 'none', ";--bolio-ui-button-icon-padding:").concat(SCALES.pl(0.75), ";--bolio-ui-button-height:").concat(SCALES.height(2.5), ";--bolio-ui-button-color:").concat(color, ";--bolio-ui-button-bg:").concat(bg, ";min-width:").concat(auto ? 'min-content' : SCALES.width(10.5), ";width:").concat(auto ? 'auto' : 'initial', ";height:").concat(SCALES.height(2.5), ";padding:").concat(SCALES.pt(0), " ").concat(paddingRight, " ").concat(SCALES.pb(0), " ").concat(paddingLeft, ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.btn.__jsx-style-dynamic-selector:hover,.btn.__jsx-style-dynamic-selector:focus{color:").concat(hover.color, ";--bolio-ui-button-color:").concat(hover.color, ";background-color:").concat(hover.bg, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";}.btn.__jsx-style-dynamic-selector:active{-webkit-transform:scale(0.98,0.98);-ms-transform:scale(0.98,0.98);transform:scale(0.98,0.98);}.btn.__jsx-style-dynamic-selector .text{position:relative;z-index:1;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;text-align:center;line-height:inherit;}.btn.__jsx-style-dynamic-selector .text p,.btn.__jsx-style-dynamic-selector .text pre,.btn.__jsx-style-dynamic-selector .text div{margin:0;}")));
1586
+ });
1587
+ ButtonComponent.defaultProps = defaultProps$1;
1588
+ ButtonComponent.displayName = 'BolioUIButton';
1589
+ var Button = withScale$1(ButtonComponent);
1590
+ var Button$1 = Button;
1591
+
1592
+ var _excluded$5 = ["className", "children", "onClick", "passive", "disabled"];
1593
+ var ModalActionComponent = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
1594
+ var _ref$className = _ref.className,
1595
+ className = _ref$className === void 0 ? '' : _ref$className,
1596
+ children = _ref.children,
1597
+ onClick = _ref.onClick,
1598
+ _ref$passive = _ref.passive,
1599
+ passive = _ref$passive === void 0 ? false : _ref$passive,
1600
+ _ref$disabled = _ref.disabled,
1601
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1602
+ props = _objectWithoutProperties(_ref, _excluded$5);
1603
+
1604
+ var theme = useTheme();
1605
+
1606
+ var _useScale = useScale(),
1607
+ SCALES = _useScale.SCALES;
1608
+
1609
+ var btnRef = React.useRef(null);
1610
+
1611
+ var _useModalContext = useModalContext(),
1612
+ _close = _useModalContext.close;
1613
+
1614
+ React.useImperativeHandle(ref, function () {
1615
+ return btnRef.current;
1616
+ });
1617
+
1618
+ var clickHandler = function clickHandler(event) {
1619
+ if (disabled) return;
1620
+ var actionEvent = Object.assign({}, event, {
1621
+ close: function close() {
1622
+ return _close && _close();
1623
+ }
1624
+ });
1625
+ onClick && onClick(actionEvent);
1626
+ };
1627
+
1628
+ var color = React.useMemo(function () {
1629
+ return passive ? theme.palette.accents_5 : theme.palette.foreground;
1630
+ }, [theme.palette, passive]);
1631
+ var bgColor = React.useMemo(function () {
1632
+ return disabled ? theme.palette.accents_1 : theme.palette.background;
1633
+ }, [theme.palette, disabled]);
1634
+ var _styles$className = {
1635
+ styles: /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1636
+ id: "1003252629",
1637
+ dynamic: [SCALES.font(0.75), color, theme.palette.background, SCALES.height(3.5625), disabled ? color : theme.palette.foreground, disabled ? bgColor : theme.palette.accents_1]
1638
+ }, "button.btn.__jsx-style-dynamic-selector{font-size:".concat(SCALES.font(0.75), ";border:none;color:").concat(color, ";background-color:").concat(theme.palette.background, ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-flex:1;-ms-flex:1;flex:1;height:").concat(SCALES.height(3.5625), ";border-radius:0;min-width:0;}button.btn.__jsx-style-dynamic-selector:hover,button.btn.__jsx-style-dynamic-selector:focus{color:").concat(disabled ? color : theme.palette.foreground, ";background-color:").concat(disabled ? bgColor : theme.palette.accents_1, ";}")),
1639
+ className: styledJsx_cjs.style.dynamic([["1003252629", [SCALES.font(0.75), color, theme.palette.background, SCALES.height(3.5625), disabled ? color : theme.palette.foreground, disabled ? bgColor : theme.palette.accents_1]]])
1640
+ },
1641
+ resolveClassName = _styles$className.className,
1642
+ styles = _styles$className.styles;
1643
+ var classes = useClasses$1(resolveClassName, className);
1644
+
1645
+ var overrideProps = _objectSpread2(_objectSpread2({}, props), {}, {
1646
+ effect: false,
1647
+ ref: btnRef
1648
+ });
1649
+
1650
+ return /*#__PURE__*/React__default["default"].createElement(Button$1, _extends({
1651
+ className: classes,
1652
+ onClick: clickHandler,
1653
+ disabled: disabled
1654
+ }, overrideProps), children, styles);
1655
+ });
1656
+ ModalActionComponent.displayName = 'BolioUIModalAction';
1657
+ var ModalAction = withScale$1(ModalActionComponent);
1658
+ var ModalAction$1 = ModalAction;
1659
+
1660
+ var _excluded$4 = ["children"];
1661
+
1662
+ var ModalActionsComponent = function ModalActionsComponent(_ref) {
1663
+ var children = _ref.children,
1664
+ props = _objectWithoutProperties(_ref, _excluded$4);
1665
+
1666
+ var theme = useTheme();
1667
+ var ref = React.useRef(null);
1668
+
1669
+ var _useState = React.useState('auto'),
1670
+ _useState2 = _slicedToArray(_useState, 2),
1671
+ height = _useState2[0],
1672
+ setHeight = _useState2[1];
1673
+
1674
+ React.useEffect(function () {
1675
+ if (!ref.current) return;
1676
+ setHeight("".concat(ref.current.clientHeight, "px"));
1677
+ }, [ref]);
1678
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
1679
+ className: styledJsx_cjs.style.dynamic([["2914444644", [theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, height]]])
1680
+ }), /*#__PURE__*/React__default["default"].createElement("footer", _extends({
1681
+ ref: ref
1682
+ }, props, {
1683
+ className: styledJsx_cjs.style.dynamic([["2914444644", [theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, height]]]) + " " + (props && props.className != null && props.className || "")
1684
+ }), children), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1685
+ id: "2914444644",
1686
+ dynamic: [theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, height]
1687
+ }, "footer.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;overflow:hidden;width:100%;height:auto;position:absolute;bottom:0;left:0;right:0;border-top:1px solid ".concat(theme.palette.border, ";border-bottom-left-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";}footer.__jsx-style-dynamic-selector>button.btn + button.btn{border-left:1px solid ").concat(theme.palette.border, ";}div.__jsx-style-dynamic-selector{height:").concat(height, ";-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}")));
1688
+ };
1689
+
1690
+ ModalActionsComponent.displayName = 'BolioUIModalActions';
1691
+ var ModalActions = /*#__PURE__*/React__default["default"].memo(ModalActionsComponent);
1692
+ var ModalActions$1 = ModalActions;
1693
+
1694
+ var useCurrentState = function useCurrentState(initialState) {
1695
+ var _useState = React.useState(function () {
1696
+ return typeof initialState === 'function' ? initialState() : initialState;
1697
+ }),
1698
+ _useState2 = _slicedToArray(_useState, 2),
1699
+ state = _useState2[0],
1700
+ setState = _useState2[1];
1701
+
1702
+ var ref = React.useRef(initialState);
1703
+ React.useEffect(function () {
1704
+ ref.current = state;
1705
+ }, [state]);
1706
+
1707
+ var setValue = function setValue(val) {
1708
+ var result = typeof val === 'function' ? val(ref.current) : val;
1709
+ ref.current = result;
1710
+ setState(result);
1711
+ };
1712
+
1713
+ return [state, setValue, ref];
1714
+ };
1715
+
1716
+ var useCurrentState$1 = useCurrentState;
1717
+
1718
+ var _excluded$3 = ["children", "onClick", "visible", "width", "onContentClick", "backdropClassName", "positionClassName", "layerClassName"];
1719
+ var defaultProps = {
1720
+ onClick: function onClick() {},
1721
+ visible: false,
1722
+ // onContentClick: () => {},
1723
+ backdropClassName: '',
1724
+ positionClassName: '',
1725
+ layerClassName: ''
1726
+ };
1727
+
1728
+ function BackdropComponent(_ref) {
1729
+ var children = _ref.children,
1730
+ onClick = _ref.onClick,
1731
+ visible = _ref.visible,
1732
+ width = _ref.width,
1733
+ onContentClick = _ref.onContentClick,
1734
+ backdropClassName = _ref.backdropClassName,
1735
+ positionClassName = _ref.positionClassName,
1736
+ layerClassName = _ref.layerClassName,
1737
+ props = _objectWithoutProperties(_ref, _excluded$3);
1738
+
1739
+ var theme = useTheme();
1740
+
1741
+ var _useCurrentState = useCurrentState$1(false),
1742
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
1743
+ setIsContentMouseDown = _useCurrentState2[1],
1744
+ IsContentMouseDownRef = _useCurrentState2[2];
1745
+
1746
+ var clickHandler = function clickHandler(event) {
1747
+ if (IsContentMouseDownRef.current) return;
1748
+ onClick && onClick(event);
1749
+ };
1750
+
1751
+ var mouseUpHandler = function mouseUpHandler() {
1752
+ if (!IsContentMouseDownRef.current) return;
1753
+ var timer = setTimeout(function () {
1754
+ setIsContentMouseDown(false);
1755
+ clearTimeout(timer);
1756
+ }, 0);
1757
+ };
1758
+
1759
+ return /*#__PURE__*/React__default["default"].createElement(CssTransition, {
1760
+ name: "backdrop-wrapper",
1761
+ visible: visible,
1762
+ clearTime: 300
1763
+ }, /*#__PURE__*/React__default["default"].createElement("div", _extends({
1764
+ onClick: clickHandler,
1765
+ onMouseUp: mouseUpHandler
1766
+ }, props, {
1767
+ className: styledJsx_cjs.style.dynamic([["1944751280", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (props && props.className != null && props.className || useClasses$1('backdrop', backdropClassName) || "")
1768
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
1769
+ className: styledJsx_cjs.style.dynamic([["1944751280", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (useClasses$1('layer', layerClassName) || "")
1770
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
1771
+ onClick: onContentClick,
1772
+ onMouseDown: function onMouseDown() {
1773
+ return setIsContentMouseDown(true);
1774
+ },
1775
+ className: styledJsx_cjs.style.dynamic([["1944751280", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (useClasses$1('position', positionClassName) || "")
1776
+ }, children), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1777
+ id: "1944751280",
1778
+ dynamic: [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]
1779
+ }, ".backdrop.__jsx-style-dynamic-selector{position:fixed;top:0;left:0;right:0;bottom:0;overflow:auto;z-index:1000;-webkit-overflow-scrolling:touch;box-sizing:border-box;text-align:center;}.position.__jsx-style-dynamic-selector{position:relative;z-index:1001;outline:none;max-width:90%;width:".concat(width, ";margin:20px auto;vertical-align:middle;display:inline-block;}.backdrop.__jsx-style-dynamic-selector:before{display:inline-block;width:0;height:100%;vertical-align:middle;content:'';}.layer.__jsx-style-dynamic-selector{position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;opacity:").concat(theme.expressiveness.portalOpacity, ";background-color:black;-webkit-transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1);transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1);pointer-events:none;z-index:1000;}.backdrop-wrapper-enter.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:0;}.backdrop-wrapper-enter-active.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:").concat(theme.expressiveness.portalOpacity, ";}.backdrop-wrapper-leave.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:").concat(theme.expressiveness.portalOpacity, ";}.backdrop-wrapper-leave-active.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:0;}"))));
1780
+ }
1781
+
1782
+ BackdropComponent.defaultProps = defaultProps;
1783
+ BackdropComponent.displayName = 'BolioUIBackdrop';
1784
+ var Backdrop = /*#__PURE__*/React__default["default"].memo(BackdropComponent);
1785
+ var Backdrop$1 = Backdrop;
1786
+
1787
+ var defaultOptions = {
1788
+ scrollLayer: false,
1789
+ delayReset: 0
1790
+ };
1791
+ var elementStack = new Map();
1792
+
1793
+ var getOwnerPaddingRight = function getOwnerPaddingRight(element) {
1794
+ var owner = (element === null || element === void 0 ? void 0 : element.ownerDocument) || document;
1795
+ var view = owner.defaultView || window;
1796
+ return Number.parseInt(view.getComputedStyle(element).paddingRight, 10) || 0;
1797
+ };
1798
+
1799
+ var getOwnerScrollbarWidth = function getOwnerScrollbarWidth(element) {
1800
+ var doc = (element === null || element === void 0 ? void 0 : element.ownerDocument) || document;
1801
+ return Math.abs(window.innerWidth - doc.documentElement.clientWidth);
1802
+ };
1803
+
1804
+ function useBodyScroll(elementRef, options) {
1805
+ if (typeof document === 'undefined') return [false, function (t) {
1806
+ return t;
1807
+ }];
1808
+ var elRef = elementRef || React.useRef(document.body);
1809
+
1810
+ var _useState = React.useState(false),
1811
+ _useState2 = _slicedToArray(_useState, 2),
1812
+ hidden = _useState2[0],
1813
+ setHidden = _useState2[1];
1814
+
1815
+ var safeOptions = _objectSpread2(_objectSpread2({}, defaultOptions), options || {});
1816
+
1817
+ React.useEffect(function () {
1818
+ if (!elRef || !elRef.current) return;
1819
+ var lastOverflow = elRef.current.style.overflow;
1820
+
1821
+ if (hidden) {
1822
+ if (elementStack.has(elRef.current)) return;
1823
+ var paddingRight = getOwnerPaddingRight(elRef.current);
1824
+ var scrollbarWidth = getOwnerScrollbarWidth(elRef.current);
1825
+ elementStack.set(elRef.current, {
1826
+ overflow: lastOverflow,
1827
+ paddingRight: elRef.current.style.paddingRight
1828
+ });
1829
+ elRef.current.style.overflow = 'hidden';
1830
+ elRef.current.style.paddingRight = "".concat(paddingRight + scrollbarWidth, "px");
1831
+ return;
1832
+ } // reset element overflow
1833
+
1834
+
1835
+ if (!elementStack.has(elRef.current)) return;
1836
+
1837
+ var reset = function reset(el) {
1838
+ var store = elementStack.get(el);
1839
+ if (!store) return;
1840
+ el.style.overflow = store.overflow;
1841
+ el.style.paddingRight = store.paddingRight;
1842
+ elementStack["delete"](el);
1843
+ };
1844
+
1845
+ var timer = window.setTimeout(function () {
1846
+ reset(elRef.current);
1847
+ window.clearTimeout(timer);
1848
+ }, safeOptions.delayReset);
1849
+ }, [hidden, elRef]);
1850
+ return [hidden, setHidden];
1851
+ }
1852
+
1853
+ /**
1854
+ * KeyBinding Codes
1855
+ * The content of this file is based on the design of the open source project "microsoft/vscode",
1856
+ * Copyright (c) Microsoft Corporation. All rights reserved.
1857
+ *
1858
+ * We inherit the KeyMod values from "microsoft/vscode",
1859
+ * but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
1860
+ */
1861
+ var KeyCode;
1862
+
1863
+ (function (KeyCode) {
1864
+ KeyCode[KeyCode["Unknown"] = 0] = "Unknown";
1865
+ KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
1866
+ KeyCode[KeyCode["Tab"] = 9] = "Tab";
1867
+ KeyCode[KeyCode["Enter"] = 13] = "Enter";
1868
+ KeyCode[KeyCode["Shift"] = 16] = "Shift";
1869
+ KeyCode[KeyCode["Ctrl"] = 17] = "Ctrl";
1870
+ KeyCode[KeyCode["Alt"] = 18] = "Alt";
1871
+ KeyCode[KeyCode["PauseBreak"] = 19] = "PauseBreak";
1872
+ KeyCode[KeyCode["CapsLock"] = 20] = "CapsLock";
1873
+ KeyCode[KeyCode["Escape"] = 27] = "Escape";
1874
+ KeyCode[KeyCode["Space"] = 32] = "Space";
1875
+ KeyCode[KeyCode["PageUp"] = 33] = "PageUp";
1876
+ KeyCode[KeyCode["PageDown"] = 34] = "PageDown";
1877
+ KeyCode[KeyCode["End"] = 35] = "End";
1878
+ KeyCode[KeyCode["Home"] = 36] = "Home";
1879
+ KeyCode[KeyCode["LeftArrow"] = 37] = "LeftArrow";
1880
+ KeyCode[KeyCode["UpArrow"] = 38] = "UpArrow";
1881
+ KeyCode[KeyCode["RightArrow"] = 39] = "RightArrow";
1882
+ KeyCode[KeyCode["DownArrow"] = 40] = "DownArrow";
1883
+ KeyCode[KeyCode["Insert"] = 45] = "Insert";
1884
+ KeyCode[KeyCode["Delete"] = 46] = "Delete";
1885
+ KeyCode[KeyCode["KEY_0"] = 48] = "KEY_0";
1886
+ KeyCode[KeyCode["KEY_1"] = 49] = "KEY_1";
1887
+ KeyCode[KeyCode["KEY_2"] = 50] = "KEY_2";
1888
+ KeyCode[KeyCode["KEY_3"] = 51] = "KEY_3";
1889
+ KeyCode[KeyCode["KEY_4"] = 52] = "KEY_4";
1890
+ KeyCode[KeyCode["KEY_5"] = 53] = "KEY_5";
1891
+ KeyCode[KeyCode["KEY_6"] = 54] = "KEY_6";
1892
+ KeyCode[KeyCode["KEY_7"] = 55] = "KEY_7";
1893
+ KeyCode[KeyCode["KEY_8"] = 56] = "KEY_8";
1894
+ KeyCode[KeyCode["KEY_9"] = 57] = "KEY_9";
1895
+ KeyCode[KeyCode["KEY_A"] = 65] = "KEY_A";
1896
+ KeyCode[KeyCode["KEY_B"] = 66] = "KEY_B";
1897
+ KeyCode[KeyCode["KEY_C"] = 67] = "KEY_C";
1898
+ KeyCode[KeyCode["KEY_D"] = 68] = "KEY_D";
1899
+ KeyCode[KeyCode["KEY_E"] = 69] = "KEY_E";
1900
+ KeyCode[KeyCode["KEY_F"] = 70] = "KEY_F";
1901
+ KeyCode[KeyCode["KEY_G"] = 71] = "KEY_G";
1902
+ KeyCode[KeyCode["KEY_H"] = 72] = "KEY_H";
1903
+ KeyCode[KeyCode["KEY_I"] = 73] = "KEY_I";
1904
+ KeyCode[KeyCode["KEY_J"] = 74] = "KEY_J";
1905
+ KeyCode[KeyCode["KEY_K"] = 75] = "KEY_K";
1906
+ KeyCode[KeyCode["KEY_L"] = 76] = "KEY_L";
1907
+ KeyCode[KeyCode["KEY_M"] = 77] = "KEY_M";
1908
+ KeyCode[KeyCode["KEY_N"] = 78] = "KEY_N";
1909
+ KeyCode[KeyCode["KEY_O"] = 79] = "KEY_O";
1910
+ KeyCode[KeyCode["KEY_P"] = 80] = "KEY_P";
1911
+ KeyCode[KeyCode["KEY_Q"] = 81] = "KEY_Q";
1912
+ KeyCode[KeyCode["KEY_R"] = 82] = "KEY_R";
1913
+ KeyCode[KeyCode["KEY_S"] = 83] = "KEY_S";
1914
+ KeyCode[KeyCode["KEY_T"] = 84] = "KEY_T";
1915
+ KeyCode[KeyCode["KEY_U"] = 85] = "KEY_U";
1916
+ KeyCode[KeyCode["KEY_V"] = 86] = "KEY_V";
1917
+ KeyCode[KeyCode["KEY_W"] = 87] = "KEY_W";
1918
+ KeyCode[KeyCode["KEY_X"] = 88] = "KEY_X";
1919
+ KeyCode[KeyCode["KEY_Y"] = 89] = "KEY_Y";
1920
+ KeyCode[KeyCode["KEY_Z"] = 90] = "KEY_Z";
1921
+ KeyCode[KeyCode["Meta"] = 91] = "Meta";
1922
+ KeyCode[KeyCode["F1"] = 112] = "F1";
1923
+ KeyCode[KeyCode["F2"] = 113] = "F2";
1924
+ KeyCode[KeyCode["F3"] = 114] = "F3";
1925
+ KeyCode[KeyCode["F4"] = 115] = "F4";
1926
+ KeyCode[KeyCode["F5"] = 116] = "F5";
1927
+ KeyCode[KeyCode["F6"] = 117] = "F6";
1928
+ KeyCode[KeyCode["F7"] = 118] = "F7";
1929
+ KeyCode[KeyCode["F8"] = 119] = "F8";
1930
+ KeyCode[KeyCode["F9"] = 120] = "F9";
1931
+ KeyCode[KeyCode["F10"] = 121] = "F10";
1932
+ KeyCode[KeyCode["F11"] = 122] = "F11";
1933
+ KeyCode[KeyCode["F12"] = 123] = "F12";
1934
+ KeyCode[KeyCode["NumLock"] = 144] = "NumLock";
1935
+ KeyCode[KeyCode["ScrollLock"] = 145] = "ScrollLock";
1936
+ KeyCode[KeyCode["Equal"] = 187] = "Equal";
1937
+ KeyCode[KeyCode["Minus"] = 189] = "Minus";
1938
+ KeyCode[KeyCode["Backquote"] = 192] = "Backquote";
1939
+ KeyCode[KeyCode["Backslash"] = 220] = "Backslash";
1940
+ })(KeyCode || (KeyCode = {}));
1941
+
1942
+ var KeyMod;
1943
+
1944
+ (function (KeyMod) {
1945
+ KeyMod[KeyMod["CtrlCmd"] = 2048] = "CtrlCmd";
1946
+ KeyMod[KeyMod["Shift"] = 1024] = "Shift";
1947
+ KeyMod[KeyMod["Alt"] = 512] = "Alt";
1948
+ KeyMod[KeyMod["WinCtrl"] = 256] = "WinCtrl";
1949
+ })(KeyMod || (KeyMod = {}));
1950
+
1951
+ /* istanbul ignore next */
1952
+
1953
+ var getCtrlKeysByPlatform = function getCtrlKeysByPlatform() {
1954
+ return {
1955
+ CtrlCmd: isMac() ? 'metaKey' : 'ctrlKey',
1956
+ WinCtrl: isMac() ? 'ctrlKey' : 'metaKey'
1957
+ };
1958
+ };
1959
+ var getActiveModMap = function getActiveModMap(bindings) {
1960
+ var modBindings = bindings.filter(function (item) {
1961
+ return !!KeyMod[item];
1962
+ });
1963
+ var activeModMap = {
1964
+ CtrlCmd: false,
1965
+ Shift: false,
1966
+ Alt: false,
1967
+ WinCtrl: false
1968
+ };
1969
+ modBindings.forEach(function (code) {
1970
+ var modKey = KeyMod[code];
1971
+ activeModMap[modKey] = true;
1972
+ });
1973
+ return activeModMap;
1974
+ };
1975
+
1976
+ var useKeyboard = function useKeyboard(handler, keyBindings) {
1977
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1978
+ var bindings = Array.isArray(keyBindings) ? keyBindings : [keyBindings];
1979
+ var _options$disableGloba = options.disableGlobalEvent,
1980
+ disableGlobalEvent = _options$disableGloba === void 0 ? false : _options$disableGloba,
1981
+ _options$capture = options.capture,
1982
+ capture = _options$capture === void 0 ? false : _options$capture,
1983
+ _options$stopPropagat = options.stopPropagation,
1984
+ stopPropagation = _options$stopPropagat === void 0 ? false : _options$stopPropagat,
1985
+ _options$preventDefau = options.preventDefault,
1986
+ preventDefault = _options$preventDefau === void 0 ? true : _options$preventDefau,
1987
+ _options$event = options.event,
1988
+ event = _options$event === void 0 ? 'keydown' : _options$event;
1989
+ var activeModMap = getActiveModMap(bindings);
1990
+ var keyCode = bindings.filter(function (item) {
1991
+ return !KeyMod[item];
1992
+ });
1993
+
1994
+ var _getCtrlKeysByPlatfor = getCtrlKeysByPlatform(),
1995
+ CtrlCmd = _getCtrlKeysByPlatfor.CtrlCmd,
1996
+ WinCtrl = _getCtrlKeysByPlatfor.WinCtrl;
1997
+
1998
+ var eventHandler = function eventHandler(event) {
1999
+ if (activeModMap.Shift && !event.shiftKey) return;
2000
+ if (activeModMap.Alt && !event.altKey) return;
2001
+ if (activeModMap.CtrlCmd && !event[CtrlCmd]) return;
2002
+ if (activeModMap.WinCtrl && !event[WinCtrl]) return;
2003
+ var hitOne = keyCode.find(function (k) {
2004
+ return k === event.keyCode;
2005
+ });
2006
+ if (keyCode && !hitOne) return;
2007
+
2008
+ if (stopPropagation) {
2009
+ event.stopPropagation();
2010
+ }
2011
+
2012
+ if (preventDefault) {
2013
+ event.preventDefault();
2014
+ }
2015
+
2016
+ handler && handler(event);
2017
+ };
2018
+
2019
+ React.useEffect(function () {
2020
+ if (!disableGlobalEvent) {
2021
+ document.addEventListener(event, eventHandler);
2022
+ }
2023
+
2024
+ return function () {
2025
+ document.removeEventListener(event, eventHandler);
2026
+ };
2027
+ }, [disableGlobalEvent]);
2028
+
2029
+ var elementBindingHandler = function elementBindingHandler(elementEventType) {
2030
+ var isCapture = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2031
+ if (elementEventType !== event) return function () {};
2032
+ if (isCapture !== capture) return function () {};
2033
+ return function (e) {
2034
+ return eventHandler(e);
2035
+ };
2036
+ };
2037
+
2038
+ return {
2039
+ bindings: {
2040
+ onKeyDown: elementBindingHandler('keydown'),
2041
+ onKeyDownCapture: elementBindingHandler('keydown', true),
2042
+ onKeyPress: elementBindingHandler('keypress'),
2043
+ onKeyPressCapture: elementBindingHandler('keypress', true),
2044
+ onKeyUp: elementBindingHandler('keyup'),
2045
+ onKeyUpCapture: elementBindingHandler('keyup', true)
2046
+ }
2047
+ };
2048
+ };
2049
+
2050
+ var useKeyboard$1 = useKeyboard;
2051
+
2052
+ function ModalComponent(_ref) {
2053
+ var customVisible = _ref.visible,
2054
+ onClose = _ref.onClose,
2055
+ children = _ref.children,
2056
+ _ref$keyboard = _ref.keyboard,
2057
+ keyboard = _ref$keyboard === void 0 ? true : _ref$keyboard,
2058
+ _ref$wrapClassName = _ref.wrapClassName,
2059
+ wrapClassName = _ref$wrapClassName === void 0 ? '' : _ref$wrapClassName,
2060
+ onContentClick = _ref.onContentClick,
2061
+ _ref$disableBackdropC = _ref.disableBackdropClick,
2062
+ disableBackdropClick = _ref$disableBackdropC === void 0 ? false : _ref$disableBackdropC,
2063
+ _ref$positionClassNam = _ref.positionClassName,
2064
+ positionClassName = _ref$positionClassNam === void 0 ? '' : _ref$positionClassNam,
2065
+ _ref$backdropClassNam = _ref.backdropClassName,
2066
+ backdropClassName = _ref$backdropClassNam === void 0 ? '' : _ref$backdropClassNam,
2067
+ _ref$layerClassName = _ref.layerClassName,
2068
+ layerClassName = _ref$layerClassName === void 0 ? '' : _ref$layerClassName;
2069
+ var portal = usePortal$1('modal');
2070
+
2071
+ var _useScale = useScale(),
2072
+ SCALES = _useScale.SCALES;
2073
+
2074
+ var _useBodyScroll = useBodyScroll(null, {
2075
+ delayReset: 300
2076
+ }),
2077
+ _useBodyScroll2 = _slicedToArray(_useBodyScroll, 2),
2078
+ setBodyHidden = _useBodyScroll2[1];
2079
+
2080
+ var _useState = React.useState(false),
2081
+ _useState2 = _slicedToArray(_useState, 2),
2082
+ visible = _useState2[0],
2083
+ setVisible = _useState2[1];
2084
+
2085
+ var _pickChild = pickChild(children, ModalAction$1),
2086
+ _pickChild2 = _slicedToArray(_pickChild, 2),
2087
+ withoutActionsChildren = _pickChild2[0],
2088
+ ActionsChildren = _pickChild2[1];
2089
+
2090
+ var hasActions = ActionsChildren && React__default["default"].Children.count(ActionsChildren) > 0;
2091
+
2092
+ var closeModal = function closeModal() {
2093
+ onClose && onClose();
2094
+ setVisible(false);
2095
+ setBodyHidden(false);
2096
+ };
2097
+
2098
+ React.useEffect(function () {
2099
+ if (typeof customVisible === 'undefined') return;
2100
+ setVisible(customVisible);
2101
+ setBodyHidden(customVisible);
2102
+ }, [customVisible, setBodyHidden]);
2103
+
2104
+ var _useKeyboard = useKeyboard$1(function () {
2105
+ keyboard && closeModal();
2106
+ }, KeyCode.Escape, {
2107
+ disableGlobalEvent: true
2108
+ }),
2109
+ bindings = _useKeyboard.bindings;
2110
+
2111
+ var closeFromBackdrop = function closeFromBackdrop() {
2112
+ if (disableBackdropClick) return;
2113
+ closeModal();
2114
+ };
2115
+
2116
+ var modalConfig = React.useMemo(function () {
2117
+ return {
2118
+ close: closeModal
2119
+ };
2120
+ }, []);
2121
+ if (!portal) return null;
2122
+ return /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default["default"].createElement(ModalContext.Provider, {
2123
+ value: modalConfig
2124
+ }, /*#__PURE__*/React__default["default"].createElement(Backdrop$1, _extends({
2125
+ onClick: closeFromBackdrop,
2126
+ onContentClick: onContentClick,
2127
+ visible: visible,
2128
+ width: SCALES.width(26),
2129
+ positionClassName: positionClassName,
2130
+ backdropClassName: backdropClassName,
2131
+ layerClassName: layerClassName
2132
+ }, bindings), /*#__PURE__*/React__default["default"].createElement(ModalWrapper, {
2133
+ visible: visible,
2134
+ className: wrapClassName
2135
+ }, withoutActionsChildren, hasActions && /*#__PURE__*/React__default["default"].createElement(ModalActions$1, null, ActionsChildren)))), portal);
2136
+ }
2137
+
2138
+ ModalComponent.displayName = 'BolioUIModal';
2139
+ var Modal = withScale$1(ModalComponent);
2140
+ var Modal$1 = Modal;
2141
+
2142
+ var _excluded$2 = ["className", "children"];
2143
+
2144
+ function ModalTitleComponent(_ref) {
2145
+ var _ref$className = _ref.className,
2146
+ className = _ref$className === void 0 ? '' : _ref$className,
2147
+ children = _ref.children,
2148
+ props = _objectWithoutProperties(_ref, _excluded$2);
2149
+
2150
+ var theme = useTheme();
2151
+
2152
+ var _useScale = useScale(),
2153
+ SCALES = _useScale.SCALES;
2154
+
2155
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("h2", _extends({}, props, {
2156
+ className: styledJsx_cjs.style.dynamic([["4121803681", [SCALES.font(1.5), theme.palette.foreground, SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
2157
+ }), children), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
2158
+ id: "4121803681",
2159
+ dynamic: [SCALES.font(1.5), theme.palette.foreground, SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
2160
+ }, "h2.__jsx-style-dynamic-selector{line-height:1.6;font-weight:normal;text-align:center;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;word-break:break-word;text-transform:capitalize;font-size:".concat(SCALES.font(1.5), ";color:").concat(theme.palette.foreground, ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")));
2161
+ }
2162
+
2163
+ ModalTitleComponent.displayName = 'BolioUIModalTitle';
2164
+ var ModalTitle = withScale$1(ModalTitleComponent);
2165
+ var ModalTitle$1 = ModalTitle;
2166
+
2167
+ var _excluded$1 = ["className", "children"];
2168
+
2169
+ function ModalSubtitleComponent(_ref) {
2170
+ var _ref$className = _ref.className,
2171
+ className = _ref$className === void 0 ? '' : _ref$className,
2172
+ children = _ref.children,
2173
+ props = _objectWithoutProperties(_ref, _excluded$1);
2174
+
2175
+ var theme = useTheme();
2176
+
2177
+ var _useScale = useScale(),
2178
+ SCALES = _useScale.SCALES;
2179
+
2180
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("p", _extends({}, props, {
2181
+ className: styledJsx_cjs.style.dynamic([["1585744472", [theme.palette.accents_5, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, '1.5em'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
2182
+ }), children), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
2183
+ id: "1585744472",
2184
+ dynamic: [theme.palette.accents_5, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, '1.5em'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
2185
+ }, "p.__jsx-style-dynamic-selector{font-weight:normal;display:inline-block;text-align:center;word-break:break-word;text-transform:uppercase;color:".concat(theme.palette.accents_5, ";font-size:").concat(SCALES.font(0.875), ";line-height:1.5em;width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, '1.5em'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")));
2186
+ }
2187
+
2188
+ ModalSubtitleComponent.displayName = 'BolioUIModalSubtitle';
2189
+ var ModalSubtitle = withScale$1(ModalSubtitleComponent);
2190
+ var ModalSubtitle$1 = ModalSubtitle;
2191
+
2192
+ var _excluded = ["className", "children"];
2193
+
2194
+ function ModalContentComponent(_ref) {
2195
+ var _ref$className = _ref.className,
2196
+ className = _ref$className === void 0 ? '' : _ref$className,
2197
+ children = _ref.children,
2198
+ props = _objectWithoutProperties(_ref, _excluded);
2199
+
2200
+ var _useScale = useScale(),
2201
+ SCALES = _useScale.SCALES;
2202
+
2203
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", _extends({}, props, {
2204
+ className: styledJsx_cjs.style.dynamic([["588605445", [SCALES.font(1), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(1.3125), SCALES.pr(1.3125), SCALES.pb(0.6625), SCALES.pl(1.3125), SCALES.mt(0), SCALES.mr(0, 'calc(var(--modal-wrapper-padding-right) * -1)'), SCALES.mb(0), SCALES.ml(0, 'calc(var(--modal-wrapper-padding-left) * -1)')]]]) + " " + (props && props.className != null && props.className || useClasses$1('content', className) || "")
2205
+ }), children), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
2206
+ id: "588605445",
2207
+ dynamic: [SCALES.font(1), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(1.3125), SCALES.pr(1.3125), SCALES.pb(0.6625), SCALES.pl(1.3125), SCALES.mt(0), SCALES.mr(0, 'calc(var(--modal-wrapper-padding-right) * -1)'), SCALES.mb(0), SCALES.ml(0, 'calc(var(--modal-wrapper-padding-left) * -1)')]
2208
+ }, ".content.__jsx-style-dynamic-selector{position:relative;text-align:left;font-size:".concat(SCALES.font(1), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(1.3125), " ").concat(SCALES.pr(1.3125), " ").concat(SCALES.pb(0.6625), " ").concat(SCALES.pl(1.3125), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0, 'calc(var(--modal-wrapper-padding-right) * -1)'), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0, 'calc(var(--modal-wrapper-padding-left) * -1)'), ";}.content.__jsx-style-dynamic-selector>*:first-child{margin-top:0;}.content.__jsx-style-dynamic-selector>*:last-child{margin-bottom:0;}")));
2209
+ }
2210
+
2211
+ ModalContentComponent.displayName = 'BolioUIModalContent';
2212
+ var ModalContent = withScale$1(ModalContentComponent);
2213
+ var ModalContent$1 = ModalContent;
2214
+
2215
+ Modal$1.Title = ModalTitle$1;
2216
+ Modal$1.Subtitle = ModalSubtitle$1;
2217
+ Modal$1.Content = ModalContent$1;
2218
+ Modal$1.Action = ModalAction$1;
2219
+
2220
+ exports["default"] = Modal$1;