@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,188 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+
7
+ function _slicedToArray(arr, i) {
8
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
9
+ }
10
+
11
+ function _arrayWithHoles(arr) {
12
+ if (Array.isArray(arr)) return arr;
13
+ }
14
+
15
+ function _iterableToArrayLimit(arr, i) {
16
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
17
+
18
+ if (_i == null) return;
19
+ var _arr = [];
20
+ var _n = true;
21
+ var _d = false;
22
+
23
+ var _s, _e;
24
+
25
+ try {
26
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
27
+ _arr.push(_s.value);
28
+
29
+ if (i && _arr.length === i) break;
30
+ }
31
+ } catch (err) {
32
+ _d = true;
33
+ _e = err;
34
+ } finally {
35
+ try {
36
+ if (!_n && _i["return"] != null) _i["return"]();
37
+ } finally {
38
+ if (_d) throw _e;
39
+ }
40
+ }
41
+
42
+ return _arr;
43
+ }
44
+
45
+ function _unsupportedIterableToArray(o, minLen) {
46
+ if (!o) return;
47
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
48
+ var n = Object.prototype.toString.call(o).slice(8, -1);
49
+ if (n === "Object" && o.constructor) n = o.constructor.name;
50
+ if (n === "Map" || n === "Set") return Array.from(o);
51
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
52
+ }
53
+
54
+ function _arrayLikeToArray(arr, len) {
55
+ if (len == null || len > arr.length) len = arr.length;
56
+
57
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
58
+
59
+ return arr2;
60
+ }
61
+
62
+ function _nonIterableRest() {
63
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
64
+ }
65
+
66
+ var getId = function getId() {
67
+ return Math.random().toString(32).slice(2, 10);
68
+ };
69
+ var isBrowser = function isBrowser() {
70
+ return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
71
+ };
72
+
73
+ var useSSR = function useSSR() {
74
+ var _useState = React.useState(false),
75
+ _useState2 = _slicedToArray(_useState, 2),
76
+ browser = _useState2[0],
77
+ setBrowser = _useState2[1];
78
+
79
+ React.useEffect(function () {
80
+ setBrowser(isBrowser());
81
+ }, []);
82
+ return {
83
+ isBrowser: browser,
84
+ isServer: !browser
85
+ };
86
+ };
87
+
88
+ var useSSR$1 = useSSR;
89
+
90
+ var createElement = function createElement(id) {
91
+ var el = document.createElement('div');
92
+ el.setAttribute('id', id);
93
+ return el;
94
+ };
95
+
96
+ var usePortal = function usePortal() {
97
+ var selectId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getId();
98
+ var getContainer = arguments.length > 1 ? arguments[1] : undefined;
99
+ var id = "bolio-ui-".concat(selectId);
100
+
101
+ var _useSSR = useSSR$1(),
102
+ isBrowser = _useSSR.isBrowser;
103
+
104
+ var _useState = React.useState(isBrowser ? createElement(id) : null),
105
+ _useState2 = _slicedToArray(_useState, 2),
106
+ elSnapshot = _useState2[0],
107
+ setElSnapshot = _useState2[1];
108
+
109
+ React.useEffect(function () {
110
+ var customContainer = getContainer ? getContainer() : null;
111
+ var parentElement = customContainer || document.body;
112
+ var hasElement = parentElement.querySelector("#".concat(id));
113
+ var el = hasElement || createElement(id);
114
+
115
+ if (!hasElement) {
116
+ parentElement.appendChild(el);
117
+ }
118
+
119
+ setElSnapshot(el);
120
+ }, []);
121
+ return elSnapshot;
122
+ };
123
+
124
+ var usePortal$1 = usePortal;
125
+
126
+ var warningStack = {};
127
+
128
+ var useWarning = function useWarning(message, component) {
129
+ var tag = component ? " [".concat(component, "]") : ' ';
130
+ var log = "[Bolio UI]".concat(tag, ": ").concat(message);
131
+ if (typeof console === 'undefined') return;
132
+ if (warningStack[log]) return;
133
+ warningStack[log] = true;
134
+
135
+ if (process.env.NODE_ENV !== 'production') {
136
+ return console.error(log);
137
+ }
138
+
139
+ console.warn(log);
140
+ };
141
+
142
+ var useWarning$1 = useWarning;
143
+
144
+ var defaultOptions = {
145
+ onError: function onError() {
146
+ return useWarning$1('Failed to copy.', 'use-clipboard');
147
+ }
148
+ };
149
+
150
+ var useClipboard = function useClipboard() {
151
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultOptions;
152
+ var el = usePortal$1('clipboard');
153
+
154
+ var copyText = function copyText(el, text) {
155
+ if (!el || !text) return;
156
+ var selection = window.getSelection();
157
+ if (!selection) return;
158
+ el.style.whiteSpace = 'pre';
159
+ el.textContent = text;
160
+ var range = window.document.createRange();
161
+ selection.removeAllRanges();
162
+ range.selectNode(el);
163
+ selection.addRange(range);
164
+
165
+ try {
166
+ window.document.execCommand('copy');
167
+ } catch (e) {
168
+ options.onError && options.onError();
169
+ }
170
+
171
+ selection.removeAllRanges();
172
+
173
+ if (el) {
174
+ el.textContent = '';
175
+ }
176
+ };
177
+
178
+ var copy = React.useCallback(function (text) {
179
+ copyText(el, text);
180
+ }, [el]);
181
+ return {
182
+ copy: copy
183
+ };
184
+ };
185
+
186
+ var useClipboard$1 = useClipboard;
187
+
188
+ exports["default"] = useClipboard$1;
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var react = require('react');
6
+
7
+ function _slicedToArray(arr, i) {
8
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
9
+ }
10
+
11
+ function _arrayWithHoles(arr) {
12
+ if (Array.isArray(arr)) return arr;
13
+ }
14
+
15
+ function _iterableToArrayLimit(arr, i) {
16
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
17
+
18
+ if (_i == null) return;
19
+ var _arr = [];
20
+ var _n = true;
21
+ var _d = false;
22
+
23
+ var _s, _e;
24
+
25
+ try {
26
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
27
+ _arr.push(_s.value);
28
+
29
+ if (i && _arr.length === i) break;
30
+ }
31
+ } catch (err) {
32
+ _d = true;
33
+ _e = err;
34
+ } finally {
35
+ try {
36
+ if (!_n && _i["return"] != null) _i["return"]();
37
+ } finally {
38
+ if (_d) throw _e;
39
+ }
40
+ }
41
+
42
+ return _arr;
43
+ }
44
+
45
+ function _unsupportedIterableToArray(o, minLen) {
46
+ if (!o) return;
47
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
48
+ var n = Object.prototype.toString.call(o).slice(8, -1);
49
+ if (n === "Object" && o.constructor) n = o.constructor.name;
50
+ if (n === "Map" || n === "Set") return Array.from(o);
51
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
52
+ }
53
+
54
+ function _arrayLikeToArray(arr, len) {
55
+ if (len == null || len > arr.length) len = arr.length;
56
+
57
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
58
+
59
+ return arr2;
60
+ }
61
+
62
+ function _nonIterableRest() {
63
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
64
+ }
65
+
66
+ var useCurrentState = function useCurrentState(initialState) {
67
+ var _useState = react.useState(function () {
68
+ return typeof initialState === 'function' ? initialState() : initialState;
69
+ }),
70
+ _useState2 = _slicedToArray(_useState, 2),
71
+ state = _useState2[0],
72
+ setState = _useState2[1];
73
+
74
+ var ref = react.useRef(initialState);
75
+ react.useEffect(function () {
76
+ ref.current = state;
77
+ }, [state]);
78
+
79
+ var setValue = function setValue(val) {
80
+ var result = typeof val === 'function' ? val(ref.current) : val;
81
+ ref.current = result;
82
+ setState(result);
83
+ };
84
+
85
+ return [state, setValue, ref];
86
+ };
87
+
88
+ var useCurrentState$1 = useCurrentState;
89
+
90
+ exports["default"] = useCurrentState$1;
@@ -0,0 +1,129 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var react = require('react');
6
+
7
+ function _typeof(obj) {
8
+ "@babel/helpers - typeof";
9
+
10
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
11
+ return typeof obj;
12
+ } : function (obj) {
13
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
14
+ }, _typeof(obj);
15
+ }
16
+
17
+ function _slicedToArray(arr, i) {
18
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
19
+ }
20
+
21
+ function _arrayWithHoles(arr) {
22
+ if (Array.isArray(arr)) return arr;
23
+ }
24
+
25
+ function _iterableToArrayLimit(arr, i) {
26
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
27
+
28
+ if (_i == null) return;
29
+ var _arr = [];
30
+ var _n = true;
31
+ var _d = false;
32
+
33
+ var _s, _e;
34
+
35
+ try {
36
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
37
+ _arr.push(_s.value);
38
+
39
+ if (i && _arr.length === i) break;
40
+ }
41
+ } catch (err) {
42
+ _d = true;
43
+ _e = err;
44
+ } finally {
45
+ try {
46
+ if (!_n && _i["return"] != null) _i["return"]();
47
+ } finally {
48
+ if (_d) throw _e;
49
+ }
50
+ }
51
+
52
+ return _arr;
53
+ }
54
+
55
+ function _unsupportedIterableToArray(o, minLen) {
56
+ if (!o) return;
57
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
58
+ var n = Object.prototype.toString.call(o).slice(8, -1);
59
+ if (n === "Object" && o.constructor) n = o.constructor.name;
60
+ if (n === "Map" || n === "Set") return Array.from(o);
61
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
62
+ }
63
+
64
+ function _arrayLikeToArray(arr, len) {
65
+ if (len == null || len > arr.length) len = arr.length;
66
+
67
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
68
+
69
+ return arr2;
70
+ }
71
+
72
+ function _nonIterableRest() {
73
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
74
+ }
75
+
76
+ var useCurrentState = function useCurrentState(initialState) {
77
+ var _useState = react.useState(function () {
78
+ return typeof initialState === 'function' ? initialState() : initialState;
79
+ }),
80
+ _useState2 = _slicedToArray(_useState, 2),
81
+ state = _useState2[0],
82
+ setState = _useState2[1];
83
+
84
+ var ref = react.useRef(initialState);
85
+ react.useEffect(function () {
86
+ ref.current = state;
87
+ }, [state]);
88
+
89
+ var setValue = function setValue(val) {
90
+ var result = typeof val === 'function' ? val(ref.current) : val;
91
+ ref.current = result;
92
+ setState(result);
93
+ };
94
+
95
+ return [state, setValue, ref];
96
+ };
97
+
98
+ var useCurrentState$1 = useCurrentState;
99
+
100
+ var useInput = function useInput(initialValue) {
101
+ var _useCurrentState = useCurrentState$1(initialValue),
102
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
103
+ state = _useCurrentState2[0],
104
+ setState = _useCurrentState2[1],
105
+ currentRef = _useCurrentState2[2];
106
+
107
+ return {
108
+ state: state,
109
+ setState: setState,
110
+ currentRef: currentRef,
111
+ reset: function reset() {
112
+ return setState(initialValue);
113
+ },
114
+ bindings: {
115
+ value: state,
116
+ onChange: function onChange(event) {
117
+ if (_typeof(event) === 'object' && event.target) {
118
+ setState(event.target.value);
119
+ } else {
120
+ setState(event);
121
+ }
122
+ }
123
+ }
124
+ };
125
+ };
126
+
127
+ var useInput$1 = useInput;
128
+
129
+ exports["default"] = useInput$1;
@@ -0,0 +1,214 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+
7
+ /**
8
+ * KeyBinding Codes
9
+ * The content of this file is based on the design of the open source project "microsoft/vscode",
10
+ * Copyright (c) Microsoft Corporation. All rights reserved.
11
+ *
12
+ * We inherit the KeyMod values from "microsoft/vscode",
13
+ * but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
14
+ */
15
+ exports.KeyCode = void 0;
16
+
17
+ (function (KeyCode) {
18
+ KeyCode[KeyCode["Unknown"] = 0] = "Unknown";
19
+ KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
20
+ KeyCode[KeyCode["Tab"] = 9] = "Tab";
21
+ KeyCode[KeyCode["Enter"] = 13] = "Enter";
22
+ KeyCode[KeyCode["Shift"] = 16] = "Shift";
23
+ KeyCode[KeyCode["Ctrl"] = 17] = "Ctrl";
24
+ KeyCode[KeyCode["Alt"] = 18] = "Alt";
25
+ KeyCode[KeyCode["PauseBreak"] = 19] = "PauseBreak";
26
+ KeyCode[KeyCode["CapsLock"] = 20] = "CapsLock";
27
+ KeyCode[KeyCode["Escape"] = 27] = "Escape";
28
+ KeyCode[KeyCode["Space"] = 32] = "Space";
29
+ KeyCode[KeyCode["PageUp"] = 33] = "PageUp";
30
+ KeyCode[KeyCode["PageDown"] = 34] = "PageDown";
31
+ KeyCode[KeyCode["End"] = 35] = "End";
32
+ KeyCode[KeyCode["Home"] = 36] = "Home";
33
+ KeyCode[KeyCode["LeftArrow"] = 37] = "LeftArrow";
34
+ KeyCode[KeyCode["UpArrow"] = 38] = "UpArrow";
35
+ KeyCode[KeyCode["RightArrow"] = 39] = "RightArrow";
36
+ KeyCode[KeyCode["DownArrow"] = 40] = "DownArrow";
37
+ KeyCode[KeyCode["Insert"] = 45] = "Insert";
38
+ KeyCode[KeyCode["Delete"] = 46] = "Delete";
39
+ KeyCode[KeyCode["KEY_0"] = 48] = "KEY_0";
40
+ KeyCode[KeyCode["KEY_1"] = 49] = "KEY_1";
41
+ KeyCode[KeyCode["KEY_2"] = 50] = "KEY_2";
42
+ KeyCode[KeyCode["KEY_3"] = 51] = "KEY_3";
43
+ KeyCode[KeyCode["KEY_4"] = 52] = "KEY_4";
44
+ KeyCode[KeyCode["KEY_5"] = 53] = "KEY_5";
45
+ KeyCode[KeyCode["KEY_6"] = 54] = "KEY_6";
46
+ KeyCode[KeyCode["KEY_7"] = 55] = "KEY_7";
47
+ KeyCode[KeyCode["KEY_8"] = 56] = "KEY_8";
48
+ KeyCode[KeyCode["KEY_9"] = 57] = "KEY_9";
49
+ KeyCode[KeyCode["KEY_A"] = 65] = "KEY_A";
50
+ KeyCode[KeyCode["KEY_B"] = 66] = "KEY_B";
51
+ KeyCode[KeyCode["KEY_C"] = 67] = "KEY_C";
52
+ KeyCode[KeyCode["KEY_D"] = 68] = "KEY_D";
53
+ KeyCode[KeyCode["KEY_E"] = 69] = "KEY_E";
54
+ KeyCode[KeyCode["KEY_F"] = 70] = "KEY_F";
55
+ KeyCode[KeyCode["KEY_G"] = 71] = "KEY_G";
56
+ KeyCode[KeyCode["KEY_H"] = 72] = "KEY_H";
57
+ KeyCode[KeyCode["KEY_I"] = 73] = "KEY_I";
58
+ KeyCode[KeyCode["KEY_J"] = 74] = "KEY_J";
59
+ KeyCode[KeyCode["KEY_K"] = 75] = "KEY_K";
60
+ KeyCode[KeyCode["KEY_L"] = 76] = "KEY_L";
61
+ KeyCode[KeyCode["KEY_M"] = 77] = "KEY_M";
62
+ KeyCode[KeyCode["KEY_N"] = 78] = "KEY_N";
63
+ KeyCode[KeyCode["KEY_O"] = 79] = "KEY_O";
64
+ KeyCode[KeyCode["KEY_P"] = 80] = "KEY_P";
65
+ KeyCode[KeyCode["KEY_Q"] = 81] = "KEY_Q";
66
+ KeyCode[KeyCode["KEY_R"] = 82] = "KEY_R";
67
+ KeyCode[KeyCode["KEY_S"] = 83] = "KEY_S";
68
+ KeyCode[KeyCode["KEY_T"] = 84] = "KEY_T";
69
+ KeyCode[KeyCode["KEY_U"] = 85] = "KEY_U";
70
+ KeyCode[KeyCode["KEY_V"] = 86] = "KEY_V";
71
+ KeyCode[KeyCode["KEY_W"] = 87] = "KEY_W";
72
+ KeyCode[KeyCode["KEY_X"] = 88] = "KEY_X";
73
+ KeyCode[KeyCode["KEY_Y"] = 89] = "KEY_Y";
74
+ KeyCode[KeyCode["KEY_Z"] = 90] = "KEY_Z";
75
+ KeyCode[KeyCode["Meta"] = 91] = "Meta";
76
+ KeyCode[KeyCode["F1"] = 112] = "F1";
77
+ KeyCode[KeyCode["F2"] = 113] = "F2";
78
+ KeyCode[KeyCode["F3"] = 114] = "F3";
79
+ KeyCode[KeyCode["F4"] = 115] = "F4";
80
+ KeyCode[KeyCode["F5"] = 116] = "F5";
81
+ KeyCode[KeyCode["F6"] = 117] = "F6";
82
+ KeyCode[KeyCode["F7"] = 118] = "F7";
83
+ KeyCode[KeyCode["F8"] = 119] = "F8";
84
+ KeyCode[KeyCode["F9"] = 120] = "F9";
85
+ KeyCode[KeyCode["F10"] = 121] = "F10";
86
+ KeyCode[KeyCode["F11"] = 122] = "F11";
87
+ KeyCode[KeyCode["F12"] = 123] = "F12";
88
+ KeyCode[KeyCode["NumLock"] = 144] = "NumLock";
89
+ KeyCode[KeyCode["ScrollLock"] = 145] = "ScrollLock";
90
+ KeyCode[KeyCode["Equal"] = 187] = "Equal";
91
+ KeyCode[KeyCode["Minus"] = 189] = "Minus";
92
+ KeyCode[KeyCode["Backquote"] = 192] = "Backquote";
93
+ KeyCode[KeyCode["Backslash"] = 220] = "Backslash";
94
+ })(exports.KeyCode || (exports.KeyCode = {}));
95
+
96
+ exports.KeyMod = void 0;
97
+
98
+ (function (KeyMod) {
99
+ KeyMod[KeyMod["CtrlCmd"] = 2048] = "CtrlCmd";
100
+ KeyMod[KeyMod["Shift"] = 1024] = "Shift";
101
+ KeyMod[KeyMod["Alt"] = 512] = "Alt";
102
+ KeyMod[KeyMod["WinCtrl"] = 256] = "WinCtrl";
103
+ })(exports.KeyMod || (exports.KeyMod = {}));
104
+
105
+ var isBrowser = function isBrowser() {
106
+ return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
107
+ };
108
+ var isMac = function isMac() {
109
+ if (!isBrowser()) return false;
110
+ return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
111
+ };
112
+
113
+ /* istanbul ignore next */
114
+
115
+ var getCtrlKeysByPlatform = function getCtrlKeysByPlatform() {
116
+ return {
117
+ CtrlCmd: isMac() ? 'metaKey' : 'ctrlKey',
118
+ WinCtrl: isMac() ? 'ctrlKey' : 'metaKey'
119
+ };
120
+ };
121
+ var getActiveModMap = function getActiveModMap(bindings) {
122
+ var modBindings = bindings.filter(function (item) {
123
+ return !!exports.KeyMod[item];
124
+ });
125
+ var activeModMap = {
126
+ CtrlCmd: false,
127
+ Shift: false,
128
+ Alt: false,
129
+ WinCtrl: false
130
+ };
131
+ modBindings.forEach(function (code) {
132
+ var modKey = exports.KeyMod[code];
133
+ activeModMap[modKey] = true;
134
+ });
135
+ return activeModMap;
136
+ };
137
+
138
+ var useKeyboard = function useKeyboard(handler, keyBindings) {
139
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
140
+ var bindings = Array.isArray(keyBindings) ? keyBindings : [keyBindings];
141
+ var _options$disableGloba = options.disableGlobalEvent,
142
+ disableGlobalEvent = _options$disableGloba === void 0 ? false : _options$disableGloba,
143
+ _options$capture = options.capture,
144
+ capture = _options$capture === void 0 ? false : _options$capture,
145
+ _options$stopPropagat = options.stopPropagation,
146
+ stopPropagation = _options$stopPropagat === void 0 ? false : _options$stopPropagat,
147
+ _options$preventDefau = options.preventDefault,
148
+ preventDefault = _options$preventDefau === void 0 ? true : _options$preventDefau,
149
+ _options$event = options.event,
150
+ event = _options$event === void 0 ? 'keydown' : _options$event;
151
+ var activeModMap = getActiveModMap(bindings);
152
+ var keyCode = bindings.filter(function (item) {
153
+ return !exports.KeyMod[item];
154
+ });
155
+
156
+ var _getCtrlKeysByPlatfor = getCtrlKeysByPlatform(),
157
+ CtrlCmd = _getCtrlKeysByPlatfor.CtrlCmd,
158
+ WinCtrl = _getCtrlKeysByPlatfor.WinCtrl;
159
+
160
+ var eventHandler = function eventHandler(event) {
161
+ if (activeModMap.Shift && !event.shiftKey) return;
162
+ if (activeModMap.Alt && !event.altKey) return;
163
+ if (activeModMap.CtrlCmd && !event[CtrlCmd]) return;
164
+ if (activeModMap.WinCtrl && !event[WinCtrl]) return;
165
+ var hitOne = keyCode.find(function (k) {
166
+ return k === event.keyCode;
167
+ });
168
+ if (keyCode && !hitOne) return;
169
+
170
+ if (stopPropagation) {
171
+ event.stopPropagation();
172
+ }
173
+
174
+ if (preventDefault) {
175
+ event.preventDefault();
176
+ }
177
+
178
+ handler && handler(event);
179
+ };
180
+
181
+ React.useEffect(function () {
182
+ if (!disableGlobalEvent) {
183
+ document.addEventListener(event, eventHandler);
184
+ }
185
+
186
+ return function () {
187
+ document.removeEventListener(event, eventHandler);
188
+ };
189
+ }, [disableGlobalEvent]);
190
+
191
+ var elementBindingHandler = function elementBindingHandler(elementEventType) {
192
+ var isCapture = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
193
+ if (elementEventType !== event) return function () {};
194
+ if (isCapture !== capture) return function () {};
195
+ return function (e) {
196
+ return eventHandler(e);
197
+ };
198
+ };
199
+
200
+ return {
201
+ bindings: {
202
+ onKeyDown: elementBindingHandler('keydown'),
203
+ onKeyDownCapture: elementBindingHandler('keydown', true),
204
+ onKeyPress: elementBindingHandler('keypress'),
205
+ onKeyPressCapture: elementBindingHandler('keypress', true),
206
+ onKeyUp: elementBindingHandler('keyup'),
207
+ onKeyUpCapture: elementBindingHandler('keyup', true)
208
+ }
209
+ };
210
+ };
211
+
212
+ var useKeyboard$1 = useKeyboard;
213
+
214
+ exports["default"] = useKeyboard$1;