blue-react 8.7.3 → 8.8.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/dist/components/Modal.js +4 -2
- package/dist/components/ModalProvider.js +40 -14
- package/dist/style.css +2 -2
- package/dist/style.min.css +2 -2
- package/dist/style.scss +1 -1
- package/dist/types/components/Modal.d.ts +2 -1
- package/dist/types/components/ModalProvider.d.ts +10 -3
- package/package.json +2 -2
package/dist/components/Modal.js
CHANGED
|
@@ -42,7 +42,9 @@ function Modal(_ref) {
|
|
|
42
42
|
unSetModalContent = _ref.unSetModalContent,
|
|
43
43
|
onSubmit = _ref.onSubmit,
|
|
44
44
|
defaultInput = _ref.defaultInput,
|
|
45
|
-
type = _ref.type
|
|
45
|
+
type = _ref.type,
|
|
46
|
+
_ref$inputType = _ref.inputType,
|
|
47
|
+
inputType = _ref$inputType === void 0 ? "text" : _ref$inputType;
|
|
46
48
|
var modalRef = (0, _react.useRef)();
|
|
47
49
|
|
|
48
50
|
var _useState = (0, _react.useState)(defaultInput || ""),
|
|
@@ -136,7 +138,7 @@ function Modal(_ref) {
|
|
|
136
138
|
whiteSpace: "pre-wrap"
|
|
137
139
|
}
|
|
138
140
|
}, modalContent, type === "ask" && /*#__PURE__*/_react.default.createElement("input", {
|
|
139
|
-
type:
|
|
141
|
+
type: inputType,
|
|
140
142
|
className: "form-control mt-1",
|
|
141
143
|
value: input,
|
|
142
144
|
onChange: function onChange(_ref2) {
|
|
@@ -72,21 +72,34 @@ var ModalProvider = function ModalProvider(_ref) {
|
|
|
72
72
|
defaultInput = _useState10[0],
|
|
73
73
|
setDefaultInput = _useState10[1];
|
|
74
74
|
|
|
75
|
+
var _useState11 = (0, _react.useState)(),
|
|
76
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
77
|
+
inputType = _useState12[0],
|
|
78
|
+
setInputType = _useState12[1];
|
|
79
|
+
|
|
75
80
|
var unSetModalContent = (0, _react.useCallback)(function () {
|
|
76
81
|
setModalContent(undefined);
|
|
77
82
|
}, [setModalContent]);
|
|
78
83
|
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
onSubmit =
|
|
82
|
-
setOnSubmit =
|
|
84
|
+
var _useState13 = (0, _react.useState)(),
|
|
85
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
86
|
+
onSubmit = _useState14[0],
|
|
87
|
+
setOnSubmit = _useState14[1];
|
|
83
88
|
|
|
84
|
-
var ask = function ask(text,
|
|
89
|
+
var ask = function ask(text, options) {
|
|
85
90
|
return new Promise(function (resolve) {
|
|
86
91
|
setType("ask");
|
|
87
92
|
setModalContent(text);
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
|
|
94
|
+
if (options) {
|
|
95
|
+
var title = options.title,
|
|
96
|
+
icon = options.icon,
|
|
97
|
+
_inputType = options.inputType;
|
|
98
|
+
setModalTitle(title);
|
|
99
|
+
setModalIcon(icon);
|
|
100
|
+
setInputType(_inputType);
|
|
101
|
+
}
|
|
102
|
+
|
|
90
103
|
setDefaultInput("");
|
|
91
104
|
setOnSubmit(function () {
|
|
92
105
|
return function (input) {
|
|
@@ -98,12 +111,18 @@ var ModalProvider = function ModalProvider(_ref) {
|
|
|
98
111
|
});
|
|
99
112
|
};
|
|
100
113
|
|
|
101
|
-
var tell = function tell(text,
|
|
114
|
+
var tell = function tell(text, options) {
|
|
102
115
|
return new Promise(function (resolve) {
|
|
103
116
|
setType("tell");
|
|
104
117
|
setModalContent(text);
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
|
|
119
|
+
if (options) {
|
|
120
|
+
var title = options.title,
|
|
121
|
+
icon = options.icon;
|
|
122
|
+
setModalTitle(title);
|
|
123
|
+
setModalIcon(icon);
|
|
124
|
+
}
|
|
125
|
+
|
|
107
126
|
setOnSubmit(function () {
|
|
108
127
|
return function (input) {
|
|
109
128
|
resolve(input ? true : false);
|
|
@@ -113,12 +132,18 @@ var ModalProvider = function ModalProvider(_ref) {
|
|
|
113
132
|
});
|
|
114
133
|
};
|
|
115
134
|
|
|
116
|
-
var verify = function verify(text,
|
|
135
|
+
var verify = function verify(text, options) {
|
|
117
136
|
return new Promise(function (resolve) {
|
|
118
137
|
setType("verify");
|
|
119
138
|
setModalContent(text);
|
|
120
|
-
|
|
121
|
-
|
|
139
|
+
|
|
140
|
+
if (options) {
|
|
141
|
+
var title = options.title,
|
|
142
|
+
icon = options.icon;
|
|
143
|
+
setModalTitle(title);
|
|
144
|
+
setModalIcon(icon);
|
|
145
|
+
}
|
|
146
|
+
|
|
122
147
|
setOnSubmit(function () {
|
|
123
148
|
return function (input) {
|
|
124
149
|
resolve(input ? true : false);
|
|
@@ -141,7 +166,8 @@ var ModalProvider = function ModalProvider(_ref) {
|
|
|
141
166
|
unSetModalContent: unSetModalContent,
|
|
142
167
|
onSubmit: onSubmit,
|
|
143
168
|
defaultInput: defaultInput,
|
|
144
|
-
type: type
|
|
169
|
+
type: type,
|
|
170
|
+
inputType: inputType
|
|
145
171
|
}));
|
|
146
172
|
};
|
|
147
173
|
|