@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,142 +1,142 @@
1
- import React from 'react';
2
- import { InputGroup } from './InputGroup';
3
- import { QTip } from '../Tooltip/Qtip';
4
- export default {
5
- title: 'InputGroup',
6
- };
7
- export const AllTextFields = () => {
8
- const renderAllVariations = () => (React.createElement(React.Fragment, null,
9
- React.createElement("div", { className: "light" },
10
- React.createElement("div", { className: "tw-p-4" },
11
- React.createElement(InputGroup, { value: "value provided", append: [
12
- {
13
- variant: 'button',
14
- buttonProps: {
15
- icon: 'fc-annotate',
16
- iconStyle: 'theme',
17
- },
18
- },
19
- {
20
- variant: 'button',
21
- buttonProps: {
22
- icon: 'fc-trash',
23
- iconStyle: 'theme',
24
- },
25
- },
26
- ] })),
27
- React.createElement("div", { className: "tw-p-4" },
28
- React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with tooltip", append: [
29
- {
30
- variant: 'button',
31
- buttonProps: {
32
- icon: 'fc-annotate',
33
- iconStyle: 'theme',
34
- },
35
- },
36
- {
37
- variant: 'button',
38
- buttonProps: {
39
- icon: 'fc-trash',
40
- iconStyle: 'theme',
41
- },
42
- },
43
- ] })),
44
- React.createElement("div", { className: "tw-p-4" },
45
- React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with tooltip", append: [
46
- {
47
- variant: 'button',
48
- buttonProps: {
49
- icon: 'fc-annotate',
50
- iconStyle: 'theme',
51
- },
52
- },
53
- ] })),
54
- React.createElement("div", { className: "tw-p-4" },
55
- React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with custom element", append: [
56
- {
57
- variant: 'element',
58
- element: React.createElement("div", { className: "tw-text-sm tw-p-1 tw-bg-sq-light-background" }, "Custom"),
59
- },
60
- ] })),
61
- React.createElement("div", { className: "tw-p-4" },
62
- React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "button input group", onClick: () => console.log('clicked'), append: [
63
- {
64
- variant: 'element',
65
- element: (React.createElement("div", { className: "tw-text-sm tw-p-1 tw-bg-sq-light-background dark:tw-text-sq-dark-text" }, "Custom")),
66
- },
67
- ] }))),
68
- React.createElement("div", { className: "tw-dark tw-bg-sq-dark-background" },
69
- React.createElement("div", { className: "tw-p-4" },
70
- React.createElement(InputGroup, { value: "value provided", append: [
71
- {
72
- variant: 'button',
73
- buttonProps: {
74
- icon: 'fc-annotate',
75
- iconStyle: 'theme',
76
- },
77
- },
78
- {
79
- variant: 'button',
80
- buttonProps: {
81
- icon: 'fc-trash',
82
- iconStyle: 'theme',
83
- },
84
- },
85
- ] })),
86
- React.createElement("div", { className: "tw-p-4" },
87
- React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with tooltip", append: [
88
- {
89
- variant: 'button',
90
- buttonProps: {
91
- icon: 'fc-annotate',
92
- iconStyle: 'theme',
93
- },
94
- },
95
- {
96
- variant: 'button',
97
- buttonProps: {
98
- icon: 'fc-trash',
99
- iconStyle: 'theme',
100
- },
101
- },
102
- ] })),
103
- React.createElement("div", { className: "tw-p-4" },
104
- React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with tooltip", append: [
105
- {
106
- variant: 'button',
107
- buttonProps: {
108
- icon: 'fc-annotate',
109
- iconStyle: 'theme',
110
- },
111
- },
112
- ] })),
113
- React.createElement("div", { className: "tw-p-4" },
114
- React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with custom element", append: [
115
- {
116
- variant: 'element',
117
- element: (React.createElement("div", { className: "tw-text-sm tw-p-1 tw-bg-sq-light-background dark:tw-text-sq-dark-text" }, "Custom")),
118
- },
119
- ] })),
120
- React.createElement("div", { className: "tw-p-4" },
121
- React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "button input group", onClick: () => console.log('clicked'), append: [
122
- {
123
- variant: 'element',
124
- element: (React.createElement("div", { className: "tw-text-sm tw-p-1 tw-bg-sq-light-background dark:tw-text-sq-dark-text" }, "Custom")),
125
- },
126
- ] })))));
127
- return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
128
- React.createElement(QTip, null),
129
- React.createElement("div", { className: "color_topic" },
130
- React.createElement("b", null, "Topic Colors"),
131
- renderAllVariations()),
132
- React.createElement("div", { className: "color_analysis" },
133
- React.createElement("b", null, "Analysis Colors"),
134
- renderAllVariations()),
135
- React.createElement("div", { className: "color_datalab" },
136
- React.createElement("b", null, "Datalab Colors"),
137
- renderAllVariations()),
138
- React.createElement("div", { className: "color_vantage" },
139
- React.createElement("b", null, "Vantage Colors"),
140
- renderAllVariations())));
141
- };
1
+ import React from 'react';
2
+ import { InputGroup } from './InputGroup';
3
+ import { QTip } from '../Tooltip/Qtip';
4
+ export default {
5
+ title: 'InputGroup',
6
+ };
7
+ export const AllTextFields = () => {
8
+ const renderAllVariations = () => (React.createElement(React.Fragment, null,
9
+ React.createElement("div", { className: "light" },
10
+ React.createElement("div", { className: "tw-p-4" },
11
+ React.createElement(InputGroup, { value: "value provided", append: [
12
+ {
13
+ variant: 'button',
14
+ buttonProps: {
15
+ icon: 'fc-annotate',
16
+ iconStyle: 'theme',
17
+ },
18
+ },
19
+ {
20
+ variant: 'button',
21
+ buttonProps: {
22
+ icon: 'fc-trash',
23
+ iconStyle: 'theme',
24
+ },
25
+ },
26
+ ] })),
27
+ React.createElement("div", { className: "tw-p-4" },
28
+ React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with tooltip", append: [
29
+ {
30
+ variant: 'button',
31
+ buttonProps: {
32
+ icon: 'fc-annotate',
33
+ iconStyle: 'theme',
34
+ },
35
+ },
36
+ {
37
+ variant: 'button',
38
+ buttonProps: {
39
+ icon: 'fc-trash',
40
+ iconStyle: 'theme',
41
+ },
42
+ },
43
+ ] })),
44
+ React.createElement("div", { className: "tw-p-4" },
45
+ React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with tooltip", append: [
46
+ {
47
+ variant: 'button',
48
+ buttonProps: {
49
+ icon: 'fc-annotate',
50
+ iconStyle: 'theme',
51
+ },
52
+ },
53
+ ] })),
54
+ React.createElement("div", { className: "tw-p-4" },
55
+ React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with custom element", append: [
56
+ {
57
+ variant: 'element',
58
+ element: React.createElement("div", { className: "tw-text-sm tw-p-1 tw-bg-sq-light-background" }, "Custom"),
59
+ },
60
+ ] })),
61
+ React.createElement("div", { className: "tw-p-4" },
62
+ React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "button input group", onClick: () => console.log('clicked'), append: [
63
+ {
64
+ variant: 'element',
65
+ element: (React.createElement("div", { className: "tw-text-sm tw-p-1 tw-bg-sq-light-background dark:tw-text-sq-dark-text" }, "Custom")),
66
+ },
67
+ ] }))),
68
+ React.createElement("div", { className: "tw-dark tw-bg-sq-dark-background" },
69
+ React.createElement("div", { className: "tw-p-4" },
70
+ React.createElement(InputGroup, { value: "value provided", append: [
71
+ {
72
+ variant: 'button',
73
+ buttonProps: {
74
+ icon: 'fc-annotate',
75
+ iconStyle: 'theme',
76
+ },
77
+ },
78
+ {
79
+ variant: 'button',
80
+ buttonProps: {
81
+ icon: 'fc-trash',
82
+ iconStyle: 'theme',
83
+ },
84
+ },
85
+ ] })),
86
+ React.createElement("div", { className: "tw-p-4" },
87
+ React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with tooltip", append: [
88
+ {
89
+ variant: 'button',
90
+ buttonProps: {
91
+ icon: 'fc-annotate',
92
+ iconStyle: 'theme',
93
+ },
94
+ },
95
+ {
96
+ variant: 'button',
97
+ buttonProps: {
98
+ icon: 'fc-trash',
99
+ iconStyle: 'theme',
100
+ },
101
+ },
102
+ ] })),
103
+ React.createElement("div", { className: "tw-p-4" },
104
+ React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with tooltip", append: [
105
+ {
106
+ variant: 'button',
107
+ buttonProps: {
108
+ icon: 'fc-annotate',
109
+ iconStyle: 'theme',
110
+ },
111
+ },
112
+ ] })),
113
+ React.createElement("div", { className: "tw-p-4" },
114
+ React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "with custom element", append: [
115
+ {
116
+ variant: 'element',
117
+ element: (React.createElement("div", { className: "tw-text-sm tw-p-1 tw-bg-sq-light-background dark:tw-text-sq-dark-text" }, "Custom")),
118
+ },
119
+ ] })),
120
+ React.createElement("div", { className: "tw-p-4" },
121
+ React.createElement(InputGroup, { tooltip: "This is a small input group.", tooltipDelay: 0, tooltipPlacement: "top", isHtmlTooltip: false, value: "button input group", onClick: () => console.log('clicked'), append: [
122
+ {
123
+ variant: 'element',
124
+ element: (React.createElement("div", { className: "tw-text-sm tw-p-1 tw-bg-sq-light-background dark:tw-text-sq-dark-text" }, "Custom")),
125
+ },
126
+ ] })))));
127
+ return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
128
+ React.createElement(QTip, null),
129
+ React.createElement("div", { className: "color_topic" },
130
+ React.createElement("b", null, "Topic Colors"),
131
+ renderAllVariations()),
132
+ React.createElement("div", { className: "color_analysis" },
133
+ React.createElement("b", null, "Analysis Colors"),
134
+ renderAllVariations()),
135
+ React.createElement("div", { className: "color_datalab" },
136
+ React.createElement("b", null, "Datalab Colors"),
137
+ renderAllVariations()),
138
+ React.createElement("div", { className: "color_vantage" },
139
+ React.createElement("b", null, "Vantage Colors"),
140
+ renderAllVariations())));
141
+ };
142
142
  //# sourceMappingURL=InputGroup.stories.js.map
