@driveflux/ui 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,349 +1,32 @@
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 asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
10
- try {
11
- var info = gen[key](arg);
12
- var value = info.value;
13
- } catch (error) {
14
- reject(error);
15
- return;
16
- }
17
- if (info.done) {
18
- resolve(value);
19
- } else {
20
- Promise.resolve(value).then(_next, _throw);
21
- }
22
- }
23
- function _async_to_generator(fn) {
24
- return function() {
25
- var self = this, args = arguments;
26
- return new Promise(function(resolve, reject) {
27
- var gen = fn.apply(self, args);
28
- function _next(value) {
29
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
30
- }
31
- function _throw(err) {
32
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
33
- }
34
- _next(undefined);
35
- });
36
- };
37
- }
38
- function _define_property(obj, key, value) {
39
- if (key in obj) {
40
- Object.defineProperty(obj, key, {
41
- value: value,
42
- enumerable: true,
43
- configurable: true,
44
- writable: true
45
- });
46
- } else {
47
- obj[key] = value;
48
- }
49
- return obj;
50
- }
51
- function _iterable_to_array_limit(arr, i) {
52
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
53
- if (_i == null) return;
54
- var _arr = [];
55
- var _n = true;
56
- var _d = false;
57
- var _s, _e;
58
- try {
59
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
60
- _arr.push(_s.value);
61
- if (i && _arr.length === i) break;
62
- }
63
- } catch (err) {
64
- _d = true;
65
- _e = err;
66
- } finally{
67
- try {
68
- if (!_n && _i["return"] != null) _i["return"]();
69
- } finally{
70
- if (_d) throw _e;
71
- }
72
- }
73
- return _arr;
74
- }
75
- function _non_iterable_rest() {
76
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
77
- }
78
- function _object_spread(target) {
79
- for(var i = 1; i < arguments.length; i++){
80
- var source = arguments[i] != null ? arguments[i] : {};
81
- var ownKeys = Object.keys(source);
82
- if (typeof Object.getOwnPropertySymbols === "function") {
83
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
84
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
85
- }));
86
- }
87
- ownKeys.forEach(function(key) {
88
- _define_property(target, key, source[key]);
89
- });
90
- }
91
- return target;
92
- }
93
- function _object_without_properties(source, excluded) {
94
- if (source == null) return {};
95
- var target = _object_without_properties_loose(source, excluded);
96
- var key, i;
97
- if (Object.getOwnPropertySymbols) {
98
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
99
- for(i = 0; i < sourceSymbolKeys.length; i++){
100
- key = sourceSymbolKeys[i];
101
- if (excluded.indexOf(key) >= 0) continue;
102
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
103
- target[key] = source[key];
104
- }
105
- }
106
- return target;
107
- }
108
- function _object_without_properties_loose(source, excluded) {
109
- if (source == null) return {};
110
- var target = {};
111
- var sourceKeys = Object.keys(source);
112
- var key, i;
113
- for(i = 0; i < sourceKeys.length; i++){
114
- key = sourceKeys[i];
115
- if (excluded.indexOf(key) >= 0) continue;
116
- target[key] = source[key];
117
- }
118
- return target;
119
- }
120
- function _sliced_to_array(arr, i) {
121
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
122
- }
123
- function _unsupported_iterable_to_array(o, minLen) {
124
- if (!o) return;
125
- if (typeof o === "string") return _array_like_to_array(o, minLen);
126
- var n = Object.prototype.toString.call(o).slice(8, -1);
127
- if (n === "Object" && o.constructor) n = o.constructor.name;
128
- if (n === "Map" || n === "Set") return Array.from(n);
129
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
130
- }
131
- function _ts_generator(thisArg, body) {
132
- var f, y, t, _ = {
133
- label: 0,
134
- sent: function() {
135
- if (t[0] & 1) throw t[1];
136
- return t[1];
137
- },
138
- trys: [],
139
- ops: []
140
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
141
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
142
- return this;
143
- }), g;
144
- function verb(n) {
145
- return function(v) {
146
- return step([
147
- n,
148
- v
149
- ]);
150
- };
151
- }
152
- function step(op) {
153
- if (f) throw new TypeError("Generator is already executing.");
154
- while(g && (g = 0, op[0] && (_ = 0)), _)try {
155
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
156
- if (y = 0, t) op = [
157
- op[0] & 2,
158
- t.value
159
- ];
160
- switch(op[0]){
161
- case 0:
162
- case 1:
163
- t = op;
164
- break;
165
- case 4:
166
- _.label++;
167
- return {
168
- value: op[1],
169
- done: false
170
- };
171
- case 5:
172
- _.label++;
173
- y = op[1];
174
- op = [
175
- 0
176
- ];
177
- continue;
178
- case 7:
179
- op = _.ops.pop();
180
- _.trys.pop();
181
- continue;
182
- default:
183
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
184
- _ = 0;
185
- continue;
186
- }
187
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
188
- _.label = op[1];
189
- break;
190
- }
191
- if (op[0] === 6 && _.label < t[1]) {
192
- _.label = t[1];
193
- t = op;
194
- break;
195
- }
196
- if (t && _.label < t[2]) {
197
- _.label = t[2];
198
- _.ops.push(op);
199
- break;
200
- }
201
- if (t[2]) _.ops.pop();
202
- _.trys.pop();
203
- continue;
204
- }
205
- op = body.call(thisArg, _);
206
- } catch (e) {
207
- op = [
208
- 6,
209
- e
210
- ];
211
- y = 0;
212
- } finally{
213
- f = t = 0;
214
- }
215
- if (op[0] & 5) throw op[1];
216
- return {
217
- value: op[0] ? op[1] : void 0,
218
- done: true
219
- };
220
- }
221
- }
222
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
223
2
  import { useCallback, useState } from 'react';
