@driveflux/ui 1.0.5 → 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 +17 -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 +11 -10
- 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.d.ts.map +1 -1
- package/dist/translations.js +11 -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 -11
- package/src/translations.ts +3 -2
- package/tsconfig.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
> @driveflux/ui@1.0.
|
|
2
|
+
> @driveflux/ui@1.0.7 build /Users/flux/Projects/flux/shared/ui
|
|
3
3
|
> fab
|
|
4
4
|
|
|
5
|
-
Successfully compiled: 19 files with swc (
|
|
6
|
-
Successfully compiled: 19 files with swc (
|
|
5
|
+
Successfully compiled: 19 files with swc (239.41ms)
|
|
6
|
+
Successfully compiled: 19 files with swc (236.4ms)
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @driveflux/ui
|
|
2
2
|
|
|
3
|
+
## 1.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Upgraded packages
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @driveflux/singleton@1.0.1
|
|
10
|
+
- @driveflux/icons@1.0.6
|
|
11
|
+
|
|
12
|
+
## 1.0.6
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Date fns and other bug fixes
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @driveflux/icons@1.0.5
|
|
19
|
+
|
|
3
20
|
## 1.0.5
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/chakra.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from '@chakra-ui/react';
|
|
@@ -122,21 +122,21 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
122
122
|
var getModalComponent = function(modalContentConfig, controls) {
|
|
123
123
|
var otherProps = modalContentConfig.contentProps || {};
|
|
124
124
|
switch(modalContentConfig.type){
|
|
125
|
-
case
|
|
125
|
+
case 'standard':
|
|
126
126
|
{
|
|
127
127
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_StandardModalContent.default, _object_spread({
|
|
128
128
|
controls: controls,
|
|
129
129
|
modalContentConfig: modalContentConfig
|
|
130
130
|
}, otherProps));
|
|
131
131
|
}
|
|
132
|
-
case
|
|
132
|
+
case 'minimal':
|
|
133
133
|
{
|
|
134
134
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_MinimalModalContent.default, _object_spread({
|
|
135
135
|
controls: controls,
|
|
136
136
|
modalContentConfig: modalContentConfig
|
|
137
137
|
}, otherProps));
|
|
138
138
|
}
|
|
139
|
-
case
|
|
139
|
+
case 'custom':
|
|
140
140
|
return (0, _react1.isReactNode)(modalContentConfig.content) ? modalContentConfig.content : /*#__PURE__*/ (0, _jsxruntime.jsx)(modalContentConfig.content, _object_spread({
|
|
141
141
|
open: open,
|
|
142
142
|
close: close
|
|
@@ -231,13 +231,13 @@ var ModalProvider = function(param) {
|
|
|
231
231
|
children: [
|
|
232
232
|
children,
|
|
233
233
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_chakra.Modal, {
|
|
234
|
-
scrollBehavior:
|
|
234
|
+
scrollBehavior: 'inside',
|
|
235
235
|
isCentered: true,
|
|
236
236
|
blockScrollOnMount: true,
|
|
237
237
|
closeOnOverlayClick: true,
|
|
238
238
|
size: (modalContentConfig === null || modalContentConfig === void 0 ? void 0 : modalContentConfig.size) || {
|
|
239
|
-
base:
|
|
240
|
-
md:
|
|
239
|
+
base: 'full',
|
|
240
|
+
md: '3xl'
|
|
241
241
|
},
|
|
242
242
|
isOpen: isOpen,
|
|
243
243
|
onClose: onClose,
|
|
@@ -104,30 +104,30 @@ var EnhancedModalCustomWrapper = function(_param) {
|
|
|
104
104
|
]);
|
|
105
105
|
var close = (0, _useenhancedmodal.useEnhancedModal)().close;
|
|
106
106
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_chakra.Stack, _object_spread_props(_object_spread({
|
|
107
|
-
overflowY:
|
|
108
|
-
px:
|
|
109
|
-
py:
|
|
110
|
-
spacing:
|
|
107
|
+
overflowY: 'scroll',
|
|
108
|
+
px: '32px',
|
|
109
|
+
py: '24px',
|
|
110
|
+
spacing: '18px'
|
|
111
111
|
}, props), {
|
|
112
112
|
children: [
|
|
113
113
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_chakra.HStack, {
|
|
114
|
-
justifyContent:
|
|
114
|
+
justifyContent: 'space-between',
|
|
115
115
|
children: [
|
|
116
116
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Heading, {
|
|
117
|
-
fontSize:
|
|
118
|
-
textTransform:
|
|
117
|
+
fontSize: '18px',
|
|
118
|
+
textTransform: 'uppercase',
|
|
119
119
|
children: title
|
|
120
120
|
}),
|
|
121
121
|
!isCloseHidden && /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Button, {
|
|
122
122
|
p: 0,
|
|
123
|
-
variant:
|
|
123
|
+
variant: 'unstyled',
|
|
124
124
|
border: 0,
|
|
125
|
-
w:
|
|
125
|
+
w: 'fit-content',
|
|
126
126
|
onClick: function() {
|
|
127
127
|
close();
|
|
128
128
|
},
|
|
129
129
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_IconClose.default, {
|
|
130
|
-
size:
|
|
130
|
+
size: '28px'
|
|
131
131
|
})
|
|
132
132
|
})
|
|
133
133
|
]
|
|
@@ -103,55 +103,55 @@ var EnhancedModalFooter = function(_param) {
|
|
|
103
103
|
var close = (0, _useenhancedmodal.useEnhancedModal)().close;
|
|
104
104
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_chakra.Stack, _object_spread_props(_object_spread({
|
|
105
105
|
pos: {
|
|
106
|
-
base:
|
|
107
|
-
md: sticky ?
|
|
106
|
+
base: 'absolute',
|
|
107
|
+
md: sticky ? 'absolute' : 'static'
|
|
108
108
|
},
|
|
109
109
|
bottom: 0,
|
|
110
110
|
left: 0,
|
|
111
111
|
right: 0,
|
|
112
|
-
py:
|
|
112
|
+
py: '32px',
|
|
113
113
|
px: {
|
|
114
|
-
base:
|
|
115
|
-
md: sticky ?
|
|
114
|
+
base: '32px',
|
|
115
|
+
md: sticky ? '32px' : '0'
|
|
116
116
|
},
|
|
117
|
-
borderTop: sticky ? "1px solid ".concat(_colors.colors.primary2) :
|
|
117
|
+
borderTop: sticky ? "1px solid ".concat(_colors.colors.primary2) : '',
|
|
118
118
|
background: _colors.colors.white,
|
|
119
|
-
spacing:
|
|
120
|
-
zIndex:
|
|
119
|
+
spacing: '24px',
|
|
120
|
+
zIndex: 'sticky'
|
|
121
121
|
}, props), {
|
|
122
122
|
children: [
|
|
123
123
|
children ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Stack, {
|
|
124
124
|
direction: {
|
|
125
|
-
base:
|
|
126
|
-
md:
|
|
125
|
+
base: 'column-reverse',
|
|
126
|
+
md: 'row'
|
|
127
127
|
},
|
|
128
|
-
spacing:
|
|
128
|
+
spacing: '24px',
|
|
129
129
|
children: children
|
|
130
130
|
}) : /*#__PURE__*/ (0, _jsxruntime.jsxs)(_chakra.Stack, {
|
|
131
131
|
direction: {
|
|
132
|
-
base:
|
|
133
|
-
md:
|
|
132
|
+
base: 'column-reverse',
|
|
133
|
+
md: 'row'
|
|
134
134
|
},
|
|
135
|
-
spacing:
|
|
135
|
+
spacing: '24px',
|
|
136
136
|
children: [
|
|
137
137
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Button, _object_spread_props(_object_spread({
|
|
138
|
-
w:
|
|
139
|
-
variant:
|
|
138
|
+
w: 'full',
|
|
139
|
+
variant: 'outline',
|
|
140
140
|
onClick: function() {
|
|
141
141
|
return close();
|
|
142
142
|
}
|
|
143
143
|
}, cancelProps), {
|
|
144
|
-
fontSize:
|
|
145
|
-
fontWeight:
|
|
146
|
-
letterSpacing:
|
|
144
|
+
fontSize: '10px',
|
|
145
|
+
fontWeight: 'bold',
|
|
146
|
+
letterSpacing: '3px',
|
|
147
147
|
children: (cancelProps === null || cancelProps === void 0 ? void 0 : cancelProps.children) ? cancelProps.children : _translations.translations.cancel
|
|
148
148
|
})),
|
|
149
149
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Button, _object_spread_props(_object_spread({
|
|
150
|
-
w:
|
|
150
|
+
w: 'full'
|
|
151
151
|
}, okProps), {
|
|
152
|
-
fontSize:
|
|
153
|
-
fontWeight:
|
|
154
|
-
letterSpacing:
|
|
152
|
+
fontSize: '10px',
|
|
153
|
+
fontWeight: 'bold',
|
|
154
|
+
letterSpacing: '3px',
|
|
155
155
|
children: (okProps === null || okProps === void 0 ? void 0 : okProps.children) ? okProps.children : _translations.translations.confirm
|
|
156
156
|
}))
|
|
157
157
|
]
|
|
@@ -79,7 +79,7 @@ var MinimalModalContent = function(_param) {
|
|
|
79
79
|
modalContentConfig.title ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.ModalHeader, {
|
|
80
80
|
children: modalContentConfig.title
|
|
81
81
|
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Box, {
|
|
82
|
-
h:
|
|
82
|
+
h: '32px'
|
|
83
83
|
}),
|
|
84
84
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.ModalCloseButton, {}),
|
|
85
85
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(Wrapper, {
|
|
@@ -331,21 +331,21 @@ var StandardModalContent = function(_param) {
|
|
|
331
331
|
}),
|
|
332
332
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.ModalFooter, {
|
|
333
333
|
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_chakra.HStack, {
|
|
334
|
-
w:
|
|
335
|
-
spacing:
|
|
334
|
+
w: 'full',
|
|
335
|
+
spacing: '6',
|
|
336
336
|
children: [
|
|
337
337
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Button, {
|
|
338
338
|
isDisabled: isSaving,
|
|
339
|
-
w:
|
|
340
|
-
variant:
|
|
339
|
+
w: 'full',
|
|
340
|
+
variant: 'outline',
|
|
341
341
|
onClick: handleCancel,
|
|
342
342
|
children: modalContentConfig.cancelText || _translations.translations.close
|
|
343
343
|
}),
|
|
344
344
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Button, {
|
|
345
345
|
isDisabled: modalContentConfig.isOkDisabled,
|
|
346
346
|
isLoading: isSaving || modalContentConfig.isOkLoading,
|
|
347
|
-
w:
|
|
348
|
-
variant:
|
|
347
|
+
w: 'full',
|
|
348
|
+
variant: 'solid',
|
|
349
349
|
onClick: handleOK,
|
|
350
350
|
colorScheme: modalContentConfig.okColorScheme,
|
|
351
351
|
children: modalContentConfig.okText || _translations.translations.ok
|
package/dist/cjs/theme/colors.js
CHANGED
|
@@ -14,134 +14,134 @@ Object.defineProperty(exports, "colors", {
|
|
|
14
14
|
var colors = {
|
|
15
15
|
/**
|
|
16
16
|
* #EFEFF0 Light Gray
|
|
17
|
-
*/ primary1:
|
|
17
|
+
*/ primary1: '#EFEFF0',
|
|
18
18
|
/**
|
|
19
19
|
* #CACACA Gray
|
|
20
|
-
*/ primary2:
|
|
20
|
+
*/ primary2: '#CACACA',
|
|
21
21
|
/**
|
|
22
22
|
* #585858 Dark Gray
|
|
23
|
-
*/ primary3:
|
|
23
|
+
*/ primary3: '#585858',
|
|
24
24
|
/**
|
|
25
25
|
* #191919 Soft Black
|
|
26
|
-
*/ primary4:
|
|
26
|
+
*/ primary4: '#191919',
|
|
27
27
|
/**
|
|
28
28
|
* #E55867 Red
|
|
29
|
-
*/ accent4:
|
|
29
|
+
*/ accent4: '#E55867',
|
|
30
30
|
/**
|
|
31
31
|
* #ADE0EE Light Blue
|
|
32
|
-
*/ links2:
|
|
32
|
+
*/ links2: '#ADE0EE',
|
|
33
33
|
/**
|
|
34
34
|
* #50C8E8 Blue
|
|
35
|
-
*/ links:
|
|
35
|
+
*/ links: '#50C8E8',
|
|
36
36
|
/**
|
|
37
37
|
* #E24657 Red
|
|
38
|
-
*/ alert4:
|
|
38
|
+
*/ alert4: '#E24657',
|
|
39
39
|
/**
|
|
40
40
|
* #E24657 Red
|
|
41
|
-
*/ danger:
|
|
41
|
+
*/ danger: '#E24657',
|
|
42
42
|
/**
|
|
43
43
|
* #F4B25C Yellow
|
|
44
|
-
*/ warning4:
|
|
44
|
+
*/ warning4: '#F4B25C',
|
|
45
45
|
/**
|
|
46
46
|
* #4FD9C2 Green
|
|
47
|
-
*/ success4:
|
|
47
|
+
*/ success4: '#4FD9C2',
|
|
48
48
|
/**
|
|
49
49
|
* #4FD9C2 Green
|
|
50
|
-
*/ green:
|
|
50
|
+
*/ green: '#4FD9C2',
|
|
51
51
|
/**
|
|
52
52
|
* #3BD5BC Green
|
|
53
53
|
*/ // green: '#3BD5BC',
|
|
54
54
|
/**
|
|
55
55
|
* #000000 Black
|
|
56
|
-
*/ black:
|
|
56
|
+
*/ black: '#000000',
|
|
57
57
|
/**
|
|
58
58
|
* #ffffff White
|
|
59
|
-
*/ white:
|
|
59
|
+
*/ white: '#ffffff',
|
|
60
60
|
/**
|
|
61
61
|
* #E6E6E6 Light Gray
|
|
62
|
-
*/ whiteHover:
|
|
62
|
+
*/ whiteHover: '#E6E6E6',
|
|
63
63
|
/**
|
|
64
64
|
* #F4F4F4 Light Gray
|
|
65
|
-
*/ placeholder:
|
|
65
|
+
*/ placeholder: '#F4F4F4',
|
|
66
66
|
/**
|
|
67
67
|
* #F9F7D7 Light Yellow
|
|
68
|
-
*/ highlight:
|
|
68
|
+
*/ highlight: '#F9F7D7',
|
|
69
69
|
primary: {
|
|
70
|
-
25:
|
|
71
|
-
50:
|
|
72
|
-
100:
|
|
73
|
-
200:
|
|
74
|
-
300:
|
|
75
|
-
400:
|
|
76
|
-
500:
|
|
77
|
-
600:
|
|
78
|
-
700:
|
|
79
|
-
800:
|
|
80
|
-
900:
|
|
70
|
+
25: '#fafafa',
|
|
71
|
+
50: '#d6f5f0',
|
|
72
|
+
100: '#98e6d6',
|
|
73
|
+
200: '#191919',
|
|
74
|
+
300: '#191919',
|
|
75
|
+
400: '#3bd5bb',
|
|
76
|
+
500: '#000000',
|
|
77
|
+
600: '#000000',
|
|
78
|
+
700: '#000000',
|
|
79
|
+
800: '#000000',
|
|
80
|
+
900: '#000000'
|
|
81
81
|
},
|
|
82
82
|
// TODO add 25
|
|
83
83
|
success: {
|
|
84
|
-
50:
|
|
85
|
-
100:
|
|
86
|
-
200:
|
|
87
|
-
300:
|
|
88
|
-
400:
|
|
89
|
-
500:
|
|
90
|
-
600:
|
|
91
|
-
700:
|
|
92
|
-
800:
|
|
93
|
-
900:
|
|
84
|
+
50: '#d8f7f2',
|
|
85
|
+
100: '#98e6d6',
|
|
86
|
+
200: '#3bd5bc',
|
|
87
|
+
300: '#4FD9C2',
|
|
88
|
+
400: '#3bd5bb',
|
|
89
|
+
500: '#3bd5bb',
|
|
90
|
+
600: '#2EA692',
|
|
91
|
+
700: '#00825c',
|
|
92
|
+
800: '#00724d',
|
|
93
|
+
900: '#005530'
|
|
94
94
|
},
|
|
95
95
|
// TODO add 25
|
|
96
96
|
accent: {
|
|
97
|
-
50:
|
|
98
|
-
100:
|
|
99
|
-
200:
|
|
100
|
-
300:
|
|
101
|
-
400:
|
|
102
|
-
500:
|
|
103
|
-
600:
|
|
104
|
-
700:
|
|
105
|
-
800:
|
|
106
|
-
900:
|
|
97
|
+
50: '#fceaee',
|
|
98
|
+
100: '#f8cad3',
|
|
99
|
+
200: '#E55867',
|
|
100
|
+
300: '#E55867',
|
|
101
|
+
400: '#E24657',
|
|
102
|
+
500: '#E24657',
|
|
103
|
+
600: '#d8253f',
|
|
104
|
+
700: '#c61a38',
|
|
105
|
+
800: '#b91231',
|
|
106
|
+
900: '#aa0026'
|
|
107
107
|
},
|
|
108
108
|
// TODO add 25
|
|
109
109
|
warning: {
|
|
110
|
-
50:
|
|
111
|
-
100:
|
|
112
|
-
200:
|
|
113
|
-
300:
|
|
114
|
-
400:
|
|
115
|
-
500:
|
|
116
|
-
600:
|
|
117
|
-
700:
|
|
118
|
-
800:
|
|
119
|
-
900:
|
|
110
|
+
50: '#FDF0DE',
|
|
111
|
+
100: '#F4B25C',
|
|
112
|
+
200: '#F4B25C',
|
|
113
|
+
300: '#F4B25C',
|
|
114
|
+
400: '#F4B25C',
|
|
115
|
+
500: '#F4B25C',
|
|
116
|
+
600: '#BF7F2C',
|
|
117
|
+
700: '#F4B25C',
|
|
118
|
+
800: '#F4B25C',
|
|
119
|
+
900: '#F4B25C'
|
|
120
120
|
},
|
|
121
121
|
info: {
|
|
122
|
-
25:
|
|
123
|
-
50:
|
|
124
|
-
100:
|
|
125
|
-
200:
|
|
126
|
-
300:
|
|
127
|
-
400:
|
|
128
|
-
500:
|
|
129
|
-
600:
|
|
130
|
-
700:
|
|
131
|
-
800:
|
|
132
|
-
900:
|
|
122
|
+
25: '#50C8E81A',
|
|
123
|
+
50: '#CDF1FA',
|
|
124
|
+
100: '#50C8E8',
|
|
125
|
+
200: '#50C8E8',
|
|
126
|
+
300: '#50C8E8',
|
|
127
|
+
400: '#50C8E8',
|
|
128
|
+
500: '#50C8E8',
|
|
129
|
+
600: '#3EA5C0',
|
|
130
|
+
700: '#50C8E8',
|
|
131
|
+
800: '#50C8E8',
|
|
132
|
+
900: '#50C8E8'
|
|
133
133
|
},
|
|
134
134
|
// TODO add 25
|
|
135
135
|
alert: {
|
|
136
|
-
50:
|
|
137
|
-
100:
|
|
138
|
-
200:
|
|
139
|
-
300:
|
|
140
|
-
400:
|
|
141
|
-
500:
|
|
142
|
-
600:
|
|
143
|
-
700:
|
|
144
|
-
800:
|
|
145
|
-
900:
|
|
136
|
+
50: '#E24657',
|
|
137
|
+
100: '#E24657',
|
|
138
|
+
200: '#E24657',
|
|
139
|
+
300: '#E24657',
|
|
140
|
+
400: '#E24657',
|
|
141
|
+
500: '#E24657',
|
|
142
|
+
600: '#E24657',
|
|
143
|
+
700: '#E24657',
|
|
144
|
+
800: '#E24657',
|
|
145
|
+
900: '#E24657'
|
|
146
146
|
}
|
|
147
147
|
};
|
|
@@ -107,17 +107,17 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
107
107
|
return target;
|
|
108
108
|
}
|
|
109
109
|
var accessStatus = function(s, data) {
|
|
110
|
-
return typeof s ===
|
|
110
|
+
return typeof s === 'function' ? s(data) : s;
|
|
111
111
|
};
|
|
112
112
|
var defaultUseToastResultOptions = {
|
|
113
113
|
success: {
|
|
114
|
-
status:
|
|
114
|
+
status: 'success',
|
|
115
115
|
title: _translations.translations.success,
|
|
116
116
|
description: _translations.translations.successDescription,
|
|
117
117
|
isClosable: true
|
|
118
118
|
},
|
|
119
119
|
error: {
|
|
120
|
-
status:
|
|
120
|
+
status: 'error',
|
|
121
121
|
title: _translations.translations.failed,
|
|
122
122
|
defaultDescription: _translations.translations.failedDescription,
|
|
123
123
|
showValidationErrors: true,
|
|
@@ -155,11 +155,11 @@ var useToastResult = function(options) {
|
|
|
155
155
|
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
156
156
|
children: [
|
|
157
157
|
problemMessage && /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Text, {
|
|
158
|
-
color:
|
|
158
|
+
color: 'inherit',
|
|
159
159
|
children: problemMessage
|
|
160
160
|
}),
|
|
161
161
|
problem.validation && showValidationErrors && /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.UnorderedList, {
|
|
162
|
-
color:
|
|
162
|
+
color: 'inherit',
|
|
163
163
|
children: getValidationErrorsList(problem.validation).map(function(message, i) {
|
|
164
164
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.ListItem, {
|
|
165
165
|
children: message
|
|
@@ -187,12 +187,12 @@ var useToastResult = function(options) {
|
|
|
187
187
|
]);
|
|
188
188
|
var toastResult = (0, _react.useCallback)(function(result, generalToastOptions) {
|
|
189
189
|
var _$options = (0, _merge.default)({}, defaultUseToastResultOptions, generalToastOptions || defaultUseToastResultOptions);
|
|
190
|
-
var toastType = result.ok ?
|
|
191
|
-
var toastOptions = typeof generalToastOptions ===
|
|
190
|
+
var toastType = result.ok ? 'success' : 'error';
|
|
191
|
+
var toastOptions = typeof generalToastOptions === 'undefined' || generalToastOptions[toastType] === null ? null : _$options[toastType];
|
|
192
192
|
if (!toastOptions) {
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
|
-
var finalToastOptions = _object_spread({}, accessOptions(typeof toastOptions ===
|
|
195
|
+
var finalToastOptions = _object_spread({}, accessOptions(typeof toastOptions === 'boolean' ? defaultUseToastResultOptions[toastType] : toastOptions, result.val));
|
|
196
196
|
return result.ok ? toastSuccess(finalToastOptions) : toastProblem(result.val, finalToastOptions);
|
|
197
197
|
}, [
|
|
198
198
|
originalToast,
|
package/dist/cjs/translations.js
CHANGED
|
@@ -19,16 +19,17 @@ _export(exports, {
|
|
|
19
19
|
return translations;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
var _singleton = require("@driveflux/singleton");
|
|
23
|
+
var translations = (0, _singleton.singleton)('uiTranslations', {
|
|
24
|
+
success: 'Success',
|
|
25
|
+
successDescription: 'Operation completed successfully.',
|
|
26
|
+
failed: 'Operation Failed',
|
|
27
|
+
failedDescription: 'There was a problem while performing this operation.',
|
|
28
|
+
cancel: 'Cancel',
|
|
29
|
+
confirm: 'Confirm',
|
|
30
|
+
close: 'Close',
|
|
31
|
+
ok: 'Ok'
|
|
32
|
+
});
|
|
32
33
|
var setTranslations = function(ts) {
|
|
33
34
|
for(var key in ts){
|
|
34
35
|
// TODO
|
|
@@ -35,7 +35,7 @@ var accessSelf = function(s, data, defaultValue) {
|
|
|
35
35
|
if (!s) {
|
|
36
36
|
return defaultValue;
|
|
37
37
|
}
|
|
38
|
-
return typeof s ===
|
|
38
|
+
return typeof s === 'function' ? s(data) : s;
|
|
39
39
|
};
|
|
40
40
|
var accessBoolean = function(s, data, defaultBoolean) {
|
|
41
41
|
return accessSelf(s, data, defaultBoolean);
|
|
@@ -57,5 +57,5 @@ var accessFunction = function(f, data, defaultFunction) {
|
|
|
57
57
|
if (!f) {
|
|
58
58
|
return defaultFunction;
|
|
59
59
|
}
|
|
60
|
-
return typeof f ===
|
|
60
|
+
return typeof f === 'object' && 'generateFunction' in f ? f.generateFunction(data) : f;
|
|
61
61
|
};
|
package/dist/cjs/utils/react.js
CHANGED
|
@@ -28,7 +28,7 @@ function _instanceof(left, right) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
function isReactComponent(Component) {
|
|
31
|
-
return typeof Component ===
|
|
31
|
+
return typeof Component === 'function' && // TODO
|
|
32
32
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- React component, it's fine
|
|
33
33
|
(_instanceof(Component.prototype, Component) || Component.displayName !== undefined);
|
|
34
34
|
}
|
|
@@ -41,8 +41,8 @@ function isReactNode(node) {
|
|
|
41
41
|
if (// TODO
|
|
42
42
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- isValidElement is a validation function
|
|
43
43
|
(0, _react.isValidElement)(node) || // Check if it's a React element
|
|
44
|
-
typeof node ===
|
|
45
|
-
typeof node ===
|
|
44
|
+
typeof node === 'string' || // Check if it's a string
|
|
45
|
+
typeof node === 'number' // Check if it's a number
|
|
46
46
|
) {
|
|
47
47
|
return true;
|
|
48
48
|
}
|
package/dist/index.js
CHANGED
|
@@ -97,31 +97,31 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
97
97
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
98
98
|
}
|
|
99
99
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
100
|
-
import isEmpty from
|
|
101
|
-
import { useCallback, useMemo, useState } from
|
|
102
|
-
import { Modal, ModalContent, ModalOverlay, useDisclosure } from
|
|
103
|
-
import { isReactNode } from
|
|
104
|
-
import MinimalModalContent from
|
|
105
|
-
import StandardModalContent from
|
|
106
|
-
import { ModalContext } from
|
|
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
107
|
var getModalComponent = function(modalContentConfig, controls) {
|
|
108
108
|
var otherProps = modalContentConfig.contentProps || {};
|
|
109
109
|
switch(modalContentConfig.type){
|
|
110
|
-
case
|
|
110
|
+
case 'standard':
|
|
111
111
|
{
|
|
112
112
|
return /*#__PURE__*/ _jsx(StandardModalContent, _object_spread({
|
|
113
113
|
controls: controls,
|
|
114
114
|
modalContentConfig: modalContentConfig
|
|
115
115
|
}, otherProps));
|
|
116
116
|
}
|
|
117
|
-
case
|
|
117
|
+
case 'minimal':
|
|
118
118
|
{
|
|
119
119
|
return /*#__PURE__*/ _jsx(MinimalModalContent, _object_spread({
|
|
120
120
|
controls: controls,
|
|
121
121
|
modalContentConfig: modalContentConfig
|
|
122
122
|
}, otherProps));
|
|
123
123
|
}
|
|
124
|
-
case
|
|
124
|
+
case 'custom':
|
|
125
125
|
return isReactNode(modalContentConfig.content) ? modalContentConfig.content : /*#__PURE__*/ _jsx(modalContentConfig.content, _object_spread({
|
|
126
126
|
open: open,
|
|
127
127
|
close: close
|
|
@@ -216,13 +216,13 @@ var ModalProvider = function(param) {
|
|
|
216
216
|
children: [
|
|
217
217
|
children,
|
|
218
218
|
/*#__PURE__*/ _jsxs(Modal, {
|
|
219
|
-
scrollBehavior:
|
|
219
|
+
scrollBehavior: 'inside',
|
|
220
220
|
isCentered: true,
|
|
221
221
|
blockScrollOnMount: true,
|
|
222
222
|
closeOnOverlayClick: true,
|
|
223
223
|
size: (modalContentConfig === null || modalContentConfig === void 0 ? void 0 : modalContentConfig.size) || {
|
|
224
|
-
base:
|
|
225
|
-
md:
|
|
224
|
+
base: 'full',
|
|
225
|
+
md: '3xl'
|
|
226
226
|
},
|
|
227
227
|
isOpen: isOpen,
|
|
228
228
|
onClose: onClose,
|