@@ -1,43 +1,43 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import '@testing-library/jest-dom/extend-expect';
4
- import { InputGroup } from './InputGroup';
5
- describe('InputGroup', () => {
6
- const defaultProps = {
7
- value: 'with tooltip',
8
- append: [
9
- {
10
- variant: 'button',
11
- buttonProps: {
12
- icon: 'fc-annotate',
13
- iconStyle: 'theme',
14
- },
15
- },
16
- ],
17
- extraClassNames: 'extra-class',
18
- tooltip: 'Tooltip title',
19
- tooltipDelay: 0,
20
- id: 'input-group-id',
21
- testId: 'input-group-test-id',
22
- };
23
- it('renders without crashing', () => {
24
- const { getByTestId } = render(React.createElement(InputGroup, { ...defaultProps }));
25
- expect(getByTestId('input-group-test-id')).toBeInTheDocument();
26
- });
27
- it('applies the correct classes', () => {
28
- const { getByTestId } = render(React.createElement(InputGroup, { ...defaultProps }));
29
- const inputGroup = getByTestId('input-group-test-id');
30
- expect(inputGroup).toHaveClass('tw-flex');
31
- expect(inputGroup).toHaveClass('tw-outline-none');
32
- expect(inputGroup).toHaveClass('extra-class');
33
- });
34
- it('renders append items', () => {
35
- const { getByRole } = render(React.createElement(InputGroup, { ...defaultProps }));
36
- expect(getByRole('button')).toBeInTheDocument();
37
- });
38
- it('renders input element', () => {
39
- const { container } = render(React.createElement(InputGroup, { ...defaultProps }));
40
- expect(container.querySelector('input[type="text"]')).toBeInTheDocument();
41
- });
42
- });
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+ import { InputGroup } from './InputGroup';
5
+ describe('InputGroup', () => {
6
+ const defaultProps = {
7
+ value: 'with tooltip',
8
+ append: [
9
+ {
10
+ variant: 'button',
11
+ buttonProps: {
12
+ icon: 'fc-annotate',
13
+ iconStyle: 'theme',
14
+ },
15
+ },
16
+ ],
17
+ extraClassNames: 'extra-class',
18
+ tooltip: 'Tooltip title',
19
+ tooltipDelay: 0,
20
+ id: 'input-group-id',
21
+ testId: 'input-group-test-id',
22
+ };
23
+ it('renders without crashing', () => {
24
+ const { getByTestId } = render(React.createElement(InputGroup, { ...defaultProps }));
25
+ expect(getByTestId('input-group-test-id')).toBeInTheDocument();
26
+ });
27
+ it('applies the correct classes', () => {
28
+ const { getByTestId } = render(React.createElement(InputGroup, { ...defaultProps }));
29
+ const inputGroup = getByTestId('input-group-test-id');
30
+ expect(inputGroup).toHaveClass('tw-flex');
31
+ expect(inputGroup).toHaveClass('tw-outline-none');
32
+ expect(inputGroup).toHaveClass('extra-class');
33
+ });
34
+ it('renders append items', () => {
35
+ const { getByRole } = render(React.createElement(InputGroup, { ...defaultProps }));
36
+ expect(getByRole('button')).toBeInTheDocument();
37
+ });
38
+ it('renders input element', () => {
39
+ const { container } = render(React.createElement(InputGroup, { ...defaultProps }));
40
+ expect(container.querySelector('input[type="text"]')).toBeInTheDocument();
41
+ });
42
+ });
43
43
  //# sourceMappingURL=InputGroup.test.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=InputGroup.types.js.map