224
- import { Button, HStack, ModalBody, ModalCloseButton, ModalFooter, ModalHeader } from '../../chakra.js';
3
+ import { Button, HStack, ModalBody, ModalCloseButton, ModalFooter, ModalHeader, } from '../../chakra.js';
225
4
  import { translations } from '../../translations.js';
226
5
  import { isReactNode } from '../../utils/react.js';
227
6
  import { useEnhancedModal } from '../use-enhanced-modal.js';
228
- var StandardModalContent = function(_param) {
229
- var _param_controls = _param.controls, open = _param_controls.open, close = _param_controls.close, modalContentConfig = _param.modalContentConfig, props = _object_without_properties(_param, [
230
- "controls",
231
- "modalContentConfig"
232
- ]);
233
- var Content = modalContentConfig.content;
234
- var _useState = _sliced_to_array(useState(false), 2), isSaving = _useState[0], setIsSaving = _useState[1];
235
- var modalState = useEnhancedModal().modalState;
236
- var handleOK = useCallback(function() {
237
- return _async_to_generator(function() {
238
- return _ts_generator(this, function(_state) {
239
- switch(_state.label){
240
- case 0:
241
- setIsSaving(true);
242
- if (!modalContentConfig.onOk) return [
243
- 3,
244
- 4
245
- ];
246
- _state.label = 1;
247
- case 1:
248
- _state.trys.push([
249
- 1,
250
- ,
251
- 3,
252
- 4
253
- ]);
254
- return [
255
- 4,
256
- modalContentConfig.onOk(modalState)
257
- ];
258
- case 2:
259
- _state.sent();
260
- return [
261
- 3,
262
- 4
263
- ];
264
- case 3:
265
- setIsSaving(false);
266
- return [
267
- 7
268
- ];
269
- case 4:
270
- close();
271
- return [
272
- 2
273
- ];
274
- }
275
- });
276
- })();
277
- }, [
278
- modalContentConfig.onOk,
279
- close,
280
- modalState
281
- ]);
282
- var handleCancel = useCallback(function() {
283
- return _async_to_generator(function() {
284
- return _ts_generator(this, function(_state) {
285
- switch(_state.label){
286
- case 0:
287
- if (!modalContentConfig.onCancel) return [
288
- 3,
289
- 2
290
- ];
291
- return [
292
- 4,
293
- modalContentConfig.onCancel()
294
- ];
295
- case 1:
296
- _state.sent();
297
- _state.label = 2;
298
- case 2:
299
- close();
300
- return [
301
- 2
302
- ];
303
- }
304
- });
305
- })();
306
- }, [
307
- modalContentConfig.onCancel,
308
- close
309
- ]);
310
- return /*#__PURE__*/ _jsxs(_Fragment, {
311
- children: [
312
- /*#__PURE__*/ _jsx(ModalHeader, {
313
- children: modalContentConfig.title
314
- }),
315
- /*#__PURE__*/ _jsx(ModalCloseButton, {}),
316
- /*#__PURE__*/ _jsx(ModalBody, {
317
- children: isReactNode(Content) ? Content : /*#__PURE__*/ _jsx(Content, _object_spread({
318
- open: open,
319
- close: close
320
- }, props))
321
- }),
322
- /*#__PURE__*/ _jsx(ModalFooter, {
323
- children: /*#__PURE__*/ _jsxs(HStack, {
324
- w: 'full',
325
- spacing: '6',
326
- children: [
327
- /*#__PURE__*/ _jsx(Button, {
328
- isDisabled: isSaving,
329
- w: 'full',
330
- variant: 'outline',
331
- onClick: handleCancel,
332
- children: modalContentConfig.cancelText || translations.close
333
- }),
334
- /*#__PURE__*/ _jsx(Button, {
335
- isDisabled: modalContentConfig.isOkDisabled,
336
- isLoading: isSaving || modalContentConfig.isOkLoading,
337
- w: 'full',
338
- variant: 'solid',
339
- onClick: handleOK,
340
- colorScheme: modalContentConfig.okColorScheme,
341
- children: modalContentConfig.okText || translations.ok
342
- })
343
- ]
344
- })
345
- })
346
- ]
347
- });
7
+ const StandardModalContent = ({ controls: { open, close }, modalContentConfig, ...props }) => {
8
+ const Content = modalContentConfig.content;
9
+ const [isSaving, setIsSaving] = useState(false);
10
+ const { modalState } = useEnhancedModal();
11
+ const handleOK = useCallback(async () => {
12
+ setIsSaving(true);
13
+ if (modalContentConfig.onOk) {
14
+ try {
15
+ await modalContentConfig.onOk(modalState);
16
+ }
17
+ finally {
18
+ setIsSaving(false);
19
+ }
20
+ }
21
+ close();
22
+ }, [modalContentConfig.onOk, close, modalState]);
23
+ const handleCancel = useCallback(async () => {
24
+ if (modalContentConfig.onCancel) {
25
+ await modalContentConfig.onCancel();
26
+ }
27
+ close();
28
+ }, [modalContentConfig.onCancel, close]);
29
+ return (_jsxs(_Fragment, { children: [_jsx(ModalHeader, { children: modalContentConfig.title }), _jsx(ModalCloseButton, {}), _jsx(ModalBody, { children: isReactNode(Content) ? (Content) : (_jsx(Content, { open: open, close: close, ...props })) }), _jsx(ModalFooter, { children: _jsxs(HStack, { w: 'full', spacing: '6', children: [_jsx(Button, { isDisabled: isSaving, w: 'full', variant: 'outline', onClick: handleCancel, children: modalContentConfig.cancelText || translations.close }), _jsx(Button, { isDisabled: modalContentConfig.isOkDisabled, isLoading: isSaving || modalContentConfig.isOkLoading, w: 'full', variant: 'solid', onClick: handleOK, colorScheme: modalContentConfig.okColorScheme, children: modalContentConfig.okText || translations.ok })] }) })] }));
348
30
  };
349
31
  export default StandardModalContent;
32
+ //# sourceMappingURL=StandardModalContent.js.map
@@ -1,10 +1,11 @@
1
- import { createContext } from 'react';
2
- var initialState = {
1
+ import { createContext, } from 'react';
2
+ const initialState = {
3
3
  isOpen: true,
4
- open: function() {},
5
- close: function() {},
6
- update: function() {},
4
+ open: () => { },
5
+ close: () => { },
6
+ update: () => { },
7
7
  modalState: undefined,
8
- setModalState: function() {}
8
+ setModalState: () => { },
9
9
  };
10
- export var ModalContext = /*#__PURE__*/ createContext(initialState);
10
+ export const ModalContext = createContext(initialState);
11
+ //# sourceMappingURL=context.js.map
@@ -4,3 +4,4 @@ export { default as EnhancedModalFooter } from './components/EnhancedModalFooter
4
4
  export { default as MinimalModalContent } from './components/MinimalModalContent.js';
5
5
  export * from './context.js';
6
6
  export * from './use-enhanced-modal.js';
7
+ //# sourceMappingURL=index.js.map
@@ -1,5 +1,6 @@
1
1
  import { useContext } from 'react';
2
2
  import { ModalContext } from './context.js';
3
- export var useEnhancedModal = function() {
3
+ export const useEnhancedModal = () => {
4
4
  return useContext(ModalContext);
5
5
  };
6
+ //# sourceMappingURL=use-enhanced-modal.js.map
@@ -1,61 +1,79 @@
1
1
  // TODO sync this with the one in dump
2
2
  // remove dump file version
3
3
  // update all instances using colors
4
- export var colors = {
4
+ export const colors = {
5
5
  /**
6
- * #EFEFF0 Light Gray
7
- */ primary1: '#EFEFF0',
6
+ * #EFEFF0 Light Gray
7
+ */
8
+ primary1: '#EFEFF0',
8
9
  /**
9
- * #CACACA Gray
10
- */ primary2: '#CACACA',
10
+ * #CACACA Gray
11
+ */
12
+ primary2: '#CACACA',
11
13
  /**
12
- * #585858 Dark Gray
13
- */ primary3: '#585858',
14
+ * #585858 Dark Gray
15
+ */
16
+ primary3: '#585858',
14
17
  /**
15
- * #191919 Soft Black
16
- */ primary4: '#191919',
18
+ * #191919 Soft Black
19
+ */
20
+ primary4: '#191919',
17
21
  /**
18
- * #E55867 Red
19
- */ accent4: '#E55867',
22
+ * #E55867 Red
23
+ */
24
+ accent4: '#E55867',
20
25
  /**
21
- * #ADE0EE Light Blue
22
- */ links2: '#ADE0EE',
26
+ * #ADE0EE Light Blue
27
+ */
28
+ links2: '#ADE0EE',
23
29
  /**
24
- * #50C8E8 Blue
25
- */ links: '#50C8E8',
30
+ * #50C8E8 Blue
31
+ */
32
+ links: '#50C8E8',
26
33
  /**
27
- * #E24657 Red
28
- */ alert4: '#E24657',
34
+ * #E24657 Red
35
+ */
36
+ alert4: '#E24657',
29
37
  /**
30
- * #E24657 Red
31
- */ danger: '#E24657',
38
+ * #E24657 Red
39
+ */
40
+ danger: '#E24657',
32
41
  /**
33
- * #F4B25C Yellow
34
- */ warning4: '#F4B25C',
42
+ * #F4B25C Yellow
43
+ */
44
+ warning4: '#F4B25C',
35
45
  /**
36
- * #4FD9C2 Green
37
- */ success4: '#4FD9C2',
46
+ * #4FD9C2 Green
47
+ */
48
+ success4: '#4FD9C2',
38
49
  /**
39
- * #4FD9C2 Green
40
- */ green: '#4FD9C2',
50
+ * #4FD9C2 Green
51
+ */
52
+ green: '#4FD9C2',
41
53
  /**
42
- * #3BD5BC Green
43
- */ // green: '#3BD5BC',
54
+ * #3BD5BC Green
55
+ */
56
+ // green: '#3BD5BC',
44
57
  /**
45
- * #000000 Black
46
- */ black: '#000000',
58
+ * #000000 Black
59
+ */
60
+ black: '#000000',
47
61
  /**
48
- * #ffffff White
49
- */ white: '#ffffff',
62
+ * #ffffff White
63
+ */
64
+ white: '#ffffff',
50
65
  /**
51
- * #E6E6E6 Light Gray
52
- */ whiteHover: '#E6E6E6',
66
+ * #E6E6E6 Light Gray
67
+ */
68
+ whiteHover: '#E6E6E6',
53
69
  /**
54
- * #F4F4F4 Light Gray
55
- */ placeholder: '#F4F4F4',
70
+ * #F4F4F4 Light Gray
71
+ */
72
+ placeholder: '#F4F4F4',
56
73
  /**
57
- * #F9F7D7 Light Yellow
58
- */ highlight: '#F9F7D7',
74
+ * #F9F7D7 Light Yellow
75
+ */
76
+ highlight: '#F9F7D7',
59
77
  primary: {
60
78
  25: '#fafafa',
61
79
  50: '#d6f5f0',
@@ -67,7 +85,7 @@ export var colors = {
67
85
  600: '#000000',
68
86
  700: '#000000',
69
87
  800: '#000000',
70
- 900: '#000000'
88
+ 900: '#000000',
71
89
  },
72
90
  // TODO add 25
73
91
  success: {
@@ -80,7 +98,7 @@ export var colors = {
80
98
  600: '#2EA692',
81
99
  700: '#00825c',
82
100
  800: '#00724d',
83
- 900: '#005530'
101
+ 900: '#005530',
84
102
  },
85
103
  // TODO add 25
86
104
  accent: {
@@ -93,7 +111,7 @@ export var colors = {
93
111
  600: '#d8253f',
94
112
  700: '#c61a38',
95
113
  800: '#b91231',
96
- 900: '#aa0026'
114
+ 900: '#aa0026',
97
115
  },
98
116
  // TODO add 25
99
117
  warning: {
@@ -106,7 +124,7 @@ export var colors = {
106
124
  600: '#BF7F2C',
107
125
  700: '#F4B25C',
108
126
  800: '#F4B25C',
109
- 900: '#F4B25C'
127
+ 900: '#F4B25C',
110
128
  },
111
129
  info: {
112
130
  25: '#50C8E81A',
@@ -119,7 +137,7 @@ export var colors = {
119
137
  600: '#3EA5C0',
120
138
  700: '#50C8E8',
121
139
  800: '#50C8E8',
122
- 900: '#40A0BA'
140
+ 900: '#40A0BA',
123
141
  },
124
142
  // TODO add 25
125
143
  alert: {
@@ -132,6 +150,7 @@ export var colors = {
132
150
  600: '#E24657',
133
151
  700: '#E24657',
134
152
  800: '#E24657',
135
- 900: '#E24657'
136
- }
153
+ 900: '#E24657',
154
+ },
137
155
  };
156
+ //# sourceMappingURL=colors.js.map
@@ -1 +1,2 @@
1
1
  export * from './colors.js';
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1,3 @@
1
- export * from './use-toast-result.js'; // TODO: Add the ToastBox component here
1
+ export * from './use-toast-result.js';
2
+ // TODO: Add the ToastBox component here
3
+ //# sourceMappingURL=index.js.map