@axinom/mosaic-ui 0.44.0-rc.1 → 0.44.0-rc.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axinom/mosaic-ui",
3
- "version": "0.44.0-rc.1",
3
+ "version": "0.44.0-rc.10",
4
4
  "description": "UI components for building Axinom Mosaic applications",
5
5
  "author": "Axinom",
6
6
  "license": "PROPRIETARY",
@@ -32,7 +32,7 @@
32
32
  "build-storybook": "storybook build"
33
33
  },
34
34
  "dependencies": {
35
- "@axinom/mosaic-core": "^0.4.17-rc.1",
35
+ "@axinom/mosaic-core": "^0.4.17-rc.10",
36
36
  "@faker-js/faker": "^7.4.0",
37
37
  "@popperjs/core": "^2.11.8",
38
38
  "clsx": "^1.1.0",
@@ -105,5 +105,5 @@
105
105
  "publishConfig": {
106
106
  "access": "public"
107
107
  },
108
- "gitHead": "a59e7ea3b1d1ee3427e6553c097ae6e29df14353"
108
+ "gitHead": "996702d66aaab62214cb3db5f20966918e6b1007"
109
109
  }
@@ -1,91 +0,0 @@
1
- /** Default Styles from the Calendar Library */
2
- :global(.react-calendar) {
3
- max-width: 100%;
4
- background: white;
5
- }
6
- :global(.react-calendar--doubleView .react-calendar__viewContainer) {
7
- display: flex;
8
- margin: -0.5em;
9
- }
10
- :global(.react-calendar--doubleView .react-calendar__viewContainer) > * {
11
- width: 50%;
12
- margin: 0.5em;
13
- }
14
- :global(.react-calendar),
15
- :global(.react-calendar) *,
16
- :global(.react-calendar) *:before,
17
- :global(.react-calendar) *:after {
18
- -moz-box-sizing: border-box;
19
- -webkit-box-sizing: border-box;
20
- box-sizing: border-box;
21
- }
22
- :global(.react-calendar) button {
23
- margin: 0;
24
- border: 0;
25
- outline: none;
26
- }
27
- :global(.react-calendar) button:enabled:hover {
28
- cursor: pointer;
29
- }
30
- :global(.react-calendar__navigation) button[disabled] {
31
- background-color: #f0f0f0;
32
- }
33
- :global(.react-calendar__month-view__weekdays) {
34
- text-align: center;
35
- text-transform: uppercase;
36
- font-weight: bold;
37
- // font-size: 0.75em;
38
- }
39
- :global(.react-calendar__month-view__weekdays__weekday) {
40
- font-size: 18px;
41
- padding: 8px;
42
- }
43
- :global(.react-calendar__month-view__weekNumbers) {
44
- font-weight: bold;
45
- }
46
- :global(.react-calendar__month-view__weekNumbers .react-calendar__tile) {
47
- display: flex;
48
- align-items: center;
49
- justify-content: center;
50
- font-size: 0.75em;
51
- padding: calc(0.75em / 0.75) calc(0.5em / 0.75);
52
- }
53
- :global(.react-calendar__month-view__days__day--neighboringMonth) {
54
- color: #757575;
55
- }
56
- :global(.react-calendar__year-view) :global(.react-calendar__tile),
57
- :global(.react-calendar__decade-view) :global(.react-calendar__tile),
58
- :global(.react-calendar__century-view) :global(.react-calendar__tile) {
59
- padding: 2em 0.5em;
60
- }
61
- :global(.react-calendar__tile) {
62
- max-width: 100%;
63
- text-align: center;
64
- padding: 0.5em 0.5em;
65
- font-size: 16px;
66
- background: none;
67
- }
68
- :global(.react-calendar__tile):disabled {
69
- background-color: #f0f0f0;
70
- }
71
- :global(.react-calendar__tile):enabled:hover {
72
- background-color: #e6e6e6;
73
- }
74
- :global(.react-calendar__tile--hasActive) {
75
- background: #76baff;
76
- }
77
- :global(.react-calendar__tile--hasActive):enabled:hover,
78
- :global(.react-calendar__tile--hasActive):enabled:focus {
79
- background: #a9d4ff;
80
- }
81
- :global(.react-calendar__tile--active) {
82
- background: #006edc;
83
- color: white;
84
- }
85
- :global(.react-calendar__tile--active):enabled:hover,
86
- :global(.react-calendar__tile--active):enabled:focus {
87
- background: #1087ff;
88
- }
89
- :global(.react-calendar--selectRange) :global(.react-calendar__tile--hover) {
90
- background-color: #e6e6e6;
91
- }
@@ -6,6 +6,98 @@
6
6
  width: 325px;
