@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 @@
|
|
|
1
|
+
export * from './wait-time';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export var __html = "<span class=\"token keyword module\">import</span> <span class=\"token imports\"><span class=\"token maybe-class-name\">React</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span> useState <span class=\"token punctuation\">}</span></span> <span class=\"token keyword module\">from</span> <span class=\"token string\">\"react\"</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">const</span> <span class=\"token function-variable function\"><span class=\"token maybe-class-name\">App</span></span> <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token arrow operator\">=></span> <span class=\"token punctuation\">{</span>\n <span class=\"token keyword\">const</span> <span class=\"token punctuation\">[</span>wait<span class=\"token punctuation\">,</span> showWaitTime<span class=\"token punctuation\">]</span> <span class=\"token operator\">=</span> <span class=\"token function\">useState</span><span class=\"token punctuation\">(</span><span class=\"token number\">0</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n <span class=\"token function\">setTimeout</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token arrow operator\">=></span> <span class=\"token function\">showWaitTime</span><span class=\"token punctuation\">(</span>wait <span class=\"token operator\">+</span> <span class=\"token number\">1</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> <span class=\"token number\">1000</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n <span class=\"token keyword control-flow\">return</span> <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\"><</span>div</span><span class=\"token punctuation\">></span></span><span class=\"token plain-text\">You've been waiting since </span><span class=\"token punctuation\">{</span>wait<span class=\"token punctuation\">}</span><span class=\"token plain-text\"> seconds!</span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\"></</span>div</span><span class=\"token punctuation\">></span></span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword module\">export</span> <span class=\"token keyword module\">default</span> <span class=\"token maybe-class-name\">App</span><span class=\"token punctuation\">;</span>\n".trim();
|
|
3
|
+
|
|
4
|
+
var WaitTime = function WaitTime() {
|
|
5
|
+
return /*#__PURE__*/React.createElement("code", {
|
|
6
|
+
className: "language-jsx",
|
|
7
|
+
dangerouslySetInnerHTML: {
|
|
8
|
+
__html: __html
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default WaitTime;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Modal from './modal';
|
|
2
|
+
import ModalTitle from './modal-title';
|
|
3
|
+
import ModalSubtitle from './modal-subtitle';
|
|
4
|
+
import ModalContent from './modal-content';
|
|
5
|
+
import ModalAction from './modal-action';
|
|
6
|
+
Modal.Title = ModalTitle;
|
|
7
|
+
Modal.Subtitle = ModalSubtitle;
|
|
8
|
+
Modal.Content = ModalContent;
|
|
9
|
+
Modal.Action = ModalAction;
|
|
10
|
+
export default Modal;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "children", "onClick", "passive", "disabled"];
|
|
4
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
5
|
+
import React, { useImperativeHandle, useMemo, useRef } from 'react';
|
|
6
|
+
import useTheme from '../use-theme';
|
|
7
|
+
import { useModalContext } from './modal-context';
|
|
8
|
+
import Button from '../button/button';
|
|
9
|
+
import useScale, { withScale } from '../use-scale';
|
|
10
|
+
import useClasses from '../use-classes';
|
|
11
|
+
var ModalActionComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
12
|
+
var _ref$className = _ref.className,
|
|
13
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
14
|
+
children = _ref.children,
|
|
15
|
+
onClick = _ref.onClick,
|
|
16
|
+
_ref$passive = _ref.passive,
|
|
17
|
+
passive = _ref$passive === void 0 ? false : _ref$passive,
|
|
18
|
+
_ref$disabled = _ref.disabled,
|
|
19
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
20
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
|
|
22
|
+
var theme = useTheme();
|
|
23
|
+
|
|
24
|
+
var _useScale = useScale(),
|
|
25
|
+
SCALES = _useScale.SCALES;
|
|
26
|
+
|
|
27
|
+
var btnRef = useRef(null);
|
|
28
|
+
|
|
29
|
+
var _useModalContext = useModalContext(),
|
|
30
|
+
_close = _useModalContext.close;
|
|
31
|
+
|
|
32
|
+
useImperativeHandle(ref, function () {
|
|
33
|
+
return btnRef.current;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
var clickHandler = function clickHandler(event) {
|
|
37
|
+
if (disabled) return;
|
|
38
|
+
var actionEvent = Object.assign({}, event, {
|
|
39
|
+
close: function close() {
|
|
40
|
+
return _close && _close();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
onClick && onClick(actionEvent);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var color = useMemo(function () {
|
|
47
|
+
return passive ? theme.palette.accents_5 : theme.palette.foreground;
|
|
48
|
+
}, [theme.palette, passive]);
|
|
49
|
+
var bgColor = useMemo(function () {
|
|
50
|
+
return disabled ? theme.palette.accents_1 : theme.palette.background;
|
|
51
|
+
}, [theme.palette, disabled]);
|
|
52
|
+
var _styles$className = {
|
|
53
|
+
styles: /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
54
|
+
id: "1003252629",
|
|
55
|
+
dynamic: [SCALES.font(0.75), color, theme.palette.background, SCALES.height(3.5625), disabled ? color : theme.palette.foreground, disabled ? bgColor : theme.palette.accents_1]
|
|
56
|
+
}, "button.btn.__jsx-style-dynamic-selector{font-size:".concat(SCALES.font(0.75), ";border:none;color:").concat(color, ";background-color:").concat(theme.palette.background, ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-flex:1;-ms-flex:1;flex:1;height:").concat(SCALES.height(3.5625), ";border-radius:0;min-width:0;}button.btn.__jsx-style-dynamic-selector:hover,button.btn.__jsx-style-dynamic-selector:focus{color:").concat(disabled ? color : theme.palette.foreground, ";background-color:").concat(disabled ? bgColor : theme.palette.accents_1, ";}")),
|
|
57
|
+
className: _JSXStyle.dynamic([["1003252629", [SCALES.font(0.75), color, theme.palette.background, SCALES.height(3.5625), disabled ? color : theme.palette.foreground, disabled ? bgColor : theme.palette.accents_1]]])
|
|
58
|
+
},
|
|
59
|
+
resolveClassName = _styles$className.className,
|
|
60
|
+
styles = _styles$className.styles;
|
|
61
|
+
var classes = useClasses(resolveClassName, className);
|
|
62
|
+
|
|
63
|
+
var overrideProps = _extends({}, props, {
|
|
64
|
+
effect: false,
|
|
65
|
+
ref: btnRef
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
69
|
+
className: classes,
|
|
70
|
+
onClick: clickHandler,
|
|
71
|
+
disabled: disabled
|
|
72
|
+
}, overrideProps), children, styles);
|
|
73
|
+
});
|
|
74
|
+
ModalActionComponent.displayName = 'BolioUIModalAction';
|
|
75
|
+
var ModalAction = withScale(ModalActionComponent);
|
|
76
|
+
export default ModalAction;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 = ["children"];
|
|
5
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
6
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
7
|
+
import useTheme from '../use-theme';
|
|
8
|
+
|
|
9
|
+
var ModalActionsComponent = function ModalActionsComponent(_ref) {
|
|
10
|
+
var children = _ref.children,
|
|
11
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
|
|
13
|
+
var theme = useTheme();
|
|
14
|
+
var ref = useRef(null);
|
|
15
|
+
|
|
16
|
+
var _useState = useState('auto'),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
height = _useState2[0],
|
|
19
|
+
setHeight = _useState2[1];
|
|
20
|
+
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
if (!ref.current) return;
|
|
23
|
+
setHeight("".concat(ref.current.clientHeight, "px"));
|
|
24
|
+
}, [ref]);
|
|
25
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: _JSXStyle.dynamic([["2914444644", [theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, height]]])
|
|
27
|
+
}), /*#__PURE__*/React.createElement("footer", _extends({
|
|
28
|
+
ref: ref
|
|
29
|
+
}, props, {
|
|
30
|
+
className: _JSXStyle.dynamic([["2914444644", [theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, height]]]) + " " + (props && props.className != null && props.className || "")
|
|
31
|
+
}), children), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
32
|
+
id: "2914444644",
|
|
33
|
+
dynamic: [theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, height]
|
|
34
|
+
}, "footer.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;overflow:hidden;width:100%;height:auto;position:absolute;bottom:0;left:0;right:0;border-top:1px solid ".concat(theme.palette.border, ";border-bottom-left-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";}footer.__jsx-style-dynamic-selector>button.btn + button.btn{border-left:1px solid ").concat(theme.palette.border, ";}div.__jsx-style-dynamic-selector{height:").concat(height, ";-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}")));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
ModalActionsComponent.displayName = 'BolioUIModalActions';
|
|
38
|
+
var ModalActions = /*#__PURE__*/React.memo(ModalActionsComponent);
|
|
39
|
+
export default ModalActions;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 ModalContentComponent(_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
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
19
|
+
className: _JSXStyle.dynamic([["588605445", [SCALES.font(1), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(1.3125), SCALES.pr(1.3125), SCALES.pb(0.6625), SCALES.pl(1.3125), SCALES.mt(0), SCALES.mr(0, 'calc(var(--modal-wrapper-padding-right) * -1)'), SCALES.mb(0), SCALES.ml(0, 'calc(var(--modal-wrapper-padding-left) * -1)')]]]) + " " + (props && props.className != null && props.className || useClasses('content', className) || "")
|
|
20
|
+
}), children), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
21
|
+
id: "588605445",
|
|
22
|
+
dynamic: [SCALES.font(1), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(1.3125), SCALES.pr(1.3125), SCALES.pb(0.6625), SCALES.pl(1.3125), SCALES.mt(0), SCALES.mr(0, 'calc(var(--modal-wrapper-padding-right) * -1)'), SCALES.mb(0), SCALES.ml(0, 'calc(var(--modal-wrapper-padding-left) * -1)')]
|
|
23
|
+
}, ".content.__jsx-style-dynamic-selector{position:relative;text-align:left;font-size:".concat(SCALES.font(1), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(1.3125), " ").concat(SCALES.pr(1.3125), " ").concat(SCALES.pb(0.6625), " ").concat(SCALES.pl(1.3125), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0, 'calc(var(--modal-wrapper-padding-right) * -1)'), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0, 'calc(var(--modal-wrapper-padding-left) * -1)'), ";}.content.__jsx-style-dynamic-selector>*:first-child{margin-top:0;}.content.__jsx-style-dynamic-selector>*:last-child{margin-bottom:0;}")));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ModalContentComponent.displayName = 'BolioUIModalContent';
|
|
27
|
+
var ModalContent = withScale(ModalContentComponent);
|
|
28
|
+
export default ModalContent;
|
|
@@ -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 ModalSubtitleComponent(_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(React.Fragment, null, /*#__PURE__*/React.createElement("p", _extends({}, props, {
|
|
21
|
+
className: _JSXStyle.dynamic([["1585744472", [theme.palette.accents_5, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, '1.5em'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
|
|
22
|
+
}), children), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
23
|
+
id: "1585744472",
|
|
24
|
+
dynamic: [theme.palette.accents_5, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, '1.5em'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
|
|
25
|
+
}, "p.__jsx-style-dynamic-selector{font-weight:normal;display:inline-block;text-align:center;word-break:break-word;text-transform:uppercase;color:".concat(theme.palette.accents_5, ";font-size:").concat(SCALES.font(0.875), ";line-height:1.5em;width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, '1.5em'), ";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), ";}")));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
ModalSubtitleComponent.displayName = 'BolioUIModalSubtitle';
|
|
29
|
+
var ModalSubtitle = withScale(ModalSubtitleComponent);
|
|
30
|
+
export default ModalSubtitle;
|
|
@@ -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 ModalTitleComponent(_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(React.Fragment, null, /*#__PURE__*/React.createElement("h2", _extends({}, props, {
|
|
21
|
+
className: _JSXStyle.dynamic([["4121803681", [SCALES.font(1.5), theme.palette.foreground, SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
|
|
22
|
+
}), children), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
23
|
+
id: "4121803681",
|
|
24
|
+
dynamic: [SCALES.font(1.5), theme.palette.foreground, 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)]
|
|
25
|
+
}, "h2.__jsx-style-dynamic-selector{line-height:1.6;font-weight:normal;text-align:center;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;word-break:break-word;text-transform:capitalize;font-size:".concat(SCALES.font(1.5), ";color:").concat(theme.palette.foreground, ";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), ";}")));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
ModalTitleComponent.displayName = 'BolioUIModalTitle';
|
|
29
|
+
var ModalTitle = withScale(ModalTitleComponent);
|
|
30
|
+
export default ModalTitle;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "children", "visible"];
|
|
4
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
5
|
+
import React, { useEffect, useRef } from 'react';
|
|
6
|
+
import useTheme from '../use-theme';
|
|
7
|
+
import CssTransition from '../shared/css-transition';
|
|
8
|
+
import { isChildElement } from '../utils/collections';
|
|
9
|
+
import useScale from '../use-scale';
|
|
10
|
+
import useClasses from '../use-classes';
|
|
11
|
+
|
|
12
|
+
function ModalWrapper(_ref) {
|
|
13
|
+
var _ref$className = _ref.className,
|
|
14
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
15
|
+
children = _ref.children,
|
|
16
|
+
_ref$visible = _ref.visible,
|
|
17
|
+
visible = _ref$visible === void 0 ? false : _ref$visible,
|
|
18
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
|
|
20
|
+
var theme = useTheme();
|
|
21
|
+
|
|
22
|
+
var _useScale = useScale(),
|
|
23
|
+
SCALES = _useScale.SCALES;
|
|
24
|
+
|
|
25
|
+
var modalContent = useRef(null);
|
|
26
|
+
var tabStart = useRef(null);
|
|
27
|
+
var tabEnd = useRef(null);
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
if (!visible) return;
|
|
30
|
+
var activeElement = document.activeElement;
|
|
31
|
+
var isChild = isChildElement(modalContent.current, activeElement);
|
|
32
|
+
if (isChild) return;
|
|
33
|
+
tabStart.current && tabStart.current.focus();
|
|
34
|
+
}, [visible]);
|
|
35
|
+
|
|
36
|
+
var onKeyDown = function onKeyDown(event) {
|
|
37
|
+
var isTabDown = event.keyCode === 9;
|
|
38
|
+
if (!visible || !isTabDown) return;
|
|
39
|
+
var activeElement = document.activeElement;
|
|
40
|
+
|
|
41
|
+
if (event.shiftKey) {
|
|
42
|
+
if (activeElement === tabStart.current) {
|
|
43
|
+
tabEnd.current && tabEnd.current.focus();
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
if (activeElement === tabEnd.current) {
|
|
47
|
+
tabStart.current && tabStart.current.focus();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return /*#__PURE__*/React.createElement(CssTransition, {
|
|
53
|
+
name: "wrapper",
|
|
54
|
+
visible: visible,
|
|
55
|
+
clearTime: 300
|
|
56
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
57
|
+
role: "dialog",
|
|
58
|
+
tabIndex: -1,
|
|
59
|
+
onKeyDown: onKeyDown,
|
|
60
|
+
ref: modalContent
|
|
61
|
+
}, props, {
|
|
62
|
+
className: _JSXStyle.dynamic([["212284330", [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, SCALES.font(1), SCALES.height(1, 'auto'), 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)]]]) + " " + (props && props.className != null && props.className || useClasses('wrapper', className) || "")
|
|
63
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
tabIndex: 0,
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
ref: tabStart,
|
|
67
|
+
className: _JSXStyle.dynamic([["212284330", [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, SCALES.font(1), SCALES.height(1, 'auto'), 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)]]]) + " " + "hide-tab"
|
|
68
|
+
}), children, /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
tabIndex: 0,
|
|
70
|
+
"aria-hidden": "true",
|
|
71
|
+
ref: tabEnd,
|
|
72
|
+
className: _JSXStyle.dynamic([["212284330", [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, SCALES.font(1), SCALES.height(1, 'auto'), 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)]]]) + " " + "hide-tab"
|
|
73
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
74
|
+
id: "212284330",
|
|
75
|
+
dynamic: [theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, SCALES.font(1), SCALES.height(1, 'auto'), 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)]
|
|
76
|
+
}, ".wrapper.__jsx-style-dynamic-selector{max-width:100%;vertical-align:middle;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:relative;box-sizing:border-box;background-color:".concat(theme.palette.background, ";color:").concat(theme.palette.foreground, ";border-radius:").concat(theme.layout.radius, ";box-shadow:").concat(theme.expressiveness.shadowLarge, ";opacity:0;outline:none;-webkit-transform:translate3d(0px,-30px,0px);-ms-transform:translate3d(0px,-30px,0px);transform:translate3d(0px,-30px,0px);-webkit-transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1) 0s, -webkit-transform 0.35s cubic-bezier(0.4,0,0.2,1) 0s;-webkit-transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1) 0s, transform 0.35s cubic-bezier(0.4,0,0.2,1) 0s;transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1) 0s, transform 0.35s cubic-bezier(0.4,0,0.2,1) 0s;width:100%;font-size:").concat(SCALES.font(1), ";height:").concat(SCALES.height(1, 'auto'), ";--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), ";}.wrapper-enter.__jsx-style-dynamic-selector{opacity:0;-webkit-transform:translate3d(0px,-30px,0px);-ms-transform:translate3d(0px,-30px,0px);transform:translate3d(0px,-30px,0px);}.wrapper-enter-active.__jsx-style-dynamic-selector{opacity:1;-webkit-transform:translate3d(0px,0px,0px);-ms-transform:translate3d(0px,0px,0px);transform:translate3d(0px,0px,0px);}.wrapper-leave.__jsx-style-dynamic-selector{opacity:1;-webkit-transform:translate3d(0px,0px,0px);-ms-transform:translate3d(0px,0px,0px);transform:translate3d(0px,0px,0px);}.wrapper-leave-active.__jsx-style-dynamic-selector{opacity:0;-webkit-transform:translate3d(0px,-30px,0px);-ms-transform:translate3d(0px,-30px,0px);transform:translate3d(0px,-30px,0px);}.hide-tab.__jsx-style-dynamic-selector{outline:none;overflow:hidden;width:0;height:0;opacity:0;}"))));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
ModalWrapper.displayName = 'BolioUIModalWrapper';
|
|
80
|
+
export default ModalWrapper;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
|
+
import usePortal from '../utils/use-portal';
|
|
6
|
+
import ModalWrapper from './modal-wrapper';
|
|
7
|
+
import ModalAction from './modal-action';
|
|
8
|
+
import ModalActions from './modal-actions';
|
|
9
|
+
import Backdrop from '../shared/backdrop';
|
|
10
|
+
import { ModalContext } from './modal-context';
|
|
11
|
+
import { pickChild } from '../utils/collections';
|
|
12
|
+
import useBodyScroll from '../utils/use-body-scroll';
|
|
13
|
+
import useScale, { withScale } from '../use-scale';
|
|
14
|
+
import useKeyboard, { KeyCode } from '../use-keyboard';
|
|
15
|
+
|
|
16
|
+
function ModalComponent(_ref) {
|
|
17
|
+
var customVisible = _ref.visible,
|
|
18
|
+
onClose = _ref.onClose,
|
|
19
|
+
children = _ref.children,
|
|
20
|
+
_ref$keyboard = _ref.keyboard,
|
|
21
|
+
keyboard = _ref$keyboard === void 0 ? true : _ref$keyboard,
|
|
22
|
+
_ref$wrapClassName = _ref.wrapClassName,
|
|
23
|
+
wrapClassName = _ref$wrapClassName === void 0 ? '' : _ref$wrapClassName,
|
|
24
|
+
onContentClick = _ref.onContentClick,
|
|
25
|
+
_ref$disableBackdropC = _ref.disableBackdropClick,
|
|
26
|
+
disableBackdropClick = _ref$disableBackdropC === void 0 ? false : _ref$disableBackdropC,
|
|
27
|
+
_ref$positionClassNam = _ref.positionClassName,
|
|
28
|
+
positionClassName = _ref$positionClassNam === void 0 ? '' : _ref$positionClassNam,
|
|
29
|
+
_ref$backdropClassNam = _ref.backdropClassName,
|
|
30
|
+
backdropClassName = _ref$backdropClassNam === void 0 ? '' : _ref$backdropClassNam,
|
|
31
|
+
_ref$layerClassName = _ref.layerClassName,
|
|
32
|
+
layerClassName = _ref$layerClassName === void 0 ? '' : _ref$layerClassName;
|
|
33
|
+
var portal = usePortal('modal');
|
|
34
|
+
|
|
35
|
+
var _useScale = useScale(),
|
|
36
|
+
SCALES = _useScale.SCALES;
|
|
37
|
+
|
|
38
|
+
var _useBodyScroll = useBodyScroll(null, {
|
|
39
|
+
delayReset: 300
|
|
40
|
+
}),
|
|
41
|
+
_useBodyScroll2 = _slicedToArray(_useBodyScroll, 2),
|
|
42
|
+
setBodyHidden = _useBodyScroll2[1];
|
|
43
|
+
|
|
44
|
+
var _useState = useState(false),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
visible = _useState2[0],
|
|
47
|
+
setVisible = _useState2[1];
|
|
48
|
+
|
|
49
|
+
var _pickChild = pickChild(children, ModalAction),
|
|
50
|
+
_pickChild2 = _slicedToArray(_pickChild, 2),
|
|
51
|
+
withoutActionsChildren = _pickChild2[0],
|
|
52
|
+
ActionsChildren = _pickChild2[1];
|
|
53
|
+
|
|
54
|
+
var hasActions = ActionsChildren && React.Children.count(ActionsChildren) > 0;
|
|
55
|
+
|
|
56
|
+
var closeModal = function closeModal() {
|
|
57
|
+
onClose && onClose();
|
|
58
|
+
setVisible(false);
|
|
59
|
+
setBodyHidden(false);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
if (typeof customVisible === 'undefined') return;
|
|
64
|
+
setVisible(customVisible);
|
|
65
|
+
setBodyHidden(customVisible);
|
|
66
|
+
}, [customVisible, setBodyHidden]);
|
|
67
|
+
|
|
68
|
+
var _useKeyboard = useKeyboard(function () {
|
|
69
|
+
keyboard && closeModal();
|
|
70
|
+
}, KeyCode.Escape, {
|
|
71
|
+
disableGlobalEvent: true
|
|
72
|
+
}),
|
|
73
|
+
bindings = _useKeyboard.bindings;
|
|
74
|
+
|
|
75
|
+
var closeFromBackdrop = function closeFromBackdrop() {
|
|
76
|
+
if (disableBackdropClick) return;
|
|
77
|
+
closeModal();
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
var modalConfig = useMemo(function () {
|
|
81
|
+
return {
|
|
82
|
+
close: closeModal
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
if (!portal) return null;
|
|
86
|
+
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(ModalContext.Provider, {
|
|
87
|
+
value: modalConfig
|
|
88
|
+
}, /*#__PURE__*/React.createElement(Backdrop, _extends({
|
|
89
|
+
onClick: closeFromBackdrop,
|
|
90
|
+
onContentClick: onContentClick,
|
|
91
|
+
visible: visible,
|
|
92
|
+
width: SCALES.width(26),
|
|
93
|
+
positionClassName: positionClassName,
|
|
94
|
+
backdropClassName: backdropClassName,
|
|
95
|
+
layerClassName: layerClassName
|
|
96
|
+
}, bindings), /*#__PURE__*/React.createElement(ModalWrapper, {
|
|
97
|
+
visible: visible,
|
|
98
|
+
className: wrapClassName
|
|
99
|
+
}, withoutActionsChildren, hasActions && /*#__PURE__*/React.createElement(ModalActions, null, ActionsChildren)))), portal);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
ModalComponent.displayName = 'BolioUIModal';
|
|
103
|
+
var Modal = withScale(ModalComponent);
|
|
104
|
+
export default Modal;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import Modal from '.';
|
|
5
|
+
import Button from '../button';
|
|
6
|
+
import Grid from '../grid';
|
|
7
|
+
import useModal from '../use-modal';
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Feedback/Modal',
|
|
10
|
+
component: Modal
|
|
11
|
+
};
|
|
12
|
+
export var Default = function Default() {
|
|
13
|
+
var _useState = useState(false),
|
|
14
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15
|
+
state = _useState2[0],
|
|
16
|
+
setState = _useState2[1];
|
|
17
|
+
|
|
18
|
+
var handler = function handler() {
|
|
19
|
+
return setState(true);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
23
|
+
gap: 2
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
|
|
25
|
+
auto: true,
|
|
26
|
+
onClick: handler
|
|
27
|
+
}, "Show Modal"), /*#__PURE__*/React.createElement(Modal, {
|
|
28
|
+
visible: state,
|
|
29
|
+
onClose: function onClose() {
|
|
30
|
+
return setState(false);
|
|
31
|
+
}
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Modal.Title, null, "Modal"), /*#__PURE__*/React.createElement(Modal.Subtitle, null, "Example of a modal"), /*#__PURE__*/React.createElement(Modal.Content, null, /*#__PURE__*/React.createElement("p", null, "Demo content for the modal.")), /*#__PURE__*/React.createElement(Modal.Action, {
|
|
33
|
+
passive: true,
|
|
34
|
+
onClick: function onClick() {
|
|
35
|
+
return setState(false);
|
|
36
|
+
}
|
|
37
|
+
}, "Cancel"), /*#__PURE__*/React.createElement(Modal.Action, null, "Accepted"))));
|
|
38
|
+
};
|
|
39
|
+
export var UseModal = function UseModal() {
|
|
40
|
+
var _useModal = useModal(),
|
|
41
|
+
setVisible = _useModal.setVisible,
|
|
42
|
+
bindings = _useModal.bindings;
|
|
43
|
+
|
|
44
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
45
|
+
gap: 2
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
|
|
47
|
+
auto: true,
|
|
48
|
+
onClick: function onClick() {
|
|
49
|
+
return setVisible(true);
|
|
50
|
+
}
|
|
51
|
+
}, "Show Modal"), /*#__PURE__*/React.createElement(Modal, bindings, /*#__PURE__*/React.createElement(Modal.Title, null, "Modal"), /*#__PURE__*/React.createElement(Modal.Subtitle, null, "Example of a modal"), /*#__PURE__*/React.createElement(Modal.Content, null, /*#__PURE__*/React.createElement("p", null, "Demo content for the modal.")), /*#__PURE__*/React.createElement(Modal.Action, {
|
|
52
|
+
passive: true,
|
|
53
|
+
onClick: function onClick() {
|
|
54
|
+
return setVisible(false);
|
|
55
|
+
}
|
|
56
|
+
}, "Cancel"), /*#__PURE__*/React.createElement(Modal.Action, null, "Accepted"))));
|
|
57
|
+
};
|
|
58
|
+
export var WithoutActions = function WithoutActions() {
|
|
59
|
+
var _useState3 = useState(false),
|
|
60
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
61
|
+
state = _useState4[0],
|
|
62
|
+
setState = _useState4[1];
|
|
63
|
+
|
|
64
|
+
var handler = function handler() {
|
|
65
|
+
return setState(true);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
69
|
+
gap: 2
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
|
|
71
|
+
auto: true,
|
|
72
|
+
onClick: handler
|
|
73
|
+
}, "Show Modal"), /*#__PURE__*/React.createElement(Modal, {
|
|
74
|
+
visible: state,
|
|
75
|
+
onClose: function onClose() {
|
|
76
|
+
return setState(false);
|
|
77
|
+
}
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Modal.Title, null, "Modal"), /*#__PURE__*/React.createElement(Modal.Subtitle, null, "Example of a modal"), /*#__PURE__*/React.createElement(Modal.Content, null, /*#__PURE__*/React.createElement("p", null, "Demo content for the modal.")))));
|
|
79
|
+
};
|
|
80
|
+
export var DisabledAction = function DisabledAction() {
|
|
81
|
+
var _useState5 = useState(false),
|
|
82
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
83
|
+
state = _useState6[0],
|
|
84
|
+
setState = _useState6[1];
|
|
85
|
+
|
|
86
|
+
var handler = function handler() {
|
|
87
|
+
return setState(true);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
var closeHandler = function closeHandler() {
|
|
91
|
+
setState(false);
|
|
92
|
+
console.log('closed');
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
96
|
+
auto: true,
|
|
97
|
+
onClick: handler
|
|
98
|
+
}, "Show Modal"), /*#__PURE__*/React.createElement(Modal, {
|
|
99
|
+
visible: state,
|
|
100
|
+
onClose: closeHandler
|
|
101
|
+
}, /*#__PURE__*/React.createElement(Modal.Title, null, "Modal"), /*#__PURE__*/React.createElement(Modal.Subtitle, null, "Example of a modal"), /*#__PURE__*/React.createElement(Modal.Content, null, /*#__PURE__*/React.createElement("p", null, "Demo content for the modal.")), /*#__PURE__*/React.createElement(Modal.Action, {
|
|
102
|
+
passive: true,
|
|
103
|
+
onClick: function onClick() {
|
|
104
|
+
return setState(false);
|
|
105
|
+
}
|
|
106
|
+
}, "Cancel"), /*#__PURE__*/React.createElement(Modal.Action, {
|
|
107
|
+
disabled: true
|
|
108
|
+
}, "Submit")));
|
|
109
|
+
};
|
|
110
|
+
export var Customized = function Customized() {
|
|
111
|
+
var _useModal2 = useModal(),
|
|
112
|
+
setVisible = _useModal2.setVisible,
|
|
113
|
+
bindings = _useModal2.bindings;
|
|
114
|
+
|
|
115
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
116
|
+
gap: 2
|
|
117
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
|
|
118
|
+
auto: true,
|
|
119
|
+
onClick: function onClick() {
|
|
120
|
+
return setVisible(true);
|
|
121
|
+
}
|
|
122
|
+
}, "Show Modal"), /*#__PURE__*/React.createElement(Modal, _extends({
|
|
123
|
+
width: "35rem"
|
|
124
|
+
}, bindings), /*#__PURE__*/React.createElement(Modal.Title, null, "My Favorites"), /*#__PURE__*/React.createElement(Modal.Content, null, /*#__PURE__*/React.createElement("p", null, "This is the width I want.")))));
|
|
125
|
+
};
|
|
126
|
+
export var Loading = function Loading() {
|
|
127
|
+
var _useModal3 = useModal(),
|
|
128
|
+
setVisible = _useModal3.setVisible,
|
|
129
|
+
bindings = _useModal3.bindings;
|
|
130
|
+
|
|
131
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
132
|
+
gap: 2
|
|
133
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
|
|
134
|
+
auto: true,
|
|
135
|
+
onClick: function onClick() {
|
|
136
|
+
return setVisible(true);
|
|
137
|
+
}
|
|
138
|
+
}, "Show Modal"), /*#__PURE__*/React.createElement(Modal, bindings, /*#__PURE__*/React.createElement(Modal.Title, null, "Modal"), /*#__PURE__*/React.createElement(Modal.Subtitle, null, "Example of a modal"), /*#__PURE__*/React.createElement(Modal.Content, null, /*#__PURE__*/React.createElement("p", null, "Demo content for the modal.")), /*#__PURE__*/React.createElement(Modal.Action, {
|
|
139
|
+
passive: true,
|
|
140
|
+
onClick: function onClick() {
|
|
141
|
+
return setVisible(false);
|
|
142
|
+
}
|
|
143
|
+
}, "Cancel"), /*#__PURE__*/React.createElement(Modal.Action, {
|
|
144
|
+
loading: true
|
|
145
|
+
}, "Accepted"))));
|
|
146
|
+
};
|
|
147
|
+
export var Overlong = function Overlong() {
|
|
148
|
+
var _useModal4 = useModal(),
|
|
149
|
+
setVisible = _useModal4.setVisible,
|
|
150
|
+
bindings = _useModal4.bindings;
|
|
151
|
+
|
|
152
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
153
|
+
gap: 2
|
|
154
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
|
|
155
|
+
auto: true,
|
|
156
|
+
onClick: function onClick() {
|
|
157
|
+
return setVisible(true);
|
|
158
|
+
}
|
|
159
|
+
}, "Show Modal"), /*#__PURE__*/React.createElement(Modal, bindings, /*#__PURE__*/React.createElement(Modal.Title, null, "Modal"), /*#__PURE__*/React.createElement(Modal.Subtitle, null, "Modal with a very large content"), /*#__PURE__*/React.createElement(Modal.Content, null, /*#__PURE__*/React.createElement("p", null, "React has been designed from the start for gradual adoption, and you can use as little or as much React as you need. Whether you want to get a taste of React, add some interactivity to a simple HTML page, or start a complex React-powered app, the links in this section will help you get started."), /*#__PURE__*/React.createElement("p", null, "React has been designed from the start for gradual adoption, and you can use as little or as much React as you need. Whether you want to get a taste of React, add some interactivity to a simple HTML page, or start a complex React-powered app, the links in this section will help you get started."), /*#__PURE__*/React.createElement("p", null, "React has been designed from the start for gradual adoption, and you can use as little or as much React as you need. Whether you want to get a taste of React, add some interactivity to a simple HTML page, or start a complex React-powered app, the links in this section will help you get started."), /*#__PURE__*/React.createElement("p", null, "React has been designed from the start for gradual adoption, and you can use as little or as much React as you need. Whether you want to get a taste of React, add some interactivity to a simple HTML page, or start a complex React-powered app, the links in this section will help you get started."), /*#__PURE__*/React.createElement("p", null, "React has been designed from the start for gradual adoption, and you can use as little or as much React as you need. Whether you want to get a taste of React, add some interactivity to a simple HTML page, or start a complex React-powered app, the links in this section will help you get started."), /*#__PURE__*/React.createElement("p", null, "React has been designed from the start for gradual adoption, and you can use as little or as much React as you need. Whether you want to get a taste of React, add some interactivity to a simple HTML page, or start a complex React-powered app, the links in this section will help you get started."), /*#__PURE__*/React.createElement("p", null, "React has been designed from the start for gradual adoption, and you can use as little or as much React as you need. Whether you want to get a taste of React, add some interactivity to a simple HTML page, or start a complex React-powered app, the links in this section will help you get started.")), /*#__PURE__*/React.createElement(Modal.Action, {
|
|
160
|
+
passive: true,
|
|
161
|
+
onClick: function onClick() {
|
|
162
|
+
return setVisible(false);
|
|
163
|
+
}
|
|
164
|
+
}, "Cancel"), /*#__PURE__*/React.createElement(Modal.Action, null, "Accepted"))));
|
|
165
|
+
};
|