venice-ui 2.4.9 → 2.4.11
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/Dropdown/Dropdown.js +2 -2
- package/dist/cjs/components/common/commonComponents.js +6 -0
- package/dist/esm/components/Dropdown/Dropdown.js +2 -2
- package/dist/esm/components/common/commonComponents.js +6 -0
- package/dist/types/components/Dropdown/Dropdown.d.ts +1 -0
- package/dist/types/components/common/commonComponents.d.ts +2 -1
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@ const common_1 = require("../common");
|
|
|
33
33
|
const react_dom_1 = require("react-dom");
|
|
34
34
|
const Icons_1 = require("../Icons");
|
|
35
35
|
const Theme_1 = require("../../Theme");
|
|
36
|
-
const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = false, error, errorMsg, width, options, value, placeholder = 'Please select', name, handleSelect, position = 'left', zIndex, readOnly = false, theme = Theme_1.mainTheme, handleFieldFocus, handleFieldBlur, }) => {
|
|
36
|
+
const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = false, error, errorMsg, width, options, value, placeholder = 'Please select', name, handleSelect, position = 'left', zIndex, maxHeight, readOnly = false, theme = Theme_1.mainTheme, handleFieldFocus, handleFieldBlur, }) => {
|
|
37
37
|
const [open, toogleOpen] = (0, react_1.useState)(false);
|
|
38
38
|
const ref = (0, react_1.useRef)(null);
|
|
39
39
|
const sourceRef = (0, react_1.useRef)(null);
|
|
@@ -100,7 +100,7 @@ const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = fa
|
|
|
100
100
|
react_1.default.createElement(Input_1.EyeIconWrapper, { size: size },
|
|
101
101
|
react_1.default.createElement(Icons_1.Icon, { name: open ? 'arrow_drop_up' : 'arrow_drop_down', size: 24, iconColor: theme.inputDefaultTextColor, iconHoverColor: theme.inputDefaultTextColor, iconBgHoverColor: "transparent" })),
|
|
102
102
|
open &&
|
|
103
|
-
(0, react_dom_1.createPortal)(react_1.default.createElement(common_1.Panel, { style: dropdownStyles, ref: ref, size: size, fullWidth: true, zIndex: zIndex }, options &&
|
|
103
|
+
(0, react_dom_1.createPortal)(react_1.default.createElement(common_1.Panel, { style: dropdownStyles, ref: ref, size: size, fullWidth: true, zIndex: zIndex, maxHeight: maxHeight }, options &&
|
|
104
104
|
options.map((option) => (react_1.default.createElement(common_1.PanelOption, { key: option.value, active: option.value === value, onClick: (e) => selectOption(e, option.value, option.disabled), isDisabled: option.disabled || false }, option.label)))), document.body),
|
|
105
105
|
error && errorMsg && react_1.default.createElement(Input_1.InputErrorMsg, null, errorMsg)))));
|
|
106
106
|
};
|
|
@@ -31,6 +31,12 @@ exports.Panel = styled_components_1.default.div `
|
|
|
31
31
|
border: 1px solid ${Theme_1.Theme.colors.gray_2};
|
|
32
32
|
border-top: none;
|
|
33
33
|
min-width: 30px;
|
|
34
|
+
${(p) => p.maxHeight &&
|
|
35
|
+
`
|
|
36
|
+
max-height: ${p.maxHeight};
|
|
37
|
+
overflow: auto;
|
|
38
|
+
|
|
39
|
+
`}
|
|
34
40
|
`;
|
|
35
41
|
exports.PanelOption = styled_components_1.default.div `
|
|
36
42
|
padding: ${Theme_1.Theme.padding.s} ${Theme_1.Theme.padding.m};
|
|
@@ -7,7 +7,7 @@ import { Panel, PanelOption } from '../common';
|
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
8
|
import { Icon } from '../Icons';
|
|
9
9
|
import { mainTheme } from '../../Theme';
|
|
10
|
-
export const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = false, error, errorMsg, width, options, value, placeholder = 'Please select', name, handleSelect, position = 'left', zIndex, readOnly = false, theme = mainTheme, handleFieldFocus, handleFieldBlur, }) => {
|
|
10
|
+
export const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = false, error, errorMsg, width, options, value, placeholder = 'Please select', name, handleSelect, position = 'left', zIndex, maxHeight, readOnly = false, theme = mainTheme, handleFieldFocus, handleFieldBlur, }) => {
|
|
11
11
|
const [open, toogleOpen] = useState(false);
|
|
12
12
|
const ref = useRef(null);
|
|
13
13
|
const sourceRef = useRef(null);
|
|
@@ -74,7 +74,7 @@ export const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabl
|
|
|
74
74
|
React.createElement(EyeIconWrapper, { size: size },
|
|
75
75
|
React.createElement(Icon, { name: open ? 'arrow_drop_up' : 'arrow_drop_down', size: 24, iconColor: theme.inputDefaultTextColor, iconHoverColor: theme.inputDefaultTextColor, iconBgHoverColor: "transparent" })),
|
|
76
76
|
open &&
|
|
77
|
-
createPortal(React.createElement(Panel, { style: dropdownStyles, ref: ref, size: size, fullWidth: true, zIndex: zIndex }, options &&
|
|
77
|
+
createPortal(React.createElement(Panel, { style: dropdownStyles, ref: ref, size: size, fullWidth: true, zIndex: zIndex, maxHeight: maxHeight }, options &&
|
|
78
78
|
options.map((option) => (React.createElement(PanelOption, { key: option.value, active: option.value === value, onClick: (e) => selectOption(e, option.value, option.disabled), isDisabled: option.disabled || false }, option.label)))), document.body),
|
|
79
79
|
error && errorMsg && React.createElement(InputErrorMsg, null, errorMsg)))));
|
|
80
80
|
};
|
|
@@ -25,6 +25,12 @@ export const Panel = styled.div `
|
|
|
25
25
|
border: 1px solid ${Theme.colors.gray_2};
|
|
26
26
|
border-top: none;
|
|
27
27
|
min-width: 30px;
|
|
28
|
+
${(p) => p.maxHeight &&
|
|
29
|
+
`
|
|
30
|
+
max-height: ${p.maxHeight};
|
|
31
|
+
overflow: auto;
|
|
32
|
+
|
|
33
|
+
`}
|
|
28
34
|
`;
|
|
29
35
|
export const PanelOption = styled.div `
|
|
30
36
|
padding: ${Theme.padding.s} ${Theme.padding.m};
|
|
@@ -5,6 +5,7 @@ export interface IDropdownProps extends IFormElement {
|
|
|
5
5
|
handleSelect: (name: string, value: string | number) => void;
|
|
6
6
|
position?: string;
|
|
7
7
|
zIndex?: number;
|
|
8
|
+
maxHeight?: string;
|
|
8
9
|
theme?: any;
|
|
9
10
|
handleFieldFocus?: (name: string) => void;
|
|
10
11
|
handleFieldBlur?: () => void;
|
|
@@ -2,8 +2,9 @@ import { InputSize } from '../../types';
|
|
|
2
2
|
export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export declare const ScrollCotainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
4
|
interface IPanelStyle {
|
|
5
|
-
height?: string;
|
|
6
5
|
size: InputSize;
|
|
6
|
+
height?: string;
|
|
7
|
+
maxHeight?: string;
|
|
7
8
|
fullWidth?: boolean;
|
|
8
9
|
zIndex?: number;
|
|
9
10
|
}
|