guestbell-forms 2.0.297 → 2.0.298

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 (27) hide show
  1. package/build/components/InputHeader/InputHeader.js +1 -1
  2. package/build/components/base/input/BaseInput.js +1 -1
  3. package/build/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.js +15 -15
  4. package/build/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.js.map +1 -1
  5. package/build/components/button/Button.js +1 -1
  6. package/build/components/checkbox/Checkbox.js +1 -1
  7. package/build/components/dynamicSubmit/DynamicSubmit.js +1 -1
  8. package/build/components/form/Form.js +1 -1
  9. package/build/components/form/FormValidationSummary.js +1 -1
  10. package/build/components/inputGroup/InputGroup.js +1 -1
  11. package/build/components/money/Money.js +1 -1
  12. package/build/components/numberInput/NumberInput.js +1 -1
  13. package/build/components/openingHours/openingHoursDay/OpeningHoursDay.js +1 -1
  14. package/build/components/openingHours/openingHoursSpecial/OpeningHoursSpecial.js +1 -1
  15. package/build/components/openingHours/openingHoursWeek/OpeningHoursWeek.js +1 -1
  16. package/build/components/radio/Radio.js +1 -1
  17. package/build/components/radioContainer/RadioContainer.js +1 -1
  18. package/build/components/select/Select.js +1 -1
  19. package/build/components/submit/Submit.js +1 -1
  20. package/build/components/tags/Tags.js +1 -1
  21. package/build/components/text/Text.js +1 -1
  22. package/build/components/textArea/TextArea.js +1 -1
  23. package/build/components/time/Time.js +29 -11
  24. package/build/components/time/Time.js.map +1 -1
  25. package/build/components/timeSpan/TimeSpan.js +1 -1
  26. package/build/dist/report.html +1 -1
  27. package/package.json +1 -1
@@ -45,7 +45,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
45
45
 
46
46
  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); }; }
47
47
 
48
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
48
+ 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); }
49
49
 
50
50
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
51
51
 
@@ -43,7 +43,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
43
43
 
44
44
  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); }; }
45
45
 
46
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
46
+ 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); }
47
47
 
48
48
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
49
49
 
@@ -25,7 +25,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
25
25
 
26
26
  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); }; }
27
27
 
28
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
28
+ 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); }
29
29
 
30
30
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
31
31
 
