@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,1207 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var styledJsx_cjs = require('../styled-jsx.cjs.js');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
11
|
+
|
|
12
|
+
function ownKeys(object, enumerableOnly) {
|
|
13
|
+
var keys = Object.keys(object);
|
|
14
|
+
|
|
15
|
+
if (Object.getOwnPropertySymbols) {
|
|
16
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
17
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
18
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
19
|
+
})), keys.push.apply(keys, symbols);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return keys;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function _objectSpread2(target) {
|
|
26
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
27
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
28
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
29
|
+
_defineProperty(target, key, source[key]);
|
|
30
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
31
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return target;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _typeof(obj) {
|
|
39
|
+
"@babel/helpers - typeof";
|
|
40
|
+
|
|
41
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
42
|
+
return typeof obj;
|
|
43
|
+
} : function (obj) {
|
|
44
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
45
|
+
}, _typeof(obj);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _defineProperty(obj, key, value) {
|
|
49
|
+
if (key in obj) {
|
|
50
|
+
Object.defineProperty(obj, key, {
|
|
51
|
+
value: value,
|
|
52
|
+
enumerable: true,
|
|
53
|
+
configurable: true,
|
|
54
|
+
writable: true
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
obj[key] = value;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function _extends() {
|
|
64
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
65
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
66
|
+
var source = arguments[i];
|
|
67
|
+
|
|
68
|
+
for (var key in source) {
|
|
69
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
70
|
+
target[key] = source[key];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return target;
|
|
76
|
+
};
|
|
77
|
+
return _extends.apply(this, arguments);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
81
|
+
if (source == null) return {};
|
|
82
|
+
var target = {};
|
|
83
|
+
var sourceKeys = Object.keys(source);
|
|
84
|
+
var key, i;
|
|
85
|
+
|
|
86
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
87
|
+
key = sourceKeys[i];
|
|
88
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
89
|
+
target[key] = source[key];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return target;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function _objectWithoutProperties(source, excluded) {
|
|
96
|
+
if (source == null) return {};
|
|
97
|
+
|
|
98
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
99
|
+
|
|
100
|
+
var key, i;
|
|
101
|
+
|
|
102
|
+
if (Object.getOwnPropertySymbols) {
|
|
103
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
104
|
+
|
|
105
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
106
|
+
key = sourceSymbolKeys[i];
|
|
107
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
108
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
109
|
+
target[key] = source[key];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return target;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function _slicedToArray(arr, i) {
|
|
117
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function _toConsumableArray(arr) {
|
|
121
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function _arrayWithoutHoles(arr) {
|
|
125
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function _arrayWithHoles(arr) {
|
|
129
|
+
if (Array.isArray(arr)) return arr;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function _iterableToArray(iter) {
|
|
133
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function _iterableToArrayLimit(arr, i) {
|
|
137
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
138
|
+
|
|
139
|
+
if (_i == null) return;
|
|
140
|
+
var _arr = [];
|
|
141
|
+
var _n = true;
|
|
142
|
+
var _d = false;
|
|
143
|
+
|
|
144
|
+
var _s, _e;
|
|
145
|
+
|
|
146
|
+
try {
|
|
147
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
148
|
+
_arr.push(_s.value);
|
|
149
|
+
|
|
150
|
+
if (i && _arr.length === i) break;
|
|
151
|
+
}
|
|
152
|
+
} catch (err) {
|
|
153
|
+
_d = true;
|
|
154
|
+
_e = err;
|
|
155
|
+
} finally {
|
|
156
|
+
try {
|
|
157
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
158
|
+
} finally {
|
|
159
|
+
if (_d) throw _e;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return _arr;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
167
|
+
if (!o) return;
|
|
168
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
169
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
170
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
171
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
172
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function _arrayLikeToArray(arr, len) {
|
|
176
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
177
|
+
|
|
178
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
179
|
+
|
|
180
|
+
return arr2;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function _nonIterableSpread() {
|
|
184
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function _nonIterableRest() {
|
|
188
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
192
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
193
|
+
|
|
194
|
+
if (!it) {
|
|
195
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
196
|
+
if (it) o = it;
|
|
197
|
+
var i = 0;
|
|
198
|
+
|
|
199
|
+
var F = function () {};
|
|
200
|
+
|
|
201
|
+
return {
|
|
202
|
+
s: F,
|
|
203
|
+
n: function () {
|
|
204
|
+
if (i >= o.length) return {
|
|
205
|
+
done: true
|
|
206
|
+
};
|
|
207
|
+
return {
|
|
208
|
+
done: false,
|
|
209
|
+
value: o[i++]
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
e: function (e) {
|
|
213
|
+
throw e;
|
|
214
|
+
},
|
|
215
|
+
f: F
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
var normalCompletion = true,
|
|
223
|
+
didErr = false,
|
|
224
|
+
err;
|
|
225
|
+
return {
|
|
226
|
+
s: function () {
|
|
227
|
+
it = it.call(o);
|
|
228
|
+
},
|
|
229
|
+
n: function () {
|
|
230
|
+
var step = it.next();
|
|
231
|
+
normalCompletion = step.done;
|
|
232
|
+
return step;
|
|
233
|
+
},
|
|
234
|
+
e: function (e) {
|
|
235
|
+
didErr = true;
|
|
236
|
+
err = e;
|
|
237
|
+
},
|
|
238
|
+
f: function () {
|
|
239
|
+
try {
|
|
240
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
241
|
+
} finally {
|
|
242
|
+
if (didErr) throw err;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
var defaultFont = {
|
|
249
|
+
sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
|
|
250
|
+
mono: 'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace',
|
|
251
|
+
prism: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,"Liberation Mono", "Courier New", monospace'
|
|
252
|
+
};
|
|
253
|
+
var defaultBreakpoints = {
|
|
254
|
+
xs: {
|
|
255
|
+
min: '0',
|
|
256
|
+
max: '650px'
|
|
257
|
+
},
|
|
258
|
+
sm: {
|
|
259
|
+
min: '650px',
|
|
260
|
+
max: '900px'
|
|
261
|
+
},
|
|
262
|
+
md: {
|
|
263
|
+
min: '900px',
|
|
264
|
+
max: '1280px'
|
|
265
|
+
},
|
|
266
|
+
lg: {
|
|
267
|
+
min: '1280px',
|
|
268
|
+
max: '1920px'
|
|
269
|
+
},
|
|
270
|
+
xl: {
|
|
271
|
+
min: '1920px',
|
|
272
|
+
max: '10000px'
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
var defaultLayout = {
|
|
276
|
+
gap: '16pt',
|
|
277
|
+
gapNegative: '-16pt',
|
|
278
|
+
gapHalf: '8pt',
|
|
279
|
+
gapHalfNegative: '-8pt',
|
|
280
|
+
gapQuarter: '4pt',
|
|
281
|
+
gapQuarterNegative: '-4pt',
|
|
282
|
+
pageMargin: '16pt',
|
|
283
|
+
pageWidth: '900pt',
|
|
284
|
+
pageWidthWithMargin: '930pt',
|
|
285
|
+
breakpointMobile: defaultBreakpoints.xs.max,
|
|
286
|
+
breakpointTablet: defaultBreakpoints.sm.max,
|
|
287
|
+
radius: '6px',
|
|
288
|
+
unit: '16px'
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
var palette$1 = {
|
|
292
|
+
background: '#fff',
|
|
293
|
+
foreground: '#000',
|
|
294
|
+
accents_1: '#fafafa',
|
|
295
|
+
accents_2: '#eaeaea',
|
|
296
|
+
accents_3: '#999',
|
|
297
|
+
accents_4: '#888',
|
|
298
|
+
accents_5: '#666',
|
|
299
|
+
accents_6: '#444',
|
|
300
|
+
accents_7: '#333',
|
|
301
|
+
accents_8: '#111',
|
|
302
|
+
selection: '#cee4fe',
|
|
303
|
+
code: '#C25FFF',
|
|
304
|
+
border: '#eaeaea',
|
|
305
|
+
primary: '#0072F6',
|
|
306
|
+
primaryLight: '#96C1F3',
|
|
307
|
+
primaryLighter: '#CEE4FF',
|
|
308
|
+
primaryDark: '#00254E',
|
|
309
|
+
secondary: '#7828C9',
|
|
310
|
+
secondaryLighter: '#D1B1F1',
|
|
311
|
+
secondaryLight: '#EADCF9',
|
|
312
|
+
secondaryDark: '#290E45',
|
|
313
|
+
error: '#F31261',
|
|
314
|
+
errorLight: '#FAA8C6',
|
|
315
|
+
errorLighter: '#FDD8E6',
|
|
316
|
+
errorDark: '#4E041F',
|
|
317
|
+
success: '#17C965',
|
|
318
|
+
successLight: '#ADF5CD',
|
|
319
|
+
successLighter: '#DAFBE9',
|
|
320
|
+
successDark: '#06371C',
|
|
321
|
+
warning: '#F5A525',
|
|
322
|
+
warningLight: '#FBDBA8',
|
|
323
|
+
warningLighter: '#FDEFD9',
|
|
324
|
+
warningDark: '#4E3105',
|
|
325
|
+
info: '#06B7DC',
|
|
326
|
+
infoLighter: '#A5EEFE',
|
|
327
|
+
infoLight: '#D7F8FF',
|
|
328
|
+
infoDark: '#053B49',
|
|
329
|
+
purple: '#f81ce5',
|
|
330
|
+
alert: '#ff0080',
|
|
331
|
+
link: '#0070f3',
|
|
332
|
+
pre: '#363450'
|
|
333
|
+
};
|
|
334
|
+
var expressiveness$1 = {
|
|
335
|
+
linkStyle: 'none',
|
|
336
|
+
linkHoverStyle: 'none',
|
|
337
|
+
dropdownBoxShadow: '0 4px 4px 0 rgba(0, 0, 0, 0.02)',
|
|
338
|
+
scrollerStart: 'rgba(255, 255, 255, 1)',
|
|
339
|
+
scrollerEnd: 'rgba(255, 255, 255, 0)',
|
|
340
|
+
shadowSmall: '0 5px 10px rgba(0, 0, 0, 0.12)',
|
|
341
|
+
shadowMedium: '0 8px 30px rgba(0, 0, 0, 0.12)',
|
|
342
|
+
shadowLarge: '0 30px 60px rgba(0, 0, 0, 0.12)',
|
|
343
|
+
portalOpacity: 0.25
|
|
344
|
+
};
|
|
345
|
+
var font$1 = defaultFont;
|
|
346
|
+
var breakpoints$1 = defaultBreakpoints;
|
|
347
|
+
var layout$1 = defaultLayout;
|
|
348
|
+
var themes$1 = {
|
|
349
|
+
type: 'light',
|
|
350
|
+
font: font$1,
|
|
351
|
+
layout: layout$1,
|
|
352
|
+
palette: palette$1,
|
|
353
|
+
breakpoints: breakpoints$1,
|
|
354
|
+
expressiveness: expressiveness$1
|
|
355
|
+
};
|
|
356
|
+
var lightTheme = themes$1;
|
|
357
|
+
|
|
358
|
+
var palette = {
|
|
359
|
+
background: '#000',
|
|
360
|
+
foreground: '#fff',
|
|
361
|
+
accents_1: '#111',
|
|
362
|
+
accents_2: '#333',
|
|
363
|
+
accents_3: '#444',
|
|
364
|
+
accents_4: '#666',
|
|
365
|
+
accents_5: '#888',
|
|
366
|
+
accents_6: '#999',
|
|
367
|
+
accents_7: '#eaeaea',
|
|
368
|
+
accents_8: '#fafafa',
|
|
369
|
+
selection: '#f81ce5',
|
|
370
|
+
code: '#C25FFF',
|
|
371
|
+
border: '#333',
|
|
372
|
+
primary: '#0072F6',
|
|
373
|
+
primaryLight: '#96C1F3',
|
|
374
|
+
primaryLighter: '#CEE4FF',
|
|
375
|
+
primaryDark: '#00254E',
|
|
376
|
+
secondary: '#7828C9',
|
|
377
|
+
secondaryLighter: '#D1B1F1',
|
|
378
|
+
secondaryLight: '#EADCF9',
|
|
379
|
+
secondaryDark: '#290E45',
|
|
380
|
+
error: '#F31261',
|
|
381
|
+
errorLight: '#FAA8C6',
|
|
382
|
+
errorLighter: '#FDD8E6',
|
|
383
|
+
errorDark: '#4E041F',
|
|
384
|
+
success: '#17C965',
|
|
385
|
+
successLight: '#ADF5CD',
|
|
386
|
+
successLighter: '#DAFBE9',
|
|
387
|
+
successDark: '#06371C',
|
|
388
|
+
warning: '#F5A525',
|
|
389
|
+
warningLight: '#FBDBA8',
|
|
390
|
+
warningLighter: '#FDEFD9',
|
|
391
|
+
warningDark: '#4E3105',
|
|
392
|
+
info: '#06B7DC',
|
|
393
|
+
infoLighter: '#A5EEFE',
|
|
394
|
+
infoLight: '#D7F8FF',
|
|
395
|
+
infoDark: '#053B49',
|
|
396
|
+
purple: '#f81ce5',
|
|
397
|
+
alert: '#ff0080',
|
|
398
|
+
link: '#3291ff',
|
|
399
|
+
pre: '#363450'
|
|
400
|
+
};
|
|
401
|
+
var expressiveness = {
|
|
402
|
+
linkStyle: 'none',
|
|
403
|
+
linkHoverStyle: 'none',
|
|
404
|
+
dropdownBoxShadow: '0 0 0 1px #333',
|
|
405
|
+
scrollerStart: 'rgba(255, 255, 255, 1)',
|
|
406
|
+
scrollerEnd: 'rgba(255, 255, 255, 0)',
|
|
407
|
+
shadowSmall: '0 0 0 1px #333',
|
|
408
|
+
shadowMedium: '0 0 0 1px #333',
|
|
409
|
+
shadowLarge: '0 0 0 1px #333',
|
|
410
|
+
portalOpacity: 0.75
|
|
411
|
+
};
|
|
412
|
+
var font = defaultFont;
|
|
413
|
+
var breakpoints = defaultBreakpoints;
|
|
414
|
+
var layout = defaultLayout;
|
|
415
|
+
var themes = {
|
|
416
|
+
type: 'dark',
|
|
417
|
+
font: font,
|
|
418
|
+
layout: layout,
|
|
419
|
+
palette: palette,
|
|
420
|
+
breakpoints: breakpoints,
|
|
421
|
+
expressiveness: expressiveness
|
|
422
|
+
};
|
|
423
|
+
var darkTheme = themes;
|
|
424
|
+
|
|
425
|
+
var isObject = function isObject(target) {
|
|
426
|
+
return target && _typeof(target) === 'object';
|
|
427
|
+
};
|
|
428
|
+
var deepDuplicable = function deepDuplicable(source, target) {
|
|
429
|
+
if (!isObject(target) || !isObject(source)) return source;
|
|
430
|
+
var sourceKeys = Object.keys(source);
|
|
431
|
+
var result = {};
|
|
432
|
+
|
|
433
|
+
for (var _i = 0, _sourceKeys = sourceKeys; _i < _sourceKeys.length; _i++) {
|
|
434
|
+
var key = _sourceKeys[_i];
|
|
435
|
+
var sourceValue = source[key];
|
|
436
|
+
var targetValue = target[key];
|
|
437
|
+
|
|
438
|
+
if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
|
|
439
|
+
result[key] = targetValue.concat(sourceValue);
|
|
440
|
+
} else if (isObject(sourceValue) && isObject(targetValue)) {
|
|
441
|
+
result[key] = deepDuplicable(sourceValue, _objectSpread2({}, targetValue));
|
|
442
|
+
} else if (targetValue) {
|
|
443
|
+
result[key] = targetValue;
|
|
444
|
+
} else {
|
|
445
|
+
result[key] = sourceValue;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return result;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
var getPresets = function getPresets() {
|
|
453
|
+
return [lightTheme, darkTheme];
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
var getPresetStaticTheme = function getPresetStaticTheme() {
|
|
457
|
+
return lightTheme;
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
var isAvailableThemeType = function isAvailableThemeType(type) {
|
|
461
|
+
if (!type) return false;
|
|
462
|
+
var presetThemes = getPresets();
|
|
463
|
+
var hasType = presetThemes.find(function (theme) {
|
|
464
|
+
return theme.type === type;
|
|
465
|
+
});
|
|
466
|
+
return !hasType;
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
var isPresetTheme = function isPresetTheme(themeOrType) {
|
|
470
|
+
if (!themeOrType) return false;
|
|
471
|
+
var isType = typeof themeOrType === 'string';
|
|
472
|
+
var type = isType ? themeOrType : themeOrType.type;
|
|
473
|
+
return !isAvailableThemeType(type);
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
var hasUserCustomTheme = function hasUserCustomTheme() {
|
|
477
|
+
var themes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
478
|
+
return !!themes.find(function (item) {
|
|
479
|
+
return isAvailableThemeType(item.type);
|
|
480
|
+
});
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
var create = function create(base, custom) {
|
|
484
|
+
if (!isAvailableThemeType(custom.type)) {
|
|
485
|
+
throw new Error('Duplicate or unavailable theme type');
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
return deepDuplicable(base, custom);
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
var createFromDark = function createFromDark(custom) {
|
|
492
|
+
return create(darkTheme, custom);
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
var createFromLight = function createFromLight(custom) {
|
|
496
|
+
return create(lightTheme, custom);
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
var Themes = {
|
|
500
|
+
isPresetTheme: isPresetTheme,
|
|
501
|
+
isAvailableThemeType: isAvailableThemeType,
|
|
502
|
+
hasUserCustomTheme: hasUserCustomTheme,
|
|
503
|
+
getPresets: getPresets,
|
|
504
|
+
getPresetStaticTheme: getPresetStaticTheme,
|
|
505
|
+
create: create,
|
|
506
|
+
createFromDark: createFromDark,
|
|
507
|
+
createFromLight: createFromLight
|
|
508
|
+
};
|
|
509
|
+
var Themes$1 = Themes;
|
|
510
|
+
|
|
511
|
+
var defaultTheme = Themes$1.getPresetStaticTheme();
|
|
512
|
+
var ThemeContext = /*#__PURE__*/React__default["default"].createContext(defaultTheme);
|
|
513
|
+
var useTheme$1 = function useTheme() {
|
|
514
|
+
return React__default["default"].useContext(ThemeContext);
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
var useTheme = useTheme$1;
|
|
518
|
+
|
|
519
|
+
var getStyles = function getStyles(type, palette, fill) {
|
|
520
|
+
var styles = {
|
|
521
|
+
"default": {
|
|
522
|
+
color: palette.foreground,
|
|
523
|
+
border: palette.accents_2,
|
|
524
|
+
bgColor: palette.accents_2
|
|
525
|
+
},
|
|
526
|
+
primary: {
|
|
527
|
+
color: palette.primary,
|
|
528
|
+
border: palette.primary,
|
|
529
|
+
bgColor: palette.accents_1
|
|
530
|
+
},
|
|
531
|
+
secondary: {
|
|
532
|
+
color: palette.secondary,
|
|
533
|
+
border: palette.secondary,
|
|
534
|
+
bgColor: palette.accents_1
|
|
535
|
+
},
|
|
536
|
+
success: {
|
|
537
|
+
color: palette.success,
|
|
538
|
+
border: palette.success,
|
|
539
|
+
bgColor: palette.accents_1
|
|
540
|
+
},
|
|
541
|
+
warning: {
|
|
542
|
+
color: palette.warning,
|
|
543
|
+
border: palette.warning,
|
|
544
|
+
bgColor: palette.accents_1
|
|
545
|
+
},
|
|
546
|
+
error: {
|
|
547
|
+
color: palette.error,
|
|
548
|
+
border: palette.error,
|
|
549
|
+
bgColor: palette.accents_1
|
|
550
|
+
},
|
|
551
|
+
info: {
|
|
552
|
+
color: palette.info,
|
|
553
|
+
border: palette.info,
|
|
554
|
+
bgColor: palette.accents_1
|
|
555
|
+
},
|
|
556
|
+
lite: {
|
|
557
|
+
color: palette.foreground,
|
|
558
|
+
border: palette.border,
|
|
559
|
+
bgColor: palette.accents_1
|
|
560
|
+
},
|
|
561
|
+
dark: {
|
|
562
|
+
color: palette.background,
|
|
563
|
+
border: palette.foreground,
|
|
564
|
+
bgColor: palette.foreground
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
var filledTypes = ['primary', 'secondary', 'success', 'warning', 'error', 'info'];
|
|
568
|
+
var style = styles[type];
|
|
569
|
+
var shouldFilled = filledTypes.includes(type);
|
|
570
|
+
if (!fill || !shouldFilled) return style;
|
|
571
|
+
return _objectSpread2(_objectSpread2({}, style), {}, {
|
|
572
|
+
color: style.bgColor,
|
|
573
|
+
bgColor: style.color
|
|
574
|
+
});
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
function SnippetIconComponent() {
|
|
578
|
+
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
579
|
+
viewBox: "0 0 24 24",
|
|
580
|
+
stroke: "currentColor",
|
|
581
|
+
strokeWidth: "1.5",
|
|
582
|
+
strokeLinecap: "round",
|
|
583
|
+
strokeLinejoin: "round",
|
|
584
|
+
fill: "none",
|
|
585
|
+
shapeRendering: "geometricPrecision",
|
|
586
|
+
style: {
|
|
587
|
+
color: 'currentcolor'
|
|
588
|
+
},
|
|
589
|
+
className: "jsx-418323402"
|
|
590
|
+
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
591
|
+
d: "M8 17.929H6c-1.105 0-2-.912-2-2.036V5.036C4 3.91 4.895 3 6 3h8c1.105 0 2 .911 2 2.036v1.866m-6 .17h8c1.105 0 2 .91 2 2.035v10.857C20 21.09 19.105 22 18 22h-8c-1.105 0-2-.911-2-2.036V9.107c0-1.124.895-2.036 2-2.036z",
|
|
592
|
+
className: "jsx-418323402"
|
|
593
|
+
}), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
|
|
594
|
+
id: "418323402"
|
|
595
|
+
}, "svg.jsx-418323402{width:calc(var(--snippet-font-size) * 1.69);height:calc(var(--snippet-font-size) * 1.69);}"));
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
SnippetIconComponent.displayName = 'BolioUISnippetIcon';
|
|
599
|
+
var SnippetIcon = /*#__PURE__*/React__default["default"].memo(SnippetIconComponent);
|
|
600
|
+
var SnippetIcon$1 = SnippetIcon;
|
|
601
|
+
|
|
602
|
+
var getId = function getId() {
|
|
603
|
+
return Math.random().toString(32).slice(2, 10);
|
|
604
|
+
};
|
|
605
|
+
var isBrowser = function isBrowser() {
|
|
606
|
+
return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
607
|
+
};
|
|
608
|
+
var isCSSNumberValue = function isCSSNumberValue(value) {
|
|
609
|
+
return value !== undefined && !Number.isNaN(+value);
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
var useSSR = function useSSR() {
|
|
613
|
+
var _useState = React.useState(false),
|
|
614
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
615
|
+
browser = _useState2[0],
|
|
616
|
+
setBrowser = _useState2[1];
|
|
617
|
+
|
|
618
|
+
React.useEffect(function () {
|
|
619
|
+
setBrowser(isBrowser());
|
|
620
|
+
}, []);
|
|
621
|
+
return {
|
|
622
|
+
isBrowser: browser,
|
|
623
|
+
isServer: !browser
|
|
624
|
+
};
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
var useSSR$1 = useSSR;
|
|
628
|
+
|
|
629
|
+
var createElement = function createElement(id) {
|
|
630
|
+
var el = document.createElement('div');
|
|
631
|
+
el.setAttribute('id', id);
|
|
632
|
+
return el;
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
var usePortal = function usePortal() {
|
|
636
|
+
var selectId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getId();
|
|
637
|
+
var getContainer = arguments.length > 1 ? arguments[1] : undefined;
|
|
638
|
+
var id = "bolio-ui-".concat(selectId);
|
|
639
|
+
|
|
640
|
+
var _useSSR = useSSR$1(),
|
|
641
|
+
isBrowser = _useSSR.isBrowser;
|
|
642
|
+
|
|
643
|
+
var _useState = React.useState(isBrowser ? createElement(id) : null),
|
|
644
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
645
|
+
elSnapshot = _useState2[0],
|
|
646
|
+
setElSnapshot = _useState2[1];
|
|
647
|
+
|
|
648
|
+
React.useEffect(function () {
|
|
649
|
+
var customContainer = getContainer ? getContainer() : null;
|
|
650
|
+
var parentElement = customContainer || document.body;
|
|
651
|
+
var hasElement = parentElement.querySelector("#".concat(id));
|
|
652
|
+
var el = hasElement || createElement(id);
|
|
653
|
+
|
|
654
|
+
if (!hasElement) {
|
|
655
|
+
parentElement.appendChild(el);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
setElSnapshot(el);
|
|
659
|
+
}, []);
|
|
660
|
+
return elSnapshot;
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
var usePortal$1 = usePortal;
|
|
664
|
+
|
|
665
|
+
var warningStack = {};
|
|
666
|
+
|
|
667
|
+
var useWarning = function useWarning(message, component) {
|
|
668
|
+
var tag = component ? " [".concat(component, "]") : ' ';
|
|
669
|
+
var log = "[Bolio UI]".concat(tag, ": ").concat(message);
|
|
670
|
+
if (typeof console === 'undefined') return;
|
|
671
|
+
if (warningStack[log]) return;
|
|
672
|
+
warningStack[log] = true;
|
|
673
|
+
|
|
674
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
675
|
+
return console.error(log);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
console.warn(log);
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
var useWarning$1 = useWarning;
|
|
682
|
+
|
|
683
|
+
var defaultOptions = {
|
|
684
|
+
onError: function onError() {
|
|
685
|
+
return useWarning$1('Failed to copy.', 'use-clipboard');
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
var useClipboard = function useClipboard() {
|
|
690
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultOptions;
|
|
691
|
+
var el = usePortal$1('clipboard');
|
|
692
|
+
|
|
693
|
+
var copyText = function copyText(el, text) {
|
|
694
|
+
if (!el || !text) return;
|
|
695
|
+
var selection = window.getSelection();
|
|
696
|
+
if (!selection) return;
|
|
697
|
+
el.style.whiteSpace = 'pre';
|
|
698
|
+
el.textContent = text;
|
|
699
|
+
var range = window.document.createRange();
|
|
700
|
+
selection.removeAllRanges();
|
|
701
|
+
range.selectNode(el);
|
|
702
|
+
selection.addRange(range);
|
|
703
|
+
|
|
704
|
+
try {
|
|
705
|
+
window.document.execCommand('copy');
|
|
706
|
+
} catch (e) {
|
|
707
|
+
options.onError && options.onError();
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
selection.removeAllRanges();
|
|
711
|
+
|
|
712
|
+
if (el) {
|
|
713
|
+
el.textContent = '';
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
var copy = React.useCallback(function (text) {
|
|
718
|
+
copyText(el, text);
|
|
719
|
+
}, [el]);
|
|
720
|
+
return {
|
|
721
|
+
copy: copy
|
|
722
|
+
};
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
var useClipboard$1 = useClipboard;
|
|
726
|
+
|
|
727
|
+
var defaultToastLayout = {
|
|
728
|
+
padding: '12px 16px',
|
|
729
|
+
margin: '8px 0',
|
|
730
|
+
width: '420px',
|
|
731
|
+
maxWidth: '90vw',
|
|
732
|
+
maxHeight: '75px',
|
|
733
|
+
placement: 'bottomRight'
|
|
734
|
+
};
|
|
735
|
+
var defaultParams = {
|
|
736
|
+
toasts: [],
|
|
737
|
+
toastLayout: defaultToastLayout,
|
|
738
|
+
updateToastLayout: function updateToastLayout(t) {
|
|
739
|
+
return t;
|
|
740
|
+
},
|
|
741
|
+
updateToasts: function updateToasts(t) {
|
|
742
|
+
return t;
|
|
743
|
+
},
|
|
744
|
+
lastUpdateToastId: null,
|
|
745
|
+
updateLastToastId: function updateLastToastId() {
|
|
746
|
+
return null;
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
var BolioUIContent = /*#__PURE__*/React__default["default"].createContext(defaultParams);
|
|
750
|
+
var useBolioUIContext = function useBolioUIContext() {
|
|
751
|
+
return React__default["default"].useContext(BolioUIContent);
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
var defaultToast = {
|
|
755
|
+
delay: 2000,
|
|
756
|
+
type: 'default'
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
var useToasts = function useToasts(layout) {
|
|
760
|
+
var _useBolioUIContext = useBolioUIContext(),
|
|
761
|
+
updateToasts = _useBolioUIContext.updateToasts,
|
|
762
|
+
toasts = _useBolioUIContext.toasts,
|
|
763
|
+
updateToastLayout = _useBolioUIContext.updateToastLayout,
|
|
764
|
+
updateLastToastId = _useBolioUIContext.updateLastToastId;
|
|
765
|
+
|
|
766
|
+
React.useEffect(function () {
|
|
767
|
+
if (!layout) return;
|
|
768
|
+
updateToastLayout(function () {
|
|
769
|
+
return layout ? _objectSpread2(_objectSpread2({}, defaultToastLayout), layout) : defaultToastLayout;
|
|
770
|
+
});
|
|
771
|
+
}, []);
|
|
772
|
+
|
|
773
|
+
var cancel = function cancel(internalId) {
|
|
774
|
+
updateToasts(function (currentToasts) {
|
|
775
|
+
return currentToasts.map(function (item) {
|
|
776
|
+
if (item._internalIdent !== internalId) return item;
|
|
777
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
778
|
+
visible: false
|
|
779
|
+
});
|
|
780
|
+
});
|
|
781
|
+
});
|
|
782
|
+
updateLastToastId(function () {
|
|
783
|
+
return internalId;
|
|
784
|
+
});
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
var removeAll = function removeAll() {
|
|
788
|
+
updateToasts(function (last) {
|
|
789
|
+
return last.map(function (toast) {
|
|
790
|
+
return _objectSpread2(_objectSpread2({}, toast), {}, {
|
|
791
|
+
visible: false
|
|
792
|
+
});
|
|
793
|
+
});
|
|
794
|
+
});
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
var findToastOneByID = function findToastOneByID(id) {
|
|
798
|
+
return toasts.find(function (t) {
|
|
799
|
+
return t.id === id;
|
|
800
|
+
});
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
var removeToastOneByID = function removeToastOneByID(id) {
|
|
804
|
+
updateToasts(function (last) {
|
|
805
|
+
return last.map(function (toast) {
|
|
806
|
+
if (toast.id !== id) return toast;
|
|
807
|
+
return _objectSpread2(_objectSpread2({}, toast), {}, {
|
|
808
|
+
visible: false
|
|
809
|
+
});
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
var setToast = function setToast(toast) {
|
|
815
|
+
var internalIdent = "toast-".concat(getId());
|
|
816
|
+
var delay = toast.delay || defaultToast.delay;
|
|
817
|
+
|
|
818
|
+
if (toast.id) {
|
|
819
|
+
var hasIdent = toasts.find(function (t) {
|
|
820
|
+
return t.id === toast.id;
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
if (hasIdent) {
|
|
824
|
+
throw new Error('Toast: Already have the same key: "ident"');
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
updateToasts(function (last) {
|
|
829
|
+
var newToast = {
|
|
830
|
+
delay: delay,
|
|
831
|
+
text: toast.text,
|
|
832
|
+
visible: true,
|
|
833
|
+
type: toast.type || defaultToast.type,
|
|
834
|
+
id: toast.id || internalIdent,
|
|
835
|
+
actions: toast.actions || [],
|
|
836
|
+
_internalIdent: internalIdent,
|
|
837
|
+
_timeout: window.setTimeout(function () {
|
|
838
|
+
cancel(internalIdent);
|
|
839
|
+
|
|
840
|
+
if (newToast._timeout) {
|
|
841
|
+
window.clearTimeout(newToast._timeout);
|
|
842
|
+
newToast._timeout = null;
|
|
843
|
+
}
|
|
844
|
+
}, delay),
|
|
845
|
+
cancel: function (_cancel) {
|
|
846
|
+
function cancel() {
|
|
847
|
+
return _cancel.apply(this, arguments);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
cancel.toString = function () {
|
|
851
|
+
return _cancel.toString();
|
|
852
|
+
};
|
|
853
|
+
|
|
854
|
+
return cancel;
|
|
855
|
+
}(function () {
|
|
856
|
+
return cancel(internalIdent);
|
|
857
|
+
})
|
|
858
|
+
};
|
|
859
|
+
return [].concat(_toConsumableArray(last), [newToast]);
|
|
860
|
+
});
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
return {
|
|
864
|
+
toasts: toasts,
|
|
865
|
+
setToast: setToast,
|
|
866
|
+
removeAll: removeAll,
|
|
867
|
+
findToastOneByID: findToastOneByID,
|
|
868
|
+
removeToastOneByID: removeToastOneByID
|
|
869
|
+
};
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
var useToasts$1 = useToasts;
|
|
873
|
+
|
|
874
|
+
var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', 'pl', 'pr', 'pt', 'pb', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom', 'ml', 'mr', 'mt', 'mb', 'px', 'py', 'mx', 'my', 'font', 'unit', 'scale'];
|
|
875
|
+
|
|
876
|
+
var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
|
|
877
|
+
return "".concat(scale1x);
|
|
878
|
+
};
|
|
879
|
+
|
|
880
|
+
var defaultContext = {
|
|
881
|
+
getScaleProps: function getScaleProps() {
|
|
882
|
+
return undefined;
|
|
883
|
+
},
|
|
884
|
+
getAllScaleProps: function getAllScaleProps() {
|
|
885
|
+
return {};
|
|
886
|
+
},
|
|
887
|
+
SCALES: {
|
|
888
|
+
pl: defaultDynamicLayoutPipe,
|
|
889
|
+
pr: defaultDynamicLayoutPipe,
|
|
890
|
+
pb: defaultDynamicLayoutPipe,
|
|
891
|
+
pt: defaultDynamicLayoutPipe,
|
|
892
|
+
px: defaultDynamicLayoutPipe,
|
|
893
|
+
py: defaultDynamicLayoutPipe,
|
|
894
|
+
mb: defaultDynamicLayoutPipe,
|
|
895
|
+
ml: defaultDynamicLayoutPipe,
|
|
896
|
+
mr: defaultDynamicLayoutPipe,
|
|
897
|
+
mt: defaultDynamicLayoutPipe,
|
|
898
|
+
mx: defaultDynamicLayoutPipe,
|
|
899
|
+
my: defaultDynamicLayoutPipe,
|
|
900
|
+
width: defaultDynamicLayoutPipe,
|
|
901
|
+
height: defaultDynamicLayoutPipe,
|
|
902
|
+
font: defaultDynamicLayoutPipe
|
|
903
|
+
},
|
|
904
|
+
unit: '16px'
|
|
905
|
+
};
|
|
906
|
+
var ScaleContext = /*#__PURE__*/React__default["default"].createContext(defaultContext);
|
|
907
|
+
var useScale$1 = function useScale() {
|
|
908
|
+
return React__default["default"].useContext(ScaleContext);
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
var generateGetScaleProps = function generateGetScaleProps(props) {
|
|
912
|
+
var getScaleProps = function getScaleProps(keyOrKeys) {
|
|
913
|
+
if (!Array.isArray(keyOrKeys)) return props[keyOrKeys];
|
|
914
|
+
var value = undefined;
|
|
915
|
+
|
|
916
|
+
var _iterator = _createForOfIteratorHelper(keyOrKeys),
|
|
917
|
+
_step;
|
|
918
|
+
|
|
919
|
+
try {
|
|
920
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
921
|
+
var key = _step.value;
|
|
922
|
+
var currentValue = props[key];
|
|
923
|
+
|
|
924
|
+
if (typeof currentValue !== 'undefined') {
|
|
925
|
+
value = currentValue;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
} catch (err) {
|
|
929
|
+
_iterator.e(err);
|
|
930
|
+
} finally {
|
|
931
|
+
_iterator.f();
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
return value;
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
return getScaleProps;
|
|
938
|
+
};
|
|
939
|
+
var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
940
|
+
var getAllScaleProps = function getAllScaleProps() {
|
|
941
|
+
var scaleProps = {};
|
|
942
|
+
|
|
943
|
+
var _iterator2 = _createForOfIteratorHelper(ScalePropKeys),
|
|
944
|
+
_step2;
|
|
945
|
+
|
|
946
|
+
try {
|
|
947
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
948
|
+
var key = _step2.value;
|
|
949
|
+
var value = props[key];
|
|
950
|
+
|
|
951
|
+
if (typeof value !== 'undefined') {
|
|
952
|
+
scaleProps[key] = value;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
} catch (err) {
|
|
956
|
+
_iterator2.e(err);
|
|
957
|
+
} finally {
|
|
958
|
+
_iterator2.f();
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
return scaleProps;
|
|
962
|
+
};
|
|
963
|
+
|
|
964
|
+
return getAllScaleProps;
|
|
965
|
+
};
|
|
966
|
+
|
|
967
|
+
var _excluded$1 = ["children"],
|
|
968
|
+
_excluded2 = ["paddingLeft", "pl", "paddingRight", "pr", "paddingTop", "pt", "paddingBottom", "pb", "marginTop", "mt", "marginRight", "mr", "marginBottom", "mb", "marginLeft", "ml", "px", "py", "mx", "my", "width", "height", "font", "w", "h", "margin", "padding", "unit", "scale"];
|
|
969
|
+
|
|
970
|
+
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
971
|
+
if (scale === 1) return scale;
|
|
972
|
+
var diff = Math.abs((scale - 1) / 2);
|
|
973
|
+
return scale > 1 ? 1 + diff : 1 - diff;
|
|
974
|
+
}; // eslint-disable-next-line @typescript-eslint/ban-types
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
var withScale = function withScale(Render) {
|
|
978
|
+
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
979
|
+
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31, _ref32, _ref33;
|
|
980
|
+
|
|
981
|
+
var children = _ref.children,
|
|
982
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
983
|
+
|
|
984
|
+
var _useTheme = useTheme(),
|
|
985
|
+
layout = _useTheme.layout;
|
|
986
|
+
|
|
987
|
+
var paddingLeft = props.paddingLeft,
|
|
988
|
+
pl = props.pl,
|
|
989
|
+
paddingRight = props.paddingRight,
|
|
990
|
+
pr = props.pr,
|
|
991
|
+
paddingTop = props.paddingTop,
|
|
992
|
+
pt = props.pt,
|
|
993
|
+
paddingBottom = props.paddingBottom,
|
|
994
|
+
pb = props.pb,
|
|
995
|
+
marginTop = props.marginTop,
|
|
996
|
+
mt = props.mt,
|
|
997
|
+
marginRight = props.marginRight,
|
|
998
|
+
mr = props.mr,
|
|
999
|
+
marginBottom = props.marginBottom,
|
|
1000
|
+
mb = props.mb,
|
|
1001
|
+
marginLeft = props.marginLeft,
|
|
1002
|
+
ml = props.ml,
|
|
1003
|
+
px = props.px,
|
|
1004
|
+
py = props.py,
|
|
1005
|
+
mx = props.mx,
|
|
1006
|
+
my = props.my,
|
|
1007
|
+
width = props.width,
|
|
1008
|
+
height = props.height,
|
|
1009
|
+
font = props.font,
|
|
1010
|
+
w = props.w,
|
|
1011
|
+
h = props.h,
|
|
1012
|
+
margin = props.margin,
|
|
1013
|
+
padding = props.padding,
|
|
1014
|
+
_props$unit = props.unit,
|
|
1015
|
+
unit = _props$unit === void 0 ? layout.unit : _props$unit,
|
|
1016
|
+
_props$scale = props.scale,
|
|
1017
|
+
scale = _props$scale === void 0 ? 1 : _props$scale,
|
|
1018
|
+
innerProps = _objectWithoutProperties(props, _excluded2);
|
|
1019
|
+
|
|
1020
|
+
var makeScaleHandler = function makeScaleHandler(attrValue) {
|
|
1021
|
+
return function (scale1x, defaultValue) {
|
|
1022
|
+
// 0 means disable scale and the default value is 0
|
|
1023
|
+
if (scale1x === 0) {
|
|
1024
|
+
scale1x = 1;
|
|
1025
|
+
defaultValue = defaultValue || 0;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
var factor = reduceScaleCoefficient(scale) * scale1x;
|
|
1029
|
+
|
|
1030
|
+
if (typeof attrValue === 'undefined') {
|
|
1031
|
+
if (typeof defaultValue !== 'undefined') return "".concat(defaultValue);
|
|
1032
|
+
return "calc(".concat(factor, " * ").concat(unit, ")");
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
if (!isCSSNumberValue(attrValue)) return "".concat(attrValue);
|
|
1036
|
+
var customFactor = factor * Number(attrValue);
|
|
1037
|
+
return "calc(".concat(customFactor, " * ").concat(unit, ")");
|
|
1038
|
+
};
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1041
|
+
var value = {
|
|
1042
|
+
unit: unit,
|
|
1043
|
+
SCALES: {
|
|
1044
|
+
pt: makeScaleHandler((_ref2 = (_ref3 = paddingTop !== null && paddingTop !== void 0 ? paddingTop : pt) !== null && _ref3 !== void 0 ? _ref3 : py) !== null && _ref2 !== void 0 ? _ref2 : padding),
|
|
1045
|
+
pr: makeScaleHandler((_ref4 = (_ref5 = paddingRight !== null && paddingRight !== void 0 ? paddingRight : pr) !== null && _ref5 !== void 0 ? _ref5 : px) !== null && _ref4 !== void 0 ? _ref4 : padding),
|
|
1046
|
+
pb: makeScaleHandler((_ref6 = (_ref7 = paddingBottom !== null && paddingBottom !== void 0 ? paddingBottom : pb) !== null && _ref7 !== void 0 ? _ref7 : py) !== null && _ref6 !== void 0 ? _ref6 : padding),
|
|
1047
|
+
pl: makeScaleHandler((_ref8 = (_ref9 = paddingLeft !== null && paddingLeft !== void 0 ? paddingLeft : pl) !== null && _ref9 !== void 0 ? _ref9 : px) !== null && _ref8 !== void 0 ? _ref8 : padding),
|
|
1048
|
+
px: makeScaleHandler((_ref10 = (_ref11 = (_ref12 = (_ref13 = px !== null && px !== void 0 ? px : paddingLeft) !== null && _ref13 !== void 0 ? _ref13 : paddingRight) !== null && _ref12 !== void 0 ? _ref12 : pl) !== null && _ref11 !== void 0 ? _ref11 : pr) !== null && _ref10 !== void 0 ? _ref10 : padding),
|
|
1049
|
+
py: makeScaleHandler((_ref14 = (_ref15 = (_ref16 = (_ref17 = py !== null && py !== void 0 ? py : paddingTop) !== null && _ref17 !== void 0 ? _ref17 : paddingBottom) !== null && _ref16 !== void 0 ? _ref16 : pt) !== null && _ref15 !== void 0 ? _ref15 : pb) !== null && _ref14 !== void 0 ? _ref14 : padding),
|
|
1050
|
+
mt: makeScaleHandler((_ref18 = (_ref19 = marginTop !== null && marginTop !== void 0 ? marginTop : mt) !== null && _ref19 !== void 0 ? _ref19 : my) !== null && _ref18 !== void 0 ? _ref18 : margin),
|
|
1051
|
+
mr: makeScaleHandler((_ref20 = (_ref21 = marginRight !== null && marginRight !== void 0 ? marginRight : mr) !== null && _ref21 !== void 0 ? _ref21 : mx) !== null && _ref20 !== void 0 ? _ref20 : margin),
|
|
1052
|
+
mb: makeScaleHandler((_ref22 = (_ref23 = marginBottom !== null && marginBottom !== void 0 ? marginBottom : mb) !== null && _ref23 !== void 0 ? _ref23 : my) !== null && _ref22 !== void 0 ? _ref22 : margin),
|
|
1053
|
+
ml: makeScaleHandler((_ref24 = (_ref25 = marginLeft !== null && marginLeft !== void 0 ? marginLeft : ml) !== null && _ref25 !== void 0 ? _ref25 : mx) !== null && _ref24 !== void 0 ? _ref24 : margin),
|
|
1054
|
+
mx: makeScaleHandler((_ref26 = (_ref27 = (_ref28 = (_ref29 = mx !== null && mx !== void 0 ? mx : marginLeft) !== null && _ref29 !== void 0 ? _ref29 : marginRight) !== null && _ref28 !== void 0 ? _ref28 : ml) !== null && _ref27 !== void 0 ? _ref27 : mr) !== null && _ref26 !== void 0 ? _ref26 : margin),
|
|
1055
|
+
my: makeScaleHandler((_ref30 = (_ref31 = (_ref32 = (_ref33 = my !== null && my !== void 0 ? my : marginTop) !== null && _ref33 !== void 0 ? _ref33 : marginBottom) !== null && _ref32 !== void 0 ? _ref32 : mt) !== null && _ref31 !== void 0 ? _ref31 : mb) !== null && _ref30 !== void 0 ? _ref30 : margin),
|
|
1056
|
+
width: makeScaleHandler(width !== null && width !== void 0 ? width : w),
|
|
1057
|
+
height: makeScaleHandler(height !== null && height !== void 0 ? height : h),
|
|
1058
|
+
font: makeScaleHandler(font)
|
|
1059
|
+
},
|
|
1060
|
+
getScaleProps: generateGetScaleProps(props),
|
|
1061
|
+
getAllScaleProps: generateGetAllScaleProps(props)
|
|
1062
|
+
};
|
|
1063
|
+
return /*#__PURE__*/React__default["default"].createElement(ScaleContext.Provider, {
|
|
1064
|
+
value: value
|
|
1065
|
+
}, /*#__PURE__*/React__default["default"].createElement(Render, _extends({}, innerProps, {
|
|
1066
|
+
ref: ref
|
|
1067
|
+
}), children));
|
|
1068
|
+
});
|
|
1069
|
+
ScaleFC.displayName = "Scale".concat(Render.displayName || 'Wrapper');
|
|
1070
|
+
return ScaleFC;
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
var withScale$1 = withScale;
|
|
1074
|
+
|
|
1075
|
+
var useScale = useScale$1;
|
|
1076
|
+
|
|
1077
|
+
var classObjectToString = function classObjectToString(className) {
|
|
1078
|
+
var keys = Object.keys(className);
|
|
1079
|
+
var len = keys.length;
|
|
1080
|
+
var str = '';
|
|
1081
|
+
|
|
1082
|
+
for (var index = 0; index < len; index++) {
|
|
1083
|
+
var key = keys[index];
|
|
1084
|
+
var val = className[keys[index]];
|
|
1085
|
+
if (!val) continue;
|
|
1086
|
+
str = str ? "".concat(str, " ").concat(String(key)) : String(key);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
return str;
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
var isObjectClassName = function isObjectClassName(value) {
|
|
1093
|
+
return _typeof(value) === 'object' && !Array.isArray(value);
|
|
1094
|
+
};
|
|
1095
|
+
|
|
1096
|
+
var useClasses = function useClasses() {
|
|
1097
|
+
var len = arguments.length;
|
|
1098
|
+
var classes = '';
|
|
1099
|
+
if (len === 0) return classes;
|
|
1100
|
+
|
|
1101
|
+
for (var index = 0; index < len; index++) {
|
|
1102
|
+
var val = index < 0 || arguments.length <= index ? undefined : arguments[index];
|
|
1103
|
+
if (!val) continue;
|
|
1104
|
+
|
|
1105
|
+
if (isObjectClassName(val)) {
|
|
1106
|
+
classes += " ".concat(classObjectToString(val));
|
|
1107
|
+
} else {
|
|
1108
|
+
classes += " ".concat(String(val).trim());
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
return classes.trim();
|
|
1113
|
+
};
|
|
1114
|
+
|
|
1115
|
+
var useClasses$1 = useClasses;
|
|
1116
|
+
|
|
1117
|
+
var _excluded = ["type", "filled", "children", "symbol", "toastText", "toastType", "text", "copy", "className"];
|
|
1118
|
+
|
|
1119
|
+
var textArrayToString = function textArrayToString(text) {
|
|
1120
|
+
return text.reduce(function (pre, current) {
|
|
1121
|
+
if (!current) return pre;
|
|
1122
|
+
return pre ? "".concat(pre, "\n").concat(current) : current;
|
|
1123
|
+
}, '');
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
function SnippetComponent(_ref) {
|
|
1127
|
+
var _ref$type = _ref.type,
|
|
1128
|
+
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
1129
|
+
_ref$filled = _ref.filled,
|
|
1130
|
+
filled = _ref$filled === void 0 ? false : _ref$filled,
|
|
1131
|
+
children = _ref.children,
|
|
1132
|
+
_ref$symbol = _ref.symbol,
|
|
1133
|
+
symbol = _ref$symbol === void 0 ? '$' : _ref$symbol,
|
|
1134
|
+
_ref$toastText = _ref.toastText,
|
|
1135
|
+
toastText = _ref$toastText === void 0 ? 'Copied!' : _ref$toastText,
|
|
1136
|
+
_ref$toastType = _ref.toastType,
|
|
1137
|
+
toastType = _ref$toastType === void 0 ? 'primary' : _ref$toastType,
|
|
1138
|
+
text = _ref.text,
|
|
1139
|
+
copyType = _ref.copy,
|
|
1140
|
+
_ref$className = _ref.className,
|
|
1141
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1142
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
1143
|
+
|
|
1144
|
+
var theme = useTheme();
|
|
1145
|
+
|
|
1146
|
+
var _useScale = useScale(),
|
|
1147
|
+
SCALES = _useScale.SCALES;
|
|
1148
|
+
|
|
1149
|
+
var _useClipboard = useClipboard$1(),
|
|
1150
|
+
copy = _useClipboard.copy;
|
|
1151
|
+
|
|
1152
|
+
var _useToasts = useToasts$1(),
|
|
1153
|
+
setToast = _useToasts.setToast;
|
|
1154
|
+
|
|
1155
|
+
var ref = React.useRef(null);
|
|
1156
|
+
var isMultiLine = text && Array.isArray(text);
|
|
1157
|
+
var style = React.useMemo(function () {
|
|
1158
|
+
return getStyles(type, theme.palette, filled);
|
|
1159
|
+
}, [type, theme.palette, filled]);
|
|
1160
|
+
var showCopyIcon = React.useMemo(function () {
|
|
1161
|
+
return copyType !== 'prevent';
|
|
1162
|
+
}, [copyType]);
|
|
1163
|
+
var childText = React.useMemo(function () {
|
|
1164
|
+
if (isMultiLine) return textArrayToString(text);
|
|
1165
|
+
if (!children) return text;
|
|
1166
|
+
if (!ref.current) return '';
|
|
1167
|
+
return ref.current.textContent;
|
|
1168
|
+
}, [isMultiLine, text, children]);
|
|
1169
|
+
var symbolBefore = React.useMemo(function () {
|
|
1170
|
+
var str = symbol.trim();
|
|
1171
|
+
return str ? "".concat(str, " ") : '';
|
|
1172
|
+
}, [symbol]);
|
|
1173
|
+
|
|
1174
|
+
var clickHandler = function clickHandler() {
|
|
1175
|
+
if (!childText || !showCopyIcon) return;
|
|
1176
|
+
copy(childText);
|
|
1177
|
+
if (copyType === 'silent') return;
|
|
1178
|
+
setToast({
|
|
1179
|
+
text: toastText,
|
|
1180
|
+
type: toastType
|
|
1181
|
+
});
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _extends({}, props, {
|
|
1185
|
+
className: styledJsx_cjs.style.dynamic([["2957719341", [style.color, style.bgColor, style.border, theme.layout.radius, SCALES.font(0.8125), SCALES.pt(0.667), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0.667), SCALES.pr(2.667), SCALES.pb(0.667), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), style.color, symbolBefore, style.bgColor, isMultiLine ? 'flex-start' : 'center', theme.layout.radius, isMultiLine ? 'var(--snippet-padding-top)' : 0]]]) + " " + (props && props.className != null && props.className || useClasses$1('snippet', className) || "")
|
|
1186
|
+
}), isMultiLine ? text.map(function (t, index) {
|
|
1187
|
+
return /*#__PURE__*/React__default["default"].createElement("pre", {
|
|
1188
|
+
key: "snippet-".concat(index, "-").concat(t),
|
|
1189
|
+
className: styledJsx_cjs.style.dynamic([["2957719341", [style.color, style.bgColor, style.border, theme.layout.radius, SCALES.font(0.8125), SCALES.pt(0.667), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0.667), SCALES.pr(2.667), SCALES.pb(0.667), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), style.color, symbolBefore, style.bgColor, isMultiLine ? 'flex-start' : 'center', theme.layout.radius, isMultiLine ? 'var(--snippet-padding-top)' : 0]]])
|
|
1190
|
+
}, t);
|
|
1191
|
+
}) : /*#__PURE__*/React__default["default"].createElement("pre", {
|
|
1192
|
+
ref: ref,
|
|
1193
|
+
className: styledJsx_cjs.style.dynamic([["2957719341", [style.color, style.bgColor, style.border, theme.layout.radius, SCALES.font(0.8125), SCALES.pt(0.667), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0.667), SCALES.pr(2.667), SCALES.pb(0.667), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), style.color, symbolBefore, style.bgColor, isMultiLine ? 'flex-start' : 'center', theme.layout.radius, isMultiLine ? 'var(--snippet-padding-top)' : 0]]])
|
|
1194
|
+
}, children || text), showCopyIcon && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1195
|
+
onClick: clickHandler,
|
|
1196
|
+
className: styledJsx_cjs.style.dynamic([["2957719341", [style.color, style.bgColor, style.border, theme.layout.radius, SCALES.font(0.8125), SCALES.pt(0.667), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0.667), SCALES.pr(2.667), SCALES.pb(0.667), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), style.color, symbolBefore, style.bgColor, isMultiLine ? 'flex-start' : 'center', theme.layout.radius, isMultiLine ? 'var(--snippet-padding-top)' : 0]]]) + " " + "copy"
|
|
1197
|
+
}, /*#__PURE__*/React__default["default"].createElement(SnippetIcon$1, null)), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
|
|
1198
|
+
id: "2957719341",
|
|
1199
|
+
dynamic: [style.color, style.bgColor, style.border, theme.layout.radius, SCALES.font(0.8125), SCALES.pt(0.667), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0.667), SCALES.pr(2.667), SCALES.pb(0.667), SCALES.pl(0.667), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), style.color, symbolBefore, style.bgColor, isMultiLine ? 'flex-start' : 'center', theme.layout.radius, isMultiLine ? 'var(--snippet-padding-top)' : 0]
|
|
1200
|
+
}, ".snippet.__jsx-style-dynamic-selector{position:relative;max-width:100%;color:".concat(style.color, ";background-color:").concat(style.bgColor, ";border:1px solid ").concat(style.border, ";border-radius:").concat(theme.layout.radius, ";--snippet-font-size:").concat(SCALES.font(0.8125), ";--snippet-padding-top:").concat(SCALES.pt(0.667), ";font-size:var(--snippet-font-size);width:").concat(SCALES.width(1, 'initial'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0.667), " ").concat(SCALES.pr(2.667), " ").concat(SCALES.pb(0.667), " ").concat(SCALES.pl(0.667), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}pre.__jsx-style-dynamic-selector{margin:0;padding:0;border:none;background-color:transparent;color:").concat(style.color, ";font-size:inherit;}pre.__jsx-style-dynamic-selector::before{content:'").concat(symbolBefore, "';-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}pre.__jsx-style-dynamic-selector *{margin:0;padding:0;font-size:inherit;color:inherit;}.copy.__jsx-style-dynamic-selector{position:absolute;right:0;top:0;bottom:0;background-color:").concat(style.bgColor, ";display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:").concat(isMultiLine ? 'flex-start' : 'center', ";-webkit-box-align:").concat(isMultiLine ? 'flex-start' : 'center', ";-ms-flex-align:").concat(isMultiLine ? 'flex-start' : 'center', ";align-items:").concat(isMultiLine ? 'flex-start' : 'center', ";width:calc(3.281 * var(--snippet-font-size));color:inherit;-webkit-transition:opacity 150ms ease 0s;transition:opacity 150ms ease 0s;border-radius:").concat(theme.layout.radius, ";cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding-top:").concat(isMultiLine ? 'var(--snippet-padding-top)' : 0, ";opacity:0.65;}.copy.__jsx-style-dynamic-selector:hover{opacity:1;}")));
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
SnippetComponent.displayName = 'BolioUISnippet';
|
|
1204
|
+
var Snippet = withScale$1(SnippetComponent);
|
|
1205
|
+
var Snippet$1 = Snippet;
|
|
1206
|
+
|
|
1207
|
+
exports["default"] = Snippet$1;
|