@axinom/mosaic-ui 0.72.4 → 0.72.6
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/dist/cjs/components/Explorer/Explorer.d.ts.map +1 -1
- package/dist/cjs/components/Explorer/helpers/useFilters.d.ts +3 -0
- package/dist/cjs/components/Explorer/helpers/useFilters.d.ts.map +1 -1
- package/dist/cjs/components/Filters/Filters.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/Explorer/Explorer.d.ts.map +1 -1
- package/dist/esm/components/Explorer/helpers/useFilters.d.ts +3 -0
- package/dist/esm/components/Explorer/helpers/useFilters.d.ts.map +1 -1
- package/dist/esm/components/Filters/Filters.d.ts.map +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Explorer/Explorer.module.scss +3 -1
- package/src/components/Explorer/Explorer.tsx +10 -7
- package/src/components/Explorer/helpers/useFilters.tsx +4 -0
- package/src/components/Filters/Filters.module.scss +40 -20
- package/src/components/Filters/Filters.tsx +13 -6
- package/src/styles/variables.scss +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axinom/mosaic-ui",
|
|
3
|
-
"version": "0.72.
|
|
3
|
+
"version": "0.72.6",
|
|
4
4
|
"description": "UI components for building Axinom Mosaic applications",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"publishConfig": {
|
|
114
114
|
"access": "public"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "efcad0d91a11ba7fbdd2efd9568a75e61f796a44"
|
|
117
117
|
}
|
|
@@ -57,7 +57,9 @@
|
|
|
57
57
|
height: calc(100vh - #{$header-height} - 30px);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
// When no filters are rendered, the List spans both grid columns so it
|
|
61
|
+
// fills the full available width instead of only the second (1fr) track.
|
|
62
|
+
.listFullWidth {
|
|
61
63
|
grid-column: 1 / -1;
|
|
62
64
|
}
|
|
63
65
|
}
|
|
@@ -262,13 +262,15 @@ export const Explorer = React.forwardRef(function Explorer<T extends Data>(
|
|
|
262
262
|
listRef.current?.resetSelection();
|
|
263
263
|
}, []);
|
|
264
264
|
|
|
265
|
-
const { activeFilters, Filters, collapseFilters } = useFilters<T>(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
265
|
+
const { activeFilters, Filters, collapseFilters, hasFilters } = useFilters<T>(
|
|
266
|
+
{
|
|
267
|
+
stationKey,
|
|
268
|
+
globalStateOptions,
|
|
269
|
+
filterOptions,
|
|
270
|
+
defaultFilterValues,
|
|
271
|
+
onFiltersChange: onFilterChangedHandler,
|
|
272
|
+
},
|
|
273
|
+
);
|
|
272
274
|
|
|
273
275
|
const {
|
|
274
276
|
data,
|
|
@@ -454,6 +456,7 @@ export const Explorer = React.forwardRef(function Explorer<T extends Data>(
|
|
|
454
456
|
{Filters}
|
|
455
457
|
<List<T>
|
|
456
458
|
ref={listRef}
|
|
459
|
+
className={clsx({ [classes.listFullWidth]: !hasFilters })}
|
|
457
460
|
columns={columns}
|
|
458
461
|
data={data}
|
|
459
462
|
isLoading={isLoading}
|
|
@@ -17,6 +17,9 @@ interface UseFiltersReturnType<T extends Data> {
|
|
|
17
17
|
readonly Filters: JSX.Element;
|
|
18
18
|
readonly activeFilters: FilterValues<T>;
|
|
19
19
|
readonly collapseFilters: () => void;
|
|
20
|
+
/** Whether any filters are available to render. Mirrors the condition the
|
|
21
|
+
* `Filters` component uses to decide whether it renders anything at all. */
|
|
22
|
+
readonly hasFilters: boolean;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
export const useFilters = <T extends Data>({
|
|
@@ -70,5 +73,6 @@ export const useFilters = <T extends Data>({
|
|
|
70
73
|
Filters: FilterComponent,
|
|
71
74
|
activeFilters,
|
|
72
75
|
collapseFilters,
|
|
76
|
+
hasFilters: Boolean(filterOptions?.length),
|
|
73
77
|
};
|
|
74
78
|
};
|
|
@@ -3,44 +3,47 @@
|
|
|
3
3
|
.container {
|
|
4
4
|
@include boxSizing;
|
|
5
5
|
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
|
|
6
9
|
height: 100%;
|
|
7
10
|
width: $filter-width;
|
|
8
11
|
|
|
9
|
-
display: grid;
|
|
10
|
-
grid-template-columns: 1fr;
|
|
11
|
-
grid-auto-rows: min-content;
|
|
12
|
-
overflow-x: hidden;
|
|
13
|
-
overflow-y: auto;
|
|
14
|
-
gap: 5px;
|
|
15
|
-
padding: 5px;
|
|
16
|
-
|
|
17
|
-
transition: width 250ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
18
|
-
|
|
19
12
|
background-color: var(
|
|
20
13
|
--filter-controller-background-color,
|
|
21
14
|
$filter-controller-background-color
|
|
22
15
|
);
|
|
16
|
+
|
|
17
|
+
transition: width 250ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
23
18
|
}
|
|
24
19
|
|
|
25
20
|
.header {
|
|
21
|
+
position: sticky;
|
|
22
|
+
top: 0;
|
|
23
|
+
z-index: 1;
|
|
24
|
+
|
|
26
25
|
display: grid;
|
|
27
26
|
grid-template-columns: auto 1fr auto;
|
|
28
27
|
align-items: center;
|
|
29
28
|
|
|
30
|
-
background-color:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
transparent
|
|
29
|
+
background-color: var(
|
|
30
|
+
--filter-controller-background-color,
|
|
31
|
+
$filter-controller-background-color
|
|
34
32
|
);
|
|
33
|
+
border-bottom: 1px solid
|
|
34
|
+
var(--filter-header-border-color, $filter-header-border-color);
|
|
35
35
|
|
|
36
36
|
.headerButton {
|
|
37
|
-
width:
|
|
38
|
-
height:
|
|
37
|
+
width: 44px;
|
|
38
|
+
height: 44px;
|
|
39
39
|
|
|
40
40
|
svg {
|
|
41
|
-
height:
|
|
41
|
+
height: 80%;
|
|
42
42
|
* {
|
|
43
|
-
stroke: var(
|
|
43
|
+
stroke: var(
|
|
44
|
+
--filter-context-button-color,
|
|
45
|
+
$filter-context-button-color
|
|
46
|
+
);
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
}
|
|
@@ -49,11 +52,28 @@
|
|
|
49
52
|
text-align: left;
|
|
50
53
|
font-weight: bold;
|
|
51
54
|
white-space: nowrap;
|
|
52
|
-
color: var(--
|
|
55
|
+
color: var(--filter-header-color, $filter-header-color);
|
|
56
|
+
padding-left: 5px;
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
.collapsed {
|
|
57
|
-
width:
|
|
61
|
+
width: 44px; // matches the 44px header toggle button
|
|
58
62
|
overflow-y: hidden;
|
|
59
63
|
}
|
|
64
|
+
|
|
65
|
+
.filters {
|
|
66
|
+
// Fill the remaining column height; `min-height: 0` overrides the default
|
|
67
|
+
// `auto` so the child can shrink below its content size and scroll instead
|
|
68
|
+
// of overflowing the container.
|
|
69
|
+
flex: 1;
|
|
70
|
+
min-height: 0;
|
|
71
|
+
|
|
72
|
+
display: grid;
|
|
73
|
+
grid-template-columns: 1fr;
|
|
74
|
+
grid-auto-rows: min-content;
|
|
75
|
+
overflow-x: hidden;
|
|
76
|
+
overflow-y: auto;
|
|
77
|
+
gap: 5px;
|
|
78
|
+
padding: 5px;
|
|
79
|
+
}
|
|
@@ -220,9 +220,10 @@ const FiltersComponent = <T extends Data>(
|
|
|
220
220
|
<Button
|
|
221
221
|
icon={IconName.Filters}
|
|
222
222
|
className={classes.headerButton}
|
|
223
|
-
buttonContext={ButtonContext.
|
|
223
|
+
buttonContext={ButtonContext.Icon}
|
|
224
224
|
onButtonClicked={toggleExpanded}
|
|
225
225
|
dataTestId="filters-toggle"
|
|
226
|
+
title={isExpanded ? 'Collapse filters' : 'Expand filters'}
|
|
226
227
|
/>
|
|
227
228
|
</Badge>
|
|
228
229
|
{isExpanded && (
|
|
@@ -234,18 +235,24 @@ const FiltersComponent = <T extends Data>(
|
|
|
234
235
|
<Button
|
|
235
236
|
icon={IconName.RemoveAllFilters}
|
|
236
237
|
className={classes.headerButton}
|
|
237
|
-
buttonContext={ButtonContext.
|
|
238
|
+
buttonContext={ButtonContext.Icon}
|
|
238
239
|
onButtonClicked={clearAllFilters}
|
|
239
240
|
dataTestId="filters-clear-all"
|
|
241
|
+
title="Remove all filters"
|
|
240
242
|
/>
|
|
241
243
|
)}
|
|
242
244
|
</>
|
|
243
245
|
)}
|
|
244
246
|
</div>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
<div
|
|
248
|
+
className={clsx(classes.filters, 'filters')}
|
|
249
|
+
data-test-id="filters-list"
|
|
250
|
+
>
|
|
251
|
+
{isExpanded &&
|
|
252
|
+
options?.map((filter: FilterType<T>, index: number) =>
|
|
253
|
+
renderFilter(filter, index),
|
|
254
|
+
)}
|
|
255
|
+
</div>
|
|
249
256
|
</div>
|
|
250
257
|
);
|
|
251
258
|
};
|
|
@@ -82,6 +82,8 @@ $filter-controller-background-color: var(--mosaic-neutral-3);
|
|
|
82
82
|
$filter-border-color: var(--mosaic-secondary);
|
|
83
83
|
$multi-option-checkbox-border: var(--mosaic-secondary);
|
|
84
84
|
$multi-option-label-color: var(--mosaic-neutral-1);
|
|
85
|
+
$filter-header-border-color: var(--mosaic-neutral-2);
|
|
86
|
+
$filter-header-color: var(--mosaic-neutral-1);
|
|
85
87
|
|
|
86
88
|
/* Details vars */
|
|
87
89
|
$details-background-color: #ffffff;
|