@developer_tribe/react-builder 1.0.5 → 1.0.7
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/dist/build-components/index.d.ts +1 -2
- package/dist/build-components/patterns.generated.d.ts +0 -383
- package/dist/components/BottomBar.d.ts +12 -0
- package/dist/components/LoadingComponent.d.ts +1 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.cjs.js +1 -1
- package/dist/index.native.cjs.js.map +1 -1
- package/dist/index.native.esm.js +4 -4
- package/dist/index.native.esm.js.map +1 -1
- package/dist/modals/ScreenColorsModal.d.ts +8 -0
- package/dist/modals/index.d.ts +1 -0
- package/dist/pages/ProjectPage.d.ts +3 -2
- package/dist/styles.css +1 -1
- package/dist/utils/nodeTree.d.ts +5 -0
- package/package.json +5 -2
- package/src/build-components/RenderNode.generated.tsx +0 -7
- package/src/build-components/index.ts +0 -5
- package/src/build-components/patterns.generated.ts +0 -399
- package/src/components/BottomBar.tsx +242 -0
- package/src/components/LoadingComponent.tsx +10 -0
- package/src/index.ts +2 -1
- package/src/modals/ScreenColorsModal.tsx +121 -0
- package/src/modals/index.ts +1 -0
- package/src/pages/ProjectPage.tsx +72 -163
- package/src/styles/base/_global.scss +25 -20
- package/src/styles/components/_attributes-editor.scss +26 -24
- package/src/styles/components/_bottom-bar.scss +101 -0
- package/src/styles/components/_editor-shell.scss +19 -18
- package/src/styles/components/_mockos-router.scss +16 -14
- package/src/styles/components/_ui-components.scss +14 -15
- package/src/styles/foundation/_colors.scss +28 -8
- package/src/styles/foundation/_mixins.scss +1 -1
- package/src/styles/foundation/_sizes.scss +4 -2
- package/src/styles/index.scss +1 -0
- package/src/styles/layout/_builder.scss +1 -1
- package/src/styles/modals/_add-component.scss +2 -2
- package/src/styles/modals/_color-modal.scss +2 -2
- package/src/styles/modals/_modal-shell.scss +1 -1
- package/src/utils/nodeTree.ts +99 -0
- package/dist/build-components/PaywallSubscriButton/PaywallSubscriButton.d.ts +0 -5
- package/dist/build-components/PaywallSubscriButton/PaywallSubscriButtonProps.generated.d.ts +0 -50
- package/src/build-components/PaywallSubscriButton/PaywallSubscriButton.tsx +0 -10
- package/src/build-components/PaywallSubscriButton/PaywallSubscriButtonProps.generated.ts +0 -77
- package/src/build-components/PaywallSubscriButton/pattern.json +0 -27
|
@@ -9130,405 +9130,6 @@ export const patterns = [
|
|
|
9130
9130
|
},
|
|
9131
9131
|
types: {},
|
|
9132
9132
|
},
|
|
9133
|
-
{
|
|
9134
|
-
schemaVersion: 1,
|
|
9135
|
-
allowUnknownAttributes: false,
|
|
9136
|
-
pattern: {
|
|
9137
|
-
type: 'PaywallSubscriButton',
|
|
9138
|
-
children: 'string',
|
|
9139
|
-
attributes: {
|
|
9140
|
-
color: 'color',
|
|
9141
|
-
fontSize: 'size',
|
|
9142
|
-
fontWeight: [
|
|
9143
|
-
'normal',
|
|
9144
|
-
'bold',
|
|
9145
|
-
'100',
|
|
9146
|
-
'200',
|
|
9147
|
-
'300',
|
|
9148
|
-
'400',
|
|
9149
|
-
'500',
|
|
9150
|
-
'600',
|
|
9151
|
-
'700',
|
|
9152
|
-
'800',
|
|
9153
|
-
'900',
|
|
9154
|
-
],
|
|
9155
|
-
scrollable: 'boolean',
|
|
9156
|
-
flexDirection: ['row', 'column'],
|
|
9157
|
-
alignItems: ['flex-start', 'center', 'flex-end', 'stretch', 'baseline'],
|
|
9158
|
-
justifyContent: [
|
|
9159
|
-
'flex-start',
|
|
9160
|
-
'center',
|
|
9161
|
-
'flex-end',
|
|
9162
|
-
'space-between',
|
|
9163
|
-
'space-around',
|
|
9164
|
-
'space-evenly',
|
|
9165
|
-
],
|
|
9166
|
-
gap: 'size',
|
|
9167
|
-
padding: 'size',
|
|
9168
|
-
paddingHorizontal: 'size',
|
|
9169
|
-
paddingVertical: 'size',
|
|
9170
|
-
paddingTop: 'size',
|
|
9171
|
-
paddingBottom: 'size',
|
|
9172
|
-
paddingLeft: 'size',
|
|
9173
|
-
paddingRight: 'size',
|
|
9174
|
-
margin: 'size',
|
|
9175
|
-
marginVertical: 'size',
|
|
9176
|
-
marginTop: 'size',
|
|
9177
|
-
marginBottom: 'size',
|
|
9178
|
-
marginLeft: 'size',
|
|
9179
|
-
marginRight: 'size',
|
|
9180
|
-
backgroundColor: 'color',
|
|
9181
|
-
borderRadius: 'size',
|
|
9182
|
-
width: 'size',
|
|
9183
|
-
minWidth: 'size',
|
|
9184
|
-
maxWidth: 'size',
|
|
9185
|
-
height: 'size',
|
|
9186
|
-
minHeight: 'size',
|
|
9187
|
-
maxHeight: 'size',
|
|
9188
|
-
flex: 'number',
|
|
9189
|
-
position: ['relative', 'absolute'],
|
|
9190
|
-
top: 'size',
|
|
9191
|
-
bottom: 'size',
|
|
9192
|
-
left: 'size',
|
|
9193
|
-
right: 'size',
|
|
9194
|
-
zIndex: 'number',
|
|
9195
|
-
},
|
|
9196
|
-
defaults: { flexDirection: 'column', position: 'relative', zIndex: 1 },
|
|
9197
|
-
},
|
|
9198
|
-
meta: {
|
|
9199
|
-
desiredParent: ['>PaywallProvider'],
|
|
9200
|
-
label: 'Paywall Subscribe Button',
|
|
9201
|
-
description: 'Paywall subscribe call-to-action button. Extends Button.',
|
|
9202
|
-
attributes: {
|
|
9203
|
-
color: {
|
|
9204
|
-
label: 'Color',
|
|
9205
|
-
description: 'Text color of the button.',
|
|
9206
|
-
category: 'style',
|
|
9207
|
-
specialCategory: null,
|
|
9208
|
-
sort: 1,
|
|
9209
|
-
},
|
|
9210
|
-
fontSize: {
|
|
9211
|
-
label: 'Font Size',
|
|
9212
|
-
description: 'Text size of the button.',
|
|
9213
|
-
category: 'style',
|
|
9214
|
-
specialCategory: null,
|
|
9215
|
-
sort: 2,
|
|
9216
|
-
},
|
|
9217
|
-
fontWeight: {
|
|
9218
|
-
label: 'Font Weight',
|
|
9219
|
-
description: 'Text weight of the button.',
|
|
9220
|
-
category: 'style',
|
|
9221
|
-
specialCategory: null,
|
|
9222
|
-
sort: 3,
|
|
9223
|
-
},
|
|
9224
|
-
scrollable: {
|
|
9225
|
-
label: 'Scrollable',
|
|
9226
|
-
description: 'Turns scroll interaction on.',
|
|
9227
|
-
category: 'container',
|
|
9228
|
-
specialCategory: null,
|
|
9229
|
-
sort: -1,
|
|
9230
|
-
},
|
|
9231
|
-
flexDirection: {
|
|
9232
|
-
label: 'Flex Direction',
|
|
9233
|
-
description: 'Sets row or column layout.',
|
|
9234
|
-
category: 'container',
|
|
9235
|
-
specialCategory: null,
|
|
9236
|
-
sort: 4,
|
|
9237
|
-
},
|
|
9238
|
-
alignItems: {
|
|
9239
|
-
label: 'Align Items',
|
|
9240
|
-
description: 'Controls cross-axis alignment.',
|
|
9241
|
-
category: 'container',
|
|
9242
|
-
specialCategory: null,
|
|
9243
|
-
sort: 3,
|
|
9244
|
-
},
|
|
9245
|
-
justifyContent: {
|
|
9246
|
-
label: 'Justify Content',
|
|
9247
|
-
description: 'Controls main-axis alignment.',
|
|
9248
|
-
category: 'container',
|
|
9249
|
-
specialCategory: null,
|
|
9250
|
-
sort: 5,
|
|
9251
|
-
},
|
|
9252
|
-
gap: {
|
|
9253
|
-
label: 'Gap',
|
|
9254
|
-
description: 'Space between children.',
|
|
9255
|
-
category: 'container',
|
|
9256
|
-
specialCategory: null,
|
|
9257
|
-
sort: 10,
|
|
9258
|
-
preferedScale: 's',
|
|
9259
|
-
},
|
|
9260
|
-
padding: {
|
|
9261
|
-
label: 'Padding',
|
|
9262
|
-
description: 'Uniform padding on all sides.',
|
|
9263
|
-
category: 'container',
|
|
9264
|
-
specialCategory: 'padding',
|
|
9265
|
-
sort: 6,
|
|
9266
|
-
preferedScale: 's',
|
|
9267
|
-
},
|
|
9268
|
-
paddingHorizontal: {
|
|
9269
|
-
label: 'Padding Horizontal',
|
|
9270
|
-
description: 'Left and right padding.',
|
|
9271
|
-
category: 'container',
|
|
9272
|
-
specialCategory: 'padding',
|
|
9273
|
-
sort: 7,
|
|
9274
|
-
preferedScale: 's',
|
|
9275
|
-
},
|
|
9276
|
-
paddingVertical: {
|
|
9277
|
-
label: 'Padding Vertical',
|
|
9278
|
-
description: 'Top and bottom padding.',
|
|
9279
|
-
category: 'container',
|
|
9280
|
-
specialCategory: 'padding',
|
|
9281
|
-
sort: 8,
|
|
9282
|
-
preferedScale: 'vs',
|
|
9283
|
-
},
|
|
9284
|
-
paddingTop: {
|
|
9285
|
-
label: 'Padding Top',
|
|
9286
|
-
description: 'Top padding only.',
|
|
9287
|
-
category: 'container',
|
|
9288
|
-
specialCategory: 'padding',
|
|
9289
|
-
sort: 9,
|
|
9290
|
-
preferedScale: 'vs',
|
|
9291
|
-
},
|
|
9292
|
-
paddingBottom: {
|
|
9293
|
-
label: 'Padding Bottom',
|
|
9294
|
-
description: 'Bottom padding only.',
|
|
9295
|
-
category: 'container',
|
|
9296
|
-
specialCategory: 'padding',
|
|
9297
|
-
sort: 10,
|
|
9298
|
-
preferedScale: 'vs',
|
|
9299
|
-
},
|
|
9300
|
-
paddingLeft: {
|
|
9301
|
-
label: 'Padding Left',
|
|
9302
|
-
description: 'Left padding only.',
|
|
9303
|
-
category: 'container',
|
|
9304
|
-
specialCategory: 'padding',
|
|
9305
|
-
sort: 11,
|
|
9306
|
-
preferedScale: 's',
|
|
9307
|
-
},
|
|
9308
|
-
paddingRight: {
|
|
9309
|
-
label: 'Padding Right',
|
|
9310
|
-
description: 'Right padding only.',
|
|
9311
|
-
category: 'container',
|
|
9312
|
-
specialCategory: 'padding',
|
|
9313
|
-
sort: 12,
|
|
9314
|
-
preferedScale: 's',
|
|
9315
|
-
},
|
|
9316
|
-
margin: {
|
|
9317
|
-
label: 'Margin',
|
|
9318
|
-
description: 'Uniform margin on all sides.',
|
|
9319
|
-
category: 'container',
|
|
9320
|
-
specialCategory: 'margin',
|
|
9321
|
-
sort: 13,
|
|
9322
|
-
preferedScale: 's',
|
|
9323
|
-
},
|
|
9324
|
-
marginHorizontal: {
|
|
9325
|
-
label: 'Margin Horizontal',
|
|
9326
|
-
description: 'Left and right margin.',
|
|
9327
|
-
category: 'container',
|
|
9328
|
-
specialCategory: 'margin',
|
|
9329
|
-
sort: 14,
|
|
9330
|
-
preferedScale: 's',
|
|
9331
|
-
},
|
|
9332
|
-
marginVertical: {
|
|
9333
|
-
label: 'Margin Vertical',
|
|
9334
|
-
description: 'Top and bottom margin.',
|
|
9335
|
-
category: 'container',
|
|
9336
|
-
specialCategory: 'margin',
|
|
9337
|
-
sort: 15,
|
|
9338
|
-
preferedScale: 'vs',
|
|
9339
|
-
},
|
|
9340
|
-
marginTop: {
|
|
9341
|
-
label: 'Margin Top',
|
|
9342
|
-
description: 'Top margin only.',
|
|
9343
|
-
category: 'container',
|
|
9344
|
-
specialCategory: 'margin',
|
|
9345
|
-
sort: 16,
|
|
9346
|
-
preferedScale: 'vs',
|
|
9347
|
-
},
|
|
9348
|
-
marginBottom: {
|
|
9349
|
-
label: 'Margin Bottom',
|
|
9350
|
-
description: 'Bottom margin only.',
|
|
9351
|
-
category: 'container',
|
|
9352
|
-
specialCategory: 'margin',
|
|
9353
|
-
sort: 17,
|
|
9354
|
-
preferedScale: 'vs',
|
|
9355
|
-
},
|
|
9356
|
-
marginLeft: {
|
|
9357
|
-
label: 'Margin Left',
|
|
9358
|
-
description: 'Left margin only.',
|
|
9359
|
-
category: 'container',
|
|
9360
|
-
specialCategory: 'margin',
|
|
9361
|
-
sort: 18,
|
|
9362
|
-
preferedScale: 's',
|
|
9363
|
-
},
|
|
9364
|
-
marginRight: {
|
|
9365
|
-
label: 'Margin Right',
|
|
9366
|
-
description: 'Right margin only.',
|
|
9367
|
-
category: 'container',
|
|
9368
|
-
specialCategory: 'margin',
|
|
9369
|
-
sort: 19,
|
|
9370
|
-
preferedScale: 's',
|
|
9371
|
-
},
|
|
9372
|
-
backgroundColor: {
|
|
9373
|
-
label: 'Background Color',
|
|
9374
|
-
description: 'Background fill color.',
|
|
9375
|
-
category: 'style',
|
|
9376
|
-
specialCategory: null,
|
|
9377
|
-
sort: 20,
|
|
9378
|
-
},
|
|
9379
|
-
borderRadius: {
|
|
9380
|
-
label: 'Border Radius',
|
|
9381
|
-
description: 'Corner rounding amount.',
|
|
9382
|
-
category: 'style',
|
|
9383
|
-
specialCategory: null,
|
|
9384
|
-
sort: 21,
|
|
9385
|
-
preferedScale: 's',
|
|
9386
|
-
},
|
|
9387
|
-
width: {
|
|
9388
|
-
label: 'Width',
|
|
9389
|
-
description: 'Fixed width value.',
|
|
9390
|
-
category: 'container',
|
|
9391
|
-
specialCategory: 'size',
|
|
9392
|
-
sort: 0,
|
|
9393
|
-
preferedScale: 's',
|
|
9394
|
-
},
|
|
9395
|
-
minWidth: {
|
|
9396
|
-
label: 'Min Width',
|
|
9397
|
-
description: 'Minimum width constraint.',
|
|
9398
|
-
category: 'container',
|
|
9399
|
-
specialCategory: 'size',
|
|
9400
|
-
sort: 1,
|
|
9401
|
-
preferedScale: 's',
|
|
9402
|
-
},
|
|
9403
|
-
maxWidth: {
|
|
9404
|
-
label: 'Max Width',
|
|
9405
|
-
description: 'Maximum width constraint.',
|
|
9406
|
-
category: 'container',
|
|
9407
|
-
specialCategory: 'size',
|
|
9408
|
-
sort: 2,
|
|
9409
|
-
preferedScale: 's',
|
|
9410
|
-
},
|
|
9411
|
-
height: {
|
|
9412
|
-
label: 'Height',
|
|
9413
|
-
description: 'Fixed height value.',
|
|
9414
|
-
category: 'container',
|
|
9415
|
-
specialCategory: 'size',
|
|
9416
|
-
sort: 3,
|
|
9417
|
-
preferedScale: 'vs',
|
|
9418
|
-
},
|
|
9419
|
-
minHeight: {
|
|
9420
|
-
label: 'Min Height',
|
|
9421
|
-
description: 'Minimum height constraint.',
|
|
9422
|
-
category: 'container',
|
|
9423
|
-
specialCategory: 'size',
|
|
9424
|
-
sort: 4,
|
|
9425
|
-
preferedScale: 'vs',
|
|
9426
|
-
},
|
|
9427
|
-
maxHeight: {
|
|
9428
|
-
label: 'Max Height',
|
|
9429
|
-
description: 'Maximum height constraint.',
|
|
9430
|
-
category: 'container',
|
|
9431
|
-
specialCategory: 'size',
|
|
9432
|
-
sort: 5,
|
|
9433
|
-
preferedScale: 'vs',
|
|
9434
|
-
},
|
|
9435
|
-
flex: {
|
|
9436
|
-
label: 'Flex',
|
|
9437
|
-
description: 'Flex grow factor (e.g. 1 fills available space).',
|
|
9438
|
-
category: 'container',
|
|
9439
|
-
specialCategory: 'size',
|
|
9440
|
-
sort: 6,
|
|
9441
|
-
},
|
|
9442
|
-
position: {
|
|
9443
|
-
label: 'Position',
|
|
9444
|
-
description: 'Sets layout positioning mode.',
|
|
9445
|
-
category: 'container',
|
|
9446
|
-
specialCategory: null,
|
|
9447
|
-
sort: 3,
|
|
9448
|
-
},
|
|
9449
|
-
top: {
|
|
9450
|
-
label: 'Top',
|
|
9451
|
-
description: 'Offset from the top edge.',
|
|
9452
|
-
category: 'container',
|
|
9453
|
-
specialCategory: 'offset',
|
|
9454
|
-
sort: 22,
|
|
9455
|
-
preferedScale: 'vs',
|
|
9456
|
-
},
|
|
9457
|
-
bottom: {
|
|
9458
|
-
label: 'Bottom',
|
|
9459
|
-
description: 'Offset from the bottom edge.',
|
|
9460
|
-
category: 'container',
|
|
9461
|
-
specialCategory: 'offset',
|
|
9462
|
-
sort: 23,
|
|
9463
|
-
preferedScale: 'vs',
|
|
9464
|
-
},
|
|
9465
|
-
left: {
|
|
9466
|
-
label: 'Left',
|
|
9467
|
-
description: 'Offset from the left edge.',
|
|
9468
|
-
category: 'container',
|
|
9469
|
-
specialCategory: 'offset',
|
|
9470
|
-
sort: 24,
|
|
9471
|
-
preferedScale: 's',
|
|
9472
|
-
},
|
|
9473
|
-
right: {
|
|
9474
|
-
label: 'Right',
|
|
9475
|
-
description: 'Offset from the right edge.',
|
|
9476
|
-
category: 'container',
|
|
9477
|
-
specialCategory: 'offset',
|
|
9478
|
-
sort: 25,
|
|
9479
|
-
preferedScale: 's',
|
|
9480
|
-
},
|
|
9481
|
-
zIndex: {
|
|
9482
|
-
label: 'Z-Index',
|
|
9483
|
-
description: 'Controls stacking order.',
|
|
9484
|
-
category: 'container',
|
|
9485
|
-
specialCategory: null,
|
|
9486
|
-
sort: 26,
|
|
9487
|
-
},
|
|
9488
|
-
},
|
|
9489
|
-
specialCategories: {
|
|
9490
|
-
padding: {
|
|
9491
|
-
label: 'Padding',
|
|
9492
|
-
description: 'Uniform padding on all sides.',
|
|
9493
|
-
category: 'container',
|
|
9494
|
-
sort: 1,
|
|
9495
|
-
},
|
|
9496
|
-
margin: {
|
|
9497
|
-
label: 'Margin',
|
|
9498
|
-
description: 'Uniform margin on all sides.',
|
|
9499
|
-
category: 'container',
|
|
9500
|
-
sort: 2,
|
|
9501
|
-
},
|
|
9502
|
-
size: {
|
|
9503
|
-
label: 'Size',
|
|
9504
|
-
description: 'Fixed dimensions.',
|
|
9505
|
-
category: 'container',
|
|
9506
|
-
sort: 3,
|
|
9507
|
-
},
|
|
9508
|
-
offset: {
|
|
9509
|
-
label: 'Offset',
|
|
9510
|
-
description: 'Absolute positioning offsets.',
|
|
9511
|
-
category: 'container',
|
|
9512
|
-
sort: 4,
|
|
9513
|
-
},
|
|
9514
|
-
},
|
|
9515
|
-
},
|
|
9516
|
-
defaults: {
|
|
9517
|
-
flexDirection: 'column',
|
|
9518
|
-
position: 'relative',
|
|
9519
|
-
zIndex: 1,
|
|
9520
|
-
backgroundColor: '#1C1C1E',
|
|
9521
|
-
paddingHorizontal: '20@s',
|
|
9522
|
-
paddingVertical: '12@vs',
|
|
9523
|
-
borderRadius: '12@s',
|
|
9524
|
-
color: 'cornflowerblue',
|
|
9525
|
-
fontSize: '16@fs',
|
|
9526
|
-
fontWeight: '700',
|
|
9527
|
-
justifyContent: 'center',
|
|
9528
|
-
alignItems: 'center',
|
|
9529
|
-
},
|
|
9530
|
-
types: {},
|
|
9531
|
-
},
|
|
9532
9133
|
{
|
|
9533
9134
|
schemaVersion: 1,
|
|
9534
9135
|
allowUnknownAttributes: false,
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { Icon } from './Icon.generated';
|
|
3
|
+
import type { IconsType } from '../types/Icons';
|
|
4
|
+
import { useRenderStore } from '../store';
|
|
5
|
+
import { Checkbox } from './Checkbox';
|
|
6
|
+
import type { Localication } from '../types/PreviewConfig';
|
|
7
|
+
import { LocalicationModal, Modal, ScreenColorsModal } from '../modals';
|
|
8
|
+
import { JsonTextEditor } from './JsonTextEditor';
|
|
9
|
+
import type { Node } from '../types/Node';
|
|
10
|
+
import { analyseAndProccess } from '../utils/analyseNode';
|
|
11
|
+
|
|
12
|
+
type BottomBarProps = {
|
|
13
|
+
className?: string;
|
|
14
|
+
data: Node;
|
|
15
|
+
setData: React.Dispatch<React.SetStateAction<Node>>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Bottom tool bar (Figma-like).
|
|
20
|
+
*/
|
|
21
|
+
export function BottomBar({ className, data, setData }: BottomBarProps) {
|
|
22
|
+
const rtlIcon: IconsType = 'translate';
|
|
23
|
+
const magicCursorIcon: IconsType = 'magicpen';
|
|
24
|
+
const debugIcon: IconsType = 'speedometer-03';
|
|
25
|
+
const localizationIcon: IconsType = 'globe-01';
|
|
26
|
+
const colorIcon: IconsType = 'colors';
|
|
27
|
+
|
|
28
|
+
const { appConfig, setAppConfig, previewMode, setPreviewMode } =
|
|
29
|
+
useRenderStore(s => ({
|
|
30
|
+
appConfig: s.appConfig,
|
|
31
|
+
setAppConfig: s.setAppConfig,
|
|
32
|
+
previewMode: s.previewMode,
|
|
33
|
+
setPreviewMode: s.setPreviewMode,
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
const [isDebugOpen, setIsDebugOpen] = useState(false);
|
|
37
|
+
const [isLocalizationOpen, setIsLocalizationOpen] = useState(false);
|
|
38
|
+
const [isColorsOpen, setIsColorsOpen] = useState(false);
|
|
39
|
+
|
|
40
|
+
const languages = useMemo(() => ['en', 'tr', 'ar'], []);
|
|
41
|
+
const activeLanguage = appConfig.defaultLanguage ?? 'en';
|
|
42
|
+
|
|
43
|
+
const handleLocalicationChange = (next: Localication) => {
|
|
44
|
+
setAppConfig({ ...appConfig, localication: next });
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const themeIsActive = appConfig.theme === 'dark';
|
|
48
|
+
const rtlIsActive = appConfig.isRtl ?? false;
|
|
49
|
+
const previewIsActive = previewMode;
|
|
50
|
+
const themeIcon: IconsType = themeIsActive ? 'moon-bold' : 'sun';
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
<div className={['rb-bottom-bar', className].filter(Boolean).join(' ')}>
|
|
55
|
+
<button
|
|
56
|
+
type='button'
|
|
57
|
+
className={`rb-bottom-bar__button${themeIsActive ? ' is-active' : ''}`}
|
|
58
|
+
aria-label='Theme'
|
|
59
|
+
aria-pressed={themeIsActive}
|
|
60
|
+
onClick={() =>
|
|
61
|
+
setAppConfig({
|
|
62
|
+
...appConfig,
|
|
63
|
+
theme: appConfig.theme === 'dark' ? 'light' : 'dark',
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
<Icon iconType={themeIcon} size={20} color='currentColor' alt='' />
|
|
68
|
+
</button>
|
|
69
|
+
|
|
70
|
+
<button
|
|
71
|
+
type='button'
|
|
72
|
+
className={`rb-bottom-bar__button rb-bottom-bar__button--rtl${
|
|
73
|
+
rtlIsActive ? ' is-active' : ''
|
|
74
|
+
}`}
|
|
75
|
+
aria-label='RTL'
|
|
76
|
+
aria-pressed={rtlIsActive}
|
|
77
|
+
onClick={() =>
|
|
78
|
+
setAppConfig({ ...appConfig, isRtl: !(appConfig.isRtl ?? false) })
|
|
79
|
+
}
|
|
80
|
+
>
|
|
81
|
+
<Icon iconType={rtlIcon} size={18} color='currentColor' alt='' />
|
|
82
|
+
<span className='rb-bottom-bar__rtl-text'>RTL</span>
|
|
83
|
+
</button>
|
|
84
|
+
|
|
85
|
+
<button
|
|
86
|
+
type='button'
|
|
87
|
+
className={`rb-bottom-bar__button rb-bottom-bar__button--preview${
|
|
88
|
+
previewIsActive ? ' is-active' : ''
|
|
89
|
+
}`}
|
|
90
|
+
aria-label='Magic cursor tool'
|
|
91
|
+
aria-pressed={previewIsActive}
|
|
92
|
+
onClick={() => setPreviewMode(!previewMode)}
|
|
93
|
+
>
|
|
94
|
+
<Icon
|
|
95
|
+
iconType={magicCursorIcon}
|
|
96
|
+
size={20}
|
|
97
|
+
color='currentColor'
|
|
98
|
+
alt=''
|
|
99
|
+
/>
|
|
100
|
+
</button>
|
|
101
|
+
|
|
102
|
+
<button
|
|
103
|
+
type='button'
|
|
104
|
+
className={`rb-bottom-bar__button${isDebugOpen ? ' is-active' : ''}`}
|
|
105
|
+
aria-label='Debug'
|
|
106
|
+
aria-pressed={isDebugOpen}
|
|
107
|
+
onClick={() => setIsDebugOpen(true)}
|
|
108
|
+
>
|
|
109
|
+
<Icon iconType={debugIcon} size={20} color='currentColor' alt='' />
|
|
110
|
+
</button>
|
|
111
|
+
|
|
112
|
+
<button
|
|
113
|
+
type='button'
|
|
114
|
+
className={`rb-bottom-bar__button${
|
|
115
|
+
isLocalizationOpen ? ' is-active' : ''
|
|
116
|
+
}`}
|
|
117
|
+
aria-label='Localization'
|
|
118
|
+
aria-pressed={isLocalizationOpen}
|
|
119
|
+
onClick={() => setIsLocalizationOpen(true)}
|
|
120
|
+
>
|
|
121
|
+
<Icon
|
|
122
|
+
iconType={localizationIcon}
|
|
123
|
+
size={20}
|
|
124
|
+
color='currentColor'
|
|
125
|
+
alt=''
|
|
126
|
+
/>
|
|
127
|
+
</button>
|
|
128
|
+
|
|
129
|
+
<button
|
|
130
|
+
type='button'
|
|
131
|
+
className={`rb-bottom-bar__button${isColorsOpen ? ' is-active' : ''}`}
|
|
132
|
+
aria-label='Color'
|
|
133
|
+
aria-pressed={isColorsOpen}
|
|
134
|
+
onClick={() => setIsColorsOpen(true)}
|
|
135
|
+
>
|
|
136
|
+
<Icon iconType={colorIcon} size={20} color='currentColor' alt='' />
|
|
137
|
+
</button>
|
|
138
|
+
|
|
139
|
+
<div className='rb-bottom-bar__spacer' />
|
|
140
|
+
|
|
141
|
+
<div className='rb-bottom-bar__langs' aria-label='Language'>
|
|
142
|
+
{languages.map(language => (
|
|
143
|
+
<button
|
|
144
|
+
key={language}
|
|
145
|
+
type='button'
|
|
146
|
+
className={`rb-bottom-bar__lang${
|
|
147
|
+
activeLanguage === language ? ' is-active' : ''
|
|
148
|
+
}`}
|
|
149
|
+
onClick={() =>
|
|
150
|
+
setAppConfig({ ...appConfig, defaultLanguage: language })
|
|
151
|
+
}
|
|
152
|
+
>
|
|
153
|
+
{language}
|
|
154
|
+
</button>
|
|
155
|
+
))}
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
{isLocalizationOpen && (
|
|
160
|
+
<LocalicationModal
|
|
161
|
+
data={appConfig.localication ?? {}}
|
|
162
|
+
onChange={handleLocalicationChange}
|
|
163
|
+
onClose={() => setIsLocalizationOpen(false)}
|
|
164
|
+
/>
|
|
165
|
+
)}
|
|
166
|
+
|
|
167
|
+
{isColorsOpen && (
|
|
168
|
+
<ScreenColorsModal
|
|
169
|
+
appConfig={appConfig}
|
|
170
|
+
onChange={setAppConfig}
|
|
171
|
+
onClose={() => setIsColorsOpen(false)}
|
|
172
|
+
/>
|
|
173
|
+
)}
|
|
174
|
+
|
|
175
|
+
{isDebugOpen && (
|
|
176
|
+
<Modal
|
|
177
|
+
onClose={() => setIsDebugOpen(false)}
|
|
178
|
+
ariaLabelledBy='debug-json-editor-title'
|
|
179
|
+
className='modal--large modal--scrollable'
|
|
180
|
+
contentClassName='localication-modal__content'
|
|
181
|
+
>
|
|
182
|
+
<div className='modal__header localication-modal__header'>
|
|
183
|
+
<div className='localication-modal__header-main'>
|
|
184
|
+
<h3 id='debug-json-editor-title' className='modal__title'>
|
|
185
|
+
Debug JSON
|
|
186
|
+
</h3>
|
|
187
|
+
<p className='localication-modal__description'>
|
|
188
|
+
Inspect and edit raw node JSON.
|
|
189
|
+
</p>
|
|
190
|
+
</div>
|
|
191
|
+
<button
|
|
192
|
+
type='button'
|
|
193
|
+
className='editor-button'
|
|
194
|
+
onClick={() => setIsDebugOpen(false)}
|
|
195
|
+
>
|
|
196
|
+
Close
|
|
197
|
+
</button>
|
|
198
|
+
</div>
|
|
199
|
+
<div className='localication-modal__body'>
|
|
200
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
201
|
+
<Checkbox
|
|
202
|
+
label='Preview mode'
|
|
203
|
+
checked={previewMode}
|
|
204
|
+
onChange={setPreviewMode}
|
|
205
|
+
/>
|
|
206
|
+
<Checkbox
|
|
207
|
+
label='Dark Mode'
|
|
208
|
+
checked={appConfig.theme === 'dark'}
|
|
209
|
+
onChange={checked =>
|
|
210
|
+
setAppConfig({
|
|
211
|
+
...appConfig,
|
|
212
|
+
theme: checked ? 'dark' : 'light',
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
/>
|
|
216
|
+
<Checkbox
|
|
217
|
+
label='Is RTL'
|
|
218
|
+
checked={appConfig.isRtl ?? false}
|
|
219
|
+
onChange={checked =>
|
|
220
|
+
setAppConfig({ ...appConfig, isRtl: checked })
|
|
221
|
+
}
|
|
222
|
+
/>
|
|
223
|
+
</div>
|
|
224
|
+
<div
|
|
225
|
+
className='localication-modal__editor'
|
|
226
|
+
style={{ marginTop: 12 }}
|
|
227
|
+
>
|
|
228
|
+
<JsonTextEditor
|
|
229
|
+
rootName='node'
|
|
230
|
+
value={data ?? {}}
|
|
231
|
+
onChange={next =>
|
|
232
|
+
setData(analyseAndProccess(next as Node) as Node)
|
|
233
|
+
}
|
|
234
|
+
className='localication-modal__json-editor'
|
|
235
|
+
/>
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
</Modal>
|
|
239
|
+
)}
|
|
240
|
+
</>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Lottie from 'lottie-react';
|
|
2
|
+
import loadingAnimation from '../assets/loading_animation.json';
|
|
3
|
+
|
|
4
|
+
export function LoadingComponent() {
|
|
5
|
+
return (
|
|
6
|
+
<div className="rb-loading">
|
|
7
|
+
<Lottie animationData={loadingAnimation as any} loop autoplay />
|
|
8
|
+
</div>
|
|
9
|
+
);
|
|
10
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -28,7 +28,8 @@ export { getOnboardSamples } from './assets/samples/getSamples';
|
|
|
28
28
|
export { RenderPage } from './RenderPage';
|
|
29
29
|
export { DeviceMockFrame } from './DeviceMockFrame';
|
|
30
30
|
export { novaToJson } from './utils/novaToJson';
|
|
31
|
-
export type { Localication } from './types/PreviewConfig';
|
|
31
|
+
export type { AppConfig, Localication } from './types/PreviewConfig';
|
|
32
|
+
export { defaultAppConfig } from './types/PreviewConfig';
|
|
32
33
|
export { getDevices, getDefaultDevice } from './utils/getDevices';
|
|
33
34
|
export type { Device } from './types/Device';
|
|
34
35
|
export { AttributesEditor };
|