@codacy/ui-components 0.50.2 → 0.50.4
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/Select/Select.d.ts +2 -2
- package/lib/Select/Select.js +35 -64
- package/lib/Select/types.d.ts +3 -9
- package/lib/Table/Table.js +2 -2
- package/package.json +22 -21
- package/lib/Select/style.d.ts +0 -2
- package/lib/Select/style.js +0 -76
package/lib/Select/Select.d.ts
CHANGED
package/lib/Select/Select.js
CHANGED
|
@@ -1,70 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { InputWrapper, InputErrorMessage } from '../Input/styles';
|
|
5
|
-
import { customStyles } from './style';
|
|
6
|
-
import { ChevronDownIcon } from '../Icons';
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
3
|
+
import { Dropdown, DropdownItem, SelectTrigger } from '../';
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
icon: ChevronDownIcon,
|
|
11
|
-
size: "md"
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
var DropdownIndicator = function DropdownIndicator(props) {
|
|
16
|
-
return /*#__PURE__*/React.createElement(components.DropdownIndicator, props, /*#__PURE__*/React.createElement(CaretDownIcon, null));
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
var StyledSelect = function StyledSelect(_ref) {
|
|
5
|
+
/** @deprecated Use Dropdown + SelectTrigger instead */
|
|
6
|
+
export var Select = function Select(_ref) {
|
|
20
7
|
var options = _ref.options,
|
|
21
|
-
placeholder = _ref.placeholder,
|
|
22
|
-
_ref$isSearchable = _ref.isSearchable,
|
|
23
|
-
isSearchable = _ref$isSearchable === void 0 ? false : _ref$isSearchable,
|
|
24
|
-
name = _ref.name,
|
|
25
8
|
id = _ref.id,
|
|
26
|
-
label = _ref.label,
|
|
27
|
-
_ref$required = _ref.required,
|
|
28
|
-
required = _ref$required === void 0 ? false : _ref$required,
|
|
29
|
-
size = _ref.size,
|
|
30
|
-
_ref$hasError = _ref.hasError,
|
|
31
|
-
hasError = _ref$hasError === void 0 ? false : _ref$hasError,
|
|
32
|
-
errorMessage = _ref.errorMessage,
|
|
33
|
-
inputId = _ref.inputId,
|
|
34
9
|
value = _ref.value,
|
|
35
|
-
_onChange = _ref.onChange
|
|
36
|
-
|
|
10
|
+
_onChange = _ref.onChange,
|
|
11
|
+
onOpen = _ref.onOpen,
|
|
12
|
+
onClose = _ref.onClose,
|
|
13
|
+
portal = _ref.portal,
|
|
14
|
+
inputProps = _objectWithoutProperties(_ref, ["options", "id", "value", "onChange", "onOpen", "onClose", "portal"]);
|
|
15
|
+
|
|
16
|
+
var dropdownProps = {
|
|
17
|
+
onOpen: onOpen,
|
|
18
|
+
onClose: onClose,
|
|
19
|
+
portal: portal
|
|
20
|
+
};
|
|
21
|
+
var getLabel = useCallback(function (val) {
|
|
22
|
+
var value = val ? val : undefined;
|
|
23
|
+
return value ? value.label : '';
|
|
24
|
+
}, []);
|
|
25
|
+
return /*#__PURE__*/React.createElement(Dropdown, Object.assign({
|
|
37
26
|
id: id,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
isSearchable: isSearchable,
|
|
46
|
-
name: name,
|
|
47
|
-
maxMenuHeight: 230,
|
|
48
|
-
onChange: function onChange(value) {
|
|
49
|
-
return _onChange(value);
|
|
27
|
+
size: inputProps.size,
|
|
28
|
+
trigger: /*#__PURE__*/React.createElement(SelectTrigger, Object.assign({
|
|
29
|
+
id: id ? "".concat(id, "-input") : undefined,
|
|
30
|
+
caption: getLabel
|
|
31
|
+
}, inputProps)),
|
|
32
|
+
onChange: function onChange(val) {
|
|
33
|
+
return _onChange(val);
|
|
50
34
|
},
|
|
51
|
-
|
|
52
|
-
}),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
forId: id,
|
|
59
|
-
label: label,
|
|
60
|
-
required: required,
|
|
61
|
-
size: size
|
|
62
|
-
}, content);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return /*#__PURE__*/React.createElement(InputWrapper, {
|
|
66
|
-
size: size
|
|
67
|
-
}, content);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export { StyledSelect as Select };
|
|
35
|
+
initialValue: value
|
|
36
|
+
}, dropdownProps), options.map(function (option) {
|
|
37
|
+
return /*#__PURE__*/React.createElement(DropdownItem, {
|
|
38
|
+
value: option
|
|
39
|
+
}, option.label);
|
|
40
|
+
}));
|
|
41
|
+
};
|
package/lib/Select/types.d.ts
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DropdownProps } from '../Dropdown/Dropdown.types';
|
|
2
|
+
import { SelectTriggerProps } from '../Dropdown/Triggers/types';
|
|
2
3
|
export declare type SelectOption = {
|
|
3
4
|
value: string;
|
|
4
5
|
label: string;
|
|
5
6
|
};
|
|
6
|
-
export interface SelectProps {
|
|
7
|
+
export interface SelectProps extends Pick<DropdownProps, 'onClose' | 'onOpen' | 'portal'>, Omit<SelectTriggerProps, 'value' | 'onChange' | 'caption'> {
|
|
7
8
|
id?: string;
|
|
8
9
|
inputId?: string;
|
|
9
10
|
options: Array<SelectOption>;
|
|
10
|
-
placeholder: string;
|
|
11
|
-
isSearchable?: boolean;
|
|
12
11
|
name: string;
|
|
13
|
-
label?: string;
|
|
14
|
-
required?: boolean;
|
|
15
|
-
size?: Size;
|
|
16
|
-
hasError?: boolean;
|
|
17
|
-
errorMessage?: string | null;
|
|
18
12
|
value?: SelectOption;
|
|
19
13
|
onChange: (value: SelectOption) => void;
|
|
20
14
|
}
|
package/lib/Table/Table.js
CHANGED
|
@@ -141,9 +141,9 @@ var VirtualRow = function VirtualRow(_ref8) {
|
|
|
141
141
|
props = _objectWithoutProperties(_ref8, ["children", "index", "height"]);
|
|
142
142
|
|
|
143
143
|
var scrollCtx = useContext(ScrollableContentContext);
|
|
144
|
-
var top = (index + 1
|
|
144
|
+
var top = (index + 1
|
|
145
145
|
/* +1 to acknowledge the header row */
|
|
146
|
-
height;
|
|
146
|
+
) * height;
|
|
147
147
|
var threshold = height / 2;
|
|
148
148
|
var inViewport = top >= scrollCtx.scroll - threshold && top <= scrollCtx.scroll + scrollCtx.height + threshold;
|
|
149
149
|
return /*#__PURE__*/React.createElement(StyledTableRow, Object.assign({}, props, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codacy/ui-components",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -28,29 +28,26 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.12.5",
|
|
31
|
-
"@
|
|
32
|
-
"@emotion/styled-base": "^10.0.31",
|
|
33
|
-
"@pathofdev/react-tag-input": "github:inesgomas/react-tag-input#9820d2ae045d9398fbd3ba9021f675b127003237",
|
|
34
|
-
"@popperjs/core": "^2.5.4",
|
|
31
|
+
"@pathofdev/react-tag-input": "github:inesgomas/react-tag-input",
|
|
35
32
|
"@styled-system/should-forward-prop": "^5.1.5",
|
|
36
33
|
"autosize": "^4.0.2",
|
|
37
34
|
"emotion-theming": "10.x",
|
|
38
|
-
"lodash": "^4.17.20",
|
|
39
35
|
"md5": "^2.3.0",
|
|
40
36
|
"polished": "^3.6.7",
|
|
41
37
|
"query-string": "^6.13.7",
|
|
42
38
|
"react-popper": "^2.2.4",
|
|
43
|
-
"react-select": "3.1.0",
|
|
44
|
-
"react-spring": "^8.0.27",
|
|
45
39
|
"styled-system": "^5.1.5"
|
|
46
40
|
},
|
|
47
41
|
"devDependencies": {
|
|
48
42
|
"@babel/cli": "^7.12.1",
|
|
49
43
|
"@babel/core": "^7.12.3",
|
|
50
|
-
"@emotion/
|
|
51
|
-
"@
|
|
44
|
+
"@emotion/core": "^10.3.0",
|
|
45
|
+
"@emotion/styled": "^10.3.0",
|
|
46
|
+
"@emotion/styled-base": "^10.3.0",
|
|
47
|
+
"@popperjs/core": "^2.5.4",
|
|
48
|
+
"@storybook/addon-docs": "^6.4.9",
|
|
52
49
|
"@storybook/addons": "^6.3.8",
|
|
53
|
-
"@storybook/react": "^6.
|
|
50
|
+
"@storybook/react": "^6.4.9",
|
|
54
51
|
"@testing-library/dom": "^6.16.0",
|
|
55
52
|
"@testing-library/jest-dom": "^5.11.6",
|
|
56
53
|
"@testing-library/react": "^10.4.9",
|
|
@@ -61,7 +58,6 @@
|
|
|
61
58
|
"@types/md5": "^2.2.1",
|
|
62
59
|
"@types/react": "^16.9.56",
|
|
63
60
|
"@types/react-dom": "^16.9.9",
|
|
64
|
-
"@types/react-select": "3.0.13",
|
|
65
61
|
"@types/resize-observer-browser": "^0.1.6",
|
|
66
62
|
"@types/styled-system": "^5.1.10",
|
|
67
63
|
"@types/styled-system__should-forward-prop": "^5.1.2",
|
|
@@ -72,14 +68,14 @@
|
|
|
72
68
|
"babel-plugin-emotion": "^10.0.33",
|
|
73
69
|
"babel-preset-react-app": "^9.1.2",
|
|
74
70
|
"copy-to-clipboard": "^3.3.1",
|
|
75
|
-
"depcheck": "^
|
|
71
|
+
"depcheck": "^1.4.2",
|
|
76
72
|
"eslint": "^6.8.0",
|
|
77
73
|
"eslint-config-prettier": "^6.15.0",
|
|
78
74
|
"eslint-config-react-app": "^5.2.1",
|
|
79
75
|
"eslint-plugin-flowtype": "^3.13.0",
|
|
80
76
|
"eslint-plugin-import": "^2.22.1",
|
|
81
77
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
82
|
-
"eslint-plugin-mdx": "^1.
|
|
78
|
+
"eslint-plugin-mdx": "^1.16.0",
|
|
83
79
|
"eslint-plugin-prettier": "^3.1.4",
|
|
84
80
|
"eslint-plugin-react": "^7.21.5",
|
|
85
81
|
"eslint-plugin-react-hooks": "^1.7.0",
|
|
@@ -89,23 +85,28 @@
|
|
|
89
85
|
"jest-environment-jsdom-fourteen": "1.0.1",
|
|
90
86
|
"jest-watch-typeahead": "^0.4.2",
|
|
91
87
|
"lint-staged": "^9.5.0",
|
|
88
|
+
"lodash": "^4.17.20",
|
|
92
89
|
"prettier": "^1.19.1",
|
|
93
90
|
"react": "^17.0.1",
|
|
94
91
|
"react-docgen-typescript-loader": "^3.7.2",
|
|
95
92
|
"react-dom": "^17.0.1",
|
|
96
93
|
"react-toastify": "^8.0.2",
|
|
97
|
-
"reakit": "1.
|
|
94
|
+
"reakit": "^1.3.11",
|
|
98
95
|
"rimraf": "^3.0.2",
|
|
99
96
|
"typeface-clear-sans": "0.0.44",
|
|
100
97
|
"typescript": "^3.8.3"
|
|
101
98
|
},
|
|
102
99
|
"peerDependencies": {
|
|
103
|
-
"@emotion/
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"react
|
|
100
|
+
"@emotion/core": "^10.3.0",
|
|
101
|
+
"@emotion/styled": "^10.3.0",
|
|
102
|
+
"@emotion/styled-base": "^10.3.0",
|
|
103
|
+
"@popperjs/core": "^2.5.4",
|
|
104
|
+
"lodash": "^4.17.20",
|
|
105
|
+
"react": "^16.8.0 || ^17.0.0",
|
|
106
|
+
"react-dom": "^16.8.0 || ^17.0.0",
|
|
107
|
+
"react-toastify": "^8.0.2",
|
|
108
|
+
"reakit": "^1.3.11",
|
|
109
|
+
"typeface-clear-sans": "0.0.44"
|
|
109
110
|
},
|
|
110
111
|
"husky": {
|
|
111
112
|
"hooks": {
|
package/lib/Select/style.d.ts
DELETED
package/lib/Select/style.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { theme } from '../';
|
|
3
|
-
import { rgba } from 'polished';
|
|
4
|
-
export function customStyles(hasError) {
|
|
5
|
-
return {
|
|
6
|
-
option: function option(provided, state) {
|
|
7
|
-
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
8
|
-
backgroundColor: state.isSelected ? theme.colors['background-info'] : theme.colors['background-primary'],
|
|
9
|
-
color: theme.colors['text-secondary'],
|
|
10
|
-
fontSize: theme.fontSizes[2],
|
|
11
|
-
padding: "".concat(theme.space[1], " ").concat(theme.space[3]),
|
|
12
|
-
cursor: 'pointer',
|
|
13
|
-
':hover': {
|
|
14
|
-
backgroundColor: !!!state.isSelected && theme.colors['background-secondary']
|
|
15
|
-
},
|
|
16
|
-
':active, :focus': {
|
|
17
|
-
backgroundColor: theme.colors['background-info']
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
},
|
|
21
|
-
control: function control(provided, state) {
|
|
22
|
-
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
23
|
-
height: '2rem',
|
|
24
|
-
minHeight: '2rem',
|
|
25
|
-
borderColor: state.menuIsOpen ? theme.colors['control-active-border'] : hasError ? theme.colors['control-invalid-border'] : theme.colors['control-border'],
|
|
26
|
-
':hover': {
|
|
27
|
-
borderColor: hasError && !state.menuIsOpen ? theme.colors['control-invalid-border'] : theme.colors['control-active-border']
|
|
28
|
-
},
|
|
29
|
-
cursor: 'pointer',
|
|
30
|
-
boxShadow: 'none'
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
menu: function menu(provided) {
|
|
34
|
-
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
35
|
-
border: theme.borderSize[0] + ' solid ' + theme.colors['brand-primary'],
|
|
36
|
-
boxShadow: '0 3px 6px ' + rgba(theme.colors['brand-primary'], 0.3),
|
|
37
|
-
marginTop: theme.space[1]
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
indicatorSeparator: function indicatorSeparator() {
|
|
41
|
-
return {
|
|
42
|
-
display: 'none'
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
placeholder: function placeholder(provided, state) {
|
|
46
|
-
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
47
|
-
overflow: 'hidden',
|
|
48
|
-
position: 'absolute',
|
|
49
|
-
textOverflow: 'ellipsis',
|
|
50
|
-
whiteSpace: 'nowrap',
|
|
51
|
-
maxWidth: "calc(100% - ".concat(theme.space[3], ")"),
|
|
52
|
-
color: state.isFocused || state.isSelected ? theme.colors['text-secondary'] : theme.colors['text-placeholder']
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
valueContainer: function valueContainer(provided) {
|
|
56
|
-
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
57
|
-
fontSize: theme.fontSizes[2],
|
|
58
|
-
padding: "0px ".concat(theme.space[3])
|
|
59
|
-
});
|
|
60
|
-
},
|
|
61
|
-
menuList: function menuList(provided) {
|
|
62
|
-
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
63
|
-
borderRadius: '0.25rem'
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
dropdownIndicator: function dropdownIndicator(provided, state) {
|
|
67
|
-
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
68
|
-
'&, :hover': {
|
|
69
|
-
color: theme.colors['brand-primary']
|
|
70
|
-
},
|
|
71
|
-
transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
72
|
-
padding: "".concat(theme.space[1], " ").concat(theme.space[3])
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|