@seeqdev/qomponents 0.0.142 → 0.0.143

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 (247) hide show
  1. package/dist/Accordion/Accordion.js +9 -0
  2. package/dist/Accordion/Accordion.js.map +1 -0
  3. package/dist/Accordion/Accordion.stories.js +115 -0
  4. package/dist/Accordion/Accordion.stories.js.map +1 -0
  5. package/dist/Accordion/Accordion.test.js +55 -0
  6. package/dist/Accordion/Accordion.test.js.map +1 -0
  7. package/dist/Accordion/Accordion.types.js +2 -0
  8. package/dist/Accordion/Accordion.types.js.map +1 -0
  9. package/dist/Accordion/index.js +2 -0
  10. package/dist/Accordion/index.js.map +1 -0
  11. package/dist/Alert/Alert.js +34 -0
  12. package/dist/Alert/Alert.js.map +1 -0
  13. package/dist/Alert/Alert.stories.js +52 -0
  14. package/dist/Alert/Alert.stories.js.map +1 -0
  15. package/dist/Alert/Alert.test.js +51 -0
  16. package/dist/Alert/Alert.test.js.map +1 -0
  17. package/dist/Alert/Alert.types.js +2 -0
  18. package/dist/Alert/Alert.types.js.map +1 -0
  19. package/dist/Alert/index.js +2 -0
  20. package/dist/Alert/index.js.map +1 -0
  21. package/dist/Button/Button.js +92 -0
  22. package/dist/Button/Button.js.map +1 -0
  23. package/dist/Button/Button.stories.js +100 -0
  24. package/dist/Button/Button.stories.js.map +1 -0
  25. package/dist/Button/Button.test.js +49 -0
  26. package/dist/Button/Button.test.js.map +1 -0
  27. package/dist/Button/Button.types.js +5 -0
  28. package/dist/Button/Button.types.js.map +1 -0
  29. package/dist/Button/index.js +2 -0
  30. package/dist/Button/index.js.map +1 -0
  31. package/dist/ButtonGroup/ButtonGroup.js +35 -0
  32. package/dist/ButtonGroup/ButtonGroup.js.map +1 -0
  33. package/dist/ButtonGroup/ButtonGroup.stories.js +385 -0
  34. package/dist/ButtonGroup/ButtonGroup.stories.js.map +1 -0
  35. package/dist/ButtonGroup/ButtonGroup.test.js +67 -0
  36. package/dist/ButtonGroup/ButtonGroup.test.js.map +1 -0
  37. package/dist/ButtonGroup/ButtonGroup.types.js +2 -0
  38. package/dist/ButtonGroup/ButtonGroup.types.js.map +1 -0
  39. package/dist/ButtonGroup/index.js +2 -0
  40. package/dist/ButtonGroup/index.js.map +1 -0
  41. package/dist/ButtonWithDropdown/ButtonWithDropdown.js +60 -0
  42. package/dist/ButtonWithDropdown/ButtonWithDropdown.js.map +1 -0
  43. package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +143 -0
  44. package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js.map +1 -0
  45. package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +93 -0
  46. package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js.map +1 -0
  47. package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +2 -0
  48. package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js.map +1 -0
  49. package/dist/ButtonWithDropdown/index.js +2 -0
  50. package/dist/ButtonWithDropdown/index.js.map +1 -0
  51. package/dist/ButtonWithPopover/ButtonWithPopover.js +62 -0
  52. package/dist/ButtonWithPopover/ButtonWithPopover.js.map +1 -0
  53. package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +75 -0
  54. package/dist/ButtonWithPopover/ButtonWithPopover.stories.js.map +1 -0
  55. package/dist/ButtonWithPopover/ButtonWithPopover.test.js +82 -0
  56. package/dist/ButtonWithPopover/ButtonWithPopover.test.js.map +1 -0
  57. package/dist/ButtonWithPopover/ButtonWithPopover.types.js +2 -0
  58. package/dist/ButtonWithPopover/ButtonWithPopover.types.js.map +1 -0
  59. package/dist/ButtonWithPopover/index.js +2 -0
  60. package/dist/ButtonWithPopover/index.js.map +1 -0
  61. package/dist/Carousel/Carousel.js +67 -0
  62. package/dist/Carousel/Carousel.js.map +1 -0
  63. package/dist/Carousel/Carousel.stories.js +115 -0
  64. package/dist/Carousel/Carousel.stories.js.map +1 -0
  65. package/dist/Carousel/Carousel.test.js +48 -0
  66. package/dist/Carousel/Carousel.test.js.map +1 -0
  67. package/dist/Carousel/Carousel.types.js +2 -0
  68. package/dist/Carousel/Carousel.types.js.map +1 -0
  69. package/dist/Carousel/index.js +2 -0
  70. package/dist/Carousel/index.js.map +1 -0
  71. package/dist/Checkbox/Checkbox.js +26 -0
  72. package/dist/Checkbox/Checkbox.js.map +1 -0
  73. package/dist/Checkbox/Checkbox.stories.js +34 -0
  74. package/dist/Checkbox/Checkbox.stories.js.map +1 -0
  75. package/dist/Checkbox/Checkbox.test.js +94 -0
  76. package/dist/Checkbox/Checkbox.test.js.map +1 -0
  77. package/dist/Checkbox/Checkbox.types.js +2 -0
  78. package/dist/Checkbox/Checkbox.types.js.map +1 -0
  79. package/dist/Checkbox/index.js +2 -0
  80. package/dist/Checkbox/index.js.map +1 -0
  81. package/dist/Collapse/Collapse.js +18 -0
  82. package/dist/Collapse/Collapse.js.map +1 -0
  83. package/dist/Collapse/Collapse.stories.js +37 -0
  84. package/dist/Collapse/Collapse.stories.js.map +1 -0
  85. package/dist/Collapse/Collapse.test.js +19 -0
  86. package/dist/Collapse/Collapse.test.js.map +1 -0
  87. package/dist/Collapse/Collapse.types.js +2 -0
  88. package/dist/Collapse/Collapse.types.js.map +1 -0
  89. package/dist/Collapse/index.js +2 -0
  90. package/dist/Collapse/index.js.map +1 -0
  91. package/dist/Icon/Icon.js +55 -0
  92. package/dist/Icon/Icon.js.map +1 -0
  93. package/dist/Icon/Icon.stories.js +47 -0
  94. package/dist/Icon/Icon.stories.js.map +1 -0
  95. package/dist/Icon/Icon.test.js +55 -0
  96. package/dist/Icon/Icon.test.js.map +1 -0
  97. package/dist/Icon/Icon.types.js +16 -0
  98. package/dist/Icon/Icon.types.js.map +1 -0
  99. package/dist/Icon/index.js +2 -0
  100. package/dist/Icon/index.js.map +1 -0
  101. package/dist/InputGroup/InputGroup.js +35 -0
  102. package/dist/InputGroup/InputGroup.js.map +1 -0
  103. package/dist/InputGroup/InputGroup.stories.js +176 -0
  104. package/dist/InputGroup/InputGroup.stories.js.map +1 -0
  105. package/dist/InputGroup/InputGroup.test.js +43 -0
  106. package/dist/InputGroup/InputGroup.test.js.map +1 -0
  107. package/dist/InputGroup/InputGroup.types.js +2 -0
  108. package/dist/InputGroup/InputGroup.types.js.map +1 -0
  109. package/dist/InputGroup/index.js +2 -0
  110. package/dist/InputGroup/index.js.map +1 -0
  111. package/dist/Modal/Modal.js +100 -0
  112. package/dist/Modal/Modal.js.map +1 -0
  113. package/dist/Modal/Modal.stories.js +127 -0
  114. package/dist/Modal/Modal.stories.js.map +1 -0
  115. package/dist/Modal/Modal.test.js +108 -0
  116. package/dist/Modal/Modal.test.js.map +1 -0
  117. package/dist/Modal/Modal.types.js +2 -0
  118. package/dist/Modal/Modal.types.js.map +1 -0
  119. package/dist/Modal/index.js +2 -0
  120. package/dist/Modal/index.js.map +1 -0
  121. package/dist/ProgressBar/ProgressBar.js +70 -0
  122. package/dist/ProgressBar/ProgressBar.js.map +1 -0
  123. package/dist/ProgressBar/ProgressBar.stories.js +83 -0
  124. package/dist/ProgressBar/ProgressBar.stories.js.map +1 -0
  125. package/dist/ProgressBar/ProgressBar.test.js +44 -0
  126. package/dist/ProgressBar/ProgressBar.test.js.map +1 -0
  127. package/dist/ProgressBar/ProgressBar.types.js +2 -0
  128. package/dist/ProgressBar/ProgressBar.types.js.map +1 -0
  129. package/dist/ProgressBar/index.js +2 -0
  130. package/dist/ProgressBar/index.js.map +1 -0
  131. package/dist/SeeqActionDropdown/SeeqActionDropdown.js +48 -0
  132. package/dist/SeeqActionDropdown/SeeqActionDropdown.js.map +1 -0
  133. package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js +87 -0
  134. package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js.map +1 -0
  135. package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js +73 -0
  136. package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js.map +1 -0
  137. package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js +2 -0
  138. package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js.map +1 -0
  139. package/dist/SeeqActionDropdown/index.js +2 -0
  140. package/dist/SeeqActionDropdown/index.js.map +1 -0
  141. package/dist/SeeqActionDropdown/variants.js +38 -0
  142. package/dist/SeeqActionDropdown/variants.js.map +1 -0
  143. package/dist/Select/Select.js +177 -0
  144. package/dist/Select/Select.js.map +1 -0
  145. package/dist/Select/Select.stories.js +80 -0
  146. package/dist/Select/Select.stories.js.map +1 -0
  147. package/dist/Select/Select.test.js +182 -0
  148. package/dist/Select/Select.test.js.map +1 -0
  149. package/dist/Select/Select.types.js +2 -0
  150. package/dist/Select/Select.types.js.map +1 -0
  151. package/dist/Select/index.js +3 -0
  152. package/dist/Select/index.js.map +1 -0
  153. package/dist/Slider/Slider.js +13 -0
  154. package/dist/Slider/Slider.js.map +1 -0
  155. package/dist/Slider/Slider.stories.js +58 -0
  156. package/dist/Slider/Slider.stories.js.map +1 -0
  157. package/dist/Slider/Slider.test.js +33 -0
  158. package/dist/Slider/Slider.test.js.map +1 -0
  159. package/dist/Slider/Slider.types.js +2 -0
  160. package/dist/Slider/Slider.types.js.map +1 -0
  161. package/dist/Slider/index.js +2 -0
  162. package/dist/Slider/index.js.map +1 -0
  163. package/dist/SvgIcon/SvgIcon.js +30 -0
  164. package/dist/SvgIcon/SvgIcon.js.map +1 -0
  165. package/dist/SvgIcon/SvgIcon.stories.js +42 -0
  166. package/dist/SvgIcon/SvgIcon.stories.js.map +1 -0
  167. package/dist/SvgIcon/SvgIcon.test.js +41 -0
  168. package/dist/SvgIcon/SvgIcon.test.js.map +1 -0
  169. package/dist/SvgIcon/SvgIcon.types.js +6 -0
  170. package/dist/SvgIcon/SvgIcon.types.js.map +1 -0
  171. package/dist/SvgIcon/index.js +2 -0
  172. package/dist/SvgIcon/index.js.map +1 -0
  173. package/dist/Tabs/Tabs.js +22 -0
  174. package/dist/Tabs/Tabs.js.map +1 -0
  175. package/dist/Tabs/Tabs.stories.js +91 -0
  176. package/dist/Tabs/Tabs.stories.js.map +1 -0
  177. package/dist/Tabs/Tabs.test.js +91 -0
  178. package/dist/Tabs/Tabs.test.js.map +1 -0
  179. package/dist/Tabs/Tabs.types.js +2 -0
  180. package/dist/Tabs/Tabs.types.js.map +1 -0
  181. package/dist/Tabs/index.js +2 -0
  182. package/dist/Tabs/index.js.map +1 -0
  183. package/dist/TextArea/TextArea.js +25 -0
  184. package/dist/TextArea/TextArea.js.map +1 -0
  185. package/dist/TextArea/TextArea.stories.js +46 -0
  186. package/dist/TextArea/TextArea.stories.js.map +1 -0
  187. package/dist/TextArea/TextArea.test.js +68 -0
  188. package/dist/TextArea/TextArea.test.js.map +1 -0
  189. package/dist/TextArea/TextArea.types.js +2 -0
  190. package/dist/TextArea/TextArea.types.js.map +1 -0
  191. package/dist/TextArea/index.js +2 -0
  192. package/dist/TextArea/index.js.map +1 -0
  193. package/dist/TextField/TextField.js +79 -0
  194. package/dist/TextField/TextField.js.map +1 -0
  195. package/dist/TextField/TextField.stories.js +70 -0
  196. package/dist/TextField/TextField.stories.js.map +1 -0
  197. package/dist/TextField/TextField.test.js +39 -0
  198. package/dist/TextField/TextField.test.js.map +1 -0
  199. package/dist/TextField/TextField.types.js +2 -0
  200. package/dist/TextField/TextField.types.js.map +1 -0
  201. package/dist/TextField/index.js +2 -0
  202. package/dist/TextField/index.js.map +1 -0
  203. package/dist/ToolbarButton/ToolbarButton.js +69 -0
  204. package/dist/ToolbarButton/ToolbarButton.js.map +1 -0
  205. package/dist/ToolbarButton/ToolbarButton.stories.js +97 -0
  206. package/dist/ToolbarButton/ToolbarButton.stories.js.map +1 -0
  207. package/dist/ToolbarButton/ToolbarButton.test.js +93 -0
  208. package/dist/ToolbarButton/ToolbarButton.test.js.map +1 -0
  209. package/dist/ToolbarButton/ToolbarButton.types.js +2 -0
  210. package/dist/ToolbarButton/ToolbarButton.types.js.map +1 -0
  211. package/dist/ToolbarButton/index.js +2 -0
  212. package/dist/ToolbarButton/index.js.map +1 -0
  213. package/dist/Tooltip/QTip.stories.js +45 -0
  214. package/dist/Tooltip/QTip.stories.js.map +1 -0
  215. package/dist/Tooltip/QTip.types.js +2 -0
  216. package/dist/Tooltip/QTip.types.js.map +1 -0
  217. package/dist/Tooltip/QTipPerformance.stories.js +30 -0
  218. package/dist/Tooltip/QTipPerformance.stories.js.map +1 -0
  219. package/dist/Tooltip/Qtip.js +168 -0
  220. package/dist/Tooltip/Qtip.js.map +1 -0
  221. package/dist/Tooltip/Tooltip.js +36 -0
  222. package/dist/Tooltip/Tooltip.js.map +1 -0
  223. package/dist/Tooltip/Tooltip.stories.js +32 -0
  224. package/dist/Tooltip/Tooltip.stories.js.map +1 -0
  225. package/dist/Tooltip/Tooltip.types.js +3 -0
  226. package/dist/Tooltip/Tooltip.types.js.map +1 -0
  227. package/dist/Tooltip/TooltipPerformance.stories.js +30 -0
  228. package/dist/Tooltip/TooltipPerformance.stories.js.map +1 -0
  229. package/dist/Tooltip/index.js +3 -0
  230. package/dist/Tooltip/index.js.map +1 -0
  231. package/dist/Tooltip/qTip.utilities.js +11 -0
  232. package/dist/Tooltip/qTip.utilities.js.map +1 -0
  233. package/dist/index.esm.js +2 -4
  234. package/dist/index.esm.js.map +1 -1
  235. package/dist/index.js +2 -4
  236. package/dist/index.js.map +1 -1
  237. package/dist/types.js +2 -0
  238. package/dist/types.js.map +1 -0
  239. package/dist/utils/browserId.js +29 -0
  240. package/dist/utils/browserId.js.map +1 -0
  241. package/dist/utils/svg.js +20 -0
  242. package/dist/utils/svg.js.map +1 -0
  243. package/dist/utils/validateStyleDimension.js +14 -0
  244. package/dist/utils/validateStyleDimension.js.map +1 -0
  245. package/dist/utils/validateStyleDimension.test.js +20 -0
  246. package/dist/utils/validateStyleDimension.test.js.map +1 -0
  247. package/package.json +1 -1
