kitchen-simulator 5.0.0-test.6 → 5.0.0-test.8

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 (178) hide show
  1. package/package.json +23 -3
  2. package/src/components/_export.js +11 -0
  3. package/src/components/viewer3d/scene-creator.js +23 -26
  4. package/src/components/viewer3d/viewer3d.js +18 -18
  5. package/src/components/catalog-view/catalog-breadcrumb.jsx +0 -53
  6. package/src/components/catalog-view/catalog-item.jsx +0 -229
  7. package/src/components/catalog-view/catalog-list.jsx +0 -173
  8. package/src/components/catalog-view/catalog-page-item.jsx +0 -110
  9. package/src/components/catalog-view/catalog-turn-back-page-item.jsx +0 -80
  10. package/src/components/configurator/custom-configurator.jsx +0 -77
  11. package/src/components/configurator/project-configurator.jsx +0 -120
  12. package/src/components/export.js +0 -36
  13. package/src/components/firstsetting/button/styles.js +0 -223
  14. package/src/components/firstsetting/export.js +0 -9
  15. package/src/components/firstsetting/firstsetting-content-button.jsx +0 -198
  16. package/src/components/firstsetting/firstsetting-toggle-button.jsx +0 -101
  17. package/src/components/firstsetting/firstsetting.jsx +0 -814
  18. package/src/components/footerbar/button/ControlButton.jsx +0 -43
  19. package/src/components/footerbar/button/DirectionButton.jsx +0 -54
  20. package/src/components/footerbar/button/DirectionPanSpinButton.jsx +0 -36
  21. package/src/components/footerbar/button/ToggleButton.jsx +0 -58
  22. package/src/components/footerbar/button/ToggleConvertButton.jsx +0 -48
  23. package/src/components/footerbar/button/ToggleMeasureButton.jsx +0 -33
  24. package/src/components/footerbar/button/styles.js +0 -217
  25. package/src/components/footerbar/export.js +0 -9
  26. package/src/components/footerbar/footer-content-button.jsx +0 -198
  27. package/src/components/footerbar/footer-toggle-button.jsx +0 -101
  28. package/src/components/footerbar/footerbar.jsx +0 -1103
  29. package/src/components/footerbar/styles.js +0 -263
  30. package/src/components/header/button/MenuButton.jsx +0 -46
  31. package/src/components/header/button/SaveButton.jsx +0 -54
  32. package/src/components/header/button/styles.js +0 -181
  33. package/src/components/header/export.js +0 -5
  34. package/src/components/header/header.jsx +0 -631
  35. package/src/components/header/header.style.css +0 -47
  36. package/src/components/header/styles.js +0 -320
  37. package/src/components/login/Login.js +0 -77
  38. package/src/components/login/LoginForm/index.js +0 -108
  39. package/src/components/login/Register.js +0 -83
  40. package/src/components/login/RegisterForm/index.js +0 -171
  41. package/src/components/login/jwtService.js +0 -201
  42. package/src/components/login/style.css +0 -158
  43. package/src/components/login/style.scss +0 -260
  44. package/src/components/myprojects/export.js +0 -5
  45. package/src/components/myprojects/index.jsx +0 -445
  46. package/src/components/myprojects/styles.js +0 -241
  47. package/src/components/sidebar/custom-accordion.jsx +0 -48
  48. package/src/components/sidebar/export.js +0 -15
  49. package/src/components/sidebar/panel-element-editor/attributes-editor/attributes-editor.jsx +0 -73
  50. package/src/components/sidebar/panel-element-editor/attributes-editor/confirm-popup.jsx +0 -101
  51. package/src/components/sidebar/panel-element-editor/attributes-editor/hole-attributes-editor.jsx +0 -149
  52. package/src/components/sidebar/panel-element-editor/attributes-editor/item-attributes-editor.jsx +0 -316
  53. package/src/components/sidebar/panel-element-editor/attributes-editor/line-attributes-editor.jsx +0 -108
  54. package/src/components/sidebar/panel-element-editor/element-editor.jsx +0 -1070
  55. package/src/components/sidebar/panel-element-editor/multi-elements-editor.jsx +0 -0
  56. package/src/components/sidebar/panel-element-editor/panel-element-editor.jsx +0 -104
  57. package/src/components/sidebar/panel-element-editor/panel-multi-elements-editor.jsx +0 -155
  58. package/src/components/sidebar/panel-group-editor.jsx +0 -272
  59. package/src/components/sidebar/panel-groups.jsx +0 -310
  60. package/src/components/sidebar/panel-guides.jsx +0 -192
  61. package/src/components/sidebar/panel-layer-elements.jsx +0 -298
  62. package/src/components/sidebar/panel-layers.jsx +0 -381
  63. package/src/components/sidebar/panel.jsx +0 -71
  64. package/src/components/sidebar/sidebar.jsx +0 -106
  65. package/src/components/sidebar/toolbar-panel.jsx +0 -139
  66. package/src/components/sign/export.js +0 -7
  67. package/src/components/sign/main/index.jsx +0 -523
  68. package/src/components/sign/main/styles.js +0 -163
  69. package/src/components/toolbar/button/ControlButton.jsx +0 -41
  70. package/src/components/toolbar/button/DirectionButton.jsx +0 -34
  71. package/src/components/toolbar/button/RightButton.jsx +0 -103
  72. package/src/components/toolbar/button/ToggleButton.jsx +0 -41
  73. package/src/components/toolbar/button/index.jsx +0 -55
  74. package/src/components/toolbar/button/styles.js +0 -127
  75. package/src/components/toolbar/components/DoorStyleMenu.jsx +0 -103
  76. package/src/components/toolbar/components/Pricing.jsx +0 -126
  77. package/src/components/toolbar/components/ReviewForQuote.jsx +0 -635
  78. package/src/components/toolbar/export.js +0 -21
  79. package/src/components/toolbar/main/Alert.js +0 -122
  80. package/src/components/toolbar/main/TakePictureModal.jsx +0 -104
  81. package/src/components/toolbar/main/confirm-popup.jsx +0 -99
  82. package/src/components/toolbar/main/index.jsx +0 -5687
  83. package/src/components/toolbar/main/lShaped.json +0 -311
  84. package/src/components/toolbar/main/longNarrow.json +0 -238
  85. package/src/components/toolbar/main/myComponents.js +0 -123
  86. package/src/components/toolbar/main/oRectangle.json +0 -220
  87. package/src/components/toolbar/main/rectangle.json +0 -238
  88. package/src/components/toolbar/main/style.css +0 -107
  89. package/src/components/toolbar/main/styles.js +0 -696
  90. package/src/components/toolbar/plugin-item.jsx +0 -123
  91. package/src/components/toolbar/popup/appliance/appliance-category/index.jsx +0 -73
  92. package/src/components/toolbar/popup/appliance/choose-appliance/index.jsx +0 -102
  93. package/src/components/toolbar/popup/appliance/index.jsx +0 -83
  94. package/src/components/toolbar/popup/autosaveprompt/index.jsx +0 -150
  95. package/src/components/toolbar/popup/autosaveprompt/styles.css +0 -64
  96. package/src/components/toolbar/popup/autosaveprompt/styles.js +0 -40
  97. package/src/components/toolbar/popup/cabinet/cabinet-category/index.jsx +0 -73
  98. package/src/components/toolbar/popup/cabinet/choose-product/index.jsx +0 -119
  99. package/src/components/toolbar/popup/cabinet/index.jsx +0 -85
  100. package/src/components/toolbar/popup/doorStyle/choose-style/index.jsx +0 -63
  101. package/src/components/toolbar/popup/doorStyle/index.jsx +0 -71
  102. package/src/components/toolbar/popup/doorStyle/style-category/index.jsx +0 -139
  103. package/src/components/toolbar/popup/downloadsummary/downloadSummaryContext.js +0 -2
  104. package/src/components/toolbar/popup/downloadsummary/downloadSummaryTemp.jsx +0 -157
  105. package/src/components/toolbar/popup/downloadsummary/index.jsx +0 -643
  106. package/src/components/toolbar/popup/downloadsummary/show2D/show2DView.jsx +0 -51
  107. package/src/components/toolbar/popup/downloadsummary/show2D/viewer2DDownLoad.jsx +0 -175
  108. package/src/components/toolbar/popup/downloadsummary/show3D/show3DView.jsx +0 -283
  109. package/src/components/toolbar/popup/downloadsummary/show3D/viewer3DDownLoad.jsx +0 -2257
  110. package/src/components/toolbar/popup/downloadsummary/showCabinetInfo.js +0 -93
  111. package/src/components/toolbar/popup/downloadsummary/showElevation/showElevationView.jsx +0 -132
  112. package/src/components/toolbar/popup/downloadsummary/showElevation/viewer3DElevationDownload.jsx +0 -2198
  113. package/src/components/toolbar/popup/downloadsummary/showElevation/viewerElevationDownload.jsx +0 -152
  114. package/src/components/toolbar/popup/downloadsummary/showWarranty.jsx +0 -149
  115. package/src/components/toolbar/popup/downloadsummary/styles.css +0 -177
  116. package/src/components/toolbar/popup/downloadsummary/styles.js +0 -453
  117. package/src/components/toolbar/popup/finishingtouch/category/index.jsx +0 -34
  118. package/src/components/toolbar/popup/finishingtouch/index.jsx +0 -58
  119. package/src/components/toolbar/popup/finishingtouch/material-edit.jsx +0 -112
  120. package/src/components/toolbar/popup/finishingtouch/product/index.jsx +0 -116
  121. package/src/components/toolbar/popup/floorplan/choose-floor/confirm-popup.jsx +0 -101
  122. package/src/components/toolbar/popup/floorplan/choose-floor/index.jsx +0 -254
  123. package/src/components/toolbar/popup/floorplan/choose-floor/lShaped.json +0 -311
  124. package/src/components/toolbar/popup/floorplan/choose-floor/longNarrow.json +0 -238
  125. package/src/components/toolbar/popup/floorplan/choose-floor/oRectangle.json +0 -220
  126. package/src/components/toolbar/popup/floorplan/choose-floor/rectangle.json +0 -238
  127. package/src/components/toolbar/popup/floorplan/choose-floor/styles.js +0 -86
  128. package/src/components/toolbar/popup/floorplan/floor-category/index.jsx +0 -109
  129. package/src/components/toolbar/popup/floorplan/index.jsx +0 -60
  130. package/src/components/toolbar/popup/index.jsx +0 -241
  131. package/src/components/toolbar/popup/newproject/index.jsx +0 -59
  132. package/src/components/toolbar/popup/newproject/styles.css +0 -64
  133. package/src/components/toolbar/popup/newproject/styles.js +0 -41
  134. package/src/components/toolbar/popup/product/appliance.jsx +0 -54
  135. package/src/components/toolbar/popup/product/cabinetproduct.jsx +0 -15
  136. package/src/components/toolbar/popup/product/doorstyle.jsx +0 -58
  137. package/src/components/toolbar/popup/product/doorstyleproduct.jsx +0 -47
  138. package/src/components/toolbar/popup/product/floor.jsx +0 -36
  139. package/src/components/toolbar/popup/product/floorproduct.jsx +0 -42
  140. package/src/components/toolbar/popup/product/index.jsx +0 -36
  141. package/src/components/toolbar/popup/product/primary.jsx +0 -77
  142. package/src/components/toolbar/popup/product/productline.jsx +0 -93
  143. package/src/components/toolbar/popup/product/reviewItem.jsx +0 -427
  144. package/src/components/toolbar/popup/product/reviewMolding.jsx +0 -310
  145. package/src/components/toolbar/popup/product/style.css +0 -54
  146. package/src/components/toolbar/popup/product/styles.js +0 -260
  147. package/src/components/toolbar/popup/savedesign/FullPictureForm.jsx +0 -146
  148. package/src/components/toolbar/popup/savedesign/index.jsx +0 -495
  149. package/src/components/toolbar/popup/savedesign/savedesign.style.css +0 -16
  150. package/src/components/toolbar/popup/savedesign/styles.js +0 -151
  151. package/src/components/toolbar/popup/setDoorStyleOption/index.jsx +0 -87
  152. package/src/components/toolbar/popup/styles.js +0 -909
  153. package/src/components/toolbar/popup/submitforquote/AddToCartOptions.jsx +0 -192
  154. package/src/components/toolbar/popup/submitforquote/CustomerRequestsForm.jsx +0 -96
  155. package/src/components/toolbar/popup/submitforquote/SkipDesignerReview.jsx +0 -54
  156. package/src/components/toolbar/popup/submitforquote/StepDots.jsx +0 -25
  157. package/src/components/toolbar/popup/submitforquote/cart-choice.jsx +0 -116
  158. package/src/components/toolbar/popup/submitforquote/doorstyle-menus.js +0 -38
  159. package/src/components/toolbar/popup/submitforquote/index.jsx +0 -698
  160. package/src/components/toolbar/popup/submitforquote/styles.css +0 -105
  161. package/src/components/toolbar/popup/submitforquote/styles.js +0 -294
  162. package/src/components/toolbar/popup/submitprompt/index.jsx +0 -89
  163. package/src/components/toolbar/popup/submitprompt/styles.css +0 -64
  164. package/src/components/toolbar/popup/submitprompt/styles.js +0 -42
  165. package/src/components/toolbar/toolbar-button.jsx +0 -90
  166. package/src/components/toolbar/toolbar-load-button.jsx +0 -36
  167. package/src/components/toolbar/toolbar-save-button.jsx +0 -32
  168. package/src/components/wizardstep/button/styles.js +0 -677
  169. package/src/components/wizardstep/export.js +0 -5
  170. package/src/components/wizardstep/index.jsx +0 -1372
  171. package/src/components/wizardstep/styles.js +0 -688
  172. package/src/components/wizardstep/wizardstep-content-button.jsx +0 -198
  173. package/src/components/wizardstep/wizardstep-toggle-button.jsx +0 -101
  174. package/src/hooks/useCheckCart.js +0 -38
  175. package/src/hooks/useGetPricesBySku.js +0 -59
  176. package/src/hooks/useValidateToken.js +0 -181
  177. package/src/styles/export.js +0 -7
  178. package/src/styles/tabs.css +0 -40
