@bundle-stats/ui 4.13.0-beta.7 → 4.13.0-beta.9
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/lib/components/bundle-modules/bundle-modules.js +2 -1
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/metrics-display-selector/metrics-display-selector.js +2 -2
- package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib/components/metrics-table-header/metrics-table-header.js +7 -7
- package/lib/components/metrics-table-header/metrics-table-header.js.map +1 -1
- package/lib/components/metrics-table-header/metrics-table-header.module.css +11 -4
- package/lib/components/metrics-table-options/metrics-table-options.js +2 -2
- package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.js.map +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.module.css +1 -0
- package/lib/components/metrics-treemap/metrics-treemap.js +8 -10
- package/lib/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib/components/metrics-treemap/metrics-treemap.module.css +14 -16
- package/lib/ui/dropdown/dropdown.js +9 -39
- package/lib/ui/dropdown/dropdown.js.map +1 -1
- package/lib/ui/dropdown/index.js.map +1 -1
- package/lib/ui/filters/filters.js +32 -34
- package/lib/ui/filters/filters.js.map +1 -1
- package/lib/ui/filters/filters.module.css +48 -67
- package/lib-esm/components/bundle-modules/bundle-modules.js +2 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +2 -2
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib-esm/components/metrics-table-header/metrics-table-header.js +7 -7
- package/lib-esm/components/metrics-table-header/metrics-table-header.js.map +1 -1
- package/lib-esm/components/metrics-table-header/metrics-table-header.module.css +11 -4
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +3 -3
- package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.js.map +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.module.css +1 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.js +8 -10
- package/lib-esm/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.module.css +14 -16
- package/lib-esm/ui/dropdown/dropdown.js +7 -38
- package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
- package/lib-esm/ui/dropdown/index.js.map +1 -1
- package/lib-esm/ui/filters/filters.js +33 -35
- package/lib-esm/ui/filters/filters.js.map +1 -1
- package/lib-esm/ui/filters/filters.module.css +48 -67
- package/package.json +5 -5
- package/src/components/bundle-modules/bundle-modules.tsx +3 -2
- package/src/components/metrics-display-selector/metrics-display-selector.tsx +4 -4
- package/src/components/metrics-table-header/metrics-table-header.module.css +11 -4
- package/src/components/metrics-table-header/metrics-table-header.tsx +7 -7
- package/src/components/metrics-table-options/metrics-table-options.jsx +4 -10
- package/src/components/metrics-table-title/metrics-table-title.jsx +1 -1
- package/src/components/metrics-table-title/metrics-table-title.module.css +1 -0
- package/src/components/metrics-treemap/metrics-treemap.module.css +14 -16
- package/src/components/metrics-treemap/metrics-treemap.tsx +31 -31
- package/src/ui/dropdown/dropdown.stories.tsx +25 -0
- package/src/ui/dropdown/dropdown.tsx +67 -0
- package/src/ui/filters/filters.module.css +48 -67
- package/src/ui/filters/filters.stories.tsx +109 -0
- package/src/ui/filters/filters.tsx +128 -166
- package/types/components/metrics-display-selector/metrics-display-selector.d.ts +2 -2
- package/types/ui/dropdown/dropdown.d.ts +13 -47
- package/types/ui/dropdown/index.d.ts +1 -1
- package/types/ui/filters/filters.d.ts +2 -7
- package/src/ui/dropdown/dropdown.jsx +0 -88
- /package/src/ui/dropdown/{index.js → index.ts} +0 -0
|
@@ -22,15 +22,13 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/** Leaf wrapper button */
|
|
25
|
-
.
|
|
26
|
-
position:
|
|
25
|
+
.leaf {
|
|
26
|
+
position: absolute;
|
|
27
27
|
appearance: none;
|
|
28
28
|
border: 0;
|
|
29
29
|
border-radius: 0;
|
|
30
30
|
padding: 0;
|
|
31
31
|
background: none;
|
|
32
|
-
width: 100%;
|
|
33
|
-
height: 100%;
|
|
34
32
|
display: flex;
|
|
35
33
|
align-items: center;
|
|
36
34
|
font-family: var(--font-family-fixed);
|
|
@@ -39,7 +37,7 @@
|
|
|
39
37
|
text-align: left;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
.
|
|
40
|
+
.leaf::before {
|
|
43
41
|
content: "";
|
|
44
42
|
display: block;
|
|
45
43
|
position: absolute;
|
|
@@ -55,7 +53,7 @@
|
|
|
55
53
|
opacity: 0.6;
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
.leaf:hover
|
|
56
|
+
.leaf:hover::before {
|
|
59
57
|
transition: var(--ui-transition-in);
|
|
60
58
|
opacity: 0.4;
|
|
61
59
|
}
|
|
@@ -74,7 +72,7 @@
|
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
/** Align label to other elements on the first column leafs */
|
|
77
|
-
.
|
|
75
|
+
.leafFirstCol .leafContent {
|
|
78
76
|
padding-left: var(--space-small);
|
|
79
77
|
}
|
|
80
78
|
|
|
@@ -113,40 +111,40 @@
|
|
|
113
111
|
}
|
|
114
112
|
|
|
115
113
|
/** Tile diff variation */
|
|
116
|
-
.leaf-NO_CHANGE
|
|
114
|
+
.leaf-NO_CHANGE {
|
|
117
115
|
color: var(--color-text-light);
|
|
118
116
|
}
|
|
119
117
|
|
|
120
|
-
.leaf-NO_CHANGE
|
|
118
|
+
.leaf-NO_CHANGE::before {
|
|
121
119
|
color: var(--color-gray-50);
|
|
122
120
|
opacity: 0.4;
|
|
123
121
|
}
|
|
124
122
|
|
|
125
|
-
.leaf-NO_CHANGE:hover
|
|
123
|
+
.leaf-NO_CHANGE:hover::before {
|
|
126
124
|
opacity: 0.2;
|
|
127
125
|
}
|
|
128
126
|
|
|
129
|
-
.leaf-HIGH_NEGATIVE
|
|
127
|
+
.leaf-HIGH_NEGATIVE::before {
|
|
130
128
|
color: var(--color-red-100);
|
|
131
129
|
}
|
|
132
130
|
|
|
133
|
-
.leaf-NEGATIVE
|
|
131
|
+
.leaf-NEGATIVE::before {
|
|
134
132
|
color: var(--color-red-50);
|
|
135
133
|
}
|
|
136
134
|
|
|
137
|
-
.leaf-LOW_NEGATIVE
|
|
135
|
+
.leaf-LOW_NEGATIVE::before {
|
|
138
136
|
color: var(--color-red-25);
|
|
139
137
|
}
|
|
140
138
|
|
|
141
|
-
.leaf-LOW_POSITIVE
|
|
139
|
+
.leaf-LOW_POSITIVE::before {
|
|
142
140
|
color: var(--color-green-25);
|
|
143
141
|
}
|
|
144
142
|
|
|
145
|
-
.leaf-POSITIVE
|
|
143
|
+
.leaf-POSITIVE::before {
|
|
146
144
|
color: var(--color-green-50);
|
|
147
145
|
}
|
|
148
146
|
|
|
149
|
-
.leaf-HIGH_POSITIVE
|
|
147
|
+
.leaf-HIGH_POSITIVE::before {
|
|
150
148
|
color: var(--color-green-100);
|
|
151
149
|
}
|
|
152
150
|
|
|
@@ -11,9 +11,9 @@ import { Delta } from '../delta';
|
|
|
11
11
|
import { RunInfo } from '../run-info';
|
|
12
12
|
import css from './metrics-treemap.module.css';
|
|
13
13
|
|
|
14
|
-
const SQUARIFY_RATIO = 1.
|
|
15
|
-
const PADDING_OUTER =
|
|
16
|
-
const PADDING_INNER =
|
|
14
|
+
const SQUARIFY_RATIO = 1.33;
|
|
15
|
+
const PADDING_OUTER = 0;
|
|
16
|
+
const PADDING_INNER = 2;
|
|
17
17
|
|
|
18
18
|
type TileSizeDisplay = 'minimal' | 'small' | 'default';
|
|
19
19
|
|
|
@@ -142,11 +142,6 @@ const LeafContentWithTooltip = (props: LeafContentProps & { parentRef: RefObject
|
|
|
142
142
|
);
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
const LeafAction = forwardRef((props: React.ComponentProps<'button'>, ref) => (
|
|
146
|
-
// @ts-expect-error
|
|
147
|
-
<button type="button" xmlns="http://www.w3.org/1999/xhtml" ref={ref} {...props} />
|
|
148
|
-
));
|
|
149
|
-
|
|
150
145
|
interface TreeNode {
|
|
151
146
|
id: string;
|
|
152
147
|
value: number;
|
|
@@ -161,8 +156,8 @@ interface RootTree {
|
|
|
161
156
|
}
|
|
162
157
|
|
|
163
158
|
interface LeafProps {
|
|
164
|
-
|
|
165
|
-
|
|
159
|
+
left: number;
|
|
160
|
+
top: number;
|
|
166
161
|
width: number;
|
|
167
162
|
height: number;
|
|
168
163
|
data: TreeNode;
|
|
@@ -170,7 +165,7 @@ interface LeafProps {
|
|
|
170
165
|
}
|
|
171
166
|
|
|
172
167
|
const Leaf = (props: LeafProps) => {
|
|
173
|
-
const {
|
|
168
|
+
const { left, top, width, height, data, onClick } = props;
|
|
174
169
|
|
|
175
170
|
const { item } = data;
|
|
176
171
|
const runInfo = item.runs?.[0] as MetricRunInfo;
|
|
@@ -178,30 +173,35 @@ const Leaf = (props: LeafProps) => {
|
|
|
178
173
|
const sizeDisplay = useMemo(() => resolveLeafSizeDisplay(width, height), [width, height]);
|
|
179
174
|
const handleOnClick = useCallback(() => onClick?.(item.key), [item.key, onClick]);
|
|
180
175
|
|
|
181
|
-
const leafContentRef = useRef<
|
|
176
|
+
const leafContentRef = useRef<HTMLButtonElement>(null);
|
|
182
177
|
const hover = useHoverDirty(leafContentRef);
|
|
183
178
|
|
|
184
179
|
const leafClassName = cx(
|
|
185
180
|
css.leaf,
|
|
186
181
|
css[`leaf-${runInfo.deltaType}`],
|
|
187
182
|
sizeDisplay === 'small' && css.leafSmall,
|
|
183
|
+
left === 0 && css.leafFirstCol,
|
|
188
184
|
);
|
|
189
185
|
|
|
190
186
|
return (
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
187
|
+
<button
|
|
188
|
+
type="button"
|
|
189
|
+
onClick={handleOnClick}
|
|
190
|
+
ref={leafContentRef}
|
|
191
|
+
style={{ left, top, width, height }}
|
|
192
|
+
className={leafClassName}
|
|
193
|
+
>
|
|
194
|
+
{hover ? (
|
|
195
|
+
<LeafContentWithTooltip
|
|
196
|
+
sizeDisplay={sizeDisplay}
|
|
197
|
+
item={item}
|
|
198
|
+
runInfo={runInfo}
|
|
199
|
+
parentRef={leafContentRef}
|
|
200
|
+
/>
|
|
201
|
+
) : (
|
|
202
|
+
<LeafContent sizeDisplay={sizeDisplay} item={item} runInfo={runInfo} />
|
|
203
|
+
)}
|
|
204
|
+
</button>
|
|
205
205
|
);
|
|
206
206
|
};
|
|
207
207
|
|
|
@@ -275,7 +275,7 @@ export const MetricsTreemap = (props: MetricsTreemapProps & React.ComponentProps
|
|
|
275
275
|
return (
|
|
276
276
|
<div className={cx(css.root, className)} {...restProps} ref={containerRef}>
|
|
277
277
|
{cells.length > 0 ? (
|
|
278
|
-
<
|
|
278
|
+
<div className={css.canvas}>
|
|
279
279
|
{cells.map((leaf) => {
|
|
280
280
|
if (!leaf.parent) {
|
|
281
281
|
return null;
|
|
@@ -283,17 +283,17 @@ export const MetricsTreemap = (props: MetricsTreemapProps & React.ComponentProps
|
|
|
283
283
|
|
|
284
284
|
return (
|
|
285
285
|
<Leaf
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
data={leaf.data as TreeNode}
|
|
287
|
+
left={leaf.x0}
|
|
288
|
+
top={leaf.y0}
|
|
288
289
|
width={leaf.x1 - leaf.x0}
|
|
289
290
|
height={leaf.y1 - leaf.y0}
|
|
290
|
-
data={leaf.data as TreeNode}
|
|
291
291
|
onClick={onItemClick}
|
|
292
292
|
key={leaf.id}
|
|
293
293
|
/>
|
|
294
294
|
);
|
|
295
295
|
})}
|
|
296
|
-
</
|
|
296
|
+
</div>
|
|
297
297
|
) : (
|
|
298
298
|
<div className={css.emptyMessage}>
|
|
299
299
|
<div className={css.emptyMessageWrapper}>{emptyMessage}</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { getWrapperDecorator } from '../../stories';
|
|
5
|
+
import { Dropdown, DropdownItem } from '.';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'UI/Dropdown',
|
|
9
|
+
component: Dropdown,
|
|
10
|
+
decorators: [getWrapperDecorator()],
|
|
11
|
+
} as Meta;
|
|
12
|
+
|
|
13
|
+
export const Defualt = () => (
|
|
14
|
+
<Dropdown glyph="filter" label="Toggle">
|
|
15
|
+
<DropdownItem>Option 1</DropdownItem>
|
|
16
|
+
<DropdownItem>Option 2</DropdownItem>
|
|
17
|
+
</Dropdown>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const Disabled = () => (
|
|
21
|
+
<Dropdown glyph="filter" label="Toggle" disabled>
|
|
22
|
+
<DropdownItem>Option 1</DropdownItem>
|
|
23
|
+
<DropdownItem>Option 2</DropdownItem>
|
|
24
|
+
</Dropdown>
|
|
25
|
+
);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import { Menu, MenuButton, MenuItem, useMenuState } from 'ariakit/menu';
|
|
4
|
+
|
|
5
|
+
import { Button, BUTTON_SIZE } from '../button';
|
|
6
|
+
import css from './dropdown.module.css';
|
|
7
|
+
|
|
8
|
+
interface DropdownItemProps {
|
|
9
|
+
isActive?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const DropdownItem = (props: DropdownItemProps & React.ComponentProps<typeof MenuItem>) => {
|
|
13
|
+
const { className = '', isActive = false, ...restProps } = props;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<MenuItem className={cx(css.item, className, isActive && css.itemActive)} {...restProps} />
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
interface DropdownProps {
|
|
21
|
+
buttonClassName?: string;
|
|
22
|
+
dropdownClassName?: string;
|
|
23
|
+
label?: React.ReactNode;
|
|
24
|
+
ariaLabel?: string;
|
|
25
|
+
glyph?: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) => {
|
|
30
|
+
const {
|
|
31
|
+
buttonClassName = '',
|
|
32
|
+
dropdownClassName = '',
|
|
33
|
+
label = null,
|
|
34
|
+
ariaLabel = '',
|
|
35
|
+
glyph = '',
|
|
36
|
+
disabled = false,
|
|
37
|
+
children,
|
|
38
|
+
} = props;
|
|
39
|
+
|
|
40
|
+
const dropdownAriaLabel = ariaLabel || (typeof label === 'string' ? label : '');
|
|
41
|
+
const menuState = useMenuState();
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<MenuButton
|
|
46
|
+
as={Button}
|
|
47
|
+
outline
|
|
48
|
+
size={BUTTON_SIZE.SMALL}
|
|
49
|
+
glyph={glyph}
|
|
50
|
+
disabled={disabled}
|
|
51
|
+
state={menuState}
|
|
52
|
+
tabIndex={null}
|
|
53
|
+
className={cx(css.button, buttonClassName)}
|
|
54
|
+
>
|
|
55
|
+
{label}
|
|
56
|
+
</MenuButton>
|
|
57
|
+
<Menu
|
|
58
|
+
portal
|
|
59
|
+
state={menuState}
|
|
60
|
+
aria-label={dropdownAriaLabel}
|
|
61
|
+
className={cx(css.dropdown, dropdownClassName)}
|
|
62
|
+
>
|
|
63
|
+
{children}
|
|
64
|
+
</Menu>
|
|
65
|
+
</>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/*
|
|
2
|
-
.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/* explicit ControlGroup last item styles to override ariakit injected sibling nodes */
|
|
2
|
+
.itemLast {
|
|
3
|
+
border-top-right-radius: var(--radius-small) !important;
|
|
4
|
+
border-bottom-right-radius: var(--radius-small) !important;
|
|
5
|
+
}
|
|
6
6
|
|
|
7
|
+
/* Filter (label with input + text) */
|
|
8
|
+
.filter {
|
|
7
9
|
position: relative;
|
|
8
10
|
width: 100%;
|
|
9
11
|
max-width: 240px;
|
|
12
|
+
color: var(--color-text);
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
.
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.filterInput {
|
|
15
|
+
.filterControl {
|
|
16
16
|
flex: 0 0 auto;
|
|
17
17
|
height: 1em;
|
|
18
18
|
}
|
|
@@ -25,7 +25,42 @@
|
|
|
25
25
|
text-overflow: ellipsis;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.
|
|
28
|
+
.filterControl[disabled] + .filterLabel {
|
|
29
|
+
color: var(--color-text-light);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.filter:hover {
|
|
33
|
+
color: var(--color-dark);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Filter single */
|
|
37
|
+
.filterSingle {
|
|
38
|
+
padding: calc(var(--space-xxsmall) - 1px);
|
|
39
|
+
border: 1px solid var(--color-outline);
|
|
40
|
+
border-radius: var(--radius-small);
|
|
41
|
+
font-size: var(--size-small);
|
|
42
|
+
line-height: var(--space-small);
|
|
43
|
+
color: var(--color-text-ultra-light);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.filterSingle:hover,
|
|
47
|
+
.filterSingle:active,
|
|
48
|
+
.filterSingle:focus {
|
|
49
|
+
border-color: var(--color-outline-dark);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Filter group */
|
|
53
|
+
.filterGroupItems {
|
|
54
|
+
max-height: calc(10 * (var(--space-small) + 2 * var(--space-xxxsmall)));
|
|
55
|
+
overflow: auto;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.filterGroupItem {
|
|
59
|
+
position: relative;
|
|
60
|
+
padding-right: 10em;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.filterGroupOnlyButton {
|
|
29
64
|
display: none;
|
|
30
65
|
position: absolute;
|
|
31
66
|
right: 2px;
|
|
@@ -37,7 +72,7 @@
|
|
|
37
72
|
}
|
|
38
73
|
|
|
39
74
|
/** cover item text */
|
|
40
|
-
.
|
|
75
|
+
.filterGroupOnlyButton::before {
|
|
41
76
|
content: ' ';
|
|
42
77
|
display: block;
|
|
43
78
|
position: absolute;
|
|
@@ -48,53 +83,13 @@
|
|
|
48
83
|
background: linear-gradient(90deg, rgba(255, 255, 255, 0), var(--color-highlight) 75%);
|
|
49
84
|
}
|
|
50
85
|
|
|
51
|
-
/** filter disabled state */
|
|
52
|
-
.filterInput[disabled] + .filterLabel {
|
|
53
|
-
color: var(--color-text-light);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.filterInput[disabled] + .filterOnlyButton {
|
|
57
|
-
display: none;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
86
|
/** filter hover state */
|
|
61
|
-
.
|
|
62
|
-
color: var(--color-text);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.filter:hover {
|
|
66
|
-
color: var(--color-dark);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.filter:hover .filterOnlyButton {
|
|
87
|
+
.filterGroupItem:hover .filterGroupOnlyButton {
|
|
70
88
|
display: block;
|
|
71
89
|
}
|
|
72
90
|
|
|
73
|
-
/** Filter standard variation */
|
|
74
|
-
.filterStandalone {
|
|
75
|
-
padding: 0;
|
|
76
|
-
width: auto;
|
|
77
|
-
color: var(--color-text-light);
|
|
78
|
-
z-index: var(--layout-xlow); /* show collapsed border */
|
|
79
|
-
font-size: var(--size-small);
|
|
80
|
-
line-height: var(--space-small);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.filterStandalone .filterCheckbox {
|
|
84
|
-
padding: calc(var(--space-xxsmall) - 1px) calc(var(--space-xxsmall) - 1px);
|
|
85
|
-
border: 1px solid var(--color-outline);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.filterStandalone:hover .filterCheckbox,
|
|
89
|
-
.filterStandalone:active .filterCheckbox,
|
|
90
|
-
.filterStandalone:focus .filterCheckbox {
|
|
91
|
-
z-index: var(--layout-xlow); /* show collapsed border */
|
|
92
|
-
box-shadow: var(--outline-hover);
|
|
93
|
-
color: var(--color-text);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
91
|
/** Filter group variation */
|
|
97
|
-
.
|
|
92
|
+
.filterGroupLabelSuffixCustom {
|
|
98
93
|
color: var(--color-text);
|
|
99
94
|
text-transform: lowercase;
|
|
100
95
|
}
|
|
@@ -112,11 +107,6 @@
|
|
|
112
107
|
color: var(--color-text-light);
|
|
113
108
|
}
|
|
114
109
|
|
|
115
|
-
.filterGroupItems {
|
|
116
|
-
max-height: calc(10 * (var(--space-small) + 2 * var(--space-xxxsmall)));
|
|
117
|
-
overflow: auto;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
110
|
.filterGroupActions {
|
|
121
111
|
margin-top: var(--space-xxxsmall);
|
|
122
112
|
padding-top: var(--space-xxxsmall);
|
|
@@ -124,12 +114,3 @@
|
|
|
124
114
|
margin-bottom: calc(0px - var(--space-xxxsmall));
|
|
125
115
|
border-top: 1px solid var(--color-outline);
|
|
126
116
|
}
|
|
127
|
-
|
|
128
|
-
.item {
|
|
129
|
-
position: relative;
|
|
130
|
-
flex: 0 0 auto;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.itemButton {
|
|
134
|
-
border-radius: var(--radius-small);
|
|
135
|
-
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions'; // eslint-disable-line
|
|
4
|
+
|
|
5
|
+
import { getWrapperDecorator } from '../../stories';
|
|
6
|
+
import { Filters } from '.';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'UI/Filters',
|
|
10
|
+
component: Filters,
|
|
11
|
+
decorators: [getWrapperDecorator({ paddingLeft: '200px' })],
|
|
12
|
+
} as Meta;
|
|
13
|
+
|
|
14
|
+
export const Default = () => (
|
|
15
|
+
<Filters
|
|
16
|
+
onChange={action('CHANGE')}
|
|
17
|
+
filters={{
|
|
18
|
+
changed: {
|
|
19
|
+
label: 'Changed',
|
|
20
|
+
defaultValue: true,
|
|
21
|
+
},
|
|
22
|
+
fileTypes: {
|
|
23
|
+
label: 'File types',
|
|
24
|
+
children: [
|
|
25
|
+
{
|
|
26
|
+
key: 'CSS',
|
|
27
|
+
label: 'CSS',
|
|
28
|
+
defaultValue: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: 'JS',
|
|
32
|
+
label: 'JS',
|
|
33
|
+
defaultValue: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: 'HTML',
|
|
37
|
+
label: 'HTML',
|
|
38
|
+
defaultValue: true,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: 'OTHER',
|
|
42
|
+
label: 'Asset that is not CSS, JS or HTML',
|
|
43
|
+
defaultValue: true,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const Overflow = () => (
|
|
52
|
+
<Filters
|
|
53
|
+
onChange={action('CHANGE')}
|
|
54
|
+
filters={{
|
|
55
|
+
changed: {
|
|
56
|
+
label: 'Changed',
|
|
57
|
+
defaultValue: true,
|
|
58
|
+
},
|
|
59
|
+
chunks: {
|
|
60
|
+
label: 'Chunks',
|
|
61
|
+
children: Array(22)
|
|
62
|
+
.fill('')
|
|
63
|
+
.map((_, currentIndex) => ({
|
|
64
|
+
key: `chunk-${currentIndex}`,
|
|
65
|
+
label: `Chunk ${currentIndex + 1}`,
|
|
66
|
+
defaultValue: true,
|
|
67
|
+
})),
|
|
68
|
+
},
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
export const DisableOptions = () => (
|
|
74
|
+
<Filters
|
|
75
|
+
onChange={action('CHANGE')}
|
|
76
|
+
filters={{
|
|
77
|
+
changed: {
|
|
78
|
+
label: 'Changed',
|
|
79
|
+
defaultValue: false,
|
|
80
|
+
disabled: true,
|
|
81
|
+
},
|
|
82
|
+
entrypoint: {
|
|
83
|
+
label: 'Entrypoint',
|
|
84
|
+
defaultValue: false,
|
|
85
|
+
},
|
|
86
|
+
fileTypes: {
|
|
87
|
+
label: 'File types',
|
|
88
|
+
children: [
|
|
89
|
+
{
|
|
90
|
+
key: 'CSS',
|
|
91
|
+
label: 'CSS',
|
|
92
|
+
defaultValue: true,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: 'JS',
|
|
96
|
+
label: 'JS',
|
|
97
|
+
defaultValue: true,
|
|
98
|
+
disabled: true,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: 'HTML',
|
|
102
|
+
label: 'HTML',
|
|
103
|
+
defaultValue: true,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
}}
|
|
108
|
+
/>
|
|
109
|
+
);
|