@pie-element/drawing-response 3.9.21 → 4.1.1
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.
- package/CHANGELOG.md +44 -0
- package/configure/CHANGELOG.md +43 -0
- package/configure/lib/defaults.js +8 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/image-container.js +1 -4
- package/configure/lib/image-container.js.map +1 -1
- package/configure/lib/root.js +13 -3
- package/configure/lib/root.js.map +1 -1
- package/configure/package.json +3 -3
- package/configure/src/__tests__/__snapshots__/root.test.jsx.snap +10 -0
- package/configure/src/defaults.js +8 -0
- package/configure/src/image-container.jsx +1 -5
- package/configure/src/root.jsx +9 -0
- package/docs/config-schema.json +63 -0
- package/docs/config-schema.json.md +49 -1
- package/docs/pie-schema.json +21 -0
- package/docs/pie-schema.json.md +16 -0
- package/lib/drawing-response/container.js +13 -8
- package/lib/drawing-response/container.js.map +1 -1
- package/lib/drawing-response/drawable-image.js +1 -1
- package/lib/drawing-response/drawable-image.js.map +1 -1
- package/lib/drawing-response/drawable-main.js +8 -2
- package/lib/drawing-response/drawable-main.js.map +1 -1
- package/package.json +4 -4
- package/src/drawing-response/__tests__/__snapshots__/container.test.jsx.snap +154 -158
- package/src/drawing-response/container.jsx +22 -20
- package/src/drawing-response/drawable-image.jsx +1 -1
- package/src/drawing-response/drawable-main.jsx +6 -2
|
@@ -132,85 +132,83 @@ exports[`Container snapshot renders 1`] = `
|
|
|
132
132
|
/>
|
|
133
133
|
<div>
|
|
134
134
|
<div>
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
/>
|
|
213
|
-
</div>
|
|
135
|
+
<WithStyles(RawButton)
|
|
136
|
+
disabled={true}
|
|
137
|
+
key="Select"
|
|
138
|
+
label={
|
|
139
|
+
<IconWrapper
|
|
140
|
+
path="mdiCursorDefault"
|
|
141
|
+
/>
|
|
142
|
+
}
|
|
143
|
+
onClick={[Function]}
|
|
144
|
+
title="Select"
|
|
145
|
+
/>
|
|
146
|
+
<WithStyles(RawButton)
|
|
147
|
+
disabled={false}
|
|
148
|
+
key="FreePathDrawable"
|
|
149
|
+
label={
|
|
150
|
+
<IconWrapper
|
|
151
|
+
path="mdiPencil"
|
|
152
|
+
/>
|
|
153
|
+
}
|
|
154
|
+
onClick={[Function]}
|
|
155
|
+
title="Free Draw"
|
|
156
|
+
/>
|
|
157
|
+
<WithStyles(RawButton)
|
|
158
|
+
disabled={false}
|
|
159
|
+
key="LineDrawable"
|
|
160
|
+
label={
|
|
161
|
+
<IconWrapper
|
|
162
|
+
path="mdiMinus"
|
|
163
|
+
/>
|
|
164
|
+
}
|
|
165
|
+
onClick={[Function]}
|
|
166
|
+
title="Line"
|
|
167
|
+
/>
|
|
168
|
+
<WithStyles(RawButton)
|
|
169
|
+
disabled={false}
|
|
170
|
+
key="RectangleDrawable"
|
|
171
|
+
label={
|
|
172
|
+
<IconWrapper
|
|
173
|
+
path="mdiRectangle"
|
|
174
|
+
/>
|
|
175
|
+
}
|
|
176
|
+
onClick={[Function]}
|
|
177
|
+
title="Rectangle"
|
|
178
|
+
/>
|
|
179
|
+
<WithStyles(RawButton)
|
|
180
|
+
disabled={false}
|
|
181
|
+
key="CircleDrawable"
|
|
182
|
+
label={
|
|
183
|
+
<IconWrapper
|
|
184
|
+
path="mdiCircle"
|
|
185
|
+
/>
|
|
186
|
+
}
|
|
187
|
+
onClick={[Function]}
|
|
188
|
+
title="Circle"
|
|
189
|
+
/>
|
|
190
|
+
<WithStyles(RawButton)
|
|
191
|
+
disabled={false}
|
|
192
|
+
key="Text"
|
|
193
|
+
label={
|
|
194
|
+
<IconWrapper
|
|
195
|
+
path="mdiFormatColorText"
|
|
196
|
+
/>
|
|
197
|
+
}
|
|
198
|
+
onClick={[Function]}
|
|
199
|
+
title="Text Entry"
|
|
200
|
+
/>
|
|
201
|
+
<WithStyles(RawButton)
|
|
202
|
+
disabled={false}
|
|
203
|
+
key="EraserDrawable"
|
|
204
|
+
label={
|
|
205
|
+
<IconWrapper
|
|
206
|
+
path="mdiEraser"
|
|
207
|
+
/>
|
|
208
|
+
}
|
|
209
|
+
onClick={[Function]}
|
|
210
|
+
title="Eraser"
|
|
211
|
+
/>
|
|
214
212
|
</div>
|
|
215
213
|
<div
|
|
216
214
|
style={
|
|
@@ -266,85 +264,83 @@ exports[`Container snapshot renders disabled 1`] = `
|
|
|
266
264
|
<div>
|
|
267
265
|
<div>
|
|
268
266
|
<div>
|
|
269
|
-
<
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
/>
|
|
347
|
-
</div>
|
|
267
|
+
<WithStyles(RawButton)
|
|
268
|
+
disabled={true}
|
|
269
|
+
key="Select"
|
|
270
|
+
label={
|
|
271
|
+
<IconWrapper
|
|
272
|
+
path="mdiCursorDefault"
|
|
273
|
+
/>
|
|
274
|
+
}
|
|
275
|
+
onClick={[Function]}
|
|
276
|
+
title="Select"
|
|
277
|
+
/>
|
|
278
|
+
<WithStyles(RawButton)
|
|
279
|
+
disabled={true}
|
|
280
|
+
key="FreePathDrawable"
|
|
281
|
+
label={
|
|
282
|
+
<IconWrapper
|
|
283
|
+
path="mdiPencil"
|
|
284
|
+
/>
|
|
285
|
+
}
|
|
286
|
+
onClick={[Function]}
|
|
287
|
+
title="Free Draw"
|
|
288
|
+
/>
|
|
289
|
+
<WithStyles(RawButton)
|
|
290
|
+
disabled={true}
|
|
291
|
+
key="LineDrawable"
|
|
292
|
+
label={
|
|
293
|
+
<IconWrapper
|
|
294
|
+
path="mdiMinus"
|
|
295
|
+
/>
|
|
296
|
+
}
|
|
297
|
+
onClick={[Function]}
|
|
298
|
+
title="Line"
|
|
299
|
+
/>
|
|
300
|
+
<WithStyles(RawButton)
|
|
301
|
+
disabled={true}
|
|
302
|
+
key="RectangleDrawable"
|
|
303
|
+
label={
|
|
304
|
+
<IconWrapper
|
|
305
|
+
path="mdiRectangle"
|
|
306
|
+
/>
|
|
307
|
+
}
|
|
308
|
+
onClick={[Function]}
|
|
309
|
+
title="Rectangle"
|
|
310
|
+
/>
|
|
311
|
+
<WithStyles(RawButton)
|
|
312
|
+
disabled={true}
|
|
313
|
+
key="CircleDrawable"
|
|
314
|
+
label={
|
|
315
|
+
<IconWrapper
|
|
316
|
+
path="mdiCircle"
|
|
317
|
+
/>
|
|
318
|
+
}
|
|
319
|
+
onClick={[Function]}
|
|
320
|
+
title="Circle"
|
|
321
|
+
/>
|
|
322
|
+
<WithStyles(RawButton)
|
|
323
|
+
disabled={true}
|
|
324
|
+
key="Text"
|
|
325
|
+
label={
|
|
326
|
+
<IconWrapper
|
|
327
|
+
path="mdiFormatColorText"
|
|
328
|
+
/>
|
|
329
|
+
}
|
|
330
|
+
onClick={[Function]}
|
|
331
|
+
title="Text Entry"
|
|
332
|
+
/>
|
|
333
|
+
<WithStyles(RawButton)
|
|
334
|
+
disabled={true}
|
|
335
|
+
key="EraserDrawable"
|
|
336
|
+
label={
|
|
337
|
+
<IconWrapper
|
|
338
|
+
path="mdiEraser"
|
|
339
|
+
/>
|
|
340
|
+
}
|
|
341
|
+
onClick={[Function]}
|
|
342
|
+
title="Eraser"
|
|
343
|
+
/>
|
|
348
344
|
</div>
|
|
349
345
|
<div
|
|
350
346
|
style={
|
|
@@ -200,21 +200,19 @@ export class Container extends Component {
|
|
|
200
200
|
|
|
201
201
|
<div className={classes.box}>
|
|
202
202
|
<div className={classes.toolbar}>
|
|
203
|
-
|
|
204
|
-
{
|
|
205
|
-
const { type, label, icon } = tool;
|
|
203
|
+
{TOOLS.map(tool => {
|
|
204
|
+
const { type, label, icon } = tool;
|
|
206
205
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
</div>
|
|
206
|
+
return (
|
|
207
|
+
<Button
|
|
208
|
+
title={label}
|
|
209
|
+
key={type}
|
|
210
|
+
disabled={this.checkIfToolIsDisabled(type)}
|
|
211
|
+
onClick={() => this.handleMakeToolActive(tool)}
|
|
212
|
+
label={<Icon path={icon} />}
|
|
213
|
+
/>
|
|
214
|
+
);
|
|
215
|
+
})}
|
|
218
216
|
</div>
|
|
219
217
|
|
|
220
218
|
<div
|
|
@@ -253,19 +251,23 @@ const styles = theme => ({
|
|
|
253
251
|
box: {
|
|
254
252
|
border: '1px solid #E0E1E6',
|
|
255
253
|
borderRadius: '5px',
|
|
256
|
-
marginTop: theme.spacing.unit * 2
|
|
254
|
+
marginTop: theme.spacing.unit * 2,
|
|
255
|
+
backgroundColor: '#ECEDF1'
|
|
257
256
|
},
|
|
258
257
|
drawableHeight: {
|
|
259
|
-
minHeight: 350
|
|
258
|
+
minHeight: 350,
|
|
259
|
+
backgroundColor: '#fff'
|
|
260
260
|
},
|
|
261
261
|
toolbar: {
|
|
262
|
-
backgroundColor: '#ECEDF1',
|
|
263
262
|
borderBottom: '1px solid #E0E1E6',
|
|
264
263
|
borderTopLeftRadius: '5px',
|
|
265
264
|
borderTopRightRadius: '5px',
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
padding: '12px 8px 4px',
|
|
266
|
+
boxSizing: 'border-box',
|
|
267
|
+
maxWidth: 'calc(100% - 163px)', // 163px is the width set on undoControls
|
|
268
|
+
'& button': {
|
|
269
|
+
marginBottom: '8px'
|
|
270
|
+
}
|
|
269
271
|
}
|
|
270
272
|
});
|
|
271
273
|
|
|
@@ -240,7 +240,7 @@ export class DrawableMain extends React.Component {
|
|
|
240
240
|
const imageWidth = imageDimensions?.width * scale;
|
|
241
241
|
|
|
242
242
|
return (
|
|
243
|
-
<div>
|
|
243
|
+
<div className={classes.wrapper}>
|
|
244
244
|
<div className={classes.undoControls}>
|
|
245
245
|
<Button disabled={disabled} onClick={this.handleUndo} label="Undo"/>
|
|
246
246
|
<Button disabled={disabled} onClick={this.handleClearAll} label="Clear all"/>
|
|
@@ -288,6 +288,11 @@ export class DrawableMain extends React.Component {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
const styles = () => ({
|
|
291
|
+
wrapper: {
|
|
292
|
+
display: 'flex',
|
|
293
|
+
flexWrap: 'wrap',
|
|
294
|
+
justifyContent: 'flex-end'
|
|
295
|
+
},
|
|
291
296
|
base: {
|
|
292
297
|
position: 'relative',
|
|
293
298
|
width: '100%'
|
|
@@ -301,7 +306,6 @@ const styles = () => ({
|
|
|
301
306
|
cursor: 'pointer'
|
|
302
307
|
},
|
|
303
308
|
undoControls: {
|
|
304
|
-
float: 'right',
|
|
305
309
|
marginTop: -43,
|
|
306
310
|
width: 163
|
|
307
311
|
}
|