@@ -91,20 +91,20 @@ var BookingCalendarSelection = /*#__PURE__*/function (_React$Component) {
91
91
  }, {
92
92
  key: "handleMouseLeave",
93
93
  value: function handleMouseLeave(evt) {
94
- /*if (this.state.hold) {
95
- this.setState({
96
- hold: false,
97
- animation: 'bookingCalendar__selection--fadeout',
98
- });
99
- this.animationInProgress = (setTimeout(() => {
100
- this.setState({
101
- selectionBox: false,
102
- animation: '',
103
- selectionBoxOrigin: [0, 0],
104
- selectionBoxTarget: [0, 0],
105
- });
106
- this.animationInProgress = null;
107
- }, 300) as unknown) as number;
94
+ /*if (this.state.hold) {
95
+ this.setState({
96
+ hold: false,
97
+ animation: 'bookingCalendar__selection--fadeout',
98
+ });
99
+ this.animationInProgress = (setTimeout(() => {
100
+ this.setState({
101
+ selectionBox: false,
102
+ animation: '',
103
+ selectionBoxOrigin: [0, 0],
104
+ selectionBoxTarget: [0, 0],
105
+ });
106
+ this.animationInProgress = null;
107
+ }, 300) as unknown) as number;
108
108
  }*/
109
109
  }
110
110
  }, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.tsx"],"names":["BookingCalendarSelection","props","animationInProgress","containerRef","React","createRef","state","hold","selectionBox","selectionBoxOrigin","selectionBoxTarget","animation","handleMouseUp","bind","handleMouseDown","handleMouseMove","handleMouseLeave","evt","distance","Math","sqrt","pow","setState","setTimeout","minSelectionSize","onSelected","origin","target","e","disabled","nativeEvent","button","clearTimeout","bb","current","getBoundingClientRect","pageX","x","pageY","y","onSelecting","baseStyle","zIndex","left","top","height","abs","width","userSelect","transformOrigin","transform","handleTransformBox","boxVisible","undefined","gridRowEnd","dataRowsCount","children","Component"],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6BqBA,wB;;;;;AAOnB,oCAAYC,KAAZ,EAAmB;AAAA;;AAAA;;AACjB,8BAAMA,KAAN;;AADiB;;AAAA;;AAEjB,UAAKC,mBAAL,GAA2B,IAA3B;AACA,UAAKC,YAAL,gBAAoBC,KAAK,CAACC,SAAN,EAApB;AACA,UAAKC,KAAL,GAAa;AACXC,MAAAA,IAAI,EAAE,KADK;AAEXC,MAAAA,YAAY,EAAE,KAFH;AAGXC,MAAAA,kBAAkB,EAAE,CAAC,CAAD,EAAI,CAAJ,CAHT;AAIXC,MAAAA,kBAAkB,EAAE,CAAC,CAAD,EAAI,CAAJ,CAJT;AAKXC,MAAAA,SAAS,EAAE;AALA,KAAb;AAOA,UAAKC,aAAL,GAAqB,MAAKA,aAAL,CAAmBC,IAAnB,+BAArB;AACA,UAAKC,eAAL,GAAuB,MAAKA,eAAL,CAAqBD,IAArB,+BAAvB;AACA,UAAKE,eAAL,GAAuB,MAAKA,eAAL,CAAqBF,IAArB,+BAAvB;AACA,UAAKG,gBAAL,GAAwB,MAAKA,gBAAL,CAAsBH,IAAtB,+BAAxB;AAdiB;AAelB;;;;WAED,8BAAqB;AACnB,wBAAmD,KAAKP,KAAxD;AAAA,UAAQG,kBAAR,eAAQA,kBAAR;AAAA,UAA4BC,kBAA5B,eAA4BA,kBAA5B;;AACA,UACED,kBAAkB,CAAC,CAAD,CAAlB,GAAwBC,kBAAkB,CAAC,CAAD,CAA1C,IACAD,kBAAkB,CAAC,CAAD,CAAlB,GAAwBC,kBAAkB,CAAC,CAAD,CAF5C,EAGE;AACA,eAAO,uBAAP;AACD;;AAED,UAAID,kBAAkB,CAA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U,EAAE,MAVyB;AAWrCC,QAAAA,eAAe,EAAE,UAXoB;AAYrCC,QAAAA,SAAS,EAAE,KAAKC,kBAAL;AAZ0B,OAAvC;AAcA,UAAMC,UAAU,GACdjC,IAAI,CAACC,IAAL,CACED,IAAI,CAACE,GAAL,CACE,KAAKf,KAAL,CAAWI,kBAAX,CAA8B,CAA9B,IAAmC,KAAKJ,KAAL,CAAWG,kBAAX,CAA8B,CAA9B,CADrC,EAEE,CAFF,IAIEU,IAAI,CAACE,GAAL,CACE,KAAKf,KAAL,CAAWI,kBAAX,CAA8B,CAA9B,IAAmC,KAAKJ,KAAL,CAAWG,kBAAX,CAA8B,CAA9B,CADrC,EAEE,CAFF,CALJ,IASI,KAAKR,KAAL,CAAWuB,gBAVjB;AAWA,0BACE;AACE,QAAA,GAAG,EAAE,KAAKrB,YADZ;AAEE,QAAA,SAAS,EAAC,uCAFZ;AAGE,QAAA,KAAK,EAAE;AACLuC,UAAAA,MAAM,EAAE,KAAKpC,KAAL,CAAWE,YAAX,GAA0B,KAA1B,GAAkC6C,SADrC;AAELC,UAAAA,UAAU,iBAAU,KAAKrD,KAAL,CAAWsD,aAArB;AAFL,SAHT;AAOE,QAAA,WAAW,EAAE,KAAKzC,eAPpB;AAQE,QAAA,SAAS,EAAE,KAAKF,aARlB;AASE,QAAA,WAAW,EAAE,KAAKG,eATpB;AAUE,QAAA,YAAY,EAAE,KAAKC;AAVrB,SAYGoC,UAAU,IAAI,KAAK9C,KAAL,CAAWE,YAAzB,iBACC;AACE,QAAA,SAAS,uCAAgC,KAAKF,KAAL,CAAWK,SAA3C,CADX;AAEE,QAAA,KAAK,EAAE8B;AAFT,QAbJ,EAkBG,KAAKxC,KAAL,CAAWuD,QAlBd,CADF;AAsBD;;;;EAzLmDpD,KAAK,CAACqD,S","sourcesContent":["import * as React from 'react';\n\nexport type BookingCalendarSelectionCoordinates = [number, number];\nexport interface BookingCalendarSelectionData {\n origin: BookingCalendarSelectionCoordinates;\n target: BookingCalendarSelectionCoordinates;\n}\nexport interface BookingCalendarSelectionProps {\n disabled?: boolean;\n onSelecting?: (data: {\n origin: BookingCalendarSelectionCoordinates;\n target: BookingCalendarSelectionCoordinates;\n }) => void;\n onSelected?: (data: {\n origin: BookingCalendarSelectionCoordinates;\n target: BookingCalendarSelectionCoordinates;\n }) => void;\n dataRowsCount: number;\n minSelectionSize: number;\n}\n\nexport interface BookingCalendarSelectionState {\n selectionBoxOrigin: BookingCalendarSelectionCoordinates;\n selectionBoxTarget: BookingCalendarSelectionCoordinates;\n hold: boolean;\n animation: string;\n selectionBox: boolean;\n}\n\nexport default class BookingCalendarSelection extends React.Component<\n BookingCalendarSelectionProps,\n BookingCalendarSelectionState\n> {\n private animationInProgress: number;\n private containerRef: React.RefObject<HTMLDivElement>;\n\n constructor(props) {\n super(props);\n this.animationInProgress = null;\n this.containerRef = React.createRef();\n this.state = {\n hold: false,\n selectionBox: false,\n selectionBoxOrigin: [0, 0],\n selectionBoxTarget: [0, 0],\n animation: '',\n };\n this.handleMouseUp = this.handleMouseUp.bind(this);\n this.handleMouseDown = this.handleMouseDown.bind(this);\n this.handleMouseMove = this.handleMouseMove.bind(this);\n this.handleMouseLeave = this.handleMouseLeave.bind(this);\n }\n\n handleTransformBox() {\n const { selectionBoxOrigin, selectionBoxTarget } = this.state;\n if (\n selectionBoxOrigin[1] > selectionBoxTarget[1] &&\n selectionBoxOrigin[0] > selectionBoxTarget[0]\n ) {\n return 'scaleY(-1) scaleX(-1)';\n }\n\n if (selectionBoxOrigin[1] > selectionBoxTarget[1]) {\n return 'scaleY(-1)';\n }\n if (selectionBoxOrigin[0] > selectionBoxTarget[0]) {\n return 'scaleX(-1)';\n }\n return null;\n }\n\n handleMouseLeave(evt: React.MouseEvent<HTMLElement>) {\n /*if (this.state.hold) {\n this.setState({\n hold: false,\n animation: 'bookingCalendar__selection--fadeout',\n });\n this.animationInProgress = (setTimeout(() => {\n this.setState({\n selectionBox: false,\n animation: '',\n selectionBoxOrigin: [0, 0],\n selectionBoxTarget: [0, 0],\n });\n this.animationInProgress = null;\n }, 300) as unknown) as number;\n }*/\n }\n\n handleMouseUp(evt: React.MouseEvent<HTMLElement>) {\n if (this.state.hold) {\n const distance = Math.sqrt(\n Math.pow(\n this.state.selectionBoxTarget[1] - this.state.selectionBoxOrigin[1],\n 2\n ) +\n Math.pow(\n this.state.selectionBoxTarget[0] - this.state.selectionBoxOrigin[0],\n 2\n )\n );\n this.setState({\n hold: false,\n animation: 'bookingCalendar__selection--fadeout',\n });\n this.animationInProgress = (setTimeout(() => {\n this.setState({\n selectionBox: false,\n animation: '',\n selectionBoxOrigin: [0, 0],\n selectionBoxTarget: [0, 0],\n });\n this.animationInProgress = null;\n }, 300) as unknown) as number;\n if (distance < this.props.minSelectionSize) {\n return;\n }\n this.props.onSelected?.({\n origin: this.state.selectionBoxOrigin,\n target: this.state.selectionBoxTarget,\n });\n }\n }\n\n handleMouseDown(e: React.MouseEvent<HTMLDivElement>) {\n if (this.props.disabled || e.nativeEvent.button !== 0) {\n return;\n }\n clearTimeout(this.animationInProgress);\n this.animationInProgress = null;\n this.setState({ selectionBox: false, animation: '' });\n\n const bb = this.containerRef.current?.getBoundingClientRect();\n this.setState({\n hold: true,\n selectionBoxOrigin: [\n e.nativeEvent.pageX - bb.x,\n e.nativeEvent.pageY - bb.y,\n ],\n selectionBoxTarget: [\n e.nativeEvent.pageX - bb.x,\n e.nativeEvent.pageY - bb.y,\n ],\n });\n }\n\n private handleMouseMove(evt: React.MouseEvent<HTMLDivElement>) {\n if (this.state.hold && !this.state.selectionBox) {\n this.setState({ selectionBox: true });\n }\n if (this.state.selectionBox && !this.animationInProgress) {\n const bb = this.containerRef.current?.getBoundingClientRect();\n this.setState({\n selectionBoxTarget: [\n evt.nativeEvent.pageX - bb?.x,\n evt.nativeEvent.pageY - bb?.y,\n ],\n });\n\n this.props.onSelecting?.({\n origin: this.state.selectionBoxOrigin,\n target: this.state.selectionBoxTarget,\n });\n }\n }\n\n render() {\n const baseStyle: React.CSSProperties = {\n zIndex: 10,\n left: this.state.selectionBoxOrigin[0],\n top: this.state.selectionBoxOrigin[1],\n height: Math.abs(\n this.state.selectionBoxTarget[1] - this.state.selectionBoxOrigin[1] - 1\n ),\n width: Math.abs(\n this.state.selectionBoxTarget[0] - this.state.selectionBoxOrigin[0] - 1\n ),\n userSelect: 'none',\n transformOrigin: 'top left',\n transform: this.handleTransformBox(),\n };\n const boxVisible =\n Math.sqrt(\n Math.pow(\n this.state.selectionBoxTarget[1] - this.state.selectionBoxOrigin[1],\n 2\n ) +\n Math.pow(\n this.state.selectionBoxTarget[0] - this.state.selectionBoxOrigin[0],\n 2\n )\n ) > this.props.minSelectionSize;\n return (\n <div\n ref={this.containerRef}\n className=\"bookingCalendar__selection__container\"\n style={{\n zIndex: this.state.selectionBox ? 99999 : undefined,\n gridRowEnd: `span ${this.props.dataRowsCount}`,\n }}\n onMouseDown={this.handleMouseDown}\n onMouseUp={this.handleMouseUp}\n onMouseMove={this.handleMouseMove}\n onMouseLeave={this.handleMouseLeave}\n >\n {boxVisible && this.state.selectionBox && (\n <div\n className={`bookingCalendar__selection ${this.state.animation}`}\n style={baseStyle}\n />\n )}\n {this.props.children}\n </div>\n );\n }\n}\n"],"file":"BookingCalendarSelection.js"}
