@seeqdev/qomponents 0.0.108 → 0.0.109

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.
Files changed (96) hide show
  1. package/dist/Accordion/Accordion.js +8 -8
  2. package/dist/Accordion/Accordion.stories.js +114 -114
  3. package/dist/Accordion/Accordion.test.js +54 -54
  4. package/dist/Accordion/Accordion.types.js +1 -1
  5. package/dist/Accordion/index.js +1 -1
  6. package/dist/Alert/Alert.js +31 -31
  7. package/dist/Alert/Alert.stories.js +44 -44
  8. package/dist/Alert/Alert.test.js +50 -50
  9. package/dist/Alert/Alert.types.js +1 -1
  10. package/dist/Alert/index.js +1 -1
  11. package/dist/Button/Button.js +91 -91
  12. package/dist/Button/Button.stories.js +97 -97
  13. package/dist/Button/Button.test.js +48 -48
  14. package/dist/Button/Button.types.js +4 -4
  15. package/dist/Button/index.js +1 -1
  16. package/dist/ButtonWithDropdown/ButtonWithDropdown.js +66 -66
  17. package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +97 -97
  18. package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +84 -84
  19. package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +1 -1
  20. package/dist/ButtonWithDropdown/index.js +1 -1
  21. package/dist/ButtonWithPopover/ButtonWithPopover.js +50 -50
  22. package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +74 -74
  23. package/dist/ButtonWithPopover/ButtonWithPopover.test.js +81 -81
  24. package/dist/ButtonWithPopover/ButtonWithPopover.types.js +1 -1
  25. package/dist/ButtonWithPopover/index.js +1 -1
  26. package/dist/Checkbox/Checkbox.js +25 -25
  27. package/dist/Checkbox/Checkbox.stories.js +33 -33
  28. package/dist/Checkbox/Checkbox.test.js +93 -93
  29. package/dist/Checkbox/Checkbox.types.js +1 -1
  30. package/dist/Checkbox/index.js +1 -1
  31. package/dist/Icon/Icon.js +53 -53
  32. package/dist/Icon/Icon.stories.js +44 -44
  33. package/dist/Icon/Icon.test.js +54 -54
  34. package/dist/Icon/Icon.types.js +15 -15
  35. package/dist/Icon/index.js +1 -1
  36. package/dist/InputGroup/InputGroup.js +25 -25
  37. package/dist/InputGroup/InputGroup.stories.js +141 -141
  38. package/dist/InputGroup/InputGroup.test.js +42 -42
  39. package/dist/InputGroup/InputGroup.types.js +1 -1
  40. package/dist/InputGroup/index.js +1 -1
  41. package/dist/Modal/Modal.js +97 -97
  42. package/dist/Modal/Modal.stories.js +126 -126
  43. package/dist/Modal/Modal.test.js +107 -107
  44. package/dist/Modal/Modal.types.js +1 -1
  45. package/dist/Modal/index.js +1 -1
  46. package/dist/SeeqActionDropdown/SeeqActionDropdown.js +47 -47
  47. package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js +79 -79
  48. package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js +72 -72
  49. package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js +1 -1
  50. package/dist/SeeqActionDropdown/index.js +1 -1
  51. package/dist/SeeqActionDropdown/variants.js +22 -22
  52. package/dist/Select/Select.js +173 -173
  53. package/dist/Select/Select.stories.js +79 -79
  54. package/dist/Select/Select.test.js +181 -181
  55. package/dist/Select/Select.types.js +1 -1
  56. package/dist/Select/index.js +2 -2
  57. package/dist/Tabs/Tabs.js +21 -21
  58. package/dist/Tabs/Tabs.stories.js +90 -90
  59. package/dist/Tabs/Tabs.test.js +90 -90
  60. package/dist/Tabs/Tabs.types.js +1 -1
  61. package/dist/Tabs/index.js +1 -1
  62. package/dist/TextArea/TextArea.js +24 -24
  63. package/dist/TextArea/TextArea.stories.js +45 -45
  64. package/dist/TextArea/TextArea.test.js +67 -67
  65. package/dist/TextArea/TextArea.types.js +1 -1
  66. package/dist/TextArea/index.js +1 -1
  67. package/dist/TextField/TextField.js +78 -78
  68. package/dist/TextField/TextField.stories.js +69 -69
  69. package/dist/TextField/TextField.test.js +38 -38
  70. package/dist/TextField/TextField.types.js +1 -1
  71. package/dist/TextField/index.js +1 -1
  72. package/dist/ToolbarButton/ToolbarButton.js +74 -74
  73. package/dist/ToolbarButton/ToolbarButton.stories.js +93 -93
  74. package/dist/ToolbarButton/ToolbarButton.test.js +92 -92
  75. package/dist/ToolbarButton/ToolbarButton.types.js +1 -1
  76. package/dist/ToolbarButton/index.js +1 -1
  77. package/dist/Tooltip/QTip.stories.js +44 -44
  78. package/dist/Tooltip/QTip.types.js +1 -1
  79. package/dist/Tooltip/QTipPerformance.stories.js +29 -29
  80. package/dist/Tooltip/Qtip.js +154 -154
  81. package/dist/Tooltip/Tooltip.js +30 -30
  82. package/dist/Tooltip/Tooltip.stories.js +31 -31
  83. package/dist/Tooltip/Tooltip.types.js +2 -2
  84. package/dist/Tooltip/TooltipPerformance.stories.js +29 -29
  85. package/dist/Tooltip/index.js +2 -2
  86. package/dist/Tooltip/qTip.utilities.js +10 -10
  87. package/dist/index.esm.js +30 -17
  88. package/dist/index.esm.js.map +1 -1
  89. package/dist/index.js +30 -17
  90. package/dist/index.js.map +1 -1
  91. package/dist/types.js +1 -1
  92. package/dist/utils/browserId.js +28 -28
  93. package/dist/utils/svg.js +19 -19
  94. package/dist/utils/validateStyleDimension.js +13 -13
  95. package/dist/utils/validateStyleDimension.test.js +19 -19
  96. package/package.json +1 -1
