@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,232 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { addColorAlpha } from '../utils/color';
|
|
3
|
+
export var getButtonGhostColors = function getButtonGhostColors(palette, type) {
|
|
4
|
+
var colors = {
|
|
5
|
+
primary: {
|
|
6
|
+
bg: palette.background,
|
|
7
|
+
border: palette.primary,
|
|
8
|
+
color: palette.primary
|
|
9
|
+
},
|
|
10
|
+
secondary: {
|
|
11
|
+
bg: palette.background,
|
|
12
|
+
border: palette.secondary,
|
|
13
|
+
color: palette.secondary
|
|
14
|
+
},
|
|
15
|
+
success: {
|
|
16
|
+
bg: palette.background,
|
|
17
|
+
border: palette.success,
|
|
18
|
+
color: palette.success
|
|
19
|
+
},
|
|
20
|
+
warning: {
|
|
21
|
+
bg: palette.background,
|
|
22
|
+
border: palette.warning,
|
|
23
|
+
color: palette.warning
|
|
24
|
+
},
|
|
25
|
+
error: {
|
|
26
|
+
bg: palette.background,
|
|
27
|
+
border: palette.error,
|
|
28
|
+
color: palette.error
|
|
29
|
+
},
|
|
30
|
+
info: {
|
|
31
|
+
bg: palette.background,
|
|
32
|
+
border: palette.info,
|
|
33
|
+
color: palette.info
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return colors[type] || null;
|
|
37
|
+
};
|
|
38
|
+
export var getButtonColors = function getButtonColors(palette, props) {
|
|
39
|
+
var type = props.type,
|
|
40
|
+
disabled = props.disabled,
|
|
41
|
+
ghost = props.ghost;
|
|
42
|
+
var colors = {
|
|
43
|
+
"default": {
|
|
44
|
+
bg: palette.background,
|
|
45
|
+
border: palette.border,
|
|
46
|
+
color: palette.accents_5
|
|
47
|
+
},
|
|
48
|
+
primary: {
|
|
49
|
+
bg: palette.primary,
|
|
50
|
+
border: palette.primary,
|
|
51
|
+
color: '#fff'
|
|
52
|
+
},
|
|
53
|
+
secondary: {
|
|
54
|
+
bg: palette.secondary,
|
|
55
|
+
border: palette.secondary,
|
|
56
|
+
color: '#fff'
|
|
57
|
+
},
|
|
58
|
+
success: {
|
|
59
|
+
bg: palette.success,
|
|
60
|
+
border: palette.success,
|
|
61
|
+
color: '#fff'
|
|
62
|
+
},
|
|
63
|
+
warning: {
|
|
64
|
+
bg: palette.warning,
|
|
65
|
+
border: palette.warning,
|
|
66
|
+
color: '#fff'
|
|
67
|
+
},
|
|
68
|
+
error: {
|
|
69
|
+
bg: palette.error,
|
|
70
|
+
border: palette.error,
|
|
71
|
+
color: '#fff'
|
|
72
|
+
},
|
|
73
|
+
info: {
|
|
74
|
+
bg: palette.info,
|
|
75
|
+
border: palette.info,
|
|
76
|
+
color: '#fff'
|
|
77
|
+
},
|
|
78
|
+
abort: {
|
|
79
|
+
bg: 'transparent',
|
|
80
|
+
border: 'transparent',
|
|
81
|
+
color: palette.accents_5
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
if (disabled) return {
|
|
85
|
+
bg: palette.accents_1,
|
|
86
|
+
border: palette.accents_2,
|
|
87
|
+
color: '#ccc'
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* The '-light' type is the same color as the common type,
|
|
91
|
+
* only hover's color is different.
|
|
92
|
+
* e.g.
|
|
93
|
+
* Color['success'] === Color['success-light']
|
|
94
|
+
* Color['warning'] === Color['warning-light']
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
var withoutLightType = type === null || type === void 0 ? void 0 : type.replace('-light', '');
|
|
98
|
+
var defaultColor = colors["default"];
|
|
99
|
+
if (ghost) return getButtonGhostColors(palette, withoutLightType) || defaultColor;
|
|
100
|
+
return colors[withoutLightType] || defaultColor;
|
|
101
|
+
};
|
|
102
|
+
export var getButtonGhostHoverColors = function getButtonGhostHoverColors(palette, type) {
|
|
103
|
+
var colors = {
|
|
104
|
+
primary: {
|
|
105
|
+
bg: palette.primary,
|
|
106
|
+
border: palette.background,
|
|
107
|
+
color: 'white'
|
|
108
|
+
},
|
|
109
|
+
secondary: {
|
|
110
|
+
bg: palette.secondary,
|
|
111
|
+
border: palette.background,
|
|
112
|
+
color: 'white'
|
|
113
|
+
},
|
|
114
|
+
success: {
|
|
115
|
+
bg: palette.success,
|
|
116
|
+
border: palette.background,
|
|
117
|
+
color: 'white'
|
|
118
|
+
},
|
|
119
|
+
warning: {
|
|
120
|
+
bg: palette.warning,
|
|
121
|
+
border: palette.background,
|
|
122
|
+
color: 'white'
|
|
123
|
+
},
|
|
124
|
+
error: {
|
|
125
|
+
bg: palette.error,
|
|
126
|
+
border: palette.background,
|
|
127
|
+
color: 'white'
|
|
128
|
+
},
|
|
129
|
+
info: {
|
|
130
|
+
bg: palette.info,
|
|
131
|
+
border: palette.background,
|
|
132
|
+
color: 'white'
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
var withoutLightType = type.replace('-light', '');
|
|
136
|
+
return colors[withoutLightType] || null;
|
|
137
|
+
};
|
|
138
|
+
export var getButtonHoverColors = function getButtonHoverColors(palette, props) {
|
|
139
|
+
var type = props.type,
|
|
140
|
+
disabled = props.disabled,
|
|
141
|
+
loading = props.loading,
|
|
142
|
+
shadow = props.shadow,
|
|
143
|
+
ghost = props.ghost;
|
|
144
|
+
var defaultColor = getButtonColors(palette, props);
|
|
145
|
+
var alphaBackground = addColorAlpha(defaultColor.bg, 0.85);
|
|
146
|
+
var colors = {
|
|
147
|
+
"default": {
|
|
148
|
+
bg: palette.background,
|
|
149
|
+
border: palette.foreground
|
|
150
|
+
},
|
|
151
|
+
primary: {
|
|
152
|
+
bg: palette.background,
|
|
153
|
+
border: palette.primary
|
|
154
|
+
},
|
|
155
|
+
secondary: {
|
|
156
|
+
bg: palette.background,
|
|
157
|
+
border: palette.secondary
|
|
158
|
+
},
|
|
159
|
+
success: {
|
|
160
|
+
bg: palette.background,
|
|
161
|
+
border: palette.success
|
|
162
|
+
},
|
|
163
|
+
warning: {
|
|
164
|
+
bg: palette.background,
|
|
165
|
+
border: palette.warning
|
|
166
|
+
},
|
|
167
|
+
error: {
|
|
168
|
+
bg: palette.background,
|
|
169
|
+
border: palette.error
|
|
170
|
+
},
|
|
171
|
+
info: {
|
|
172
|
+
bg: palette.background,
|
|
173
|
+
border: palette.info
|
|
174
|
+
},
|
|
175
|
+
abort: {
|
|
176
|
+
bg: 'transparent',
|
|
177
|
+
border: 'transparent',
|
|
178
|
+
color: palette.accents_5
|
|
179
|
+
},
|
|
180
|
+
'primary-light': _extends({}, defaultColor, {
|
|
181
|
+
bg: alphaBackground
|
|
182
|
+
}),
|
|
183
|
+
'secondary-light': _extends({}, defaultColor, {
|
|
184
|
+
bg: alphaBackground
|
|
185
|
+
}),
|
|
186
|
+
'success-light': _extends({}, defaultColor, {
|
|
187
|
+
bg: alphaBackground
|
|
188
|
+
}),
|
|
189
|
+
'warning-light': _extends({}, defaultColor, {
|
|
190
|
+
bg: alphaBackground
|
|
191
|
+
}),
|
|
192
|
+
'error-light': _extends({}, defaultColor, {
|
|
193
|
+
bg: alphaBackground
|
|
194
|
+
}),
|
|
195
|
+
'info-light': _extends({}, defaultColor, {
|
|
196
|
+
bg: alphaBackground
|
|
197
|
+
})
|
|
198
|
+
};
|
|
199
|
+
if (disabled) return {
|
|
200
|
+
bg: palette.accents_1,
|
|
201
|
+
border: palette.accents_2,
|
|
202
|
+
color: '#ccc'
|
|
203
|
+
};
|
|
204
|
+
if (loading) return _extends({}, defaultColor, {
|
|
205
|
+
color: 'transparent'
|
|
206
|
+
});
|
|
207
|
+
if (shadow) return defaultColor;
|
|
208
|
+
var hoverColor = (ghost ? getButtonGhostHoverColors(palette, type) : colors[type]) || colors["default"];
|
|
209
|
+
return _extends({}, hoverColor, {
|
|
210
|
+
color: hoverColor.color || hoverColor.border
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
export var getButtonCursor = function getButtonCursor(disabled, loading) {
|
|
214
|
+
if (disabled) return {
|
|
215
|
+
cursor: 'not-allowed',
|
|
216
|
+
events: 'auto'
|
|
217
|
+
};
|
|
218
|
+
if (loading) return {
|
|
219
|
+
cursor: 'default',
|
|
220
|
+
events: 'none'
|
|
221
|
+
};
|
|
222
|
+
return {
|
|
223
|
+
cursor: 'pointer',
|
|
224
|
+
events: 'auto'
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
export var getButtonDripColor = function getButtonDripColor(palette, props) {
|
|
228
|
+
var type = props.type;
|
|
229
|
+
var isLightHover = type === null || type === void 0 ? void 0 : type.endsWith('light');
|
|
230
|
+
var hoverColors = getButtonHoverColors(palette, props);
|
|
231
|
+
return isLightHover ? addColorAlpha(hoverColors.bg, 0.65) : addColorAlpha(palette.accents_2, 0.65);
|
|
232
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import ButtonIcon from './button-icon';
|
|
5
|
+
import useClasses from '../use-classes';
|
|
6
|
+
export var getButtonChildrenWithIcon = function getButtonChildrenWithIcon() {
|
|
7
|
+
var auto = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
8
|
+
var children = arguments.length > 1 ? arguments[1] : undefined;
|
|
9
|
+
var icons = arguments.length > 2 ? arguments[2] : undefined;
|
|
10
|
+
var icon = icons.icon,
|
|
11
|
+
iconRight = icons.iconRight;
|
|
12
|
+
var hasIcon = icon || iconRight;
|
|
13
|
+
var isRight = Boolean(iconRight);
|
|
14
|
+
var paddingForAutoMode = auto ? "calc(var(--bolio-ui-button-height) / 2 + var(--bolio-ui-button-icon-padding) * .5)" : 0; // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
15
|
+
|
|
16
|
+
var classes = useClasses('text', isRight ? 'right' : 'left');
|
|
17
|
+
if (!hasIcon) return /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
className: "text"
|
|
19
|
+
}, children);
|
|
20
|
+
|
|
21
|
+
if (React.Children.count(children) === 0) {
|
|
22
|
+
return /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
23
|
+
isRight: isRight,
|
|
24
|
+
isSingle: true
|
|
25
|
+
}, hasIcon);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
29
|
+
isRight: isRight
|
|
30
|
+
}, hasIcon), /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: _JSXStyle.dynamic([["3568181479", [paddingForAutoMode, paddingForAutoMode]]]) + " " + (classes || "")
|
|
32
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
33
|
+
id: "3568181479",
|
|
34
|
+
dynamic: [paddingForAutoMode, paddingForAutoMode]
|
|
35
|
+
}, ".left.__jsx-style-dynamic-selector{padding-left:".concat(paddingForAutoMode, ";}.right.__jsx-style-dynamic-selector{padding-right:").concat(paddingForAutoMode, ";}"))));
|
|
36
|
+
};
|
|
37
|
+
export var filterPropsWithGroup = function filterPropsWithGroup(props, config) {
|
|
38
|
+
if (!config.isButtonGroup) return props;
|
|
39
|
+
return _extends({}, props, {
|
|
40
|
+
auto: true,
|
|
41
|
+
shadow: false,
|
|
42
|
+
ghost: config.ghost || props.ghost,
|
|
43
|
+
type: config.type || props.type,
|
|
44
|
+
disabled: config.disabled || props.disabled
|
|
45
|
+
});
|
|
46
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var defaultContext = {
|
|
3
|
+
type: 'default',
|
|
4
|
+
auto: false,
|
|
5
|
+
disabled: false,
|
|
6
|
+
loading: false
|
|
7
|
+
};
|
|
8
|
+
export var ButtonDropdownContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
9
|
+
export var useButtonDropdown = function useButtonDropdown() {
|
|
10
|
+
return React.useContext(ButtonDropdownContext);
|
|
11
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children", "onClick", "className", "main", "type"];
|
|
4
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
import useTheme from '../use-theme';
|
|
7
|
+
import { getColor } from './styles';
|
|
8
|
+
import { useButtonDropdown } from './button-dropdown-context';
|
|
9
|
+
import Loading from '../loading';
|
|
10
|
+
|
|
11
|
+
function ButtonDropdownItem(_ref) {
|
|
12
|
+
var children = _ref.children,
|
|
13
|
+
onClick = _ref.onClick,
|
|
14
|
+
_ref$className = _ref.className,
|
|
15
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
16
|
+
_ref$main = _ref.main,
|
|
17
|
+
main = _ref$main === void 0 ? false : _ref$main,
|
|
18
|
+
_ref$type = _ref.type,
|
|
19
|
+
selfType = _ref$type === void 0 ? 'default' : _ref$type,
|
|
20
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
|
|
22
|
+
var theme = useTheme();
|
|
23
|
+
|
|
24
|
+
var _useButtonDropdown = useButtonDropdown(),
|
|
25
|
+
parentType = _useButtonDropdown.type,
|
|
26
|
+
disabled = _useButtonDropdown.disabled,
|
|
27
|
+
loading = _useButtonDropdown.loading;
|
|
28
|
+
|
|
29
|
+
var type = main ? parentType : selfType;
|
|
30
|
+
var colors = getColor(theme.palette, type, disabled);
|
|
31
|
+
|
|
32
|
+
var clickHandler = function clickHandler(event) {
|
|
33
|
+
if (disabled || loading) return;
|
|
34
|
+
onClick && onClick(event);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var cursor = useMemo(function () {
|
|
38
|
+
if (loading) return 'default';
|
|
39
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
40
|
+
}, [loading, disabled]);
|
|
41
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
42
|
+
onClick: clickHandler
|
|
43
|
+
}, props, {
|
|
44
|
+
className: _JSXStyle.dynamic([["3452455908", [cursor, colors.bgColor, colors.color, colors.hoverBorder, colors.hoverBgColor]]]) + " " + (props && props.className != null && props.className || className || "")
|
|
45
|
+
}), loading ? /*#__PURE__*/React.createElement(Loading, null) : children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
46
|
+
id: "3452455908",
|
|
47
|
+
dynamic: [cursor, colors.bgColor, colors.color, colors.hoverBorder, colors.hoverBgColor]
|
|
48
|
+
}, "button.__jsx-style-dynamic-selector{position:relative;-webkit-appearance:button;text-rendering:auto;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;vertical-align:middle;text-align:center;cursor:".concat(cursor, ";box-sizing:border-box;margin:0;border:none;background-color:").concat(colors.bgColor, ";color:").concat(colors.color, ";width:100%;height:var(--bolio-ui-dropdown-height);min-width:var(--bolio-ui-dropdown-min-width);padding:var(--bolio-ui-dropdown-padding);font-size:var(--bolio-ui-dropdown-font-size);}button.__jsx-style-dynamic-selector:hover{border-color:").concat(colors.hoverBorder, ";background-color:").concat(colors.hoverBgColor, ";}")));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ButtonDropdownItem.displayName = 'BolioUIButtonDropdownItem';
|
|
52
|
+
export default ButtonDropdownItem;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["children", "type", "auto", "className", "disabled", "loading", "icon"];
|
|
5
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
6
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import useTheme from '../use-theme';
|
|
8
|
+
import useClickAway from '../utils/use-click-away';
|
|
9
|
+
import { getColor } from './styles';
|
|
10
|
+
import ButtonDropdownIcon from './icon';
|
|
11
|
+
import ButtonDropdownItem from './button-dropdown-item';
|
|
12
|
+
import { ButtonDropdownContext } from './button-dropdown-context';
|
|
13
|
+
import { pickChild, pickChildByProps } from '../utils/collections';
|
|
14
|
+
import useScale, { withScale } from '../use-scale';
|
|
15
|
+
import useClasses from '../use-classes';
|
|
16
|
+
|
|
17
|
+
var stopPropagation = function stopPropagation(event) {
|
|
18
|
+
event.stopPropagation();
|
|
19
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function ButtonDropdownComponent(_ref) {
|
|
23
|
+
var children = _ref.children,
|
|
24
|
+
_ref$type = _ref.type,
|
|
25
|
+
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
26
|
+
_ref$auto = _ref.auto,
|
|
27
|
+
auto = _ref$auto === void 0 ? false : _ref$auto,
|
|
28
|
+
_ref$className = _ref.className,
|
|
29
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
30
|
+
_ref$disabled = _ref.disabled,
|
|
31
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
32
|
+
_ref$loading = _ref.loading,
|
|
33
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
34
|
+
icon = _ref.icon,
|
|
35
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
+
|
|
37
|
+
var _useScale = useScale(),
|
|
38
|
+
SCALES = _useScale.SCALES;
|
|
39
|
+
|
|
40
|
+
var ref = useRef(null);
|
|
41
|
+
var theme = useTheme();
|
|
42
|
+
var colors = getColor(theme.palette, type);
|
|
43
|
+
var itemChildren = pickChild(children, ButtonDropdownItem)[1];
|
|
44
|
+
|
|
45
|
+
var _pickChildByProps = pickChildByProps(itemChildren, 'main', true),
|
|
46
|
+
_pickChildByProps2 = _slicedToArray(_pickChildByProps, 2),
|
|
47
|
+
itemChildrenWithoutMain = _pickChildByProps2[0],
|
|
48
|
+
mainItemChildren = _pickChildByProps2[1];
|
|
49
|
+
|
|
50
|
+
var _useState = useState(false),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
visible = _useState2[0],
|
|
53
|
+
setVisible = _useState2[1];
|
|
54
|
+
|
|
55
|
+
var clickHandler = useCallback(function (event) {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
stopPropagation(event);
|
|
58
|
+
if (disabled || loading) return;
|
|
59
|
+
setVisible(!visible);
|
|
60
|
+
}, [disabled, loading, visible]);
|
|
61
|
+
var initialValue = {
|
|
62
|
+
type: type,
|
|
63
|
+
auto: auto,
|
|
64
|
+
disabled: disabled,
|
|
65
|
+
loading: loading
|
|
66
|
+
};
|
|
67
|
+
var bgColor = useMemo(function () {
|
|
68
|
+
if (disabled || loading) return theme.palette.accents_1;
|
|
69
|
+
return visible ? colors.hoverBgColor : colors.bgColor;
|
|
70
|
+
}, [disabled, loading, theme.palette.accents_1, visible, colors.hoverBgColor, colors.bgColor]);
|
|
71
|
+
var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
|
|
72
|
+
paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
|
|
73
|
+
useClickAway(ref, function () {
|
|
74
|
+
return setVisible(false);
|
|
75
|
+
});
|
|
76
|
+
return /*#__PURE__*/React.createElement(ButtonDropdownContext.Provider, {
|
|
77
|
+
value: initialValue
|
|
78
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
79
|
+
ref: ref,
|
|
80
|
+
onClick: stopPropagation
|
|
81
|
+
}, props, {
|
|
82
|
+
className: _JSXStyle.dynamic([["2624345116", [theme.palette.border, theme.layout.radius, SCALES.height(2.5), auto ? 'min-content' : SCALES.width(10.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.font(0.875), theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius, SCALES.height(2.5), colors.color, bgColor, SCALES.height(2.5), colors.borderLeftColor, disabled || loading ? 'not-allowed' : 'pointer', colors.hoverBorder, colors.hoverBgColor, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gapHalf, theme.palette.background, theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius]]]) + " " + (props && props.className != null && props.className || useClasses('btn-dropdown', className) || "")
|
|
83
|
+
}), mainItemChildren, /*#__PURE__*/React.createElement("details", {
|
|
84
|
+
open: visible,
|
|
85
|
+
className: _JSXStyle.dynamic([["2624345116", [theme.palette.border, theme.layout.radius, SCALES.height(2.5), auto ? 'min-content' : SCALES.width(10.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.font(0.875), theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius, SCALES.height(2.5), colors.color, bgColor, SCALES.height(2.5), colors.borderLeftColor, disabled || loading ? 'not-allowed' : 'pointer', colors.hoverBorder, colors.hoverBgColor, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gapHalf, theme.palette.background, theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius]]])
|
|
86
|
+
}, /*#__PURE__*/React.createElement("summary", {
|
|
87
|
+
onClick: clickHandler,
|
|
88
|
+
className: _JSXStyle.dynamic([["2624345116", [theme.palette.border, theme.layout.radius, SCALES.height(2.5), auto ? 'min-content' : SCALES.width(10.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.font(0.875), theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius, SCALES.height(2.5), colors.color, bgColor, SCALES.height(2.5), colors.borderLeftColor, disabled || loading ? 'not-allowed' : 'pointer', colors.hoverBorder, colors.hoverBgColor, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gapHalf, theme.palette.background, theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius]]])
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: _JSXStyle.dynamic([["2624345116", [theme.palette.border, theme.layout.radius, SCALES.height(2.5), auto ? 'min-content' : SCALES.width(10.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.font(0.875), theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius, SCALES.height(2.5), colors.color, bgColor, SCALES.height(2.5), colors.borderLeftColor, disabled || loading ? 'not-allowed' : 'pointer', colors.hoverBorder, colors.hoverBgColor, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gapHalf, theme.palette.background, theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius]]]) + " " + "dropdown-box"
|
|
91
|
+
}, icon ? /*#__PURE__*/React.createElement("span", {
|
|
92
|
+
style: {
|
|
93
|
+
color: colors.color,
|
|
94
|
+
height: SCALES.height(2.5),
|
|
95
|
+
width: SCALES.height(2.5)
|
|
96
|
+
},
|
|
97
|
+
className: _JSXStyle.dynamic([["2624345116", [theme.palette.border, theme.layout.radius, SCALES.height(2.5), auto ? 'min-content' : SCALES.width(10.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.font(0.875), theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius, SCALES.height(2.5), colors.color, bgColor, SCALES.height(2.5), colors.borderLeftColor, disabled || loading ? 'not-allowed' : 'pointer', colors.hoverBorder, colors.hoverBgColor, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gapHalf, theme.palette.background, theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius]]]) + " " + "dropdown-icon"
|
|
98
|
+
}, icon) : /*#__PURE__*/React.createElement(ButtonDropdownIcon, {
|
|
99
|
+
color: colors.color,
|
|
100
|
+
height: SCALES.height(2.5)
|
|
101
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
className: _JSXStyle.dynamic([["2624345116", [theme.palette.border, theme.layout.radius, SCALES.height(2.5), auto ? 'min-content' : SCALES.width(10.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.font(0.875), theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius, SCALES.height(2.5), colors.color, bgColor, SCALES.height(2.5), colors.borderLeftColor, disabled || loading ? 'not-allowed' : 'pointer', colors.hoverBorder, colors.hoverBgColor, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gapHalf, theme.palette.background, theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius]]]) + " " + "content"
|
|
103
|
+
}, itemChildrenWithoutMain)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
104
|
+
id: "2624345116",
|
|
105
|
+
dynamic: [theme.palette.border, theme.layout.radius, SCALES.height(2.5), auto ? 'min-content' : SCALES.width(10.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.font(0.875), theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius, SCALES.height(2.5), colors.color, bgColor, SCALES.height(2.5), colors.borderLeftColor, disabled || loading ? 'not-allowed' : 'pointer', colors.hoverBorder, colors.hoverBgColor, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gapHalf, theme.palette.background, theme.layout.radius, theme.layout.radius, theme.layout.radius, theme.layout.radius]
|
|
106
|
+
}, ".btn-dropdown.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;box-sizing:border-box;border:1px solid ".concat(theme.palette.border, ";border-radius:").concat(theme.layout.radius, ";--bolio-ui-dropdown-height:").concat(SCALES.height(2.5), ";--bolio-ui-dropdown-min-width:").concat(auto ? 'min-content' : SCALES.width(10.5), ";--bolio-ui-dropdown-padding:").concat(SCALES.pt(0), " ").concat(paddingRight, " ").concat(SCALES.pb(0), " ").concat(paddingLeft, ";--bolio-ui-dropdown-font-size:").concat(SCALES.font(0.875), ";}.btn-dropdown.__jsx-style-dynamic-selector>button{border-top-left-radius:").concat(theme.layout.radius, ";border-bottom-left-radius:").concat(theme.layout.radius, ";}details.__jsx-style-dynamic-selector{border-top-right-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";overflow:hidden;}.dropdown-box.__jsx-style-dynamic-selector{height:").concat(SCALES.height(2.5), ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:auto;}summary.__jsx-style-dynamic-selector{box-sizing:border-box;-webkit-tap-highlight-color:transparent;list-style:none;outline:none;color:").concat(colors.color, ";background-color:").concat(bgColor, ";height:").concat(SCALES.height(2.5), ";border-left:1px solid ").concat(colors.borderLeftColor, ";cursor:").concat(disabled || loading ? 'not-allowed' : 'pointer', ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:auto;padding:0 1px;-webkit-transition:background 0.2s ease 0s,border-color 0.2s ease 0s;transition:background 0.2s ease 0s,border-color 0.2s ease 0s;}summary.__jsx-style-dynamic-selector:hover{border-color:").concat(colors.hoverBorder, ";background-color:").concat(colors.hoverBgColor, ";}.content.__jsx-style-dynamic-selector{position:absolute;right:0;left:0;z-index:90;width:100%;border-radius:").concat(theme.layout.radius, ";box-shadow:").concat(theme.expressiveness.shadowLarge, ";-webkit-transform:translateY(").concat(theme.layout.gapHalf, ");-ms-transform:translateY(").concat(theme.layout.gapHalf, ");transform:translateY(").concat(theme.layout.gapHalf, ");background-color:").concat(theme.palette.background, ";}.content.__jsx-style-dynamic-selector>button:first-of-type{border-top-left-radius:").concat(theme.layout.radius, ";border-top-right-radius:").concat(theme.layout.radius, ";}.content.__jsx-style-dynamic-selector>button:last-of-type{border-bottom-left-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";}.dropdown-icon.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transform:scale(0.6);-ms-transform:scale(0.6);transform:scale(0.6);}"))));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
ButtonDropdownComponent.displayName = 'BolioUIButtonDropdown';
|
|
110
|
+
var ButtonDropdown = withScale(ButtonDropdownComponent);
|
|
111
|
+
export default ButtonDropdown;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
function ButtonDropdownIcon(_ref) {
|
|
5
|
+
var color = _ref.color,
|
|
6
|
+
height = _ref.height;
|
|
7
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
8
|
+
stroke: color,
|
|
9
|
+
style: {
|
|
10
|
+
color: color
|
|
11
|
+
},
|
|
12
|
+
viewBox: "0 0 24 24",
|
|
13
|
+
width: height,
|
|
14
|
+
height: height,
|
|
15
|
+
strokeWidth: "1",
|
|
16
|
+
strokeLinecap: "round",
|
|
17
|
+
strokeLinejoin: "round",
|
|
18
|
+
fill: "none",
|
|
19
|
+
shapeRendering: "geometricPrecision",
|
|
20
|
+
className: "jsx-3359574434"
|
|
21
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
22
|
+
d: "M6 9l6 6 6-6",
|
|
23
|
+
className: "jsx-3359574434"
|
|
24
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
25
|
+
id: "3359574434"
|
|
26
|
+
}, "svg.jsx-3359574434{-webkit-transform:scale(0.6);-ms-transform:scale(0.6);transform:scale(0.6);}"));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
ButtonDropdownIcon.displayName = 'BolioUIButtonDropdownIcon';
|
|
30
|
+
export default ButtonDropdownIcon;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import ButtonDropdown from '.';
|
|
2
|
+
import Grid from '../grid';
|
|
3
|
+
import { Plus } from '@bolio-ui/icons';
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Navigation/ButtonDropdown',
|
|
6
|
+
component: ButtonDropdown
|
|
7
|
+
};
|
|
8
|
+
export var Default = function Default() {
|
|
9
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
10
|
+
gap: 2
|
|
11
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(ButtonDropdown, null, /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
12
|
+
main: true
|
|
13
|
+
}, "Default Button"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, null, "Secondary Button"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, null, "Tertiary Button"))));
|
|
14
|
+
};
|
|
15
|
+
export var Loading = function Loading() {
|
|
16
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
17
|
+
gap: 2
|
|
18
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(ButtonDropdown, {
|
|
19
|
+
loading: true
|
|
20
|
+
}, /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
21
|
+
main: true
|
|
22
|
+
}, "Default Button"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, null, "Secondary Button"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, null, "Tertiary Button"))));
|
|
23
|
+
};
|
|
24
|
+
export var Disabled = function Disabled() {
|
|
25
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
26
|
+
gap: 2
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(ButtonDropdown, {
|
|
28
|
+
disabled: true
|
|
29
|
+
}, /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
30
|
+
main: true
|
|
31
|
+
}, "Default Button"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, null, "Secondary Button"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, null, "Tertiary Button"))));
|
|
32
|
+
};
|
|
33
|
+
export var Types = function Types() {
|
|
34
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
35
|
+
gap: 2
|
|
36
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(ButtonDropdown, {
|
|
37
|
+
type: "primary",
|
|
38
|
+
scale: 0.5
|
|
39
|
+
}, /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
40
|
+
main: true
|
|
41
|
+
}, "Primary Button"))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(ButtonDropdown, {
|
|
42
|
+
type: "secondary",
|
|
43
|
+
scale: 0.5
|
|
44
|
+
}, /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
45
|
+
main: true
|
|
46
|
+
}, "Secondary Button"))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(ButtonDropdown, {
|
|
47
|
+
type: "success",
|
|
48
|
+
scale: 0.5
|
|
49
|
+
}, /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
50
|
+
main: true
|
|
51
|
+
}, "Success Button"))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(ButtonDropdown, {
|
|
52
|
+
type: "warning",
|
|
53
|
+
scale: 0.5
|
|
54
|
+
}, /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
55
|
+
main: true
|
|
56
|
+
}, "Warning Button"))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(ButtonDropdown, {
|
|
57
|
+
type: "error",
|
|
58
|
+
scale: 0.5
|
|
59
|
+
}, /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
60
|
+
main: true
|
|
61
|
+
}, "Error Button"))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(ButtonDropdown, {
|
|
62
|
+
type: "info",
|
|
63
|
+
scale: 0.5
|
|
64
|
+
}, /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
65
|
+
main: true
|
|
66
|
+
}, "Info Button"))));
|
|
67
|
+
};
|
|
68
|
+
export var MultipleType = function MultipleType() {
|
|
69
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
70
|
+
gap: 2
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(ButtonDropdown, {
|
|
72
|
+
scale: 2 / 3,
|
|
73
|
+
auto: true
|
|
74
|
+
}, /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
75
|
+
main: true
|
|
76
|
+
}, "Check"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, null, "Block"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, null, "Lock"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
77
|
+
type: "error"
|
|
78
|
+
}, "Destroy"))));
|
|
79
|
+
};
|
|
80
|
+
export var CustomIcon = function CustomIcon() {
|
|
81
|
+
return /*#__PURE__*/React.createElement(Grid.Container, {
|
|
82
|
+
gap: 2
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(ButtonDropdown, {
|
|
84
|
+
scale: 2 / 3,
|
|
85
|
+
auto: true,
|
|
86
|
+
icon: /*#__PURE__*/React.createElement(Plus, null)
|
|
87
|
+
}, /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
88
|
+
main: true
|
|
89
|
+
}, "Check User"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, null, "Block User"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, null, "Lock User"), /*#__PURE__*/React.createElement(ButtonDropdown.Item, {
|
|
90
|
+
type: "error"
|
|
91
|
+
}, "Destroy User"))));
|
|
92
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
export var getColor = function getColor(palette, type) {
|
|
3
|
+
var disabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4
|
+
var colors = {
|
|
5
|
+
"default": {
|
|
6
|
+
color: palette.accents_5,
|
|
7
|
+
bgColor: palette.background,
|
|
8
|
+
borderLeftColor: palette.accents_2,
|
|
9
|
+
hoverBgColor: palette.accents_1,
|
|
10
|
+
hoverBorder: palette.accents_2
|
|
11
|
+
},
|
|
12
|
+
primary: {
|
|
13
|
+
color: palette.background,
|
|
14
|
+
bgColor: palette.primary,
|
|
15
|
+
borderLeftColor: palette.primaryDark,
|
|
16
|
+
hoverBgColor: palette.primaryDark,
|
|
17
|
+
hoverBorder: palette.primaryDark
|
|
18
|
+
},
|
|
19
|
+
secondary: {
|
|
20
|
+
color: palette.background,
|
|
21
|
+
bgColor: palette.secondary,
|
|
22
|
+
borderLeftColor: palette.secondaryDark,
|
|
23
|
+
hoverBgColor: palette.secondaryDark,
|
|
24
|
+
hoverBorder: palette.secondaryDark
|
|
25
|
+
},
|
|
26
|
+
success: {
|
|
27
|
+
color: palette.background,
|
|
28
|
+
bgColor: palette.success,
|
|
29
|
+
borderLeftColor: palette.successDark,
|
|
30
|
+
hoverBgColor: palette.successDark,
|
|
31
|
+
hoverBorder: palette.successDark
|
|
32
|
+
},
|
|
33
|
+
warning: {
|
|
34
|
+
color: palette.background,
|
|
35
|
+
bgColor: palette.warning,
|
|
36
|
+
borderLeftColor: palette.warningDark,
|
|
37
|
+
hoverBgColor: palette.warningDark,
|
|
38
|
+
hoverBorder: palette.warningDark
|
|
39
|
+
},
|
|
40
|
+
error: {
|
|
41
|
+
color: palette.background,
|
|
42
|
+
bgColor: palette.error,
|
|
43
|
+
borderLeftColor: palette.errorDark,
|
|
44
|
+
hoverBgColor: palette.errorDark,
|
|
45
|
+
hoverBorder: palette.errorDark
|
|
46
|
+
},
|
|
47
|
+
info: {
|
|
48
|
+
color: palette.background,
|
|
49
|
+
bgColor: palette.info,
|
|
50
|
+
borderLeftColor: palette.infoDark,
|
|
51
|
+
hoverBgColor: palette.infoDark,
|
|
52
|
+
hoverBorder: palette.infoDark
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
if (disabled) return _extends({}, colors["default"], {
|
|
56
|
+
bgColor: palette.accents_1,
|
|
57
|
+
color: palette.accents_4
|
|
58
|
+
});
|
|
59
|
+
return type ? colors[type] : colors["default"];
|
|
60
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var defaultContext = {
|
|
3
|
+
isButtonGroup: false,
|
|
4
|
+
disabled: false
|
|
5
|
+
};
|
|
6
|
+
export var ButtonGroupContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
7
|
+
export var useButtonGroupContext = function useButtonGroupContext() {
|
|
8
|
+
return React.useContext(ButtonGroupContext);
|
|
9
|
+
};
|