@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.umd.js CHANGED
@@ -79,6 +79,95 @@
79
79
  return ar;
80
80
  }
81
81
 
82
+ /* *
83
+ * Licensed under the Apache License, Version 2.0 (the "License");
84
+ * you may not use this file except in compliance with the License.
85
+ * You may obtain a copy of the License at
86
+ *
87
+ * http://www.apache.org/licenses/LICENSE-2.0
88
+ *
89
+ * Unless required by applicable law or agreed to in writing, software
90
+ * distributed under the License is distributed on an "AS IS" BASIS,
91
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
92
+ * See the License for the specific language governing permissions and
93
+ * limitations under the License.
94
+ *
95
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
96
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
97
+ * */
98
+ var gwButtonVariants = ['primary', 'secondary', 'tertiary', 'flat', 'tool', 'boxed'];
99
+
100
+ var defaultButtonStyle = function defaultButtonStyle(button) {
101
+ return {
102
+ // default styling
103
+ color: button["default"].color,
104
+ backgroundColor: button["default"].fill,
105
+ textTransform: 'capitalize',
106
+ // hover styling
107
+ '&:hover': {
108
+ backgroundColor: button.mouseOver.fill,
109
+ borderColor: button.mouseOver.borderColor
110
+ },
111
+ // active styling
112
+ '&.Mui-selected': {
113
+ backgroundColor: button.active.fill,
114
+ color: button.active.color,
115
+ borderColor: button.active.borderColor,
116
+ '&:hover': {
117
+ backgroundColor: button.activeMouseOver.fill
118
+ }
119
+ },
120
+ // disabled styling
121
+ '&.Mui-disabled': {
122
+ backgroundColor: button.disabled.fill,
123
+ color: button.disabled.color,
124
+ borderColor: button.disabled.borderColor
125
+ }
126
+ };
127
+ };
128
+ var buttonStyle = function buttonStyle(button) {
129
+ return __assign(__assign({}, defaultButtonStyle(button)), {
130
+ padding: '12px 8px',
131
+ height: '40px',
132
+ borderStyle: 'solid',
133
+ borderWidth: '1px',
134
+ borderColor: button["default"].borderColor,
135
+ borderRadius: '5px',
136
+ // size styling
137
+ '&[class*="sizeSmall"]': {
138
+ fontSize: '12px',
139
+ height: '32px',
140
+ lineHeight: '12px'
141
+ },
142
+ // icon styling
143
+ '& .MuiButton-startIcon': {
144
+ marginRight: '2px',
145
+ '& .MuiSvgIcon-root': {
146
+ fontSize: '26px'
147
+ }
148
+ }
149
+ });
150
+ };
151
+ var variantsToClassName = function variantsToClassName(buttonVariants) {
152
+ return buttonVariants.reduce(function (variants, _a) {
153
+ var _b;
154
+
155
+ var variant = _a.props.variant,
156
+ style = _a.style;
157
+ return __assign(__assign({}, variants), (_b = {}, _b["&." + variant] = style, _b));
158
+ }, {});
159
+ };
160
+ var buttonVariants = function buttonVariants(buttons) {
161
+ return gwButtonVariants.map(function (variant) {
162
+ return {
163
+ props: {
164
+ variant: variant
165
+ },
166
+ style: buttonStyle(buttons[variant])
167
+ };
168
+ });
169
+ };
170
+
82
171
  var hex2rgba = function hex2rgba(hex, alpha) {
83
172
  if (alpha === void 0) {
84
173
  alpha = 1;
@@ -158,23 +247,36 @@
158
247
  },
159
248
  shadows: shadows,
160
249
  components: {
250
+ MuiButton: {
251
+ variants: buttonVariants(geowebColors.buttons)
252
+ },
253
+ MuiToggleButton: {
254
+ styleOverrides: {
255
+ root: variantsToClassName(buttonVariants(geowebColors.buttons))
256
+ }
257
+ },
258
+ MuiIconButton: {
259
+ // TODO: https://gitlab.com/opengeoweb/opengeoweb/-/issues/1926 remove default styling and create CustomIconButton
260
+ styleOverrides: {
261
+ root: defaultButtonStyle(geowebColors.buttons.flat)
262
+ }
263
+ },
161
264
  MuiCssBaseline: {
162
265
  styleOverrides: "\n html {\n -webkit-font-smoothing: auto;\n }\n "
163
266
  },
164
267
  MuiMenuItem: {
165
268
  styleOverrides: {
166
269
  root: {
270
+ minHeight: '48px!important',
167
271
  fontSize: '0.875rem',
168
272
  letterSpacing: '0.25px',
169
- ':not(:last-child)&:after': {
170
- content: '""',
171
- position: 'absolute',
172
- width: '100%',
173
- height: 1,
174
- background: geowebColors.greys.accessible,
175
- bottom: 0,
176
- left: 0,
177
- opacity: 0.5
273
+ divider: {
274
+ borderBottomColor: geowebColors.greys.accessibleLight
275
+ },
276
+ li: {
277
+ '&:hover': {
278
+ backgroundColor: geowebColors.tab.mouseOver.rgba
279
+ }
178
280
  },
179
281
  '&.Mui-selected': {
180
282
  background: 'none',
@@ -325,13 +427,23 @@
325
427
  styleOverrides: {
326
428
  root: {
327
429
  color: geowebColors.typographyAndIcons.text,
328
- fontSize: '14px'
430
+ fontSize: '14px',
431
+ minHeight: '36px'
329
432
  },
330
433
  divider: {
331
434
  borderBottomColor: hex2rgba(geowebColors.greys.accessible, 0.2)
332
435
  }
333
436
  }
334
437
  },
438
+ MuiListItemIcon: {
439
+ styleOverrides: {
440
+ root: {
441
+ color: geowebColors.typographyAndIcons.icon,
442
+ width: '24px',
443
+ height: '24px'
444
+ }
445
+ }
446
+ },
335
447
  MuiBackdrop: {
336
448
  styleOverrides: {
337
449
  root: {
@@ -400,20 +512,33 @@
400
512
  }
401
513
  }
402
514
  },
515
+ MuiTextField: {
516
+ defaultProps: {
517
+ variant: 'filled'
518
+ }
519
+ },
403
520
  MuiFilledInput: {
404
521
  styleOverrides: {
405
522
  root: {
406
523
  backgroundColor: geowebColors.textInputField["default"].rgba,
407
524
  '&.Mui-focused': {
408
- backgroundColor: geowebColors.textInputField.active.rgba
525
+ backgroundColor: geowebColors.textInputField.active.rgba,
526
+ '&:after': {
527
+ borderColor: 'transparent'
528
+ }
409
529
  },
410
530
  '&.Mui-disabled': {
411
531
  backgroundColor: geowebColors.textInputField.disabled.rgba
532
+ },
533
+ '&.Mui-error': {
534
+ '&:after': {
535
+ borderColor: geowebColors.captions.captionError.color
536
+ }
412
537
  }
413
538
  },
414
539
  underline: {
415
540
  '&:after': {
416
- borderBottom: 'transparent'
541
+ borderWidth: '1px'
417
542
  },
418
543
  '&.Mui-disabled:before': {
419
544
  borderBottomStyle: 'solid'
@@ -489,25 +614,161 @@
489
614
  },
490
615
  buttons: {
491
616
  primary: {
492
- fill: '#186DFF'
617
+ "default": {
618
+ fill: '#186DFF',
619
+ color: '#FFFFFF',
620
+ borderColor: 'transparent'
621
+ },
622
+ mouseOver: {
623
+ fill: '#1047B0',
624
+ color: '#FFFFFF',
625
+ borderColor: '#71A6FF'
626
+ },
627
+ active: {
628
+ fill: '#186DFF',
629
+ color: '#FFFFFF',
630
+ borderColor: 'transparent'
631
+ },
632
+ activeMouseOver: {},
633
+ disabled: {
634
+ fill: 'transparent',
635
+ color: '#707070',
636
+ borderColor: 'transparent'
637
+ }
638
+ },
639
+ secondary: {
640
+ "default": {
641
+ fill: '#0876b6',
642
+ color: '#FFFFFF',
643
+ borderColor: 'transparent'
644
+ },
645
+ mouseOver: {
646
+ fill: '#064c84',
647
+ color: '#FFFFFF',
648
+ borderColor: '#3DA6FF'
649
+ },
650
+ active: {
651
+ fill: '#0876b6',
652
+ color: '#FFFFFF',
653
+ borderColor: 'transparent'
654
+ },
655
+ activeMouseOver: {},
656
+ disabled: {
657
+ fill: 'transparent',
658
+ color: '#707070',
659
+ borderColor: 'transparent'
660
+ }
661
+ },
662
+ tertiary: {
663
+ "default": {
664
+ fill: 'transparent',
665
+ color: '#575F7A',
666
+ borderColor: '#575F7A'
667
+ },
668
+ mouseOver: {
669
+ fill: '#E3E4E7',
670
+ color: '#575F7A',
671
+ borderColor: '#575F7A'
672
+ },
673
+ active: {
674
+ fill: 'transparent',
675
+ color: '#186DFF',
676
+ borderColor: '#186DFF'
677
+ },
678
+ activeMouseOver: {
679
+ fill: 'rgba(24, 109, 255, 0.1)',
680
+ color: '#186DFF',
681
+ borderColor: '#186DFF'
682
+ },
683
+ disabled: {
684
+ fill: 'transparent',
685
+ color: '#707070',
686
+ borderColor: 'transparent'
687
+ }
493
688
  },
494
- primaryMouseover: {
495
- fill: '#1047B0'
689
+ flat: {
690
+ "default": {
691
+ fill: 'transparent',
692
+ color: '#575F7A',
693
+ borderColor: 'transparent'
694
+ },
695
+ mouseOver: {
696
+ fill: '#E3E4E7',
697
+ color: '#575F7A',
698
+ borderColor: 'transparent'
699
+ },
700
+ active: {
701
+ fill: 'transparent',
702
+ color: '#186DFF',
703
+ borderColor: 'transparent'
704
+ },
705
+ activeMouseOver: {
706
+ fill: 'rgba(24, 109, 255, 0.1)',
707
+ color: '#186DFF',
708
+ borderColor: 'transparent'
709
+ },
710
+ disabled: {
711
+ fill: 'transparent',
712
+ color: '#707070',
713
+ borderColor: 'transparent'
714
+ }
496
715
  },
497
- primaryActive: {
498
- fill: '#186DFF'
716
+ tool: {
717
+ "default": {
718
+ fill: '#ECEDEE',
719
+ color: '#575F7A',
720
+ borderColor: 'transparent'
721
+ },
722
+ mouseOver: {
723
+ fill: '#E3E4E7',
724
+ color: '#575F7A',
725
+ borderColor: 'transparent'
726
+ },
727
+ active: {
728
+ fill: '#186DFF',
729
+ color: '#FFFFFF',
730
+ borderColor: 'transparent'
731
+ },
732
+ activeMouseOver: {
733
+ fill: '#1047B0',
734
+ color: '#FFFFFF',
735
+ borderColor: 'transparent'
736
+ },
737
+ disabled: {
738
+ fill: 'transparent',
739
+ color: '#707070',
740
+ borderColor: 'transparent'
741
+ }
499
742
  },
500
- flatMouseover: {
501
- fill: '#E3E4E7'
743
+ boxed: {
744
+ "default": {
745
+ fill: 'transparent',
746
+ color: '#575F7A',
747
+ borderColor: '#575f7a'
748
+ },
749
+ mouseOver: {
750
+ fill: '#E3E4E7',
751
+ color: '#575F7A',
752
+ borderColor: '#575f7a'
753
+ },
754
+ active: {
755
+ fill: '#186DFF',
756
+ color: '#FFFFFF',
757
+ borderColor: 'transparent'
758
+ },
759
+ activeMouseOver: {
760
+ fill: '#1047B0',
761
+ color: '#FFFFFF',
762
+ borderColor: 'transparent'
763
+ },
764
+ disabled: {
765
+ fill: 'transparent',
766
+ color: '#707070',
767
+ borderColor: 'transparent'
768
+ }
502
769
  },
503
770
  focusDefault: {
504
771
  outline: 'solid 2px #419cfe'
505
- },
506
- disabled: {
507
- fill: '#E8E5E5'
508
- },
509
- surfaceIconDefault: {
510
- fill: '#F5F5F5'
511
772
  }
512
773
  },
513
774
  typographyAndIcons: {
@@ -540,7 +801,8 @@
540
801
  }
541
802
  },
542
803
  greys: {
543
- accessible: '#767676'
804
+ accessible: '#767676',
805
+ accessibleLight: '#C5C5C5'
544
806
  },
545
807
  cards: {
546
808
  cardContainer: '#FFFFFF',
@@ -660,10 +922,6 @@
660
922
  }
661
923
  },
662
924
  layerManager: {
663
- tableRowDefaultIcon: {
664
- fill: '#051039',
665
- opacity: 0.67
666
- },
667
925
  tableRowDefaultText: {
668
926
  color: '#051039',
669
927
  opacity: 0.87,
@@ -677,9 +935,6 @@
677
935
  fill: '#051039',
678
936
  opacity: 0.07
679
937
  },
680
- tableRowDisabledIcon: {
681
- fill: '#767676'
682
- },
683
938
  tableRowDisabledText: {
684
939
  color: '#767676',
685
940
  opacity: 0.87,
@@ -713,7 +968,7 @@
713
968
  opacity: 1
714
969
  },
715
970
  captionDisabled: {
716
- color: '#767676',
971
+ color: '#707070',
717
972
  opacity: 1
718
973
  }
719
974
  }
@@ -1008,6 +1263,14 @@
1008
1263
  maxWidth: '1280px'
1009
1264
  }
1010
1265
  }
1266
+ },
1267
+ MuiButton: {
1268
+ variants: buttonVariants(geowebColors.buttons)
1269
+ },
1270
+ MuiToggleButton: {
1271
+ styleOverrides: {
1272
+ root: variantsToClassName(buttonVariants(geowebColors.buttons))
1273
+ }
1011
1274
  }
1012
1275
  }
1013
1276
  });
@@ -1040,25 +1303,161 @@
1040
1303
  },
1041
1304
  buttons: {
1042
1305
  primary: {
1043
- fill: '#186DFF'
1306
+ "default": {
1307
+ fill: '#186DFF',
1308
+ color: '#FFFFFF',
1309
+ borderColor: 'transparent'
1310
+ },
1311
+ mouseOver: {
1312
+ fill: '#1047B0',
1313
+ color: '#FFFFFF',
1314
+ borderColor: '#71A6FF'
1315
+ },
1316
+ active: {
1317
+ fill: '#186DFF',
1318
+ color: '#FFFFFF',
1319
+ borderColor: 'transparent'
1320
+ },
1321
+ activeMouseOver: {},
1322
+ disabled: {
1323
+ fill: 'transparent',
1324
+ color: '#B0B0B0',
1325
+ borderColor: 'transparent'
1326
+ }
1044
1327
  },
1045
- primaryMouseover: {
1046
- fill: '#1047B0'
1328
+ secondary: {
1329
+ "default": {
1330
+ fill: '#0876b6',
1331
+ color: '#FFFFFF',
1332
+ borderColor: 'transparent'
1333
+ },
1334
+ mouseOver: {
1335
+ fill: '#064C84',
1336
+ color: '#FFFFFF',
1337
+ borderColor: '#3DA6FF'
1338
+ },
1339
+ active: {
1340
+ fill: '#0876B6',
1341
+ color: '#FFFFFF',
1342
+ borderColor: 'transparent'
1343
+ },
1344
+ activeMouseOver: {},
1345
+ disabled: {
1346
+ fill: 'transparent',
1347
+ color: '#707070',
1348
+ borderColor: 'transparent'
1349
+ }
1047
1350
  },
1048
- primaryActive: {
1049
- fill: '#186DFF'
1351
+ tertiary: {
1352
+ "default": {
1353
+ fill: 'transparent',
1354
+ color: '#E5E5E5',
1355
+ borderColor: '#E5E5E5'
1356
+ },
1357
+ mouseOver: {
1358
+ fill: '#494949',
1359
+ color: '#E5E5E5',
1360
+ borderColor: '#E5E5E5'
1361
+ },
1362
+ active: {
1363
+ fill: 'transparent',
1364
+ color: '#488BFD',
1365
+ borderColor: '#48A8FA'
1366
+ },
1367
+ activeMouseOver: {
1368
+ fill: 'rgba(24, 109, 255, 0.1)',
1369
+ color: '#488BFD',
1370
+ borderColor: '#488BFD'
1371
+ },
1372
+ disabled: {
1373
+ fill: 'transparent',
1374
+ color: '#B0B0B0',
1375
+ borderColor: 'transparent'
1376
+ }
1050
1377
  },
1051
- flatMouseover: {
1052
- fill: '#494949'
1378
+ flat: {
1379
+ "default": {
1380
+ fill: 'transparent',
1381
+ color: '#E5E5E5',
1382
+ borderColor: 'transparent'
1383
+ },
1384
+ mouseOver: {
1385
+ fill: '#494949',
1386
+ color: '#E5E5E5',
1387
+ borderColor: 'transparent'
1388
+ },
1389
+ active: {
1390
+ fill: 'transparent',
1391
+ color: '#488BFD',
1392
+ borderColor: 'transparent'
1393
+ },
1394
+ activeMouseOver: {
1395
+ fill: 'rgba(24, 109, 255, 0.1)',
1396
+ color: '#488BFD',
1397
+ borderColor: 'transparent'
1398
+ },
1399
+ disabled: {
1400
+ fill: 'transparent',
1401
+ color: '#B0B0B0',
1402
+ borderColor: 'transparent'
1403
+ }
1053
1404
  },
1054
- focusDefault: {
1055
- outline: 'solid 2px #419cfe'
1405
+ tool: {
1406
+ "default": {
1407
+ fill: '#393939',
1408
+ color: '#E5E5E5',
1409
+ borderColor: 'transparent'
1410
+ },
1411
+ mouseOver: {
1412
+ fill: '#494949',
1413
+ color: '#E5E5E5',
1414
+ borderColor: 'transparent'
1415
+ },
1416
+ active: {
1417
+ fill: '#186DFF',
1418
+ color: '#FFFFFF',
1419
+ borderColor: 'transparent'
1420
+ },
1421
+ activeMouseOver: {
1422
+ fill: '#1047B0',
1423
+ color: '#FFFFFF',
1424
+ borderColor: 'transparent'
1425
+ },
1426
+ disabled: {
1427
+ fill: 'transparent',
1428
+ color: '#B0B0B0',
1429
+ borderColor: 'transparent'
1430
+ }
1056
1431
  },
1057
- disabled: {
1058
- fill: '#303030'
1432
+ boxed: {
1433
+ "default": {
1434
+ fill: 'transparent',
1435
+ color: '#E5E5E5',
1436
+ borderColor: '#e5e5e5'
1437
+ },
1438
+ mouseOver: {
1439
+ fill: '#494949',
1440
+ color: '#E5E5E5',
1441
+ borderColor: '#e5e5e5'
1442
+ },
1443
+ active: {
1444
+ fill: '#186DFF',
1445
+ color: '#FFFFFF',
1446
+ borderColor: 'transparent'
1447
+ },
1448
+ activeMouseOver: {
1449
+ fill: '#1047B0',
1450
+ color: '#FFFFFF',
1451
+ borderColor: 'transparent'
1452
+ },
1453
+ disabled: {
1454
+ fill: 'transparent',
1455
+ color: '#B0B0B0',
1456
+ borderColor: 'transparent'
1457
+ }
1059
1458
  },
1060
- surfaceIconDefault: {
1061
- fill: '#2B2B2B'
1459
+ focusDefault: {
1460
+ outline: 'solid 2px #419cfe'
1062
1461
  }
1063
1462
  },
1064
1463
  typographyAndIcons: {
@@ -1091,7 +1490,8 @@
1091
1490
  }
1092
1491
  },
1093
1492
  greys: {
1094
- accessible: '#A2A2A2'
1493
+ accessible: '#A2A2A2',
1494
+ accessibleLight: '#6F6F6F'
1095
1495
  },
1096
1496
  cards: {
1097
1497
  cardContainer: '#303030',
@@ -1211,10 +1611,6 @@
1211
1611
  }
1212
1612
  },
1213
1613
  layerManager: {
1214
- tableRowDefaultIcon: {
1215
- fill: '#C5C5C5',
1216
- opacity: 1
1217
- },
1218
1614
  tableRowDefaultText: {
1219
1615
  color: '#FFFFFF',
1220
1616
  opacity: 0.87,
@@ -1228,9 +1624,6 @@
1228
1624
  fill: '#000000',
1229
1625
  opacity: 0.15
1230
1626
  },
1231
- tableRowDisabledIcon: {
1232
- fill: '#A2A2A2'
1233
- },
1234
1627
  tableRowDisabledText: {
1235
1628
  color: '#909090',
1236
1629
  opacity: 0.87,
@@ -1264,7 +1657,7 @@
1264
1657
  opacity: 1
1265
1658
  },
1266
1659
  captionDisabled: {
1267
- color: '#909090',
1660
+ color: '#B0B0B0',
1268
1661
  opacity: 1
1269
1662
  }
1270
1663
  }
@@ -1350,6 +1743,7 @@
1350
1743
  exports.ThemeWrapper = ThemeWrapper;
1351
1744
  exports.ThemeWrapperOldTheme = ThemeWrapperOldTheme;
1352
1745
  exports.darkTheme = darkTheme;
1746
+ exports.gwButtonVariants = gwButtonVariants;
1353
1747
  exports.lightTheme = lightTheme;
1354
1748
  exports.useThemeContext = useThemeContext;
1355
1749
 
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ interface StoryHeaderProps {
3
+ title: string;
4
+ }
5
+ export declare const StoryHeader: React.FC<StoryHeaderProps>;
6
+ export default StoryHeader;
@@ -0,0 +1 @@
1
+ export * from './StoryHeader';
@@ -0,0 +1,6 @@
1
+ import { ComponentsVariants, CSSInterpolation, CSSObject } from '@mui/material';
2
+ import { ButtonStyles, ButtonStyle } from './types';
3
+ export declare const defaultButtonStyle: (button: ButtonStyle) => CSSObject;
4
+ export declare const buttonStyle: (button: ButtonStyle) => CSSInterpolation;
5
+ export declare const variantsToClassName: (buttonVariants: ComponentsVariants['MuiButton']) => CSSInterpolation;
6
+ export declare const buttonVariants: (buttons: ButtonStyles) => ComponentsVariants['MuiButton'];
@@ -0,0 +1 @@
1
+ export {};