@bundle-stats/ui 4.8.4 → 4.9.0-beta.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/lib/components/bundle-assets/bundle-assets.js +2 -2
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +2 -2
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.js +2 -2
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/index.js +1 -3
- package/lib/components/index.js.map +1 -1
- package/lib/ui/filters/filters.i18n.js +4 -1
- package/lib/ui/filters/filters.i18n.js.map +1 -1
- package/lib/ui/filters/filters.js +22 -6
- package/lib/ui/filters/filters.js.map +1 -1
- package/lib/ui/filters/filters.module.css +29 -0
- package/lib/ui/index.js +3 -1
- package/lib/ui/index.js.map +1 -1
- package/lib/ui/input/index.js.map +1 -1
- package/lib/ui/input/input.js +2 -10
- package/lib/ui/input/input.js.map +1 -1
- package/lib/{components/metrics-table-search → ui/input-search}/index.js +1 -1
- package/lib/ui/input-search/index.js.map +1 -0
- package/lib/ui/input-search/input-search.js +63 -0
- package/lib/ui/input-search/input-search.js.map +1 -0
- package/lib-esm/components/bundle-assets/bundle-assets.js +2 -2
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +2 -2
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.js +2 -2
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/index.js +0 -1
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/ui/filters/filters.i18n.js +3 -0
- package/lib-esm/ui/filters/filters.i18n.js.map +1 -1
- package/lib-esm/ui/filters/filters.js +23 -7
- package/lib-esm/ui/filters/filters.js.map +1 -1
- package/lib-esm/ui/filters/filters.module.css +29 -0
- package/lib-esm/ui/index.js +1 -0
- package/lib-esm/ui/index.js.map +1 -1
- package/lib-esm/ui/input/index.js.map +1 -1
- package/lib-esm/ui/input/input.js +2 -10
- package/lib-esm/ui/input/input.js.map +1 -1
- package/lib-esm/ui/input-search/index.js +2 -0
- package/lib-esm/ui/input-search/index.js.map +1 -0
- package/lib-esm/ui/input-search/input-search.js +33 -0
- package/lib-esm/ui/input-search/input-search.js.map +1 -0
- package/package.json +10 -10
- package/src/components/bundle-assets/bundle-assets.jsx +4 -4
- package/src/components/bundle-modules/bundle-modules.tsx +4 -4
- package/src/components/bundle-packages/bundle-packages.jsx +4 -4
- package/src/components/index.js +0 -1
- package/src/ui/filters/filters.i18n.ts +3 -0
- package/src/ui/filters/filters.module.css +29 -0
- package/src/ui/filters/filters.tsx +63 -25
- package/src/ui/index.js +1 -0
- package/src/ui/input/input.stories.tsx +13 -0
- package/src/ui/input/input.tsx +16 -0
- package/src/ui/input-search/index.ts +1 -0
- package/src/ui/input-search/input-search.tsx +82 -0
- package/types/components/index.d.ts +0 -1
- package/types/ui/filters/filters.i18n.d.ts +3 -0
- package/types/ui/index.d.ts +1 -0
- package/types/ui/input/index.d.ts +1 -1
- package/types/ui/input/input.d.ts +5 -18
- package/types/ui/input-search/index.d.ts +1 -0
- package/types/ui/input-search/input-search.d.ts +9 -0
- package/lib/components/metrics-table-search/index.js.map +0 -1
- package/lib/components/metrics-table-search/metrics-table-search.js +0 -73
- package/lib/components/metrics-table-search/metrics-table-search.js.map +0 -1
- package/lib-esm/components/metrics-table-search/index.js +0 -2
- package/lib-esm/components/metrics-table-search/index.js.map +0 -1
- package/lib-esm/components/metrics-table-search/metrics-table-search.js +0 -43
- package/lib-esm/components/metrics-table-search/metrics-table-search.js.map +0 -1
- package/src/components/metrics-table-search/index.js +0 -1
- package/src/components/metrics-table-search/metrics-table-search.jsx +0 -72
- package/src/ui/input/input.jsx +0 -20
- package/types/components/metrics-table-search/index.d.ts +0 -1
- package/types/components/metrics-table-search/metrics-table-search.d.ts +0 -17
- /package/lib/{components/metrics-table-search/metrics-table-search.module.css → ui/input-search/input-search.module.css} +0 -0
- /package/lib-esm/{components/metrics-table-search/metrics-table-search.module.css → ui/input-search/input-search.module.css} +0 -0
- /package/src/ui/input/{index.js → index.ts} +0 -0
- /package/src/{components/metrics-table-search/metrics-table-search.module.css → ui/input-search/input-search.module.css} +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
|
|
4
4
|
import type { FilterFieldsData, FilterGroupFieldData } from '../../types';
|
|
5
5
|
import { FlexStack } from '../../layout/flex-stack';
|
|
6
|
+
import { Stack } from '../../layout/stack';
|
|
6
7
|
import { Dropdown } from '../dropdown';
|
|
8
|
+
import { InputSearch } from '../input-search';
|
|
7
9
|
import * as I18N from './filters.i18n';
|
|
8
10
|
import { getGroupFiltersLabelSuffix, LABELS } from './filters.utils';
|
|
9
11
|
import css from './filters.module.css';
|
|
@@ -75,6 +77,8 @@ const FilterGroup = (props: FilterGroupProps) => {
|
|
|
75
77
|
toggleFilters,
|
|
76
78
|
} = props;
|
|
77
79
|
|
|
80
|
+
const [search, setSearch] = useState('');
|
|
81
|
+
|
|
78
82
|
const { label: groupLabel, children: groupItems } = data;
|
|
79
83
|
|
|
80
84
|
const areAllGroupItemsChecked = groupItems
|
|
@@ -108,6 +112,14 @@ const FilterGroup = (props: FilterGroupProps) => {
|
|
|
108
112
|
});
|
|
109
113
|
};
|
|
110
114
|
|
|
115
|
+
const filteredGroupItems = useMemo(() => {
|
|
116
|
+
if (!search) {
|
|
117
|
+
return groupItems;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return groupItems.filter((item) => item.label.match(new RegExp(`${search}`, 'i')));
|
|
121
|
+
}, [search, groupItems]);
|
|
122
|
+
|
|
111
123
|
return (
|
|
112
124
|
<Dropdown
|
|
113
125
|
className={className}
|
|
@@ -118,8 +130,32 @@ const FilterGroup = (props: FilterGroupProps) => {
|
|
|
118
130
|
{({ MenuItem, menuItemClassName }) => {
|
|
119
131
|
return (
|
|
120
132
|
<>
|
|
133
|
+
{groupItems.length > 10 && (
|
|
134
|
+
<div className={css.filterGroupSearchWrapper}>
|
|
135
|
+
<InputSearch
|
|
136
|
+
defaultValue={search}
|
|
137
|
+
onChange={setSearch}
|
|
138
|
+
placeholder={I18N.CHUNKS_SEARCH}
|
|
139
|
+
debounceWait={0}
|
|
140
|
+
/>
|
|
141
|
+
</div>
|
|
142
|
+
)}
|
|
121
143
|
<div className={css.filterGroupItems}>
|
|
122
|
-
{
|
|
144
|
+
{filteredGroupItems.length === 0 && (
|
|
145
|
+
<Stack className={css.filterGroupSearchNotFound}>
|
|
146
|
+
<p>{I18N.CHUNKS_NOT_FOUND}</p>
|
|
147
|
+
<div>
|
|
148
|
+
<button
|
|
149
|
+
type="button"
|
|
150
|
+
onClick={() => setSearch('')}
|
|
151
|
+
className={css.filterGroupSearchNotFoundClear}
|
|
152
|
+
>
|
|
153
|
+
{I18N.CHUNKS_SEARCH_CLEAR}
|
|
154
|
+
</button>
|
|
155
|
+
</div>
|
|
156
|
+
</Stack>
|
|
157
|
+
)}
|
|
158
|
+
{filteredGroupItems.map(({ key: itemKey, ...itemData }) => {
|
|
123
159
|
const id = [groupKey, itemKey].join('.');
|
|
124
160
|
const getOnOnlyClick = () => getOnGroupCheck(false, { [id]: true });
|
|
125
161
|
|
|
@@ -138,29 +174,31 @@ const FilterGroup = (props: FilterGroupProps) => {
|
|
|
138
174
|
);
|
|
139
175
|
})}
|
|
140
176
|
</div>
|
|
141
|
-
|
|
142
|
-
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
177
|
+
{filteredGroupItems.length !== 0 && (
|
|
178
|
+
<div className={css.filterGroupActions}>
|
|
179
|
+
{areAllGroupItemsChecked ? (
|
|
180
|
+
<MenuItem
|
|
181
|
+
id="clear-all"
|
|
182
|
+
as="button"
|
|
183
|
+
className={menuItemClassName}
|
|
184
|
+
type="button"
|
|
185
|
+
onClick={getOnGroupCheck(false)}
|
|
186
|
+
>
|
|
187
|
+
{I18N.CLEAR}
|
|
188
|
+
</MenuItem>
|
|
189
|
+
) : (
|
|
190
|
+
<MenuItem
|
|
191
|
+
id="clear-all"
|
|
192
|
+
as="button"
|
|
193
|
+
className={menuItemClassName}
|
|
194
|
+
type="button"
|
|
195
|
+
onClick={getOnGroupCheck(true)}
|
|
196
|
+
>
|
|
197
|
+
{I18N.CHECK}
|
|
198
|
+
</MenuItem>
|
|
199
|
+
)}
|
|
200
|
+
</div>
|
|
201
|
+
)}
|
|
164
202
|
</>
|
|
165
203
|
);
|
|
166
204
|
}}
|
package/src/ui/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { HorizontalBarChart } from './horizontal-bar-chart';
|
|
|
8
8
|
export { HoverCard } from './hover-card';
|
|
9
9
|
export { Icon } from './icon';
|
|
10
10
|
export { Input } from './input';
|
|
11
|
+
export { InputSearch } from './input-search';
|
|
11
12
|
export { Loader } from './loader';
|
|
12
13
|
export { Skeleton } from './skeleton';
|
|
13
14
|
export { Table } from './table';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { getWrapperDecorator } from '../../stories';
|
|
4
|
+
import { Input } from '.';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'UI/Input',
|
|
8
|
+
component: Input,
|
|
9
|
+
decorators: [getWrapperDecorator()],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Default = () => <Input placeholder="Search" />;
|
|
13
|
+
export const WithSize = () => <Input placeholder="Search" size="small" />;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
|
|
4
|
+
import css from './input.module.css';
|
|
5
|
+
|
|
6
|
+
interface InputProps {
|
|
7
|
+
size?: 'small' | 'medium' | 'large';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Input = (props: InputProps & Omit<React.ComponentProps<'input'>, 'size'>) => {
|
|
11
|
+
const { className = '', size = 'medium', ...restProps } = props;
|
|
12
|
+
|
|
13
|
+
const rootClassName = cx(css.root, className, css[size]);
|
|
14
|
+
|
|
15
|
+
return <input className={rootClassName} {...restProps} />;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './input-search';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import debounce from 'lodash/debounce';
|
|
4
|
+
import noop from 'lodash/noop';
|
|
5
|
+
|
|
6
|
+
import { Icon } from '../icon';
|
|
7
|
+
import { Input } from '../input';
|
|
8
|
+
|
|
9
|
+
import css from './input-search.module.css';
|
|
10
|
+
|
|
11
|
+
interface InputSearchProps {
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
onChange?: (newValue: string) => void;
|
|
15
|
+
debounceWait?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const InputSearch = (
|
|
19
|
+
props: InputSearchProps & Omit<React.ComponentProps<'div'>, 'onChange'>,
|
|
20
|
+
) => {
|
|
21
|
+
const {
|
|
22
|
+
className = '',
|
|
23
|
+
placeholder = 'Search',
|
|
24
|
+
defaultValue = '',
|
|
25
|
+
onChange = noop,
|
|
26
|
+
debounceWait = 500,
|
|
27
|
+
} = props;
|
|
28
|
+
const rootClassname = cx(css.root, className);
|
|
29
|
+
|
|
30
|
+
const [value, setValue] = useState(defaultValue);
|
|
31
|
+
|
|
32
|
+
// Update local state when default value changes
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setValue(defaultValue);
|
|
35
|
+
}, [defaultValue]);
|
|
36
|
+
|
|
37
|
+
const debouncedUpdateSearch = useCallback(debounce(onChange, debounceWait), [onChange]);
|
|
38
|
+
|
|
39
|
+
const changeValue = useCallback(
|
|
40
|
+
(newValue: string) => {
|
|
41
|
+
if (newValue !== value) {
|
|
42
|
+
debouncedUpdateSearch(newValue);
|
|
43
|
+
setValue(newValue);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
[setValue, value],
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const inputOnChange = useCallback(
|
|
50
|
+
(event: React.ChangeEvent<HTMLInputElement>) => {
|
|
51
|
+
changeValue(event.target.value);
|
|
52
|
+
},
|
|
53
|
+
[changeValue],
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const clearButtonOnClick = useCallback(() => {
|
|
57
|
+
changeValue('');
|
|
58
|
+
}, [changeValue]);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className={rootClassname}>
|
|
62
|
+
<Input
|
|
63
|
+
className={css.input}
|
|
64
|
+
placeholder={placeholder}
|
|
65
|
+
onChange={inputOnChange}
|
|
66
|
+
value={value}
|
|
67
|
+
size="small"
|
|
68
|
+
autoComplete="off"
|
|
69
|
+
/>
|
|
70
|
+
{value && (
|
|
71
|
+
<button
|
|
72
|
+
className={css.cancelButton}
|
|
73
|
+
type="button"
|
|
74
|
+
onClick={clearButtonOnClick}
|
|
75
|
+
aria-label="Clear search"
|
|
76
|
+
>
|
|
77
|
+
<Icon className={css.cancelButtonIcon} glyph={Icon.ICONS.CANCEL} />
|
|
78
|
+
</button>
|
|
79
|
+
)}
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
@@ -14,7 +14,6 @@ export { LighthouseTable } from "./lighthouse-table";
|
|
|
14
14
|
export { Metric } from "./metric";
|
|
15
15
|
export { MetricsTable } from "./metrics-table";
|
|
16
16
|
export { MetricsTableOptions } from "./metrics-table-options";
|
|
17
|
-
export { MetricsTableSearch } from "./metrics-table-search";
|
|
18
17
|
export { MetricsTableTitle } from "./metrics-table-title";
|
|
19
18
|
export { ModuleInfo } from "./module-info";
|
|
20
19
|
export { Summary } from "./summary";
|
package/types/ui/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { HorizontalBarChart } from "./horizontal-bar-chart";
|
|
|
8
8
|
export { HoverCard } from "./hover-card";
|
|
9
9
|
export { Icon } from "./icon";
|
|
10
10
|
export { Input } from "./input";
|
|
11
|
+
export { InputSearch } from "./input-search";
|
|
11
12
|
export { Loader } from "./loader";
|
|
12
13
|
export { Skeleton } from "./skeleton";
|
|
13
14
|
export { Table } from "./table";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './input';
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
export function Input({ className, size, ...restProps }: {
|
|
2
|
-
[x: string]: any;
|
|
3
|
-
className: any;
|
|
4
|
-
size: any;
|
|
5
|
-
}): React.JSX.Element;
|
|
6
|
-
export namespace Input {
|
|
7
|
-
namespace propTypes {
|
|
8
|
-
let className: PropTypes.Requireable<string>;
|
|
9
|
-
let size: PropTypes.Requireable<string>;
|
|
10
|
-
}
|
|
11
|
-
namespace defaultProps {
|
|
12
|
-
let className_1: string;
|
|
13
|
-
export { className_1 as className };
|
|
14
|
-
let size_1: string;
|
|
15
|
-
export { size_1 as size };
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
1
|
import React from 'react';
|
|
19
|
-
|
|
2
|
+
interface InputProps {
|
|
3
|
+
size?: 'small' | 'medium' | 'large';
|
|
4
|
+
}
|
|
5
|
+
export declare const Input: (props: InputProps & Omit<React.ComponentProps<'input'>, 'size'>) => React.JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './input-search';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface InputSearchProps {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
onChange?: (newValue: string) => void;
|
|
6
|
+
debounceWait?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const InputSearch: (props: InputSearchProps & Omit<React.ComponentProps<'div'>, 'onChange'>) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/metrics-table-search/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.MetricsTableSearch = void 0;
|
|
30
|
-
const react_1 = __importStar(require("react"));
|
|
31
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
32
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
33
|
-
const debounce_1 = __importDefault(require("lodash/debounce"));
|
|
34
|
-
const icon_1 = require("../../ui/icon");
|
|
35
|
-
const input_1 = require("../../ui/input");
|
|
36
|
-
const metrics_table_search_module_css_1 = __importDefault(require("./metrics-table-search.module.css"));
|
|
37
|
-
const MetricsTableSearch = (props) => {
|
|
38
|
-
const { className, placeholder, search, updateSearch } = props;
|
|
39
|
-
const rootClassname = (0, classnames_1.default)(metrics_table_search_module_css_1.default.root, className);
|
|
40
|
-
const [value, setValue] = (0, react_1.useState)(search);
|
|
41
|
-
(0, react_1.useEffect)(() => {
|
|
42
|
-
setValue(search);
|
|
43
|
-
}, [search]);
|
|
44
|
-
const debouncedUpdateSearch = (0, react_1.useCallback)((0, debounce_1.default)(updateSearch, 500), []);
|
|
45
|
-
const handleChangeValue = (0, react_1.useCallback)((event) => {
|
|
46
|
-
const newValue = event.target.value;
|
|
47
|
-
setValue(newValue);
|
|
48
|
-
if (newValue !== search) {
|
|
49
|
-
debouncedUpdateSearch(newValue);
|
|
50
|
-
}
|
|
51
|
-
}, [search]);
|
|
52
|
-
const handleClearValue = (0, react_1.useCallback)(() => {
|
|
53
|
-
const newValue = '';
|
|
54
|
-
setValue(newValue);
|
|
55
|
-
updateSearch(newValue);
|
|
56
|
-
}, []);
|
|
57
|
-
return (react_1.default.createElement("div", { className: rootClassname },
|
|
58
|
-
react_1.default.createElement(input_1.Input, { className: metrics_table_search_module_css_1.default.input, placeholder: placeholder, onChange: handleChangeValue, value: value, size: "small", autoComplete: "off" }),
|
|
59
|
-
search && (react_1.default.createElement("button", { className: metrics_table_search_module_css_1.default.cancelButton, type: "button", onClick: handleClearValue },
|
|
60
|
-
react_1.default.createElement(icon_1.Icon, { className: metrics_table_search_module_css_1.default.cancelButtonIcon, glyph: icon_1.Icon.ICONS.CANCEL })))));
|
|
61
|
-
};
|
|
62
|
-
exports.MetricsTableSearch = MetricsTableSearch;
|
|
63
|
-
exports.MetricsTableSearch.propTypes = {
|
|
64
|
-
className: prop_types_1.default.string,
|
|
65
|
-
placeholder: prop_types_1.default.string,
|
|
66
|
-
search: prop_types_1.default.string.isRequired,
|
|
67
|
-
updateSearch: prop_types_1.default.func.isRequired,
|
|
68
|
-
};
|
|
69
|
-
exports.MetricsTableSearch.defaultProps = {
|
|
70
|
-
className: '',
|
|
71
|
-
placeholder: '',
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=metrics-table-search.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics-table-search.js","sourceRoot":"","sources":["../../../src/components/metrics-table-search/metrics-table-search.jsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgE;AAChE,4DAAmC;AACnC,4DAA4B;AAC5B,+DAAuC;AAEvC,wCAAqC;AACrC,0CAAuC;AAEvC,wGAAoD;AAE7C,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,EAAE;IAC1C,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,aAAa,GAAG,IAAA,oBAAE,EAAC,yCAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAE9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,MAAM,CAAC,CAAC;IAG3C,IAAA,iBAAS,EAAC,GA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BAAkB,sBAiD7B;AAEF,0BAAkB,CAAC,SAAS,GAAG;IAC7B,SAAS,EAAE,oBAAS,CAAC,MAAM;IAC3B,WAAW,EAAE,oBAAS,CAAC,MAAM;IAC7B,MAAM,EAAE,oBAAS,CAAC,MAAM,CAAC,UAAU;IACnC,YAAY,EAAE,oBAAS,CAAC,IAAI,CAAC,UAAU;CACxC,CAAC;AAEF,0BAAkB,CAAC,YAAY,GAAG;IAChC,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,EAAE;CAChB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/metrics-table-search/index.js"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import cx from 'classnames';
|
|
4
|
-
import debounce from 'lodash/debounce';
|
|
5
|
-
import { Icon } from '../../ui/icon';
|
|
6
|
-
import { Input } from '../../ui/input';
|
|
7
|
-
import css from './metrics-table-search.module.css';
|
|
8
|
-
export const MetricsTableSearch = (props) => {
|
|
9
|
-
const { className, placeholder, search, updateSearch } = props;
|
|
10
|
-
const rootClassname = cx(css.root, className);
|
|
11
|
-
const [value, setValue] = useState(search);
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
setValue(search);
|
|
14
|
-
}, [search]);
|
|
15
|
-
const debouncedUpdateSearch = useCallback(debounce(updateSearch, 500), []);
|
|
16
|
-
const handleChangeValue = useCallback((event) => {
|
|
17
|
-
const newValue = event.target.value;
|
|
18
|
-
setValue(newValue);
|
|
19
|
-
if (newValue !== search) {
|
|
20
|
-
debouncedUpdateSearch(newValue);
|
|
21
|
-
}
|
|
22
|
-
}, [search]);
|
|
23
|
-
const handleClearValue = useCallback(() => {
|
|
24
|
-
const newValue = '';
|
|
25
|
-
setValue(newValue);
|
|
26
|
-
updateSearch(newValue);
|
|
27
|
-
}, []);
|
|
28
|
-
return (React.createElement("div", { className: rootClassname },
|
|
29
|
-
React.createElement(Input, { className: css.input, placeholder: placeholder, onChange: handleChangeValue, value: value, size: "small", autoComplete: "off" }),
|
|
30
|
-
search && (React.createElement("button", { className: css.cancelButton, type: "button", onClick: handleClearValue },
|
|
31
|
-
React.createElement(Icon, { className: css.cancelButtonIcon, glyph: Icon.ICONS.CANCEL })))));
|
|
32
|
-
};
|
|
33
|
-
MetricsTableSearch.propTypes = {
|
|
34
|
-
className: PropTypes.string,
|
|
35
|
-
placeholder: PropTypes.string,
|
|
36
|
-
search: PropTypes.string.isRequired,
|
|
37
|
-
updateSearch: PropTypes.func.isRequired,
|
|
38
|
-
};
|
|
39
|
-
MetricsTableSearch.defaultProps = {
|
|
40
|
-
className: '',
|
|
41
|
-
placeholder: '',
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=metrics-table-search.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics-table-search.js","sourceRoot":"","sources":["../../../src/components/metrics-table-search/metrics-table-search.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,GAAG,MAAM,mCAAmC,CAAC;AAEpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,EAAE;IAC1C,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,aAAa,GAAG,EAAE,CAA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,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAI,CAC5D,CACV,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAkB,CAAC,SAAS,GAAG;IAC7B,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,WAAW,EAAE,SAAS,CAAC,MAAM;IAC7B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACnC,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;CACxC,CAAC;AAEF,kBAAkB,CAAC,YAAY,GAAG;IAChC,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,EAAE;CAChB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './metrics-table-search';
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import cx from 'classnames';
|
|
4
|
-
import debounce from 'lodash/debounce';
|
|
5
|
-
|
|
6
|
-
import { Icon } from '../../ui/icon';
|
|
7
|
-
import { Input } from '../../ui/input';
|
|
8
|
-
|
|
9
|
-
import css from './metrics-table-search.module.css';
|
|
10
|
-
|
|
11
|
-
export const MetricsTableSearch = (props) => {
|
|
12
|
-
const { className, placeholder, search, updateSearch } = props;
|
|
13
|
-
const rootClassname = cx(css.root, className);
|
|
14
|
-
|
|
15
|
-
const [value, setValue] = useState(search);
|
|
16
|
-
|
|
17
|
-
// Update local state when initial value has changed
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setValue(search);
|
|
20
|
-
}, [search]);
|
|
21
|
-
|
|
22
|
-
const debouncedUpdateSearch = useCallback(debounce(updateSearch, 500), []);
|
|
23
|
-
|
|
24
|
-
const handleChangeValue = useCallback(
|
|
25
|
-
(event) => {
|
|
26
|
-
const newValue = event.target.value;
|
|
27
|
-
setValue(newValue);
|
|
28
|
-
|
|
29
|
-
// Update parent state when the local value has changed
|
|
30
|
-
if (newValue !== search) {
|
|
31
|
-
debouncedUpdateSearch(newValue);
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
[search],
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const handleClearValue = useCallback(() => {
|
|
38
|
-
const newValue = '';
|
|
39
|
-
setValue(newValue);
|
|
40
|
-
updateSearch(newValue);
|
|
41
|
-
}, []);
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div className={rootClassname}>
|
|
45
|
-
<Input
|
|
46
|
-
className={css.input}
|
|
47
|
-
placeholder={placeholder}
|
|
48
|
-
onChange={handleChangeValue}
|
|
49
|
-
value={value}
|
|
50
|
-
size="small"
|
|
51
|
-
autoComplete="off"
|
|
52
|
-
/>
|
|
53
|
-
{search && (
|
|
54
|
-
<button className={css.cancelButton} type="button" onClick={handleClearValue}>
|
|
55
|
-
<Icon className={css.cancelButtonIcon} glyph={Icon.ICONS.CANCEL} />
|
|
56
|
-
</button>
|
|
57
|
-
)}
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
MetricsTableSearch.propTypes = {
|
|
63
|
-
className: PropTypes.string,
|
|
64
|
-
placeholder: PropTypes.string,
|
|
65
|
-
search: PropTypes.string.isRequired,
|
|
66
|
-
updateSearch: PropTypes.func.isRequired,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
MetricsTableSearch.defaultProps = {
|
|
70
|
-
className: '',
|
|
71
|
-
placeholder: '',
|
|
72
|
-
};
|
package/src/ui/input/input.jsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
import css from './input.module.css';
|
|
6
|
-
|
|
7
|
-
export const Input = ({ className, size, ...restProps }) => {
|
|
8
|
-
const rootClassName = cx(css.root, className, css[size]);
|
|
9
|
-
return <input className={rootClassName} {...restProps} />;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
Input.propTypes = {
|
|
13
|
-
className: PropTypes.string,
|
|
14
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
Input.defaultProps = {
|
|
18
|
-
className: '',
|
|
19
|
-
size: 'medium',
|
|
20
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./metrics-table-search";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function MetricsTableSearch(props: any): React.JSX.Element;
|
|
2
|
-
export namespace MetricsTableSearch {
|
|
3
|
-
namespace propTypes {
|
|
4
|
-
let className: PropTypes.Requireable<string>;
|
|
5
|
-
let placeholder: PropTypes.Requireable<string>;
|
|
6
|
-
let search: PropTypes.Validator<string>;
|
|
7
|
-
let updateSearch: PropTypes.Validator<(...args: any[]) => any>;
|
|
8
|
-
}
|
|
9
|
-
namespace defaultProps {
|
|
10
|
-
let className_1: string;
|
|
11
|
-
export { className_1 as className };
|
|
12
|
-
let placeholder_1: string;
|
|
13
|
-
export { placeholder_1 as placeholder };
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
import React from 'react';
|
|
17
|
-
import PropTypes from 'prop-types';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|