@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,1883 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var styledJsx_cjs = require('../styled-jsx.cjs.js');
7
+ var reactDom = require('react-dom');
8
+
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
+
13
+ function ownKeys(object, enumerableOnly) {
14
+ var keys = Object.keys(object);
15
+
16
+ if (Object.getOwnPropertySymbols) {
17
+ var symbols = Object.getOwnPropertySymbols(object);
18
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
19
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
20
+ })), keys.push.apply(keys, symbols);
21
+ }
22
+
23
+ return keys;
24
+ }
25
+
26
+ function _objectSpread2(target) {
27
+ for (var i = 1; i < arguments.length; i++) {
28
+ var source = null != arguments[i] ? arguments[i] : {};
29
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
30
+ _defineProperty(target, key, source[key]);
31
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
32
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
33
+ });
34
+ }
35
+
36
+ return target;
37
+ }
38
+
39
+ function _typeof(obj) {
40
+ "@babel/helpers - typeof";
41
+
42
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
43
+ return typeof obj;
44
+ } : function (obj) {
45
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
46
+ }, _typeof(obj);
47
+ }
48
+
49
+ function _defineProperty(obj, key, value) {
50
+ if (key in obj) {
51
+ Object.defineProperty(obj, key, {
52
+ value: value,
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true
56
+ });
57
+ } else {
58
+ obj[key] = value;
59
+ }
60
+
61
+ return obj;
62
+ }
63
+
64
+ function _extends() {
65
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
66
+ for (var i = 1; i < arguments.length; i++) {
67
+ var source = arguments[i];
68
+
69
+ for (var key in source) {
70
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
71
+ target[key] = source[key];
72
+ }
73
+ }
74
+ }
75
+
76
+ return target;
77
+ };
78
+ return _extends.apply(this, arguments);
79
+ }
80
+
81
+ function _objectWithoutPropertiesLoose(source, excluded) {
82
+ if (source == null) return {};
83
+ var target = {};
84
+ var sourceKeys = Object.keys(source);
85
+ var key, i;
86
+
87
+ for (i = 0; i < sourceKeys.length; i++) {
88
+ key = sourceKeys[i];
89
+ if (excluded.indexOf(key) >= 0) continue;
90
+ target[key] = source[key];
91
+ }
92
+
93
+ return target;
94
+ }
95
+
96
+ function _objectWithoutProperties(source, excluded) {
97
+ if (source == null) return {};
98
+
99
+ var target = _objectWithoutPropertiesLoose(source, excluded);
100
+
101
+ var key, i;
102
+
103
+ if (Object.getOwnPropertySymbols) {
104
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
105
+
106
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
107
+ key = sourceSymbolKeys[i];
108
+ if (excluded.indexOf(key) >= 0) continue;
109
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
110
+ target[key] = source[key];
111
+ }
112
+ }
113
+
114
+ return target;
115
+ }
116
+
117
+ function _slicedToArray(arr, i) {
118
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
119
+ }
120
+
121
+ function _arrayWithHoles(arr) {
122
+ if (Array.isArray(arr)) return arr;
123
+ }
124
+
125
+ function _iterableToArrayLimit(arr, i) {
126
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
127
+
128
+ if (_i == null) return;
129
+ var _arr = [];
130
+ var _n = true;
131
+ var _d = false;
132
+
133
+ var _s, _e;
134
+
135
+ try {
136
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
137
+ _arr.push(_s.value);
138
+
139
+ if (i && _arr.length === i) break;
140
+ }
141
+ } catch (err) {
142
+ _d = true;
143
+ _e = err;
144
+ } finally {
145
+ try {
146
+ if (!_n && _i["return"] != null) _i["return"]();
147
+ } finally {
148
+ if (_d) throw _e;
149
+ }
150
+ }
151
+
152
+ return _arr;
153
+ }
154
+
155
+ function _unsupportedIterableToArray(o, minLen) {
156
+ if (!o) return;
157
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
158
+ var n = Object.prototype.toString.call(o).slice(8, -1);
159
+ if (n === "Object" && o.constructor) n = o.constructor.name;
160
+ if (n === "Map" || n === "Set") return Array.from(o);
161
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
162
+ }
163
+
164
+ function _arrayLikeToArray(arr, len) {
165
+ if (len == null || len > arr.length) len = arr.length;
166
+
167
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
168
+
169
+ return arr2;
170
+ }
171
+
172
+ function _nonIterableRest() {
173
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
174
+ }
175
+
176
+ function _createForOfIteratorHelper(o, allowArrayLike) {
177
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
178
+
179
+ if (!it) {
180
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
181
+ if (it) o = it;
182
+ var i = 0;
183
+
184
+ var F = function () {};
185
+
186
+ return {
187
+ s: F,
188
+ n: function () {
189
+ if (i >= o.length) return {
190
+ done: true
191
+ };
192
+ return {
193
+ done: false,
194
+ value: o[i++]
195
+ };
196
+ },
197
+ e: function (e) {
198
+ throw e;
199
+ },
200
+ f: F
201
+ };
202
+ }
203
+
204
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
205
+ }
206
+
207
+ var normalCompletion = true,
208
+ didErr = false,
209
+ err;
210
+ return {
211
+ s: function () {
212
+ it = it.call(o);
213
+ },
214
+ n: function () {
215
+ var step = it.next();
216
+ normalCompletion = step.done;
217
+ return step;
218
+ },
219
+ e: function (e) {
220
+ didErr = true;
221
+ err = e;
222
+ },
223
+ f: function () {
224
+ try {
225
+ if (!normalCompletion && it.return != null) it.return();
226
+ } finally {
227
+ if (didErr) throw err;
228
+ }
229
+ }
230
+ };
231
+ }
232
+
233
+ var defaultToastLayout = {
234
+ padding: '12px 16px',
235
+ margin: '8px 0',
236
+ width: '420px',
237
+ maxWidth: '90vw',
238
+ maxHeight: '75px',
239
+ placement: 'bottomRight'
240
+ };
241
+ var defaultParams = {
242
+ toasts: [],
243
+ toastLayout: defaultToastLayout,
244
+ updateToastLayout: function updateToastLayout(t) {
245
+ return t;
246
+ },
247
+ updateToasts: function updateToasts(t) {
248
+ return t;
249
+ },
250
+ lastUpdateToastId: null,
251
+ updateLastToastId: function updateLastToastId() {
252
+ return null;
253
+ }
254
+ };
255
+ var BolioUIContent = /*#__PURE__*/React__default["default"].createContext(defaultParams);
256
+ var useBolioUIContext = function useBolioUIContext() {
257
+ return React__default["default"].useContext(BolioUIContent);
258
+ };
259
+
260
+ var defaultFont = {
261
+ sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
262
+ mono: 'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace',
263
+ prism: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,"Liberation Mono", "Courier New", monospace'
264
+ };
265
+ var defaultBreakpoints = {
266
+ xs: {
267
+ min: '0',
268
+ max: '650px'
269
+ },
270
+ sm: {
271
+ min: '650px',
272
+ max: '900px'
273
+ },
274
+ md: {
275
+ min: '900px',
276
+ max: '1280px'
277
+ },
278
+ lg: {
279
+ min: '1280px',
280
+ max: '1920px'
281
+ },
282
+ xl: {
283
+ min: '1920px',
284
+ max: '10000px'
285
+ }
286
+ };
287
+ var defaultLayout = {
288
+ gap: '16pt',
289
+ gapNegative: '-16pt',
290
+ gapHalf: '8pt',
291
+ gapHalfNegative: '-8pt',
292
+ gapQuarter: '4pt',
293
+ gapQuarterNegative: '-4pt',
294
+ pageMargin: '16pt',
295
+ pageWidth: '900pt',
296
+ pageWidthWithMargin: '930pt',
297
+ breakpointMobile: defaultBreakpoints.xs.max,
298
+ breakpointTablet: defaultBreakpoints.sm.max,
299
+ radius: '6px',
300
+ unit: '16px'
301
+ };
302
+
303
+ var palette$1 = {
304
+ background: '#fff',
305
+ foreground: '#000',
306
+ accents_1: '#fafafa',
307
+ accents_2: '#eaeaea',
308
+ accents_3: '#999',
309
+ accents_4: '#888',
310
+ accents_5: '#666',
311
+ accents_6: '#444',
312
+ accents_7: '#333',
313
+ accents_8: '#111',
314
+ selection: '#cee4fe',
315
+ code: '#C25FFF',
316
+ border: '#eaeaea',
317
+ primary: '#0072F6',
318
+ primaryLight: '#96C1F3',
319
+ primaryLighter: '#CEE4FF',
320
+ primaryDark: '#00254E',
321
+ secondary: '#7828C9',
322
+ secondaryLighter: '#D1B1F1',
323
+ secondaryLight: '#EADCF9',
324
+ secondaryDark: '#290E45',
325
+ error: '#F31261',
326
+ errorLight: '#FAA8C6',
327
+ errorLighter: '#FDD8E6',
328
+ errorDark: '#4E041F',
329
+ success: '#17C965',
330
+ successLight: '#ADF5CD',
331
+ successLighter: '#DAFBE9',
332
+ successDark: '#06371C',
333
+ warning: '#F5A525',
334
+ warningLight: '#FBDBA8',
335
+ warningLighter: '#FDEFD9',
336
+ warningDark: '#4E3105',
337
+ info: '#06B7DC',
338
+ infoLighter: '#A5EEFE',
339
+ infoLight: '#D7F8FF',
340
+ infoDark: '#053B49',
341
+ purple: '#f81ce5',
342
+ alert: '#ff0080',
343
+ link: '#0070f3',
344
+ pre: '#363450'
345
+ };
346
+ var expressiveness$1 = {
347
+ linkStyle: 'none',
348
+ linkHoverStyle: 'none',
349
+ dropdownBoxShadow: '0 4px 4px 0 rgba(0, 0, 0, 0.02)',
350
+ scrollerStart: 'rgba(255, 255, 255, 1)',
351
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
352
+ shadowSmall: '0 5px 10px rgba(0, 0, 0, 0.12)',
353
+ shadowMedium: '0 8px 30px rgba(0, 0, 0, 0.12)',
354
+ shadowLarge: '0 30px 60px rgba(0, 0, 0, 0.12)',
355
+ portalOpacity: 0.25
356
+ };
357
+ var font$1 = defaultFont;
358
+ var breakpoints$1 = defaultBreakpoints;
359
+ var layout$1 = defaultLayout;
360
+ var themes$1 = {
361
+ type: 'light',
362
+ font: font$1,
363
+ layout: layout$1,
364
+ palette: palette$1,
365
+ breakpoints: breakpoints$1,
366
+ expressiveness: expressiveness$1
367
+ };
368
+ var lightTheme = themes$1;
369
+
370
+ var palette = {
371
+ background: '#000',
372
+ foreground: '#fff',
373
+ accents_1: '#111',
374
+ accents_2: '#333',
375
+ accents_3: '#444',
376
+ accents_4: '#666',
377
+ accents_5: '#888',
378
+ accents_6: '#999',
379
+ accents_7: '#eaeaea',
380
+ accents_8: '#fafafa',
381
+ selection: '#f81ce5',
382
+ code: '#C25FFF',
383
+ border: '#333',
384
+ primary: '#0072F6',
385
+ primaryLight: '#96C1F3',
386
+ primaryLighter: '#CEE4FF',
387
+ primaryDark: '#00254E',
388
+ secondary: '#7828C9',
389
+ secondaryLighter: '#D1B1F1',
390
+ secondaryLight: '#EADCF9',
391
+ secondaryDark: '#290E45',
392
+ error: '#F31261',
393
+ errorLight: '#FAA8C6',
394
+ errorLighter: '#FDD8E6',
395
+ errorDark: '#4E041F',
396
+ success: '#17C965',
397
+ successLight: '#ADF5CD',
398
+ successLighter: '#DAFBE9',
399
+ successDark: '#06371C',
400
+ warning: '#F5A525',
401
+ warningLight: '#FBDBA8',
402
+ warningLighter: '#FDEFD9',
403
+ warningDark: '#4E3105',
404
+ info: '#06B7DC',
405
+ infoLighter: '#A5EEFE',
406
+ infoLight: '#D7F8FF',
407
+ infoDark: '#053B49',
408
+ purple: '#f81ce5',
409
+ alert: '#ff0080',
410
+ link: '#3291ff',
411
+ pre: '#363450'
412
+ };
413
+ var expressiveness = {
414
+ linkStyle: 'none',
415
+ linkHoverStyle: 'none',
416
+ dropdownBoxShadow: '0 0 0 1px #333',
417
+ scrollerStart: 'rgba(255, 255, 255, 1)',
418
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
419
+ shadowSmall: '0 0 0 1px #333',
420
+ shadowMedium: '0 0 0 1px #333',
421
+ shadowLarge: '0 0 0 1px #333',
422
+ portalOpacity: 0.75
423
+ };
424
+ var font = defaultFont;
425
+ var breakpoints = defaultBreakpoints;
426
+ var layout = defaultLayout;
427
+ var themes = {
428
+ type: 'dark',
429
+ font: font,
430
+ layout: layout,
431
+ palette: palette,
432
+ breakpoints: breakpoints,
433
+ expressiveness: expressiveness
434
+ };
435
+ var darkTheme = themes;
436
+
437
+ var isObject = function isObject(target) {
438
+ return target && _typeof(target) === 'object';
439
+ };
440
+ var deepDuplicable = function deepDuplicable(source, target) {
441
+ if (!isObject(target) || !isObject(source)) return source;
442
+ var sourceKeys = Object.keys(source);
443
+ var result = {};
444
+
445
+ for (var _i = 0, _sourceKeys = sourceKeys; _i < _sourceKeys.length; _i++) {
446
+ var key = _sourceKeys[_i];
447
+ var sourceValue = source[key];
448
+ var targetValue = target[key];
449
+
450
+ if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
451
+ result[key] = targetValue.concat(sourceValue);
452
+ } else if (isObject(sourceValue) && isObject(targetValue)) {
453
+ result[key] = deepDuplicable(sourceValue, _objectSpread2({}, targetValue));
454
+ } else if (targetValue) {
455
+ result[key] = targetValue;
456
+ } else {
457
+ result[key] = sourceValue;
458
+ }
459
+ }
460
+
461
+ return result;
462
+ };
463
+
464
+ var getPresets = function getPresets() {
465
+ return [lightTheme, darkTheme];
466
+ };
467
+
468
+ var getPresetStaticTheme = function getPresetStaticTheme() {
469
+ return lightTheme;
470
+ };
471
+
472
+ var isAvailableThemeType = function isAvailableThemeType(type) {
473
+ if (!type) return false;
474
+ var presetThemes = getPresets();
475
+ var hasType = presetThemes.find(function (theme) {
476
+ return theme.type === type;
477
+ });
478
+ return !hasType;
479
+ };
480
+
481
+ var isPresetTheme = function isPresetTheme(themeOrType) {
482
+ if (!themeOrType) return false;
483
+ var isType = typeof themeOrType === 'string';
484
+ var type = isType ? themeOrType : themeOrType.type;
485
+ return !isAvailableThemeType(type);
486
+ };
487
+
488
+ var hasUserCustomTheme = function hasUserCustomTheme() {
489
+ var themes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
490
+ return !!themes.find(function (item) {
491
+ return isAvailableThemeType(item.type);
492
+ });
493
+ };
494
+
495
+ var create = function create(base, custom) {
496
+ if (!isAvailableThemeType(custom.type)) {
497
+ throw new Error('Duplicate or unavailable theme type');
498
+ }
499
+
500
+ return deepDuplicable(base, custom);
501
+ };
502
+
503
+ var createFromDark = function createFromDark(custom) {
504
+ return create(darkTheme, custom);
505
+ };
506
+
507
+ var createFromLight = function createFromLight(custom) {
508
+ return create(lightTheme, custom);
509
+ };
510
+
511
+ var Themes = {
512
+ isPresetTheme: isPresetTheme,
513
+ isAvailableThemeType: isAvailableThemeType,
514
+ hasUserCustomTheme: hasUserCustomTheme,
515
+ getPresets: getPresets,
516
+ getPresetStaticTheme: getPresetStaticTheme,
517
+ create: create,
518
+ createFromDark: createFromDark,
519
+ createFromLight: createFromLight
520
+ };
521
+ var Themes$1 = Themes;
522
+
523
+ var defaultTheme = Themes$1.getPresetStaticTheme();
524
+ var ThemeContext = /*#__PURE__*/React__default["default"].createContext(defaultTheme);
525
+ var useTheme$1 = function useTheme() {
526
+ return React__default["default"].useContext(ThemeContext);
527
+ };
528
+
529
+ var defaultAllThemesConfig = {
530
+ themes: Themes$1.getPresets()
531
+ };
532
+ var AllThemesContext = /*#__PURE__*/React__default["default"].createContext(defaultAllThemesConfig);
533
+
534
+ var ThemeProvider = function ThemeProvider(_ref) {
535
+ var children = _ref.children,
536
+ themeType = _ref.themeType,
537
+ _ref$themes = _ref.themes,
538
+ themes = _ref$themes === void 0 ? [] : _ref$themes;
539
+
540
+ var _useState = React.useState({
541
+ themes: Themes$1.getPresets()
542
+ }),
543
+ _useState2 = _slicedToArray(_useState, 2),
544
+ allThemes = _useState2[0],
545
+ setAllThemes = _useState2[1];
546
+
547
+ var currentTheme = React.useMemo(function () {
548
+ var theme = allThemes.themes.find(function (item) {
549
+ return item.type === themeType;
550
+ });
551
+ if (theme) return theme;
552
+ return Themes$1.getPresetStaticTheme();
553
+ }, [allThemes, themeType]);
554
+ React.useEffect(function () {
555
+ if (!(themes !== null && themes !== void 0 && themes.length)) return;
556
+ setAllThemes(function (last) {
557
+ var safeThemes = themes.filter(function (item) {
558
+ return Themes$1.isAvailableThemeType(item.type);
559
+ });
560
+ var nextThemes = Themes$1.getPresets().concat(safeThemes);
561
+ return _objectSpread2(_objectSpread2({}, last), {}, {
562
+ themes: nextThemes
563
+ });
564
+ });
565
+ }, [themes]);
566
+ return /*#__PURE__*/React__default["default"].createElement(AllThemesContext.Provider, {
567
+ value: allThemes
568
+ }, /*#__PURE__*/React__default["default"].createElement(ThemeContext.Provider, {
569
+ value: currentTheme
570
+ }, children));
571
+ };
572
+
573
+ var ThemeProvider$1 = ThemeProvider;
574
+
575
+ var useCurrentState = function useCurrentState(initialState) {
576
+ var _useState = React.useState(function () {
577
+ return typeof initialState === 'function' ? initialState() : initialState;
578
+ }),
579
+ _useState2 = _slicedToArray(_useState, 2),
580
+ state = _useState2[0],
581
+ setState = _useState2[1];
582
+
583
+ var ref = React.useRef(initialState);
584
+ React.useEffect(function () {
585
+ ref.current = state;
586
+ }, [state]);
587
+
588
+ var setValue = function setValue(val) {
589
+ var result = typeof val === 'function' ? val(ref.current) : val;
590
+ ref.current = result;
591
+ setState(result);
592
+ };
593
+
594
+ return [state, setValue, ref];
595
+ };
596
+
597
+ var useCurrentState$1 = useCurrentState;
598
+
599
+ var getId = function getId() {
600
+ return Math.random().toString(32).slice(2, 10);
601
+ };
602
+ var isBrowser = function isBrowser() {
603
+ return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
604
+ };
605
+ var isCSSNumberValue = function isCSSNumberValue(value) {
606
+ return value !== undefined && !Number.isNaN(+value);
607
+ };
608
+
609
+ var useSSR = function useSSR() {
610
+ var _useState = React.useState(false),
611
+ _useState2 = _slicedToArray(_useState, 2),
612
+ browser = _useState2[0],
613
+ setBrowser = _useState2[1];
614
+
615
+ React.useEffect(function () {
616
+ setBrowser(isBrowser());
617
+ }, []);
618
+ return {
619
+ isBrowser: browser,
620
+ isServer: !browser
621
+ };
622
+ };
623
+
624
+ var useSSR$1 = useSSR;
625
+
626
+ var createElement = function createElement(id) {
627
+ var el = document.createElement('div');
628
+ el.setAttribute('id', id);
629
+ return el;
630
+ };
631
+
632
+ var usePortal = function usePortal() {
633
+ var selectId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getId();
634
+ var getContainer = arguments.length > 1 ? arguments[1] : undefined;
635
+ var id = "bolio-ui-".concat(selectId);
636
+
637
+ var _useSSR = useSSR$1(),
638
+ isBrowser = _useSSR.isBrowser;
639
+
640
+ var _useState = React.useState(isBrowser ? createElement(id) : null),
641
+ _useState2 = _slicedToArray(_useState, 2),
642
+ elSnapshot = _useState2[0],
643
+ setElSnapshot = _useState2[1];
644
+
645
+ React.useEffect(function () {
646
+ var customContainer = getContainer ? getContainer() : null;
647
+ var parentElement = customContainer || document.body;
648
+ var hasElement = parentElement.querySelector("#".concat(id));
649
+ var el = hasElement || createElement(id);
650
+
651
+ if (!hasElement) {
652
+ parentElement.appendChild(el);
653
+ }
654
+
655
+ setElSnapshot(el);
656
+ }, []);
657
+ return elSnapshot;
658
+ };
659
+
660
+ var usePortal$1 = usePortal;
661
+
662
+ var useTheme = useTheme$1;
663
+
664
+ var _excluded$4 = ["children", "className", "visible", "enterTime", "leaveTime", "clearTime", "name"];
665
+ var defaultProps$2 = {
666
+ visible: false,
667
+ enterTime: 60,
668
+ leaveTime: 60,
669
+ clearTime: 60,
670
+ className: '',
671
+ name: 'transition'
672
+ };
673
+
674
+ function CssTransition(_ref) {
675
+ var children = _ref.children,
676
+ className = _ref.className,
677
+ visible = _ref.visible,
678
+ enterTime = _ref.enterTime,
679
+ leaveTime = _ref.leaveTime,
680
+ clearTime = _ref.clearTime,
681
+ name = _ref.name,
682
+ props = _objectWithoutProperties(_ref, _excluded$4);
683
+
684
+ var _useState = React.useState(''),
685
+ _useState2 = _slicedToArray(_useState, 2),
686
+ classes = _useState2[0],
687
+ setClasses = _useState2[1];
688
+
689
+ var _useState3 = React.useState(visible),
690
+ _useState4 = _slicedToArray(_useState3, 2),
691
+ renderable = _useState4[0],
692
+ setRenderable = _useState4[1];
693
+
694
+ React.useEffect(function () {
695
+ var statusClassName = visible ? 'enter' : 'leave';
696
+ var time = visible ? enterTime : leaveTime;
697
+
698
+ if (visible && !renderable) {
699
+ setRenderable(true);
700
+ }
701
+
702
+ setClasses("".concat(name, "-").concat(statusClassName)); // set class to active
703
+
704
+ var timer = setTimeout(function () {
705
+ setClasses("".concat(name, "-").concat(statusClassName, " ").concat(name, "-").concat(statusClassName, "-active"));
706
+ clearTimeout(timer);
707
+ }, time); // remove classess when animation over
708
+
709
+ var clearClassesTimer = setTimeout(function () {
710
+ if (!visible) {
711
+ setClasses('');
712
+ setRenderable(false);
713
+ }
714
+
715
+ clearTimeout(clearClassesTimer);
716
+ }, time + clearTime);
717
+ return function () {
718
+ clearTimeout(timer);
719
+ clearTimeout(clearClassesTimer);
720
+ };
721
+ }, [visible, renderable]);
722
+ if (! /*#__PURE__*/React__default["default"].isValidElement(children) || !renderable) return null;
723
+ return /*#__PURE__*/React__default["default"].cloneElement(children, _objectSpread2(_objectSpread2({}, props), {}, {
724
+ className: "".concat(children.props.className, " ").concat(className, " ").concat(classes)
725
+ }));
726
+ }
727
+
728
+ CssTransition.defaultProps = defaultProps$2;
729
+ CssTransition.displayName = 'BolioUICssTransition';
730
+
731
+ 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'];
732
+
733
+ var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
734
+ return "".concat(scale1x);
735
+ };
736
+
737
+ var defaultContext$1 = {
738
+ getScaleProps: function getScaleProps() {
739
+ return undefined;
740
+ },
741
+ getAllScaleProps: function getAllScaleProps() {
742
+ return {};
743
+ },
744
+ SCALES: {
745
+ pl: defaultDynamicLayoutPipe,
746
+ pr: defaultDynamicLayoutPipe,
747
+ pb: defaultDynamicLayoutPipe,
748
+ pt: defaultDynamicLayoutPipe,
749
+ px: defaultDynamicLayoutPipe,
750
+ py: defaultDynamicLayoutPipe,
751
+ mb: defaultDynamicLayoutPipe,
752
+ ml: defaultDynamicLayoutPipe,
753
+ mr: defaultDynamicLayoutPipe,
754
+ mt: defaultDynamicLayoutPipe,
755
+ mx: defaultDynamicLayoutPipe,
756
+ my: defaultDynamicLayoutPipe,
757
+ width: defaultDynamicLayoutPipe,
758
+ height: defaultDynamicLayoutPipe,
759
+ font: defaultDynamicLayoutPipe
760
+ },
761
+ unit: '16px'
762
+ };
763
+ var ScaleContext = /*#__PURE__*/React__default["default"].createContext(defaultContext$1);
764
+ var useScale$1 = function useScale() {
765
+ return React__default["default"].useContext(ScaleContext);
766
+ };
767
+
768
+ var generateGetScaleProps = function generateGetScaleProps(props) {
769
+ var getScaleProps = function getScaleProps(keyOrKeys) {
770
+ if (!Array.isArray(keyOrKeys)) return props[keyOrKeys];
771
+ var value = undefined;
772
+
773
+ var _iterator = _createForOfIteratorHelper(keyOrKeys),
774
+ _step;
775
+
776
+ try {
777
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
778
+ var key = _step.value;
779
+ var currentValue = props[key];
780
+
781
+ if (typeof currentValue !== 'undefined') {
782
+ value = currentValue;
783
+ }
784
+ }
785
+ } catch (err) {
786
+ _iterator.e(err);
787
+ } finally {
788
+ _iterator.f();
789
+ }
790
+
791
+ return value;
792
+ };
793
+
794
+ return getScaleProps;
795
+ };
796
+ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
797
+ var getAllScaleProps = function getAllScaleProps() {
798
+ var scaleProps = {};
799
+
800
+ var _iterator2 = _createForOfIteratorHelper(ScalePropKeys),
801
+ _step2;
802
+
803
+ try {
804
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
805
+ var key = _step2.value;
806
+ var value = props[key];
807
+
808
+ if (typeof value !== 'undefined') {
809
+ scaleProps[key] = value;
810
+ }
811
+ }
812
+ } catch (err) {
813
+ _iterator2.e(err);
814
+ } finally {
815
+ _iterator2.f();
816
+ }
817
+
818
+ return scaleProps;
819
+ };
820
+
821
+ return getAllScaleProps;
822
+ };
823
+
824
+ var _excluded$3 = ["children"],
825
+ _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"];
826
+
827
+ var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
828
+ if (scale === 1) return scale;
829
+ var diff = Math.abs((scale - 1) / 2);
830
+ return scale > 1 ? 1 + diff : 1 - diff;
831
+ }; // eslint-disable-next-line @typescript-eslint/ban-types
832
+
833
+
834
+ var withScale = function withScale(Render) {
835
+ var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
836
+ 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;
837
+
838
+ var children = _ref.children,
839
+ props = _objectWithoutProperties(_ref, _excluded$3);
840
+
841
+ var _useTheme = useTheme(),
842
+ layout = _useTheme.layout;
843
+
844
+ var paddingLeft = props.paddingLeft,
845
+ pl = props.pl,
846
+ paddingRight = props.paddingRight,
847
+ pr = props.pr,
848
+ paddingTop = props.paddingTop,
849
+ pt = props.pt,
850
+ paddingBottom = props.paddingBottom,
851
+ pb = props.pb,
852
+ marginTop = props.marginTop,
853
+ mt = props.mt,
854
+ marginRight = props.marginRight,
855
+ mr = props.mr,
856
+ marginBottom = props.marginBottom,
857
+ mb = props.mb,
858
+ marginLeft = props.marginLeft,
859
+ ml = props.ml,
860
+ px = props.px,
861
+ py = props.py,
862
+ mx = props.mx,
863
+ my = props.my,
864
+ width = props.width,
865
+ height = props.height,
866
+ font = props.font,
867
+ w = props.w,
868
+ h = props.h,
869
+ margin = props.margin,
870
+ padding = props.padding,
871
+ _props$unit = props.unit,
872
+ unit = _props$unit === void 0 ? layout.unit : _props$unit,
873
+ _props$scale = props.scale,
874
+ scale = _props$scale === void 0 ? 1 : _props$scale,
875
+ innerProps = _objectWithoutProperties(props, _excluded2);
876
+
877
+ var makeScaleHandler = function makeScaleHandler(attrValue) {
878
+ return function (scale1x, defaultValue) {
879
+ // 0 means disable scale and the default value is 0
880
+ if (scale1x === 0) {
881
+ scale1x = 1;
882
+ defaultValue = defaultValue || 0;
883
+ }
884
+
885
+ var factor = reduceScaleCoefficient(scale) * scale1x;
886
+
887
+ if (typeof attrValue === 'undefined') {
888
+ if (typeof defaultValue !== 'undefined') return "".concat(defaultValue);
889
+ return "calc(".concat(factor, " * ").concat(unit, ")");
890
+ }
891
+
892
+ if (!isCSSNumberValue(attrValue)) return "".concat(attrValue);
893
+ var customFactor = factor * Number(attrValue);
894
+ return "calc(".concat(customFactor, " * ").concat(unit, ")");
895
+ };
896
+ };
897
+
898
+ var value = {
899
+ unit: unit,
900
+ SCALES: {
901
+ pt: makeScaleHandler((_ref2 = (_ref3 = paddingTop !== null && paddingTop !== void 0 ? paddingTop : pt) !== null && _ref3 !== void 0 ? _ref3 : py) !== null && _ref2 !== void 0 ? _ref2 : padding),
902
+ pr: makeScaleHandler((_ref4 = (_ref5 = paddingRight !== null && paddingRight !== void 0 ? paddingRight : pr) !== null && _ref5 !== void 0 ? _ref5 : px) !== null && _ref4 !== void 0 ? _ref4 : padding),
903
+ pb: makeScaleHandler((_ref6 = (_ref7 = paddingBottom !== null && paddingBottom !== void 0 ? paddingBottom : pb) !== null && _ref7 !== void 0 ? _ref7 : py) !== null && _ref6 !== void 0 ? _ref6 : padding),
904
+ pl: makeScaleHandler((_ref8 = (_ref9 = paddingLeft !== null && paddingLeft !== void 0 ? paddingLeft : pl) !== null && _ref9 !== void 0 ? _ref9 : px) !== null && _ref8 !== void 0 ? _ref8 : padding),
905
+ 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),
906
+ 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),
907
+ mt: makeScaleHandler((_ref18 = (_ref19 = marginTop !== null && marginTop !== void 0 ? marginTop : mt) !== null && _ref19 !== void 0 ? _ref19 : my) !== null && _ref18 !== void 0 ? _ref18 : margin),
908
+ mr: makeScaleHandler((_ref20 = (_ref21 = marginRight !== null && marginRight !== void 0 ? marginRight : mr) !== null && _ref21 !== void 0 ? _ref21 : mx) !== null && _ref20 !== void 0 ? _ref20 : margin),
909
+ mb: makeScaleHandler((_ref22 = (_ref23 = marginBottom !== null && marginBottom !== void 0 ? marginBottom : mb) !== null && _ref23 !== void 0 ? _ref23 : my) !== null && _ref22 !== void 0 ? _ref22 : margin),
910
+ ml: makeScaleHandler((_ref24 = (_ref25 = marginLeft !== null && marginLeft !== void 0 ? marginLeft : ml) !== null && _ref25 !== void 0 ? _ref25 : mx) !== null && _ref24 !== void 0 ? _ref24 : margin),
911
+ 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),
912
+ 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),
913
+ width: makeScaleHandler(width !== null && width !== void 0 ? width : w),
914
+ height: makeScaleHandler(height !== null && height !== void 0 ? height : h),
915
+ font: makeScaleHandler(font)
916
+ },
917
+ getScaleProps: generateGetScaleProps(props),
918
+ getAllScaleProps: generateGetAllScaleProps(props)
919
+ };
920
+ return /*#__PURE__*/React__default["default"].createElement(ScaleContext.Provider, {
921
+ value: value
922
+ }, /*#__PURE__*/React__default["default"].createElement(Render, _extends({}, innerProps, {
923
+ ref: ref
924
+ }), children));
925
+ });
926
+ ScaleFC.displayName = "Scale".concat(Render.displayName || 'Wrapper');
927
+ return ScaleFC;
928
+ };
929
+
930
+ var withScale$1 = withScale;
931
+
932
+ var useScale = useScale$1;
933
+
934
+ var defaultProps$1 = {
935
+ x: 0,
936
+ y: 0
937
+ };
938
+
939
+ var ButtonDrip = function ButtonDrip(_ref) {
940
+ var x = _ref.x,
941
+ y = _ref.y,
942
+ color = _ref.color,
943
+ onCompleted = _ref.onCompleted;
944
+ var dripRef = React.useRef(null);
945
+ var top = Number.isNaN(+y) ? 0 : y - 10;
946
+ var left = Number.isNaN(+x) ? 0 : x - 10;
947
+ React.useEffect(function () {
948
+ if (!dripRef.current) return;
949
+ dripRef.current.addEventListener('animationend', onCompleted);
950
+ return function () {
951
+ if (!dripRef.current) return;
952
+ dripRef.current.removeEventListener('animationend', onCompleted);
953
+ };
954
+ });
955
+ return /*#__PURE__*/React__default["default"].createElement("div", {
956
+ ref: dripRef,
957
+ className: "jsx-3424889537" + " " + "drip"
958
+ }, /*#__PURE__*/React__default["default"].createElement("svg", {
959
+ width: "20",
960
+ height: "20",
961
+ viewBox: "0 0 20 20",
962
+ style: {
963
+ top: top,
964
+ left: left
965
+ },
966
+ className: "jsx-3424889537"
967
+ }, /*#__PURE__*/React__default["default"].createElement("g", {
968
+ stroke: "none",
969
+ strokeWidth: "1",
970
+ fill: "none",
971
+ fillRule: "evenodd",
972
+ className: "jsx-3424889537"
973
+ }, /*#__PURE__*/React__default["default"].createElement("g", {
974
+ fill: color,
975
+ className: "jsx-3424889537"
976
+ }, /*#__PURE__*/React__default["default"].createElement("rect", {
977
+ width: "100%",
978
+ height: "100%",
979
+ rx: "10",
980
+ className: "jsx-3424889537"
981
+ })))), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
982
+ id: "3424889537"
983
+ }, ".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;}}"));
984
+ };
985
+
986
+ ButtonDrip.defaultProps = defaultProps$1;
987
+ ButtonDrip.displayName = 'BolioUItButtonDrip';
988
+ var ButtonDrip$1 = ButtonDrip;
989
+
990
+ var classObjectToString = function classObjectToString(className) {
991
+ var keys = Object.keys(className);
992
+ var len = keys.length;
993
+ var str = '';
994
+
995
+ for (var index = 0; index < len; index++) {
996
+ var key = keys[index];
997
+ var val = className[keys[index]];
998
+ if (!val) continue;
999
+ str = str ? "".concat(str, " ").concat(String(key)) : String(key);
1000
+ }
1001
+
1002
+ return str;
1003
+ };
1004
+
1005
+ var isObjectClassName = function isObjectClassName(value) {
1006
+ return _typeof(value) === 'object' && !Array.isArray(value);
1007
+ };
1008
+
1009
+ var useClasses = function useClasses() {
1010
+ var len = arguments.length;
1011
+ var classes = '';
1012
+ if (len === 0) return classes;
1013
+
1014
+ for (var index = 0; index < len; index++) {
1015
+ var val = index < 0 || arguments.length <= index ? undefined : arguments[index];
1016
+ if (!val) continue;
1017
+
1018
+ if (isObjectClassName(val)) {
1019
+ classes += " ".concat(classObjectToString(val));
1020
+ } else {
1021
+ classes += " ".concat(String(val).trim());
1022
+ }
1023
+ }
1024
+
1025
+ return classes.trim();
1026
+ };
1027
+
1028
+ var useClasses$1 = useClasses;
1029
+
1030
+ var _excluded$2 = ["children", "type", "color", "className", "spaceRatio"];
1031
+
1032
+ var getIconBgColor = function getIconBgColor(type, palette, color) {
1033
+ var colors = {
1034
+ "default": palette.accents_6,
1035
+ primary: palette.primary,
1036
+ secondary: palette.secondary,
1037
+ success: palette.success,
1038
+ warning: palette.warning,
1039
+ error: palette.error,
1040
+ info: palette.info
1041
+ };
1042
+ return color ? color : colors[type];
1043
+ };
1044
+
1045
+ function LoadingComponent(_ref) {
1046
+ var children = _ref.children,
1047
+ _ref$type = _ref.type,
1048
+ type = _ref$type === void 0 ? 'default' : _ref$type,
1049
+ color = _ref.color,
1050
+ _ref$className = _ref.className,
1051
+ className = _ref$className === void 0 ? '' : _ref$className,
1052
+ _ref$spaceRatio = _ref.spaceRatio,
1053
+ spaceRatio = _ref$spaceRatio === void 0 ? 1 : _ref$spaceRatio,
1054
+ props = _objectWithoutProperties(_ref, _excluded$2);
1055
+
1056
+ var theme = useTheme();
1057
+
1058
+ var _useScale = useScale(),
1059
+ SCALES = _useScale.SCALES;
1060
+
1061
+ var classes = useClasses$1('loading-container', className);
1062
+ var bgColor = React.useMemo(function () {
1063
+ return getIconBgColor(type, theme.palette, color);
1064
+ }, [type, theme.palette, color]);
1065
+ return /*#__PURE__*/React__default["default"].createElement("div", _extends({}, props, {
1066
+ 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 || "")
1067
+ }), /*#__PURE__*/React__default["default"].createElement("span", {
1068
+ 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"
1069
+ }, children && /*#__PURE__*/React__default["default"].createElement("label", {
1070
+ 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]]])
1071
+ }, children), /*#__PURE__*/React__default["default"].createElement("i", {
1072
+ 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]]])
1073
+ }), /*#__PURE__*/React__default["default"].createElement("i", {
1074
+ 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]]])
1075
+ }), /*#__PURE__*/React__default["default"].createElement("i", {
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]]])
1077
+ })), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1078
+ id: "3790031813",
1079
+ 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]
1080
+ }, ".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;}}")));
1081
+ }
1082
+
1083
+ LoadingComponent.displayName = 'BolioUILoading';
1084
+ var Loading = withScale$1(LoadingComponent);
1085
+ var Loading$1 = Loading;
1086
+
1087
+ function ButtonLoading(_ref) {
1088
+ var color = _ref.color;
1089
+ return /*#__PURE__*/React__default["default"].createElement("div", {
1090
+ className: "jsx-412966635" + " " + "btn-loading"
1091
+ }, /*#__PURE__*/React__default["default"].createElement(Loading$1, {
1092
+ color: color
1093
+ }), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1094
+ id: "412966635"
1095
+ }, ".btn-loading.jsx-412966635{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;background-color:var(--bolio-ui-button-bg);}"));
1096
+ }
1097
+
1098
+ ButtonLoading.displayName = 'BolioUIButtonLoading';
1099
+
1100
+ var _excluded$1 = ["isRight", "isSingle", "children", "className"];
1101
+
1102
+ function ButtonIcon(_ref) {
1103
+ var _ref$isRight = _ref.isRight,
1104
+ isRight = _ref$isRight === void 0 ? false : _ref$isRight,
1105
+ isSingle = _ref.isSingle,
1106
+ children = _ref.children,
1107
+ _ref$className = _ref.className,
1108
+ className = _ref$className === void 0 ? '' : _ref$className,
1109
+ props = _objectWithoutProperties(_ref, _excluded$1);
1110
+
1111
+ var classes = useClasses$1('icon', {
1112
+ right: isRight,
1113
+ single: isSingle
1114
+ }, className);
1115
+ return /*#__PURE__*/React__default["default"].createElement("span", _extends({}, props, {
1116
+ className: "jsx-2499243154" + " " + (props && props.className != null && props.className || classes || "")
1117
+ }), children, /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1118
+ id: "2499243154"
1119
+ }, ".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;}"));
1120
+ }
1121
+
1122
+ ButtonIcon.displayName = 'BolioUIButtonIcon';
1123
+
1124
+ var getButtonChildrenWithIcon = function getButtonChildrenWithIcon() {
1125
+ var auto = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1126
+ var children = arguments.length > 1 ? arguments[1] : undefined;
1127
+ var icons = arguments.length > 2 ? arguments[2] : undefined;
1128
+ var icon = icons.icon,
1129
+ iconRight = icons.iconRight;
1130
+ var hasIcon = icon || iconRight;
1131
+ var isRight = Boolean(iconRight);
1132
+ 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
1133
+
1134
+ var classes = useClasses$1('text', isRight ? 'right' : 'left');
1135
+ if (!hasIcon) return /*#__PURE__*/React__default["default"].createElement("div", {
1136
+ className: "text"
1137
+ }, children);
1138
+
1139
+ if (React__default["default"].Children.count(children) === 0) {
1140
+ return /*#__PURE__*/React__default["default"].createElement(ButtonIcon, {
1141
+ isRight: isRight,
1142
+ isSingle: true
1143
+ }, hasIcon);
1144
+ }
1145
+
1146
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(ButtonIcon, {
1147
+ isRight: isRight
1148
+ }, hasIcon), /*#__PURE__*/React__default["default"].createElement("div", {
1149
+ className: styledJsx_cjs.style.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || "")
1150
+ }, children, /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1151
+ id: "3568181479",
1152
+ dynamic: [paddingForAutoMode, paddingForAutoMode]
1153
+ }, ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}"))));
1154
+ };
1155
+ var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
1156
+ if (!config.isButtonGroup) return props;
1157
+ return _objectSpread2(_objectSpread2({}, props), {}, {
1158
+ auto: true,
1159
+ shadow: false,
1160
+ ghost: config.ghost || props.ghost,
1161
+ type: config.type || props.type,
1162
+ disabled: config.disabled || props.disabled
1163
+ });
1164
+ };
1165
+
1166
+ var defaultContext = {
1167
+ isButtonGroup: false,
1168
+ disabled: false
1169
+ };
1170
+ var ButtonGroupContext = /*#__PURE__*/React__default["default"].createContext(defaultContext);
1171
+ var useButtonGroupContext = function useButtonGroupContext() {
1172
+ return React__default["default"].useContext(ButtonGroupContext);
1173
+ };
1174
+
1175
+ var hexToRgb = function hexToRgb(color) {
1176
+ var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
1177
+ var full = color.replace(fullReg, function (_, r, g, b) {
1178
+ return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
1179
+ });
1180
+ var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
1181
+
1182
+ if (!values) {
1183
+ throw new Error("Bolio UI: Unsupported ".concat(color, " color."));
1184
+ }
1185
+
1186
+ return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
1187
+ };
1188
+
1189
+ var colorToRgbValues = function colorToRgbValues(color) {
1190
+ if (color.charAt(0) === '#') return hexToRgb(color);
1191
+ var safeColor = color.replace(/ /g, '');
1192
+ var colorType = color.substr(0, 4);
1193
+ var regArray = safeColor.match(/\((.+)\)/);
1194
+
1195
+ if (!colorType.startsWith('rgb') || !regArray) {
1196
+ console.log(color);
1197
+ throw new Error("Bolio UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
1198
+ }
1199
+
1200
+ return regArray[1].split(',').map(function (str) {
1201
+ return Number.parseFloat(str);
1202
+ });
1203
+ };
1204
+ var addColorAlpha = function addColorAlpha(color, alpha) {
1205
+ if (!/^#|rgb|RGB/.test(color)) return color;
1206
+
1207
+ var _colorToRgbValues = colorToRgbValues(color),
1208
+ _colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
1209
+ r = _colorToRgbValues2[0],
1210
+ g = _colorToRgbValues2[1],
1211
+ b = _colorToRgbValues2[2];
1212
+
1213
+ var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
1214
+ return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
1215
+ };
1216
+
1217
+ var getButtonGhostColors = function getButtonGhostColors(palette, type) {
1218
+ var colors = {
1219
+ primary: {
1220
+ bg: palette.background,
1221
+ border: palette.primary,
1222
+ color: palette.primary
1223
+ },
1224
+ secondary: {
1225
+ bg: palette.background,
1226
+ border: palette.secondary,
1227
+ color: palette.secondary
1228
+ },
1229
+ success: {
1230
+ bg: palette.background,
1231
+ border: palette.success,
1232
+ color: palette.success
1233
+ },
1234
+ warning: {
1235
+ bg: palette.background,
1236
+ border: palette.warning,
1237
+ color: palette.warning
1238
+ },
1239
+ error: {
1240
+ bg: palette.background,
1241
+ border: palette.error,
1242
+ color: palette.error
1243
+ },
1244
+ info: {
1245
+ bg: palette.background,
1246
+ border: palette.info,
1247
+ color: palette.info
1248
+ }
1249
+ };
1250
+ return colors[type] || null;
1251
+ };
1252
+ var getButtonColors = function getButtonColors(palette, props) {
1253
+ var type = props.type,
1254
+ disabled = props.disabled,
1255
+ ghost = props.ghost;
1256
+ var colors = {
1257
+ "default": {
1258
+ bg: palette.background,
1259
+ border: palette.border,
1260
+ color: palette.accents_5
1261
+ },
1262
+ primary: {
1263
+ bg: palette.primary,
1264
+ border: palette.primary,
1265
+ color: '#fff'
1266
+ },
1267
+ secondary: {
1268
+ bg: palette.secondary,
1269
+ border: palette.secondary,
1270
+ color: '#fff'
1271
+ },
1272
+ success: {
1273
+ bg: palette.success,
1274
+ border: palette.success,
1275
+ color: '#fff'
1276
+ },
1277
+ warning: {
1278
+ bg: palette.warning,
1279
+ border: palette.warning,
1280
+ color: '#fff'
1281
+ },
1282
+ error: {
1283
+ bg: palette.error,
1284
+ border: palette.error,
1285
+ color: '#fff'
1286
+ },
1287
+ info: {
1288
+ bg: palette.info,
1289
+ border: palette.info,
1290
+ color: '#fff'
1291
+ },
1292
+ abort: {
1293
+ bg: 'transparent',
1294
+ border: 'transparent',
1295
+ color: palette.accents_5
1296
+ }
1297
+ };
1298
+ if (disabled) return {
1299
+ bg: palette.accents_1,
1300
+ border: palette.accents_2,
1301
+ color: '#ccc'
1302
+ };
1303
+ /**
1304
+ * The '-light' type is the same color as the common type,
1305
+ * only hover's color is different.
1306
+ * e.g.
1307
+ * Color['success'] === Color['success-light']
1308
+ * Color['warning'] === Color['warning-light']
1309
+ */
1310
+
1311
+ var withoutLightType = type === null || type === void 0 ? void 0 : type.replace('-light', '');
1312
+ var defaultColor = colors["default"];
1313
+ if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
1314
+ return colors[withoutLightType] || defaultColor;
1315
+ };
1316
+ var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, type) {
1317
+ var colors = {
1318
+ primary: {
1319
+ bg: palette.primary,
1320
+ border: palette.background,
1321
+ color: 'white'
1322
+ },
1323
+ secondary: {
1324
+ bg: palette.secondary,
1325
+ border: palette.background,
1326
+ color: 'white'
1327
+ },
1328
+ success: {
1329
+ bg: palette.success,
1330
+ border: palette.background,
1331
+ color: 'white'
1332
+ },
1333
+ warning: {
1334
+ bg: palette.warning,
1335
+ border: palette.background,
1336
+ color: 'white'
1337
+ },
1338
+ error: {
1339
+ bg: palette.error,
1340
+ border: palette.background,
1341
+ color: 'white'
1342
+ },
1343
+ info: {
1344
+ bg: palette.info,
1345
+ border: palette.background,
1346
+ color: 'white'
1347
+ }
1348
+ };
1349
+ var withoutLightType = type.replace('-light', '');
1350
+ return colors[withoutLightType] || null;
1351
+ };
1352
+ var getButtonHoverColors = function getButtonHoverColors(palette, props) {
1353
+ var type = props.type,
1354
+ disabled = props.disabled,
1355
+ loading = props.loading,
1356
+ shadow = props.shadow,
1357
+ ghost = props.ghost;
1358
+ var defaultColor = getButtonColors(palette, props);
1359
+ var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
1360
+ var colors = {
1361
+ "default": {
1362
+ bg: palette.background,
1363
+ border: palette.foreground
1364
+ },
1365
+ primary: {
1366
+ bg: palette.background,
1367
+ border: palette.primary
1368
+ },
1369
+ secondary: {
1370
+ bg: palette.background,
1371
+ border: palette.secondary
1372
+ },
1373
+ success: {
1374
+ bg: palette.background,
1375
+ border: palette.success
1376
+ },
1377
+ warning: {
1378
+ bg: palette.background,
1379
+ border: palette.warning
1380
+ },
1381
+ error: {
1382
+ bg: palette.background,
1383
+ border: palette.error
1384
+ },
1385
+ info: {
1386
+ bg: palette.background,
1387
+ border: palette.info
1388
+ },
1389
+ abort: {
1390
+ bg: 'transparent',
1391
+ border: 'transparent',
1392
+ color: palette.accents_5
1393
+ },
1394
+ 'primary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1395
+ bg: alphaBackground
1396
+ }),
1397
+ 'secondary-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1398
+ bg: alphaBackground
1399
+ }),
1400
+ 'success-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1401
+ bg: alphaBackground
1402
+ }),
1403
+ 'warning-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1404
+ bg: alphaBackground
1405
+ }),
1406
+ 'error-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1407
+ bg: alphaBackground
1408
+ }),
1409
+ 'info-light': _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1410
+ bg: alphaBackground
1411
+ })
1412
+ };
1413
+ if (disabled) return {
1414
+ bg: palette.accents_1,
1415
+ border: palette.accents_2,
1416
+ color: '#ccc'
1417
+ };
1418
+ if (loading) return _objectSpread2(_objectSpread2({}, defaultColor), {}, {
1419
+ color: 'transparent'
1420
+ });
1421
+ if (shadow) return defaultColor;
1422
+ var hoverColor = (ghost ? getButtonGhostHoverColors(palette, type) : colors[type]) || colors["default"];
1423
+ return _objectSpread2(_objectSpread2({}, hoverColor), {}, {
1424
+ color: hoverColor.color || hoverColor.border
1425
+ });
1426
+ };
1427
+ var getButtonCursor = function getButtonCursor(disabled, loading) {
1428
+ if (disabled) return {
1429
+ cursor: 'not-allowed',
1430
+ events: 'auto'
1431
+ };
1432
+ if (loading) return {
1433
+ cursor: 'default',
1434
+ events: 'none'
1435
+ };
1436
+ return {
1437
+ cursor: 'pointer',
1438
+ events: 'auto'
1439
+ };
1440
+ };
1441
+ var getButtonDripColor = function getButtonDripColor(palette, props) {
1442
+ var type = props.type;
1443
+ var isLightHover = type === null || type === void 0 ? void 0 : type.endsWith('light');
1444
+ var hoverColors = getButtonHoverColors(palette, props);
1445
+ return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
1446
+ };
1447
+
1448
+ var _excluded = ["children", "disabled", "type", "loading", "shadow", "ghost", "rounded", "effect", "onClick", "auto", "icon", "htmlType", "iconRight", "className"];
1449
+ var defaultProps = {
1450
+ type: 'default',
1451
+ htmlType: 'button',
1452
+ ghost: false,
1453
+ rounded: false,
1454
+ loading: false,
1455
+ shadow: false,
1456
+ auto: false,
1457
+ effect: true,
1458
+ disabled: false,
1459
+ className: ''
1460
+ };
1461
+ var ButtonComponent = /*#__PURE__*/React__default["default"].forwardRef(function (btnProps, ref) {
1462
+ var theme = useTheme();
1463
+
1464
+ var _useScale = useScale(),
1465
+ SCALES = _useScale.SCALES;
1466
+
1467
+ var buttonRef = React.useRef(null);
1468
+ React.useImperativeHandle(ref, function () {
1469
+ return buttonRef.current;
1470
+ });
1471
+
1472
+ var _useState = React.useState(false),
1473
+ _useState2 = _slicedToArray(_useState, 2),
1474
+ dripShow = _useState2[0],
1475
+ setDripShow = _useState2[1];
1476
+
1477
+ var _useState3 = React.useState(0),
1478
+ _useState4 = _slicedToArray(_useState3, 2),
1479
+ dripX = _useState4[0],
1480
+ setDripX = _useState4[1];
1481
+
1482
+ var _useState5 = React.useState(0),
1483
+ _useState6 = _slicedToArray(_useState5, 2),
1484
+ dripY = _useState6[0],
1485
+ setDripY = _useState6[1];
1486
+
1487
+ var groupConfig = useButtonGroupContext();
1488
+ var filteredProps = filterPropsWithGroup(btnProps, groupConfig);
1489
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1490
+
1491
+ var children = filteredProps.children,
1492
+ disabled = filteredProps.disabled;
1493
+ filteredProps.type;
1494
+ var loading = filteredProps.loading,
1495
+ shadow = filteredProps.shadow;
1496
+ filteredProps.ghost;
1497
+ var rounded = filteredProps.rounded,
1498
+ effect = filteredProps.effect,
1499
+ onClick = filteredProps.onClick,
1500
+ auto = filteredProps.auto,
1501
+ icon = filteredProps.icon,
1502
+ htmlType = filteredProps.htmlType,
1503
+ iconRight = filteredProps.iconRight,
1504
+ className = filteredProps.className,
1505
+ props = _objectWithoutProperties(filteredProps, _excluded);
1506
+ /* eslint-enable @typescript-eslint/no-unused-vars */
1507
+
1508
+
1509
+ var _useMemo = React.useMemo(function () {
1510
+ return getButtonColors(theme.palette, filteredProps);
1511
+ }, [theme.palette, filteredProps]),
1512
+ bg = _useMemo.bg,
1513
+ border = _useMemo.border,
1514
+ color = _useMemo.color;
1515
+
1516
+ var hover = React.useMemo(function () {
1517
+ return getButtonHoverColors(theme.palette, filteredProps);
1518
+ }, [theme.palette, filteredProps]);
1519
+
1520
+ var _useMemo2 = React.useMemo(function () {
1521
+ return getButtonCursor(disabled, loading);
1522
+ }, [disabled, loading]),
1523
+ cursor = _useMemo2.cursor,
1524
+ events = _useMemo2.events;
1525
+
1526
+ var dripColor = React.useMemo(function () {
1527
+ return getButtonDripColor(theme.palette, filteredProps);
1528
+ }, [theme.palette, filteredProps]);
1529
+
1530
+ var dripCompletedHandle = function dripCompletedHandle() {
1531
+ setDripShow(false);
1532
+ setDripX(0);
1533
+ setDripY(0);
1534
+ };
1535
+
1536
+ var clickHandler = function clickHandler(event) {
1537
+ if (disabled || loading) return;
1538
+ var showDrip = effect;
1539
+
1540
+ if (showDrip && buttonRef.current) {
1541
+ var rect = buttonRef.current.getBoundingClientRect();
1542
+ setDripShow(true);
1543
+ setDripX(event.clientX - rect.left);
1544
+ setDripY(event.clientY - rect.top);
1545
+ }
1546
+
1547
+ onClick && onClick(event);
1548
+ };
1549
+
1550
+ var childrenWithIcon = React.useMemo(function () {
1551
+ return getButtonChildrenWithIcon(auto, children, {
1552
+ icon: icon,
1553
+ iconRight: iconRight
1554
+ });
1555
+ }, [auto, children, icon, iconRight]);
1556
+ var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.15),
1557
+ paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.15);
1558
+ return /*#__PURE__*/React__default["default"].createElement("button", _extends({
1559
+ ref: buttonRef,
1560
+ type: htmlType,
1561
+ disabled: disabled,
1562
+ onClick: clickHandler
1563
+ }, props, {
1564
+ 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) || "")
1565
+ }), loading && /*#__PURE__*/React__default["default"].createElement(ButtonLoading, {
1566
+ color: color
1567
+ }), childrenWithIcon, dripShow && /*#__PURE__*/React__default["default"].createElement(ButtonDrip$1, {
1568
+ x: dripX,
1569
+ y: dripY,
1570
+ color: dripColor,
1571
+ onCompleted: dripCompletedHandle
1572
+ }), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1573
+ id: "3337261033",
1574
+ 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]
1575
+ }, ".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;}")));
1576
+ });
1577
+ ButtonComponent.defaultProps = defaultProps;
1578
+ ButtonComponent.displayName = 'BolioUIButton';
1579
+ var Button = withScale$1(ButtonComponent);
1580
+ var Button$1 = Button;
1581
+
1582
+ var tuple = function tuple() {
1583
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1584
+ args[_key] = arguments[_key];
1585
+ }
1586
+
1587
+ return args;
1588
+ };
1589
+ tuple('default', 'primary', 'secondary', 'info', 'success', 'warning', 'error', 'abort', 'primary-light', 'secondary-light', 'info-light', 'success-light', 'warning-light', 'error-light');
1590
+ tuple('default', 'primary', 'secondary', 'success', 'warning', 'error', 'info');
1591
+ tuple('default', 'primary', 'secondary', 'success', 'warning', 'error', 'info', 'dark', 'lite');
1592
+ tuple('default', 'primary', 'secondary', 'success', 'warning', 'error', 'dark', 'lite', 'info');
1593
+ tuple('default', 'silent', 'prevent');
1594
+ tuple('hover', 'click');
1595
+ tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
1596
+ tuple('start', 'center', 'end', 'left', 'right');
1597
+
1598
+ var makeToastActions = function makeToastActions(actions, cancelHandle) {
1599
+ var handler = function handler(event, userHandler) {
1600
+ userHandler && userHandler(event, cancelHandle);
1601
+ };
1602
+
1603
+ if (!actions || !actions.length) return null;
1604
+ return actions.map(function (action, index) {
1605
+ return /*#__PURE__*/React__default["default"].createElement(Button$1, {
1606
+ auto: true,
1607
+ scale: 1 / 3,
1608
+ font: "13px",
1609
+ type: action.passive ? 'default' : 'primary',
1610
+ key: "action-".concat(index),
1611
+ onClick: function onClick(event) {
1612
+ return handler(event, action.handler);
1613
+ }
1614
+ }, action.name);
1615
+ });
1616
+ };
1617
+ var getColors = function getColors(palette, type) {
1618
+ var colors = {
1619
+ "default": palette.background,
1620
+ primary: palette.primary,
1621
+ secondary: palette.secondary,
1622
+ success: palette.success,
1623
+ warning: palette.warning,
1624
+ error: palette.error,
1625
+ info: palette.info
1626
+ };
1627
+ var isDefault = !type || type === 'default';
1628
+ if (isDefault) return {
1629
+ bgColor: colors["default"],
1630
+ color: palette.foreground
1631
+ };
1632
+ /**
1633
+ * Prevent main color change in special types.
1634
+ * The color will only follow the theme when it is in the default type.
1635
+ */
1636
+
1637
+ return {
1638
+ bgColor: colors[type],
1639
+ color: 'white'
1640
+ };
1641
+ };
1642
+ tuple('topLeft', 'topRight', 'bottomLeft', 'bottomRight');
1643
+ var isTopPlacement = function isTopPlacement(placement) {
1644
+ return "".concat(placement).toLowerCase().startsWith('top');
1645
+ };
1646
+ var isLeftPlacement = function isLeftPlacement(placement) {
1647
+ return "".concat(placement).toLowerCase().endsWith('left');
1648
+ };
1649
+ var getTranslateByPlacement = function getTranslateByPlacement(placement) {
1650
+ var translateInByPlacement = {
1651
+ topLeft: 'translate(-60px, -60px)',
1652
+ topRight: 'translate(60px, -60px)',
1653
+ bottomLeft: 'translate(-60px, 60px)',
1654
+ bottomRight: 'translate(60px, 60px)'
1655
+ };
1656
+ var translateOutByPlacement = {
1657
+ topLeft: 'translate(-50px, 15px) scale(0.85)',
1658
+ topRight: 'translate(50px, 15px) scale(0.85)',
1659
+ bottomLeft: 'translate(-50px, -15px) scale(0.85)',
1660
+ bottomRight: 'translate(50px, -15px) scale(0.85)'
1661
+ };
1662
+ return {
1663
+ enter: translateInByPlacement[placement],
1664
+ leave: translateOutByPlacement[placement]
1665
+ };
1666
+ };
1667
+
1668
+ var ToastItem = /*#__PURE__*/React__default["default"].memo(function (_ref) {
1669
+ var toast = _ref.toast,
1670
+ layout = _ref.layout;
1671
+ var theme = useTheme();
1672
+
1673
+ var _useMemo = React.useMemo(function () {
1674
+ return getColors(theme.palette, toast.type);
1675
+ }, [theme.palette, toast.type]),
1676
+ color = _useMemo.color,
1677
+ bgColor = _useMemo.bgColor;
1678
+
1679
+ var isReactNode = typeof toast.text !== 'string';
1680
+ var padding = layout.padding,
1681
+ margin = layout.margin,
1682
+ maxHeight = layout.maxHeight,
1683
+ maxWidth = layout.maxWidth,
1684
+ width = layout.width,
1685
+ placement = layout.placement;
1686
+
1687
+ var _useMemo2 = React.useMemo(function () {
1688
+ return getTranslateByPlacement(placement);
1689
+ }, [placement]),
1690
+ enter = _useMemo2.enter,
1691
+ leave = _useMemo2.leave;
1692
+
1693
+ return /*#__PURE__*/React__default["default"].createElement(CssTransition, {
1694
+ name: "toast",
1695
+ visible: toast.visible,
1696
+ clearTime: 350
1697
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
1698
+ key: toast.id,
1699
+ className: styledJsx_cjs.style.dynamic([["1059503143", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "toast"
1700
+ }, isReactNode ? toast.text : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
1701
+ className: styledJsx_cjs.style.dynamic([["1059503143", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "message"
1702
+ }, toast.text), /*#__PURE__*/React__default["default"].createElement("div", {
1703
+ className: styledJsx_cjs.style.dynamic([["1059503143", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "action"
1704
+ }, makeToastActions(toast.actions, toast.cancel))), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1705
+ id: "1059503143",
1706
+ dynamic: [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]
1707
+ }, ".toast.__jsx-style-dynamic-selector{max-height:".concat(maxHeight, ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:").concat(theme.palette.foreground, ";background-color:").concat(bgColor, ";color:").concat(color, ";border:0;border-radius:").concat(theme.layout.radius, ";opacity:1;box-shadow:").concat(theme.expressiveness.shadowSmall, ";-webkit-transition:all 350ms cubic-bezier(0.1,0.2,0.1,1);transition:all 350ms cubic-bezier(0.1,0.2,0.1,1);overflow:hidden;}.message.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;font-size:0.875em;display:-webkit-box;word-break:break-all;overflow:hidden;max-height:100%;text-overflow:ellipsis;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:1.1rem;}.toast-enter.__jsx-style-dynamic-selector{opacity:0;height:0;padding:0;margin:0;-webkit-transform:").concat(enter, ";-ms-transform:").concat(enter, ";transform:").concat(enter, ";}.toast-enter-active.__jsx-style-dynamic-selector{opacity:1;height:auto;margin:").concat(margin, ";padding:").concat(padding, ";-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0);}.toast-leave.__jsx-style-dynamic-selector{opacity:1;-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0);height:auto;margin:").concat(margin, ";padding:").concat(padding, ";}.toast-leave-active.__jsx-style-dynamic-selector{opacity:0;-webkit-transform:").concat(leave, ";-ms-transform:").concat(leave, ";transform:").concat(leave, ";}"))));
1708
+ });
1709
+ ToastItem.displayName = 'BolioUIToastItem';
1710
+ var ToastItem$1 = ToastItem;
1711
+
1712
+ var ToastContainer = function ToastContainer() {
1713
+ var theme = useTheme();
1714
+ var portal = usePortal$1('toast');
1715
+
1716
+ var _useCurrentState = useCurrentState$1(false),
1717
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
1718
+ setHovering = _useCurrentState2[1],
1719
+ hoveringRef = _useCurrentState2[2];
1720
+
1721
+ var _useBolioUIContext = useBolioUIContext(),
1722
+ toasts = _useBolioUIContext.toasts,
1723
+ updateToasts = _useBolioUIContext.updateToasts,
1724
+ toastLayout = _useBolioUIContext.toastLayout,
1725
+ lastUpdateToastId = _useBolioUIContext.lastUpdateToastId;
1726
+
1727
+ var memoizedLayout = React.useMemo(function () {
1728
+ return toastLayout;
1729
+ }, [toastLayout]);
1730
+ var toastElements = React.useMemo(function () {
1731
+ return toasts.map(function (toast) {
1732
+ return /*#__PURE__*/React__default["default"].createElement(ToastItem$1, {
1733
+ toast: toast,
1734
+ layout: memoizedLayout,
1735
+ key: toast._internalIdent
1736
+ });
1737
+ });
1738
+ }, [toasts, memoizedLayout]);
1739
+ var classNames = React.useMemo(function () {
1740
+ return useClasses$1('toasts', {
1741
+ top: isTopPlacement(toastLayout.placement),
1742
+ left: isLeftPlacement(toastLayout.placement)
1743
+ });
1744
+ }, [memoizedLayout]);
1745
+
1746
+ var hoverHandler = function hoverHandler(isHovering) {
1747
+ setHovering(isHovering);
1748
+
1749
+ if (isHovering) {
1750
+ return updateToasts(function (last) {
1751
+ return last.map(function (toast) {
1752
+ if (!toast.visible) return toast;
1753
+ toast._timeout && window.clearTimeout(toast._timeout);
1754
+ return _objectSpread2(_objectSpread2({}, toast), {}, {
1755
+ timeout: null
1756
+ });
1757
+ });
1758
+ });
1759
+ }
1760
+
1761
+ updateToasts(function (last) {
1762
+ return last.map(function (toast, index) {
1763
+ if (!toast.visible) return toast;
1764
+ toast._timeout && window.clearTimeout(toast._timeout);
1765
+ return _objectSpread2(_objectSpread2({}, toast), {}, {
1766
+ _timeout: function () {
1767
+ var timer = window.setTimeout(function () {
1768
+ toast.cancel();
1769
+ window.clearTimeout(timer);
1770
+ }, toast.delay + index * 100);
1771
+ return timer;
1772
+ }()
1773
+ });
1774
+ });
1775
+ });
1776
+ };
1777
+
1778
+ React.useEffect(function () {
1779
+ var index = toasts.findIndex(function (r) {
1780
+ return r._internalIdent === lastUpdateToastId;
1781
+ });
1782
+ var toast = toasts[index];
1783
+ if (!toast || toast.visible || !hoveringRef.current) return;
1784
+ var hasVisible = toasts.find(function (r, i) {
1785
+ return i < index && r.visible;
1786
+ });
1787
+ if (hasVisible || !hoveringRef.current) return;
1788
+ hoverHandler(false);
1789
+ }, [toasts, lastUpdateToastId]);
1790
+ React.useEffect(function () {
1791
+ var timeout = null;
1792
+ var timer = window.setInterval(function () {
1793
+ if (toasts.length === 0) return;
1794
+ timeout = window.setTimeout(function () {
1795
+ var allInvisible = !toasts.find(function (r) {
1796
+ return r.visible;
1797
+ });
1798
+ allInvisible && updateToasts(function () {
1799
+ return [];
1800
+ });
1801
+ timeout && clearTimeout(timeout);
1802
+ }, 350);
1803
+ }, 5000);
1804
+ return function () {
1805
+ timer && clearInterval(timer);
1806
+ timeout && clearTimeout(timeout);
1807
+ };
1808
+ }, [toasts]);
1809
+ if (!portal) return null;
1810
+ if (!toasts || toasts.length === 0) return null;
1811
+ return /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default["default"].createElement("div", {
1812
+ onMouseEnter: function onMouseEnter() {
1813
+ return hoverHandler(true);
1814
+ },
1815
+ onMouseLeave: function onMouseLeave() {
1816
+ return hoverHandler(false);
1817
+ },
1818
+ className: styledJsx_cjs.style.dynamic([["622610754", [theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.layout.gap]]]) + " " + (classNames || "")
1819
+ }, toastElements, /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1820
+ id: "622610754",
1821
+ dynamic: [theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.layout.gap]
1822
+ }, ".toasts.__jsx-style-dynamic-selector{position:fixed;width:auto;max-width:100%;right:".concat(theme.layout.gap, ";bottom:").concat(theme.layout.gap, ";z-index:2000;-webkit-transition:all 400ms ease;transition:all 400ms ease;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.top.__jsx-style-dynamic-selector{bottom:unset;-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;top:").concat(theme.layout.gap, ";}.left.__jsx-style-dynamic-selector{right:unset;left:").concat(theme.layout.gap, ";}"))), portal);
1823
+ };
1824
+
1825
+ var ToastContainer$1 = ToastContainer;
1826
+
1827
+ var BolioUIProvider = function BolioUIProvider(_ref) {
1828
+ var themes = _ref.themes,
1829
+ themeType = _ref.themeType,
1830
+ children = _ref.children;
1831
+
1832
+ var _useState = React.useState(null),
1833
+ _useState2 = _slicedToArray(_useState, 2),
1834
+ lastUpdateToastId = _useState2[0],
1835
+ setLastUpdateToastId = _useState2[1];
1836
+
1837
+ var _useCurrentState = useCurrentState$1([]),
1838
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
1839
+ toasts = _useCurrentState2[0],
1840
+ setToasts = _useCurrentState2[1],
1841
+ toastsRef = _useCurrentState2[2];
1842
+
1843
+ var _useCurrentState3 = useCurrentState$1(defaultToastLayout),
1844
+ _useCurrentState4 = _slicedToArray(_useCurrentState3, 3),
1845
+ toastLayout = _useCurrentState4[0],
1846
+ setToastLayout = _useCurrentState4[1],
1847
+ toastLayoutRef = _useCurrentState4[2];
1848
+
1849
+ var updateToasts = function updateToasts(fn) {
1850
+ var nextToasts = fn(toastsRef.current);
1851
+ setToasts(nextToasts);
1852
+ };
1853
+
1854
+ var updateToastLayout = function updateToastLayout(fn) {
1855
+ var nextLayout = fn(toastLayoutRef.current);
1856
+ setToastLayout(nextLayout);
1857
+ };
1858
+
1859
+ var updateLastToastId = function updateLastToastId(fn) {
1860
+ setLastUpdateToastId(fn());
1861
+ };
1862
+
1863
+ var initialValue = React.useMemo(function () {
1864
+ return {
1865
+ toasts: toasts,
1866
+ toastLayout: toastLayout,
1867
+ updateToasts: updateToasts,
1868
+ lastUpdateToastId: lastUpdateToastId,
1869
+ updateToastLayout: updateToastLayout,
1870
+ updateLastToastId: updateLastToastId
1871
+ };
1872
+ }, [toasts, toastLayout, lastUpdateToastId]);
1873
+ return /*#__PURE__*/React__default["default"].createElement(BolioUIContent.Provider, {
1874
+ value: initialValue
1875
+ }, /*#__PURE__*/React__default["default"].createElement(ThemeProvider$1, {
1876
+ themes: themes,
1877
+ themeType: themeType
1878
+ }, children, /*#__PURE__*/React__default["default"].createElement(ToastContainer$1, null)));
1879
+ };
1880
+
1881
+ var BolioUIProvider$1 = BolioUIProvider;
1882
+
1883
+ exports["default"] = BolioUIProvider$1;