@seeqdev/qomponents 0.0.183 → 0.0.185
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 +5 -19
- package/dist/example/.eslintrc.cjs +2 -6
- package/dist/example/README.md +0 -3
- package/dist/example/src/Example.tsx +7 -7
- package/dist/example/tsconfig.json +2 -8
- package/dist/example/tsconfig.node.json +1 -3
- package/dist/example/vite.config.ts +1 -1
- package/dist/index.esm.js +784 -523
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +781 -520
- package/dist/index.js.map +1 -1
- package/dist/src/Accordion/Accordion.js +8 -0
- package/dist/src/Accordion/Accordion.stories.js +96 -0
- package/dist/src/Accordion/Accordion.test.js +54 -0
- package/dist/src/Accordion/Accordion.types.js +1 -0
- package/dist/src/Accordion/index.js +1 -0
- package/dist/src/Alert/Alert.js +33 -0
- package/dist/src/Alert/Alert.stories.d.ts +13 -5
- package/dist/src/Alert/Alert.stories.js +72 -0
- package/dist/src/Alert/Alert.test.js +49 -0
- package/dist/src/Alert/Alert.types.js +1 -0
- package/dist/src/Alert/index.js +1 -0
- package/dist/src/Button/Button.js +107 -0
- package/dist/src/Button/Button.stories.js +74 -0
- package/dist/src/Button/Button.test.js +65 -0
- package/dist/src/Button/Button.types.d.ts +4 -4
- package/dist/src/Button/Button.types.js +4 -0
- package/dist/src/Button/index.d.ts +1 -1
- package/dist/src/Button/index.js +1 -0
- package/dist/src/ButtonGroup/ButtonGroup.js +34 -0
- package/dist/src/ButtonGroup/ButtonGroup.stories.js +328 -0
- package/dist/src/ButtonGroup/ButtonGroup.test.js +65 -0
- package/dist/src/ButtonGroup/ButtonGroup.types.js +1 -0
- package/dist/src/ButtonGroup/index.js +1 -0
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.js +46 -0
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.stories.js +119 -0
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.test.js +92 -0
- package/dist/src/ButtonWithDropdown/ButtonWithDropdown.types.js +1 -0
- package/dist/src/ButtonWithDropdown/index.js +1 -0
- package/dist/src/ButtonWithPopover/ButtonWithPopover.js +54 -0
- package/dist/src/ButtonWithPopover/ButtonWithPopover.stories.js +51 -0
- package/dist/src/ButtonWithPopover/ButtonWithPopover.test.js +80 -0
- package/dist/src/ButtonWithPopover/ButtonWithPopover.types.js +1 -0
- package/dist/src/ButtonWithPopover/index.js +1 -0
- package/dist/src/Carousel/Carousel.js +80 -0
- package/dist/src/Carousel/Carousel.stories.js +100 -0
- package/dist/src/Carousel/Carousel.test.js +47 -0
- package/dist/src/Carousel/Carousel.types.js +1 -0
- package/dist/src/Carousel/index.js +1 -0
- package/dist/src/Checkbox/Checkbox.js +24 -0
- package/dist/src/Checkbox/Checkbox.stories.js +21 -0
- package/dist/src/Checkbox/Checkbox.test.js +93 -0
- package/dist/src/Checkbox/Checkbox.types.js +1 -0
- package/dist/src/Checkbox/index.js +1 -0
- package/dist/src/Collapse/Collapse.js +16 -0
- package/dist/src/Collapse/Collapse.stories.js +28 -0
- package/dist/src/Collapse/Collapse.test.js +16 -0
- package/dist/src/Collapse/Collapse.types.js +1 -0
- package/dist/src/Collapse/index.js +1 -0
- package/dist/src/Icon/Icon.js +55 -0
- package/dist/src/Icon/Icon.stories.js +31 -0
- package/dist/src/Icon/Icon.test.js +54 -0
- package/dist/src/Icon/Icon.types.d.ts +1 -1
- package/dist/src/Icon/Icon.types.js +15 -0
- package/dist/src/Icon/index.js +1 -0
- package/dist/src/InputGroup/InputGroup.js +33 -0
- package/dist/src/InputGroup/InputGroup.stories.js +144 -0
- package/dist/src/InputGroup/InputGroup.test.js +41 -0
- package/dist/src/InputGroup/InputGroup.types.js +1 -0
- package/dist/src/InputGroup/index.js +1 -0
- package/dist/src/Modal/Modal.js +86 -0
- package/dist/src/Modal/Modal.stories.js +79 -0
- package/dist/src/Modal/Modal.test.js +107 -0
- package/dist/src/Modal/Modal.types.js +1 -0
- package/dist/src/Modal/index.js +1 -0
- package/dist/src/ProgressBar/ProgressBar.js +71 -0
- package/dist/src/ProgressBar/ProgressBar.stories.js +46 -0
- package/dist/src/ProgressBar/ProgressBar.test.js +42 -0
- package/dist/src/ProgressBar/ProgressBar.types.js +1 -0
- package/dist/src/ProgressBar/index.js +1 -0
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.js +41 -0
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.stories.js +73 -0
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.test.js +72 -0
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.types.d.ts +0 -5
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.types.js +1 -0
- package/dist/src/SeeqActionDropdown/index.js +1 -0
- package/dist/src/SeeqActionDropdown/variants.js +34 -0
- package/dist/src/Select/Select.js +171 -0
- package/dist/src/Select/Select.stories.js +50 -0
- package/dist/src/Select/Select.test.js +176 -0
- package/dist/src/Select/Select.types.js +1 -0
- package/dist/src/Select/index.js +2 -0
- package/dist/src/Slider/Slider.js +11 -0
- package/dist/src/Slider/Slider.stories.js +37 -0
- package/dist/src/Slider/Slider.test.js +31 -0
- package/dist/src/Slider/Slider.types.js +1 -0
- package/dist/src/Slider/index.js +1 -0
- package/dist/src/SvgIcon/SvgIcon.js +27 -0
- package/dist/src/SvgIcon/SvgIcon.stories.js +26 -0
- package/dist/src/SvgIcon/SvgIcon.test.js +40 -0
- package/dist/src/SvgIcon/SvgIcon.types.d.ts +1 -1
- package/dist/src/SvgIcon/SvgIcon.types.js +2 -0
- package/dist/src/SvgIcon/index.js +1 -0
- package/dist/src/Tabs/Tabs.js +18 -0
- package/dist/src/Tabs/Tabs.stories.js +83 -0
- package/dist/src/Tabs/Tabs.test.js +91 -0
- package/dist/src/Tabs/Tabs.types.js +1 -0
- package/dist/src/Tabs/index.js +1 -0
- package/dist/src/TextArea/TextArea.js +54 -0
- package/dist/src/TextArea/TextArea.stories.js +21 -0
- package/dist/src/TextArea/TextArea.test.js +129 -0
- package/dist/src/TextArea/TextArea.types.js +1 -0
- package/dist/src/TextArea/index.js +1 -0
- package/dist/src/TextField/TextField.js +85 -0
- package/dist/src/TextField/TextField.stories.js +30 -0
- package/dist/src/TextField/TextField.test.js +40 -0
- package/dist/src/TextField/TextField.types.js +1 -0
- package/dist/src/TextField/index.js +1 -0
- package/dist/src/ToolbarButton/ToolbarButton.js +58 -0
- package/dist/src/ToolbarButton/ToolbarButton.stories.js +63 -0
- package/dist/src/ToolbarButton/ToolbarButton.test.js +89 -0
- package/dist/src/ToolbarButton/ToolbarButton.types.d.ts +1 -1
- package/dist/src/ToolbarButton/ToolbarButton.types.js +1 -0
- package/dist/src/ToolbarButton/index.js +1 -0
- package/dist/src/Tooltip/QTip.stories.js +22 -0
- package/dist/src/Tooltip/QTip.types.js +1 -0
- package/dist/src/Tooltip/QTipPerformance.stories.js +27 -0
- package/dist/src/Tooltip/Qtip.js +168 -0
- package/dist/src/Tooltip/Tooltip.js +34 -0
- package/dist/src/Tooltip/Tooltip.stories.js +20 -0
- package/dist/src/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/src/Tooltip/Tooltip.types.js +2 -0
- package/dist/src/Tooltip/TooltipPerformance.stories.js +25 -0
- package/dist/src/Tooltip/index.js +2 -0
- package/dist/src/Tooltip/qTip.utilities.js +10 -0
- package/dist/src/index.js +47 -0
- package/dist/src/setupTests.js +5 -0
- package/dist/src/types.js +25 -0
- package/dist/src/utils/browserId.d.ts +3 -3
- package/dist/src/utils/browserId.js +28 -0
- package/dist/src/utils/svg.js +19 -0
- package/dist/src/utils/validateStyleDimension.js +13 -0
- package/dist/src/utils/validateStyleDimension.test.js +19 -0
- package/dist/styles.css +3410 -2791
- package/package.json +22 -17
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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(_jsx("td", { children: _jsx(Tooltip, { text: `hello there ${i}`, children: _jsx(Icon, { icon: "fc-sun" }) }) }, 'col_' + i + '_row_' + rowId));
|
|
15
|
+
}
|
|
16
|
+
return cols;
|
|
17
|
+
};
|
|
18
|
+
for (let i = 0; i < rowCount; i++) {
|
|
19
|
+
rows.push(_jsxs("tr", { children: [...getCols(i)] }, 'row_' + i));
|
|
20
|
+
}
|
|
21
|
+
return (_jsx("table", { children: _jsx("tbody", { children: rows.map((row) => row) }) }));
|
|
22
|
+
};
|
|
23
|
+
export const TooltipPerformance = () => {
|
|
24
|
+
return (_jsx(_Fragment, { children: _jsx("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4 tw-text-center", children: renderManyTooltips() }) }));
|
|
25
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DEFAULT_TOOL_TIP_DELAY } from './Tooltip.types';
|
|
2
|
+
export const getQTipData = ({ tooltip, tooltipPlacement, isHtmlTooltip, tooltipTestId, tooltipDelay = DEFAULT_TOOL_TIP_DELAY, }) => tooltip
|
|
3
|
+
? {
|
|
4
|
+
'data-qtip-text': tooltip,
|
|
5
|
+
'data-qtip-placement': tooltipPlacement,
|
|
6
|
+
'data-qtip-is-html': isHtmlTooltip,
|
|
7
|
+
'data-qtip-testid': tooltipTestId,
|
|
8
|
+
'data-qtip-delay': tooltipDelay,
|
|
9
|
+
}
|
|
10
|
+
: undefined;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Button from './Button';
|
|
2
|
+
import ToolbarButton from './ToolbarButton';
|
|
3
|
+
import TextField from './TextField';
|
|
4
|
+
import Checkbox from './Checkbox';
|
|
5
|
+
import TextArea from './TextArea';
|
|
6
|
+
import { QTip, Tooltip } from './Tooltip';
|
|
7
|
+
import Icon from './Icon';
|
|
8
|
+
import Select from './Select';
|
|
9
|
+
import { SelectCompoents } from './Select';
|
|
10
|
+
import Modal from './Modal';
|
|
11
|
+
import Tabs from './Tabs';
|
|
12
|
+
import Accordion from './Accordion';
|
|
13
|
+
import ButtonWithPopover from './ButtonWithPopover';
|
|
14
|
+
import ButtonWithDropdown from './ButtonWithDropdown';
|
|
15
|
+
import Alert from './Alert';
|
|
16
|
+
import SeeqActionDropdown from './SeeqActionDropdown';
|
|
17
|
+
import InputGroup from './InputGroup';
|
|
18
|
+
import Collapse from './Collapse';
|
|
19
|
+
import Slider from './Slider';
|
|
20
|
+
import ProgressBar from './ProgressBar';
|
|
21
|
+
import ButtonGroup from './ButtonGroup';
|
|
22
|
+
import Carousel from './Carousel';
|
|
23
|
+
export { Tabs };
|
|
24
|
+
export { Button };
|
|
25
|
+
export { ToolbarButton };
|
|
26
|
+
export { TextField };
|
|
27
|
+
export { TextArea };
|
|
28
|
+
export { Tooltip };
|
|
29
|
+
export { Checkbox };
|
|
30
|
+
export { Icon };
|
|
31
|
+
export { Select };
|
|
32
|
+
export { SelectCompoents };
|
|
33
|
+
export { QTip };
|
|
34
|
+
export { Modal };
|
|
35
|
+
export { Accordion };
|
|
36
|
+
export { ButtonWithPopover };
|
|
37
|
+
export { ButtonWithDropdown };
|
|
38
|
+
export { Alert };
|
|
39
|
+
export { SeeqActionDropdown };
|
|
40
|
+
export { InputGroup };
|
|
41
|
+
export { Collapse };
|
|
42
|
+
export { Slider };
|
|
43
|
+
export { ProgressBar };
|
|
44
|
+
export { ButtonGroup };
|
|
45
|
+
export { Carousel };
|
|
46
|
+
// Export types
|
|
47
|
+
export * from './types';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Export all component types
|
|
2
|
+
export * from './Accordion/Accordion.types';
|
|
3
|
+
export * from './Alert/Alert.types';
|
|
4
|
+
export * from './Button/Button.types';
|
|
5
|
+
export * from './ButtonGroup/ButtonGroup.types';
|
|
6
|
+
export * from './ButtonWithDropdown/ButtonWithDropdown.types';
|
|
7
|
+
export * from './ButtonWithPopover/ButtonWithPopover.types';
|
|
8
|
+
export * from './Carousel/Carousel.types';
|
|
9
|
+
export * from './Checkbox/Checkbox.types';
|
|
10
|
+
export * from './Collapse/Collapse.types';
|
|
11
|
+
export * from './Icon/Icon.types';
|
|
12
|
+
export * from './InputGroup/InputGroup.types';
|
|
13
|
+
export * from './Modal/Modal.types';
|
|
14
|
+
export * from './ProgressBar/ProgressBar.types';
|
|
15
|
+
export * from './SeeqActionDropdown/SeeqActionDropdown.types';
|
|
16
|
+
export * from './Select/Select.types';
|
|
17
|
+
export * from './Slider/Slider.types';
|
|
18
|
+
export * from './SvgIcon/SvgIcon.types';
|
|
19
|
+
export * from './Tabs/Tabs.types';
|
|
20
|
+
export * from './TextArea/TextArea.types';
|
|
21
|
+
export * from './TextField/TextField.types';
|
|
22
|
+
export * from './ToolbarButton/ToolbarButton.types';
|
|
23
|
+
export * from './Tooltip/QTip.types';
|
|
24
|
+
export * from './Tooltip/Tooltip.types';
|
|
25
|
+
export { toolbarButtonVariants } from './ToolbarButton/ToolbarButton.types';
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const browserId: string;
|
|
6
6
|
export declare const browserName: string;
|
|
7
|
-
export declare const browserVersion: number;
|
|
8
|
-
export declare const browserIsFirefox: boolean;
|
|
9
|
-
export declare const browserIsEdgeBeforeChromium: boolean;
|
|
7
|
+
export declare const browserVersion: number | "";
|
|
8
|
+
export declare const browserIsFirefox: boolean | "";
|
|
9
|
+
export declare const browserIsEdgeBeforeChromium: boolean | "" | 0;
|
|
@@ -0,0 +1,28 @@
|
|
|
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;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const SVG_PATH = 'svgpath:';
|
|
2
|
+
/**
|
|
3
|
+
* Determines if an icon is SVG
|
|
4
|
+
*
|
|
5
|
+
* @param icon - an icon string that will either be an icon class or an SVG path definition (e.g. "fa fa-wrench" or
|
|
6
|
+
* "svgpath:M 17.0181 0 ...")
|
|
7
|
+
*/
|
|
8
|
+
export function isSvgIcon(icon) {
|
|
9
|
+
return icon.startsWith(SVG_PATH);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves the SVG path from an SVG icon
|
|
13
|
+
*
|
|
14
|
+
* @param icon - an SVG icon string including path definition (e.g. "svgpath:M 17.0181 0 ...")
|
|
15
|
+
* @returns the SVG icon path or an empty string if the supplied icon is not SVG
|
|
16
|
+
*/
|
|
17
|
+
export function getSvgIconPath(icon) {
|
|
18
|
+
return isSvgIcon(icon) ? icon.substring(SVG_PATH.length) : '';
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const setValidInputDimension = (width, height) => {
|
|
2
|
+
let inputStyle;
|
|
3
|
+
if (typeof width === 'number' && width > 0) {
|
|
4
|
+
inputStyle = {
|
|
5
|
+
width: `${width}px`,
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
if (typeof height === 'number' && height > 0) {
|
|
9
|
+
inputStyle = inputStyle || {};
|
|
10
|
+
inputStyle['height'] = `${height}px`;
|
|
11
|
+
}
|
|
12
|
+
return inputStyle;
|
|
13
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { setValidInputDimension } from './validateStyleDimension';
|
|
2
|
+
describe('setValidInputDimension', () => {
|
|
3
|
+
it('returns undefined if both width and height are undefined', () => {
|
|
4
|
+
const result = setValidInputDimension();
|
|
5
|
+
expect(result).toBeUndefined();
|
|
6
|
+
});
|
|
7
|
+
it('returns a DimensionStyle object with width if width is a valid number', () => {
|
|
8
|
+
const result = setValidInputDimension(300);
|
|
9
|
+
expect(result).toEqual({ width: '300px' });
|
|
10
|
+
});
|
|
11
|
+
it('returns a DimensionStyle object with height if height is a valid number', () => {
|
|
12
|
+
const result = setValidInputDimension(undefined, 400);
|
|
13
|
+
expect(result).toEqual({ height: '400px' });
|
|
14
|
+
});
|
|
15
|
+
it('returns a DimensionStyle object with both width and height if both are valid numbers', () => {
|
|
16
|
+
const result = setValidInputDimension(500, 600);
|
|
17
|
+
expect(result).toEqual({ width: '500px', height: '600px' });
|
|
18
|
+
});
|
|
19
|
+
});
|