@@ -1,2 +1,2 @@
1
- export { InputGroup as default } from './InputGroup';
1
+ export { InputGroup as default } from './InputGroup';
2
2
  //# sourceMappingURL=index.js.map
@@ -1,100 +1,100 @@
1
- import React, { useEffect, useState } from 'react';
2
- import * as DialogPrimitive from '@radix-ui/react-dialog';
3
- import classNames from 'classnames';
4
- import '../styles.css';
5
- import Button from '../Button';
6
- import Icon from '../Icon';
7
- import TextField from '../TextField';
8
- const Dialog = DialogPrimitive.Root;
9
- const DialogPortal = DialogPrimitive.Portal;
10
- const DialogClose = DialogPrimitive.Close;
11
- const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (React.createElement(DialogPortal, null,
12
- React.createElement("div", { className: "tw-select-none tw-fixed tw-w-full tw-h-full tw-opacity-50 tw-inset-0 tw-z-[1009] tw-bg-sq-dark-background\n data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 " }),
1
+ import React, { useEffect, useState } from 'react';
2
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
3
+ import classNames from 'classnames';
4
+ import '../styles.css';
5
+ import Button from '../Button';
6
+ import Icon from '../Icon';
7
+ import TextField from '../TextField';
8
+ const Dialog = DialogPrimitive.Root;
9
+ const DialogPortal = DialogPrimitive.Portal;
10
+ const DialogClose = DialogPrimitive.Close;
11
+ const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (React.createElement(DialogPortal, null,
12
+ React.createElement("div", { className: "tw-select-none tw-fixed tw-w-full tw-h-full tw-opacity-50 tw-inset-0 tw-z-[1009] tw-bg-sq-dark-background\n data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 " }),
13
13
  React.createElement(DialogPrimitive.Content, { ref: ref, className: `tw-fixed tw-left-[50%] tw-top-0 tw-my-6 tw-translate-x-[-50%] tw-z-[1010] tw-grid
14
14
  tw-gap-4 tw-border tw-bg-sq-white dark:tw-bg-sq-dark-background tw-p-6 tw-shadow-lg tw-duration-200
15
- tw-rounded-lg ${className}`, ...props }, children))));
16
- DialogContent.displayName = DialogPrimitive.Content.displayName;
17
- const DialogHeader = (props) => (React.createElement("div", { className: "tw-w-full tw-justify-between" },
18
- React.createElement("div", { ...props })));
19
- DialogHeader.displayName = 'DialogHeader';
20
- const DialogFooter = (props) => React.createElement("div", { ...props });
21
- DialogFooter.displayName = 'DialogFooter';
22
- const DialogTitle = React.forwardRef((props, ref) => React.createElement(DialogPrimitive.Title, { ref: ref, ...props }));
23
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
24
- const DialogDescription = React.forwardRef((props, ref) => React.createElement(DialogPrimitive.Description, { ref: ref, ...props }));
25
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
26
- const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, subtitle, children, open = false, onClose, customButton = false, customButtonLabel = 'Back', onClickCustomButton, submitButtonLabel = 'Submit', cancelButtonLabel = 'Cancel', disableSubmitButton = false, stopPropagationSubmitButton = false, onSubmit, isTitleEditable = false, onTitleChanged, inputExtraClassNames, hideCloseIcon = false, size = 'xl', titleIconPosition = 'left', hideFooterButtons = false, hideSubmitButton = false, hideCancelButton = false, testId = 'modal', modalFooter, dialogClassName, titlePlaceholder, titleRequired, titleError, submitButtonTooltip, cancelButtonTooltip, disableCustomButton, customHeader, middleFooterSection = React.createElement(React.Fragment, null), customButtonVariant = 'outline', submitButtonVariant = 'theme', keepFocusInsideModal = true, onPointerDownOutside, }) => {
27
- const [isLoading, setIsLoading] = useState(false);
28
- // the Dialog is adding pointerEvents: none to body and the dropdowns from the modal does not work anymore
29
- useEffect(() => {
30
- if (open) {
31
- // Pushing the change to the end of the call stack
32
- const timer = setTimeout(() => {
33
- document.body.style.pointerEvents = '';
34
- }, 0);
35
- return () => clearTimeout(timer);
36
- }
37
- else {
38
- document.body.style.pointerEvents = 'auto';
39
- }
40
- }, [open]);
41
- const handleSubmit = async (e) => {
42
- if (!onSubmit)
43
- return;
44
- try {
45
- setIsLoading(true);
46
- await onSubmit(e);
47
- }
48
- finally {
49
- setIsLoading(false);
50
- }
51
- };
52
- const renderTitle = () => {
53
- let titleIconElement = React.createElement(React.Fragment, null);
54
- if (titleIcon) {
55
- if (typeof titleIcon === 'string') {
56
- titleIconElement = (React.createElement(Icon, { icon: titleIcon, testId: "modalTitleIcon", extraClassNames: "tw-flex tw-text-xl tw-mt-1" }));
57
- }
58
- else {
59
- titleIconElement = React.createElement("div", { className: "tw-mt-1.5" }, titleIcon);
60
- }
61
- }
62
- return (React.createElement(React.Fragment, null,
63
- titleIcon && titleIconPosition === 'left' ? React.createElement("div", { className: "tw-flex tw-mr-2" }, titleIconElement) : React.createElement(React.Fragment, null),
64
- React.createElement(DialogTitle, { asChild: true }, isTitleEditable ? (React.createElement("div", { className: "tw-flex tw-w-full tw-items-center" },
65
- React.createElement(TextField, { extraClassNames: inputExtraClassNames, value: title, type: "text", testId: "modalTitle", onChange: onTitleChanged, placeholder: titlePlaceholder, required: titleRequired, showError: !!titleError }),
66
- titleError && React.createElement("p", { className: "tw-text-sq-danger-color tw-min-w-fit tw-pl-2 tw-mb-0" }, titleError))) : (customHeader ?? (React.createElement("div", { "data-testid": "modalTitle", className: "modal-title" },
67
- React.createElement("div", { className: "tw-flex tw-items-center" },
68
- React.createElement("h3", null, title),
69
- titleSuffixLabel && React.createElement("span", { className: "tw-text-xl tw-pl-0.5" }, titleSuffixLabel)),
70
- subtitle && (React.createElement("div", { className: "tw-italic tw-text-sm tw-text-left tw-mt-1", "data-testid": "modal-subtitle" }, subtitle)))))),
71
- titleIcon && titleIconPosition === 'right' ? React.createElement("div", { className: "tw-flex tw-ml-4" }, titleIconElement) : React.createElement(React.Fragment, null)));
72
- };
73
- return open ? (React.createElement(Dialog, { open: true, onOpenChange: onClose, modal: keepFocusInsideModal },
74
- React.createElement(DialogContent, { onPointerDownOutside: (e) => (onPointerDownOutside ? onPointerDownOutside(e) : e.preventDefault()), "data-testid": testId, className: classNames(`modalContent tw-w-full !tw-p-0 tw-border-none tw-shadow-none dark:tw-text-sq-dark-text !tw-gap-0`, {
75
- 'tw-max-w-xs': size === 'xs',
76
- 'tw-max-w-sm': size === 'sm',
77
- 'tw-max-w-md': size === 'md',
78
- 'tw-max-w-lg': size === 'lg',
79
- 'tw-max-w-xl': size === 'xl',
80
- 'tw-max-w-2xl': size === '2xl',
81
- 'tw-max-w-3xl': size === '3xl',
82
- 'tw-max-w-4xl': size === '4xl',
83
- 'tw-max-w-5xl': size === '5xl',
84
- 'tw-max-w-6xl': size === '6xl',
85
- }, dialogClassName) },
86
- React.createElement(DialogHeader, { className: "modal-header tw-flex tw-w-full tw-justify-between tw-border-sq-disabled-gray\n dark:tw-border-sq-dark-disabled-gray tw-border-0 tw-border-b tw-px-6 tw-py-4" },
87
- React.createElement("div", { className: "tw-flex tw-w-full" }, renderTitle()),
88
- !hideCloseIcon && (React.createElement(DialogClose, { autoFocus: false, className: "[&:has(:focus-visible)]:none tw-opacity-70 tw-bg-transparent hover:tw-opacity-100 close tw-cursor-pointer tw-ml-4", "data-testid": "closeButton" },
89
- React.createElement("span", { className: "tw-cursor-pointer" }, "\u00D7")))),
90
- React.createElement(DialogDescription, { className: "modal-body tw-px-6 tw-py-4 tw-overflow-y-auto", asChild: true }, children),
91
- !hideFooterButtons && (React.createElement(DialogFooter, { className: "modal-footer tw-px-6 tw-py-4" }, modalFooter ?? (React.createElement("div", { className: "tw-flex tw-w-full tw-justify-between", "data-testid": "modalFooter" },
92
- React.createElement("div", { className: "tw-flex tw-justify-start" }, customButton && (React.createElement(Button, { label: customButtonLabel, onClick: onClickCustomButton, disabled: disableCustomButton, extraClassNames: "tw-justify-start tw-min-w-[100px]", testId: "customButton", variant: customButtonVariant }))),
93
- React.createElement("div", { className: "tw-flex tw-justify-end" },
94
- React.createElement("div", { className: "tw-flex tw-items-center" }, middleFooterSection),
95
- !hideCancelButton && (React.createElement(DialogClose, { asChild: true },
96
- React.createElement(Button, { label: cancelButtonLabel, extraClassNames: "tw-mr-5 tw-min-w-[100px]", tooltip: cancelButtonTooltip, variant: "outline", stopPropagation: false, testId: "cancelButton" }))),
97
- !hideSubmitButton && (React.createElement(Button, { label: submitButtonLabel, onClick: handleSubmit, disabled: disableSubmitButton || isLoading, variant: submitButtonVariant, stopPropagation: stopPropagationSubmitButton, tooltip: submitButtonTooltip, icon: isLoading ? 'fc-loading-notch tw-animate-spin' : undefined, iconPosition: "left", testId: "submitButton", extraClassNames: "tw-min-w-[100px]" })))))))))) : (React.createElement(React.Fragment, null));
98
- };
99
- export default Modal;
15
+ tw-rounded-lg ${className}`, ...props }, children))));
16
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
17
+ const DialogHeader = (props) => (React.createElement("div", { className: "tw-w-full tw-justify-between" },
18
+ React.createElement("div", { ...props })));
19
+ DialogHeader.displayName = 'DialogHeader';
20
+ const DialogFooter = (props) => React.createElement("div", { ...props });
21
+ DialogFooter.displayName = 'DialogFooter';
22
+ const DialogTitle = React.forwardRef((props, ref) => React.createElement(DialogPrimitive.Title, { ref: ref, ...props }));
23
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
24
+ const DialogDescription = React.forwardRef((props, ref) => React.createElement(DialogPrimitive.Description, { ref: ref, ...props }));
25
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
26
+ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, subtitle, children, open = false, onClose, customButton = false, customButtonLabel = 'Back', onClickCustomButton, submitButtonLabel = 'Submit', cancelButtonLabel = 'Cancel', disableSubmitButton = false, stopPropagationSubmitButton = false, onSubmit, isTitleEditable = false, onTitleChanged, inputExtraClassNames, hideCloseIcon = false, size = 'xl', titleIconPosition = 'left', hideFooterButtons = false, hideSubmitButton = false, hideCancelButton = false, testId = 'modal', modalFooter, dialogClassName, titlePlaceholder, titleRequired, titleError, submitButtonTooltip, cancelButtonTooltip, disableCustomButton, customHeader, middleFooterSection = React.createElement(React.Fragment, null), customButtonVariant = 'outline', submitButtonVariant = 'theme', keepFocusInsideModal = true, onPointerDownOutside, }) => {
27
+ const [isLoading, setIsLoading] = useState(false);
28
+ // the Dialog is adding pointerEvents: none to body and the dropdowns from the modal does not work anymore
29
+ useEffect(() => {
30
+ if (open) {
31
+ // Pushing the change to the end of the call stack
32
+ const timer = setTimeout(() => {
33
+ document.body.style.pointerEvents = '';
34
+ }, 0);
35
+ return () => clearTimeout(timer);
36
+ }
37
+ else {
38
+ document.body.style.pointerEvents = 'auto';
39
+ }
40
+ }, [open]);
41
+ const handleSubmit = async (e) => {
42
+ if (!onSubmit)
43
+ return;
44
+ try {
45
+ setIsLoading(true);
46
+ await onSubmit(e);
47
+ }
48
+ finally {
49
+ setIsLoading(false);
50
+ }
51
+ };
52
+ const renderTitle = () => {
53
+ let titleIconElement = React.createElement(React.Fragment, null);
54
+ if (titleIcon) {
55
+ if (typeof titleIcon === 'string') {
56
+ titleIconElement = (React.createElement(Icon, { icon: titleIcon, testId: "modalTitleIcon", extraClassNames: "tw-flex tw-text-xl tw-mt-1" }));
57
+ }
58
+ else {
59
+ titleIconElement = React.createElement("div", { className: "tw-mt-1.5" }, titleIcon);
60
+ }
61
+ }
62
+ return (React.createElement(React.Fragment, null,
63
+ titleIcon && titleIconPosition === 'left' ? React.createElement("div", { className: "tw-flex tw-mr-2" }, titleIconElement) : React.createElement(React.Fragment, null),
64
+ React.createElement(DialogTitle, { asChild: true }, isTitleEditable ? (React.createElement("div", { className: "tw-flex tw-w-full tw-items-center" },
65
+ React.createElement(TextField, { extraClassNames: inputExtraClassNames, value: title, type: "text", testId: "modalTitle", onChange: onTitleChanged, placeholder: titlePlaceholder, required: titleRequired, showError: !!titleError }),
66
+ titleError && React.createElement("p", { className: "tw-text-sq-danger-color tw-min-w-fit tw-pl-2 tw-mb-0" }, titleError))) : (customHeader ?? (React.createElement("div", { "data-testid": "modalTitle", className: "modal-title" },
67
+ React.createElement("div", { className: "tw-flex tw-items-center" },
68
+ React.createElement("h3", null, title),
69
+ titleSuffixLabel && React.createElement("span", { className: "tw-text-xl tw-pl-0.5" }, titleSuffixLabel)),
70
+ subtitle && (React.createElement("div", { className: "tw-italic tw-text-sm tw-text-left tw-mt-1", "data-testid": "modal-subtitle" }, subtitle)))))),
71
+ titleIcon && titleIconPosition === 'right' ? React.createElement("div", { className: "tw-flex tw-ml-4" }, titleIconElement) : React.createElement(React.Fragment, null)));
72
+ };
73
+ return open ? (React.createElement(Dialog, { open: true, onOpenChange: onClose, modal: keepFocusInsideModal },
74
+ React.createElement(DialogContent, { onPointerDownOutside: (e) => (onPointerDownOutside ? onPointerDownOutside(e) : e.preventDefault()), "data-testid": testId, className: classNames(`modalContent tw-w-full !tw-p-0 tw-border-none tw-shadow-none dark:tw-text-sq-dark-text !tw-gap-0`, {
75
+ 'tw-max-w-xs': size === 'xs',
76
+ 'tw-max-w-sm': size === 'sm',
77
+ 'tw-max-w-md': size === 'md',
78
+ 'tw-max-w-lg': size === 'lg',
79
+ 'tw-max-w-xl': size === 'xl',
80
+ 'tw-max-w-2xl': size === '2xl',
81
+ 'tw-max-w-3xl': size === '3xl',
82
+ 'tw-max-w-4xl': size === '4xl',
83
+ 'tw-max-w-5xl': size === '5xl',
84
+ 'tw-max-w-6xl': size === '6xl',
85
+ }, dialogClassName) },
86
+ React.createElement(DialogHeader, { className: "modal-header tw-flex tw-w-full tw-justify-between tw-border-sq-disabled-gray\n dark:tw-border-sq-dark-disabled-gray tw-border-0 tw-border-b tw-px-6 tw-py-4" },
87
+ React.createElement("div", { className: "tw-flex tw-w-full" }, renderTitle()),
88
+ !hideCloseIcon && (React.createElement(DialogClose, { autoFocus: false, className: "[&:has(:focus-visible)]:none tw-opacity-70 tw-bg-transparent hover:tw-opacity-100 close tw-cursor-pointer tw-ml-4", "data-testid": "closeButton" },
89
+ React.createElement("span", { className: "tw-cursor-pointer" }, "\u00D7")))),
90
+ React.createElement(DialogDescription, { className: "modal-body tw-px-6 tw-py-4 tw-overflow-y-auto", asChild: true }, children),
91
+ !hideFooterButtons && (React.createElement(DialogFooter, { className: "modal-footer tw-px-6 tw-py-4" }, modalFooter ?? (React.createElement("div", { className: "tw-flex tw-w-full tw-justify-between", "data-testid": "modalFooter" },
92
+ React.createElement("div", { className: "tw-flex tw-justify-start" }, customButton && (React.createElement(Button, { label: customButtonLabel, onClick: onClickCustomButton, disabled: disableCustomButton, extraClassNames: "tw-justify-start tw-min-w-[100px]", testId: "customButton", variant: customButtonVariant }))),
93
+ React.createElement("div", { className: "tw-flex tw-justify-end" },
94
+ React.createElement("div", { className: "tw-flex tw-items-center" }, middleFooterSection),
95
+ !hideCancelButton && (React.createElement(DialogClose, { asChild: true },
96
+ React.createElement(Button, { label: cancelButtonLabel, extraClassNames: "tw-mr-5 tw-min-w-[100px]", tooltip: cancelButtonTooltip, variant: "outline", stopPropagation: false, testId: "cancelButton" }))),
97
+ !hideSubmitButton && (React.createElement(Button, { label: submitButtonLabel, onClick: handleSubmit, disabled: disableSubmitButton || isLoading, variant: submitButtonVariant, stopPropagation: stopPropagationSubmitButton, tooltip: submitButtonTooltip, icon: isLoading ? 'fc-loading-notch tw-animate-spin' : undefined, iconPosition: "left", testId: "submitButton", extraClassNames: "tw-min-w-[100px]" })))))))))) : (React.createElement(React.Fragment, null));
98
+ };
99
+ export default Modal;
100
100
  //# sourceMappingURL=Modal.js.map