blue-react 8.7.2 → 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.
@@ -136,7 +136,8 @@ function MenuItem(props) {
136
136
  draggable: props.draggable,
137
137
  "data-tooltip": props["data-tooltip"],
138
138
  disabled: props.disabled,
139
- style: props.style
139
+ style: props.style,
140
+ type: props.type
140
141
  }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
141
142
  className: (0, _clsx.default)("blue-menu-item-icon", {
142
143
  hasIconForActive: iconForActive
@@ -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: "text",
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 _useState11 = (0, _react.useState)(),
80
- _useState12 = _slicedToArray(_useState11, 2),
81
- onSubmit = _useState12[0],
82
- setOnSubmit = _useState12[1];
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, title, icon) {
89
+ var ask = function ask(text, options) {
85
90
  return new Promise(function (resolve) {
86
91
  setType("ask");
87
92
  setModalContent(text);
88
- setModalTitle(title);
89
- setModalIcon(icon);
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, title, icon) {
114
+ var tell = function tell(text, options) {
102
115
  return new Promise(function (resolve) {
103
116
  setType("tell");
104
117
  setModalContent(text);
105
- setModalTitle(title);
106
- setModalIcon(icon);
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, title, icon) {
135
+ var verify = function verify(text, options) {
117
136
  return new Promise(function (resolve) {
118
137
  setType("verify");
119
138
  setModalContent(text);
120
- setModalTitle(title);
121
- setModalIcon(icon);
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