@dreamcommerce/aurora 3.0.0-31 → 3.0.0-33

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 (111) hide show
  1. package/build/cjs/packages/aurora/src/assets/icons/close_line.js +10 -0
  2. package/build/cjs/packages/aurora/src/assets/icons/close_line.js.map +1 -0
  3. package/build/cjs/packages/aurora/src/assets/icons/question_icon.js +10 -0
  4. package/build/cjs/packages/aurora/src/assets/icons/question_icon.js.map +1 -0
  5. package/build/cjs/packages/aurora/src/components/action_list/components/action_list_label.js +7 -4
  6. package/build/cjs/packages/aurora/src/components/action_list/components/action_list_label.js.map +1 -1
  7. package/build/cjs/packages/aurora/src/components/box/box.js +6 -6
  8. package/build/cjs/packages/aurora/src/components/divider/divider.js +27 -13
  9. package/build/cjs/packages/aurora/src/components/divider/divider.js.map +1 -1
  10. package/build/cjs/packages/aurora/src/components/divider/divider_constants.js +24 -0
  11. package/build/cjs/packages/aurora/src/components/divider/divider_constants.js.map +1 -0
  12. package/build/cjs/packages/aurora/src/components/divider/divider_variants.js +39 -4
  13. package/build/cjs/packages/aurora/src/components/divider/divider_variants.js.map +1 -1
  14. package/build/cjs/packages/aurora/src/components/modal/components/modal/modal.js +98 -0
  15. package/build/cjs/packages/aurora/src/components/modal/components/modal/modal.js.map +1 -0
  16. package/build/cjs/packages/aurora/src/components/modal/components/modal/modal_close_icon.js +24 -0
  17. package/build/cjs/packages/aurora/src/components/modal/components/modal/modal_close_icon.js.map +1 -0
  18. package/build/cjs/packages/aurora/src/components/modal/components/modal/modal_footer.js +20 -0
  19. package/build/cjs/packages/aurora/src/components/modal/components/modal/modal_footer.js.map +1 -0
  20. package/build/cjs/packages/aurora/src/components/modal/components/modal/modal_header.js +28 -0
  21. package/build/cjs/packages/aurora/src/components/modal/components/modal/modal_header.js.map +1 -0
  22. package/build/cjs/packages/aurora/src/components/modal/components/modals_wrapper.js +53 -0
  23. package/build/cjs/packages/aurora/src/components/modal/components/modals_wrapper.js.map +1 -0
  24. package/build/cjs/packages/aurora/src/components/modal/hooks/use_modals.js +109 -0
  25. package/build/cjs/packages/aurora/src/components/modal/hooks/use_modals.js.map +1 -0
  26. package/build/cjs/packages/aurora/src/components/modal/hooks/use_modals_context.js +17 -0
  27. package/build/cjs/packages/aurora/src/components/modal/hooks/use_modals_context.js.map +1 -0
  28. package/build/cjs/packages/aurora/src/components/modal/modal_constants.js +24 -0
  29. package/build/cjs/packages/aurora/src/components/modal/modal_constants.js.map +1 -0
  30. package/build/cjs/packages/aurora/src/components/modal/modal_context.js +21 -0
  31. package/build/cjs/packages/aurora/src/components/modal/modal_context.js.map +1 -0
  32. package/build/cjs/packages/aurora/src/components/modal/modal_variants.js +19 -0
  33. package/build/cjs/packages/aurora/src/components/modal/modal_variants.js.map +1 -0
  34. package/build/cjs/packages/aurora/src/components/modal/modals_manager.js +43 -0
  35. package/build/cjs/packages/aurora/src/components/modal/modals_manager.js.map +1 -0
  36. package/build/cjs/packages/aurora/src/components/stack/stack.js +9 -9
  37. package/build/cjs/packages/aurora/src/components/tooltip/components/tooltip_trigger.js +15 -1
  38. package/build/cjs/packages/aurora/src/components/tooltip/components/tooltip_trigger.js.map +1 -1
  39. package/build/cjs/packages/aurora/src/index.js +8 -0
  40. package/build/cjs/packages/aurora/src/index.js.map +1 -1
  41. package/build/esm/packages/aurora/src/assets/icons/close_line.d.ts +1 -0
  42. package/build/esm/packages/aurora/src/assets/icons/close_line.js +6 -0
  43. package/build/esm/packages/aurora/src/assets/icons/close_line.js.map +1 -0
  44. package/build/esm/packages/aurora/src/assets/icons/question_icon.d.ts +1 -0
  45. package/build/esm/packages/aurora/src/assets/icons/question_icon.js +6 -0
  46. package/build/esm/packages/aurora/src/assets/icons/question_icon.js.map +1 -0
  47. package/build/esm/packages/aurora/src/components/action_list/components/action_list_label.d.ts +1 -1
  48. package/build/esm/packages/aurora/src/components/action_list/components/action_list_label.js +7 -4
  49. package/build/esm/packages/aurora/src/components/action_list/components/action_list_label.js.map +1 -1
  50. package/build/esm/packages/aurora/src/components/box/box.d.ts +2 -2
  51. package/build/esm/packages/aurora/src/components/box/box.js +6 -6
  52. package/build/esm/packages/aurora/src/components/divider/divider.d.ts +2 -6
  53. package/build/esm/packages/aurora/src/components/divider/divider.js +27 -13
  54. package/build/esm/packages/aurora/src/components/divider/divider.js.map +1 -1
  55. package/build/esm/packages/aurora/src/components/divider/divider_constants.d.ts +15 -0
  56. package/build/esm/packages/aurora/src/components/divider/divider_constants.js +18 -0
  57. package/build/esm/packages/aurora/src/components/divider/divider_constants.js.map +1 -0
  58. package/build/esm/packages/aurora/src/components/divider/divider_types.d.ts +8 -3
  59. package/build/esm/packages/aurora/src/components/divider/divider_types.js +3 -0
  60. package/build/esm/packages/aurora/src/components/divider/divider_types.js.map +1 -1
  61. package/build/esm/packages/aurora/src/components/divider/divider_variants.d.ts +3 -2
  62. package/build/esm/packages/aurora/src/components/divider/divider_variants.js +39 -4
  63. package/build/esm/packages/aurora/src/components/divider/divider_variants.js.map +1 -1
  64. package/build/esm/packages/aurora/src/components/modal/components/modal/modal.d.ts +3 -0
  65. package/build/esm/packages/aurora/src/components/modal/components/modal/modal.js +90 -0
  66. package/build/esm/packages/aurora/src/components/modal/components/modal/modal.js.map +1 -0
  67. package/build/esm/packages/aurora/src/components/modal/components/modal/modal_close_icon.d.ts +3 -0
  68. package/build/esm/packages/aurora/src/components/modal/components/modal/modal_close_icon.js +16 -0
  69. package/build/esm/packages/aurora/src/components/modal/components/modal/modal_close_icon.js.map +1 -0
  70. package/build/esm/packages/aurora/src/components/modal/components/modal/modal_footer.d.ts +3 -0
  71. package/build/esm/packages/aurora/src/components/modal/components/modal/modal_footer.js +12 -0
  72. package/build/esm/packages/aurora/src/components/modal/components/modal/modal_footer.js.map +1 -0
  73. package/build/esm/packages/aurora/src/components/modal/components/modal/modal_header.d.ts +3 -0
  74. package/build/esm/packages/aurora/src/components/modal/components/modal/modal_header.js +20 -0
  75. package/build/esm/packages/aurora/src/components/modal/components/modal/modal_header.js.map +1 -0
  76. package/build/esm/packages/aurora/src/components/modal/components/modals_wrapper.d.ts +6 -0
  77. package/build/esm/packages/aurora/src/components/modal/components/modals_wrapper.js +45 -0
  78. package/build/esm/packages/aurora/src/components/modal/components/modals_wrapper.js.map +1 -0
  79. package/build/esm/packages/aurora/src/components/modal/hooks/use_modals.d.ts +12 -0
  80. package/build/esm/packages/aurora/src/components/modal/hooks/use_modals.js +105 -0
  81. package/build/esm/packages/aurora/src/components/modal/hooks/use_modals.js.map +1 -0
  82. package/build/esm/packages/aurora/src/components/modal/hooks/use_modals_context.d.ts +2 -0
  83. package/build/esm/packages/aurora/src/components/modal/hooks/use_modals_context.js +13 -0
  84. package/build/esm/packages/aurora/src/components/modal/hooks/use_modals_context.js.map +1 -0
  85. package/build/esm/packages/aurora/src/components/modal/modal_constants.d.ts +13 -0
  86. package/build/esm/packages/aurora/src/components/modal/modal_constants.js +16 -0
  87. package/build/esm/packages/aurora/src/components/modal/modal_constants.js.map +1 -0
  88. package/build/esm/packages/aurora/src/components/modal/modal_context.d.ts +3 -0
  89. package/build/esm/packages/aurora/src/components/modal/modal_context.js +17 -0
  90. package/build/esm/packages/aurora/src/components/modal/modal_context.js.map +1 -0
  91. package/build/esm/packages/aurora/src/components/modal/modal_types.d.ts +39 -0
  92. package/build/esm/packages/aurora/src/components/modal/modal_types.js +3 -0
  93. package/build/esm/packages/aurora/src/components/modal/modal_types.js.map +1 -0
  94. package/build/esm/packages/aurora/src/components/modal/modal_variants.d.ts +3 -0
  95. package/build/esm/packages/aurora/src/components/modal/modal_variants.js +15 -0
  96. package/build/esm/packages/aurora/src/components/modal/modal_variants.js.map +1 -0
  97. package/build/esm/packages/aurora/src/components/modal/modals_manager.d.ts +6 -0
  98. package/build/esm/packages/aurora/src/components/modal/modals_manager.js +35 -0
  99. package/build/esm/packages/aurora/src/components/modal/modals_manager.js.map +1 -0
  100. package/build/esm/packages/aurora/src/components/stack/stack.d.ts +2 -2
  101. package/build/esm/packages/aurora/src/components/stack/stack.js +9 -9
  102. package/build/esm/packages/aurora/src/components/stack/stack_types.d.ts +2 -2
  103. package/build/esm/packages/aurora/src/components/tooltip/components/tooltip_trigger.d.ts +2 -2
  104. package/build/esm/packages/aurora/src/components/tooltip/components/tooltip_trigger.js +15 -1
  105. package/build/esm/packages/aurora/src/components/tooltip/components/tooltip_trigger.js.map +1 -1
  106. package/build/esm/packages/aurora/src/index.d.ts +3 -0
  107. package/build/esm/packages/aurora/src/index.js +3 -0
  108. package/build/esm/packages/aurora/src/index.js.map +1 -1
  109. package/build/index.css +1 -1
  110. package/build/tailwind.config.js +20 -4
  111. package/package.json +7 -5
