@qualtrics/plugin-ui-react 1.4.0-alpha.0 → 1.4.0-alpha.2

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.
Files changed (26) hide show
  1. package/.dockerignore +1 -3
  2. package/.eslintignore +3 -0
  3. package/CHANGELOG.md +20 -0
  4. package/Dockerfile +5 -8
  5. package/Makefile +9 -17
  6. package/dist/common/capture-event/capture-event.d.ts +10 -6
  7. package/dist/common/field-mapper/field-mapper-key/field-mapper-key.d.ts +3 -3
  8. package/dist/common/field-mapper/field-mapper-row/field-mapper-row.d.ts +3 -2
  9. package/dist/common/field-mapper/field-mapper.d.ts +1 -1
  10. package/dist/common/piped-text-select/piped-text-menu/embedded-data-menu/embedded-data-input/embedded-data-input.d.ts +10 -0
  11. package/dist/common/piped-text-select/piped-text-menu/embedded-data-menu/embedded-data-menu.d.ts +15 -2
  12. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-item/piped-text-menu-item.d.ts +10 -7
  13. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-item-service.d.ts +7 -0
  14. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-keyboard-ctrl.d.ts +27 -0
  15. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-list/piped-text-menu-list.d.ts +24 -0
  16. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-list/piped-text-menu-load-error/piped-text-menu-load-error.d.ts +7 -0
  17. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu-list/piped-text-search-input/piped-text-search-input.d.ts +10 -0
  18. package/dist/common/piped-text-select/piped-text-menu/piped-text-menu.d.ts +26 -4
  19. package/dist/common/piped-text-select/piped-text-menu/piped-text-submenu-item/piped-text-submenu-item.d.ts +7 -4
  20. package/dist/common/popover/popover-options.d.ts +3 -0
  21. package/dist/lib/merge-refs.d.ts +2 -0
  22. package/dist/main.es.js +1074 -640
  23. package/dist/main.js +1072 -638
  24. package/jenkins.groovy +13 -7
  25. package/jenkinsPipelineUtils/pipelineControls.groovy +8 -0
  26. package/package.json +2 -1
