@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,5 @@
1
+ import Tabs from './tabs';
2
+ import TabsItem from './tabs-item';
3
+ Tabs.Item = TabsItem;
4
+ Tabs.Tab = TabsItem;
5
+ export default Tabs;
@@ -0,0 +1,92 @@
1
+ import Tabs from '.';
2
+ import Text from '../text';
3
+ import Grid from '../grid';
4
+ import { Instagram, Facebook } from '@bolio-ui/icons';
5
+ export default {
6
+ title: 'Navigation/Tabs',
7
+ component: Tabs
8
+ };
9
+ export var Default = function Default() {
10
+ return /*#__PURE__*/React.createElement(Grid.Container, {
11
+ gap: 2
12
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tabs, {
13
+ initialValue: "1"
14
+ }, /*#__PURE__*/React.createElement(Tabs.Item, {
15
+ label: "Declarative",
16
+ value: "1"
17
+ }, "React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes."), /*#__PURE__*/React.createElement(Tabs.Item, {
18
+ label: "Component-Based",
19
+ value: "2"
20
+ }, "Build encapsulated components that manage their own state, then compose them to make complex UIs."))));
21
+ };
22
+ export var Disabled = function Disabled() {
23
+ return /*#__PURE__*/React.createElement(Grid.Container, {
24
+ gap: 2
25
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tabs, {
26
+ initialValue: "1"
27
+ }, /*#__PURE__*/React.createElement(Tabs.Item, {
28
+ label: "Declarative",
29
+ value: "1"
30
+ }, "React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes."), /*#__PURE__*/React.createElement(Tabs.Item, {
31
+ label: "Component-Based",
32
+ value: "2",
33
+ disabled: true
34
+ }))));
35
+ };
36
+ export var HideDivider = function HideDivider() {
37
+ return /*#__PURE__*/React.createElement(Grid.Container, {
38
+ gap: 2
39
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tabs, {
40
+ initialValue: "react",
41
+ hideDivider: true
42
+ }, /*#__PURE__*/React.createElement(Tabs.Item, {
43
+ label: "Declarative",
44
+ value: "react"
45
+ }, /*#__PURE__*/React.createElement(Text, {
46
+ mt: 0
47
+ }, "React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.")), /*#__PURE__*/React.createElement(Tabs.Item, {
48
+ label: "Component-Based",
49
+ value: "component-based"
50
+ }, /*#__PURE__*/React.createElement(Text, {
51
+ mt: 0
52
+ }, "Build encapsulated components that manage their own state, then compose them to make complex UIs.")))));
53
+ };
54
+ export var HideBorder = function HideBorder() {
55
+ return /*#__PURE__*/React.createElement(Grid.Container, {
56
+ gap: 2
57
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tabs, {
58
+ initialValue: "react",
59
+ hideDivider: true,
60
+ hideBorder: true,
61
+ leftSpace: 0
62
+ }, /*#__PURE__*/React.createElement(Tabs.Item, {
63
+ label: "Declarative",
64
+ value: "react"
65
+ }, /*#__PURE__*/React.createElement(Text, {
66
+ mt: 0
67
+ }, "React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.")), /*#__PURE__*/React.createElement(Tabs.Item, {
68
+ label: "Component-Based",
69
+ value: "component-based"
70
+ }, /*#__PURE__*/React.createElement(Text, {
71
+ mt: 0
72
+ }, "Build encapsulated components that manage their own state, then compose them to make complex UIs.")))));
73
+ };
74
+ export var WithIcon = function WithIcon() {
75
+ return /*#__PURE__*/React.createElement(Grid.Container, {
76
+ gap: 2
77
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tabs, {
78
+ initialValue: "1",
79
+ align: "center",
80
+ leftSpace: 0
81
+ }, /*#__PURE__*/React.createElement(Tabs.Item, {
82
+ label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Instagram, null), " Instagram"),
83
+ value: "1"
84
+ }, /*#__PURE__*/React.createElement(Text, {
85
+ mt: 0
86
+ }, "Hello, this is my profile.")), /*#__PURE__*/React.createElement(Tabs.Item, {
87
+ label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Facebook, null), " Facebook"),
88
+ value: "2"
89
+ }, /*#__PURE__*/React.createElement(Text, {
90
+ mt: 0
91
+ }, "Hi, this is my page.")))));
92
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ var defaultContext = {
3
+ inGroup: false
4
+ };
5
+ export var TabsContext = /*#__PURE__*/React.createContext(defaultContext);
6
+ export var useTabsContext = function useTabsContext() {
7
+ return React.useContext(TabsContext);
8
+ };
@@ -0,0 +1,80 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _JSXStyle from "../styled-jsx.es.js";
3
+ import React, { useEffect, useMemo, useRef } from 'react';
4
+ import { useTabsContext } from './tabs-context';
5
+ import useTheme from '../use-theme';
6
+ import useScale, { withScale } from '../use-scale';
7
+ import useClasses from '../use-classes';
8
+
9
+ function TabsItemComponent(_ref) {
10
+ var children = _ref.children,
11
+ value = _ref.value,
12
+ label = _ref.label,
13
+ _ref$disabled = _ref.disabled,
14
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled;
15
+
16
+ var _useScale = useScale(),
17
+ SCALES = _useScale.SCALES;
18
+
19
+ var _useTabsContext = useTabsContext(),
20
+ register = _useTabsContext.register,
21
+ currentValue = _useTabsContext.currentValue;
22
+
23
+ var isActive = useMemo(function () {
24
+ return currentValue === value;
25
+ }, [currentValue, value]);
26
+
27
+ var TabsInternalCell = function TabsInternalCell(_ref2) {
28
+ var _useClasses;
29
+
30
+ var onClick = _ref2.onClick,
31
+ onMouseOver = _ref2.onMouseOver,
32
+ activeClassName = _ref2.activeClassName,
33
+ activeStyle = _ref2.activeStyle,
34
+ hideBorder = _ref2.hideBorder;
35
+ var theme = useTheme();
36
+ var ref = useRef(null);
37
+
38
+ var _useTabsContext2 = useTabsContext(),
39
+ currentValue = _useTabsContext2.currentValue;
40
+
41
+ var active = currentValue === value;
42
+ var classes = useClasses('tab', (_useClasses = {
43
+ active: active,
44
+ disabled: disabled
45
+ }, _defineProperty(_useClasses, activeClassName, active), _defineProperty(_useClasses, 'hide-border', hideBorder), _useClasses));
46
+
47
+ var clickHandler = function clickHandler() {
48
+ if (disabled) return;
49
+ onClick && onClick(value);
50
+ };
51
+
52
+ return /*#__PURE__*/React.createElement("div", {
53
+ ref: ref,
54
+ role: "button",
55
+ key: value,
56
+ onMouseOver: onMouseOver,
57
+ onClick: clickHandler,
58
+ style: active ? activeStyle : {},
59
+ "data-bolioui": "tab-item",
60
+ className: _JSXStyle.dynamic([["605786882", [theme.palette.accents_5, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0.875), SCALES.pr(0.55), SCALES.pb(0.875), SCALES.pl(0.55), SCALES.mt(0), SCALES.mr(0.2), SCALES.mb(0), SCALES.ml(0.2), SCALES.pl(0.28), SCALES.pr(0.28), theme.palette.foreground, theme.palette.foreground, theme.palette.foreground, theme.palette.accents_3, label]]]) + " " + (classes || "")
61
+ }, label, /*#__PURE__*/React.createElement(_JSXStyle, {
62
+ id: "605786882",
63
+ dynamic: [theme.palette.accents_5, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0.875), SCALES.pr(0.55), SCALES.pb(0.875), SCALES.pl(0.55), SCALES.mt(0), SCALES.mr(0.2), SCALES.mb(0), SCALES.ml(0.2), SCALES.pl(0.28), SCALES.pr(0.28), theme.palette.foreground, theme.palette.foreground, theme.palette.foreground, theme.palette.accents_3, label]
64
+ }, ".tab.__jsx-style-dynamic-selector{position:relative;box-sizing:border-box;cursor:pointer;outline:0;text-transform:capitalize;white-space:nowrap;background-color:transparent;color:".concat(theme.palette.accents_5, ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-size:").concat(SCALES.font(0.875), ";line-height:normal;width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0.875), " ").concat(SCALES.pr(0.55), " ").concat(SCALES.pb(0.875), " ").concat(SCALES.pl(0.55), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0.2), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0.2), ";z-index:1;--tabs-item-hover-left:calc(-1 * ").concat(SCALES.pl(0.28), ");--tabs-item-hover-right:calc(-1 * ").concat(SCALES.pr(0.28), ");}.tab.__jsx-style-dynamic-selector:hover{color:").concat(theme.palette.foreground, ";}.tab.__jsx-style-dynamic-selector:after{position:absolute;content:'';bottom:-1px;left:0;right:0;width:100%;height:2px;border-radius:4px;-webkit-transform:scaleX(0.75);-ms-transform:scaleX(0.75);transform:scaleX(0.75);background-color:").concat(theme.palette.foreground, ";-webkit-transition:opacity,-webkit-transform 200ms ease-in;-webkit-transition:opacity,transform 200ms ease-in;transition:opacity,transform 200ms ease-in;opacity:0;}.active.__jsx-style-dynamic-selector:after{opacity:1;-webkit-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);}.tab.__jsx-style-dynamic-selector svg{max-height:1em;margin-right:5px;}.tab.__jsx-style-dynamic-selector:first-of-type{margin-left:0;}.active.__jsx-style-dynamic-selector{color:").concat(theme.palette.foreground, ";}.disabled.__jsx-style-dynamic-selector{color:").concat(theme.palette.accents_3, ";cursor:not-allowed;}.hide-border.__jsx-style-dynamic-selector:before{display:block;content:").concat(label, ";font-weight:500;height:0;overflow:hidden;visibility:hidden;}.hide-border.__jsx-style-dynamic-selector:after{display:none;}.hide-border.active.__jsx-style-dynamic-selector{font-weight:500;}")));
65
+ };
66
+
67
+ TabsInternalCell.displayName = 'BolioUITabsInternalCell';
68
+ useEffect(function () {
69
+ register && register({
70
+ value: value,
71
+ cell: TabsInternalCell
72
+ });
73
+ }, [value, label, disabled]);
74
+ return isActive ? /*#__PURE__*/React.createElement(React.Fragment, null, children) : null;
75
+ }
76
+
77
+ TabsItemComponent.displayName = 'BolioUITabsItem';
78
+ var TabsItem = withScale(TabsItemComponent);
79
+ export default TabsItem;
80
+ /* eslint-enable */
@@ -0,0 +1,151 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ var _excluded = ["initialValue", "value", "hideDivider", "hideBorder", "children", "onChange", "className", "leftSpace", "highlight", "hoverHeightRatio", "hoverWidthRatio", "activeClassName", "activeStyles", "align"];
6
+ import _JSXStyle from "../styled-jsx.es.js";
7
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
8
+ import useTheme from '../use-theme';
9
+ import { TabsContext } from './tabs-context';
10
+ import useScale, { withScale } from '../use-scale';
11
+ import Highlight from '../shared/highlight';
12
+ import { useRect } from '../utils/layouts';
13
+ import { isBolioUIElement } from '../utils/collections';
14
+ import useClasses from '../use-classes';
15
+
16
+ function TabsComponent(_ref) {
17
+ var userCustomInitialValue = _ref.initialValue,
18
+ value = _ref.value,
19
+ _ref$hideDivider = _ref.hideDivider,
20
+ hideDivider = _ref$hideDivider === void 0 ? false : _ref$hideDivider,
21
+ _ref$hideBorder = _ref.hideBorder,
22
+ hideBorder = _ref$hideBorder === void 0 ? false : _ref$hideBorder,
23
+ children = _ref.children,
24
+ onChange = _ref.onChange,
25
+ _ref$className = _ref.className,
26
+ className = _ref$className === void 0 ? '' : _ref$className,
27
+ _ref$leftSpace = _ref.leftSpace,
28
+ leftSpace = _ref$leftSpace === void 0 ? '12px' : _ref$leftSpace,
29
+ _ref$highlight = _ref.highlight,
30
+ highlight = _ref$highlight === void 0 ? true : _ref$highlight,
31
+ _ref$hoverHeightRatio = _ref.hoverHeightRatio,
32
+ hoverHeightRatio = _ref$hoverHeightRatio === void 0 ? 0.7 : _ref$hoverHeightRatio,
33
+ _ref$hoverWidthRatio = _ref.hoverWidthRatio,
34
+ hoverWidthRatio = _ref$hoverWidthRatio === void 0 ? 1.15 : _ref$hoverWidthRatio,
35
+ _ref$activeClassName = _ref.activeClassName,
36
+ activeClassName = _ref$activeClassName === void 0 ? '' : _ref$activeClassName,
37
+ activeStyles = _ref.activeStyles,
38
+ _ref$align = _ref.align,
39
+ align = _ref$align === void 0 ? 'left' : _ref$align,
40
+ props = _objectWithoutProperties(_ref, _excluded);
41
+
42
+ var theme = useTheme();
43
+
44
+ var _useScale = useScale(),
45
+ SCALES = _useScale.SCALES;
46
+
47
+ var _useState = useState([]),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ tabs = _useState2[0],
50
+ setTabs = _useState2[1];
51
+
52
+ var _useState3 = useState(userCustomInitialValue),
53
+ _useState4 = _slicedToArray(_useState3, 2),
54
+ selfValue = _useState4[0],
55
+ setSelfValue = _useState4[1];
56
+
57
+ var ref = useRef(null);
58
+
59
+ var _useState5 = useState(false),
60
+ _useState6 = _slicedToArray(_useState5, 2),
61
+ displayHighlight = _useState6[0],
62
+ setDisplayHighlight = _useState6[1];
63
+
64
+ var _useRect = useRect(),
65
+ rect = _useRect.rect,
66
+ setRect = _useRect.setRect;
67
+
68
+ var register = function register(next) {
69
+ setTabs(function (last) {
70
+ var hasItem = last.find(function (item) {
71
+ return item.value === next.value;
72
+ });
73
+ if (!hasItem) return [].concat(_toConsumableArray(last), [next]);
74
+ return last.map(function (item) {
75
+ if (item.value !== next.value) return item;
76
+ return _extends({}, item, next);
77
+ });
78
+ });
79
+ };
80
+
81
+ var initialValue = useMemo(function () {
82
+ return {
83
+ register: register,
84
+ currentValue: selfValue,
85
+ inGroup: true,
86
+ leftSpace: leftSpace
87
+ };
88
+ }, [selfValue, leftSpace]);
89
+ useEffect(function () {
90
+ if (typeof value === 'undefined') return;
91
+ setSelfValue(value);
92
+ }, [value]);
93
+
94
+ var clickHandler = function clickHandler(value) {
95
+ setSelfValue(value);
96
+ onChange && onChange(value);
97
+ };
98
+
99
+ var tabItemMouseOverHandler = function tabItemMouseOverHandler(event) {
100
+ if (!isBolioUIElement(event.target)) return;
101
+ setRect(event, function () {
102
+ return ref.current;
103
+ });
104
+
105
+ if (highlight) {
106
+ setDisplayHighlight(true);
107
+ }
108
+ };
109
+
110
+ return /*#__PURE__*/React.createElement(TabsContext.Provider, {
111
+ value: initialValue
112
+ }, /*#__PURE__*/React.createElement("div", _extends({}, props, {
113
+ className: _JSXStyle.dynamic([["750647969", [SCALES.font(1), SCALES.width(1, 'initial'), 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), align, theme.palette.border, leftSpace]]]) + " " + (props && props.className != null && props.className || useClasses('tabs', className) || "")
114
+ }), /*#__PURE__*/React.createElement("header", {
115
+ ref: ref,
116
+ onMouseLeave: function onMouseLeave() {
117
+ return setDisplayHighlight(false);
118
+ },
119
+ className: _JSXStyle.dynamic([["750647969", [SCALES.font(1), SCALES.width(1, 'initial'), 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), align, theme.palette.border, leftSpace]]])
120
+ }, /*#__PURE__*/React.createElement(Highlight, {
121
+ rect: rect,
122
+ visible: displayHighlight,
123
+ hoverHeightRatio: hoverHeightRatio,
124
+ hoverWidthRatio: hoverWidthRatio
125
+ }), /*#__PURE__*/React.createElement("div", {
126
+ className: _JSXStyle.dynamic([["750647969", [SCALES.font(1), SCALES.width(1, 'initial'), 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), align, theme.palette.border, leftSpace]]]) + " " + (useClasses('scroll-container', {
127
+ 'hide-divider': hideDivider
128
+ }) || "")
129
+ }, tabs.map(function (_ref2) {
130
+ var Cell = _ref2.cell,
131
+ value = _ref2.value;
132
+ return /*#__PURE__*/React.createElement(Cell, {
133
+ key: value,
134
+ onClick: clickHandler,
135
+ onMouseOver: tabItemMouseOverHandler,
136
+ activeClassName: activeClassName,
137
+ activeStyle: activeStyles,
138
+ hideBorder: hideBorder,
139
+ className: _JSXStyle.dynamic([["750647969", [SCALES.font(1), SCALES.width(1, 'initial'), 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), align, theme.palette.border, leftSpace]]])
140
+ });
141
+ }))), /*#__PURE__*/React.createElement("div", {
142
+ className: _JSXStyle.dynamic([["750647969", [SCALES.font(1), SCALES.width(1, 'initial'), 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), align, theme.palette.border, leftSpace]]]) + " " + "content"
143
+ }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
144
+ id: "750647969",
145
+ dynamic: [SCALES.font(1), SCALES.width(1, 'initial'), 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), align, theme.palette.border, leftSpace]
146
+ }, ".tabs.__jsx-style-dynamic-selector{font-size:".concat(SCALES.font(1), ";width:").concat(SCALES.width(1, 'initial'), ";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), ";}header.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;overflow-y:hidden;overflow-x:scroll;-webkit-scrollbar-width:none;-moz-scrollbar-width:none;-ms-scrollbar-width:none;scrollbar-width:none;position:relative;}.scroll-container.__jsx-style-dynamic-selector{width:100%;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:").concat(align, ";-webkit-justify-content:").concat(align, ";-ms-flex-pack:").concat(align, ";justify-content:").concat(align, ";border-bottom:1px solid ").concat(theme.palette.border, ";padding-left:").concat(leftSpace, ";}header.__jsx-style-dynamic-selector::-webkit-scrollbar{display:none;}.hide-divider.__jsx-style-dynamic-selector{border-color:transparent;}.content.__jsx-style-dynamic-selector{padding-top:0.625rem;}"))));
147
+ }
148
+
149
+ TabsComponent.displayName = 'BolioUITabs';
150
+ var Tabs = withScale(TabsComponent);
151
+ export default Tabs;
@@ -0,0 +1,2 @@
1
+ import Tag from './tag';
2
+ export default Tag;
@@ -0,0 +1,58 @@
1
+ import Tag from '.';
2
+ import Grid from '../grid';
3
+ export default {
4
+ title: 'Data Display/Tag',
5
+ component: Tag
6
+ };
7
+ export var Default = function Default() {
8
+ return /*#__PURE__*/React.createElement(Grid.Container, {
9
+ gap: 2
10
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, null, "Status: Unstable")));
11
+ };
12
+ export var Types = function Types() {
13
+ return /*#__PURE__*/React.createElement(Grid.Container, {
14
+ gap: 2
15
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, null, "Default")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
16
+ type: "primary"
17
+ }, "Primary")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
18
+ type: "secondary"
19
+ }, "Secondary")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
20
+ type: "success"
21
+ }, "Success")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
22
+ type: "warning"
23
+ }, "Warning")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
24
+ type: "error"
25
+ }, "Error")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
26
+ type: "dark"
27
+ }, "Dark")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
28
+ type: "lite"
29
+ }, "Lite")));
30
+ };
31
+ export var TypesInvert = function TypesInvert() {
32
+ return /*#__PURE__*/React.createElement(Grid.Container, {
33
+ gap: 2
34
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
35
+ invert: true
36
+ }, "Default")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
37
+ type: "primary",
38
+ invert: true
39
+ }, "Primary")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
40
+ type: "secondary",
41
+ invert: true
42
+ }, "Secondary")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
43
+ type: "success",
44
+ invert: true
45
+ }, "Success")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
46
+ type: "warning",
47
+ invert: true
48
+ }, "Warning")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
49
+ type: "error",
50
+ invert: true
51
+ }, "Error")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
52
+ type: "dark",
53
+ invert: true
54
+ }, "Dark")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Tag, {
55
+ type: "lite",
56
+ invert: true
57
+ }, "Lite")));
58
+ };
package/esm/tag/tag.js ADDED
@@ -0,0 +1,86 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ var _excluded = ["type", "children", "className", "invert"];
4
+ import _JSXStyle from "../styled-jsx.es.js";
5
+ import React, { useMemo } from 'react';
6
+ import useTheme from '../use-theme';
7
+ import useScale, { withScale } from '../use-scale';
8
+
9
+ var getColors = function getColors(type, palette, invert) {
10
+ var colors = {
11
+ "default": {
12
+ color: palette.foreground
13
+ },
14
+ primary: {
15
+ color: palette.primary
16
+ },
17
+ secondary: {
18
+ color: palette.secondary
19
+ },
20
+ success: {
21
+ color: palette.success
22
+ },
23
+ warning: {
24
+ color: palette.warning
25
+ },
26
+ error: {
27
+ color: palette.error
28
+ },
29
+ info: {
30
+ color: palette.info
31
+ },
32
+ dark: {
33
+ color: palette.background,
34
+ bgColor: palette.foreground
35
+ },
36
+ lite: {
37
+ color: palette.foreground,
38
+ bgColor: palette.accents_2
39
+ }
40
+ };
41
+ var hideBorder = invert || type === 'lite';
42
+
43
+ var cardStyle = _extends({}, colors[type], {
44
+ bgColor: colors[type].bgColor || palette.background,
45
+ borderColor: hideBorder ? 'transparent' : colors[type].color
46
+ });
47
+
48
+ return !invert ? cardStyle : _extends({}, cardStyle, {
49
+ color: cardStyle.bgColor,
50
+ bgColor: cardStyle.color
51
+ });
52
+ };
53
+
54
+ function TagComponent(_ref) {
55
+ var _ref$type = _ref.type,
56
+ type = _ref$type === void 0 ? 'default' : _ref$type,
57
+ children = _ref.children,
58
+ _ref$className = _ref.className,
59
+ className = _ref$className === void 0 ? '' : _ref$className,
60
+ _ref$invert = _ref.invert,
61
+ invert = _ref$invert === void 0 ? false : _ref$invert,
62
+ props = _objectWithoutProperties(_ref, _excluded);
63
+
64
+ var theme = useTheme();
65
+
66
+ var _useScale = useScale(),
67
+ SCALES = _useScale.SCALES;
68
+
69
+ var _useMemo = useMemo(function () {
70
+ return getColors(type, theme.palette, invert);
71
+ }, [type, theme.palette, invert]),
72
+ color = _useMemo.color,
73
+ bgColor = _useMemo.bgColor,
74
+ borderColor = _useMemo.borderColor;
75
+
76
+ return /*#__PURE__*/React.createElement("span", _extends({}, props, {
77
+ className: _JSXStyle.dynamic([["3411740258", [borderColor, bgColor, color, SCALES.height(0.3125), SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1.75), SCALES.pt(0.375), SCALES.pr(0.375), SCALES.pb(0.375), SCALES.pl(0.375), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
78
+ }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
79
+ id: "3411740258",
80
+ dynamic: [borderColor, bgColor, color, SCALES.height(0.3125), SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1.75), SCALES.pt(0.375), SCALES.pr(0.375), SCALES.pb(0.375), SCALES.pl(0.375), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
81
+ }, "span.__jsx-style-dynamic-selector{display:inline-block;border:1px solid ".concat(borderColor, ";background-color:").concat(bgColor, ";color:").concat(color, ";box-sizing:border-box;line-height:1em;border-radius:").concat(SCALES.height(0.3125), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1.75), ";padding:").concat(SCALES.pt(0.375), " ").concat(SCALES.pr(0.375), " ").concat(SCALES.pb(0.375), " ").concat(SCALES.pl(0.375), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")));
82
+ }
83
+
84
+ TagComponent.displayName = 'BolioUITag';
85
+ var Tag = withScale(TagComponent);
86
+ export default Tag;
@@ -0,0 +1,78 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["children", "tag", "className", "type"];
4
+ import _JSXStyle from "../styled-jsx.es.js";
5
+ import React, { useMemo } from 'react';
6
+ import useTheme from '../use-theme';
7
+ import useScale from '../use-scale';
8
+
9
+ var getTypeColor = function getTypeColor(type, palette) {
10
+ var colors = {
11
+ "default": 'inherit',
12
+ primary: palette.primary,
13
+ secondary: palette.secondary,
14
+ success: palette.success,
15
+ warning: palette.warning,
16
+ error: palette.error,
17
+ info: palette.info
18
+ };
19
+ return colors[type] || colors["default"];
20
+ };
21
+
22
+ function TextChild(_ref) {
23
+ var children = _ref.children,
24
+ tag = _ref.tag,
25
+ _ref$className = _ref.className,
26
+ className = _ref$className === void 0 ? '' : _ref$className,
27
+ _ref$type = _ref.type,
28
+ type = _ref$type === void 0 ? 'default' : _ref$type,
29
+ props = _objectWithoutProperties(_ref, _excluded);
30
+
31
+ var Component = tag;
32
+ var theme = useTheme();
33
+
34
+ var _useScale = useScale(),
35
+ SCALES = _useScale.SCALES,
36
+ getScaleProps = _useScale.getScaleProps;
37
+
38
+ var font = getScaleProps('font');
39
+ var mx = getScaleProps(['margin', 'marginLeft', 'marginRight', 'mx', 'ml', 'mr']);
40
+ var my = getScaleProps(['margin', 'marginTop', 'marginBottom', 'my', 'mt', 'mb']);
41
+ var px = getScaleProps(['padding', 'paddingLeft', 'paddingRight', 'pl', 'pr', 'px']);
42
+ var py = getScaleProps(['padding', 'paddingTop', 'paddingBottom', 'pt', 'pb', 'py']);
43
+ var color = useMemo(function () {
44
+ return getTypeColor(type, theme.palette);
45
+ }, [type, theme.palette]);
46
+ var classNames = useMemo(function () {
47
+ var keys = [{
48
+ value: mx,
49
+ className: 'mx'
50
+ }, {
51
+ value: my,
52
+ className: 'my'
53
+ }, {
54
+ value: px,
55
+ className: 'px'
56
+ }, {
57
+ value: py,
58
+ className: 'py'
59
+ }, {
60
+ value: font,
61
+ className: 'font'
62
+ }];
63
+ var scaleClassNames = keys.reduce(function (pre, next) {
64
+ if (typeof next.value === 'undefined') return pre;
65
+ return "".concat(pre, " ").concat(next.className);
66
+ }, '');
67
+ return "".concat(scaleClassNames, " ").concat(className).trim();
68
+ }, [mx, my, px, py, font, className]);
69
+ return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
70
+ className: _JSXStyle.dynamic([["3155699851", [tag, color, SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.font(1, 'inherit'), SCALES.ml(0, 'revert'), SCALES.mr(0, 'revert'), SCALES.mt(0, 'revert'), SCALES.mb(0, 'revert'), SCALES.pl(0, 'revert'), SCALES.pr(0, 'revert'), SCALES.pt(0, 'revert'), SCALES.pb(0, 'revert')]]]) + " " + (props && props.className != null && props.className || classNames || "")
71
+ }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
72
+ id: "3155699851",
73
+ dynamic: [tag, color, SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.font(1, 'inherit'), SCALES.ml(0, 'revert'), SCALES.mr(0, 'revert'), SCALES.mt(0, 'revert'), SCALES.mb(0, 'revert'), SCALES.pl(0, 'revert'), SCALES.pr(0, 'revert'), SCALES.pt(0, 'revert'), SCALES.pb(0, 'revert')]
74
+ }, "".concat(tag, ".__jsx-style-dynamic-selector{color:").concat(color, ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";}.font.__jsx-style-dynamic-selector{font-size:").concat(SCALES.font(1, 'inherit'), ";}.mx.__jsx-style-dynamic-selector{margin-left:").concat(SCALES.ml(0, 'revert'), ";margin-right:").concat(SCALES.mr(0, 'revert'), ";}.my.__jsx-style-dynamic-selector{margin-top:").concat(SCALES.mt(0, 'revert'), ";margin-bottom:").concat(SCALES.mb(0, 'revert'), ";}.px.__jsx-style-dynamic-selector{padding-left:").concat(SCALES.pl(0, 'revert'), ";padding-right:").concat(SCALES.pr(0, 'revert'), ";}.py.__jsx-style-dynamic-selector{padding-top:").concat(SCALES.pt(0, 'revert'), ";padding-bottom:").concat(SCALES.pb(0, 'revert'), ";}")));
75
+ }
76
+
77
+ TextChild.displayName = 'BolioUITextChild';
78
+ export default TextChild;
@@ -0,0 +1,2 @@
1
+ import Text from './text';
2
+ export default Text;