guestbell-forms 2.0.297 → 2.0.299

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 (209) hide show
  1. package/build/components/InputHeader/InputHeader.js +258 -323
  2. package/build/components/InputHeader/InputHeader.js.map +1 -1
  3. package/build/components/InputHeader/InputHeaderContext.js +6 -8
  4. package/build/components/InputHeader/InputHeaderContext.js.map +1 -1
  5. package/build/components/InputHeader/index.js +4 -6
  6. package/build/components/InputHeader/index.js.map +1 -1
  7. package/build/components/InputHeader/withInputHeaderContext.js +9 -13
  8. package/build/components/InputHeader/withInputHeaderContext.js.map +1 -1
  9. package/build/components/base/input/BaseInput.js +334 -418
  10. package/build/components/base/input/BaseInput.js.map +1 -1
  11. package/build/components/base/input/index.js +1 -1
  12. package/build/components/base/input/index.js.map +1 -1
  13. package/build/components/bookingCalendar/BookingCalendar.js +68 -85
  14. package/build/components/bookingCalendar/BookingCalendar.js.map +1 -1
  15. package/build/components/bookingCalendar/bookingCalendarControls/BookingCalendarControls.js +40 -71
  16. package/build/components/bookingCalendar/bookingCalendarControls/BookingCalendarControls.js.map +1 -1
  17. package/build/components/bookingCalendar/bookingCalendarControls/classes.js +1 -1
  18. package/build/components/bookingCalendar/bookingCalendarControls/classes.js.map +1 -1
  19. package/build/components/bookingCalendar/bookingCalendarControls/index.js +2 -2
  20. package/build/components/bookingCalendar/bookingCalendarControls/index.js.map +1 -1
  21. package/build/components/bookingCalendar/bookingCalendarDatePicker/BookingCalendarDatePicker.js +22 -41
  22. package/build/components/bookingCalendar/bookingCalendarDatePicker/BookingCalendarDatePicker.js.map +1 -1
  23. package/build/components/bookingCalendar/bookingCalendarDatePicker/classes.js +1 -1
  24. package/build/components/bookingCalendar/bookingCalendarDatePicker/classes.js.map +1 -1
  25. package/build/components/bookingCalendar/bookingCalendarDatePicker/index.js +2 -2
  26. package/build/components/bookingCalendar/bookingCalendarDatePicker/index.js.map +1 -1
  27. package/build/components/bookingCalendar/bookingCalendarGrid/BookingCalendarGrid.js +20 -24
  28. package/build/components/bookingCalendar/bookingCalendarGrid/BookingCalendarGrid.js.map +1 -1
  29. package/build/components/bookingCalendar/bookingCalendarGrid/classes.js +1 -1
  30. package/build/components/bookingCalendar/bookingCalendarGrid/classes.js.map +1 -1
  31. package/build/components/bookingCalendar/bookingCalendarItem/BookingCalendarItem.js +9 -12
  32. package/build/components/bookingCalendar/bookingCalendarItem/BookingCalendarItem.js.map +1 -1
  33. package/build/components/bookingCalendar/bookingCalendarItem/classes.js +1 -1
  34. package/build/components/bookingCalendar/bookingCalendarItem/classes.js.map +1 -1
  35. package/build/components/bookingCalendar/bookingCalendarItem/index.js +2 -2
  36. package/build/components/bookingCalendar/bookingCalendarItem/index.js.map +1 -1
  37. package/build/components/bookingCalendar/bookingCalendarLane/BookingCalendarLane.js +23 -28
  38. package/build/components/bookingCalendar/bookingCalendarLane/BookingCalendarLane.js.map +1 -1
  39. package/build/components/bookingCalendar/bookingCalendarLane/classes.js +1 -1
  40. package/build/components/bookingCalendar/bookingCalendarLane/classes.js.map +1 -1
  41. package/build/components/bookingCalendar/bookingCalendarLane/index.js +2 -2
  42. package/build/components/bookingCalendar/bookingCalendarLane/index.js.map +1 -1
  43. package/build/components/bookingCalendar/bookingCalendarLaneHeader/BookingCalendarLaneHeader.js +6 -6
  44. package/build/components/bookingCalendar/bookingCalendarLaneHeader/BookingCalendarLaneHeader.js.map +1 -1
  45. package/build/components/bookingCalendar/bookingCalendarLaneHeader/classes.js +1 -1
  46. package/build/components/bookingCalendar/bookingCalendarLaneHeader/classes.js.map +1 -1
  47. package/build/components/bookingCalendar/bookingCalendarLaneHeader/index.js +1 -1
  48. package/build/components/bookingCalendar/bookingCalendarLaneHeader/index.js.map +1 -1
  49. package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeader.js +12 -16
  50. package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeader.js.map +1 -1
  51. package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeaderRenderItem.js +27 -31
  52. package/build/components/bookingCalendar/bookingCalendarLanesHeader/BookingCalendarLanesHeaderRenderItem.js.map +1 -1
  53. package/build/components/bookingCalendar/bookingCalendarLanesHeader/classes.js +1 -1
  54. package/build/components/bookingCalendar/bookingCalendarLanesHeader/classes.js.map +1 -1
  55. package/build/components/bookingCalendar/bookingCalendarLanesHeader/index.js +2 -2
  56. package/build/components/bookingCalendar/bookingCalendarLanesHeader/index.js.map +1 -1
  57. package/build/components/bookingCalendar/bookingCalendarRenderItem/BookingCalendarRenderItem.js +19 -19
  58. package/build/components/bookingCalendar/bookingCalendarRenderItem/BookingCalendarRenderItem.js.map +1 -1
  59. package/build/components/bookingCalendar/bookingCalendarRenderItem/classes.js +1 -1
  60. package/build/components/bookingCalendar/bookingCalendarRenderItem/classes.js.map +1 -1
  61. package/build/components/bookingCalendar/bookingCalendarRenderItem/index.js +1 -1
  62. package/build/components/bookingCalendar/bookingCalendarRenderItem/index.js.map +1 -1
  63. package/build/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.js +135 -177
  64. package/build/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.js.map +1 -1
  65. package/build/components/bookingCalendar/bookingCalendarTimeAxis/BookingCalendarTimeAxis.js +17 -19
  66. package/build/components/bookingCalendar/bookingCalendarTimeAxis/BookingCalendarTimeAxis.js.map +1 -1
  67. package/build/components/bookingCalendar/bookingCalendarTimeAxis/classes.js +1 -1
  68. package/build/components/bookingCalendar/bookingCalendarTimeAxis/classes.js.map +1 -1
  69. package/build/components/bookingCalendar/classes.js +1 -1
  70. package/build/components/bookingCalendar/classes.js.map +1 -1
  71. package/build/components/bookingCalendar/common.js +5 -7
  72. package/build/components/bookingCalendar/common.js.map +1 -1
  73. package/build/components/bookingCalendar/index.js +3 -3
  74. package/build/components/bookingCalendar/index.js.map +1 -1
  75. package/build/components/bookingCalendar/utils.js +143 -205
  76. package/build/components/bookingCalendar/utils.js.map +1 -1
  77. package/build/components/button/Button.js +101 -123
  78. package/build/components/button/Button.js.map +1 -1
  79. package/build/components/button/index.js +4 -6
  80. package/build/components/button/index.js.map +1 -1
  81. package/build/components/checkbox/Checkbox.js +102 -145
  82. package/build/components/checkbox/Checkbox.js.map +1 -1
  83. package/build/components/checkbox/index.js +4 -6
  84. package/build/components/checkbox/index.js.map +1 -1
  85. package/build/components/dropdown/Dropdown.js +41 -57
  86. package/build/components/dropdown/Dropdown.js.map +1 -1
  87. package/build/components/dropdown/index.js +4 -6
  88. package/build/components/dropdown/index.js.map +1 -1
  89. package/build/components/dynamicSubmit/DynamicSubmit.js +81 -123
  90. package/build/components/dynamicSubmit/DynamicSubmit.js.map +1 -1
  91. package/build/components/dynamicSubmit/index.js +4 -6
  92. package/build/components/dynamicSubmit/index.js.map +1 -1
  93. package/build/components/form/Form.js +139 -193
  94. package/build/components/form/Form.js.map +1 -1
  95. package/build/components/form/FormContext.js +6 -8
  96. package/build/components/form/FormContext.js.map +1 -1
  97. package/build/components/form/FormValidationSummary.js +57 -105
  98. package/build/components/form/FormValidationSummary.js.map +1 -1
  99. package/build/components/form/index.js +5 -7
  100. package/build/components/form/index.js.map +1 -1
  101. package/build/components/form/withFormContext.js +9 -13
  102. package/build/components/form/withFormContext.js.map +1 -1
  103. package/build/components/inputGroup/InputGroup.js +16 -48
  104. package/build/components/inputGroup/InputGroup.js.map +1 -1
  105. package/build/components/inputGroup/index.js +4 -6
  106. package/build/components/inputGroup/index.js.map +1 -1
  107. package/build/components/money/Money.js +137 -211
  108. package/build/components/money/Money.js.map +1 -1
  109. package/build/components/money/index.js +4 -6
  110. package/build/components/money/index.js.map +1 -1
  111. package/build/components/numberInput/NumberInput.js +106 -144
  112. package/build/components/numberInput/NumberInput.js.map +1 -1
  113. package/build/components/numberInput/index.js +4 -6
  114. package/build/components/numberInput/index.js.map +1 -1
  115. package/build/components/openingHours/openingHoursDay/OpeningHoursDay.js +162 -220
  116. package/build/components/openingHours/openingHoursDay/OpeningHoursDay.js.map +1 -1
  117. package/build/components/openingHours/openingHoursDay/index.js +4 -6
  118. package/build/components/openingHours/openingHoursDay/index.js.map +1 -1
  119. package/build/components/openingHours/openingHoursSpecial/OpeningHoursSpecial.js +114 -191
  120. package/build/components/openingHours/openingHoursSpecial/OpeningHoursSpecial.js.map +1 -1
  121. package/build/components/openingHours/openingHoursSpecial/index.js +4 -6
  122. package/build/components/openingHours/openingHoursSpecial/index.js.map +1 -1
  123. package/build/components/openingHours/openingHoursWeek/OpeningHoursWeek.js +150 -209
  124. package/build/components/openingHours/openingHoursWeek/OpeningHoursWeek.js.map +1 -1
  125. package/build/components/openingHours/openingHoursWeek/index.js +4 -6
  126. package/build/components/openingHours/openingHoursWeek/index.js.map +1 -1
  127. package/build/components/openingHours/utils/OpeningHoursUtil.js +51 -76
  128. package/build/components/openingHours/utils/OpeningHoursUtil.js.map +1 -1
  129. package/build/components/radio/Radio.js +38 -75
  130. package/build/components/radio/Radio.js.map +1 -1
  131. package/build/components/radio/index.js +4 -6
  132. package/build/components/radio/index.js.map +1 -1
  133. package/build/components/radioContainer/RadioContainer.js +19 -49
  134. package/build/components/radioContainer/RadioContainer.js.map +1 -1
  135. package/build/components/radioContainer/index.js +4 -6
  136. package/build/components/radioContainer/index.js.map +1 -1
  137. package/build/components/select/Select.js +186 -264
  138. package/build/components/select/Select.js.map +1 -1
  139. package/build/components/select/index.js +4 -6
  140. package/build/components/select/index.js.map +1 -1
  141. package/build/components/submit/Submit.js +50 -87
  142. package/build/components/submit/Submit.js.map +1 -1
  143. package/build/components/submit/index.js +4 -6
  144. package/build/components/submit/index.js.map +1 -1
  145. package/build/components/submit/subComponents/SubmitValidationSummary.js +5 -7
  146. package/build/components/submit/subComponents/SubmitValidationSummary.js.map +1 -1
  147. package/build/components/tags/Tags.js +365 -565
  148. package/build/components/tags/Tags.js.map +1 -1
  149. package/build/components/tags/index.js +4 -6
  150. package/build/components/tags/index.js.map +1 -1
  151. package/build/components/tags/subComponents/TagsSuggestions.js +29 -30
  152. package/build/components/tags/subComponents/TagsSuggestions.js.map +1 -1
  153. package/build/components/text/Text.js +95 -138
  154. package/build/components/text/Text.js.map +1 -1
  155. package/build/components/text/index.js +4 -6
  156. package/build/components/text/index.js.map +1 -1
  157. package/build/components/textArea/TextArea.js +52 -91
  158. package/build/components/textArea/TextArea.js.map +1 -1
  159. package/build/components/textArea/index.js +4 -6
  160. package/build/components/textArea/index.js.map +1 -1
  161. package/build/components/themeProvider/ThemeContext.js +6 -8
  162. package/build/components/themeProvider/ThemeContext.js.map +1 -1
  163. package/build/components/themeProvider/ThemeProvider.js +3 -5
  164. package/build/components/themeProvider/ThemeProvider.js.map +1 -1
  165. package/build/components/themeProvider/index.js +4 -6
  166. package/build/components/themeProvider/index.js.map +1 -1
  167. package/build/components/themeProvider/withThemeContext.js +10 -14
  168. package/build/components/themeProvider/withThemeContext.js.map +1 -1
  169. package/build/components/time/Time.js +190 -216
  170. package/build/components/time/Time.js.map +1 -1
  171. package/build/components/time/index.js +4 -6
  172. package/build/components/time/index.js.map +1 -1
  173. package/build/components/timeSpan/TimeSpan.js +226 -280
  174. package/build/components/timeSpan/TimeSpan.js.map +1 -1
  175. package/build/components/timeSpan/index.js +4 -6
  176. package/build/components/timeSpan/index.js.map +1 -1
  177. package/build/components/utils/Guid.js +3 -5
  178. package/build/components/utils/Guid.js.map +1 -1
  179. package/build/components/utils/ShallowEqual.js +5 -11
  180. package/build/components/utils/ShallowEqual.js.map +1 -1
  181. package/build/components/utils/TimeUtil.js +8 -22
  182. package/build/components/utils/TimeUtil.js.map +1 -1
  183. package/build/components/utils/Typescript.js.map +1 -1
  184. package/build/dist/guestbell-forms.css +0 -6
  185. package/build/dist/guestbell-forms.css.map +1 -1
  186. package/build/dist/guestbell-forms.min.css +1 -1
  187. package/build/dist/guestbell-forms.min.js +1 -1
  188. package/build/dist/guestbell-forms.min.js.map +1 -1
  189. package/build/dist/report.html +2 -2
  190. package/build/index.js +23 -23
  191. package/build/index.js.map +1 -1
  192. package/build/types/ElementOverrideProp.js.map +1 -1
  193. package/build/types/Theme.js.map +1 -1
  194. package/build/types/ThemeOverrides.js.map +1 -1
  195. package/build/validators/EmailValidator.js +8 -22
  196. package/build/validators/EmailValidator.js.map +1 -1
  197. package/build/validators/LatitudeValidator.js +13 -27
  198. package/build/validators/LatitudeValidator.js.map +1 -1
  199. package/build/validators/LongitudeValidator.js +13 -27
  200. package/build/validators/LongitudeValidator.js.map +1 -1
  201. package/build/validators/NumberValidator.js +27 -39
  202. package/build/validators/NumberValidator.js.map +1 -1
  203. package/build/validators/UrlValidator.js +9 -23
  204. package/build/validators/UrlValidator.js.map +1 -1
  205. package/build/validators/base.js.map +1 -1
  206. package/build/validators/index.js +6 -6
  207. package/build/validators/index.js.map +1 -1
  208. package/package.json +8 -5
  209. package/tsconfig.json +0 -1
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports.default = exports.Tags = exports.TagsRaw = exports.defaultTagsTranslations = void 0;
6
+ exports.defaultTagsTranslations = exports.default = exports.TagsRaw = exports.Tags = void 0;
9
7
 
