@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,91 @@
|
|
|
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 = ["src", "disableSkeleton", "className", "maxDelay"];
|
|
5
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
6
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import useTheme from '../use-theme';
|
|
8
|
+
import ImageSkeleton from './image.skeleton';
|
|
9
|
+
import { transformDataSource } from './helpers';
|
|
10
|
+
import useScale, { withScale } from '../use-scale';
|
|
11
|
+
import useClasses from '../use-classes';
|
|
12
|
+
|
|
13
|
+
function ImageComponent(_ref) {
|
|
14
|
+
var src = _ref.src,
|
|
15
|
+
_ref$disableSkeleton = _ref.disableSkeleton,
|
|
16
|
+
disableSkeleton = _ref$disableSkeleton === void 0 ? false : _ref$disableSkeleton,
|
|
17
|
+
_ref$className = _ref.className,
|
|
18
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
19
|
+
_ref$maxDelay = _ref.maxDelay,
|
|
20
|
+
maxDelay = _ref$maxDelay === void 0 ? 3000 : _ref$maxDelay,
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
|
|
23
|
+
var _useScale = useScale(),
|
|
24
|
+
SCALES = _useScale.SCALES,
|
|
25
|
+
getScaleProps = _useScale.getScaleProps;
|
|
26
|
+
|
|
27
|
+
var width = getScaleProps(['width', 'w']);
|
|
28
|
+
var height = getScaleProps(['height', 'h']);
|
|
29
|
+
var showAnimation = !disableSkeleton && width && height;
|
|
30
|
+
var theme = useTheme();
|
|
31
|
+
|
|
32
|
+
var _useState = useState(true),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
loading = _useState2[0],
|
|
35
|
+
setLoading = _useState2[1];
|
|
36
|
+
|
|
37
|
+
var _useState3 = useState(true),
|
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
+
showSkeleton = _useState4[0],
|
|
40
|
+
setShowSkeleton = _useState4[1];
|
|
41
|
+
|
|
42
|
+
var imageRef = useRef(null);
|
|
43
|
+
var url = useMemo(function () {
|
|
44
|
+
return transformDataSource(src);
|
|
45
|
+
}, [src]);
|
|
46
|
+
|
|
47
|
+
var imageLoaded = function imageLoaded() {
|
|
48
|
+
if (!showAnimation) return;
|
|
49
|
+
setLoading(false);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
if (!showAnimation) return;
|
|
54
|
+
if (!imageRef.current) return;
|
|
55
|
+
|
|
56
|
+
if (imageRef.current.complete) {
|
|
57
|
+
setLoading(false);
|
|
58
|
+
setShowSkeleton(false);
|
|
59
|
+
}
|
|
60
|
+
}, [showAnimation]);
|
|
61
|
+
useEffect(function () {
|
|
62
|
+
var timer = setTimeout(function () {
|
|
63
|
+
if (showAnimation) {
|
|
64
|
+
setShowSkeleton(false);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
clearTimeout(timer);
|
|
68
|
+
}, maxDelay);
|
|
69
|
+
return function () {
|
|
70
|
+
return clearTimeout(timer);
|
|
71
|
+
};
|
|
72
|
+
}, [loading, maxDelay, showAnimation]);
|
|
73
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: _JSXStyle.dynamic([["2756333380", [theme.layout.radius, SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0, 'auto'), SCALES.mb(0), SCALES.ml(0, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.width(1, 'auto'), SCALES.height(1, 'auto')]]]) + " " + (useClasses('image', className) || "")
|
|
75
|
+
}, showSkeleton && showAnimation && /*#__PURE__*/React.createElement(ImageSkeleton, {
|
|
76
|
+
opacity: loading ? 1 : 0
|
|
77
|
+
}), /*#__PURE__*/React.createElement("img", _extends({
|
|
78
|
+
ref: imageRef,
|
|
79
|
+
onLoad: imageLoaded,
|
|
80
|
+
src: url
|
|
81
|
+
}, props, {
|
|
82
|
+
className: _JSXStyle.dynamic([["2756333380", [theme.layout.radius, SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0, 'auto'), SCALES.mb(0), SCALES.ml(0, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.width(1, 'auto'), SCALES.height(1, 'auto')]]]) + " " + (props && props.className != null && props.className || "")
|
|
83
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
84
|
+
id: "2756333380",
|
|
85
|
+
dynamic: [theme.layout.radius, SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0, 'auto'), SCALES.mb(0), SCALES.ml(0, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.width(1, 'auto'), SCALES.height(1, 'auto')]
|
|
86
|
+
}, ".image.__jsx-style-dynamic-selector{position:relative;border-radius:".concat(theme.layout.radius, ";overflow:hidden;max-width:100%;width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0, 'auto'), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";}img.__jsx-style-dynamic-selector{width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";object-fit:scale-down;display:inline-block;}")));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
ImageComponent.displayName = 'BolioUIImage';
|
|
90
|
+
var Image = withScale(ImageComponent);
|
|
91
|
+
export default Image;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["opacity"];
|
|
4
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import useTheme from '../use-theme';
|
|
7
|
+
var ImageSkeleton = /*#__PURE__*/React.memo(function (_ref) {
|
|
8
|
+
var _ref$opacity = _ref.opacity,
|
|
9
|
+
opacity = _ref$opacity === void 0 ? 0.5 : _ref$opacity,
|
|
10
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
11
|
+
|
|
12
|
+
var theme = useTheme();
|
|
13
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
14
|
+
className: _JSXStyle.dynamic([["2946022605", [theme.palette.accents_1, theme.palette.accents_2, theme.palette.accents_2, theme.palette.accents_1, opacity]]]) + " " + (props && props.className != null && props.className || "skeleton")
|
|
15
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
16
|
+
id: "2946022605",
|
|
17
|
+
dynamic: [theme.palette.accents_1, theme.palette.accents_2, theme.palette.accents_2, theme.palette.accents_1, opacity]
|
|
18
|
+
}, ".skeleton.__jsx-style-dynamic-selector{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;background-image:linear-gradient( 270deg, ".concat(theme.palette.accents_1, ", ").concat(theme.palette.accents_2, ", ").concat(theme.palette.accents_2, ", ").concat(theme.palette.accents_1, " );background-size:400% 100%;-webkit-animation:loading-__jsx-style-dynamic-selector 3s ease-in-out infinite;animation:loading-__jsx-style-dynamic-selector 3s ease-in-out infinite;opacity:").concat(opacity, ";-webkit-transition:opacity 300ms ease-out;transition:opacity 300ms ease-out;}@-webkit-keyframes loading-__jsx-style-dynamic-selector{0%{background-position:200% 0;}to{background-position:-200% 0;}}@keyframes loading-__jsx-style-dynamic-selector{0%{background-position:200% 0;}to{background-position:-200% 0;}}")));
|
|
19
|
+
});
|
|
20
|
+
ImageSkeleton.displayName = 'BolioUIImageSkeleton';
|
|
21
|
+
export default ImageSkeleton;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import Image from '.';
|
|
2
|
+
import Display from '../display';
|
|
3
|
+
import Code from '../code';
|
|
4
|
+
import Grid from '../grid';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Data Display/Image',
|
|
7
|
+
component: Image
|
|
8
|
+
};
|
|
9
|
+
export var Default = function Default() {
|
|
10
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
11
|
+
gap: 2
|
|
12
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Image, {
|
|
13
|
+
width: "280px",
|
|
14
|
+
height: "160px",
|
|
15
|
+
src: "https://bolio-ui.com/logo-white.jpg"
|
|
16
|
+
})));
|
|
17
|
+
};
|
|
18
|
+
export var Skeleton = function Skeleton() {
|
|
19
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
20
|
+
gap: 2
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Image, {
|
|
22
|
+
width: "280px",
|
|
23
|
+
height: "160px",
|
|
24
|
+
src: "https://bolio-ui.com/logo-white.jpg"
|
|
25
|
+
})));
|
|
26
|
+
};
|
|
27
|
+
export var Browser = function Browser() {
|
|
28
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
29
|
+
gap: 2
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Image.Browser, {
|
|
31
|
+
url: "https://bolio-ui.com.br/",
|
|
32
|
+
anchorProps: {
|
|
33
|
+
rel: 'nofollow'
|
|
34
|
+
}
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
36
|
+
width: "450px",
|
|
37
|
+
height: "300px",
|
|
38
|
+
src: "https://bolio-ui.com/logo-white.jpg"
|
|
39
|
+
}))));
|
|
40
|
+
};
|
|
41
|
+
export var BrowserInvert = function BrowserInvert() {
|
|
42
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
43
|
+
gap: 2
|
|
44
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Image.Browser, {
|
|
45
|
+
url: "https://bolio-ui.com.br/",
|
|
46
|
+
invert: true
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
48
|
+
width: "450px",
|
|
49
|
+
height: "300px",
|
|
50
|
+
src: "https://bolio-ui.com/logo-white.jpg"
|
|
51
|
+
}))));
|
|
52
|
+
};
|
|
53
|
+
export var Compose = function Compose() {
|
|
54
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
55
|
+
gap: 2
|
|
56
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Display, {
|
|
57
|
+
shadow: true,
|
|
58
|
+
caption: /*#__PURE__*/React.createElement("p", null, "Reduce the possibility of page rendering by setting", ' ', /*#__PURE__*/React.createElement(Code, null, "height"))
|
|
59
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
60
|
+
height: "250px",
|
|
61
|
+
src: "https://bolio-ui.com/logo-white.jpg"
|
|
62
|
+
}))));
|
|
63
|
+
};
|
|
64
|
+
export var SVG = function SVG() {
|
|
65
|
+
var svg = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30px\" height=\"30px\" viewBox=\"0 0 30 30\" fill=\"none\">\n <path d=\"M13.5 3.5H14V3.29289L13.8536 3.14645L13.5 3.5ZM10.5 0.5L10.8536 0.146447L10.7071 0H10.5V0.5ZM2.5 6.5V6H2V6.5H2.5ZM2.5 8.5H2V9H2.5V8.5ZM4.5 8.5H5V8H4.5V8.5ZM4.5 10.5V11H5V10.5H4.5ZM6.5 9.5H6V9.70711L6.14645 9.85355L6.5 9.5ZM7.5 10.5L7.14645 10.8536L7.5 11.2071L7.85355 10.8536L7.5 10.5ZM8.5 9.5L8.85355 9.85355L9 9.70711V9.5H8.5ZM10.5 6.5V6H10V6.5H10.5ZM10.5 10.5H10V11H10.5V10.5ZM12.5 10.5V11H13V10.5H12.5ZM2 5V1.5H1V5H2ZM13 3.5V5H14V3.5H13ZM2.5 1H10.5V0H2.5V1ZM10.1464 0.853553L13.1464 3.85355L13.8536 3.14645L10.8536 0.146447L10.1464 0.853553ZM2 1.5C2 1.22386 2.22386 1 2.5 1V0C1.67157 0 1 0.671573 1 1.5H2ZM1 12V13.5H2V12H1ZM2.5 15H12.5V14H2.5V15ZM14 13.5V12H13V13.5H14ZM12.5 15C13.3284 15 14 14.3284 14 13.5H13C13 13.7761 12.7761 14 12.5 14V15ZM1 13.5C1 14.3284 1.67157 15 2.5 15V14C2.22386 14 2 13.7761 2 13.5H1ZM5 6H2.5V7H5V6ZM2 6.5V8.5H3V6.5H2ZM2.5 9H4.5V8H2.5V9ZM4 8.5V10.5H5V8.5H4ZM4.5 10H2V11H4.5V10ZM6 6V9.5H7V6H6ZM6.14645 9.85355L7.14645 10.8536L7.85355 10.1464L6.85355 9.14645L6.14645 9.85355ZM7.85355 10.8536L8.85355 9.85355L8.14645 9.14645L7.14645 10.1464L7.85355 10.8536ZM9 9.5V6H8V9.5H9ZM13 6H10.5V7H13V6ZM10 6.5V10.5H11V6.5H10ZM10.5 11H12.5V10H10.5V11ZM13 10.5V8.5H12V10.5H13Z\" fill=\"black\"/>\n </svg>";
|
|
66
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
67
|
+
gap: 2
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Image, {
|
|
69
|
+
width: "100px",
|
|
70
|
+
height: "50px",
|
|
71
|
+
src: svg
|
|
72
|
+
})));
|
|
73
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export var getBrowserColors = function getBrowserColors(invert, palette) {
|
|
2
|
+
return invert ? {
|
|
3
|
+
color: palette.background,
|
|
4
|
+
barBgColor: palette.foreground,
|
|
5
|
+
inputBgColor: palette.accents_8,
|
|
6
|
+
borderColor: palette.accents_7,
|
|
7
|
+
titleColor: palette.accents_2
|
|
8
|
+
} : {
|
|
9
|
+
color: palette.foreground,
|
|
10
|
+
barBgColor: palette.background,
|
|
11
|
+
inputBgColor: palette.accents_1,
|
|
12
|
+
borderColor: palette.border,
|
|
13
|
+
titleColor: palette.accents_5
|
|
14
|
+
};
|
|
15
|
+
};
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
/// <reference types="styled-jsx" />
|
|
4
|
+
export { default as Avatar } from './avatar';
|
|
5
|
+
export { default as Badge } from './badge';
|
|
6
|
+
export { default as BolioUIProvider } from './bolio-ui-provider';
|
|
7
|
+
export { default as Breadcrumbs } from './breadcrumbs';
|
|
8
|
+
export { default as Button } from './button';
|
|
9
|
+
export { default as ButtonDropdown } from './button-dropdown';
|
|
10
|
+
export { default as ButtonGroup } from './button-group';
|
|
11
|
+
export { default as Capacity } from './capacity';
|
|
12
|
+
export { default as Card } from './card';
|
|
13
|
+
export { default as Checkbox } from './checkbox';
|
|
14
|
+
export { default as Code } from './code';
|
|
15
|
+
export { default as Col } from './col';
|
|
16
|
+
export { default as Collapse } from './collapse';
|
|
17
|
+
export { default as Container } from './container';
|
|
18
|
+
export { default as Description } from './description';
|
|
19
|
+
export { default as Display } from './display';
|
|
20
|
+
export { default as Divider } from './divider';
|
|
21
|
+
export { default as Dot } from './dot';
|
|
22
|
+
export { default as Drawer } from './drawer';
|
|
23
|
+
export { default as Fieldset } from './fieldset';
|
|
24
|
+
export { default as Grid } from './grid';
|
|
25
|
+
export { default as Image } from './image';
|
|
26
|
+
export { default as Input } from './input';
|
|
27
|
+
export { default as Keyboard } from './keyboard';
|
|
28
|
+
export { default as Link } from './link';
|
|
29
|
+
export { default as Loading } from './loading';
|
|
30
|
+
export { default as Modal } from './modal';
|
|
31
|
+
export { default as Note } from './note';
|
|
32
|
+
export { default as Page } from './page';
|
|
33
|
+
export { default as Pagination } from './pagination';
|
|
34
|
+
export { default as Popover } from './popover';
|
|
35
|
+
export { default as Progress } from './progress';
|
|
36
|
+
export { default as Radio } from './radio';
|
|
37
|
+
export { default as Rating } from './rating';
|
|
38
|
+
export { default as Row } from './row';
|
|
39
|
+
export { default as Section } from './section';
|
|
40
|
+
export { default as Select } from './select';
|
|
41
|
+
export { default as Slider } from './slider';
|
|
42
|
+
export { default as Snippet } from './snippet';
|
|
43
|
+
export { default as Spacer } from './spacer';
|
|
44
|
+
export { default as Spinner } from './spinner';
|
|
45
|
+
export { default as Tabs } from './tabs';
|
|
46
|
+
export { default as Tag } from './tag';
|
|
47
|
+
export { default as Text } from './text';
|
|
48
|
+
export { default as Textarea } from './textarea';
|
|
49
|
+
export { default as Themes } from './themes';
|
|
50
|
+
export { default as Toggle } from './toggle';
|
|
51
|
+
export { default as Tooltip } from './tooltip';
|
|
52
|
+
export { default as useAllThemes } from './use-all-themes';
|
|
53
|
+
export { default as useToasts } from './use-toasts';
|
|
54
|
+
export { default as useBodyScroll } from './use-body-scroll';
|
|
55
|
+
export { default as useClipboard } from './use-clipboard';
|
|
56
|
+
export { default as useMediaQuery } from './use-media-query';
|
|
57
|
+
export { default as useKeyboard, KeyMod, KeyCode } from './use-keyboard';
|
|
58
|
+
export { default as useInput } from './use-input';
|
|
59
|
+
export { default as useModal } from './use-modal';
|
|
60
|
+
export { default as useTabs } from './use-tabs';
|
|
61
|
+
export { default as useClickAway } from './use-click-away';
|
|
62
|
+
export { default as useCurrentState } from './use-current-state';
|
|
63
|
+
export { default as CssBaseline } from './css-baseline';
|
|
64
|
+
export { default as useTheme } from './use-theme';
|
|
65
|
+
export { default as useClasses } from './use-classes';
|
|
66
|
+
export { default as useScale } from './use-scale';
|
|
67
|
+
export { withScale, ScalePropKeys, ScaleContext } from './use-scale';
|
|
68
|
+
export { useRect } from './utils/layouts';
|
|
69
|
+
export { default as Highlight } from './shared/highlight';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import useTheme from '../use-theme';
|
|
4
|
+
|
|
5
|
+
function InputBlockLabelComponent(_ref) {
|
|
6
|
+
var children = _ref.children;
|
|
7
|
+
var theme = useTheme();
|
|
8
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
9
|
+
className: _JSXStyle.dynamic([["1278828862", [theme.palette.accents_6]]])
|
|
10
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
11
|
+
id: "1278828862",
|
|
12
|
+
dynamic: [theme.palette.accents_6]
|
|
13
|
+
}, "label.__jsx-style-dynamic-selector{display:block;font-weight:normal;color:".concat(theme.palette.accents_6, ";padding:0 0 0 1px;margin-bottom:0.5em;font-size:1em;line-height:1.5;}label.__jsx-style-dynamic-selector>*:first-child{margin-top:0;}label.__jsx-style-dynamic-selector>*:last-child{margin-bottom:0;}")));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
InputBlockLabelComponent.displayName = 'BolioUIInputBlockLabel';
|
|
17
|
+
var InputBlockLabel = /*#__PURE__*/React.memo(InputBlockLabelComponent);
|
|
18
|
+
export default InputBlockLabel;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import useTheme from '../use-theme';
|
|
4
|
+
import useClasses from '../use-classes';
|
|
5
|
+
|
|
6
|
+
function InputIconClear(_ref) {
|
|
7
|
+
var onClick = _ref.onClick,
|
|
8
|
+
disabled = _ref.disabled,
|
|
9
|
+
visible = _ref.visible;
|
|
10
|
+
var theme = useTheme();
|
|
11
|
+
var classes = useClasses('clear-icon', {
|
|
12
|
+
visible: visible
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
var clickHandler = function clickHandler(event) {
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
event.stopPropagation();
|
|
18
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
19
|
+
onClick && onClick(event);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
onClick: clickHandler,
|
|
24
|
+
className: _JSXStyle.dynamic([["2817842826", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]]) + " " + (classes || "")
|
|
25
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
26
|
+
viewBox: "0 0 24 24",
|
|
27
|
+
stroke: "currentColor",
|
|
28
|
+
strokeWidth: "1.5",
|
|
29
|
+
strokeLinecap: "round",
|
|
30
|
+
strokeLinejoin: "round",
|
|
31
|
+
fill: "none",
|
|
32
|
+
shapeRendering: "geometricPrecision",
|
|
33
|
+
className: _JSXStyle.dynamic([["2817842826", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]])
|
|
34
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
35
|
+
d: "M18 6L6 18",
|
|
36
|
+
className: _JSXStyle.dynamic([["2817842826", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]])
|
|
37
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
38
|
+
d: "M6 6l12 12",
|
|
39
|
+
className: _JSXStyle.dynamic([["2817842826", [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]]])
|
|
40
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
41
|
+
id: "2817842826",
|
|
42
|
+
dynamic: [disabled ? 'not-allowed' : 'pointer', theme.palette.accents_3, disabled ? theme.palette.accents_3 : theme.palette.foreground]
|
|
43
|
+
}, ".clear-icon.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:calc(var(--input-height) - 2px);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;cursor:".concat(disabled ? 'not-allowed' : 'pointer', ";-webkit-transition:color 150ms ease 0s;transition:color 150ms ease 0s;margin:0;padding:0;color:").concat(theme.palette.accents_3, ";visibility:hidden;opacity:0;}.visible.__jsx-style-dynamic-selector{visibility:visible;opacity:1;}.clear-icon.__jsx-style-dynamic-selector:hover{color:").concat(disabled ? theme.palette.accents_3 : theme.palette.foreground, ";}svg.__jsx-style-dynamic-selector{color:currentColor;width:calc(var(--input-height) - 2px);height:calc(var(--input-height) - 2px);-webkit-transform:scale(0.44);-ms-transform:scale(0.44);transform:scale(0.44);}")));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var MemoInputIconClear = /*#__PURE__*/React.memo(InputIconClear);
|
|
47
|
+
export default MemoInputIconClear;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
function InputIconComponent(_ref) {
|
|
5
|
+
var icon = _ref.icon,
|
|
6
|
+
clickable = _ref.clickable,
|
|
7
|
+
onClick = _ref.onClick;
|
|
8
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
9
|
+
onClick: onClick,
|
|
10
|
+
className: _JSXStyle.dynamic([["4247656379", [clickable ? 'pointer' : 'default', clickable ? 'auto' : 'none']]]) + " " + "input-icon"
|
|
11
|
+
}, icon, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
12
|
+
id: "4247656379",
|
|
13
|
+
dynamic: [clickable ? 'pointer' : 'default', clickable ? 'auto' : 'none']
|
|
14
|
+
}, ".input-icon.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:calc(var(--input-height) - 2px);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;margin:0;padding:0;line-height:1;position:relative;cursor:".concat(clickable ? 'pointer' : 'default', ";pointer-events:").concat(clickable ? 'auto' : 'none', ";}.input-icon.__jsx-style-dynamic-selector svg{width:calc(var(--input-height) - 2px);height:calc(var(--input-height) - 2px);-webkit-transform:scale(0.44);-ms-transform:scale(0.44);transform:scale(0.44);}")));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
InputIconComponent.displayName = 'BolioUIInputIcon';
|
|
18
|
+
var InputIcon = /*#__PURE__*/React.memo(InputIconComponent);
|
|
19
|
+
export default InputIcon;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import useTheme from '../use-theme';
|
|
4
|
+
|
|
5
|
+
function InputLabel(_ref) {
|
|
6
|
+
var children = _ref.children,
|
|
7
|
+
isRight = _ref.isRight;
|
|
8
|
+
var theme = useTheme();
|
|
9
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
10
|
+
className: _JSXStyle.dynamic([["839392656", [theme.layout.gapHalf, theme.palette.accents_4, theme.palette.accents_1, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border]]]) + " " + ((isRight ? 'right' : '') || "")
|
|
11
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
12
|
+
id: "839392656",
|
|
13
|
+
dynamic: [theme.layout.gapHalf, theme.palette.accents_4, theme.palette.accents_1, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border]
|
|
14
|
+
}, "span.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:initial;height:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;pointer-events:none;margin:0;padding:0 ".concat(theme.layout.gapHalf, ";color:").concat(theme.palette.accents_4, ";background-color:").concat(theme.palette.accents_1, ";border-top-left-radius:").concat(theme.layout.radius, ";border-bottom-left-radius:").concat(theme.layout.radius, ";border-top:1px solid ").concat(theme.palette.border, ";border-left:1px solid ").concat(theme.palette.border, ";border-bottom:1px solid ").concat(theme.palette.border, ";border-right:1px solid ").concat(theme.palette.border, ";font-size:inherit;line-height:1;}span.right.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";border-left:1px solid ").concat(theme.palette.border, ";border-right:1px solid ").concat(theme.palette.border, ";}")));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var MemoInputLabel = /*#__PURE__*/React.memo(InputLabel);
|
|
18
|
+
export default MemoInputLabel;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
var _excluded = ["label", "labelRight", "type", "htmlType", "icon", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "autoComplete", "placeholder", "children", "disabled", "backgroundColor"];
|
|
5
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
6
|
+
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import useTheme from '../use-theme';
|
|
8
|
+
import InputLabel from './input-label';
|
|
9
|
+
import InputBlockLabel from './input-block-label';
|
|
10
|
+
import InputIcon from './input-icon';
|
|
11
|
+
import InputClearIcon from './input-icon-clear';
|
|
12
|
+
import { getColors } from './styles';
|
|
13
|
+
import { defaultProps } from './input-props';
|
|
14
|
+
import useScale, { withScale } from '../use-scale';
|
|
15
|
+
import useClasses from '../use-classes';
|
|
16
|
+
|
|
17
|
+
var simulateChangeEvent = function simulateChangeEvent(el, event) {
|
|
18
|
+
return _extends({}, event, {
|
|
19
|
+
target: el,
|
|
20
|
+
currentTarget: el
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
25
|
+
var label = _ref.label,
|
|
26
|
+
labelRight = _ref.labelRight,
|
|
27
|
+
type = _ref.type,
|
|
28
|
+
htmlType = _ref.htmlType,
|
|
29
|
+
icon = _ref.icon,
|
|
30
|
+
iconRight = _ref.iconRight,
|
|
31
|
+
iconClickable = _ref.iconClickable,
|
|
32
|
+
onIconClick = _ref.onIconClick,
|
|
33
|
+
initialValue = _ref.initialValue,
|
|
34
|
+
onChange = _ref.onChange,
|
|
35
|
+
readOnly = _ref.readOnly,
|
|
36
|
+
value = _ref.value,
|
|
37
|
+
onClearClick = _ref.onClearClick,
|
|
38
|
+
clearable = _ref.clearable,
|
|
39
|
+
className = _ref.className,
|
|
40
|
+
onBlur = _ref.onBlur,
|
|
41
|
+
onFocus = _ref.onFocus,
|
|
42
|
+
autoComplete = _ref.autoComplete,
|
|
43
|
+
placeholder = _ref.placeholder,
|
|
44
|
+
children = _ref.children,
|
|
45
|
+
disabled = _ref.disabled,
|
|
46
|
+
backgroundColor = _ref.backgroundColor,
|
|
47
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
+
|
|
49
|
+
var theme = useTheme();
|
|
50
|
+
|
|
51
|
+
var _useScale = useScale(),
|
|
52
|
+
SCALES = _useScale.SCALES;
|
|
53
|
+
|
|
54
|
+
var inputRef = useRef(null);
|
|
55
|
+
useImperativeHandle(ref, function () {
|
|
56
|
+
return inputRef.current;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
var _useState = useState(''),
|
|
60
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
61
|
+
selfValue = _useState2[0],
|
|
62
|
+
setSelfValue = _useState2[1];
|
|
63
|
+
|
|
64
|
+
var _useState3 = useState(false),
|
|
65
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
66
|
+
hover = _useState4[0],
|
|
67
|
+
setHover = _useState4[1];
|
|
68
|
+
|
|
69
|
+
var isControlledComponent = useMemo(function () {
|
|
70
|
+
return value !== undefined;
|
|
71
|
+
}, [value]);
|
|
72
|
+
var labelClasses = useMemo(function () {
|
|
73
|
+
return labelRight ? 'right-label' : label ? 'left-label' : '';
|
|
74
|
+
}, [label, labelRight]);
|
|
75
|
+
var iconClasses = useMemo(function () {
|
|
76
|
+
return iconRight ? 'right-icon' : icon ? 'left-icon' : '';
|
|
77
|
+
}, [icon, iconRight]);
|
|
78
|
+
|
|
79
|
+
var _useMemo = useMemo(function () {
|
|
80
|
+
return getColors(theme.palette, type);
|
|
81
|
+
}, [theme.palette, type]),
|
|
82
|
+
color = _useMemo.color,
|
|
83
|
+
borderColor = _useMemo.borderColor,
|
|
84
|
+
hoverBorder = _useMemo.hoverBorder;
|
|
85
|
+
|
|
86
|
+
var changeHandler = function changeHandler(event) {
|
|
87
|
+
if (disabled || readOnly) return;
|
|
88
|
+
setSelfValue(event.target.value);
|
|
89
|
+
onChange && onChange(event);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var clearHandler = function clearHandler(event) {
|
|
93
|
+
setSelfValue('');
|
|
94
|
+
onClearClick && onClearClick(event);
|
|
95
|
+
/* istanbul ignore next */
|
|
96
|
+
|
|
97
|
+
if (!inputRef.current) return;
|
|
98
|
+
var changeEvent = simulateChangeEvent(inputRef.current, event);
|
|
99
|
+
changeEvent.target.value = '';
|
|
100
|
+
onChange && onChange(changeEvent);
|
|
101
|
+
inputRef.current.focus();
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
var focusHandler = function focusHandler(e) {
|
|
105
|
+
setHover(true);
|
|
106
|
+
onFocus && onFocus(e);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var blurHandler = function blurHandler(e) {
|
|
110
|
+
setHover(false);
|
|
111
|
+
onBlur && onBlur(e);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
var iconClickHandler = function iconClickHandler(e) {
|
|
115
|
+
if (disabled) return;
|
|
116
|
+
onIconClick && onIconClick(e);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
var iconProps = useMemo(function () {
|
|
120
|
+
return {
|
|
121
|
+
clickable: iconClickable,
|
|
122
|
+
onClick: iconClickHandler
|
|
123
|
+
};
|
|
124
|
+
}, [iconClickable, iconClickHandler]);
|
|
125
|
+
useEffect(function () {
|
|
126
|
+
if (isControlledComponent) {
|
|
127
|
+
setSelfValue(value);
|
|
128
|
+
}
|
|
129
|
+
}, [isControlledComponent, value]);
|
|
130
|
+
var controlledValue = isControlledComponent ? {
|
|
131
|
+
value: selfValue
|
|
132
|
+
} : {
|
|
133
|
+
defaultValue: initialValue
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
var inputProps = _extends({}, props, controlledValue);
|
|
137
|
+
|
|
138
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
139
|
+
className: _JSXStyle.dynamic([["341430505", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, backgroundColor ? backgroundColor : theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + "with-label"
|
|
140
|
+
}, children && /*#__PURE__*/React.createElement(InputBlockLabel, null, children), /*#__PURE__*/React.createElement("div", {
|
|
141
|
+
className: _JSXStyle.dynamic([["341430505", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, backgroundColor ? backgroundColor : theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-container', className) || "")
|
|
142
|
+
}, label && /*#__PURE__*/React.createElement(InputLabel, null, label), /*#__PURE__*/React.createElement("div", {
|
|
143
|
+
className: _JSXStyle.dynamic([["341430505", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, backgroundColor ? backgroundColor : theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-wrapper', {
|
|
144
|
+
hover: hover,
|
|
145
|
+
disabled: disabled
|
|
146
|
+
}, labelClasses) || "")
|
|
147
|
+
}, icon && /*#__PURE__*/React.createElement(InputIcon, _extends({
|
|
148
|
+
icon: icon
|
|
149
|
+
}, iconProps)), /*#__PURE__*/React.createElement("input", _extends({
|
|
150
|
+
type: htmlType,
|
|
151
|
+
ref: inputRef,
|
|
152
|
+
placeholder: placeholder,
|
|
153
|
+
disabled: disabled,
|
|
154
|
+
readOnly: readOnly,
|
|
155
|
+
onFocus: focusHandler,
|
|
156
|
+
onBlur: blurHandler,
|
|
157
|
+
onChange: changeHandler,
|
|
158
|
+
autoComplete: autoComplete
|
|
159
|
+
}, inputProps, {
|
|
160
|
+
className: _JSXStyle.dynamic([["341430505", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, backgroundColor ? backgroundColor : theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (inputProps && inputProps.className != null && inputProps.className || useClasses({
|
|
161
|
+
disabled: disabled
|
|
162
|
+
}, iconClasses) || "")
|
|
163
|
+
})), clearable && /*#__PURE__*/React.createElement(InputClearIcon, {
|
|
164
|
+
visible: Boolean(inputRef.current && inputRef.current.value !== ''),
|
|
165
|
+
disabled: disabled || readOnly,
|
|
166
|
+
onClick: clearHandler
|
|
167
|
+
}), iconRight && /*#__PURE__*/React.createElement(InputIcon, _extends({
|
|
168
|
+
icon: iconRight
|
|
169
|
+
}, iconProps))), labelRight && /*#__PURE__*/React.createElement(InputLabel, {
|
|
170
|
+
isRight: true
|
|
171
|
+
}, labelRight)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
172
|
+
id: "341430505",
|
|
173
|
+
dynamic: [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), theme.layout.radius, backgroundColor ? backgroundColor : theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]
|
|
174
|
+
}, ".with-label.__jsx-style-dynamic-selector{display:inline-block;box-sizing:border-box;-webkit-box-align:center;--input-height:".concat(SCALES.height(2.25), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'initial'), ";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), ";}.input-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:").concat(SCALES.width(1, 'initial'), ";height:var(--input-height);}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:").concat(theme.layout.radius, ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;background:").concat(backgroundColor ? backgroundColor : theme.palette.accents_1, ";}.input-wrapper.left-label.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;}.input-wrapper.right-label.__jsx-style-dynamic-selector{border-top-right-radius:0;border-bottom-right-radius:0;}.input-wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme.palette.accents_2, ";cursor:not-allowed;}input.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}.input-wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}input.__jsx-style-dynamic-selector{margin:0.25em 0.625em;padding:0;box-shadow:none;font-size:").concat(SCALES.font(0.875), ";background-color:transparent;border:none;color:").concat(color, ";outline:none;border-radius:0;width:100%;min-width:0;-webkit-appearance:none;}input.left-icon.__jsx-style-dynamic-selector{margin-left:0;}input.right-icon.__jsx-style-dynamic-selector{margin-right:0;}.__jsx-style-dynamic-selector::-webkit-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-ms-reveal{display:none !important;}input.__jsx-style-dynamic-selector:-webkit-autofill,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme.palette.background, " inset !important;-webkit-text-fill-color:").concat(color, " !important;}")));
|
|
175
|
+
});
|
|
176
|
+
InputComponent.defaultProps = defaultProps;
|
|
177
|
+
InputComponent.displayName = 'BolioUIInput';
|
|
178
|
+
var Input = withScale(InputComponent);
|
|
179
|
+
export default Input;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
function PasswordIcon(_ref) {
|
|
4
|
+
var visible = _ref.visible;
|
|
5
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
stroke: "currentColor",
|
|
8
|
+
strokeWidth: "1.5",
|
|
9
|
+
strokeLinecap: "round",
|
|
10
|
+
strokeLinejoin: "round",
|
|
11
|
+
fill: "none",
|
|
12
|
+
shapeRendering: "geometricPrecision",
|
|
13
|
+
style: {
|
|
14
|
+
color: 'currentColor'
|
|
15
|
+
}
|
|
16
|
+
}, !visible ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"
|
|
18
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
19
|
+
cx: "12",
|
|
20
|
+
cy: "12",
|
|
21
|
+
r: "3"
|
|
22
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
d: "M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"
|
|
24
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
25
|
+
d: "M1 1l22 22"
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var MemoPasswordIcon = /*#__PURE__*/React.memo(PasswordIcon);
|
|
30
|
+
export default MemoPasswordIcon;
|