@driveflux/ui 1.0.6 → 1.0.7
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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +9 -0
- package/dist/chakra.js +1 -1
- package/dist/cjs/modal/ModalProvider.js +6 -6
- package/dist/cjs/modal/components/EnhancedModalCustomWrapper.js +10 -10
- package/dist/cjs/modal/components/EnhancedModalFooter.js +23 -23
- package/dist/cjs/modal/components/MinimalModalContent.js +1 -1
- package/dist/cjs/modal/components/StandardModalContent.js +6 -6
- package/dist/cjs/theme/colors.js +79 -79
- package/dist/cjs/toast/use-toast-result.js +8 -8
- package/dist/cjs/translations.js +9 -9
- package/dist/cjs/utils/accessors.js +2 -2
- package/dist/cjs/utils/react.js +3 -3
- package/dist/index.js +1 -1
- package/dist/modal/ModalProvider.js +13 -13
- package/dist/modal/components/EnhancedModalCustomWrapper.js +13 -13
- package/dist/modal/components/EnhancedModalFooter.js +27 -27
- package/dist/modal/components/MinimalModalContent.js +4 -4
- package/dist/modal/components/StandardModalContent.js +11 -11
- package/dist/modal/context.js +1 -1
- package/dist/modal/index.js +6 -6
- package/dist/modal/use-enhanced-modal.js +2 -2
- package/dist/theme/colors.js +79 -79
- package/dist/theme/index.js +1 -1
- package/dist/toast/index.js +1 -1
- package/dist/toast/use-toast-result.js +13 -13
- package/dist/translations.js +10 -10
- package/dist/utils/accessors.js +2 -2
- package/dist/utils/index.js +2 -2
- package/dist/utils/react.js +4 -4
- package/package.json +12 -12
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -78,9 +78,9 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
78
78
|
return target;
|
|
79
79
|
}
|
|
80
80
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
81
|
-
import IconClose from
|
|
82
|
-
import { Button, HStack, Heading, Stack } from
|
|
83
|
-
import { useEnhancedModal } from
|
|
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
84
|
var EnhancedModalCustomWrapper = function(_param) {
|
|
85
85
|
var title = _param.title, children = _param.children, isCloseHidden = _param.isCloseHidden, props = _object_without_properties(_param, [
|
|
86
86
|
"title",
|
|
@@ -89,30 +89,30 @@ var EnhancedModalCustomWrapper = function(_param) {
|
|
|
89
89
|
]);
|
|
90
90
|
var close = useEnhancedModal().close;
|
|
91
91
|
return /*#__PURE__*/ _jsxs(Stack, _object_spread_props(_object_spread({
|
|
92
|
-
overflowY:
|
|
93
|
-
px:
|
|
94
|
-
py:
|
|
95
|
-
spacing:
|
|
92
|
+
overflowY: 'scroll',
|
|
93
|
+
px: '32px',
|
|
94
|
+
py: '24px',
|
|
95
|
+
spacing: '18px'
|
|
96
96
|
}, props), {
|
|
97
97
|
children: [
|
|
98
98
|
/*#__PURE__*/ _jsxs(HStack, {
|
|
99
|
-
justifyContent:
|
|
99
|
+
justifyContent: 'space-between',
|
|
100
100
|
children: [
|
|
101
101
|
/*#__PURE__*/ _jsx(Heading, {
|
|
102
|
-
fontSize:
|
|
103
|
-
textTransform:
|
|
102
|
+
fontSize: '18px',
|
|
103
|
+
textTransform: 'uppercase',
|
|
104
104
|
children: title
|
|
105
105
|
}),
|
|
106
106
|
!isCloseHidden && /*#__PURE__*/ _jsx(Button, {
|
|
107
107
|
p: 0,
|
|
108
|
-
variant:
|
|
108
|
+
variant: 'unstyled',
|
|
109
109
|
border: 0,
|
|
110
|
-
w:
|
|
110
|
+
w: 'fit-content',
|
|
111
111
|
onClick: function() {
|
|
112
112
|
close();
|
|
113
113
|
},
|
|
114
114
|
children: /*#__PURE__*/ _jsx(IconClose, {
|
|
115
|
-
size:
|
|
115
|
+
size: '28px'
|
|
116
116
|
})
|
|
117
117
|
})
|
|
118
118
|
]
|
|
@@ -78,10 +78,10 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
78
78
|
return target;
|
|
79
79
|
}
|
|
80
80
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
81
|
-
import { Button, Stack } from
|
|
82
|
-
import { colors } from
|
|
83
|
-
import { translations } from
|
|
84
|
-
import { useEnhancedModal } from
|
|
81
|
+
import { Button, Stack } from '../../chakra.js';
|
|
82
|
+
import { colors } from '../../theme/colors.js';
|
|
83
|
+
import { translations } from '../../translations.js';
|
|
84
|
+
import { useEnhancedModal } from '../use-enhanced-modal.js';
|
|
85
85
|
var EnhancedModalFooter = function(_param) {
|
|
86
86
|
var sticky = _param.sticky, cancelProps = _param.cancelProps, okProps = _param.okProps, children = _param.children, suffix = _param.suffix, props = _object_without_properties(_param, [
|
|
87
87
|
"sticky",
|
|
@@ -93,55 +93,55 @@ var EnhancedModalFooter = function(_param) {
|
|
|
93
93
|
var close = useEnhancedModal().close;
|
|
94
94
|
return /*#__PURE__*/ _jsxs(Stack, _object_spread_props(_object_spread({
|
|
95
95
|
pos: {
|
|
96
|
-
base:
|
|
97
|
-
md: sticky ?
|
|
96
|
+
base: 'absolute',
|
|
97
|
+
md: sticky ? 'absolute' : 'static'
|
|
98
98
|
},
|
|
99
99
|
bottom: 0,
|
|
100
100
|
left: 0,
|
|
101
101
|
right: 0,
|
|
102
|
-
py:
|
|
102
|
+
py: '32px',
|
|
103
103
|
px: {
|
|
104
|
-
base:
|
|
105
|
-
md: sticky ?
|
|
104
|
+
base: '32px',
|
|
105
|
+
md: sticky ? '32px' : '0'
|
|
106
106
|
},
|
|
107
|
-
borderTop: sticky ? "1px solid ".concat(colors.primary2) :
|
|
107
|
+
borderTop: sticky ? "1px solid ".concat(colors.primary2) : '',
|
|
108
108
|
background: colors.white,
|
|
109
|
-
spacing:
|
|
110
|
-
zIndex:
|
|
109
|
+
spacing: '24px',
|
|
110
|
+
zIndex: 'sticky'
|
|
111
111
|
}, props), {
|
|
112
112
|
children: [
|
|
113
113
|
children ? /*#__PURE__*/ _jsx(Stack, {
|
|
114
114
|
direction: {
|
|
115
|
-
base:
|
|
116
|
-
md:
|
|
115
|
+
base: 'column-reverse',
|
|
116
|
+
md: 'row'
|
|
117
117
|
},
|
|
118
|
-
spacing:
|
|
118
|
+
spacing: '24px',
|
|
119
119
|
children: children
|
|
120
120
|
}) : /*#__PURE__*/ _jsxs(Stack, {
|
|
121
121
|
direction: {
|
|
122
|
-
base:
|
|
123
|
-
md:
|
|
122
|
+
base: 'column-reverse',
|
|
123
|
+
md: 'row'
|
|
124
124
|
},
|
|
125
|
-
spacing:
|
|
125
|
+
spacing: '24px',
|
|
126
126
|
children: [
|
|
127
127
|
/*#__PURE__*/ _jsx(Button, _object_spread_props(_object_spread({
|
|
128
|
-
w:
|
|
129
|
-
variant:
|
|
128
|
+
w: 'full',
|
|
129
|
+
variant: 'outline',
|
|
130
130
|
onClick: function() {
|
|
131
131
|
return close();
|
|
132
132
|
}
|
|
133
133
|
}, cancelProps), {
|
|
134
|
-
fontSize:
|
|
135
|
-
fontWeight:
|
|
136
|
-
letterSpacing:
|
|
134
|
+
fontSize: '10px',
|
|
135
|
+
fontWeight: 'bold',
|
|
136
|
+
letterSpacing: '3px',
|
|
137
137
|
children: (cancelProps === null || cancelProps === void 0 ? void 0 : cancelProps.children) ? cancelProps.children : translations.cancel
|
|
138
138
|
})),
|
|
139
139
|
/*#__PURE__*/ _jsx(Button, _object_spread_props(_object_spread({
|
|
140
|
-
w:
|
|
140
|
+
w: 'full'
|
|
141
141
|
}, okProps), {
|
|
142
|
-
fontSize:
|
|
143
|
-
fontWeight:
|
|
144
|
-
letterSpacing:
|
|
142
|
+
fontSize: '10px',
|
|
143
|
+
fontWeight: 'bold',
|
|
144
|
+
letterSpacing: '3px',
|
|
145
145
|
children: (okProps === null || okProps === void 0 ? void 0 : okProps.children) ? okProps.children : translations.confirm
|
|
146
146
|
}))
|
|
147
147
|
]
|
|
@@ -54,9 +54,9 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
54
54
|
return target;
|
|
55
55
|
}
|
|
56
56
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
57
|
-
import { Fragment } from
|
|
58
|
-
import { Box, ModalBody, ModalCloseButton, ModalHeader } from
|
|
59
|
-
import { isReactNode } from
|
|
57
|
+
import { Fragment } from 'react';
|
|
58
|
+
import { Box, ModalBody, ModalCloseButton, ModalHeader } from '../../chakra.js';
|
|
59
|
+
import { isReactNode } from '../../utils/react.js';
|
|
60
60
|
var MinimalModalContent = function(_param) {
|
|
61
61
|
var _param_controls = _param.controls, open = _param_controls.open, close = _param_controls.close, modalContentConfig = _param.modalContentConfig, props = _object_without_properties(_param, [
|
|
62
62
|
"controls",
|
|
@@ -69,7 +69,7 @@ var MinimalModalContent = function(_param) {
|
|
|
69
69
|
modalContentConfig.title ? /*#__PURE__*/ _jsx(ModalHeader, {
|
|
70
70
|
children: modalContentConfig.title
|
|
71
71
|
}) : /*#__PURE__*/ _jsx(Box, {
|
|
72
|
-
h:
|
|
72
|
+
h: '32px'
|
|
73
73
|
}),
|
|
74
74
|
/*#__PURE__*/ _jsx(ModalCloseButton, {}),
|
|
75
75
|
/*#__PURE__*/ _jsx(Wrapper, {
|
|
@@ -224,11 +224,11 @@ function _ts_generator(thisArg, body) {
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
227
|
-
import { useCallback, useState } from
|
|
228
|
-
import { Button, HStack, ModalBody, ModalCloseButton, ModalFooter, ModalHeader } from
|
|
229
|
-
import { translations } from
|
|
230
|
-
import { isReactNode } from
|
|
231
|
-
import { useEnhancedModal } from
|
|
227
|
+
import { useCallback, useState } from 'react';
|
|
228
|
+
import { Button, HStack, ModalBody, ModalCloseButton, ModalFooter, ModalHeader } from '../../chakra.js';
|
|
229
|
+
import { translations } from '../../translations.js';
|
|
230
|
+
import { isReactNode } from '../../utils/react.js';
|
|
231
|
+
import { useEnhancedModal } from '../use-enhanced-modal.js';
|
|
232
232
|
var StandardModalContent = function(_param) {
|
|
233
233
|
var _param_controls = _param.controls, open = _param_controls.open, close = _param_controls.close, modalContentConfig = _param.modalContentConfig, props = _object_without_properties(_param, [
|
|
234
234
|
"controls",
|
|
@@ -321,21 +321,21 @@ var StandardModalContent = function(_param) {
|
|
|
321
321
|
}),
|
|
322
322
|
/*#__PURE__*/ _jsx(ModalFooter, {
|
|
323
323
|
children: /*#__PURE__*/ _jsxs(HStack, {
|
|
324
|
-
w:
|
|
325
|
-
spacing:
|
|
324
|
+
w: 'full',
|
|
325
|
+
spacing: '6',
|
|
326
326
|
children: [
|
|
327
327
|
/*#__PURE__*/ _jsx(Button, {
|
|
328
328
|
isDisabled: isSaving,
|
|
329
|
-
w:
|
|
330
|
-
variant:
|
|
329
|
+
w: 'full',
|
|
330
|
+
variant: 'outline',
|
|
331
331
|
onClick: handleCancel,
|
|
332
332
|
children: modalContentConfig.cancelText || translations.close
|
|
333
333
|
}),
|
|
334
334
|
/*#__PURE__*/ _jsx(Button, {
|
|
335
335
|
isDisabled: modalContentConfig.isOkDisabled,
|
|
336
336
|
isLoading: isSaving || modalContentConfig.isOkLoading,
|
|
337
|
-
w:
|
|
338
|
-
variant:
|
|
337
|
+
w: 'full',
|
|
338
|
+
variant: 'solid',
|
|
339
339
|
onClick: handleOK,
|
|
340
340
|
colorScheme: modalContentConfig.okColorScheme,
|
|
341
341
|
children: modalContentConfig.okText || translations.ok
|
package/dist/modal/context.js
CHANGED
package/dist/modal/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { default as ModalProvider } from
|
|
2
|
-
export { default as EnhancedModalCustomWrapper } from
|
|
3
|
-
export { default as EnhancedModalFooter } from
|
|
4
|
-
export { default as MinimalModalContent } from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
1
|
+
export { default as ModalProvider } from './ModalProvider.js';
|
|
2
|
+
export { default as EnhancedModalCustomWrapper } from './components/EnhancedModalCustomWrapper.js';
|
|
3
|
+
export { default as EnhancedModalFooter } from './components/EnhancedModalFooter.js';
|
|
4
|
+
export { default as MinimalModalContent } from './components/MinimalModalContent.js';
|
|
5
|
+
export * from './context.js';
|
|
6
|
+
export * from './use-enhanced-modal.js';
|
package/dist/theme/colors.js
CHANGED
|
@@ -4,134 +4,134 @@
|
|
|
4
4
|
export var colors = {
|
|
5
5
|
/**
|
|
6
6
|
* #EFEFF0 Light Gray
|
|
7
|
-
*/ primary1:
|
|
7
|
+
*/ primary1: '#EFEFF0',
|
|
8
8
|
/**
|
|
9
9
|
* #CACACA Gray
|
|
10
|
-
*/ primary2:
|
|
10
|
+
*/ primary2: '#CACACA',
|
|
11
11
|
/**
|
|
12
12
|
* #585858 Dark Gray
|
|
13
|
-
*/ primary3:
|
|
13
|
+
*/ primary3: '#585858',
|
|
14
14
|
/**
|
|
15
15
|
* #191919 Soft Black
|
|
16
|
-
*/ primary4:
|
|
16
|
+
*/ primary4: '#191919',
|
|
17
17
|
/**
|
|
18
18
|
* #E55867 Red
|
|
19
|
-
*/ accent4:
|
|
19
|
+
*/ accent4: '#E55867',
|
|
20
20
|
/**
|
|
21
21
|
* #ADE0EE Light Blue
|
|
22
|
-
*/ links2:
|
|
22
|
+
*/ links2: '#ADE0EE',
|
|
23
23
|
/**
|
|
24
24
|
* #50C8E8 Blue
|
|
25
|
-
*/ links:
|
|
25
|
+
*/ links: '#50C8E8',
|
|
26
26
|
/**
|
|
27
27
|
* #E24657 Red
|
|
28
|
-
*/ alert4:
|
|
28
|
+
*/ alert4: '#E24657',
|
|
29
29
|
/**
|
|
30
30
|
* #E24657 Red
|
|
31
|
-
*/ danger:
|
|
31
|
+
*/ danger: '#E24657',
|
|
32
32
|
/**
|
|
33
33
|
* #F4B25C Yellow
|
|
34
|
-
*/ warning4:
|
|
34
|
+
*/ warning4: '#F4B25C',
|
|
35
35
|
/**
|
|
36
36
|
* #4FD9C2 Green
|
|
37
|
-
*/ success4:
|
|
37
|
+
*/ success4: '#4FD9C2',
|
|
38
38
|
/**
|
|
39
39
|
* #4FD9C2 Green
|
|
40
|
-
*/ green:
|
|
40
|
+
*/ green: '#4FD9C2',
|
|
41
41
|
/**
|
|
42
42
|
* #3BD5BC Green
|
|
43
43
|
*/ // green: '#3BD5BC',
|
|
44
44
|
/**
|
|
45
45
|
* #000000 Black
|
|
46
|
-
*/ black:
|
|
46
|
+
*/ black: '#000000',
|
|
47
47
|
/**
|
|
48
48
|
* #ffffff White
|
|
49
|
-
*/ white:
|
|
49
|
+
*/ white: '#ffffff',
|
|
50
50
|
/**
|
|
51
51
|
* #E6E6E6 Light Gray
|
|
52
|
-
*/ whiteHover:
|
|
52
|
+
*/ whiteHover: '#E6E6E6',
|
|
53
53
|
/**
|
|
54
54
|
* #F4F4F4 Light Gray
|
|
55
|
-
*/ placeholder:
|
|
55
|
+
*/ placeholder: '#F4F4F4',
|
|
56
56
|
/**
|
|
57
57
|
* #F9F7D7 Light Yellow
|
|
58
|
-
*/ highlight:
|
|
58
|
+
*/ highlight: '#F9F7D7',
|
|
59
59
|
primary: {
|
|
60
|
-
25:
|
|
61
|
-
50:
|
|
62
|
-
100:
|
|
63
|
-
200:
|
|
64
|
-
300:
|
|
65
|
-
400:
|
|
66
|
-
500:
|
|
67
|
-
600:
|
|
68
|
-
700:
|
|
69
|
-
800:
|
|
70
|
-
900:
|
|
60
|
+
25: '#fafafa',
|
|
61
|
+
50: '#d6f5f0',
|
|
62
|
+
100: '#98e6d6',
|
|
63
|
+
200: '#191919',
|
|
64
|
+
300: '#191919',
|
|
65
|
+
400: '#3bd5bb',
|
|
66
|
+
500: '#000000',
|
|
67
|
+
600: '#000000',
|
|
68
|
+
700: '#000000',
|
|
69
|
+
800: '#000000',
|
|
70
|
+
900: '#000000'
|
|
71
71
|
},
|
|
72
72
|
// TODO add 25
|
|
73
73
|
success: {
|
|
74
|
-
50:
|
|
75
|
-
100:
|
|
76
|
-
200:
|
|
77
|
-
300:
|
|
78
|
-
400:
|
|
79
|
-
500:
|
|
80
|
-
600:
|
|
81
|
-
700:
|
|
82
|
-
800:
|
|
83
|
-
900:
|
|
74
|
+
50: '#d8f7f2',
|
|
75
|
+
100: '#98e6d6',
|
|
76
|
+
200: '#3bd5bc',
|
|
77
|
+
300: '#4FD9C2',
|
|
78
|
+
400: '#3bd5bb',
|
|
79
|
+
500: '#3bd5bb',
|
|
80
|
+
600: '#2EA692',
|
|
81
|
+
700: '#00825c',
|
|
82
|
+
800: '#00724d',
|
|
83
|
+
900: '#005530'
|
|
84
84
|
},
|
|
85
85
|
// TODO add 25
|
|
86
86
|
accent: {
|
|
87
|
-
50:
|
|
88
|
-
100:
|
|
89
|
-
200:
|
|
90
|
-
300:
|
|
91
|
-
400:
|
|
92
|
-
500:
|
|
93
|
-
600:
|
|
94
|
-
700:
|
|
95
|
-
800:
|
|
96
|
-
900:
|
|
87
|
+
50: '#fceaee',
|
|
88
|
+
100: '#f8cad3',
|
|
89
|
+
200: '#E55867',
|
|
90
|
+
300: '#E55867',
|
|
91
|
+
400: '#E24657',
|
|
92
|
+
500: '#E24657',
|
|
93
|
+
600: '#d8253f',
|
|
94
|
+
700: '#c61a38',
|
|
95
|
+
800: '#b91231',
|
|
96
|
+
900: '#aa0026'
|
|
97
97
|
},
|
|
98
98
|
// TODO add 25
|
|
99
99
|
warning: {
|
|
100
|
-
50:
|
|
101
|
-
100:
|
|
102
|
-
200:
|
|
103
|
-
300:
|
|
104
|
-
400:
|
|
105
|
-
500:
|
|
106
|
-
600:
|
|
107
|
-
700:
|
|
108
|
-
800:
|
|
109
|
-
900:
|
|
100
|
+
50: '#FDF0DE',
|
|
101
|
+
100: '#F4B25C',
|
|
102
|
+
200: '#F4B25C',
|
|
103
|
+
300: '#F4B25C',
|
|
104
|
+
400: '#F4B25C',
|
|
105
|
+
500: '#F4B25C',
|
|
106
|
+
600: '#BF7F2C',
|
|
107
|
+
700: '#F4B25C',
|
|
108
|
+
800: '#F4B25C',
|
|
109
|
+
900: '#F4B25C'
|
|
110
110
|
},
|
|
111
111
|
info: {
|
|
112
|
-
25:
|
|
113
|
-
50:
|
|
114
|
-
100:
|
|
115
|
-
200:
|
|
116
|
-
300:
|
|
117
|
-
400:
|
|
118
|
-
500:
|
|
119
|
-
600:
|
|
120
|
-
700:
|
|
121
|
-
800:
|
|
122
|
-
900:
|
|
112
|
+
25: '#50C8E81A',
|
|
113
|
+
50: '#CDF1FA',
|
|
114
|
+
100: '#50C8E8',
|
|
115
|
+
200: '#50C8E8',
|
|
116
|
+
300: '#50C8E8',
|
|
117
|
+
400: '#50C8E8',
|
|
118
|
+
500: '#50C8E8',
|
|
119
|
+
600: '#3EA5C0',
|
|
120
|
+
700: '#50C8E8',
|
|
121
|
+
800: '#50C8E8',
|
|
122
|
+
900: '#50C8E8'
|
|
123
123
|
},
|
|
124
124
|
// TODO add 25
|
|
125
125
|
alert: {
|
|
126
|
-
50:
|
|
127
|
-
100:
|
|
128
|
-
200:
|
|
129
|
-
300:
|
|
130
|
-
400:
|
|
131
|
-
500:
|
|
132
|
-
600:
|
|
133
|
-
700:
|
|
134
|
-
800:
|
|
135
|
-
900:
|
|
126
|
+
50: '#E24657',
|
|
127
|
+
100: '#E24657',
|
|
128
|
+
200: '#E24657',
|
|
129
|
+
300: '#E24657',
|
|
130
|
+
400: '#E24657',
|
|
131
|
+
500: '#E24657',
|
|
132
|
+
600: '#E24657',
|
|
133
|
+
700: '#E24657',
|
|
134
|
+
800: '#E24657',
|
|
135
|
+
900: '#E24657'
|
|
136
136
|
}
|
|
137
137
|
};
|
package/dist/theme/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './colors.js';
|
package/dist/toast/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './use-toast-result.js'; // TODO: Add the ToastBox component here
|
|
@@ -78,23 +78,23 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
78
78
|
return target;
|
|
79
79
|
}
|
|
80
80
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
81
|
-
import merge from
|
|
82
|
-
import { useCallback } from
|
|
83
|
-
import { Box, ListItem, Text, UnorderedList, useToast } from
|
|
84
|
-
import { translations } from
|
|
85
|
-
import { accessReactNode } from
|
|
81
|
+
import merge from 'lodash/merge.js';
|
|
82
|
+
import { useCallback } from 'react';
|
|
83
|
+
import { Box, ListItem, Text, UnorderedList, useToast } from '../chakra.js';
|
|
84
|
+
import { translations } from '../translations.js';
|
|
85
|
+
import { accessReactNode } from '../utils/accessors.js';
|
|
86
86
|
var accessStatus = function(s, data) {
|
|
87
|
-
return typeof s ===
|
|
87
|
+
return typeof s === 'function' ? s(data) : s;
|
|
88
88
|
};
|
|
89
89
|
var defaultUseToastResultOptions = {
|
|
90
90
|
success: {
|
|
91
|
-
status:
|
|
91
|
+
status: 'success',
|
|
92
92
|
title: translations.success,
|
|
93
93
|
description: translations.successDescription,
|
|
94
94
|
isClosable: true
|
|
95
95
|
},
|
|
96
96
|
error: {
|
|
97
|
-
status:
|
|
97
|
+
status: 'error',
|
|
98
98
|
title: translations.failed,
|
|
99
99
|
defaultDescription: translations.failedDescription,
|
|
100
100
|
showValidationErrors: true,
|
|
@@ -132,11 +132,11 @@ export var useToastResult = function(options) {
|
|
|
132
132
|
children: /*#__PURE__*/ _jsxs(_Fragment, {
|
|
133
133
|
children: [
|
|
134
134
|
problemMessage && /*#__PURE__*/ _jsx(Text, {
|
|
135
|
-
color:
|
|
135
|
+
color: 'inherit',
|
|
136
136
|
children: problemMessage
|
|
137
137
|
}),
|
|
138
138
|
problem.validation && showValidationErrors && /*#__PURE__*/ _jsx(UnorderedList, {
|
|
139
|
-
color:
|
|
139
|
+
color: 'inherit',
|
|
140
140
|
children: getValidationErrorsList(problem.validation).map(function(message, i) {
|
|
141
141
|
return /*#__PURE__*/ _jsx(ListItem, {
|
|
142
142
|
children: message
|
|
@@ -164,12 +164,12 @@ export var useToastResult = function(options) {
|
|
|
164
164
|
]);
|
|
165
165
|
var toastResult = useCallback(function(result, generalToastOptions) {
|
|
166
166
|
var _$options = merge({}, defaultUseToastResultOptions, generalToastOptions || defaultUseToastResultOptions);
|
|
167
|
-
var toastType = result.ok ?
|
|
168
|
-
var toastOptions = typeof generalToastOptions ===
|
|
167
|
+
var toastType = result.ok ? 'success' : 'error';
|
|
168
|
+
var toastOptions = typeof generalToastOptions === 'undefined' || generalToastOptions[toastType] === null ? null : _$options[toastType];
|
|
169
169
|
if (!toastOptions) {
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
|
-
var finalToastOptions = _object_spread({}, accessOptions(typeof toastOptions ===
|
|
172
|
+
var finalToastOptions = _object_spread({}, accessOptions(typeof toastOptions === 'boolean' ? defaultUseToastResultOptions[toastType] : toastOptions, result.val));
|
|
173
173
|
return result.ok ? toastSuccess(finalToastOptions) : toastProblem(result.val, finalToastOptions);
|
|
174
174
|
}, [
|
|
175
175
|
originalToast,
|
package/dist/translations.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { singleton } from
|
|
2
|
-
export var translations = singleton(
|
|
3
|
-
success:
|
|
4
|
-
successDescription:
|
|
5
|
-
failed:
|
|
6
|
-
failedDescription:
|
|
7
|
-
cancel:
|
|
8
|
-
confirm:
|
|
9
|
-
close:
|
|
10
|
-
ok:
|
|
1
|
+
import { singleton } from '@driveflux/singleton';
|
|
2
|
+
export var translations = singleton('uiTranslations', {
|
|
3
|
+
success: 'Success',
|
|
4
|
+
successDescription: 'Operation completed successfully.',
|
|
5
|
+
failed: 'Operation Failed',
|
|
6
|
+
failedDescription: 'There was a problem while performing this operation.',
|
|
7
|
+
cancel: 'Cancel',
|
|
8
|
+
confirm: 'Confirm',
|
|
9
|
+
close: 'Close',
|
|
10
|
+
ok: 'Ok'
|
|
11
11
|
});
|
|
12
12
|
export var setTranslations = function(ts) {
|
|
13
13
|
for(var key in ts){
|
package/dist/utils/accessors.js
CHANGED
|
@@ -2,7 +2,7 @@ export var accessSelf = function(s, data, defaultValue) {
|
|
|
2
2
|
if (!s) {
|
|
3
3
|
return defaultValue;
|
|
4
4
|
}
|
|
5
|
-
return typeof s ===
|
|
5
|
+
return typeof s === 'function' ? s(data) : s;
|
|
6
6
|
};
|
|
7
7
|
export var accessBoolean = function(s, data, defaultBoolean) {
|
|
8
8
|
return accessSelf(s, data, defaultBoolean);
|
|
@@ -24,5 +24,5 @@ export var accessFunction = function(f, data, defaultFunction) {
|
|
|
24
24
|
if (!f) {
|
|
25
25
|
return defaultFunction;
|
|
26
26
|
}
|
|
27
|
-
return typeof f ===
|
|
27
|
+
return typeof f === 'object' && 'generateFunction' in f ? f.generateFunction(data) : f;
|
|
28
28
|
};
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './accessors.js';
|
|
2
|
+
export * from './react.js';
|
package/dist/utils/react.js
CHANGED
|
@@ -5,9 +5,9 @@ function _instanceof(left, right) {
|
|
|
5
5
|
return left instanceof right;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
import { isValidElement } from
|
|
8
|
+
import { isValidElement } from 'react';
|
|
9
9
|
export function isReactComponent(Component) {
|
|
10
|
-
return typeof Component ===
|
|
10
|
+
return typeof Component === 'function' && // TODO
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- React component, it's fine
|
|
12
12
|
(_instanceof(Component.prototype, Component) || Component.displayName !== undefined);
|
|
13
13
|
}
|
|
@@ -20,8 +20,8 @@ export function isReactNode(node) {
|
|
|
20
20
|
if (// TODO
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- isValidElement is a validation function
|
|
22
22
|
isValidElement(node) || // Check if it's a React element
|
|
23
|
-
typeof node ===
|
|
24
|
-
typeof node ===
|
|
23
|
+
typeof node === 'string' || // Check if it's a string
|
|
24
|
+
typeof node === 'number' // Check if it's a number
|
|
25
25
|
) {
|
|
26
26
|
return true;
|
|
27
27
|
}
|