@seeqdev/qomponents 0.0.24 → 0.0.26
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/dist/Button/Button.js +86 -0
- package/dist/Button/Button.js.map +1 -0
- package/dist/Button/Button.stories.js +77 -0
- package/dist/Button/Button.stories.js.map +1 -0
- package/dist/Button/Button.test.js +49 -0
- package/dist/Button/Button.test.js.map +1 -0
- package/dist/Button/Button.types.js +4 -0
- package/dist/Button/Button.types.js.map +1 -0
- package/dist/Button/index.js +2 -0
- package/dist/Button/index.js.map +1 -0
- package/dist/Checkbox/Checkbox.js +23 -0
- package/dist/Checkbox/Checkbox.js.map +1 -0
- package/dist/Checkbox/Checkbox.stories.js +29 -0
- package/dist/Checkbox/Checkbox.stories.js.map +1 -0
- package/dist/Checkbox/Checkbox.test.js +94 -0
- package/dist/Checkbox/Checkbox.test.js.map +1 -0
- package/dist/Checkbox/Checkbox.types.js +2 -0
- package/dist/Checkbox/Checkbox.types.js.map +1 -0
- package/dist/Checkbox/index.js +2 -0
- package/dist/Checkbox/index.js.map +1 -0
- package/dist/FontCustom.woff +0 -0
- package/dist/Icon/Icon.js +61 -0
- package/dist/Icon/Icon.js.map +1 -0
- package/dist/Icon/Icon.stories.js +40 -0
- package/dist/Icon/Icon.stories.js.map +1 -0
- package/dist/Icon/Icon.test.js +55 -0
- package/dist/Icon/Icon.test.js.map +1 -0
- package/dist/Icon/Icon.types.js +16 -0
- package/dist/Icon/Icon.types.js.map +1 -0
- package/dist/Icon/index.js +2 -0
- package/dist/Icon/index.js.map +1 -0
- package/dist/Select/Select.js +168 -0
- package/dist/Select/Select.js.map +1 -0
- package/dist/Select/Select.stories.js +72 -0
- package/dist/Select/Select.stories.js.map +1 -0
- package/dist/Select/Select.test.js +161 -0
- package/dist/Select/Select.test.js.map +1 -0
- package/dist/Select/Select.types.js +2 -0
- package/dist/Select/Select.types.js.map +1 -0
- package/dist/Select/index.js +2 -0
- package/dist/Select/index.js.map +1 -0
- package/dist/TextArea/TextArea.js +23 -0
- package/dist/TextArea/TextArea.js.map +1 -0
- package/dist/TextArea/TextArea.stories.js +39 -0
- package/dist/TextArea/TextArea.stories.js.map +1 -0
- package/dist/TextArea/TextArea.test.js +68 -0
- package/dist/TextArea/TextArea.test.js.map +1 -0
- package/dist/TextArea/TextArea.types.js +2 -0
- package/dist/TextArea/TextArea.types.js.map +1 -0
- package/dist/TextArea/index.js +2 -0
- package/dist/TextArea/index.js.map +1 -0
- package/dist/TextField/TextField.js +64 -0
- package/dist/TextField/TextField.js.map +1 -0
- package/dist/TextField/TextField.stories.js +41 -0
- package/dist/TextField/TextField.stories.js.map +1 -0
- package/dist/TextField/TextField.test.js +35 -0
- package/dist/TextField/TextField.test.js.map +1 -0
- package/dist/TextField/TextField.types.js +2 -0
- package/dist/TextField/TextField.types.js.map +1 -0
- package/dist/TextField/index.js +2 -0
- package/dist/TextField/index.js.map +1 -0
- package/dist/Tooltip/QTip.stories.js +40 -0
- package/dist/Tooltip/QTip.stories.js.map +1 -0
- package/dist/Tooltip/QTip.types.js +2 -0
- package/dist/Tooltip/QTip.types.js.map +1 -0
- package/dist/Tooltip/QTipPerformance.stories.js +30 -0
- package/dist/Tooltip/QTipPerformance.stories.js.map +1 -0
- package/dist/Tooltip/Qtip.js +146 -0
- package/dist/Tooltip/Qtip.js.map +1 -0
- package/dist/Tooltip/Tooltip.js +36 -0
- package/dist/Tooltip/Tooltip.js.map +1 -0
- package/dist/Tooltip/Tooltip.stories.js +32 -0
- package/dist/Tooltip/Tooltip.stories.js.map +1 -0
- package/dist/Tooltip/Tooltip.types.js +3 -0
- package/dist/Tooltip/Tooltip.types.js.map +1 -0
- package/dist/Tooltip/TooltipPerformance.stories.js +30 -0
- package/dist/Tooltip/TooltipPerformance.stories.js.map +1 -0
- package/dist/Tooltip/index.js +3 -0
- package/dist/Tooltip/index.js.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/browserId.js +29 -0
- package/dist/utils/browserId.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.types.js","sourceRoot":"","sources":["../../src/TextArea/TextArea.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/TextArea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import '../styles.css';
|
|
3
|
+
const errorClasses = 'tw-border-sq-danger-color';
|
|
4
|
+
const borderColorClasses = [
|
|
5
|
+
'tw-border-sq-disabled-gray',
|
|
6
|
+
'dark:tw-border-sq-dark-disabled-gray',
|
|
7
|
+
'dark:focus:tw-border-sq-color-dark-dark',
|
|
8
|
+
'dark:active:tw-border-sq-color-dark-dark',
|
|
9
|
+
'focus:tw-border-sq-color-dark',
|
|
10
|
+
'active:tw-border-sq-color-dark',
|
|
11
|
+
].join(' ');
|
|
12
|
+
const baseClasses = 'tw-h-inputs tw-leading-normal tw-outline-none tw-py-1 tw-px-3' +
|
|
13
|
+
' disabled:tw-pointer-events-none' +
|
|
14
|
+
' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border tw-placeholder-gray-400' +
|
|
15
|
+
' dark:tw-placeholder-sq-dark-text-lighter specTextField';
|
|
16
|
+
const darkTheme = 'dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text';
|
|
17
|
+
const lightTheme = 'tw-text-sq-text-color';
|
|
18
|
+
const sizeClasses = {
|
|
19
|
+
sm: 'tw-text-sm',
|
|
20
|
+
lg: 'tw-text-xl',
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Textfield.
|
|
24
|
+
*/
|
|
25
|
+
export const TextField = React.forwardRef((props, ref) => {
|
|
26
|
+
const { readonly = false, onChange, onKeyUp, id, name, size = 'sm', value, placeholder, extraClassNames, testId, type = 'text', inputGroup, step, showError, } = props;
|
|
27
|
+
const internalRef = useRef(null);
|
|
28
|
+
const [cursor, setCursor] = useState(null);
|
|
29
|
+
const setAllRefs = (receivedRef) => {
|
|
30
|
+
if (ref)
|
|
31
|
+
ref.current = receivedRef;
|
|
32
|
+
internalRef.current = receivedRef;
|
|
33
|
+
};
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const input = internalRef.current;
|
|
36
|
+
if (input && type !== 'number')
|
|
37
|
+
input.setSelectionRange(cursor, cursor);
|
|
38
|
+
}, [ref, cursor, value]);
|
|
39
|
+
const handleChange = (e) => {
|
|
40
|
+
setCursor(e.target.selectionStart);
|
|
41
|
+
onChange && onChange(e);
|
|
42
|
+
};
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
/**
|
|
45
|
+
* we need to change the value only if it's different since the internal state of "input" will change it anyway
|
|
46
|
+
* this will only be the case when the value has been changed externally via store (undo / redo)
|
|
47
|
+
*/
|
|
48
|
+
if (value !== null && value !== undefined && value !== internalRef.current?.value && internalRef.current) {
|
|
49
|
+
// we need to use this method because using the value props directly will switch the input to a "controlled"
|
|
50
|
+
// component
|
|
51
|
+
internalRef.current.value = `${value}`;
|
|
52
|
+
}
|
|
53
|
+
}, [value]);
|
|
54
|
+
let borderRadius = 'tw-rounded-sm';
|
|
55
|
+
if (inputGroup === 'left') {
|
|
56
|
+
borderRadius = 'tw-rounded-l-sm tw-border-r-0 focus:tw-border-r' + ' active:tw-border-r';
|
|
57
|
+
}
|
|
58
|
+
else if (inputGroup === 'right') {
|
|
59
|
+
borderRadius = 'tw-rounded-r-sm tw-border-l-0 focus:tw-border-l active:tw-border-l';
|
|
60
|
+
}
|
|
61
|
+
const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames} ${lightTheme} ${darkTheme} ${borderRadius} ${showError ? errorClasses : borderColorClasses} `;
|
|
62
|
+
return (React.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: readonly, autoComplete: "none", onChange: handleChange, onKeyUp: onKeyUp, step: step }));
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=TextField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../src/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,eAAe,CAAC;AAEvB,MAAM,YAAY,GAAG,2BAA2B,CAAC;AAEjD,MAAM,kBAAkB,GAAG;IACzB,4BAA4B;IAC5B,sCAAsC;IACtC,yCAAyC;IACzC,0CAA0C;IAC1C,+BAA+B;IAC/B,gCAAgC;CACjC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,WAAW,GACf,+DAA+D;IAC/D,kCAAkC;IAClC,0FAA0F;IAC1F,0DAA0D,CAAC;AAE7D,MAAM,SAAS,GAAG,yDAAyD,CAAC;AAC5E,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAE3C,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;CACjB,CAAC;AACF;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAA4C,KAAK,CAAC,UAAU,CAChF,CAAC,KAAK,EAAE,GAAQ,EAAE,EAAE;IAClB,MAAM,EACJ,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,EAAE,EACF,IAAI,EACJ,IAAI,GAAG,IAAI,EACX,KAAK,EACL,WAAW,EACX,eAAe,EACf,MAAM,EACN,IAAI,GAAG,MAAM,EACb,UAAU,EACV,IAAI,EACJ,SAAS,GACV,GAAG,KAAK,CAAC;IAEV,MAAM,WAAW,GAAG,MAAM,CAA0B,IAAI,CAAC,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Ac,GAAG,GAAG,WAAW,IACnC,WAAW,CAAC,IAAI,CAClB,IAAI,eAAe,IAAI,UAAU,IAAI,SAAS,IAAI,YAAY,IAAI,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,kBAAkB,GAAG,CAAC;IAEnH,OAAO,CACL,+BACE,GAAG,EAAE,UAAU,iBACF,MAAM,EACnB,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAC,MAAM,EACnB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,GACV,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextField } from './TextField';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'TextField',
|
|
5
|
+
};
|
|
6
|
+
export const AllTextFields = () => {
|
|
7
|
+
const renderAllVariations = () => (React.createElement(React.Fragment, null,
|
|
8
|
+
React.createElement("div", { className: "tw-p-4 light" },
|
|
9
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
10
|
+
React.createElement(TextField, { value: "value provided" })),
|
|
11
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
12
|
+
React.createElement(TextField, { placeholder: "placeholder text" })),
|
|
13
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
14
|
+
React.createElement(TextField, { placeholder: "with error", showError: true })),
|
|
15
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
16
|
+
React.createElement(TextField, { value: "read-only", readonly: true })),
|
|
17
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
18
|
+
React.createElement(TextField, { value: "large", size: "lg" }))),
|
|
19
|
+
React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
|
|
20
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
21
|
+
React.createElement(TextField, { value: "value provided" })),
|
|
22
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
23
|
+
React.createElement(TextField, { placeholder: "placeholder text" })),
|
|
24
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
25
|
+
React.createElement(TextField, { placeholder: "with error", showError: true })),
|
|
26
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
27
|
+
React.createElement(TextField, { value: "read-only", readonly: true })),
|
|
28
|
+
React.createElement("div", { className: "tw-p-4" },
|
|
29
|
+
React.createElement(TextField, { value: "large", size: "lg" })))));
|
|
30
|
+
return (React.createElement("div", { className: "tw-grid tw-grid-cols-3 tw-gap-4" },
|
|
31
|
+
React.createElement("div", { className: "color_topic" },
|
|
32
|
+
React.createElement("b", null, "Topic Colors"),
|
|
33
|
+
renderAllVariations()),
|
|
34
|
+
React.createElement("div", { className: "color_analysis" },
|
|
35
|
+
React.createElement("b", null, "Analysis Colors"),
|
|
36
|
+
renderAllVariations()),
|
|
37
|
+
React.createElement("div", { className: "color_datalab" },
|
|
38
|
+
React.createElement("b", null, "Datalab Colors"),
|
|
39
|
+
renderAllVariations())));
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=TextField.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.stories.js","sourceRoot":"","sources":["../../src/TextField/TextField.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,eAAe;IACb,KAAK,EAAE,WAAW;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,CAChC;QACE,6BAAK,SAAS,EAAC,cAAc;YAC3B,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,SAAS,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E,CAClB;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,EAAE,CAClB,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import { TextField } from './TextField';
|
|
6
|
+
describe('TextField', () => {
|
|
7
|
+
class Context {
|
|
8
|
+
testId = 'textFieldTestId';
|
|
9
|
+
props = {
|
|
10
|
+
onChange: jest.fn(),
|
|
11
|
+
testId: this.testId,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
let tc;
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
tc = new Context();
|
|
17
|
+
});
|
|
18
|
+
const renderTextField = (props) => render(React.createElement(TextField, { ...props }));
|
|
19
|
+
it('renders the provided value', () => {
|
|
20
|
+
const value = 'hello';
|
|
21
|
+
renderTextField({ ...tc.props, value });
|
|
22
|
+
expect(screen.getByDisplayValue(value)).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
it('renders the provided placeholder', () => {
|
|
25
|
+
const placeholder = 'Prompt to enter';
|
|
26
|
+
renderTextField({ ...tc.props, placeholder });
|
|
27
|
+
expect(screen.getByPlaceholderText(placeholder)).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
it('calls onChange handler', async () => {
|
|
30
|
+
renderTextField({ ...tc.props });
|
|
31
|
+
await userEvent.type(screen.getByTestId(tc.testId), 'trigger');
|
|
32
|
+
expect(tc.props.onChange).toHaveBeenCalled();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=TextField.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.test.js","sourceRoot":"","sources":["../../src/TextField/TextField.test.tsx"],"names":[],"mappings":"AAAA,OAAO,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AI,EAAE;QACtC,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;QACjC,MAAM,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;QAC/D,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.types.js","sourceRoot":"","sources":["../../src/TextField/TextField.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/TextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Button from '../Button';
|
|
3
|
+
import { tooltipPositions } from './Tooltip.types';
|
|
4
|
+
import { QTip } from './Qtip';
|
|
5
|
+
import Icon from '../Icon';
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Tooltip',
|
|
8
|
+
};
|
|
9
|
+
export const AllQTips = () => {
|
|
10
|
+
const renderButtonsWithTooltip = () => tooltipPositions.map((position) => (React.createElement("div", { key: `${position}_button` },
|
|
11
|
+
React.createElement(Button, { tooltip: `Tooltip on the ${position}`, label: position, tooltipOptions: { position } }))));
|
|
12
|
+
const renderIconsWithHtmlTooltip = () => tooltipPositions.map((position) => (React.createElement("div", { key: `${position}_icon` },
|
|
13
|
+
React.createElement(Icon, { tooltip: "<div><h2>Fancy Tooltip</h2> This is a special tooltip. Why? <br />Because it supports <b>HTML!</b></div>", tooltipPlacement: position, icon: "fc-sun", isHtmlTooltip: true }))));
|
|
14
|
+
const renderTextTooltipOnText = () => tooltipPositions.map((position) => (React.createElement("div", { key: `${position}_text` },
|
|
15
|
+
React.createElement("span", { "data-qtip-text": "Helpful information provided here", "data-qtip-placement": position },
|
|
16
|
+
"Hover for Tooltip (on the ",
|
|
17
|
+
position,
|
|
18
|
+
")"))));
|
|
19
|
+
const renderTextTooltipOnTextWithDelay = () => tooltipPositions.map((position) => (React.createElement("div", { key: `${position}_text` },
|
|
20
|
+
React.createElement("span", { "data-qtip-text": "Helpful information provided here", "data-qtip-placement": position, "data-qtip-delay": 1500 },
|
|
21
|
+
"Hover for Tooltip (on the ",
|
|
22
|
+
position,
|
|
23
|
+
") - with delay (1500ms)"))));
|
|
24
|
+
const renderTextTooltipOnOverflowHiddenText = () => tooltipPositions.map((position) => (React.createElement("div", { key: `${position}_text`, className: "tw-overflow-hidden" },
|
|
25
|
+
React.createElement("span", { "data-qtip-text": "Helpful information provided here", "data-qtip-placement": position },
|
|
26
|
+
"Hover for Tooltip (on the ",
|
|
27
|
+
position,
|
|
28
|
+
")",
|
|
29
|
+
React.createElement("br", null),
|
|
30
|
+
"(Overflow set to hidden)"))));
|
|
31
|
+
return (React.createElement(React.Fragment, null,
|
|
32
|
+
React.createElement(QTip, null),
|
|
33
|
+
React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4 tw-text-center" },
|
|
34
|
+
renderButtonsWithTooltip(),
|
|
35
|
+
renderIconsWithHtmlTooltip(),
|
|
36
|
+
renderTextTooltipOnText(),
|
|
37
|
+
renderTextTooltipOnTextWithDelay(),
|
|
38
|
+
renderTextTooltipOnOverflowHiddenText())));
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=QTip.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QTip.stories.js","sourceRoot":"","sources":["../../src/Tooltip/QTip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,gBA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qBAAmB,IAAI;;YAChF,QAAQ;sCAC9B,CACH,CACP,CAAC,CAAC;IAEL,MAAM,qCAAqC,GAAG,GAAG,EAAE,CACjD,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CACjC,6BAAK,GAAG,EAAE,GAAG,QAAQ,OAAO,EAAE,SAAS,EAAC,oBAAoB;QAC1D,gDAAqB,mCAAmC,yBAAsB,QAAQ;;YACzD,QAAQ;;YAAE,+BAAM;uCAEtC,CACH,CACP,CAAC,CAAC;IAEL,OAAO,CACL;QACE,oBAAC,IAAI,OAAG;QACR,6BAAK,SAAS,EAAC,gDAAgD;YAC5D,wBAAwB,EAAE;YAC1B,0BAA0B,EAAE;YAC5B,uBAAuB,EAAE;YACzB,gCAAgC,EAAE;YAClC,qCAAqC,EAAE,CACpC,CACL,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QTip.types.js","sourceRoot":"","sources":["../../src/Tooltip/QTip.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { QTip } from './Qtip';
|
|
3
|
+
import Icon from '../Icon';
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Tooltip',
|
|
6
|
+
};
|
|
7
|
+
const renderManyQTips = () => {
|
|
8
|
+
const colsCount = 100;
|
|
9
|
+
const rowCount = 100;
|
|
10
|
+
const rows = [];
|
|
11
|
+
const getCols = (rowId) => {
|
|
12
|
+
const cols = [];
|
|
13
|
+
for (let i = 0; i < colsCount; i++) {
|
|
14
|
+
cols.push(React.createElement("td", { key: 'col_' + i + '_row_' + rowId },
|
|
15
|
+
React.createElement(Icon, { icon: "fc-sun", tooltip: `hello there ${i}` })));
|
|
16
|
+
}
|
|
17
|
+
return cols;
|
|
18
|
+
};
|
|
19
|
+
for (let i = 0; i < rowCount; i++) {
|
|
20
|
+
rows.push(React.createElement("tr", { key: 'row_' + i }, ...getCols(i)));
|
|
21
|
+
}
|
|
22
|
+
return (React.createElement("table", null,
|
|
23
|
+
React.createElement("tbody", null, rows.map((row) => row))));
|
|
24
|
+
};
|
|
25
|
+
export const QtipPerformance = () => {
|
|
26
|
+
return (React.createElement(React.Fragment, null,
|
|
27
|
+
React.createElement(QTip, null),
|
|
28
|
+
React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4 tw-text-center" }, renderManyQTips())));
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=QTipPerformance.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QTipPerformance.stories.js","sourceRoot":"","sources":["../../src/Tooltip/QTipPerformance.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,eAAe;IACb,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,MAAM,SAAS,GAAG,GAAG,CAAC;IACtB,MAAM,QAAQ,GAAG,GAAG,CAAC;IACrB,MAAM,IAAI,GAAG,EAAE,CAAC;IAEhB,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE;QAChC,MAAM,IAAI,GAAG,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;YAClC,IAAI,CAAC,IAAI,CACP,4BAAI,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,OAAO,GAAG,KAAK;gBACnC,oBAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,eAAe,CAAC,EAAE,GAAI,CAChD,CACN,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE;QACjC,IAAI,CAAC,IAAI,CAAC,4BAAI,GAAG,EAAE,MAAM,GAAG,CAAC,OAAM,OAAO,CAAC,CAAC,CAAC,CAAM,CAAC,CAAC;KACtD;IACD,OAAO,CACL;QACE,mCAAQ,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAS,CACjC,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,OAAO,CACL;QACE,oBAAC,IAAI,OAAG;QACR,6BAAK,SAAS,EAAC,gDAAgD,IAAE,eAAe,EAAE,CAAO,CACxF,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import DOMPurify from 'dompurify';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { arrow, computePosition, offset } from '@floating-ui/dom';
|
|
4
|
+
import { useIntervalWhen } from 'rooks';
|
|
5
|
+
const getArrowStyle = (position, x, arrowWidth, tooltipHeight, tooltipWidth) => {
|
|
6
|
+
switch (position) {
|
|
7
|
+
case 'bottom':
|
|
8
|
+
return {
|
|
9
|
+
left: `${x}px`,
|
|
10
|
+
top: `${-arrowWidth}px`,
|
|
11
|
+
};
|
|
12
|
+
case 'left':
|
|
13
|
+
return {
|
|
14
|
+
left: `${tooltipWidth - arrowWidth}px`,
|
|
15
|
+
top: `${tooltipHeight / 2 - arrowWidth}px`,
|
|
16
|
+
};
|
|
17
|
+
case 'right':
|
|
18
|
+
return {
|
|
19
|
+
left: `${-arrowWidth}px`,
|
|
20
|
+
top: `${tooltipHeight / 2 - arrowWidth}px`,
|
|
21
|
+
};
|
|
22
|
+
default: // 'top':
|
|
23
|
+
return {
|
|
24
|
+
left: `${x}px`,
|
|
25
|
+
top: `${tooltipHeight - 10 + arrowWidth}px`,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const HTMLTip = ({ text }) => {
|
|
30
|
+
return React.createElement('div', {
|
|
31
|
+
dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(text) },
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* QTip
|
|
36
|
+
*
|
|
37
|
+
* QTip is a Singleton Tooltip component that guarantees high-performance and reduces component wrappers!
|
|
38
|
+
*
|
|
39
|
+
* QTip is used by all qomponents that support the display of tooltips.
|
|
40
|
+
* If you want to add a Tooltip to your application you can do so by adding the following html data-attributes:
|
|
41
|
+
*
|
|
42
|
+
* 'data-qtip-text': the tooltip text to display; this can also be a string containing valid HTML
|
|
43
|
+
* 'data-qtip-placement': one of TooltipPosition (top, bottom, right, or left)
|
|
44
|
+
* 'data-qtip-is-html': set this to true if you provided a text that contains HTML,
|
|
45
|
+
* 'data-qtip-delay': this can be used to delay the showing of the tooltip. this should be a number representing
|
|
46
|
+
* the # of milliseconds you want to delay the tooltip for.
|
|
47
|
+
* 'data-qtip-testid': use this attribute to provide a value for a data-testid of your tooltip; this is useful
|
|
48
|
+
* for tests
|
|
49
|
+
*
|
|
50
|
+
* In order for QTip to be able to display Tooltips you must add the QTip component to your top-most component
|
|
51
|
+
* (often that's App or Application) - simply add:
|
|
52
|
+
*
|
|
53
|
+
* <QTip />
|
|
54
|
+
*
|
|
55
|
+
* and enjoy beautiful & performant tooltips!
|
|
56
|
+
*/
|
|
57
|
+
export const QTip = () => {
|
|
58
|
+
const tooltipRef = useRef(null);
|
|
59
|
+
const tooltipTarget = useRef(null);
|
|
60
|
+
const tooltipArrowRef = useRef(null);
|
|
61
|
+
const [tooltipText, setTooltipText] = useState('');
|
|
62
|
+
const [tooltipTargetOriginalPosition, setTooltipTargetOriginalPosition] = useState(null);
|
|
63
|
+
const [show, setShow] = useState(false);
|
|
64
|
+
const [html, setHtml] = useState(false);
|
|
65
|
+
const [tooltipTestId, setTooltipTestId] = useState('');
|
|
66
|
+
const [overTooltip, setOverTooltip] = useState(false);
|
|
67
|
+
// Check every 300ms if the tooltip target position has changed and hide the tooltip if this happens.
|
|
68
|
+
useIntervalWhen(() => {
|
|
69
|
+
const currentPosition = tooltipTarget?.current?.getBoundingClientRect();
|
|
70
|
+
if (overTooltip) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (tooltipTargetOriginalPosition?.y !== currentPosition?.y ||
|
|
74
|
+
tooltipTargetOriginalPosition?.x !== currentPosition?.x) {
|
|
75
|
+
setShow(false);
|
|
76
|
+
}
|
|
77
|
+
}, 300, show);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
document.body.addEventListener('mousemove', onMouseMove);
|
|
80
|
+
return () => {
|
|
81
|
+
document.removeEventListener('mousemove', onMouseMove);
|
|
82
|
+
};
|
|
83
|
+
}, []);
|
|
84
|
+
const ttTimeout = useRef();
|
|
85
|
+
const onMouseMove = (e) => {
|
|
86
|
+
clearTimeout(ttTimeout.current);
|
|
87
|
+
if (!(e.target instanceof HTMLElement)) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
tooltipTarget.current = e.target;
|
|
91
|
+
let dataset = e.target?.dataset;
|
|
92
|
+
let text = dataset?.qtipText;
|
|
93
|
+
// Buttons support React.Nodes as children, the tooltip however is applied to the actual button component.
|
|
94
|
+
// we only check one level up - alternatively the tooltip can also be provided on the React.Node
|
|
95
|
+
if (!text || text === '') {
|
|
96
|
+
dataset = e.target?.parentElement?.dataset;
|
|
97
|
+
text = dataset?.qtipText;
|
|
98
|
+
tooltipTarget.current = e.target?.parentElement;
|
|
99
|
+
}
|
|
100
|
+
if (text) {
|
|
101
|
+
const delay = parseInt(dataset?.qtipDelay ?? '0');
|
|
102
|
+
ttTimeout.current = setTimeout(() => makeTooltip(text, dataset?.qtipPlacement, dataset?.qtipIsHtml === 'true', dataset?.qtipTestid, delay), delay);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const makeTooltip = (tooltipText, position = 'top', isHtml, dataTestId, delay) => {
|
|
106
|
+
if (tooltipText && tooltipTarget.current) {
|
|
107
|
+
setHtml(isHtml);
|
|
108
|
+
setTooltipText(tooltipText);
|
|
109
|
+
setTooltipTestId(dataTestId);
|
|
110
|
+
setTooltipTargetOriginalPosition(tooltipTarget.current.getBoundingClientRect());
|
|
111
|
+
const positionTooltip = () => {
|
|
112
|
+
if (tooltipRef.current && tooltipTarget.current) {
|
|
113
|
+
computePosition(tooltipTarget.current, tooltipRef.current, {
|
|
114
|
+
placement: position,
|
|
115
|
+
middleware: [offset(10), arrow({ element: tooltipArrowRef.current })],
|
|
116
|
+
}).then(({ x, y, middlewareData }) => {
|
|
117
|
+
Object.assign(tooltipRef.current?.style, {
|
|
118
|
+
left: `${x}px`,
|
|
119
|
+
top: `${y}px`,
|
|
120
|
+
});
|
|
121
|
+
if (middlewareData.arrow) {
|
|
122
|
+
const { x, y } = middlewareData.arrow;
|
|
123
|
+
const arrowWidth = tooltipArrowRef.current?.offsetHeight / 2;
|
|
124
|
+
const tooltipHeight = tooltipRef.current?.offsetHeight;
|
|
125
|
+
const tooltipWidth = tooltipRef.current?.offsetWidth;
|
|
126
|
+
const style = getArrowStyle(position, x || y, arrowWidth, tooltipHeight, tooltipWidth);
|
|
127
|
+
Object.assign(tooltipArrowRef.current.style, style);
|
|
128
|
+
}
|
|
129
|
+
setShow(true);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
delay > 0
|
|
134
|
+
? requestAnimationFrame(() => {
|
|
135
|
+
positionTooltip();
|
|
136
|
+
})
|
|
137
|
+
: positionTooltip();
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
return (React.createElement(React.Fragment, null,
|
|
141
|
+
React.createElement("div", { onMouseEnter: () => setOverTooltip(true), onMouseLeave: () => setOverTooltip(false), "data-testid": tooltipTestId, ref: tooltipRef, className: 'tw-absolute tw-rounded tw-bg-black tw-p-2 tw-text-xs tw-text-white tw-z-[9999] fade-in ' +
|
|
142
|
+
(show ? 'tw-visible' : 'tw-invisible tw-pointer-events-none') },
|
|
143
|
+
html ? React.createElement(HTMLTip, { text: tooltipText }) : tooltipText,
|
|
144
|
+
React.createElement("div", { className: "tw-absolute tw-w-[10px] tw-h-[10px] tw-rotate-45 tw-bg-black", ref: tooltipArrowRef }))));
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=Qtip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Qtip.js","sourceRoot":"","sources":["../../src/Tooltip/Qtip.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAa,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,aAAa,GAAG,CACpB,QAAgB,EAChB,CAAqB,EACrB,UAAkB,EAClB,aAAqB,EACrB,YAAoB,EACpB,EAAE;IACF,QAAQ,QAAQ,EAAE;QAChB,KAAK,QAAQ;YACX,OAAO;gBACL,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,GAAG,EAAE,GAAG,CAAC,UAAU,IAAI;aACxB,CAAC;QAEJ,KAAK,MAAM;YACT,OAAO;gBACL,IAAI,EAAE,GAAG,YAAY,GAAG,UAAU,IAAI;gBACtC,GAAG,EAAE,GAAG,aAAa,GAAG,CAAC,GAAG,UAAU,IAAI;aAC3C,CAAC;QACJ,KAAK,OAAO;YACV,OAAO;gBACL,IAAI,EAAE,GAAG,CAAC,UAAU,IAAI;gBACxB,GAAG,EAAE,GAAG,aAAa,GAAG,CAAC,GAAG,UAAU,IAAI;aAC3C,CAAC;QACJ,SAAS,SAAS;YAChB,OAAO;gBACL,IAAI,EAAE,GAA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L_TIP_DELAY } from './Tooltip.types';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
* Note: Tooltip has been replaced by QTip - a singleton JS tooltip that behaves well even with overflow settings :)
|
|
7
|
+
* See @QTip for more info!
|
|
8
|
+
*
|
|
9
|
+
* This component displays a Tooltip for the provided children. It is a CSS only tooltip that will not display
|
|
10
|
+
* correctly if a parent element has an overflow CSS property assigned. Please use QTip to ensure your tooltips
|
|
11
|
+
* display correctly.
|
|
12
|
+
*/
|
|
13
|
+
export const Tooltip = ({ position = 'bottom', children, text, delay = DEFAULT_TOOL_TIP_DELAY, }) => {
|
|
14
|
+
const arrowBaseClasses = "before:tw-content-[''] before:tw-absolute before:tw-border-8";
|
|
15
|
+
const centerArrowVertically = 'before:tw-top-1/2 before:-tw-translate-y-1/2';
|
|
16
|
+
const centerArrowHorizontally = 'before:tw-left-1/2 before:-tw-translate-x-1/2';
|
|
17
|
+
const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:tw-right-[100%] before:tw-border-y-transparent
|
|
18
|
+
before:tw-border-l-transparent before:tw-border-r-black`;
|
|
19
|
+
const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:tw-left-[100%] before:tw-border-y-transparent
|
|
20
|
+
before:tw-border-l-black before:tw-border-r-transparent`;
|
|
21
|
+
const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-top-4 before:tw-border-b-black
|
|
22
|
+
before:tw-border-r-transparent before:tw-border-l-transparent before:tw-border-t-transparent`;
|
|
23
|
+
const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-bottom-4 before:tw-border-b-transparent
|
|
24
|
+
before:tw-border-t-black before:tw-border-l-transparent before:tw-border-r-transparent`;
|
|
25
|
+
const placements = {
|
|
26
|
+
top: `-tw-top-2 -tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowTop}`,
|
|
27
|
+
left: `-tw-translate-x-full -tw-left-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowLeft}`,
|
|
28
|
+
right: `tw-translate-x-full -tw-right-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowRight}`,
|
|
29
|
+
bottom: `-tw-bottom-2 tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowBottom}`,
|
|
30
|
+
};
|
|
31
|
+
return (React.createElement("div", { className: "tw-group tw-relative tw-inline-block" },
|
|
32
|
+
children,
|
|
33
|
+
React.createElement("div", { className: `tw-z-50 tw-whitespace-nowrap tw-hidden group-hover:tw-inline-block group-hover:tw-delay-[${delay}ms]
|
|
34
|
+
tw-absolute tw-opacity-0 group-hover:tw-opacity-100 tw-rounded tw-bg-black tw-p-2 tw-text-xs tw-text-white ${placements[position]}` }, text)));
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,sBAAsB,EAAgB,MAAM,iBAAiB,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAA0C,CAAC,EAC7D,QAAQ,GAAG,QAAQ,EACnB,QAAQ,EACR,IAAI,EACJ,KAAK,GAAG,sBAAsB,GAC/B,EAAE,EAAE;IACH,MAAM,gBAAgB,GAAG,8DAA8D,CAAC;IACxF,MAAM,qBAAqB,GAAG,8CAA8C,CAAC;IAC7E,MAAM,uBAAuB,GAAG,+CAA+C,CAAC;IAChF,MAAM,UAAU,GAAG,GAAG,gBAAgB,IAAI,qBAAqB;0DACP,CAAC;IAEzD,MAAM,SAAS,GAAG,GAAG,gBAAgB,IAAI,qBAAqB;2DACL,CAAC;IAE1D,MAAM,WAAW,GAAG,GAAG,gBAAgB,IAAI,uBAAuB;+FAC2B,CAAC;IAC9F,MAAM,QAAQ,GAAG,GAAG,gBAAgB,IAAI,uBAAuB;yFACwB,CAAC;IAExF,MAAM,UAAU,GAAG;QACjB,GAAG,EAAE,kEAAkE,QAAQ,EAAE;QACjF,IAAI,EAAE,kEAAkE,SAAS,EAAE;QACnF,KAAK,EAAE,kEAAkE,UAAU,EAAE;QACrF,MAAM,EAAE,oEAAoE,WAAW,EAAE;KAC1F,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,sCAAsC;QAClD,QAAQ;QACT,6BACE,SAAS,EAAE,4FAA4F,KAAK;qHACC,UAAU,CAAC,QAAQ,CAAC,EAAE,IAClI,IAAI,CACD,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tooltip } from './Tooltip';
|
|
3
|
+
import Icon from '../Icon';
|
|
4
|
+
import Button from '../Button';
|
|
5
|
+
import { tooltipPositions } from './Tooltip.types';
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Tooltip',
|
|
8
|
+
};
|
|
9
|
+
export const AllTooltips = () => {
|
|
10
|
+
const renderButtonsWithTooltip = () => tooltipPositions.map((position) => (React.createElement("div", { key: `${position}_button` },
|
|
11
|
+
React.createElement(Tooltip, { text: `Tooltip on the ${position}`, position: position },
|
|
12
|
+
React.createElement(Button, { label: position })))));
|
|
13
|
+
const renderIconsWithHtmlTooltip = () => tooltipPositions.map((position) => (React.createElement("div", { key: `${position}_icon` },
|
|
14
|
+
React.createElement(Tooltip, { text: React.createElement("div", null,
|
|
15
|
+
React.createElement("h2", null, "Fancy Tooltip"),
|
|
16
|
+
" This is a special tooltip. Why?",
|
|
17
|
+
React.createElement("br", null),
|
|
18
|
+
"Because it supports ",
|
|
19
|
+
React.createElement("b", null, "HTML!")), position: position },
|
|
20
|
+
React.createElement(Icon, { icon: "fc-sun" })))));
|
|
21
|
+
const renderTextTooltipOnText = () => tooltipPositions.map((position) => (React.createElement("div", { key: `${position}_text` },
|
|
22
|
+
React.createElement(Tooltip, { text: "Helpful information provided here", position: position },
|
|
23
|
+
React.createElement("span", null,
|
|
24
|
+
"Hover for Tooltip (on the ",
|
|
25
|
+
position,
|
|
26
|
+
")")))));
|
|
27
|
+
return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4 tw-text-center" },
|
|
28
|
+
renderButtonsWithTooltip(),
|
|
29
|
+
renderIconsWithHtmlTooltip(),
|
|
30
|
+
renderTextTooltipOnText()));
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=Tooltip.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.stories.js","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,eAAe;IACb,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,MAAM,wBAAwB,GAAG,GAAG,EAAE,CACpC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CACjC,6BAAK,GAAG,EAAE,GAAG,QAAQ,SAAS;QAC5B,oBAAC,OAAO,IAAC,IAAI,EAAE,kBAAkB,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ;YAC7D,oBAAC,MAAM,IAAC,KAAK,EAAE,QAAQ,GAAI,CACnB,CACN,CACP,CAAC,CAAC;IAEL,MAAM,0BAA0B,GAAG,GAAG,EAAE,CACtC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CACjC,6BAAK,GAAG,EAAE,GAAG,QAAQ,OAAO;QAC1B,oBAAC,OAAO,IACN,IAAI,EACF;gBACE,gDAAsB;;gBACtB,+BAAM;;gBACc,uCAAY,CAC5B,EAER,QAAQ,EAAE,QAAQ;YAClB,oBAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,GAAG,CACd,CACN,CACP,CAAC,CAAC;IAEL,MAAM,uBAAuB,GAAG,GAAG,EAAE,CACnC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CACjC,6BAAK,GAAG,EAAE,GAAG,QAAQ,OAAO;QAC1B,oBAAC,OAAO,IAAC,IAAI,EAAC,mCAAmC,EAAC,QAAQ,EAAE,QAAQ;YAClE;;gBAAiC,QAAQ;oBAAS,CAC1C,CACN,CACP,CAAC,CAAC;IAEL,OAAO,CACL,6BAAK,SAAS,EAAC,gDAAgD;QAC5D,wBAAwB,EAAE;QAC1B,0BAA0B,EAAE;QAC5B,uBAAuB,EAAE,CACtB,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.types.js","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAC3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tooltip } from './Tooltip';
|
|
3
|
+
import Icon from '../Icon';
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Tooltip',
|
|
6
|
+
};
|
|
7
|
+
const renderManyTooltips = () => {
|
|
8
|
+
const colsCount = 100;
|
|
9
|
+
const rowCount = 100;
|
|
10
|
+
const rows = [];
|
|
11
|
+
const getCols = (rowId) => {
|
|
12
|
+
const cols = [];
|
|
13
|
+
for (let i = 0; i < colsCount; i++) {
|
|
14
|
+
cols.push(React.createElement("td", { key: 'col_' + i + '_row_' + rowId },
|
|
15
|
+
React.createElement(Tooltip, { text: `hello there ${i}` },
|
|
16
|
+
React.createElement(Icon, { icon: "fc-sun" }))));
|
|
17
|
+
}
|
|
18
|
+
return cols;
|
|
19
|
+
};
|
|
20
|
+
for (let i = 0; i < rowCount; i++) {
|
|
21
|
+
rows.push(React.createElement("tr", { key: 'row_' + i }, ...getCols(i)));
|
|
22
|
+
}
|
|
23
|
+
return (React.createElement("table", null,
|
|
24
|
+
React.createElement("tbody", null, rows.map((row) => row))));
|
|
25
|
+
};
|
|
26
|
+
export const TooltipPerformance = () => {
|
|
27
|
+
return (React.createElement(React.Fragment, null,
|
|
28
|
+
React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4 tw-text-center" }, renderManyTooltips())));
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=TooltipPerformance.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipPerformance.stories.js","sourceRoot":"","sources":["../../src/Tooltip/TooltipPerformance.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,eAAe;IACb,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC9B,MAAM,SAAS,GAAG,GAAG,CAAC;IACtB,MAAM,QAAQ,GAAG,GAAG,CAAC;IACrB,MAAM,IAAI,GAAG,EAAE,CAAC;IAEhB,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE;QAChC,MAAM,IAAI,GAAG,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;YAClC,IAAI,CAAC,IAAI,CACP,4BAAI,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,OAAO,GAAG,KAAK;gBACnC,oBAAC,OAAO,IAAC,IAAI,EAAE,eAAe,CAAC,EAAE;oBAC/B,oBAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,GAAG,CACd,CACP,CACN,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE;QACjC,IAAI,CAAC,IAAI,CAAC,4BAAI,GAAG,EAAE,MAAM,GAAG,CAAC,OAAM,OAAO,CAAC,CAAC,CAAC,CAAM,CAAC,CAAC;KACtD;IACD,OAAO,CACL;QACE,mCAAQ,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAS,CACjC,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,OAAO,CACL;QACE,6BAAK,SAAS,EAAC,gDAAgD,IAAE,kBAAkB,EAAE,CAAO,CAC3F,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @exports the browser id (i.e., 'IE 11' 'Chrome 90')
|
|
3
|
+
* @see http://stackoverflow.com/questions/2400935/browser-detection-in-javascript
|
|
4
|
+
*/
|
|
5
|
+
export const browserId = (function () {
|
|
6
|
+
let tem;
|
|
7
|
+
const ua = navigator.userAgent;
|
|
8
|
+
let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
|
|
9
|
+
if (/trident/i.test(M[1])) {
|
|
10
|
+
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
|
|
11
|
+
return `IE ${tem[1] || ''}`;
|
|
12
|
+
}
|
|
13
|
+
if (M[1] === 'Chrome') {
|
|
14
|
+
tem = ua.match(/\b(OPR|Edge?)\/(\d+)/);
|
|
15
|
+
if (tem !== null) {
|
|
16
|
+
return tem.slice(1).join(' ').replace('OPR', 'Opera').replace('Edg ', 'Edge ');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
|
|
20
|
+
if ((tem = ua.match(/version\/(\d+)/i)) !== null) {
|
|
21
|
+
M.splice(1, 1, tem[1]);
|
|
22
|
+
}
|
|
23
|
+
return M.join(' ');
|
|
24
|
+
})();
|
|
25
|
+
export const browserName = browserId && browserId.split(' ', 2)[0];
|
|
26
|
+
export const browserVersion = browserId && parseInt(browserId.split(' ', 2)[1], 10);
|
|
27
|
+
export const browserIsFirefox = browserId && browserName === 'Firefox';
|
|
28
|
+
export const browserIsEdgeBeforeChromium = browserName && browserVersion && browserName === 'Edge' && browserVersion < 70;
|
|
29
|
+
//# sourceMappingURL=browserId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserId.js","sourceRoot":"","sources":["../../src/utils/browserId.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAW,CAAC;IAChC,IAAI,GAAG,CAAC;IACR,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC;IAC/B,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,8DAA8D,CAAC,IAAI,EAAE,CAAC;IACvF,IAAI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