@@ -0,0 +1,90 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { slicedToArray as _slicedToArray } from '../../../../../../../_virtual/_rollupPluginBabelHelpers.js';
3
+ import { cn } from '../../../../utilities/cn.js';
4
+ import { MODAL_VISIBILITY_STATE, MODAL_SLIDE_FADE_DURATION, MODAL_WIDTH_VARIANT } from '../../modal_constants.js';
5
+ import { ModalFooter } from './modal_footer.js';
6
+ import { ModalHeader } from './modal_header.js';
7
+ import { createPortal } from 'react-dom';
8
+ import { modalVariants } from '../../modal_variants.js';
9
+ import { useModalsContext } from '../../hooks/use_modals_context.js';
10
+
11
+ var Modal = function Modal(_ref) {
12
+ var name = _ref.name,
13
+ hideAllModalsOnClose = _ref.hideAllModalsOnClose,
14
+ _ref$width = _ref.width,
15
+ width = _ref$width === void 0 ? MODAL_WIDTH_VARIANT.m : _ref$width,
16
+ _ref$hasCloseIcon = _ref.hasCloseIcon,
17
+ hasCloseIcon = _ref$hasCloseIcon === void 0 ? true : _ref$hasCloseIcon,
18
+ onCloseAction = _ref.onCloseAction,
19
+ header = _ref.header,
20
+ footer = _ref.footer,
21
+ children = _ref.children;
22
+ var _useState = useState(false),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ visibleClass = _useState2[0],
25
+ setVisibleClass = _useState2[1];
26
+ var _useModalsContext = useModalsContext(),
27
+ modalsManagerContainerSelector = _useModalsContext.modalsManagerContainerSelector,
28
+ addModal = _useModalsContext.addModal,
29
+ getModal = _useModalsContext.getModal,
30
+ hideModal = _useModalsContext.hideModal,
31
+ hideAllModals = _useModalsContext.hideAllModals;
32
+ var $modalsManagerContainer = document.querySelector(modalsManagerContainerSelector);
33
+ var modal = getModal(name);
34
+ var _useState3 = useState(false),
35
+ _useState4 = _slicedToArray(_useState3, 2),
36
+ renderModal = _useState4[0],
37
+ setRenderModal = _useState4[1];
38
+ useEffect(function () {
39
+ addModal({
40
+ name: name,
41
+ visibilityState: MODAL_VISIBILITY_STATE.none,
42
+ width: width
43
+ });
44
+ }, []);
45
+ useEffect(function () {
46
+ var showModalTimeout;
47
+ var hideModalTimeout;
48
+ if ((modal === null || modal === void 0 ? void 0 : modal.visibilityState) === MODAL_VISIBILITY_STATE.visible) {
49
+ setRenderModal(true);
50
+ showModalTimeout = setTimeout(function () {
51
+ setVisibleClass(true);
52
+ }, MODAL_SLIDE_FADE_DURATION);
53
+ }
54
+ if ((modal === null || modal === void 0 ? void 0 : modal.visibilityState) === MODAL_VISIBILITY_STATE.hidden) {
55
+ setVisibleClass(false);
56
+ }
57
+ if ((modal === null || modal === void 0 ? void 0 : modal.visibilityState) === MODAL_VISIBILITY_STATE.none) {
58
+ setVisibleClass(false);
59
+ hideModalTimeout = setTimeout(function () {
60
+ setRenderModal(false);
61
+ }, MODAL_SLIDE_FADE_DURATION);
62
+ }
63
+ return function () {
64
+ clearTimeout(showModalTimeout);
65
+ clearTimeout(hideModalTimeout);
66
+ };
67
+ }, [modal]);
68
+ var handleCloseModal = function handleCloseModal() {
69
+ hideAllModalsOnClose ? hideAllModals(onCloseAction) : hideModal(name, onCloseAction);
70
+ };
71
+ if (!$modalsManagerContainer) return null;
72
+ return renderModal ? /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement("div", {
73
+ "data-modal-id": name,
74
+ "data-test-id": "modal",
75
+ className: cn(modalVariants({
76
+ width: width
77
+ }), visibleClass ? 'aurora-opacity-100 aurora-animate-modal-slide-in' : 'aurora-opacity-0 aurora-animate-modal-slide-out')
78
+ }, header && /*#__PURE__*/React.createElement(ModalHeader, {
79
+ hasCloseIcon: hasCloseIcon,
80
+ text: header.text,
81
+ onClose: handleCloseModal
82
+ }), children && /*#__PURE__*/React.createElement("div", {
83
+ className: "aurora-overflow-y-auto"
84
+ }, children), footer && /*#__PURE__*/React.createElement(ModalFooter, {
85
+ text: footer.text
86
+ })), $modalsManagerContainer) : null;
87
+ };
88
+
89
+ export { Modal };
90
+ //# sourceMappingURL=modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { IModalCloseIconProps } from "../../modal_types";
3
+ export declare const ModalCloseIcon: FC<IModalCloseIconProps>;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { CloseLine } from '../../../../assets/icons/close_line.js';
3
+
4
+ var ModalCloseIcon = function ModalCloseIcon(_ref) {
5
+ var onClose = _ref.onClose;
6
+ return /*#__PURE__*/React.createElement("button", {
7
+ className: "aurora-p-1 aurora-border-0 aurora-bg-none aurora-cursor-pointer aurora-rounded-4 aurora-bg-transparent hover:aurora-bg-hover",
8
+ onClick: function onClick() {
9
+ return onClose();
10
+ },
11
+ "data-test-id": "close-modal"
12
+ }, /*#__PURE__*/React.createElement(CloseLine, null));
13
+ };
14
+
15
+ export { ModalCloseIcon };
16
+ //# sourceMappingURL=modal_close_icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { IModalFooterProps } from "../../modal_types";
3
+ export declare const ModalFooter: FC<IModalFooterProps>;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+
3
+ var ModalFooter = function ModalFooter(_ref) {
4
+ var text = _ref.text;
5
+ return /*#__PURE__*/React.createElement("footer", {
6
+ className: 'aurora-flex aurora-items-center aurora-justify-end aurora-gap-3 aurora-mt-5',
7
+ "data-test-id": "modal-footer"
8
+ }, text);
9
+ };
10
+
11
+ export { ModalFooter };
12
+ //# sourceMappingURL=modal_footer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { IModalHeaderProps } from "../../modal_types";
3
+ export declare const ModalHeader: FC<IModalHeaderProps>;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { ModalCloseIcon } from './modal_close_icon.js';
3
+
4
+ var ModalHeader = function ModalHeader(_ref) {
5
+ var _ref$text = _ref.text,
6
+ text = _ref$text === void 0 ? '' : _ref$text,
7
+ onClose = _ref.onClose,
8
+ hasCloseIcon = _ref.hasCloseIcon;
9
+ return /*#__PURE__*/React.createElement("header", {
10
+ className: 'aurora-flex aurora-items-center aurora-justify-between aurora-mb-5',
11
+ "data-test-id": "modal-header"
12
+ }, /*#__PURE__*/React.createElement("h3", {
13
+ className: "aurora-font-bold aurora-text-xl"
14
+ }, text), hasCloseIcon && /*#__PURE__*/React.createElement(ModalCloseIcon, {
15
+ onClose: onClose
16
+ }));
17
+ };
18
+
19
+ export { ModalHeader };
20
+ //# sourceMappingURL=modal_header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,6 @@
1
+ import React, { ReactNode } from 'react';
2
+ interface IModalsWrapperProps {
3
+ children: ReactNode;
4
+ }
5
+ export declare const ModalsWrapper: React.FC<IModalsWrapperProps>;
6
+ export {};
@@ -0,0 +1,45 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { slicedToArray as _slicedToArray } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
3
+ import { MODALS_WRAPPER_BACKDROP_FADE_DURATION, MODALS_CONTENT_ID } from '../modal_constants.js';
4
+ import { createPortal } from 'react-dom';
5
+ import { useModalsContext } from '../hooks/use_modals_context.js';
6
+
7
+ var ModalsWrapper = function ModalsWrapper(_ref) {
8
+ var children = _ref.children;
9
+ var _useState = useState(false),
10
+ _useState2 = _slicedToArray(_useState, 2),
11
+ showWrapper = _useState2[0],
12
+ setShowWrapper = _useState2[1];
13
+ var _useState3 = useState(false),
14
+ _useState4 = _slicedToArray(_useState3, 2),
15
+ visibleClass = _useState4[0],
16
+ setVisibleClass = _useState4[1];
17
+ var _useModalsContext = useModalsContext(),
18
+ openedModals = _useModalsContext.openedModals;
19
+ useEffect(function () {
20
+ var showWrapperTimeout;
21
+ if (openedModals.length) {
22
+ setShowWrapper(true);
23
+ setVisibleClass(true);
24
+ } else {
25
+ setVisibleClass(false);
26
+ showWrapperTimeout = setTimeout(function () {
27
+ setShowWrapper(false);
28
+ }, MODALS_WRAPPER_BACKDROP_FADE_DURATION);
29
+ }
30
+ return function () {
31
+ return clearTimeout(showWrapperTimeout);
32
+ };
33
+ }, [openedModals]);
34
+ return /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement("div", null, showWrapper && (/*#__PURE__*/React.createElement("div", {
35
+ className: "aurora-fixed aurora-flex aurora-items-center aurora-justify-center aurora-top-0 aurora-left-0 aurora-w-full aurora-h-full aurora-z-20 aurora-p-4"
36
+ }, /*#__PURE__*/React.createElement("div", {
37
+ className: "aurora-absolute aurora-inset-x-0 aurora-inset-y-0 aurora-bg-inverse aurora-z-10 aurora-transition-opacity aurora-duration-300 aurora-animate-modal-backdrop-fade-in ".concat(visibleClass ? 'aurora-opacity-70' : 'aurora-opacity-0')
38
+ }), /*#__PURE__*/React.createElement("div", {
39
+ id: MODALS_CONTENT_ID,
40
+ className: "aurora-flex aurora-items-center aurora-justify-center aurora-z-30"
41
+ }))), children), document.body);
42
+ };
43
+
44
+ export { ModalsWrapper };
45
+ //# sourceMappingURL=modals_wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,12 @@
1
+ import { IModal } from '../modal_types';
2
+ declare const useModals: () => {
3
+ modalsManagerContainerSelector: string;
4
+ addModal: (modal: IModal) => void;
5
+ updateModal: (modal: IModal) => void;
6
+ getModal: (modalName: string) => IModal | undefined;
7
+ showModal: (modalName: string) => void;
8
+ hideModal: (modalName: string, onCloseAction: () => void | undefined) => void;
9
+ hideAllModals: (onCloseAction: () => void | undefined) => void;
10
+ openedModals: string[];
11
+ };
12
+ export default useModals;
@@ -0,0 +1,105 @@
1
+ import { useState } from 'react';
2
+ import { slicedToArray as _slicedToArray, toConsumableArray as _toConsumableArray, objectSpread2 as _objectSpread2 } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
3
+ import { MODALS_CONTENT_ID, MODAL_VISIBILITY_STATE } from '../modal_constants.js';
4
+
5
+ var useModals = function useModals() {
6
+ var _useState = useState([]),
7
+ _useState2 = _slicedToArray(_useState, 2),
8
+ modalsStack = _useState2[0],
9
+ setModalsStack = _useState2[1];
10
+ var _useState3 = useState([]),
11
+ _useState4 = _slicedToArray(_useState3, 2),
12
+ openedModals = _useState4[0],
13
+ setOpenedModals = _useState4[1];
14
+ var modalsManagerContainerSelector = "#".concat(MODALS_CONTENT_ID);
15
+ var addModal = function addModal(modal) {
16
+ setModalsStack(function (stack) {
17
+ var modalNameAlreadyExist = stack.some(function (stackModal) {
18
+ return stackModal.name === modal.name;
19
+ });
20
+ if (modalNameAlreadyExist) {
21
+ return _toConsumableArray(stack);
22
+ } else {
23
+ return [].concat(_toConsumableArray(stack), [modal]);
24
+ }
25
+ });
26
+ };
27
+ var updateModal = function updateModal(modal) {
28
+ setModalsStack(function (previousStack) {
29
+ var updatedStack = previousStack.map(function (stackModal) {
30
+ return stackModal.name === modal.name ? _objectSpread2({}, modal) : stackModal;
31
+ });
32
+ return updatedStack;
33
+ });
34
+ };
35
+ var getModal = function getModal(modalName) {
36
+ return modalsStack.find(function (stackModal) {
37
+ return stackModal.name === modalName;
38
+ });
39
+ };
40
+ var showModal = function showModal(modalName) {
41
+ setOpenedModals(function (modals) {
42
+ setVisibleState(modals, MODAL_VISIBILITY_STATE.hidden);
43
+ return [].concat(_toConsumableArray(modals), [modalName]);
44
+ });
45
+ setVisibleState(modalName, MODAL_VISIBILITY_STATE.visible);
46
+ };
47
+ var hideModal = function hideModal(modalName, onCloseAction) {
48
+ setOpenedModals(function (modals) {
49
+ var secondToLastItem = modals[modals.length - 2];
50
+ setVisibleState(secondToLastItem, MODAL_VISIBILITY_STATE.visible);
51
+ return modals.filter(function (modal) {
52
+ return modal !== modalName;
53
+ });
54
+ });
55
+ setVisibleState(modalName, MODAL_VISIBILITY_STATE.none);
56
+ onCloseAction && onCloseAction();
57
+ };
58
+ var hideAllModals = function hideAllModals(onCloseAction) {
59
+ setOpenedModals([]);
60
+ setVisibleStatesToNone();
61
+ onCloseAction && onCloseAction();
62
+ };
63
+ var setVisibleState = function setVisibleState(modalName, state) {
64
+ if (typeof modalName === 'string') {
65
+ setModalsStack(function (prevState) {
66
+ return prevState.map(function (modal) {
67
+ return modal.name === modalName ? _objectSpread2(_objectSpread2({}, modal), {}, {
68
+ visibilityState: state
69
+ }) : modal;
70
+ });
71
+ });
72
+ } else {
73
+ setModalsStack(function (prevState) {
74
+ return prevState.map(function (modal) {
75
+ if (!modalName) return modal;
76
+ return modalName.includes(modal.name) ? _objectSpread2(_objectSpread2({}, modal), {}, {
77
+ visibilityState: state
78
+ }) : modal;
79
+ });
80
+ });
81
+ }
82
+ };
83
+ var setVisibleStatesToNone = function setVisibleStatesToNone() {
84
+ setModalsStack(function (prevState) {
85
+ return prevState.map(function (modal) {
86
+ return _objectSpread2(_objectSpread2({}, modal), {}, {
87
+ visibilityState: MODAL_VISIBILITY_STATE.none
88
+ });
89
+ });
90
+ });
91
+ };
92
+ return {
93
+ modalsManagerContainerSelector: modalsManagerContainerSelector,
94
+ addModal: addModal,
95
+ updateModal: updateModal,
96
+ getModal: getModal,
97
+ showModal: showModal,
98
+ hideModal: hideModal,
99
+ hideAllModals: hideAllModals,
100
+ openedModals: openedModals
101
+ };
102
+ };
103
+
104
+ export default useModals;
105
+ //# sourceMappingURL=use_modals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,2 @@
1
+ import { IModalsManagerContextProps } from '../modal_types';
2
+ export declare function useModalsContext(): IModalsManagerContextProps;
@@ -0,0 +1,13 @@
1
+ import { useContext } from 'react';
2
+ import { ModalsManagerContext } from '../modal_context.js';
3
+
4
+ function useModalsContext() {
5
+ var context = useContext(ModalsManagerContext);
6
+ if (Object.keys(context).length === 0 && context.constructor === Object) {
7
+ throw new Error("Modal component cannot be rendered outside the ModalWrapper component");
8
+ }
9
+ return context;
10
+ }
11
+
12
+ export { useModalsContext };
13
+ //# sourceMappingURL=use_modals_context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,13 @@
1
+ export declare const MODALS_CONTENT_ID = "modals-content";
2
+ export declare const MODALS_WRAPPER_BACKDROP_FADE_DURATION = 300;
3
+ export declare const MODAL_SLIDE_FADE_DURATION = 200;
4
+ export declare const MODAL_VISIBILITY_STATE: {
5
+ readonly none: "none";
6
+ readonly hidden: "hidden";
7
+ readonly visible: "visible";
8
+ };
9
+ export declare const MODAL_WIDTH_VARIANT: {
10
+ readonly s: "s";
11
+ readonly m: "m";
12
+ readonly l: "l";
13
+ };
@@ -0,0 +1,16 @@
1
+ var MODALS_CONTENT_ID = 'modals-content';
2
+ var MODALS_WRAPPER_BACKDROP_FADE_DURATION = 300;
3
+ var MODAL_SLIDE_FADE_DURATION = 200;
4
+ var MODAL_VISIBILITY_STATE = {
5
+ none: 'none',
6
+ hidden: 'hidden',
7
+ visible: 'visible'
8
+ };
9
+ var MODAL_WIDTH_VARIANT = {
10
+ s: 's',
11
+ m: 'm',
12
+ l: 'l'
13
+ };
14
+
15
+ export { MODALS_CONTENT_ID, MODALS_WRAPPER_BACKDROP_FADE_DURATION, MODAL_SLIDE_FADE_DURATION, MODAL_VISIBILITY_STATE, MODAL_WIDTH_VARIANT };
16
+ //# sourceMappingURL=modal_constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { IModalsManagerContextProps } from './modal_types';
3
+ export declare const ModalsManagerContext: import("react").Context<IModalsManagerContextProps>;
@@ -0,0 +1,17 @@
1
+ import { createContext } from 'react';
2
+
3
+ var ModalsManagerContext = /*#__PURE__*/createContext({
4
+ modalsManagerContainerSelector: '',
5
+ addModal: function addModal() {},
6
+ updateModal: function updateModal() {},
7
+ getModal: function getModal() {
8
+ return undefined;
9
+ },
10
+ showModal: function showModal() {},
11
+ hideModal: function hideModal() {},
12
+ hideAllModals: function hideAllModals() {},
13
+ openedModals: []
14
+ });
15
+
16
+ export { ModalsManagerContext };
17
+ //# sourceMappingURL=modal_context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,39 @@
1
+ import * as React from 'react';
2
+ import { MODAL_VISIBILITY_STATE, MODAL_WIDTH_VARIANT } from './modal_constants';
3
+ export declare type VisibleStates = typeof MODAL_VISIBILITY_STATE[keyof typeof MODAL_VISIBILITY_STATE];
4
+ export interface IModal {
5
+ name: string;
6
+ visibilityState: VisibleStates;
7
+ width: typeof MODAL_WIDTH_VARIANT[keyof typeof MODAL_WIDTH_VARIANT];
8
+ }
9
+ export interface IModalsManagerContextProps {
10
+ modalsManagerContainerSelector: string;
11
+ addModal: (modal: IModal) => void;
12
+ updateModal: (modal: IModal) => void;
13
+ getModal: (modalName: string) => IModal | undefined;
14
+ showModal: (modalName: string) => void;
15
+ hideModal: (modalName: string, onCloseAction?: () => void) => void;
16
+ hideAllModals: (onCloseAction?: () => void) => void;
17
+ openedModals: string[];
18
+ }
19
+ export interface IModalNewProps extends React.HTMLAttributes<HTMLDivElement> {
20
+ name: string;
21
+ hideAllModalsOnClose?: boolean;
22
+ width?: typeof MODAL_WIDTH_VARIANT[keyof typeof MODAL_WIDTH_VARIANT];
23
+ hasCloseIcon?: boolean;
24
+ onCloseAction?: () => void;
25
+ header?: Pick<IModalHeaderProps, 'text'>;
26
+ footer?: IModalFooterProps;
27
+ children?: React.ReactNode;
28
+ }
29
+ export interface IModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
30
+ text?: string | React.ReactNode;
31
+ hasCloseIcon?: boolean;
32
+ onClose: () => void;
33
+ }
34
+ export interface IModalFooterProps extends React.HTMLAttributes<HTMLDivElement> {
35
+ text: React.ReactNode;
36
+ }
37
+ export interface IModalCloseIconProps extends React.HTMLAttributes<HTMLButtonElement> {
38
+ onClose: () => void;
39
+ }
@@ -0,0 +1,3 @@
1
+ import 'react';
2
+ import './modal_constants';
3
+ //# sourceMappingURL=modal_types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal_types.js","sourceRoot":"","sources":["../../../../../../../src/components/modal/modal_types.ts"],"names":[],"mappings":"AAAA,OAAuB,OAAO,CAAC;AAE/B,OAA4D,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const modalVariants: (props?: ({
2
+ width?: "s" | "m" | "l" | null | undefined;
3
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -0,0 +1,15 @@
1
+ import { defineProperty as _defineProperty } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { cva } from '../../../../../external/class-variance-authority/dist/index.mjs.js';
3
+ import { MODAL_WIDTH_VARIANT } from './modal_constants.js';
4
+
5
+ var modalVariants = cva('aurora-w-full aurora-absolute aurora-bg aurora-rounded-16 aurora-shadow-xl aurora-p-6 aurora-opacity-0 aurora-transition-all', {
6
+ variants: {
7
+ width: _defineProperty(_defineProperty(_defineProperty({}, MODAL_WIDTH_VARIANT.s, 'aurora-max-w-[25rem]'), MODAL_WIDTH_VARIANT.m, 'aurora-max-w-[40rem]'), MODAL_WIDTH_VARIANT.l, 'aurora-max-w-[61rem]')
8
+ },
9
+ defaultVariants: {
10
+ width: MODAL_WIDTH_VARIANT.m
11
+ }
12
+ });
13
+
14
+ export { modalVariants };
15
+ //# sourceMappingURL=modal_variants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA,oBAAoB,oEAAwE;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,6 @@
1
+ import React, { ReactNode } from 'react';
2
+ interface IModalsManagerProps {
3
+ children: ReactNode;
4
+ }
5
+ export declare const ModalsManager: React.FC<IModalsManagerProps>;
6
+ export {};
@@ -0,0 +1,35 @@
1
+ import React, { useMemo } from 'react';
2
+ import { ModalsManagerContext } from './modal_context.js';
3
+ import { ModalsWrapper } from './components/modals_wrapper.js';
4
+ import useModals from './hooks/use_modals.js';
5
+
6
+ var ModalsManager = function ModalsManager(_ref) {
7
+ var children = _ref.children;
8
+ var _useModals = useModals(),
9
+ modalsManagerContainerSelector = _useModals.modalsManagerContainerSelector,
10
+ addModal = _useModals.addModal,
11
+ updateModal = _useModals.updateModal,
12
+ getModal = _useModals.getModal,
13
+ showModal = _useModals.showModal,
14
+ hideModal = _useModals.hideModal,
15
+ hideAllModals = _useModals.hideAllModals,
16
+ openedModals = _useModals.openedModals;
17
+ var value = useMemo(function () {
18
+ return {
19
+ modalsManagerContainerSelector: modalsManagerContainerSelector,
20
+ addModal: addModal,
21
+ updateModal: updateModal,
22
+ getModal: getModal,
23
+ showModal: showModal,
24
+ hideModal: hideModal,
25
+ hideAllModals: hideAllModals,
26
+ openedModals: openedModals
27
+ };
28
+ }, [modalsManagerContainerSelector, addModal, updateModal, getModal, showModal, hideModal, hideAllModals, openedModals]);
29
+ return /*#__PURE__*/React.createElement(ModalsManagerContext.Provider, {
30
+ value: value
31
+ }, /*#__PURE__*/React.createElement(ModalsWrapper, null, children));
32
+ };
33
+
34
+ export { ModalsManager };
35
+ //# sourceMappingURL=modals_manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  export declare const Stack: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
3
3
  direction?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