7
7
  border: none;
8
8
 
9
+ /** Default Styles from the Calendar Library */
10
+ &:global(.react-calendar) {
11
+ max-width: 100%;
12
+ background: white;
13
+ }
14
+ :global(.react-calendar--doubleView .react-calendar__viewContainer) {
15
+ display: flex;
16
+ margin: -0.5em;
17
+ }
18
+ :global(.react-calendar--doubleView .react-calendar__viewContainer) > * {
19
+ width: 50%;
20
+ margin: 0.5em;
21
+ }
22
+ &:global(.react-calendar),
23
+ &:global(.react-calendar) *,
24
+ &:global(.react-calendar) *:before,
25
+ &:global(.react-calendar) *:after {
26
+ -moz-box-sizing: border-box;
27
+ -webkit-box-sizing: border-box;
28
+ box-sizing: border-box;
29
+ }
30
+ &:global(.react-calendar) button {
31
+ margin: 0;
32
+ border: 0;
33
+ outline: none;
34
+ }
35
+ &:global(.react-calendar) button:enabled:hover {
36
+ cursor: pointer;
37
+ }
38
+ :global(.react-calendar__navigation) button[disabled] {
39
+ background-color: #f0f0f0;
40
+ }
41
+ :global(.react-calendar__month-view__weekdays) {
42
+ text-align: center;
43
+ text-transform: uppercase;
44
+ font-weight: bold;
45
+ // font-size: 0.75em;
46
+ }
47
+ :global(.react-calendar__month-view__weekdays__weekday) {
48
+ font-size: 18px;
49
+ padding: 8px;
50
+ }
51
+ :global(.react-calendar__month-view__weekNumbers) {
52
+ font-weight: bold;
53
+ }
54
+ :global(.react-calendar__month-view__weekNumbers .react-calendar__tile) {
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ font-size: 0.75em;
59
+ padding: calc(0.75em / 0.75) calc(0.5em / 0.75);
60
+ }
61
+ :global(.react-calendar__month-view__days__day--neighboringMonth) {
62
+ color: #757575;
63
+ }
64
+ :global(.react-calendar__year-view) :global(.react-calendar__tile),
65
+ :global(.react-calendar__decade-view) :global(.react-calendar__tile),
66
+ :global(.react-calendar__century-view) :global(.react-calendar__tile) {
67
+ padding: 2em 0.5em;
68
+ }
69
+ :global(.react-calendar__tile) {
70
+ max-width: 100%;
71
+ text-align: center;
72
+ padding: 0.5em 0.5em;
73
+ font-size: 16px;
74
+ background: none;
75
+ }
76
+ :global(.react-calendar__tile):disabled {
77
+ background-color: #f0f0f0;
78
+ }
79
+ :global(.react-calendar__tile):enabled:hover {
80
+ background-color: #e6e6e6;
81
+ }
82
+ :global(.react-calendar__tile--hasActive) {
83
+ background: #76baff;
84
+ }
85
+ :global(.react-calendar__tile--hasActive):enabled:hover,
86
+ :global(.react-calendar__tile--hasActive):enabled:focus {
87
+ background: #a9d4ff;
88
+ }
89
+ :global(.react-calendar__tile--active) {
90
+ background: #006edc;
91
+ color: white;
92
+ }
93
+ :global(.react-calendar__tile--active):enabled:hover,
94
+ :global(.react-calendar__tile--active):enabled:focus {
95
+ background: #1087ff;
96
+ }
97
+ :global(.react-calendar--selectRange) :global(.react-calendar__tile--hover) {
98
+ background-color: #e6e6e6;
99
+ }
100
+
9
101
  :global(.react-calendar__tile) {
10
102
  transition: background-color 0.15s ease-in-out 0s;
11
103
 
@@ -3,7 +3,6 @@ import React from 'react';
3
3
  import Calendar from 'react-calendar';
4
4
  import { noop } from '../../../helpers/utils';
5
5
  import { IconName, Icons } from '../../Icons';
6
- import './Calendar.scss';
7
6
  import classes from './DatePicker.scss';
8
7
 
9
8
  export interface DatePickerProps {
@@ -5,8 +5,6 @@ import { PageHeader } from '../PageHeader';
5
5
  import { StationError } from '../models';
6
6
  import { EmptyStation, EmptyStationProps } from './EmptyStation';
7
7
 
8
- jest.mock('../../hooks/useTabTitle/useTabTitle');
9
-
10
8
  describe('EmptyStation', () => {
11
9
  const defaultProps: EmptyStationProps = {
12
10
  title: 'test-title',
@@ -34,8 +34,6 @@ import {
34
34
  } from './Explorer.model';
35
35
  import { StationMessage } from './useStationMessage';
36
36
 
37
- jest.mock('../../hooks/useTabTitle/useTabTitle');
38
-
39
37
  interface ExplorerTestData {
40
38
  id: number;
41
39
  title: string;
@@ -12,8 +12,6 @@ import { Explorer } from '../Explorer';
12
12
  import { ExplorerDataProvider } from '../Explorer.model';
13
13
  import { NavigationExplorer } from './NavigationExplorer';
14
14
 
15
- jest.mock('../../../hooks/useTabTitle/useTabTitle');
16
-
17
15
  interface NavExplorerTestData {
18
16
  id: string;
19
17
  desc: string;
@@ -11,8 +11,6 @@ import { Explorer } from '../Explorer';
11
11
  import { ExplorerDataProvider } from '../Explorer.model';
12
12
  import { SelectionExplorer } from './SelectionExplorer';
13
13
 
14
- jest.mock('../../../hooks/useTabTitle/useTabTitle');
15
-
16
14
  interface SelectExplorerTestData {
17
15
  id: string;
18
16
  desc: string;
@@ -81,4 +81,15 @@ describe('useTabTitle', () => {
81
81
 
82
82
  expect(setTitle).toHaveBeenCalledTimes(1);
83
83
  });
84
+
85
+ it('should set the tab title outside a react router context', () => {
86
+ (useHistory as jest.Mock) = jest.fn().mockReturnValue(undefined);
87
+
88
+ const title = 'Test Title';
89
+ const setTabTitle = true;
90
+
91
+ mount(<TestWrapper title={title} setTabTitle={setTabTitle} />);
92
+
93
+ expect(setTitle).toHaveBeenCalled();
94
+ });
84
95
  });
@@ -6,10 +6,11 @@ export const useTabTitle = (
6
6
  title: string | undefined,
7
7
  setTabTitle: boolean | undefined,
8
8
  ): void => {
9
- const { location: currentLocation } = useHistory();
10
- const [initialLocation] = useState(currentLocation);
9
+ // useTabTitle should work outside a react router context
10
+ const { location } = useHistory() ?? {};
11
+ const [initialLocation] = useState(location);
11
12
 
12
- if (setTabTitle && currentLocation.pathname === initialLocation.pathname) {
13
+ if (setTabTitle && location?.pathname === initialLocation?.pathname) {
13
14
  setTitle(title);
14
15
  }
15
16
  };