@seeqdev/qomponents 0.0.143 → 0.0.145
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/styles.css +13 -13
- package/package.json +1 -1
- package/dist/Accordion/Accordion.js +0 -9
- package/dist/Accordion/Accordion.js.map +0 -1
- package/dist/Accordion/Accordion.stories.js +0 -115
- package/dist/Accordion/Accordion.stories.js.map +0 -1
- package/dist/Accordion/Accordion.test.js +0 -55
- package/dist/Accordion/Accordion.test.js.map +0 -1
- package/dist/Accordion/Accordion.types.js +0 -2
- package/dist/Accordion/Accordion.types.js.map +0 -1
- package/dist/Accordion/index.js +0 -2
- package/dist/Accordion/index.js.map +0 -1
- package/dist/Alert/Alert.js +0 -34
- package/dist/Alert/Alert.js.map +0 -1
- package/dist/Alert/Alert.stories.js +0 -52
- package/dist/Alert/Alert.stories.js.map +0 -1
- package/dist/Alert/Alert.test.js +0 -51
- package/dist/Alert/Alert.test.js.map +0 -1
- package/dist/Alert/Alert.types.js +0 -2
- package/dist/Alert/Alert.types.js.map +0 -1
- package/dist/Alert/index.js +0 -2
- package/dist/Alert/index.js.map +0 -1
- package/dist/Button/Button.js +0 -92
- package/dist/Button/Button.js.map +0 -1
- package/dist/Button/Button.stories.js +0 -100
- package/dist/Button/Button.stories.js.map +0 -1
- package/dist/Button/Button.test.js +0 -49
- package/dist/Button/Button.test.js.map +0 -1
- package/dist/Button/Button.types.js +0 -5
- package/dist/Button/Button.types.js.map +0 -1
- package/dist/Button/index.js +0 -2
- package/dist/Button/index.js.map +0 -1
- package/dist/ButtonGroup/ButtonGroup.js +0 -35
- package/dist/ButtonGroup/ButtonGroup.js.map +0 -1
- package/dist/ButtonGroup/ButtonGroup.stories.js +0 -385
- package/dist/ButtonGroup/ButtonGroup.stories.js.map +0 -1
- package/dist/ButtonGroup/ButtonGroup.test.js +0 -67
- package/dist/ButtonGroup/ButtonGroup.test.js.map +0 -1
- package/dist/ButtonGroup/ButtonGroup.types.js +0 -2
- package/dist/ButtonGroup/ButtonGroup.types.js.map +0 -1
- package/dist/ButtonGroup/index.js +0 -2
- package/dist/ButtonGroup/index.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js +0 -60
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +0 -143
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +0 -93
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +0 -2
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js.map +0 -1
- package/dist/ButtonWithDropdown/index.js +0 -2
- package/dist/ButtonWithDropdown/index.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.js +0 -62
- package/dist/ButtonWithPopover/ButtonWithPopover.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +0 -75
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js +0 -82
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js +0 -2
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js.map +0 -1
- package/dist/ButtonWithPopover/index.js +0 -2
- package/dist/ButtonWithPopover/index.js.map +0 -1
- package/dist/Carousel/Carousel.js +0 -67
- package/dist/Carousel/Carousel.js.map +0 -1
- package/dist/Carousel/Carousel.stories.js +0 -115
- package/dist/Carousel/Carousel.stories.js.map +0 -1
- package/dist/Carousel/Carousel.test.js +0 -48
- package/dist/Carousel/Carousel.test.js.map +0 -1
- package/dist/Carousel/Carousel.types.js +0 -2
- package/dist/Carousel/Carousel.types.js.map +0 -1
- package/dist/Carousel/index.js +0 -2
- package/dist/Carousel/index.js.map +0 -1
- package/dist/Checkbox/Checkbox.js +0 -26
- package/dist/Checkbox/Checkbox.js.map +0 -1
- package/dist/Checkbox/Checkbox.stories.js +0 -34
- package/dist/Checkbox/Checkbox.stories.js.map +0 -1
- package/dist/Checkbox/Checkbox.test.js +0 -94
- package/dist/Checkbox/Checkbox.test.js.map +0 -1
- package/dist/Checkbox/Checkbox.types.js +0 -2
- package/dist/Checkbox/Checkbox.types.js.map +0 -1
- package/dist/Checkbox/index.js +0 -2
- package/dist/Checkbox/index.js.map +0 -1
- package/dist/Collapse/Collapse.js +0 -18
- package/dist/Collapse/Collapse.js.map +0 -1
- package/dist/Collapse/Collapse.stories.js +0 -37
- package/dist/Collapse/Collapse.stories.js.map +0 -1
- package/dist/Collapse/Collapse.test.js +0 -19
- package/dist/Collapse/Collapse.test.js.map +0 -1
- package/dist/Collapse/Collapse.types.js +0 -2
- package/dist/Collapse/Collapse.types.js.map +0 -1
- package/dist/Collapse/index.js +0 -2
- package/dist/Collapse/index.js.map +0 -1
- package/dist/Icon/Icon.js +0 -55
- package/dist/Icon/Icon.js.map +0 -1
- package/dist/Icon/Icon.stories.js +0 -47
- package/dist/Icon/Icon.stories.js.map +0 -1
- package/dist/Icon/Icon.test.js +0 -55
- package/dist/Icon/Icon.test.js.map +0 -1
- package/dist/Icon/Icon.types.js +0 -16
- package/dist/Icon/Icon.types.js.map +0 -1
- package/dist/Icon/index.js +0 -2
- package/dist/Icon/index.js.map +0 -1
- package/dist/InputGroup/InputGroup.js +0 -35
- package/dist/InputGroup/InputGroup.js.map +0 -1
- package/dist/InputGroup/InputGroup.stories.js +0 -176
- package/dist/InputGroup/InputGroup.stories.js.map +0 -1
- package/dist/InputGroup/InputGroup.test.js +0 -43
- package/dist/InputGroup/InputGroup.test.js.map +0 -1
- package/dist/InputGroup/InputGroup.types.js +0 -2
- package/dist/InputGroup/InputGroup.types.js.map +0 -1
- package/dist/InputGroup/index.js +0 -2
- package/dist/InputGroup/index.js.map +0 -1
- package/dist/Modal/Modal.js +0 -100
- package/dist/Modal/Modal.js.map +0 -1
- package/dist/Modal/Modal.stories.js +0 -127
- package/dist/Modal/Modal.stories.js.map +0 -1
- package/dist/Modal/Modal.test.js +0 -108
- package/dist/Modal/Modal.test.js.map +0 -1
- package/dist/Modal/Modal.types.js +0 -2
- package/dist/Modal/Modal.types.js.map +0 -1
- package/dist/Modal/index.js +0 -2
- package/dist/Modal/index.js.map +0 -1
- package/dist/ProgressBar/ProgressBar.js +0 -70
- package/dist/ProgressBar/ProgressBar.js.map +0 -1
- package/dist/ProgressBar/ProgressBar.stories.js +0 -83
- package/dist/ProgressBar/ProgressBar.stories.js.map +0 -1
- package/dist/ProgressBar/ProgressBar.test.js +0 -44
- package/dist/ProgressBar/ProgressBar.test.js.map +0 -1
- package/dist/ProgressBar/ProgressBar.types.js +0 -2
- package/dist/ProgressBar/ProgressBar.types.js.map +0 -1
- package/dist/ProgressBar/index.js +0 -2
- package/dist/ProgressBar/index.js.map +0 -1
- package/dist/SeeqActionDropdown/SeeqActionDropdown.js +0 -48
- package/dist/SeeqActionDropdown/SeeqActionDropdown.js.map +0 -1
- package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js +0 -87
- package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js.map +0 -1
- package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js +0 -73
- package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js.map +0 -1
- package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js +0 -2
- package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js.map +0 -1
- package/dist/SeeqActionDropdown/index.js +0 -2
- package/dist/SeeqActionDropdown/index.js.map +0 -1
- package/dist/SeeqActionDropdown/variants.js +0 -38
- package/dist/SeeqActionDropdown/variants.js.map +0 -1
- package/dist/Select/Select.js +0 -177
- package/dist/Select/Select.js.map +0 -1
- package/dist/Select/Select.stories.js +0 -80
- package/dist/Select/Select.stories.js.map +0 -1
- package/dist/Select/Select.test.js +0 -182
- package/dist/Select/Select.test.js.map +0 -1
- package/dist/Select/Select.types.js +0 -2
- package/dist/Select/Select.types.js.map +0 -1
- package/dist/Select/index.js +0 -3
- package/dist/Select/index.js.map +0 -1
- package/dist/Slider/Slider.js +0 -13
- package/dist/Slider/Slider.js.map +0 -1
- package/dist/Slider/Slider.stories.js +0 -58
- package/dist/Slider/Slider.stories.js.map +0 -1
- package/dist/Slider/Slider.test.js +0 -33
- package/dist/Slider/Slider.test.js.map +0 -1
- package/dist/Slider/Slider.types.js +0 -2
- package/dist/Slider/Slider.types.js.map +0 -1
- package/dist/Slider/index.js +0 -2
- package/dist/Slider/index.js.map +0 -1
- package/dist/SvgIcon/SvgIcon.js +0 -30
- package/dist/SvgIcon/SvgIcon.js.map +0 -1
- package/dist/SvgIcon/SvgIcon.stories.js +0 -42
- package/dist/SvgIcon/SvgIcon.stories.js.map +0 -1
- package/dist/SvgIcon/SvgIcon.test.js +0 -41
- package/dist/SvgIcon/SvgIcon.test.js.map +0 -1
- package/dist/SvgIcon/SvgIcon.types.js +0 -6
- package/dist/SvgIcon/SvgIcon.types.js.map +0 -1
- package/dist/SvgIcon/index.js +0 -2
- package/dist/SvgIcon/index.js.map +0 -1
- package/dist/Tabs/Tabs.js +0 -22
- package/dist/Tabs/Tabs.js.map +0 -1
- package/dist/Tabs/Tabs.stories.js +0 -91
- package/dist/Tabs/Tabs.stories.js.map +0 -1
- package/dist/Tabs/Tabs.test.js +0 -91
- package/dist/Tabs/Tabs.test.js.map +0 -1
- package/dist/Tabs/Tabs.types.js +0 -2
- package/dist/Tabs/Tabs.types.js.map +0 -1
- package/dist/Tabs/index.js +0 -2
- package/dist/Tabs/index.js.map +0 -1
- package/dist/TextArea/TextArea.js +0 -25
- package/dist/TextArea/TextArea.js.map +0 -1
- package/dist/TextArea/TextArea.stories.js +0 -46
- package/dist/TextArea/TextArea.stories.js.map +0 -1
- package/dist/TextArea/TextArea.test.js +0 -68
- package/dist/TextArea/TextArea.test.js.map +0 -1
- package/dist/TextArea/TextArea.types.js +0 -2
- package/dist/TextArea/TextArea.types.js.map +0 -1
- package/dist/TextArea/index.js +0 -2
- package/dist/TextArea/index.js.map +0 -1
- package/dist/TextField/TextField.js +0 -79
- package/dist/TextField/TextField.js.map +0 -1
- package/dist/TextField/TextField.stories.js +0 -70
- package/dist/TextField/TextField.stories.js.map +0 -1
- package/dist/TextField/TextField.test.js +0 -39
- package/dist/TextField/TextField.test.js.map +0 -1
- package/dist/TextField/TextField.types.js +0 -2
- package/dist/TextField/TextField.types.js.map +0 -1
- package/dist/TextField/index.js +0 -2
- package/dist/TextField/index.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.js +0 -69
- package/dist/ToolbarButton/ToolbarButton.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.stories.js +0 -97
- package/dist/ToolbarButton/ToolbarButton.stories.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.test.js +0 -93
- package/dist/ToolbarButton/ToolbarButton.test.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.types.js +0 -2
- package/dist/ToolbarButton/ToolbarButton.types.js.map +0 -1
- package/dist/ToolbarButton/index.js +0 -2
- package/dist/ToolbarButton/index.js.map +0 -1
- package/dist/Tooltip/QTip.stories.js +0 -45
- package/dist/Tooltip/QTip.stories.js.map +0 -1
- package/dist/Tooltip/QTip.types.js +0 -2
- package/dist/Tooltip/QTip.types.js.map +0 -1
- package/dist/Tooltip/QTipPerformance.stories.js +0 -30
- package/dist/Tooltip/QTipPerformance.stories.js.map +0 -1
- package/dist/Tooltip/Qtip.js +0 -168
- package/dist/Tooltip/Qtip.js.map +0 -1
- package/dist/Tooltip/Tooltip.js +0 -36
- package/dist/Tooltip/Tooltip.js.map +0 -1
- package/dist/Tooltip/Tooltip.stories.js +0 -32
- package/dist/Tooltip/Tooltip.stories.js.map +0 -1
- package/dist/Tooltip/Tooltip.types.js +0 -3
- package/dist/Tooltip/Tooltip.types.js.map +0 -1
- package/dist/Tooltip/TooltipPerformance.stories.js +0 -30
- package/dist/Tooltip/TooltipPerformance.stories.js.map +0 -1
- package/dist/Tooltip/index.js +0 -3
- package/dist/Tooltip/index.js.map +0 -1
- package/dist/Tooltip/qTip.utilities.js +0 -11
- package/dist/Tooltip/qTip.utilities.js.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/browserId.js +0 -29
- package/dist/utils/browserId.js.map +0 -1
- package/dist/utils/svg.js +0 -20
- package/dist/utils/svg.js.map +0 -1
- package/dist/utils/validateStyleDimension.js +0 -14
- package/dist/utils/validateStyleDimension.js.map +0 -1
- package/dist/utils/validateStyleDimension.test.js +0 -20
- package/dist/utils/validateStyleDimension.test.js.map +0 -1
|
@@ -1,68 +0,0 @@
|
|
|
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 { TextArea } from './TextArea';
|
|
6
|
-
describe('TextArea', () => {
|
|
7
|
-
class Context {
|
|
8
|
-
testId = 'textAreaTestId';
|
|
9
|
-
props = {
|
|
10
|
-
onChange: jest.fn(),
|
|
11
|
-
onKeyUp: jest.fn(),
|
|
12
|
-
testId: this.testId,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
let tc;
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
tc = new Context();
|
|
18
|
-
});
|
|
19
|
-
const renderTextArea = (props) => render(React.createElement(TextArea, { ...props }));
|
|
20
|
-
it('renders the provided value', () => {
|
|
21
|
-
const value = 'hello, this is text for a text area.';
|
|
22
|
-
renderTextArea({ ...tc.props, value });
|
|
23
|
-
expect(screen.getByDisplayValue(value)).toBeInTheDocument();
|
|
24
|
-
});
|
|
25
|
-
it('renders the provided placeholder', () => {
|
|
26
|
-
const placeholder = 'Prompt to enter';
|
|
27
|
-
renderTextArea({ ...tc.props, placeholder });
|
|
28
|
-
expect(screen.getByPlaceholderText(placeholder)).toBeInTheDocument();
|
|
29
|
-
});
|
|
30
|
-
it('calls onChange handler', async () => {
|
|
31
|
-
renderTextArea({ ...tc.props });
|
|
32
|
-
await userEvent.type(screen.getByTestId(tc.testId), 'trigger');
|
|
33
|
-
expect(tc.props.onChange).toHaveBeenCalled();
|
|
34
|
-
});
|
|
35
|
-
it('calls the onKeyUp handler', async () => {
|
|
36
|
-
renderTextArea({ ...tc.props });
|
|
37
|
-
await userEvent.type(screen.getByTestId(tc.testId), 'trigger');
|
|
38
|
-
expect(tc.props.onKeyUp).toHaveBeenCalled();
|
|
39
|
-
});
|
|
40
|
-
it('respects readOnly', async () => {
|
|
41
|
-
renderTextArea({ ...tc.props, disabled: true });
|
|
42
|
-
expect(screen.getByTestId(tc.testId)).not.toBeEnabled();
|
|
43
|
-
});
|
|
44
|
-
it('provides rows', async () => {
|
|
45
|
-
renderTextArea({ ...tc.props, rows: 7 });
|
|
46
|
-
expect(screen.getByTestId(tc.testId)).toHaveProperty('rows', 7);
|
|
47
|
-
});
|
|
48
|
-
it('provides cols', async () => {
|
|
49
|
-
renderTextArea({ ...tc.props, cols: 8 });
|
|
50
|
-
expect(screen.getByTestId(tc.testId)).toHaveProperty('cols', 8);
|
|
51
|
-
});
|
|
52
|
-
it('provides name', async () => {
|
|
53
|
-
const name = 'myTextArea';
|
|
54
|
-
renderTextArea({ ...tc.props, name });
|
|
55
|
-
expect(screen.getByTestId(tc.testId)).toHaveProperty('name', name);
|
|
56
|
-
});
|
|
57
|
-
it('provides id', async () => {
|
|
58
|
-
const id = 'myTextId';
|
|
59
|
-
renderTextArea({ ...tc.props, id });
|
|
60
|
-
expect(screen.getByTestId(tc.testId)).toHaveProperty('id', id);
|
|
61
|
-
});
|
|
62
|
-
it('provides extraClassNames', async () => {
|
|
63
|
-
const extraClassNames = 'extra css';
|
|
64
|
-
renderTextArea({ ...tc.props, extraClassNames });
|
|
65
|
-
expect(screen.getByTestId(tc.testId)).toHaveClass(extraClassNames);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
//# sourceMappingURL=TextArea.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.test.js","sourceRoot":"","sources":["../../src/TextArea/TextArea.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,MAAM,OAAO;QACX,MAAM,GAAG,gBAAgB,CAAC;QAC1B,KAAK,GAAkB;YACrB,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;YACnB,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;YAClB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;KACH;IAED,IAAI,EAAW,CAAC;IAChB,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IACH,MAAM,cAAc,GAAG,CAAC,KAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,oBAAC,QAAQ,OAAK,KAAK,GAAI,CAAC,CAAC;IAEjF,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,KAAK,GAAG,sCAAsC,CAAC;QACrD,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,WAAW,GAAG,iBAAiB,CA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AAe,EAAE,CAAC,CAAC;QACjD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.types.js","sourceRoot":"","sources":["../../src/TextArea/TextArea.types.ts"],"names":[],"mappings":""}
|
package/dist/TextArea/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/TextArea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import '../styles.css';
|
|
3
|
-
import { setValidInputDimension } from '../utils/validateStyleDimension';
|
|
4
|
-
import { getQTipData } from '../Tooltip/qTip.utilities';
|
|
5
|
-
const errorClasses = 'tw-border-sq-danger-color';
|
|
6
|
-
const borderColorClasses = [
|
|
7
|
-
'tw-border-sq-disabled-gray',
|
|
8
|
-
'dark:tw-border-sq-dark-disabled-gray',
|
|
9
|
-
'dark:focus:tw-border-sq-color-dark-dark',
|
|
10
|
-
'dark:active:tw-border-sq-color-dark-dark',
|
|
11
|
-
'focus:tw-border-sq-color-dark',
|
|
12
|
-
'active:tw-border-sq-color-dark',
|
|
13
|
-
].join(' ');
|
|
14
|
-
const baseClasses = 'tw-h-inputs tw-leading-normal tw-outline-none tw-py-1 tw-px-3' +
|
|
15
|
-
' disabled:tw-pointer-events-none disabled:tw-bg-sq-light-gray disabled:dark:tw-bg-sq-dark-disabled-gray' +
|
|
16
|
-
' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border tw-placeholder-gray-400' +
|
|
17
|
-
' dark:tw-placeholder-sq-dark-text-lighter specTextField';
|
|
18
|
-
const darkTheme = 'dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text disabled:dark:tw-text-sq-dark-text-lighter';
|
|
19
|
-
const lightTheme = 'tw-text-sq-text-color disabled:tw-text-sq-darkish-gray';
|
|
20
|
-
const sizeClasses = {
|
|
21
|
-
sm: 'tw-text-sm',
|
|
22
|
-
lg: 'tw-text-xl',
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Textfield.
|
|
26
|
-
*/
|
|
27
|
-
export const TextField = React.forwardRef((props, ref) => {
|
|
28
|
-
const { readonly = false, disabled = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, id, name, size = 'sm', value, placeholder, extraClassNames, testId, type = 'text', inputGroup, step, showError, errorText, min, max, maxLength, minLength, required = false, autoComplete = 'off', inputWidth = undefined, inputHeight = undefined, autoFocus = false, ...tooltipProps } = props;
|
|
29
|
-
const internalRef = useRef(null);
|
|
30
|
-
const [cursor, setCursor] = useState(null);
|
|
31
|
-
const tooltipData = getQTipData(tooltipProps);
|
|
32
|
-
const setAllRefs = (receivedRef) => {
|
|
33
|
-
if (ref)
|
|
34
|
-
ref.current = receivedRef;
|
|
35
|
-
internalRef.current = receivedRef;
|
|
36
|
-
};
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
const input = internalRef.current;
|
|
39
|
-
if (input && type !== 'number' && type !== 'email')
|
|
40
|
-
input.setSelectionRange(cursor, cursor);
|
|
41
|
-
}, [ref, cursor, value]);
|
|
42
|
-
const handleChange = (e) => {
|
|
43
|
-
setCursor(e.target.selectionStart);
|
|
44
|
-
onChange && onChange(e);
|
|
45
|
-
};
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
/**
|
|
48
|
-
* we need to change the value only if it's different since the internal state of "input" will change it anyway
|
|
49
|
-
* this will only be the case when the value has been changed externally via store (undo / redo)
|
|
50
|
-
*/
|
|
51
|
-
if (value !== null && value !== undefined && value !== internalRef.current?.value && internalRef.current) {
|
|
52
|
-
// we need to use this method because using the value props directly will switch the input to a "controlled"
|
|
53
|
-
// component
|
|
54
|
-
internalRef.current.value = `${value}`;
|
|
55
|
-
}
|
|
56
|
-
}, [value]);
|
|
57
|
-
let borderRadius = 'tw-rounded-md';
|
|
58
|
-
if (inputGroup === 'left') {
|
|
59
|
-
borderRadius = 'tw-rounded-l-md tw-border-r-0 focus:tw-border-r' + ' active:tw-border-r';
|
|
60
|
-
}
|
|
61
|
-
else if (inputGroup === 'right') {
|
|
62
|
-
borderRadius = 'tw-rounded-r-md tw-border-l-0 focus:tw-border-l active:tw-border-l';
|
|
63
|
-
}
|
|
64
|
-
const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames} ${lightTheme} ${darkTheme} ${borderRadius} ${showError ? errorClasses : borderColorClasses} `;
|
|
65
|
-
const inputProp = setValidInputDimension(inputWidth, inputHeight)
|
|
66
|
-
? {
|
|
67
|
-
style: setValidInputDimension(inputWidth, inputHeight),
|
|
68
|
-
}
|
|
69
|
-
: {};
|
|
70
|
-
const inputLenghtProp = {};
|
|
71
|
-
if (maxLength)
|
|
72
|
-
inputLenghtProp.maxLength = maxLength;
|
|
73
|
-
if (minLength)
|
|
74
|
-
inputLenghtProp.minLength = minLength;
|
|
75
|
-
return (React.createElement(React.Fragment, null,
|
|
76
|
-
React.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required, autoFocus: autoFocus, min: min, max: max, ...inputLenghtProp, ...inputProp, ...tooltipData }),
|
|
77
|
-
errorText && showError && React.createElement("div", { className: "tw-text-sq-danger-color tw-text-xs tw-mt-1" }, errorText)));
|
|
78
|
-
});
|
|
79
|
-
//# sourceMappingURL=TextField.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","sourceRoot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AAS,KACT,WAAW,GACf;QACD,SAAS,IAAI,SAAS,IAAI,6BAAK,SAAS,EAAC,4CAA4C,IAAE,SAAS,CAAO,CACvG,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TextField } from './TextField';
|
|
3
|
-
import { QTip } from '../Tooltip';
|
|
4
|
-
export default {
|
|
5
|
-
title: 'TextField',
|
|
6
|
-
};
|
|
7
|
-
export const AllTextFields = () => {
|
|
8
|
-
const renderAllVariations = () => (React.createElement(React.Fragment, null,
|
|
9
|
-
React.createElement("div", { className: "tw-p-4 light" },
|
|
10
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
11
|
-
React.createElement(TextField, { value: "value provided" })),
|
|
12
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
13
|
-
React.createElement(TextField, { placeholder: "placeholder text" })),
|
|
14
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
15
|
-
React.createElement(TextField, { placeholder: "with error", showError: true })),
|
|
16
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
17
|
-
React.createElement(TextField, { placeholder: "with error text", showError: true, errorText: "this is a major test error and it is long on purpose to see its looks" })),
|
|
18
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
19
|
-
React.createElement(TextField, { value: "read-only", readonly: true, onFocus: (e) => e.currentTarget.select() })),
|
|
20
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
21
|
-
React.createElement(TextField, { value: "disabled", disabled: true, onFocus: (e) => e.currentTarget.select() })),
|
|
22
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
23
|
-
React.createElement("div", null, "max value = 10"),
|
|
24
|
-
React.createElement(TextField, { type: "number", value: 20, max: 10 })),
|
|
25
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
26
|
-
React.createElement("div", null, "min value = 2"),
|
|
27
|
-
React.createElement(TextField, { type: "number", value: 1, min: 2 })),
|
|
28
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
29
|
-
React.createElement(TextField, { value: "large", size: "lg" })),
|
|
30
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
31
|
-
React.createElement(TextField, { value: "with tooltip", tooltip: "small tooltip" }))),
|
|
32
|
-
React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
|
|
33
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
34
|
-
React.createElement(TextField, { value: "value provided" })),
|
|
35
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
36
|
-
React.createElement(TextField, { placeholder: "placeholder text" })),
|
|
37
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
38
|
-
React.createElement(TextField, { placeholder: "with error", showError: true })),
|
|
39
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
40
|
-
React.createElement(TextField, { placeholder: "with error text", showError: true, errorText: "this is a major test error and it is long on purpose to see its looks" })),
|
|
41
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
42
|
-
React.createElement(TextField, { value: "read-only", readonly: true, onFocus: (e) => e.currentTarget.select() })),
|
|
43
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
44
|
-
React.createElement(TextField, { value: "disabled", disabled: true, onFocus: (e) => e.currentTarget.select() })),
|
|
45
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
46
|
-
React.createElement("div", { className: "tw-text-sq-color-dark dark:tw-text-sq-color-dark-dark" }, "max value = 10"),
|
|
47
|
-
React.createElement(TextField, { type: "number", value: 8, max: 10 })),
|
|
48
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
49
|
-
React.createElement("div", { className: "tw-text-sq-color-dark dark:tw-text-sq-color-dark-dark" }, "min value = 2"),
|
|
50
|
-
React.createElement(TextField, { type: "number", value: 10, min: 2 })),
|
|
51
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
52
|
-
React.createElement(TextField, { value: "large", size: "lg" })),
|
|
53
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
54
|
-
React.createElement(TextField, { value: "with tooltip", tooltip: "small tooltip" })))));
|
|
55
|
-
return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
|
|
56
|
-
React.createElement(QTip, null),
|
|
57
|
-
React.createElement("div", { className: "color_topic" },
|
|
58
|
-
React.createElement("b", null, "Topic Colors"),
|
|
59
|
-
renderAllVariations()),
|
|
60
|
-
React.createElement("div", { className: "color_analysis" },
|
|
61
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
62
|
-
renderAllVariations()),
|
|
63
|
-
React.createElement("div", { className: "color_datalab" },
|
|
64
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
65
|
-
renderAllVariations()),
|
|
66
|
-
React.createElement("div", { className: "color_vantage" },
|
|
67
|
-
React.createElement("b", null, "Vantage Colors"),
|
|
68
|
-
renderAllVariations())));
|
|
69
|
-
};
|
|
70
|
-
//# sourceMappingURL=TextField.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,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,IAAC,KAAK,EAAC,gBAAgB,GAAG,CAChC;YACN,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,SAAS,IAAC,WAAW,EAAC,kBAAkB,GAAG,CACxC;YACN,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,SAAS,IAAC,WAAW,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K,SAAS,EAAC,QAAQ;gBACrB,oBAAC,SAAS,IAAC,KAAK,EAAC,cAAc,EAAC,OAAO,EAAC,eAAe,GAAG,CACtD,CACF,CACL,CACJ,CAAC;IACF,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,oBAAC,IAAI,OAAG;QACR,6BAAK,SAAS,EAAC,aAAa;YAC1B,8CAAmB;YAClB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,iDAAsB;YACrB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,EAAE,CAClB,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
it('autofocuses the textfield', async () => {
|
|
35
|
-
renderTextField({ ...tc.props, autoFocus: true });
|
|
36
|
-
expect(screen.getByTestId(tc.testId)).toHaveFocus();
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
//# sourceMappingURL=TextField.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.test.js","sourceRoot":"","sources":["../../src/TextField/TextField.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,OAAO;QACX,MAAM,GAAG,iBAAiB,CAAC;QAC3B,KAAK,GAAmB;YACtB,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;KACH;IAED,IAAI,EAAW,CAAC;IAChB,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IACH,MAAM,eAAe,GAAG,CAAC,KAAqB,EAAE,EAAE,CAAC,MAAM,CAAC,oBAAC,SAAS,OAAK,KAAK,GAAI,CAAC,CAAC;IAEpF,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,M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package/dist/TextField/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/TextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
-
import Icon from '../Icon';
|
|
4
|
-
import { DEFAULT_TOOL_TIP_DELAY } from '../Tooltip/Tooltip.types';
|
|
5
|
-
import { getSvgIconPath } from '../utils/svg';
|
|
6
|
-
const popoverBorderStyles = [
|
|
7
|
-
'tw-border-solid',
|
|
8
|
-
'tw-border',
|
|
9
|
-
'tw-rounded-[10px]',
|
|
10
|
-
'tw-border-sq-disabled-gray',
|
|
11
|
-
'dark:tw-border-gray-500',
|
|
12
|
-
].join(' ');
|
|
13
|
-
const triggerBackgroundStyles = [
|
|
14
|
-
'tw-bg-transparent',
|
|
15
|
-
'hover:tw-bg-sq-light-gray',
|
|
16
|
-
'active:tw-bg-sq-light-gray',
|
|
17
|
-
'dark:tw-bg-transparent',
|
|
18
|
-
'dark:hover:tw-bg-sq-field-disabled-gray',
|
|
19
|
-
'dark:active:tw-bg-sq-field-disabled-gray',
|
|
20
|
-
].join(' ');
|
|
21
|
-
const activeBackgroundStyles = [
|
|
22
|
-
'active',
|
|
23
|
-
'tw-bg-sq-dark-gray',
|
|
24
|
-
'hover:tw-bg-sq-dark-gray',
|
|
25
|
-
'active:tw-bg-sq-dark-gray',
|
|
26
|
-
'dark:tw-bg-sq-field-disabled-gray',
|
|
27
|
-
'dark:hover:tw-border-sq-field-disabled-gray',
|
|
28
|
-
'dark:active:tw-bg-sq-field-disabled-gray',
|
|
29
|
-
].join(' ');
|
|
30
|
-
const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
|
|
31
|
-
const disabledClasses = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
32
|
-
const PopoverContent = React.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (React.createElement(PopoverPrimitive.Content, { ref: ref, align: align, sideOffset: sideOffset, ...props, asChild: true })));
|
|
33
|
-
export const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIcon = false, tooltipText, id, popoverContent, extraClassNames, testId, tooltipTestId, tooltipOptions, isActive = false, isHtmlTooltip = false, hasArrow = false, disabled = false, isPrimaryAnSvg = false, primaryIconExtraClassNames = false, iconHeight = 24, iconWidth = 24, primaryIconViewbox = '0 0 24 24', onClick, onHide, }) => {
|
|
34
|
-
let tooltipData = undefined;
|
|
35
|
-
if (tooltipText) {
|
|
36
|
-
tooltipData = {
|
|
37
|
-
'data-qtip-text': tooltipText,
|
|
38
|
-
'data-qtip-placement': tooltipOptions?.position,
|
|
39
|
-
'data-qtip-is-html': isHtmlTooltip,
|
|
40
|
-
'data-qtip-testid': tooltipTestId,
|
|
41
|
-
'data-qtip-delay': tooltipOptions?.delay ?? DEFAULT_TOOL_TIP_DELAY,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
const onOpenChange = (open) => {
|
|
45
|
-
if (!open) {
|
|
46
|
-
onHide && onHide();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
return (React.createElement(PopoverPrimitive.Root, { defaultOpen: false, onOpenChange: onOpenChange },
|
|
50
|
-
React.createElement(PopoverPrimitive.Trigger, { id: id, className: `tw-border-none tw-mx-[1.5px] first:tw-ml-0 last:tw-mr-0 ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, onClick: (e) => {
|
|
51
|
-
onClick && onClick(e);
|
|
52
|
-
} },
|
|
53
|
-
React.createElement("div", { ...tooltipData, className: `tw-flex tw-flex-col tw-items-center tw-rounded-[10px] ${isSmall ? 'tw-py-[1px] tw-px-1' : 'tw-px-2 tw-py-[5px]'} ${disabled ? disabledClasses : isActive ? activeBackgroundStyles : triggerBackgroundStyles} ${extraClassNames || ''}` },
|
|
54
|
-
React.createElement("span", { className: "tw-nowrap" },
|
|
55
|
-
isPrimaryAnSvg ? (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: `tw-text-sq-text-color dark:tw-text-sq-dark-text ${primaryIconExtraClassNames || ''}`, viewBox: primaryIconViewbox, height: `${iconHeight}px`, width: `${iconWidth}px`, fill: "currentColor", "data-testid": testId },
|
|
56
|
-
React.createElement("path", { d: getSvgIconPath(icon) }))) : (React.createElement(Icon, { icon: icon, testId: "firstIcon", type: "text", large: !isSmall && !label && !secondIcon && !forceSmallIcon, extraClassNames: `tw-text-sq-text-color dark:tw-text-sq-dark-text` })),
|
|
57
|
-
secondIcon && React.createElement(Icon, { icon: secondIcon, type: "text", testId: "secondIcon" }),
|
|
58
|
-
popoverContent ? (React.createElement(Icon, { icon: "fc-arrow-dropdown", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-ml-[3px] tw-text-[8px]", type: "text" })) : undefined),
|
|
59
|
-
!isSmall && (React.createElement("small", { className: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-text-[10px]" }, label)))),
|
|
60
|
-
!!popoverContent ? (React.createElement(PopoverContent, { sideOffset: 2, align: "start" },
|
|
61
|
-
React.createElement("div", { className: bgStyles +
|
|
62
|
-
' tw-relative tw-z-[1000] tw-min-w-6 tw-p-[0.5rem] focus-visible:tw-outline-none tw-outline-none data-[state=open]:animate-in data-[state=closed]:animate-out' +
|
|
63
|
-
' data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2' +
|
|
64
|
-
popoverBorderStyles },
|
|
65
|
-
hasArrow && (React.createElement(PopoverPrimitive.Arrow, { asChild: true },
|
|
66
|
-
React.createElement("div", { className: " tw-fill-transparent tw-bg-white tw-w-[15px] tw-h-[15px] tw-mt-[-7px] tw-rotate-45 dark:tw-bg-sq-dark-background tw-border-b tw-border-r tw-border-sq-disabled-gray dark:tw-border-gray-500" }))),
|
|
67
|
-
popoverContent))) : undefined));
|
|
68
|
-
};
|
|
69
|
-
//# sourceMappingURL=ToolbarButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarButton.js","sourceRoot":"","sources":["../../src/ToolbarButton/ToolbarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAE5D,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,mBAAmB,GAAG;IAC1B,iBAAiB;IACjB,WAAW;IACX,mBAAmB;IACnB,4BAA4B;IAC5B,yBAAyB;CAC1B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,uBAAuB,GAAG;IAC9B,mBAAmB;IACnB,2BAA2B;IAC3B,4BAA4B;IAC5B,wBAAwB;IACxB,yCAAyC;IACzC,0CAA0C;CAC3C,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,sBAAsB,GAAG;IAC7B,QAAQ;IACR,oBAAoB;IACpB,0BAA0B;IAC1B,2BAA2B;IAC3B,mCAAmC;IACnC,6CAA6C;IAC7C,0CAA0C;CAC3C,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,QAAQ,GAAG,CAAC,gBAAgB,EAAE,+BAA+B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/E,MAAM,eAAe,GAAG,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAA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I,EAAC,MAAM,EAAC,MAAM,EAAC,YAAY,GAAG;oBACxE,cAAc,CAAC,CAAC,CAAC,CAChB,oBAAC,IAAI,IACH,IAAI,EAAC,mBAAmB,EACxB,eAAe,EAAC,2EAA2E,EAC3F,IAAI,EAAC,MAAM,GACX,CACH,CAAC,CAAC,CAAC,SAAS,CACR;gBACN,CAAC,OAAO,IAAI,CACX,+BAAO,SAAS,EAAC,gEAAgE,IAAE,KAAK,CAAS,CAClG,CACG,CACmB;QAC1B,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAClB,oBAAC,cAAc,IAAC,UAAU,EAAE,CAAC,EAAE,KAAK,EAAC,OAAO;YAC1C,6BACE,SAAS,EACP,QAAQ;oBACR,8JAA8J;oBAC9J,sRAAsR;oBACtR,mBAAmB;gBAEpB,QAAQ,IAAI,CACX,oBAAC,gBAAgB,CAAC,KAAK,IAAC,OAAO;oBAC7B,6BAAK,SAAS,EAAC,6LAA6L,GAAG,CACxL,CAC1B;gBACA,cAAc,CACX,CACS,CAClB,CAAC,CAAC,CAAC,SAAS,CACS,CACzB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ToolbarButton } from './ToolbarButton';
|
|
3
|
-
import Icon from '../Icon';
|
|
4
|
-
import { QTip } from '../Tooltip/Qtip';
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Toolbar Button',
|
|
7
|
-
};
|
|
8
|
-
export const AllToolbarButtonVariants = () => {
|
|
9
|
-
const options = [
|
|
10
|
-
{ value: 'a', label: 'Chocolate' },
|
|
11
|
-
{ value: 'b', label: 'Strawberry' },
|
|
12
|
-
{ value: 'c', label: 'Vanilla' },
|
|
13
|
-
{ value: 'd', label: 'Rocky Road' },
|
|
14
|
-
{ value: 'e', label: 'Crazy Cow' },
|
|
15
|
-
{ value: 'f', label: 'Almond Joy' },
|
|
16
|
-
{ value: 'g', label: 'All of the above' },
|
|
17
|
-
];
|
|
18
|
-
const colorOptions = [
|
|
19
|
-
{ value: 'h', label: 'pink' },
|
|
20
|
-
{ value: 'i', label: 'purple' },
|
|
21
|
-
{ value: 'j', label: 'green' },
|
|
22
|
-
{ value: 'k', label: 'red' },
|
|
23
|
-
];
|
|
24
|
-
const allToolbarButtons = (isDark) => (React.createElement("div", { className: isDark ? 'tw-dark tw-bg-sq-dark-background' : '' },
|
|
25
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
26
|
-
React.createElement(ToolbarButton, { icon: "fc-y-axis", label: "Popover", testId: "basic-popover1", tooltipText: "This is a small popover.", tooltipOptions: { position: 'top', delay: 0 }, isHtmlTooltip: false, isSmall: true, popoverContent: React.createElement("div", { className: "tw-text-sm dark:tw-text-white" },
|
|
27
|
-
React.createElement("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2" }, "Flavors"),
|
|
28
|
-
options.map((option) => (React.createElement("div", { key: option.value, className: "tw-flex tw-items-center tw-p-2 hover:tw-bg-green-500" },
|
|
29
|
-
React.createElement(Icon, { type: "color", color: "green", icon: "fc-check", extraClassNames: "tw-mr-2" }),
|
|
30
|
-
React.createElement("span", null, option.label)))),
|
|
31
|
-
React.createElement("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2" }, "Colors"),
|
|
32
|
-
colorOptions.map((option) => (React.createElement("div", { key: option.value, className: "tw-flex tw-items-center tw-p-2" },
|
|
33
|
-
React.createElement(Icon, { type: "color", color: "green", icon: "fc-check", extraClassNames: "tw-mr-2" }),
|
|
34
|
-
React.createElement("span", null, option.label))))) })),
|
|
35
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
36
|
-
React.createElement(ToolbarButton, { icon: "fc-y-axis", label: "Normal", testId: "basic-popover1", tooltipText: "This is a normal popover.", tooltipOptions: { position: 'top', delay: 0 }, isHtmlTooltip: false, popoverContent: React.createElement("div", { className: "tw-text-sm dark:tw-text-white" },
|
|
37
|
-
React.createElement("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2" }, "Flavors"),
|
|
38
|
-
options.map((option) => (React.createElement("div", { key: option.value, className: "tw-flex tw-items-center tw-p-2 hover:tw-bg-green-500" },
|
|
39
|
-
React.createElement(Icon, { type: "color", color: "green", icon: "fc-check", extraClassNames: "tw-mr-2" }),
|
|
40
|
-
React.createElement("span", null, option.label)))),
|
|
41
|
-
React.createElement("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2" }, "Colors"),
|
|
42
|
-
colorOptions.map((option) => (React.createElement("div", { key: option.value, className: "tw-flex tw-items-center tw-p-2" },
|
|
43
|
-
React.createElement(Icon, { type: "color", color: "green", icon: "fc-check", extraClassNames: "tw-mr-2" }),
|
|
44
|
-
React.createElement("span", null, option.label))))) })),
|
|
45
|
-
React.createElement("div", { className: "tw-p-5 tw-flex" },
|
|
46
|
-
React.createElement(ToolbarButton, { icon: "fc-y-axis", label: "With arrow", testId: "basic-popover1", tooltipText: "This is a normal popover.", tooltipOptions: { position: 'top', delay: 0 }, hasArrow: true, isHtmlTooltip: false, popoverContent: React.createElement("div", { className: "tw-text-sm dark:tw-text-white" },
|
|
47
|
-
React.createElement("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2" }, "Flavors"),
|
|
48
|
-
options.map((option) => (React.createElement("div", { key: option.value, className: "tw-flex tw-items-center tw-p-2 hover:tw-bg-green-500" },
|
|
49
|
-
React.createElement(Icon, { type: "color", color: "green", icon: "fc-check", extraClassNames: "tw-mr-2" }),
|
|
50
|
-
React.createElement("span", null, option.label)))),
|
|
51
|
-
React.createElement("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2" }, "Colors"),
|
|
52
|
-
colorOptions.map((option) => (React.createElement("div", { key: option.value, className: "tw-flex tw-items-center tw-p-2" },
|
|
53
|
-
React.createElement(Icon, { type: "color", color: "green", icon: "fc-check", extraClassNames: "tw-mr-2" }),
|
|
54
|
-
React.createElement("span", null, option.label))))) }),
|
|
55
|
-
React.createElement(ToolbarButton, { icon: "fc-y-axis", tooltipText: "This is a large popover icon", tooltipOptions: { position: 'top', delay: 0 }, testId: "basic-popover4", isHtmlTooltip: false })),
|
|
56
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
57
|
-
React.createElement("p", { className: "tw-text-sq-color-dark tw-text-[10px]" }, "Without popup"),
|
|
58
|
-
React.createElement(ToolbarButton, { icon: "fc-y-axis", label: "Button", testId: "basic-popover3", isHtmlTooltip: false })),
|
|
59
|
-
React.createElement("div", { className: "tw-p-5 tw-flex" },
|
|
60
|
-
React.createElement(ToolbarButton, { icon: "fc-y-axis", label: "Disabled", testId: "basic-popover2", tooltipText: "This is a popover.", tooltipOptions: { position: 'top' }, isHtmlTooltip: false, disabled: true, popoverContent: React.createElement("div", { className: "tw-border tw-border-gray-100 tw-p-2 tw-rounded-sm tw-text-sm dark:tw-bg-sq-dark-background" },
|
|
61
|
-
React.createElement("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2" }, "Flavors"),
|
|
62
|
-
options.map((option) => (React.createElement("div", { key: option.value, className: "tw-flex tw-items-center tw-p-2 hover:tw-bg-green-500" },
|
|
63
|
-
React.createElement(Icon, { type: "color", color: "green", icon: "fc-check", extraClassNames: "tw-mr-2" }),
|
|
64
|
-
React.createElement("span", null, option.label)))),
|
|
65
|
-
React.createElement("p", { className: "tw-bg-gray-200 dark:tw-bg-gray-700 tw-p-2" }, "Colors"),
|
|
66
|
-
colorOptions.map((option) => (React.createElement("div", { key: option.value, className: "tw-flex tw-items-center tw-p-2" },
|
|
67
|
-
React.createElement(Icon, { type: "color", color: "green", icon: "fc-check", extraClassNames: "tw-mr-2" }),
|
|
68
|
-
React.createElement("span", null, option.label))))) })),
|
|
69
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
70
|
-
React.createElement(ToolbarButton, { id: "scatterPlotFlipXY", isActive: false, disabled: true, testId: "scatterPlotFlipXY", label: "", icon: "fc-grab-window", tooltipText: "This is a large disabled popover.", tooltipOptions: { position: 'top' }, extraClassNames: "no-border ml5" })),
|
|
71
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
72
|
-
React.createElement(ToolbarButton, { icon: "fc-y-axis", tooltipText: "This is a large popover icon", tooltipOptions: { position: 'top', delay: 0 }, testId: "basic-popover4", isHtmlTooltip: false })),
|
|
73
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
74
|
-
React.createElement(ToolbarButton, { icon: "fc-y-axis", label: "Active", testId: "basic-popover5", tooltipText: "This is a button.", tooltipOptions: { position: 'top', delay: 0 }, isHtmlTooltip: false, isActive: true })),
|
|
75
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
76
|
-
React.createElement(ToolbarButton, { isPrimaryAnSvg: true, iconHeight: 13, iconWidth: 13, icon: "svgpath:M 19 2.76 L 18.016 4.066 L 7.678 17.765 L 6.745 19 L 5.812 17.765 L 0.984 11.373 L 0 10.067 L 1.867 7.307 L 2.851 8.613 L 6.745 13.771 L 16.149 1.306 L 17.133 0 L 19 2.76 Z", label: "Active", testId: "basic-popover5", tooltipText: "This is a button.", tooltipOptions: { position: 'top', delay: 0 }, isHtmlTooltip: false, isActive: true }))));
|
|
77
|
-
const renderAllVariations = () => (React.createElement("div", { className: "tw-grid tw-grid-cols-2 tw-gap-4 tw-p-4" },
|
|
78
|
-
allToolbarButtons(),
|
|
79
|
-
allToolbarButtons(true)));
|
|
80
|
-
return (React.createElement("div", null,
|
|
81
|
-
React.createElement("div", { className: "tw-grid tw-grid-cols-2 tw-gap-4" },
|
|
82
|
-
React.createElement(QTip, null),
|
|
83
|
-
React.createElement("div", { className: "color_topic" },
|
|
84
|
-
React.createElement("b", null, "Topic Colors"),
|
|
85
|
-
renderAllVariations()),
|
|
86
|
-
React.createElement("div", { className: "color_analysis" },
|
|
87
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
88
|
-
renderAllVariations())),
|
|
89
|
-
React.createElement("div", { className: "tw-grid tw-grid-cols-2 tw-gap-4" },
|
|
90
|
-
React.createElement("div", { className: "color_datalab" },
|
|
91
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
92
|
-
renderAllVariations()),
|
|
93
|
-
React.createElement("div", { className: "color_vantage" },
|
|
94
|
-
React.createElement("b", null, "Vantage Colors"),
|
|
95
|
-
renderAllVariations()))));
|
|
96
|
-
};
|
|
97
|
-
//# sourceMappingURL=ToolbarButton.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarButton.stories.js","sourceRoot":"","sources":["../../src/ToolbarButton/ToolbarButton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,eAAe;IACb,KAAK,EAAE,gBAAgB;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,MAAM,OAAO,GAAG;QACd,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE;QAClC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE;QACnC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE;QAChC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE;QACnC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE;QAClC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE;QACnC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,EAAE;KAC1C,CAAC;IAEF,MAAM,YAAY,GAAG;QACnB,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE;QAC7B,EAAE,KAAK,EAAE,GAAG,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AAiC;YAC9C,oBAAC,IAAI,OAAG;YACR,6BAAK,SAAS,EAAC,aAAa;gBAC1B,8CAAmB;gBAClB,mBAAmB,EAAE,CAClB;YAEN,6BAAK,SAAS,EAAC,gBAAgB;gBAC7B,iDAAsB;gBACrB,mBAAmB,EAAE,CAClB,CACF;QACN,6BAAK,SAAS,EAAC,iCAAiC;YAC9C,6BAAK,SAAS,EAAC,eAAe;gBAC5B,gDAAqB;gBACpB,mBAAmB,EAAE,CAClB;YAEN,6BAAK,SAAS,EAAC,eAAe;gBAC5B,gDAAqB;gBACpB,mBAAmB,EAAE,CAClB,CACF,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
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 { ToolbarButton } from './ToolbarButton';
|
|
6
|
-
import Icon from '../Icon';
|
|
7
|
-
describe('ToolbarButton', () => {
|
|
8
|
-
const options = [
|
|
9
|
-
{ value: 'a', label: 'Chocolate' },
|
|
10
|
-
{ value: 'b', label: 'Strawberry' },
|
|
11
|
-
{ value: 'c', label: 'Vanilla' },
|
|
12
|
-
{ value: 'd', label: 'Rocky Road' },
|
|
13
|
-
{ value: 'e', label: 'Crazy Cow' },
|
|
14
|
-
{ value: 'f', label: 'Almond Joy' },
|
|
15
|
-
{ value: 'g', label: 'All of the above' },
|
|
16
|
-
];
|
|
17
|
-
const colorOptions = [
|
|
18
|
-
{ value: 'h', label: 'pink' },
|
|
19
|
-
{ value: 'i', label: 'purple' },
|
|
20
|
-
{ value: 'j', label: 'green' },
|
|
21
|
-
{ value: 'k', label: 'red' },
|
|
22
|
-
];
|
|
23
|
-
const popoverContent = (React.createElement("div", { className: "tw-text-sm" },
|
|
24
|
-
React.createElement("p", { className: "tw-bg-gray-200 tw-p-2" }, "Flavors"),
|
|
25
|
-
options.map((option) => (React.createElement("div", { key: option.value, className: "tw-flex tw-items-center tw-p-2 hover:tw-bg-green-500" },
|
|
26
|
-
React.createElement(Icon, { type: "color", color: "green", icon: "fc-check", extraClassNames: "tw-mr-2" }),
|
|
27
|
-
React.createElement("span", null, option.label)))),
|
|
28
|
-
React.createElement("p", null, "Colors"),
|
|
29
|
-
colorOptions.map((option) => (React.createElement("div", { key: option.value, className: "tw-flex tw-items-center tw-p-2" },
|
|
30
|
-
React.createElement(Icon, { type: "color", color: "green", icon: "fc-check", extraClassNames: "tw-mr-2" }),
|
|
31
|
-
React.createElement("span", null, option.label))))));
|
|
32
|
-
const mockOnClick = jest.fn();
|
|
33
|
-
class Context {
|
|
34
|
-
testId = 'popoverTestId';
|
|
35
|
-
label = 'popover label';
|
|
36
|
-
props = {
|
|
37
|
-
label: this.label,
|
|
38
|
-
onClick: mockOnClick,
|
|
39
|
-
testId: this.testId,
|
|
40
|
-
icon: 'fc-y-axis',
|
|
41
|
-
tooltipText: 'This is a popover.',
|
|
42
|
-
tooltipOptions: { position: 'top', delay: 0 },
|
|
43
|
-
isHtmlTooltip: false,
|
|
44
|
-
isSmall: false,
|
|
45
|
-
popoverContent,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
let tc;
|
|
49
|
-
beforeEach(() => {
|
|
50
|
-
tc = new Context();
|
|
51
|
-
jest.clearAllMocks();
|
|
52
|
-
});
|
|
53
|
-
const renderToolbarButton = (props) => render(React.createElement(ToolbarButton, { ...props }));
|
|
54
|
-
const openPopover = async () => {
|
|
55
|
-
const popover = screen.getByTestId(tc.testId);
|
|
56
|
-
await userEvent.click(popover);
|
|
57
|
-
};
|
|
58
|
-
it('renders popover icon without label when small', () => {
|
|
59
|
-
tc.props.isSmall = true;
|
|
60
|
-
renderToolbarButton(tc.props);
|
|
61
|
-
const popoverLabel = screen.queryByText(tc.label);
|
|
62
|
-
expect(popoverLabel).not.toBeInTheDocument();
|
|
63
|
-
});
|
|
64
|
-
it('renders popover trigger button', () => {
|
|
65
|
-
renderToolbarButton(tc.props);
|
|
66
|
-
expect(screen.getByText(tc.label)).toBeInTheDocument();
|
|
67
|
-
});
|
|
68
|
-
it('opens popover on click', async () => {
|
|
69
|
-
renderToolbarButton(tc.props);
|
|
70
|
-
await openPopover();
|
|
71
|
-
expect(screen.getByText(options[2].label)).toBeVisible();
|
|
72
|
-
});
|
|
73
|
-
it('renders disabled popover trigger', async () => {
|
|
74
|
-
renderToolbarButton({ ...tc.props, disabled: true });
|
|
75
|
-
await openPopover();
|
|
76
|
-
expect(mockOnClick).not.toHaveBeenCalled();
|
|
77
|
-
});
|
|
78
|
-
it('handles click events', async () => {
|
|
79
|
-
const handleClick = jest.fn();
|
|
80
|
-
tc.props.onClick = handleClick;
|
|
81
|
-
const { getByTestId } = renderToolbarButton(tc.props);
|
|
82
|
-
await userEvent.click(getByTestId(tc.testId));
|
|
83
|
-
expect(handleClick).toHaveBeenCalled();
|
|
84
|
-
});
|
|
85
|
-
it('handles click events within popover and does not close the popover', async () => {
|
|
86
|
-
renderToolbarButton(tc.props);
|
|
87
|
-
expect(screen.queryByText(options[4].label)).not.toBeInTheDocument();
|
|
88
|
-
await openPopover();
|
|
89
|
-
await userEvent.click(screen.getByText(options[3].label));
|
|
90
|
-
expect(screen.getByText(options[4].label)).toBeInTheDocument();
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
//# sourceMappingURL=ToolbarButton.test.js.map
|