4
- justifyContent?: "start" | "end" | "center" | "stretch" | "normal" | "between" | "around" | "evenly" | undefined;
5
- alignItems?: "start" | "end" | "center" | "baseline" | "stretch" | undefined;
4
+ justify?: "start" | "end" | "center" | "stretch" | "normal" | "between" | "around" | "evenly" | undefined;
5
+ align?: "start" | "end" | "center" | "baseline" | "stretch" | undefined;
6
6
  spacing?: "0" | "0.5" | "1" | "1.5" | "2" | "2.5" | "3" | "3.5" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "90" | undefined;
7
7
  wrap?: string | undefined;
8
8
  children?: React.ReactNode;
@@ -4,13 +4,13 @@ import { STACK_DIRECTION_TYPES, STACK_WRAP_TYPES, STACK_ALIGN_ITEMS_TYPES, STACK
4
4
  import { cn } from '../../utilities/cn.js';
5
5
  import { cva } from '../../../../../external/class-variance-authority/dist/index.mjs.js';
6
6
 
7
- var _excluded = ["children", "spacing", "className", "direction", "justifyContent", "alignItems", "wrap", "as", "inline", "attributes", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "style"];
7
+ var _excluded = ["children", "spacing", "className", "direction", "justify", "align", "wrap", "as", "inline", "attributes", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "style"];
8
8
  var stackVariants = cva('aurora-flex', {
9
9
  variants: {
10
10
  direction: _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, STACK_DIRECTION_TYPES.row, 'aurora-flex-row'), STACK_DIRECTION_TYPES.column, 'aurora-flex-col'), STACK_DIRECTION_TYPES.rowReverse, 'aurora-flex-row-reverse'), STACK_DIRECTION_TYPES.columnReverse, 'aurora-flex-col-reverse'),
