guestbell-forms 2.0.298 → 2.0.300

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 +133 -175
  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 +184 -228
  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,17 +1,15 @@
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.TimeSpan = exports.TimeSpanRaw = exports.allTimeSpanUnits = exports.TimeSpanUnit = void 0;
6
+ exports.default = exports.allTimeSpanUnits = exports.TimeSpanUnit = exports.TimeSpanRaw = exports.TimeSpan = void 0;
9
7
 
10
8
  var React = _interopRequireWildcard(require("react"));
11
9
 
12
10
  var _InputGroup = _interopRequireDefault(require("../inputGroup/InputGroup"));
13
11
 
14
- var _BaseInput2 = require("../base/input/BaseInput");
12
+ var _BaseInput = require("../base/input/BaseInput");
15
13
 
16
14
  var _withFormContext = require("../form/withFormContext");
17
15
 
@@ -21,31 +19,11 @@ var _withThemeContext = require("../themeProvider/withThemeContext");
21
19
 
22
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
21
 
24
- 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); }
25
-
26
- 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; }
27
-
28
- 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); }
29
-
30
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31
-
32
- 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); } }
33
-
34
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
22
+ 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); }
35
23
 
36
- 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); }
24
+ 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
25
 
38
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
39
-
40
- 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); }; }
41
-
42
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
43
-
44
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
-
46
- 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; } }
47
-
48
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
26
+ 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); }
49
27
 
50
28
  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; }
51
29
 
