@codacy/ui-components 0.64.11 → 0.64.13
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["children", "hideChevron"];
|
|
3
|
-
import React
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { useDropdownTrigger } from './hooks';
|
|
5
|
-
import {
|
|
5
|
+
import { ChevronDownIcon } from '../../Icons';
|
|
6
6
|
import { Button, IconAndText } from '../../';
|
|
7
7
|
export var DropdownButtonTrigger = React.forwardRef(function (_ref, ref) {
|
|
8
8
|
var _dropdownContext$valu, _dropdownContext$valu2;
|
|
@@ -13,14 +13,14 @@ export var DropdownButtonTrigger = React.forwardRef(function (_ref, ref) {
|
|
|
13
13
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
14
|
|
|
15
15
|
var dropdownContext = useDropdownTrigger();
|
|
16
|
-
var rightIcon = useMemo(function () {
|
|
17
|
-
return dropdownContext.open ? ChevronUpIcon : ChevronDownIcon;
|
|
18
|
-
}, [dropdownContext.open]);
|
|
19
16
|
return /*#__PURE__*/React.createElement(Button, Object.assign({
|
|
20
17
|
onClick: dropdownContext.onClick,
|
|
21
18
|
ref: ref
|
|
22
19
|
}, props), hideChevron ? children || ((_dropdownContext$valu = dropdownContext.value) === null || _dropdownContext$valu === void 0 ? void 0 : _dropdownContext$valu.toString()) : /*#__PURE__*/React.createElement(IconAndText, {
|
|
23
20
|
toRight: true,
|
|
24
|
-
icon:
|
|
21
|
+
icon: ChevronDownIcon,
|
|
22
|
+
iconProps: {
|
|
23
|
+
rotate: dropdownContext.open
|
|
24
|
+
}
|
|
25
25
|
}, children || ((_dropdownContext$valu2 = dropdownContext.value) === null || _dropdownContext$valu2 === void 0 ? void 0 : _dropdownContext$valu2.toString())));
|
|
26
26
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["caption"];
|
|
3
|
-
import React
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { Input } from '../../Input';
|
|
5
5
|
import { useDropdownTrigger } from './hooks';
|
|
6
|
-
import {
|
|
6
|
+
import { ChevronDownIcon } from '../../Icons';
|
|
7
7
|
export var SelectTrigger = React.forwardRef(function (_ref, ref) {
|
|
8
8
|
var _dropdownContext$valu;
|
|
9
9
|
|
|
@@ -11,18 +11,16 @@ export var SelectTrigger = React.forwardRef(function (_ref, ref) {
|
|
|
11
11
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
12
|
|
|
13
13
|
var dropdownContext = useDropdownTrigger();
|
|
14
|
-
var rightIcon = useMemo(function () {
|
|
15
|
-
return dropdownContext.open ? {
|
|
16
|
-
icon: ChevronUpIcon,
|
|
17
|
-
color: 'accent-primary-active'
|
|
18
|
-
} : ChevronDownIcon;
|
|
19
|
-
}, [dropdownContext.open]);
|
|
20
14
|
return /*#__PURE__*/React.createElement(Input, Object.assign({}, props, {
|
|
21
15
|
ref: ref,
|
|
22
16
|
size: dropdownContext.size,
|
|
23
17
|
readOnly: true,
|
|
24
18
|
onClick: dropdownContext.onClick,
|
|
25
|
-
rightIcon:
|
|
19
|
+
rightIcon: {
|
|
20
|
+
icon: ChevronDownIcon,
|
|
21
|
+
color: dropdownContext.open ? 'accent-primary-active' : undefined,
|
|
22
|
+
rotate: dropdownContext.open
|
|
23
|
+
},
|
|
26
24
|
value: caption ? typeof caption === 'string' ? caption : caption(dropdownContext.value) : (_dropdownContext$valu = dropdownContext.value) === null || _dropdownContext$valu === void 0 ? void 0 : _dropdownContext$valu.toString()
|
|
27
25
|
}));
|
|
28
26
|
});
|