@@ -1,94 +1,94 @@
1
- import React from 'react';
2
- import '@testing-library/jest-dom';
3
- import { render, screen } from '@testing-library/react';
4
- import { Checkbox } from './Checkbox';
5
- import userEvent from '@testing-library/user-event';
6
- describe('Checkbox', () => {
7
- class Context {
8
- testId = 'checkboxTestId';
9
- props = {
10
- onChange: jest.fn(),
11
- checked: false,
12
- testId: this.testId,
13
- };
14
- }
15
- let tc;
16
- beforeEach(() => {
17
- tc = new Context();
18
- });
19
- const renderCheckbox = (props) => render(React.createElement(Checkbox, { ...props }));
20
- it('renders checkbox', () => {
21
- renderCheckbox(tc.props);
22
- expect(screen.getByTestId(tc.testId)).toBeInTheDocument();
23
- });
24
- it('renders radio', () => {
25
- renderCheckbox({ ...tc.props, type: 'radio' });
26
- expect(screen.getByTestId(tc.testId)).toHaveProperty('type', 'radio');
27
- });
28
- it('renders label', () => {
29
- const label = 'look at this checkbox!';
30
- renderCheckbox({ ...tc.props, label });
31
- expect(screen.getByText(label)).toBeInTheDocument();
32
- });
33
- it('respects checked', () => {
34
- renderCheckbox({ ...tc.props, checked: true });
35
- expect(screen.getByTestId(tc.testId)).toBeChecked();
36
- });
37
- it('calls onChange handler', async () => {
38
- const onChange = jest.fn();
39
- renderCheckbox({ ...tc.props, onChange });
40
- await userEvent.click(screen.getByTestId(tc.testId));
41
- expect(onChange).toHaveBeenCalled();
42
- });
43
- it('calls onKeyDown handler', async () => {
44
- const onKeyDown = jest.fn();
45
- renderCheckbox({ ...tc.props, onKeyDown });
46
- await userEvent.type(screen.getByTestId(tc.testId), 'a');
47
- expect(onKeyDown).toHaveBeenCalled();
48
- });
49
- it('calls onClickHandler handler', async () => {
50
- const onClick = jest.fn();
51
- renderCheckbox({ ...tc.props, onClick });
52
- await userEvent.click(screen.getByTestId(tc.testId));
53
- expect(onClick).toHaveBeenCalled();
54
- });
55
- it('respects disabled', () => {
56
- renderCheckbox({ ...tc.props, disabled: true });
57
- expect(screen.getByTestId(tc.testId)).not.toBeEnabled();
58
- });
59
- it('renders label clickable', async () => {
60
- const label = 'amazing checkbox';
61
- const onClick = jest.fn();
62
- renderCheckbox({ ...tc.props, label, onClick });
63
- expect(screen.getByTestId(tc.testId)).not.toBeChecked();
64
- await userEvent.click(screen.getByText(label));
65
- expect(onClick).toHaveBeenCalled();
66
- });
67
- it('respects id', () => {
68
- const id = 'checkboxId';
69
- renderCheckbox({ ...tc.props, id });
70
- expect(screen.getByTestId(tc.testId)).toHaveProperty('id', id);
71
- });
72
- it('respects name', () => {
73
- const name = 'checkboxName';
74
- renderCheckbox({ ...tc.props, name });
75
- expect(screen.getByTestId(tc.testId)).toHaveProperty('name', name);
76
- });
77
- it('respects name', () => {
78
- const value = 'priceless';
79
- renderCheckbox({ ...tc.props, value });
80
- expect(screen.getByTestId(tc.testId)).toHaveProperty('value', value);
81
- });
82
- it('applies extraClassNames', () => {
83
- const extraClassNames = 'extra styling so fancy';
84
- renderCheckbox({ ...tc.props, extraClassNames });
85
- expect(screen.getByTestId(tc.testId).parentNode).toHaveClass(extraClassNames);
86
- });
87
- it('applies extraLabelClassNames', () => {
88
- const extraLabelClassNames = 'special label';
89
- const label = 'amazing checkbox';
90
- renderCheckbox({ ...tc.props, extraLabelClassNames, label });
91
- expect(screen.getByText(label)).toHaveClass(extraLabelClassNames);
92
- });
93
- });
1
+ import React from 'react';
2
+ import '@testing-library/jest-dom';
3
+ import { render, screen } from '@testing-library/react';
4
+ import { Checkbox } from './Checkbox';
5
+ import userEvent from '@testing-library/user-event';
6
+ describe('Checkbox', () => {
7
+ class Context {
8
+ testId = 'checkboxTestId';
9
+ props = {
10
+ onChange: jest.fn(),
11
+ checked: false,
12
+ testId: this.testId,
13
+ };
14
+ }
15
+ let tc;
16
+ beforeEach(() => {
17
+ tc = new Context();
18
+ });
19
+ const renderCheckbox = (props) => render(React.createElement(Checkbox, { ...props }));
20
+ it('renders checkbox', () => {
21
+ renderCheckbox(tc.props);
22
+ expect(screen.getByTestId(tc.testId)).toBeInTheDocument();
23
+ });
24
+ it('renders radio', () => {
25
+ renderCheckbox({ ...tc.props, type: 'radio' });
26
+ expect(screen.getByTestId(tc.testId)).toHaveProperty('type', 'radio');
27
+ });
28
+ it('renders label', () => {
29
+ const label = 'look at this checkbox!';
30
+ renderCheckbox({ ...tc.props, label });
31
+ expect(screen.getByText(label)).toBeInTheDocument();
32
+ });
33
+ it('respects checked', () => {
34
+ renderCheckbox({ ...tc.props, checked: true });
35
+ expect(screen.getByTestId(tc.testId)).toBeChecked();
36
+ });
37
+ it('calls onChange handler', async () => {
38
+ const onChange = jest.fn();
39
+ renderCheckbox({ ...tc.props, onChange });
40
+ await userEvent.click(screen.getByTestId(tc.testId));
41
+ expect(onChange).toHaveBeenCalled();
42
+ });
43
+ it('calls onKeyDown handler', async () => {
44
+ const onKeyDown = jest.fn();
45
+ renderCheckbox({ ...tc.props, onKeyDown });
46
+ await userEvent.type(screen.getByTestId(tc.testId), 'a');
47
+ expect(onKeyDown).toHaveBeenCalled();
48
+ });
49
+ it('calls onClickHandler handler', async () => {
50
+ const onClick = jest.fn();
51
+ renderCheckbox({ ...tc.props, onClick });
52
+ await userEvent.click(screen.getByTestId(tc.testId));
53
+ expect(onClick).toHaveBeenCalled();
54
+ });
55
+ it('respects disabled', () => {
56
+ renderCheckbox({ ...tc.props, disabled: true });
57
+ expect(screen.getByTestId(tc.testId)).not.toBeEnabled();
58
+ });
59
+ it('renders label clickable', async () => {
60
+ const label = 'amazing checkbox';
61
+ const onClick = jest.fn();
62
+ renderCheckbox({ ...tc.props, label, onClick });
63
+ expect(screen.getByTestId(tc.testId)).not.toBeChecked();
64
+ await userEvent.click(screen.getByText(label));
65
+ expect(onClick).toHaveBeenCalled();
66
+ });
67
+ it('respects id', () => {
68
+ const id = 'checkboxId';
69
+ renderCheckbox({ ...tc.props, id });
70
+ expect(screen.getByTestId(tc.testId)).toHaveProperty('id', id);
71
+ });
72
+ it('respects name', () => {
73
+ const name = 'checkboxName';
74
+ renderCheckbox({ ...tc.props, name });
75
+ expect(screen.getByTestId(tc.testId)).toHaveProperty('name', name);
76
+ });
77
+ it('respects name', () => {
78
+ const value = 'priceless';
79
+ renderCheckbox({ ...tc.props, value });
80
+ expect(screen.getByTestId(tc.testId)).toHaveProperty('value', value);
81
+ });
82
+ it('applies extraClassNames', () => {
83
+ const extraClassNames = 'extra styling so fancy';
84
+ renderCheckbox({ ...tc.props, extraClassNames });
85
+ expect(screen.getByTestId(tc.testId).parentNode).toHaveClass(extraClassNames);
86
+ });
87
+ it('applies extraLabelClassNames', () => {
88
+ const extraLabelClassNames = 'special label';
89
+ const label = 'amazing checkbox';
90
+ renderCheckbox({ ...tc.props, extraLabelClassNames, label });
91
+ expect(screen.getByText(label)).toHaveClass(extraLabelClassNames);
92
+ });
93
+ });
94
94
  //# sourceMappingURL=Checkbox.test.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=Checkbox.types.js.map
