@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,86 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["className", "children", "visible", "placement"];
4
+ import _JSXStyle from "../styled-jsx.es.js";
5
+ import React, { useEffect, useMemo, useRef } from 'react';
6
+ import useScale from '../use-scale';
7
+ import useTheme from '../use-theme';
8
+ import CssTransition from '../shared/css-transition';
9
+ import { isChildElement } from '../utils/collections';
10
+ import { getDrawerTransform } from './helper';
11
+ import useClasses from '../use-classes';
12
+
13
+ function DrawerWrapper(_ref) {
14
+ var _ref$className = _ref.className,
15
+ className = _ref$className === void 0 ? '' : _ref$className,
16
+ children = _ref.children,
17
+ _ref$visible = _ref.visible,
18
+ visible = _ref$visible === void 0 ? false : _ref$visible,
19
+ placement = _ref.placement,
20
+ props = _objectWithoutProperties(_ref, _excluded);
21
+
22
+ var theme = useTheme();
23
+
24
+ var _useScale = useScale(),
25
+ SCALES = _useScale.SCALES;
26
+
27
+ var modalContent = useRef(null);
28
+ var tabStart = useRef(null);
29
+ var tabEnd = useRef(null);
30
+ var transform = useMemo(function () {
31
+ return getDrawerTransform(placement);
32
+ }, [placement]);
33
+ var classes = useClasses('wrapper', placement, className);
34
+ useEffect(function () {
35
+ if (!visible) return;
36
+ var activeElement = document.activeElement;
37
+ var isChild = isChildElement(modalContent.current, activeElement);
38
+ if (isChild) return;
39
+ tabStart.current && tabStart.current.focus();
40
+ }, [visible]);
41
+
42
+ var onKeyDown = function onKeyDown(event) {
43
+ var isTabDown = event.keyCode === 9;
44
+ if (!visible || !isTabDown) return;
45
+ var activeElement = document.activeElement;
46
+
47
+ if (event.shiftKey) {
48
+ if (activeElement === tabStart.current) {
49
+ tabEnd.current && tabEnd.current.focus();
50
+ }
51
+ } else {
52
+ if (activeElement === tabEnd.current) {
53
+ tabStart.current && tabStart.current.focus();
54
+ }
55
+ }
56
+ };
57
+
58
+ return /*#__PURE__*/React.createElement(CssTransition, {
59
+ name: "wrapper",
60
+ visible: visible,
61
+ clearTime: 300
62
+ }, /*#__PURE__*/React.createElement("div", _extends({
63
+ role: "dialog",
64
+ tabIndex: -1,
65
+ onKeyDown: onKeyDown,
66
+ ref: modalContent
67
+ }, props, {
68
+ className: _JSXStyle.dynamic([["1322120384", [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, transform.initial, SCALES.font(1), SCALES.pl(1.3125), SCALES.pr(1.3125), SCALES.pt(1.3125), SCALES.pb(1.3125), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.width(1, 'auto'), SCALES.height(1, '100%'), transform.hidden, transform.visible, transform.visible, transform.hidden]]]) + " " + (props && props.className != null && props.className || classes || "")
69
+ }), /*#__PURE__*/React.createElement("div", {
70
+ tabIndex: 0,
71
+ "aria-hidden": "true",
72
+ ref: tabStart,
73
+ className: _JSXStyle.dynamic([["1322120384", [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, transform.initial, SCALES.font(1), SCALES.pl(1.3125), SCALES.pr(1.3125), SCALES.pt(1.3125), SCALES.pb(1.3125), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.width(1, 'auto'), SCALES.height(1, '100%'), transform.hidden, transform.visible, transform.visible, transform.hidden]]]) + " " + "hide-tab start"
74
+ }), children, /*#__PURE__*/React.createElement("div", {
75
+ tabIndex: 0,
76
+ "aria-hidden": "true",
77
+ ref: tabEnd,
78
+ className: _JSXStyle.dynamic([["1322120384", [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, transform.initial, SCALES.font(1), SCALES.pl(1.3125), SCALES.pr(1.3125), SCALES.pt(1.3125), SCALES.pb(1.3125), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.width(1, 'auto'), SCALES.height(1, '100%'), transform.hidden, transform.visible, transform.visible, transform.hidden]]]) + " " + "hide-tab end"
79
+ }), /*#__PURE__*/React.createElement(_JSXStyle, {
80
+ id: "1322120384",
81
+ dynamic: [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, transform.initial, SCALES.font(1), SCALES.pl(1.3125), SCALES.pr(1.3125), SCALES.pt(1.3125), SCALES.pb(1.3125), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.width(1, 'auto'), SCALES.height(1, '100%'), transform.hidden, transform.visible, transform.visible, transform.hidden]
82
+ }, ".wrapper.__jsx-style-dynamic-selector{position:fixed;top:0;left:0;right:0;bottom:0;max-width:100%;vertical-align:middle;overflow:auto;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;box-sizing:border-box;background-color:".concat(theme.palette.background, ";color:").concat(theme.palette.foreground, ";border-radius:calc(3 * ").concat(theme.layout.radius, ");box-shadow:").concat(theme.expressiveness.shadowLarge, ";opacity:0;outline:none;-webkit-transform:").concat(transform.initial, ";-ms-transform:").concat(transform.initial, ";transform:").concat(transform.initial, ";-webkit-transition:opacity,-webkit-transform 400ms cubic-bezier(0.1,0.6,0.1,1);-webkit-transition:opacity,transform 400ms cubic-bezier(0.1,0.6,0.1,1);transition:opacity,transform 400ms cubic-bezier(0.1,0.6,0.1,1);font-size:").concat(SCALES.font(1), ";--modal-wrapper-padding-left:").concat(SCALES.pl(1.3125), ";--modal-wrapper-padding-right:").concat(SCALES.pr(1.3125), ";padding:").concat(SCALES.pt(1.3125), " var(--modal-wrapper-padding-right) ").concat(SCALES.pb(1.3125), " var(--modal-wrapper-padding-left);margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.top.__jsx-style-dynamic-selector,.bottom.__jsx-style-dynamic-selector{width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, 'auto'), ";}.left.__jsx-style-dynamic-selector,.right.__jsx-style-dynamic-selector{width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, '100%'), ";}.top.__jsx-style-dynamic-selector{bottom:auto;border-top-left-radius:0;border-top-right-radius:0;}.left.__jsx-style-dynamic-selector{right:auto;border-top-left-radius:0;border-bottom-left-radius:0;}.bottom.__jsx-style-dynamic-selector{top:auto;border-bottom-left-radius:0;border-bottom-right-radius:0;}.right.__jsx-style-dynamic-selector{left:auto;border-top-right-radius:0;border-bottom-right-radius:0;}.wrapper-enter.__jsx-style-dynamic-selector{opacity:0;-webkit-transform:").concat(transform.hidden, ";-ms-transform:").concat(transform.hidden, ";transform:").concat(transform.hidden, ";}.wrapper-enter-active.__jsx-style-dynamic-selector{opacity:1;-webkit-transform:").concat(transform.visible, ";-ms-transform:").concat(transform.visible, ";transform:").concat(transform.visible, ";}.wrapper-leave.__jsx-style-dynamic-selector{opacity:1;-webkit-transform:").concat(transform.visible, ";-ms-transform:").concat(transform.visible, ";transform:").concat(transform.visible, ";-webkit-transition:opacity,-webkit-transform 400ms cubic-bezier(0.1,0.2,0.1,1);-webkit-transition:opacity,transform 400ms cubic-bezier(0.1,0.2,0.1,1);transition:opacity,transform 400ms cubic-bezier(0.1,0.2,0.1,1);}.wrapper-leave-active.__jsx-style-dynamic-selector{opacity:0.4;-webkit-transform:").concat(transform.hidden, ";-ms-transform:").concat(transform.hidden, ";transform:").concat(transform.hidden, ";}.hide-tab.__jsx-style-dynamic-selector{outline:none;overflow:hidden;width:0;height:0;opacity:0;}"))));
83
+ }
84
+
85
+ DrawerWrapper.displayName = 'BolioUIDrawerWrapper';
86
+ export default DrawerWrapper;
@@ -0,0 +1,77 @@
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 = ["visible", "keyboard", "disableBackdropClick", "wrapClassName", "children", "placement", "onClose", "onContentClick"];
5
+ import React, { useEffect, useState } from 'react';
6
+ import { withScale } from '../use-scale';
7
+ import usePortal from '../utils/use-portal';
8
+ import useBodyScroll from '../utils/use-body-scroll';
9
+ import useKeyboard, { KeyCode } from '../use-keyboard';
10
+ import { createPortal } from 'react-dom';
11
+ import Backdrop from '../shared/backdrop';
12
+ import DrawerWrapper from './drawer-wrapper';
13
+
14
+ function DrawerComponent(_ref) {
15
+ var customVisible = _ref.visible,
16
+ keyboard = _ref.keyboard,
17
+ disableBackdropClick = _ref.disableBackdropClick,
18
+ wrapClassName = _ref.wrapClassName,
19
+ children = _ref.children,
20
+ placement = _ref.placement,
21
+ onClose = _ref.onClose,
22
+ onContentClick = _ref.onContentClick,
23
+ props = _objectWithoutProperties(_ref, _excluded);
24
+
25
+ var portal = usePortal('drawer');
26
+
27
+ var _useState = useState(false),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ visible = _useState2[0],
30
+ setVisible = _useState2[1];
31
+
32
+ var _useBodyScroll = useBodyScroll(null, {
33
+ delayReset: 300
34
+ }),
35
+ _useBodyScroll2 = _slicedToArray(_useBodyScroll, 2),
36
+ setBodyHidden = _useBodyScroll2[1];
37
+
38
+ var closeDrawer = function closeDrawer() {
39
+ onClose && onClose();
40
+ setVisible(false);
41
+ setBodyHidden(false);
42
+ };
43
+
44
+ useEffect(function () {
45
+ if (typeof customVisible === 'undefined') return;
46
+ setVisible(customVisible);
47
+ setBodyHidden(customVisible);
48
+ }, [customVisible, setBodyHidden]);
49
+
50
+ var _useKeyboard = useKeyboard(function () {
51
+ keyboard && closeDrawer();
52
+ }, KeyCode.Escape, {
53
+ disableGlobalEvent: true
54
+ }),
55
+ bindings = _useKeyboard.bindings;
56
+
57
+ var closeFromBackdrop = function closeFromBackdrop() {
58
+ if (disableBackdropClick) return;
59
+ closeDrawer();
60
+ };
61
+
62
+ if (!portal) return null;
63
+ return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(Backdrop, _extends({
64
+ onClick: closeFromBackdrop,
65
+ onContentClick: onContentClick,
66
+ visible: visible,
67
+ width: "100%"
68
+ }, bindings), /*#__PURE__*/React.createElement(DrawerWrapper, _extends({
69
+ visible: visible,
70
+ className: wrapClassName,
71
+ placement: placement
72
+ }, props), children)), portal);
73
+ }
74
+
75
+ DrawerComponent.displayName = 'BolioUIDrawer';
76
+ var Drawer = withScale(DrawerComponent);
77
+ export default Drawer;
@@ -0,0 +1,27 @@
1
+ import { tuple } from '../utils/prop-types';
2
+ var drawerPlacement = tuple('top', 'right', 'bottom', 'left');
3
+ export var getDrawerTransform = function getDrawerTransform(placement) {
4
+ var translates = {
5
+ top: {
6
+ initial: 'translate3d(0, -100%, 0)',
7
+ hidden: 'translate3d(0, -100%, 0)',
8
+ visible: 'translate3d(0, 0, 0)'
9
+ },
10
+ left: {
11
+ initial: 'translate3d(-100%, 0, 0)',
12
+ hidden: 'translate3d(-100%, 0, 0)',
13
+ visible: 'translate3d(0, 0, 0)'
14
+ },
15
+ bottom: {
16
+ initial: 'translate3d(0, 100%, 0)',
17
+ hidden: 'translate3d(0, 100%, 0)',
18
+ visible: 'translate3d(0, 0, 0)'
19
+ },
20
+ right: {
21
+ initial: 'translate3d(100%, 0, 0)',
22
+ hidden: 'translate3d(100%, 0, 0)',
23
+ visible: 'translate3d(0, 0, 0)'
24
+ }
25
+ };
26
+ return translates[placement];
27
+ };
@@ -0,0 +1,8 @@
1
+ import Drawer from './drawer';
2
+ import ModalTitle from '../modal/modal-title';
3
+ import ModalSubtitle from '../modal/modal-subtitle';
4
+ import ModalContent from '../modal/modal-content';
5
+ Drawer.Title = ModalTitle;
6
+ Drawer.Subtitle = ModalSubtitle;
7
+ Drawer.Content = ModalContent;
8
+ export default Drawer;
@@ -0,0 +1,79 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { useState } from 'react';
3
+ import Drawer from '.';
4
+ import Button from '../button';
5
+ import Grid from '../grid';
6
+ export default {
7
+ title: 'Feedback/Drawer',
8
+ component: Drawer
9
+ };
10
+ export var Default = function Default() {
11
+ var _useState = useState(false),
12
+ _useState2 = _slicedToArray(_useState, 2),
13
+ state = _useState2[0],
14
+ setState = _useState2[1];
15
+
16
+ return /*#__PURE__*/React.createElement(Grid.Container, {
17
+ gap: 2
18
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
19
+ auto: true,
20
+ onClick: function onClick() {
21
+ return setState(true);
22
+ }
23
+ }, "Show Drawer"), /*#__PURE__*/React.createElement(Drawer, {
24
+ visible: state,
25
+ onClose: function onClose() {
26
+ return setState(false);
27
+ },
28
+ placement: "right"
29
+ }, /*#__PURE__*/React.createElement(Drawer.Title, null, "Drawer"), /*#__PURE__*/React.createElement(Drawer.Subtitle, null, "Example of a drawer"), /*#__PURE__*/React.createElement(Drawer.Content, null, /*#__PURE__*/React.createElement("p", null, "Demo content for the drawer.")))));
30
+ };
31
+ export var Placement = function Placement() {
32
+ var _React$useState = React.useState(false),
33
+ _React$useState2 = _slicedToArray(_React$useState, 2),
34
+ state = _React$useState2[0],
35
+ setState = _React$useState2[1];
36
+
37
+ var _React$useState3 = React.useState('bottom'),
38
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
39
+ placement = _React$useState4[0],
40
+ setPlacement = _React$useState4[1];
41
+
42
+ var open = function open(text) {
43
+ setPlacement(text);
44
+ setState(true);
45
+ };
46
+
47
+ return /*#__PURE__*/React.createElement(Grid.Container, {
48
+ gap: 2
49
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
50
+ auto: true,
51
+ onClick: function onClick() {
52
+ return open('top');
53
+ },
54
+ mr: "10px"
55
+ }, "Top")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
56
+ auto: true,
57
+ onClick: function onClick() {
58
+ return open('right');
59
+ },
60
+ mr: "10px"
61
+ }, "Right")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
62
+ auto: true,
63
+ onClick: function onClick() {
64
+ return open('bottom');
65
+ },
66
+ mr: "10px"
67
+ }, "Bottom")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
68
+ auto: true,
69
+ onClick: function onClick() {
70
+ return open('left');
71
+ }
72
+ }, "Left")), /*#__PURE__*/React.createElement(Drawer, {
73
+ visible: state,
74
+ onClose: function onClose() {
75
+ return setState(false);
76
+ },
77
+ placement: placement
78
+ }, /*#__PURE__*/React.createElement(Drawer.Title, null, "Drawer"), /*#__PURE__*/React.createElement(Drawer.Subtitle, null, "Example of a drawer"), /*#__PURE__*/React.createElement(Drawer.Content, null, /*#__PURE__*/React.createElement("p", null, "Demo content for the drawer."))));
79
+ };
@@ -0,0 +1,29 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["className", "children"];
4
+ import _JSXStyle from "../styled-jsx.es.js";
5
+ import React from 'react';
6
+ import useScale, { withScale } from '../use-scale';
7
+ import useClasses from '../use-classes';
8
+
9
+ function FieldsetContentComponent(_ref) {
10
+ var _ref$className = _ref.className,
11
+ className = _ref$className === void 0 ? '' : _ref$className,
12
+ children = _ref.children,
13
+ props = _objectWithoutProperties(_ref, _excluded);
14
+
15
+ var _useScale = useScale(),
16
+ SCALES = _useScale.SCALES;
17
+
18
+ var classes = useClasses('content', className);
19
+ return /*#__PURE__*/React.createElement("div", _extends({}, props, {
20
+ className: _JSXStyle.dynamic([["1553218241", [SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(1.3), SCALES.pr(1.3), SCALES.pb(1.3), SCALES.pl(1.3), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || classes || "")
21
+ }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
22
+ id: "1553218241",
23
+ dynamic: [SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(1.3), SCALES.pr(1.3), SCALES.pb(1.3), SCALES.pl(1.3), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
24
+ }, ".content.__jsx-style-dynamic-selector{width:".concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(1.3), " ").concat(SCALES.pr(1.3), " ").concat(SCALES.pb(1.3), " ").concat(SCALES.pl(1.3), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.content.__jsx-style-dynamic-selector > *:first-child{margin-top:0;}.content.__jsx-style-dynamic-selector > *:last-child{margin-bottom:0;}")));
25
+ }
26
+
27
+ FieldsetContentComponent.displayName = 'BolioUIFieldsetContent';
28
+ var FieldsetContent = withScale(FieldsetContentComponent);
29
+ export default FieldsetContent;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ var defaultContext = {
3
+ inGroup: false,
4
+ currentValue: ''
5
+ };
6
+ export var FieldsetContext = /*#__PURE__*/React.createContext(defaultContext);
7
+ export var useFieldset = function useFieldset() {
8
+ return React.useContext(FieldsetContext);
9
+ };
@@ -0,0 +1,30 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["className", "children"];
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
+
9
+ function FieldsetFooterComponent(_ref) {
10
+ var _ref$className = _ref.className,
11
+ className = _ref$className === void 0 ? '' : _ref$className,
12
+ children = _ref.children,
13
+ props = _objectWithoutProperties(_ref, _excluded);
14
+
15
+ var theme = useTheme();
16
+
17
+ var _useScale = useScale(),
18
+ SCALES = _useScale.SCALES;
19
+
20
+ return /*#__PURE__*/React.createElement("footer", _extends({}, props, {
21
+ className: _JSXStyle.dynamic([["4117809613", [theme.palette.accents_1, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.accents_6, theme.layout.gapHalf, theme.layout.gap, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(2.875), SCALES.pt(0.625), SCALES.pr(1.31), SCALES.pb(0.625), SCALES.pl(1.31), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
22
+ }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
23
+ id: "4117809613",
24
+ dynamic: [theme.palette.accents_1, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.accents_6, theme.layout.gapHalf, theme.layout.gap, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(2.875), SCALES.pt(0.625), SCALES.pr(1.31), SCALES.pb(0.625), SCALES.pl(1.31), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
25
+ }, "footer.__jsx-style-dynamic-selector{background-color:".concat(theme.palette.accents_1, ";border-top:1px solid ").concat(theme.palette.border, ";border-bottom-left-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;overflow:hidden;color:").concat(theme.palette.accents_6, ";padding:").concat(theme.layout.gapHalf, " ").concat(theme.layout.gap, ";box-sizing:border-box;font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(2.875), ";padding:").concat(SCALES.pt(0.625), " ").concat(SCALES.pr(1.31), " ").concat(SCALES.pb(0.625), " ").concat(SCALES.pl(1.31), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")));
26
+ }
27
+
28
+ FieldsetFooterComponent.displayName = 'BolioUIFieldsetFooter';
29
+ var FieldsetFooter = withScale(FieldsetFooterComponent);
30
+ export default FieldsetFooter;
@@ -0,0 +1,88 @@
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 = ["className", "children", "value", "onChange"];
6
+ import _JSXStyle from "../styled-jsx.es.js";
7
+ import React, { useCallback, useMemo, useState } from 'react';
8
+ import useTheme from '../use-theme';
9
+ import useCurrentState from '../utils/use-current-state';
10
+ import { FieldsetContext } from './fieldset-context';
11
+ import useWarning from '../utils/use-warning';
12
+ import useScale, { withScale } from '../use-scale';
13
+ import useClasses from '../use-classes';
14
+
15
+ function FieldsetGroupComponent(_ref) {
16
+ var _ref$className = _ref.className,
17
+ className = _ref$className === void 0 ? '' : _ref$className,
18
+ children = _ref.children,
19
+ value = _ref.value,
20
+ onChange = _ref.onChange,
21
+ props = _objectWithoutProperties(_ref, _excluded);
22
+
23
+ var theme = useTheme();
24
+
25
+ var _useScale = useScale(),
26
+ SCALES = _useScale.SCALES;
27
+
28
+ var _useState = useState(value),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ selfVal = _useState2[0],
31
+ setSelfVal = _useState2[1];
32
+
33
+ var _useCurrentState = useCurrentState([]),
34
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
35
+ items = _useCurrentState2[0],
36
+ setItems = _useCurrentState2[1],
37
+ ref = _useCurrentState2[2];
38
+
39
+ var classes = useClasses('group', className);
40
+
41
+ var register = function register(newItem) {
42
+ var hasItem = ref.current.find(function (item) {
43
+ return item.value === newItem.value;
44
+ });
45
+
46
+ if (hasItem) {
47
+ useWarning('The "value" of each "Fieldset" must be unique.', 'Fieldset');
48
+ }
49
+
50
+ setItems([].concat(_toConsumableArray(ref.current), [newItem]));
51
+ };
52
+
53
+ var providerValue = useMemo(function () {
54
+ return {
55
+ currentValue: selfVal,
56
+ inGroup: true,
57
+ register: register
58
+ };
59
+ }, [selfVal]);
60
+ var clickHandle = useCallback(function (nextValue) {
61
+ setSelfVal(nextValue);
62
+ onChange && onChange(nextValue);
63
+ }, [onChange]);
64
+ return /*#__PURE__*/React.createElement(FieldsetContext.Provider, {
65
+ value: providerValue
66
+ }, /*#__PURE__*/React.createElement("div", _extends({}, props, {
67
+ className: _JSXStyle.dynamic([["4025768429", [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, 0), SCALES.ml(0), SCALES.font(1), theme.palette.accents_3, theme.palette.accents_1, theme.palette.border, theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.layout.radius]]]) + " " + (props && props.className != null && props.className || classes || "")
68
+ }), /*#__PURE__*/React.createElement("div", {
69
+ className: _JSXStyle.dynamic([["4025768429", [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, 0), SCALES.ml(0), SCALES.font(1), theme.palette.accents_3, theme.palette.accents_1, theme.palette.border, theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.layout.radius]]]) + " " + "group-tabs"
70
+ }, items.map(function (item) {
71
+ return /*#__PURE__*/React.createElement("button", {
72
+ onClick: function onClick() {
73
+ return clickHandle(item.value);
74
+ },
75
+ key: item.value,
76
+ className: _JSXStyle.dynamic([["4025768429", [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, 0), SCALES.ml(0), SCALES.font(1), theme.palette.accents_3, theme.palette.accents_1, theme.palette.border, theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.layout.radius]]]) + " " + ((selfVal === item.value ? 'active' : '') || "")
77
+ }, item.label);
78
+ })), /*#__PURE__*/React.createElement("div", {
79
+ className: _JSXStyle.dynamic([["4025768429", [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, 0), SCALES.ml(0), SCALES.font(1), theme.palette.accents_3, theme.palette.accents_1, theme.palette.border, theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.layout.radius]]]) + " " + "group-content"
80
+ }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
81
+ id: "4025768429",
82
+ dynamic: [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, 0), SCALES.ml(0), SCALES.font(1), theme.palette.accents_3, theme.palette.accents_1, theme.palette.border, theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.layout.radius]
83
+ }, ".group.__jsx-style-dynamic-selector{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, 0), " ").concat(SCALES.ml(0), ";}.group-tabs.__jsx-style-dynamic-selector{white-space:nowrap;overflow-y:hidden;overflow-x:auto;font-size:").concat(SCALES.font(1), ";margin-bottom:-1px;}.group-content.__jsx-style-dynamic-selector{border-top-left-radius:0;overflow:hidden;}.group-content.__jsx-style-dynamic-selector .fieldset{border-top-left-radius:0;}button.__jsx-style-dynamic-selector{height:2.7em;line-height:2.7em;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:").concat(theme.palette.accents_3, ";background-color:").concat(theme.palette.accents_1, ";font-size:0.875em;white-space:nowrap;text-transform:capitalize;-webkit-appearance:none;cursor:pointer;margin:0;padding:0 1.45em;overflow:hidden;-webkit-transition:all 0.2s ease 0s;transition:all 0.2s ease 0s;border-radius:0;border:1px solid ").concat(theme.palette.border, ";-webkit-text-decoration:none;text-decoration:none;outline:none;}button.active.__jsx-style-dynamic-selector{border-bottom-color:transparent;background-color:").concat(theme.palette.background, ";color:").concat(theme.palette.foreground, ";cursor:default;}button.__jsx-style-dynamic-selector:first-of-type{border-top-left-radius:").concat(theme.layout.radius, ";}button.__jsx-style-dynamic-selector:last-of-type{border-top-right-radius:").concat(theme.layout.radius, ";}button.__jsx-style-dynamic-selector+button.__jsx-style-dynamic-selector{border-left:0;}"))));
84
+ }
85
+
86
+ FieldsetGroupComponent.displayName = 'BolioUIFieldsetGroup';
87
+ var FieldsetGroup = withScale(FieldsetGroupComponent);
88
+ export default FieldsetGroup;
@@ -0,0 +1,21 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["className", "children"];
4
+ import _JSXStyle from "../styled-jsx.es.js";
5
+ import React from 'react';
6
+
7
+ function FieldsetSubtitle(_ref) {
8
+ var _ref$className = _ref.className,
9
+ className = _ref$className === void 0 ? '' : _ref$className,
10
+ children = _ref.children,
11
+ props = _objectWithoutProperties(_ref, _excluded);
12
+
13
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", _extends({}, props, {
14
+ className: "jsx-2265168013" + " " + (props && props.className != null && props.className || className || "")
15
+ }), children), /*#__PURE__*/React.createElement(_JSXStyle, {
16
+ id: "2265168013"
17
+ }, "div.jsx-2265168013{font-size:0.875em;line-height:1.6;-webkit-letter-spacing:-0.005625em;-moz-letter-spacing:-0.005625em;-ms-letter-spacing:-0.005625em;letter-spacing:-0.005625em;margin:0.75em 0;}"));
18
+ }
19
+
20
+ FieldsetSubtitle.displayName = 'BolioUIFieldsetSubtitle';
21
+ export default FieldsetSubtitle;
@@ -0,0 +1,23 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["className", "children"];
4
+ import _JSXStyle from "../styled-jsx.es.js";
5
+ import React from 'react';
6
+ import useClasses from '../use-classes';
7
+
8
+ function FieldsetTitle(_ref) {
9
+ var _ref$className = _ref.className,
10
+ className = _ref$className === void 0 ? '' : _ref$className,
11
+ children = _ref.children,
12
+ props = _objectWithoutProperties(_ref, _excluded);
13
+
14
+ var classes = useClasses('title', className);
15
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", _extends({}, props, {
16
+ className: "jsx-4105044205" + " " + (props && props.className != null && props.className || classes || "")
17
+ }), children), /*#__PURE__*/React.createElement(_JSXStyle, {
18
+ id: "4105044205"
19
+ }, ".title.jsx-4105044205{line-height:1.5;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;word-break:break-word;font-weight:600;-webkit-letter-spacing:-0.020625em;-moz-letter-spacing:-0.020625em;-ms-letter-spacing:-0.020625em;letter-spacing:-0.020625em;font-size:1.25em;width:auto;}"));
20
+ }
21
+
22
+ FieldsetTitle.displayName = 'BolioUIFieldsetTitle';
23
+ export default FieldsetTitle;
@@ -0,0 +1,96 @@
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 = ["className", "title", "subtitle", "children", "value", "label"];
5
+ import _JSXStyle from "../styled-jsx.es.js";
6
+ import React, { useEffect, useMemo, useState } from 'react';
7
+ import useTheme from '../use-theme';
8
+ import FieldsetTitle from './fieldset-title';
9
+ import FieldsetSubtitle from './fieldset-subtitle';
10
+ import FieldsetFooter from './fieldset-footer';
11
+ import FieldsetContent from './fieldset-content';
12
+ import { hasChild, pickChild } from '../utils/collections';
13
+ import { useFieldset } from './fieldset-context';
14
+ import useWarning from '../utils/use-warning';
15
+ import useScale, { withScale } from '../use-scale';
16
+ import useClasses from '../use-classes';
17
+
18
+ function FieldsetComponent(_ref) {
19
+ var _ref$className = _ref.className,
20
+ className = _ref$className === void 0 ? '' : _ref$className,
21
+ _ref$title = _ref.title,
22
+ title = _ref$title === void 0 ? '' : _ref$title,
23
+ _ref$subtitle = _ref.subtitle,
24
+ subtitle = _ref$subtitle === void 0 ? '' : _ref$subtitle,
25
+ children = _ref.children,
26
+ _ref$value = _ref.value,
27
+ value = _ref$value === void 0 ? '' : _ref$value,
28
+ _ref$label = _ref.label,
29
+ label = _ref$label === void 0 ? '' : _ref$label,
30
+ props = _objectWithoutProperties(_ref, _excluded);
31
+
32
+ var theme = useTheme();
33
+
34
+ var _useScale = useScale(),
35
+ SCALES = _useScale.SCALES;
36
+
37
+ var _useFieldset = useFieldset(),
38
+ inGroup = _useFieldset.inGroup,
39
+ currentValue = _useFieldset.currentValue,
40
+ register = _useFieldset.register;
41
+
42
+ var _useState = useState(inGroup),
43
+ _useState2 = _slicedToArray(_useState, 2),
44
+ hidden = _useState2[0],
45
+ setHidden = _useState2[1];
46
+
47
+ var classes = useClasses('fieldset', className);
48
+
49
+ var _pickChild = pickChild(children, FieldsetFooter),
50
+ _pickChild2 = _slicedToArray(_pickChild, 2),
51
+ withoutFooterChildren = _pickChild2[0],
52
+ FooterChildren = _pickChild2[1];
53
+
54
+ var hasTitle = hasChild(withoutFooterChildren, FieldsetTitle);
55
+ var hasSubtitle = hasChild(withoutFooterChildren, FieldsetSubtitle);
56
+ var hasContent = hasChild(withoutFooterChildren, FieldsetContent);
57
+
58
+ if (inGroup) {
59
+ if (!label) {
60
+ useWarning('Props "label" is required when in a group.', 'Fieldset Group');
61
+ }
62
+
63
+ if (!value || value === '') {
64
+ value = label;
65
+ }
66
+
67
+ useEffect(function () {
68
+ register && register({
69
+ value: value,
70
+ label: label
71
+ });
72
+ }, []);
73
+ useEffect(function () {
74
+ // In a few cases, the user will set Fieldset state manually.
75
+ // If the user incorrectly set the state, Group component should ignore it.
76
+
77
+ /* istanbul ignore if */
78
+ if (!currentValue || currentValue === '') return;
79
+ setHidden(currentValue !== value);
80
+ }, [currentValue, value]);
81
+ }
82
+
83
+ var content = useMemo(function () {
84
+ return /*#__PURE__*/React.createElement(React.Fragment, null, withoutFooterChildren, !hasTitle && title && /*#__PURE__*/React.createElement(FieldsetTitle, null, title), !hasSubtitle && subtitle && /*#__PURE__*/React.createElement(FieldsetSubtitle, null, subtitle));
85
+ }, [withoutFooterChildren, hasTitle, hasSubtitle, title, subtitle]);
86
+ return /*#__PURE__*/React.createElement("div", _extends({}, props, {
87
+ className: _JSXStyle.dynamic([["169128941", [theme.palette.background, theme.palette.border, theme.layout.radius, hidden ? 'none' : 'block', SCALES.font(1), 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 || classes || "")
88
+ }), hasContent ? content : /*#__PURE__*/React.createElement(FieldsetContent, null, content), FooterChildren && FooterChildren, /*#__PURE__*/React.createElement(_JSXStyle, {
89
+ id: "169128941",
90
+ dynamic: [theme.palette.background, theme.palette.border, theme.layout.radius, hidden ? 'none' : 'block', SCALES.font(1), 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)]
91
+ }, ".fieldset.__jsx-style-dynamic-selector{background-color:".concat(theme.palette.background, ";border:1px solid ").concat(theme.palette.border, ";border-radius:").concat(theme.layout.radius, ";overflow:hidden;display:").concat(hidden ? 'none' : 'block', ";font-size:").concat(SCALES.font(1), ";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), ";}")));
92
+ }
93
+
94
+ FieldsetComponent.displayName = 'BolioUIFieldset';
95
+ var Fieldset = withScale(FieldsetComponent);
96
+ export default Fieldset;
@@ -0,0 +1,13 @@
1
+ import Fieldset from './fieldset';
2
+ import FieldsetTitle from './fieldset-title';
3
+ import FieldsetSubtitle from './fieldset-subtitle';
4
+ import FieldsetFooter from './fieldset-footer';
5
+ import FieldsetGroup from './fieldset-group';
6
+ import FieldsetContent from './fieldset-content';
7
+ Fieldset.Title = FieldsetTitle;
8
+ Fieldset.Subtitle = FieldsetSubtitle;
9
+ Fieldset.Footer = FieldsetFooter;
10
+ Fieldset.Group = FieldsetGroup;
11
+ Fieldset.Content = FieldsetContent;
12
+ Fieldset.Body = FieldsetContent;
13
+ export default Fieldset;