1
+ {"version":3,"sources":["../../../../src/lib/components/bookingCalendar/bookingCalendarSelection/BookingCalendarSelection.tsx"],"names":["BookingCalendarSelection","props","animationInProgress","containerRef","React","createRef","state","hold","selectionBox","selectionBoxOrigin","selectionBoxTarget","animation","handleMouseUp","bind","handleMouseDown","handleMouseMove","handleMouseLeave","evt","distance","Math","sqrt","pow","setState","setTimeout","minSelectionSize","onSelected","origin","target","e","disabled","nativeEvent","button","clearTimeout","bb","current","getBoundingClientRect","pageX","x","pageY","y","onSelecting","baseStyle","zIndex","left","top","height","abs","width","userSelect","transformOrigin","transform","handleTransformBox","boxVisible","undefined","gridRowEnd","dataRowsCount","children","Component"],"mappings":";;;;;;;;;AAAA;;;;;;;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AAWI,kBAAX,CAA8B,CAA9B,IAAmC,KAAKJ,KAAL,CAAWG,kBAAX,CAA8B,CAA9B,CADrC,EAEE,CAFF,IAIEU,IAAI,CAACE,GAAL,CACE,KAAKf,KAAL,CAAWI,kBAAX,CAA8B,CAA9B,IAAmC,KAAKJ,KAAL,CAAWG,kBAAX,CAA8B,CAA9B,CADrC,EAEE,CAFF,CALJ,IASI,KAAKR,KAAL,CAAWuB,gBAVjB;AAWA,0BACE;AACE,QAAA,GAAG,EAAE,KAAKrB,YADZ;AAEE,QAAA,SAAS,EAAC,uCAFZ;AAGE,QAAA,KAAK,EAAE;AACLuC,UAAAA,MAAM,EAAE,KAAKpC,KAAL,CAAWE,YAAX,GAA0B,KAA1B,GAAkC6C,SADrC;AAELC,UAAAA,UAAU,iBAAU,KAAKrD,KAAL,CAAWsD,aAArB;AAFL,SAHT;AAOE,QAAA,WAAW,EAAE,KAAKzC,eAPpB;AAQE,QAAA,SAAS,EAAE,KAAKF,aARlB;AASE,QAAA,WAAW,EAAE,KAAKG,eATpB;AAUE,QAAA,YAAY,EAAE,KAAKC;AAVrB,SAYGoC,UAAU,IAAI,KAAK9C,KAAL,CAAWE,YAAzB,iBACC;AACE,QAAA,SAAS,uCAAgC,KAAKF,KAAL,CAAWK,SAA3C,CADX;AAEE,QAAA,KAAK,EAAE8B;AAFT,QAbJ,EAkBG,KAAKxC,KAAL,CAAWuD,QAlBd,CADF;AAsBD;;;;EAzLmDpD,KAAK,CAACqD,S","sourcesContent":["import * as React from 'react';\r\n\r\nexport type BookingCalendarSelectionCoordinates = [number, number];\r\nexport interface BookingCalendarSelectionData {\r\n origin: BookingCalendarSelectionCoordinates;\r\n target: BookingCalendarSelectionCoordinates;\r\n}\r\nexport interface BookingCalendarSelectionProps {\r\n disabled?: boolean;\r\n onSelecting?: (data: {\r\n origin: BookingCalendarSelectionCoordinates;\r\n target: BookingCalendarSelectionCoordinates;\r\n }) => void;\r\n onSelected?: (data: {\r\n origin: BookingCalendarSelectionCoordinates;\r\n target: BookingCalendarSelectionCoordinates;\r\n }) => void;\r\n dataRowsCount: number;\r\n minSelectionSize: number;\r\n}\r\n\r\nexport interface BookingCalendarSelectionState {\r\n selectionBoxOrigin: BookingCalendarSelectionCoordinates;\r\n selectionBoxTarget: BookingCalendarSelectionCoordinates;\r\n hold: boolean;\r\n animation: string;\r\n selectionBox: boolean;\r\n}\r\n\r\nexport default class BookingCalendarSelection extends React.Component<\r\n BookingCalendarSelectionProps,\r\n BookingCalendarSelectionState\r\n> {\r\n private animationInProgress: number;\r\n private containerRef: React.RefObject<HTMLDivElement>;\r\n\r\n constructor(props) {\r\n super(props);\r\n this.animationInProgress = null;\r\n this.containerRef = React.createRef();\r\n this.state = {\r\n hold: false,\r\n selectionBox: false,\r\n selectionBoxOrigin: [0, 0],\r\n selectionBoxTarget: [0, 0],\r\n animation: '',\r\n };\r\n this.handleMouseUp = this.handleMouseUp.bind(this);\r\n this.handleMouseDown = this.handleMouseDown.bind(this);\r\n this.handleMouseMove = this.handleMouseMove.bind(this);\r\n this.handleMouseLeave = this.handleMouseLeave.bind(this);\r\n }\r\n\r\n handleTransformBox() {\r\n const { selectionBoxOrigin, selectionBoxTarget } = this.state;\r\n if (\r\n selectionBoxOrigin[1] > selectionBoxTarget[1] &&\r\n selectionBoxOrigin[0] > selectionBoxTarget[0]\r\n ) {\r\n return 'scaleY(-1) scaleX(-1)';\r\n }\r\n\r\n if (selectionBoxOrigin[1] > selectionBoxTarget[1]) {\r\n return 'scaleY(-1)';\r\n }\r\n if (selectionBoxOrigin[0] > selectionBoxTarget[0]) {\r\n return 'scaleX(-1)';\r\n }\r\n return null;\r\n }\r\n\r\n handleMouseLeave(evt: React.MouseEvent<HTMLElement>) {\r\n /*if (this.state.hold) {\r\n this.setState({\r\n hold: false,\r\n animation: 'bookingCalendar__selection--fadeout',\r\n });\r\n this.animationInProgress = (setTimeout(() => {\r\n this.setState({\r\n selectionBox: false,\r\n animation: '',\r\n selectionBoxOrigin: [0, 0],\r\n selectionBoxTarget: [0, 0],\r\n });\r\n this.animationInProgress = null;\r\n }, 300) as unknown) as number;\r\n }*/\r\n }\r\n\r\n handleMouseUp(evt: React.MouseEvent<HTMLElement>) {\r\n if (this.state.hold) {\r\n const distance = Math.sqrt(\r\n Math.pow(\r\n this.state.selectionBoxTarget[1] - this.state.selectionBoxOrigin[1],\r\n 2\r\n ) +\r\n Math.pow(\r\n this.state.selectionBoxTarget[0] - this.state.selectionBoxOrigin[0],\r\n 2\r\n )\r\n );\r\n this.setState({\r\n hold: false,\r\n animation: 'bookingCalendar__selection--fadeout',\r\n });\r\n this.animationInProgress = (setTimeout(() => {\r\n this.setState({\r\n selectionBox: false,\r\n animation: '',\r\n selectionBoxOrigin: [0, 0],\r\n selectionBoxTarget: [0, 0],\r\n });\r\n this.animationInProgress = null;\r\n }, 300) as unknown) as number;\r\n if (distance < this.props.minSelectionSize) {\r\n return;\r\n }\r\n this.props.onSelected?.({\r\n origin: this.state.selectionBoxOrigin,\r\n target: this.state.selectionBoxTarget,\r\n });\r\n }\r\n }\r\n\r\n handleMouseDown(e: React.MouseEvent<HTMLDivElement>) {\r\n if (this.props.disabled || e.nativeEvent.button !== 0) {\r\n return;\r\n }\r\n clearTimeout(this.animationInProgress);\r\n this.animationInProgress = null;\r\n this.setState({ selectionBox: false, animation: '' });\r\n\r\n const bb = this.containerRef.current?.getBoundingClientRect();\r\n this.setState({\r\n hold: true,\r\n selectionBoxOrigin: [\r\n e.nativeEvent.pageX - bb.x,\r\n e.nativeEvent.pageY - bb.y,\r\n ],\r\n selectionBoxTarget: [\r\n e.nativeEvent.pageX - bb.x,\r\n e.nativeEvent.pageY - bb.y,\r\n ],\r\n });\r\n }\r\n\r\n private handleMouseMove(evt: React.MouseEvent<HTMLDivElement>) {\r\n if (this.state.hold && !this.state.selectionBox) {\r\n this.setState({ selectionBox: true });\r\n }\r\n if (this.state.selectionBox && !this.animationInProgress) {\r\n const bb = this.containerRef.current?.getBoundingClientRect();\r\n this.setState({\r\n selectionBoxTarget: [\r\n evt.nativeEvent.pageX - bb?.x,\r\n evt.nativeEvent.pageY - bb?.y,\r\n ],\r\n });\r\n\r\n this.props.onSelecting?.({\r\n origin: this.state.selectionBoxOrigin,\r\n target: this.state.selectionBoxTarget,\r\n });\r\n }\r\n }\r\n\r\n render() {\r\n const baseStyle: React.CSSProperties = {\r\n zIndex: 10,\r\n left: this.state.selectionBoxOrigin[0],\r\n top: this.state.selectionBoxOrigin[1],\r\n height: Math.abs(\r\n this.state.selectionBoxTarget[1] - this.state.selectionBoxOrigin[1] - 1\r\n ),\r\n width: Math.abs(\r\n this.state.selectionBoxTarget[0] - this.state.selectionBoxOrigin[0] - 1\r\n ),\r\n userSelect: 'none',\r\n transformOrigin: 'top left',\r\n transform: this.handleTransformBox(),\r\n };\r\n const boxVisible =\r\n Math.sqrt(\r\n Math.pow(\r\n this.state.selectionBoxTarget[1] - this.state.selectionBoxOrigin[1],\r\n 2\r\n ) +\r\n Math.pow(\r\n this.state.selectionBoxTarget[0] - this.state.selectionBoxOrigin[0],\r\n 2\r\n )\r\n ) > this.props.minSelectionSize;\r\n return (\r\n <div\r\n ref={this.containerRef}\r\n className=\"bookingCalendar__selection__container\"\r\n style={{\r\n zIndex: this.state.selectionBox ? 99999 : undefined,\r\n gridRowEnd: `span ${this.props.dataRowsCount}`,\r\n }}\r\n onMouseDown={this.handleMouseDown}\r\n onMouseUp={this.handleMouseUp}\r\n onMouseMove={this.handleMouseMove}\r\n onMouseLeave={this.handleMouseLeave}\r\n >\r\n {boxVisible && this.state.selectionBox && (\r\n <div\r\n className={`bookingCalendar__selection ${this.state.animation}`}\r\n style={baseStyle}\r\n />\r\n )}\r\n {this.props.children}\r\n </div>\r\n );\r\n }\r\n}\r\n"],"file":"BookingCalendarSelection.js"}
@@ -31,7 +31,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
31
31
 