@@ -0,0 +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 " }),
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
+ 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, onInteractOutside, }) => {
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()), onInteractOutside: (e) => (onInteractOutside ? onInteractOutside(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
+ //# sourceMappingURL=Modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../src/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAA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EAAC,mCAAmC,EACnD,MAAM,EAAC,cAAc,EACrB,OAAO,EAAE,mBAAmB,GAC5B,CACH,CACG;gBACN,6BAAK,SAAS,EAAC,wBAAwB;oBACrC,6BAAK,SAAS,EAAC,yBAAyB,IAAE,mBAAmB,CAAO;oBACnE,CAAC,gBAAgB,IAAI,CACpB,oBAAC,WAAW,IAAC,OAAO;wBAClB,oBAAC,MAAM,IACL,KAAK,EAAE,iBAAiB,EACxB,eAAe,EAAC,0BAA0B,EAC1C,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAC,SAAS,EACjB,eAAe,EAAE,KAAK,EACtB,MAAM,EAAC,cAAc,GACrB,CACU,CACf;oBACA,CAAC,gBAAgB,IAAI,CACpB,oBAAC,MAAM,IACL,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,mBAAmB,IAAI,SAAS,EAC1C,OAAO,EAAE,mBAAmB,EAC5B,eAAe,EAAE,2BAA2B,EAC5C,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,SAAS,EAChE,YAAY,EAAC,MAAM,EACnB,MAAM,EAAC,cAAc,EACrB,eAAe,EAAC,kBAAkB,GAClC,CACH,CACG,CACF,CACP,CACY,CAChB,CACa,CACT,CACV,CAAC,CAAC,CAAC,CACF,yCAAK,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,127 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import Modal from './Modal';
3
+ import Button from '../Button';
4
+ export default {
5
+ title: 'Modal',
6
+ };
7
+ const modalBody = (React.createElement("div", null, "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."));
8
+ const waitUntil = async (timeout) => {
9
+ return new Promise((resolve) => {
10
+ setTimeout(() => resolve('yes'), timeout);
11
+ });
12
+ };
13
+ const ModalComponent = ({ bodyClass = '', title: originalTitle, titleIcon, isTitleEditable, children, hideCloseIcon, disableSubmitButton, size, buttonLabel = 'Open Modal', customButton, customButtonLabel, submitButtonVariant, onSubmit, }) => {
14
+ const [open, setOpen] = useState(false);
15
+ const [title, setTitle] = useState(originalTitle);
16
+ useEffect(() => {
17
+ return () => {
18
+ document.body.className = '';
19
+ };
20
+ }, []);
21
+ const onClose = () => {
22
+ document.body.className = '';
23
+ setOpen(false);
24
+ };
25
+ return (React.createElement("div", { className: "tw-p-4" },
26
+ React.createElement(Button, { onClick: () => {
27
+ document.body.className = bodyClass;
28
+ setOpen(true);
29
+ }, label: buttonLabel }),
30
+ React.createElement(Modal, { open: open, onClose: onClose, title: title, titleIcon: titleIcon, isTitleEditable: isTitleEditable, onTitleChanged: (event) => setTitle(event.target.value), hideCloseIcon: hideCloseIcon, disableSubmitButton: disableSubmitButton, size: size, onSubmit: onSubmit, customButton: customButton, submitButtonVariant: submitButtonVariant, onPointerDownOutside: onClose, customButtonLabel: customButtonLabel }, children)));
31
+ };
32
+ export const AllModalsVariants = () => {
33
+ const colors = ['Topic', 'Analysis', 'Datalab', 'Vantage'];
34
+ const sizes = ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl'];
35
+ return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" }, colors.map((color) => (React.createElement("div", { key: color },
36
+ React.createElement("b", null,
37
+ color,
38
+ " colors"),
39
+ React.createElement("div", { className: "tw-p-4 light" }, sizes.map((size) => (React.createElement(ModalComponent, { key: `${size}_${color}`, bodyClass: `color_${color.toLowerCase()}`, title: "Modal example", children: modalBody, size: size, buttonLabel: `Open ${size} size modal` })))),
40
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" }, sizes.map((size) => (React.createElement(ModalComponent, { key: `${size}_${color}_dark`, bodyClass: `color_${color.toLowerCase()} tw-dark color_${color.toLowerCase()}_dark`, title: "Modal example", children: modalBody, size: size, buttonLabel: `Open ${size} size modal` })))))))));
41
+ };
42
+ export const ModalsWithDisabledSubmit = () => (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
43
+ React.createElement("div", null,
44
+ React.createElement("b", null, "Topic Colors"),
45
+ React.createElement("div", { className: "tw-p-4 light" },
46
+ React.createElement(ModalComponent, { bodyClass: "color_topic", title: "Disabled submit button example", disableSubmitButton: true, children: modalBody })),
47
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
48
+ React.createElement(ModalComponent, { bodyClass: "color_topic tw-dark color_analysis_dark", title: "Disabled submit button example", disableSubmitButton: true, children: modalBody }))),
49
+ React.createElement("div", null,
50
+ React.createElement("b", null, "Analysis Colors"),
51
+ React.createElement("div", { className: "tw-p-4 light" },
52
+ React.createElement(ModalComponent, { bodyClass: "color_analysis", title: "Disabled submit button example", disableSubmitButton: true, children: modalBody })),
53
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
54
+ React.createElement(ModalComponent, { bodyClass: "color_analysis tw-dark color_analysis_dark", title: "Disabled submit button example", disableSubmitButton: true, children: modalBody }))),
55
+ React.createElement("div", null,
56
+ React.createElement("b", null, "Datalab Colors"),
57
+ React.createElement("div", { className: "tw-p-4 light" },
58
+ React.createElement(ModalComponent, { bodyClass: "color_datalab", title: "Disabled submit button example", disableSubmitButton: true, children: modalBody })),
59
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
60
+ React.createElement(ModalComponent, { bodyClass: "color_datalab tw-dark color_analysis_dark", title: "Disabled submit button example", disableSubmitButton: true, children: modalBody }))),
61
+ React.createElement("div", null,
62
+ React.createElement("b", null, "Vantage Colors"),
63
+ React.createElement("div", { className: "tw-p-4 light" },
64
+ React.createElement(ModalComponent, { bodyClass: "color_vantage", title: "Disabled submit button example", disableSubmitButton: true, children: modalBody })),
65
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
66
+ React.createElement(ModalComponent, { bodyClass: "color_vantage tw-dark color_vantage_dark", title: "Disabled submit button example", disableSubmitButton: true, children: modalBody })))));
67
+ export const ModalsWithEditableTitle = () => {
68
+ const colors = ['Topic', 'Analysis', 'Datalab', 'Vantage'];
69
+ const sizes = ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl'];
70
+ return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" }, colors.map((color) => (React.createElement("div", { key: color },
71
+ React.createElement("b", null,
72
+ color,
73
+ " colors"),
74
+ React.createElement("div", { className: "tw-p-4 light" }, sizes.map((size) => (React.createElement(ModalComponent, { key: `${size}_${color}`, bodyClass: `color_${color.toLowerCase()}`, title: "Editable title example", isTitleEditable: true, titleIcon: "fc-check", children: modalBody, size: size, buttonLabel: `Open ${size} size modal` })))),
75
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" }, sizes.map((size) => (React.createElement(ModalComponent, { key: `${size}_${color}_dark`, bodyClass: `color_${color.toLowerCase()} tw-dark color_${color.toLowerCase()}_dark`, title: "Editable title example", isTitleEditable: true, titleIcon: "fc-check", children: modalBody, size: size, buttonLabel: `Open ${size} size modal` })))))))));
76
+ };
77
+ export const ModalsWithCustomButton = () => (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
78
+ React.createElement("div", null,
79
+ React.createElement("b", null, "Topic Colors"),
80
+ React.createElement("div", { className: "tw-p-4 light" },
81
+ React.createElement(ModalComponent, { bodyClass: "color_topic", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back" })),
82
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
83
+ React.createElement(ModalComponent, { bodyClass: "color_topic tw-dark color_analysis_dark", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back" }))),
84
+ React.createElement("div", null,
85
+ React.createElement("b", null, "Analysis Colors"),
86
+ React.createElement("div", { className: "tw-p-4 light" },
87
+ React.createElement(ModalComponent, { bodyClass: "color_analysis", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back" })),
88
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
89
+ React.createElement(ModalComponent, { bodyClass: "color_analysis tw-dark color_analysis_dark", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back" }))),
90
+ React.createElement("div", null,
91
+ React.createElement("b", null, "Datalab Colors"),
92
+ React.createElement("div", { className: "tw-p-4 light" },
93
+ React.createElement(ModalComponent, { bodyClass: "color_datalab", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back" })),
94
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
95
+ React.createElement(ModalComponent, { bodyClass: "color_datalab tw-dark color_analysis_dark", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back" }))),
96
+ React.createElement("div", null,
97
+ React.createElement("b", null, "Vantage Colors"),
98
+ React.createElement("div", { className: "tw-p-4 light" },
99
+ React.createElement(ModalComponent, { bodyClass: "color_vantage", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back" })),
100
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
101
+ React.createElement(ModalComponent, { bodyClass: "color_vantage tw-dark color_vantage_dark", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back" })))));
102
+ export const ModalsWithVariantButton = () => (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
103
+ React.createElement("div", null,
104
+ React.createElement("b", null, "Topic Colors"),
105
+ React.createElement("div", { className: "tw-p-4 light" },
106
+ React.createElement(ModalComponent, { bodyClass: "color_topic", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back", submitButtonVariant: "theme" })),
107
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
108
+ React.createElement(ModalComponent, { bodyClass: "color_topic tw-dark color_analysis_dark", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back", submitButtonVariant: "theme-light" }))),
109
+ React.createElement("div", null,
110
+ React.createElement("b", null, "Analysis Colors"),
111
+ React.createElement("div", { className: "tw-p-4 light" },
112
+ React.createElement(ModalComponent, { bodyClass: "color_analysis", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back", submitButtonVariant: "warning" })),
113
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
114
+ React.createElement(ModalComponent, { bodyClass: "color_analysis tw-dark color_analysis_dark", title: "Modal with custom button", children: modalBody, customButton: true, submitButtonVariant: "danger", customButtonLabel: "Back" }))),
115
+ React.createElement("div", null,
116
+ React.createElement("b", null, "Datalab Colors"),
117
+ React.createElement("div", { className: "tw-p-4 light" },
118
+ React.createElement(ModalComponent, { bodyClass: "color_datalab", title: "Modal with custom button", children: modalBody, customButton: true, customButtonLabel: "Back", submitButtonVariant: "outline" })),
119
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
120
+ React.createElement(ModalComponent, { bodyClass: "color_datalab tw-dark color_analysis_dark", title: "Modal with custom button", children: modalBody, customButton: true, submitButtonVariant: "no-border", customButtonLabel: "Back" }))),
121
+ React.createElement("div", null,
122
+ React.createElement("b", null, "Vantage Colors"),
123
+ React.createElement("div", { className: "tw-p-4 light" },
124
+ React.createElement(ModalComponent, { bodyClass: "color_vantage", title: "Modal with custom button", children: modalBody, customButton: true, submitButtonVariant: "theme", customButtonLabel: "Back" })),
125
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
126
+ React.createElement(ModalComponent, { bodyClass: "color_vantage tw-dark color_vantage_dark", title: "Modal with custom button", children: modalBody, submitButtonVariant: "outline", customButton: true, customButtonLabel: "Back" })))));
127
+ //# sourceMappingURL=Modal.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.stories.js","sourceRoot":"","sources":["../../src/Modal/Modal.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,MAAM,MAAM,WAAW,CAAC;AAG/B,eAAe;IACb,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,MAAM,SAAS,GAAG,CAChB,kmBAOM,CACP,CAAC;AAQF,MAAM,SAAS,GAAG,KAAK,EAAE,OAAe,EAAE,EAAE;IAC1C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,cAAc,GAAiD,CAAC,EACpE,SAAS,GAAG,EAAE,EACd,KAAK,EAAE,aAAa,EACpB,SAAS,EACT,eAAe,EACf,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,IAAI,EACJ,WAAW,GAAG,YAAY,EAC1B,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IAElD,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,M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@ -0,0 +1,108 @@
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 Modal from './Modal';
6
+ describe('Modal', () => {
7
+ class Context {
8
+ props = {
9
+ onTitleChanged: jest.fn(),
10
+ disableSubmitButton: false,
11
+ title: 'Testing Modal Dialog',
12
+ children: React.createElement("div", null, "Modal content"),
13
+ open: true,
14
+ };
15
+ }
16
+ let tc;
17
+ beforeEach(() => {
18
+ tc = new Context();
19
+ });
20
+ const renderModal = (props) => render(React.createElement(Modal, { ...props }));
21
+ describe('renders Modal', () => {
22
+ it('doesn\'t render the modal if the open state is false', () => {
23
+ const open = false;
24
+ renderModal({ ...tc.props, open });
25
+ expect(screen.queryByTestId('modal')).not.toBeInTheDocument();
26
+ });
27
+ it('renders the modal if the open state is true', () => {
28
+ renderModal(tc.props);
29
+ expect(screen.getByTestId('modal')).toBeInTheDocument();
30
+ expect(screen.getByTestId('modal')).toHaveClass('tw-max-w-xl');
31
+ });
32
+ it('calls onClose modal when close button is clicked', async () => {
33
+ const onClose = jest.fn();
34
+ const { getByTestId } = renderModal({ ...tc.props, onClose });
35
+ expect(screen.getByTestId('modal')).toBeInTheDocument();
36
+ await userEvent.click(getByTestId('closeButton'));
37
+ expect(onClose).toHaveBeenCalled();
38
+ });
39
+ it('hides close button', () => {
40
+ const hideCloseIcon = true;
41
+ const { queryByTestId } = renderModal({ ...tc.props, hideCloseIcon });
42
+ expect(queryByTestId('closeButton')).not.toBeInTheDocument();
43
+ });
44
+ it('renders modal size based on the size prop', () => {
45
+ const size = 'lg';
46
+ renderModal({ ...tc.props, size });
47
+ expect(screen.getByTestId('modal')).toHaveClass('tw-max-w-lg');
48
+ });
49
+ it('renders not editable title', () => {
50
+ renderModal(tc.props);
51
+ expect(screen.getByTestId('modalTitle')).not.toHaveAttribute('value');
52
+ });
53
+ it('renders editable title', () => {
54
+ const isTitleEditable = true;
55
+ const { getByTestId } = renderModal({ ...tc.props, isTitleEditable });
56
+ expect(getByTestId('modalTitle')).toHaveAttribute('value');
57
+ });
58
+ it('calls onChange when title is modified', async () => {
59
+ const isTitleEditable = true;
60
+ const { getByTestId } = renderModal({ ...tc.props, isTitleEditable });
61
+ await userEvent.type(getByTestId('modalTitle'), 'a');
62
+ expect(tc.props.onTitleChanged).toHaveBeenCalled();
63
+ });
64
+ it('displays icon title', () => {
65
+ const titleIcon = 'fc-check';
66
+ const { getByTestId } = renderModal({ ...tc.props, titleIcon });
67
+ expect(getByTestId('modalTitleIcon')).toBeInTheDocument();
68
+ });
69
+ it('calls onSubmit when submit button is clicked', async () => {
70
+ const onSubmit = jest.fn();
71
+ const { getByTestId } = renderModal({ ...tc.props, onSubmit });
72
+ expect(getByTestId('submitButton')).not.toBeDisabled();
73
+ await userEvent.click(getByTestId('submitButton'));
74
+ expect(onSubmit).toHaveBeenCalled();
75
+ });
76
+ it('displays the disabled submit button', async () => {
77
+ const onSubmit = jest.fn();
78
+ const disableSubmitButton = true;
79
+ const { getByTestId } = renderModal({ ...tc.props, onSubmit, disableSubmitButton });
80
+ expect(getByTestId('submitButton')).toBeDisabled();
81
+ await userEvent.click(getByTestId('submitButton'));
82
+ expect(onSubmit).not.toHaveBeenCalled();
83
+ });
84
+ it('calls onClose when cancel button is clicked', async () => {
85
+ const onClose = jest.fn();
86
+ const { getByTestId } = renderModal({ ...tc.props, onClose });
87
+ expect(getByTestId('cancelButton')).not.toBeDisabled();
88
+ await userEvent.click(getByTestId('cancelButton'));
89
+ expect(onClose).toHaveBeenCalled();
90
+ });
91
+ it('displays custom button', () => {
92
+ const customButton = true;
93
+ const customButtonLabel = 'Back';
94
+ const { getByTestId } = renderModal({ ...tc.props, customButton, customButtonLabel });
95
+ expect(getByTestId('customButton')).toBeInTheDocument();
96
+ });
97
+ it('calls onClickCustomButton when custom button is clicked', async () => {
98
+ const customButton = true;
99
+ const customButtonLabel = 'Back';
100
+ const onClickCustomButton = jest.fn();
101
+ const { getByTestId } = renderModal({ ...tc.props, customButtonLabel, customButton, onClickCustomButton });
102
+ expect(getByTestId('customButton')).toBeInTheDocument();
103
+ await userEvent.click(getByTestId('customButton'));
104
+ expect(onClickCustomButton).toHaveBeenCalled();
105
+ });
106
+ });
107
+ });
108
+ //# sourceMappingURL=Modal.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.test.js","sourceRoot":"","sources":["../../src/Modal/Modal.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,KAAK,MAAM,SAAS,CAAC;AAG5B,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,MAAM,OAAO;QACX,KAAK,GAAe;YAClB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;YACzB,mBAAmB,EAAE,KAAK;YAC1B,KAAK,EAAE,sBAAsB;YAC7B,QAAQ,EAAE,iDAAwB;YAClC,IAAI,EAAE,IAAI;SACX,CAAC;KACH;IAED,IAAI,EAAW,CAAC;IAChB,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,CAAC,KAAiB,EAAE,EAAE,CAAC,MAAM,CAAC,oBAAC,KAAK,OAAK,KAAK,GAAI,CAAC,CAAC;IAExE,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;QAC7B,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;YAC9D,MAAM,IAAI,GAAG,KAAK,CAAC;YACnB,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACnC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,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C,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Modal.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.types.js","sourceRoot":"","sources":["../../src/Modal/Modal.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export { default } from './Modal';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Modal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,70 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import * as Progress from '@radix-ui/react-progress';
3
+ import { getQTipData } from '../Tooltip/qTip.utilities';
4
+ import tinycolor from 'tinycolor2';
5
+ const baseLabelClasses = 'tw-left-1 tw-text-xs tw-text-sq-text-color dark:tw-text-sq-dark-text tw-items-center tw-h-[18px]';
6
+ const ProgressIndicator = (props) => {
7
+ const { value, color = undefined, testId, label, extraClasses = '', labelClasses = '', valuesLength, max, index, totalValue, ...tooltipProps } = props;
8
+ const tooltipData = getQTipData(tooltipProps);
9
+ const previousWidth = useRef(0);
10
+ const indicatorElementRef = useRef(null);
11
+ const [textColorClass, setTextColorClass] = React.useState('');
12
+ const [animatedWidth, setAnimatedWidth] = React.useState(previousWidth.current);
13
+ // Determine which corners to round based on position and total value
14
+ let roundedCorners = '';
15
+ if (totalValue >= max) {
16
+ // If progress is 100%, round both ends
17
+ if (index === 0 && valuesLength === 1) {
18
+ roundedCorners = 'tw-rounded-[15px]';
19
+ }
20
+ else if (index === 0) {
21
+ roundedCorners = 'tw-rounded-l-[15px]';
22
+ }
23
+ else if (index === valuesLength - 1) {
24
+ roundedCorners = 'tw-rounded-r-[15px]';
25
+ }
26
+ }
27
+ else {
28
+ // Otherwise, only round the leftmost indicator
29
+ if (index === 0) {
30
+ roundedCorners = 'tw-rounded-l-[15px]';
31
+ }
32
+ }
33
+ useEffect(() => {
34
+ const timeout = setTimeout(() => {
35
+ const newWidth = (Number(value) / Number(max)) * 100;
36
+ setAnimatedWidth(newWidth);
37
+ previousWidth.current = newWidth;
38
+ }, 100);
39
+ return () => clearTimeout(timeout);
40
+ }, [value]);
41
+ const bgColor = color || undefined;
42
+ const bgClass = color ? '' : 'tw-bg-sq-color-dark';
43
+ const computeTextClass = (elem) => {
44
+ const computedStyle = getComputedStyle(elem);
45
+ const backgroundColor = computedStyle.backgroundColor;
46
+ const textColorClass = tinycolor(backgroundColor).isDark()
47
+ ? 'tw-text-sq-white dark:tw-text-sq-white'
48
+ : 'tw-text-sq-text-color dark:tw-text-sq-text-color';
49
+ setTextColorClass(textColorClass);
50
+ };
51
+ useEffect(() => {
52
+ if (indicatorElementRef.current) {
53
+ computeTextClass(indicatorElementRef.current);
54
+ }
55
+ }, [!!indicatorElementRef.current]);
56
+ return (React.createElement(Progress.Indicator, { className: `tw-ease-[cubic-bezier(0.65, 0, 0.35, 1)] tw-w-full tw-h-[18px] tw-duration-[660ms] tw-flex tw-justify-center tw-items-center ${valuesLength === 1 ? '' : 'tw-overflow-hidden'} ${roundedCorners} ${bgClass} ${extraClasses}`, ...tooltipData, "data-qtip-text": tooltipProps.tooltip ? tooltipProps.tooltip : `${value}%`, "data-testid": `progress-bar-indicator-${testId ? testId : value}`, key: `${index}-${value}`, ref: indicatorElementRef, style: {
57
+ // Background color will default to the theme color if undefined
58
+ backgroundColor: bgColor,
59
+ animation: 'width 660ms forwards',
60
+ width: `${animatedWidth}%`,
61
+ } }, label ? (React.createElement("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw-absolute tw-z-50' : ''}` }, label)) : undefined));
62
+ };
63
+ const ProgressBar = ({ values = [], max = 100, containerExtraClasses = '', zeroValueLabel = 'No progress yet', }) => {
64
+ const totalValue = values.reduce((acc, { value }) => acc + value, 0);
65
+ return (React.createElement(Progress.Root, { className: `tw-relative tw-h-[18px] tw-w-full tw-overflow-hidden tw-rounded-[15px] tw-bg-sq-dark-gray dark:tw-bg-sq-dark-disabled-gray tw-flex tw-flex-1 ${containerExtraClasses}`, max: max, value: totalValue }, totalValue > 0 ? (values.map((props, i) => {
66
+ return React.createElement(ProgressIndicator, { ...props, max: max, valuesLength: values.length, index: i, totalValue: totalValue, key: i });
67
+ })) : (React.createElement("div", { className: `${baseLabelClasses} tw-mx-auto tw-overflow-hidden` }, zeroValueLabel))));
68
+ };
69
+ export default ProgressBar;
70
+ //# sourceMappingURL=ProgressBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../src/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,MAAM,gBAAgB,GACpB,kGAAkG,CAAC;AAErG,MAAM,iBAAiB,GAEnB,CAAC,KAAK,EAAE,EAAE;IACZ,MAAM,EACJ,KAAK,EACL,KAAK,GAAG,SAAS,EACjB,MAAM,EACN,KAAK,EACL,YAAY,GAAG,EAAE,EACjB,YAAY,GAAG,EAAE,EACjB,YAAY,EACZ,GAAG,EACH,KAAK,EACL,UAAU,EACV,GAAG,YAAY,EAChB,GAAG,KAAK,CAAC;IACV,MAAM,WAAW,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;IAE9C,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,mBAAmB,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAChE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC/D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J,CAAC,CAAC;AAEF,MAAM,WAAW,GAA8C,CAAC,EAC9D,MAAM,GAAG,EAAE,EACX,GAAG,GAAG,GAAG,EACT,qBAAqB,GAAG,EAAE,EAC1B,cAAc,GAAG,iBAAiB,GACnC,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;IACrE,OAAO,CACL,oBAAC,QAAQ,CAAC,IAAI,IACZ,SAAS,EAAE,gJAAgJ,qBAAqB,EAAE,EAClL,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,UAAU,IAChB,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CAChB,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QACtB,OAAO,oBAAC,iBAAiB,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,GAAI,CAAC;IAC3H,CAAC,CAAC,CACH,CAAC,CAAC,CAAC,CACF,6BAAK,SAAS,EAAE,GAAG,gBAAgB,gCAAgC,IAAG,cAAc,CAAO,CAC5F,CACa,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,83 @@
1
+ import React, { useEffect } from 'react';
2
+ import ProgressBar from './ProgressBar';
3
+ import { QTip } from '../Tooltip';
4
+ export default {
5
+ title: 'ProgressBar',
6
+ };
7
+ export const AllProgressBars = () => {
8
+ const [values, setValues] = React.useState([
9
+ { value: 20, label: 'RGB' },
10
+ { value: 15, color: 'brown', label: 'Brown' },
11
+ { value: 40, color: '#435abc', label: 'Hex' },
12
+ ]);
13
+ useEffect(() => {
14
+ const timeout = setTimeout(() => {
15
+ setValues([
16
+ { value: 40, label: 'RGB' },
17
+ { value: 5, color: 'brown', label: 'Brown' },
18
+ { value: 50, color: '#435abc', label: 'Hex' },
19
+ ]);
20
+ }, 2000);
21
+ return () => clearTimeout(timeout);
22
+ });
23
+ const renderAllVariations = () => (React.createElement(React.Fragment, null,
24
+ React.createElement("div", { className: "tw-p-4 light" },
25
+ React.createElement("div", { className: "tw-p-4" },
26
+ React.createElement(ProgressBar, { max: 100, values: [{ value: 40 }] })),
27
+ React.createElement("div", { className: "tw-p-4" },
28
+ React.createElement(ProgressBar, { max: 100, values: [{ value: 10 }] })),
29
+ React.createElement("div", { className: "tw-p-4" },
30
+ React.createElement(ProgressBar, { values: [{ value: 0 }], max: 100 })),
31
+ React.createElement("div", { className: "tw-p-4" },
32
+ React.createElement(ProgressBar, { values: [{ value: 70, tooltip: 'this is an indicator tooltip' }], max: 100, containerExtraClasses: "tw-bg-sq-text-color" })),
33
+ React.createElement("div", { className: "tw-p-4" },
34
+ React.createElement(ProgressBar, { values: [
35
+ { value: 20, label: 'RGB' },
36
+ { value: 15, color: 'brown', label: 'Brown' },
37
+ { value: 40, color: '#435abc', label: 'Hex' },
38
+ ], max: 100, containerExtraClasses: "tw-bg-sq-text-color" })),
39
+ React.createElement("div", { className: "tw-p-4" },
40
+ React.createElement(ProgressBar, { values: [{ value: 5, label: 'A very long text' }], max: 100 })),
41
+ React.createElement("div", { className: "tw-p-4" },
42
+ React.createElement(ProgressBar, { values: values, max: 100, containerExtraClasses: "tw-bg-sq-text-color" })),
43
+ React.createElement("div", { className: "tw-p-4" },
44
+ React.createElement(ProgressBar, { values: [{ value: 0, label: 'zero label' }], max: 100 })),
45
+ React.createElement("div", { className: "tw-p-4" },
46
+ React.createElement(ProgressBar, { values: [{ value: 0 }], zeroValueLabel: "default zero level label deliberately long to test overflow", max: 100 }))),
47
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
48
+ React.createElement("div", { className: "tw-p-4" },
49
+ React.createElement(ProgressBar, { max: 100, values: [{ value: 40 }] })),
50
+ React.createElement("div", { className: "tw-p-4" },
51
+ React.createElement(ProgressBar, { max: 100, values: [{ value: 10 }] })),
52
+ React.createElement("div", { className: "tw-p-4" },
53
+ React.createElement(ProgressBar, { values: [{ value: 0 }], max: 100 })),
54
+ React.createElement("div", { className: "tw-p-4" },
55
+ React.createElement(ProgressBar, { values: [{ value: 70, tooltip: 'this is an indicator tooltip' }], max: 100, containerExtraClasses: "tw-bg-sq-text-color" })),
56
+ React.createElement("div", { className: "tw-p-4" },
57
+ React.createElement(ProgressBar, { values: [
58
+ { value: 20, color: 'rgb(44,200,190)', label: 'RGB' },
59
+ { value: 15, color: 'brown', label: 'Brown' },
60
+ { value: 40, color: '#435abc', label: 'Hex' },
61
+ ], max: 100, containerExtraClasses: "tw-bg-sq-text-color" })),
62
+ React.createElement("div", { className: "tw-p-4" },
63
+ React.createElement(ProgressBar, { values: values, max: 100, containerExtraClasses: "tw-bg-sq-text-color" })),
64
+ React.createElement("div", { className: "tw-p-4" },
65
+ React.createElement(ProgressBar, { values: [{ value: 0, label: 'zero label' }], max: 100, containerExtraClasses: "tw-bg-sq-text-color" })),
66
+ React.createElement("div", { className: "tw-p-4" },
67
+ React.createElement(ProgressBar, { values: [{ value: 0 }], zeroValueLabel: "default zero level label is made deliberately long to test overflow", max: 100, containerExtraClasses: "tw-bg-sq-text-color" })))));
68
+ return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
69
+ React.createElement(QTip, null),
70
+ React.createElement("div", { className: "color_topic" },
71
+ React.createElement("b", null, "Topic Colors"),
72
+ renderAllVariations()),
73
+ React.createElement("div", { className: "color_analysis" },
74
+ React.createElement("b", null, "Analysis Colors"),
75
+ renderAllVariations()),
76
+ React.createElement("div", { className: "color_datalab" },
77
+ React.createElement("b", null, "Datalab Colors"),
78
+ renderAllVariations()),
79
+ React.createElement("div", { className: "color_vantage" },
80
+ React.createElement("b", null, "Vantage Colors"),
81
+ renderAllVariations())));
82
+ };
83
+ //# sourceMappingURL=ProgressBar.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressBar.stories.js","sourceRoot":"","sources":["../../src/ProgressBar/ProgressBar.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,eAAe;IACb,KAAK,EAAE,aAAa;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;QACzC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;QAC3B,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QAC7C,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE;KAC9C,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,SAAS,CAAC;gBACR,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC3B,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;gBAC5C,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE;aAC9C,CAAC,CAAC;QACL,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,CAChC;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