@seeqdev/qomponents 0.0.77 → 0.0.79
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/Accordion/Accordion.js +8 -8
- package/dist/Accordion/Accordion.stories.js +108 -108
- package/dist/Accordion/Accordion.test.js +54 -54
- package/dist/Accordion/Accordion.types.js +1 -1
- package/dist/Accordion/index.js +1 -1
- package/dist/Button/Button.js +89 -89
- package/dist/Button/Button.stories.js +84 -84
- package/dist/Button/Button.test.js +48 -48
- package/dist/Button/Button.types.js +4 -4
- package/dist/Button/index.js +1 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js +63 -63
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +92 -92
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +71 -71
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +1 -1
- package/dist/ButtonWithDropdown/index.js +1 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.js +50 -50
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +71 -71
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js +81 -81
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js +1 -1
- package/dist/ButtonWithPopover/index.js +1 -1
- package/dist/Checkbox/Checkbox.js +25 -25
- package/dist/Checkbox/Checkbox.stories.js +33 -33
- package/dist/Checkbox/Checkbox.test.js +93 -93
- package/dist/Checkbox/Checkbox.types.js +1 -1
- package/dist/Checkbox/index.js +1 -1
- package/dist/FontCustom.woff +0 -0
- package/dist/FontCustom.woff2 +0 -0
- package/dist/Icon/Icon.js +53 -53
- package/dist/Icon/Icon.stories.js +40 -40
- package/dist/Icon/Icon.test.js +54 -54
- package/dist/Icon/Icon.types.js +15 -15
- package/dist/Icon/index.js +1 -1
- package/dist/Modal/Modal.js +85 -85
- package/dist/Modal/Modal.stories.js +175 -175
- package/dist/Modal/Modal.test.js +107 -107
- package/dist/Modal/Modal.types.js +1 -1
- package/dist/Modal/index.js +1 -1
- package/dist/NewWorkbench/NewWorkbench.js +47 -54
- package/dist/NewWorkbench/NewWorkbench.js.map +1 -1
- package/dist/NewWorkbench/NewWorkbench.stories.js +76 -70
- package/dist/NewWorkbench/NewWorkbench.stories.js.map +1 -1
- package/dist/NewWorkbench/NewWorkbench.test.js +72 -71
- package/dist/NewWorkbench/NewWorkbench.test.js.map +1 -1
- package/dist/NewWorkbench/NewWorkbench.types.d.ts +1 -0
- package/dist/NewWorkbench/NewWorkbench.types.js +1 -1
- package/dist/NewWorkbench/index.js +1 -1
- package/dist/NewWorkbench/variants.d.ts +5 -0
- package/dist/NewWorkbench/variants.js +23 -0
- package/dist/NewWorkbench/variants.js.map +1 -0
- package/dist/Select/Select.js +170 -170
- package/dist/Select/Select.stories.js +76 -76
- package/dist/Select/Select.test.js +181 -181
- package/dist/Select/Select.types.js +1 -1
- package/dist/Select/index.js +1 -1
- package/dist/Tabs/Tabs.js +21 -21
- package/dist/Tabs/Tabs.stories.js +90 -90
- package/dist/Tabs/Tabs.test.js +90 -90
- package/dist/Tabs/Tabs.types.js +1 -1
- package/dist/Tabs/index.js +1 -1
- package/dist/TextArea/TextArea.js +22 -22
- package/dist/TextArea/TextArea.stories.js +38 -38
- package/dist/TextArea/TextArea.test.js +67 -67
- package/dist/TextArea/TextArea.types.js +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/TextField/TextField.js +63 -63
- package/dist/TextField/TextField.stories.js +40 -40
- package/dist/TextField/TextField.test.js +34 -34
- package/dist/TextField/TextField.types.js +1 -1
- package/dist/TextField/index.js +1 -1
- package/dist/ToolbarButton/ToolbarButton.js +72 -72
- package/dist/ToolbarButton/ToolbarButton.stories.js +88 -88
- package/dist/ToolbarButton/ToolbarButton.test.js +92 -92
- package/dist/ToolbarButton/ToolbarButton.types.js +1 -1
- package/dist/ToolbarButton/index.js +1 -1
- package/dist/Tooltip/QTip.stories.js +39 -39
- package/dist/Tooltip/QTip.stories.js.map +1 -1
- package/dist/Tooltip/QTip.types.js +1 -1
- package/dist/Tooltip/QTipPerformance.stories.js +29 -29
- package/dist/Tooltip/Qtip.js +157 -153
- package/dist/Tooltip/Qtip.js.map +1 -1
- package/dist/Tooltip/Tooltip.js +30 -30
- package/dist/Tooltip/Tooltip.stories.js +31 -31
- package/dist/Tooltip/Tooltip.types.js +2 -2
- package/dist/Tooltip/TooltipPerformance.stories.js +29 -29
- package/dist/Tooltip/index.js +2 -2
- package/dist/Tooltip/qTip.utilities.js +10 -10
- package/dist/index.esm.js +41 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +41 -10
- package/dist/index.js.map +1 -1
- package/dist/styles.css +21 -4
- package/dist/types.js +1 -1
- package/dist/utils/browserId.js +28 -28
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=TextArea.types.js.map
|
package/dist/TextArea/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { TextArea as default } from './TextArea';
|
|
1
|
+
export { TextArea as default } from './TextArea';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,64 +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, required = false, } = 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, required: required }));
|
|
63
|
-
});
|
|
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, required = false, } = 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, required: required }));
|
|
63
|
+
});
|
|
64
64
|
//# sourceMappingURL=TextField.js.map
|
|
@@ -1,41 +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
|
-
};
|
|
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
41
|
//# sourceMappingURL=TextField.stories.js.map
|
|
@@ -1,35 +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
|
-
});
|
|
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
35
|
//# sourceMappingURL=TextField.test.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=TextField.types.js.map
|
package/dist/TextField/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { TextField as default } from './TextField';
|
|
1
|
+
export { TextField as default } from './TextField';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,73 +1,73 @@
|
|
|
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
|
-
const borderStyles = [
|
|
6
|
-
'tw-border-solid',
|
|
7
|
-
'tw-border',
|
|
8
|
-
'tw-rounded-sm',
|
|
9
|
-
'tw-border-sq-disabled-gray',
|
|
10
|
-
'dark:tw-border-gray-500',
|
|
11
|
-
].join(' ');
|
|
12
|
-
const triggerBorderStyles = [
|
|
13
|
-
'tw-border-solid',
|
|
14
|
-
'tw-border',
|
|
15
|
-
'tw-rounded-sm',
|
|
16
|
-
'tw-border-transparent',
|
|
17
|
-
'hover:tw-border-solid',
|
|
18
|
-
'hover:tw-border',
|
|
19
|
-
'hover:tw-rounded-sm',
|
|
20
|
-
'hover:tw-border-sq-darkish-gray',
|
|
21
|
-
'active:tw-border-sq-color-dark',
|
|
22
|
-
'dark:hover:tw-border-sq-color-dark-dark',
|
|
23
|
-
'dark:focus:tw-border-sq-color-dark-dark',
|
|
24
|
-
'dark:active:tw-border-sq-color-dark-dark',
|
|
25
|
-
].join(' ');
|
|
26
|
-
const activeBorderStyles = [
|
|
27
|
-
'active',
|
|
28
|
-
'tw-border-solid',
|
|
29
|
-
'tw-border',
|
|
30
|
-
'tw-rounded-sm',
|
|
31
|
-
'tw-border-sq-color-dark',
|
|
32
|
-
'active:tw-border-sq-color-dark',
|
|
33
|
-
'dark:hover:tw-border-sq-color-dark-dark',
|
|
34
|
-
].join(' ');
|
|
35
|
-
const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
|
|
36
|
-
const disabledClasses = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
37
|
-
const PopoverContent = React.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (React.createElement(PopoverPrimitive.Content, { ref: ref, align: align, sideOffset: sideOffset, ...props, asChild: true })));
|
|
38
|
-
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, onClick, onHide, }) => {
|
|
39
|
-
let tooltipData = undefined;
|
|
40
|
-
if (tooltipText) {
|
|
41
|
-
tooltipData = {
|
|
42
|
-
'data-qtip-text': tooltipText,
|
|
43
|
-
'data-qtip-placement': tooltipOptions?.position,
|
|
44
|
-
'data-qtip-is-html': isHtmlTooltip,
|
|
45
|
-
'data-qtip-testid': tooltipTestId,
|
|
46
|
-
'data-qtip-delay': tooltipOptions?.delay ?? DEFAULT_TOOL_TIP_DELAY,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
const onOpenChange = (open) => {
|
|
50
|
-
if (!open) {
|
|
51
|
-
onHide && onHide();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
return (React.createElement(PopoverPrimitive.Root, { defaultOpen: false, onOpenChange: onOpenChange },
|
|
55
|
-
React.createElement(PopoverPrimitive.Trigger, { id: id, className: `tw-border-none ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, onClick: (e) => {
|
|
56
|
-
onClick && onClick(e);
|
|
57
|
-
} },
|
|
58
|
-
React.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-p-0 tw-flex tw-flex-col tw-items-center ${isSmall ? 'tw-py-[1px] tw-px-[5px]' : 'tw-px-2 tw-py-[3px]'} ${disabled ? disabledClasses : isActive ? activeBorderStyles : triggerBorderStyles} ${extraClassNames || ''}` },
|
|
59
|
-
React.createElement("span", { className: "tw-nowrap" },
|
|
60
|
-
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` }),
|
|
61
|
-
secondIcon && React.createElement(Icon, { icon: secondIcon, type: "text", testId: "secondIcon" }),
|
|
62
|
-
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),
|
|
63
|
-
!isSmall && (React.createElement("small", { className: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-text-[10px]" }, label)))),
|
|
64
|
-
!!popoverContent ? (React.createElement(PopoverContent, { sideOffset: 2, align: "start" },
|
|
65
|
-
React.createElement("div", { className: bgStyles +
|
|
66
|
-
' 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' +
|
|
67
|
-
' 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' +
|
|
68
|
-
borderStyles },
|
|
69
|
-
hasArrow && (React.createElement(PopoverPrimitive.Arrow, { asChild: true },
|
|
70
|
-
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" }))),
|
|
71
|
-
popoverContent))) : undefined));
|
|
72
|
-
};
|
|
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
|
+
const borderStyles = [
|
|
6
|
+
'tw-border-solid',
|
|
7
|
+
'tw-border',
|
|
8
|
+
'tw-rounded-sm',
|
|
9
|
+
'tw-border-sq-disabled-gray',
|
|
10
|
+
'dark:tw-border-gray-500',
|
|
11
|
+
].join(' ');
|
|
12
|
+
const triggerBorderStyles = [
|
|
13
|
+
'tw-border-solid',
|
|
14
|
+
'tw-border',
|
|
15
|
+
'tw-rounded-sm',
|
|
16
|
+
'tw-border-transparent',
|
|
17
|
+
'hover:tw-border-solid',
|
|
18
|
+
'hover:tw-border',
|
|
19
|
+
'hover:tw-rounded-sm',
|
|
20
|
+
'hover:tw-border-sq-darkish-gray',
|
|
21
|
+
'active:tw-border-sq-color-dark',
|
|
22
|
+
'dark:hover:tw-border-sq-color-dark-dark',
|
|
23
|
+
'dark:focus:tw-border-sq-color-dark-dark',
|
|
24
|
+
'dark:active:tw-border-sq-color-dark-dark',
|
|
25
|
+
].join(' ');
|
|
26
|
+
const activeBorderStyles = [
|
|
27
|
+
'active',
|
|
28
|
+
'tw-border-solid',
|
|
29
|
+
'tw-border',
|
|
30
|
+
'tw-rounded-sm',
|
|
31
|
+
'tw-border-sq-color-dark',
|
|
32
|
+
'active:tw-border-sq-color-dark',
|
|
33
|
+
'dark:hover:tw-border-sq-color-dark-dark',
|
|
34
|
+
].join(' ');
|
|
35
|
+
const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
|
|
36
|
+
const disabledClasses = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
37
|
+
const PopoverContent = React.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (React.createElement(PopoverPrimitive.Content, { ref: ref, align: align, sideOffset: sideOffset, ...props, asChild: true })));
|
|
38
|
+
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, onClick, onHide, }) => {
|
|
39
|
+
let tooltipData = undefined;
|
|
40
|
+
if (tooltipText) {
|
|
41
|
+
tooltipData = {
|
|
42
|
+
'data-qtip-text': tooltipText,
|
|
43
|
+
'data-qtip-placement': tooltipOptions?.position,
|
|
44
|
+
'data-qtip-is-html': isHtmlTooltip,
|
|
45
|
+
'data-qtip-testid': tooltipTestId,
|
|
46
|
+
'data-qtip-delay': tooltipOptions?.delay ?? DEFAULT_TOOL_TIP_DELAY,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const onOpenChange = (open) => {
|
|
50
|
+
if (!open) {
|
|
51
|
+
onHide && onHide();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return (React.createElement(PopoverPrimitive.Root, { defaultOpen: false, onOpenChange: onOpenChange },
|
|
55
|
+
React.createElement(PopoverPrimitive.Trigger, { id: id, className: `tw-border-none ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, onClick: (e) => {
|
|
56
|
+
onClick && onClick(e);
|
|
57
|
+
} },
|
|
58
|
+
React.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-p-0 tw-flex tw-flex-col tw-items-center ${isSmall ? 'tw-py-[1px] tw-px-[5px]' : 'tw-px-2 tw-py-[3px]'} ${disabled ? disabledClasses : isActive ? activeBorderStyles : triggerBorderStyles} ${extraClassNames || ''}` },
|
|
59
|
+
React.createElement("span", { className: "tw-nowrap" },
|
|
60
|
+
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` }),
|
|
61
|
+
secondIcon && React.createElement(Icon, { icon: secondIcon, type: "text", testId: "secondIcon" }),
|
|
62
|
+
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),
|
|
63
|
+
!isSmall && (React.createElement("small", { className: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-text-[10px]" }, label)))),
|
|
64
|
+
!!popoverContent ? (React.createElement(PopoverContent, { sideOffset: 2, align: "start" },
|
|
65
|
+
React.createElement("div", { className: bgStyles +
|
|
66
|
+
' 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' +
|
|
67
|
+
' 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' +
|
|
68
|
+
borderStyles },
|
|
69
|
+
hasArrow && (React.createElement(PopoverPrimitive.Arrow, { asChild: true },
|
|
70
|
+
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" }))),
|
|
71
|
+
popoverContent))) : undefined));
|
|
72
|
+
};
|
|
73
73
|
//# sourceMappingURL=ToolbarButton.js.map
|