10
8
  var React = _interopRequireWildcard(require("react"));
11
9
 
@@ -13,7 +11,7 @@ var _InputGroup = require("../inputGroup/InputGroup");
13
11
 
14
12
  var _Text = require("../text/Text");
15
13
 
16
- var _BaseInput2 = require("../base/input/BaseInput");
14
+ var _BaseInput = require("../base/input/BaseInput");
17
15
 
18
16
  var _Button = require("../button/Button");
19
17
 
@@ -31,43 +29,15 @@ var _Portal = _interopRequireDefault(require("@material-ui/core/Portal"));
31
29
 
32
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
31
 
34
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
-
36
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
-
38
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
39
-
40
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
41
-
42
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
43
-
44
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
45
-
46
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
47
-
48
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
49
-
50
- function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
32
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
51
33
 
52
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
34
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
53
35
 
54
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
36
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
55
37
 
56
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
38
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
57
39
 
58
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
59
-
60
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
61
-
62
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
63
-
64
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
65
-
66
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
67
-
68
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
69
-
70
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
40
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
71
41
 
72
42
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
73
43
 
@@ -97,287 +67,181 @@ LeftArrowIcon.defaultProps = {
97
67
  viewBox: "0 0 24 24"
98
68
  };
99
69
 
100
- var defaultTagsTranslations = _objectSpread(_objectSpread({}, _BaseInput2.defaultBaseTranslations), {}, {
70
+ const defaultTagsTranslations = _objectSpread(_objectSpread({}, _BaseInput.defaultBaseTranslations), {}, {
101
71
  addNew: 'Add new'
102
72
  });
103
73
 
104
74
  exports.defaultTagsTranslations = defaultTagsTranslations;
105
75
 
106
- var TagButtonComponent = function TagButtonComponent(p) {
107
- return /*#__PURE__*/React.createElement("a", {
108
- className: p.className,
109
- id: p.id,
110
- onClick: p.onClick
111
- }, p.children);
112
- };
113
-
114
- var TagsRaw = /*#__PURE__*/function (_BaseInput) {
115
- _inherits(TagsRaw, _BaseInput);
76
+ const TagButtonComponent = p => /*#__PURE__*/React.createElement("a", {
77
+ className: p.className,
78
+ id: p.id,
79
+ onClick: p.onClick
80
+ }, p.children);
116
81
 
117
- var _super = _createSuper(TagsRaw);
118
-
119
- function TagsRaw(props) {
82
+ class TagsRaw extends _BaseInput.BaseInput {
83
+ constructor(props) {
120
84
  var _this;
121
85
 
122
- _classCallCheck(this, TagsRaw);
123
-
124
- _this = _super.call(this, props);
86
+ super(props);
87
+ _this = this;
125
88
 
126
- _defineProperty(_assertThisInitialized(_this), "textRef", void 0);
89
+ _defineProperty(this, "textRef", void 0);
127
90
 
128
- _defineProperty(_assertThisInitialized(_this), "suggestionsRef", void 0);
91
+ _defineProperty(this, "suggestionsRef", void 0);
129
92
 
130
- _defineProperty(_assertThisInitialized(_this), "isMobile", false);
93
+ _defineProperty(this, "isMobile", false);
131
94
 
132
- _defineProperty(_assertThisInitialized(_this), "onTextErrorsChanged", function (textErrors) {
133
- return _this.setState(function () {
134
- return {
135
- textErrors: textErrors
136
- };
137
- }, function () {
138
- return _this.handleErrors();
139
- });
140
- });
95
+ _defineProperty(this, "onTextErrorsChanged", textErrors => this.setState(() => ({
96
+ textErrors
97
+ }), () => this.handleErrors()));
141
98
 
142
- _defineProperty(_assertThisInitialized(_this), "onFocus", function (e) {
99
+ _defineProperty(this, "onFocus", e => {
143
100
  var _this$props$onFocus, _this$props;
144
101
 
145
- (_this$props$onFocus = (_this$props = _this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props, e);
102
+ (_this$props$onFocus = (_this$props = this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props, e);
146
103
 
147
- if (!_this.state.suggestionsVisible) {
104
+ if (!this.state.suggestionsVisible) {
148
105
  var _this$props$onSuggest, _this$props2;
149
106
 
150
- (_this$props$onSuggest = (_this$props2 = _this.props).onSuggestionsOpened) === null || _this$props$onSuggest === void 0 ? void 0 : _this$props$onSuggest.call(_this$props2);
107
+ (_this$props$onSuggest = (_this$props2 = this.props).onSuggestionsOpened) === null || _this$props$onSuggest === void 0 ? void 0 : _this$props$onSuggest.call(_this$props2);
151
108
  }
152
109
 
153
- _this.setState(function () {
154
- return {
155
- textIsFocused: true,
156
- suggestionsVisible: true,
157
- touched: true
158
- };
159
- }, function () {
160
- return _this.handleErrors();
161
- });
162
-
163
- _this.fetchExistingTags(_this.state.value);
110
+ this.setState(() => ({
111
+ textIsFocused: true,
112
+ suggestionsVisible: true,
113
+ touched: true
114
+ }), () => this.handleErrors());
115
+ this.fetchExistingTags(this.state.value);
116
+ const showMobileVersion = this.props.mobileVersionEnabled && this.isMobile && (this.state.textIsFocused || this.state.suggestionsVisible);
164
117
 
165
- var showMobileVersion = _this.props.mobileVersionEnabled && _this.isMobile && (_this.state.textIsFocused || _this.state.suggestionsVisible);
166
-
167
- if (!showMobileVersion && _this.props.mobileVersionEnabled && _this.isMobile) {
168
- setTimeout(function () {
118
+ if (!showMobileVersion && this.props.mobileVersionEnabled && this.isMobile) {
119
+ setTimeout(() => {
169
120
  var _this$textRef$current;
170
121
 
171
- return (_this$textRef$current = _this.textRef.current) === null || _this$textRef$current === void 0 ? void 0 : _this$textRef$current.focus();
122
+ return (_this$textRef$current = this.textRef.current) === null || _this$textRef$current === void 0 ? void 0 : _this$textRef$current.focus();
172
123
  }, 100);
173
124
  }
174
125
  });
175
126
 
176
- _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (suggestions) {
177
- return /*#__PURE__*/function () {
178
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(e) {
179
- var existingTag, preselectedSuggestion, _preselectedSuggestion;
180
-
181
- return regeneratorRuntime.wrap(function _callee$(_context) {
182
- while (1) {
183
- switch (_context.prev = _context.next) {
184
- case 0:
185
- if (e.key === 'Tab') {
186
- _this.setState({
187
- suggestionsVisible: false,
188
- preselectedSuggestion: undefined
189
- });
190
- }
191
-
192
- if (!(e.key === 'Enter' && (_this.state.value !== '' || _this.state.preselectedSuggestion !== undefined) && _this.state.textErrors.length === 0)) {
193
- _context.next = 19;
194
- break;
195
- }
196
-
197
- e.preventDefault();
198
- e.stopPropagation();
199
- existingTag = _this.props.existingTags && _this.props.existingTags.find(function (et) {
200
- return et.name === _this.state.value;
201
- });
202
-
203
- if (!(_this.state.preselectedSuggestion !== undefined)) {
204
- _context.next = 10;
205
- break;
206
- }
207
-
208
- _this.props.onTagsChanged(_this.props.tags.concat(suggestions[_this.state.preselectedSuggestion]));
209
-
210
- _this.setState({
211
- value: '',
212
- preselectedSuggestion: undefined
213
- }, function () {
214
- _this.fetchExistingTags();
215
-
216
- _this.handleErrors();
217
- });
218
-
219
- _context.next = 19;
220
- break;
221
-
222
- case 10:
223
- if (!existingTag) {
224
- _context.next = 15;
225
- break;
226
- }
227
-
228
- _this.props.onTagsChanged(_this.props.tags.concat(existingTag));
229
-
230
- _this.setState({
231
- value: ''
232
- }, function () {
233
- _this.fetchExistingTags();
234
-
235
- _this.handleErrors();
236
- });
237
-
238
- _context.next = 19;
239
- break;
240
-
241
- case 15:
242
- if (!_this.props.allowNew) {
243
- _context.next = 19;
244
- break;
245
- }
246
-
247
- _context.next = 18;
248
- return _this.addNewTag();
249
-
250
- case 18:
251
- _this.handleErrors();
252
-
253
- case 19:
254
- if (suggestions.length > 0 && _this.state.suggestionsVisible) {
255
- if (e.key === 'ArrowUp') {
256
- preselectedSuggestion = _this.state.preselectedSuggestion === undefined ? suggestions.length - 1 : _this.state.preselectedSuggestion === 0 ? suggestions.length - 1 : _this.state.preselectedSuggestion - 1;
257
-
258
- _this.setState({
259
- preselectedSuggestion: preselectedSuggestion
260
- });
261
- } else if (e.key === 'ArrowDown') {
262
- _preselectedSuggestion = _this.state.preselectedSuggestion === undefined ? 0 : _this.state.preselectedSuggestion === suggestions.length - 1 ? 0 : _this.state.preselectedSuggestion + 1;
263
-
264
- _this.setState({
265
- preselectedSuggestion: _preselectedSuggestion
266
- });
267
- } else {
268
- _this.setState({
269
- preselectedSuggestion: undefined
270
- });
271
- }
272
- }
273
-
274
- case 20:
275
- case "end":
276
- return _context.stop();
277
- }
278
- }
279
- }, _callee);
280
- }));
127
+ _defineProperty(this, "onKeyDown", suggestions => async e => {
128
+ if (e.key === 'Tab') {
129
+ this.setState({
130
+ suggestionsVisible: false,
131
+ preselectedSuggestion: undefined
132
+ });
133
+ }
281
134
 
282
- return function (_x) {
283
- return _ref.apply(this, arguments);
284
- };
285
- }();
286
- });
135
+ if (e.key === 'Enter' && (this.state.value !== '' || this.state.preselectedSuggestion !== undefined) && this.state.textErrors.length === 0) {
136
+ e.preventDefault();
137
+ e.stopPropagation();
138
+ const existingTag = this.props.existingTags && this.props.existingTags.find(et => et.name === this.state.value);
139
+
140
+ if (this.state.preselectedSuggestion !== undefined) {
141
+ this.props.onTagsChanged(this.props.tags.concat(suggestions[this.state.preselectedSuggestion]));
142
+ this.setState({
143
+ value: '',
144
+ preselectedSuggestion: undefined
145
+ }, () => {
146
+ this.fetchExistingTags();
147
+ this.handleErrors();
148
+ });
149
+ } else if (existingTag) {
150
+ this.props.onTagsChanged(this.props.tags.concat(existingTag));
151
+ this.setState({
152
+ value: ''
153
+ }, () => {
154
+ this.fetchExistingTags();
155
+ this.handleErrors();
156
+ });
157
+ } else if (this.props.allowNew) {
158
+ await this.addNewTag();
159
+ this.handleErrors();
160
+ }
161
+ }
287
162
 
288
- _defineProperty(_assertThisInitialized(_this), "addNewTag", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
289
- var newTag;
290
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
291
- while (1) {
292
- switch (_context2.prev = _context2.next) {
293
- case 0:
294
- _context2.next = 2;
295
- return _this.props.onNewTagAdded(_this.state.value);
296
-
297
- case 2:
298
- newTag = _context2.sent;
299
-
300
- _this.setState({
301
- suggestionsVisible: _this.props.closeSuggestionsAfterCreate ? false : _this.state.suggestionsVisible
302
- });
303
-
304
- if (newTag) {
305
- _this.props.onTagsChanged(_this.props.tags ? _this.props.tags.concat(newTag) : [newTag]);
306
- }
307
-
308
- _this.setState({
309
- value: '',
310
- textErrors: []
311
- }, function () {
312
- _this.fetchExistingTags();
313
-
314
- _this.handleErrors();
315
- });
316
-
317
- case 6:
318
- case "end":
319
- return _context2.stop();
320
- }
163
+ if (suggestions.length > 0 && this.state.suggestionsVisible) {
164
+ if (e.key === 'ArrowUp') {
165
+ const preselectedSuggestion = this.state.preselectedSuggestion === undefined ? suggestions.length - 1 : this.state.preselectedSuggestion === 0 ? suggestions.length - 1 : this.state.preselectedSuggestion - 1;
166
+ this.setState({
167
+ preselectedSuggestion
168
+ });
169
+ } else if (e.key === 'ArrowDown') {
170
+ const preselectedSuggestion = this.state.preselectedSuggestion === undefined ? 0 : this.state.preselectedSuggestion === suggestions.length - 1 ? 0 : this.state.preselectedSuggestion + 1;
171
+ this.setState({
172
+ preselectedSuggestion
173
+ });
174
+ } else {
175
+ this.setState({
176
+ preselectedSuggestion: undefined
177
+ });
321
178
  }
322
- }, _callee2);
323
- })));
179
+ }
180
+ });
324
181
 
325
- _defineProperty(_assertThisInitialized(_this), "onSuggestionSelected", function (tag, lastSelected) {
326
- var newTags = _this.props.tags.concat(tag);
182
+ _defineProperty(this, "addNewTag", async () => {
183
+ const newTag = await this.props.onNewTagAdded(this.state.value);
184
+ this.setState({
185
+ suggestionsVisible: this.props.closeSuggestionsAfterCreate ? false : this.state.suggestionsVisible
186
+ });
327
187
 
328
- _this.props.onTagsChanged(newTags);
188
+ if (newTag) {
189
+ this.props.onTagsChanged(this.props.tags ? this.props.tags.concat(newTag) : [newTag]);
190
+ }
329
191
 
330
- var isMax = newTags.length === _this.props.maxTags;
331
- var finalValue = !_this.props.allowNew && !isMax && !lastSelected ? _this.state.value : '';
192
+ this.setState({
193
+ value: '',
194
+ textErrors: []
195
+ }, () => {
196
+ this.fetchExistingTags();
197
+ this.handleErrors();
198
+ });
199
+ });
332
200
 
333
- _this.setState({
201
+ _defineProperty(this, "onSuggestionSelected", (tag, lastSelected) => {
202
+ const newTags = this.props.tags.concat(tag);
203
+ this.props.onTagsChanged(newTags);
204
+ const isMax = newTags.length === this.props.maxTags;
205
+ const finalValue = !this.props.allowNew && !isMax && !lastSelected ? this.state.value : '';
206
+ this.setState({
334
207
  value: finalValue,
335
- suggestionsVisible: isMax || _this.props.closeSuggestionsAfterCreate ? false : _this.state.suggestionsVisible,
208
+ suggestionsVisible: isMax || this.props.closeSuggestionsAfterCreate ? false : this.state.suggestionsVisible,
336
209
  preselectedSuggestion: undefined,
337
210
  textErrors: []
338
- }, function () {
339
- if (!_this.props.maxTags || _this.props.tags.length + 1 < _this.props.maxTags) {
340
- _this.fetchExistingTags(finalValue);
211
+ }, () => {
212
+ if (!this.props.maxTags || this.props.tags.length + 1 < this.props.maxTags) {
213
+ this.fetchExistingTags(finalValue);
341
214
  }
342
215
 
343
- _this.handleErrors();
216
+ this.handleErrors();
344
217
  });
345
218
  });
346
219
 
347
- _defineProperty(_assertThisInitialized(_this), "onBlur", function () {
220
+ _defineProperty(this, "onBlur", () => {
348
221
  var _this$props$onBlur, _this$props3;
349
222
 
350
- (_this$props$onBlur = (_this$props3 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props3);
351
-
352
- _this.setState({
223
+ (_this$props$onBlur = (_this$props3 = this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props3);
224
+ this.setState({
353
225
  textIsFocused: false,
354
226
  preselectedSuggestion: undefined
355
- }, function () {
356
- return _this.handleErrors();
357
- });
227
+ }, () => this.handleErrors());
358
228
  });
359
229
 
360
- _defineProperty(_assertThisInitialized(_this), "onTextChanged", function (e, isValid) {
361
- var value = e.target.value;
362
-
363
- _this.setState(function () {
364
- return {
365
- value: value,
366
- isValid: isValid,
367
- textIsValid: isValid,
368
- suggestionsVisible: true
369
- };
370
- }, function () {
371
- return _this.handleErrors();
372
- });
373
-
374
- _this.fetchExistingTags(e.target.value);
230
+ _defineProperty(this, "onTextChanged", (e, isValid) => {
231
+ const value = e.target.value;
232
+ this.setState(() => ({
233
+ value,
234
+ isValid: isValid,
235
+ textIsValid: isValid,
236
+ suggestionsVisible: true
237
+ }), () => this.handleErrors());
238
+ this.fetchExistingTags(e.target.value);
375
239
  });
376
240
 
377
- _defineProperty(_assertThisInitialized(_this), "handleErrors", function () {
378
- var tags = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.tags;
241
+ _defineProperty(this, "handleErrors", function () {
242
+ let tags = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.tags;
379
243
 
380
- var errors = _this.getErrors(tags);
244
+ let errors = _this.getErrors(tags);
381
245
 
382
246
  if (errors.length > 0) {
383
247
  _this.setInvalid(errors);
@@ -386,35 +250,25 @@ var TagsRaw = /*#__PURE__*/function (_BaseInput) {
386
250
  }
387
251
  });
388
252
 
389
- _defineProperty(_assertThisInitialized(_this), "tagClick", function (tag) {
390
- return function () {
391
- _this.props.onTagClick && _this.props.onTagClick(tag);
392
- };
253
+ _defineProperty(this, "tagClick", tag => () => {
254
+ this.props.onTagClick && this.props.onTagClick(tag);
393
255
  });
394
256
 
395
- _defineProperty(_assertThisInitialized(_this), "tagRemoveClick", function (tag) {
396
- return function (e) {
397
- e.stopPropagation();
398
-
399
- var newTags = _this.props.tags.filter(function (sv) {
400
- return sv.id !== tag.id;
401
- });
402
- /*if (newTags.length === 0) {
403
- setTimeout(() => this.focus(), 50);
404
- }
405
- this.setState({
406
- suggestionsVisible: false,
407
- });*/
408
-
409
-
410
- _this.props.onTagsChanged && _this.props.onTagsChanged(newTags);
411
-
412
- _this.handleErrors(newTags); // this.fetchExistingTags();
413
-
414
- };
257
+ _defineProperty(this, "tagRemoveClick", tag => e => {
258
+ e.stopPropagation();
259
+ const newTags = this.props.tags.filter(sv => sv.id !== tag.id);
260
+ /*if (newTags.length === 0) {
261
+ setTimeout(() => this.focus(), 50);
262
+ }
263
+ this.setState({
264
+ suggestionsVisible: false,
265
+ });*/
266
+
267
+ this.props.onTagsChanged && this.props.onTagsChanged(newTags);
268
+ this.handleErrors(newTags); // this.fetchExistingTags();
415
269
  });
416
270
 
417
- _this.state = _objectSpread(_objectSpread({}, _this.state), {}, {
271
+ this.state = _objectSpread(_objectSpread({}, this.state), {}, {
418
272
  textErrors: [],
419
273
  textIsFocused: false,
420
274
  suggestionsVisible: false,
@@ -422,316 +276,266 @@ var TagsRaw = /*#__PURE__*/function (_BaseInput) {
422
276
  textIsValid: false,
423
277
  fetchedExistingTags: []
424
278
  });
425
- _this.textRef = /*#__PURE__*/React.createRef();
426
- _this.suggestionsRef = /*#__PURE__*/React.createRef();
427
- _this.handleClickOutside = _this.handleClickOutside.bind(_assertThisInitialized(_this));
428
- _this.handleLeaveMobileClick = _this.handleLeaveMobileClick.bind(_assertThisInitialized(_this));
279
+ this.textRef = /*#__PURE__*/React.createRef();
280
+ this.suggestionsRef = /*#__PURE__*/React.createRef();
281
+ this.handleClickOutside = this.handleClickOutside.bind(this);
282
+ this.handleLeaveMobileClick = this.handleLeaveMobileClick.bind(this);
429
283
 
430
284
  if (props.mobileVersionEnabled) {
431
285
  var _require;
432
286
 
433
- _this.isMobile = (_require = require('react-device-detect')) === null || _require === void 0 ? void 0 : _require.isMobile;
287
+ this.isMobile = (_require = require('react-device-detect')) === null || _require === void 0 ? void 0 : _require.isMobile;
434
288
  }
435
-
436
- return _this;
437
289
  }
438
290
 
439
- _createClass(TagsRaw, [{
440
- key: "focus",
441
- value: function focus() {
442
- if (this.textRef.current) {
443
- this.textRef.current.focus();
444
- }
291
+ focus() {
292
+ if (this.textRef.current) {
293
+ this.textRef.current.focus();
445
294
  }
446
- }, {
447
- key: "componentDidUpdate",
448
- value: function componentDidUpdate(oldProps) {
449
- if (oldProps.tags !== this.props.tags || oldProps.validators !== this.props.validators || oldProps.customValidators !== this.props.customValidators || oldProps.required !== this.props.required) {
450
- this.handleErrors(this.props.tags);
451
- }
295
+ }
296
+
297
+ componentDidUpdate(oldProps) {
298
+ if (oldProps.tags !== this.props.tags || oldProps.validators !== this.props.validators || oldProps.customValidators !== this.props.customValidators || oldProps.required !== this.props.required) {
299
+ this.handleErrors(this.props.tags);
452
300
  }
453
- }, {
454
- key: "handleLeaveMobileClick",
455
- value: function handleLeaveMobileClick() {
456
- this.setState({
457
- textIsFocused: false,
458
- suggestionsVisible: false,
459
- preselectedSuggestion: undefined
460
- });
301
+ }
302
+
303
+ handleLeaveMobileClick() {
304
+ this.setState({
305
+ textIsFocused: false,
306
+ suggestionsVisible: false,
307
+ preselectedSuggestion: undefined
308
+ });
309
+ }
310
+
311
+ handleClickOutside(e) {
312
+ var _this$containerRef$cu, _this$containerRef$cu2;
313
+
314
+ if (!this.containerRef.current || (_this$containerRef$cu = this.containerRef.current.querySelector('.tags-input__tag__wrapper')) !== null && _this$containerRef$cu !== void 0 && _this$containerRef$cu.contains(e.target) || (_this$containerRef$cu2 = this.containerRef.current.querySelector('.tags-input__text-input')) !== null && _this$containerRef$cu2 !== void 0 && _this$containerRef$cu2.contains(e.target) || !this.suggestionsRef.current || this.suggestionsRef.current.contains(e.target)) {
315
+ return;
461
316
  }
462
- }, {
463
- key: "handleClickOutside",
464
- value: function handleClickOutside(e) {
465
- var _this$containerRef$cu,
466
- _this$containerRef$cu2,
467
- _this2 = this;
468
-
469
- if (!this.containerRef.current || (_this$containerRef$cu = this.containerRef.current.querySelector('.tags-input__tag__wrapper')) !== null && _this$containerRef$cu !== void 0 && _this$containerRef$cu.contains(e.target) || (_this$containerRef$cu2 = this.containerRef.current.querySelector('.tags-input__text-input')) !== null && _this$containerRef$cu2 !== void 0 && _this$containerRef$cu2.contains(e.target) || !this.suggestionsRef.current || this.suggestionsRef.current.contains(e.target)) {
470
- return;
471
- }
472
317
 
473
- if (this.state.suggestionsVisible) {
474
- var _this$props$onSuggest2, _this$props4;
318
+ if (this.state.suggestionsVisible) {
319
+ var _this$props$onSuggest2, _this$props4;
475
320
 
476
- (_this$props$onSuggest2 = (_this$props4 = this.props).onSuggestionsClosed) === null || _this$props$onSuggest2 === void 0 ? void 0 : _this$props$onSuggest2.call(_this$props4);
477
- }
321
+ (_this$props$onSuggest2 = (_this$props4 = this.props).onSuggestionsClosed) === null || _this$props$onSuggest2 === void 0 ? void 0 : _this$props$onSuggest2.call(_this$props4);
322
+ }
478
323
 
479
- this.setState({
480
- suggestionsVisible: false,
481
- preselectedSuggestion: undefined
482
- });
324
+ this.setState({
325
+ suggestionsVisible: false,
326
+ preselectedSuggestion: undefined
327
+ });
483
328
 
484
- if (this.props.addNewOnBlur && this.state.value) {
485
- var suggestions = this.getSuggestions();
486
- var existing = suggestions.find(function (s) {
487
- return s.name === _this2.state.value;
488
- });
329
+ if (this.props.addNewOnBlur && this.state.value) {
330
+ const suggestions = this.getSuggestions();
331
+ const existing = suggestions.find(s => s.name === this.state.value);
489
332
 
490
- if (existing) {
491
- this.onSuggestionSelected(existing, suggestions.length === 1);
492
- } else if (this.props.allowNew) {
493
- this.addNewTag();
494
- }
333
+ if (existing) {
334
+ this.onSuggestionSelected(existing, suggestions.length === 1);
335
+ } else if (this.props.allowNew) {
336
+ this.addNewTag();
495
337
  }
496
- /* else if (this.state.value) {
497
- this.setState({ value: '' });
498
- }*/
499
-
500
- }
501
- }, {
502
- key: "componentDidMount",
503
- value: function componentDidMount() {
504
- document.addEventListener('mousedown', this.handleClickOutside);
505
- document.addEventListener('touchstart', this.handleClickOutside);
506
- this.handleErrors(this.props.tags);
507
338
  }
508
- }, {
509
- key: "componentWillUnmount",
510
- value: function componentWillUnmount() {
511
- document.removeEventListener('mousedown', this.handleClickOutside);
512
- document.removeEventListener('touchstart', this.handleClickOutside);
339
+ /* else if (this.state.value) {
340
+ this.setState({ value: '' });
341
+ }*/
513
342
 
514
- _get(_getPrototypeOf(TagsRaw.prototype), "componentWillUnmount", this).call(this);
515
- }
516
- }, {
517
- key: "render",
518
- value: function render() {
519
- var _this3 = this;
520
-
521
- var translations = this.getTranslations(defaultTagsTranslations);
522
- var textProps = this.props.textProps ? this.props.textProps : {};
523
- var suggestions = this.getSuggestions();
524
- var showMobileVersion = this.props.mobileVersionEnabled && this.isMobile && (this.state.textIsFocused || this.state.suggestionsVisible);
525
- var LeaveMobileButton = showMobileVersion ? /*#__PURE__*/React.createElement(_Button.Button, {
526
- className: "tags-input__leaveMobileTagsButton line-height--0",
527
- onClick: this.handleLeaveMobileClick,
528
- noShadow: true,
529
- unobtrusive: true
530
- }, /*#__PURE__*/React.createElement(LeftArrowIcon, null)) : undefined;
531
- var showInput = Boolean((!this.props.maxTags || this.props.maxTags > (this.props.tags && this.props.tags.length)) && !this.props.readOnly);
532
- return /*#__PURE__*/React.createElement(_Portal.default, {
533
- container: document.body,
534
- disablePortal: !showMobileVersion
535
- }, /*#__PURE__*/React.createElement(_InputGroup.InputGroup, {
536
- title: this.props.title,
537
- tooltip: this.props.tooltip
538
- }, /*#__PURE__*/React.createElement("div", _extends({}, this.props.id && {
539
- id: this.props.id
540
- }, {
541
- className: (0, _classnames.default)('input__base tags-input', this.getValidationClass(), this.props.className, {
542
- 'tags-input--readOnly': this.props.readOnly,
543
- 'tags-input--hasPlaceholder': this.props.textProps && this.props.textProps.placeholder,
544
- 'tags-input--mobile': showMobileVersion
545
- }),
546
- ref: this.containerRef
547
- }), showMobileVersion && /*#__PURE__*/React.createElement("div", {
548
- className: "tags-input__mobileBackdrop"
549
- }), /*#__PURE__*/React.createElement("div", {
550
- className: "tags-input__tags__wrapper"
551
- }, !showInput && showMobileVersion && LeaveMobileButton, this.props.tags && this.props.tags.length > 0 ? /*#__PURE__*/React.createElement("div", {
552
- className: "tags-input__tag__wrapper"
553
- }, this.props.tags.map(function (item, index) {
554
- return _this3.renderTag(item, index);
555
- })) : this.props.readOnly && /*#__PURE__*/React.createElement("div", {
556
- className: "tags-input__tag__wrapper"
557
- }, /*#__PURE__*/React.createElement("div", {
558
- className: "tags-input__tag"
559
- }, this.props.readonlyEmptyPlaceholder))), showInput && /*#__PURE__*/React.createElement("div", {
560
- className: 'tags-input__tags__wrapper ' + (this.props.readOnly ? 'filled ' : '')
561
- }, /*#__PURE__*/React.createElement(_Text.Text, _extends({
562
- showClearButton: true
563
- }, textProps, this.props.id && {
564
- id: this.props.id + '-text-input'
565
- }, {
566
- ref: this.textRef,
567
- required: this.props.tags.length > 0 ? false : this.props.required,
568
- className: 'tags-input__text-input ' + (textProps.className ? textProps.className : ''),
569
- onKeyDown: this.onKeyDown(suggestions),
570
- onErrorsChanged: this.onTextErrorsChanged,
571
- onChange: this.onTextChanged,
572
- onFocus: this.onFocus,
573
- onBlur: this.onBlur,
574
- value: this.state.value,
575
- readOnly: this.props.readOnly,
576
- showValidation: false,
577
- ignoreContext: true,
578
- validators: this.props.validators,
579
- customValidators: this.props.customValidators,
580
- before: LeaveMobileButton
581
- })), this.state.suggestionsVisible && this.props.showSuggestions && /*#__PURE__*/React.createElement(_TagsSuggestions.default, _extends({}, this.props.id && {
582
- id: this.props.id + '-text-input'
583
- }, {
584
- className: (0, _classnames.default)(this.props.tagsSuggestionsClassName),
585
- innerRef: this.suggestionsRef,
586
- anchorEl: this.containerRef.current,
587
- allowNew: this.props.allowNew,
588
- preselectedSuggestion: this.state.preselectedSuggestion,
589
- loading: this.state.fetchingExistingTags || this.props.isLoading,
590
- LoadingComponent: this.props.suggestionsLoadingComponent,
591
- isVisible: this.state.suggestionsVisible,
592
- EmptyComponent: this.props.suggestionsEmptyComponent,
593
- WaitingForMoreInputComponent: this.props.waitingForMoreInputComponent,
594
- isWaitingForMoreInput: this.state.value.length < this.props.minLettersToFetch,
595
- tags: suggestions,
596
- onSelected: this.onSuggestionSelected,
597
- value: this.state.value,
598
- AddNewTagComponent: this.props.allowNew && this.state.value !== '' && (!this.props.existingTags || !this.props.existingTags.find(function (e) {
599
- return e.name === _this3.state.value;
600
- })) && (!this.state.fetchedExistingTags || !this.state.fetchedExistingTags.find(function (e) {
601
- return e.name === _this3.state.value;
602
- })) && this.state.textIsValid && /*#__PURE__*/React.createElement(_Button.Button, _extends({}, this.props.id && {
603
- id: this.props.id + '-add-new-button'
604
- }, {
605
- className: "tags-input__suggestion tags-input__add-new",
606
- dropdown: true,
607
- onClick: this.addNewTag
608
- }), translations.addNew, " \"", this.state.value, "\""),
609
- SuggestionTag: this.props.SuggestionTag,
610
- popperProps: this.props.popperProps
611
- }))), this.renderDefaultValidation(), this.props.label && /*#__PURE__*/React.createElement("label", {
612
- className: this.state.value !== '' || this.state.textIsFocused || this.props.readOnly || this.props.tags.length >= this.props.maxTags || showMobileVersion ? 'label--focused' : ''
613
- }, this.renderLabel()))));
614
- }
615
- }, {
616
- key: "getErrors",
617
- value: function getErrors(tags) {
618
- var errors = [];
343
+ }
619
344
 
620
- if (tags.length < this.props.maxTags) {
621
- errors = errors.concat(this.state.textErrors);
622
- }
345
+ componentDidMount() {
346
+ document.addEventListener('mousedown', this.handleClickOutside);
347
+ document.addEventListener('touchstart', this.handleClickOutside);
348
+ this.handleErrors(this.props.tags);
349
+ }
623
350
 
624
- if (this.state.value !== '' && tags.length === 0 && this.props.required) {
625
- errors = errors.concat(this.getTranslations(this.props.translations).required);
626
- }
351
+ componentWillUnmount() {
352
+ document.removeEventListener('mousedown', this.handleClickOutside);
353
+ document.removeEventListener('touchstart', this.handleClickOutside);
354
+ super.componentWillUnmount();
355
+ }
627
356
 
628
- if (this.state.value && this.props.allowNew && !this.state.textIsFocused) {
629
- errors = errors.concat(this.props.valueNotAddedError);
630
- }
357
+ render() {
358
+ const translations = this.getTranslations(defaultTagsTranslations);
359
+ const textProps = this.props.textProps ? this.props.textProps : {};
360
+ const suggestions = this.getSuggestions();
361
+ const showMobileVersion = this.props.mobileVersionEnabled && this.isMobile && (this.state.textIsFocused || this.state.suggestionsVisible);
362
+ const LeaveMobileButton = showMobileVersion ? /*#__PURE__*/React.createElement(_Button.Button, {
363
+ className: "tags-input__leaveMobileTagsButton line-height--0",
364
+ onClick: this.handleLeaveMobileClick,
365
+ noShadow: true,
366
+ unobtrusive: true
367
+ }, /*#__PURE__*/React.createElement(LeftArrowIcon, null)) : undefined;
368
+ const showInput = Boolean((!this.props.maxTags || this.props.maxTags > (this.props.tags && this.props.tags.length)) && !this.props.readOnly);
369
+ return /*#__PURE__*/React.createElement(_Portal.default, {
370
+ container: document.body,
371
+ disablePortal: !showMobileVersion
372
+ }, /*#__PURE__*/React.createElement(_InputGroup.InputGroup, {
373
+ title: this.props.title,
374
+ tooltip: this.props.tooltip
375
+ }, /*#__PURE__*/React.createElement("div", _extends({}, this.props.id && {
376
+ id: this.props.id
377
+ }, {
378
+ className: (0, _classnames.default)('input__base tags-input', this.getValidationClass(), this.props.className, {
379
+ 'tags-input--readOnly': this.props.readOnly,
380
+ 'tags-input--hasPlaceholder': this.props.textProps && this.props.textProps.placeholder,
381
+ 'tags-input--mobile': showMobileVersion
382
+ }),
383
+ ref: this.containerRef
384
+ }), showMobileVersion && /*#__PURE__*/React.createElement("div", {
385
+ className: "tags-input__mobileBackdrop"
386
+ }), /*#__PURE__*/React.createElement("div", {
387
+ className: "tags-input__tags__wrapper"
388
+ }, !showInput && showMobileVersion && LeaveMobileButton, this.props.tags && this.props.tags.length > 0 ? /*#__PURE__*/React.createElement("div", {
389
+ className: "tags-input__tag__wrapper"
390
+ }, this.props.tags.map((item, index) => this.renderTag(item, index))) : this.props.readOnly && /*#__PURE__*/React.createElement("div", {
391
+ className: "tags-input__tag__wrapper"
392
+ }, /*#__PURE__*/React.createElement("div", {
393
+ className: "tags-input__tag"
394
+ }, this.props.readonlyEmptyPlaceholder))), showInput && /*#__PURE__*/React.createElement("div", {
395
+ className: 'tags-input__tags__wrapper ' + (this.props.readOnly ? 'filled ' : '')
396
+ }, /*#__PURE__*/React.createElement(_Text.Text, _extends({
397
+ showClearButton: true
398
+ }, textProps, this.props.id && {
399
+ id: this.props.id + '-text-input'
400
+ }, {
401
+ ref: this.textRef,
402
+ required: this.props.tags.length > 0 ? false : this.props.required,
403
+ className: 'tags-input__text-input ' + (textProps.className ? textProps.className : ''),
404
+ onKeyDown: this.onKeyDown(suggestions),
405
+ onErrorsChanged: this.onTextErrorsChanged,
406
+ onChange: this.onTextChanged,
407
+ onFocus: this.onFocus,
408
+ onBlur: this.onBlur,
409
+ value: this.state.value,
410
+ readOnly: this.props.readOnly,
411
+ showValidation: false,
412
+ ignoreContext: true,
413
+ validators: this.props.validators,
414
+ customValidators: this.props.customValidators,
415
+ before: LeaveMobileButton
416
+ })), this.state.suggestionsVisible && this.props.showSuggestions && /*#__PURE__*/React.createElement(_TagsSuggestions.default, _extends({}, this.props.id && {
417
+ id: this.props.id + '-text-input'
418
+ }, {
419
+ className: (0, _classnames.default)(this.props.tagsSuggestionsClassName),
420
+ innerRef: this.suggestionsRef,
421
+ anchorEl: this.containerRef.current,
422
+ allowNew: this.props.allowNew,
423
+ preselectedSuggestion: this.state.preselectedSuggestion,
424
+ loading: this.state.fetchingExistingTags || this.props.isLoading,
425
+ LoadingComponent: this.props.suggestionsLoadingComponent,
426
+ isVisible: this.state.suggestionsVisible,
427
+ EmptyComponent: this.props.suggestionsEmptyComponent,
428
+ WaitingForMoreInputComponent: this.props.waitingForMoreInputComponent,
429
+ isWaitingForMoreInput: this.state.value.length < this.props.minLettersToFetch,
430
+ tags: suggestions,
431
+ onSelected: this.onSuggestionSelected,
432
+ value: this.state.value,
433
+ AddNewTagComponent: this.props.allowNew && this.state.value !== '' && (!this.props.existingTags || !this.props.existingTags.find(e => e.name === this.state.value)) && (!this.state.fetchedExistingTags || !this.state.fetchedExistingTags.find(e => e.name === this.state.value)) && this.state.textIsValid && /*#__PURE__*/React.createElement(_Button.Button, _extends({}, this.props.id && {
434
+ id: this.props.id + '-add-new-button'
435
+ }, {
436
+ className: "tags-input__suggestion tags-input__add-new",
437
+ dropdown: true,
438
+ onClick: this.addNewTag
439
+ }), translations.addNew, " \"", this.state.value, "\""),
440
+ SuggestionTag: this.props.SuggestionTag,
441
+ popperProps: this.props.popperProps
442
+ }))), this.renderDefaultValidation(), this.props.label && /*#__PURE__*/React.createElement("label", {
443
+ className: this.state.value !== '' || this.state.textIsFocused || this.props.readOnly || this.props.tags.length >= this.props.maxTags || showMobileVersion ? 'label--focused' : ''
444
+ }, this.renderLabel()))));
445
+ }
631
446
 
632
- if (this.props.maxTags < (this.props.tags && this.props.tags.length)) {
633
- errors = errors.concat(this.props.maxTagsSurpassedError);
634
- }
447
+ getErrors(tags) {
448
+ let errors = [];
635
449
 
636
- return errors.filter(function (i) {
637
- return i;
638
- });
450
+ if (tags.length < this.props.maxTags) {
451
+ errors = errors.concat(this.state.textErrors);
639
452
  }
640
- }, {
641
- key: "fetchExistingTags",
642
- value: function fetchExistingTags() {
643
- var _this4 = this;
644
-
645
- var startsWith = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
646
-
647
- if (this.props.fetchExistingTags && startsWith.length >= this.props.minLettersToFetch) {
648
- var timer = setTimeout(function () {
649
- return _this4.setState(function () {
650
- return {
651
- fetchingExistingTags: true
652
- };
653
- });
654
- }, this.props.loadingDelayMs);
655
- this.props.fetchExistingTags(startsWith).then(function (fetchedExistingTags) {
656
- clearTimeout(timer);
657
-
658
- _this4.setState(function () {
659
- return {
660
- fetchedExistingTags: fetchedExistingTags,
661
- fetchingExistingTags: false
662
- };
663
- });
664
- });
665
- }
453
+
454
+ if (this.state.value !== '' && tags.length === 0 && this.props.required) {
455
+ errors = errors.concat(this.getTranslations(this.props.translations).required);
666
456
  }
667
- }, {
668
- key: "getSuggestions",
669
- value: function getSuggestions() {
670
- var _this5 = this;
671
-
672
- var existingTags = [].concat(this.props.existingTags ? this.props.existingTags : []).concat(this.state.fetchedExistingTags ? this.state.fetchedExistingTags : []);
673
- var filteredTags = this.props.filterExistingTags(this.state.value ? this.state.value.toLowerCase() : '', existingTags);
674
- var suggestions = filteredTags.filter(function (tag) {
675
- return _this5.props.allowSameTagMultipleTimes || !_this5.props.tags.some(function (t) {
676
- return t.id === tag.id;
677
- });
678
- }).slice(0, this.props.maxSuggestions);
679
- return suggestions;
457
+
458
+ if (this.state.value && this.props.allowNew && !this.state.textIsFocused) {
459
+ errors = errors.concat(this.props.valueNotAddedError);
680
460
  }
681
- }, {
682
- key: "renderTag",
683
- value: function renderTag(tag, index) {
684
- var body = /*#__PURE__*/React.createElement(React.Fragment, null, tag.name, !this.props.readOnly && /*#__PURE__*/React.createElement(_Button.Button, _extends({}, this.props.id && {
685
- id: this.props.id + '-tag-' + index.toString()
686
- }, {
687
- circular: true,
688
- blank: true,
689
- onClick: this.tagRemoveClick(tag),
690
- className: "ml-1 transform-rotate--45 line-height--0 p-0",
691
- Component: TagButtonComponent,
692
- preventsDefault: false
693
- }), /*#__PURE__*/React.createElement(PlusIcon, null)));
694
- var className = (0, _classnames.default)('tags-input__tag', {
695
- 'tags-input__tag-chip': this.props.showChips
461
+
462
+ if (this.props.maxTags < (this.props.tags && this.props.tags.length)) {
463
+ errors = errors.concat(this.props.maxTagsSurpassedError);
464
+ }
465
+
466
+ return errors.filter(i => i);
467
+ }
468
+
469
+ fetchExistingTags() {
470
+ let startsWith = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
471
+
472
+ if (this.props.fetchExistingTags && startsWith.length >= this.props.minLettersToFetch) {
473
+ const timer = setTimeout(() => this.setState(() => ({
474
+ fetchingExistingTags: true
475
+ })), this.props.loadingDelayMs);
476
+ this.props.fetchExistingTags(startsWith).then(fetchedExistingTags => {
477
+ clearTimeout(timer);
478
+ this.setState(() => ({
479
+ fetchedExistingTags,
480
+ fetchingExistingTags: false
481
+ }));
696
482
  });
483
+ }
484
+ }
697
485
 
698
- if (this.props.onTagClick) {
699
- return /*#__PURE__*/React.createElement(_Button.Button, {
700
- onClick: this.tagClick(tag),
701
- small: true,
702
- className: className,
703
- key: index
704
- }, body);
705
- }
486
+ getSuggestions() {
487
+ const existingTags = [].concat(this.props.existingTags ? this.props.existingTags : []).concat(this.state.fetchedExistingTags ? this.state.fetchedExistingTags : []);
488
+ const filteredTags = this.props.filterExistingTags(this.state.value ? this.state.value.toLowerCase() : '', existingTags);
489
+ let suggestions = filteredTags.filter(tag => this.props.allowSameTagMultipleTimes || !this.props.tags.some(t => t.id === tag.id)).slice(0, this.props.maxSuggestions);
490
+ return suggestions;
491
+ }
492
+
493
+ renderTag(tag, index) {
494
+ const body = /*#__PURE__*/React.createElement(React.Fragment, null, tag.name, !this.props.readOnly && /*#__PURE__*/React.createElement(_Button.Button, _extends({}, this.props.id && {
495
+ id: this.props.id + '-tag-' + index.toString()
496
+ }, {
497
+ circular: true,
498
+ blank: true,
499
+ onClick: this.tagRemoveClick(tag),
500
+ className: "ml-1 transform-rotate--45 line-height--0 p-0",
501
+ Component: TagButtonComponent,
502
+ preventsDefault: false
503
+ }), /*#__PURE__*/React.createElement(PlusIcon, null)));
504
+ const className = (0, _classnames.default)('tags-input__tag', {
505
+ 'tags-input__tag-chip': this.props.showChips
506
+ });
706
507
 
707
- return /*#__PURE__*/React.createElement("div", {
508
+ if (this.props.onTagClick) {
509
+ return /*#__PURE__*/React.createElement(_Button.Button, {
708
510
  onClick: this.tagClick(tag),
511
+ small: true,
709
512
  className: className,
710
513
  key: index
711
514
  }, body);
712
515
  }
713
- }]);
714
516
 
715
- return TagsRaw;
716
- }(_BaseInput2.BaseInput);
517
+ return /*#__PURE__*/React.createElement("div", {
518
+ onClick: this.tagClick(tag),
519
+ className: className,
520
+ key: index
521
+ }, body);
522
+ }
523
+
524
+ }
717
525
 
718
526
  exports.TagsRaw = TagsRaw;
719
527
 
720
- _defineProperty(TagsRaw, "defaultProps", _objectSpread(_objectSpread({}, _BaseInput2.BaseInput.defaultProps), {}, {
528
+ _defineProperty(TagsRaw, "defaultProps", _objectSpread(_objectSpread({}, _BaseInput.BaseInput.defaultProps), {}, {
721
529
  disabled: false,
722
530
  className: '',
723
531
  tags: [],
724
532
  existingTags: [],
725
533
  maxTags: 1000,
726
- onTagsChanged: function onTagsChanged() {
727
- return undefined;
728
- },
729
- onNewTagAdded: function onNewTagAdded(newTagName) {
730
- return Promise.resolve({
731
- name: newTagName,
732
- id: new Date().getTime()
733
- });
734
- },
534
+ onTagsChanged: () => undefined,
535
+ onNewTagAdded: newTagName => Promise.resolve({
536
+ name: newTagName,
537
+ id: new Date().getTime()
538
+ }),
735
539
  valueNotAddedError: /*#__PURE__*/React.createElement("span", null, "You forgot to add tag"),
736
540
  maxTagsSurpassedError: /*#__PURE__*/React.createElement("span", null, "Maximum number of tags surpassed"),
737
541
  waitingForMoreInputComponent: /*#__PURE__*/React.createElement("span", null, "Waiting for more input..."),
@@ -741,11 +545,7 @@ _defineProperty(TagsRaw, "defaultProps", _objectSpread(_objectSpread({}, _BaseIn
741
545
  }),
742
546
  suggestionsEmptyComponent: 'No existing tags...',
743
547
  loadingDelayMs: 500,
744
- filterExistingTags: function filterExistingTags(text, tags) {
745
- return tags.filter(function (tag) {
746
- return tag.name && tag.name.toLowerCase().startsWith(text);
747
- });
748
- },
548
+ filterExistingTags: (text, tags) => tags.filter(tag => tag.name && tag.name.toLowerCase().startsWith(text)),
749
549
  maxSuggestions: 5,
750
550
  addNewOnBlur: false,
751
551
  translations: defaultTagsTranslations,
@@ -754,7 +554,7 @@ _defineProperty(TagsRaw, "defaultProps", _objectSpread(_objectSpread({}, _BaseIn
754
554
  closeSuggestionsAfterCreate: false
755
555
  }));
756
556
 
757
- var Tags = (0, _withThemeContext.withThemeContext)( // tslint:disable-next-line: no-any
557
+ const Tags = (0, _withThemeContext.withThemeContext)( // tslint:disable-next-line: no-any
758
558
  (0, _withFormContext.withFormContext)(TagsRaw), 'tags');
759
559
  exports.Tags = Tags;
760
560
  var _default = Tags;