@autoguru/overdrive 4.1.13 → 4.1.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/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { FunctionComponent, ReactElement } from 'react';
|
|
2
2
|
import { EAlignment } from '../Positioner/alignment';
|
|
3
|
+
declare type ToolTipSize = 'medium' | 'large';
|
|
3
4
|
export interface Props {
|
|
5
|
+
size?: ToolTipSize;
|
|
4
6
|
label: string;
|
|
5
7
|
alignment?: EAlignment;
|
|
6
8
|
children: ReactElement;
|
|
7
9
|
closeAfter?: number;
|
|
8
10
|
}
|
|
9
11
|
export declare const Tooltip: FunctionComponent<Props>;
|
|
12
|
+
export {};
|
|
10
13
|
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../lib/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../lib/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAIN,iBAAiB,EACjB,YAAY,EAKZ,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD,aAAK,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AACtC,MAAM,WAAW,KAAK;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAiE5C,CAAC"}
|
|
@@ -5,7 +5,11 @@ import { Positioner } from '../Positioner';
|
|
|
5
5
|
import { EAlignment } from '../Positioner/alignment';
|
|
6
6
|
import { Text } from '../Text';
|
|
7
7
|
import * as styles from './Tooltip.css';
|
|
8
|
-
|
|
8
|
+
const sizeMap = {
|
|
9
|
+
medium: '2',
|
|
10
|
+
large: '3',
|
|
11
|
+
};
|
|
12
|
+
export const Tooltip = ({ alignment = EAlignment.RIGHT, label, children, size = 'medium', closeAfter = null, }) => {
|
|
9
13
|
const [isOpen, setIsOpen] = useState(false);
|
|
10
14
|
const childRef = useRef(null);
|
|
11
15
|
const triggerRef = useRef(null);
|
|
@@ -34,6 +38,6 @@ export const Tooltip = ({ alignment = EAlignment.RIGHT, label, children, closeAf
|
|
|
34
38
|
onMouseLeave: leaveHandler,
|
|
35
39
|
}),
|
|
36
40
|
React.createElement(Positioner, { triggerRef: triggerRef, alignment: alignment, isOpen: isOpen },
|
|
37
|
-
React.createElement(Box, { ref: childRef, className: styles.root, width: "full", pointerEvents: "none", userSelect: "none", overflow: "hidden", borderRadius: "1", boxShadow: "4", backgroundColour: "gray900",
|
|
38
|
-
React.createElement(Text, { colour: "white" }, label)))));
|
|
41
|
+
React.createElement(Box, { ref: childRef, className: styles.root, width: "full", pointerEvents: "none", userSelect: "none", overflow: "hidden", borderRadius: "1", boxShadow: "4", backgroundColour: "gray900", paddingY: "2", paddingX: "3" },
|
|
42
|
+
React.createElement(Text, { size: sizeMap[size], colour: "white" }, label)))));
|
|
39
43
|
};
|
|
@@ -10,6 +10,7 @@ import * as React from 'react';
|
|
|
10
10
|
import { EAlignment } from "../Positioner/alignment.js";
|
|
11
11
|
import { Tooltip } from "./index.js";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const sizeScale = ['medium', 'large'];
|
|
13
14
|
export default {
|
|
14
15
|
title: 'Components/Tooltip',
|
|
15
16
|
decorators: [Story => _jsx("div", {
|
|
@@ -32,6 +33,13 @@ export default {
|
|
|
32
33
|
type: 'select'
|
|
33
34
|
}
|
|
34
35
|
},
|
|
36
|
+
size: {
|
|
37
|
+
options: sizeScale,
|
|
38
|
+
defaultValue: void 0,
|
|
39
|
+
control: {
|
|
40
|
+
type: 'select'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
35
43
|
label: {
|
|
36
44
|
defaultValue: ''
|
|
37
45
|
},
|
|
@@ -70,4 +78,11 @@ const withLongTextProps = {
|
|
|
70
78
|
alignment: EAlignment.BOTTOM
|
|
71
79
|
};
|
|
72
80
|
export const withLongText = Template.bind(withLongTextProps);
|
|
73
|
-
withLongText.args = withLongTextProps;
|
|
81
|
+
withLongText.args = withLongTextProps;
|
|
82
|
+
const withSmallTextSizePropsProps = {
|
|
83
|
+
label: 'Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.',
|
|
84
|
+
alignment: EAlignment.BOTTOM,
|
|
85
|
+
size: 'large'
|
|
86
|
+
};
|
|
87
|
+
export const withLargeTextSize = Template.bind(withSmallTextSizePropsProps);
|
|
88
|
+
withLargeTextSize.args = withSmallTextSizePropsProps;
|