@opengeoweb/theme 2.1.4 → 2.3.0

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/index.esm.js CHANGED
@@ -72,6 +72,93 @@ function _nonIterableRest() {
72
72
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
73
73
  }
74
74
 
75
+ /* *
76
+ * Licensed under the Apache License, Version 2.0 (the "License");
77
+ * you may not use this file except in compliance with the License.
78
+ * You may obtain a copy of the License at
79
+ *
80
+ * http://www.apache.org/licenses/LICENSE-2.0
81
+ *
82
+ * Unless required by applicable law or agreed to in writing, software
83
+ * distributed under the License is distributed on an "AS IS" BASIS,
84
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
85
+ * See the License for the specific language governing permissions and
86
+ * limitations under the License.
87
+ *
88
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
89
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
90
+ * */
91
+ var gwButtonVariants = ['primary', 'secondary', 'tertiary', 'flat', 'tool', 'boxed'];
92
+
93
+ var defaultButtonStyle = function defaultButtonStyle(button) {
94
+ return {
95
+ // default styling
96
+ color: button["default"].color,
97
+ backgroundColor: button["default"].fill,
98
+ textTransform: 'capitalize',
99
+ // hover styling
100
+ '&:hover': {
101
+ backgroundColor: button.mouseOver.fill,
102
+ borderColor: button.mouseOver.borderColor
103
+ },
104
+ // active styling
105
+ '&.Mui-selected': {
106
+ backgroundColor: button.active.fill,
107
+ color: button.active.color,
108
+ borderColor: button.active.borderColor,
109
+ '&:hover': {
110
+ backgroundColor: button.activeMouseOver.fill
111
+ }
112
+ },
113
+ // disabled styling
114
+ '&.Mui-disabled': {
115
+ backgroundColor: button.disabled.fill,
116
+ color: button.disabled.color,
117
+ borderColor: button.disabled.borderColor
118
+ }
119
+ };
120
+ };
121
+ var buttonStyle = function buttonStyle(button) {
122
+ return Object.assign(Object.assign({}, defaultButtonStyle(button)), {
123
+ padding: '12px 8px',
124
+ height: '40px',
125
+ borderStyle: 'solid',
126
+ borderWidth: '1px',
127
+ borderColor: button["default"].borderColor,
128
+ borderRadius: '5px',
129
+ // size styling
130
+ '&[class*="sizeSmall"]': {
131
+ fontSize: '12px',
132
+ height: '32px',
133
+ lineHeight: '12px'
134
+ },
135
+ // icon styling
136
+ '& .MuiButton-startIcon': {
137
+ marginRight: '2px',
138
+ '& .MuiSvgIcon-root': {
139
+ fontSize: '26px'
140
+ }
141
+ }
142
+ });
143
+ };
144
+ var variantsToClassName = function variantsToClassName(buttonVariants) {
145
+ return buttonVariants.reduce(function (variants, _ref) {
146
+ var variant = _ref.props.variant,
147
+ style = _ref.style;
148
+ return Object.assign(Object.assign({}, variants), _defineProperty({}, "&.".concat(variant), style));
149
+ }, {});
150
+ };
151
+ var buttonVariants = function buttonVariants(buttons) {
152
+ return gwButtonVariants.map(function (variant) {
153
+ return {
154
+ props: {
155
+ variant: variant
156
+ },
157
+ style: buttonStyle(buttons[variant])
158
+ };
159
+ });
160
+ };
161
+
75
162
  var hex2rgba = function hex2rgba(hex) {
76
163
  var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
77
164
 
@@ -146,23 +233,36 @@ var createTheme = function createTheme(paletteType, geowebColors, shadows) {
146
233
  },
147
234
  shadows: shadows,
148
235
  components: {
236
+ MuiButton: {
237
+ variants: buttonVariants(geowebColors.buttons)
238
+ },
239
+ MuiToggleButton: {
240
+ styleOverrides: {
241
+ root: variantsToClassName(buttonVariants(geowebColors.buttons))
242
+ }
243
+ },
244
+ MuiIconButton: {
245
+ // TODO: https://gitlab.com/opengeoweb/opengeoweb/-/issues/1926 remove default styling and create CustomIconButton
246
+ styleOverrides: {
247
+ root: defaultButtonStyle(geowebColors.buttons.flat)
248
+ }
249
+ },
149
250
  MuiCssBaseline: {
150
251
  styleOverrides: "\n html {\n -webkit-font-smoothing: auto;\n }\n "
151
252
  },
152
253
  MuiMenuItem: {
153
254
  styleOverrides: {
154
255
  root: {
256
+ minHeight: '48px!important',
155
257
  fontSize: '0.875rem',
156
258
  letterSpacing: '0.25px',
157
- ':not(:last-child)&:after': {
158
- content: '""',
159
- position: 'absolute',
160
- width: '100%',
161
- height: 1,
162
- background: geowebColors.greys.accessible,
163
- bottom: 0,
164
- left: 0,
165
- opacity: 0.5
259
+ divider: {
260
+ borderBottomColor: geowebColors.greys.accessibleLight
261
+ },
262
+ li: {
263
+ '&:hover': {
264
+ backgroundColor: geowebColors.tab.mouseOver.rgba
265
+ }
166
266
  },
167
267
  '&.Mui-selected': {
168
268
  background: 'none',
@@ -313,13 +413,23 @@ var createTheme = function createTheme(paletteType, geowebColors, shadows) {
313
413
  styleOverrides: {
314
414
  root: {
315
415
  color: geowebColors.typographyAndIcons.text,
316
- fontSize: '14px'
416
+ fontSize: '14px',
417
+ minHeight: '36px'
317
418
  },
318
419
  divider: {
319
420
  borderBottomColor: hex2rgba(geowebColors.greys.accessible, 0.2)
320
421
  }
321
422
  }
322
423
  },
424
+ MuiListItemIcon: {
425
+ styleOverrides: {
426
+ root: {
427
+ color: geowebColors.typographyAndIcons.icon,
428
+ width: '24px',
429
+ height: '24px'
430
+ }
431
+ }
432
+ },
323
433
  MuiBackdrop: {
324
434
  styleOverrides: {
325
435
  root: {
@@ -388,20 +498,33 @@ var createTheme = function createTheme(paletteType, geowebColors, shadows) {
388
498
  }
389
499
  }
390
500
  },
501
+ MuiTextField: {
502
+ defaultProps: {
503
+ variant: 'filled'
504
+ }
505
+ },
391
506
  MuiFilledInput: {
392
507
  styleOverrides: {
393
508
  root: {
394
509
  backgroundColor: geowebColors.textInputField["default"].rgba,
395
510
  '&.Mui-focused': {
396
- backgroundColor: geowebColors.textInputField.active.rgba
511
+ backgroundColor: geowebColors.textInputField.active.rgba,
512
+ '&:after': {
513
+ borderColor: 'transparent'
514
+ }
397
515
  },
398
516
  '&.Mui-disabled': {
399
517
  backgroundColor: geowebColors.textInputField.disabled.rgba
518
+ },
519
+ '&.Mui-error': {
520
+ '&:after': {
521
+ borderColor: geowebColors.captions.captionError.color
522
+ }
400
523
  }
401
524
  },
402
525
  underline: {
403
526
  '&:after': {
404
- borderBottom: 'transparent'
527
+ borderWidth: '1px'
405
528
  },
406
529
  '&.Mui-disabled:before': {
407
530
  borderBottomStyle: 'solid'
@@ -477,25 +600,161 @@ var colors$1 = {
477
600
  },
478
601
  buttons: {
479
602
  primary: {
480
- fill: '#186DFF'
603
+ "default": {
604
+ fill: '#186DFF',
605
+ color: '#FFFFFF',
606
+ borderColor: 'transparent'
607
+ },
608
+ mouseOver: {
609
+ fill: '#1047B0',
610
+ color: '#FFFFFF',
611
+ borderColor: '#71A6FF'
612
+ },
613
+ active: {
614
+ fill: '#186DFF',
615
+ color: '#FFFFFF',
616
+ borderColor: 'transparent'
617
+ },
618
+ activeMouseOver: {},
619
+ disabled: {
620
+ fill: 'transparent',
621
+ color: '#707070',
622
+ borderColor: 'transparent'
623
+ }
481
624
  },
482
- primaryMouseover: {
483
- fill: '#1047B0'
625
+ secondary: {
626
+ "default": {
627
+ fill: '#0876b6',
628
+ color: '#FFFFFF',
629
+ borderColor: 'transparent'
630
+ },
631
+ mouseOver: {
632
+ fill: '#064c84',
633
+ color: '#FFFFFF',
634
+ borderColor: '#3DA6FF'
635
+ },
636
+ active: {
637
+ fill: '#0876b6',
638
+ color: '#FFFFFF',
639
+ borderColor: 'transparent'
640
+ },
641
+ activeMouseOver: {},
642
+ disabled: {
643
+ fill: 'transparent',
644
+ color: '#707070',
645
+ borderColor: 'transparent'
646
+ }
484
647
  },
485
- primaryActive: {
486
- fill: '#186DFF'
648
+ tertiary: {
649
+ "default": {
650
+ fill: 'transparent',
651
+ color: '#575F7A',
652
+ borderColor: '#575F7A'
653
+ },
654
+ mouseOver: {
655
+ fill: '#E3E4E7',
656
+ color: '#575F7A',
657
+ borderColor: '#575F7A'
658
+ },
659
+ active: {
660
+ fill: 'transparent',
661
+ color: '#186DFF',
662
+ borderColor: '#186DFF'
663
+ },
664
+ activeMouseOver: {
665
+ fill: 'rgba(24, 109, 255, 0.1)',
666
+ color: '#186DFF',
667
+ borderColor: '#186DFF'
668
+ },
669
+ disabled: {
670
+ fill: 'transparent',
671
+ color: '#707070',
672
+ borderColor: 'transparent'
673
+ }
487
674
  },
488
- flatMouseover: {
489
- fill: '#E3E4E7'
675
+ flat: {
676
+ "default": {
677
+ fill: 'transparent',
678
+ color: '#575F7A',
679
+ borderColor: 'transparent'
680
+ },
681
+ mouseOver: {
682
+ fill: '#E3E4E7',
683
+ color: '#575F7A',
684
+ borderColor: 'transparent'
685
+ },
686
+ active: {
687
+ fill: 'transparent',
688
+ color: '#186DFF',
689
+ borderColor: 'transparent'
690
+ },
691
+ activeMouseOver: {
692
+ fill: 'rgba(24, 109, 255, 0.1)',
693
+ color: '#186DFF',
694
+ borderColor: 'transparent'
695
+ },
696
+ disabled: {
697
+ fill: 'transparent',
698
+ color: '#707070',
699
+ borderColor: 'transparent'
700
+ }
490
701
  },
491
- focusDefault: {
492
- outline: 'solid 2px #419cfe'
702
+ tool: {
703
+ "default": {
704
+ fill: '#ECEDEE',
705
+ color: '#575F7A',
706
+ borderColor: 'transparent'
707
+ },
708
+ mouseOver: {
709
+ fill: '#E3E4E7',
710
+ color: '#575F7A',
711
+ borderColor: 'transparent'
712
+ },
713
+ active: {
714
+ fill: '#186DFF',
715
+ color: '#FFFFFF',
716
+ borderColor: 'transparent'
717
+ },
718
+ activeMouseOver: {
719
+ fill: '#1047B0',
720
+ color: '#FFFFFF',
721
+ borderColor: 'transparent'
722
+ },
723
+ disabled: {
724
+ fill: 'transparent',
725
+ color: '#707070',
726
+ borderColor: 'transparent'
727
+ }
493
728
  },
494
- disabled: {
495
- fill: '#E8E5E5'
729
+ boxed: {
730
+ "default": {
731
+ fill: 'transparent',
732
+ color: '#575F7A',
733
+ borderColor: '#575f7a'
734
+ },
735
+ mouseOver: {
736
+ fill: '#E3E4E7',
737
+ color: '#575F7A',
738
+ borderColor: '#575f7a'
739
+ },
740
+ active: {
741
+ fill: '#186DFF',
742
+ color: '#FFFFFF',
743
+ borderColor: 'transparent'
744
+ },
745
+ activeMouseOver: {
746
+ fill: '#1047B0',
747
+ color: '#FFFFFF',
748
+ borderColor: 'transparent'
749
+ },
750
+ disabled: {
751
+ fill: 'transparent',
752
+ color: '#707070',
753
+ borderColor: 'transparent'
754
+ }
496
755
  },
497
- surfaceIconDefault: {
498
- fill: '#F5F5F5'
756
+ focusDefault: {
757
+ outline: 'solid 2px #419cfe'
499
758
  }
500
759
  },
501
760
  typographyAndIcons: {
@@ -528,7 +787,8 @@ var colors$1 = {
528
787
  }
529
788
  },
530
789
  greys: {
531
- accessible: '#767676'
790
+ accessible: '#767676',
791
+ accessibleLight: '#C5C5C5'
532
792
  },
533
793
  cards: {
534
794
  cardContainer: '#FFFFFF',
@@ -648,10 +908,6 @@ var colors$1 = {
648
908
  }
649
909
  },
650
910
  layerManager: {
651
- tableRowDefaultIcon: {
652
- fill: '#051039',
653
- opacity: 0.67
654
- },
655
911
  tableRowDefaultText: {
656
912
  color: '#051039',
657
913
  opacity: 0.87,
@@ -665,9 +921,6 @@ var colors$1 = {
665
921
  fill: '#051039',
666
922
  opacity: 0.07
667
923
  },
668
- tableRowDisabledIcon: {
669
- fill: '#767676'
670
- },
671
924
  tableRowDisabledText: {
672
925
  color: '#767676',
673
926
  opacity: 0.87,
@@ -701,7 +954,7 @@ var colors$1 = {
701
954
  opacity: 1
702
955
  },
703
956
  captionDisabled: {
704
- color: '#767676',
957
+ color: '#707070',
705
958
  opacity: 1
706
959
  }
707
960
  }
@@ -1012,6 +1265,14 @@ var GWTheme = createTheme$1({
1012
1265
  maxWidth: '1280px'
1013
1266
  }
1014
1267
  }
1268
+ },
1269
+ MuiButton: {
1270
+ variants: buttonVariants(geowebColors.buttons)
1271
+ },
1272
+ MuiToggleButton: {
1273
+ styleOverrides: {
1274
+ root: variantsToClassName(buttonVariants(geowebColors.buttons))
1275
+ }
1015
1276
  }
1016
1277
  }
1017
1278
  });
@@ -1071,25 +1332,161 @@ var colors = {
1071
1332
  },
1072
1333
  buttons: {
1073
1334
  primary: {
1074
- fill: '#186DFF'
1335
+ "default": {
1336
+ fill: '#186DFF',
1337
+ color: '#FFFFFF',
1338
+ borderColor: 'transparent'
1339
+ },
1340
+ mouseOver: {
1341
+ fill: '#1047B0',
1342
+ color: '#FFFFFF',
1343
+ borderColor: '#71A6FF'
1344
+ },
1345
+ active: {
1346
+ fill: '#186DFF',
1347
+ color: '#FFFFFF',
1348
+ borderColor: 'transparent'
1349
+ },
1350
+ activeMouseOver: {},
1351
+ disabled: {
1352
+ fill: 'transparent',
1353
+ color: '#B0B0B0',
1354
+ borderColor: 'transparent'
1355
+ }
1356
+ },
1357
+ secondary: {
1358
+ "default": {
1359
+ fill: '#0876b6',
1360
+ color: '#FFFFFF',
1361
+ borderColor: 'transparent'
1362
+ },
1363
+ mouseOver: {
1364
+ fill: '#064C84',
1365
+ color: '#FFFFFF',
1366
+ borderColor: '#3DA6FF'
1367
+ },
1368
+ active: {
1369
+ fill: '#0876B6',
1370
+ color: '#FFFFFF',
1371
+ borderColor: 'transparent'
1372
+ },
1373
+ activeMouseOver: {},
1374
+ disabled: {
1375
+ fill: 'transparent',
1376
+ color: '#707070',
1377
+ borderColor: 'transparent'
1378
+ }
1075
1379
  },
1076
- primaryMouseover: {
1077
- fill: '#1047B0'
1380
+ tertiary: {
1381
+ "default": {
1382
+ fill: 'transparent',
1383
+ color: '#E5E5E5',
1384
+ borderColor: '#E5E5E5'
1385
+ },
1386
+ mouseOver: {
1387
+ fill: '#494949',
1388
+ color: '#E5E5E5',
1389
+ borderColor: '#E5E5E5'
1390
+ },
1391
+ active: {
1392
+ fill: 'transparent',
1393
+ color: '#488BFD',
1394
+ borderColor: '#48A8FA'
1395
+ },
1396
+ activeMouseOver: {
1397
+ fill: 'rgba(24, 109, 255, 0.1)',
1398
+ color: '#488BFD',
1399
+ borderColor: '#488BFD'
1400
+ },
1401
+ disabled: {
1402
+ fill: 'transparent',
1403
+ color: '#B0B0B0',
1404
+ borderColor: 'transparent'
1405
+ }
1078
1406
  },
1079
- primaryActive: {
1080
- fill: '#186DFF'
1407
+ flat: {
1408
+ "default": {
1409
+ fill: 'transparent',
1410
+ color: '#E5E5E5',
1411
+ borderColor: 'transparent'
1412
+ },
1413
+ mouseOver: {
1414
+ fill: '#494949',
1415
+ color: '#E5E5E5',
1416
+ borderColor: 'transparent'
1417
+ },
1418
+ active: {
1419
+ fill: 'transparent',
1420
+ color: '#488BFD',
1421
+ borderColor: 'transparent'
1422
+ },
1423
+ activeMouseOver: {
1424
+ fill: 'rgba(24, 109, 255, 0.1)',
1425
+ color: '#488BFD',
1426
+ borderColor: 'transparent'
1427
+ },
1428
+ disabled: {
1429
+ fill: 'transparent',
1430
+ color: '#B0B0B0',
1431
+ borderColor: 'transparent'
1432
+ }
1081
1433
  },
1082
- flatMouseover: {
1083
- fill: '#494949'
1434
+ tool: {
1435
+ "default": {
1436
+ fill: '#393939',
1437
+ color: '#E5E5E5',
1438
+ borderColor: 'transparent'
1439
+ },
1440
+ mouseOver: {
1441
+ fill: '#494949',
1442
+ color: '#E5E5E5',
1443
+ borderColor: 'transparent'
1444
+ },
1445
+ active: {
1446
+ fill: '#186DFF',
1447
+ color: '#FFFFFF',
1448
+ borderColor: 'transparent'
1449
+ },
1450
+ activeMouseOver: {
1451
+ fill: '#1047B0',
1452
+ color: '#FFFFFF',
1453
+ borderColor: 'transparent'
1454
+ },
1455
+ disabled: {
1456
+ fill: 'transparent',
1457
+ color: '#B0B0B0',
1458
+ borderColor: 'transparent'
1459
+ }
1460
+ },
1461
+ boxed: {
1462
+ "default": {
1463
+ fill: 'transparent',
1464
+ color: '#E5E5E5',
1465
+ borderColor: '#e5e5e5'
1466
+ },
1467
+ mouseOver: {
1468
+ fill: '#494949',
1469
+ color: '#E5E5E5',
1470
+ borderColor: '#e5e5e5'
1471
+ },
1472
+ active: {
1473
+ fill: '#186DFF',
1474
+ color: '#FFFFFF',
1475
+ borderColor: 'transparent'
1476
+ },
1477
+ activeMouseOver: {
1478
+ fill: '#1047B0',
1479
+ color: '#FFFFFF',
1480
+ borderColor: 'transparent'
1481
+ },
1482
+ disabled: {
1483
+ fill: 'transparent',
1484
+ color: '#B0B0B0',
1485
+ borderColor: 'transparent'
1486
+ }
1084
1487
  },
1085
1488
  focusDefault: {
1086
1489
  outline: 'solid 2px #419cfe'
1087
- },
1088
- disabled: {
1089
- fill: '#303030'
1090
- },
1091
- surfaceIconDefault: {
1092
- fill: '#2B2B2B'
1093
1490
  }
1094
1491
  },
1095
1492
  typographyAndIcons: {
@@ -1122,7 +1519,8 @@ var colors = {
1122
1519
  }
1123
1520
  },
1124
1521
  greys: {
1125
- accessible: '#A2A2A2'
1522
+ accessible: '#A2A2A2',
1523
+ accessibleLight: '#6F6F6F'
1126
1524
  },
1127
1525
  cards: {
1128
1526
  cardContainer: '#303030',
@@ -1242,10 +1640,6 @@ var colors = {
1242
1640
  }
1243
1641
  },
1244
1642
  layerManager: {
1245
- tableRowDefaultIcon: {
1246
- fill: '#C5C5C5',
1247
- opacity: 1
1248
- },
1249
1643
  tableRowDefaultText: {
1250
1644
  color: '#FFFFFF',
1251
1645
  opacity: 0.87,
@@ -1259,9 +1653,6 @@ var colors = {
1259
1653
  fill: '#000000',
1260
1654
  opacity: 0.15
1261
1655
  },
1262
- tableRowDisabledIcon: {
1263
- fill: '#A2A2A2'
1264
- },
1265
1656
  tableRowDisabledText: {
1266
1657
  color: '#909090',
1267
1658
  opacity: 0.87,
@@ -1295,7 +1686,7 @@ var colors = {
1295
1686
  opacity: 1
1296
1687
  },
1297
1688
  captionDisabled: {
1298
- color: '#909090',
1689
+ color: '#B0B0B0',
1299
1690
  opacity: 1
1300
1691
  }
1301
1692
  }
@@ -1376,4 +1767,4 @@ var ThemeWrapperOldTheme = function ThemeWrapperOldTheme(_a) {
1376
1767
  }, props), children);
1377
1768
  };
1378
1769
 
1379
- export { GWTheme, ThemeContext, ThemeProvider, ThemeWrapper, ThemeWrapperOldTheme, darkTheme, lightTheme, useThemeContext };
1770
+ export { GWTheme, ThemeContext, ThemeProvider, ThemeWrapper, ThemeWrapperOldTheme, darkTheme, gwButtonVariants, lightTheme, useThemeContext };