@quen-ui/components 0.0.14
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/README.md +43 -0
- package/dist/Alert/Alert.cjs.js +54 -0
- package/dist/Alert/Alert.d.ts +4 -0
- package/dist/Alert/Alert.es.js +55 -0
- package/dist/Alert/index.d.ts +2 -0
- package/dist/Alert/styles.cjs.js +90 -0
- package/dist/Alert/styles.d.ts +10 -0
- package/dist/Alert/styles.es.js +90 -0
- package/dist/Alert/types.d.ts +25 -0
- package/dist/Avatar/Avatar.cjs.js +65 -0
- package/dist/Avatar/Avatar.d.ts +4 -0
- package/dist/Avatar/Avatar.es.js +66 -0
- package/dist/Avatar/AvatarIcon.svg.cjs.js +21 -0
- package/dist/Avatar/AvatarIcon.svg.es.js +5 -0
- package/dist/Avatar/helpers.cjs.js +18 -0
- package/dist/Avatar/helpers.d.ts +1 -0
- package/dist/Avatar/helpers.es.js +18 -0
- package/dist/Avatar/index.d.ts +2 -0
- package/dist/Avatar/styles.cjs.js +31 -0
- package/dist/Avatar/styles.d.ts +9 -0
- package/dist/Avatar/styles.es.js +31 -0
- package/dist/Avatar/types.d.ts +31 -0
- package/dist/Badge/Badge.cjs.js +53 -0
- package/dist/Badge/Badge.d.ts +4 -0
- package/dist/Badge/Badge.es.js +54 -0
- package/dist/Badge/index.d.ts +3 -0
- package/dist/Badge/styles.cjs.js +70 -0
- package/dist/Badge/styles.d.ts +7 -0
- package/dist/Badge/styles.es.js +70 -0
- package/dist/Badge/types.cjs.js +10 -0
- package/dist/Badge/types.d.ts +22 -0
- package/dist/Badge/types.es.js +10 -0
- package/dist/Breadcrumbs/BreadcrumbItem.cjs.js +42 -0
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts +4 -0
- package/dist/Breadcrumbs/BreadcrumbItem.es.js +43 -0
- package/dist/Breadcrumbs/Breadcrumbs.cjs.js +48 -0
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/dist/Breadcrumbs/Breadcrumbs.es.js +49 -0
- package/dist/Breadcrumbs/helpers.cjs.js +18 -0
- package/dist/Breadcrumbs/helpers.d.ts +16 -0
- package/dist/Breadcrumbs/helpers.es.js +18 -0
- package/dist/Breadcrumbs/index.d.ts +2 -0
- package/dist/Breadcrumbs/styles.cjs.js +50 -0
- package/dist/Breadcrumbs/styles.d.ts +4 -0
- package/dist/Breadcrumbs/styles.es.js +50 -0
- package/dist/Breadcrumbs/types.d.ts +56 -0
- package/dist/Button/Button.cjs.js +66 -0
- package/dist/Button/Button.d.ts +4 -0
- package/dist/Button/Button.es.js +67 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Button/styles.cjs.js +177 -0
- package/dist/Button/styles.d.ts +7 -0
- package/dist/Button/styles.es.js +177 -0
- package/dist/Button/types.d.ts +38 -0
- package/dist/Card/Card.cjs.js +38 -0
- package/dist/Card/Card.d.ts +3 -0
- package/dist/Card/Card.es.js +39 -0
- package/dist/Card/index.d.ts +2 -0
- package/dist/Card/styles.cjs.js +55 -0
- package/dist/Card/styles.d.ts +11 -0
- package/dist/Card/styles.es.js +55 -0
- package/dist/Card/types.d.ts +26 -0
- package/dist/Checkbox/Checkbox.cjs.js +39 -0
- package/dist/Checkbox/Checkbox.d.ts +4 -0
- package/dist/Checkbox/Checkbox.es.js +40 -0
- package/dist/Checkbox/CheckboxGroup.cjs.js +82 -0
- package/dist/Checkbox/CheckboxGroup.d.ts +4 -0
- package/dist/Checkbox/CheckboxGroup.es.js +83 -0
- package/dist/Checkbox/helpers.cjs.js +14 -0
- package/dist/Checkbox/helpers.d.ts +18 -0
- package/dist/Checkbox/helpers.es.js +14 -0
- package/dist/Checkbox/index.cjs.js +7 -0
- package/dist/Checkbox/index.d.ts +8 -0
- package/dist/Checkbox/index.es.js +7 -0
- package/dist/Checkbox/styles.cjs.js +147 -0
- package/dist/Checkbox/styles.d.ts +13 -0
- package/dist/Checkbox/styles.es.js +147 -0
- package/dist/Checkbox/types.d.ts +67 -0
- package/dist/Divider/Divider.cjs.js +27 -0
- package/dist/Divider/Divider.d.ts +4 -0
- package/dist/Divider/Divider.es.js +28 -0
- package/dist/Divider/index.d.ts +2 -0
- package/dist/Divider/styles.cjs.js +121 -0
- package/dist/Divider/styles.d.ts +3 -0
- package/dist/Divider/styles.es.js +121 -0
- package/dist/Divider/types.d.ts +17 -0
- package/dist/Drawer/Drawer.cjs.js +67 -0
- package/dist/Drawer/Drawer.d.ts +4 -0
- package/dist/Drawer/Drawer.es.js +68 -0
- package/dist/Drawer/index.d.ts +2 -0
- package/dist/Drawer/styles.cjs.js +85 -0
- package/dist/Drawer/styles.d.ts +18 -0
- package/dist/Drawer/styles.es.js +85 -0
- package/dist/Drawer/types.d.ts +24 -0
- package/dist/Dropdown/Dropdown.cjs.js +65 -0
- package/dist/Dropdown/Dropdown.d.ts +4 -0
- package/dist/Dropdown/Dropdown.es.js +66 -0
- package/dist/Dropdown/DropdownItem.cjs.js +32 -0
- package/dist/Dropdown/DropdownItem.d.ts +4 -0
- package/dist/Dropdown/DropdownItem.es.js +33 -0
- package/dist/Dropdown/DropdownList.cjs.js +85 -0
- package/dist/Dropdown/DropdownList.d.ts +6 -0
- package/dist/Dropdown/DropdownList.es.js +86 -0
- package/dist/Dropdown/DropdownPortal.cjs.js +41 -0
- package/dist/Dropdown/DropdownPortal.d.ts +4 -0
- package/dist/Dropdown/DropdownPortal.es.js +42 -0
- package/dist/Dropdown/helpers.cjs.js +112 -0
- package/dist/Dropdown/helpers.d.ts +35 -0
- package/dist/Dropdown/helpers.es.js +112 -0
- package/dist/Dropdown/index.d.ts +2 -0
- package/dist/Dropdown/styles.cjs.js +150 -0
- package/dist/Dropdown/styles.d.ts +33 -0
- package/dist/Dropdown/styles.es.js +150 -0
- package/dist/Dropdown/types.d.ts +81 -0
- package/dist/Flex/Flex.cjs.js +10 -0
- package/dist/Flex/Flex.d.ts +4 -0
- package/dist/Flex/Flex.es.js +11 -0
- package/dist/Flex/index.d.ts +2 -0
- package/dist/Flex/styles.cjs.js +32 -0
- package/dist/Flex/styles.d.ts +2 -0
- package/dist/Flex/styles.es.js +32 -0
- package/dist/Flex/types.d.ts +23 -0
- package/dist/Image/Image.cjs.js +79 -0
- package/dist/Image/Image.d.ts +4 -0
- package/dist/Image/Image.es.js +80 -0
- package/dist/Image/index.d.ts +2 -0
- package/dist/Image/styles.cjs.js +87 -0
- package/dist/Image/styles.d.ts +13 -0
- package/dist/Image/styles.es.js +87 -0
- package/dist/Image/types.d.ts +20 -0
- package/dist/InputNumber/InputNumber.cjs.js +145 -0
- package/dist/InputNumber/InputNumber.d.ts +4 -0
- package/dist/InputNumber/InputNumber.es.js +146 -0
- package/dist/InputNumber/index.d.ts +2 -0
- package/dist/InputNumber/styles.cjs.js +136 -0
- package/dist/InputNumber/styles.d.ts +21 -0
- package/dist/InputNumber/styles.es.js +136 -0
- package/dist/InputNumber/types.d.ts +61 -0
- package/dist/Layout/Content.cjs.js +7 -0
- package/dist/Layout/Content.d.ts +4 -0
- package/dist/Layout/Content.es.js +8 -0
- package/dist/Layout/Footer.cjs.js +7 -0
- package/dist/Layout/Footer.d.ts +4 -0
- package/dist/Layout/Footer.es.js +8 -0
- package/dist/Layout/Header.cjs.js +47 -0
- package/dist/Layout/Header.d.ts +4 -0
- package/dist/Layout/Header.es.js +48 -0
- package/dist/Layout/Layout.cjs.js +49 -0
- package/dist/Layout/Layout.d.ts +5 -0
- package/dist/Layout/Layout.es.js +49 -0
- package/dist/Layout/Sidebar.cjs.js +57 -0
- package/dist/Layout/Sidebar.d.ts +4 -0
- package/dist/Layout/Sidebar.es.js +58 -0
- package/dist/Layout/index.cjs.js +13 -0
- package/dist/Layout/index.d.ts +14 -0
- package/dist/Layout/index.es.js +13 -0
- package/dist/Layout/styles.cjs.js +150 -0
- package/dist/Layout/styles.d.ts +32 -0
- package/dist/Layout/styles.es.js +150 -0
- package/dist/Layout/types.d.ts +75 -0
- package/dist/Loader/Loader.cjs.js +34 -0
- package/dist/Loader/Loader.d.ts +4 -0
- package/dist/Loader/Loader.es.js +35 -0
- package/dist/Loader/index.d.ts +2 -0
- package/dist/Loader/loaders/Bars.cjs.js +12 -0
- package/dist/Loader/loaders/Bars.d.ts +6 -0
- package/dist/Loader/loaders/Bars.es.js +13 -0
- package/dist/Loader/loaders/Dots.cjs.js +12 -0
- package/dist/Loader/loaders/Dots.d.ts +6 -0
- package/dist/Loader/loaders/Dots.es.js +13 -0
- package/dist/Loader/loaders/Oval.cjs.js +8 -0
- package/dist/Loader/loaders/Oval.d.ts +6 -0
- package/dist/Loader/loaders/Oval.es.js +9 -0
- package/dist/Loader/styles.cjs.js +95 -0
- package/dist/Loader/styles.d.ts +9 -0
- package/dist/Loader/styles.es.js +95 -0
- package/dist/Loader/types.d.ts +11 -0
- package/dist/Modal/Modal.cjs.js +67 -0
- package/dist/Modal/Modal.d.ts +4 -0
- package/dist/Modal/Modal.es.js +68 -0
- package/dist/Modal/index.d.ts +2 -0
- package/dist/Modal/styles.cjs.js +52 -0
- package/dist/Modal/styles.d.ts +14 -0
- package/dist/Modal/styles.es.js +52 -0
- package/dist/Modal/types.d.ts +31 -0
- package/dist/Notification/Notification.cjs.js +73 -0
- package/dist/Notification/Notification.d.ts +4 -0
- package/dist/Notification/Notification.es.js +74 -0
- package/dist/Notification/NotificationInstance.cjs.js +244 -0
- package/dist/Notification/NotificationInstance.d.ts +8 -0
- package/dist/Notification/NotificationInstance.es.js +244 -0
- package/dist/Notification/NotificationsStore.cjs.js +30 -0
- package/dist/Notification/NotificationsStore.d.ts +13 -0
- package/dist/Notification/NotificationsStore.es.js +31 -0
- package/dist/Notification/index.d.ts +3 -0
- package/dist/Notification/styles.cjs.js +90 -0
- package/dist/Notification/styles.d.ts +8 -0
- package/dist/Notification/styles.es.js +90 -0
- package/dist/Notification/types.cjs.js +9 -0
- package/dist/Notification/types.d.ts +41 -0
- package/dist/Notification/types.es.js +9 -0
- package/dist/Progress/Progress.cjs.js +43 -0
- package/dist/Progress/Progress.d.ts +4 -0
- package/dist/Progress/Progress.es.js +44 -0
- package/dist/Progress/index.d.ts +2 -0
- package/dist/Progress/styles.cjs.js +82 -0
- package/dist/Progress/styles.d.ts +13 -0
- package/dist/Progress/styles.es.js +82 -0
- package/dist/Progress/types.d.ts +20 -0
- package/dist/RadioButton/RadioButton.cjs.js +45 -0
- package/dist/RadioButton/RadioButton.d.ts +4 -0
- package/dist/RadioButton/RadioButton.es.js +46 -0
- package/dist/RadioButton/RadioButtonGroup.cjs.js +68 -0
- package/dist/RadioButton/RadioButtonGroup.d.ts +4 -0
- package/dist/RadioButton/RadioButtonGroup.es.js +69 -0
- package/dist/RadioButton/helpers.cjs.js +14 -0
- package/dist/RadioButton/helpers.d.ts +18 -0
- package/dist/RadioButton/helpers.es.js +14 -0
- package/dist/RadioButton/index.cjs.js +7 -0
- package/dist/RadioButton/index.d.ts +8 -0
- package/dist/RadioButton/index.es.js +7 -0
- package/dist/RadioButton/styles.cjs.js +84 -0
- package/dist/RadioButton/styles.d.ts +12 -0
- package/dist/RadioButton/styles.es.js +84 -0
- package/dist/RadioButton/types.d.ts +65 -0
- package/dist/Select/Select.cjs.js +114 -0
- package/dist/Select/Select.d.ts +4 -0
- package/dist/Select/Select.es.js +115 -0
- package/dist/Select/helpers.cjs.js +16 -0
- package/dist/Select/helpers.d.ts +138 -0
- package/dist/Select/helpers.es.js +16 -0
- package/dist/Select/index.d.ts +2 -0
- package/dist/Select/styles.cjs.js +415 -0
- package/dist/Select/styles.d.ts +9 -0
- package/dist/Select/styles.es.js +415 -0
- package/dist/Select/types.d.ts +116 -0
- package/dist/Select/useSelect.cjs.js +72 -0
- package/dist/Select/useSelect.d.ts +150 -0
- package/dist/Select/useSelect.es.js +72 -0
- package/dist/Switch/Switch.cjs.js +53 -0
- package/dist/Switch/Switch.d.ts +4 -0
- package/dist/Switch/Switch.es.js +54 -0
- package/dist/Switch/index.d.ts +2 -0
- package/dist/Switch/styles.cjs.js +78 -0
- package/dist/Switch/styles.d.ts +7 -0
- package/dist/Switch/styles.es.js +78 -0
- package/dist/Switch/types.d.ts +25 -0
- package/dist/Tabs/Tab.cjs.js +42 -0
- package/dist/Tabs/Tab.d.ts +4 -0
- package/dist/Tabs/Tab.es.js +43 -0
- package/dist/Tabs/TabPanel.cjs.js +14 -0
- package/dist/Tabs/TabPanel.d.ts +4 -0
- package/dist/Tabs/TabPanel.es.js +15 -0
- package/dist/Tabs/Tabs.cjs.js +21 -0
- package/dist/Tabs/Tabs.d.ts +5 -0
- package/dist/Tabs/Tabs.es.js +21 -0
- package/dist/Tabs/TabsList.cjs.js +12 -0
- package/dist/Tabs/TabsList.d.ts +4 -0
- package/dist/Tabs/TabsList.es.js +13 -0
- package/dist/Tabs/index.cjs.js +10 -0
- package/dist/Tabs/index.d.ts +12 -0
- package/dist/Tabs/index.es.js +11 -0
- package/dist/Tabs/styles.cjs.js +74 -0
- package/dist/Tabs/styles.d.ts +9 -0
- package/dist/Tabs/styles.es.js +74 -0
- package/dist/Tabs/types.d.ts +51 -0
- package/dist/Tag/Tag.cjs.js +39 -0
- package/dist/Tag/Tag.d.ts +4 -0
- package/dist/Tag/Tag.es.js +40 -0
- package/dist/Tag/index.d.ts +2 -0
- package/dist/Tag/styles.cjs.js +51 -0
- package/dist/Tag/styles.d.ts +6 -0
- package/dist/Tag/styles.es.js +51 -0
- package/dist/Tag/types.d.ts +18 -0
- package/dist/TextField/TextField.cjs.js +100 -0
- package/dist/TextField/TextField.d.ts +4 -0
- package/dist/TextField/TextField.es.js +101 -0
- package/dist/TextField/index.d.ts +2 -0
- package/dist/TextField/styles.cjs.js +65 -0
- package/dist/TextField/styles.d.ts +9 -0
- package/dist/TextField/styles.es.js +65 -0
- package/dist/TextField/types.d.ts +41 -0
- package/dist/Textarea/Textarea.cjs.js +103 -0
- package/dist/Textarea/Textarea.d.ts +4 -0
- package/dist/Textarea/Textarea.es.js +104 -0
- package/dist/Textarea/index.d.ts +2 -0
- package/dist/Textarea/styles.cjs.js +80 -0
- package/dist/Textarea/styles.d.ts +9 -0
- package/dist/Textarea/styles.es.js +80 -0
- package/dist/Textarea/types.d.ts +47 -0
- package/dist/Tooltip/Tooltip.cjs.js +69 -0
- package/dist/Tooltip/Tooltip.d.ts +4 -0
- package/dist/Tooltip/Tooltip.es.js +70 -0
- package/dist/Tooltip/index.d.ts +2 -0
- package/dist/Tooltip/styles.cjs.js +232 -0
- package/dist/Tooltip/styles.d.ts +13 -0
- package/dist/Tooltip/styles.es.js +232 -0
- package/dist/Tooltip/types.d.ts +22 -0
- package/dist/assets/icon-arrow-bottom.svg.cjs.js +21 -0
- package/dist/assets/icon-arrow-bottom.svg.es.js +5 -0
- package/dist/assets/icon-close.svg.cjs.js +21 -0
- package/dist/assets/icon-close.svg.es.js +5 -0
- package/dist/assets/icon-error.svg.cjs.js +21 -0
- package/dist/assets/icon-error.svg.es.js +5 -0
- package/dist/assets/icon-info.svg.cjs.js +21 -0
- package/dist/assets/icon-info.svg.es.js +5 -0
- package/dist/assets/icon-lines.svg.cjs.js +21 -0
- package/dist/assets/icon-lines.svg.es.js +5 -0
- package/dist/assets/icon-success.svg.cjs.js +21 -0
- package/dist/assets/icon-success.svg.es.js +5 -0
- package/dist/assets/icon-warning.svg.cjs.js +21 -0
- package/dist/assets/icon-warning.svg.es.js +5 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/index.cjs.js +63 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.es.js +63 -0
- package/dist/types/propsWithAttributes.d.ts +2 -0
- package/dist/types/size.d.ts +2 -0
- package/dist/typography/Text/Text.cjs.js +31 -0
- package/dist/typography/Text/Text.d.ts +4 -0
- package/dist/typography/Text/Text.es.js +32 -0
- package/dist/typography/Text/__stories__/Text.stories.d.ts +9 -0
- package/dist/typography/Text/index.d.ts +2 -0
- package/dist/typography/Text/styles.cjs.js +69 -0
- package/dist/typography/Text/styles.d.ts +2 -0
- package/dist/typography/Text/styles.es.js +69 -0
- package/dist/typography/Text/types.d.ts +22 -0
- package/dist/typography/Title/Title.cjs.js +26 -0
- package/dist/typography/Title/Title.d.ts +4 -0
- package/dist/typography/Title/Title.es.js +27 -0
- package/dist/typography/Title/__stories__/Title.stories.d.ts +9 -0
- package/dist/typography/Title/index.d.ts +2 -0
- package/dist/typography/Title/styles.cjs.js +75 -0
- package/dist/typography/Title/styles.d.ts +2 -0
- package/dist/typography/Title/styles.es.js +75 -0
- package/dist/typography/Title/types.d.ts +22 -0
- package/package.json +71 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TQuenSize } from '../types/size';
|
|
3
|
+
export interface ITextareaProps {
|
|
4
|
+
/** Visual size */
|
|
5
|
+
size?: TQuenSize;
|
|
6
|
+
/** Field label */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Marks as required */
|
|
9
|
+
required?: boolean;
|
|
10
|
+
/** Error state/message */
|
|
11
|
+
error?: string | boolean;
|
|
12
|
+
/** Placeholder text */
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** Left adornment */
|
|
15
|
+
leftContent?: React.ReactNode;
|
|
16
|
+
/** Right adornment */
|
|
17
|
+
rightContent?: React.ReactNode;
|
|
18
|
+
/** Disables interaction */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** DOM ID for textarea */
|
|
21
|
+
id?: string;
|
|
22
|
+
/** Form textarea name */
|
|
23
|
+
name?: string;
|
|
24
|
+
/** Container class */
|
|
25
|
+
className?: string;
|
|
26
|
+
/** Blur event handler */
|
|
27
|
+
onBlur?: React.FocusEventHandler;
|
|
28
|
+
/** Focus event handler */
|
|
29
|
+
onFocus?: React.FocusEventHandler;
|
|
30
|
+
/** Value change handler */
|
|
31
|
+
onChange?: (value: string, event: React.ChangeEvent) => void;
|
|
32
|
+
/** Clear button handler */
|
|
33
|
+
onClear?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
34
|
+
/** Controlled value */
|
|
35
|
+
value?: string;
|
|
36
|
+
/** Shows clear button */
|
|
37
|
+
clearable?: boolean;
|
|
38
|
+
/** Textarea-specific class */
|
|
39
|
+
classNameTextarea?: string;
|
|
40
|
+
/** Auto-adjusts height */
|
|
41
|
+
autosize?: boolean;
|
|
42
|
+
/** Maximum visible rows */
|
|
43
|
+
maxRows?: number;
|
|
44
|
+
/** Minimum visible rows */
|
|
45
|
+
minRows?: number;
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const reactTransitionState = require("react-transition-state");
|
|
5
|
+
const styles = require("./styles.cjs.js");
|
|
6
|
+
const Tooltip = ({
|
|
7
|
+
children,
|
|
8
|
+
text,
|
|
9
|
+
position = "top",
|
|
10
|
+
open: controlledOpen,
|
|
11
|
+
show = true,
|
|
12
|
+
zIndex = 1e3,
|
|
13
|
+
color = "grayViolet",
|
|
14
|
+
width,
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const [hovered, setHovered] = React.useState(false);
|
|
19
|
+
const controlled = typeof controlledOpen !== "undefined";
|
|
20
|
+
const shouldShow = controlled ? controlledOpen : hovered;
|
|
21
|
+
const [{ status }, toggle] = reactTransitionState.useTransition({
|
|
22
|
+
enter: true,
|
|
23
|
+
exit: true,
|
|
24
|
+
preEnter: true,
|
|
25
|
+
preExit: true,
|
|
26
|
+
timeout: 200
|
|
27
|
+
});
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
toggle(shouldShow && show);
|
|
30
|
+
}, [show, toggle, shouldShow]);
|
|
31
|
+
const handleMouseEnter = () => {
|
|
32
|
+
if (!controlled) {
|
|
33
|
+
setHovered(true);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const handleMouseLeave = () => {
|
|
37
|
+
if (!controlled) {
|
|
38
|
+
setHovered(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
42
|
+
styles.TooltipContainer,
|
|
43
|
+
{
|
|
44
|
+
onMouseEnter: handleMouseEnter,
|
|
45
|
+
onMouseLeave: handleMouseLeave,
|
|
46
|
+
...props,
|
|
47
|
+
children: [
|
|
48
|
+
children,
|
|
49
|
+
show && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
50
|
+
styles.TooltipContent,
|
|
51
|
+
{
|
|
52
|
+
className,
|
|
53
|
+
width,
|
|
54
|
+
state: status,
|
|
55
|
+
zIndex,
|
|
56
|
+
color,
|
|
57
|
+
position,
|
|
58
|
+
role: "tooltip",
|
|
59
|
+
children: [
|
|
60
|
+
text,
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx(styles.TooltipArrowStyled, { color, position })
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
module.exports = Tooltip;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ITooltipProps } from './types';
|
|
3
|
+
declare const Tooltip: ({ children, text, position, open: controlledOpen, show, zIndex, color, width, className, ...props }: ITooltipProps) => React.ReactElement;
|
|
4
|
+
export default Tooltip;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { useTransition } from "react-transition-state";
|
|
4
|
+
import { TooltipContainer, TooltipContent, TooltipArrowStyled } from "./styles.es.js";
|
|
5
|
+
const Tooltip = ({
|
|
6
|
+
children,
|
|
7
|
+
text,
|
|
8
|
+
position = "top",
|
|
9
|
+
open: controlledOpen,
|
|
10
|
+
show = true,
|
|
11
|
+
zIndex = 1e3,
|
|
12
|
+
color = "grayViolet",
|
|
13
|
+
width,
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}) => {
|
|
17
|
+
const [hovered, setHovered] = useState(false);
|
|
18
|
+
const controlled = typeof controlledOpen !== "undefined";
|
|
19
|
+
const shouldShow = controlled ? controlledOpen : hovered;
|
|
20
|
+
const [{ status }, toggle] = useTransition({
|
|
21
|
+
enter: true,
|
|
22
|
+
exit: true,
|
|
23
|
+
preEnter: true,
|
|
24
|
+
preExit: true,
|
|
25
|
+
timeout: 200
|
|
26
|
+
});
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
toggle(shouldShow && show);
|
|
29
|
+
}, [show, toggle, shouldShow]);
|
|
30
|
+
const handleMouseEnter = () => {
|
|
31
|
+
if (!controlled) {
|
|
32
|
+
setHovered(true);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const handleMouseLeave = () => {
|
|
36
|
+
if (!controlled) {
|
|
37
|
+
setHovered(false);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ jsxs(
|
|
41
|
+
TooltipContainer,
|
|
42
|
+
{
|
|
43
|
+
onMouseEnter: handleMouseEnter,
|
|
44
|
+
onMouseLeave: handleMouseLeave,
|
|
45
|
+
...props,
|
|
46
|
+
children: [
|
|
47
|
+
children,
|
|
48
|
+
show && /* @__PURE__ */ jsxs(
|
|
49
|
+
TooltipContent,
|
|
50
|
+
{
|
|
51
|
+
className,
|
|
52
|
+
width,
|
|
53
|
+
state: status,
|
|
54
|
+
zIndex,
|
|
55
|
+
color,
|
|
56
|
+
position,
|
|
57
|
+
role: "tooltip",
|
|
58
|
+
children: [
|
|
59
|
+
text,
|
|
60
|
+
/* @__PURE__ */ jsx(TooltipArrowStyled, { color, position })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
Tooltip as default
|
|
70
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const styled = require("styled-components");
|
|
4
|
+
const getColor = (theme, color) => {
|
|
5
|
+
return color in theme.colors ? theme.colors[color]["5"] : color;
|
|
6
|
+
};
|
|
7
|
+
const getPosition = (position, state) => {
|
|
8
|
+
switch (position) {
|
|
9
|
+
case "top":
|
|
10
|
+
return styled.css`
|
|
11
|
+
bottom: 100%;
|
|
12
|
+
left: 50%;
|
|
13
|
+
transform-origin: bottom center;
|
|
14
|
+
margin-bottom: 8px;
|
|
15
|
+
transform: translateX(-50%) scale(${state === "entered" ? 1 : 0.9});
|
|
16
|
+
`;
|
|
17
|
+
case "bottom":
|
|
18
|
+
return styled.css`
|
|
19
|
+
top: 100%;
|
|
20
|
+
left: 50%;
|
|
21
|
+
transform-origin: top center;
|
|
22
|
+
margin-top: 8px;
|
|
23
|
+
transform: translateX(-50%) scale(${state === "entered" ? 1 : 0.9});
|
|
24
|
+
`;
|
|
25
|
+
case "left":
|
|
26
|
+
return styled.css`
|
|
27
|
+
top: 50%;
|
|
28
|
+
right: 100%;
|
|
29
|
+
transform-origin: center right;
|
|
30
|
+
margin-right: 8px;
|
|
31
|
+
transform: translateY(-50%) scale(${state === "entered" ? 1 : 0.9});
|
|
32
|
+
`;
|
|
33
|
+
case "right":
|
|
34
|
+
return styled.css`
|
|
35
|
+
top: 50%;
|
|
36
|
+
left: 100%;
|
|
37
|
+
transform-origin: center left;
|
|
38
|
+
margin-left: 8px;
|
|
39
|
+
transform: translateY(-50%) scale(${state === "entered" ? 1 : 0.9});
|
|
40
|
+
`;
|
|
41
|
+
case "topLeft":
|
|
42
|
+
return styled.css`
|
|
43
|
+
bottom: 100%;
|
|
44
|
+
left: 0;
|
|
45
|
+
transform-origin: bottom left;
|
|
46
|
+
margin-bottom: 8px;
|
|
47
|
+
`;
|
|
48
|
+
case "topRight":
|
|
49
|
+
return styled.css`
|
|
50
|
+
bottom: 100%;
|
|
51
|
+
right: 0;
|
|
52
|
+
transform-origin: bottom right;
|
|
53
|
+
margin-bottom: 8px;
|
|
54
|
+
`;
|
|
55
|
+
case "bottomLeft":
|
|
56
|
+
return styled.css`
|
|
57
|
+
top: 100%;
|
|
58
|
+
left: 0;
|
|
59
|
+
transform-origin: top left;
|
|
60
|
+
margin-top: 8px;
|
|
61
|
+
`;
|
|
62
|
+
case "bottomRight":
|
|
63
|
+
return styled.css`
|
|
64
|
+
top: 100%;
|
|
65
|
+
right: 0;
|
|
66
|
+
transform-origin: top right;
|
|
67
|
+
margin-top: 8px;
|
|
68
|
+
`;
|
|
69
|
+
case "leftTop":
|
|
70
|
+
return styled.css`
|
|
71
|
+
top: 0;
|
|
72
|
+
right: 100%;
|
|
73
|
+
transform-origin: top right;
|
|
74
|
+
margin-right: 8px;
|
|
75
|
+
`;
|
|
76
|
+
case "leftBottom":
|
|
77
|
+
return styled.css`
|
|
78
|
+
bottom: 0;
|
|
79
|
+
right: 100%;
|
|
80
|
+
transform-origin: bottom right;
|
|
81
|
+
margin-right: 8px;
|
|
82
|
+
`;
|
|
83
|
+
case "rightTop":
|
|
84
|
+
return styled.css`
|
|
85
|
+
top: 0;
|
|
86
|
+
left: 100%;
|
|
87
|
+
transform-origin: top left;
|
|
88
|
+
margin-left: 8px;
|
|
89
|
+
`;
|
|
90
|
+
case "rightBottom":
|
|
91
|
+
return styled.css`
|
|
92
|
+
bottom: 0;
|
|
93
|
+
left: 100%;
|
|
94
|
+
transform-origin: bottom left;
|
|
95
|
+
margin-left: 8px;
|
|
96
|
+
`;
|
|
97
|
+
default:
|
|
98
|
+
return styled.css``;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const TooltipContainer = styled.div`
|
|
102
|
+
position: relative;
|
|
103
|
+
display: inline-block;
|
|
104
|
+
`;
|
|
105
|
+
const TooltipContent = styled.div.withConfig({
|
|
106
|
+
shouldForwardProp: (props) => !["position", "color", "zIndex", "state", "width"].includes(props)
|
|
107
|
+
})`
|
|
108
|
+
position: absolute;
|
|
109
|
+
padding: ${({ theme }) => theme.space.xs};
|
|
110
|
+
border-radius: ${({ theme }) => theme.control.radius};
|
|
111
|
+
background-color: ${({ color, theme }) => getColor(theme, color)};
|
|
112
|
+
color: ${({ theme }) => theme.colors.gray["9"]};
|
|
113
|
+
z-index: ${({ zIndex }) => zIndex};
|
|
114
|
+
pointer-events: none;
|
|
115
|
+
white-space: nowrap;
|
|
116
|
+
opacity: ${({ state }) => state === "entered" ? 1 : 0};
|
|
117
|
+
transform: ${({ state }) => state === "entered" ? "scale(1)" : "scale(0.9)"};
|
|
118
|
+
transition:
|
|
119
|
+
opacity 0.2s ease,
|
|
120
|
+
transform 0.2s ease;
|
|
121
|
+
width: ${({ width }) => width ? `${width}px` : "max-content"};
|
|
122
|
+
text-wrap: wrap;
|
|
123
|
+
|
|
124
|
+
${({ state, position }) => getPosition(position, state)};
|
|
125
|
+
`;
|
|
126
|
+
const TooltipArrowStyled = styled.div.withConfig({
|
|
127
|
+
shouldForwardProp: (props) => !["position", "color"].includes(props)
|
|
128
|
+
})`
|
|
129
|
+
position: absolute;
|
|
130
|
+
width: 0;
|
|
131
|
+
height: 0;
|
|
132
|
+
border-style: solid;
|
|
133
|
+
|
|
134
|
+
${({ position, color, theme }) => {
|
|
135
|
+
const _color = getColor(theme, color);
|
|
136
|
+
switch (position) {
|
|
137
|
+
case "top":
|
|
138
|
+
return styled.css`
|
|
139
|
+
left: 50%;
|
|
140
|
+
top: 100%;
|
|
141
|
+
margin-left: -5px;
|
|
142
|
+
border-width: 5px 5px 0 5px;
|
|
143
|
+
border-color: ${_color} transparent transparent transparent;
|
|
144
|
+
`;
|
|
145
|
+
case "bottom":
|
|
146
|
+
return styled.css`
|
|
147
|
+
bottom: 100%;
|
|
148
|
+
left: 50%;
|
|
149
|
+
margin-left: -5px;
|
|
150
|
+
border-width: 0 5px 5px 5px;
|
|
151
|
+
border-color: transparent transparent ${_color} transparent;
|
|
152
|
+
`;
|
|
153
|
+
case "left":
|
|
154
|
+
return styled.css`
|
|
155
|
+
top: 50%;
|
|
156
|
+
left: 100%;
|
|
157
|
+
margin-top: -5px;
|
|
158
|
+
border-width: 5px 0 5px 5px;
|
|
159
|
+
border-color: transparent transparent transparent ${_color};
|
|
160
|
+
`;
|
|
161
|
+
case "right":
|
|
162
|
+
return styled.css`
|
|
163
|
+
top: 50%;
|
|
164
|
+
right: 100%;
|
|
165
|
+
margin-top: -5px;
|
|
166
|
+
border-width: 5px 5px 5px 0;
|
|
167
|
+
border-color: transparent ${_color} transparent transparent;
|
|
168
|
+
`;
|
|
169
|
+
case "topLeft":
|
|
170
|
+
return styled.css`
|
|
171
|
+
top: 100%;
|
|
172
|
+
left: 10px;
|
|
173
|
+
border-width: 5px 5px 0 5px;
|
|
174
|
+
border-color: ${_color} transparent transparent transparent;
|
|
175
|
+
`;
|
|
176
|
+
case "topRight":
|
|
177
|
+
return styled.css`
|
|
178
|
+
top: 100%;
|
|
179
|
+
right: 10px;
|
|
180
|
+
border-width: 5px 5px 0 5px;
|
|
181
|
+
border-color: ${_color} transparent transparent transparent;
|
|
182
|
+
`;
|
|
183
|
+
case "bottomLeft":
|
|
184
|
+
return styled.css`
|
|
185
|
+
bottom: 100%;
|
|
186
|
+
left: 10px;
|
|
187
|
+
border-width: 0 5px 5px 5px;
|
|
188
|
+
border-color: transparent transparent ${_color} transparent;
|
|
189
|
+
`;
|
|
190
|
+
case "bottomRight":
|
|
191
|
+
return styled.css`
|
|
192
|
+
bottom: 100%;
|
|
193
|
+
right: 10px;
|
|
194
|
+
border-width: 0 5px 5px 5px;
|
|
195
|
+
border-color: transparent transparent ${_color} transparent;
|
|
196
|
+
`;
|
|
197
|
+
case "leftTop":
|
|
198
|
+
return styled.css`
|
|
199
|
+
top: 10px;
|
|
200
|
+
left: 100%;
|
|
201
|
+
border-width: 5px 0 5px 5px;
|
|
202
|
+
border-color: transparent transparent transparent ${_color};
|
|
203
|
+
`;
|
|
204
|
+
case "leftBottom":
|
|
205
|
+
return styled.css`
|
|
206
|
+
bottom: 10px;
|
|
207
|
+
left: 100%;
|
|
208
|
+
border-width: 5px 0 5px 5px;
|
|
209
|
+
border-color: transparent transparent transparent ${_color};
|
|
210
|
+
`;
|
|
211
|
+
case "rightBottom":
|
|
212
|
+
return styled.css`
|
|
213
|
+
bottom: 10px;
|
|
214
|
+
right: 100%;
|
|
215
|
+
border-width: 5px 5px 5px 0;
|
|
216
|
+
border-color: transparent ${_color} transparent transparent;
|
|
217
|
+
`;
|
|
218
|
+
case "rightTop":
|
|
219
|
+
return styled.css`
|
|
220
|
+
top: 10px;
|
|
221
|
+
right: 100%;
|
|
222
|
+
border-width: 5px 5px 5px 0;
|
|
223
|
+
border-color: transparent ${_color} transparent transparent;
|
|
224
|
+
`;
|
|
225
|
+
default:
|
|
226
|
+
return "";
|
|
227
|
+
}
|
|
228
|
+
}}
|
|
229
|
+
`;
|
|
230
|
+
exports.TooltipArrowStyled = TooltipArrowStyled;
|
|
231
|
+
exports.TooltipContainer = TooltipContainer;
|
|
232
|
+
exports.TooltipContent = TooltipContent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ITooltipProps } from './types';
|
|
2
|
+
export declare const TooltipContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const TooltipContent: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
4
|
+
color: string;
|
|
5
|
+
position: ITooltipProps["position"];
|
|
6
|
+
zIndex: number;
|
|
7
|
+
state: string;
|
|
8
|
+
width?: number;
|
|
9
|
+
}>> & string;
|
|
10
|
+
export declare const TooltipArrowStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
11
|
+
color: string;
|
|
12
|
+
position: ITooltipProps["position"];
|
|
13
|
+
}>> & string;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
const getColor = (theme, color) => {
|
|
3
|
+
return color in theme.colors ? theme.colors[color]["5"] : color;
|
|
4
|
+
};
|
|
5
|
+
const getPosition = (position, state) => {
|
|
6
|
+
switch (position) {
|
|
7
|
+
case "top":
|
|
8
|
+
return css`
|
|
9
|
+
bottom: 100%;
|
|
10
|
+
left: 50%;
|
|
11
|
+
transform-origin: bottom center;
|
|
12
|
+
margin-bottom: 8px;
|
|
13
|
+
transform: translateX(-50%) scale(${state === "entered" ? 1 : 0.9});
|
|
14
|
+
`;
|
|
15
|
+
case "bottom":
|
|
16
|
+
return css`
|
|
17
|
+
top: 100%;
|
|
18
|
+
left: 50%;
|
|
19
|
+
transform-origin: top center;
|
|
20
|
+
margin-top: 8px;
|
|
21
|
+
transform: translateX(-50%) scale(${state === "entered" ? 1 : 0.9});
|
|
22
|
+
`;
|
|
23
|
+
case "left":
|
|
24
|
+
return css`
|
|
25
|
+
top: 50%;
|
|
26
|
+
right: 100%;
|
|
27
|
+
transform-origin: center right;
|
|
28
|
+
margin-right: 8px;
|
|
29
|
+
transform: translateY(-50%) scale(${state === "entered" ? 1 : 0.9});
|
|
30
|
+
`;
|
|
31
|
+
case "right":
|
|
32
|
+
return css`
|
|
33
|
+
top: 50%;
|
|
34
|
+
left: 100%;
|
|
35
|
+
transform-origin: center left;
|
|
36
|
+
margin-left: 8px;
|
|
37
|
+
transform: translateY(-50%) scale(${state === "entered" ? 1 : 0.9});
|
|
38
|
+
`;
|
|
39
|
+
case "topLeft":
|
|
40
|
+
return css`
|
|
41
|
+
bottom: 100%;
|
|
42
|
+
left: 0;
|
|
43
|
+
transform-origin: bottom left;
|
|
44
|
+
margin-bottom: 8px;
|
|
45
|
+
`;
|
|
46
|
+
case "topRight":
|
|
47
|
+
return css`
|
|
48
|
+
bottom: 100%;
|
|
49
|
+
right: 0;
|
|
50
|
+
transform-origin: bottom right;
|
|
51
|
+
margin-bottom: 8px;
|
|
52
|
+
`;
|
|
53
|
+
case "bottomLeft":
|
|
54
|
+
return css`
|
|
55
|
+
top: 100%;
|
|
56
|
+
left: 0;
|
|
57
|
+
transform-origin: top left;
|
|
58
|
+
margin-top: 8px;
|
|
59
|
+
`;
|
|
60
|
+
case "bottomRight":
|
|
61
|
+
return css`
|
|
62
|
+
top: 100%;
|
|
63
|
+
right: 0;
|
|
64
|
+
transform-origin: top right;
|
|
65
|
+
margin-top: 8px;
|
|
66
|
+
`;
|
|
67
|
+
case "leftTop":
|
|
68
|
+
return css`
|
|
69
|
+
top: 0;
|
|
70
|
+
right: 100%;
|
|
71
|
+
transform-origin: top right;
|
|
72
|
+
margin-right: 8px;
|
|
73
|
+
`;
|
|
74
|
+
case "leftBottom":
|
|
75
|
+
return css`
|
|
76
|
+
bottom: 0;
|
|
77
|
+
right: 100%;
|
|
78
|
+
transform-origin: bottom right;
|
|
79
|
+
margin-right: 8px;
|
|
80
|
+
`;
|
|
81
|
+
case "rightTop":
|
|
82
|
+
return css`
|
|
83
|
+
top: 0;
|
|
84
|
+
left: 100%;
|
|
85
|
+
transform-origin: top left;
|
|
86
|
+
margin-left: 8px;
|
|
87
|
+
`;
|
|
88
|
+
case "rightBottom":
|
|
89
|
+
return css`
|
|
90
|
+
bottom: 0;
|
|
91
|
+
left: 100%;
|
|
92
|
+
transform-origin: bottom left;
|
|
93
|
+
margin-left: 8px;
|
|
94
|
+
`;
|
|
95
|
+
default:
|
|
96
|
+
return css``;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const TooltipContainer = styled.div`
|
|
100
|
+
position: relative;
|
|
101
|
+
display: inline-block;
|
|
102
|
+
`;
|
|
103
|
+
const TooltipContent = styled.div.withConfig({
|
|
104
|
+
shouldForwardProp: (props) => !["position", "color", "zIndex", "state", "width"].includes(props)
|
|
105
|
+
})`
|
|
106
|
+
position: absolute;
|
|
107
|
+
padding: ${({ theme }) => theme.space.xs};
|
|
108
|
+
border-radius: ${({ theme }) => theme.control.radius};
|
|
109
|
+
background-color: ${({ color, theme }) => getColor(theme, color)};
|
|
110
|
+
color: ${({ theme }) => theme.colors.gray["9"]};
|
|
111
|
+
z-index: ${({ zIndex }) => zIndex};
|
|
112
|
+
pointer-events: none;
|
|
113
|
+
white-space: nowrap;
|
|
114
|
+
opacity: ${({ state }) => state === "entered" ? 1 : 0};
|
|
115
|
+
transform: ${({ state }) => state === "entered" ? "scale(1)" : "scale(0.9)"};
|
|
116
|
+
transition:
|
|
117
|
+
opacity 0.2s ease,
|
|
118
|
+
transform 0.2s ease;
|
|
119
|
+
width: ${({ width }) => width ? `${width}px` : "max-content"};
|
|
120
|
+
text-wrap: wrap;
|
|
121
|
+
|
|
122
|
+
${({ state, position }) => getPosition(position, state)};
|
|
123
|
+
`;
|
|
124
|
+
const TooltipArrowStyled = styled.div.withConfig({
|
|
125
|
+
shouldForwardProp: (props) => !["position", "color"].includes(props)
|
|
126
|
+
})`
|
|
127
|
+
position: absolute;
|
|
128
|
+
width: 0;
|
|
129
|
+
height: 0;
|
|
130
|
+
border-style: solid;
|
|
131
|
+
|
|
132
|
+
${({ position, color, theme }) => {
|
|
133
|
+
const _color = getColor(theme, color);
|
|
134
|
+
switch (position) {
|
|
135
|
+
case "top":
|
|
136
|
+
return css`
|
|
137
|
+
left: 50%;
|
|
138
|
+
top: 100%;
|
|
139
|
+
margin-left: -5px;
|
|
140
|
+
border-width: 5px 5px 0 5px;
|
|
141
|
+
border-color: ${_color} transparent transparent transparent;
|
|
142
|
+
`;
|
|
143
|
+
case "bottom":
|
|
144
|
+
return css`
|
|
145
|
+
bottom: 100%;
|
|
146
|
+
left: 50%;
|
|
147
|
+
margin-left: -5px;
|
|
148
|
+
border-width: 0 5px 5px 5px;
|
|
149
|
+
border-color: transparent transparent ${_color} transparent;
|
|
150
|
+
`;
|
|
151
|
+
case "left":
|
|
152
|
+
return css`
|
|
153
|
+
top: 50%;
|
|
154
|
+
left: 100%;
|
|
155
|
+
margin-top: -5px;
|
|
156
|
+
border-width: 5px 0 5px 5px;
|
|
157
|
+
border-color: transparent transparent transparent ${_color};
|
|
158
|
+
`;
|
|
159
|
+
case "right":
|
|
160
|
+
return css`
|
|
161
|
+
top: 50%;
|
|
162
|
+
right: 100%;
|
|
163
|
+
margin-top: -5px;
|
|
164
|
+
border-width: 5px 5px 5px 0;
|
|
165
|
+
border-color: transparent ${_color} transparent transparent;
|
|
166
|
+
`;
|
|
167
|
+
case "topLeft":
|
|
168
|
+
return css`
|
|
169
|
+
top: 100%;
|
|
170
|
+
left: 10px;
|
|
171
|
+
border-width: 5px 5px 0 5px;
|
|
172
|
+
border-color: ${_color} transparent transparent transparent;
|
|
173
|
+
`;
|
|
174
|
+
case "topRight":
|
|
175
|
+
return css`
|
|
176
|
+
top: 100%;
|
|
177
|
+
right: 10px;
|
|
178
|
+
border-width: 5px 5px 0 5px;
|
|
179
|
+
border-color: ${_color} transparent transparent transparent;
|
|
180
|
+
`;
|
|
181
|
+
case "bottomLeft":
|
|
182
|
+
return css`
|
|
183
|
+
bottom: 100%;
|
|
184
|
+
left: 10px;
|
|
185
|
+
border-width: 0 5px 5px 5px;
|
|
186
|
+
border-color: transparent transparent ${_color} transparent;
|
|
187
|
+
`;
|
|
188
|
+
case "bottomRight":
|
|
189
|
+
return css`
|
|
190
|
+
bottom: 100%;
|
|
191
|
+
right: 10px;
|
|
192
|
+
border-width: 0 5px 5px 5px;
|
|
193
|
+
border-color: transparent transparent ${_color} transparent;
|
|
194
|
+
`;
|
|
195
|
+
case "leftTop":
|
|
196
|
+
return css`
|
|
197
|
+
top: 10px;
|
|
198
|
+
left: 100%;
|
|
199
|
+
border-width: 5px 0 5px 5px;
|
|
200
|
+
border-color: transparent transparent transparent ${_color};
|
|
201
|
+
`;
|
|
202
|
+
case "leftBottom":
|
|
203
|
+
return css`
|
|
204
|
+
bottom: 10px;
|
|
205
|
+
left: 100%;
|
|
206
|
+
border-width: 5px 0 5px 5px;
|
|
207
|
+
border-color: transparent transparent transparent ${_color};
|
|
208
|
+
`;
|
|
209
|
+
case "rightBottom":
|
|
210
|
+
return css`
|
|
211
|
+
bottom: 10px;
|
|
212
|
+
right: 100%;
|
|
213
|
+
border-width: 5px 5px 5px 0;
|
|
214
|
+
border-color: transparent ${_color} transparent transparent;
|
|
215
|
+
`;
|
|
216
|
+
case "rightTop":
|
|
217
|
+
return css`
|
|
218
|
+
top: 10px;
|
|
219
|
+
right: 100%;
|
|
220
|
+
border-width: 5px 5px 5px 0;
|
|
221
|
+
border-color: transparent ${_color} transparent transparent;
|
|
222
|
+
`;
|
|
223
|
+
default:
|
|
224
|
+
return "";
|
|
225
|
+
}
|
|
226
|
+
}}
|
|
227
|
+
`;
|
|
228
|
+
export {
|
|
229
|
+
TooltipArrowStyled,
|
|
230
|
+
TooltipContainer,
|
|
231
|
+
TooltipContent
|
|
232
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ITooltipProps {
|
|
3
|
+
/** Tooltip content */
|
|
4
|
+
text: React.ReactNode;
|
|
5
|
+
/** Trigger element */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/** Background color */
|
|
8
|
+
color?: string;
|
|
9
|
+
/** Controlled visibility state */
|
|
10
|
+
open?: boolean;
|
|
11
|
+
/** Position relative to trigger */
|
|
12
|
+
position?: "top" | "bottom" | "left" | "right" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightBottom" | "rightTop";
|
|
13
|
+
/** Stacking context */
|
|
14
|
+
zIndex?: number;
|
|
15
|
+
/** Uncontrolled visibility (always show if true) */
|
|
16
|
+
show?: boolean;
|
|
17
|
+
/** Maximum width (px) */
|
|
18
|
+
width?: number;
|
|
19
|
+
/** Custom CSS class */
|
|
20
|
+
className?: string;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}
|