kitchen-simulator 3.1.2 → 4.0.0-react-18

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 (138) hide show
  1. package/README.md +0 -3
  2. package/es/AppContext.js +1 -1
  3. package/es/LiteKitchenConfigurator.js +15 -25
  4. package/es/LiteRenderer.js +2 -5
  5. package/es/actions/export.js +12 -25
  6. package/es/catalog/catalog.js +5 -21
  7. package/es/components/content.js +2 -5
  8. package/es/components/export.js +6 -4
  9. package/es/components/style/export.js +2 -28
  10. package/es/components/style/form-number-input.js +22 -11
  11. package/es/components/viewer2d/group.js +4 -5
  12. package/es/components/viewer2d/item.js +4 -5
  13. package/es/components/viewer2d/layer.js +1 -1
  14. package/es/components/viewer2d/line.js +47 -17
  15. package/es/components/viewer2d/rulerX.js +0 -3
  16. package/es/components/viewer2d/rulerY.js +0 -3
  17. package/es/components/viewer2d/scene.js +1 -4
  18. package/es/components/viewer2d/state.js +1 -1
  19. package/es/components/viewer2d/viewer2d.js +43 -28
  20. package/es/components/viewer3d/viewer3d-first-person.js +0 -8
  21. package/es/components/viewer3d/viewer3d.js +0 -9
  22. package/es/devLiteRenderer.js +148 -317
  23. package/es/index.js +12 -4
  24. package/es/mocks/appliancePayload.json +27 -0
  25. package/es/mocks/cabinetPayload.json +1914 -0
  26. package/es/mocks/cabinetPayload2.json +76 -0
  27. package/es/mocks/dataBundle2.json +4 -0
  28. package/es/mocks/distancePayload.json +6 -0
  29. package/es/mocks/doorStylePayload2.json +84 -0
  30. package/es/mocks/furnishingPayload.json +23 -0
  31. package/es/mocks/itemCDSPayload.json +27 -0
  32. package/es/mocks/lightingPayload.json +23 -0
  33. package/es/mocks/mockProps.json +43 -0
  34. package/es/mocks/mockProps2.json +9 -0
  35. package/es/mocks/moldingPayload.json +19 -0
  36. package/es/mocks/projectItemsCatalog.json +133 -0
  37. package/es/mocks/rectangleShape.json +238 -0
  38. package/es/mocks/replaceCabinetPayload.json +81 -0
  39. package/es/mocks/roomShapePayload.json +5 -0
  40. package/es/useAppContext.js +8 -0
  41. package/lib/AppContext.js +1 -1
  42. package/lib/LiteKitchenConfigurator.js +15 -25
  43. package/lib/LiteRenderer.js +2 -5
  44. package/lib/actions/export.js +39 -35
  45. package/lib/catalog/catalog.js +4 -20
  46. package/lib/components/content.js +2 -5
  47. package/lib/components/export.js +26 -6
  48. package/lib/components/style/export.js +1 -105
  49. package/lib/components/style/form-number-input.js +22 -11
  50. package/lib/components/viewer2d/group.js +4 -5
  51. package/lib/components/viewer2d/item.js +4 -5
  52. package/lib/components/viewer2d/layer.js +1 -1
  53. package/lib/components/viewer2d/line.js +47 -17
  54. package/lib/components/viewer2d/rulerX.js +0 -3
  55. package/lib/components/viewer2d/rulerY.js +0 -3
  56. package/lib/components/viewer2d/scene.js +1 -4
  57. package/lib/components/viewer2d/state.js +1 -1
  58. package/lib/components/viewer2d/viewer2d.js +42 -27
  59. package/lib/components/viewer3d/viewer3d-first-person.js +0 -8
  60. package/lib/components/viewer3d/viewer3d.js +0 -9
  61. package/lib/devLiteRenderer.js +147 -316
  62. package/lib/index.js +12 -4
  63. package/lib/mocks/appliancePayload.json +27 -0
  64. package/lib/mocks/cabinetPayload.json +1914 -0
  65. package/lib/mocks/cabinetPayload2.json +76 -0
  66. package/lib/mocks/dataBundle2.json +4 -0
  67. package/lib/mocks/distancePayload.json +6 -0
  68. package/lib/mocks/doorStylePayload2.json +84 -0
  69. package/lib/mocks/furnishingPayload.json +23 -0
  70. package/lib/mocks/itemCDSPayload.json +27 -0
  71. package/lib/mocks/lightingPayload.json +23 -0
  72. package/lib/mocks/mockProps.json +43 -0
  73. package/lib/mocks/mockProps2.json +9 -0
  74. package/lib/mocks/moldingPayload.json +19 -0
  75. package/lib/mocks/projectItemsCatalog.json +133 -0
  76. package/lib/mocks/rectangleShape.json +238 -0
  77. package/lib/mocks/replaceCabinetPayload.json +81 -0
  78. package/lib/mocks/roomShapePayload.json +5 -0
  79. package/lib/useAppContext.js +16 -0
  80. package/package.json +16 -21
  81. package/es/catalog/properties/export.js +0 -21
  82. package/es/catalog/properties/property-checkbox.js +0 -68
  83. package/es/catalog/properties/property-color.js +0 -39
  84. package/es/catalog/properties/property-enum.js +0 -50
  85. package/es/catalog/properties/property-hidden.js +0 -19
  86. package/es/catalog/properties/property-lenght-measure.js +0 -100
  87. package/es/catalog/properties/property-length-measure.js +0 -84
  88. package/es/catalog/properties/property-length-measure_hole.js +0 -100
  89. package/es/catalog/properties/property-number.js +0 -48
  90. package/es/catalog/properties/property-read-only.js +0 -26
  91. package/es/catalog/properties/property-string.js +0 -48
  92. package/es/catalog/properties/property-toggle.js +0 -39
  93. package/es/catalog/properties/shared-property-style.js +0 -14
  94. package/es/components/style/button.js +0 -106
  95. package/es/components/style/cancel-button.js +0 -21
  96. package/es/components/style/content-container.js +0 -30
  97. package/es/components/style/content-title.js +0 -25
  98. package/es/components/style/delete-button.js +0 -24
  99. package/es/components/style/form-block.js +0 -20
  100. package/es/components/style/form-color-input.js +0 -26
  101. package/es/components/style/form-label.js +0 -22
  102. package/es/components/style/form-number-input_2.js +0 -200
  103. package/es/components/style/form-select.js +0 -19
  104. package/es/components/style/form-slider.js +0 -60
  105. package/es/components/style/form-submit-button.js +0 -25
  106. package/es/components/style/form-text-input.js +0 -69
  107. package/es/plugins/SVGLoader.js +0 -1414
  108. package/es/styles/export.js +0 -5
  109. package/es/styles/tabs.css +0 -40
  110. package/lib/catalog/properties/export.js +0 -81
  111. package/lib/catalog/properties/property-checkbox.js +0 -76
  112. package/lib/catalog/properties/property-color.js +0 -47
  113. package/lib/catalog/properties/property-enum.js +0 -58
  114. package/lib/catalog/properties/property-hidden.js +0 -27
  115. package/lib/catalog/properties/property-lenght-measure.js +0 -108
  116. package/lib/catalog/properties/property-length-measure.js +0 -92
  117. package/lib/catalog/properties/property-length-measure_hole.js +0 -108
  118. package/lib/catalog/properties/property-number.js +0 -56
  119. package/lib/catalog/properties/property-read-only.js +0 -34
  120. package/lib/catalog/properties/property-string.js +0 -56
  121. package/lib/catalog/properties/property-toggle.js +0 -47
  122. package/lib/catalog/properties/shared-property-style.js +0 -21
  123. package/lib/components/style/button.js +0 -115
  124. package/lib/components/style/cancel-button.js +0 -29
  125. package/lib/components/style/content-container.js +0 -38
  126. package/lib/components/style/content-title.js +0 -35
  127. package/lib/components/style/delete-button.js +0 -34
  128. package/lib/components/style/form-block.js +0 -28
  129. package/lib/components/style/form-color-input.js +0 -34
  130. package/lib/components/style/form-label.js +0 -30
  131. package/lib/components/style/form-number-input_2.js +0 -209
  132. package/lib/components/style/form-select.js +0 -29
  133. package/lib/components/style/form-slider.js +0 -68
  134. package/lib/components/style/form-submit-button.js +0 -35
  135. package/lib/components/style/form-text-input.js +0 -78
  136. package/lib/plugins/SVGLoader.js +0 -1419
  137. package/lib/styles/export.js +0 -13
  138. package/lib/styles/tabs.css +0 -40