32
32
  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); }; }
33
33
 
34
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
34
+ 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); }
35
35
 
36
36
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
37
37
 
@@ -41,7 +41,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
41
41
 
42
42
  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); }; }
43
43
 
44
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
44
+ 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); }
45
45
 
46
46
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
47
47
 
@@ -33,7 +33,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
33
33
 
34
34
  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); }; }
35
35
 
36
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
36
+ 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); }
37
37
 
38
38
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
39
 
@@ -35,7 +35,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
35
35
 
36
36
  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); }; }
37
37
 
38
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
38
+ 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); }
39
39
 
40
40
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
41
 
@@ -33,7 +33,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
33
33
 
34
34
  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); }; }
35
35
 
36
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
36
+ 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); }
37
37
 
38
38
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
39
 
@@ -29,7 +29,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
29
29
 
30
30
  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); }; }
31
31
 
32
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
32
+ 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); }
33
33
 
34
34
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
35
 
@@ -43,7 +43,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
43
43
 
44
44
  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); }; }
45
45
 
46
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
46
+ 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); }
47
47
 
48
48
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
49
49
 
@@ -37,7 +37,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
37
37
 
38
38
  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); }; }
39
39
 
40
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
40
+ 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); }
41
41
 
42
42
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
43
43
 
@@ -49,7 +49,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
49
49
 
50
50
  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); }; }
51
51
 
52
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
52
+ 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); }
53
53
 
54
54
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
55
55
 
@@ -49,7 +49,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
49
49
 
50
50
  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); }; }
51
51
 
52
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
52
+ 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); }
53
53
 
54
54
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
55
55
 
@@ -39,7 +39,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
39
39
 
40
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
41
 
42
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
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
43
 
44
44
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
45
 
@@ -33,7 +33,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
33
33
 
34
34
  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); }; }
35
35
 
36
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
36
+ 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); }
37
37
 
38
38
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
39
 
@@ -33,7 +33,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
33
33
 
34
34
  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); }; }
35
35
 
36
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
36
+ 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); }
37
37
 
38
38
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
39
 
@@ -43,7 +43,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
43
43
 
44
44
  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); }; }
45
45
 
46
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
46
+ 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); }
47
47
 
48
48
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
49
49
 
@@ -41,7 +41,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
41
41
 
42
42
  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); }; }
43
43
 
44
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
44
+ 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); }
45
45
 
46
46
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
47
47
 
@@ -57,7 +57,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
57
57
 
58
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
59
 
60
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
60
+ 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); }
61
61
 
62
62
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
63
63
 
@@ -43,7 +43,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
43
43
 
44
44
  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); }; }
45
45
 
46
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
46
+ 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); }
47
47
 
48
48
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
49
49
 
@@ -39,7 +39,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
39
39
 
40
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
41
 
42
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
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
43
 
44
44
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
45
 
@@ -43,7 +43,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
43
43
 
44
44
  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); }; }
45
45
 
46
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
46
+ 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); }
47
47
 
48
48
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
49
49
 
@@ -103,21 +103,27 @@ var TimeRaw = /*#__PURE__*/function (_BaseInput) {
103
103
  });
104
104
 
105
105
  _defineProperty(_assertThisInitialized(_this), "removeMinuteClick", function (e) {
106
+ var _this$props$time$minu, _this$props$time, _this$props$time$minu2;
107
+
106
108
  e.preventDefault();
107
109
 
108
- _this.handleMinutesChange((_this.props.time.minutes() - 1).toString());
110
+ _this.handleMinutesChange((((_this$props$time$minu = (_this$props$time = _this.props.time) === null || _this$props$time === void 0 ? void 0 : (_this$props$time$minu2 = _this$props$time.minutes) === null || _this$props$time$minu2 === void 0 ? void 0 : _this$props$time$minu2.call(_this$props$time)) !== null && _this$props$time$minu !== void 0 ? _this$props$time$minu : 0) - 1).toString());
109
111
  });
110
112
 
111
113
  _defineProperty(_assertThisInitialized(_this), "addMinuteClick", function (e) {
114
+ var _this$props$time$minu3, _this$props$time2, _this$props$time2$min;
115
+
112
116
  e.preventDefault();
113
117
 
114
- _this.handleMinutesChange((_this.props.time.minutes() + 1).toString());
118
+ _this.handleMinutesChange((((_this$props$time$minu3 = (_this$props$time2 = _this.props.time) === null || _this$props$time2 === void 0 ? void 0 : (_this$props$time2$min = _this$props$time2.minutes) === null || _this$props$time2$min === void 0 ? void 0 : _this$props$time2$min.call(_this$props$time2)) !== null && _this$props$time$minu3 !== void 0 ? _this$props$time$minu3 : 0) + 1).toString());
115
119
  });
116
120
 
117
121
  _defineProperty(_assertThisInitialized(_this), "removeHourClick", function (e) {
122
+ var _this$props$time$hour, _this$props$time3, _this$props$time3$hou;
123
+
118
124
  e.preventDefault();
119
125
 
120
- _this.handleHoursChange((_this.props.time.hours() - 1).toString());
126
+ _this.handleHoursChange((((_this$props$time$hour = (_this$props$time3 = _this.props.time) === null || _this$props$time3 === void 0 ? void 0 : (_this$props$time3$hou = _this$props$time3.hours) === null || _this$props$time3$hou === void 0 ? void 0 : _this$props$time3$hou.call(_this$props$time3)) !== null && _this$props$time$hour !== void 0 ? _this$props$time$hour : 0) - 1).toString());
121
127
  });
122
128
 
