@driveflux/ui 3.0.5 → 3.0.6

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.
@@ -1,16 +1,63 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
9
+ function _iterable_to_array_limit(arr, i) {
10
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
+ if (_i == null) return;
12
+ var _arr = [];
13
+ var _n = true;
14
+ var _d = false;
15
+ var _s, _e;
16
+ try {
17
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18
+ _arr.push(_s.value);
19
+ if (i && _arr.length === i) break;
20
+ }
21
+ } catch (err) {
22
+ _d = true;
23
+ _e = err;
24
+ } finally{
25
+ try {
26
+ if (!_n && _i["return"] != null) _i["return"]();
27
+ } finally{
28
+ if (_d) throw _e;
29
+ }
30
+ }
31
+ return _arr;
32
+ }
33
+ function _non_iterable_rest() {
34
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
+ }
36
+ function _sliced_to_array(arr, i) {
37
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
38
+ }
39
+ function _unsupported_iterable_to_array(o, minLen) {
40
+ if (!o) return;
41
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
42
+ var n = Object.prototype.toString.call(o).slice(8, -1);
43
+ if (n === "Object" && o.constructor) n = o.constructor.name;
44
+ if (n === "Map" || n === "Set") return Array.from(n);
45
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
+ }
1
47
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
48
  import { IconClose } from '@driveflux/icons';
3
- import { useCallback, useEffect, useRef, useState, } from 'react';
4
- import { Box, Button, Divider, HStack, Slide, Text, useDisclosure, VStack, } from '../chakra.js';
49
+ import { useCallback, useEffect, useRef, useState } from 'react';
50
+ import { Box, Button, Divider, HStack, Slide, Text, useDisclosure, VStack } from '../chakra.js';
5
51
  import { colors } from '../theme/index.js';
6
52
  import { BottomSheetContext } from './context.js';
7
53
  import { isMobile } from './utils.js';
