@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.
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/dist/avatar/index.js +901 -0
- package/dist/badge/index.js +899 -0
- package/dist/bolio-ui-provider/index.js +1883 -0
- package/dist/breadcrumbs/index.js +985 -0
- package/dist/button/index.js +1358 -0
- package/dist/button-dropdown/index.js +1111 -0
- package/dist/button-group/index.js +782 -0
- package/dist/capacity/index.js +780 -0
- package/dist/card/index.js +1275 -0
- package/dist/checkbox/index.js +1042 -0
- package/dist/code/index.js +803 -0
- package/dist/col/index.js +90 -0
- package/dist/collapse/index.js +1158 -0
- package/dist/container/index.js +444 -0
- package/dist/css-baseline/index.js +348 -0
- package/dist/description/index.js +741 -0
- package/dist/display/index.js +745 -0
- package/dist/divider/index.js +767 -0
- package/dist/dot/index.js +755 -0
- package/dist/drawer/index.js +1513 -0
- package/dist/fieldset/index.js +1089 -0
- package/dist/grid/index.js +870 -0
- package/dist/image/index.js +1094 -0
- package/dist/index.js +9970 -0
- package/dist/input/index.js +1275 -0
- package/dist/keyboard/index.js +711 -0
- package/dist/link/index.js +863 -0
- package/dist/loading/index.js +765 -0
- package/dist/mdx-widgets/index.js +438 -0
- package/dist/modal/index.js +2220 -0
- package/dist/note/index.js +773 -0
- package/dist/page/index.js +928 -0
- package/dist/pagination/index.js +1201 -0
- package/dist/popover/index.js +1502 -0
- package/dist/progress/index.js +804 -0
- package/dist/radio/index.js +1028 -0
- package/dist/rating/index.js +912 -0
- package/dist/row/index.js +442 -0
- package/dist/section/index.js +733 -0
- package/dist/select/index.js +1865 -0
- package/dist/slider/index.js +1097 -0
- package/dist/snippet/index.js +1207 -0
- package/dist/spacer/index.js +692 -0
- package/dist/spinner/index.js +763 -0
- package/dist/styled-jsx.cjs.js +766 -0
- package/dist/tabs/index.js +1125 -0
- package/dist/tag/index.js +749 -0
- package/dist/text/index.js +830 -0
- package/dist/textarea/index.js +915 -0
- package/dist/themes/index.js +319 -0
- package/dist/toggle/index.js +852 -0
- package/dist/tooltip/index.js +1353 -0
- package/dist/use-all-themes/index.js +335 -0
- package/dist/use-body-scroll/index.js +173 -0
- package/dist/use-classes/index.js +55 -0
- package/dist/use-click-away/index.js +28 -0
- package/dist/use-clipboard/index.js +188 -0
- package/dist/use-current-state/index.js +90 -0
- package/dist/use-input/index.js +129 -0
- package/dist/use-keyboard/index.js +214 -0
- package/dist/use-media-query/index.js +495 -0
- package/dist/use-modal/index.js +114 -0
- package/dist/use-scale/index.js +673 -0
- package/dist/use-tabs/index.js +112 -0
- package/dist/use-theme/index.js +333 -0
- package/dist/use-toasts/index.js +236 -0
- package/esm/avatar/avatar-group.js +29 -0
- package/esm/avatar/avatar.js +107 -0
- package/esm/avatar/avatar.skeleton.js +21 -0
- package/esm/avatar/helpers.js +16 -0
- package/esm/avatar/index.js +4 -0
- package/esm/avatar/stories.js +113 -0
- package/esm/badge/badge-anchor.js +70 -0
- package/esm/badge/badge.js +58 -0
- package/esm/badge/index.js +4 -0
- package/esm/badge/stories.js +92 -0
- package/esm/bolio-ui-provider/bolio-ui-provider.js +62 -0
- package/esm/bolio-ui-provider/index.js +2 -0
- package/esm/bolio-ui-provider/theme-provider.js +47 -0
- package/esm/breadcrumbs/breadcrumbs-item.js +49 -0
- package/esm/breadcrumbs/breadcrumbs-separator.js +25 -0
- package/esm/breadcrumbs/breadcrumbs.js +47 -0
- package/esm/breadcrumbs/index.js +6 -0
- package/esm/breadcrumbs/stories.js +51 -0
- package/esm/button/button-icon.js +29 -0
- package/esm/button/button-loading.js +17 -0
- package/esm/button/button.drip.js +57 -0
- package/esm/button/button.js +146 -0
- package/esm/button/index.js +2 -0
- package/esm/button/stories.js +221 -0
- package/esm/button/styles.js +232 -0
- package/esm/button/utils.js +46 -0
- package/esm/button-dropdown/button-dropdown-context.js +11 -0
- package/esm/button-dropdown/button-dropdown-item.js +52 -0
- package/esm/button-dropdown/button-dropdown.js +111 -0
- package/esm/button-dropdown/icon.js +30 -0
- package/esm/button-dropdown/index.js +4 -0
- package/esm/button-dropdown/stories.js +92 -0
- package/esm/button-dropdown/styles.js +60 -0
- package/esm/button-group/button-group-context.js +9 -0
- package/esm/button-group/button-group.js +75 -0
- package/esm/button-group/index.js +2 -0
- package/esm/button-group/stories.js +66 -0
- package/esm/capacity/capacity.js +52 -0
- package/esm/capacity/index.js +2 -0
- package/esm/capacity/stories.js +55 -0
- package/esm/card/card-content.js +28 -0
- package/esm/card/card-footer.js +36 -0
- package/esm/card/card.js +68 -0
- package/esm/card/index.js +8 -0
- package/esm/card/stories.js +126 -0
- package/esm/card/styles.js +45 -0
- package/esm/checkbox/checkbox-context.js +10 -0
- package/esm/checkbox/checkbox-group.js +70 -0
- package/esm/checkbox/checkbox.icon.js +50 -0
- package/esm/checkbox/checkbox.js +114 -0
- package/esm/checkbox/index.js +4 -0
- package/esm/checkbox/stories.js +84 -0
- package/esm/checkbox/styles.js +34 -0
- package/esm/code/code.js +57 -0
- package/esm/code/index.js +2 -0
- package/esm/code/stories.js +53 -0
- package/esm/col/col.js +29 -0
- package/esm/col/index.js +2 -0
- package/esm/collapse/collapse-context.js +8 -0
- package/esm/collapse/collapse-group.js +75 -0
- package/esm/collapse/collapse-icon.js +28 -0
- package/esm/collapse/collapse.js +93 -0
- package/esm/collapse/index.js +4 -0
- package/esm/collapse/stories.js +48 -0
- package/esm/container/container.js +62 -0
- package/esm/container/index.js +2 -0
- package/esm/css-baseline/css-baseline.js +18 -0
- package/esm/css-baseline/index.js +1 -0
- package/esm/description/description.js +39 -0
- package/esm/description/index.js +2 -0
- package/esm/description/stories.js +23 -0
- package/esm/display/display.js +43 -0
- package/esm/display/index.js +2 -0
- package/esm/divider/divider.js +65 -0
- package/esm/divider/index.js +2 -0
- package/esm/divider/stories.js +41 -0
- package/esm/dot/dot.js +53 -0
- package/esm/dot/index.js +2 -0
- package/esm/dot/stories.js +40 -0
- package/esm/drawer/drawer-wrapper.js +86 -0
- package/esm/drawer/drawer.js +77 -0
- package/esm/drawer/helper.js +27 -0
- package/esm/drawer/index.js +8 -0
- package/esm/drawer/stories.js +79 -0
- package/esm/fieldset/fieldset-content.js +29 -0
- package/esm/fieldset/fieldset-context.js +9 -0
- package/esm/fieldset/fieldset-footer.js +30 -0
- package/esm/fieldset/fieldset-group.js +88 -0
- package/esm/fieldset/fieldset-subtitle.js +21 -0
- package/esm/fieldset/fieldset-title.js +23 -0
- package/esm/fieldset/fieldset.js +96 -0
- package/esm/fieldset/index.js +13 -0
- package/esm/fieldset/stories.js +72 -0
- package/esm/grid/basic-item.js +96 -0
- package/esm/grid/grid-container.js +46 -0
- package/esm/grid/grid-types.js +6 -0
- package/esm/grid/grid.js +37 -0
- package/esm/grid/index.js +4 -0
- package/esm/grid/stories.js +212 -0
- package/esm/icon/stories.js +36 -0
- package/esm/image/helpers.js +16 -0
- package/esm/image/image-browser-https-icon.js +23 -0
- package/esm/image/image-browser.js +86 -0
- package/esm/image/image.js +91 -0
- package/esm/image/image.skeleton.js +21 -0
- package/esm/image/index.js +4 -0
- package/esm/image/stories.js +73 -0
- package/esm/image/styles.js +15 -0
- package/esm/index.js +69 -0
- package/esm/input/index.js +6 -0
- package/esm/input/input-block-label.js +18 -0
- package/esm/input/input-icon-clear.js +47 -0
- package/esm/input/input-icon.js +19 -0
- package/esm/input/input-label.js +18 -0
- package/esm/input/input-props.js +12 -0
- package/esm/input/input.js +179 -0
- package/esm/input/password-icon.js +30 -0
- package/esm/input/password.js +66 -0
- package/esm/input/stories.js +113 -0
- package/esm/input/styles.js +41 -0
- package/esm/keyboard/index.js +2 -0
- package/esm/keyboard/keyboard.js +48 -0
- package/esm/keyboard/stories.js +43 -0
- package/esm/link/icon.js +30 -0
- package/esm/link/index.js +2 -0
- package/esm/link/link.js +50 -0
- package/esm/link/stories.js +59 -0
- package/esm/loading/index.js +2 -0
- package/esm/loading/loading.js +63 -0
- package/esm/loading/stories.js +75 -0
- package/esm/mdx-widgets/index.js +2 -0
- package/esm/mdx-widgets/mock-page.js +37 -0
- package/esm/mdx-widgets/parsed-codes/index.js +1 -0
- package/esm/mdx-widgets/parsed-codes/wait-time.js +13 -0
- package/esm/modal/index.js +10 -0
- package/esm/modal/modal-action.js +76 -0
- package/esm/modal/modal-actions.js +39 -0
- package/esm/modal/modal-content.js +28 -0
- package/esm/modal/modal-context.js +6 -0
- package/esm/modal/modal-subtitle.js +30 -0
- package/esm/modal/modal-title.js +30 -0
- package/esm/modal/modal-wrapper.js +80 -0
- package/esm/modal/modal.js +104 -0
- package/esm/modal/stories.js +165 -0
- package/esm/note/index.js +2 -0
- package/esm/note/note.js +71 -0
- package/esm/note/stories.js +68 -0
- package/esm/page/index.js +9 -0
- package/esm/page/page-content.js +26 -0
- package/esm/page/page-footer.js +25 -0
- package/esm/page/page-header.js +33 -0
- package/esm/page/page.js +88 -0
- package/esm/page/stories.js +54 -0
- package/esm/pagination/index.js +6 -0
- package/esm/pagination/pagination-context.js +8 -0
- package/esm/pagination/pagination-ellipsis.js +73 -0
- package/esm/pagination/pagination-item.js +50 -0
- package/esm/pagination/pagination-next.js +25 -0
- package/esm/pagination/pagination-pages.js +90 -0
- package/esm/pagination/pagination-previous.js +25 -0
- package/esm/pagination/pagination.js +105 -0
- package/esm/pagination/stories.js +49 -0
- package/esm/popover/index.js +5 -0
- package/esm/popover/popover-context.js +9 -0
- package/esm/popover/popover-item.js +65 -0
- package/esm/popover/popover.js +83 -0
- package/esm/popover/stories.js +84 -0
- package/esm/progress/index.js +2 -0
- package/esm/progress/progress.js +76 -0
- package/esm/progress/stories.js +114 -0
- package/esm/radio/index.js +7 -0
- package/esm/radio/radio-context.js +9 -0
- package/esm/radio/radio-description.js +30 -0
- package/esm/radio/radio-group.js +61 -0
- package/esm/radio/radio.js +123 -0
- package/esm/radio/stories.js +98 -0
- package/esm/radio/styles.js +41 -0
- package/esm/rating/index.js +2 -0
- package/esm/rating/rating-icon.js +20 -0
- package/esm/rating/rating.js +115 -0
- package/esm/rating/stories.js +72 -0
- package/esm/row/index.js +2 -0
- package/esm/row/row.js +60 -0
- package/esm/section/index.js +2 -0
- package/esm/section/section.js +30 -0
- package/esm/select/index.js +4 -0
- package/esm/select/select-context.js +9 -0
- package/esm/select/select-dropdown.js +41 -0
- package/esm/select/select-icon-clear.js +41 -0
- package/esm/select/select-icon.js +23 -0
- package/esm/select/select-input.js +34 -0
- package/esm/select/select-multiple-value.js +23 -0
- package/esm/select/select-option.js +100 -0
- package/esm/select/select.js +244 -0
- package/esm/select/stories.js +239 -0
- package/esm/select/styles.js +48 -0
- package/esm/shared/backdrop.js +77 -0
- package/esm/shared/css-transition.js +71 -0
- package/esm/shared/dropdown.js +109 -0
- package/esm/shared/ellipsis.js +15 -0
- package/esm/shared/expand.js +95 -0
- package/esm/shared/highlight.js +47 -0
- package/esm/slider/index.js +2 -0
- package/esm/slider/slider-dot.js +27 -0
- package/esm/slider/slider-mark.js +38 -0
- package/esm/slider/slider.js +163 -0
- package/esm/slider/stories.js +134 -0
- package/esm/slider/styles.js +27 -0
- package/esm/snippet/index.js +2 -0
- package/esm/snippet/snippet-icon.js +27 -0
- package/esm/snippet/snippet.js +100 -0
- package/esm/snippet/stories.js +133 -0
- package/esm/snippet/styles.js +58 -0
- package/esm/spacer/index.js +2 -0
- package/esm/spacer/spacer.js +28 -0
- package/esm/spacer/stories.js +54 -0
- package/esm/spinner/index.js +2 -0
- package/esm/spinner/spinner.js +46 -0
- package/esm/spinner/stories.js +13 -0
- package/esm/styled-jsx-server.es.js +5 -0
- package/esm/styled-jsx.es.js +757 -0
- package/esm/tabs/index.js +5 -0
- package/esm/tabs/stories.js +92 -0
- package/esm/tabs/tabs-context.js +8 -0
- package/esm/tabs/tabs-item.js +80 -0
- package/esm/tabs/tabs.js +151 -0
- package/esm/tag/index.js +2 -0
- package/esm/tag/stories.js +58 -0
- package/esm/tag/tag.js +86 -0
- package/esm/text/child.js +78 -0
- package/esm/text/index.js +2 -0
- package/esm/text/stories.js +104 -0
- package/esm/text/text.js +94 -0
- package/esm/textarea/index.js +2 -0
- package/esm/textarea/stories.js +104 -0
- package/esm/textarea/textarea.js +116 -0
- package/esm/themes/index.js +2 -0
- package/esm/themes/presets/dark.js +67 -0
- package/esm/themes/presets/default.js +67 -0
- package/esm/themes/presets/index.js +1 -0
- package/esm/themes/presets/shared.js +42 -0
- package/esm/themes/themes.js +89 -0
- package/esm/toggle/index.js +2 -0
- package/esm/toggle/stories.js +55 -0
- package/esm/toggle/styles.js +27 -0
- package/esm/toggle/toggle.js +82 -0
- package/esm/tooltip/helper.js +21 -0
- package/esm/tooltip/index.js +2 -0
- package/esm/tooltip/placement.js +160 -0
- package/esm/tooltip/stories.js +183 -0
- package/esm/tooltip/styles.js +18 -0
- package/esm/tooltip/tooltip-content.js +83 -0
- package/esm/tooltip/tooltip-icon.js +32 -0
- package/esm/tooltip/tooltip.js +132 -0
- package/esm/use-all-themes/all-themes-context.js +9 -0
- package/esm/use-all-themes/index.js +2 -0
- package/esm/use-body-scroll/index.js +2 -0
- package/esm/use-body-scroll/use-body-scroll.js +70 -0
- package/esm/use-classes/index.js +2 -0
- package/esm/use-classes/use-classes.js +41 -0
- package/esm/use-click-away/index.js +2 -0
- package/esm/use-click-away/use-click-away.js +22 -0
- package/esm/use-clipboard/index.js +2 -0
- package/esm/use-clipboard/use-clipboard.js +46 -0
- package/esm/use-current-state/index.js +2 -0
- package/esm/use-current-state/use-current-state.js +26 -0
- package/esm/use-input/index.js +2 -0
- package/esm/use-input/use-input.js +32 -0
- package/esm/use-keyboard/codes.js +97 -0
- package/esm/use-keyboard/helper.js +26 -0
- package/esm/use-keyboard/index.js +4 -0
- package/esm/use-keyboard/use-keyboard.js +79 -0
- package/esm/use-media-query/index.js +2 -0
- package/esm/use-media-query/use-media-query.js +90 -0
- package/esm/use-modal/index.js +2 -0
- package/esm/use-modal/use-modal.js +26 -0
- package/esm/use-scale/index.js +6 -0
- package/esm/use-scale/scale-context.js +37 -0
- package/esm/use-scale/utils.js +62 -0
- package/esm/use-scale/with-scale.js +114 -0
- package/esm/use-tabs/index.js +2 -0
- package/esm/use-tabs/use-tabs.js +24 -0
- package/esm/use-theme/index.js +2 -0
- package/esm/use-theme/theme-context.js +7 -0
- package/esm/use-toasts/helpers.js +72 -0
- package/esm/use-toasts/index.js +2 -0
- package/esm/use-toasts/toast-container.js +127 -0
- package/esm/use-toasts/toast-item.js +48 -0
- package/esm/use-toasts/use-toast.js +124 -0
- package/esm/utils/calculations.js +27 -0
- package/esm/utils/collections.js +138 -0
- package/esm/utils/color.js +43 -0
- package/esm/utils/layouts.js +82 -0
- package/esm/utils/prop-types.js +22 -0
- package/esm/utils/types.js +1 -0
- package/esm/utils/use-body-scroll.js +2 -0
- package/esm/utils/use-bolio-ui-context.js +27 -0
- package/esm/utils/use-click-anywhere.js +16 -0
- package/esm/utils/use-click-away.js +2 -0
- package/esm/utils/use-clipboard.js +2 -0
- package/esm/utils/use-context-state/create-bolio-ui-context.js +57 -0
- package/esm/utils/use-context-state/use-context-state.js +44 -0
- package/esm/utils/use-current-state.js +2 -0
- package/esm/utils/use-default-props.js +22 -0
- package/esm/utils/use-dom-observer.js +28 -0
- package/esm/utils/use-drag.js +75 -0
- package/esm/utils/use-portal.js +40 -0
- package/esm/utils/use-previous.js +11 -0
- package/esm/utils/use-real-shape.js +53 -0
- package/esm/utils/use-resize.js +21 -0
- package/esm/utils/use-ssr.js +20 -0
- package/esm/utils/use-warning.js +17 -0
- 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;
|