@@ -64,7 +42,7 @@ ArrowIcon.defaultProps = {
64
42
 
65
43
  var classNames = require('classnames');
66
44
 
67
- var TimeSpanUnit;
45
+ let TimeSpanUnit;
68
46
  exports.TimeSpanUnit = TimeSpanUnit;
69
47
 
70
48
  (function (TimeSpanUnit) {
@@ -77,7 +55,7 @@ exports.TimeSpanUnit = TimeSpanUnit;
77
55
  TimeSpanUnit[TimeSpanUnit["Year"] = 32] = "Year";
78
56
  })(TimeSpanUnit || (exports.TimeSpanUnit = TimeSpanUnit = {}));
79
57
 
80
- var allTimeSpanUnits = TimeSpanUnit.Day | TimeSpanUnit.Hour | TimeSpanUnit.Millisecond | TimeSpanUnit.Minute | TimeSpanUnit.Second | TimeSpanUnit.Year;
58
+ const allTimeSpanUnits = TimeSpanUnit.Day | TimeSpanUnit.Hour | TimeSpanUnit.Millisecond | TimeSpanUnit.Minute | TimeSpanUnit.Second | TimeSpanUnit.Year;
81
59
  exports.allTimeSpanUnits = allTimeSpanUnits;
82
60
 
83
61
  function getValues(enumeration) {
@@ -92,330 +70,298 @@ function getValues(enumeration) {
92
70
  return values;
93
71
  }
94
72
 
95
- var allUnits = getValues(TimeSpanUnit);
96
-
97
- var TimeSpanRaw = /*#__PURE__*/function (_BaseInput) {
98
- _inherits(TimeSpanRaw, _BaseInput);
73
+ const allUnits = getValues(TimeSpanUnit);
99
74
 
100
- var _super = _createSuper(TimeSpanRaw);
75
+ class TimeSpanRaw extends _BaseInput.BaseInput {
76
+ constructor(props) {
77
+ super(props);
101
78
 
102
- function TimeSpanRaw(props) {
103
- var _this;
104
-
105
- _classCallCheck(this, TimeSpanRaw);
106
-
107
- _this = _super.call(this, props);
108
-
109
- _defineProperty(_assertThisInitialized(_this), "onBlur", function (e) {
110
- _this.commitState();
111
-
112
- _this.handleBlur(e);
79
+ _defineProperty(this, "onBlur", e => {
80
+ this.commitState();
81
+ this.handleBlur(e);
113
82
  });
114
83
 
115
- _defineProperty(_assertThisInitialized(_this), "removeUnitClick", function (e) {
84
+ _defineProperty(this, "removeUnitClick", e => {
116
85
  var _this$props$timeSpan;
117
86
 
118
87
  e.preventDefault();
119
- var unit = Number(e.currentTarget.dataset.unit);
120
-
121
- var diff = -1 * _this.oneUnitInMs(unit);
122
-
123
- var newDate = (0, _moment.duration)((((_this$props$timeSpan = _this.props.timeSpan) === null || _this$props$timeSpan === void 0 ? void 0 : _this$props$timeSpan.asMilliseconds()) || 0) + diff, 'millisecond');
124
-
125
- _this.handleLimits(newDate);
88
+ const unit = Number(e.currentTarget.dataset.unit);
89
+ const diff = -1 * this.oneUnitInMs(unit);
90
+ const newDate = (0, _moment.duration)((((_this$props$timeSpan = this.props.timeSpan) === null || _this$props$timeSpan === void 0 ? void 0 : _this$props$timeSpan.asMilliseconds()) || 0) + diff, 'millisecond');
91
+ this.handleLimits(newDate);
126
92
  });
127
93
 
128
- _defineProperty(_assertThisInitialized(_this), "onUnitChanged", function (e) {
94
+ _defineProperty(this, "onUnitChanged", e => {
129
95
  // this.handleHoursChange(e.target.value);
130
- var unit = Number(e.currentTarget.dataset.unit);
131
-
132
- _this.setState({
96
+ const unit = Number(e.currentTarget.dataset.unit);
97
+ this.setState({
133
98
  currentUnitText: e.target.value,
134
99
  currentUnit: unit
135
100
  });
136
101
  });
137
102
 
138
- _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (e) {
103
+ _defineProperty(this, "onKeyDown", e => {
139
104
  if (e.key === 'Enter') {
140
- _this.commitState();
105
+ this.commitState();
141
106
  }
142
107
  });
143
108
 
144
- _defineProperty(_assertThisInitialized(_this), "addUnitClick", function (e) {
109
+ _defineProperty(this, "addUnitClick", e => {
145
110
  var _this$props$timeSpan2;
146
111
 
147
112
  e.preventDefault();
148
- var unit = Number(e.currentTarget.dataset.unit);
149
-
150
- var diff = _this.oneUnitInMs(unit);
151
-
152
- var newDate = (0, _moment.duration)((((_this$props$timeSpan2 = _this.props.timeSpan) === null || _this$props$timeSpan2 === void 0 ? void 0 : _this$props$timeSpan2.asMilliseconds()) || 0) + diff, 'milliseconds');
153
-
154
- _this.handleLimits(newDate);
113
+ const unit = Number(e.currentTarget.dataset.unit);
114
+ const diff = this.oneUnitInMs(unit);
115
+ const newDate = (0, _moment.duration)((((_this$props$timeSpan2 = this.props.timeSpan) === null || _this$props$timeSpan2 === void 0 ? void 0 : _this$props$timeSpan2.asMilliseconds()) || 0) + diff, 'milliseconds');
116
+ this.handleLimits(newDate);
155
117
  });
156
118
 
157
- _this.removeUnitClick = _this.removeUnitClick.bind(_assertThisInitialized(_this));
158
- _this.addUnitClick = _this.addUnitClick.bind(_assertThisInitialized(_this));
159
- _this.onUnitChanged = _this.onUnitChanged.bind(_assertThisInitialized(_this));
160
- return _this;
119
+ this.removeUnitClick = this.removeUnitClick.bind(this);
120
+ this.addUnitClick = this.addUnitClick.bind(this);
121
+ this.onUnitChanged = this.onUnitChanged.bind(this);
122
+ }
123
+
124
+ render() {
125
+ const {
126
+ timeSpan,
127
+ validUnits,
128
+ initialUnits,
129
+ units: _units
130
+ } = this.props;
131
+
132
+ const units = _units || this.getUnits(timeSpan, validUnits, initialUnits);
133
+
134
+ const unitsArr = allUnits.filter(u => (units & u) !== 0).reverse();
135
+ return /*#__PURE__*/React.createElement(_InputGroup.default, {
136
+ title: this.props.title,
137
+ tooltip: this.props.tooltip
138
+ }, /*#__PURE__*/React.createElement("div", _extends({}, this.props.id && {
139
+ id: this.props.id
140
+ }, {
141
+ className: 'input__base timeSpan-input ' + this.getValidationClass() + ' ' + (this.props.className ? this.props.className : ''),
142
+ ref: this.containerRef
143
+ }), unitsArr.map(unit => /*#__PURE__*/React.createElement("div", {
144
+ className: "",
145
+ key: unit
146
+ }, /*#__PURE__*/React.createElement("div", {
147
+ className: "timeSpan-input__arrows__container"
148
+ }, /*#__PURE__*/React.createElement("button", _extends({
149
+ className: "plus",
150
+ onClick: this.addUnitClick
151
+ }, this.props.id && {
152
+ id: this.props.id + '-add-hours-button'
153
+ }, {
154
+ "data-unit": unit,
155
+ tabIndex: 0
156
+ }), /*#__PURE__*/React.createElement(ArrowIcon, null)), /*#__PURE__*/React.createElement("div", {
157
+ className: "input-padding"
158
+ }, /*#__PURE__*/React.createElement("input", _extends({}, this.props.id && {
159
+ id: this.props.id + '-' + unit + '-input'
160
+ }, {
161
+ disabled: this.getDisabled(),
162
+ required: this.props.required,
163
+ className: classNames('timeSpan-input__time', {
164
+ filled: this.state.value,
165
+ 'timeSpan-input__time--ms': unit === TimeSpanUnit.Millisecond
166
+ }),
167
+ onChange: this.onUnitChanged,
168
+ value: this.state.currentUnit === unit ? this.state.currentUnitText : this.getValue(timeSpan, unit),
169
+ onBlur: this.onBlur,
170
+ onFocus: this.handleFocus,
171
+ type: "number",
172
+ "data-unit": unit,
173
+ onKeyDown: this.onKeyDown
174
+ })), /*#__PURE__*/React.createElement("span", {
175
+ className: "highlight"
176
+ })), /*#__PURE__*/React.createElement("button", _extends({
177
+ className: "minus",
178
+ onClick: this.removeUnitClick
179
+ }, this.props.id && {
180
+ id: this.props.id + '-subtract-hours-button'
181
+ }, {
182
+ "data-unit": unit,
183
+ tabIndex: 0
184
+ }), /*#__PURE__*/React.createElement(ArrowIcon, null))), this.props.unitToString(unit))), this.renderDefaultValidation(), /*#__PURE__*/React.createElement("span", {
185
+ className: "highlight"
186
+ }), /*#__PURE__*/React.createElement("span", {
187
+ className: 'bar ' + (this.state.focused ? 'focused' : '')
188
+ }), this.props.label && /*#__PURE__*/React.createElement("label", {
189
+ className: classNames('timeSpan-input__label label--focused')
190
+ }, this.renderLabel())));
161
191
  }
162
192
 
163
- _createClass(TimeSpanRaw, [{
164
- key: "render",
165
- value: function render() {
166
- var _this2 = this;
167
-
168
- var _this$props = this.props,
169
- timeSpan = _this$props.timeSpan,
170
- validUnits = _this$props.validUnits,
171
- initialUnits = _this$props.initialUnits,
172
- _units = _this$props.units;
173
-
174
- var units = _units || this.getUnits(timeSpan, validUnits, initialUnits);
175
-
176
- var unitsArr = allUnits.filter(function (u) {
177
- return (units & u) !== 0;
178
- }).reverse();
179
- return /*#__PURE__*/React.createElement(_InputGroup.default, {
180
- title: this.props.title,
181
- tooltip: this.props.tooltip
182
- }, /*#__PURE__*/React.createElement("div", _extends({}, this.props.id && {
183
- id: this.props.id
184
- }, {
185
- className: 'input__base timeSpan-input ' + this.getValidationClass() + ' ' + (this.props.className ? this.props.className : ''),
186
- ref: this.containerRef
187
- }), unitsArr.map(function (unit) {
188
- return /*#__PURE__*/React.createElement("div", {
189
- className: "",
190
- key: unit
191
- }, /*#__PURE__*/React.createElement("div", {
192
- className: "timeSpan-input__arrows__container"
193
- }, /*#__PURE__*/React.createElement("button", _extends({
194
- className: "plus",
195
- onClick: _this2.addUnitClick
196
- }, _this2.props.id && {
197
- id: _this2.props.id + '-add-hours-button'
198
- }, {
199
- "data-unit": unit,
200
- tabIndex: 0
201
- }), /*#__PURE__*/React.createElement(ArrowIcon, null)), /*#__PURE__*/React.createElement("div", {
202
- className: "input-padding"
203
- }, /*#__PURE__*/React.createElement("input", _extends({}, _this2.props.id && {
204
- id: _this2.props.id + '-' + unit + '-input'
205
- }, {
206
- disabled: _this2.getDisabled(),
207
- required: _this2.props.required,
208
- className: classNames('timeSpan-input__time', {
209
- filled: _this2.state.value,
210
- 'timeSpan-input__time--ms': unit === TimeSpanUnit.Millisecond
211
- }),
212
- onChange: _this2.onUnitChanged,
213
- value: _this2.state.currentUnit === unit ? _this2.state.currentUnitText : _this2.getValue(timeSpan, unit),
214
- onBlur: _this2.onBlur,
215
- onFocus: _this2.handleFocus,
216
- type: "number",
217
- "data-unit": unit,
218
- onKeyDown: _this2.onKeyDown
219
- })), /*#__PURE__*/React.createElement("span", {
220
- className: "highlight"
221
- })), /*#__PURE__*/React.createElement("button", _extends({
222
- className: "minus",
223
- onClick: _this2.removeUnitClick
224
- }, _this2.props.id && {
225
- id: _this2.props.id + '-subtract-hours-button'
226
- }, {
227
- "data-unit": unit,
228
- tabIndex: 0
229
- }), /*#__PURE__*/React.createElement(ArrowIcon, null))), _this2.props.unitToString(unit));
230
- }), this.renderDefaultValidation(), /*#__PURE__*/React.createElement("span", {
231
- className: "highlight"
232
- }), /*#__PURE__*/React.createElement("span", {
233
- className: 'bar ' + (this.state.focused ? 'focused' : '')
234
- }), this.props.label && /*#__PURE__*/React.createElement("label", {
235
- className: classNames('timeSpan-input__label label--focused')
236
- }, this.renderLabel())));
193
+ getUnits(time, validUnits, initialUnits) {
194
+ if (time === null || time === undefined) {
195
+ return initialUnits;
237
196
  }
238
- }, {
239
- key: "getUnits",
240
- value: function getUnits(time, validUnits, initialUnits) {
241
- if (time === null || time === undefined) {
242
- return initialUnits;
243
- }
244
197
 
245
- var ms = time.asMilliseconds();
246
- var units = TimeSpanUnit.Millisecond | TimeSpanUnit.Second;
198
+ const ms = time.asMilliseconds();
199
+ let units = TimeSpanUnit.Millisecond | TimeSpanUnit.Second;
247
200
 
248
- if (ms >= 1000) {
249
- units += TimeSpanUnit.Minute;
250
- }
201
+ if (ms >= 1000) {
202
+ units += TimeSpanUnit.Minute;
203
+ }
251
204
 
252
- if (ms >= 60000) {
253
- units += TimeSpanUnit.Hour;
254
- }
205
+ if (ms >= 60000) {
206
+ units += TimeSpanUnit.Hour;
207
+ }
255
208
 
256
- if (ms >= 60 * 60000) {
257
- units += TimeSpanUnit.Day;
258
- }
209
+ if (ms >= 60 * 60000) {
210
+ units += TimeSpanUnit.Day;
211
+ }
259
212
 
260
- if (ms >= 24 * 60 * 60000) {
261
- units += TimeSpanUnit.Year;
262
- }
213
+ if (ms >= 24 * 60 * 60000) {
214
+ units += TimeSpanUnit.Year;
215
+ }
216
+
217
+ const tagMask = allTimeSpanUnits & ~validUnits;
218
+ units &= ~tagMask;
219
+ return units || initialUnits;
220
+ }
263
221
 
264
- var tagMask = allTimeSpanUnits & ~validUnits;
265
- units &= ~tagMask;
266
- return units || initialUnits;
222
+ getValue(time, unit) {
223
+ if (!time || !unit) {
224
+ return 0;
267
225
  }
268
- }, {
269
- key: "getValue",
270
- value: function getValue(time, unit) {
271
- if (!time || !unit) {
272
- return 0;
273
- }
274
226
 
275
- switch (unit) {
276
- case TimeSpanUnit.Millisecond:
277
- return Math.floor(time.get('millisecond'));
227
+ switch (unit) {
228
+ case TimeSpanUnit.Millisecond:
229
+ return Math.floor(time.get('millisecond'));
278
230
 
279
- case TimeSpanUnit.Second:
280
- return Math.floor(time.get('second'));
231
+ case TimeSpanUnit.Second:
232
+ return Math.floor(time.get('second'));
281
233
 
282
- case TimeSpanUnit.Minute:
283
- return Math.floor(time.get('minute'));
234
+ case TimeSpanUnit.Minute:
235
+ return Math.floor(time.get('minute'));
284
236
 
285
- case TimeSpanUnit.Hour:
286
- return Math.floor(time.get('hour'));
237
+ case TimeSpanUnit.Hour:
238
+ return Math.floor(time.get('hour'));
287
239
 
288
- case TimeSpanUnit.Day:
289
- return Math.floor(time.get('day'));
240
+ case TimeSpanUnit.Day:
241
+ return Math.floor(time.get('day'));
290
242
 
291
- case TimeSpanUnit.Year:
292
- return Math.floor(time.get('year'));
243
+ case TimeSpanUnit.Year:
244
+ return Math.floor(time.get('year'));
293
245
 
294
- default:
295
- return 0;
296
- }
297
- }
298
- }, {
299
- key: "oneUnitInMs",
300
- value: function oneUnitInMs(unit) {
301
- if (!unit) {
246
+ default:
302
247
  return 0;
303
- }
248
+ }
249
+ }
304
250
 
305
- switch (unit) {
306
- case TimeSpanUnit.Millisecond:
307
- return 1;
251
+ oneUnitInMs(unit) {
252
+ if (!unit) {
253
+ return 0;
254
+ }
308
255
 
309
- case TimeSpanUnit.Second:
310
- return 1000;
256
+ switch (unit) {
257
+ case TimeSpanUnit.Millisecond:
258
+ return 1;
311
259
 
312
- case TimeSpanUnit.Minute:
313
- return 60000;
260
+ case TimeSpanUnit.Second:
261
+ return 1000;
314
262
 
315
- case TimeSpanUnit.Hour:
316
- return 3600000;
263
+ case TimeSpanUnit.Minute:
264
+ return 60000;
317
265
 
318
- case TimeSpanUnit.Day:
319
- return 24 * 3600000;
266
+ case TimeSpanUnit.Hour:
267
+ return 3600000;
320
268
 
321
- case TimeSpanUnit.Year:
322
- return 24 * 365 * 3600000;
269
+ case TimeSpanUnit.Day:
270
+ return 24 * 3600000;
323
271
 
324
- default:
325
- return 0;
326
- }
327
- }
328
- }, {
329
- key: "maxOfUnit",
330
- value: function maxOfUnit(unit) {
331
- if (!unit) {
272
+ case TimeSpanUnit.Year:
273
+ return 24 * 365 * 3600000;
274
+
275
+ default:
332
276
  return 0;
333
- }
277
+ }
278
+ }
334
279
 
335
- switch (unit) {
336
- case TimeSpanUnit.Millisecond:
337
- return 1000;
280
+ maxOfUnit(unit) {
281
+ if (!unit) {
282
+ return 0;
283
+ }
338
284
 
339
- case TimeSpanUnit.Second:
340
- return 60;
285
+ switch (unit) {
286
+ case TimeSpanUnit.Millisecond:
287
+ return 1000;
341
288
 
342
- case TimeSpanUnit.Minute:
343
- return 60;
289
+ case TimeSpanUnit.Second:
290
+ return 60;
344
291
 
345
- case TimeSpanUnit.Hour:
346
- return 24;
292
+ case TimeSpanUnit.Minute:
293
+ return 60;
347
294
 
348
- case TimeSpanUnit.Day:
349
- return 365;
295
+ case TimeSpanUnit.Hour:
296
+ return 24;
350
297
 
351
- case TimeSpanUnit.Year:
352
- return 9999;
298
+ case TimeSpanUnit.Day:
299
+ return 365;
353
300
 
354
- default:
355
- return 0;
356
- }
357
- }
358
- }, {
359
- key: "commitState",
360
- value: function commitState() {
361
- if (this.state.currentUnit) {
362
- var num = Number(this.state.currentUnitText);
363
-
364
- if (!isNaN(num)) {
365
- var newOfUnitMs = num * this.oneUnitInMs(this.state.currentUnit);
366
- var oldOfUnitMs = this.getValue(this.props.timeSpan, this.state.currentUnit) * this.oneUnitInMs(this.state.currentUnit);
367
- var maxOfUnitMs = this.maxOfUnit(this.state.currentUnit) * this.oneUnitInMs(this.state.currentUnit);
368
- var moreThanMax = maxOfUnitMs < newOfUnitMs;
369
- var diff = newOfUnitMs - oldOfUnitMs;
370
-
371
- if (moreThanMax) {
372
- this.handleLimits((0, _moment.duration)(newOfUnitMs, 'millisecond'));
373
- } else {
374
- var _this$props$timeSpan3;
375
-
376
- this.handleLimits((0, _moment.duration)((((_this$props$timeSpan3 = this.props.timeSpan) === null || _this$props$timeSpan3 === void 0 ? void 0 : _this$props$timeSpan3.asMilliseconds()) || 0) + diff, 'millisecond'));
377
- }
378
- }
301
+ case TimeSpanUnit.Year:
302
+ return 9999;
379
303
 
380
- this.setState({
381
- currentUnit: undefined,
382
- currentUnitText: undefined
383
- });
384
- }
304
+ default:
305
+ return 0;
385
306
  }
386
- }, {
387
- key: "handleLimits",
388
- value: function handleLimits(time) {
389
- if (this.props.min) {
390
- if (time.asMilliseconds() - this.props.min.asMilliseconds() <= 0) {
391
- this.props.timeSpanChange(this.props.min.clone());
392
- return;
307
+ }
308
+
309
+ commitState() {
310
+ if (this.state.currentUnit) {
311
+ var num = Number(this.state.currentUnitText);
312
+
313
+ if (!isNaN(num)) {
314
+ const newOfUnitMs = num * this.oneUnitInMs(this.state.currentUnit);
315
+ const oldOfUnitMs = this.getValue(this.props.timeSpan, this.state.currentUnit) * this.oneUnitInMs(this.state.currentUnit);
316
+ const maxOfUnitMs = this.maxOfUnit(this.state.currentUnit) * this.oneUnitInMs(this.state.currentUnit);
317
+ const moreThanMax = maxOfUnitMs < newOfUnitMs;
318
+ const diff = newOfUnitMs - oldOfUnitMs;
319
+
320
+ if (moreThanMax) {
321
+ this.handleLimits((0, _moment.duration)(newOfUnitMs, 'millisecond'));
322
+ } else {
323
+ var _this$props$timeSpan3;
324
+
325
+ this.handleLimits((0, _moment.duration)((((_this$props$timeSpan3 = this.props.timeSpan) === null || _this$props$timeSpan3 === void 0 ? void 0 : _this$props$timeSpan3.asMilliseconds()) || 0) + diff, 'millisecond'));
393
326
  }
394
327
  }
395
328
 
396
- if (this.props.max) {
397
- if (this.props.max.asMilliseconds() - time.asMilliseconds() <= 0) {
398
- this.props.timeSpanChange(this.props.max.clone());
399
- return;
400
- }
329
+ this.setState({
330
+ currentUnit: undefined,
331
+ currentUnitText: undefined
332
+ });
333
+ }
334
+ }
335
+
336
+ handleLimits(time) {
337
+ if (this.props.min) {
338
+ if (time.asMilliseconds() - this.props.min.asMilliseconds() <= 0) {
339
+ this.props.timeSpanChange(this.props.min.clone());
340
+ return;
401
341
  }
342
+ }
402
343
 
403
- this.props.timeSpanChange(time);
344
+ if (this.props.max) {
345
+ if (this.props.max.asMilliseconds() - time.asMilliseconds() <= 0) {
346
+ this.props.timeSpanChange(this.props.max.clone());
347
+ return;
348
+ }
404
349
  }
405
- }]);
406
350
 
407
- return TimeSpanRaw;
408
- }(_BaseInput2.BaseInput);
351
+ this.props.timeSpanChange(time);
352
+ }
353
+
354
+ }
409
355
 
410
356
  exports.TimeSpanRaw = TimeSpanRaw;
411
357
 
412
- _defineProperty(TimeSpanRaw, "defaultProps", Object.assign({}, _BaseInput2.BaseInput.defaultProps, {
358
+ _defineProperty(TimeSpanRaw, "defaultProps", Object.assign({}, _BaseInput.BaseInput.defaultProps, {
413
359
  type: 'time',
414
360
  placeholder: '',
415
361
  validUnits: allTimeSpanUnits,
416
362
  initialUnits: allTimeSpanUnits,
417
363
  units: TimeSpanUnit.Dynamic,
418
- unitToString: function unitToString(unit) {
364
+ unitToString: unit => {
419
365
  switch (unit) {
420
366
  case TimeSpanUnit.Millisecond:
421
367
  return 'ms';
@@ -442,7 +388,7 @@ _defineProperty(TimeSpanRaw, "defaultProps", Object.assign({}, _BaseInput2.BaseI
442
388
  min: (0, _moment.duration)(0)
443
389
  }));
444
390
 
445
- var TimeSpan = (0, _withThemeContext.withThemeContext)((0, _withFormContext.withFormContext)(TimeSpanRaw), 'timeSpan');
391
+ const TimeSpan = (0, _withThemeContext.withThemeContext)((0, _withFormContext.withFormContext)(TimeSpanRaw), 'timeSpan');
446
392
  exports.TimeSpan = TimeSpan;
447
393
  var _default = TimeSpan;
448
394
  exports.default = _default;