blue-react 7.10.2 → 7.11.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.
@@ -44,7 +44,9 @@ function Modal(_ref) {
44
44
  unSetModalContent = _ref.unSetModalContent,
45
45
  onSubmit = _ref.onSubmit,
46
46
  defaultInput = _ref.defaultInput,
47
- type = _ref.type;
47
+ type = _ref.type,
48
+ _ref$inputType = _ref.inputType,
49
+ inputType = _ref$inputType === void 0 ? "text" : _ref$inputType;
48
50
  var modalRef = (0, _react.useRef)();
49
51
 
50
52
  var _useState = (0, _react.useState)(defaultInput || ""),
@@ -122,7 +124,7 @@ function Modal(_ref) {
122
124
  })), /*#__PURE__*/_react.default.createElement("div", {
123
125
  className: "modal-body"
124
126
  }, modalContent, type === "ask" && /*#__PURE__*/_react.default.createElement("input", {
125
- type: "text",
127
+ type: inputType,
126
128
  className: "form-control mt-1",
127
129
  value: input,
128
130
  onChange: function onChange(_ref2) {
@@ -53,19 +53,30 @@ var ModalProvider = function ModalProvider(props) {
53
53
  defaultInput = _useState6[0],
54
54
  setDefaultInput = _useState6[1];
55
55
 
56
+ var _useState7 = (0, _react.useState)(),
57
+ _useState8 = _slicedToArray(_useState7, 2),
58
+ inputType = _useState8[0],
59
+ setInputType = _useState8[1];
60
+
56
61
  var unSetModalContent = (0, _react.useCallback)(function () {
57
62
  setModalContent(undefined);
58
63
  }, [setModalContent]);
59
64
 
60
- var _useState7 = (0, _react.useState)(),
61
- _useState8 = _slicedToArray(_useState7, 2),
62
- onSubmit = _useState8[0],
63
- setOnSubmit = _useState8[1];
65
+ var _useState9 = (0, _react.useState)(),
66
+ _useState10 = _slicedToArray(_useState9, 2),
67
+ onSubmit = _useState10[0],
68
+ setOnSubmit = _useState10[1];
64
69
 
65
- var ask = function ask(text) {
70
+ var ask = function ask(text, options) {
66
71
  return new Promise(function (resolve) {
67
72
  setType("ask");
68
73
  setModalContent(text);
74
+
75
+ if (options) {
76
+ var _inputType = options.inputType;
77
+ setInputType(_inputType);
78
+ }
79
+
69
80
  setDefaultInput("");
70
81
  setOnSubmit(function () {
71
82
  return function (input) {
@@ -114,7 +125,8 @@ var ModalProvider = function ModalProvider(props) {
114
125
  unSetModalContent: unSetModalContent,
115
126
  onSubmit: onSubmit,
116
127
  defaultInput: defaultInput,
117
- type: type
128
+ type: type,
129
+ inputType: inputType
118
130
  }));
119
131
  };
120
132