123
129
  _defineProperty(_assertThisInitialized(_this), "onHoursChanged", function (e) {
@@ -128,9 +134,11 @@ var TimeRaw = /*#__PURE__*/function (_BaseInput) {
128
134
  });
129
135
 
130
136
  _defineProperty(_assertThisInitialized(_this), "addHourClick", function (e) {
137
+ var _this$props$time$hour2, _this$props$time4, _this$props$time4$hou;
138
+
131
139
  e.preventDefault();
132
140
 
133
- _this.handleHoursChange((_this.props.time.hours() + 1).toString());
141
+ _this.handleHoursChange((((_this$props$time$hour2 = (_this$props$time4 = _this.props.time) === null || _this$props$time4 === void 0 ? void 0 : (_this$props$time4$hou = _this$props$time4.hours) === null || _this$props$time4$hou === void 0 ? void 0 : _this$props$time4$hou.call(_this$props$time4)) !== null && _this$props$time$hour2 !== void 0 ? _this$props$time$hour2 : 0) + 1).toString());
134
142
  });
135
143
 
136
144
  _this.handleHoursChange = _this.handleHoursChange.bind(_assertThisInitialized(_this));
@@ -141,8 +149,10 @@ var TimeRaw = /*#__PURE__*/function (_BaseInput) {
141
149
  _createClass(TimeRaw, [{
142
150
  key: "render",
143
151
  value: function render() {
144
- var hours = this.props.time.hours();
145
- var minutes = this.props.time.minutes();
152
+ var _this$props$time$hour3, _this$props$time5, _this$props$time5$hou, _this$props$time$minu4, _this$props$time6, _this$props$time6$min;
153
+
154
+ var hours = (_this$props$time$hour3 = (_this$props$time5 = this.props.time) === null || _this$props$time5 === void 0 ? void 0 : (_this$props$time5$hou = _this$props$time5.hours) === null || _this$props$time5$hou === void 0 ? void 0 : _this$props$time5$hou.call(_this$props$time5)) !== null && _this$props$time$hour3 !== void 0 ? _this$props$time$hour3 : 0;
155
+ var minutes = (_this$props$time$minu4 = (_this$props$time6 = this.props.time) === null || _this$props$time6 === void 0 ? void 0 : (_this$props$time6$min = _this$props$time6.minutes) === null || _this$props$time6$min === void 0 ? void 0 : _this$props$time6$min.call(_this$props$time6)) !== null && _this$props$time$minu4 !== void 0 ? _this$props$time$minu4 : 0;
146
156
 
147
157
  if (minutes < 0) {
148
158
  hours--;
@@ -260,14 +270,18 @@ var TimeRaw = /*#__PURE__*/function (_BaseInput) {
260
270
  key: "handleLimits",
261
271
  value: function handleLimits(time) {
262
272
  if (this.props.min) {
263
- if (time.asMilliseconds() - this.props.min.asMilliseconds() <= 0) {
273
+ var _time$asMilliseconds, _time$asMilliseconds2;
274
+
275
+ if (((_time$asMilliseconds = time === null || time === void 0 ? void 0 : (_time$asMilliseconds2 = time.asMilliseconds) === null || _time$asMilliseconds2 === void 0 ? void 0 : _time$asMilliseconds2.call(time)) !== null && _time$asMilliseconds !== void 0 ? _time$asMilliseconds : 0) - this.props.min.asMilliseconds() <= 0) {
264
276
  this.props.timeChange(this.props.min.clone());
265
277
  return;
266
278
  }
267
279
  }
268
280
 
269
281
  if (this.props.max) {
270
- if (this.props.max.asMilliseconds() - time.asMilliseconds() <= 0) {
282
+ var _time$asMilliseconds3, _time$asMilliseconds4;
283
+
284
+ if (this.props.max.asMilliseconds() - ((_time$asMilliseconds3 = time === null || time === void 0 ? void 0 : (_time$asMilliseconds4 = time.asMilliseconds) === null || _time$asMilliseconds4 === void 0 ? void 0 : _time$asMilliseconds4.call(time)) !== null && _time$asMilliseconds3 !== void 0 ? _time$asMilliseconds3 : 0) <= 0) {
271
285
  this.props.timeChange(this.props.max.clone());
272
286
  return;
273
287
  }
@@ -285,7 +299,9 @@ var TimeRaw = /*#__PURE__*/function (_BaseInput) {
285
299
  }
286
300
 
287
301
  if (!isNaN(num)) {
288
- var newTime = (0, _moment.duration)(this.props.time.asMilliseconds(), 'milliseconds').subtract(this.props.time.hours(), 'hours').add(num, 'hours');
302
+ var _this$props$time$asMi, _this$props$time7, _this$props$time7$asM, _this$props$time$hour4, _this$props$time8, _this$props$time8$hou;
303
+
304
+ var newTime = (0, _moment.duration)((_this$props$time$asMi = (_this$props$time7 = this.props.time) === null || _this$props$time7 === void 0 ? void 0 : (_this$props$time7$asM = _this$props$time7.asMilliseconds) === null || _this$props$time7$asM === void 0 ? void 0 : _this$props$time7$asM.call(_this$props$time7)) !== null && _this$props$time$asMi !== void 0 ? _this$props$time$asMi : 0, 'milliseconds').subtract((_this$props$time$hour4 = (_this$props$time8 = this.props.time) === null || _this$props$time8 === void 0 ? void 0 : (_this$props$time8$hou = _this$props$time8.hours) === null || _this$props$time8$hou === void 0 ? void 0 : _this$props$time8$hou.call(_this$props$time8)) !== null && _this$props$time$hour4 !== void 0 ? _this$props$time$hour4 : 0, 'hours').add(num, 'hours');
289
305
  this.handleLimits(newTime);
290
306
  }
291
307
  }
@@ -299,7 +315,9 @@ var TimeRaw = /*#__PURE__*/function (_BaseInput) {
299
315
  }
300
316
 
301
317
  if (!isNaN(num)) {
302
- var newTime = (0, _moment.duration)(this.props.time.asMilliseconds(), 'milliseconds').subtract(this.props.time.minutes(), 'minutes').add(num, 'minutes');
318
+ var _this$props$time$asMi2, _this$props$time9, _this$props$time9$asM, _this$props$time$minu5, _this$props$time10, _this$props$time10$mi;
319
+
320
+ var newTime = (0, _moment.duration)((_this$props$time$asMi2 = (_this$props$time9 = this.props.time) === null || _this$props$time9 === void 0 ? void 0 : (_this$props$time9$asM = _this$props$time9.asMilliseconds) === null || _this$props$time9$asM === void 0 ? void 0 : _this$props$time9$asM.call(_this$props$time9)) !== null && _this$props$time$asMi2 !== void 0 ? _this$props$time$asMi2 : 0, 'milliseconds').subtract((_this$props$time$minu5 = (_this$props$time10 = this.props.time) === null || _this$props$time10 === void 0 ? void 0 : (_this$props$time10$mi = _this$props$time10.minutes) === null || _this$props$time10$mi === void 0 ? void 0 : _this$props$time10$mi.call(_this$props$time10)) !== null && _this$props$time$minu5 !== void 0 ? _this$props$time$minu5 : 0, 'minutes').add(num, 'minutes');
303
321
  this.handleLimits(newTime);
304
322
  }
305
323
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/components/time/Time.tsx"],"names":["ArrowIcon","TimeRaw","props","e","state","hoursText","handleHoursChange","minutesText","handleMinutesChange","setState","undefined","handleBlur","target","value","preventDefault","time","minutes","toString","hours","bind","mid","showDateDiff","min","diffDays","TimeUtil","dayDiff","title","tooltip","id","getValidationClass","className","containerRef","addHourClick","getDisabled","required","onHoursChanged","onBlur","handleFocus","removeHourClick","addMinuteClick","onMinutesChanged","removeMinuteClick","renderDefaultValidation","focused","label","renderLabel","asMilliseconds","timeChange","clone","max","hoursString","num","Number","isNaN","newTime","subtract","add","handleLimits","minutesString","BaseInput","Object","assign","defaultProps","type","placeholder","Time"],"mappings":";;;;;;;;;AAGA;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAhBYA,S,YAAAA,S;;;;;;AAAAA,S;;;;;GAEZ;;IA8BaC,O;;;;;AAMX,mBAAYC,KAAZ,EAA8B;AAAA;;AAAA;;AAC5B,8BAAMA,KAAN;;AAD4B,6DAuJb,UAACC,CAAD,EAA2C;AAC1D,UAAI,MAAKC,KAAL,CAAWC,SAAf,EAA0B;AACxB,cAAKC,iBAAL,CAAuB,MAAKF,KAAL,CAAWC,SAAlC;AACD;;AACD,UAAI,MAAKD,KAAL,CAAWG,WAAf,EAA4B;AAC1B,cAAKC,mBAAL,CAAyB,MAAKJ,KAAL,CAAWG,WAApC;AACD;;AACD,YAAKE,QAAL,CAAc;AAAEF,QAAAA,WAAW,EAAEG,SAAf;AAA0BL,QAAAA,SAAS,EAAEK;AAArC,OAAd,EAAgE;AAAA,eAC9D,MAAKC,UAAL,CAAgBR,CAAhB,CAD8D;AAAA,OAAhE;AAGD,KAjK6B;;AAAA,uEAmKH,UAACA,CAAD,EAA4C;AACrE;AACA,YAAKM,QAAL,CAAc;AAAEF,QAAAA,WAAW,EAAEJ,CAAC,CAACS,MAAF,CAASC;AAAxB,OAAd;AACD,KAtK6B;;AAAA,wEAwKF,UAACV,CAAD,EAA4C;AACtEA,MAAAA,CAAC,CAACW,cAAF;;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;AACf,YAAIG,OAAiB,GAAG,sBACtB,KAAKpD,KAAL,CAAWa,IAAX,CAAgB+B,cAAhB,EADsB,EAEtB,cAFsB,EAIrBS,QAJqB,CAIZ,KAAKrD,KAAL,CAAWa,IAAX,CAAgBG,KAAhB,EAJY,EAIa,OAJb,EAKrBsC,GALqB,CAKjBL,GALiB,EAKZ,OALY,CAAxB;AAMA,aAAKM,YAAL,CAAkBH,OAAlB;AACD;AACF;;;WAED,6BAA4BI,aAA5B,EAAmD;AACjD,UAAIP,GAAG,GAAGC,MAAM,CAACM,aAAD,CAAhB;;AACA,UAAIA,aAAa,KAAK,EAAtB,EAA0B;AACxBP,QAAAA,GAAG,GAAG,CAAN;AACD;;AACD,UAAI,CAACE,KAAK,CAACF,GAAD,CAAV,EAAiB;AACf,YAAIG,OAAiB,GAAG,sBACtB,KAAKpD,KAAL,CAAWa,IAAX,CAAgB+B,cAAhB,EADsB,EAEtB,cAFsB,EAIrBS,QAJqB,CAIZ,KAAKrD,KAAL,CAAWa,IAAX,CAAgBC,OAAhB,EAJY,EAIe,SAJf,EAKrBwC,GALqB,CAKjBL,GALiB,EAKZ,SALY,CAAxB;AAMA,aAAKM,YAAL,CAAkBH,OAAlB;AACD;AACF;;;;EArP0BK,qB;;;;gBAAhB1D,O,kBACmB2D,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBF,sBAAUG,YAA5B,EAA0C;AACtEC,EAAAA,IAAI,EAAE,MADgE;AAEtEC,EAAAA,WAAW,EAAE;AAFyD,CAA1C,C;;AAuPzB,IAAMC,IAAI,GAAG,wCAClB,sCAA2BhE,OAA3B,CADkB,EAElB,MAFkB,CAAb;;eAKQgE,I","sourcesContent":["import * as ArrowIcon from 'material-design-icons/hardware/svg/production/ic_keyboard_arrow_down_24px.svg';\r\n\r\n// Libs\r\nimport * as React from 'react';\r\n\r\n// Misc\r\nimport InputGroup from '../inputGroup/InputGroup';\r\nimport {\r\n BaseInputProps,\r\n BaseInputState,\r\n BaseInput,\r\n} from '../base/input/BaseInput';\r\nimport { withFormContext } from '../form/withFormContext';\r\nimport TimeUtil from '../utils/TimeUtil';\r\nimport { Duration, duration } from 'moment';\r\nimport { withThemeContext } from '../themeProvider/withThemeContext';\r\nimport classNames from 'classnames';\r\n\r\nexport interface TimeProps extends BaseInputProps<HTMLInputElement> {\r\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\r\n timeChange: (time: Duration) => void;\r\n time: Duration;\r\n min?: Duration;\r\n max?: Duration;\r\n showDateDiff?: boolean;\r\n}\r\n\r\nexport interface TimeState extends BaseInputState {\r\n hoursText?: string;\r\n minutesText?: string;\r\n}\r\n\r\nexport class TimeRaw extends BaseInput<TimeProps, TimeState, HTMLInputElement> {\r\n public static defaultProps = (Object.assign({}, BaseInput.defaultProps, {\r\n type: 'time',\r\n placeholder: '',\r\n }) as unknown) as TimeProps;\r\n\r\n constructor(props: TimeProps) {\r\n super(props);\r\n this.handleHoursChange = this.handleHoursChange.bind(this);\r\n this.handleMinutesChange = this.handleMinutesChange.bind(this);\r\n }\r\n\r\n public render() {\r\n let hours = this.props.time.hours();\r\n let minutes = this.props.time.minutes();\r\n if (minutes < 0) {\r\n hours--;\r\n }\r\n minutes = (minutes + 60) % 60;\r\n hours = (hours + 24) % 24;\r\n var mid = 'AM';\r\n if (hours % 24 >= 12) {\r\n hours = hours % 12;\r\n mid = 'PM';\r\n }\r\n if (hours % 12 === 0) {\r\n // At 00 hours we need to show 12 am\r\n hours = 12;\r\n }\r\n if (this.props.showDateDiff && this.props.min) {\r\n const diffDays = TimeUtil.dayDiff(this.props.min, this.props.time);\r\n if (diffDays > 0) {\r\n mid += ' +' + diffDays.toString();\r\n }\r\n }\r\n return (\r\n <InputGroup title={this.props.title} tooltip={this.props.tooltip}>\r\n <div\r\n {...(this.props.id && {\r\n id: this.props.id,\r\n })}\r\n className={classNames(\r\n 'input__base time-input',\r\n this.getValidationClass(),\r\n this.props.className\r\n )}\r\n ref={this.containerRef}\r\n >\r\n <div className=\"\">\r\n <div className=\"time-input__arrows__container\">\r\n <button\r\n className=\"plus\"\r\n onClick={this.addHourClick}\r\n {...(this.props.id && {\r\n id: this.props.id + '-add-hours-button',\r\n })}\r\n tabIndex={0}\r\n >\r\n <ArrowIcon />\r\n </button>\r\n <div className=\"input-padding\">\r\n <input\r\n {...(this.props.id && {\r\n id: this.props.id + '-hours-input',\r\n })}\r\n disabled={this.getDisabled()}\r\n required={this.props.required}\r\n className={\r\n 'time-input__time ' + (this.state.value ? 'filled' : '')\r\n }\r\n onChange={this.onHoursChanged}\r\n value={\r\n this.state.hoursText !== undefined\r\n ? this.state.hoursText\r\n : hours\r\n }\r\n onBlur={this.onBlur}\r\n onFocus={this.handleFocus}\r\n type=\"number\"\r\n />\r\n <span className=\"highlight\" />\r\n </div>\r\n <button\r\n className=\"minus\"\r\n onClick={this.removeHourClick}\r\n {...(this.props.id && {\r\n id: this.props.id + '-subtract-hours-button',\r\n })}\r\n tabIndex={0}\r\n >\r\n <ArrowIcon />\r\n </button>\r\n </div>\r\n </div>\r\n <span className=\"\">:</span>\r\n <div className=\"\">\r\n <div className=\"time-input__arrows__container\">\r\n <button\r\n className=\"plus\"\r\n onClick={this.addMinuteClick}\r\n {...(this.props.id && {\r\n id: this.props.id + '-add-minutes-button',\r\n })}\r\n tabIndex={0}\r\n >\r\n <ArrowIcon />\r\n </button>\r\n <div className=\"input-padding\">\r\n <input\r\n {...(this.props.id && {\r\n id: this.props.id + '-minutes-input',\r\n })}\r\n disabled={this.getDisabled()}\r\n required={this.props.required}\r\n className={\r\n 'time-input__time ' + (this.state.value ? 'filled' : '')\r\n }\r\n onChange={this.onMinutesChanged}\r\n value={\r\n this.state.minutesText !== undefined\r\n ? this.state.minutesText\r\n : minutes < 10\r\n ? '0' + minutes.toString()\r\n : minutes.toString()\r\n }\r\n onBlur={this.onBlur}\r\n onFocus={this.handleFocus}\r\n type=\"number\"\r\n />\r\n <span className=\"highlight\" />\r\n </div>\r\n <button\r\n className=\"minus\"\r\n onClick={this.removeMinuteClick}\r\n {...(this.props.id && {\r\n id: this.props.id + '-subtract-minutes-button',\r\n })}\r\n tabIndex={0}\r\n >\r\n <ArrowIcon />\r\n </button>\r\n </div>\r\n </div>\r\n {this.renderDefaultValidation()}\r\n <span className=\"time-input__am-pm\">{mid}</span>\r\n <span className=\"highlight\" />\r\n <span className={'bar ' + (this.state.focused ? 'focused' : '')} />\r\n {this.props.label && (\r\n <label className={classNames('time-input__label label--focused')}>\r\n {this.renderLabel()}\r\n </label>\r\n )}\r\n </div>\r\n </InputGroup>\r\n );\r\n }\r\n\r\n private onBlur = (e: React.FocusEvent<HTMLInputElement>) => {\r\n if (this.state.hoursText) {\r\n this.handleHoursChange(this.state.hoursText);\r\n }\r\n if (this.state.minutesText) {\r\n this.handleMinutesChange(this.state.minutesText);\r\n }\r\n this.setState({ minutesText: undefined, hoursText: undefined }, () =>\r\n this.handleBlur(e)\r\n );\r\n };\r\n\r\n private onMinutesChanged = (e: React.ChangeEvent<HTMLInputElement>) => {\r\n // this.handleMinutesChange(e.target.value);\r\n this.setState({ minutesText: e.target.value });\r\n };\r\n\r\n private removeMinuteClick = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n e.preventDefault();\r\n this.handleMinutesChange((this.props.time.minutes() - 1).toString());\r\n };\r\n\r\n private addMinuteClick = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n e.preventDefault();\r\n this.handleMinutesChange((this.props.time.minutes() + 1).toString());\r\n };\r\n\r\n private removeHourClick = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n e.preventDefault();\r\n this.handleHoursChange((this.props.time.hours() - 1).toString());\r\n };\r\n\r\n private onHoursChanged = (e: React.ChangeEvent<HTMLInputElement>) => {\r\n // this.handleHoursChange(e.target.value);\r\n this.setState({ hoursText: e.target.value });\r\n };\r\n\r\n private addHourClick = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n e.preventDefault();\r\n this.handleHoursChange((this.props.time.hours() + 1).toString());\r\n };\r\n\r\n private handleLimits(time: Duration) {\r\n if (this.props.min) {\r\n if (time.asMilliseconds() - this.props.min.asMilliseconds() <= 0) {\r\n this.props.timeChange(this.props.min.clone());\r\n return;\r\n }\r\n }\r\n if (this.props.max) {\r\n if (this.props.max.asMilliseconds() - time.asMilliseconds() <= 0) {\r\n this.props.timeChange(this.props.max.clone());\r\n return;\r\n }\r\n }\r\n this.props.timeChange(time);\r\n }\r\n\r\n private handleHoursChange(hoursString: string) {\r\n let num = Number(hoursString);\r\n if (hoursString === '') {\r\n num = 0;\r\n }\r\n if (!isNaN(num)) {\r\n let newTime: Duration = duration(\r\n this.props.time.asMilliseconds(),\r\n 'milliseconds'\r\n )\r\n .subtract(this.props.time.hours(), 'hours')\r\n .add(num, 'hours');\r\n this.handleLimits(newTime);\r\n }\r\n }\r\n\r\n private handleMinutesChange(minutesString: string) {\r\n let num = Number(minutesString);\r\n if (minutesString === '') {\r\n num = 0;\r\n }\r\n if (!isNaN(num)) {\r\n let newTime: Duration = duration(\r\n this.props.time.asMilliseconds(),\r\n 'milliseconds'\r\n )\r\n .subtract(this.props.time.minutes(), 'minutes')\r\n .add(num, 'minutes');\r\n this.handleLimits(newTime);\r\n }\r\n }\r\n}\r\n\r\nexport const Time = withThemeContext<TimeProps, InstanceType<typeof TimeRaw>>(\r\n withFormContext<TimeProps>(TimeRaw),\r\n 'time'\r\n);\r\n\r\nexport default Time;\r\n"],"file":"Time.js"}
1
+ {"version":3,"sources":["../../../src/lib/components/time/Time.tsx"],"names":["ArrowIcon","TimeRaw","props","e","state","hoursText","handleHoursChange","minutesText","handleMinutesChange","setState","undefined","handleBlur","target","value","preventDefault","time","minutes","toString","hours","bind","mid","showDateDiff","min","diffDays","TimeUtil","dayDiff","title","tooltip","id","getValidationClass","className","containerRef","addHourClick","getDisabled","required","onHoursChanged","onBlur","handleFocus","removeHourClick","addMinuteClick","onMinutesChanged","removeMinuteClick","renderDefaultValidation","focused","label","renderLabel","asMilliseconds","timeChange","clone","max","hoursString","num","Number","isNaN","newTime","subtract","add","handleLimits","minutesString","BaseInput","Object","assign","defaultProps","type","placeholder","Time"],"mappings":";;;;;;;;;AAGA;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAhBYA,S,YAAAA,S;;;;;;AAAAA,S;;;;;GAEZ;;IA8BaC,O;;;;;AAMX,mBAAYC,KAAZ,EAA8B;AAAA;;AAAA;;AAC5B,8BAAMA,KAAN;;AAD4B,6DAuJb,UAACC,CAAD,EAA2C;AAC1D,UAAI,MAAKC,KAAL,CAAWC,SAAf,EAA0B;AACxB,cAAKC,iBAAL,CAAuB,MAAKF,KAAL,CAAWC,SAAlC;AACD;;AACD,UAAI,MAAKD,KAAL,CAAWG,WAAf,EAA4B;AAC1B,cAAKC,mBAAL,CAAyB,MAAKJ,KAAL,CAAWG,WAApC;AACD;;AACD,YAAKE,QAAL,CAAc;AAAEF,QAAAA,WAAW,EAAEG,SAAf;AAA0BL,QAAAA,SAAS,EAAEK;AAArC,OAAd,EAAgE;AAAA,eAC9D,MAAKC,UAAL,CAAgBR,CAAhB,CAD8D;AAAA,OAAhE;AAGD,KAjK6B;;AAAA,uEAmKH,UAACA,CAAD,EAA4C;AACrE;AACA,YAAKM,QAAL,CAAc;AAAEF,QAAAA,WAAW,EAAEJ,CAAC,CAACS,MAAF,CAASC;AAAxB,OAAd;AACD,KAtK6B;;AAAA,wEAwKF,UAACV,CAAD,EAA4C;AAAA;;AACtEA,MAAAA,CAAC,CAACW,cAAF;;AACA,YAAKN,mBAAL,CACE,CAAC,8CAAC,MAAKN,KAAL,CAAWa,IAAZ,+EAAC,iBAAiBC,OAAlB,2DAAC,6CAAD,yEAAiC,CAAjC,IAAsC,CAAvC,EAA0CC,QAA1C,EADF;AAGD,KA7K6B;;AAAA,qEA+KL,UAACd,CAAD,EAA4C;AAAA;;AACnEA,MAAAA,CAAC,CAACW,cAAF;;AACA,YAAKN,mBAAL,CACE,CA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;;AAiQzB,IAAMC,IAAI,GAAG,wCAClB,sCAA2BhE,OAA3B,CADkB,EAElB,MAFkB,CAAb;;eAKQgE,I","sourcesContent":["import * as ArrowIcon from 'material-design-icons/hardware/svg/production/ic_keyboard_arrow_down_24px.svg';\r\n\r\n// Libs\r\nimport * as React from 'react';\r\n\r\n// Misc\r\nimport InputGroup from '../inputGroup/InputGroup';\r\nimport {\r\n BaseInputProps,\r\n BaseInputState,\r\n BaseInput,\r\n} from '../base/input/BaseInput';\r\nimport { withFormContext } from '../form/withFormContext';\r\nimport TimeUtil from '../utils/TimeUtil';\r\nimport { Duration, duration } from 'moment';\r\nimport { withThemeContext } from '../themeProvider/withThemeContext';\r\nimport classNames from 'classnames';\r\n\r\nexport interface TimeProps extends BaseInputProps<HTMLInputElement> {\r\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\r\n timeChange: (time: Duration) => void;\r\n time: Duration;\r\n min?: Duration;\r\n max?: Duration;\r\n showDateDiff?: boolean;\r\n}\r\n\r\nexport interface TimeState extends BaseInputState {\r\n hoursText?: string;\r\n minutesText?: string;\r\n}\r\n\r\nexport class TimeRaw extends BaseInput<TimeProps, TimeState, HTMLInputElement> {\r\n public static defaultProps = (Object.assign({}, BaseInput.defaultProps, {\r\n type: 'time',\r\n placeholder: '',\r\n }) as unknown) as TimeProps;\r\n\r\n constructor(props: TimeProps) {\r\n super(props);\r\n this.handleHoursChange = this.handleHoursChange.bind(this);\r\n this.handleMinutesChange = this.handleMinutesChange.bind(this);\r\n }\r\n\r\n public render() {\r\n let hours = this.props.time?.hours?.() ?? 0;\r\n let minutes = this.props.time?.minutes?.() ?? 0;\r\n if (minutes < 0) {\r\n hours--;\r\n }\r\n minutes = (minutes + 60) % 60;\r\n hours = (hours + 24) % 24;\r\n var mid = 'AM';\r\n if (hours % 24 >= 12) {\r\n hours = hours % 12;\r\n mid = 'PM';\r\n }\r\n if (hours % 12 === 0) {\r\n // At 00 hours we need to show 12 am\r\n hours = 12;\r\n }\r\n if (this.props.showDateDiff && this.props.min) {\r\n const diffDays = TimeUtil.dayDiff(this.props.min, this.props.time);\r\n if (diffDays > 0) {\r\n mid += ' +' + diffDays.toString();\r\n }\r\n }\r\n return (\r\n <InputGroup title={this.props.title} tooltip={this.props.tooltip}>\r\n <div\r\n {...(this.props.id && {\r\n id: this.props.id,\r\n })}\r\n className={classNames(\r\n 'input__base time-input',\r\n this.getValidationClass(),\r\n this.props.className\r\n )}\r\n ref={this.containerRef}\r\n >\r\n <div className=\"\">\r\n <div className=\"time-input__arrows__container\">\r\n <button\r\n className=\"plus\"\r\n onClick={this.addHourClick}\r\n {...(this.props.id && {\r\n id: this.props.id + '-add-hours-button',\r\n })}\r\n tabIndex={0}\r\n >\r\n <ArrowIcon />\r\n </button>\r\n <div className=\"input-padding\">\r\n <input\r\n {...(this.props.id && {\r\n id: this.props.id + '-hours-input',\r\n })}\r\n disabled={this.getDisabled()}\r\n required={this.props.required}\r\n className={\r\n 'time-input__time ' + (this.state.value ? 'filled' : '')\r\n }\r\n onChange={this.onHoursChanged}\r\n value={\r\n this.state.hoursText !== undefined\r\n ? this.state.hoursText\r\n : hours\r\n }\r\n onBlur={this.onBlur}\r\n onFocus={this.handleFocus}\r\n type=\"number\"\r\n />\r\n <span className=\"highlight\" />\r\n </div>\r\n <button\r\n className=\"minus\"\r\n onClick={this.removeHourClick}\r\n {...(this.props.id && {\r\n id: this.props.id + '-subtract-hours-button',\r\n })}\r\n tabIndex={0}\r\n >\r\n <ArrowIcon />\r\n </button>\r\n </div>\r\n </div>\r\n <span className=\"\">:</span>\r\n <div className=\"\">\r\n <div className=\"time-input__arrows__container\">\r\n <button\r\n className=\"plus\"\r\n onClick={this.addMinuteClick}\r\n {...(this.props.id && {\r\n id: this.props.id + '-add-minutes-button',\r\n })}\r\n tabIndex={0}\r\n >\r\n <ArrowIcon />\r\n </button>\r\n <div className=\"input-padding\">\r\n <input\r\n {...(this.props.id && {\r\n id: this.props.id + '-minutes-input',\r\n })}\r\n disabled={this.getDisabled()}\r\n required={this.props.required}\r\n className={\r\n 'time-input__time ' + (this.state.value ? 'filled' : '')\r\n }\r\n onChange={this.onMinutesChanged}\r\n value={\r\n this.state.minutesText !== undefined\r\n ? this.state.minutesText\r\n : minutes < 10\r\n ? '0' + minutes.toString()\r\n : minutes.toString()\r\n }\r\n onBlur={this.onBlur}\r\n onFocus={this.handleFocus}\r\n type=\"number\"\r\n />\r\n <span className=\"highlight\" />\r\n </div>\r\n <button\r\n className=\"minus\"\r\n onClick={this.removeMinuteClick}\r\n {...(this.props.id && {\r\n id: this.props.id + '-subtract-minutes-button',\r\n })}\r\n tabIndex={0}\r\n >\r\n <ArrowIcon />\r\n </button>\r\n </div>\r\n </div>\r\n {this.renderDefaultValidation()}\r\n <span className=\"time-input__am-pm\">{mid}</span>\r\n <span className=\"highlight\" />\r\n <span className={'bar ' + (this.state.focused ? 'focused' : '')} />\r\n {this.props.label && (\r\n <label className={classNames('time-input__label label--focused')}>\r\n {this.renderLabel()}\r\n </label>\r\n )}\r\n </div>\r\n </InputGroup>\r\n );\r\n }\r\n\r\n private onBlur = (e: React.FocusEvent<HTMLInputElement>) => {\r\n if (this.state.hoursText) {\r\n this.handleHoursChange(this.state.hoursText);\r\n }\r\n if (this.state.minutesText) {\r\n this.handleMinutesChange(this.state.minutesText);\r\n }\r\n this.setState({ minutesText: undefined, hoursText: undefined }, () =>\r\n this.handleBlur(e)\r\n );\r\n };\r\n\r\n private onMinutesChanged = (e: React.ChangeEvent<HTMLInputElement>) => {\r\n // this.handleMinutesChange(e.target.value);\r\n this.setState({ minutesText: e.target.value });\r\n };\r\n\r\n private removeMinuteClick = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n e.preventDefault();\r\n this.handleMinutesChange(\r\n ((this.props.time?.minutes?.() ?? 0) - 1).toString()\r\n );\r\n };\r\n\r\n private addMinuteClick = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n e.preventDefault();\r\n this.handleMinutesChange(\r\n ((this.props.time?.minutes?.() ?? 0) + 1).toString()\r\n );\r\n };\r\n\r\n private removeHourClick = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n e.preventDefault();\r\n this.handleHoursChange(((this.props.time?.hours?.() ?? 0) - 1).toString());\r\n };\r\n\r\n private onHoursChanged = (e: React.ChangeEvent<HTMLInputElement>) => {\r\n // this.handleHoursChange(e.target.value);\r\n this.setState({ hoursText: e.target.value });\r\n };\r\n\r\n private addHourClick = (e: React.MouseEvent<HTMLButtonElement>) => {\r\n e.preventDefault();\r\n this.handleHoursChange(((this.props.time?.hours?.() ?? 0) + 1).toString());\r\n };\r\n\r\n private handleLimits(time: Duration) {\r\n if (this.props.min) {\r\n if (\r\n (time?.asMilliseconds?.() ?? 0) - this.props.min.asMilliseconds() <=\r\n 0\r\n ) {\r\n this.props.timeChange(this.props.min.clone());\r\n return;\r\n }\r\n }\r\n if (this.props.max) {\r\n if (\r\n this.props.max.asMilliseconds() - (time?.asMilliseconds?.() ?? 0) <=\r\n 0\r\n ) {\r\n this.props.timeChange(this.props.max.clone());\r\n return;\r\n }\r\n }\r\n this.props.timeChange(time);\r\n }\r\n\r\n private handleHoursChange(hoursString: string) {\r\n let num = Number(hoursString);\r\n if (hoursString === '') {\r\n num = 0;\r\n }\r\n if (!isNaN(num)) {\r\n let newTime: Duration = duration(\r\n this.props.time?.asMilliseconds?.() ?? 0,\r\n 'milliseconds'\r\n )\r\n .subtract(this.props.time?.hours?.() ?? 0, 'hours')\r\n .add(num, 'hours');\r\n this.handleLimits(newTime);\r\n }\r\n }\r\n\r\n private handleMinutesChange(minutesString: string) {\r\n let num = Number(minutesString);\r\n if (minutesString === '') {\r\n num = 0;\r\n }\r\n if (!isNaN(num)) {\r\n let newTime: Duration = duration(\r\n this.props.time?.asMilliseconds?.() ?? 0,\r\n 'milliseconds'\r\n )\r\n .subtract(this.props.time?.minutes?.() ?? 0, 'minutes')\r\n .add(num, 'minutes');\r\n this.handleLimits(newTime);\r\n }\r\n }\r\n}\r\n\r\nexport const Time = withThemeContext<TimeProps, InstanceType<typeof TimeRaw>>(\r\n withFormContext<TimeProps>(TimeRaw),\r\n 'time'\r\n);\r\n\r\nexport default Time;\r\n"],"file":"Time.js"}
@@ -39,7 +39,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
39
39
 
40
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
41
 
42
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
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
43
 
44
44
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
45
 
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8"/>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
6
- <title>guestbell-forms [12 Sep 2022 at 15:42]</title>
6
+ <title>guestbell-forms [15 Sep 2022 at 18:30]</title>
7
7
  <link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y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9
9
  <script>
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.297",
2
+ "version": "2.0.298",
3
3
  "description": "React forms with validation as used in GuestBell",
4
4
  "keywords": [
5
5
  "react",