@@ -1,106 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/esm/createClass";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
7
- import _inherits from "@babel/runtime/helpers/esm/inherits";
8
- var _excluded = ["type", "style", "styleHover", "children", "size"];
9
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
- import React, { Component } from 'react';
12
- import PropTypes from 'prop-types';
13
- import * as SharedStyle from "../../shared-style";
14
- var BASE_STYLE = {
15
- display: 'inline-block',
16
- fontWeight: '400',
17
- lineHeight: '1.25',
18
- textAlign: 'center',
19
- whiteSpace: 'nowrap',
20
- verticalAlign: 'middle',
21
- cursor: 'pointer',
22
- WebkitUserSelect: 'none',
23
- MozUserSelect: 'none',
24
- MsUserSelect: 'none',
25
- userSelect: 'none',
26
- padding: '5px 14px',
27
- fontSize: '14px',
28
- color: SharedStyle.COLORS.black,
29
- fonWeight: '400px',
30
- transition: 'background-color 175ms ease, border 175ms ease',
31
- outline: 'none',
32
- borderRadius: '2px',
33
- borderWidth: '1px',
34
- borderType: 'solid',
35
- width: '100%'
36
- };
37
- var BASE_STYLE_SIZE = {
38
- small: {
39
- fontSize: '12px',
40
- padding: '3px 8px'
41
- },
42
- normal: {},
43
- large: {
44
- padding: '8px 20px'
45
- }
46
- };
47
- var Button = /*#__PURE__*/function (_Component) {
48
- function Button(props) {
49
- var _this;
50
- _classCallCheck(this, Button);
51
- _this = _callSuper(this, Button, [props]);
52
- _this.state = {
53
- hover: false
54
- };
55
- return _this;
56
- }
57
- _inherits(Button, _Component);
58
- return _createClass(Button, [{
59
- key: "render",
60
- value: function render() {
61
- var _this2 = this;
62
- var hover = this.state.hover;
63
- var _this$props = this.props,
64
- type = _this$props.type,
65
- customStyle = _this$props.style,
66
- customStyleHover = _this$props.styleHover,
67
- children = _this$props.children,
68
- size = _this$props.size,
69
- rest = _objectWithoutProperties(_this$props, _excluded);
70
- var styleMerged = Object.assign({}, BASE_STYLE, BASE_STYLE_SIZE[size], hover ? customStyleHover : customStyle);
71
- return /*#__PURE__*/React.createElement("button", _extends({
72
- type: type,
73
- onMouseEnter: function onMouseEnter(e) {
74
- return _this2.setState({
75
- hover: true
76
- });
77
- },
78
- onMouseLeave: function onMouseLeave(e) {
79
- return _this2.setState({
80
- hover: false
81
- });
82
- },
83
- style: styleMerged
84
- }, rest), children);
85
- }
86
- }]);
87
- }(Component);
88
- export { Button as default };
89
- Button.defaultProps = {
90
- type: 'button',
91
- size: 'normal',
92
- style: {
93
- backgroundColor: '#e6e6e6',
94
- borderColor: '#adadad'
95
- },
96
- styleHover: {
97
- backgroundColor: '#d4d4d4',
98
- borderColor: '#8c8c8c'
99
- }
100
- };
101
- Button.propTypes = {
102
- type: PropTypes.string,
103
- style: PropTypes.object,
104
- styleHover: PropTypes.object,
105
- size: PropTypes.oneOf(['large', 'normal', 'small'])
106
- };
@@ -1,21 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["children"];
4
- import React from 'react';
5
- import Button from "./button";
6
- var STYLE = {
7
- borderColor: '#adadad',
8
- backgroundColor: '#e6e6e6'
9
- };
10
- var STYLE_HOVER = {
11
- backgroundColor: '#d4d4d4',
12
- borderColor: '#8c8c8c'
13
- };
14
- export default function CancelButton(_ref) {
15
- var children = _ref.children,
16
- rest = _objectWithoutProperties(_ref, _excluded);
17
- return /*#__PURE__*/React.createElement(Button, _extends({
18
- style: STYLE,
19
- styleHover: STYLE_HOVER
20
- }, rest), children);
21
- }
@@ -1,30 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import React from 'react';
5
- import PropTypes from 'prop-types';
6
- var STYLE = {
7
- padding: '0 20px',
8
- overflowY: 'auto'
9
- };
10
- export default function ContentContainer(_ref) {
11
- var children = _ref.children,
12
- width = _ref.width,
13
- height = _ref.height,
14
- _ref$style = _ref.style,
15
- style = _ref$style === void 0 ? {} : _ref$style;
16
- return /*#__PURE__*/React.createElement("div", {
17
- style: _objectSpread(_objectSpread({
18
- width: width,
19
- height: height
20
- }, STYLE), style),
21
- onWheel: function onWheel(event) {
22
- return event.stopPropagation();
23
- }
24
- }, children);
25
- }
26
- ContentContainer.propsType = {
27
- width: PropTypes.number.isRequired,
28
- height: PropTypes.number.isRequired,
29
- style: PropTypes.object
30
- };
@@ -1,25 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["children", "style"];
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import React from 'react';
8
- import PropTypes from 'prop-types';
9
- import * as SharedStyle from "../../shared-style";
10
- var STYLE = {
11
- color: SharedStyle.PRIMARY_COLOR.alt,
12
- fontWeight: 300
13
- };
14
- export default function ContentTitle(_ref) {
15
- var children = _ref.children,
16
- _ref$style = _ref.style,
17
- style = _ref$style === void 0 ? {} : _ref$style,
18
- rest = _objectWithoutProperties(_ref, _excluded);
19
- return /*#__PURE__*/React.createElement("h1", _extends({
20
- style: _objectSpread(_objectSpread({}, STYLE), style)
21
- }, rest), children);
22
- }
23
- ContentTitle.propsType = {
24
- style: PropTypes.object
25
- };
@@ -1,24 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["children"];
4
- import React from 'react';
5
- import Button from "./button";
6
- import * as SharedStyle from "../../shared-style";
7
- var STYLE = {
8
- borderColor: '#c12e2a',
9
- backgroundColor: '#c9302c',
10
- color: SharedStyle.COLORS.white
11
- };
12
- var STYLE_HOVER = {
13
- backgroundColor: '#972726',
14
- borderColor: '#c12e2a',
15
- color: SharedStyle.COLORS.white
16
- };
17
- export default function FormDeleteButton(_ref) {
18
- var children = _ref.children,
19
- rest = _objectWithoutProperties(_ref, _excluded);
20
- return /*#__PURE__*/React.createElement(Button, _extends({
21
- style: STYLE,
22
- styleHover: STYLE_HOVER
23
- }, rest), children);
24
- }
@@ -1,20 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["children", "style"];
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import React from 'react';
8
- var BASE_STYLE = {
9
- marginBottom: '16px'
10
- };
11
- export default function FormBlock(_ref) {
12
- var children = _ref.children,
13
- style = _ref.style,
14
- rest = _objectWithoutProperties(_ref, _excluded);
15
- return /*#__PURE__*/React.createElement("div", _extends({
16
- style: _objectSpread(_objectSpread({}, BASE_STYLE), {}, {
17
- style: style
18
- })
19
- }, rest), children);
20
- }
@@ -1,26 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["onChange"];
4
- import React from 'react';
5
- import FormTextInput from "./form-text-input";
6
- var STYLE = {
7
- padding: 0,
8
- border: 0
9
- };
10
- var EREG_NUMBER = /^.*$/;
11
- export default function FormColorInput(_ref) {
12
- var onChange = _ref.onChange,
13
- rest = _objectWithoutProperties(_ref, _excluded);
14
- var onChangeCustom = function onChangeCustom(event) {
15
- var value = event.target.value;
16
- if (EREG_NUMBER.test(value)) {
17
- onChange(event);
18
- }
19
- };
20
- return /*#__PURE__*/React.createElement(FormTextInput, _extends({
21
- type: "color",
22
- style: STYLE,
23
- onChange: onChangeCustom,
24
- autoComplete: "off"
25
- }, rest));
26
- }
@@ -1,22 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["children", "style"];
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import React from 'react';
8
- var BASE_STYLE = {
9
- display: 'block',
10
- marginBottom: '2px',
11
- fontSize: '12px'
12
- };
13
- export default function FormLabel(_ref) {
14
- var children = _ref.children,
15
- style = _ref.style,
16
- rest = _objectWithoutProperties(_ref, _excluded);
17
- return /*#__PURE__*/React.createElement("label", _extends({
18
- style: _objectSpread(_objectSpread({}, BASE_STYLE), {}, {
19
- style: style
20
- })
21
- }, rest), children);
22
- }
@@ -1,200 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
- import _inherits from "@babel/runtime/helpers/esm/inherits";
7
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
- import React, { Component } from 'react';
12
- import PropTypes from 'prop-types';
13
- import * as SharedStyle from "../../shared-style";
14
- import { MdUpdate } from 'react-icons/md';
15
- import { KEYBOARD_BUTTON_CODE } from "../../constants";
16
- var STYLE_INPUT = {
17
- display: 'block',
18
- width: '100%',
19
- padding: '0 2px',
20
- fontSize: '13px',
21
- lineHeight: '1.25',
22
- color: SharedStyle.PRIMARY_COLOR.input,
23
- backgroundColor: SharedStyle.COLORS.white,
24
- backgroundImage: 'none',
25
- border: '1px solid rgba(0,0,0,.15)',
26
- outline: 'none',
27
- height: '30px'
28
- };
29
- var confirmStyle = {
30
- position: 'absolute',
31
- cursor: 'pointer',
32
- width: '20px',
33
- height: '20px',
34
- right: '5px',
35
- top: '5px',
36
- backgroundColor: SharedStyle.SECONDARY_COLOR.main,
37
- color: '#FFF',
38
- transition: 'all 0.1s linear'
39
- };
40
- var FormNumberInput = /*#__PURE__*/function (_Component) {
41
- function FormNumberInput(props, context) {
42
- var _this;
43
- _classCallCheck(this, FormNumberInput);
44
- _this = _callSuper(this, FormNumberInput, [props, context]);
45
- _this.state = {
46
- focus: false,
47
- valid: true,
48
- showedValue: props.value,
49
- disabled: props.disabled === true ? true : false,
50
- focusOn: false
51
- };
52
- return _this;
53
- }
54
- _inherits(FormNumberInput, _Component);
55
- return _createClass(FormNumberInput, [{
56
- key: "componentWillReceiveProps",
57
- value: function componentWillReceiveProps(nextProps) {
58
- if (this.props.value !== nextProps.value || this.props.focus !== nextProps.focus) {
59
- this.setState({
60
- showedValue: nextProps.value,
61
- focusOn: nextProps.focus
62
- });
63
- }
64
- if (this.props.focus !== nextProps.focus) {
65
- this.Input.focus();
66
- this.Input.select();
67
- }
68
- }
69
- }, {
70
- key: "render",
71
- value: function render() {
72
- var _this2 = this;
73
- var _this$props = this.props,
74
- value = _this$props.value,
75
- min = _this$props.min,
76
- max = _this$props.max,
77
- precision = _this$props.precision,
78
- onChange = _this$props.onChange,
79
- onValid = _this$props.onValid,
80
- onInvalid = _this$props.onInvalid,
81
- style = _this$props.style,
82
- placeholder = _this$props.placeholder;
83
- var numericInputStyle = _objectSpread(_objectSpread({}, STYLE_INPUT), style);
84
- if (this.state.focusOn) numericInputStyle.border = "1px solid ".concat(SharedStyle.SECONDARY_COLOR.main);
85
- var regexp = new RegExp("^-?([0-9]+)?\\.?([0-9]{0,".concat(precision, "})?$"));
86
- if (!isNaN(min) && isFinite(min) && this.state.showedValue < min) this.setState({
87
- showedValue: min
88
- }); // value = min;
89
- if (!isNaN(max) && isFinite(max) && this.state.showedValue > max) this.setState({
90
- showedValue: max
91
- }); // value = max;
92
-
93
- var currValue = regexp.test(this.state.showedValue) ? this.state.showedValue : parseFloat(this.state.showedValue).toFixed(precision);
94
- var different = parseFloat(this.props.value).toFixed(precision) !== parseFloat(this.state.showedValue).toFixed(precision);
95
- var saveFn = function saveFn(e) {
96
- e.stopPropagation();
97
- if (_this2.state.valid) {
98
- var savedValue = _this2.state.showedValue !== '' && _this2.state.showedValue !== '-' ? parseFloat(_this2.state.showedValue) : 0;
99
- _this2.setState({
100
- showedValue: savedValue
101
- });
102
- onChange({
103
- target: {
104
- value: savedValue
105
- }
106
- });
107
- }
108
- };
109
- return /*#__PURE__*/React.createElement("div", {
110
- style: {
111
- position: 'relative'
112
- }
113
- }, /*#__PURE__*/React.createElement("input", {
114
- autoFocus: this.state.focusOn,
115
- readOnly: this.state.disabled,
116
- type: "text",
117
- value: currValue,
118
- style: numericInputStyle,
119
- onChange: function onChange(evt) {
120
- var valid = regexp.test(evt.nativeEvent.target.value);
121
- if (valid) {
122
- _this2.setState({
123
- showedValue: evt.nativeEvent.target.value
124
- });
125
- if (onValid) onValid(evt.nativeEvent);
126
- } else {
127
- if (onInvalid) onInvalid(evt.nativeEvent);
128
- }
129
- _this2.setState({
130
- valid: valid
131
- });
132
- },
133
- onFocus: function onFocus(e) {
134
- return _this2.setState({
135
- focusOn: true
136
- });
137
- },
138
- onBlur: function onBlur(e) {
139
- return _this2.setState({
140
- focusOn: false
141
- });
142
- },
143
- ref: function ref(ele) {
144
- _this2.Input = ele;
145
- },
146
- onKeyDown: function onKeyDown(e) {
147
- var keyCode = e.keyCode || e.which;
148
- if (keyCode == KEYBOARD_BUTTON_CODE.ENTER || keyCode == KEYBOARD_BUTTON_CODE.TAB) {
149
- saveFn(e);
150
- _this2.Input.blur();
151
- }
152
- if (keyCode == KEYBOARD_BUTTON_CODE.ESC) {
153
- _this2.context.projectActions.rollback();
154
- }
155
- },
156
- placeholder: placeholder
157
- }), /*#__PURE__*/React.createElement("div", {
158
- onClick: function onClick(e) {
159
- if (different) saveFn(e);
160
- },
161
- title: this.context.translator.t('Confirm'),
162
- style: _objectSpread(_objectSpread({}, confirmStyle), {}, {
163
- visibility: different ? 'visible' : 'hidden',
164
- opacity: different ? '1' : '0'
165
- })
166
- }, /*#__PURE__*/React.createElement(MdUpdate, {
167
- style: {
168
- width: '100%',
169
- height: '100%',
170
- padding: '0.2em',
171
- color: '#FFF'
172
- }
173
- })));
174
- }
175
- }]);
176
- }(Component);
177
- export { FormNumberInput as default };
178
- FormNumberInput.propTypes = {
179
- value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
180
- style: PropTypes.object,
181
- onChange: PropTypes.func.isRequired,
182
- onValid: PropTypes.func,
183
- onInvalid: PropTypes.func,
184
- min: PropTypes.number,
185
- max: PropTypes.number,
186
- precision: PropTypes.number,
187
- placeholder: PropTypes.string
188
- };
189
- FormNumberInput.contextTypes = {
190
- translator: PropTypes.object.isRequired,
191
- projectActions: PropTypes.object.isRequired
192
- };
193
- FormNumberInput.defaultProps = {
194
- value: 0,
195
- style: {},
196
- min: Number.MIN_SAFE_INTEGER,
197
- max: Number.MAX_SAFE_INTEGER,
198
- precision: 2,
199
- disabled: false
200
- };
@@ -1,19 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
4
- var _excluded = ["children", "style"];
5
- var _templateObject;
6
- import React from 'react';
7
- import * as SharedStyle from "../../shared-style";
8
- import styled from 'styled-components';
9
- import { TEXT_COLOR_NEUTRAL_3, DEFAULT_FONT_FAMILY, SECONDARY_PURPLE_COLOR } from "../../constants";
10
- var StyledSelect = styled.select(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n width: 120px;\n float: right;\n padding: 15px 10px 12px 0px;\n color: ", ";\n border: 2px solid;\n font-family: ", ";\n font-size: 12px;\n font-weight: 600;\n line-height: 17px;\n text-align: right;\n outline: none;\n border-radius: 5px;\n :hover {\n border-color: ", ";\n }\n :focus {\n border-color: ", ";\n }\n"])), TEXT_COLOR_NEUTRAL_3, DEFAULT_FONT_FAMILY, SECONDARY_PURPLE_COLOR, SECONDARY_PURPLE_COLOR);
11
- export default function FormSelect(_ref) {
12
- var children = _ref.children,
13
- style = _ref.style,
14
- rest = _objectWithoutProperties(_ref, _excluded);
15
- return /*#__PURE__*/React.createElement(StyledSelect, _extends({
16
- type: "text",
17
- style: style
18
- }, rest), children);
19
- }
@@ -1,60 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["value", "onChange", "min", "max", "step"];
4
- import React from 'react';
5
- import FormTextInput from "./form-text-input";
6
- var sliderContainerStyle = {
7
- display: 'inline-block',
8
- width: '80%',
9
- marginRight: '5%'
10
- };
11
- var sliderStyle = {
12
- display: 'block',
13
- width: '100%',
14
- height: '30px'
15
- };
16
- var textContainerStyle = {
17
- display: 'inline-block',
18
- width: '15%',
19
- "float": 'right'
20
- };
21
- var textStyle = {
22
- height: '34px',
23
- textAlign: 'center'
24
- };
25
- export default function FormNumberInput(_ref) {
26
- var value = _ref.value,
27
- onChange = _ref.onChange,
28
- _ref$min = _ref.min,
29
- min = _ref$min === void 0 ? 0 : _ref$min,
30
- _ref$max = _ref.max,
31
- max = _ref$max === void 0 ? 100 : _ref$max,
32
- _ref$step = _ref.step,
33
- step = _ref$step === void 0 ? 1 : _ref$step,
34
- rest = _objectWithoutProperties(_ref, _excluded);
35
- // Handle both slider and text input changes
36
- var handleSliderChange = function handleSliderChange(e) {
37
- onChange(Number(e.target.value));
38
- };
39
- var handleTextChange = function handleTextChange(e) {
40
- var val = e.target.value === '' ? '' : Number(e.target.value);
41
- onChange(val);
42
- };
43
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
44
- style: sliderContainerStyle
45
- }, /*#__PURE__*/React.createElement("input", _extends({
46
- type: "range",
47
- style: sliderStyle,
48
- min: min,
49
- max: max,
50
- step: step,
51
- value: value,
52
- onChange: handleSliderChange
53
- }, rest))), /*#__PURE__*/React.createElement("div", {
54
- style: textContainerStyle
55
- }, /*#__PURE__*/React.createElement(FormTextInput, {
56
- value: value,
57
- onChange: handleTextChange,
58
- style: textStyle
59
- })));
60
- }
@@ -1,25 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["children"];
4
- import React from 'react';
5
- import Button from "./button";
6
- import * as SharedStyle from "../../shared-style";
7
- var STYLE = {
8
- borderColor: '#415375',
9
- backgroundColor: '#415375',
10
- color: SharedStyle.COLORS.white
11
- };
12
- var STYLE_HOVER = {
13
- borderColor: '#1f3149',
14
- backgroundColor: '#1f3149',
15
- color: SharedStyle.COLORS.white
16
- };
17
- export default function FormSubmitButton(_ref) {
18
- var children = _ref.children,
19
- rest = _objectWithoutProperties(_ref, _excluded);
20
- return /*#__PURE__*/React.createElement(Button, _extends({
21
- type: "submit",
22
- style: STYLE,
23
- styleHover: STYLE_HOVER
24
- }, rest), children);
25
- }
@@ -1,69 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/esm/createClass";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
7
- import _inherits from "@babel/runtime/helpers/esm/inherits";
8
- import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
9
- var _excluded = ["style"];
10
- var _templateObject;
11
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
- import React, { Component } from 'react';
14
- import * as SharedStyle from "../../shared-style";
15
- import { PROJECT_NAME_LENGTH_LIMIT, TEXT_COLOR_NEUTRAL_3, BG_COLOR_0, DEFAULT_FONT_FAMILY, SECONDARY_PURPLE_COLOR } from "../../constants";
16
- import styled from 'styled-components';
17
- var StyledInput = styled.input(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n padding: 15px 10px 12px 0px;\n width: 120px;\n font-family: ", ";\n font-size: 12px;\n font-weight: 600;\n line-height: 17px;\n color: ", ";\n background-color: ", ";\n border: 2px solid;\n text-align: right;\n float: right;\n border-radius: 5px;\n outline: 0;\n :focus {\n border-color: ", ";\n }\n"])), DEFAULT_FONT_FAMILY, TEXT_COLOR_NEUTRAL_3, BG_COLOR_0, SECONDARY_PURPLE_COLOR);
18
- var FormTextInput = /*#__PURE__*/function (_Component) {
19
- function FormTextInput(props) {
20
- var _this;
21
- _classCallCheck(this, FormTextInput);
22
- _this = _callSuper(this, FormTextInput, [props]);
23
- _this.state = {
24
- focus: false
25
- };
26
- _this.input = /*#__PURE__*/React.createRef(null);
27
- return _this;
28
- }
29
- _inherits(FormTextInput, _Component);
30
- return _createClass(FormTextInput, [{
31
- key: "componentDidMount",
32
- value: function componentDidMount() {
33
- if (this.input.current) {
34
- this.input.current.select();
35
- }
36
- }
37
- }, {
38
- key: "render",
39
- value: function render() {
40
- var _this2 = this;
41
- var _this$props = this.props,
42
- style = _this$props.style,
43
- rest = _objectWithoutProperties(_this$props, _excluded);
44
- return /*#__PURE__*/React.createElement(StyledInput, _extends({
45
- ref: this.input,
46
- onFocus: function onFocus(e) {
47
- return _this2.setState({
48
- focus: true
49
- });
50
- },
51
- onBlur: function onBlur(e) {
52
- return _this2.setState({
53
- focus: false
54
- });
55
- },
56
- style: style
57
- // autoFocus
58
- ,
59
- type: "text"
60
- }, rest, {
61
- maxLength: PROJECT_NAME_LENGTH_LIMIT
62
- }));
63
- }
64
- }]);
65
- }(Component);
66
- export { FormTextInput as default };
67
- FormTextInput.defaultProps = {
68
- style: {}
69
- };