@pushwoosh/dumb-components 1.0.1 → 1.0.2

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 (237) hide show
  1. package/DropdownMenu/components/DropdownMenu/DropdownMenu.d.ts +3 -0
  2. package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +27 -0
  3. package/DropdownMenu/components/DropdownMenu/hooks.d.ts +4 -0
  4. package/DropdownMenu/components/DropdownMenu/hooks.js +10 -0
  5. package/DropdownMenu/components/DropdownMenu/index.d.ts +2 -0
  6. package/DropdownMenu/components/DropdownMenu/index.js +2 -0
  7. package/DropdownMenu/components/DropdownMenu/types.d.ts +23 -0
  8. package/DropdownMenu/components/DropdownMenu/types.js +1 -0
  9. package/DropdownMenu/components/DropdownMenuContainer/DropdownMenuContainer.d.ts +3 -0
  10. package/DropdownMenu/components/DropdownMenuContainer/DropdownMenuContainer.js +79 -0
  11. package/DropdownMenu/components/DropdownMenuContainer/index.d.ts +1 -0
  12. package/DropdownMenu/components/DropdownMenuContainer/index.js +1 -0
  13. package/DropdownMenu/components/DropdownMenuContainer/maps.d.ts +26 -0
  14. package/DropdownMenu/components/DropdownMenuContainer/maps.js +11 -0
  15. package/DropdownMenu/components/DropdownMenuContainer/styles.d.ts +35 -0
  16. package/DropdownMenu/components/DropdownMenuContainer/styles.js +109 -0
  17. package/DropdownMenu/components/DropdownMenuContainer/types.d.ts +19 -0
  18. package/DropdownMenu/components/DropdownMenuContainer/types.js +1 -0
  19. package/DropdownMenu/components/DropdownMenuGroup/DropdownMenuGroup.d.ts +3 -0
  20. package/DropdownMenu/components/DropdownMenuGroup/DropdownMenuGroup.js +12 -0
  21. package/DropdownMenu/components/DropdownMenuGroup/index.d.ts +1 -0
  22. package/DropdownMenu/components/DropdownMenuGroup/index.js +1 -0
  23. package/DropdownMenu/components/DropdownMenuGroup/styles.d.ts +1 -0
  24. package/DropdownMenu/components/DropdownMenuGroup/styles.js +7 -0
  25. package/DropdownMenu/components/DropdownMenuGroup/types.d.ts +5 -0
  26. package/DropdownMenu/components/DropdownMenuGroup/types.js +1 -0
  27. package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.d.ts +5 -0
  28. package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.js +38 -0
  29. package/DropdownMenu/components/DropdownMenuItem/index.d.ts +2 -0
  30. package/DropdownMenu/components/DropdownMenuItem/index.js +2 -0
  31. package/DropdownMenu/components/DropdownMenuItem/styles.d.ts +5 -0
  32. package/DropdownMenu/components/DropdownMenuItem/styles.js +73 -0
  33. package/DropdownMenu/components/DropdownMenuItem/types.d.ts +24 -0
  34. package/DropdownMenu/components/DropdownMenuItem/types.js +1 -0
  35. package/DropdownMenu/components/DropdownMenuItemCheckbox/DropdownMenuItemCheckbox.d.ts +3 -0
  36. package/DropdownMenu/components/DropdownMenuItemCheckbox/DropdownMenuItemCheckbox.js +9 -0
  37. package/DropdownMenu/components/DropdownMenuItemCheckbox/index.d.ts +1 -0
  38. package/DropdownMenu/components/DropdownMenuItemCheckbox/index.js +1 -0
  39. package/DropdownMenu/components/DropdownMenuItemCheckbox/styles.d.ts +1 -0
  40. package/DropdownMenu/components/DropdownMenuItemCheckbox/styles.js +8 -0
  41. package/DropdownMenu/components/DropdownMenuItemPick/DropdownMenuItemPick.d.ts +3 -0
  42. package/DropdownMenu/components/DropdownMenuItemPick/DropdownMenuItemPick.js +16 -0
  43. package/DropdownMenu/components/DropdownMenuItemPick/index.d.ts +1 -0
  44. package/DropdownMenu/components/DropdownMenuItemPick/index.js +1 -0
  45. package/DropdownMenu/components/DropdownMenuItemPick/styles.d.ts +3 -0
  46. package/DropdownMenu/components/DropdownMenuItemPick/styles.js +8 -0
  47. package/DropdownMenu/components/DropdownMenuItemPick/types.d.ts +2 -0
  48. package/DropdownMenu/components/DropdownMenuItemPick/types.js +1 -0
  49. package/DropdownMenu/components/DropdownMenuItemRadio/DropdownMenuItemRadio.d.ts +3 -0
  50. package/DropdownMenu/components/DropdownMenuItemRadio/DropdownMenuItemRadio.js +9 -0
  51. package/DropdownMenu/components/DropdownMenuItemRadio/index.d.ts +1 -0
  52. package/DropdownMenu/components/DropdownMenuItemRadio/index.js +1 -0
  53. package/DropdownMenu/components/DropdownMenuItemRadio/styles.d.ts +1 -0
  54. package/DropdownMenu/components/DropdownMenuItemRadio/styles.js +8 -0
  55. package/DropdownMenu/components/DropdownMenuNested/DropdownMenuNested.d.ts +3 -0
  56. package/DropdownMenu/components/DropdownMenuNested/DropdownMenuNested.js +69 -0
  57. package/DropdownMenu/components/DropdownMenuNested/index.d.ts +1 -0
  58. package/DropdownMenu/components/DropdownMenuNested/index.js +1 -0
  59. package/DropdownMenu/components/DropdownMenuNested/styles.d.ts +8 -0
  60. package/DropdownMenu/components/DropdownMenuNested/styles.js +35 -0
  61. package/DropdownMenu/components/DropdownMenuNested/types.d.ts +6 -0
  62. package/DropdownMenu/components/DropdownMenuNested/types.js +1 -0
  63. package/DropdownMenu/components/DropdownMenuWindow/DropdownMenuWindow.d.ts +3 -0
  64. package/DropdownMenu/components/DropdownMenuWindow/DropdownMenuWindow.js +12 -0
  65. package/DropdownMenu/components/DropdownMenuWindow/index.d.ts +1 -0
  66. package/DropdownMenu/components/DropdownMenuWindow/index.js +1 -0
  67. package/DropdownMenu/components/DropdownMenuWindow/styles.d.ts +1 -0
  68. package/DropdownMenu/components/DropdownMenuWindow/styles.js +7 -0
  69. package/DropdownMenu/components/DropdownMenuWindow/types.d.ts +5 -0
  70. package/DropdownMenu/components/DropdownMenuWindow/types.js +1 -0
  71. package/DropdownMenu/index.d.ts +9 -0
  72. package/DropdownMenu/index.js +9 -0
  73. package/ExportResult/ExportResult.js +1 -1
  74. package/InputFile/InputFile.d.ts +3 -0
  75. package/InputFile/InputFile.js +88 -0
  76. package/InputFile/index.d.ts +1 -0
  77. package/InputFile/index.js +1 -0
  78. package/InputFile/styles.d.ts +5 -0
  79. package/InputFile/styles.js +29 -0
  80. package/InputFile/types.d.ts +25 -0
  81. package/InputFile/types.js +1 -0
  82. package/Link/Link.d.ts +5 -0
  83. package/Link/Link.js +12 -0
  84. package/Link/index.d.ts +1 -0
  85. package/Link/index.js +1 -0
  86. package/Link/styles.d.ts +1 -0
  87. package/Link/styles.js +7 -0
  88. package/Link/types.d.ts +21 -0
  89. package/Link/types.js +1 -0
  90. package/Modal/components/Modal/Modal.d.ts +3 -0
  91. package/Modal/components/Modal/Modal.js +51 -0
  92. package/Modal/components/Modal/index.d.ts +1 -0
  93. package/Modal/components/Modal/index.js +1 -0
  94. package/Modal/components/Modal/maps.d.ts +6 -0
  95. package/Modal/components/Modal/maps.js +6 -0
  96. package/Modal/components/Modal/styles.d.ts +13 -0
  97. package/Modal/components/Modal/styles.js +45 -0
  98. package/Modal/components/Modal/types.d.ts +13 -0
  99. package/Modal/components/Modal/types.js +1 -0
  100. package/Modal/components/ModalConfirm/ModalConfirm.d.ts +3 -0
  101. package/Modal/components/ModalConfirm/ModalConfirm.js +54 -0
  102. package/Modal/components/ModalConfirm/ModalConfirmProvider.d.ts +4 -0
  103. package/Modal/components/ModalConfirm/ModalConfirmProvider.js +35 -0
  104. package/Modal/components/ModalConfirm/hooks.d.ts +2 -0
  105. package/Modal/components/ModalConfirm/hooks.js +9 -0
  106. package/Modal/components/ModalConfirm/index.d.ts +3 -0
  107. package/Modal/components/ModalConfirm/index.js +3 -0
  108. package/Modal/components/ModalConfirm/types.d.ts +20 -0
  109. package/Modal/components/ModalConfirm/types.js +1 -0
  110. package/Modal/components/ModalContent/index.d.ts +1 -0
  111. package/Modal/components/ModalContent/index.js +1 -0
  112. package/Modal/components/ModalContent/styled.d.ts +19 -0
  113. package/Modal/components/ModalContent/styled.js +29 -0
  114. package/Modal/components/ModalTitle/ModalTitle.d.ts +3 -0
  115. package/Modal/components/ModalTitle/ModalTitle.js +18 -0
  116. package/Modal/components/ModalTitle/index.d.ts +1 -0
  117. package/Modal/components/ModalTitle/index.js +1 -0
  118. package/Modal/components/ModalTitle/styles.d.ts +1 -0
  119. package/Modal/components/ModalTitle/styles.js +8 -0
  120. package/Modal/components/ModalTitle/types.d.ts +5 -0
  121. package/Modal/components/ModalTitle/types.js +1 -0
  122. package/Modal/index.d.ts +4 -0
  123. package/Modal/index.js +4 -0
  124. package/PageHeader/components/AutosizeInput/AutosizeInput.d.ts +3 -0
  125. package/PageHeader/components/AutosizeInput/AutosizeInput.js +80 -0
  126. package/PageHeader/components/AutosizeInput/constants.d.ts +2 -0
  127. package/PageHeader/components/AutosizeInput/constants.js +2 -0
  128. package/PageHeader/components/AutosizeInput/index.d.ts +1 -0
  129. package/PageHeader/components/AutosizeInput/index.js +1 -0
  130. package/PageHeader/components/AutosizeInput/styles.d.ts +5 -0
  131. package/PageHeader/components/AutosizeInput/styles.js +20 -0
  132. package/PageHeader/components/AutosizeInput/types.d.ts +10 -0
  133. package/PageHeader/components/AutosizeInput/types.js +1 -0
  134. package/PageHeader/components/PageHeader/PageHeader.d.ts +3 -0
  135. package/PageHeader/components/PageHeader/PageHeader.js +51 -0
  136. package/PageHeader/components/PageHeader/index.d.ts +1 -0
  137. package/PageHeader/components/PageHeader/index.js +1 -0
  138. package/PageHeader/components/PageHeader/styles.d.ts +9 -0
  139. package/PageHeader/components/PageHeader/styles.js +29 -0
  140. package/PageHeader/components/PageHeader/types.d.ts +15 -0
  141. package/PageHeader/components/PageHeader/types.js +1 -0
  142. package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.d.ts +3 -0
  143. package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.js +67 -0
  144. package/PageHeader/components/PageHeaderEditable/index.d.ts +1 -0
  145. package/PageHeader/components/PageHeaderEditable/index.js +1 -0
  146. package/PageHeader/components/PageHeaderEditable/styles.d.ts +10 -0
  147. package/PageHeader/components/PageHeaderEditable/styles.js +33 -0
  148. package/PageHeader/components/PageHeaderEditable/types.d.ts +21 -0
  149. package/PageHeader/components/PageHeaderEditable/types.js +1 -0
  150. package/PageHeader/components/PageHeaderError/PageHeaderError.d.ts +3 -0
  151. package/PageHeader/components/PageHeaderError/PageHeaderError.js +19 -0
  152. package/PageHeader/components/PageHeaderError/index.d.ts +1 -0
  153. package/PageHeader/components/PageHeaderError/index.js +1 -0
  154. package/PageHeader/components/PageHeaderError/styles.d.ts +6 -0
  155. package/PageHeader/components/PageHeaderError/styles.js +20 -0
  156. package/PageHeader/components/PageHeaderError/types.d.ts +5 -0
  157. package/PageHeader/components/PageHeaderError/types.js +1 -0
  158. package/PageHeader/components/PageHeaderSkeleton/PageHeaderSkeleton.d.ts +2 -0
  159. package/PageHeader/components/PageHeaderSkeleton/PageHeaderSkeleton.js +20 -0
  160. package/PageHeader/components/PageHeaderSkeleton/index.d.ts +1 -0
  161. package/PageHeader/components/PageHeaderSkeleton/index.js +1 -0
  162. package/PageHeader/components/PageHeaderSkeleton/styles.d.ts +5 -0
  163. package/PageHeader/components/PageHeaderSkeleton/styles.js +15 -0
  164. package/PageHeader/index.d.ts +3 -0
  165. package/PageHeader/index.js +3 -0
  166. package/Pagination/Pagination.d.ts +3 -0
  167. package/Pagination/Pagination.js +85 -0
  168. package/Pagination/helpers.d.ts +1 -0
  169. package/Pagination/helpers.js +4 -0
  170. package/Pagination/index.d.ts +1 -0
  171. package/Pagination/index.js +1 -0
  172. package/Pagination/styles.d.ts +8 -0
  173. package/Pagination/styles.js +35 -0
  174. package/Pagination/types.d.ts +9 -0
  175. package/Pagination/types.js +1 -0
  176. package/ProgressBar/ProgressBar.js +1 -1
  177. package/PushPreview/PushPreview.js +1 -1
  178. package/ReCaptcha/ReCaptcha.d.ts +2 -0
  179. package/ReCaptcha/ReCaptcha.js +8 -0
  180. package/ReCaptcha/constants.d.ts +3 -0
  181. package/ReCaptcha/constants.js +4 -0
  182. package/ReCaptcha/helpers.d.ts +1 -0
  183. package/ReCaptcha/helpers.js +15 -0
  184. package/ReCaptcha/hooks.d.ts +2 -0
  185. package/ReCaptcha/hooks.js +66 -0
  186. package/ReCaptcha/index.d.ts +3 -0
  187. package/ReCaptcha/index.js +3 -0
  188. package/ReCaptcha/styles.d.ts +1 -0
  189. package/ReCaptcha/styles.js +5 -0
  190. package/ReCaptcha/types.d.ts +8 -0
  191. package/ReCaptcha/types.js +1 -0
  192. package/Skeleton/TextSkeleton.d.ts +3 -0
  193. package/Skeleton/TextSkeleton.js +16 -0
  194. package/Skeleton/index.d.ts +2 -0
  195. package/Skeleton/index.js +2 -0
  196. package/Skeleton/styles.d.ts +4 -0
  197. package/Skeleton/styles.js +33 -0
  198. package/Skeleton/types.d.ts +16 -0
  199. package/Skeleton/types.js +1 -0
  200. package/SortButton/SortButton.d.ts +6 -0
  201. package/SortButton/SortButton.js +33 -0
  202. package/SortButton/constants.d.ts +2 -0
  203. package/SortButton/constants.js +1 -0
  204. package/SortButton/index.d.ts +1 -0
  205. package/SortButton/index.js +1 -0
  206. package/SortButton/maps.d.ts +10 -0
  207. package/SortButton/maps.js +15 -0
  208. package/SortButton/styles.d.ts +3 -0
  209. package/SortButton/styles.js +9 -0
  210. package/SortButton/types.d.ts +14 -0
  211. package/SortButton/types.js +1 -0
  212. package/StatisticCard/StatisticCard.js +1 -1
  213. package/Switch/Switch.d.ts +3 -0
  214. package/Switch/Switch.js +23 -0
  215. package/Switch/index.d.ts +1 -0
  216. package/Switch/index.js +1 -0
  217. package/Switch/styles.d.ts +5 -0
  218. package/Switch/styles.js +62 -0
  219. package/Switch/types.d.ts +15 -0
  220. package/Switch/types.js +1 -0
  221. package/Toast/Toast.d.ts +3 -0
  222. package/Toast/Toast.js +62 -0
  223. package/Toast/ToastProvider.d.ts +4 -0
  224. package/Toast/ToastProvider.js +45 -0
  225. package/Toast/constants.d.ts +8 -0
  226. package/Toast/constants.js +8 -0
  227. package/Toast/hooks.d.ts +2 -0
  228. package/Toast/hooks.js +9 -0
  229. package/Toast/index.d.ts +3 -0
  230. package/Toast/index.js +3 -0
  231. package/Toast/styles.d.ts +8 -0
  232. package/Toast/styles.js +23 -0
  233. package/Toast/types.d.ts +28 -0
  234. package/Toast/types.js +1 -0
  235. package/index.d.ts +10 -0
  236. package/index.js +10 -0
  237. package/package.json +1 -3
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { CSSTransition } from 'react-transition-group';
3
+ import styled, { createGlobalStyle } from 'styled-components';
4
+ import { ShapeRadius, Spacing } from '@pushwoosh/kit-constants';
5
+ const animationTimeout = 300;
6
+ export const LockBody = createGlobalStyle(["body{overflow:hidden;position:relative;height:100%;}"]);
7
+ export const ModalBox = styled.div.withConfig({
8
+ displayName: "ModalBox",
9
+ componentId: "sc-lejcgu-0"
10
+ })(["position:fixed;top:0;left:0;width:100vw;height:100vh;pointer-events:all;z-index:", ";"], ({
11
+ $zIndex
12
+ }) => $zIndex);
13
+ export const ModalInner = styled.div.withConfig({
14
+ displayName: "ModalInner",
15
+ componentId: "sc-lejcgu-1"
16
+ })(["display:flex;justify-content:center;width:100vw;height:100vh;padding:", " 0;"], Spacing.S13);
17
+ function ModalBoxBase(props) {
18
+ const {
19
+ isOpen,
20
+ nodeRef,
21
+ className,
22
+ children
23
+ } = props;
24
+ return React.createElement(CSSTransition, {
25
+ appear: true,
26
+ in: isOpen,
27
+ timeout: animationTimeout,
28
+ classNames: className,
29
+ unmountOnExit: true,
30
+ nodeRef: nodeRef
31
+ }, children);
32
+ }
33
+ export const ModalBoxTrans = styled(ModalBoxBase).withConfig({
34
+ displayName: "ModalBoxTrans",
35
+ componentId: "sc-lejcgu-2"
36
+ })(["&-appear{background-color:rgb(0 0 0 / 0%);transition:background-color ", "ms;", "{opacity:0;transform:scale(0.5);}}&-appear-active{background-color:rgb(0 0 0 / 70%);", "{opacity:0.99;transform:scale(0.99);transition:opacity ", "ms,transform ", "ms;}}&-appear-done{background-color:rgb(0 0 0 / 70%);", "{opacity:1;transform:translateX(0);}}&-enter{background-color:rgb(0 0 0 / 0%);transition:background-color ", "ms;", "{opacity:0;transform:scale(0.5);}}&-enter-active{background-color:rgb(0 0 0 / 70%);", "{opacity:0.99;transform:scale(0.99);transition:opacity ", "ms,transform ", "ms;}}&-enter-done{background-color:rgb(0 0 0 / 70%);", "{opacity:1;transform:translateX(0);}}&-exit{background-color:rgba(0 0 0 / 70%);", "{opacity:1;transform:translateX(0);transition:opacity ", "ms,transform ", "ms;}}&-exit-active{transition:background-color ", "ms;background-color:rgb(0 0 0 / 0%);", "{opacity:0;transform:scale(0.5);}}"], animationTimeout, ModalInner, ModalInner, animationTimeout, animationTimeout, ModalInner, animationTimeout, ModalInner, ModalInner, animationTimeout, animationTimeout, ModalInner, ModalInner, animationTimeout, animationTimeout, animationTimeout, ModalInner);
37
+ export const ModalContainer = styled.div.withConfig({
38
+ displayName: "ModalContainer",
39
+ componentId: "sc-lejcgu-3"
40
+ })(["display:inline-flex;flex-direction:column;align-items:stretch;justify-content:flex-start;position:relative;width:", ";height:calc(100vh - 2 * ", ");vertical-align:middle;z-index:10;& > *{&:first-child{border-top-left-radius:", ";border-top-right-radius:", ";}&:last-child{border-bottom-left-radius:", ";border-bottom-right-radius:", ";}}"], ({
41
+ $width
42
+ }) => $width, Spacing.S13, ShapeRadius.DIALOG, ShapeRadius.DIALOG, ShapeRadius.DIALOG, ShapeRadius.DIALOG);
43
+ ModalBox.displayName = 'ModalBox';
44
+ ModalInner.displayName = 'ModalInner';
45
+ ModalContainer.displayName = 'ModalContainer';
@@ -0,0 +1,13 @@
1
+ import type { MutableRefObject, PropsWithChildren } from 'react';
2
+ import type { modalSizes } from './maps';
3
+ export type ModalProps = PropsWithChildren<{
4
+ readonly size: keyof typeof modalSizes;
5
+ readonly zIndex?: number;
6
+ readonly isOpen: boolean;
7
+ readonly onClose?: () => any;
8
+ }>;
9
+ export type ModalBoxBaseProps = PropsWithChildren<{
10
+ isOpen: boolean;
11
+ className?: string;
12
+ nodeRef: MutableRefObject<HTMLElement | undefined>;
13
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { ModalConfirmProps } from './types';
3
+ export declare function ModalConfirm(props: ModalConfirmProps): ReactElement;
@@ -0,0 +1,54 @@
1
+ import React, { useState, useCallback } from 'react';
2
+ import { Vertical, Horizontal } from '@pushwoosh/kit-helpers';
3
+ import { Banner } from '../../../Banner';
4
+ import { Button } from '../../../Button';
5
+ import { Modal } from '../Modal';
6
+ import { ModalHeader, ModalBody, ModalFooter } from '../ModalContent';
7
+ import { ModalTitle } from '../ModalTitle';
8
+ export function ModalConfirm(props) {
9
+ const {
10
+ isOpen,
11
+ title = 'Confirm action',
12
+ description = '',
13
+ confirmButtonText = 'Confirm',
14
+ cancelButtonText = 'Cancel',
15
+ confirmButtonColor = 'primary',
16
+ callback,
17
+ onAccept,
18
+ onCancel
19
+ } = props;
20
+ const [isLoading, setIsLoading] = useState(false);
21
+ const [errorMessage, setErrorMessage] = useState('');
22
+ const handleConfirm = useCallback(async () => {
23
+ try {
24
+ setIsLoading(true);
25
+ setErrorMessage('');
26
+ await (callback === null || callback === void 0 ? void 0 : callback());
27
+ await onAccept();
28
+ } catch (error) {
29
+ setErrorMessage((error === null || error === void 0 ? void 0 : error.message) || 'Unexpected error occurred');
30
+ } finally {
31
+ setIsLoading(false);
32
+ }
33
+ }, [callback, onAccept]);
34
+ return React.createElement(Modal, {
35
+ size: "small",
36
+ isOpen: isOpen,
37
+ onClose: onCancel
38
+ }, React.createElement(ModalHeader, null, React.createElement(Vertical, {
39
+ "$gap": 8
40
+ }, React.createElement(ModalTitle, null, title), errorMessage && React.createElement(Banner, {
41
+ type: "error",
42
+ title: errorMessage
43
+ }))), description && React.createElement(ModalBody, null, description), React.createElement(ModalFooter, null, React.createElement(Horizontal, {
44
+ "$justifyContent": "end",
45
+ "$gap": 8
46
+ }, React.createElement(Button, {
47
+ color: "secondary",
48
+ onClick: onCancel
49
+ }, cancelButtonText), React.createElement(Button, {
50
+ color: confirmButtonColor,
51
+ isLoading: isLoading,
52
+ onClick: handleConfirm
53
+ }, confirmButtonText))));
54
+ }
@@ -0,0 +1,4 @@
1
+ import React, { type ReactElement, type PropsWithChildren } from 'react';
2
+ import type { ModalConfirmContextProps } from './types';
3
+ export declare const ModalConfirmContext: React.Context<ModalConfirmContextProps | null>;
4
+ export declare function ModalConfirmProvider(props: PropsWithChildren): ReactElement;
@@ -0,0 +1,35 @@
1
+ import React, { useState, useMemo, createContext } from 'react';
2
+ import { ModalConfirm } from './ModalConfirm';
3
+ export const ModalConfirmContext = createContext(null);
4
+ export function ModalConfirmProvider(props) {
5
+ const {
6
+ children
7
+ } = props;
8
+ const [modalConfirmParams, setModalConfirmParams] = useState(() => ({
9
+ isOpen: false,
10
+ title: '',
11
+ onAccept: () => null,
12
+ onCancel: () => null
13
+ }));
14
+ const contextValue = useMemo(() => {
15
+ const closeModalConfirm = () => setModalConfirmParams(prev => ({
16
+ ...prev,
17
+ isOpen: false
18
+ }));
19
+ const openModalConfirm = params => setModalConfirmParams({
20
+ ...params,
21
+ isOpen: true,
22
+ onCancel: params.onCancel || closeModalConfirm,
23
+ onAccept: params.onAccept
24
+ });
25
+ return {
26
+ openModalConfirm,
27
+ closeModalConfirm
28
+ };
29
+ }, []);
30
+ return React.createElement(ModalConfirmContext.Provider, {
31
+ value: contextValue
32
+ }, children, React.createElement(ModalConfirm, {
33
+ ...modalConfirmParams
34
+ }));
35
+ }
@@ -0,0 +1,2 @@
1
+ import type { ModalConfirmContextProps } from './types';
2
+ export declare const useModalConfirm: () => ModalConfirmContextProps;
@@ -0,0 +1,9 @@
1
+ import { useContext } from 'react';
2
+ import { ModalConfirmContext } from './ModalConfirmProvider';
3
+ export const useModalConfirm = () => {
4
+ const context = useContext(ModalConfirmContext);
5
+ if (!context) {
6
+ throw new Error('useModalConfirm must be used within an ModalConfirmProvider');
7
+ }
8
+ return context;
9
+ };
@@ -0,0 +1,3 @@
1
+ export { ModalConfirm } from './ModalConfirm';
2
+ export { ModalConfirmProvider } from './ModalConfirmProvider';
3
+ export { useModalConfirm } from './hooks';
@@ -0,0 +1,3 @@
1
+ export { ModalConfirm } from './ModalConfirm';
2
+ export { ModalConfirmProvider } from './ModalConfirmProvider';
3
+ export { useModalConfirm } from './hooks';
@@ -0,0 +1,20 @@
1
+ export type ConfirmButtonColor = 'primary' | 'secondary' | 'danger';
2
+ export interface ModalConfirmProps {
3
+ isOpen: boolean;
4
+ title: string;
5
+ description?: string;
6
+ confirmButtonText?: string;
7
+ confirmButtonColor?: ConfirmButtonColor;
8
+ cancelButtonText?: string;
9
+ callback?: () => void;
10
+ onAccept: () => void;
11
+ onCancel: () => void;
12
+ }
13
+ export type OpenModalConfirmParams = Omit<ModalConfirmProps, 'isOpen' | 'onCancel'> & {
14
+ isOpen?: ModalConfirmProps['isOpen'];
15
+ onCancel?: () => void;
16
+ };
17
+ export interface ModalConfirmContextProps {
18
+ openModalConfirm: (params: OpenModalConfirmParams) => void;
19
+ closeModalConfirm: () => void;
20
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { ModalHeader, ModalBodyGroup, ModalBodyItem, ModalBody, ModalFooter, } from './styled';
@@ -0,0 +1 @@
1
+ export { ModalHeader, ModalBodyGroup, ModalBodyItem, ModalBody, ModalFooter } from './styled';
@@ -0,0 +1,19 @@
1
+ export declare const ModalHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const ModalBodyGroup: import("styled-components").StyledComponent<"div", any, {
3
+ $alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
4
+ $alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
5
+ $gap?: string | number | undefined;
6
+ $gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
7
+ $justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
8
+ $justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
9
+ $margin?: string | number | undefined;
10
+ $padding?: string | number | undefined;
11
+ $placeItems?: "end" | "start" | "center" | "stretch" | undefined;
12
+ } & {
13
+ $gridAutoFlow: string;
14
+ }, "$gridAutoFlow">;
15
+ export declare const ModalBodyItem: import("styled-components").StyledComponent<"div", any, {
16
+ $vPadding?: boolean;
17
+ }, never>;
18
+ export declare const ModalBody: import("styled-components").StyledComponent<"div", any, {}, never>;
19
+ export declare const ModalFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,29 @@
1
+ import styled from 'styled-components';
2
+ import { Color, Spacing } from '@pushwoosh/kit-constants';
3
+ import { Vertical } from '@pushwoosh/kit-helpers';
4
+ export const ModalHeader = styled.div.withConfig({
5
+ displayName: "ModalHeader",
6
+ componentId: "sc-t60vr-0"
7
+ })(["padding:", " ", " ", ";background-color:", ";"], Spacing.S7, Spacing.S7, Spacing.S3, Color.CLEAR);
8
+ ModalHeader.displayName = 'ModalHeader';
9
+ export const ModalBodyGroup = styled(Vertical).withConfig({
10
+ displayName: "ModalBodyGroup",
11
+ componentId: "sc-t60vr-1"
12
+ })(["background-color:", ";gap:1px;"], Color.DIVIDER);
13
+ ModalBodyGroup.displayName = 'ModalBodyGroup';
14
+ export const ModalBodyItem = styled.div.withConfig({
15
+ displayName: "ModalBodyItem",
16
+ componentId: "sc-t60vr-2"
17
+ })(["padding:", " ", ";background-color:", ";"], ({
18
+ $vPadding
19
+ }) => $vPadding ? Spacing.S7 : 0, Spacing.S7, Color.CLEAR);
20
+ export const ModalBody = styled.div.withConfig({
21
+ displayName: "ModalBody",
22
+ componentId: "sc-t60vr-3"
23
+ })(["background-color:", ";overflow-y:auto;&:not(:has(> ", ")){padding:", ";&:not(:first-child){padding-top:0;}}"], Color.CLEAR, ModalBodyGroup, Spacing.S7);
24
+ ModalBody.displayName = 'ModalBody';
25
+ export const ModalFooter = styled.div.withConfig({
26
+ displayName: "ModalFooter",
27
+ componentId: "sc-t60vr-4"
28
+ })(["padding:", ";background-color:", ";border-top:1px solid ", ";"], Spacing.S7, Color.CLEAR, Color.DIVIDER);
29
+ ModalFooter.displayName = 'ModalFooter';
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { ModalTitleProps } from './types';
3
+ export declare function ModalTitle(props: ModalTitleProps): ReactElement;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { CloseIcon } from '@pushwoosh/kit-icons';
3
+ import { ModalTitleBox } from './styles';
4
+ import { GhostButton } from '../../../Button';
5
+ export function ModalTitle(props) {
6
+ const {
7
+ children,
8
+ onClose,
9
+ ...rest
10
+ } = props;
11
+ return React.createElement(ModalTitleBox, {
12
+ ...rest
13
+ }, children, onClose && React.createElement(GhostButton, {
14
+ onClick: onClose
15
+ }, React.createElement(CloseIcon, {
16
+ size: "medium"
17
+ })));
18
+ }
@@ -0,0 +1 @@
1
+ export { ModalTitle } from './ModalTitle';
@@ -0,0 +1 @@
1
+ export { ModalTitle } from './ModalTitle';
@@ -0,0 +1 @@
1
+ export declare const ModalTitleBox: import("styled-components").StyledComponent<"h2", any, {}, never>;
@@ -0,0 +1,8 @@
1
+ import styled from 'styled-components';
2
+ import { Color, FontSize, FontWeight } from '@pushwoosh/kit-constants';
3
+ import { GhostButton } from '../../../Button';
4
+ export const ModalTitleBox = styled.h2.withConfig({
5
+ displayName: "ModalTitleBox",
6
+ componentId: "sc-8qbijb-0"
7
+ })(["display:flex;flex-wrap:nowrap;align-items:center;justify-content:space-between;font-size:", ";font-weight:", ";line-height:22px;letter-spacing:0;margin:0;", "{color:", ";cursor:pointer;&:hover{color:", ";}}"], FontSize.HEADING2, FontWeight.BOLD, GhostButton, Color.LOCKED, Color.MAIN);
8
+ ModalTitleBox.displayName = 'ModalTitleBox';
@@ -0,0 +1,5 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface ModalTitleProps {
3
+ readonly onClose?: () => void;
4
+ readonly children: ReactNode;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export { Modal } from './components/Modal';
2
+ export { ModalTitle } from './components/ModalTitle';
3
+ export { ModalConfirm, ModalConfirmProvider, useModalConfirm, } from './components/ModalConfirm';
4
+ export { ModalHeader, ModalBodyGroup, ModalBodyItem, ModalBody, ModalFooter, } from './components/ModalContent';
package/Modal/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { Modal } from './components/Modal';
2
+ export { ModalTitle } from './components/ModalTitle';
3
+ export { ModalConfirm, ModalConfirmProvider, useModalConfirm } from './components/ModalConfirm';
4
+ export { ModalHeader, ModalBodyGroup, ModalBodyItem, ModalBody, ModalFooter } from './components/ModalContent';
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { AutosizeInputProps } from './types';
3
+ export declare function AutosizeInput(props: AutosizeInputProps): ReactElement;
@@ -0,0 +1,80 @@
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import { EditIcon } from '@pushwoosh/kit-icons';
3
+ import { DEFAULT_EMPTY_VALUE, WIDTH_EMPTY_VALUE } from './constants';
4
+ import { RootBox, InputBox, InputStyled, PromptBox } from './styles';
5
+ export function AutosizeInput(props) {
6
+ const {
7
+ placeholder,
8
+ maxLength,
9
+ value,
10
+ onChange,
11
+ onComplete
12
+ } = props;
13
+ const defaultValue = useRef(value);
14
+ const inputRef = useRef(null);
15
+ const hiddenValueRef = useRef(null);
16
+ const hiddenPlaceholderRef = useRef(null);
17
+ const [width, setWidth] = useState(value ? value.length : WIDTH_EMPTY_VALUE);
18
+ useEffect(() => {
19
+ if (!defaultValue.current) {
20
+ defaultValue.current = DEFAULT_EMPTY_VALUE;
21
+ onChange === null || onChange === void 0 || onChange(DEFAULT_EMPTY_VALUE);
22
+ }
23
+ }, [defaultValue, onChange]);
24
+ useEffect(() => {
25
+ if (value) {
26
+ setWidth(hiddenValueRef.current.offsetWidth + 15);
27
+ } else {
28
+ const placeholderWidth = hiddenPlaceholderRef.current.offsetWidth ? hiddenPlaceholderRef.current.offsetWidth + 15 : 0;
29
+ setWidth(placeholderWidth || WIDTH_EMPTY_VALUE);
30
+ }
31
+ }, [value]);
32
+ const onKeyDown = event => {
33
+ if (event.key === 'Enter') {
34
+ var _inputRef$current;
35
+ event.preventDefault();
36
+ inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.blur();
37
+ }
38
+ if (event.key === 'Escape') {
39
+ var _inputRef$current2;
40
+ event.preventDefault();
41
+ onChange === null || onChange === void 0 || onChange(defaultValue.current);
42
+ setWidth(defaultValue.current.length);
43
+ inputRef === null || inputRef === void 0 || (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.blur();
44
+ }
45
+ };
46
+ const onChangeHandler = event => {
47
+ const formattedValue = maxLength ? event.currentTarget.value.slice(0, maxLength) : event.currentTarget.value;
48
+ onChange === null || onChange === void 0 || onChange(formattedValue.replace(/\n/g, ''));
49
+ };
50
+ const onBlur = () => {
51
+ if (value === '') {
52
+ onChange === null || onChange === void 0 || onChange(defaultValue.current);
53
+ }
54
+ setTimeout(() => {
55
+ var _inputRef$current3;
56
+ return onComplete === null || onComplete === void 0 ? void 0 : onComplete(inputRef === null || inputRef === void 0 || (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value);
57
+ }, 100);
58
+ };
59
+ return React.createElement(RootBox, null, React.createElement(InputBox, null, React.createElement(InputStyled, {
60
+ ref: inputRef,
61
+ width: width,
62
+ value: value,
63
+ placeholder: placeholder,
64
+ onKeyDown: onKeyDown,
65
+ onChange: onChangeHandler,
66
+ onBlur: onBlur
67
+ }), React.createElement("span", {
68
+ ref: hiddenValueRef
69
+ }, value), React.createElement("span", {
70
+ ref: hiddenPlaceholderRef
71
+ }, placeholder)), React.createElement(PromptBox, {
72
+ onClick: () => {
73
+ var _inputRef$current4;
74
+ return (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.focus();
75
+ }
76
+ }, React.createElement(EditIcon, {
77
+ size: "small",
78
+ view: "filled"
79
+ })));
80
+ }
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_EMPTY_VALUE = "Untitled";
2
+ export declare const WIDTH_EMPTY_VALUE = 90;
@@ -0,0 +1,2 @@
1
+ export const DEFAULT_EMPTY_VALUE = 'Untitled';
2
+ export const WIDTH_EMPTY_VALUE = 90;
@@ -0,0 +1 @@
1
+ export { AutosizeInput } from './AutosizeInput';
@@ -0,0 +1 @@
1
+ export { AutosizeInput } from './AutosizeInput';
@@ -0,0 +1,5 @@
1
+ import type { InputStyledProps } from './types';
2
+ export declare const PromptBox: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const InputBox: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const InputStyled: import("styled-components").StyledComponent<"input", any, InputStyledProps, never>;
5
+ export declare const RootBox: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,20 @@
1
+ import styled from 'styled-components';
2
+ import { Color, Spacing, FontSize, FontWeight } from '@pushwoosh/kit-constants';
3
+ export const PromptBox = styled.div.withConfig({
4
+ displayName: "PromptBox",
5
+ componentId: "sc-191i2ot-0"
6
+ })(["display:flex;color:", ";font-weight:", ";font-size:", ";line-height:18px;> div{color:", ";cursor:pointer;}> span{display:none;}"], Color.PHANTOM, FontWeight.REGULAR, FontSize.SMALL, Color.PRIMARY);
7
+ export const InputBox = styled.div.withConfig({
8
+ displayName: "InputBox",
9
+ componentId: "sc-191i2ot-1"
10
+ })(["display:flex;flex-direction:column;overflow:hidden;"]);
11
+ export const InputStyled = styled.input.withConfig({
12
+ displayName: "InputStyled",
13
+ componentId: "sc-191i2ot-2"
14
+ })(["color:#0e72e5;width:", "px;max-width:100%;border:0;padding:0;margin:3px ", " 0 0;background:#0000;font-weight:inherit;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;border-bottom:1px dashed ", ";&::placeholder{color:", ";}&:active,&:hover,&:focus{border-bottom:1px dashed ", ";outline-offset:0;outline:0;}&:hover{color:", ";cursor:pointer;}&:active{opacity:0.5;cursor:pointer;}"], ({
15
+ width
16
+ }) => width - 10, Spacing.S1, Color.PHANTOM, Color.PHANTOM, Color.PHANTOM, Color.PRIMARY_HOVER);
17
+ export const RootBox = styled.div.withConfig({
18
+ displayName: "RootBox",
19
+ componentId: "sc-191i2ot-3"
20
+ })(["display:flex;align-items:center;overflow:hidden;flex-grow:1;& > ", " > span{position:absolute;visibility:hidden;}&:focus-within{", " > div{display:none;}", " > span{display:block;white-space:nowrap;}", "{color:", ";}}"], InputBox, PromptBox, PromptBox, InputStyled, Color.MAIN);
@@ -0,0 +1,10 @@
1
+ export interface AutosizeInputProps {
2
+ value: string;
3
+ placeholder?: string | undefined;
4
+ maxLength?: number | undefined;
5
+ onChange?: ((value: string) => void) | undefined;
6
+ onComplete?: ((value: string) => void) | undefined;
7
+ }
8
+ export interface InputStyledProps {
9
+ width: number;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { PageHeaderProps } from './types';
3
+ export declare function PageHeader(props: PageHeaderProps): ReactElement;
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { Columns } from '@pushwoosh/kit-helpers';
3
+ import { ArrowRoundIcon } from '@pushwoosh/kit-icons';
4
+ import { H1 } from '@pushwoosh/kit-typography';
5
+ import { Button } from '../../../Button';
6
+ import { PageHeaderError } from '../PageHeaderError';
7
+ import { RootBox, BackButton, TitleBox, DescriptionBox, ActionsBox, MoreActionsBox } from './styles';
8
+ export function PageHeader(props) {
9
+ const {
10
+ title,
11
+ description,
12
+ error,
13
+ resolveErrorText,
14
+ submitText,
15
+ cancelText,
16
+ isLoadingSubmit,
17
+ moreActions,
18
+ onBack,
19
+ onSubmit,
20
+ onCancel,
21
+ onResolveError
22
+ } = props;
23
+ const hasActions = Boolean(onSubmit || onCancel);
24
+ const hasActionsBox = hasActions || Boolean(moreActions);
25
+ return React.createElement(RootBox, null, React.createElement(Columns, {
26
+ "$sizes": "minmax(0, 1fr) max-content",
27
+ "$gap": 24
28
+ }, React.createElement(TitleBox, null, onBack && React.createElement(BackButton, null, React.createElement(Button, {
29
+ color: "primary",
30
+ view: "ghost",
31
+ onClick: onBack
32
+ }, React.createElement(ArrowRoundIcon, {
33
+ direction: "left",
34
+ size: "medium",
35
+ view: "filled"
36
+ }))), React.createElement(H1, null, title)), hasActionsBox && React.createElement(ActionsBox, null, !!moreActions && React.createElement(MoreActionsBox, {
37
+ hasActions: hasActions
38
+ }, moreActions), onCancel && React.createElement(Button, {
39
+ color: "secondary",
40
+ onClick: onCancel
41
+ }, cancelText || 'Cancel'), onSubmit && React.createElement(Button, {
42
+ color: "primary",
43
+ type: "submit",
44
+ onClick: onSubmit,
45
+ isLoading: !!isLoadingSubmit
46
+ }, submitText || 'Create'))), !!error && React.createElement(PageHeaderError, {
47
+ error: error,
48
+ resolveErrorText: resolveErrorText,
49
+ onResolveError: onResolveError
50
+ }), !!description && React.createElement(DescriptionBox, null, description));
51
+ }
@@ -0,0 +1 @@
1
+ export { PageHeader } from './PageHeader';
@@ -0,0 +1 @@
1
+ export { PageHeader } from './PageHeader';
@@ -0,0 +1,9 @@
1
+ import { Paragraph } from '@pushwoosh/kit-typography';
2
+ export declare const RootBox: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const BackButton: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const TitleBox: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ export declare const ActionsBox: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export declare const MoreActionsBox: import("styled-components").StyledComponent<"div", any, {
7
+ hasActions: boolean;
8
+ }, never>;
9
+ export declare const DescriptionBox: import("styled-components").StyledComponent<typeof Paragraph, any, {}, never>;
@@ -0,0 +1,29 @@
1
+ import styled from 'styled-components';
2
+ import { Spacing } from '@pushwoosh/kit-constants';
3
+ import { Paragraph } from '@pushwoosh/kit-typography';
4
+ export const RootBox = styled.div.withConfig({
5
+ displayName: "RootBox",
6
+ componentId: "sc-1qwo99q-0"
7
+ })(["display:flex;flex-direction:column;"]);
8
+ export const BackButton = styled.div.withConfig({
9
+ displayName: "BackButton",
10
+ componentId: "sc-1qwo99q-1"
11
+ })(["min-width:36px;max-width:36px;& button{border:0;padding:0;}"]);
12
+ export const TitleBox = styled.div.withConfig({
13
+ displayName: "TitleBox",
14
+ componentId: "sc-1qwo99q-2"
15
+ })(["display:flex;align-items:center;justify-content:start;flex-shrink:0;gap:", ";"], Spacing.S3);
16
+ export const ActionsBox = styled.div.withConfig({
17
+ displayName: "ActionsBox",
18
+ componentId: "sc-1qwo99q-3"
19
+ })(["display:flex;justify-content:flex-end;gap:", ";"], Spacing.S3);
20
+ export const MoreActionsBox = styled.div.withConfig({
21
+ displayName: "MoreActionsBox",
22
+ componentId: "sc-1qwo99q-4"
23
+ })(["display:flex;margin-right:", ";"], ({
24
+ hasActions
25
+ }) => hasActions ? Spacing.S5 : '0');
26
+ export const DescriptionBox = styled(Paragraph).withConfig({
27
+ displayName: "DescriptionBox",
28
+ componentId: "sc-1qwo99q-5"
29
+ })(["margin-top:", ";"], Spacing.S5);
@@ -0,0 +1,15 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ export interface PageHeaderProps {
3
+ title: ReactNode;
4
+ description?: ReactNode | string;
5
+ error?: string;
6
+ resolveErrorText?: string;
7
+ submitText?: string;
8
+ cancelText?: string;
9
+ isLoadingSubmit?: boolean;
10
+ moreActions?: ReactElement;
11
+ onBack?: () => void;
12
+ onSubmit?: (params?: any) => void;
13
+ onCancel?: () => void;
14
+ onResolveError?: () => void;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { PageHeaderEditableProps } from './types';
3
+ export declare function PageHeaderEditable(props: PageHeaderEditableProps): ReactElement;