11
11
  wrap: _defineProperty(_defineProperty(_defineProperty({}, STACK_WRAP_TYPES.wrap, 'aurora-flex-wrap'), STACK_WRAP_TYPES.nowrap, 'aurora-flex-nowrap'), STACK_WRAP_TYPES.wrapReverse, 'aurora-flex-wrap-reverse'),
12
- alignItems: _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, STACK_ALIGN_ITEMS_TYPES.start, 'aurora-items-start'), STACK_ALIGN_ITEMS_TYPES.end, 'aurora-items-end'), STACK_ALIGN_ITEMS_TYPES.center, 'aurora-items-center'), STACK_ALIGN_ITEMS_TYPES.baseline, 'aurora-items-baseline'), STACK_ALIGN_ITEMS_TYPES.stretch, 'aurora-items-stretch'),
13
- justifyContent: _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, STACK_JUSTIFY_CONTENT_TYPES.normal, 'aurora-justify-normal'), STACK_JUSTIFY_CONTENT_TYPES.start, 'aurora-justify-start'), STACK_JUSTIFY_CONTENT_TYPES.end, 'aurora-justify-end'), STACK_JUSTIFY_CONTENT_TYPES.center, 'aurora-justify-center'), STACK_JUSTIFY_CONTENT_TYPES.between, 'aurora-justify-between'), STACK_JUSTIFY_CONTENT_TYPES.around, 'aurora-justify-around'), STACK_JUSTIFY_CONTENT_TYPES.evenly, 'aurora-justify-evenly'), STACK_JUSTIFY_CONTENT_TYPES.stretch, 'aurora-justify-stretch'),
12
+ align: _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, STACK_ALIGN_ITEMS_TYPES.start, 'aurora-items-start'), STACK_ALIGN_ITEMS_TYPES.end, 'aurora-items-end'), STACK_ALIGN_ITEMS_TYPES.center, 'aurora-items-center'), STACK_ALIGN_ITEMS_TYPES.baseline, 'aurora-items-baseline'), STACK_ALIGN_ITEMS_TYPES.stretch, 'aurora-items-stretch'),
13
+ justify: _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, STACK_JUSTIFY_CONTENT_TYPES.normal, 'aurora-justify-normal'), STACK_JUSTIFY_CONTENT_TYPES.start, 'aurora-justify-start'), STACK_JUSTIFY_CONTENT_TYPES.end, 'aurora-justify-end'), STACK_JUSTIFY_CONTENT_TYPES.center, 'aurora-justify-center'), STACK_JUSTIFY_CONTENT_TYPES.between, 'aurora-justify-between'), STACK_JUSTIFY_CONTENT_TYPES.around, 'aurora-justify-around'), STACK_JUSTIFY_CONTENT_TYPES.evenly, 'aurora-justify-evenly'), STACK_JUSTIFY_CONTENT_TYPES.stretch, 'aurora-justify-stretch'),
14
14
  display: {
15
15
  inline: 'aurora-inline-flex'
16
16
  }