8
- const BottomSheetProvider = ({ children }) => {
9
- const { isOpen, onClose, onOpen } = useDisclosure();
10
- const [options, setOptions] = useState(null);
11
- const anchorY = useRef(0);
54
+ var BottomSheetProvider = function BottomSheetProvider(param) {
55
+ var children = param.children;
56
+ var _useDisclosure = useDisclosure(), isOpen = _useDisclosure.isOpen, onClose = _useDisclosure.onClose, onOpen = _useDisclosure.onOpen;
57
+ var _useState = _sliced_to_array(useState(null), 2), options = _useState[0], setOptions = _useState[1];
58
+ var anchorY = useRef(0);
12
59
  // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
13
- const open = useCallback((options) => {
60
+ var open = useCallback(function(options) {
14
61
  if (!isMobile(navigator) && !options.showOnDesktop) {
15
62
  console.log('isMobile(navigator)', isMobile(navigator));
16
63
  return;
@@ -19,56 +66,137 @@ const BottomSheetProvider = ({ children }) => {
19
66
  onOpen();
20
67
  document.body.style.overflow = 'hidden';
21
68
  }, []);
22
- const close = () => {
69
+ var close = function close() {
23
70
  onClose();
24
71
  setOptions(null);
25
72
  document.body.style.overflow = 'auto';
26
73
  };
27
- const dismissWithAnimation = (element) => {
74
+ var dismissWithAnimation = function dismissWithAnimation(element) {
28
75
  element.style.transition = 'transform 200ms ease-in';
29
76
  element.style.transform = 'translateY(100%)';
30
- setTimeout(() => {
31
- options?.onClose?.('handle');
77
+ setTimeout(function() {
78
+ var _options_onClose;
79
+ options === null || options === void 0 ? void 0 : (_options_onClose = options.onClose) === null || _options_onClose === void 0 ? void 0 : _options_onClose.call(options, 'handle');
32
80
  close();
33
81
  element.style.transition = '';
34
82
  }, 200);
35
83
  };
36
- useEffect(() => {
84
+ useEffect(function() {
37
85
  if (!options) {
38
86
  return;
39
87
  }
40
- }, [options]);
41
- return (_jsxs(BottomSheetContext.Provider, { value: { isOpen, open, close }, children: [children, _jsx(Box, { display: isOpen ? 'block' : 'none', position: 'fixed', top: 0, left: 0, right: 0, bottom: 0, background: 'blackAlpha.600', zIndex: 'modal', onClick: () => {
42
- options?.onClose?.('overlay');
88
+ }, [
89
+ options
90
+ ]);
91
+ return /*#__PURE__*/ _jsxs(BottomSheetContext.Provider, {
92
+ value: {
93
+ isOpen: isOpen,
94
+ open: open,
95
+ close: close
96
+ },
97
+ children: [
98
+ children,
99
+ /*#__PURE__*/ _jsx(Box, {
100
+ display: isOpen ? 'block' : 'none',
101
+ position: 'fixed',
102
+ top: 0,
103
+ left: 0,
104
+ right: 0,
105
+ bottom: 0,
106
+ background: 'blackAlpha.600',
107
+ zIndex: 'modal',
108
+ onClick: function onClick() {
109
+ var _options_onClose;
110
+ options === null || options === void 0 ? void 0 : (_options_onClose = options.onClose) === null || _options_onClose === void 0 ? void 0 : _options_onClose.call(options, 'overlay');
43
111
  close();
44
- } }), _jsx(Slide, { direction: 'bottom', in: isOpen, style: { zIndex: 1500, position: 'fixed' }, children: _jsxs(Box, { background: colors.white, borderTopLeftRadius: '24px', borderTopRightRadius: '24px', children: [_jsxs(VStack, { padding: '8px 24px 16px', cursor: 'pointer',
112
+ }
113
+ }),
114
+ /*#__PURE__*/ _jsx(Slide, {
115
+ direction: 'bottom',
116
+ in: isOpen,
117
+ style: {
118
+ zIndex: 1500,
119
+ position: 'fixed'
120
+ },
121
+ children: /*#__PURE__*/ _jsxs(Box, {
122
+ background: colors.white,
123
+ borderTopLeftRadius: '24px',
124
+ borderTopRightRadius: '24px',
125
+ children: [
126
+ /*#__PURE__*/ _jsxs(VStack, {
127
+ padding: '8px 24px 16px',
128
+ cursor: 'pointer',
45
129
  // mobile touch
46
- onTouchStart: (e) => {
47
- const touch = e.touches[0];
130
+ onTouchStart: function onTouchStart(e) {
131
+ var touch = e.touches[0];
48
132
  anchorY.current = touch.clientY;
49
- }, onTouchMove: (e) => {
50
- const parent = e.currentTarget.parentElement?.parentElement;
133
+ },
134
+ onTouchMove: function onTouchMove(e) {
135
+ var _e_currentTarget_parentElement;
136
+ var parent = (_e_currentTarget_parentElement = e.currentTarget.parentElement) === null || _e_currentTarget_parentElement === void 0 ? void 0 : _e_currentTarget_parentElement.parentElement;
51
137
  if (!parent) {
52
138
  return;
53
139
  }
54
- const touch = e.touches[0];
55
- const distance = touch.clientY - anchorY.current;
56
- parent.style.bottom = `-${distance}px`;
140
+ var touch = e.touches[0];
141
+ var distance = touch.clientY - anchorY.current;
142
+ parent.style.bottom = "-".concat(distance, "px");
57
143
  if (distance > 80 && touch.clientY > window.innerHeight / 2) {
58
144
  anchorY.current = 0;
59
145
  dismissWithAnimation(parent);
60
146
  }
61
- }, onTouchEnd: (e) => {
147
+ },
148
+ onTouchEnd: function onTouchEnd(e) {
149
+ var _e_currentTarget_parentElement;
62
150
  anchorY.current = 0;
63
- const parent = e.currentTarget.parentElement?.parentElement;
151
+ var parent = (_e_currentTarget_parentElement = e.currentTarget.parentElement) === null || _e_currentTarget_parentElement === void 0 ? void 0 : _e_currentTarget_parentElement.parentElement;
64
152
  if (!parent) {
65
153
  return;
66
154
  }
67
155
  parent.style.bottom = '0px';
68
- }, children: [_jsx(Box, { backgroundColor: colors.primary2, borderRadius: '4px', w: '44px', height: '4px' }), _jsxs(HStack, { w: 'full', justifyContent: 'space-between', children: [_jsx(Text, { fontSize: '12px', letterSpacing: '1px', textStyle: 'bold', textTransform: 'uppercase', children: options?.title }), _jsx(Button, { variant: 'invisible', onClick: () => {
69
- options?.onClose?.('close_button');
156
+ },
157
+ children: [
158
+ /*#__PURE__*/ _jsx(Box, {
159
+ backgroundColor: colors.primary2,
160
+ borderRadius: '4px',
161
+ w: '44px',
162
+ height: '4px'
163
+ }),
164
+ /*#__PURE__*/ _jsxs(HStack, {
165
+ w: 'full',
166
+ justifyContent: 'space-between',
167
+ children: [
168
+ /*#__PURE__*/ _jsx(Text, {
169
+ fontSize: '12px',
170
+ letterSpacing: '1px',
171
+ textStyle: 'bold',
172
+ textTransform: 'uppercase',
173
+ children: options === null || options === void 0 ? void 0 : options.title
174
+ }),
175
+ /*#__PURE__*/ _jsx(Button, {
176
+ variant: 'invisible',
177
+ onClick: function onClick() {
178
+ var _options_onClose;
179
+ options === null || options === void 0 ? void 0 : (_options_onClose = options.onClose) === null || _options_onClose === void 0 ? void 0 : _options_onClose.call(options, 'close_button');
70
180
  close();
71
- }, children: _jsx(IconClose, { size: '16px' }) })] })] }), _jsx(Divider, {}), _jsx(Box, { overflowY: 'scroll', maxH: '80vh', children: options?.content })] }) })] }));
181
+ },
182
+ children: /*#__PURE__*/ _jsx(IconClose, {
183
+ size: '16px'
184
+ })
185
+ })
186
+ ]
187
+ })
188
+ ]
189
+ }),
190
+ /*#__PURE__*/ _jsx(Divider, {}),
191
+ /*#__PURE__*/ _jsx(Box, {
192
+ overflowY: 'scroll',
193
+ maxH: '80vh',
194
+ children: options === null || options === void 0 ? void 0 : options.content
195
+ })
196
+ ]
197
+ })
198
+ })
199
+ ]
200
+ });
72
201
  };
73
202
  export default BottomSheetProvider;
74
- //# sourceMappingURL=BottomSheetProvider.js.map
@@ -1,7 +1,6 @@
1
1
  import { createContext } from 'react';
2
- export const BottomSheetContext = createContext({
2
+ export var BottomSheetContext = createContext({
3
3
  isOpen: false,
4
- open: () => { },
5
- close: () => { },
4
+ open: function open() {},
5
+ close: function close() {}
6
6
  });
7
- //# sourceMappingURL=context.js.map
@@ -1,4 +1,3 @@
1
1
  export { default as BottomSheetProvider } from './BottomSheetProvider.js';
2
2
  export * from './context.js';
3
3
  export * from './use-bottom-sheet.js';
4
- //# sourceMappingURL=index.js.map
@@ -1,4 +1,5 @@
1
1
  import { useContext } from 'react';
2
2
  import { BottomSheetContext } from './context.js';
3
- export const useBottomSheet = () => useContext(BottomSheetContext);
4
- //# sourceMappingURL=use-bottom-sheet.js.map
3
+ export var useBottomSheet = function useBottomSheet() {
4
+ return useContext(BottomSheetContext);
5
+ };
@@ -1,5 +1,5 @@
1
- export const isMobile = (navigator) => {
2
- const toMatch = [
1
+ export var isMobile = function isMobile(navigator) {
2
+ var toMatch = [
3
3
  /Android/i,
4
4
  /webOS/i,
5
5
  /iPhone/i,
@@ -7,10 +7,9 @@ export const isMobile = (navigator) => {
7
7
  /Tablet/i,
8
8
  /iPod/i,
9
9
  /BlackBerry/i,
10
- /Windows Phone/i,
10
+ /Windows Phone/i
11
11
  ];
12
- return toMatch.some((toMatchItem) => {
12
+ return toMatch.some(function(toMatchItem) {
13
13
  return navigator.userAgent.match(toMatchItem);
14
14
  });
15
15
  };
16
- //# sourceMappingURL=utils.js.map
package/dist/chakra.js CHANGED
@@ -1,3 +1,2 @@
1
1
  'use client';
2
2
  export * from '@chakra-ui/react';
3
- //# sourceMappingURL=chakra.js.map
@@ -1,67 +1,177 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
9
+ function _define_property(obj, key, value) {
10
+ if (key in obj) {
11
+ Object.defineProperty(obj, key, {
12
+ value: value,
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true
16
+ });
17
+ } else {
18
+ obj[key] = value;
19
+ }
20
+ return obj;
21
+ }
22
+ function _iterable_to_array_limit(arr, i) {
23
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
24
+ if (_i == null) return;
25
+ var _arr = [];
26
+ var _n = true;
27
+ var _d = false;
28
+ var _s, _e;
29
+ try {
30
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
31
+ _arr.push(_s.value);
32
+ if (i && _arr.length === i) break;
33
+ }
34
+ } catch (err) {
35
+ _d = true;
36
+ _e = err;
37
+ } finally{
38
+ try {
39
+ if (!_n && _i["return"] != null) _i["return"]();
40
+ } finally{
41
+ if (_d) throw _e;
42
+ }
43
+ }
44
+ return _arr;
45
+ }
46
+ function _non_iterable_rest() {
47
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
48
+ }
49
+ function _object_spread(target) {
50
+ for(var i = 1; i < arguments.length; i++){
51
+ var source = arguments[i] != null ? arguments[i] : {};
52
+ var ownKeys = Object.keys(source);
53
+ if (typeof Object.getOwnPropertySymbols === "function") {
54
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
55
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
56
+ }));
57
+ }
58
+ ownKeys.forEach(function(key) {
59
+ _define_property(target, key, source[key]);
60
+ });
61
+ }
62
+ return target;
63
+ }
64
+ function ownKeys(object, enumerableOnly) {
65
+ var keys = Object.keys(object);
66
+ if (Object.getOwnPropertySymbols) {
67
+ var symbols = Object.getOwnPropertySymbols(object);
68
+ if (enumerableOnly) {
69
+ symbols = symbols.filter(function(sym) {
70
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
71
+ });
72
+ }
73
+ keys.push.apply(keys, symbols);
74
+ }
75
+ return keys;
76
+ }
77
+ function _object_spread_props(target, source) {
78
+ source = source != null ? source : {};
79
+ if (Object.getOwnPropertyDescriptors) {
80
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
81
+ } else {
82
+ ownKeys(Object(source)).forEach(function(key) {
83
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
84
+ });
85
+ }
86
+ return target;
87
+ }
88
+ function _sliced_to_array(arr, i) {
89
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
90
+ }
91
+ function _unsupported_iterable_to_array(o, minLen) {
92
+ if (!o) return;
93
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
94
+ var n = Object.prototype.toString.call(o).slice(8, -1);
95
+ if (n === "Object" && o.constructor) n = o.constructor.name;
96
+ if (n === "Map" || n === "Set") return Array.from(n);
97
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
98
+ }
1
99
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
100
  import isEmpty from 'lodash/isEmpty.js';
3
- import { useCallback, useMemo, useState, } from 'react';
101
+ import { useCallback, useMemo, useState } from 'react';
4
102
  import { Modal, ModalContent, ModalOverlay, useDisclosure } from '../chakra.js';
5
103
  import { isReactNode } from '../utils/react.js';
6
104
  import MinimalModalContent from './components/MinimalModalContent.js';
7
105
  import StandardModalContent from './components/StandardModalContent.js';
8
- import { ModalContext, } from './context.js';
9
- const getModalComponent = (modalContentConfig, controls) => {
10
- const otherProps = modalContentConfig.contentProps || {};
11
- switch (modalContentConfig.type) {
12
- case 'standard': {
13
- return (_jsx(StandardModalContent, { controls: controls, modalContentConfig: modalContentConfig, ...otherProps }));
14
- }
15
- case 'minimal': {
16
- return (_jsx(MinimalModalContent, { controls: controls, modalContentConfig: modalContentConfig, ...otherProps }));
17
- }
106
+ import { ModalContext } from './context.js';
107
+ var getModalComponent = function getModalComponent(modalContentConfig, controls) {
108
+ var otherProps = modalContentConfig.contentProps || {};
109
+ switch(modalContentConfig.type){
110
+ case 'standard':
111
+ {
112
+ return /*#__PURE__*/ _jsx(StandardModalContent, _object_spread({
113
+ controls: controls,
114
+ modalContentConfig: modalContentConfig
115
+ }, otherProps));
116
+ }
117
+ case 'minimal':
118
+ {
119
+ return /*#__PURE__*/ _jsx(MinimalModalContent, _object_spread({
120
+ controls: controls,
121
+ modalContentConfig: modalContentConfig
122
+ }, otherProps));
123
+ }
18
124
  case 'custom':
19
- return isReactNode(modalContentConfig.content) ? (modalContentConfig.content) : (_jsx(modalContentConfig.content, { open: open, close: close, ...otherProps }));
20
- default: {
21
- const _exhaustiveCheck = modalContentConfig;
22
- return null;
23
- }
125
+ return isReactNode(modalContentConfig.content) ? modalContentConfig.content : /*#__PURE__*/ _jsx(modalContentConfig.content, _object_spread({
126
+ open: open,
127
+ close: close
128
+ }, otherProps));
129
+ default:
130
+ {
131
+ var _exhaustiveCheck = modalContentConfig;
132
+ return null;
133
+ }
24
134
  }
25
135
  };
26
- const isModalOpenOptions = (options) => {
27
- return options?.modalContentConfig !== undefined;
136
+ var isModalOpenOptions = function isModalOpenOptions(options) {
137
+ return (options === null || options === void 0 ? void 0 : options.modalContentConfig) !== undefined;
28
138
  };
29
- const ModalProvider = ({ children }) => {
30
- const { isOpen, onClose: onCloseRaw, onOpen: onOpenRaw } = useDisclosure();
31
- const [modalContentConfig, setModalContentConfig] = useState();
32
- const [modalOptions, setModalOptions] = useState();
33
- const [modalState, setModalState] = useState();
34
- const onClose = useCallback((options) => {
139
+ var ModalProvider = function ModalProvider(param) {
140
+ var children = param.children;
141
+ var _useDisclosure = useDisclosure(), isOpen = _useDisclosure.isOpen, onCloseRaw = _useDisclosure.onClose, onOpenRaw = _useDisclosure.onOpen;
142
+ var _useState = _sliced_to_array(useState(), 2), modalContentConfig = _useState[0], setModalContentConfig = _useState[1];
143
+ var _useState1 = _sliced_to_array(useState(), 2), modalOptions = _useState1[0], setModalOptions = _useState1[1];
144
+ var _useState2 = _sliced_to_array(useState(), 2), modalState = _useState2[0], setModalState = _useState2[1];
145
+ var onClose = useCallback(function(options) {
35
146
  onCloseRaw();
36
- if (modalOptions?.onClose) {
147
+ if (modalOptions === null || modalOptions === void 0 ? void 0 : modalOptions.onClose) {
37
148
  modalOptions.onClose();
38
149
  }
39
- if (!options?.keepModalContentConfig) {
150
+ if (!(options === null || options === void 0 ? void 0 : options.keepModalContentConfig)) {
40
151
  setModalContentConfig(undefined);
41
152
  setModalOptions(undefined);
42
153
  setModalState(undefined);
43
154
  }
44
- }, [modalOptions, onCloseRaw]);
45
- const onOpen = useCallback((modalContentConfigOrOptions) => {
46
- let newModalContentConfig;
47
- let newModalSate;
48
- let newModalOptions;
155
+ }, [
156
+ modalOptions,
157
+ onCloseRaw
158
+ ]);
159
+ var onOpen = useCallback(function(modalContentConfigOrOptions) {
160
+ var newModalContentConfig;
161
+ var newModalSate;
162
+ var newModalOptions;
49
163
  // Here, we know we're passing the global options object
50
164
  if (isModalOpenOptions(modalContentConfigOrOptions)) {
51
165
  newModalContentConfig = modalContentConfigOrOptions.modalContentConfig;
52
- newModalSate =
53
- modalContentConfigOrOptions.modalContentConfig.initialModalState;
166
+ newModalSate = modalContentConfigOrOptions.modalContentConfig.initialModalState;
54
167
  newModalOptions = modalContentConfigOrOptions;
55
- }
56
- // we will set the state only when we're passing the modal content config. Maybe the modal
57
- // was closed with keepModalContentConfig set to true, so we don't want to override the state
58
- else if (modalContentConfigOrOptions) {
168
+ } else if (modalContentConfigOrOptions) {
59
169
  newModalContentConfig = modalContentConfigOrOptions;
60
170
  newModalSate = undefined;
61
171
  newModalOptions = undefined;
62
172
  }
63
- setModalContentConfig((oldModalContentConfig) => {
64
- const modalContentConfig = newModalContentConfig || oldModalContentConfig;
173
+ setModalContentConfig(function(oldModalContentConfig) {
174
+ var modalContentConfig = newModalContentConfig || oldModalContentConfig;
65
175
  if (modalContentConfig) {
66
176
  onOpenRaw();
67
177
  }
@@ -69,39 +179,67 @@ const ModalProvider = ({ children }) => {
69
179
  });
70
180
  setModalState(newModalSate);
71
181
  setModalOptions(newModalOptions);
72
- }, [onOpenRaw]);
73
- const update = useCallback((updateOptions) => {
182
+ }, [
183
+ onOpenRaw
184
+ ]);
185
+ var update = useCallback(function(updateOptions) {
74
186
  if (!updateOptions || isEmpty(updateOptions)) {
75
187
  return;
76
188
  }
77
- setModalContentConfig((oldModalContentConfig) => {
189
+ setModalContentConfig(function(oldModalContentConfig) {
78
190
  if (!oldModalContentConfig) {
79
191
  return oldModalContentConfig;
80
192
  }
81
- return {
82
- ...oldModalContentConfig,
83
- ...updateOptions.modalContentConfig,
84
- contentProps: {
85
- ...updateOptions.contentProps,
86
- ...oldModalContentConfig.contentProps,
87
- },
88
- };
193
+ return _object_spread_props(_object_spread({}, oldModalContentConfig, updateOptions.modalContentConfig), {
194
+ contentProps: _object_spread({}, updateOptions.contentProps, oldModalContentConfig.contentProps)
195
+ });
89
196
  });
90
197
  }, []);
91
- const state = useMemo(() => {
198
+ var state = useMemo(function() {
92
199
  return {
93
- isOpen,
200
+ isOpen: isOpen,
94
201
  // TODO
95
202
  // @ts-expect-error
96
203
  open: onOpen,
97
204
  close: onClose,
98
- update,
99
- modalState,
100
- setModalState,
205
+ update: update,
206
+ modalState: modalState,
207
+ setModalState: setModalState
101
208
  };
102
- }, [onOpen, onClose, update, modalState, isOpen]);
103
- const content = useMemo(() => modalContentConfig && getModalComponent(modalContentConfig, state), [modalContentConfig, state]);
104
- return (_jsxs(ModalContext.Provider, { value: state, children: [children, _jsxs(Modal, { scrollBehavior: 'inside', isCentered: true, blockScrollOnMount: true, closeOnOverlayClick: true, size: modalContentConfig?.size || '3xl', isOpen: isOpen, onClose: onClose, children: [_jsx(ModalOverlay, {}), _jsx(ModalContent, { borderRadius: 0, children: content })] })] }));
209
+ }, [
210
+ onOpen,
211
+ onClose,
212
+ update,
213
+ modalState,
214
+ isOpen
215
+ ]);
216
+ var content = useMemo(function() {
217
+ return modalContentConfig && getModalComponent(modalContentConfig, state);
218
+ }, [
219
+ modalContentConfig,
220
+ state
221
+ ]);
222
+ return /*#__PURE__*/ _jsxs(ModalContext.Provider, {
223
+ value: state,
224
+ children: [
225
+ children,
226
+ /*#__PURE__*/ _jsxs(Modal, {
227
+ scrollBehavior: 'inside',
228
+ isCentered: true,
229
+ blockScrollOnMount: true,
230
+ closeOnOverlayClick: true,
231
+ size: (modalContentConfig === null || modalContentConfig === void 0 ? void 0 : modalContentConfig.size) || '3xl',
232
+ isOpen: isOpen,
233
+ onClose: onClose,
234
+ children: [
235
+ /*#__PURE__*/ _jsx(ModalOverlay, {}),
236
+ /*#__PURE__*/ _jsx(ModalContent, {
237
+ borderRadius: 0,
238
+ children: content
239
+ })
240
+ ]
241
+ })
242
+ ]
243
+ });
105
244
  };
106
245
  export default ModalProvider;
107
- //# sourceMappingURL=ModalProvider.js.map