react-ui-basics 0.0.237 → 0.0.238

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/bundle.css CHANGED
@@ -1,3 +1,12 @@
1
+ .animated {
2
+ transition: opacity 250ms ease;
3
+ opacity: 0;
4
+ }
5
+
6
+ .animated.mounting, .animated.mounted {
7
+ opacity: 1;
8
+ }
9
+
1
10
  .AutocompleteSelect {
2
11
  display: inline-flex;
3
12
  flex-flow: column;
@@ -293,13 +302,22 @@
293
302
  position: absolute;
294
303
  }
295
304
 
296
- .animated {
297
- transition: opacity 250ms ease;
298
- opacity: 0;
305
+ .DNDContainer .DroppableList .Draggable {
306
+ transform: unset;
307
+ transition: unset;
308
+ opacity: 1;
299
309
  }
300
310
 
301
- .animated.mounting, .animated.mounted {
302
- opacity: 1;
311
+ .DNDContainer .DroppableList .Draggable.dragged {
312
+ transition: unset !important;
313
+ }
314
+
315
+ .DNDContainer .DroppableList.hover .Draggable {
316
+ transition: transform 0.2s ease-in;
317
+ }
318
+
319
+ .DNDContainer .DroppableList.resetting .Draggable {
320
+ transition: transform 0.1s ease-in;
303
321
  }
304
322
 
305
323
  .ImageGallery {
@@ -537,24 +555,6 @@
537
555
  font-size: 24px;
538
556
  }
539
557
 
540
- .DNDContainer .DroppableList .Draggable {
541
- transform: unset;
542
- transition: unset;
543
- opacity: 1;
544
- }
545
-
546
- .DNDContainer .DroppableList .Draggable.dragged {
547
- transition: unset !important;
548
- }
549
-
550
- .DNDContainer .DroppableList.hover .Draggable {
551
- transition: transform 0.2s ease-in;
552
- }
553
-
554
- .DNDContainer .DroppableList.resetting .Draggable {
555
- transition: transform 0.1s ease-in;
556
- }
557
-
558
558
  .Checkbox {
559
559
  position: relative;
560
560
  white-space: pre;
@@ -664,6 +664,63 @@
664
664
  margin-bottom: 0;
665
665
  }
666
666
 
667
+ .DNDContainer {
668
+ position: relative;
669
+ }
670
+
671
+ .DNDContainer .Draggable[draggable=true], .DNDContainer .Draggable [draggable=true] {
672
+ cursor: pointer;
673
+ }
674
+
675
+ .DNDContainer .Draggable.placeholder {
676
+ opacity: 0.2;
677
+ }
678
+
679
+ .DNDContainer .Draggable.copy {
680
+ position: absolute;
681
+ box-sizing: border-box;
682
+ will-change: transform;
683
+ opacity: 0;
684
+ }
685
+
686
+ .DNDContainer .Draggable.dragged {
687
+ z-index: 10;
688
+ }
689
+
690
+ .DNDContainer .overlay {
691
+ position: absolute;
692
+ top: 0;
693
+ left: 0;
694
+ right: 0;
695
+ bottom: 0;
696
+ pointer-events: none;
697
+ }
698
+
699
+ .CalendarMonthView {
700
+ display: flex;
701
+ flex-flow: column nowrap;
702
+ height: 100%;
703
+ }
704
+
705
+ .CalendarMonthView > .row {
706
+ display: flex;
707
+ flex-flow: row nowrap;
708
+ }
709
+
710
+ .CalendarMonthView .days {
711
+ flex-grow: 1;
712
+ position: relative;
713
+ }
714
+
715
+ .CalendarMonthView .day, .CalendarMonthView .header {
716
+ flex-grow: 1;
717
+ flex-basis: 1px;
718
+ }
719
+
720
+ .CalendarMonthView .day {
721
+ height: 100%;
722
+ }
723
+
667
724
  .Button {
668
725
  position: relative;
669
726
  min-width: 64px;
@@ -830,42 +887,31 @@
830
887
  border: 0;
831
888
  }
832
889
 
833
- .CircleProgress {
834
- width: 48px;
835
- height: 48px;
836
- }
837
-
838
- .CircleProgress .line {
839
- stroke-width: 2px;
840
- stroke: black;
841
- stroke-linecap: square;
842
- fill: none;
843
- transition: stroke-dashoffset 0.2s ease;
844
- }
845
-
846
- .CalendarMonthView {
847
- display: flex;
848
- flex-flow: column nowrap;
849
- height: 100%;
890
+ .DropFileInput {
891
+ flex-grow: 1;
850
892
  }
851
893
 
852
- .CalendarMonthView > .row {
894
+ .DropFileInput .Dropzone {
895
+ border: 1px dashed #808080;
896
+ padding: 12px;
853
897
  display: flex;
854
898
  flex-flow: row nowrap;
899
+ justify-content: center;
900
+ align-items: center;
901
+ color: gray;
902
+ cursor: pointer;
903
+ border-radius: 3px;
904
+ font-weight: normal;
905
+ line-height: 22px;
906
+ font-size: 14px;
907
+ color: #7E7E7E;
908
+ max-width: 100%;
909
+ word-break: break-all;
910
+ word-break: break-word;
855
911
  }
856
912
 
857
- .CalendarMonthView .days {
858
- flex-grow: 1;
859
- position: relative;
860
- }
861
-
862
- .CalendarMonthView .day, .CalendarMonthView .header {
863
- flex-grow: 1;
864
- flex-basis: 1px;
865
- }
866
-
867
- .CalendarMonthView .day {
868
- height: 100%;
913
+ .DropFileInput .Dropzone .icon.withText {
914
+ margin-right: 10px;
869
915
  }
870
916
 
871
917
  .Button.FloatingActionButton {
@@ -1009,66 +1055,6 @@
1009
1055
  background-color: #51adf6;
1010
1056
  }
1011
1057
 
1012
- .Dropzone {
1013
- position: relative;
1014
- }
1015
-
1016
- .Dropzone > .overlay {
1017
- position: absolute;
1018
- left: 0;
1019
- right: 0;
1020
- top: 0;
1021
- bottom: 0;
1022
- background-color: #38ADC4;
1023
- z-index: 1;
1024
- opacity: 0;
1025
- transition: all 0.2s ease;
1026
- transition-delay: 100ms;
1027
- visibility: hidden;
1028
- display: flex;
1029
- justify-content: center;
1030
- align-items: center;
1031
- }
1032
-
1033
- .Dropzone > .overlay .drop {
1034
- border-radius: 4px;
1035
- border: 1px dashed #FFFFFF;
1036
- position: absolute;
1037
- top: 18px;
1038
- left: 18px;
1039
- right: 18px;
1040
- bottom: 18px;
1041
- display: flex;
1042
- justify-content: center;
1043
- align-items: center;
1044
- font-weight: 500;
1045
- font-size: 18px;
1046
- color: #FFFFFF;
1047
- }
1048
-
1049
- .Dropzone.dragging > .overlay {
1050
- opacity: 0.7;
1051
- visibility: visible;
1052
- transition-delay: 0s;
1053
- }
1054
-
1055
- .Dropzone.dragging > * {
1056
- pointer-events: none;
1057
- }
1058
-
1059
- .Dropzone > input.file {
1060
- position: absolute;
1061
- left: 0;
1062
- right: 0;
1063
- top: 0;
1064
- bottom: 0;
1065
- width: 100%;
1066
- height: 100%;
1067
- opacity: 0;
1068
- cursor: pointer;
1069
- z-index: 1;
1070
- }
1071
-
1072
1058
  .FilteredList {
1073
1059
  max-height: 250px;
1074
1060
  position: relative;
@@ -1153,49 +1139,143 @@
1153
1139
  margin-bottom: 8px;
1154
1140
  }
1155
1141
 
1156
- .DNDContainer {
1142
+ .Dropzone {
1157
1143
  position: relative;
1158
1144
  }
1159
1145
 
1160
- .DNDContainer .Draggable[draggable=true], .DNDContainer .Draggable [draggable=true] {
1161
- cursor: pointer;
1162
- }
1163
-
1164
- .DNDContainer .Draggable.placeholder {
1165
- opacity: 0.2;
1166
- }
1167
-
1168
- .DNDContainer .Draggable.copy {
1169
- position: absolute;
1170
- box-sizing: border-box;
1171
- will-change: transform;
1172
- opacity: 0;
1173
- }
1174
-
1175
- .DNDContainer .Draggable.dragged {
1176
- z-index: 10;
1177
- }
1178
-
1179
- .DNDContainer .overlay {
1180
- position: absolute;
1181
- top: 0;
1182
- left: 0;
1183
- right: 0;
1184
- bottom: 0;
1185
- pointer-events: none;
1186
- }
1187
-
1188
- .FormUploadProgress {
1146
+ .Dropzone > .overlay {
1189
1147
  position: absolute;
1190
1148
  left: 0;
1191
1149
  right: 0;
1192
1150
  top: 0;
1193
1151
  bottom: 0;
1194
- background-color: rgba(255, 255, 255, 0.6);
1195
- z-index: 2;
1152
+ background-color: #38ADC4;
1153
+ z-index: 1;
1154
+ opacity: 0;
1155
+ transition: all 0.2s ease;
1156
+ transition-delay: 100ms;
1157
+ visibility: hidden;
1158
+ display: flex;
1159
+ justify-content: center;
1160
+ align-items: center;
1196
1161
  }
1197
1162
 
1198
- .FormUploadProgress.animated.mounting, .FormUploadProgress.animated.mounted {
1163
+ .Dropzone > .overlay .drop {
1164
+ border-radius: 4px;
1165
+ border: 1px dashed #FFFFFF;
1166
+ position: absolute;
1167
+ top: 18px;
1168
+ left: 18px;
1169
+ right: 18px;
1170
+ bottom: 18px;
1171
+ display: flex;
1172
+ justify-content: center;
1173
+ align-items: center;
1174
+ font-weight: 500;
1175
+ font-size: 18px;
1176
+ color: #FFFFFF;
1177
+ }
1178
+
1179
+ .Dropzone.dragging > .overlay {
1180
+ opacity: 0.7;
1181
+ visibility: visible;
1182
+ transition-delay: 0s;
1183
+ }
1184
+
1185
+ .Dropzone.dragging > * {
1186
+ pointer-events: none;
1187
+ }
1188
+
1189
+ .Dropzone > input.file {
1190
+ position: absolute;
1191
+ left: 0;
1192
+ right: 0;
1193
+ top: 0;
1194
+ bottom: 0;
1195
+ width: 100%;
1196
+ height: 100%;
1197
+ opacity: 0;
1198
+ cursor: pointer;
1199
+ z-index: 1;
1200
+ }
1201
+
1202
+ .CircleProgress {
1203
+ width: 48px;
1204
+ height: 48px;
1205
+ }
1206
+
1207
+ .CircleProgress .line {
1208
+ stroke-width: 2px;
1209
+ stroke: black;
1210
+ stroke-linecap: square;
1211
+ fill: none;
1212
+ transition: stroke-dashoffset 0.2s ease;
1213
+ }
1214
+
1215
+ .SpinningProgress {
1216
+ width: 48px;
1217
+ height: 48px;
1218
+ position: relative;
1219
+ margin: 0 auto;
1220
+ }
1221
+
1222
+ .SpinningProgress:before {
1223
+ content: "";
1224
+ display: block;
1225
+ padding-top: 100%;
1226
+ }
1227
+
1228
+ .SpinningProgress .circular {
1229
+ animation: rotate 2s linear infinite;
1230
+ height: 100%;
1231
+ transform-origin: center center;
1232
+ width: 100%;
1233
+ position: absolute;
1234
+ top: 0;
1235
+ bottom: 0;
1236
+ left: 0;
1237
+ right: 0;
1238
+ margin: auto;
1239
+ }
1240
+
1241
+ .SpinningProgress .line {
1242
+ stroke: black;
1243
+ stroke-width: 2px;
1244
+ stroke-dasharray: 1, 96;
1245
+ stroke-dashoffset: 0;
1246
+ animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite;
1247
+ }
1248
+
1249
+ @keyframes rotate {
1250
+ 100% {
1251
+ transform: rotate(360deg);
1252
+ }
1253
+ }
1254
+ @keyframes dash {
1255
+ 0% {
1256
+ stroke-dasharray: 1, 96;
1257
+ stroke-dashoffset: 0;
1258
+ }
1259
+ 50% {
1260
+ stroke-dasharray: 43, 96;
1261
+ stroke-dashoffset: -17px;
1262
+ }
1263
+ 100% {
1264
+ stroke-dasharray: 43, 96;
1265
+ stroke-dashoffset: -53px;
1266
+ }
1267
+ }
1268
+ .FormUploadProgress {
1269
+ position: absolute;
1270
+ left: 0;
1271
+ right: 0;
1272
+ top: 0;
1273
+ bottom: 0;
1274
+ background-color: rgba(255, 255, 255, 0.6);
1275
+ z-index: 2;
1276
+ }
1277
+
1278
+ .FormUploadProgress.animated.mounting, .FormUploadProgress.animated.mounted {
1199
1279
  transition-delay: 500ms;
1200
1280
  }
1201
1281
 
@@ -1254,131 +1334,6 @@
1254
1334
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.25);
1255
1335
  }
1256
1336
 
1257
- .DropFileInput {
1258
- flex-grow: 1;
1259
- }
1260
-
1261
- .DropFileInput .Dropzone {
1262
- border: 1px dashed #808080;
1263
- padding: 12px;
1264
- display: flex;
1265
- flex-flow: row nowrap;
1266
- justify-content: center;
1267
- align-items: center;
1268
- color: gray;
1269
- cursor: pointer;
1270
- border-radius: 3px;
1271
- font-weight: normal;
1272
- line-height: 22px;
1273
- font-size: 14px;
1274
- color: #7E7E7E;
1275
- max-width: 100%;
1276
- word-break: break-all;
1277
- word-break: break-word;
1278
- }
1279
-
1280
- .DropFileInput .Dropzone .icon.withText {
1281
- margin-right: 10px;
1282
- }
1283
-
1284
- .Scrollable {
1285
- max-height: 250px;
1286
- max-width: 250px;
1287
- padding-right: 5px;
1288
- position: relative;
1289
- display: flex;
1290
- flex-flow: column;
1291
- align-items: stretch;
1292
- overflow: hidden;
1293
- }
1294
-
1295
- .Scrollable:hover > .scrollbar.auto {
1296
- transition-delay: 0s;
1297
- opacity: 1;
1298
- }
1299
-
1300
- .Scrollable .viewport {
1301
- overflow-y: scroll;
1302
- overflow-x: scroll;
1303
- max-height: 100%;
1304
- scrollbar-width: none;
1305
- }
1306
-
1307
- .Scrollable .viewport::-webkit-scrollbar {
1308
- display: none;
1309
- }
1310
-
1311
- .Scrollable.without-scroll-horizontal {
1312
- max-width: unset;
1313
- }
1314
-
1315
- .Scrollable.undefined-horizontal {
1316
- max-width: unset;
1317
- }
1318
-
1319
- .Scrollable.without-scroll {
1320
- padding-right: 0;
1321
- max-height: unset;
1322
- }
1323
-
1324
- .Scrollable.without-scroll > .viewport {
1325
- padding-right: 0;
1326
- margin-right: 0;
1327
- }
1328
-
1329
- .Scrollable.without-scroll > .scrollbar {
1330
- visibility: hidden;
1331
- }
1332
-
1333
- .Scrollable .scrollbar {
1334
- position: absolute;
1335
- right: 0px;
1336
- top: 0px;
1337
- width: 5px;
1338
- transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
1339
- transition-delay: 0.5s;
1340
- z-index: 1;
1341
- }
1342
-
1343
- .Scrollable .scrollbar.auto, .Scrollable .scrollbar.hidden {
1344
- opacity: 0;
1345
- }
1346
-
1347
- .Scrollable .scrollbar .thumb {
1348
- background-color: rgba(0, 0, 0, 0.3);
1349
- width: 5px;
1350
- position: absolute;
1351
- right: 0px;
1352
- top: 0px;
1353
- user-select: none;
1354
- will-change: top;
1355
- border-radius: 2px;
1356
- }
1357
-
1358
- .Scrollable .scrollbar .thumb:hover {
1359
- background-color: rgba(0, 0, 0, 0.5);
1360
- }
1361
-
1362
- .Scrollable .scrollbar .thumb:active {
1363
- background-color: rgba(0, 0, 0, 0.7);
1364
- }
1365
-
1366
- .Scrollable .scrollbar.horizontal {
1367
- left: 0px;
1368
- right: 0px;
1369
- height: 5px;
1370
- bottom: 0;
1371
- width: unset;
1372
- top: unset;
1373
- }
1374
-
1375
- .Scrollable .scrollbar.horizontal .thumb {
1376
- height: 5px;
1377
- left: 0px;
1378
- bottom: 0px;
1379
- will-change: left;
1380
- }
1381
-
1382
1337
  .Modal {
1383
1338
  display: block;
1384
1339
  position: fixed;
@@ -1449,6 +1404,51 @@
1449
1404
  position: absolute;
1450
1405
  }
1451
1406
 
1407
+ .Snackbar {
1408
+ transform: translateX(-50%);
1409
+ overflow: hidden;
1410
+ background-color: #323232;
1411
+ padding: 14px 24px 14px 24px;
1412
+ color: #fff;
1413
+ min-width: 288px;
1414
+ max-width: 568px;
1415
+ position: fixed;
1416
+ bottom: -50px;
1417
+ left: 50%;
1418
+ display: flex;
1419
+ flex-wrap: nowrap;
1420
+ align-items: center;
1421
+ opacity: 0;
1422
+ transition: bottom 0.25s ease, opacity 0.2s ease;
1423
+ border-radius: 4px;
1424
+ box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
1425
+ }
1426
+
1427
+ .Snackbar.shown {
1428
+ bottom: 15px;
1429
+ opacity: 1;
1430
+ }
1431
+
1432
+ .Snackbar .message {
1433
+ overflow: hidden;
1434
+ line-height: 1.2em;
1435
+ min-height: 1.2em;
1436
+ max-height: 2.4em;
1437
+ flex: 1;
1438
+ }
1439
+
1440
+ .Snackbar .action {
1441
+ text-transform: uppercase;
1442
+ font-weight: bold;
1443
+ margin-left: 48px;
1444
+ color: #bf3727;
1445
+ }
1446
+
1447
+ .Snackbar .action a {
1448
+ text-decoration: none;
1449
+ color: #bf3727;
1450
+ }
1451
+
1452
1452
  .ModalMenu {
1453
1453
  position: absolute;
1454
1454
  top: 10px;
@@ -1467,129 +1467,203 @@
1467
1467
  top: 0;
1468
1468
  }
1469
1469
 
1470
- .ModalMenu .Button.animated.mounting, .ModalMenu .Button.animated.mounted {
1471
- opacity: 1;
1470
+ .ModalMenu .Button.animated.mounting, .ModalMenu .Button.animated.mounted {
1471
+ opacity: 1;
1472
+ }
1473
+
1474
+ .ModalMenu .Button.animated.unmounting {
1475
+ transition: opacity 100ms ease-out, right 200ms ease-out;
1476
+ }
1477
+
1478
+ .ModalMenu .Button.active {
1479
+ background: #EBEBEB;
1480
+ }
1481
+
1482
+ .ModalMenu .separator {
1483
+ height: 24px;
1484
+ width: 1px;
1485
+ background-color: #D9D9D9;
1486
+ margin-left: 4px;
1487
+ }
1488
+
1489
+ .Scrollable {
1490
+ max-height: 250px;
1491
+ max-width: 250px;
1492
+ padding-right: 5px;
1493
+ position: relative;
1494
+ display: flex;
1495
+ flex-flow: column;
1496
+ align-items: stretch;
1497
+ overflow: hidden;
1498
+ }
1499
+
1500
+ .Scrollable:hover > .scrollbar.auto {
1501
+ transition-delay: 0s;
1502
+ opacity: 1;
1503
+ }
1504
+
1505
+ .Scrollable .viewport {
1506
+ overflow-y: scroll;
1507
+ overflow-x: scroll;
1508
+ max-height: 100%;
1509
+ scrollbar-width: none;
1510
+ }
1511
+
1512
+ .Scrollable .viewport::-webkit-scrollbar {
1513
+ display: none;
1514
+ }
1515
+
1516
+ .Scrollable.without-scroll-horizontal {
1517
+ max-width: unset;
1518
+ }
1519
+
1520
+ .Scrollable.undefined-horizontal {
1521
+ max-width: unset;
1522
+ }
1523
+
1524
+ .Scrollable.without-scroll {
1525
+ padding-right: 0;
1526
+ max-height: unset;
1527
+ }
1528
+
1529
+ .Scrollable.without-scroll > .viewport {
1530
+ padding-right: 0;
1531
+ margin-right: 0;
1532
+ }
1533
+
1534
+ .Scrollable.without-scroll > .scrollbar {
1535
+ visibility: hidden;
1536
+ }
1537
+
1538
+ .Scrollable .scrollbar {
1539
+ position: absolute;
1540
+ right: 0px;
1541
+ top: 0px;
1542
+ width: 5px;
1543
+ transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
1544
+ transition-delay: 0.5s;
1545
+ z-index: 1;
1546
+ }
1547
+
1548
+ .Scrollable .scrollbar.auto, .Scrollable .scrollbar.hidden {
1549
+ opacity: 0;
1550
+ }
1551
+
1552
+ .Scrollable .scrollbar .thumb {
1553
+ background-color: rgba(0, 0, 0, 0.3);
1554
+ width: 5px;
1555
+ position: absolute;
1556
+ right: 0px;
1557
+ top: 0px;
1558
+ user-select: none;
1559
+ will-change: top;
1560
+ border-radius: 2px;
1561
+ }
1562
+
1563
+ .Scrollable .scrollbar .thumb:hover {
1564
+ background-color: rgba(0, 0, 0, 0.5);
1565
+ }
1566
+
1567
+ .Scrollable .scrollbar .thumb:active {
1568
+ background-color: rgba(0, 0, 0, 0.7);
1472
1569
  }
1473
1570
 
1474
- .ModalMenu .Button.animated.unmounting {
1475
- transition: opacity 100ms ease-out, right 200ms ease-out;
1571
+ .Scrollable .scrollbar.horizontal {
1572
+ left: 0px;
1573
+ right: 0px;
1574
+ height: 5px;
1575
+ bottom: 0;
1576
+ width: unset;
1577
+ top: unset;
1476
1578
  }
1477
1579
 
1478
- .ModalMenu .Button.active {
1479
- background: #EBEBEB;
1580
+ .Scrollable .scrollbar.horizontal .thumb {
1581
+ height: 5px;
1582
+ left: 0px;
1583
+ bottom: 0px;
1584
+ will-change: left;
1480
1585
  }
1481
1586
 
1482
- .ModalMenu .separator {
1483
- height: 24px;
1484
- width: 1px;
1485
- background-color: #D9D9D9;
1486
- margin-left: 4px;
1587
+ .Switch {
1588
+ display: inline-flex;
1589
+ padding-top: 5px;
1487
1590
  }
1488
1591
 
1489
- .Snackbar {
1490
- transform: translateX(-50%);
1491
- overflow: hidden;
1492
- background-color: #323232;
1493
- padding: 14px 24px 14px 24px;
1494
- color: #fff;
1495
- min-width: 288px;
1496
- max-width: 568px;
1497
- position: fixed;
1498
- bottom: -50px;
1499
- left: 50%;
1500
- display: flex;
1501
- flex-wrap: nowrap;
1502
- align-items: center;
1503
- opacity: 0;
1504
- transition: bottom 0.25s ease, opacity 0.2s ease;
1505
- border-radius: 4px;
1506
- box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
1592
+ .Switch .switch-input {
1593
+ display: none;
1507
1594
  }
1508
1595
 
1509
- .Snackbar.shown {
1510
- bottom: 15px;
1511
- opacity: 1;
1596
+ .Switch .switch-label {
1597
+ position: relative;
1598
+ display: inline-flex;
1599
+ align-items: center;
1600
+ min-width: 38px;
1601
+ height: 24px;
1602
+ cursor: pointer;
1603
+ font-weight: 500;
1604
+ text-align: left;
1605
+ user-select: none;
1606
+ margin: 0;
1607
+ padding: 0;
1608
+ padding-left: 44px;
1609
+ box-sizing: border-box;
1512
1610
  }
1513
1611
 
1514
- .Snackbar .message {
1515
- overflow: hidden;
1516
- line-height: 1.2em;
1517
- min-height: 1.2em;
1518
- max-height: 2.4em;
1519
- flex: 1;
1612
+ .Switch .switch-label:before, .Switch .switch-label:after {
1613
+ content: "";
1614
+ box-sizing: border-box;
1615
+ position: absolute;
1616
+ margin: 0;
1617
+ outline: 0;
1618
+ top: 50%;
1619
+ transform: translate(0, -50%);
1620
+ transition: all 0.3s ease;
1520
1621
  }
1521
1622
 
1522
- .Snackbar .action {
1523
- text-transform: uppercase;
1524
- font-weight: bold;
1525
- margin-left: 48px;
1526
- color: #bf3727;
1623
+ .Switch .switch-label:before {
1624
+ left: 1px;
1625
+ width: 34px;
1626
+ height: 14px;
1627
+ background-color: #9E9E9E;
1628
+ border-radius: 8px;
1527
1629
  }
1528
1630
 
1529
- .Snackbar .action a {
1530
- text-decoration: none;
1531
- color: #bf3727;
1631
+ .Switch .switch-label:after {
1632
+ left: 0;
1633
+ width: 20px;
1634
+ height: 20px;
1635
+ background-color: #FAFAFA;
1636
+ border-radius: 50%;
1637
+ box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 2px 2px 0 rgba(0, 0, 0, 0.098), 0 1px 5px 0 rgba(0, 0, 0, 0.084);
1532
1638
  }
1533
1639
 
1534
- .SpinningProgress {
1535
- width: 48px;
1536
- height: 48px;
1537
- position: relative;
1538
- margin: 0 auto;
1640
+ .Switch .switch-label .toggle--on {
1641
+ display: none;
1539
1642
  }
1540
1643
 
1541
- .SpinningProgress:before {
1542
- content: "";
1543
- display: block;
1544
- padding-top: 100%;
1644
+ .Switch .switch-label .toggle--off {
1645
+ display: inline-block;
1545
1646
  }
1546
1647
 
1547
- .SpinningProgress .circular {
1548
- animation: rotate 2s linear infinite;
1549
- height: 100%;
1550
- transform-origin: center center;
1551
- width: 100%;
1552
- position: absolute;
1553
- top: 0;
1554
- bottom: 0;
1555
- left: 0;
1556
- right: 0;
1557
- margin: auto;
1648
+ .Switch .switch-label .label {
1649
+ margin-right: 5px;
1558
1650
  }
1559
1651
 
1560
- .SpinningProgress .line {
1561
- stroke: black;
1562
- stroke-width: 2px;
1563
- stroke-dasharray: 1, 96;
1564
- stroke-dashoffset: 0;
1565
- animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite;
1652
+ .Switch .switch-input:checked + .switch-label:before {
1653
+ background-color: #A5D6A7;
1566
1654
  }
1567
1655
 
1568
- @keyframes rotate {
1569
- 100% {
1570
- transform: rotate(360deg);
1571
- }
1572
- }
1573
- @keyframes dash {
1574
- 0% {
1575
- stroke-dasharray: 1, 96;
1576
- stroke-dashoffset: 0;
1577
- }
1578
- 50% {
1579
- stroke-dasharray: 43, 96;
1580
- stroke-dashoffset: -17px;
1581
- }
1582
- 100% {
1583
- stroke-dasharray: 43, 96;
1584
- stroke-dashoffset: -53px;
1585
- }
1656
+ .Switch .switch-input:checked + .switch-label:after {
1657
+ background-color: #4CAF50;
1658
+ transform: translate(80%, -50%);
1586
1659
  }
1587
- .ScrollableTable .Scrollable .scrollbar {
1588
- top: 56px;
1660
+
1661
+ .Switch .switch-input:checked + .switch-label .toggle--on {
1662
+ display: inline-block;
1589
1663
  }
1590
1664
 
1591
- .ScrollableTable .Table {
1592
- position: static;
1665
+ .Switch .switch-input:checked + .switch-label .toggle--off {
1666
+ display: none;
1593
1667
  }
1594
1668
 
1595
1669
  .Table {
@@ -1714,88 +1788,6 @@
1714
1788
  margin: 0;
1715
1789
  }
1716
1790
 
1717
- .Switch {
1718
- display: inline-flex;
1719
- padding-top: 5px;
1720
- }
1721
-
1722
- .Switch .switch-input {
1723
- display: none;
1724
- }
1725
-
1726
- .Switch .switch-label {
1727
- position: relative;
1728
- display: inline-flex;
1729
- align-items: center;
1730
- min-width: 38px;
1731
- height: 24px;
1732
- cursor: pointer;
1733
- font-weight: 500;
1734
- text-align: left;
1735
- user-select: none;
1736
- margin: 0;
1737
- padding: 0;
1738
- padding-left: 44px;
1739
- box-sizing: border-box;
1740
- }
1741
-
1742
- .Switch .switch-label:before, .Switch .switch-label:after {
1743
- content: "";
1744
- box-sizing: border-box;
1745
- position: absolute;
1746
- margin: 0;
1747
- outline: 0;
1748
- top: 50%;
1749
- transform: translate(0, -50%);
1750
- transition: all 0.3s ease;
1751
- }
1752
-
1753
- .Switch .switch-label:before {
1754
- left: 1px;
1755
- width: 34px;
1756
- height: 14px;
1757
- background-color: #9E9E9E;
1758
- border-radius: 8px;
1759
- }
1760
-
1761
- .Switch .switch-label:after {
1762
- left: 0;
1763
- width: 20px;
1764
- height: 20px;
1765
- background-color: #FAFAFA;
1766
- border-radius: 50%;
1767
- box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 2px 2px 0 rgba(0, 0, 0, 0.098), 0 1px 5px 0 rgba(0, 0, 0, 0.084);
1768
- }
1769
-
1770
- .Switch .switch-label .toggle--on {
1771
- display: none;
1772
- }
1773
-
1774
- .Switch .switch-label .toggle--off {
1775
- display: inline-block;
1776
- }
1777
-
1778
- .Switch .switch-label .label {
1779
- margin-right: 5px;
1780
- }
1781
-
1782
- .Switch .switch-input:checked + .switch-label:before {
1783
- background-color: #A5D6A7;
1784
- }
1785
-
1786
- .Switch .switch-input:checked + .switch-label:after {
1787
- background-color: #4CAF50;
1788
- transform: translate(80%, -50%);
1789
- }
1790
-
1791
- .Switch .switch-input:checked + .switch-label .toggle--on {
1792
- display: inline-block;
1793
- }
1794
-
1795
- .Switch .switch-input:checked + .switch-label .toggle--off {
1796
- display: none;
1797
- }
1798
-
1799
1791
  .TextField {
1800
1792
  position: relative;
1801
1793
  width: 100%;
@@ -1937,4 +1929,12 @@
1937
1929
  animation-fill-mode: both;
1938
1930
  animation-timing-function: ease-in-out;
1939
1931
  animation-name: shake;
1932
+ }
1933
+
1934
+ .ScrollableTable .Scrollable .scrollbar {
1935
+ top: 56px;
1936
+ }
1937
+
1938
+ .ScrollableTable .Table {
1939
+ position: static;
1940
1940
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-ui-basics",
3
- "version": "0.0.237",
3
+ "version": "0.0.238",
4
4
  "description": "",
5
5
  "module": "index.js",
6
6
  "_main": "index.cjs.js",
@@ -1,2 +1,9 @@
1
- export declare const pushLocation: (path: string) => any;
2
- export declare const replaceLocation: (path: string) => any;
1
+ declare const history: History;
2
+ declare type HistoryAction = 'pushState' | 'replaceState';
3
+ declare type HistoryActionArgs = Parameters<typeof history[HistoryAction]>;
4
+ declare type HistoryMiddleware = (action: HistoryAction, args: HistoryActionArgs) => HistoryActionArgs;
5
+ export declare const pushLocation: (path: string) => void;
6
+ export declare const replaceLocation: (path: string) => void;
7
+ export declare const addMiddleware: (middleware: HistoryMiddleware) => void;
8
+ export declare const removeMiddleware: (middleware: HistoryMiddleware) => void;
9
+ export {};
@@ -1,11 +1,18 @@
1
1
  import ReactConstants from "./../ReactConstants"; import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./../CommonFields"; import {toConsumableArray as __toConsumableArray} from "./../_virtual/_rollupPluginBabelHelpers"; import {extends as __extends} from "./../_virtual/_rollupPluginBabelHelpers"; import {inherits as __inherits} from "./../_virtual/_rollupPluginBabelHelpers"; import { WINDOW } from '../Tools.js';
2
2
 
3
3
  const history = WINDOW.history;
4
+ const middlewares = [];
4
5
  const events = ['pushState', 'replaceState'];
5
6
  events.forEach(e => {
6
7
  var original = history[e];
7
8
  history[e] = function () {
8
- original.apply(history, arguments);
9
+ let args = arguments;
10
+ for (const middleware of middlewares) {
11
+ args = middleware(e, args);
12
+ if (!args)
13
+ break;
14
+ }
15
+ args && original.apply(history, args);
9
16
  fireEvent(e);
10
17
  };
11
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"HistoryTools.js","sources":["../src/router/HistoryTools.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AAE/B,MAAM,MAAM,GAAG,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAC7C,MAAM,CAAC,OAAO,CAAC,CAAC,IAAG;AACf,IAAA,IAAI,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAC,CAAC,CAAC,GAAG,YAAA;AACT,QAAA,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACnC,SAAS,CAAC,CAAC,CAAC,CAAC;AACjB,KAAC,CAAA;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,CAAC,IAAI,KAAI;AACvB,IAAA,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AACnE,IAAA,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC,CAAC;AAEK,MAAM,YAAY,GAAG,CAAC,IAAY,KAAK,IAAI,KAAK,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;MAE3G,eAAe,GAAG,CAAC,IAAY,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;AAEtF,IAAI,MAAM,CAAC,4BAA4B,CAAC,EAAE;;;IAGtC,MAAM,CAAC,eAAe,CAAC,GAAG;QACtB,eAAe;KAClB,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"HistoryTools.js","sources":["../src/router/HistoryTools.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AAM/B,MAAM,WAAW,GAAwB,EAAE,CAAA;AAE3C,MAAM,MAAM,GAAoB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAC9D,MAAM,CAAC,OAAO,CAAC,CAAC,IAAG;AACf,IAAA,IAAI,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAC,CAAC,CAAC,GAAG,YAAA;QACT,IAAI,IAAI,GAAG,SAAqC,CAAC;AACjD,QAAA,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;AAClC,YAAA,IAAI,GAAG,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AAC1B,YAAA,IAAI,CAAC,IAAI;gBAAE,MAAK;AACnB,SAAA;QACD,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACtC,SAAS,CAAC,CAAC,CAAC,CAAC;AACjB,KAAC,CAAA;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,CAAC,IAAI,KAAI;AACvB,IAAA,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AACnE,IAAA,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC,CAAC;AAEK,MAAM,YAAY,GAAG,CAAC,IAAY,KAAK,IAAI,KAAK,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;MAE3G,eAAe,GAAG,CAAC,IAAY,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;AAUtF,IAAI,MAAM,CAAC,4BAA4B,CAAC,EAAE;;;IAGtC,MAAM,CAAC,eAAe,CAAC,GAAG;QACtB,eAAe;KAClB,CAAA;AACJ;;;;"}
@@ -2,11 +2,22 @@ import {WINDOW} from "../Tools";
2
2
 
3
3
  const history = WINDOW.history;
4
4
 
5
- const events = ['pushState', 'replaceState'];
5
+ type HistoryAction = 'pushState' | 'replaceState';
6
+ type HistoryActionArgs = Parameters<typeof history[HistoryAction]>;
7
+ type HistoryMiddleware = (action: HistoryAction, args: HistoryActionArgs) => HistoryActionArgs;
8
+
9
+ const middlewares: HistoryMiddleware[] = []
10
+
11
+ const events: HistoryAction[] = ['pushState', 'replaceState'];
6
12
  events.forEach(e => {
7
13
  var original = history[e];
8
14
  history[e] = function () {
9
- original.apply(history, arguments);
15
+ let args = arguments as any as HistoryActionArgs;
16
+ for (const middleware of middlewares) {
17
+ args = middleware(e, args)
18
+ if (!args) break
19
+ }
20
+ args && original.apply(history, args);
10
21
  fireEvent(e);
11
22
  }
12
23
  });
@@ -20,6 +31,14 @@ export const pushLocation = (path: string) => path !== WINDOW.location.pathname
20
31
 
21
32
  export const replaceLocation = (path: string) => history[events[1]](null, null, path);
22
33
 
34
+ export const addMiddleware = (middleware: HistoryMiddleware) => {
35
+ middlewares.push(middleware);
36
+ };
37
+ export const removeMiddleware = (middleware: HistoryMiddleware) => {
38
+ let index = middlewares.indexOf(middleware);
39
+ index !== -1 && middlewares.splice(index, 1);
40
+ };
41
+
23
42
  if (window['isNotProductionEnvironment']) {
24
43
  // will be removed in production build
25
44
  // needed only to prevent bundler to remove 'unused' functions
@@ -1,7 +1,7 @@
1
1
  import ReactConstants from "./ReactConstants"; import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./CommonFields"; import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers"; import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers"; import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers"; import React from 'react';
2
2
  import Route from "./Route";
3
3
  import {mount} from 'enzyme';
4
- import {pushLocation} from './HistoryTools'
4
+ import {pushLocation, addMiddleware, removeMiddleware} from './HistoryTools'
5
5
 
6
6
  it('renders exact path', () => {
7
7
  pushLocation('/test');
@@ -131,4 +131,28 @@ it('do not render if regex does not match ', () => {
131
131
  <WithVariable/>
132
132
  </Route>
133
133
  </div>)).toHaveHTML('<div></div>');
134
+ });
135
+
136
+ it('middleware test', () => {
137
+ let middleware = (action, args) => {
138
+ expect(action).toBe('pushState');
139
+ expect(__length(args)).toBe(3);
140
+ expect(args[0]).toBe(null);
141
+ expect(args[1]).toBe(null);
142
+ expect(args[2]).toBe('/to-rewrite');
143
+ return [null, null, '/']
144
+ };
145
+ addMiddleware(middleware)
146
+ pushLocation('/to-rewrite');
147
+ removeMiddleware(middleware)
148
+
149
+ expect(mount(<Route path="/">
150
+ <div>test</div>
151
+ </Route>)).toContainReact(<div>test</div>);
152
+
153
+
154
+ pushLocation('/to-rewrite');
155
+ expect(mount(<Route path="/to-rewrite">
156
+ <div>to-rewrite</div>
157
+ </Route>)).toContainReact(<div>to-rewrite</div>);
134
158
  });