@@ -1,2 +1,2 @@
1
- export { Checkbox as default } from './Checkbox';
1
+ export { Checkbox as default } from './Checkbox';
2
2
  //# sourceMappingURL=index.js.map
package/dist/Icon/Icon.js CHANGED
@@ -1,55 +1,55 @@
1
- import React from 'react';
2
- import '../styles.css';
3
- import { getQTipData } from '../Tooltip/qTip.utilities';
4
- const colorClassesThemeLight = {
5
- 'theme': 'tw-text-sq-color-dark',
6
- 'white': 'tw-text-white',
7
- 'dark-gray': 'tw-text-sq-fairly-dark-gray',
8
- 'warning': 'tw-text-sq-warning-color',
9
- 'darkish-gray': 'tw-text-sq-darkish-gray',
10
- 'gray': 'tw-text-sq-disabled-gray',
11
- 'color': '',
12
- 'info': 'tw-text-sq-link',
13
- 'text': 'tw-text-sq-text-color',
14
- 'inherit': '',
15
- 'danger': 'tw-text-sq-danger-color',
16
- 'theme-light': 'tw-text-sq-color-light',
17
- 'success': 'tw-text-sq-success-color',
18
- };
19
- const colorClassesThemeDark = {
20
- 'theme': 'dark:tw-text-sq-color-dark-dark',
21
- 'white': '',
22
- 'dark-gray': 'tw-text-sq-fairly-dark-gray',
23
- 'warning': '',
24
- 'darkish-gray': 'tw-text-sq-darkish-gray',
25
- 'gray': 'dark:tw-text-sq-dark-disabled-gray',
26
- 'color': '',
27
- 'info': 'dark:tw-text-sq-link-dark',
28
- 'text': 'dark:tw-text-sq-dark-text',
29
- 'inherit': '',
30
- 'danger': 'tw-text-sq-danger-color',
31
- 'theme-light': 'tw-text-sq-color-light',
32
- 'success': 'tw-text-sq-success-color',
33
- };
34
- /**
35
- * Icon:
36
- * - access to Seeq custom icons by providing the desired icon
37
- * - leverage "type" to style your icon
38
- */
39
- const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClassNames, id, large, small, color, testId, customId, number, ...tooltipProps }) => {
40
- if ((type === 'color' && (color === undefined || color === '')) || (color && type !== 'color')) {
41
- const errorMessage = color === undefined || color === ''
42
- ? 'Icon with type="color" must have prop color specified.'
43
- : 'Icon with prop color must have type="color".';
44
- return React.createElement("div", { className: "tw-text-sq-danger-color" }, errorMessage);
45
- }
46
- const fontAwesomePrefix = iconPrefix ? iconPrefix : 'fa-sharp fa-regular';
47
- const iconPrefixString = icon.startsWith('fc') ? 'fc' : fontAwesomePrefix;
48
- const style = type === 'color' && color ? { color } : {};
1
+ import React from 'react';
2
+ import '../styles.css';
3
+ import { getQTipData } from '../Tooltip/qTip.utilities';
4
+ const colorClassesThemeLight = {
5
+ 'theme': 'tw-text-sq-color-dark',
6
+ 'white': 'tw-text-white',
7
+ 'dark-gray': 'tw-text-sq-fairly-dark-gray',
8
+ 'warning': 'tw-text-sq-warning-color',
9
+ 'darkish-gray': 'tw-text-sq-darkish-gray',
10
+ 'gray': 'tw-text-sq-disabled-gray',
11
+ 'color': '',
12
+ 'info': 'tw-text-sq-link',
13
+ 'text': 'tw-text-sq-text-color',
14
+ 'inherit': '',
15
+ 'danger': 'tw-text-sq-danger-color',
16
+ 'theme-light': 'tw-text-sq-color-light',
17
+ 'success': 'tw-text-sq-success-color',
18
+ };
19
+ const colorClassesThemeDark = {
20
+ 'theme': 'dark:tw-text-sq-color-dark-dark',
21
+ 'white': '',
22
+ 'dark-gray': 'tw-text-sq-fairly-dark-gray',
23
+ 'warning': '',
24
+ 'darkish-gray': 'tw-text-sq-darkish-gray',
25
+ 'gray': 'dark:tw-text-sq-dark-disabled-gray',
26
+ 'color': '',
27
+ 'info': 'dark:tw-text-sq-link-dark',
28
+ 'text': 'dark:tw-text-sq-dark-text',
29
+ 'inherit': '',
30
+ 'danger': 'tw-text-sq-danger-color',
31
+ 'theme-light': 'tw-text-sq-color-light',
32
+ 'success': 'tw-text-sq-success-color',
33
+ };
34
+ /**
35
+ * Icon:
36
+ * - access to Seeq custom icons by providing the desired icon
37
+ * - leverage "type" to style your icon
38
+ */
39
+ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClassNames, id, large, small, color, testId, customId, number, ...tooltipProps }) => {
40
+ if ((type === 'color' && (color === undefined || color === '')) || (color && type !== 'color')) {
41
+ const errorMessage = color === undefined || color === ''
42
+ ? 'Icon with type="color" must have prop color specified.'
43
+ : 'Icon with prop color must have type="color".';
44
+ return React.createElement("div", { className: "tw-text-sq-danger-color" }, errorMessage);
45
+ }
46
+ const fontAwesomePrefix = iconPrefix ? iconPrefix : 'fa-sharp fa-regular';
47
+ const iconPrefixString = icon.startsWith('fc') ? 'fc' : fontAwesomePrefix;
48
+ const style = type === 'color' && color ? { color } : {};
49
49
  const appliedClassNames = `${iconPrefixString} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
50
- ${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'tw-cursor-pointer' : ''} ${extraClassNames} focus:tw-outline-none focus-visible:tw-outline-none tw-outline-none`;
51
- const tooltipData = getQTipData(tooltipProps);
52
- return (React.createElement("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number, ...tooltipData }));
53
- };
54
- export default Icon;
50
+ ${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'tw-cursor-pointer' : ''} ${extraClassNames} focus:tw-outline-none focus-visible:tw-outline-none tw-outline-none`;
51
+ const tooltipData = getQTipData(tooltipProps);
52
+ return (React.createElement("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number, ...tooltipData }));
53
+ };
54
+ export default Icon;
55
55
  //# sourceMappingURL=Icon.js.map
@@ -1,45 +1,45 @@
1
- import React from 'react';
2
- import Icon from './Icon';
3
- import { iconTypes } from './Icon.types';
4
- export default {
5
- title: 'Icons',
6
- };
7
- export const AllIcons = () => {
8
- const renderAllVariations = () => {
9
- return (React.createElement(React.Fragment, null,
10
- React.createElement("br", null),
11
- React.createElement("br", null),
12
- iconTypes.map((iconType) => {
13
- return (React.createElement("div", { key: `${iconType}` },
14
- React.createElement("b", null,
15
- "type=",
16
- iconType),
17
- React.createElement("br", null),
18
- React.createElement("div", null,
19
- React.createElement(Icon, { icon: "fc-genai-chat", small: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'purple' : undefined }),
20
- React.createElement(Icon, { icon: "fc-formula-ai", extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? '#928378' : undefined }),
21
- React.createElement(Icon, { icon: "fc-datalab-ai", extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'pink' : undefined }),
22
- React.createElement(Icon, { icon: "fc-workbook-ai", extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'pink' : undefined }),
23
- React.createElement(Icon, { icon: "fc-vantage", extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'pink' : undefined })),
24
- React.createElement("div", { className: "tw-dark tw-bg-sq-dark-background" },
25
- React.createElement(Icon, { icon: "fc-announcements", small: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'purple' : undefined }),
26
- React.createElement(Icon, { icon: "fc-announcements", extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? '#928378' : undefined }),
27
- React.createElement(Icon, { icon: "fc-announcements", large: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'pink' : undefined })),
28
- React.createElement("br", null)));
29
- })));
30
- };
31
- return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
32
- React.createElement("div", { className: "color_topic" },
33
- React.createElement("b", null, "Topic Colors"),
34
- renderAllVariations()),
35
- React.createElement("div", { className: "color_analysis" },
36
- React.createElement("b", null, "Analysis Colors"),
37
- renderAllVariations()),
38
- React.createElement("div", { className: "color_datalab" },
39
- React.createElement("b", null, "Datalab Colors"),
40
- renderAllVariations()),
41
- React.createElement("div", { className: "color_vantage" },
42
- React.createElement("b", null, "Vantage Colors"),
43
- renderAllVariations())));
44
- };
1
+ import React from 'react';
2
+ import Icon from './Icon';
3
+ import { iconTypes } from './Icon.types';
4
+ export default {
5
+ title: 'Icons',
6
+ };
7
+ export const AllIcons = () => {
8
+ const renderAllVariations = () => {
9
+ return (React.createElement(React.Fragment, null,
10
+ React.createElement("br", null),
11
+ React.createElement("br", null),
12
+ iconTypes.map((iconType) => {
13
+ return (React.createElement("div", { key: `${iconType}` },
14
+ React.createElement("b", null,
15
+ "type=",
16
+ iconType),
17
+ React.createElement("br", null),
18
+ React.createElement("div", null,
19
+ React.createElement(Icon, { icon: "fc-genai-chat", small: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'purple' : undefined }),
20
+ React.createElement(Icon, { icon: "fc-formula-ai", extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? '#928378' : undefined }),
21
+ React.createElement(Icon, { icon: "fc-datalab-ai", extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'pink' : undefined }),
22
+ React.createElement(Icon, { icon: "fc-workbook-ai", extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'pink' : undefined }),
23
+ React.createElement(Icon, { icon: "fc-vantage", extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'pink' : undefined })),
24
+ React.createElement("div", { className: "tw-dark tw-bg-sq-dark-background" },
25
+ React.createElement(Icon, { icon: "fc-announcements", small: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'purple' : undefined }),
26
+ React.createElement(Icon, { icon: "fc-announcements", extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? '#928378' : undefined }),
27
+ React.createElement(Icon, { icon: "fc-announcements", large: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'pink' : undefined })),
28
+ React.createElement("br", null)));
29
+ })));
30
+ };
31
+ return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
32
+ React.createElement("div", { className: "color_topic" },
33
+ React.createElement("b", null, "Topic Colors"),
34
+ renderAllVariations()),
35
+ React.createElement("div", { className: "color_analysis" },
36
+ React.createElement("b", null, "Analysis Colors"),
37
+ renderAllVariations()),
38
+ React.createElement("div", { className: "color_datalab" },
39
+ React.createElement("b", null, "Datalab Colors"),
40
+ renderAllVariations()),
41
+ React.createElement("div", { className: "color_vantage" },
42
+ React.createElement("b", null, "Vantage Colors"),
43
+ renderAllVariations())));
44
+ };
45
45
  //# sourceMappingURL=Icon.stories.js.map
@@ -1,55 +1,55 @@
1
- import React from 'react';
2
- import '@testing-library/jest-dom';
3
- import { render, screen } from '@testing-library/react';
4
- import Icon from './Icon';
5
- describe('Icon', () => {
6
- class Context {
7
- testId = 'iconTestId';
8
- icon = 'testIcon';
9
- props = {
10
- icon: this.icon,
11
- onClick: jest.fn(),
12
- testId: this.testId,
13
- };
14
- }
15
- let tc;
16
- beforeEach(() => {
17
- tc = new Context();
18
- });
19
- const renderIcon = (props) => render(React.createElement(Icon, { ...props }));
20
- it('renders icon', () => {
21
- renderIcon(tc.props);
22
- expect(screen.getByTestId(tc.testId)).toHaveClass(tc.icon);
23
- });
24
- it('renders large icon', () => {
25
- renderIcon({ ...tc.props, large: true });
26
- expect(screen.getByTestId(tc.testId)).toHaveClass('fa-lg');
27
- });
28
- it('renders small icon', () => {
29
- renderIcon({ ...tc.props, small: true });
30
- expect(screen.getByTestId(tc.testId)).toHaveClass('fa-sm');
31
- });
32
- describe('icon types', () => {
33
- it('renders the theme type by default', () => {
34
- renderIcon(tc.props);
35
- expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-sq-color-dark');
36
- });
37
- it('renders the white icon', () => {
38
- renderIcon({ ...tc.props, type: 'white' });
39
- expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-white');
40
- });
41
- it('renders the text-type icon', () => {
42
- renderIcon({ ...tc.props, type: 'text' });
43
- expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-sq-text-color');
44
- });
45
- it('renders the color-type icon', () => {
46
- renderIcon({ ...tc.props, type: 'color', color: '#AABBFF' });
47
- expect(screen.getByTestId(tc.testId)).toHaveStyle('color: #AABBFF');
48
- });
49
- it('renders a warning if type=color and no color is provided', () => {
50
- renderIcon({ ...tc.props, type: 'color' });
51
- expect(screen.getByText('Icon with type="color" must have prop color specified.')).toBeInTheDocument();
52
- });
53
- });
54
- });
1
+ import React from 'react';
2
+ import '@testing-library/jest-dom';
3
+ import { render, screen } from '@testing-library/react';
4
+ import Icon from './Icon';
5
+ describe('Icon', () => {
6
+ class Context {
7
+ testId = 'iconTestId';
8
+ icon = 'testIcon';
9
+ props = {
10
+ icon: this.icon,
11
+ onClick: jest.fn(),
12
+ testId: this.testId,
13
+ };
14
+ }
15
+ let tc;
16
+ beforeEach(() => {
17
+ tc = new Context();
18
+ });
19
+ const renderIcon = (props) => render(React.createElement(Icon, { ...props }));
20
+ it('renders icon', () => {
21
+ renderIcon(tc.props);
22
+ expect(screen.getByTestId(tc.testId)).toHaveClass(tc.icon);
23
+ });
24
+ it('renders large icon', () => {
25
+ renderIcon({ ...tc.props, large: true });
26
+ expect(screen.getByTestId(tc.testId)).toHaveClass('fa-lg');
27
+ });
28
+ it('renders small icon', () => {
29
+ renderIcon({ ...tc.props, small: true });
30
+ expect(screen.getByTestId(tc.testId)).toHaveClass('fa-sm');
31
+ });
32
+ describe('icon types', () => {
33
+ it('renders the theme type by default', () => {
34
+ renderIcon(tc.props);
35
+ expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-sq-color-dark');
36
+ });
37
+ it('renders the white icon', () => {
38
+ renderIcon({ ...tc.props, type: 'white' });
39
+ expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-white');
40
+ });
41
+ it('renders the text-type icon', () => {
42
+ renderIcon({ ...tc.props, type: 'text' });
43
+ expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-sq-text-color');
44
+ });
45
+ it('renders the color-type icon', () => {
46
+ renderIcon({ ...tc.props, type: 'color', color: '#AABBFF' });
47
+ expect(screen.getByTestId(tc.testId)).toHaveStyle('color: #AABBFF');
48
+ });
49
+ it('renders a warning if type=color and no color is provided', () => {
50
+ renderIcon({ ...tc.props, type: 'color' });
51
+ expect(screen.getByText('Icon with type="color" must have prop color specified.')).toBeInTheDocument();
52
+ });
53
+ });
54
+ });
55
55
  //# sourceMappingURL=Icon.test.js.map
@@ -1,16 +1,16 @@
1
- export const iconTypes = [
2
- 'theme',
3
- 'white',
4
- 'dark-gray',
5
- 'darkish-gray',
6
- 'gray',
7
- 'color',
8
- 'info',
9
- 'text',
10
- 'warning',
11
- 'inherit',
12
- 'danger',
13
- 'theme-light',
14
- 'success',
15
- ];
1
+ export const iconTypes = [
2
+ 'theme',
3
+ 'white',
4
+ 'dark-gray',
5
+ 'darkish-gray',
6
+ 'gray',
7
+ 'color',
8
+ 'info',
9
+ 'text',
10
+ 'warning',
11
+ 'inherit',
12
+ 'danger',
13
+ 'theme-light',
14
+ 'success',
15
+ ];
16
16
  //# sourceMappingURL=Icon.types.js.map
@@ -1,2 +1,2 @@
1
- export { default } from './Icon';
1
+ export { default } from './Icon';
2
2
  //# sourceMappingURL=index.js.map
@@ -1,26 +1,26 @@
1
- import React from 'react';
2
- import '../styles.css';
3
- import { getQTipData } from '../Tooltip/qTip.utilities';
4
- import TextField from '../TextField';
5
- import Button from '../Button';
6
- const baseClasses = 'tw-flex tw-outline-none tw-rounded-sm tw-w-full tw-relative tw-flex-wrap tw-items-stretch';
7
- /**
8
- * InputGroup.
9
- */
10
- export const InputGroup = ({ readonly = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, onClick, name, value, placeholder, append = [], extraClassNames = '', id, testId, showError, required, autoComplete, autoFocus, disabled, type, step, min, max, ...tooltipProps }) => {
11
- const tooltipData = getQTipData(tooltipProps);
12
- const appliedClasses = `${baseClasses} ${extraClassNames}`;
13
- const borderColorClasses = [
14
- 'tw-border-sq-disabled-gray',
15
- 'dark:tw-border-sq-dark-disabled-gray',
16
- 'dark:focus:tw-border-sq-color-dark-dark',
17
- 'dark:active:tw-border-sq-color-dark-dark',
18
- 'focus:tw-border-sq-color-dark',
19
- 'active:tw-border-sq-color-dark',
20
- ].join(' ');
21
- const textfield = (React.createElement(TextField, { readonly: onClick ? true : readonly, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, name: name, showError: showError, value: value, required: required, placeholder: placeholder, autoComplete: autoComplete, autoFocus: autoFocus, id: id, type: type, disabled: disabled, step: step, min: min, max: max, extraClassNames: `tw-flex tw-flex-1 tw-rounded-r-none focus:tw-z-30 ${onClick ? 'tw-cursor-pointer' : ''} ${extraClassNames}`, ...tooltipData }));
22
- return (React.createElement("div", { id: id, "data-testid": testId, className: appliedClasses },
23
- onClick ? (React.createElement("div", { onClick: onClick, className: "tw-flex tw-flex-1 tw-cursor-pointer" }, textfield)) : (textfield),
24
- append.filter(Boolean).map((item, index) => item.variant === 'button' ? (React.createElement(Button, { key: index, extraClassNames: "tw-ml-[-1px] focus:tw-z-40 focus:tw-border tw-rounded-l-none tw-rounded-r-none last:tw-rounded-r-sm", onClick: item.buttonProps.onClick, variant: item.buttonProps.variant, icon: item.buttonProps.icon, iconColor: item.buttonProps.iconColor, testId: item.buttonProps.testId, disabled: item.buttonProps.disabled, label: item.buttonProps.label, iconStyle: item.buttonProps.iconStyle })) : (React.createElement("div", { key: index, className: `${borderColorClasses} tw-flex tw-items-center tw-h-inputs tw-justify-center tw-rounded-none tw-ml-[-1px] focus:tw-z-40 focus:tw-border last:tw-border last:tw-rounded-r-sm` }, item.element)))));
25
- };
1
+ import React from 'react';
2
+ import '../styles.css';
3
+ import { getQTipData } from '../Tooltip/qTip.utilities';
4
+ import TextField from '../TextField';
5
+ import Button from '../Button';
6
+ const baseClasses = 'tw-flex tw-outline-none tw-rounded-sm tw-w-full tw-relative tw-flex-wrap tw-items-stretch';
7
+ /**
8
+ * InputGroup.
9
+ */
10
+ export const InputGroup = ({ readonly = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, onClick, name, value, placeholder, append = [], extraClassNames = '', id, testId, showError, required, autoComplete, autoFocus, disabled, type, step, min, max, ...tooltipProps }) => {
11
+ const tooltipData = getQTipData(tooltipProps);
12
+ const appliedClasses = `${baseClasses} ${extraClassNames}`;
13
+ const borderColorClasses = [
14
+ 'tw-border-sq-disabled-gray',
15
+ 'dark:tw-border-sq-dark-disabled-gray',
16
+ 'dark:focus:tw-border-sq-color-dark-dark',
17
+ 'dark:active:tw-border-sq-color-dark-dark',
18
+ 'focus:tw-border-sq-color-dark',
19
+ 'active:tw-border-sq-color-dark',
20
+ ].join(' ');
21
+ const textfield = (React.createElement(TextField, { readonly: onClick ? true : readonly, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, name: name, showError: showError, value: value, required: required, placeholder: placeholder, autoComplete: autoComplete, autoFocus: autoFocus, id: id, type: type, disabled: disabled, step: step, min: min, max: max, extraClassNames: `tw-flex tw-flex-1 tw-rounded-r-none focus:tw-z-30 ${onClick ? 'tw-cursor-pointer' : ''} ${extraClassNames}`, ...tooltipData }));
22
+ return (React.createElement("div", { id: id, "data-testid": testId, className: appliedClasses },
23
+ onClick ? (React.createElement("div", { onClick: onClick, className: "tw-flex tw-flex-1 tw-cursor-pointer" }, textfield)) : (textfield),
24
+ append.filter(Boolean).map((item, index) => item.variant === 'button' ? (React.createElement(Button, { key: index, extraClassNames: "tw-ml-[-1px] focus:tw-z-40 focus:tw-border tw-rounded-l-none tw-rounded-r-none last:tw-rounded-r-sm", onClick: item.buttonProps.onClick, variant: item.buttonProps.variant, icon: item.buttonProps.icon, iconColor: item.buttonProps.iconColor, testId: item.buttonProps.testId, disabled: item.buttonProps.disabled, label: item.buttonProps.label, iconStyle: item.buttonProps.iconStyle })) : (React.createElement("div", { key: index, className: `${borderColorClasses} tw-flex tw-items-center tw-h-inputs tw-justify-center tw-rounded-none tw-ml-[-1px] focus:tw-z-40 focus:tw-border last:tw-border last:tw-rounded-r-sm` }, item.element)))));
25
+ };
26
26
  //# sourceMappingURL=InputGroup.js.map