@@ -22,10 +22,10 @@ var Stack = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
22
22
  className = _ref.className,
23
23
  _ref$direction = _ref.direction,
24
24
  direction = _ref$direction === void 0 ? STACK_DIRECTION_TYPES.row : _ref$direction,
25
- _ref$justifyContent = _ref.justifyContent,
26
- justifyContent = _ref$justifyContent === void 0 ? STACK_JUSTIFY_CONTENT_TYPES.start : _ref$justifyContent,
27
- _ref$alignItems = _ref.alignItems,
28
- alignItems = _ref$alignItems === void 0 ? STACK_ALIGN_ITEMS_TYPES.start : _ref$alignItems,
25
+ _ref$justify = _ref.justify,
26
+ justify = _ref$justify === void 0 ? STACK_JUSTIFY_CONTENT_TYPES.start : _ref$justify,
27
+ _ref$align = _ref.align,
28
+ align = _ref$align === void 0 ? STACK_ALIGN_ITEMS_TYPES.start : _ref$align,
29
29
  _ref$wrap = _ref.wrap,
30
30
  wrap = _ref$wrap === void 0 ? STACK_WRAP_TYPES.nowrap : _ref$wrap,
31
31
  _ref$as = _ref.as,
@@ -60,8 +60,8 @@ var Stack = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
60
60
  ref: internalRef,
61
61
  className: cn(stackVariants({
62
62
  direction: direction,
63
- justifyContent: justifyContent,
64
- alignItems: alignItems,
63
+ justify: justify,
64
+ align: align,
65
65
  wrap: wrap,
66
66
  display: display
67
67
  }), className, _defineProperty({}, "aurora-gap-".concat(spacing), !!spacing)),
@@ -4,8 +4,8 @@ import { STACK_ALIGN_ITEMS_TYPES, STACK_DIRECTION_TYPES, STACK_JUSTIFY_CONTENT_T
4
4
  import { TCssSpacingTokens } from "../../constants/css_tokens/css_tokens_types";
5
5
  export declare type TStackProps = React.HTMLAttributes<HTMLElement> & {
6
6
  direction?: TStackDirection;
7
- justifyContent?: TStackJustifyContent;
8
- alignItems?: TStackAlign;
7
+ justify?: TStackJustifyContent;
8
+ align?: TStackAlign;
9
9
  spacing?: TCssSpacingTokens;
10
10
  wrap?: TStackWrap;
11
11
  children?: React.ReactNode;