@axinom/mosaic-ui 0.66.0-rc.17 → 0.66.0-rc.19

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.66.0-rc.17",
3
+ "version": "0.66.0-rc.19",
4
4
  "description": "UI components for building Axinom Mosaic applications",
5
5
  "author": "Axinom",
6
6
  "license": "PROPRIETARY",
@@ -112,5 +112,5 @@
112
112
  "publishConfig": {
113
113
  "access": "public"
114
114
  },
115
- "gitHead": "29af6e31d596c2b76b96f3844436a8956a5f8bbd"
115
+ "gitHead": "d5bfb15cb919ad43e6ab189fa81429c2a5b600d1"
116
116
  }
@@ -7,6 +7,10 @@
7
7
  align-items: center;
8
8
  }
9
9
 
10
+ .item {
11
+ z-index: 0;
12
+ }
13
+
10
14
  .selectionHeader {
11
15
  display: grid;
12
16
  grid-template-columns: 1fr;
@@ -84,6 +84,7 @@ export const FieldSelection: React.FC<FieldSelectionProps> = ({
84
84
  {selectedFields.map((field) => (
85
85
  <AccordionItem
86
86
  key={field.value}
87
+ className={classes.item}
87
88
  header={
88
89
  <FieldSelectionItemHeader
89
90
  label={field.label as string}
@@ -15,24 +15,31 @@ $input-inactive: 1px solid var(--input-border-color, $input-border-color);
15
15
  border: $input-inactive;
16
16
  }
17
17
 
18
+ &.hasValue {
19
+ background: color-mix(
20
+ in srgb,
21
+ var(--filter-background-color, $filter-background-color) 50%,
22
+ transparent
23
+ );
24
+ }
25
+
18
26
  .title {
19
27
  display: grid;
20
28
  grid-template-columns: auto auto;
21
- grid-template-rows: 48px;
29
+ grid-template-rows: 38px;
22
30
  place-content: space-between;
23
31
  place-items: center;
24
32
  color: var(--filter-title-color, $filter-title-color);
25
33
  font-size: var(--filter-font-size, $filter-font-size);
26
- border: 1px solid white;
34
+ border: 1px solid transparent;
27
35
 
28
- transition: border 0.15s ease-in-out 0s;
29
- transition: background-color 100ms linear;
36
+ transition: border 0.15s ease-in-out 0s, background-color 100ms linear;
30
37
 
31
38
  &:hover {
32
39
  border: $border;
33
40
  }
34
41
 
35
- &.expanded {
42
+ &.active {
36
43
  background-color: var(
37
44
  --filter-background-selected-color,
38
45
  $filter-background-selected-color
@@ -46,13 +53,20 @@ $input-inactive: 1px solid var(--input-border-color, $input-border-color);
46
53
  var(--input-invalid-border-color, $input-invalid-border-color);
47
54
  }
48
55
 
49
- &.active {
56
+ &.hasValue {
50
57
  font-weight: bold;
51
58
  }
52
59
 
53
60
  .button {
61
+ height: 40px;
62
+ width: 40px;
63
+
64
+ &.rotated svg {
65
+ transform: rotate(90deg);
66
+ }
67
+
54
68
  svg {
55
- height: 50%;
69
+ transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
56
70
  }
57
71
 
58
72
  svg * {
@@ -78,9 +92,8 @@ $input-inactive: 1px solid var(--input-border-color, $input-border-color);
78
92
  place-items: center;
79
93
 
80
94
  .button {
81
- svg {
82
- height: 50%;
83
- }
95
+ height: 40px;
96
+ width: 40px;
84
97
 
85
98
  svg * {
86
99
  stroke: var(
@@ -92,17 +105,23 @@ $input-inactive: 1px solid var(--input-border-color, $input-border-color);
92
105
 
93
106
  span {
94
107
  padding-left: 30px;
95
- padding-bottom: 10px;
96
108
  }
97
109
  }
98
110
  }
99
111
 
100
112
  .content {
101
- transition: max-height 100ms linear;
102
- overflow: hidden;
103
- max-height: fit-content !important;
113
+ display: grid;
114
+ grid-template-rows: 0fr;
115
+ transition: grid-template-rows 200ms cubic-bezier(0.4, 0, 0.2, 1);
116
+
117
+ &.expanded {
118
+ grid-template-rows: 1fr;
119
+ }
104
120
 
105
121
  .active {
122
+ display: grid;
123
+ overflow: hidden;
124
+
106
125
  border-right: $border;
107
126
  border-bottom: $border;
108
127
  border-left: $border;
@@ -95,7 +95,7 @@ describe('Filter', () => {
95
95
 
96
96
  const filterTitle = wrapper.find('.title');
97
97
 
98
- expect(filterTitle.hasClass('expanded')).toBe(expected);
98
+ expect(filterTitle.hasClass('active')).toBe(expected);
99
99
  });
100
100
 
101
101
  it('passes active state to custom filter', () => {
@@ -1,11 +1,5 @@
1
1
  import clsx from 'clsx';
2
- import React, {
3
- PropsWithChildren,
4
- ReactNode,
5
- useEffect,
6
- useRef,
7
- useState,
8
- } from 'react';
2
+ import React, { PropsWithChildren, ReactNode, useState } from 'react';
9
3
  import { assertNever } from '../../../helpers/utils';
10
4
  import { Data } from '../../../types/data';
11
5
  import { Button, ButtonContext } from '../../Buttons';
@@ -58,12 +52,8 @@ export const Filter = <T extends Data>({
58
52
  }: PropsWithChildren<FilterProps<T>>): JSX.Element => {
59
53
  const [isExpanded, setIsExpanded] = useState<boolean>(false);
60
54
  const [hasError, setHasError] = useState<boolean>(false);
61
- const [contentHeight, setContentHeight] = useState<number>(0);
62
55
  const [stringValue, setStringValue] = useState<string | undefined>();
63
56
 
64
- const contentRef = useRef<HTMLDivElement>(null);
65
- const valueRef = useRef<HTMLDivElement>(null);
66
-
67
57
  const inputId = `${String(options.property)}-filter-input`;
68
58
  const labelId = `${String(options.property)}-filter-label`;
69
59
  const inputBasedFilter = [
@@ -73,13 +63,6 @@ export const Filter = <T extends Data>({
73
63
  FilterTypes.DateTime,
74
64
  ];
75
65
 
76
- useEffect(() => {
77
- setContentHeight(
78
- (contentRef.current?.scrollHeight ?? 0) +
79
- (valueRef.current?.scrollHeight ?? 0),
80
- );
81
- }, [isExpanded, hasError, value]);
82
-
83
66
  const onFilterValueChange = (
84
67
  prop: keyof T,
85
68
  value: FilterValue,
@@ -247,9 +230,16 @@ export const Filter = <T extends Data>({
247
230
  }
248
231
  };
249
232
 
233
+ const hasValue = value !== undefined && value !== '';
234
+
250
235
  return (
251
236
  <div
252
- className={clsx(classes.container, 'filter-container', className)}
237
+ className={clsx(
238
+ classes.container,
239
+ { [classes.hasValue]: hasValue },
240
+ 'filter-container',
241
+ className,
242
+ )}
253
243
  data-test-id={`filter:${options.property as string}`}
254
244
  data-test-type={FilterTypes[options.type]}
255
245
  onClick={() => onFilterClicked()}
@@ -259,12 +249,11 @@ export const Filter = <T extends Data>({
259
249
  setIsExpanded(!isExpanded);
260
250
  setHasError(false);
261
251
  }}
262
- className={clsx(
263
- classes.title,
264
- { [classes.expanded]: isExpanded && isActive },
265
- hasError && classes.hasError,
266
- !!value && classes.active,
267
- )}
252
+ className={clsx(classes.title, {
253
+ [classes.hasValue]: hasValue,
254
+ [classes.active]: isActive && isExpanded,
255
+ [classes.hasError]: hasError,
256
+ })}
268
257
  data-test-id="filter-button-toggle"
269
258
  >
270
259
  <label
@@ -277,21 +266,19 @@ export const Filter = <T extends Data>({
277
266
  {options.label}
278
267
  </label>
279
268
  <Button
280
- icon={IconName.ChevronDown}
281
- className={clsx(classes.button)}
269
+ icon={IconName.ChevronRight}
270
+ className={clsx(classes.button, {
271
+ [classes.rotated]: isExpanded || hasValue,
272
+ })}
282
273
  buttonContext={ButtonContext.None}
283
274
  />
284
275
  </div>
285
276
  <div
286
- className={clsx(classes.content)}
287
- style={{
288
- maxHeight: contentHeight,
289
- }}
277
+ className={clsx(classes.content, { [classes.expanded]: isExpanded })}
290
278
  >
291
- {value !== undefined && !isExpanded && (
279
+ {hasValue && !isExpanded && (
292
280
  <div
293
281
  className={clsx(classes.selectedValue)}
294
- ref={valueRef}
295
282
  onClick={() => {
296
283
  setIsExpanded(!isExpanded);
297
284
  }}
@@ -311,7 +298,6 @@ export const Filter = <T extends Data>({
311
298
  )}
312
299
  {isExpanded && (
313
300
  <div
314
- ref={contentRef}
315
301
  data-test-id="filter-content"
316
302
  className={clsx({ [classes.active]: isActive })}
317
303
  >
@@ -4,11 +4,7 @@
4
4
  @include boxSizing;
5
5
 
6
6
  display: grid;
7
- grid-auto-rows: 50px;
8
- background-color: var(
9
- --filter-controller-background-color,
10
- $filter-controller-background-color
11
- );
7
+ grid-auto-rows: 40px;
12
8
  gap: 1px;
13
9
  border-top: unset;
14
10
 
@@ -18,7 +14,7 @@
18
14
 
19
15
  span {
20
16
  font-size: var(--filter-font-size, $filter-font-size);
21
- color: var(--filter-title-color, $filter-title-color);
17
+ color: var(--popper-text-color, $popper-text-color);
22
18
  display: grid;
23
19
  place-items: center left;
24
20
  padding: 0 20px;
@@ -27,15 +23,15 @@
27
23
 
28
24
  &:hover {
29
25
  background-color: var(
30
- --filter-background-selected-color,
31
- $filter-background-selected-color
26
+ --popper-item-hover-color,
27
+ $popper-item-hover-color
32
28
  );
33
29
  }
34
30
 
35
31
  &.selected {
36
32
  background-color: var(
37
- --filter-background-selected-color,
38
- $filter-background-selected-color
33
+ --popper-background-selected-color,
34
+ $popper-background-selected-color
39
35
  );
40
36
  }
41
37
  }
@@ -94,7 +94,7 @@
94
94
  ul {
95
95
  display: grid;
96
96
  row-gap: 1px;
97
- background-color: var(--popper-background-color, $popper-background-color);
97
+ background-color: white;
98
98
  padding: 0px;
99
99
  margin-top: 1px;
100
100
  margin-bottom: 1px;
@@ -105,7 +105,7 @@
105
105
  li {
106
106
  display: grid;
107
107
  place-items: center left;
108
- height: 50px;
108
+ height: 40px;
109
109
  font-size: var(--popper-item-font-size, $popper-item-font-size);
110
110
  color: var(--popper-text-color, $popper-text-color);
111
111
  background-color: white;
@@ -116,18 +116,23 @@
116
116
  &:hover {
117
117
  cursor: pointer;
118
118
  background-color: var(
119
- --popper-background-selected-color,
120
- $popper-background-selected-color
119
+ --popper-item-hover-color,
120
+ $popper-item-hover-color
121
121
  );
122
122
  }
123
123
 
124
- &[aria-selected='true'],
125
- &[class='Mui-focused Mui-focusVisible'] {
124
+ &[aria-selected='true'] {
126
125
  background-color: var(
127
126
  --popper-background-selected-color,
128
127
  $popper-background-selected-color
129
128
  );
130
129
  }
130
+ &[class='Mui-focused Mui-focusVisible'] {
131
+ background-color: var(
132
+ --popper-item-selected-color,
133
+ $popper-item-selected-color
134
+ );
135
+ }
131
136
  }
132
137
  }
133
138
  }
@@ -36,7 +36,7 @@ $pop-up-arrow-extrusion: -7px;
36
36
  color: var(--infotooltip-text-color, $infotooltip-text-color);
37
37
  padding: 15px;
38
38
 
39
- z-index: 10;
39
+ z-index: 9999;
40
40
 
41
41
  .arrow,
42
42
  .arrow::before {
@@ -13,7 +13,7 @@ $pop-up-arrow-extrusion: -7px;
13
13
 
14
14
  box-shadow: 0px 1px 8px 3px rgba(92, 92, 92, 0.27);
15
15
 
16
- z-index: 10;
16
+ z-index: 9999;
17
17
 
18
18
  .arrow,
19
19
  .arrow::before {
@@ -71,8 +71,8 @@ $filter-light-font-color: $dark-gray;
71
71
  $filter-option-background-color: #d7e9f1;
72
72
  $filter-context-button-color: $blue;
73
73
  $filter-title-color: $blue;
74
- $filter-font-size: 16px;
75
- $filter-width: 360px;
74
+ $filter-font-size: 14px;
75
+ $filter-width: 330px;
76
76
  $filter-controller-background-color: $light-gray-2;
77
77
  $filter-border-color: $blue;
78
78
  $multi-option-checbox-border: $blue;
@@ -320,7 +320,8 @@ $icon-button-hover-color: $blue;
320
320
  /* Autocomplete */
321
321
  $popper-border-color: $blue;
322
322
  $popper-trigger-button-color: $blue;
323
- $popper-background-color: $light-gray-2;
324
- $popper-item-font-size: 16px;
325
- $popper-text-color: $blue;
326
- $popper-background-selected-color: rgba($blue, 0.15);
323
+ $popper-item-font-size: 14px;
324
+ $popper-text-color: $dark-gray;
325
+ $popper-background-selected-color: $light-gray-2;
326
+ $popper-item-hover-color: rgba($blue, 0.1);
327
+ $popper-item-selected-color: rgba($blue, 0.2);