@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
package/.eslintrc.json
ADDED
package/.swcrc
ADDED
package/CHANGELOG.md
ADDED
package/dist/chakra.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chakra.d.ts","sourceRoot":"","sources":["../src/chakra.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/dist/chakra.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@chakra-ui/react";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("@chakra-ui/react"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./chakra.js"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
var _isEmpty = /*#__PURE__*/ _interop_require_default(require("lodash/isEmpty.js"));
|
|
13
|
+
var _react = require("react");
|
|
14
|
+
var _chakra = require("../chakra.js");
|
|
15
|
+
var _react1 = require("../utils/react.js");
|
|
16
|
+
var _MinimalModalContent = /*#__PURE__*/ _interop_require_default(require("./components/MinimalModalContent.js"));
|
|
17
|
+
var _StandardModalContent = /*#__PURE__*/ _interop_require_default(require("./components/StandardModalContent.js"));
|
|
18
|
+
var _context = require("./context.js");
|
|
19
|
+
function _array_like_to_array(arr, len) {
|
|
20
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
21
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
22
|
+
return arr2;
|
|
23
|
+
}
|
|
24
|
+
function _array_with_holes(arr) {
|
|
25
|
+
if (Array.isArray(arr)) return arr;
|
|
26
|
+
}
|
|
27
|
+
function _define_property(obj, key, value) {
|
|
28
|
+
if (key in obj) {
|
|
29
|
+
Object.defineProperty(obj, key, {
|
|
30
|
+
value: value,
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
obj[key] = value;
|
|
37
|
+
}
|
|
38
|
+
return obj;
|
|
39
|
+
}
|
|
40
|
+
function _interop_require_default(obj) {
|
|
41
|
+
return obj && obj.__esModule ? obj : {
|
|
42
|
+
default: obj
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function _iterable_to_array_limit(arr, i) {
|
|
46
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
47
|
+
if (_i == null) return;
|
|
48
|
+
var _arr = [];
|
|
49
|
+
var _n = true;
|
|
50
|
+
var _d = false;
|
|
51
|
+
var _s, _e;
|
|
52
|
+
try {
|
|
53
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
54
|
+
_arr.push(_s.value);
|
|
55
|
+
if (i && _arr.length === i) break;
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
_d = true;
|
|
59
|
+
_e = err;
|
|
60
|
+
} finally{
|
|
61
|
+
try {
|
|
62
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
63
|
+
} finally{
|
|
64
|
+
if (_d) throw _e;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return _arr;
|
|
68
|
+
}
|
|
69
|
+
function _non_iterable_rest() {
|
|
70
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
|
+
}
|
|
72
|
+
function _object_spread(target) {
|
|
73
|
+
for(var i = 1; i < arguments.length; i++){
|
|
74
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
75
|
+
var ownKeys = Object.keys(source);
|
|
76
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
77
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
78
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
ownKeys.forEach(function(key) {
|
|
82
|
+
_define_property(target, key, source[key]);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return target;
|
|
86
|
+
}
|
|
87
|
+
function ownKeys(object, enumerableOnly) {
|
|
88
|
+
var keys = Object.keys(object);
|
|
89
|
+
if (Object.getOwnPropertySymbols) {
|
|
90
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
91
|
+
if (enumerableOnly) {
|
|
92
|
+
symbols = symbols.filter(function(sym) {
|
|
93
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
keys.push.apply(keys, symbols);
|
|
97
|
+
}
|
|
98
|
+
return keys;
|
|
99
|
+
}
|
|
100
|
+
function _object_spread_props(target, source) {
|
|
101
|
+
source = source != null ? source : {};
|
|
102
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
103
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
104
|
+
} else {
|
|
105
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
106
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return target;
|
|
110
|
+
}
|
|
111
|
+
function _sliced_to_array(arr, i) {
|
|
112
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
113
|
+
}
|
|
114
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
115
|
+
if (!o) return;
|
|
116
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
117
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
118
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
119
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
120
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
121
|
+
}
|
|
122
|
+
var getModalComponent = function(modalContentConfig, controls) {
|
|
123
|
+
var otherProps = modalContentConfig.contentProps || {};
|
|
124
|
+
switch(modalContentConfig.type){
|
|
125
|
+
case "standard":
|
|
126
|
+
{
|
|
127
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_StandardModalContent.default, _object_spread({
|
|
128
|
+
controls: controls,
|
|
129
|
+
modalContentConfig: modalContentConfig
|
|
130
|
+
}, otherProps));
|
|
131
|
+
}
|
|
132
|
+
case "minimal":
|
|
133
|
+
{
|
|
134
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_MinimalModalContent.default, _object_spread({
|
|
135
|
+
controls: controls,
|
|
136
|
+
modalContentConfig: modalContentConfig
|
|
137
|
+
}, otherProps));
|
|
138
|
+
}
|
|
139
|
+
case "custom":
|
|
140
|
+
return (0, _react1.isReactNode)(modalContentConfig.content) ? modalContentConfig.content : /*#__PURE__*/ (0, _jsxruntime.jsx)(modalContentConfig.content, _object_spread({
|
|
141
|
+
open: open,
|
|
142
|
+
close: close
|
|
143
|
+
}, otherProps));
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
var isModalOpenOptions = function(options) {
|
|
147
|
+
return (options === null || options === void 0 ? void 0 : options.modalContentConfig) !== undefined;
|
|
148
|
+
};
|
|
149
|
+
var ModalProvider = function(param) {
|
|
150
|
+
var children = param.children;
|
|
151
|
+
var _useDisclosure = (0, _chakra.useDisclosure)(), isOpen = _useDisclosure.isOpen, onCloseRaw = _useDisclosure.onClose, onOpenRaw = _useDisclosure.onOpen;
|
|
152
|
+
var _useState = _sliced_to_array((0, _react.useState)(), 2), modalContentConfig = _useState[0], setModalContentConfig = _useState[1];
|
|
153
|
+
var _useState1 = _sliced_to_array((0, _react.useState)(), 2), modalOptions = _useState1[0], setModalOptions = _useState1[1];
|
|
154
|
+
var _useState2 = _sliced_to_array((0, _react.useState)(), 2), modalState = _useState2[0], setModalState = _useState2[1];
|
|
155
|
+
var onClose = (0, _react.useCallback)(function(options) {
|
|
156
|
+
onCloseRaw();
|
|
157
|
+
if (modalOptions === null || modalOptions === void 0 ? void 0 : modalOptions.onClose) {
|
|
158
|
+
modalOptions.onClose();
|
|
159
|
+
}
|
|
160
|
+
if (!(options === null || options === void 0 ? void 0 : options.keepModalContentConfig)) {
|
|
161
|
+
setModalContentConfig(undefined);
|
|
162
|
+
setModalOptions(undefined);
|
|
163
|
+
setModalState(undefined);
|
|
164
|
+
}
|
|
165
|
+
}, [
|
|
166
|
+
modalOptions
|
|
167
|
+
]);
|
|
168
|
+
var onOpen = (0, _react.useCallback)(function(modalContentConfigOrOptions) {
|
|
169
|
+
var newModalContentConfig;
|
|
170
|
+
var newModalSate;
|
|
171
|
+
var newModalOptions;
|
|
172
|
+
// Here, we know we're passing the global options object
|
|
173
|
+
if (isModalOpenOptions(modalContentConfigOrOptions)) {
|
|
174
|
+
newModalContentConfig = modalContentConfigOrOptions.modalContentConfig;
|
|
175
|
+
newModalSate = modalContentConfigOrOptions.modalContentConfig.initialModalState;
|
|
176
|
+
newModalOptions = modalContentConfigOrOptions;
|
|
177
|
+
} else if (modalContentConfigOrOptions) {
|
|
178
|
+
newModalContentConfig = modalContentConfigOrOptions;
|
|
179
|
+
newModalSate = undefined;
|
|
180
|
+
newModalOptions = undefined;
|
|
181
|
+
}
|
|
182
|
+
setModalContentConfig(function(oldModalContentConfig) {
|
|
183
|
+
var modalContentConfig = newModalContentConfig || oldModalContentConfig;
|
|
184
|
+
if (modalContentConfig) {
|
|
185
|
+
onOpenRaw();
|
|
186
|
+
}
|
|
187
|
+
return modalContentConfig;
|
|
188
|
+
});
|
|
189
|
+
setModalState(newModalSate);
|
|
190
|
+
setModalOptions(newModalOptions);
|
|
191
|
+
}, []);
|
|
192
|
+
var update = (0, _react.useCallback)(function(updateOptions) {
|
|
193
|
+
if (!updateOptions || (0, _isEmpty.default)(updateOptions)) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
setModalContentConfig(function(oldModalContentConfig) {
|
|
197
|
+
if (!oldModalContentConfig) {
|
|
198
|
+
return oldModalContentConfig;
|
|
199
|
+
}
|
|
200
|
+
return _object_spread_props(_object_spread({}, oldModalContentConfig, updateOptions.modalContentConfig), {
|
|
201
|
+
contentProps: _object_spread({}, updateOptions.contentProps, oldModalContentConfig.contentProps)
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
}, []);
|
|
205
|
+
var state = (0, _react.useMemo)(function() {
|
|
206
|
+
return {
|
|
207
|
+
isOpen: isOpen,
|
|
208
|
+
// @ts-expect-error
|
|
209
|
+
open: onOpen,
|
|
210
|
+
close: onClose,
|
|
211
|
+
update: update,
|
|
212
|
+
modalState: modalState,
|
|
213
|
+
setModalState: setModalState
|
|
214
|
+
};
|
|
215
|
+
}, [
|
|
216
|
+
onOpen,
|
|
217
|
+
onClose,
|
|
218
|
+
update,
|
|
219
|
+
modalState,
|
|
220
|
+
setModalState,
|
|
221
|
+
isOpen
|
|
222
|
+
]);
|
|
223
|
+
var content = (0, _react.useMemo)(function() {
|
|
224
|
+
return modalContentConfig && getModalComponent(modalContentConfig, state);
|
|
225
|
+
}, [
|
|
226
|
+
modalContentConfig
|
|
227
|
+
]);
|
|
228
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_context.ModalContext.Provider, {
|
|
229
|
+
value: state,
|
|
230
|
+
children: [
|
|
231
|
+
children,
|
|
232
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_chakra.Modal, {
|
|
233
|
+
scrollBehavior: "inside",
|
|
234
|
+
isCentered: true,
|
|
235
|
+
blockScrollOnMount: true,
|
|
236
|
+
closeOnOverlayClick: true,
|
|
237
|
+
size: (modalContentConfig === null || modalContentConfig === void 0 ? void 0 : modalContentConfig.size) || {
|
|
238
|
+
base: "full",
|
|
239
|
+
md: "3xl"
|
|
240
|
+
},
|
|
241
|
+
isOpen: isOpen,
|
|
242
|
+
onClose: onClose,
|
|
243
|
+
children: [
|
|
244
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.ModalOverlay, {}),
|
|
245
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.ModalContent, {
|
|
246
|
+
borderRadius: 0,
|
|
247
|
+
children: content
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
})
|
|
251
|
+
]
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
var _default = ModalProvider;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
var _IconClose = /*#__PURE__*/ _interop_require_default(require("@driveflux/icons/icons/IconClose"));
|
|
13
|
+
var _chakra = require("../../chakra.js");
|
|
14
|
+
var _useenhancedmodal = require("../use-enhanced-modal.js");
|
|
15
|
+
function _define_property(obj, key, value) {
|
|
16
|
+
if (key in obj) {
|
|
17
|
+
Object.defineProperty(obj, key, {
|
|
18
|
+
value: value,
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
obj[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
function _interop_require_default(obj) {
|
|
29
|
+
return obj && obj.__esModule ? obj : {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function _object_spread(target) {
|
|
34
|
+
for(var i = 1; i < arguments.length; i++){
|
|
35
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
36
|
+
var ownKeys = Object.keys(source);
|
|
37
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
38
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
39
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
ownKeys.forEach(function(key) {
|
|
43
|
+
_define_property(target, key, source[key]);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return target;
|
|
47
|
+
}
|
|
48
|
+
function ownKeys(object, enumerableOnly) {
|
|
49
|
+
var keys = Object.keys(object);
|
|
50
|
+
if (Object.getOwnPropertySymbols) {
|
|
51
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
52
|
+
if (enumerableOnly) {
|
|
53
|
+
symbols = symbols.filter(function(sym) {
|
|
54
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
keys.push.apply(keys, symbols);
|
|
58
|
+
}
|
|
59
|
+
return keys;
|
|
60
|
+
}
|
|
61
|
+
function _object_spread_props(target, source) {
|
|
62
|
+
source = source != null ? source : {};
|
|
63
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
64
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
65
|
+
} else {
|
|
66
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
67
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return target;
|
|
71
|
+
}
|
|
72
|
+
function _object_without_properties(source, excluded) {
|
|
73
|
+
if (source == null) return {};
|
|
74
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
75
|
+
var key, i;
|
|
76
|
+
if (Object.getOwnPropertySymbols) {
|
|
77
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
78
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
79
|
+
key = sourceSymbolKeys[i];
|
|
80
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
81
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
82
|
+
target[key] = source[key];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return target;
|
|
86
|
+
}
|
|
87
|
+
function _object_without_properties_loose(source, excluded) {
|
|
88
|
+
if (source == null) return {};
|
|
89
|
+
var target = {};
|
|
90
|
+
var sourceKeys = Object.keys(source);
|
|
91
|
+
var key, i;
|
|
92
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
93
|
+
key = sourceKeys[i];
|
|
94
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
95
|
+
target[key] = source[key];
|
|
96
|
+
}
|
|
97
|
+
return target;
|
|
98
|
+
}
|
|
99
|
+
var EnhancedModalCustomWrapper = function(_param) {
|
|
100
|
+
var title = _param.title, children = _param.children, isCloseHidden = _param.isCloseHidden, props = _object_without_properties(_param, [
|
|
101
|
+
"title",
|
|
102
|
+
"children",
|
|
103
|
+
"isCloseHidden"
|
|
104
|
+
]);
|
|
105
|
+
var close = (0, _useenhancedmodal.useEnhancedModal)().close;
|
|
106
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_chakra.Stack, _object_spread_props(_object_spread({
|
|
107
|
+
overflowY: "scroll",
|
|
108
|
+
px: "32px",
|
|
109
|
+
py: "24px",
|
|
110
|
+
spacing: "18px"
|
|
111
|
+
}, props), {
|
|
112
|
+
children: [
|
|
113
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_chakra.HStack, {
|
|
114
|
+
justifyContent: "space-between",
|
|
115
|
+
children: [
|
|
116
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Heading, {
|
|
117
|
+
fontSize: "18px",
|
|
118
|
+
textTransform: "uppercase",
|
|
119
|
+
children: title
|
|
120
|
+
}),
|
|
121
|
+
!isCloseHidden && /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Button, {
|
|
122
|
+
p: 0,
|
|
123
|
+
variant: "unstyled",
|
|
124
|
+
border: 0,
|
|
125
|
+
w: "fit-content",
|
|
126
|
+
onClick: function() {
|
|
127
|
+
close();
|
|
128
|
+
},
|
|
129
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_IconClose.default, {
|
|
130
|
+
size: "28px"
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
}),
|
|
135
|
+
children
|
|
136
|
+
]
|
|
137
|
+
}));
|
|
138
|
+
};
|
|
139
|
+
var _default = EnhancedModalCustomWrapper;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
var _macro = require("@lingui/macro");
|
|
13
|
+
var _chakra = require("../../chakra.js");
|
|
14
|
+
var _colors = require("../../theme/colors.js");
|
|
15
|
+
var _useenhancedmodal = require("../use-enhanced-modal.js");
|
|
16
|
+
function _define_property(obj, key, value) {
|
|
17
|
+
if (key in obj) {
|
|
18
|
+
Object.defineProperty(obj, key, {
|
|
19
|
+
value: value,
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
obj[key] = value;
|
|
26
|
+
}
|
|
27
|
+
return obj;
|
|
28
|
+
}
|
|
29
|
+
function _object_spread(target) {
|
|
30
|
+
for(var i = 1; i < arguments.length; i++){
|
|
31
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
32
|
+
var ownKeys = Object.keys(source);
|
|
33
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
34
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
ownKeys.forEach(function(key) {
|
|
39
|
+
_define_property(target, key, source[key]);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return target;
|
|
43
|
+
}
|
|
44
|
+
function ownKeys(object, enumerableOnly) {
|
|
45
|
+
var keys = Object.keys(object);
|
|
46
|
+
if (Object.getOwnPropertySymbols) {
|
|
47
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
48
|
+
if (enumerableOnly) {
|
|
49
|
+
symbols = symbols.filter(function(sym) {
|
|
50
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
keys.push.apply(keys, symbols);
|
|
54
|
+
}
|
|
55
|
+
return keys;
|
|
56
|
+
}
|
|
57
|
+
function _object_spread_props(target, source) {
|
|
58
|
+
source = source != null ? source : {};
|
|
59
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
60
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
61
|
+
} else {
|
|
62
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
63
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return target;
|
|
67
|
+
}
|
|
68
|
+
function _object_without_properties(source, excluded) {
|
|
69
|
+
if (source == null) return {};
|
|
70
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
71
|
+
var key, i;
|
|
72
|
+
if (Object.getOwnPropertySymbols) {
|
|
73
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
74
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
75
|
+
key = sourceSymbolKeys[i];
|
|
76
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
77
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
78
|
+
target[key] = source[key];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return target;
|
|
82
|
+
}
|
|
83
|
+
function _object_without_properties_loose(source, excluded) {
|
|
84
|
+
if (source == null) return {};
|
|
85
|
+
var target = {};
|
|
86
|
+
var sourceKeys = Object.keys(source);
|
|
87
|
+
var key, i;
|
|
88
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
89
|
+
key = sourceKeys[i];
|
|
90
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
91
|
+
target[key] = source[key];
|
|
92
|
+
}
|
|
93
|
+
return target;
|
|
94
|
+
}
|
|
95
|
+
var EnhancedModalFooter = function(_param) {
|
|
96
|
+
var sticky = _param.sticky, cancelProps = _param.cancelProps, okProps = _param.okProps, children = _param.children, suffix = _param.suffix, props = _object_without_properties(_param, [
|
|
97
|
+
"sticky",
|
|
98
|
+
"cancelProps",
|
|
99
|
+
"okProps",
|
|
100
|
+
"children",
|
|
101
|
+
"suffix"
|
|
102
|
+
]);
|
|
103
|
+
var close = (0, _useenhancedmodal.useEnhancedModal)().close;
|
|
104
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_chakra.Stack, _object_spread_props(_object_spread({
|
|
105
|
+
pos: {
|
|
106
|
+
base: "absolute",
|
|
107
|
+
md: sticky ? "absolute" : "static"
|
|
108
|
+
},
|
|
109
|
+
bottom: 0,
|
|
110
|
+
left: 0,
|
|
111
|
+
right: 0,
|
|
112
|
+
py: "32px",
|
|
113
|
+
px: {
|
|
114
|
+
base: "32px",
|
|
115
|
+
md: sticky ? "32px" : "0"
|
|
116
|
+
},
|
|
117
|
+
borderTop: sticky ? "1px solid ".concat(_colors.colors.primary2) : "",
|
|
118
|
+
background: _colors.colors.white,
|
|
119
|
+
spacing: "24px",
|
|
120
|
+
zIndex: "sticky"
|
|
121
|
+
}, props), {
|
|
122
|
+
children: [
|
|
123
|
+
children ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Stack, {
|
|
124
|
+
direction: {
|
|
125
|
+
base: "column-reverse",
|
|
126
|
+
md: "row"
|
|
127
|
+
},
|
|
128
|
+
spacing: "24px",
|
|
129
|
+
children: children
|
|
130
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsxs)(_chakra.Stack, {
|
|
131
|
+
direction: {
|
|
132
|
+
base: "column-reverse",
|
|
133
|
+
md: "row"
|
|
134
|
+
},
|
|
135
|
+
spacing: "24px",
|
|
136
|
+
children: [
|
|
137
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Button, _object_spread_props(_object_spread({
|
|
138
|
+
w: "full",
|
|
139
|
+
variant: "outline",
|
|
140
|
+
onClick: function() {
|
|
141
|
+
return close();
|
|
142
|
+
}
|
|
143
|
+
}, cancelProps), {
|
|
144
|
+
fontSize: "10px",
|
|
145
|
+
fontWeight: "bold",
|
|
146
|
+
letterSpacing: "3px",
|
|
147
|
+
children: (cancelProps === null || cancelProps === void 0 ? void 0 : cancelProps.children) ? cancelProps.children : /*#__PURE__*/ (0, _jsxruntime.jsx)(_macro.Trans, {
|
|
148
|
+
children: "Cancel"
|
|
149
|
+
})
|
|
150
|
+
})),
|
|
151
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Button, _object_spread_props(_object_spread({
|
|
152
|
+
w: "full"
|
|
153
|
+
}, okProps), {
|
|
154
|
+
fontSize: "10px",
|
|
155
|
+
fontWeight: "bold",
|
|
156
|
+
letterSpacing: "3px",
|
|
157
|
+
children: (okProps === null || okProps === void 0 ? void 0 : okProps.children) ? okProps.children : /*#__PURE__*/ (0, _jsxruntime.jsx)(_macro.Trans, {
|
|
158
|
+
children: "Confirm"
|
|
159
|
+
})
|
|
160
|
+
}))
|
|
161
|
+
]
|
|
162
|
+
}),
|
|
163
|
+
suffix
|
|
164
|
+
]
|
|
165
|
+
}));
|
|
166
|
+
};
|
|
167
|
+
var _default = EnhancedModalFooter;
|