@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,25 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["children"];
4
+ import React from 'react';
5
+ import PaginationItem from './pagination-item';
6
+ import { usePaginationContext } from './pagination-context';
7
+
8
+ function PaginationPrevious(_ref) {
9
+ var children = _ref.children,
10
+ props = _objectWithoutProperties(_ref, _excluded);
11
+
12
+ var _usePaginationContext = usePaginationContext(),
13
+ update = _usePaginationContext.update,
14
+ isFirst = _usePaginationContext.isFirst;
15
+
16
+ return /*#__PURE__*/React.createElement(PaginationItem, _extends({
17
+ onClick: function onClick() {
18
+ return update && update('prev');
19
+ },
20
+ disabled: isFirst
21
+ }, props), children);
22
+ }
23
+
24
+ PaginationPrevious.displayName = 'BolioUIPaginationPrevious';
25
+ export default PaginationPrevious;
@@ -0,0 +1,105 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["page", "initialPage", "count", "limit", "children", "onChange", "className"];
5
+ import _JSXStyle from "../styled-jsx.es.js";
6
+ import React, { useEffect, useMemo } from 'react';
7
+ import PaginationPrevious from './pagination-previous';
8
+ import PaginationNext from './pagination-next';
9
+ import PaginationPages from './pagination-pages';
10
+ import { PaginationContext } from './pagination-context';
11
+ import useCurrentState from '../utils/use-current-state';
12
+ import { pickChild } from '../utils/collections';
13
+ import useScale, { withScale } from '../use-scale';
14
+
15
+ function PaginationComponent(_ref) {
16
+ var customPage = _ref.page,
17
+ _ref$initialPage = _ref.initialPage,
18
+ initialPage = _ref$initialPage === void 0 ? 1 : _ref$initialPage,
19
+ _ref$count = _ref.count,
20
+ count = _ref$count === void 0 ? 1 : _ref$count,
21
+ _ref$limit = _ref.limit,
22
+ limit = _ref$limit === void 0 ? 7 : _ref$limit,
23
+ children = _ref.children,
24
+ onChange = _ref.onChange,
25
+ _ref$className = _ref.className,
26
+ className = _ref$className === void 0 ? '' : _ref$className,
27
+ props = _objectWithoutProperties(_ref, _excluded);
28
+
29
+ var _useScale = useScale(),
30
+ SCALES = _useScale.SCALES;
31
+
32
+ var _useCurrentState = useCurrentState(initialPage),
33
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
34
+ page = _useCurrentState2[0],
35
+ setPage = _useCurrentState2[1],
36
+ pageRef = _useCurrentState2[2];
37
+
38
+ var _pickChild = pickChild(children, PaginationPrevious),
39
+ _pickChild2 = _slicedToArray(_pickChild, 2),
40
+ prevChildren = _pickChild2[1];
41
+
42
+ var _pickChild3 = pickChild(children, PaginationNext),
43
+ _pickChild4 = _slicedToArray(_pickChild3, 2),
44
+ nextChildren = _pickChild4[1];
45
+
46
+ var _useMemo = useMemo(function () {
47
+ var hasChildren = function hasChildren(c) {
48
+ return React.Children.count(c) > 0;
49
+ };
50
+
51
+ var prevDefault = /*#__PURE__*/React.createElement(PaginationPrevious, null, "prev");
52
+ var nextDefault = /*#__PURE__*/React.createElement(PaginationNext, null, "next");
53
+ return [hasChildren(prevChildren) ? prevChildren : prevDefault, hasChildren(nextChildren) ? nextChildren : nextDefault];
54
+ }, [prevChildren, nextChildren]),
55
+ _useMemo2 = _slicedToArray(_useMemo, 2),
56
+ prevItem = _useMemo2[0],
57
+ nextItem = _useMemo2[1];
58
+
59
+ var update = function update(type) {
60
+ if (type === 'prev' && pageRef.current > 1) {
61
+ setPage(function (last) {
62
+ return last - 1;
63
+ });
64
+ }
65
+
66
+ if (type === 'next' && pageRef.current < count) {
67
+ setPage(function (last) {
68
+ return last + 1;
69
+ });
70
+ }
71
+ };
72
+
73
+ var values = useMemo(function () {
74
+ return {
75
+ isFirst: page <= 1,
76
+ isLast: page >= count,
77
+ update: update
78
+ };
79
+ }, [page, count]);
80
+ useEffect(function () {
81
+ onChange && onChange(page);
82
+ }, [onChange, page]);
83
+ useEffect(function () {
84
+ if (customPage !== undefined) {
85
+ setPage(customPage);
86
+ }
87
+ }, [customPage, setPage]);
88
+ return /*#__PURE__*/React.createElement(PaginationContext.Provider, {
89
+ value: values
90
+ }, /*#__PURE__*/React.createElement("nav", _extends({}, props, {
91
+ className: _JSXStyle.dynamic([["77524905", [SCALES.font(2), SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
92
+ }), prevItem, /*#__PURE__*/React.createElement(PaginationPages, {
93
+ count: count,
94
+ current: page,
95
+ limit: limit,
96
+ setPage: setPage
97
+ }), nextItem), /*#__PURE__*/React.createElement(_JSXStyle, {
98
+ id: "77524905",
99
+ dynamic: [SCALES.font(2), SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
100
+ }, "nav.__jsx-style-dynamic-selector{font-variant:tabular-nums;font-feature-settings:'tnum';--pagination-size:".concat(SCALES.font(2), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}nav.__jsx-style-dynamic-selector button:last-of-type{margin-right:0;}")));
101
+ }
102
+
103
+ PaginationComponent.displayName = 'BolioUIPagination';
104
+ var Pagination = withScale(PaginationComponent);
105
+ export default Pagination;
@@ -0,0 +1,49 @@
1
+ import Pagination from '.';
2
+ import Grid from '../grid';
3
+ import { ChevronRight, ChevronLeft, ArrowRight, ArrowLeft, ArrowRightCircle, ArrowLeftCircle } from '@bolio-ui/icons';
4
+ export default {
5
+ title: 'Navigation/Pagination',
6
+ component: Pagination
7
+ };
8
+ export var Default = function Default() {
9
+ return /*#__PURE__*/React.createElement(Grid.Container, {
10
+ gap: 2
11
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Pagination, {
12
+ count: 20,
13
+ initialPage: 3
14
+ })));
15
+ };
16
+ export var Limit = function Limit() {
17
+ return /*#__PURE__*/React.createElement(Grid.Container, {
18
+ gap: 2,
19
+ direction: "column"
20
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Pagination, {
21
+ count: 10,
22
+ limit: 10
23
+ })), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Pagination, {
24
+ count: 5
25
+ })), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Pagination, {
26
+ count: 10,
27
+ initialPage: 6,
28
+ limit: 5
29
+ })), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Pagination, {
30
+ count: 10,
31
+ initialPage: 6
32
+ })), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Pagination, {
33
+ count: 30,
34
+ initialPage: 6,
35
+ limit: 10
36
+ })));
37
+ };
38
+ export var Icon = function Icon() {
39
+ return /*#__PURE__*/React.createElement(Grid.Container, {
40
+ gap: 2,
41
+ direction: "column"
42
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Pagination, {
43
+ count: 5
44
+ }, /*#__PURE__*/React.createElement(Pagination.Next, null, /*#__PURE__*/React.createElement(ChevronRight, null)), /*#__PURE__*/React.createElement(Pagination.Previous, null, /*#__PURE__*/React.createElement(ChevronLeft, null)))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Pagination, {
45
+ count: 5
46
+ }, /*#__PURE__*/React.createElement(Pagination.Next, null, /*#__PURE__*/React.createElement(ArrowRight, null)), /*#__PURE__*/React.createElement(Pagination.Previous, null, /*#__PURE__*/React.createElement(ArrowLeft, null)))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Pagination, {
47
+ count: 5
48
+ }, /*#__PURE__*/React.createElement(Pagination.Next, null, /*#__PURE__*/React.createElement(ArrowRightCircle, null)), /*#__PURE__*/React.createElement(Pagination.Previous, null, /*#__PURE__*/React.createElement(ArrowLeftCircle, null)))));
49
+ };
@@ -0,0 +1,5 @@
1
+ import Popover from './popover';
2
+ import PopoverItem from './popover-item';
3
+ Popover.Item = PopoverItem;
4
+ Popover.Option = PopoverItem;
5
+ export default Popover;
@@ -0,0 +1,9 @@
1
+ import React, { useContext } from 'react';
2
+ var defaultContext = {
3
+ disableItemsAutoClose: false,
4
+ onItemClick: function onItemClick() {}
5
+ };
6
+ export var PopoverContext = /*#__PURE__*/React.createContext(defaultContext);
7
+ export var usePopoverContext = function usePopoverContext() {
8
+ return useContext(PopoverContext);
9
+ };
@@ -0,0 +1,65 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["children", "line", "title", "className", "onClick", "disableAutoClose"];
4
+ import _JSXStyle from "../styled-jsx.es.js";
5
+ import React from 'react';
6
+ import useTheme from '../use-theme';
7
+ import useScale, { withScale } from '../use-scale';
8
+ import { usePopoverContext } from './popover-context';
9
+ import useClasses from '../use-classes';
10
+
11
+ function PopoverItemComponent(_ref) {
12
+ var children = _ref.children,
13
+ _ref$line = _ref.line,
14
+ line = _ref$line === void 0 ? false : _ref$line,
15
+ _ref$title = _ref.title,
16
+ title = _ref$title === void 0 ? false : _ref$title,
17
+ _ref$className = _ref.className,
18
+ className = _ref$className === void 0 ? '' : _ref$className,
19
+ onClick = _ref.onClick,
20
+ _ref$disableAutoClose = _ref.disableAutoClose,
21
+ disableAutoClose = _ref$disableAutoClose === void 0 ? false : _ref$disableAutoClose,
22
+ props = _objectWithoutProperties(_ref, _excluded);
23
+
24
+ var theme = useTheme();
25
+
26
+ var _useScale = useScale(),
27
+ SCALES = _useScale.SCALES;
28
+
29
+ var _usePopoverContext = usePopoverContext(),
30
+ disableItemsAutoClose = _usePopoverContext.disableItemsAutoClose,
31
+ onItemClick = _usePopoverContext.onItemClick;
32
+
33
+ var hasHandler = Boolean(onClick);
34
+ var dontCloseByClick = disableAutoClose || disableItemsAutoClose || title || line;
35
+ var classes = useClasses('item', {
36
+ line: line,
37
+ title: title
38
+ }, className);
39
+
40
+ var clickHandler = function clickHandler(event) {
41
+ onClick && onClick(event);
42
+
43
+ if (dontCloseByClick) {
44
+ return event.stopPropagation();
45
+ }
46
+
47
+ onItemClick(event);
48
+ };
49
+
50
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", _extends({
51
+ onClick: clickHandler
52
+ }, props, {
53
+ className: _JSXStyle.dynamic([["2829879905", [theme.palette.accents_5, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]]]) + " " + (props && props.className != null && props.className || classes || "")
54
+ }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
55
+ id: "2829879905",
56
+ dynamic: [theme.palette.accents_5, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]
57
+ }, ".item.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;box-sizing:border-box;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:".concat(theme.palette.accents_5, ";-webkit-transition:color,background-color 150ms linear;transition:color,background-color 150ms linear;line-height:1.25em;font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";padding:").concat(SCALES.pt(0.5), " ").concat(SCALES.pr(0.75), " ").concat(SCALES.pb(0.5), " ").concat(SCALES.pl(0.75), ";cursor:").concat(hasHandler ? 'pointer' : 'default', ";}.item.__jsx-style-dynamic-selector:hover{color:").concat(theme.palette.foreground, ";}.item.line.__jsx-style-dynamic-selector{line-height:0;padding:0;background-color:").concat(theme.palette.border, ";height:").concat(SCALES.height(0.0625), ";margin:").concat(SCALES.mt(0.35), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0.35), " ").concat(SCALES.ml(0), ";width:").concat(SCALES.width(1, '100%'), ";}.item.title.__jsx-style-dynamic-selector{font-weight:500;font-size:").concat(SCALES.font(0.925), ";color:").concat(theme.palette.foreground, ";}"))), title && /*#__PURE__*/React.createElement(PopoverItem, {
58
+ line: true,
59
+ title: false
60
+ }));
61
+ }
62
+
63
+ PopoverItemComponent.displayName = 'BolioUIPopoverItem';
64
+ var PopoverItem = withScale(PopoverItemComponent);
65
+ export default PopoverItem;
@@ -0,0 +1,83 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["content", "children", "disableItemsAutoClose", "trigger", "placement", "portalClassName", "type", "visible", "onVisibleChange"];
5
+ import _JSXStyle from "../styled-jsx.es.js";
6
+ import React, { useEffect, useMemo, useState } from 'react';
7
+ import Tooltip from '../tooltip/tooltip';
8
+ import { getReactNode } from '../utils/collections';
9
+ import useScale, { withScale } from '../use-scale';
10
+ import { PopoverContext } from './popover-context';
11
+ import useClasses from '../use-classes';
12
+
13
+ function PopoverComponent(_ref) {
14
+ var content = _ref.content,
15
+ children = _ref.children,
16
+ _ref$disableItemsAuto = _ref.disableItemsAutoClose,
17
+ disableItemsAutoClose = _ref$disableItemsAuto === void 0 ? false : _ref$disableItemsAuto,
18
+ _ref$trigger = _ref.trigger,
19
+ trigger = _ref$trigger === void 0 ? 'click' : _ref$trigger,
20
+ _ref$placement = _ref.placement,
21
+ placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,
22
+ _ref$portalClassName = _ref.portalClassName,
23
+ portalClassName = _ref$portalClassName === void 0 ? '' : _ref$portalClassName,
24
+ _ref$type = _ref.type,
25
+ type = _ref$type === void 0 ? 'default' : _ref$type,
26
+ customVisible = _ref.visible,
27
+ _ref$onVisibleChange = _ref.onVisibleChange,
28
+ onVisibleChange = _ref$onVisibleChange === void 0 ? function () {} : _ref$onVisibleChange,
29
+ props = _objectWithoutProperties(_ref, _excluded);
30
+
31
+ var _useScale = useScale(),
32
+ SCALES = _useScale.SCALES;
33
+
34
+ var _useState = useState(false),
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ visible = _useState2[0],
37
+ setVisible = _useState2[1];
38
+
39
+ var textNode = useMemo(function () {
40
+ return getReactNode(content);
41
+ }, [content]);
42
+
43
+ var onChildClick = function onChildClick() {
44
+ onPopoverVisibleChange(false);
45
+ };
46
+
47
+ var value = useMemo(function () {
48
+ return {
49
+ onItemClick: onChildClick,
50
+ disableItemsAutoClose: disableItemsAutoClose
51
+ };
52
+ }, [disableItemsAutoClose]);
53
+ var classes = useClasses('popover', portalClassName);
54
+
55
+ var onPopoverVisibleChange = function onPopoverVisibleChange(next) {
56
+ setVisible(next);
57
+ onVisibleChange(next);
58
+ };
59
+
60
+ useEffect(function () {
61
+ if (customVisible === undefined) return;
62
+ onPopoverVisibleChange(customVisible);
63
+ }, [customVisible]);
64
+ return /*#__PURE__*/React.createElement(PopoverContext.Provider, {
65
+ value: value
66
+ }, /*#__PURE__*/React.createElement(Tooltip, _extends({
67
+ initialVisible: false,
68
+ text: textNode,
69
+ trigger: trigger,
70
+ placement: placement,
71
+ portalClassName: classes,
72
+ visible: visible,
73
+ type: type,
74
+ onVisibleChange: onPopoverVisibleChange
75
+ }, props), children, /*#__PURE__*/React.createElement(_JSXStyle, {
76
+ id: "421785314",
77
+ dynamic: [SCALES.pt(0.9), SCALES.pr(0), SCALES.pb(0.9), SCALES.pl(0)]
78
+ }, ".tooltip-content.popover > .inner{padding:".concat(SCALES.pt(0.9), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0.9), " ").concat(SCALES.pl(0), ";}"))));
79
+ }
80
+
81
+ PopoverComponent.displayName = 'BolioUIPopover';
82
+ var Popover = withScale(PopoverComponent);
83
+ export default Popover;
@@ -0,0 +1,84 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { useState } from 'react';
3
+ import Popover from '.';
4
+ import Link from '../link';
5
+ import Spacer from '../spacer';
6
+ import Grid from '../grid';
7
+ export default {
8
+ title: 'Data Display/Popover',
9
+ component: Popover
10
+ };
11
+ export var Default = function Default() {
12
+ var content = function content() {
13
+ return /*#__PURE__*/React.createElement("div", {
14
+ style: {
15
+ padding: '0 10px'
16
+ }
17
+ }, /*#__PURE__*/React.createElement(Link, {
18
+ href: "#"
19
+ }, "A hyperlink"), /*#__PURE__*/React.createElement(Spacer, {
20
+ h: 0.5
21
+ }), /*#__PURE__*/React.createElement(Link, {
22
+ color: true,
23
+ href: "#"
24
+ }, "External link"));
25
+ };
26
+
27
+ return /*#__PURE__*/React.createElement(Grid.Container, {
28
+ gap: 2
29
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Popover, {
30
+ content: content
31
+ }, "Menu")));
32
+ };
33
+ export var PresetItem = function PresetItem() {
34
+ var content = function content() {
35
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Popover.Item, {
36
+ title: true
37
+ }, /*#__PURE__*/React.createElement("span", null, "User Settings")), /*#__PURE__*/React.createElement(Popover.Item, null, /*#__PURE__*/React.createElement(Link, {
38
+ href: "#"
39
+ }, "A hyperlink")), /*#__PURE__*/React.createElement(Popover.Item, null, /*#__PURE__*/React.createElement(Link, {
40
+ color: true,
41
+ href: "#"
42
+ }, "A hyperlink for edit profile")), /*#__PURE__*/React.createElement(Popover.Item, {
43
+ line: true
44
+ }), /*#__PURE__*/React.createElement(Popover.Item, null, /*#__PURE__*/React.createElement("span", null, "Command-Line")));
45
+ };
46
+
47
+ return /*#__PURE__*/React.createElement(Grid.Container, {
48
+ gap: 2
49
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Popover, {
50
+ content: content
51
+ }, "Menu")));
52
+ };
53
+ export var CloseManual = function CloseManual() {
54
+ var _useState = useState(false),
55
+ _useState2 = _slicedToArray(_useState, 2),
56
+ visible = _useState2[0],
57
+ setVisible = _useState2[1];
58
+
59
+ var changeHandler = function changeHandler(next) {
60
+ setVisible(next);
61
+ };
62
+
63
+ var content = function content() {
64
+ return /*#__PURE__*/React.createElement("div", {
65
+ style: {
66
+ padding: '0 10px'
67
+ }
68
+ }, /*#__PURE__*/React.createElement("span", {
69
+ onClick: function onClick() {
70
+ return setVisible(false);
71
+ }
72
+ }, "Click to close"), /*#__PURE__*/React.createElement(Spacer, {
73
+ h: 0.5
74
+ }), /*#__PURE__*/React.createElement("span", null, "Nothing"));
75
+ };
76
+
77
+ return /*#__PURE__*/React.createElement(Grid.Container, {
78
+ gap: 2
79
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Popover, {
80
+ content: content,
81
+ visible: visible,
82
+ onVisibleChange: changeHandler
83
+ }, "Menu")));
84
+ };
@@ -0,0 +1,2 @@
1
+ import Progress from './progress';
2
+ export default Progress;
@@ -0,0 +1,76 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["value", "max", "className", "type", "colors", "fixedTop", "fixedBottom"];
4
+ import _JSXStyle from "../styled-jsx.es.js";
5
+ import React from 'react';
6
+ import useTheme from '../use-theme';
7
+ import { useProportions } from '../utils/calculations';
8
+ import useScale, { withScale } from '../use-scale';
9
+ import useClasses from '../use-classes';
10
+
11
+ var getCurrentColor = function getCurrentColor(ratio, palette, type) {
12
+ var colors = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
13
+ var defaultColors = {
14
+ "default": palette.foreground,
15
+ primary: palette.primary,
16
+ success: palette.success,
17
+ secondary: palette.secondary,
18
+ warning: palette.warning,
19
+ error: palette.error,
20
+ info: palette.info
21
+ };
22
+ var colorKeys = Object.keys(colors);
23
+ if (colorKeys.length === 0) return defaultColors[type];
24
+ var customColorKey = colorKeys.find(function (key) {
25
+ return ratio <= +key;
26
+ });
27
+ if (!customColorKey || Number.isNaN(+customColorKey)) return defaultColors[type];
28
+ return colors[+customColorKey];
29
+ };
30
+
31
+ function ProgressComponent(_ref) {
32
+ var _ref$value = _ref.value,
33
+ value = _ref$value === void 0 ? 0 : _ref$value,
34
+ _ref$max = _ref.max,
35
+ max = _ref$max === void 0 ? 100 : _ref$max,
36
+ _ref$className = _ref.className,
37
+ className = _ref$className === void 0 ? '' : _ref$className,
38
+ _ref$type = _ref.type,
39
+ type = _ref$type === void 0 ? 'default' : _ref$type,
40
+ colors = _ref.colors,
41
+ _ref$fixedTop = _ref.fixedTop,
42
+ fixedTop = _ref$fixedTop === void 0 ? false : _ref$fixedTop,
43
+ _ref$fixedBottom = _ref.fixedBottom,
44
+ fixedBottom = _ref$fixedBottom === void 0 ? false : _ref$fixedBottom,
45
+ props = _objectWithoutProperties(_ref, _excluded);
46
+
47
+ var theme = useTheme();
48
+
49
+ var _useScale = useScale(),
50
+ SCALES = _useScale.SCALES;
51
+
52
+ var percentValue = useProportions(value, max);
53
+ var currentColor = getCurrentColor(percentValue, theme.palette, type, colors);
54
+ var fixed = fixedTop || fixedBottom;
55
+ var classes = useClasses('progress', {
56
+ fixed: fixed
57
+ }, className);
58
+ return /*#__PURE__*/React.createElement("div", {
59
+ className: _JSXStyle.dynamic([["3126216551", [theme.palette.accents_2, theme.layout.radius, SCALES.width(1, '100%'), SCALES.height(0.625), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), fixedTop ? 0 : 'unset', fixedBottom ? 0 : 'unset', theme.layout.radius, currentColor, percentValue]]]) + " " + (classes || "")
60
+ }, /*#__PURE__*/React.createElement("div", {
61
+ title: "".concat(percentValue, "%"),
62
+ className: _JSXStyle.dynamic([["3126216551", [theme.palette.accents_2, theme.layout.radius, SCALES.width(1, '100%'), SCALES.height(0.625), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), fixedTop ? 0 : 'unset', fixedBottom ? 0 : 'unset', theme.layout.radius, currentColor, percentValue]]]) + " " + "inner"
63
+ }), /*#__PURE__*/React.createElement("progress", _extends({
64
+ value: value,
65
+ max: max
66
+ }, props, {
67
+ className: _JSXStyle.dynamic([["3126216551", [theme.palette.accents_2, theme.layout.radius, SCALES.width(1, '100%'), SCALES.height(0.625), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), fixedTop ? 0 : 'unset', fixedBottom ? 0 : 'unset', theme.layout.radius, currentColor, percentValue]]]) + " " + (props && props.className != null && props.className || className || "")
68
+ })), /*#__PURE__*/React.createElement(_JSXStyle, {
69
+ id: "3126216551",
70
+ dynamic: [theme.palette.accents_2, theme.layout.radius, SCALES.width(1, '100%'), SCALES.height(0.625), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), fixedTop ? 0 : 'unset', fixedBottom ? 0 : 'unset', theme.layout.radius, currentColor, percentValue]
71
+ }, "progress.__jsx-style-dynamic-selector{position:fixed;top:-1000px;opacity:0;visibility:hidden;pointer-events:none;}.progress.__jsx-style-dynamic-selector{position:relative;background-color:".concat(theme.palette.accents_2, ";border-radius:").concat(theme.layout.radius, ";width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(0.625), ";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), ";}.fixed.__jsx-style-dynamic-selector{position:fixed;top:").concat(fixedTop ? 0 : 'unset', ";bottom:").concat(fixedBottom ? 0 : 'unset', ";left:0;border-radius:0;}.fixed.__jsx-style-dynamic-selector>.inner.__jsx-style-dynamic-selector{border-radius:0;}.inner.__jsx-style-dynamic-selector{position:absolute;top:0;left:0;height:100%;bottom:0;-webkit-transition:all 100ms ease-in;transition:all 100ms ease-in;border-radius:").concat(theme.layout.radius, ";background-color:").concat(currentColor, ";width:").concat(percentValue, "%;}")));
72
+ }
73
+
74
+ ProgressComponent.displayName = 'BolioUIProgress';
75
+ var Progress = withScale(ProgressComponent);
76
+ export default Progress;
@@ -0,0 +1,114 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { useState } from 'react';
3
+ import useTheme from '../use-theme';
4
+ import Progress from '.';
5
+ import Grid from '../grid';
6
+ import Button from '../button';
7
+ export default {
8
+ title: 'Feedback/Progress',
9
+ component: Progress
10
+ };
11
+ export var Default = function Default() {
12
+ return /*#__PURE__*/React.createElement(Grid.Container, {
13
+ gap: 2
14
+ }, /*#__PURE__*/React.createElement(Grid, {
15
+ xs: 12,
16
+ md: 12
17
+ }, /*#__PURE__*/React.createElement(Progress, {
18
+ value: 50
19
+ })));
20
+ };
21
+ export var CustomMax = function CustomMax() {
22
+ return /*#__PURE__*/React.createElement(Grid.Container, {
23
+ gap: 2
24
+ }, /*#__PURE__*/React.createElement(Grid, {
25
+ xs: 12,
26
+ md: 12
27
+ }, /*#__PURE__*/React.createElement(Progress, {
28
+ value: 45,
29
+ max: 50
30
+ })));
31
+ };
32
+ export var DynamicColors = function DynamicColors() {
33
+ var theme = useTheme();
34
+
35
+ var _useState = useState(20),
36
+ _useState2 = _slicedToArray(_useState, 2),
37
+ value = _useState2[0],
38
+ setValue = _useState2[1];
39
+
40
+ var colors = {
41
+ 20: theme.palette.error,
42
+ 40: theme.palette.warning,
43
+ 60: theme.palette.success,
44
+ 80: '#000'
45
+ };
46
+ return /*#__PURE__*/React.createElement(Grid.Container, {
47
+ gap: 2
48
+ }, /*#__PURE__*/React.createElement(Grid, {
49
+ xs: 12,
50
+ md: 12
51
+ }, /*#__PURE__*/React.createElement(Progress, {
52
+ value: value,
53
+ colors: colors
54
+ })), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
55
+ onClick: function onClick() {
56
+ return setValue(value + 20);
57
+ },
58
+ auto: true,
59
+ scale: 0.5
60
+ }, "Add")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
61
+ onClick: function onClick() {
62
+ return setValue(20);
63
+ },
64
+ auto: true,
65
+ scale: 0.5,
66
+ type: "error"
67
+ }, "Remove")));
68
+ };
69
+ export var Type = function Type() {
70
+ return /*#__PURE__*/React.createElement(Grid.Container, {
71
+ gap: 2
72
+ }, /*#__PURE__*/React.createElement(Grid, {
73
+ xs: 12,
74
+ md: 12
75
+ }, /*#__PURE__*/React.createElement(Progress, {
76
+ value: 3
77
+ })), /*#__PURE__*/React.createElement(Grid, {
78
+ xs: 12,
79
+ md: 12
80
+ }, /*#__PURE__*/React.createElement(Progress, {
81
+ type: "primary",
82
+ value: 74
83
+ })), /*#__PURE__*/React.createElement(Grid, {
84
+ xs: 12,
85
+ md: 12
86
+ }, /*#__PURE__*/React.createElement(Progress, {
87
+ type: "secondary",
88
+ value: 10
89
+ })), /*#__PURE__*/React.createElement(Grid, {
90
+ xs: 12,
91
+ md: 12
92
+ }, /*#__PURE__*/React.createElement(Progress, {
93
+ type: "success",
94
+ value: 45
95
+ })), /*#__PURE__*/React.createElement(Grid, {
96
+ xs: 12,
97
+ md: 12
98
+ }, /*#__PURE__*/React.createElement(Progress, {
99
+ type: "warning",
100
+ value: 100
101
+ })), /*#__PURE__*/React.createElement(Grid, {
102
+ xs: 12,
103
+ md: 12
104
+ }, /*#__PURE__*/React.createElement(Progress, {
105
+ type: "error",
106
+ value: 21
107
+ })), /*#__PURE__*/React.createElement(Grid, {
108
+ xs: 12,
109
+ md: 12
110
+ }, /*#__PURE__*/React.createElement(Progress, {
111
+ type: "info",
112
+ value: 34
113
+ })));
114
+ };
@@ -0,0 +1,7 @@
1
+ import Radio from './radio';
2
+ import RadioGroup from './radio-group';
3
+ import RadioDescription from './radio-description';
4
+ Radio.Group = RadioGroup;
5
+ Radio.Description = RadioDescription;
6
+ Radio.Desc = RadioDescription;
7
+ export default Radio;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ var defaultContext = {
3
+ disabledAll: false,
4
+ inGroup: false
5
+ };
6
+ export var RadioContext = /*#__PURE__*/React.createContext(defaultContext);
7
+ export var useRadioContext = function useRadioContext() {
8
+ return React.useContext(RadioContext);
9
+ };