@driveflux/ui 1.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +3 -0
- package/.swcrc +14 -0
- package/.turbo/turbo-build.log +6 -0
- package/CHANGELOG.md +12 -0
- package/dist/chakra.d.ts +2 -0
- package/dist/chakra.d.ts.map +1 -0
- package/dist/chakra.js +1 -0
- package/dist/cjs/chakra.js +18 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/modal/ModalProvider.js +254 -0
- package/dist/cjs/modal/components/EnhancedModalCustomWrapper.js +139 -0
- package/dist/cjs/modal/components/EnhancedModalFooter.js +167 -0
- package/dist/cjs/modal/components/MinimalModalContent.js +94 -0
- package/dist/cjs/modal/components/StandardModalContent.js +387 -0
- package/dist/cjs/modal/context.js +20 -0
- package/dist/cjs/modal/index.js +48 -0
- package/dist/cjs/modal/use-enhanced-modal.js +15 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/theme/colors.js +140 -0
- package/dist/cjs/theme/index.js +18 -0
- package/dist/cjs/toast/index.js +19 -0
- package/dist/cjs/toast/use-toast-result.js +255 -0
- package/dist/cjs/types.js +4 -0
- package/dist/cjs/utils/accessors.js +61 -0
- package/dist/cjs/utils/index.js +19 -0
- package/dist/cjs/utils/react.js +94 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/modal/ModalProvider.d.ts +4 -0
- package/dist/modal/ModalProvider.d.ts.map +1 -0
- package/dist/modal/ModalProvider.js +239 -0
- package/dist/modal/components/EnhancedModalCustomWrapper.d.ts +9 -0
- package/dist/modal/components/EnhancedModalCustomWrapper.d.ts.map +1 -0
- package/dist/modal/components/EnhancedModalCustomWrapper.js +124 -0
- package/dist/modal/components/EnhancedModalFooter.d.ts +12 -0
- package/dist/modal/components/EnhancedModalFooter.d.ts.map +1 -0
- package/dist/modal/components/EnhancedModalFooter.js +157 -0
- package/dist/modal/components/MinimalModalContent.d.ts +11 -0
- package/dist/modal/components/MinimalModalContent.d.ts.map +1 -0
- package/dist/modal/components/MinimalModalContent.js +84 -0
- package/dist/modal/components/StandardModalContent.d.ts +11 -0
- package/dist/modal/components/StandardModalContent.d.ts.map +1 -0
- package/dist/modal/components/StandardModalContent.js +377 -0
- package/dist/modal/context.d.ts +62 -0
- package/dist/modal/context.d.ts.map +1 -0
- package/dist/modal/context.js +10 -0
- package/dist/modal/index.d.ts +7 -0
- package/dist/modal/index.d.ts.map +1 -0
- package/dist/modal/index.js +6 -0
- package/dist/modal/use-enhanced-modal.d.ts +3 -0
- package/dist/modal/use-enhanced-modal.d.ts.map +1 -0
- package/dist/modal/use-enhanced-modal.js +5 -0
- package/dist/theme/colors.d.ts +148 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +130 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +1 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.d.ts.map +1 -0
- package/dist/toast/index.js +1 -0
- package/dist/toast/use-toast-result.d.ts +30 -0
- package/dist/toast/use-toast-result.d.ts.map +1 -0
- package/dist/toast/use-toast-result.js +232 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils/accessors.d.ts +24 -0
- package/dist/utils/accessors.d.ts.map +1 -0
- package/dist/utils/accessors.js +28 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/react.d.ts +5 -0
- package/dist/utils/react.d.ts.map +1 -0
- package/dist/utils/react.js +32 -0
- package/index.cjs +1 -0
- package/index.d.ts +1 -0
- package/modal.cjs +1 -0
- package/modal.d.ts +1 -0
- package/package.json +68 -0
- package/src/chakra.ts +1 -0
- package/src/index.ts +1 -0
- package/src/modal/ModalProvider.tsx +142 -0
- package/src/modal/components/EnhancedModalCustomWrapper.tsx +39 -0
- package/src/modal/components/EnhancedModalFooter.tsx +51 -0
- package/src/modal/components/MinimalModalContent.tsx +24 -0
- package/src/modal/components/StandardModalContent.tsx +65 -0
- package/src/modal/context.tsx +81 -0
- package/src/modal/index.ts +7 -0
- package/src/modal/use-enhanced-modal.ts +7 -0
- package/src/theme/colors.ts +171 -0
- package/src/theme/index.ts +1 -0
- package/src/toast/index.ts +3 -0
- package/src/toast/use-toast-result.tsx +169 -0
- package/src/types.ts +22 -0
- package/src/utils/accessors.ts +64 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/react.ts +32 -0
- package/theme.cjs +1 -0
- package/theme.d.ts +1 -0
- package/toast.cjs +1 -0
- package/toast.d.ts +1 -0
- package/tsconfig.json +14 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/utils.cjs +1 -0
- package/utils.d.ts +1 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "colors", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return colors;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var colors = {
|
|
12
|
+
/**
|
|
13
|
+
* #EFEFF0 Light Gray
|
|
14
|
+
*/ primary1: "#EFEFF0",
|
|
15
|
+
/**
|
|
16
|
+
* #CACACA Gray
|
|
17
|
+
*/ primary2: "#CACACA",
|
|
18
|
+
/**
|
|
19
|
+
* #585858 Dark Gray
|
|
20
|
+
*/ primary3: "#585858",
|
|
21
|
+
/**
|
|
22
|
+
* #191919 Soft Black
|
|
23
|
+
*/ primary4: "#191919",
|
|
24
|
+
/**
|
|
25
|
+
* #E55867 Red
|
|
26
|
+
*/ accent4: "#E55867",
|
|
27
|
+
/**
|
|
28
|
+
* #ADE0EE Light Blue
|
|
29
|
+
*/ links2: "#ADE0EE",
|
|
30
|
+
/**
|
|
31
|
+
* #50C8E8 Blue
|
|
32
|
+
*/ links: "#50C8E8",
|
|
33
|
+
/**
|
|
34
|
+
* #E24657 Red
|
|
35
|
+
*/ alert4: "#E24657",
|
|
36
|
+
/**
|
|
37
|
+
* #E24657 Red
|
|
38
|
+
*/ danger: "#E24657",
|
|
39
|
+
/**
|
|
40
|
+
* #F4B25C Yellow
|
|
41
|
+
*/ warning4: "#F4B25C",
|
|
42
|
+
/**
|
|
43
|
+
* #4FD9C2 Green
|
|
44
|
+
*/ success4: "#4FD9C2",
|
|
45
|
+
/**
|
|
46
|
+
* #4FD9C2 Green
|
|
47
|
+
*/ green: "#4FD9C2",
|
|
48
|
+
/**
|
|
49
|
+
* #3BD5BC Green
|
|
50
|
+
*/ // green: '#3BD5BC',
|
|
51
|
+
/**
|
|
52
|
+
* #000000 Black
|
|
53
|
+
*/ black: "#000000",
|
|
54
|
+
/**
|
|
55
|
+
* #ffffff White
|
|
56
|
+
*/ white: "#ffffff",
|
|
57
|
+
/**
|
|
58
|
+
* #E6E6E6 Light Gray
|
|
59
|
+
*/ whiteHover: "#E6E6E6",
|
|
60
|
+
/**
|
|
61
|
+
* #F4F4F4 Light Gray
|
|
62
|
+
*/ placeholder: "#F4F4F4",
|
|
63
|
+
/**
|
|
64
|
+
* #F9F7D7 Light Yellow
|
|
65
|
+
*/ highlight: "#F9F7D7",
|
|
66
|
+
primary: {
|
|
67
|
+
25: "#fafafa",
|
|
68
|
+
50: "#d6f5f0",
|
|
69
|
+
100: "#98e6d6",
|
|
70
|
+
200: "#191919",
|
|
71
|
+
300: "#191919",
|
|
72
|
+
400: "#3bd5bb",
|
|
73
|
+
500: "#000000",
|
|
74
|
+
600: "#000000",
|
|
75
|
+
700: "#000000",
|
|
76
|
+
800: "#000000",
|
|
77
|
+
900: "#000000"
|
|
78
|
+
},
|
|
79
|
+
success: {
|
|
80
|
+
50: "#d8f7f2",
|
|
81
|
+
100: "#98e6d6",
|
|
82
|
+
200: "#3bd5bc",
|
|
83
|
+
300: "#4FD9C2",
|
|
84
|
+
400: "#3bd5bb",
|
|
85
|
+
500: "#3bd5bb",
|
|
86
|
+
600: "#2EA692",
|
|
87
|
+
700: "#00825c",
|
|
88
|
+
800: "#00724d",
|
|
89
|
+
900: "#005530"
|
|
90
|
+
},
|
|
91
|
+
accent: {
|
|
92
|
+
50: "#fceaee",
|
|
93
|
+
100: "#f8cad3",
|
|
94
|
+
200: "#E55867",
|
|
95
|
+
300: "#E55867",
|
|
96
|
+
400: "#E24657",
|
|
97
|
+
500: "#E24657",
|
|
98
|
+
600: "#d8253f",
|
|
99
|
+
700: "#c61a38",
|
|
100
|
+
800: "#b91231",
|
|
101
|
+
900: "#aa0026"
|
|
102
|
+
},
|
|
103
|
+
warning: {
|
|
104
|
+
50: "#FDF0DE",
|
|
105
|
+
100: "#F4B25C",
|
|
106
|
+
200: "#F4B25C",
|
|
107
|
+
300: "#F4B25C",
|
|
108
|
+
400: "#F4B25C",
|
|
109
|
+
500: "#F4B25C",
|
|
110
|
+
600: "#BF7F2C",
|
|
111
|
+
700: "#F4B25C",
|
|
112
|
+
800: "#F4B25C",
|
|
113
|
+
900: "#F4B25C"
|
|
114
|
+
},
|
|
115
|
+
info: {
|
|
116
|
+
25: "#50C8E81A",
|
|
117
|
+
50: "#CDF1FA",
|
|
118
|
+
100: "#50C8E8",
|
|
119
|
+
200: "#50C8E8",
|
|
120
|
+
300: "#50C8E8",
|
|
121
|
+
400: "#50C8E8",
|
|
122
|
+
500: "#50C8E8",
|
|
123
|
+
600: "#3EA5C0",
|
|
124
|
+
700: "#50C8E8",
|
|
125
|
+
800: "#50C8E8",
|
|
126
|
+
900: "#50C8E8"
|
|
127
|
+
},
|
|
128
|
+
alert: {
|
|
129
|
+
50: "#E24657",
|
|
130
|
+
100: "#E24657",
|
|
131
|
+
200: "#E24657",
|
|
132
|
+
300: "#E24657",
|
|
133
|
+
400: "#E24657",
|
|
134
|
+
500: "#E24657",
|
|
135
|
+
600: "#E24657",
|
|
136
|
+
700: "#E24657",
|
|
137
|
+
800: "#E24657",
|
|
138
|
+
900: "#E24657"
|
|
139
|
+
}
|
|
140
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./colors"), 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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./use-toast-result.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
|
+
}
|
|
19
|
+
// TODO: Add the ToastBox component here
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getValidationErrorsList: function() {
|
|
13
|
+
return getValidationErrorsList;
|
|
14
|
+
},
|
|
15
|
+
useToastResult: function() {
|
|
16
|
+
return useToastResult;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
20
|
+
var _macro = require("@lingui/macro");
|
|
21
|
+
var _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge.js"));
|
|
22
|
+
var _react = require("react");
|
|
23
|
+
var _chakra = require("../chakra.js");
|
|
24
|
+
var _accessors = require("../utils/accessors.js");
|
|
25
|
+
function _define_property(obj, key, value) {
|
|
26
|
+
if (key in obj) {
|
|
27
|
+
Object.defineProperty(obj, key, {
|
|
28
|
+
value: value,
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true
|
|
32
|
+
});
|
|
33
|
+
} else {
|
|
34
|
+
obj[key] = value;
|
|
35
|
+
}
|
|
36
|
+
return obj;
|
|
37
|
+
}
|
|
38
|
+
function _interop_require_default(obj) {
|
|
39
|
+
return obj && obj.__esModule ? obj : {
|
|
40
|
+
default: obj
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function _object_spread(target) {
|
|
44
|
+
for(var i = 1; i < arguments.length; i++){
|
|
45
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
46
|
+
var ownKeys = Object.keys(source);
|
|
47
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
48
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
49
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
ownKeys.forEach(function(key) {
|
|
53
|
+
_define_property(target, key, source[key]);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return target;
|
|
57
|
+
}
|
|
58
|
+
function ownKeys(object, enumerableOnly) {
|
|
59
|
+
var keys = Object.keys(object);
|
|
60
|
+
if (Object.getOwnPropertySymbols) {
|
|
61
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
62
|
+
if (enumerableOnly) {
|
|
63
|
+
symbols = symbols.filter(function(sym) {
|
|
64
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
keys.push.apply(keys, symbols);
|
|
68
|
+
}
|
|
69
|
+
return keys;
|
|
70
|
+
}
|
|
71
|
+
function _object_spread_props(target, source) {
|
|
72
|
+
source = source != null ? source : {};
|
|
73
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
74
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
75
|
+
} else {
|
|
76
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
77
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return target;
|
|
81
|
+
}
|
|
82
|
+
function _object_without_properties(source, excluded) {
|
|
83
|
+
if (source == null) return {};
|
|
84
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
85
|
+
var key, i;
|
|
86
|
+
if (Object.getOwnPropertySymbols) {
|
|
87
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
88
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
89
|
+
key = sourceSymbolKeys[i];
|
|
90
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
91
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
92
|
+
target[key] = source[key];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return target;
|
|
96
|
+
}
|
|
97
|
+
function _object_without_properties_loose(source, excluded) {
|
|
98
|
+
if (source == null) return {};
|
|
99
|
+
var target = {};
|
|
100
|
+
var sourceKeys = Object.keys(source);
|
|
101
|
+
var key, i;
|
|
102
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
103
|
+
key = sourceKeys[i];
|
|
104
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
105
|
+
target[key] = source[key];
|
|
106
|
+
}
|
|
107
|
+
return target;
|
|
108
|
+
}
|
|
109
|
+
function _tagged_template_literal(strings, raw) {
|
|
110
|
+
if (!raw) {
|
|
111
|
+
raw = strings.slice(0);
|
|
112
|
+
}
|
|
113
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
114
|
+
raw: {
|
|
115
|
+
value: Object.freeze(raw)
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
function _templateObject() {
|
|
120
|
+
var data = _tagged_template_literal([
|
|
121
|
+
"Success"
|
|
122
|
+
]);
|
|
123
|
+
_templateObject = function _templateObject() {
|
|
124
|
+
return data;
|
|
125
|
+
};
|
|
126
|
+
return data;
|
|
127
|
+
}
|
|
128
|
+
function _templateObject1() {
|
|
129
|
+
var data = _tagged_template_literal([
|
|
130
|
+
"The operation was done successfully"
|
|
131
|
+
]);
|
|
132
|
+
_templateObject1 = function _templateObject() {
|
|
133
|
+
return data;
|
|
134
|
+
};
|
|
135
|
+
return data;
|
|
136
|
+
}
|
|
137
|
+
function _templateObject2() {
|
|
138
|
+
var data = _tagged_template_literal([
|
|
139
|
+
"Operation Failed"
|
|
140
|
+
]);
|
|
141
|
+
_templateObject2 = function _templateObject() {
|
|
142
|
+
return data;
|
|
143
|
+
};
|
|
144
|
+
return data;
|
|
145
|
+
}
|
|
146
|
+
function _templateObject3() {
|
|
147
|
+
var data = _tagged_template_literal([
|
|
148
|
+
"There was a problem while performing this operation"
|
|
149
|
+
]);
|
|
150
|
+
_templateObject3 = function _templateObject() {
|
|
151
|
+
return data;
|
|
152
|
+
};
|
|
153
|
+
return data;
|
|
154
|
+
}
|
|
155
|
+
var accessStatus = function(s, data) {
|
|
156
|
+
return typeof s === "function" ? s(data) : s;
|
|
157
|
+
};
|
|
158
|
+
var defaultUseToastResultOptions = {
|
|
159
|
+
success: {
|
|
160
|
+
status: "success",
|
|
161
|
+
title: (0, _macro.t)(_templateObject()),
|
|
162
|
+
description: (0, _macro.t)(_templateObject1()),
|
|
163
|
+
isClosable: true
|
|
164
|
+
},
|
|
165
|
+
error: {
|
|
166
|
+
status: "error",
|
|
167
|
+
title: (0, _macro.t)(_templateObject2()),
|
|
168
|
+
defaultDescription: (0, _macro.t)(_templateObject3()),
|
|
169
|
+
showValidationErrors: true,
|
|
170
|
+
isClosable: true
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
var getValidationErrorsList = function(validation) {
|
|
174
|
+
return Object.values(validation.fieldErrors).map(function(v) {
|
|
175
|
+
return v.map(function(vd) {
|
|
176
|
+
return vd.message;
|
|
177
|
+
});
|
|
178
|
+
}).flat();
|
|
179
|
+
};
|
|
180
|
+
var accessOptions = function(options, data) {
|
|
181
|
+
if (!options) {
|
|
182
|
+
return options;
|
|
183
|
+
}
|
|
184
|
+
return _object_spread_props(_object_spread({}, options), {
|
|
185
|
+
status: accessStatus(options.status, data),
|
|
186
|
+
title: (0, _accessors.accessReactNode)(options.title, data),
|
|
187
|
+
description: (0, _accessors.accessReactNode)(options.description, data)
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
var useToastResult = function(options) {
|
|
191
|
+
var originalToast = (0, _chakra.useToast)(accessOptions(options === null || options === void 0 ? void 0 : options.defaultOptions));
|
|
192
|
+
var toastProblem = (0, _react.useCallback)(function(problem, providedOptions) {
|
|
193
|
+
var _merge1 = (0, _merge.default)({}, defaultUseToastResultOptions.error, providedOptions), description = _merge1.description, defaultDescription = _merge1.defaultDescription, showValidationErrors = _merge1.showValidationErrors, rest = _object_without_properties(_merge1, [
|
|
194
|
+
"description",
|
|
195
|
+
"defaultDescription",
|
|
196
|
+
"showValidationErrors"
|
|
197
|
+
]);
|
|
198
|
+
var problemMessage = problem.message || defaultDescription;
|
|
199
|
+
return originalToast(_object_spread_props(_object_spread({}, accessOptions(rest, problem)), {
|
|
200
|
+
description: (0, _accessors.accessReactNode)(description, problem) || /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Box, {
|
|
201
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
202
|
+
children: [
|
|
203
|
+
problemMessage && /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.Text, {
|
|
204
|
+
color: "inherit",
|
|
205
|
+
children: problemMessage
|
|
206
|
+
}),
|
|
207
|
+
problem.validation && showValidationErrors && /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.UnorderedList, {
|
|
208
|
+
color: "inherit",
|
|
209
|
+
children: getValidationErrorsList(problem.validation).map(function(message, i) {
|
|
210
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_chakra.ListItem, {
|
|
211
|
+
children: message
|
|
212
|
+
}, i);
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
]
|
|
216
|
+
})
|
|
217
|
+
})
|
|
218
|
+
}));
|
|
219
|
+
}, [
|
|
220
|
+
originalToast
|
|
221
|
+
]);
|
|
222
|
+
var toastError = (0, _react.useCallback)(function(providedOptions) {
|
|
223
|
+
var _$options = accessOptions((0, _merge.default)({}, defaultUseToastResultOptions.error, providedOptions));
|
|
224
|
+
return originalToast(_object_spread({}, _$options));
|
|
225
|
+
}, [
|
|
226
|
+
originalToast
|
|
227
|
+
]);
|
|
228
|
+
var toastSuccess = (0, _react.useCallback)(function(providedOptions) {
|
|
229
|
+
var _$options = accessOptions((0, _merge.default)({}, defaultUseToastResultOptions.success, providedOptions));
|
|
230
|
+
return originalToast(_object_spread({}, _$options));
|
|
231
|
+
}, [
|
|
232
|
+
originalToast
|
|
233
|
+
]);
|
|
234
|
+
var toastResult = (0, _react.useCallback)(function(result, generalToastOptions) {
|
|
235
|
+
var _$options = (0, _merge.default)({}, defaultUseToastResultOptions, generalToastOptions || defaultUseToastResultOptions);
|
|
236
|
+
var toastType = result.ok ? "success" : "error";
|
|
237
|
+
var toastOptions = typeof generalToastOptions === "undefined" || generalToastOptions[toastType] === null ? null : _$options[toastType];
|
|
238
|
+
if (!toastOptions) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
var finalToastOptions = _object_spread({}, accessOptions(typeof toastOptions === "boolean" ? defaultUseToastResultOptions[toastType] : toastOptions, result.val));
|
|
242
|
+
return result.ok ? toastSuccess(finalToastOptions) : toastProblem(result.val, finalToastOptions);
|
|
243
|
+
}, [
|
|
244
|
+
originalToast,
|
|
245
|
+
toastProblem,
|
|
246
|
+
toastSuccess
|
|
247
|
+
]);
|
|
248
|
+
return {
|
|
249
|
+
toastProblem: toastProblem,
|
|
250
|
+
toastSuccess: toastSuccess,
|
|
251
|
+
toastResult: toastResult,
|
|
252
|
+
toastError: toastError,
|
|
253
|
+
toast: originalToast
|
|
254
|
+
};
|
|
255
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
accessBoolean: function() {
|
|
13
|
+
return accessBoolean;
|
|
14
|
+
},
|
|
15
|
+
accessFunction: function() {
|
|
16
|
+
return accessFunction;
|
|
17
|
+
},
|
|
18
|
+
accessQuery: function() {
|
|
19
|
+
return accessQuery;
|
|
20
|
+
},
|
|
21
|
+
accessReactNode: function() {
|
|
22
|
+
return accessReactNode;
|
|
23
|
+
},
|
|
24
|
+
accessSelf: function() {
|
|
25
|
+
return accessSelf;
|
|
26
|
+
},
|
|
27
|
+
accessString: function() {
|
|
28
|
+
return accessString;
|
|
29
|
+
},
|
|
30
|
+
accessStringOrNull: function() {
|
|
31
|
+
return accessStringOrNull;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var accessSelf = function(s, data, defaultValue) {
|
|
35
|
+
if (!s) {
|
|
36
|
+
return defaultValue;
|
|
37
|
+
}
|
|
38
|
+
return typeof s === "function" ? s(data) : s;
|
|
39
|
+
};
|
|
40
|
+
var accessBoolean = function(s, data, defaultBoolean) {
|
|
41
|
+
return accessSelf(s, data, defaultBoolean);
|
|
42
|
+
};
|
|
43
|
+
var accessString = function(s, data, defaultText) {
|
|
44
|
+
return accessSelf(s, data, defaultText);
|
|
45
|
+
};
|
|
46
|
+
var accessStringOrNull = function(s, data) {
|
|
47
|
+
var defaultText = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
|
|
48
|
+
return accessSelf(s, data, defaultText);
|
|
49
|
+
};
|
|
50
|
+
var accessQuery = function(s, data, defaultQuery) {
|
|
51
|
+
return accessSelf(s, data, defaultQuery);
|
|
52
|
+
};
|
|
53
|
+
var accessReactNode = function(s, data, defaultNode) {
|
|
54
|
+
return accessSelf(s, data, defaultNode);
|
|
55
|
+
};
|
|
56
|
+
var accessFunction = function(f, data, defaultFunction) {
|
|
57
|
+
if (!f) {
|
|
58
|
+
return defaultFunction;
|
|
59
|
+
}
|
|
60
|
+
return typeof f === "object" && "generateFunction" in f ? f.generateFunction(data) : f;
|
|
61
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./accessors.js"), exports);
|
|
6
|
+
_export_star(require("./react.js"), exports);
|
|
7
|
+
function _export_star(from, to) {
|
|
8
|
+
Object.keys(from).forEach(function(k) {
|
|
9
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
10
|
+
Object.defineProperty(to, k, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return from[k];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return from;
|
|
19
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
isReactComponent: function() {
|
|
13
|
+
return isReactComponent;
|
|
14
|
+
},
|
|
15
|
+
isReactElement: function() {
|
|
16
|
+
return isReactElement;
|
|
17
|
+
},
|
|
18
|
+
isReactNode: function() {
|
|
19
|
+
return isReactNode;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
23
|
+
function _instanceof(left, right) {
|
|
24
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
25
|
+
return !!right[Symbol.hasInstance](left);
|
|
26
|
+
} else {
|
|
27
|
+
return left instanceof right;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
31
|
+
if (typeof WeakMap !== "function") return null;
|
|
32
|
+
var cacheBabelInterop = new WeakMap();
|
|
33
|
+
var cacheNodeInterop = new WeakMap();
|
|
34
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
35
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
36
|
+
})(nodeInterop);
|
|
37
|
+
}
|
|
38
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
39
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
40
|
+
return obj;
|
|
41
|
+
}
|
|
42
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
43
|
+
return {
|
|
44
|
+
default: obj
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
48
|
+
if (cache && cache.has(obj)) {
|
|
49
|
+
return cache.get(obj);
|
|
50
|
+
}
|
|
51
|
+
var newObj = {
|
|
52
|
+
__proto__: null
|
|
53
|
+
};
|
|
54
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
55
|
+
for(var key in obj){
|
|
56
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
57
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
58
|
+
if (desc && (desc.get || desc.set)) {
|
|
59
|
+
Object.defineProperty(newObj, key, desc);
|
|
60
|
+
} else {
|
|
61
|
+
newObj[key] = obj[key];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
newObj.default = obj;
|
|
66
|
+
if (cache) {
|
|
67
|
+
cache.set(obj, newObj);
|
|
68
|
+
}
|
|
69
|
+
return newObj;
|
|
70
|
+
}
|
|
71
|
+
function isReactComponent(Component) {
|
|
72
|
+
return typeof Component === "function" && // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- React component, it's fine
|
|
73
|
+
(_instanceof(Component.prototype, _react.default.Component) || Component.displayName !== undefined);
|
|
74
|
+
}
|
|
75
|
+
function isReactElement(element) {
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- isValidElement is a validation function
|
|
77
|
+
return (0, _react.isValidElement)(element);
|
|
78
|
+
}
|
|
79
|
+
function isReactNode(node) {
|
|
80
|
+
if (// eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- isValidElement is a validation function
|
|
81
|
+
(0, _react.isValidElement)(node) || // Check if it's a React element
|
|
82
|
+
typeof node === "string" || // Check if it's a string
|
|
83
|
+
typeof node === "number" // Check if it's a number
|
|
84
|
+
) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
// Check if it's an array of React nodes
|
|
88
|
+
if (Array.isArray(node) && node.every(function(element) {
|
|
89
|
+
return isReactNode(element);
|
|
90
|
+
})) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./chakra.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalProvider.d.ts","sourceRoot":"","sources":["../../src/modal/ModalProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkC,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAA;AA+BvF,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,iBAAiB,CA2GxC,CAAA;AAED,eAAe,aAAa,CAAA"}
|