versacall-core-library-react 2.0.46 → 2.0.48

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.
@@ -309,7 +309,7 @@ var CoreShiftTagFilter = /*#__PURE__*/function (_Component) {
309
309
  InputLabelProps: {
310
310
  shrink: true
311
311
  },
312
- placeholder: "Type in the filter here... Example: first OR second",
312
+ placeholder: "Type in the filter here... (ex: first OR second)",
313
313
  margin: "normal",
314
314
  fullWidth: true,
315
315
  multiline: true
@@ -80,6 +80,43 @@ function CoreToolbar(props) {
80
80
  intl = props.intl,
81
81
  classes = props.classes,
82
82
  showSeperator = props.showSeperator;
83
+
84
+ var handleKeyDown = function handleKeyDown(e) {
85
+ // NOTE: In theory it would be good to have a hotkey for the close button.
86
+ if (!props.disableHotkeys) {
87
+ // Look for CTRL+S or META+S
88
+ if ((window.navigator.platform.match('Mac') ? e.metaKey : e.ctrlKey) && e.keyCode === 83) {
89
+ // CTRL+S or META+S (Mac)
90
+ e.preventDefault();
91
+
92
+ if (!props.saveDisabled) {
93
+ props.handleSave();
94
+ }
95
+ /* } else if (e.altKey && e.keyCode === 115) {
96
+ // ALT+F4
97
+ e.preventDefault();
98
+ if (!props.closeDisabled) {
99
+ props.handleClose();
100
+ }
101
+ } else if (e.ctrlKey && e.keyCode === 115) {
102
+ // CTRL+F4
103
+ e.preventDefault();
104
+ if (!props.closeDisabled) {
105
+ props.handleClose();
106
+ } */
107
+
108
+ }
109
+ }
110
+ };
111
+
112
+ _react.default.useEffect(function () {
113
+ window.addEventListener('keydown', handleKeyDown); // cleanup
114
+
115
+ return function () {
116
+ window.removeEventListener('keydown', handleKeyDown);
117
+ };
118
+ }, []);
119
+
83
120
  return /*#__PURE__*/_react.default.createElement(_Toolbar.default, null, props.icon, /*#__PURE__*/_react.default.createElement(_Typography.default, {
84
121
  variant: "h6",
85
122
  color: "inherit",
@@ -103,7 +140,12 @@ function CoreToolbar(props) {
103
140
  id: "__print"
104
141
  })), (props.handlePrint || props.children) && (props.handleSave || props.handleClose) && showSeperator && /*#__PURE__*/_react.default.createElement("div", {
105
142
  className: classes.separator
106
- }), props.handleSave && /*#__PURE__*/_react.default.createElement(_Button.default, {
143
+ }), props.handleSave && /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
144
+ title: "".concat(intl.formatMessage({
145
+ id: '__save'
146
+ }), " (Ctrl+S)"),
147
+ "aria-label": "save"
148
+ }, /*#__PURE__*/_react.default.createElement(_Button.default, {
107
149
  variant: "contained",
108
150
  color: "primary",
109
151
  style: {
@@ -124,10 +166,11 @@ function CoreToolbar(props) {
124
166
  className: classes.iconStyle
125
167
  }), /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
126
168
  id: "__save"
127
- }))), props.handleClose && /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
169
+ })))), props.handleClose && /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
128
170
  title: intl.formatMessage({
129
171
  id: '__close'
130
- })
172
+ }),
173
+ "aria-label": "close"
131
174
  }, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
132
175
  color: "inherit",
133
176
  className: classes.closeIconStyle,
@@ -152,6 +195,7 @@ CoreToolbar.propTypes = {
152
195
  saveDisabled: _propTypes.default.bool,
153
196
  closeDisabled: _propTypes.default.bool,
154
197
  showSeperator: _propTypes.default.bool,
198
+ disableHotkeys: _propTypes.default.bool,
155
199
  intl: _propTypes.default.shape().isRequired,
156
200
  classes: _propTypes.default.shape().isRequired,
157
201
  children: _propTypes.default.node
@@ -167,6 +211,7 @@ CoreToolbar.defaultProps = {
167
211
  saveDisabled: false,
168
212
  closeDisabled: false,
169
213
  showSeperator: true,
214
+ disableHotkeys: false,
170
215
  children: null
171
216
  };
172
217
 
package/package.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "versacall": {
3
3
  "title": "Versacall Core Library React",
4
4
  "applicationType": "react-library",
5
- "build": 46
5
+ "build": 48
6
6
  },
7
7
  "name": "versacall-core-library-react",
8
- "version": "2.0.46",
8
+ "version": "2.0.48",
9
9
  "description": "Versacall Core Library",
10
10
  "main": "dist/index.js",
11
11
  "module": "dist/index.js",