@@ -1,316 +0,0 @@
1
- import React, { useState } from 'react';
2
- import PropTypes from 'prop-types';
3
- import FormNumberInput from '../../../style/form-number-input';
4
- import convert from 'convert-units';
5
- import ConfirmPopup from './confirm-popup';
6
- import styled from 'styled-components';
7
- import {
8
- DEFAULT_FONT_FAMILY,
9
- TEXT_COLOR_NEUTRAL_0,
10
- TEXT_COLOR_NEUTRAL_2,
11
- TEXT_COLOR_NEUTRAL_3
12
- } from '../../../../constants';
13
-
14
- const NumberInputWrapper = styled.div`
15
- display: flex;
16
- align-items: center;
17
- margin-top: 5px;
18
- position: relative;
19
- `;
20
-
21
- const NumberInputTitle = styled.span`
22
- font-family: ${DEFAULT_FONT_FAMILY};
23
- font-size: 16px;
24
- font-weight: 400;
25
- line-height: 15px;
26
- text-align: left;
27
- color: ${TEXT_COLOR_NEUTRAL_0};
28
- margin-right: auto;
29
- `;
30
-
31
- const NumberInputMeasure = styled.span`
32
- font-family: ${DEFAULT_FONT_FAMILY};
33
- font-size: 16px;
34
- font-weight: 600;
35
- line-height: 17px;
36
- color: ${TEXT_COLOR_NEUTRAL_3};
37
- position: absolute;
38
- right: 10px;
39
- bottom: 14px;
40
- `;
41
-
42
- const Left = 0;
43
- const Right = 180;
44
- const Back = 90;
45
- const Front = -90;
46
-
47
- let newX, newY;
48
-
49
- export default function ItemAttributesEditor(
50
- {
51
- element,
52
- onUpdate,
53
- propertiesFormData,
54
- catalog,
55
- attributeFormData,
56
- onConfigUpdate,
57
- state,
58
- internalState,
59
- filteredProperties,
60
- shouldOnlyShowEditorOptions = false,
61
- ...rest
62
- },
63
- { translator }
64
- ) {
65
- let [isPopupOpen, setPopupOpen] = useState(false);
66
- // ✅ Cache element data from attributeFormData if available
67
- const formElement = attributeFormData.has('element')
68
- ? attributeFormData.get('element')
69
- : null;
70
-
71
- const name = formElement ? formElement.get('name') : element.name;
72
- const renderedX = formElement ? formElement.get('x') : element.x;
73
- const renderedY = formElement ? formElement.get('y') : element.y;
74
- const renderedR = formElement
75
- ? formElement.get('rotation')
76
- : element.rotation;
77
-
78
- // ✅ Initialize distances
79
- let distBack = null,
80
- distFront = null,
81
- distLeft = null,
82
- distRight = null;
83
-
84
- // ✅ Detect if distArray uses Immutable-style or plain array
85
- const isImmutable = typeof element.distArray?.get === 'function';
86
-
87
- for (let i = 0; i < 4; i++) {
88
- const entry = isImmutable
89
- ? element.distArray.get(i)
90
- : element.distArray?.[i];
91
-
92
- if (!entry) continue;
93
-
94
- const value = isImmutable ? entry.get(0) : entry[0];
95
- const side = isImmutable ? entry.get(1) : entry[1];
96
-
97
- // == null checks for both null and undefined (it’s a loose equality check).
98
- if (value == null || side == null) continue;
99
-
100
- const inches = convert(value).from('cm').to('in');
101
-
102
- switch (side) {
103
- case Left:
104
- distLeft = inches;
105
- break;
106
- case Right:
107
- distRight = inches;
108
- break;
109
- case Back:
110
- distBack = inches;
111
- break;
112
- case Front:
113
- distFront = inches;
114
- break;
115
- }
116
- }
117
-
118
- const moveCabinet = () => {
119
- onUpdate('pos', { x: newX, y: newY });
120
- };
121
-
122
- const changeDistance = (oldVal, newVal, oldRot) => {
123
- let rotRad = ((oldRot + renderedR) / 180) * Math.PI;
124
- let dist;
125
- switch (oldRot) {
126
- case Left:
127
- dist = distRight;
128
- break;
129
- case Right:
130
- dist = distLeft;
131
- break;
132
- case Back:
133
- dist = distFront;
134
- break;
135
- case Front:
136
- dist = distBack;
137
- break;
138
- default:
139
- break;
140
- }
141
- newX =
142
- renderedX +
143
- convert((oldVal - newVal) * Math.cos(rotRad))
144
- .from('in')
145
- .to('cm');
146
- newY =
147
- renderedY +
148
- convert((oldVal - newVal) * Math.sin(rotRad))
149
- .from('in')
150
- .to('cm');
151
- if (dist + (oldVal - newVal) <= 0 || newVal < 0) {
152
- setPopupOpen(true);
153
- return;
154
- }
155
- onUpdate('pos', { x: newX, y: newY });
156
- };
157
-
158
- let handleConfirmLoad = value => {
159
- setPopupOpen(value);
160
- };
161
-
162
- const EditorOptions = () => {
163
- return propertiesFormData.entrySeq().map(([propertyName, data]) => {
164
- if (catalog.categoryHasElement('Windows', element.type)) {
165
- if (['thickness', 'width', 'height'].includes(propertyName)) {
166
- return null;
167
- }
168
- }
169
- if (catalog.categoryHasElement('Doors', element.type)) {
170
- if (
171
- ['altitude', 'thickness', 'width', 'height'].includes(propertyName)
172
- ) {
173
- return null;
174
- }
175
- }
176
- if (filteredProperties) {
177
- if (filteredProperties.includes(propertyName)) return null;
178
- }
179
-
180
- let catalogElement = catalog.getElement(element.type);
181
- // if ((catalogElement.info.has_single_door === undefined || catalogElement.info.has_single_door == false) && propertyName == 'flip_doorhandle') {
182
- // return null;
183
- // }
184
-
185
- let currentValue = data.get('currentValue'),
186
- configs = data.get('configs');
187
- let { Editor } = catalog.getPropertyType(configs.type);
188
- return (
189
- configs.type === 'length-measure' && (
190
- <div style={{ position: 'relative' }} key={propertyName}>
191
- <Editor
192
- propertyName={propertyName}
193
- value={currentValue}
194
- configs={configs}
195
- onUpdate={value => onConfigUpdate(propertyName, value)}
196
- state={state}
197
- sourceElement={element}
198
- internalState={internalState}
199
- />
200
- <NumberInputMeasure>{unit}</NumberInputMeasure>
201
- </div>
202
- )
203
- );
204
- });
205
- };
206
-
207
- if (shouldOnlyShowEditorOptions) return EditorOptions();
208
-
209
- let unit = state.getIn([
210
- 'scene',
211
- 'layers',
212
- state.scene.selectedLayer,
213
- 'unit'
214
- ]);
215
-
216
- return (
217
- <div>
218
- <ConfirmPopup
219
- visible={isPopupOpen}
220
- handleConfirmLoad={handleConfirmLoad}
221
- ok={moveCabinet}
222
- />
223
- <NumberInputWrapper>
224
- <NumberInputTitle>Distance Left</NumberInputTitle>
225
- <FormNumberInput
226
- value={distLeft && convert(distLeft).from('in').to(unit)}
227
- disabled={distLeft ? false : true}
228
- onChange={event => changeDistance(distLeft, event.target.value, Left)}
229
- state={state}
230
- precision={2}
231
- style={{ paddingRight: '40px' }}
232
- {...rest}
233
- />
234
- <NumberInputMeasure>{unit}</NumberInputMeasure>
235
- </NumberInputWrapper>
236
- <NumberInputWrapper>
237
- <NumberInputTitle>Distance Right</NumberInputTitle>
238
- <FormNumberInput
239
- disabled={distRight ? false : true}
240
- value={distRight && convert(distRight).from('in').to(unit)}
241
- onChange={event =>
242
- changeDistance(distRight, event.target.value, Right)
243
- }
244
- state={state}
245
- style={{ paddingRight: '40px' }}
246
- precision={2}
247
- {...rest}
248
- />
249
- <NumberInputMeasure>{unit}</NumberInputMeasure>
250
- </NumberInputWrapper>
251
- <NumberInputWrapper>
252
- <NumberInputTitle>Distance Front</NumberInputTitle>
253
- <FormNumberInput
254
- disabled={distFront ? false : true}
255
- value={distFront && convert(distFront).from('in').to(unit)}
256
- onChange={event =>
257
- changeDistance(distFront, event.target.value, Front)
258
- }
259
- state={state}
260
- style={{ paddingRight: '40px' }}
261
- precision={2}
262
- {...rest}
263
- />
264
- <NumberInputMeasure>{unit}</NumberInputMeasure>
265
- </NumberInputWrapper>
266
- <NumberInputWrapper>
267
- <NumberInputTitle>Distance Back</NumberInputTitle>
268
- <FormNumberInput
269
- disabled={distBack ? false : true}
270
- value={distBack && convert(distBack).from('in').to(unit)}
271
- onChange={event => changeDistance(distBack, event.target.value, Back)}
272
- state={state}
273
- style={{ paddingRight: '40px' }}
274
- precision={2}
275
- {...rest}
276
- />
277
- <NumberInputMeasure>{unit}</NumberInputMeasure>
278
- </NumberInputWrapper>
279
- {EditorOptions()}
280
- <NumberInputWrapper>
281
- <NumberInputTitle>Rotation</NumberInputTitle>
282
- <FormNumberInput
283
- value={renderedR}
284
- onChange={event => onUpdate('rotation', event.target.value)}
285
- state={state}
286
- precision={2}
287
- {...rest}
288
- />
289
- <div
290
- style={{
291
- position: 'absolute',
292
- fontFamily: DEFAULT_FONT_FAMILY,
293
- fontSize: 19,
294
- right: 15,
295
- top: 15,
296
- border: `1px solid ${TEXT_COLOR_NEUTRAL_2}`,
297
- height: 5,
298
- width: 5,
299
- borderRadius: '50%'
300
- }}
301
- />
302
- </NumberInputWrapper>
303
- </div>
304
- );
305
- }
306
-
307
- ItemAttributesEditor.propTypes = {
308
- element: PropTypes.object.isRequired,
309
- onUpdate: PropTypes.func.isRequired,
310
- attributeFormData: PropTypes.object.isRequired,
311
- state: PropTypes.object.isRequired
312
- };
313
-
314
- ItemAttributesEditor.contextTypes = {
315
- translator: PropTypes.object.isRequired
316
- };
@@ -1,108 +0,0 @@
1
- import React, { Component } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { FormNumberInput, FormTextInput } from '../../../style/export';
4
- import { PropertyLengthMeasure } from '../../../../catalog/properties/export';
5
- import styled from 'styled-components';
6
- import {
7
- DEFAULT_FONT_FAMILY,
8
- TEXT_COLOR_NEUTRAL_2,
9
- TEXT_COLOR_NEUTRAL_0,
10
- TEXT_COLOR_NEUTRAL_3
11
- } from '../../../../constants';
12
-
13
- const NameInputWrapper = styled.div`
14
- display: flex;
15
- align-items: center;
16
- margin-top: 3px;
17
- `;
18
-
19
- const NameInputTitle = styled.span`
20
- font-family: ${DEFAULT_FONT_FAMILY};
21
- font-weight: 400;
22
- line-height: 22px;
23
- text-align: left;
24
- color: ${TEXT_COLOR_NEUTRAL_0};
25
- margin-right: auto;
26
- `;
27
-
28
- const NumberInputMeasure = styled.span`
29
- font-family: ${DEFAULT_FONT_FAMILY};
30
- font-size: 12px;
31
- font-weight: 600;
32
- line-height: 17px;
33
- color: ${TEXT_COLOR_NEUTRAL_3};
34
- position: absolute;
35
- right: 10px;
36
- bottom: 12px;
37
- `;
38
-
39
- const tableStyle = { width: '100%' };
40
- const firstTdStyle = { width: '6em' };
41
- const inputStyle = { textAlign: 'left' };
42
-
43
- export default function LineAttributesEditor(
44
- { element, onUpdate, attributeFormData, state, ...rest },
45
- { translator }
46
- ) {
47
- let name = attributeFormData.has('name')
48
- ? attributeFormData.get('name')
49
- : element.name;
50
- let vertexOne = attributeFormData.has('vertexOne')
51
- ? attributeFormData.get('vertexOne')
52
- : null;
53
- let vertexTwo = attributeFormData.has('vertexTwo')
54
- ? attributeFormData.get('vertexTwo')
55
- : null;
56
- let lineLength = attributeFormData.has('lineLength')
57
- ? attributeFormData.get('lineLength')
58
- : null;
59
- let focus = attributeFormData.has('focus')
60
- ? attributeFormData.get('focus')
61
- : false;
62
- let unit = state.getIn([
63
- 'scene',
64
- 'layers',
65
- state.scene.selectedLayer,
66
- 'unit'
67
- ]);
68
- return (
69
- <div>
70
- <NameInputWrapper>
71
- <NameInputTitle style={{ fontSize: 16 }}>
72
- {translator.t('Name')}
73
- </NameInputTitle>
74
- <FormTextInput
75
- value={name}
76
- onChange={event => onUpdate('name', event.target.value)}
77
- />
78
- </NameInputWrapper>
79
- <div style={{ position: 'relative' }}>
80
- <PropertyLengthMeasure
81
- value={lineLength}
82
- onUpdate={mapped => onUpdate('lineLength', mapped)}
83
- configs={{
84
- label: 'Length',
85
- min: 0,
86
- max: Infinity,
87
- precision: 2,
88
- focus: focus
89
- }}
90
- state={state}
91
- />
92
- <NumberInputMeasure>{unit}</NumberInputMeasure>
93
- </div>
94
- </div>
95
- );
96
- }
97
-
98
- LineAttributesEditor.propTypes = {
99
- element: PropTypes.object.isRequired,
100
- onUpdate: PropTypes.func.isRequired,
101
- onValid: PropTypes.func,
102
- attributeFormData: PropTypes.object.isRequired,
103
- state: PropTypes.object.isRequired
104
- };
105
-
106
- LineAttributesEditor.contextTypes = {
107
- translator: PropTypes.object.isRequired
108
- };