@driveflux/ui 1.0.0-next.0
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.
- package/.eslintrc.json +3 -0
- package/.swcrc +14 -0
- package/.turbo/turbo-build.log +6 -0
- package/CHANGELOG.md +12 -0
- package/dist/chakra.d.ts +2 -0
- package/dist/chakra.d.ts.map +1 -0
- package/dist/chakra.js +1 -0
- package/dist/cjs/chakra.js +18 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/modal/ModalProvider.js +254 -0
- package/dist/cjs/modal/components/EnhancedModalCustomWrapper.js +139 -0
- package/dist/cjs/modal/components/EnhancedModalFooter.js +167 -0
- package/dist/cjs/modal/components/MinimalModalContent.js +94 -0
- package/dist/cjs/modal/components/StandardModalContent.js +387 -0
- package/dist/cjs/modal/context.js +20 -0
- package/dist/cjs/modal/index.js +48 -0
- package/dist/cjs/modal/use-enhanced-modal.js +15 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/theme/colors.js +140 -0
- package/dist/cjs/theme/index.js +18 -0
- package/dist/cjs/toast/index.js +19 -0
- package/dist/cjs/toast/use-toast-result.js +255 -0
- package/dist/cjs/types.js +4 -0
- package/dist/cjs/utils/accessors.js +61 -0
- package/dist/cjs/utils/index.js +19 -0
- package/dist/cjs/utils/react.js +94 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/modal/ModalProvider.d.ts +4 -0
- package/dist/modal/ModalProvider.d.ts.map +1 -0
- package/dist/modal/ModalProvider.js +239 -0
- package/dist/modal/components/EnhancedModalCustomWrapper.d.ts +9 -0
- package/dist/modal/components/EnhancedModalCustomWrapper.d.ts.map +1 -0
- package/dist/modal/components/EnhancedModalCustomWrapper.js +124 -0
- package/dist/modal/components/EnhancedModalFooter.d.ts +12 -0
- package/dist/modal/components/EnhancedModalFooter.d.ts.map +1 -0
- package/dist/modal/components/EnhancedModalFooter.js +157 -0
- package/dist/modal/components/MinimalModalContent.d.ts +11 -0
- package/dist/modal/components/MinimalModalContent.d.ts.map +1 -0
- package/dist/modal/components/MinimalModalContent.js +84 -0
- package/dist/modal/components/StandardModalContent.d.ts +11 -0
- package/dist/modal/components/StandardModalContent.d.ts.map +1 -0
- package/dist/modal/components/StandardModalContent.js +377 -0
- package/dist/modal/context.d.ts +62 -0
- package/dist/modal/context.d.ts.map +1 -0
- package/dist/modal/context.js +10 -0
- package/dist/modal/index.d.ts +7 -0
- package/dist/modal/index.d.ts.map +1 -0
- package/dist/modal/index.js +6 -0
- package/dist/modal/use-enhanced-modal.d.ts +3 -0
- package/dist/modal/use-enhanced-modal.d.ts.map +1 -0
- package/dist/modal/use-enhanced-modal.js +5 -0
- package/dist/theme/colors.d.ts +148 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +130 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +1 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.d.ts.map +1 -0
- package/dist/toast/index.js +1 -0
- package/dist/toast/use-toast-result.d.ts +30 -0
- package/dist/toast/use-toast-result.d.ts.map +1 -0
- package/dist/toast/use-toast-result.js +232 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils/accessors.d.ts +24 -0
- package/dist/utils/accessors.d.ts.map +1 -0
- package/dist/utils/accessors.js +28 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/react.d.ts +5 -0
- package/dist/utils/react.d.ts.map +1 -0
- package/dist/utils/react.js +32 -0
- package/index.cjs +1 -0
- package/index.d.ts +1 -0
- package/modal.cjs +1 -0
- package/modal.d.ts +1 -0
- package/package.json +68 -0
- package/src/chakra.ts +1 -0
- package/src/index.ts +1 -0
- package/src/modal/ModalProvider.tsx +142 -0
- package/src/modal/components/EnhancedModalCustomWrapper.tsx +39 -0
- package/src/modal/components/EnhancedModalFooter.tsx +51 -0
- package/src/modal/components/MinimalModalContent.tsx +24 -0
- package/src/modal/components/StandardModalContent.tsx +65 -0
- package/src/modal/context.tsx +81 -0
- package/src/modal/index.ts +7 -0
- package/src/modal/use-enhanced-modal.ts +7 -0
- package/src/theme/colors.ts +171 -0
- package/src/theme/index.ts +1 -0
- package/src/toast/index.ts +3 -0
- package/src/toast/use-toast-result.tsx +169 -0
- package/src/types.ts +22 -0
- package/src/utils/accessors.ts +64 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/react.ts +32 -0
- package/theme.cjs +1 -0
- package/theme.d.ts +1 -0
- package/toast.cjs +1 -0
- package/toast.d.ts +1 -0
- package/tsconfig.json +14 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/utils.cjs +1 -0
- package/utils.d.ts +1 -0
|
@@ -0,0 +1,239 @@
|
|
|
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
|
+
}
|
|
99
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
100
|
+
import isEmpty from "lodash/isEmpty.js";
|
|
101
|
+
import { useCallback, useMemo, useState } from "react";
|
|
102
|
+
import { Modal, ModalContent, ModalOverlay, useDisclosure } from "../chakra.js";
|
|
103
|
+
import { isReactNode } from "../utils/react.js";
|
|
104
|
+
import MinimalModalContent from "./components/MinimalModalContent.js";
|
|
105
|
+
import StandardModalContent from "./components/StandardModalContent.js";
|
|
106
|
+
import { ModalContext } from "./context.js";
|
|
107
|
+
var getModalComponent = function(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
|
+
}
|
|
124
|
+
case "custom":
|
|
125
|
+
return isReactNode(modalContentConfig.content) ? modalContentConfig.content : /*#__PURE__*/ _jsx(modalContentConfig.content, _object_spread({
|
|
126
|
+
open: open,
|
|
127
|
+
close: close
|
|
128
|
+
}, otherProps));
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var isModalOpenOptions = function(options) {
|
|
132
|
+
return (options === null || options === void 0 ? void 0 : options.modalContentConfig) !== undefined;
|
|
133
|
+
};
|
|
134
|
+
var ModalProvider = function(param) {
|
|
135
|
+
var children = param.children;
|
|
136
|
+
var _useDisclosure = useDisclosure(), isOpen = _useDisclosure.isOpen, onCloseRaw = _useDisclosure.onClose, onOpenRaw = _useDisclosure.onOpen;
|
|
137
|
+
var _useState = _sliced_to_array(useState(), 2), modalContentConfig = _useState[0], setModalContentConfig = _useState[1];
|
|
138
|
+
var _useState1 = _sliced_to_array(useState(), 2), modalOptions = _useState1[0], setModalOptions = _useState1[1];
|
|
139
|
+
var _useState2 = _sliced_to_array(useState(), 2), modalState = _useState2[0], setModalState = _useState2[1];
|
|
140
|
+
var onClose = useCallback(function(options) {
|
|
141
|
+
onCloseRaw();
|
|
142
|
+
if (modalOptions === null || modalOptions === void 0 ? void 0 : modalOptions.onClose) {
|
|
143
|
+
modalOptions.onClose();
|
|
144
|
+
}
|
|
145
|
+
if (!(options === null || options === void 0 ? void 0 : options.keepModalContentConfig)) {
|
|
146
|
+
setModalContentConfig(undefined);
|
|
147
|
+
setModalOptions(undefined);
|
|
148
|
+
setModalState(undefined);
|
|
149
|
+
}
|
|
150
|
+
}, [
|
|
151
|
+
modalOptions
|
|
152
|
+
]);
|
|
153
|
+
var onOpen = useCallback(function(modalContentConfigOrOptions) {
|
|
154
|
+
var newModalContentConfig;
|
|
155
|
+
var newModalSate;
|
|
156
|
+
var newModalOptions;
|
|
157
|
+
// Here, we know we're passing the global options object
|
|
158
|
+
if (isModalOpenOptions(modalContentConfigOrOptions)) {
|
|
159
|
+
newModalContentConfig = modalContentConfigOrOptions.modalContentConfig;
|
|
160
|
+
newModalSate = modalContentConfigOrOptions.modalContentConfig.initialModalState;
|
|
161
|
+
newModalOptions = modalContentConfigOrOptions;
|
|
162
|
+
} else if (modalContentConfigOrOptions) {
|
|
163
|
+
newModalContentConfig = modalContentConfigOrOptions;
|
|
164
|
+
newModalSate = undefined;
|
|
165
|
+
newModalOptions = undefined;
|
|
166
|
+
}
|
|
167
|
+
setModalContentConfig(function(oldModalContentConfig) {
|
|
168
|
+
var modalContentConfig = newModalContentConfig || oldModalContentConfig;
|
|
169
|
+
if (modalContentConfig) {
|
|
170
|
+
onOpenRaw();
|
|
171
|
+
}
|
|
172
|
+
return modalContentConfig;
|
|
173
|
+
});
|
|
174
|
+
setModalState(newModalSate);
|
|
175
|
+
setModalOptions(newModalOptions);
|
|
176
|
+
}, []);
|
|
177
|
+
var update = useCallback(function(updateOptions) {
|
|
178
|
+
if (!updateOptions || isEmpty(updateOptions)) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
setModalContentConfig(function(oldModalContentConfig) {
|
|
182
|
+
if (!oldModalContentConfig) {
|
|
183
|
+
return oldModalContentConfig;
|
|
184
|
+
}
|
|
185
|
+
return _object_spread_props(_object_spread({}, oldModalContentConfig, updateOptions.modalContentConfig), {
|
|
186
|
+
contentProps: _object_spread({}, updateOptions.contentProps, oldModalContentConfig.contentProps)
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
}, []);
|
|
190
|
+
var state = useMemo(function() {
|
|
191
|
+
return {
|
|
192
|
+
isOpen: isOpen,
|
|
193
|
+
// @ts-expect-error
|
|
194
|
+
open: onOpen,
|
|
195
|
+
close: onClose,
|
|
196
|
+
update: update,
|
|
197
|
+
modalState: modalState,
|
|
198
|
+
setModalState: setModalState
|
|
199
|
+
};
|
|
200
|
+
}, [
|
|
201
|
+
onOpen,
|
|
202
|
+
onClose,
|
|
203
|
+
update,
|
|
204
|
+
modalState,
|
|
205
|
+
setModalState,
|
|
206
|
+
isOpen
|
|
207
|
+
]);
|
|
208
|
+
var content = useMemo(function() {
|
|
209
|
+
return modalContentConfig && getModalComponent(modalContentConfig, state);
|
|
210
|
+
}, [
|
|
211
|
+
modalContentConfig
|
|
212
|
+
]);
|
|
213
|
+
return /*#__PURE__*/ _jsxs(ModalContext.Provider, {
|
|
214
|
+
value: state,
|
|
215
|
+
children: [
|
|
216
|
+
children,
|
|
217
|
+
/*#__PURE__*/ _jsxs(Modal, {
|
|
218
|
+
scrollBehavior: "inside",
|
|
219
|
+
isCentered: true,
|
|
220
|
+
blockScrollOnMount: true,
|
|
221
|
+
closeOnOverlayClick: true,
|
|
222
|
+
size: (modalContentConfig === null || modalContentConfig === void 0 ? void 0 : modalContentConfig.size) || {
|
|
223
|
+
base: "full",
|
|
224
|
+
md: "3xl"
|
|
225
|
+
},
|
|
226
|
+
isOpen: isOpen,
|
|
227
|
+
onClose: onClose,
|
|
228
|
+
children: [
|
|
229
|
+
/*#__PURE__*/ _jsx(ModalOverlay, {}),
|
|
230
|
+
/*#__PURE__*/ _jsx(ModalContent, {
|
|
231
|
+
borderRadius: 0,
|
|
232
|
+
children: content
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
})
|
|
236
|
+
]
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
export default ModalProvider;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { type StackProps } from '../../chakra.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
isCloseHidden?: boolean;
|
|
6
|
+
} & StackProps;
|
|
7
|
+
declare const EnhancedModalCustomWrapper: FC<PropsWithChildren<Props>>;
|
|
8
|
+
export default EnhancedModalCustomWrapper;
|
|
9
|
+
//# sourceMappingURL=EnhancedModalCustomWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnhancedModalCustomWrapper.d.ts","sourceRoot":"","sources":["../../../src/modal/components/EnhancedModalCustomWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,EAAkC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGjF,KAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,GAAG,UAAU,CAAA;AAEd,QAAA,MAAM,0BAA0B,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,CA0B5D,CAAA;AAED,eAAe,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
function _object_without_properties(source, excluded) {
|
|
54
|
+
if (source == null) return {};
|
|
55
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
56
|
+
var key, i;
|
|
57
|
+
if (Object.getOwnPropertySymbols) {
|
|
58
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
59
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
60
|
+
key = sourceSymbolKeys[i];
|
|
61
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
62
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
63
|
+
target[key] = source[key];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return target;
|
|
67
|
+
}
|
|
68
|
+
function _object_without_properties_loose(source, excluded) {
|
|
69
|
+
if (source == null) return {};
|
|
70
|
+
var target = {};
|
|
71
|
+
var sourceKeys = Object.keys(source);
|
|
72
|
+
var key, i;
|
|
73
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
74
|
+
key = sourceKeys[i];
|
|
75
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
76
|
+
target[key] = source[key];
|
|
77
|
+
}
|
|
78
|
+
return target;
|
|
79
|
+
}
|
|
80
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
81
|
+
import IconClose from "@driveflux/icons/icons/IconClose";
|
|
82
|
+
import { Button, HStack, Heading, Stack } from "../../chakra.js";
|
|
83
|
+
import { useEnhancedModal } from "../use-enhanced-modal.js";
|
|
84
|
+
var EnhancedModalCustomWrapper = function(_param) {
|
|
85
|
+
var title = _param.title, children = _param.children, isCloseHidden = _param.isCloseHidden, props = _object_without_properties(_param, [
|
|
86
|
+
"title",
|
|
87
|
+
"children",
|
|
88
|
+
"isCloseHidden"
|
|
89
|
+
]);
|
|
90
|
+
var close = useEnhancedModal().close;
|
|
91
|
+
return /*#__PURE__*/ _jsxs(Stack, _object_spread_props(_object_spread({
|
|
92
|
+
overflowY: "scroll",
|
|
93
|
+
px: "32px",
|
|
94
|
+
py: "24px",
|
|
95
|
+
spacing: "18px"
|
|
96
|
+
}, props), {
|
|
97
|
+
children: [
|
|
98
|
+
/*#__PURE__*/ _jsxs(HStack, {
|
|
99
|
+
justifyContent: "space-between",
|
|
100
|
+
children: [
|
|
101
|
+
/*#__PURE__*/ _jsx(Heading, {
|
|
102
|
+
fontSize: "18px",
|
|
103
|
+
textTransform: "uppercase",
|
|
104
|
+
children: title
|
|
105
|
+
}),
|
|
106
|
+
!isCloseHidden && /*#__PURE__*/ _jsx(Button, {
|
|
107
|
+
p: 0,
|
|
108
|
+
variant: "unstyled",
|
|
109
|
+
border: 0,
|
|
110
|
+
w: "fit-content",
|
|
111
|
+
onClick: function() {
|
|
112
|
+
close();
|
|
113
|
+
},
|
|
114
|
+
children: /*#__PURE__*/ _jsx(IconClose, {
|
|
115
|
+
size: "28px"
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
}),
|
|
120
|
+
children
|
|
121
|
+
]
|
|
122
|
+
}));
|
|
123
|
+
};
|
|
124
|
+
export default EnhancedModalCustomWrapper;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps, StackProps } from '../../chakra.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
sticky?: boolean;
|
|
5
|
+
cancelProps?: ButtonProps;
|
|
6
|
+
okProps?: ButtonProps;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
suffix?: ReactNode;
|
|
9
|
+
} & StackProps;
|
|
10
|
+
declare const EnhancedModalFooter: FC<Props>;
|
|
11
|
+
export default EnhancedModalFooter;
|
|
12
|
+
//# sourceMappingURL=EnhancedModalFooter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnhancedModalFooter.d.ts","sourceRoot":"","sources":["../../../src/modal/components/EnhancedModalFooter.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAU,WAAW,EAAS,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIxE,KAAK,KAAK,GAAG;IACX,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB,GAAG,UAAU,CAAA;AAEd,QAAA,MAAM,mBAAmB,EAAE,EAAE,CAAC,KAAK,CAkClC,CAAA;AAED,eAAe,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
function _object_without_properties(source, excluded) {
|
|
54
|
+
if (source == null) return {};
|
|
55
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
56
|
+
var key, i;
|
|
57
|
+
if (Object.getOwnPropertySymbols) {
|
|
58
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
59
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
60
|
+
key = sourceSymbolKeys[i];
|
|
61
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
62
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
63
|
+
target[key] = source[key];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return target;
|
|
67
|
+
}
|
|
68
|
+
function _object_without_properties_loose(source, excluded) {
|
|
69
|
+
if (source == null) return {};
|
|
70
|
+
var target = {};
|
|
71
|
+
var sourceKeys = Object.keys(source);
|
|
72
|
+
var key, i;
|
|
73
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
74
|
+
key = sourceKeys[i];
|
|
75
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
76
|
+
target[key] = source[key];
|
|
77
|
+
}
|
|
78
|
+
return target;
|
|
79
|
+
}
|
|
80
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
81
|
+
import { Trans } from "@lingui/macro";
|
|
82
|
+
import { Button, Stack } from "../../chakra.js";
|
|
83
|
+
import { colors } from "../../theme/colors.js";
|
|
84
|
+
import { useEnhancedModal } from "../use-enhanced-modal.js";
|
|
85
|
+
var EnhancedModalFooter = function(_param) {
|
|
86
|
+
var sticky = _param.sticky, cancelProps = _param.cancelProps, okProps = _param.okProps, children = _param.children, suffix = _param.suffix, props = _object_without_properties(_param, [
|
|
87
|
+
"sticky",
|
|
88
|
+
"cancelProps",
|
|
89
|
+
"okProps",
|
|
90
|
+
"children",
|
|
91
|
+
"suffix"
|
|
92
|
+
]);
|
|
93
|
+
var close = useEnhancedModal().close;
|
|
94
|
+
return /*#__PURE__*/ _jsxs(Stack, _object_spread_props(_object_spread({
|
|
95
|
+
pos: {
|
|
96
|
+
base: "absolute",
|
|
97
|
+
md: sticky ? "absolute" : "static"
|
|
98
|
+
},
|
|
99
|
+
bottom: 0,
|
|
100
|
+
left: 0,
|
|
101
|
+
right: 0,
|
|
102
|
+
py: "32px",
|
|
103
|
+
px: {
|
|
104
|
+
base: "32px",
|
|
105
|
+
md: sticky ? "32px" : "0"
|
|
106
|
+
},
|
|
107
|
+
borderTop: sticky ? "1px solid ".concat(colors.primary2) : "",
|
|
108
|
+
background: colors.white,
|
|
109
|
+
spacing: "24px",
|
|
110
|
+
zIndex: "sticky"
|
|
111
|
+
}, props), {
|
|
112
|
+
children: [
|
|
113
|
+
children ? /*#__PURE__*/ _jsx(Stack, {
|
|
114
|
+
direction: {
|
|
115
|
+
base: "column-reverse",
|
|
116
|
+
md: "row"
|
|
117
|
+
},
|
|
118
|
+
spacing: "24px",
|
|
119
|
+
children: children
|
|
120
|
+
}) : /*#__PURE__*/ _jsxs(Stack, {
|
|
121
|
+
direction: {
|
|
122
|
+
base: "column-reverse",
|
|
123
|
+
md: "row"
|
|
124
|
+
},
|
|
125
|
+
spacing: "24px",
|
|
126
|
+
children: [
|
|
127
|
+
/*#__PURE__*/ _jsx(Button, _object_spread_props(_object_spread({
|
|
128
|
+
w: "full",
|
|
129
|
+
variant: "outline",
|
|
130
|
+
onClick: function() {
|
|
131
|
+
return close();
|
|
132
|
+
}
|
|
133
|
+
}, cancelProps), {
|
|
134
|
+
fontSize: "10px",
|
|
135
|
+
fontWeight: "bold",
|
|
136
|
+
letterSpacing: "3px",
|
|
137
|
+
children: (cancelProps === null || cancelProps === void 0 ? void 0 : cancelProps.children) ? cancelProps.children : /*#__PURE__*/ _jsx(Trans, {
|
|
138
|
+
children: "Cancel"
|
|
139
|
+
})
|
|
140
|
+
})),
|
|
141
|
+
/*#__PURE__*/ _jsx(Button, _object_spread_props(_object_spread({
|
|
142
|
+
w: "full"
|
|
143
|
+
}, okProps), {
|
|
144
|
+
fontSize: "10px",
|
|
145
|
+
fontWeight: "bold",
|
|
146
|
+
letterSpacing: "3px",
|
|
147
|
+
children: (okProps === null || okProps === void 0 ? void 0 : okProps.children) ? okProps.children : /*#__PURE__*/ _jsx(Trans, {
|
|
148
|
+
children: "Confirm"
|
|
149
|
+
})
|
|
150
|
+
}))
|
|
151
|
+
]
|
|
152
|
+
}),
|
|
153
|
+
suffix
|
|
154
|
+
]
|
|
155
|
+
}));
|
|
156
|
+
};
|
|
157
|
+
export default EnhancedModalFooter;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import type { ModalContentConfig, ModalControlProps } from '../context.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
controls: ModalControlProps;
|
|
5
|
+
modalContentConfig: Extract<ModalContentConfig, {
|
|
6
|
+
type: 'minimal';
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
declare const MinimalModalContent: FC<Props>;
|
|
10
|
+
export default MinimalModalContent;
|
|
11
|
+
//# sourceMappingURL=MinimalModalContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MinimalModalContent.d.ts","sourceRoot":"","sources":["../../../src/modal/components/MinimalModalContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAE1E,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,EAAE;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC,CAAA;CACrE,CAAA;AAED,QAAA,MAAM,mBAAmB,EAAE,EAAE,CAAC,KAAK,CAWlC,CAAA;AAED,eAAe,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function _object_without_properties(source, excluded) {
|
|
30
|
+
if (source == null) return {};
|
|
31
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
32
|
+
var key, i;
|
|
33
|
+
if (Object.getOwnPropertySymbols) {
|
|
34
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
35
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
36
|
+
key = sourceSymbolKeys[i];
|
|
37
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
38
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
39
|
+
target[key] = source[key];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return target;
|
|
43
|
+
}
|
|
44
|
+
function _object_without_properties_loose(source, excluded) {
|
|
45
|
+
if (source == null) return {};
|
|
46
|
+
var target = {};
|
|
47
|
+
var sourceKeys = Object.keys(source);
|
|
48
|
+
var key, i;
|
|
49
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
50
|
+
key = sourceKeys[i];
|
|
51
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
52
|
+
target[key] = source[key];
|
|
53
|
+
}
|
|
54
|
+
return target;
|
|
55
|
+
}
|
|
56
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
57
|
+
import { Fragment } from "react";
|
|
58
|
+
import { Box, ModalBody, ModalCloseButton, ModalHeader } from "../../chakra.js";
|
|
59
|
+
import { isReactNode } from "../../utils/react.js";
|
|
60
|
+
var MinimalModalContent = function(_param) {
|
|
61
|
+
var _param_controls = _param.controls, open = _param_controls.open, close = _param_controls.close, modalContentConfig = _param.modalContentConfig, props = _object_without_properties(_param, [
|
|
62
|
+
"controls",
|
|
63
|
+
"modalContentConfig"
|
|
64
|
+
]);
|
|
65
|
+
var Content = modalContentConfig.content;
|
|
66
|
+
var Wrapper = modalContentConfig.noModalBody ? Fragment : ModalBody;
|
|
67
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
68
|
+
children: [
|
|
69
|
+
modalContentConfig.title ? /*#__PURE__*/ _jsx(ModalHeader, {
|
|
70
|
+
children: modalContentConfig.title
|
|
71
|
+
}) : /*#__PURE__*/ _jsx(Box, {
|
|
72
|
+
h: "32px"
|
|
73
|
+
}),
|
|
74
|
+
/*#__PURE__*/ _jsx(ModalCloseButton, {}),
|
|
75
|
+
/*#__PURE__*/ _jsx(Wrapper, {
|
|
76
|
+
children: isReactNode(Content) ? Content : /*#__PURE__*/ _jsx(Content, _object_spread({
|
|
77
|
+
close: close,
|
|
78
|
+
open: open
|
|
79
|
+
}, props))
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
export default MinimalModalContent;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import type { ModalContentConfig, ModalControlProps } from '../context.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
controls: ModalControlProps;
|
|
5
|
+
modalContentConfig: Extract<ModalContentConfig, {
|
|
6
|
+
type: 'standard';
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
declare const StandardModalContent: FC<Props>;
|
|
10
|
+
export default StandardModalContent;
|
|
11
|
+
//# sourceMappingURL=StandardModalContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StandardModalContent.d.ts","sourceRoot":"","sources":["../../../src/modal/components/StandardModalContent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAA;AAUtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAG1E,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,EAAE;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAA;CACtE,CAAA;AAED,QAAA,MAAM,oBAAoB,EAAE,EAAE,CAAC,KAAK,CA2CnC,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|