package/dist/main.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @license @qualtrics/plugin-ui-react 1.4.0-alpha.0
1
+ /*! @license @qualtrics/plugin-ui-react 1.4.0-alpha.2
2
2
  Qualtrics Software License Agreement
3
3
 
4
4
  1. General.
@@ -64,23 +64,22 @@ var _get = require('lodash.get');
64
64
  var uiReact = require('@qualtrics/ui-react');
65
65
  var icons = require('@qualtrics/ui-react/icons');
66
66
  require('core-js/modules/es.string.anchor.js');
67
- require('core-js/modules/es.array.filter.js');
68
- require('core-js/modules/es.string.trim.js');
69
- require('core-js/modules/es.array.map.js');
70
- require('core-js/modules/es.array.concat.js');
71
67
  var _cloneDeep = require('lodash.clonedeep');
68
+ require('core-js/modules/es.array.concat.js');
72
69
  require('core-js/modules/es.array.is-array.js');
73
70
  var reactPopper = require('react-popper');
74
71
  var ReactDOM = require('react-dom');
75
- require('core-js/modules/web.timers.js');
76
72
  var uuid = require('uuid');
73
+ require('core-js/modules/es.array.map.js');
77
74
  require('core-js/modules/es.function.name.js');
78
75
  require('core-js/modules/es.array.slice.js');
79
76
  require('core-js/modules/es.array.iterator.js');
80
77
  require('core-js/modules/web.dom-collections.iterator.js');
81
78
  require('core-js/modules/es.array.find.js');
82
79
  require('core-js/modules/es.object.assign.js');
80
+ require('core-js/modules/es.array.filter.js');
83
81
  var _cloneDeepWith = require('lodash.clonedeepwith');
82
+ require('core-js/modules/es.string.trim.js');
84
83
  require('core-js/modules/es.regexp.exec.js');
85
84
  require('core-js/modules/es.string.search.js');
86
85
 
@@ -120,8 +119,8 @@ function styleInject(css, ref) {
120
119
  }
121
120
  }
122
121
 
123
- var css_248z$j = ".react-app {\n background-color: RGBA(0, 0, 0, 0.1); }\n";
124
- styleInject(css_248z$j);
122
+ var css_248z$m = ".react-app {\n background-color: RGBA(0, 0, 0, 0.1); }\n";
123
+ styleInject(css_248z$m);
125
124
 
126
125
  function ownKeys(object, enumerableOnly) {
127
126
  var keys = Object.keys(object);
@@ -909,6 +908,7 @@ var languageCodeMapping = {
909
908
  'ES-ES': 'es-419',
910
909
  FI: 'fi',
911
910
  FR: 'fr',
911
+ 'FR-CA': 'fr-CA',
912
912
  ID: 'id',
913
913
  IT: 'it',
914
914
  JA: 'ja',
@@ -972,6 +972,54 @@ function __rest(s, e) {
972
972
  t[p[i]] = s[p[i]];
973
973
  }
974
974
  return t;
975
+ }
976
+
977
+ function __awaiter(thisArg, _arguments, P, generator) {
978
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
979
+ return new (P || (P = Promise))(function (resolve, reject) {
980
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
981
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
982
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
983
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
984
+ });
985
+ }
986
+
987
+ function __generator(thisArg, body) {
988
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
989
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
990
+ function verb(n) { return function (v) { return step([n, v]); }; }
991
+ function step(op) {
992
+ if (f) throw new TypeError("Generator is already executing.");
993
+ while (_) try {
994
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
995
+ if (y = 0, t) op = [op[0] & 2, t.value];
996
+ switch (op[0]) {
997
+ case 0: case 1: t = op; break;
998
+ case 4: _.label++; return { value: op[1], done: false };
999
+ case 5: _.label++; y = op[1]; op = [0]; continue;
1000
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
1001
+ default:
1002
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1003
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1004
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1005
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1006
+ if (t[2]) _.ops.pop();
1007
+ _.trys.pop(); continue;
1008
+ }
1009
+ op = body.call(thisArg, _);
1010
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1011
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1012
+ }
1013
+ }
1014
+
1015
+ function __spreadArray(to, from, pack) {
1016
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1017
+ if (ar || !(i in from)) {
1018
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1019
+ ar[i] = from[i];
1020
+ }
1021
+ }
1022
+ return to.concat(ar || Array.prototype.slice.call(from));
975
1023
  }
976
1024
 
977
1025
  var Portal = function (_Component) {
@@ -1017,8 +1065,8 @@ var Portal = function (_Component) {
1017
1065
  return Portal;
1018
1066
  }(React.Component);
1019
1067
 
1020
- var css_248z$i = ".q-popover {\n position: absolute;\n z-index: 1000;\n padding: 4px 0;\n font-size: 14px;\n line-height: 20px;\n color: #32363A;\n fill: #333;\n list-style: none;\n min-width: 160px;\n max-width: 500px;\n min-height: 10px;\n max-height: 99%;\n background: #fff;\n border-radius: 4px;\n box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 0px 10px 1px rgba(0, 0, 0, 0.14), 0 0px 10px 2px rgba(0, 0, 0, 0.12);\n z-index: 9000; }\n\nbody .q-popover {\n max-height: 50vh;\n overflow-y: scroll;\n max-width: 30vw; }\n";
1021
- styleInject(css_248z$i);
1068
+ var css_248z$l = ".q-popover {\n position: absolute;\n z-index: 1000;\n padding: 4px 0;\n font-size: 14px;\n line-height: 20px;\n color: #32363A;\n fill: #333;\n list-style: none;\n min-width: 160px;\n max-width: 500px;\n min-height: 10px;\n max-height: 99%;\n background: #fff;\n border-radius: 4px;\n box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 0px 10px 1px rgba(0, 0, 0, 0.14), 0 0px 10px 2px rgba(0, 0, 0, 0.12);\n z-index: 9000; }\n\nbody .q-popover {\n max-height: 50vh;\n overflow-y: scroll;\n max-width: 30vw; }\n";
1069
+ styleInject(css_248z$l);
1022
1070
 
1023
1071
  var globalClickRegistry = new EventRegistry();
1024
1072
  var DEFAULT_PLACEMENT = 'bottom-start';
@@ -1132,92 +1180,8 @@ function initGlobalListener() {
1132
1180
  });
1133
1181
  }
1134
1182
 
1135
- var css_248z$h = "div[role=\"menu\"] .piped-text-search-input-container {\n padding: 5px 10px; }\n\n.piped-text-search-input {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .piped-text-search-input input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n\n.piped-text-menu-empty-anchor {\n /* the margin-right hack was not in harmony with tao.\n now, the empty-anchor is truly empty */ }\n\n.piped-text-submenu-item-container {\n position: relative; }\n .piped-text-submenu-item-container .piped-text-menu .piped-text-submenu-anchor {\n position: absolute;\n z-index: -1;\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n min-width: 100%; }\n\n.piped-text-menu-item, .piped-text-submenu-item {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis; }\n .piped-text-menu-item:not(.piped-text-header):not(.piped-text-disabled):hover, .piped-text-submenu-item:not(.piped-text-header):not(.piped-text-disabled):hover {\n cursor: pointer;\n background: RGBA(50, 54, 58, 0.08); }\n .piped-text-menu-item.piped-text-header, .piped-text-submenu-item.piped-text-header {\n font-size: 12px;\n line-height: 16px;\n font-weight: 700;\n padding: 12px; }\n .piped-text-menu-item.piped-text-disabled:not(.piped-text-header), .piped-text-submenu-item.piped-text-disabled:not(.piped-text-header) {\n color: RGB(116, 119, 122); }\n\n.piped-text-submenu-item {\n padding-right: 24px; }\n\n.piped-text-information-message {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n color: #74777A;\n text-align: center;\n white-space: pre-line; }\n\n.piped-text-loading-spinner {\n width: fit-content;\n margin: 0 auto; }\n\n.piped-text-error-container {\n color: #BB0000; }\n .piped-text-error-container .piped-text-error-icon {\n padding: 8px 0; }\n .piped-text-error-container .piped-text-error-icon svg {\n fill: #BB0000;\n display: block;\n margin: 0 auto; }\n .piped-text-error-container .piped-text-error-text {\n text-align: center;\n white-space: pre-line;\n padding: 0 12px 8px; }\n\n.embedded-data-menu {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .embedded-data-menu input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n";
1136
- styleInject(css_248z$h);
1137
-
1138
- var EmbeddedDataMenu = React__default["default"].forwardRef(function EmbeddedDataMeny(props, ref) {
1139
- var _useState = React.useState(''),
1140
- _useState2 = _slicedToArray(_useState, 2),
1141
- inputValue = _useState2[0],
1142
- setInputValue = _useState2[1];
1143
-
1144
- var _useState3 = React.useState(false),
1145
- _useState4 = _slicedToArray(_useState3, 2),
1146
- isInputInvalid = _useState4[0],
1147
- setIsInputInvalid = _useState4[1];
1148
-
1149
- var inputRef = React.useRef();
1150
- var anchor = props.anchor;
1151
-
1152
- var onClose = props.onClose || function () {};
1153
-
1154
- var popoverClassName = 'embedded-data-menu-content';
1155
- var ignoreClickSelector = popoverClassName;
1156
-
1157
- var onSelect = props.onSelect || function () {};
1158
-
1159
- React.useEffect(function () {
1160
- setTimeout(function () {
1161
- if (_get__default["default"](inputRef, 'current.focus') !== undefined) {
1162
- inputRef.current.focus();
1163
- }
1164
- });
1165
- }, [props.show]);
1166
-
1167
- var handleInputChange = function handleInputChange($e) {
1168
- var inputValue = ($e.target.value || '').trim();
1169
- var uriEncodedValue = encodeURIComponent(inputValue);
1170
- setInputValue(uriEncodedValue);
1171
-
1172
- if (uriEncodedValue.length > 0 && isInputInvalid) {
1173
- setIsInputInvalid(false);
1174
- }
1175
- };
1176
-
1177
- var handleAddButtonClick = function handleAddButtonClick() {
1178
- var locatorString;
1179
-
1180
- if ((inputValue || '').trim().length < 1) {
1181
- setIsInputInvalid(true);
1182
- return;
1183
- }
1184
-
1185
- locatorString = "${e://Field/".concat(inputValue, "}");
1186
- onSelect(locatorString);
1187
- };
1188
-
1189
- var handleInputKeyDown = function handleInputKeyDown($e) {
1190
- var key = $e.key;
1191
-
1192
- if (key !== 'Enter') {
1193
- return;
1194
- }
1195
-
1196
- handleAddButtonClick();
1197
- };
1198
-
1199
- return React__default["default"].createElement(Popover, {
1200
- show: props.show,
1201
- anchor: anchor,
1202
- onClose: onClose,
1203
- ignoreClickSelector: ignoreClickSelector,
1204
- placement: props.placement || 'right-start'
1205
- }, React__default["default"].createElement("div", {
1206
- className: "embedded-data-menu",
1207
- ref: ref
1208
- }, React__default["default"].createElement("div", null, React__default["default"].createElement(uiReact.InputGroup, null, React__default["default"].createElement(uiReact.Input, {
1209
- onChange: handleInputChange,
1210
- invalid: isInputInvalid,
1211
- onKeyDown: handleInputKeyDown,
1212
- ref: inputRef,
1213
- className: "q-plugin-popover-input"
1214
- }), React__default["default"].createElement(uiReact.Button, {
1215
- kind: "primary",
1216
- onClick: handleAddButtonClick
1217
- }, React__default["default"].createElement(uiReact.Icon, {
1218
- type: uiReact.IconTypes.Add
1219
- }))))));
1220
- });
1183
+ var css_248z$k = ".piped-text-menu-list .piped-text-popover-menu > * {\n min-height: 32px; }\n";
1184
+ styleInject(css_248z$k);
1221
1185
 
1222
1186
  /**
1223
1187
  * Copied from: https://gitlab-app.eng.qops.net/cfe/ui/-/blob/master/packages/ui-react/src/hooks/useId/useId.js
@@ -1232,58 +1196,494 @@ function useId(defaultExternalId) {
1232
1196
  return currentId;
1233
1197
  }
1234
1198
 
1235
- var css_248z$g = "";
1236
- styleInject(css_248z$g);
1199
+ var css_248z$j = "";
1200
+ styleInject(css_248z$j);
1237
1201
 
1238
- var css_248z$f = "";
1239
- styleInject(css_248z$f);
1202
+ function PipedTextMenuLoadError(props) {
1203
+ return (React__default["default"].createElement("div", { className: "piped-text-popover-container" },
1204
+ React__default["default"].createElement("div", { className: "piped-text-error-container" },
1205
+ React__default["default"].createElement("div", { className: "piped-text-error-icon" },
1206
+ React__default["default"].createElement(icons.ErrorIcon, { size: "medium" })),
1207
+ props.errorText && (React__default["default"].createElement("div", { className: "piped-text-error-text" }, props.errorText)))));
1208
+ }
1209
+
1210
+ var EMBEDDED_DATA_LOCATOR = 'embeddedData';
1211
+ function checkEmbeddedDataMenuItem(menuItem) {
1212
+ return menuItem.value === EMBEDDED_DATA_LOCATOR;
1213
+ }
1214
+ function checkDecoratedMenuItem(menuItem) {
1215
+ return (menuItem.header === true)
1216
+ || (menuItem.disabled === true);
1217
+ }
1218
+ function checkSubmenuMenuItemItem(menuItem) {
1219
+ return !!menuItem.hasSubmenu;
1220
+ }
1221
+ function checkMenuItemFocusable(menuItem) {
1222
+ var isEmbeddedData, isSubmenu, isDefaultMenuItem;
1223
+ isEmbeddedData = checkEmbeddedDataMenuItem(menuItem);
1224
+ isSubmenu = checkSubmenuMenuItemItem(menuItem);
1225
+ isDefaultMenuItem = checkDefaultMenuItem(menuItem);
1226
+ return (isEmbeddedData
1227
+ || isSubmenu
1228
+ || isDefaultMenuItem);
1229
+ }
1230
+ function checkDefaultMenuItem(menuItem) {
1231
+ return !(checkEmbeddedDataMenuItem(menuItem)
1232
+ || checkDecoratedMenuItem(menuItem)
1233
+ || checkSubmenuMenuItemItem(menuItem));
1234
+ }
1235
+
1236
+ var css_248z$i = "div[role=\"menu\"] .piped-text-search-input-container {\n padding: 5px 10px; }\n\n.piped-text-search-input {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .piped-text-search-input input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n\n.piped-text-menu-empty-anchor {\n /* the margin-right hack was not in harmony with tao.\n now, the empty-anchor is truly empty */ }\n\n.piped-text-submenu-item-container {\n position: relative; }\n .piped-text-submenu-item-container .piped-text-menu .piped-text-submenu-anchor {\n position: absolute;\n z-index: -1;\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n min-width: 100%; }\n\n.piped-text-submenu-item {\n padding-right: 24px; }\n\n.piped-text-information-message {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n color: #74777A;\n text-align: center;\n white-space: pre-line; }\n\n.piped-text-loading-spinner {\n width: fit-content;\n margin: 0 auto; }\n\n.piped-text-error-container {\n color: #BB0000; }\n .piped-text-error-container .piped-text-error-icon {\n padding: 8px 0; }\n .piped-text-error-container .piped-text-error-icon svg {\n fill: #BB0000;\n display: block;\n margin: 0 auto; }\n .piped-text-error-container .piped-text-error-text {\n text-align: center;\n white-space: pre-line;\n padding: 0 12px 8px; }\n\n.piped-text-menu-item-container.highlighted-menu-item {\n background: RGBA(50, 54, 58, 0.08); }\n\n.piped-text-menu-item-container .piped-text-menu-item, .piped-text-menu-item-container .piped-text-submenu-item {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis; }\n .piped-text-menu-item-container .piped-text-menu-item:not(.piped-text-header):not(.piped-text-disabled):hover, .piped-text-menu-item-container .piped-text-submenu-item:not(.piped-text-header):not(.piped-text-disabled):hover {\n cursor: pointer; }\n .piped-text-menu-item-container .piped-text-menu-item.piped-text-header, .piped-text-menu-item-container .piped-text-submenu-item.piped-text-header {\n font-size: 12px;\n line-height: 16px;\n font-weight: 700;\n padding: 12px; }\n .piped-text-menu-item-container .piped-text-menu-item.piped-text-disabled:not(.piped-text-header), .piped-text-menu-item-container .piped-text-submenu-item.piped-text-disabled:not(.piped-text-header) {\n color: RGB(116, 119, 122); }\n";
1237
+ styleInject(css_248z$i);
1238
+
1239
+ var css_248z$h = "";
1240
+ styleInject(css_248z$h);
1240
1241
 
1241
1242
  // const WrappedPipedTextMenu = PipedTextMenu as PipedTextMenuType;
1242
1243
  var PipedTextSubmenuItem = React__default["default"].forwardRef(function PipedTextSubmenuItem(props, ref) {
1243
1244
  var submenuAnchorRef = React.useRef(null);
1244
- var submenuItemId = useId();
1245
+ var submenuAnchorId = useId();
1245
1246
  var menuItem = props.menuItem;
1246
- return (React__default["default"].createElement("div", { "data-testid": "piped-text-submenu", className: "piped-text-submenu-item-container" },
1247
- menuItem.show && (React__default["default"].createElement(PipedTextMenu, { "aria-labelledby": submenuItemId,
1247
+ return (React__default["default"].createElement("div", { "data-testid": "piped-text-submenu", className: "piped-text-submenu-item-container", role: 'presentation' },
1248
+ menuItem.show && (React__default["default"].createElement(PipedTextMenu, { "aria-labelledby": submenuAnchorId,
1248
1249
  //@ts-ignore
1249
1250
  items: menuItem.submenu.items, show: menuItem.show, placement: "right-start", onClose: function () {
1250
1251
  menuItem.show = false;
1251
- }, allowCustom: menuItem.submenu.allowCustom, customScheme: menuItem.submenu.customScheme, customInputMessage: menuItem.submenu.customInputMessage, searchPlaceholder: menuItem.submenu.searchPlaceholder, errorText: menuItem.submenu.errorText, onSelected: menuItemClicked, anchor: function (ref) { return (React__default["default"].createElement("div", { ref: ref, className: "piped-text-submenu-anchor" })); }, anchorRef: submenuAnchorRef })),
1252
- React__default["default"].createElement("div", {
1253
- // aria-haspopup="menu"
1254
- // id={subMenuItemId}
1255
- className: "piped-text-submenu-item",
1256
- // role="menuitem"
1257
- onMouseEnter: function () { return submenuHovered(menuItem); }, ref: submenuAnchorRef },
1252
+ }, allowCustom: menuItem.submenu.allowCustom, customScheme: menuItem.submenu.customScheme, customInputMessage: menuItem.submenu.customInputMessage, searchPlaceholder: menuItem.submenu.searchPlaceholder, errorText: menuItem.submenu.errorText, onSelected: menuItemClicked, anchor: function (ref) { return (React__default["default"].createElement("div", { ref: ref, className: "piped-text-submenu-anchor" })); }, anchorRef: submenuAnchorRef, keyboardCtrl: props.keyboardCtrl, pipedTextMenuId: props.pipedTextMenuId })),
1253
+ React__default["default"].createElement("div", { id: submenuAnchorId, className: "piped-text-submenu-item", ref: submenuAnchorRef },
1258
1254
  React__default["default"].createElement("div", { className: "label-text" }, menuItem.label),
1259
1255
  React__default["default"].createElement("div", { className: "piped-text-icon" },
1260
1256
  React__default["default"].createElement(uiReact.Icon, { type: uiReact.IconTypes.ChevronRight, size: "medium" })))));
1261
1257
  function menuItemClicked(menuItem) {
1262
1258
  props.onMenuItemClick(menuItem);
1263
1259
  }
1264
- function submenuHovered(menuItem) {
1265
- props.onSubmenuHover(menuItem);
1260
+ });
1261
+
1262
+ var css_248z$g = "div[role=\"menu\"] .piped-text-search-input-container {\n padding: 5px 10px; }\n\n.piped-text-search-input {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .piped-text-search-input input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n\n.piped-text-menu-empty-anchor {\n /* the margin-right hack was not in harmony with tao.\n now, the empty-anchor is truly empty */ }\n\n.piped-text-submenu-item-container {\n position: relative; }\n .piped-text-submenu-item-container .piped-text-menu .piped-text-submenu-anchor {\n position: absolute;\n z-index: -1;\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n min-width: 100%; }\n\n.piped-text-submenu-item {\n padding-right: 24px; }\n\n.piped-text-information-message {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n color: #74777A;\n text-align: center;\n white-space: pre-line; }\n\n.piped-text-loading-spinner {\n width: fit-content;\n margin: 0 auto; }\n\n.piped-text-error-container {\n color: #BB0000; }\n .piped-text-error-container .piped-text-error-icon {\n padding: 8px 0; }\n .piped-text-error-container .piped-text-error-icon svg {\n fill: #BB0000;\n display: block;\n margin: 0 auto; }\n .piped-text-error-container .piped-text-error-text {\n text-align: center;\n white-space: pre-line;\n padding: 0 12px 8px; }\n\n.embedded-data-menu {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .embedded-data-menu input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n";
1263
+ styleInject(css_248z$g);
1264
+
1265
+ var css_248z$f = "";
1266
+ styleInject(css_248z$f);
1267
+
1268
+ var TEXT_INPUT_KEYS_TO_ALLOW = [
1269
+ 'ArrowDown',
1270
+ 'Escape',
1271
+ 'Tab',
1272
+ 'PageUp',
1273
+ 'Home',
1274
+ 'PageDown',
1275
+ 'End',
1276
+ 'Enter',
1277
+ ];
1278
+ var PipedTextMenuFocusItem = /** @class */ (function () {
1279
+ function PipedTextMenuFocusItem(currentContainer, menuItems) {
1280
+ this.currentContainer = currentContainer;
1281
+ this.menuItems = menuItems;
1282
+ this.highlightedIdx = -1;
1283
+ }
1284
+ PipedTextMenuFocusItem.prototype.setMenuItems = function (menuItems) {
1285
+ this.menuItems = menuItems;
1286
+ };
1287
+ PipedTextMenuFocusItem.prototype.findMenuItemIdx = function (menuItemRef) {
1288
+ return this.menuItems.findIndex(function (menuItem) {
1289
+ return menuItem.current === menuItemRef.current;
1290
+ });
1291
+ };
1292
+ return PipedTextMenuFocusItem;
1293
+ }());
1294
+ var PipedTextMenuKeyboardCtrl = /** @class */ (function () {
1295
+ function PipedTextMenuKeyboardCtrl() {
1296
+ this.menuFocusItems = [];
1297
+ this.currFocusItemIdx = -1;
1266
1298
  }
1299
+ PipedTextMenuKeyboardCtrl.prototype.getFocusMenu = function (containerRef) {
1300
+ var foundMenuFocusItemIdx;
1301
+ foundMenuFocusItemIdx = this.menuFocusItems.findIndex(function (focusItem) {
1302
+ return focusItem.currentContainer.current === containerRef.current;
1303
+ });
1304
+ if (foundMenuFocusItemIdx === -1) {
1305
+ return undefined;
1306
+ }
1307
+ return this.menuFocusItems[foundMenuFocusItemIdx];
1308
+ };
1309
+ PipedTextMenuKeyboardCtrl.prototype.getCurrentFocusMenu = function () {
1310
+ return this.menuFocusItems[this.currFocusItemIdx];
1311
+ };
1312
+ PipedTextMenuKeyboardCtrl.prototype.addMenu = function (containerRef, menuItemRefs) {
1313
+ var menuToSet, foundMenuFocusItemIdx;
1314
+ foundMenuFocusItemIdx = this.menuFocusItems.findIndex(function (menuFocusItem) {
1315
+ return menuFocusItem.currentContainer.current === containerRef.current;
1316
+ });
1317
+ if ((this.menuFocusItems.length === 0)
1318
+ || (foundMenuFocusItemIdx === -1)) {
1319
+ menuToSet = new PipedTextMenuFocusItem(containerRef, menuItemRefs);
1320
+ this.menuFocusItems.push(menuToSet);
1321
+ }
1322
+ else {
1323
+ menuToSet = this.menuFocusItems[foundMenuFocusItemIdx];
1324
+ menuToSet.setMenuItems(menuItemRefs);
1325
+ }
1326
+ };
1327
+ PipedTextMenuKeyboardCtrl.prototype.removeMenu = function (containerRef) {
1328
+ var foundMenuFocusItemIdx;
1329
+ foundMenuFocusItemIdx = this.menuFocusItems.findIndex(function (menuFocusItem) {
1330
+ return menuFocusItem.currentContainer.current === containerRef.current;
1331
+ });
1332
+ if (foundMenuFocusItemIdx === -1) {
1333
+ console.error(this);
1334
+ console.error(containerRef);
1335
+ throw new Error('Could not find a matching PipedTextMenu');
1336
+ }
1337
+ this.menuFocusItems.splice(foundMenuFocusItemIdx, 1);
1338
+ };
1339
+ PipedTextMenuKeyboardCtrl.prototype.handleKeyEvent = function ($e) {
1340
+ var _a, _b, _c, _d, _e, _f, _g;
1341
+ var key;
1342
+ var currFocusMenu, nextFocusMenu, nextFocusElemRef;
1343
+ var highlightedItem;
1344
+ key = $e.key;
1345
+ currFocusMenu = this.getCurrentFocusMenu();
1346
+ if (currFocusMenu === undefined) {
1347
+ // technically an error case...
1348
+ return;
1349
+ }
1350
+ switch (key) {
1351
+ case 'ArrowDown':
1352
+ /*
1353
+ In the current focused submenu, advance to the next available menu item
1354
+ and set it to highlighted, and trigger a focus on the menu item element
1355
+ */
1356
+ if (currFocusMenu.highlightedIdx < (currFocusMenu.menuItems.length - 1)) {
1357
+ nextFocusElemRef = currFocusMenu.menuItems[currFocusMenu.highlightedIdx + 1];
1358
+ this.setFocusMenuHighlightedIdx(currFocusMenu.currentContainer, nextFocusElemRef);
1359
+ (_a = nextFocusElemRef === null || nextFocusElemRef === void 0 ? void 0 : nextFocusElemRef.current) === null || _a === void 0 ? void 0 : _a.focus();
1360
+ }
1361
+ break;
1362
+ case 'ArrowUp':
1363
+ /*
1364
+ In the current focused submenu, advance to the previous available menu item
1365
+ and set it to highlighted, and trigger a focus on the menu item element
1366
+ */
1367
+ if (currFocusMenu.highlightedIdx > 0) {
1368
+ nextFocusElemRef = currFocusMenu.menuItems[currFocusMenu.highlightedIdx - 1];
1369
+ this.setFocusMenuHighlightedIdx(currFocusMenu.currentContainer, nextFocusElemRef);
1370
+ (_b = nextFocusElemRef === null || nextFocusElemRef === void 0 ? void 0 : nextFocusElemRef.current) === null || _b === void 0 ? void 0 : _b.focus();
1371
+ }
1372
+ break;
1373
+ case 'ArrowRight':
1374
+ this.focusNextSubmenu();
1375
+ break;
1376
+ case 'ArrowLeft':
1377
+ case 'Escape':
1378
+ /*
1379
+ Set the previous (parent) submenu as the current focused menu.
1380
+ If it has a child menuitem to highlight, focus the highlighted menu item.
1381
+ If no menuitem is highlighted in the target submenu, call focus() on the
1382
+ container element; the container element focus event handler is expected to
1383
+ respond to the event and set it's own highlighted element and index.
1384
+ */
1385
+ if (this.currFocusItemIdx > 0) {
1386
+ $e.stopPropagation();
1387
+ nextFocusMenu = this.menuFocusItems[this.currFocusItemIdx - 1];
1388
+ if (nextFocusMenu !== undefined) {
1389
+ highlightedItem = nextFocusMenu.menuItems[nextFocusMenu.highlightedIdx];
1390
+ if (highlightedItem === undefined) {
1391
+ (_d = (_c = nextFocusMenu.currentContainer) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.focus();
1392
+ }
1393
+ else {
1394
+ (_e = highlightedItem === null || highlightedItem === void 0 ? void 0 : highlightedItem.current) === null || _e === void 0 ? void 0 : _e.focus();
1395
+ }
1396
+ }
1397
+ }
1398
+ break;
1399
+ case 'PageUp':
1400
+ case 'Home':
1401
+ /*
1402
+ Focus the first menuitem in the current focus menu
1403
+ */
1404
+ nextFocusElemRef = currFocusMenu.menuItems[0];
1405
+ if (nextFocusElemRef) {
1406
+ this.setFocusMenuHighlightedIdx(currFocusMenu.currentContainer, nextFocusElemRef);
1407
+ (_f = nextFocusElemRef === null || nextFocusElemRef === void 0 ? void 0 : nextFocusElemRef.current) === null || _f === void 0 ? void 0 : _f.focus();
1408
+ }
1409
+ break;
1410
+ case 'PageDown':
1411
+ case 'End':
1412
+ /*
1413
+ Focus the last menuitem in the current focus menu
1414
+ */
1415
+ nextFocusElemRef = currFocusMenu.menuItems[currFocusMenu.menuItems.length - 1];
1416
+ if (nextFocusElemRef) {
1417
+ this.setFocusMenuHighlightedIdx(currFocusMenu.currentContainer, nextFocusElemRef);
1418
+ (_g = nextFocusElemRef === null || nextFocusElemRef === void 0 ? void 0 : nextFocusElemRef.current) === null || _g === void 0 ? void 0 : _g.focus();
1419
+ }
1420
+ break;
1421
+ }
1422
+ };
1423
+ PipedTextMenuKeyboardCtrl.prototype.focusNextSubmenu = function () {
1424
+ var _a, _b, _c;
1425
+ var currFocusMenu, nextFocusMenu, highlightedItem;
1426
+ currFocusMenu = this.getCurrentFocusMenu();
1427
+ if (currFocusMenu === undefined) {
1428
+ // technically an error case...
1429
+ return;
1430
+ }
1431
+ nextFocusMenu = this.menuFocusItems[this.currFocusItemIdx + 1];
1432
+ if (nextFocusMenu !== undefined) {
1433
+ highlightedItem = nextFocusMenu.menuItems[nextFocusMenu.highlightedIdx];
1434
+ if (highlightedItem === undefined) {
1435
+ (_b = (_a = nextFocusMenu.currentContainer) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.focus();
1436
+ }
1437
+ else {
1438
+ (_c = highlightedItem === null || highlightedItem === void 0 ? void 0 : highlightedItem.current) === null || _c === void 0 ? void 0 : _c.focus();
1439
+ }
1440
+ }
1441
+ };
1442
+ PipedTextMenuKeyboardCtrl.prototype.getCurrentFocusMenuRef = function () {
1443
+ var _a;
1444
+ return (_a = this.getCurrentFocusMenu()) === null || _a === void 0 ? void 0 : _a.currentContainer;
1445
+ };
1446
+ PipedTextMenuKeyboardCtrl.prototype.isMenuItemInCurrentFocusMenu = function (menuItemRef) {
1447
+ var currentFocusMenu, foundFocusMenuItemRef;
1448
+ currentFocusMenu = this.getCurrentFocusMenu();
1449
+ foundFocusMenuItemRef = currentFocusMenu.menuItems.find(function (menuItem) {
1450
+ return menuItem.current === menuItemRef.current;
1451
+ });
1452
+ return foundFocusMenuItemRef !== undefined;
1453
+ };
1454
+ PipedTextMenuKeyboardCtrl.prototype.setFocus = function (focusedEl) {
1455
+ var foundMenuFocusItemIdx;
1456
+ foundMenuFocusItemIdx = this.menuFocusItems.findIndex(function (menuFocusItem) {
1457
+ return menuFocusItem.currentContainer.current === focusedEl;
1458
+ });
1459
+ if (foundMenuFocusItemIdx === -1) {
1460
+ console.error(this);
1461
+ console.error(focusedEl);
1462
+ throw new Error('Could not find a matching PipedTextMenu');
1463
+ }
1464
+ this.currFocusItemIdx = foundMenuFocusItemIdx;
1465
+ };
1466
+ PipedTextMenuKeyboardCtrl.prototype.getFocusMenuHighlightedIdx = function (containerRef) {
1467
+ var focusMenu;
1468
+ focusMenu = this.getFocusMenu(containerRef);
1469
+ if (focusMenu === undefined) {
1470
+ return -1;
1471
+ }
1472
+ return focusMenu.highlightedIdx;
1473
+ };
1474
+ PipedTextMenuKeyboardCtrl.prototype.setFocusMenuHighlightedIdx = function (containerRef, highlightedItemRef) {
1475
+ var foundMenuFocusItem, foundHighlightedItemIdx;
1476
+ foundMenuFocusItem = this.getFocusMenu(containerRef);
1477
+ if (foundMenuFocusItem === undefined) {
1478
+ return;
1479
+ }
1480
+ foundHighlightedItemIdx = foundMenuFocusItem.findMenuItemIdx(highlightedItemRef);
1481
+ if (foundHighlightedItemIdx === -1) {
1482
+ return;
1483
+ }
1484
+ foundMenuFocusItem.highlightedIdx = foundHighlightedItemIdx;
1485
+ };
1486
+ return PipedTextMenuKeyboardCtrl;
1487
+ }());
1488
+
1489
+ function EmbeddedDataInput(props) {
1490
+ var _a = React.useState(''), inputValue = _a[0], setInputValue = _a[1];
1491
+ var _b = React.useState(false), isInputInvalid = _b[0], setIsInputInvalid = _b[1];
1492
+ var containerRef = React.useRef();
1493
+ var inputRef = React.useRef();
1494
+ React.useEffect(function () {
1495
+ props.keyboardCtrl.addMenu(containerRef, [
1496
+ inputRef,
1497
+ ]);
1498
+ }, [
1499
+ containerRef
1500
+ ]);
1501
+ React.useEffect(function () {
1502
+ var $destroy = function () {
1503
+ props.keyboardCtrl.removeMenu(containerRef);
1504
+ };
1505
+ return $destroy;
1506
+ }, []);
1507
+ return (React__default["default"].createElement("div", { className: 'embedded-data-input', tabIndex: -1, "aria-labelledby": props.ariaLabelledById, ref: containerRef, onFocus: handleContainerFocus, onKeyDown: handleContainerKeyDown },
1508
+ React__default["default"].createElement(uiReact.InputGroup, null,
1509
+ React__default["default"].createElement(uiReact.Input, { onChange: function ($e) {
1510
+ handleInputChange($e);
1511
+ }, invalid: isInputInvalid, onKeyDown: handleInputKeyDown, className: 'q-plugin-popover-input', ref: inputRef }),
1512
+ React__default["default"].createElement(uiReact.Button, { kind: 'primary', onClick: handleAddButtonClick, onKeyDown: handleAddButtonKeyDown, onFocus: function ($e) {
1513
+ $e.stopPropagation();
1514
+ } },
1515
+ React__default["default"].createElement(uiReact.Icon, { type: uiReact.IconTypes.Add })))));
1516
+ function handleContainerFocus($e) {
1517
+ var _a;
1518
+ if ($e.currentTarget === containerRef.current) {
1519
+ props.keyboardCtrl.setFocus(containerRef.current);
1520
+ (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
1521
+ props.keyboardCtrl.setFocusMenuHighlightedIdx(containerRef, inputRef);
1522
+ $e.stopPropagation();
1523
+ $e.preventDefault();
1524
+ }
1525
+ }
1526
+ function handleContainerKeyDown($e) {
1527
+ switch ($e.key) {
1528
+ case 'ArrowDown':
1529
+ case 'ArrowUp':
1530
+ case 'ArrowRight':
1531
+ case 'ArrowLeft':
1532
+ case 'Escape':
1533
+ props.keyboardCtrl.handleKeyEvent($e);
1534
+ $e.preventDefault(); // prevent scroll
1535
+ break;
1536
+ case 'Enter':
1537
+ handleAddButtonClick();
1538
+ /*
1539
+ We don't want Enter key events to bubble, because when the
1540
+ menu closes after enter the focus will return to the
1541
+ piped-text anchor button, and Enter would reopen the base menu
1542
+ */
1543
+ $e.stopPropagation();
1544
+ $e.preventDefault();
1545
+ break;
1546
+ case 'PageUp':
1547
+ case 'Home':
1548
+ case 'PageDown':
1549
+ case 'End':
1550
+ $e.stopPropagation();
1551
+ $e.preventDefault();
1552
+ break;
1553
+ }
1554
+ }
1555
+ function handleInputKeyDown($e) {
1556
+ var key = $e.key;
1557
+ if (!TEXT_INPUT_KEYS_TO_ALLOW.includes($e.key)) {
1558
+ $e.stopPropagation();
1559
+ }
1560
+ if (!$e.shiftKey && (key === 'Tab')) {
1561
+ /*
1562
+ User can tab forward to focus add Button element
1563
+ without closing the popover menu
1564
+ */
1565
+ $e.stopPropagation();
1566
+ }
1567
+ }
1568
+ function handleAddButtonKeyDown($e) {
1569
+ if ($e.shiftKey && ($e.key === 'Tab')) {
1570
+ /*
1571
+ User can shift+tab back to focus Text Input element
1572
+ without closing the popover menu
1573
+ */
1574
+ $e.stopPropagation();
1575
+ }
1576
+ }
1577
+ function handleAddButtonClick() {
1578
+ var locatorString;
1579
+ // Indicate a validation error if the inputValue is empty.
1580
+ // We do not need to provide an error message, via UX guidelines
1581
+ // input validation errors indicate "Required" implicitly by default.
1582
+ if ((inputValue || '').trim().length < 1) {
1583
+ setIsInputInvalid(true);
1584
+ return;
1585
+ }
1586
+ locatorString = "${e://Field/".concat(inputValue, "}");
1587
+ props.onSelect(locatorString);
1588
+ }
1589
+ function handleInputChange($e) {
1590
+ var nextInputValue = ($e.target.value || '').trim();
1591
+ var uriEncodedValue = encodeURIComponent(nextInputValue);
1592
+ setInputValue(uriEncodedValue);
1593
+ if ((uriEncodedValue.length > 0) && isInputInvalid) {
1594
+ setIsInputInvalid(false);
1595
+ }
1596
+ }
1597
+ }
1598
+
1599
+ var EmbeddedDataMenu = React__default["default"].forwardRef(function EmbeddedDataMenu(props, ref) {
1600
+ var anchor = props.anchor;
1601
+ var onClose = props.onClose || (function () { return undefined; });
1602
+ var popoverClassName = 'embedded-data-menu-content';
1603
+ var ignoreClickSelector = popoverClassName;
1604
+ var onSelect = props.onSelect || (function () { return undefined; });
1605
+ return (React__default["default"].createElement(Popover, { show: props.show, anchor: anchor, onClose: onClose, ignoreClickSelector: ignoreClickSelector, placement: props.placement || 'right-start' },
1606
+ React__default["default"].createElement("div", { className: "embedded-data-menu", ref: ref },
1607
+ React__default["default"].createElement(EmbeddedDataInput, { onSelect: onSelect, keyboardCtrl: props.keyboardCtrl, ariaLabelledById: props.ariaLabelledById }))));
1267
1608
  });
1268
1609
 
1269
- var EMBEDDED_DATA_LOCATOR$1 = 'embeddedData';
1610
+ /*
1611
+ Combines refs for using ForwardRef to manage a localRef in the component, while
1612
+ still allowing the passed ref to function
1613
+
1614
+ See following reference implementations:
1615
+ https://gitlab-app.eng.qops.net/cfe/ui/-/blob/master/packages/ui-react/src/utils/mergeRefs/mergeRefs.ts
1616
+ https://github.com/gregberge/react-merge-refs/blob/main/src/index.tsx
1617
+ */
1618
+ function mergeRefs(refs) {
1619
+ return function (value) {
1620
+ refs.forEach(function (ref) {
1621
+ if ((typeof ref) === 'function') {
1622
+ ref(value);
1623
+ }
1624
+ else if (ref !== null) {
1625
+ ref.current = value;
1626
+ }
1627
+ });
1628
+ };
1629
+ }
1630
+
1631
+ // export const EMBEDDED_DATA_LOCATOR = 'embeddedData';
1270
1632
  var PipedTextMenuItem = React__default["default"].forwardRef(function PipedTextMenuItem(props, ref) {
1271
- var submenuId = useId();
1272
- return (React__default["default"].createElement("div", { className: 'piped-text-menu-item-container', ref: ref }, getMenuItemContent(props.menuItem)));
1633
+ var _a = React.useState(), ariaHaspopup = _a[0], setAriaHaspopup = _a[1];
1634
+ var _b = React.useState(), tabIndex = _b[0], setTabIndex = _b[1];
1635
+ var _c = React.useState(), role = _c[0], setRole = _c[1];
1636
+ var _d = React.useState(), _isSubmenu = _d[0], setIsSubmenu = _d[1];
1637
+ var _e = React.useState(), _isDecorated = _e[0], setIsDecorated = _e[1];
1638
+ var _f = React.useState(), _isFocusable = _f[0], setIsFocusable = _f[1];
1639
+ var _g = React.useState(), _isEmbeddedDataMenu = _g[0], setIsEmbeddedDataMenu = _g[1];
1640
+ var localRef = React.useRef();
1641
+ var submenuItemId = useId();
1642
+ var pipedTextMenuId = useId();
1643
+ React.useEffect(function () {
1644
+ var nextIsFocusable, nextIsDecorated, nextIsSubmenu, nextIsEmbeddedDataMenu;
1645
+ var nextTabIndex, nextAriaHaspopup, nextRole;
1646
+ if (props.menuItem === undefined) {
1647
+ return;
1648
+ }
1649
+ nextIsFocusable = checkMenuItemFocusable(props.menuItem);
1650
+ nextIsSubmenu = checkSubmenuMenuItemItem(props.menuItem);
1651
+ nextIsEmbeddedDataMenu = checkEmbeddedDataMenuItem(props.menuItem);
1652
+ nextIsDecorated = checkDecoratedMenuItem(props.menuItem);
1653
+ if (nextIsFocusable) {
1654
+ nextTabIndex = -1;
1655
+ nextRole = 'menuitem';
1656
+ }
1657
+ if (nextIsSubmenu || nextIsEmbeddedDataMenu) {
1658
+ nextAriaHaspopup = 'menu';
1659
+ }
1660
+ setAriaHaspopup(nextAriaHaspopup);
1661
+ setTabIndex(nextTabIndex);
1662
+ setRole(nextRole);
1663
+ setIsSubmenu(nextIsSubmenu);
1664
+ setIsDecorated(nextIsDecorated);
1665
+ setIsFocusable(nextIsFocusable);
1666
+ setIsEmbeddedDataMenu(nextIsEmbeddedDataMenu);
1667
+ }, [
1668
+ props.menuItem,
1669
+ ]);
1670
+ return (React__default["default"].createElement("div", { className: 'piped-text-menu-item-container ' + ((props.isHighlighted)
1671
+ ? 'highlighted-menu-item'
1672
+ : ''), ref: mergeRefs([
1673
+ ref,
1674
+ localRef,
1675
+ ]), "aria-haspopup": ariaHaspopup, tabIndex: tabIndex, role: role, id: ariaHaspopup ? submenuItemId : undefined, "aria-controls": ariaHaspopup ? pipedTextMenuId : undefined, "aria-expanded": props.menuItem.show, onFocus: function ($e) {
1676
+ handleMenuItemFocused(props.menuItem);
1677
+ }, onKeyDown: function ($e) {
1678
+ handleKeyDown($e);
1679
+ }, onMouseEnter: handleMouseEnter, onClick: handleClick }, getMenuItemContent(props.menuItem)));
1273
1680
  function getMenuItemContent(menuItem) {
1274
1681
  var innerContent, menuItemEl;
1275
1682
  var menuItemHeaderClass, menuItemDisabledClass, menuItemClassName;
1276
- var isSubmenu = checkSubmenuMenuItemItem$1(menuItem);
1277
- var isDecorated = checkDecoratedMenuItem$1(menuItem);
1278
- var isEmbeddedDataMenuItem = checkEmbeddedDataMenuItem$1(menuItem);
1279
- var isFocusable = checkMenuItemFocusable$1(menuItem);
1280
- var role = isSubmenu
1281
- ? 'submenu'
1282
- : 'menuitemradio';
1283
- if (isSubmenu) {
1284
- innerContent = (React__default["default"].createElement(PipedTextSubmenuItem, { key: menuItem.key, menuItem: menuItem, onSubmenuHover: handleSubmenuHover, onMenuItemClick: handleMenuItemClick }));
1285
- }
1286
- else if (isDecorated) {
1683
+ if (_isSubmenu) {
1684
+ innerContent = (React__default["default"].createElement(PipedTextSubmenuItem, { key: menuItem.key, menuItem: menuItem, onMenuItemClick: handleMenuItemClick, keyboardCtrl: props.keyboardCtrl, pipedTextMenuId: pipedTextMenuId }));
1685
+ }
1686
+ else if (_isDecorated) {
1287
1687
  menuItemHeaderClass = (menuItem.header === true)
1288
1688
  ? 'piped-text-header'
1289
1689
  : '';
@@ -1293,35 +1693,73 @@ var PipedTextMenuItem = React__default["default"].forwardRef(function PipedTextM
1293
1693
  menuItemClassName = "piped-text-menu-item ".concat(menuItemHeaderClass, " ").concat(menuItemDisabledClass);
1294
1694
  innerContent = (React__default["default"].createElement("div", { className: menuItemClassName }, menuItem.label));
1295
1695
  }
1296
- else if (isEmbeddedDataMenuItem) {
1297
- innerContent = (React__default["default"].createElement("div", { onClick: function () {
1298
- handleEmbeddedDataItemClick(menuItem);
1299
- }, onMouseEnter: function () { return handleMenuItemHovered(menuItem); } },
1300
- React__default["default"].createElement(EmbeddedDataMenu
1301
- //@ts-ignore
1302
- , {
1303
- //@ts-ignore
1304
- show: menuItem.show, onSelect: handleEmbeddedDataSelect, anchor: function (ref) { return (React__default["default"].createElement("div", { ref: ref, className: "embedded-data-menu-anchor" })); } }),
1305
- React__default["default"].createElement("div", { className: "piped-text-menu-item" }, menuItem.label)));
1696
+ else if (_isEmbeddedDataMenu) {
1697
+ innerContent = (React__default["default"].createElement("div", { role: 'presentation' },
1698
+ React__default["default"].createElement(EmbeddedDataMenu, { show: menuItem.show, onSelect: handleEmbeddedDataSelect, anchor: function (_ref) { return (React__default["default"].createElement("div", { ref: _ref, className: "embedded-data-menu-anchor", "aria-hidden": 'true' })); }, keyboardCtrl: props.keyboardCtrl, ariaLabelledById: submenuItemId }),
1699
+ React__default["default"].createElement("div", { className: "piped-text-submenu-item" },
1700
+ React__default["default"].createElement("div", { className: 'label-text' }, menuItem.label),
1701
+ React__default["default"].createElement("div", { className: "piped-text-icon" },
1702
+ React__default["default"].createElement(uiReact.Icon, { type: uiReact.IconTypes.ChevronRight, size: 'medium' })))));
1306
1703
  }
1307
1704
  else {
1308
- innerContent = (React__default["default"].createElement("div", { onClick: function () { return handleMenuItemClick(menuItem); }, onMouseEnter: function () { return handleMenuItemHovered(menuItem); } },
1309
- React__default["default"].createElement("div", { className: "piped-text-menu-item" }, menuItem.label)));
1705
+ innerContent = (React__default["default"].createElement("div", { className: "piped-text-menu-item", role: 'presentation' }, menuItem.label));
1310
1706
  }
1311
- menuItemEl = (React__default["default"].createElement("div", { "aria-haspopup": isSubmenu ? 'menu' : undefined, id: isSubmenu ? submenuId : undefined, role: role, className: "piped-text-menu-item-content", tabIndex: isFocusable ? -1 : undefined }, innerContent));
1707
+ menuItemEl = (React__default["default"].createElement("div", { className: "piped-text-menu-item-content", role: 'presentation' }, innerContent));
1312
1708
  return menuItemEl;
1313
1709
  }
1314
- function handleEmbeddedDataItemClick(menuItem) {
1315
- props.onEmbeddedDataItemClick(menuItem);
1710
+ function handleClick($e) {
1711
+ if (_isSubmenu || _isEmbeddedDataMenu) {
1712
+ handleSubmenuItemClick(props.menuItem);
1713
+ }
1714
+ else if (_isFocusable) {
1715
+ handleMenuItemClick(props.menuItem);
1716
+ }
1717
+ }
1718
+ function handleMouseEnter($e) {
1719
+ if (_isSubmenu || _isEmbeddedDataMenu) {
1720
+ handleSubmenuHover(props.menuItem);
1721
+ }
1722
+ else if (_isFocusable) {
1723
+ handleMenuItemHovered(props.menuItem);
1724
+ }
1725
+ }
1726
+ function handleKeyDown($e) {
1727
+ if (!props.isHighlighted) {
1728
+ return;
1729
+ }
1730
+ if (!props.keyboardCtrl.isMenuItemInCurrentFocusMenu(localRef)) {
1731
+ return;
1732
+ }
1733
+ if (($e.key === ' ')
1734
+ || ($e.key === 'Enter')) {
1735
+ if (_isSubmenu || _isEmbeddedDataMenu) {
1736
+ props.onSubmenuItemClick(props.menuItem);
1737
+ }
1738
+ else {
1739
+ props.onMenuItemClicked(props.menuItem);
1740
+ }
1741
+ $e.preventDefault(); // prevent scroll
1742
+ }
1743
+ }
1744
+ function handleMenuItemFocused(menuItem) {
1745
+ if (_isSubmenu || _isEmbeddedDataMenu) {
1746
+ props.onSubmenuHover(menuItem, localRef);
1747
+ }
1748
+ else {
1749
+ props.onMenuItemHover(menuItem, localRef);
1750
+ }
1751
+ }
1752
+ function handleSubmenuItemClick(menuItem) {
1753
+ props.onSubmenuItemClick(menuItem);
1316
1754
  }
1317
1755
  function handleMenuItemClick(menuItem) {
1318
1756
  props.onMenuItemClicked(menuItem);
1319
1757
  }
1320
1758
  function handleSubmenuHover(menuItem) {
1321
- props.onSubmenuHover(menuItem);
1759
+ props.onSubmenuHover(menuItem, localRef);
1322
1760
  }
1323
1761
  function handleMenuItemHovered(menuItem) {
1324
- props.onMenuItemHover(menuItem);
1762
+ props.onMenuItemHover(menuItem, localRef);
1325
1763
  }
1326
1764
  function handleEmbeddedDataSelect(edLocator) {
1327
1765
  var edMenuItem;
@@ -1336,468 +1774,451 @@ var PipedTextMenuItem = React__default["default"].forwardRef(function PipedTextM
1336
1774
  };
1337
1775
  props.onMenuItemClicked(edMenuItem);
1338
1776
  }
1339
- });
1340
- function checkEmbeddedDataMenuItem$1(menuItem) {
1341
- return menuItem.value === EMBEDDED_DATA_LOCATOR$1;
1342
- }
1343
- function checkDecoratedMenuItem$1(menuItem) {
1344
- return (menuItem.header === true)
1345
- || (menuItem.disabled === true);
1346
- }
1347
- function checkSubmenuMenuItemItem$1(menuItem) {
1348
- return !!menuItem.hasSubmenu;
1349
- }
1350
- function checkMenuItemFocusable$1(menuItem) {
1351
- var isEmbeddedData, isSubmenu, isDefaultMenuItem;
1352
- isEmbeddedData = checkEmbeddedDataMenuItem$1(menuItem);
1353
- isSubmenu = checkSubmenuMenuItemItem$1(menuItem);
1354
- isDefaultMenuItem = checkDefaultMenuItem$1(menuItem);
1355
- return (isEmbeddedData
1356
- || isSubmenu
1357
- || isDefaultMenuItem);
1358
- }
1359
- function checkDefaultMenuItem$1(menuItem) {
1360
- return !(checkEmbeddedDataMenuItem$1(menuItem)
1361
- || checkDecoratedMenuItem$1(menuItem)
1362
- || checkSubmenuMenuItemItem$1(menuItem));
1363
- }
1364
-
1365
- var css_248z$e = "div[role=\"menu\"] .piped-text-search-input-container {\n padding: 5px 10px; }\n\n.piped-text-search-input {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .piped-text-search-input input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n\n.piped-text-menu-empty-anchor {\n /* the margin-right hack was not in harmony with tao.\n now, the empty-anchor is truly empty */ }\n\n.piped-text-submenu-item-container {\n position: relative; }\n .piped-text-submenu-item-container .piped-text-menu .piped-text-submenu-anchor {\n position: absolute;\n z-index: -1;\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n min-width: 100%; }\n\n.piped-text-menu-item, .piped-text-submenu-item {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis; }\n .piped-text-menu-item:not(.piped-text-header):not(.piped-text-disabled):hover, .piped-text-submenu-item:not(.piped-text-header):not(.piped-text-disabled):hover {\n cursor: pointer;\n background: RGBA(50, 54, 58, 0.08); }\n .piped-text-menu-item.piped-text-header, .piped-text-submenu-item.piped-text-header {\n font-size: 12px;\n line-height: 16px;\n font-weight: 700;\n padding: 12px; }\n .piped-text-menu-item.piped-text-disabled:not(.piped-text-header), .piped-text-submenu-item.piped-text-disabled:not(.piped-text-header) {\n color: RGB(116, 119, 122); }\n\n.piped-text-submenu-item {\n padding-right: 24px; }\n\n.piped-text-information-message {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n color: #74777A;\n text-align: center;\n white-space: pre-line; }\n\n.piped-text-loading-spinner {\n width: fit-content;\n margin: 0 auto; }\n\n.piped-text-error-container {\n color: #BB0000; }\n .piped-text-error-container .piped-text-error-icon {\n padding: 8px 0; }\n .piped-text-error-container .piped-text-error-icon svg {\n fill: #BB0000;\n display: block;\n margin: 0 auto; }\n .piped-text-error-container .piped-text-error-text {\n text-align: center;\n white-space: pre-line;\n padding: 0 12px 8px; }\n";
1366
- styleInject(css_248z$e);
1367
-
1368
- var EMBEDDED_DATA_LOCATOR = 'embeddedData';
1369
- var PipedTextMenu = React__default["default"].forwardRef(function PipedTextMenu(props, ref) {
1370
- var defaultMenuItems = undefined;
1371
-
1372
- if (typeof props.items !== 'function') {
1373
- defaultMenuItems = _cloneDeep__default["default"](props.items);
1374
- }
1375
-
1376
- var optionsRef = React.useRef({});
1377
-
1378
- var _useState = React.useState(defaultMenuItems),
1379
- _useState2 = _slicedToArray(_useState, 2),
1380
- menuItems = _useState2[0],
1381
- setMenuItems = _useState2[1];
1382
-
1383
- var _useState3 = React.useState(props.show),
1384
- _useState4 = _slicedToArray(_useState3, 2),
1385
- isMenuOpen = _useState4[0],
1386
- setIsMenuOpen = _useState4[1];
1387
-
1388
- var _useState5 = React.useState(false),
1389
- _useState6 = _slicedToArray(_useState5, 2),
1390
- isLoadError = _useState6[0],
1391
- setIsLoadError = _useState6[1];
1392
-
1393
- var _useState7 = React.useState(''),
1394
- _useState8 = _slicedToArray(_useState7, 2),
1395
- searchValue = _useState8[0],
1396
- setSearchValue = _useState8[1];
1397
-
1398
- var _useState9 = React.useState(undefined),
1399
- _useState10 = _slicedToArray(_useState9, 2);
1400
- _useState10[0];
1401
- var setIsSubmenu = _useState10[1];
1402
-
1403
- var _useState11 = React.useState([]),
1404
- _useState12 = _slicedToArray(_useState11, 2),
1405
- itemsToRender = _useState12[0],
1406
- setItemsToRender = _useState12[1];
1407
-
1408
- var externalAriaLabelledBy = props['aria-labelledby'];
1409
- var popoverAriaLabelledBy = useId();
1410
-
1411
- var _useState13 = React.useState([]),
1412
- _useState14 = _slicedToArray(_useState13, 2),
1413
- menuChildren = _useState14[0],
1414
- setMenuChildren = _useState14[1];
1415
-
1416
- var _useState15 = React.useState(-1),
1417
- _useState16 = _slicedToArray(_useState15, 2),
1418
- higlightedItemIndex = _useState16[0],
1419
- setHighlightedItemIndex = _useState16[1];
1420
-
1421
- var _useState17 = React.useState([]),
1422
- _useState18 = _slicedToArray(_useState17, 2);
1423
- _useState18[0];
1424
- var setFocusMenuItems = _useState18[1];
1425
-
1426
- var onClose = props.onClose || function () {
1427
- return undefined;
1428
- };
1429
-
1430
- var _useState19 = React.useState(null),
1431
- _useState20 = _slicedToArray(_useState19, 2),
1432
- popoverEl = _useState20[0],
1433
- setPopoverEl = _useState20[1];
1434
-
1435
- var popoverRefCb = React.useCallback(function (el) {
1436
- setPopoverEl(el);
1437
- }, []);
1438
-
1439
- var _useState21 = React.useState(null),
1440
- _useState22 = _slicedToArray(_useState21, 2);
1441
- _useState22[0];
1442
- var setSearchBoxEl = _useState22[1];
1443
-
1444
- var searchBoxRefCb = React.useCallback(function (el) {
1445
- setSearchBoxEl(el);
1446
- }, []);
1447
- React.useEffect(function () {
1448
- var nextMenuChildren;
1449
- nextMenuChildren = getPipedTextMenuItems(itemsToRender);
1450
- setMenuChildren(nextMenuChildren);
1451
- }, [itemsToRender]);
1452
- React.useEffect(function () {
1453
- var nextItemsToRender;
1454
- nextItemsToRender = (menuItems || []).filter(matchesSearch);
1455
- setItemsToRender(nextItemsToRender);
1456
- }, [searchValue, menuItems]);
1457
- React.useEffect(function () {
1458
- var anchorRefEl = _get__default["default"](props, 'anchorRef.current');
1459
-
1460
- if (anchorRefEl) {
1461
- var anchorRefElRole = anchorRefEl.getAttribute('role');
1462
- var nextIsSubmenu = anchorRefElRole === 'menuitem';
1463
- setIsSubmenu(nextIsSubmenu);
1464
- }
1465
- }, [popoverEl]);
1466
- React.useEffect(function () {
1467
- _asyncToGenerator(_regeneratorRuntime().mark(function _callee() {
1468
- var newMenuItems;
1469
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1470
- while (1) {
1471
- switch (_context.prev = _context.next) {
1472
- case 0:
1473
- if (!(typeof props.items === 'function')) {
1474
- _context.next = 13;
1475
- break;
1476
- }
1477
-
1478
- _context.prev = 1;
1479
- _context.next = 4;
1480
- return props.items();
1481
-
1482
- case 4:
1483
- newMenuItems = _context.sent;
1484
- newMenuItems = pipedTextDataAdapter(newMenuItems);
1485
- setMenuItems(newMenuItems);
1486
- _context.next = 12;
1487
- break;
1488
-
1489
- case 9:
1490
- _context.prev = 9;
1491
- _context.t0 = _context["catch"](1);
1492
- setIsLoadError(true);
1493
-
1494
- case 12:
1495
- if (typeof optionsRef.current.scheduleUpdate === 'function') {
1496
- optionsRef.current.scheduleUpdate();
1497
- }
1498
-
1499
- case 13:
1500
- case "end":
1501
- return _context.stop();
1502
- }
1503
- }
1504
- }, _callee, null, [[1, 9]]);
1505
- }))();
1506
- }, [props.items]);
1507
- React.useEffect(function () {
1508
- if (props.show) {
1509
- setIsMenuOpen(true);
1510
- }
1511
- }, [props.show]);
1512
- React.useEffect(function () {
1513
- return function () {
1514
- return onClose();
1515
- };
1516
- }, []);
1517
-
1518
- var _onClose = function _onClose() {
1519
- onToggleClick(false);
1520
- onClose();
1521
- };
1522
-
1523
- var reRenderMenus = function reRenderMenus() {
1524
- var nextMenuItems;
1525
- nextMenuItems = _cloneDeep__default["default"](menuItems);
1526
- setMenuItems(nextMenuItems);
1527
- };
1528
-
1529
- var onToggleClick = function onToggleClick(force) {
1530
- var nextIsMenuOpen;
1531
- nextIsMenuOpen = typeof force === 'boolean' ? force : !isMenuOpen;
1532
- setIsMenuOpen(nextIsMenuOpen);
1533
- };
1534
-
1535
- var submenuHovered = function submenuHovered(menuItem, evt) {
1536
- var nextMenuItems;
1537
- closeSubmenus(menuItems);
1538
-
1539
- if (!menuItem.show) {
1540
- menuItem.show = true;
1541
- }
1542
-
1543
- nextMenuItems = _cloneDeep__default["default"](menuItems);
1544
- setMenuItems(nextMenuItems);
1545
- };
1546
-
1547
- var menuItemHovered = function menuItemHovered(menuItem, evt) {
1548
- var nextMenuItems;
1549
- closeSubmenus(menuItems);
1550
- nextMenuItems = _cloneDeep__default["default"](menuItems);
1551
- setMenuItems(nextMenuItems);
1552
- };
1553
-
1554
- var onSearchInputChange = function onSearchInputChange(evt) {
1555
- var searchVal;
1556
- searchVal = evt.target.value;
1557
- setSearchValue(searchVal);
1558
- };
1559
-
1560
- var handleSearchInputClick = function handleSearchInputClick(evt) {
1561
- evt.stopPropagation();
1562
- };
1563
-
1564
- var matchesSearch = function matchesSearch(item) {
1565
- var searchVal = searchValue || '';
1566
- searchVal = searchVal.trim().toLowerCase();
1567
- return JSON.stringify(item).toLowerCase().includes(searchVal);
1568
- };
1569
-
1570
- var menuItemClicked = function menuItemClicked(menuItem) {
1571
- if (!menuItem.disabled) {
1572
- props.onSelected(menuItem);
1573
- }
1574
-
1575
- onClose();
1576
- };
1577
-
1578
- var embeddedDataItemClicked = function embeddedDataItemClicked(menuItem, $e) {
1579
- menuItem.show = true;
1580
- reRenderMenus();
1581
- };
1582
-
1583
- var getPipedTextMenuItems = function getPipedTextMenuItems(menuItems) {
1584
- var pipedTextMenuItems, nextFocusMenuItems;
1585
- pipedTextMenuItems = [];
1586
- nextFocusMenuItems = [];
1587
-
1588
- if (menuItems.length === 0 && props.allowCustom === true && props.customInputMessage) {
1589
- return React__default["default"].createElement("div", null, React__default["default"].createElement("div", {
1590
- className: "piped-text-information-message"
1591
- }, props.customInputMessage));
1592
- }
1593
-
1594
- pipedTextMenuItems = menuItems.map(function (menuItem) {
1595
- var isFocusable, menuItemEl;
1596
- var menuItemRef = React__default["default"].createRef();
1597
- isFocusable = checkMenuItemFocusable(menuItem);
1598
- menuItemEl = React__default["default"].createElement(PipedTextMenuItem, {
1599
- key: menuItem.key,
1600
- menuItem: menuItem,
1601
- onSubmenuHover: function onSubmenuHover(menuItem) {
1602
- submenuHovered(menuItem);
1603
- },
1604
- onMenuItemClicked: function onMenuItemClicked(menuItem) {
1605
- menuItemClicked(menuItem);
1606
- },
1607
- onMenuItemHover: function onMenuItemHover(menuItem) {
1608
- menuItemHovered();
1609
- },
1610
- onEmbeddedDataItemClick: function onEmbeddedDataItemClick(menuItem) {
1611
- embeddedDataItemClicked(menuItem);
1612
- },
1613
- ref: menuItemRef
1614
- });
1615
-
1616
- if (isFocusable) {
1617
- nextFocusMenuItems.push(menuItemEl);
1618
- }
1619
-
1620
- return menuItemEl;
1621
- });
1622
- setFocusMenuItems(nextFocusMenuItems);
1623
- return pipedTextMenuItems;
1624
- };
1625
-
1626
- var handleSearchSubmit = function handleSearchSubmit(e) {
1627
- e.preventDefault();
1628
-
1629
- if (!(props.allowCustom === true && props.customScheme)) {
1630
- return;
1631
- }
1632
-
1633
- var value = searchValue.trim();
1634
-
1635
- if (value === '') {
1636
- return;
1637
- }
1638
-
1639
- var locator = "${".concat(props.customScheme, "://Field/").concat(encodeURIComponent(value), "}");
1640
- var selected = {
1641
- value: {
1642
- locator: locator
1643
- }
1644
- };
1645
- props.onSelected(selected);
1646
- onClose();
1647
- };
1648
-
1649
- var getLoadError = function getLoadError() {
1650
- return React__default["default"].createElement("div", {
1651
- className: "piped-text-popover-container"
1652
- }, React__default["default"].createElement("div", {
1653
- className: "piped-text-error-container"
1654
- }, React__default["default"].createElement("div", {
1655
- className: "piped-text-error-icon"
1656
- }, React__default["default"].createElement(icons.ErrorIcon, {
1657
- size: "medium"
1658
- })), props.errorText && React__default["default"].createElement("div", {
1659
- className: "piped-text-error-text"
1660
- }, props.errorText)));
1661
- };
1662
-
1663
- var getLoadingSpinner = function getLoadingSpinner() {
1664
- return React__default["default"].createElement("div", {
1665
- className: "piped-text-loading-spinner"
1666
- }, React__default["default"].createElement(uiReact.LoadingSpinner, {
1667
- show: true,
1668
- size: "medium"
1669
- }));
1670
- };
1671
-
1672
- var getMenuContent = function getMenuContent() {
1673
- if (isLoadError) {
1674
- return getLoadError();
1675
- } else {
1676
- return React__default["default"].createElement("div", {
1677
- className: "piped-text-popover-menu"
1678
- }, React__default["default"].createElement("div", {
1679
- className: "piped-text-search-input"
1680
- }, React__default["default"].createElement("form", {
1681
- onSubmit: handleSearchSubmit
1682
- }, React__default["default"].createElement(uiReact.Input, {
1683
- small: true,
1684
- full: true,
1685
- placeholder: props.searchPlaceholder,
1686
- className: "q-plugin-popover-input",
1687
- value: searchValue,
1688
- onChange: function onChange($e) {
1689
- return onSearchInputChange($e);
1690
- },
1691
- onClick: function onClick($e) {
1692
- return handleSearchInputClick($e);
1693
- },
1694
- ref: searchBoxRefCb
1695
- }))), menuItems === undefined ? getLoadingSpinner() : menuChildren);
1696
- }
1697
- };
1698
-
1699
- return React__default["default"].createElement("div", {
1700
- className: "piped-text-menu"
1701
- }, React__default["default"].createElement(Popover, {
1702
- show: isMenuOpen,
1703
- onClose: _onClose,
1704
- placement: props.placement || 'right-start',
1705
- anchor: props.anchor,
1706
- ignoreClickSelector: props.ignoreClickSelector
1707
- }, React__default["default"].createElement("div", {
1708
- id: popoverAriaLabelledBy,
1709
- "aria-labelledby": externalAriaLabelledBy,
1710
- role: "menu",
1711
- className: "piped-text-popover-container",
1712
- ref: popoverRefCb,
1713
- onFocus: function onFocus($e) {
1714
- return handleFocus($e);
1715
- },
1716
- onKeyDown: function onKeyDown($e) {
1717
- return handleKeyDown($e);
1718
- },
1719
- tabIndex: props.tabIndex !== undefined ? props.tabIndex : -1
1720
- }, getMenuContent()), React__default["default"].createElement(OptionsPlaceholder, {
1721
- optionsRef: optionsRef
1722
- })));
1723
-
1724
- function handleKeyDown(evt) {
1725
- var nextFocusElIdx;
1726
-
1727
- if (evt.key === 'ArrowDown') {
1728
- if (higlightedItemIndex < menuChildren.length) {
1729
- nextFocusElIdx = higlightedItemIndex + 1;
1730
- menuChildren[nextFocusElIdx];
1731
- setHighlightedItemIndex(nextFocusElIdx);
1732
- }
1733
- } else if (evt.key === 'ArrowUp') ;
1734
- }
1735
-
1736
- function handleFocus(evt) {
1737
-
1738
- evt.stopPropagation();
1739
- }
1740
1777
  });
1741
1778
 
1742
- function OptionsPlaceholder() {
1743
- return React__default["default"].createElement("span", null);
1744
- }
1745
-
1746
- function closeSubmenus(menuItems) {
1747
- menuItems.forEach(function (item) {
1748
- if (item.show) {
1749
- item.show = false;
1750
- }
1751
- });
1752
- }
1753
-
1754
- function pipedTextDataAdapter(pipedTextData, recursed) {
1755
- var uniqueKey;
1756
-
1757
- if (!recursed) {
1758
- pipedTextData = _cloneDeep__default["default"](pipedTextData);
1759
- }
1760
-
1761
- uniqueKey = 1;
1762
- pipedTextData.forEach(function (pipedTextItem) {
1763
- pipedTextItem.key = pipedTextItem.key || uniqueKey++;
1764
- pipedTextItem.hasSubmenu = !!_get__default["default"](pipedTextItem, 'submenu.items.length') || typeof _get__default["default"](pipedTextItem, 'submenu.items') === 'function';
1765
-
1766
- if (pipedTextItem.hasSubmenu || pipedTextItem.value === EMBEDDED_DATA_LOCATOR) {
1767
- pipedTextItem.show = false;
1768
- }
1769
-
1770
- if (pipedTextItem.hasSubmenu) {
1771
- if (!(typeof pipedTextItem.submenu.items === 'function')) {
1772
- pipedTextDataAdapter(pipedTextItem.submenu.items, true);
1773
- }
1774
- }
1775
- });
1776
- return pipedTextData;
1777
- }
1778
-
1779
- function checkDefaultMenuItem(menuItem) {
1780
- return !(checkEmbeddedDataMenuItem(menuItem) || checkDecoratedMenuItem(menuItem) || checkSubmenuMenuItemItem(menuItem));
1781
- }
1782
-
1783
- function checkEmbeddedDataMenuItem(menuItem) {
1784
- return menuItem.value === EMBEDDED_DATA_LOCATOR;
1785
- }
1779
+ var PipedTextSearchInput = React__default["default"].forwardRef(function PipedTextSearchInput(props, ref) {
1780
+ var textInputRef = React__default["default"].useRef();
1781
+ return (React__default["default"].createElement("div", { className: 'piped-text-search-input', tabIndex: -1, ref: ref, onFocus: handleContainerFocus },
1782
+ React__default["default"].createElement("form", { onSubmit: props.onSearchSubmit },
1783
+ React__default["default"].createElement(uiReact.Input, { small: true, full: true, className: "q-plugin-popover-input", ref: textInputRef, placeholder: props.searchPlaceholder, value: props.value, onChange: props.onInputChange, onClick: props.onInputClick, onKeyDown: handleKeyDown, role: 'searchbox' }))));
1784
+ function handleKeyDown($e) {
1785
+ if (!TEXT_INPUT_KEYS_TO_ALLOW.includes($e.key)) {
1786
+ $e.stopPropagation();
1787
+ }
1788
+ }
1789
+ function handleContainerFocus($e) {
1790
+ var _a;
1791
+ if ($e.target !== textInputRef.current) {
1792
+ (_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
1793
+ }
1794
+ props.onFocus($e);
1795
+ }
1796
+ });
1786
1797
 
1787
- function checkDecoratedMenuItem(menuItem) {
1788
- return menuItem.header === true || menuItem.disabled === true;
1798
+ var PipedTextMenuList = React__default["default"].forwardRef(function PipedTextMenuList(props, ref) {
1799
+ var _this = this;
1800
+ var _a, _b;
1801
+ var _c = React.useState(false), isLoading = _c[0], setIsLoading = _c[1];
1802
+ var _d = React.useState(false), isLoadError = _d[0], setIsLoadError = _d[1];
1803
+ var _e = React.useState(), menuItems = _e[0], setMenuItems = _e[1];
1804
+ var _f = React.useState(), itemsToRender = _f[0], setItemsToRender = _f[1];
1805
+ var _g = React.useState(), menuChildren = _g[0], setMenuChildren = _g[1];
1806
+ var _h = React.useState(), focusMenuItems = _h[0], setFocusMenuItems = _h[1];
1807
+ var _j = React.useState(''), searchValue = _j[0], setSearchValue = _j[1];
1808
+ var _k = React.useState(false), autoFocusedOnOpen = _k[0], setAutoFocusedOnOpen = _k[1];
1809
+ var pipedTextMenuId = (_a = props.pipedTextMenuId) !== null && _a !== void 0 ? _a : useId();
1810
+ var externalAriaLabelledBy = props['aria-labelledby'];
1811
+ var localRef = React.useRef();
1812
+ var searchRef = React.useRef();
1813
+ /*
1814
+ We need to track whether or not the menu component has rendered, and the
1815
+ localRef is available, so that we can add it to the keyboardCtrl
1816
+ before the menuItems have finished loading
1817
+ */
1818
+ var _l = React.useState(false), isLocalRefReady = _l[0], setIsLocalRefReady = _l[1];
1819
+ var localRefReadyCb = React.useCallback(function (node) {
1820
+ if (node) {
1821
+ setIsLocalRefReady(true);
1822
+ }
1823
+ }, []);
1824
+ var _m = React.useState(false), isSearchRefReady = _m[0], setIsSearchRefReady = _m[1];
1825
+ var searchRefReadyCb = React.useCallback(function (node) {
1826
+ if (node) {
1827
+ setIsSearchRefReady(true);
1828
+ }
1829
+ }, []);
1830
+ var isRoot = props.keyboardCtrl === undefined;
1831
+ var _o = React.useState(isRoot
1832
+ ? new PipedTextMenuKeyboardCtrl
1833
+ : props.keyboardCtrl), keyboardCtrl = _o[0]; _o[1];
1834
+ var schedulePopoverUpdate = function () {
1835
+ var _a;
1836
+ if (typeof ((_a = props.popoverOptionsRef) === null || _a === void 0 ? void 0 : _a.current.scheduleUpdate) === 'function') {
1837
+ props.popoverOptionsRef.current.scheduleUpdate();
1838
+ }
1839
+ };
1840
+ React.useEffect(function () {
1841
+ var $destroy = function () {
1842
+ keyboardCtrl.removeMenu(localRef);
1843
+ };
1844
+ return $destroy;
1845
+ }, []);
1846
+ React.useEffect(function () {
1847
+ var nextMenuItemRefs, focusMenuItemRefs;
1848
+ if (localRef.current
1849
+ && searchRef.current
1850
+ && menuChildren
1851
+ && !isLoading) {
1852
+ focusMenuItemRefs = React__default["default"].Children.map(focusMenuItems, function (menuChild) {
1853
+ return menuChild.ref;
1854
+ });
1855
+ nextMenuItemRefs = __spreadArray([
1856
+ searchRef
1857
+ ], focusMenuItemRefs, true);
1858
+ keyboardCtrl.addMenu(localRef, nextMenuItemRefs);
1859
+ if (isRoot && (autoFocusedOnOpen === false)) {
1860
+ setTimeout(function () {
1861
+ var _a;
1862
+ /*
1863
+ Hack - see https://github.com/floating-ui/react-popper/issues/395
1864
+ Without this, the page jitters on focus as the page scroll position
1865
+ updates. Using setTimeout, we give Popper one render cycle to
1866
+ set its own position before triggering the autofocus - then the input
1867
+ element will have correct positioning by the time we call .focus()
1868
+ */
1869
+ (_a = localRef.current) === null || _a === void 0 ? void 0 : _a.focus();
1870
+ }, 0);
1871
+ setAutoFocusedOnOpen(true);
1872
+ }
1873
+ }
1874
+ }, [
1875
+ localRef,
1876
+ menuChildren,
1877
+ keyboardCtrl,
1878
+ isLoading,
1879
+ ]);
1880
+ React.useEffect(function () {
1881
+ var menuItemRefs;
1882
+ if (isLocalRefReady) {
1883
+ menuItemRefs = [];
1884
+ if (isSearchRefReady) {
1885
+ menuItemRefs.push(searchRef);
1886
+ }
1887
+ keyboardCtrl.addMenu(localRef, menuItemRefs);
1888
+ }
1889
+ }, [
1890
+ isLocalRefReady,
1891
+ isSearchRefReady,
1892
+ ]);
1893
+ React.useEffect(function () {
1894
+ if (props.items === undefined) {
1895
+ return;
1896
+ }
1897
+ (function () { return __awaiter(_this, void 0, void 0, function () {
1898
+ var rawMenuItems, nextMenuItems;
1899
+ return __generator(this, function (_a) {
1900
+ switch (_a.label) {
1901
+ case 0:
1902
+ if (!((typeof props.items) === 'function')) return [3 /*break*/, 5];
1903
+ setIsLoading(true);
1904
+ _a.label = 1;
1905
+ case 1:
1906
+ _a.trys.push([1, 3, , 4]);
1907
+ return [4 /*yield*/, props.items()];
1908
+ case 2:
1909
+ rawMenuItems = _a.sent();
1910
+ return [3 /*break*/, 4];
1911
+ case 3:
1912
+ _a.sent();
1913
+ setIsLoadError(true);
1914
+ return [3 /*break*/, 4];
1915
+ case 4:
1916
+ setIsLoading(false);
1917
+ return [3 /*break*/, 6];
1918
+ case 5:
1919
+ rawMenuItems = props.items;
1920
+ _a.label = 6;
1921
+ case 6:
1922
+ try {
1923
+ nextMenuItems = pipedTextDataAdapter(rawMenuItems);
1924
+ setMenuItems(nextMenuItems);
1925
+ }
1926
+ catch (e) {
1927
+ setIsLoadError(true);
1928
+ }
1929
+ return [2 /*return*/];
1930
+ }
1931
+ });
1932
+ }); })();
1933
+ }, [
1934
+ props.items,
1935
+ ]);
1936
+ React.useEffect(function () {
1937
+ var nextItemsToRender;
1938
+ if (menuItems === undefined) {
1939
+ return;
1940
+ }
1941
+ nextItemsToRender = (menuItems || []).filter(matchesSearch);
1942
+ setItemsToRender(nextItemsToRender);
1943
+ }, [
1944
+ searchValue,
1945
+ menuItems,
1946
+ ]);
1947
+ React.useEffect(function () {
1948
+ var nextMenuChildren;
1949
+ if (!Array.isArray(itemsToRender)) {
1950
+ return;
1951
+ }
1952
+ nextMenuChildren = getPipedTextMenuItems(itemsToRender);
1953
+ setMenuChildren(nextMenuChildren);
1954
+ }, [
1955
+ itemsToRender,
1956
+ ]);
1957
+ schedulePopoverUpdate();
1958
+ return (React__default["default"].createElement("div", { className: "piped-text-menu-list ".concat((_b = props.className) !== null && _b !== void 0 ? _b : ''), ref: mergeRefs([
1959
+ ref,
1960
+ localRef,
1961
+ localRefReadyCb,
1962
+ ]), id: pipedTextMenuId, "aria-labelledby": externalAriaLabelledBy, role: "menu",
1963
+ // role="listbox"
1964
+ tabIndex: (props.tabIndex === undefined)
1965
+ ? -1
1966
+ : props.tabIndex, onKeyDown: function ($e) {
1967
+ handleKeyDown($e);
1968
+ }, onFocus: function ($e) {
1969
+ handleMenuListFocus($e);
1970
+ } },
1971
+ React__default["default"].createElement("div", { className: "piped-text-popover-menu", role: 'presentation' }, ((isLoadError)
1972
+ ? (React__default["default"].createElement(PipedTextMenuLoadError, { errorText: props.errorText }))
1973
+ : (React__default["default"].createElement(React__default["default"].Fragment, null,
1974
+ React__default["default"].createElement(PipedTextSearchInput, { ref: mergeRefs([
1975
+ searchRef,
1976
+ searchRefReadyCb,
1977
+ ]), value: searchValue, onSearchSubmit: handleSearchSubmit, searchPlaceholder: props.searchPlaceholder, onInputChange: function ($e) { return onSearchInputChange($e); }, onInputClick: function ($e) { return handleSearchInputClick($e); }, onFocus: function () {
1978
+ handleSearchFocus();
1979
+ } }),
1980
+ (isLoading)
1981
+ ? (React__default["default"].createElement("div", { className: "piped-text-loading-spinner" },
1982
+ React__default["default"].createElement(uiReact.LoadingSpinner, { show: true, size: "medium" })))
1983
+ : menuChildren))))));
1984
+ function handleMenuListFocus($e) {
1985
+ var _a;
1986
+ if ($e.currentTarget === localRef.current) {
1987
+ keyboardCtrl.setFocus(localRef.current);
1988
+ if (keyboardCtrl.getFocusMenuHighlightedIdx(localRef) === -1) {
1989
+ (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
1990
+ }
1991
+ $e.stopPropagation();
1992
+ $e.preventDefault();
1993
+ }
1994
+ }
1995
+ function handleKeyDown($e) {
1996
+ var currFocusMenuContainerRef;
1997
+ switch ($e.key) {
1998
+ case 'Tab':
1999
+ onClose();
2000
+ }
2001
+ props === null || props === void 0 ? void 0 : props.menuKeyDown($e);
2002
+ currFocusMenuContainerRef = keyboardCtrl.getCurrentFocusMenuRef();
2003
+ if (localRef.current !== (currFocusMenuContainerRef === null || currFocusMenuContainerRef === void 0 ? void 0 : currFocusMenuContainerRef.current)) {
2004
+ return;
2005
+ }
2006
+ switch ($e.key) {
2007
+ case 'ArrowDown':
2008
+ case 'ArrowUp':
2009
+ case 'ArrowRight':
2010
+ case 'ArrowLeft':
2011
+ case 'Escape':
2012
+ case 'PageUp':
2013
+ case 'Home':
2014
+ case 'PageDown':
2015
+ case 'End':
2016
+ keyboardCtrl.handleKeyEvent($e);
2017
+ $e.preventDefault(); // prevent scroll
2018
+ break;
2019
+ }
2020
+ }
2021
+ function onClose() {
2022
+ var _a;
2023
+ (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
2024
+ }
2025
+ function onSearchInputChange(evt) {
2026
+ var nextSearchValue;
2027
+ nextSearchValue = evt.target.value;
2028
+ setSearchValue(nextSearchValue);
2029
+ }
2030
+ function handleSearchInputClick(evt) {
2031
+ evt.stopPropagation();
2032
+ }
2033
+ function matchesSearch(menuItem) {
2034
+ var searchVal;
2035
+ searchVal = searchValue || '';
2036
+ return JSON.stringify(menuItem).toLowerCase().includes(searchVal.toLowerCase());
2037
+ }
2038
+ function handleSearchSubmit(e) {
2039
+ var searchVal, locator, selected;
2040
+ e.preventDefault();
2041
+ if (!(props.allowCustom === true && props.customScheme)) {
2042
+ return;
2043
+ }
2044
+ searchVal = searchValue.trim();
2045
+ if (searchVal === '') {
2046
+ return;
2047
+ }
2048
+ locator = "${".concat(props.customScheme, "://Field/").concat(encodeURIComponent(searchVal), "}");
2049
+ selected = {
2050
+ value: {
2051
+ locator: locator,
2052
+ },
2053
+ };
2054
+ props.onSelected(selected);
2055
+ onClose();
2056
+ }
2057
+ function getPipedTextMenuItems(_menuItems) {
2058
+ var pipedTextMenuItems, nextFocusMenuItems;
2059
+ var focusItemIdx, currHighlightedIdx;
2060
+ pipedTextMenuItems = [];
2061
+ nextFocusMenuItems = [];
2062
+ if (_menuItems.length === 0 && props.allowCustom === true && props.customInputMessage) {
2063
+ return (React__default["default"].createElement("div", null,
2064
+ React__default["default"].createElement("div", { className: "piped-text-information-message" }, props.customInputMessage)));
2065
+ }
2066
+ focusItemIdx = 0;
2067
+ currHighlightedIdx = keyboardCtrl.getFocusMenuHighlightedIdx(localRef);
2068
+ pipedTextMenuItems = _menuItems.map(function (menuItem) {
2069
+ var isFocusable, menuItemEl;
2070
+ var isHighlighted;
2071
+ var menuItemRef = React__default["default"].createRef();
2072
+ isFocusable = checkMenuItemFocusable(menuItem);
2073
+ isHighlighted = (isFocusable) && ((currHighlightedIdx - 1) === focusItemIdx);
2074
+ menuItemEl = (React__default["default"].createElement(PipedTextMenuItem, { ref: menuItemRef, key: menuItem.key, menuItem: menuItem, onSubmenuHover: submenuHovered, onMenuItemHover: menuSelectItemHovered, onMenuItemClicked: menuItemClicked, onSubmenuItemClick: submenuItemClicked, onEmbeddedDataItemClick: embeddedDataItemClicked, keyboardCtrl: keyboardCtrl, isHighlighted: isHighlighted }));
2075
+ if (isFocusable) {
2076
+ nextFocusMenuItems.push(menuItemEl);
2077
+ focusItemIdx++;
2078
+ }
2079
+ return menuItemEl;
2080
+ });
2081
+ setFocusMenuItems(nextFocusMenuItems);
2082
+ return pipedTextMenuItems;
2083
+ }
2084
+ function submenuHovered(menuItem, menuItemRef) {
2085
+ var nextMenuItems;
2086
+ nextMenuItems = menuItems.slice();
2087
+ handleMenuItemHovered(menuItem, menuItemRef);
2088
+ closeSubmenus(nextMenuItems);
2089
+ setMenuItems(nextMenuItems);
2090
+ if (!menuItem.show) {
2091
+ menuItem.show = true;
2092
+ }
2093
+ }
2094
+ function menuSelectItemHovered(menuItem, menuItemRef) {
2095
+ var nextMenuItems;
2096
+ nextMenuItems = menuItems.slice();
2097
+ handleMenuItemHovered(menuItem, menuItemRef);
2098
+ closeSubmenus(nextMenuItems);
2099
+ setMenuItems(nextMenuItems);
2100
+ }
2101
+ function handleSearchFocus() {
2102
+ var _a;
2103
+ var nextMenuItems;
2104
+ nextMenuItems = (_a = menuItems === null || menuItems === void 0 ? void 0 : menuItems.slice()) !== null && _a !== void 0 ? _a : [];
2105
+ keyboardCtrl.setFocusMenuHighlightedIdx(localRef, searchRef);
2106
+ closeSubmenus(nextMenuItems);
2107
+ setMenuItems(nextMenuItems);
2108
+ }
2109
+ function handleMenuItemHovered(menuItem, menuItemRef) {
2110
+ var _a;
2111
+ keyboardCtrl.setFocusMenuHighlightedIdx(localRef, menuItemRef);
2112
+ (_a = menuItemRef.current) === null || _a === void 0 ? void 0 : _a.focus();
2113
+ }
2114
+ function menuItemClicked(menuItem) {
2115
+ if (!menuItem.disabled) {
2116
+ props.onSelected(menuItem);
2117
+ }
2118
+ }
2119
+ function submenuItemClicked(menuItem) {
2120
+ console.log('PipedTextMenuList submenu click');
2121
+ keyboardCtrl.focusNextSubmenu();
2122
+ }
2123
+ function embeddedDataItemClicked(menuItem) {
2124
+ // let nextMenuItems: PipedTextMenuItemData[];
2125
+ // nextMenuItems = menuItems.slice();
2126
+ // menuItem.show = true;
2127
+ // setMenuItems(nextMenuItems);
2128
+ }
2129
+ });
2130
+ function closeSubmenus(menuItems) {
2131
+ menuItems.forEach(function (item) {
2132
+ if (item.show) {
2133
+ item.show = false;
2134
+ }
2135
+ });
1789
2136
  }
1790
2137
 
1791
- function checkSubmenuMenuItemItem(menuItem) {
1792
- return !!menuItem.hasSubmenu;
1793
- }
2138
+ var css_248z$e = "div[role=\"menu\"] .piped-text-search-input-container {\n padding: 5px 10px; }\n\n.piped-text-search-input {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .piped-text-search-input input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n\n.piped-text-menu-empty-anchor {\n /* the margin-right hack was not in harmony with tao.\n now, the empty-anchor is truly empty */ }\n\n.piped-text-submenu-item-container {\n position: relative; }\n .piped-text-submenu-item-container .piped-text-menu .piped-text-submenu-anchor {\n position: absolute;\n z-index: -1;\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n min-width: 100%; }\n\n.piped-text-submenu-item {\n padding-right: 24px; }\n\n.piped-text-information-message {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n color: #74777A;\n text-align: center;\n white-space: pre-line; }\n\n.piped-text-loading-spinner {\n width: fit-content;\n margin: 0 auto; }\n\n.piped-text-error-container {\n color: #BB0000; }\n .piped-text-error-container .piped-text-error-icon {\n padding: 8px 0; }\n .piped-text-error-container .piped-text-error-icon svg {\n fill: #BB0000;\n display: block;\n margin: 0 auto; }\n .piped-text-error-container .piped-text-error-text {\n text-align: center;\n white-space: pre-line;\n padding: 0 12px 8px; }\n";
2139
+ styleInject(css_248z$e);
1794
2140
 
1795
- function checkMenuItemFocusable(menuItem) {
1796
- var isEmbeddedData, isSubmenu, isDefaultMenuItem;
1797
- isEmbeddedData = checkEmbeddedDataMenuItem(menuItem);
1798
- isSubmenu = checkSubmenuMenuItemItem(menuItem);
1799
- isDefaultMenuItem = checkDefaultMenuItem(menuItem);
1800
- return isEmbeddedData || isSubmenu || isDefaultMenuItem;
2141
+ /* eslint-disable-next-line prefer-arrow-callback */
2142
+ var PipedTextMenu = React__default["default"].forwardRef(function PipedTextMenu(props, ref) {
2143
+ var optionsRef = React.useRef({});
2144
+ var _a = React.useState(props.show), isMenuOpen = _a[0], setIsMenuOpen = _a[1];
2145
+ var externalAriaLabelledBy = props['aria-labelledby'];
2146
+ var onClose = props.onClose || (function () { return undefined; });
2147
+ /*
2148
+ This ref is left for use cases where the
2149
+ container popover may need to be referenced
2150
+ directly
2151
+ */
2152
+ var _b = React.useState(null); _b[0]; var setPopoverEl = _b[1];
2153
+ var popoverRefCb = React.useCallback(function (el) {
2154
+ setPopoverEl(el);
2155
+ }, []);
2156
+ React.useEffect(function () {
2157
+ if (props.show) {
2158
+ setIsMenuOpen(true);
2159
+ }
2160
+ }, [props.show]);
2161
+ React.useEffect(function () {
2162
+ return function () { return onClose(); };
2163
+ }, []);
2164
+ var _onClose = function () {
2165
+ onToggleClick(false);
2166
+ onClose();
2167
+ };
2168
+ var onToggleClick = function (force) {
2169
+ var nextIsMenuOpen;
2170
+ nextIsMenuOpen = ((typeof force) === 'boolean')
2171
+ ? force
2172
+ : !isMenuOpen;
2173
+ setIsMenuOpen(nextIsMenuOpen);
2174
+ };
2175
+ return (React__default["default"].createElement("div", { className: "piped-text-menu" },
2176
+ React__default["default"].createElement(Popover, { show: isMenuOpen, onClose: _onClose, placement: props.placement || 'right-start', anchor: props.anchor, ignoreClickSelector: props.ignoreClickSelector },
2177
+ React__default["default"].createElement(PipedTextMenuList, { className: "piped-text-popover-container", items: props.items, errorText: props.errorText, "aria-labelledby": externalAriaLabelledBy, ref: popoverRefCb, allowCustom: props.allowCustom, customInputMessage: props.customInputMessage, customScheme: props.customScheme, searchPlaceholder: props.searchPlaceholder, onSelected: function (menuItem) {
2178
+ props.onSelected(menuItem);
2179
+ closeAndFocusAnchor();
2180
+ }, onClose: function () { return onClose(); }, popoverOptionsRef: optionsRef, keyboardCtrl: props.keyboardCtrl, menuKeyDown: handleMenuKeyDown, pipedTextMenuId: props.pipedTextMenuId }),
2181
+ React__default["default"].createElement(OptionsPlaceholder, { optionsRef: optionsRef }))));
2182
+ function handleMenuKeyDown($e) {
2183
+ switch ($e.key) {
2184
+ case 'Tab':
2185
+ case 'Escape':
2186
+ closeAndFocusAnchor();
2187
+ break;
2188
+ }
2189
+ }
2190
+ function closeAndFocusAnchor() {
2191
+ var _a, _b;
2192
+ onClose();
2193
+ (_b = (_a = props.anchorRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.focus();
2194
+ }
2195
+ });
2196
+ function OptionsPlaceholder(props) {
2197
+ return (React__default["default"].createElement("div", null));
2198
+ }
2199
+ /*
2200
+ Takes piped text menu input data and formats it to be compatible
2201
+ with the piped-text-select component(s)
2202
+ */
2203
+ function pipedTextDataAdapter(pipedTextData, recursed) {
2204
+ var uniqueKey;
2205
+ if (!recursed) {
2206
+ pipedTextData = _cloneDeep__default["default"](pipedTextData);
2207
+ }
2208
+ uniqueKey = 1;
2209
+ pipedTextData.forEach(function (pipedTextItem) {
2210
+ pipedTextItem.key = pipedTextItem.key || uniqueKey++;
2211
+ pipedTextItem.hasSubmenu = (!!_get__default["default"](pipedTextItem, 'submenu.items.length') || ((typeof _get__default["default"](pipedTextItem, 'submenu.items')) === 'function'));
2212
+ if (pipedTextItem.hasSubmenu || pipedTextItem.value === EMBEDDED_DATA_LOCATOR) {
2213
+ pipedTextItem.show = false; // used by menu component to show/hide submenu popover
2214
+ }
2215
+ if (pipedTextItem.hasSubmenu) {
2216
+ if (!(typeof pipedTextItem.submenu.items === 'function')) {
2217
+ pipedTextDataAdapter(pipedTextItem.submenu.items, true);
2218
+ }
2219
+ }
2220
+ });
2221
+ return pipedTextData;
1801
2222
  }
1802
2223
 
1803
2224
  var css_248z$d = ".piped-text-dropdown button[type=button].popover-toggle-button {\n min-width: 128px; }\n\n.piped-text-popover-container {\n padding: 0; }\n .piped-text-popover-container > * {\n min-height: 32px; }\n .piped-text-popover-container .piped-text-submenu-item .label-text, .piped-text-popover-container .piped-text-submenu-item > .piped-text-icon {\n display: inline-block;\n vertical-align: middle;\n overflow-wrap: break-word;\n word-wrap: break-word;\n -webkit-hyphens: auto;\n -ms-hyphens: auto;\n -moz-hyphens: auto;\n hyphens: auto; }\n .piped-text-popover-container .piped-text-submenu-item .piped-text-icon {\n display: inline-block;\n box-sizing: content-box;\n position: absolute;\n right: 0;\n max-width: 24px;\n min-width: 24px;\n max-height: 24px; }\n .piped-text-popover-container .piped-text-submenu-item .piped-text-icon > svg {\n position: relative;\n margin-left: -5px;\n margin-top: -3px; }\n";
@@ -1874,7 +2295,7 @@ function PipedTextSelect(props) {
1874
2295
  }
1875
2296
  }
1876
2297
 
1877
- var css_248z$c = ".piped-text-input .piped-text-input-toggle, .piped-text-input .piped-text-select-container {\n display: inline-block; }\n\n.piped-text-input .piped-text-input-toggle {\n display: flex; }\n .piped-text-input .piped-text-input-toggle input {\n flex: 1 1;\n box-sizing: border-box; }\n .piped-text-input .piped-text-input-toggle input:first-child {\n border-right: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .piped-text-input .piped-text-input-toggle.multiline-input textarea {\n flex: 1 1;\n box-sizing: border-box; }\n .piped-text-input .piped-text-input-toggle input + button, .piped-text-input .piped-text-input-toggle textarea + button {\n margin-left: 4px; }\n\n.piped-text-input .addon-text-container {\n /*\n These styles are intended to match CFE QDS components,\n notably FormField and InputField.\n See: https://gitlab-app.eng.qops.net/cfe/ui/-/blob/master/packages/ui-react/src/FormField/Caption.less\n */\n margin-top: 6px; }\n .piped-text-input .addon-text-container .helper-text, .piped-text-input .addon-text-container .error-text {\n font-size: 12px; }\n .piped-text-input .addon-text-container .helper-text {\n color: #74777a;\n fill: #74777a; }\n .piped-text-input .addon-text-container .helper-text + .error-text {\n margin-top: 4px; }\n .piped-text-input .addon-text-container .error-text {\n display: flex;\n align-items: center;\n color: #b00;\n fill: #b00; }\n .piped-text-input .addon-text-container .error-text .error-text-icon svg {\n margin-left: -2px;\n margin-right: 3px;\n width: 16px;\n height: 16px; }\n";
2298
+ var css_248z$c = ".piped-text-input .piped-text-input-toggle, .piped-text-input .piped-text-select-container {\n display: inline-block; }\n\n.piped-text-input .piped-text-input-toggle {\n display: flex; }\n .piped-text-input .piped-text-input-toggle input {\n flex: 1 1;\n box-sizing: border-box; }\n .piped-text-input .piped-text-input-toggle.multiline-input textarea {\n flex: 1 1;\n box-sizing: border-box; }\n .piped-text-input .piped-text-input-toggle input + button, .piped-text-input .piped-text-input-toggle textarea + button {\n margin-left: 4px; }\n\n.piped-text-input .addon-text-container {\n /*\n These styles are intended to match CFE QDS components,\n notably FormField and InputField.\n See: https://gitlab-app.eng.qops.net/cfe/ui/-/blob/master/packages/ui-react/src/FormField/Caption.less\n */\n margin-top: 6px; }\n .piped-text-input .addon-text-container .helper-text, .piped-text-input .addon-text-container .error-text {\n font-size: 12px; }\n .piped-text-input .addon-text-container .helper-text {\n color: #74777a;\n fill: #74777a; }\n .piped-text-input .addon-text-container .helper-text + .error-text {\n margin-top: 4px; }\n .piped-text-input .addon-text-container .error-text {\n display: flex;\n align-items: center;\n color: #b00;\n fill: #b00; }\n .piped-text-input .addon-text-container .error-text .error-text-icon svg {\n margin-left: -2px;\n margin-right: 3px;\n width: 16px;\n height: 16px; }\n";
1878
2299
  styleInject(css_248z$c);
1879
2300
 
1880
2301
  function PipedTextInput(props) {
@@ -2184,7 +2605,7 @@ function FieldItem(props) {
2184
2605
  }, label);
2185
2606
  }
2186
2607
 
2187
- var css_248z$9 = ".task-fields {\n margin-right: 100px; }\n .task-fields .add-field-button .add-field-button-label {\n padding: 0 3px; }\n .task-fields .field-headers {\n margin-bottom: 10px;\n padding-left: 12px; }\n .task-fields .field-headers .field-row {\n color: #6A6D70;\n font-weight: bold; }\n .task-fields .field-headers .field-row .field-selector label, .task-fields .field-headers .field-row .field-input label {\n font-size: 12px; }\n .task-fields .field-headers .field-row .field-selector {\n padding-top: 0;\n padding-right: 24px;\n padding-bottom: 0;\n padding-left: 0; }\n .task-fields .field-headers .field-row .field-input {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n padding-left: 12px; }\n .task-fields .field-rows {\n padding-bottom: 12px; }\n .task-fields .field-rows .field-row {\n border-top: 1px solid #E5E5E5; }\n .task-fields .field-rows .field-row .field-selector {\n padding-top: 8px;\n padding-right: 12px;\n padding-bottom: 8px;\n padding-left: 12px; }\n .task-fields .field-rows .field-row .field-input {\n border-left: 1px solid #E5E5E5;\n padding-top: 8px;\n padding-right: 0;\n padding-bottom: 8px;\n padding-left: 12px; }\n\n.q-popover .field-item {\n padding: 5px 32px; }\n .q-popover .field-item:hover {\n cursor: pointer;\n user-select: none;\n background: #007ac0;\n color: #fff;\n fill: #fff; }\n";
2608
+ var css_248z$9 = ".task-fields .add-field-button {\n margin-right: 100px; }\n .task-fields .add-field-button .add-field-button-label {\n padding: 0 3px; }\n\n.task-fields .field-table {\n padding-right: 100px;\n overflow-x: auto; }\n .task-fields .field-table .field-headers {\n margin-bottom: 10px;\n padding-left: 12px; }\n .task-fields .field-table .field-headers .field-row {\n color: #6A6D70;\n font-weight: bold; }\n .task-fields .field-table .field-headers .field-row .field-selector label, .task-fields .field-table .field-headers .field-row .field-input label {\n font-size: 12px; }\n .task-fields .field-table .field-headers .field-row .field-selector {\n padding-top: 0;\n padding-right: 24px;\n padding-bottom: 0;\n padding-left: 0; }\n .task-fields .field-table .field-headers .field-row .field-input {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n padding-left: 12px; }\n .task-fields .field-table .field-rows {\n padding-bottom: 12px; }\n .task-fields .field-table .field-rows .field-row {\n border-top: 1px solid #E5E5E5; }\n .task-fields .field-table .field-rows .field-row .field-selector {\n padding-top: 8px;\n padding-right: 12px;\n padding-bottom: 8px;\n padding-left: 12px; }\n .task-fields .field-table .field-rows .field-row .field-input {\n border-left: 1px solid #E5E5E5;\n padding-top: 8px;\n padding-right: 0;\n padding-bottom: 8px;\n padding-left: 12px; }\n\n.q-popover .field-item {\n padding: 5px 32px; }\n .q-popover .field-item:hover {\n cursor: pointer;\n user-select: none;\n background: #007ac0;\n color: #fff;\n fill: #fff; }\n";
2188
2609
  styleInject(css_248z$9);
2189
2610
 
2190
2611
  var uuidv4 = uuid__default["default"].v4;
@@ -2457,6 +2878,9 @@ function TaskFields(props) {
2457
2878
  }, [props.values]);
2458
2879
  return React__default["default"].createElement("div", {
2459
2880
  className: "task-fields"
2881
+ }, React__default["default"].createElement("div", {
2882
+ className: "field-table",
2883
+ tabIndex: "0"
2460
2884
  }, React__default["default"].createElement("div", {
2461
2885
  className: "field-headers"
2462
2886
  }, React__default["default"].createElement(AddFieldHeaders, {
@@ -2464,7 +2888,7 @@ function TaskFields(props) {
2464
2888
  inputHeaderText: props.fieldInputsHeaderText
2465
2889
  })), React__default["default"].createElement("div", {
2466
2890
  className: "field-rows"
2467
- }, getFieldRows()), React__default["default"].createElement("div", {
2891
+ }, getFieldRows())), React__default["default"].createElement("div", {
2468
2892
  className: "add-field-container"
2469
2893
  }, React__default["default"].createElement(AddFieldButton, {
2470
2894
  label: props.addFieldLabel,
@@ -2833,41 +3257,37 @@ function SearchItem(props) {
2833
3257
  }, props.children);
2834
3258
  }
2835
3259
 
2836
- var css_248z$5 = ".capture-event .capture-event-controls {\n display: flex;\n align-items: center;\n gap: 10px;\n margin-bottom: 15px; }\n .capture-event .capture-event-controls .waiting-message {\n display: flex;\n align-items: center; }\n .capture-event .capture-event-controls .waiting-message .waiting-label {\n color: #74777a;\n margin-left: 8px; }\n\n.capture-event .payload-block {\n text-align: left; }\n .capture-event .payload-block .payload-label {\n text-decoration: underline;\n margin-bottom: 3px; }\n";
3260
+ var css_248z$5 = ".capture-event .capture-event-controls {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 20px; }\n .capture-event .capture-event-controls .status-message {\n font-size: 12px;\n line-height: 16px;\n display: flex;\n align-items: center;\n gap: 4px; }\n .capture-event .capture-event-controls .status-message.pending {\n color: #74777a; }\n .capture-event .capture-event-controls .status-message.success {\n color: #107e3e;\n fill: #107e3e; }\n .capture-event .capture-event-controls .status-message.failure {\n color: #bb0000;\n fill: #bb0000; }\n";
2837
3261
  styleInject(css_248z$5);
2838
3262
 
2839
3263
  function CaptureEvent(props) {
2840
- var _a = React.useState(props.payload), payload = _a[0]; _a[1];
2841
- var _b = React.useState(props.capturing || false), capturing = _b[0], setCapturing = _b[1];
2842
- var _c = React.useState(props.waitingForEventTranslation), waitingLabel = _c[0], setWaitingLabel = _c[1];
2843
3264
  return (React__default["default"].createElement("div", { className: "capture-event" },
2844
3265
  React__default["default"].createElement("div", { className: "capture-event-controls" },
2845
3266
  getCaptureEventButton(),
2846
- capturing && (React__default["default"].createElement("div", { className: "waiting-message" },
2847
- React__default["default"].createElement(uiReact.LoadingSpinner, { show: true, size: 'small' }),
2848
- React__default["default"].createElement("div", { className: "waiting-label" }, waitingLabel)))),
2849
- payload && (React__default["default"].createElement("div", { className: "payload-block" },
2850
- React__default["default"].createElement("div", { className: "payload-label" }, "".concat(props.payloadTranslation, ":")),
2851
- React__default["default"].createElement("div", { className: "payload" },
2852
- React__default["default"].createElement("pre", null, payload))))));
3267
+ getStatusMessage()),
3268
+ props.payload !== undefined && (React__default["default"].createElement(uiReact.FormField, { isReadOnly: true },
3269
+ React__default["default"].createElement(uiReact.InputField, { "aria-readonly": true, label: props.payloadLabelTranslation, multiline: true, readOnly: true, full: true, value: props.payload, className: "polled-response-output" })))));
2853
3270
  function getCaptureEventButton() {
2854
- if (capturing) {
3271
+ if (props.status === 'pending') {
2855
3272
  return (React__default["default"].createElement("div", { className: "capture-event-button-container" },
2856
- React__default["default"].createElement(uiReact.Button, { kind: "secondary", onClick: cancelCapture }, props.cancelCaptureTranslation)));
3273
+ React__default["default"].createElement(uiReact.Button, { kind: "secondary", onClick: function () { return props.onCancel(); } }, props.cancelCaptureTranslation)));
2857
3274
  }
2858
3275
  else {
2859
3276
  return (React__default["default"].createElement("div", { className: "capture-event-button-container" },
2860
- React__default["default"].createElement(uiReact.Button, { kind: "primary", onClick: startCapture }, props.captureNextEventTranslation)));
3277
+ React__default["default"].createElement(uiReact.Button, { kind: "primary", onClick: function () { return props.onStart(); } }, props.startCaptureTranslation)));
2861
3278
  }
2862
3279
  }
2863
- function startCapture() {
2864
- setCapturing(true);
2865
- props.onStart();
2866
- }
2867
- function cancelCapture() {
2868
- setCapturing(false);
2869
- setWaitingLabel(props.waitingForEventTranslation);
2870
- props.onCancel();
3280
+ function getStatusMessage() {
3281
+ var statusMessages = {
3282
+ default: ['', undefined],
3283
+ pending: [props.pendingStatusTranslation, React__default["default"].createElement(uiReact.LoadingSpinner, { size: "small", show: true })],
3284
+ success: [props.successStatusTranslation, React__default["default"].createElement(icons.SuccessIcon, { size: "small" })],
3285
+ failure: [props.failureStatusTranslation, React__default["default"].createElement(icons.ErrorIcon, { size: "small" })]
3286
+ };
3287
+ var _a = statusMessages[props.status], statusLabel = _a[0], statusIcon = _a[1];
3288
+ return (React__default["default"].createElement("div", { className: "status-message ".concat(props.status) },
3289
+ statusIcon,
3290
+ statusLabel));
2871
3291
  }
2872
3292
  }
2873
3293
 
@@ -2926,10 +3346,10 @@ var FieldMapperKey = React__default["default"].forwardRef(function FieldMapperKe
2926
3346
  availableFields = Array.isArray(props.availableFields)
2927
3347
  ? props.availableFields
2928
3348
  : [];
2929
- onFieldKeyChange = (typeof props.onFieldKeyChange === 'function')
2930
- ? props.onFieldKeyChange
3349
+ onFieldKeyChange = (typeof props.onChange === 'function')
3350
+ ? props.onChange
2931
3351
  : function () { return undefined; };
2932
- return (React__default["default"].createElement("div", { className: "field-mapper-key", ref: ref }, (React__default["default"].Children.count(props.children) > 0)
3352
+ return (React__default["default"].createElement("div", { className: "field-mapper-key" + (props.className ? ' ' + props.className : ''), ref: ref }, (React__default["default"].Children.count(props.children) > 0)
2933
3353
  ? props.children
2934
3354
  : (React__default["default"].createElement("div", { className: "field-mapper-key-dropdown" }, fieldMapperKeyDropdownDisabled()
2935
3355
  ? (React__default["default"].createElement(uiReact.Button, { disabled: true }, (_a = props.selectedField) === null || _a === void 0 ? void 0 : _a.label))
@@ -2964,14 +3384,14 @@ styleInject(css_248z);
2964
3384
 
2965
3385
  var FieldMapperValue = React__default["default"].forwardRef(function FieldMapperValue(props, ref) {
2966
3386
  var _a, _b;
2967
- return (React__default["default"].createElement("div", { className: "field-mapper-value" }, (React__default["default"].Children.count(props.children) > 0)
3387
+ return (React__default["default"].createElement("div", { className: "field-mapper-value" + (props.className ? ' ' + props.className : ''), ref: ref }, (React__default["default"].Children.count(props.children) > 0)
2968
3388
  ? props.children
2969
3389
  : (React__default["default"].createElement("div", { className: "piped-text-input-value-container" },
2970
3390
  React__default["default"].createElement(PipedTextInput, { items: (_a = props.pipedTextItems) !== null && _a !== void 0 ? _a : [], onChange: (_b = props.onChange) !== null && _b !== void 0 ? _b : (function () { return undefined; }) })))));
2971
3391
  });
2972
3392
 
2973
3393
  var FieldMapperRow = React__default["default"].forwardRef(function FieldMapperRow(props, ref) {
2974
- return (React__default["default"].createElement("div", { className: "field-mapper-row", ref: ref },
3394
+ return (React__default["default"].createElement("div", { className: "field-mapper-row" + (props.className ? ' ' + props.className : ''), ref: ref },
2975
3395
  React__default["default"].createElement("div", { className: "field-mapper-row-content" },
2976
3396
  React__default["default"].Children.map(props.children, function (child) {
2977
3397
  return getWrappedKeyValue(child);
@@ -2992,8 +3412,8 @@ var FieldMapperRow = React__default["default"].forwardRef(function FieldMapperRo
2992
3412
  var _a, _b, _c, _d;
2993
3413
  var wrappedEl;
2994
3414
  var fieldMapperKeyProps, fieldMapperValueProps;
2995
- var includeAvailableFields, includeSelectedField;
2996
- var includePipedTextItems, includeOnChange;
3415
+ var includeAvailableFields, includeSelectedField, includeOnFieldKeyChange;
3416
+ var includePipedTextItems, includeOnFieldValueChange;
2997
3417
  fieldMapperKeyProps = {};
2998
3418
  fieldMapperValueProps = {};
2999
3419
  switch (child.type) {
@@ -3002,12 +3422,19 @@ var FieldMapperRow = React__default["default"].forwardRef(function FieldMapperRo
3002
3422
  && (((_a = props.availableFields) === null || _a === void 0 ? void 0 : _a.length) > 0));
3003
3423
  includeSelectedField = (((typeof child.props.selectedField) !== 'object')
3004
3424
  && (props.selectedField !== undefined));
3425
+ includeOnFieldKeyChange = (((typeof child.props.onChange) !== 'function')
3426
+ && ((typeof props.onFieldKeyChange) === 'function'));
3005
3427
  if (includeAvailableFields) {
3006
3428
  fieldMapperKeyProps.availableFields = (_c = (_b = props.availableFields) === null || _b === void 0 ? void 0 : _b.slice()) !== null && _c !== void 0 ? _c : [];
3007
3429
  }
3008
3430
  if (includeSelectedField) {
3009
3431
  fieldMapperKeyProps.selectedField = Object.assign({}, props.selectedField);
3010
3432
  }
3433
+ if (includeOnFieldKeyChange) {
3434
+ fieldMapperKeyProps.onChange = function (prevField, fieldItem) {
3435
+ props.onFieldKeyChange(prevField, fieldItem);
3436
+ };
3437
+ }
3011
3438
  if (React__default["default"].isValidElement(child)
3012
3439
  && (includeAvailableFields
3013
3440
  || includeSelectedField)) {
@@ -3018,14 +3445,14 @@ var FieldMapperRow = React__default["default"].forwardRef(function FieldMapperRo
3018
3445
  case FieldMapperValue:
3019
3446
  includePipedTextItems = (!Array.isArray(child.props.pipedTextItems)
3020
3447
  && (((_d = props.pipedTextItems) === null || _d === void 0 ? void 0 : _d.length) > 0));
3021
- includeOnChange = (((typeof child.props.onChange) !== 'function')
3022
- && ((typeof props.onChange) === 'function'));
3448
+ includeOnFieldValueChange = (((typeof child.props.onChange) !== 'function')
3449
+ && ((typeof props.onFieldValueChange) === 'function'));
3023
3450
  if (includePipedTextItems) {
3024
3451
  fieldMapperValueProps.pipedTextItems = props.pipedTextItems;
3025
3452
  }
3026
- if (includeOnChange) {
3453
+ if (includeOnFieldValueChange) {
3027
3454
  fieldMapperValueProps.onChange = function (value) {
3028
- props.onChange(props.selectedField, value);
3455
+ props.onFieldValueChange(props.selectedField, value);
3029
3456
  };
3030
3457
  }
3031
3458
  if (React__default["default"].isValidElement(child)
@@ -3078,7 +3505,7 @@ var FieldMapper = React__default["default"].forwardRef(function FieldMapper(prop
3078
3505
  var _a, _b, _c;
3079
3506
  var wrappedEl;
3080
3507
  var fieldMapperRowProps;
3081
- var includeAvailableFields, includeOnFieldRemove, includePipedTextItems, includeOnFieldValueChange, includeShowRemove;
3508
+ var includeAvailableFields, includeOnFieldRemove, includePipedTextItems, includeOnFieldKeyChange, includeOnFieldValueChange, includeShowRemove;
3082
3509
  fieldMapperRowProps = {};
3083
3510
  switch (child.type) {
3084
3511
  case FieldMapperRow:
@@ -3093,7 +3520,9 @@ var FieldMapper = React__default["default"].forwardRef(function FieldMapper(prop
3093
3520
  && ((typeof props.onFieldRemove) === 'function'));
3094
3521
  includePipedTextItems = (!Array.isArray(wrappedEl.props.pipedTextItems)
3095
3522
  && (((_b = props.pipedTextItems) === null || _b === void 0 ? void 0 : _b.length) > 0));
3096
- includeOnFieldValueChange = (((typeof wrappedEl.props.onChange) !== 'function')
3523
+ includeOnFieldKeyChange = (((typeof wrappedEl.props.onFieldKeyChange) !== 'function')
3524
+ && (typeof props.onFieldKeyChange === 'function'));
3525
+ includeOnFieldValueChange = (((typeof wrappedEl.props.onFieldValueChange) !== 'function')
3097
3526
  && (typeof props.onFieldValueChange === 'function'));
3098
3527
  includeShowRemove = (((typeof wrappedEl.props.showRemove !== 'boolean'))
3099
3528
  && ((typeof ((_c = child.props.selectedField) === null || _c === void 0 ? void 0 : _c.required)) === 'boolean'));
@@ -3108,8 +3537,13 @@ var FieldMapper = React__default["default"].forwardRef(function FieldMapper(prop
3108
3537
  if (includePipedTextItems) {
3109
3538
  fieldMapperRowProps.pipedTextItems = props.pipedTextItems;
3110
3539
  }
3540
+ if (includeOnFieldKeyChange) {
3541
+ fieldMapperRowProps.onFieldKeyChange = function (prevField, fieldItem) {
3542
+ return props.onFieldKeyChange(prevField, fieldItem);
3543
+ };
3544
+ }
3111
3545
  if (includeOnFieldValueChange) {
3112
- fieldMapperRowProps.onChange = function (fieldItem, inputValue) {
3546
+ fieldMapperRowProps.onFieldValueChange = function (fieldItem, inputValue) {
3113
3547
  return props.onFieldValueChange(fieldItem, inputValue);
3114
3548
  };
3115
3549
  }