@dvrd/dvr-controls 0.0.31 → 0.0.33
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/package.json
CHANGED
|
@@ -67,7 +67,7 @@ export default function DvrdButton(props: DvrdButtonProps) {
|
|
|
67
67
|
else if (customBaseColor) color = customBaseColor;
|
|
68
68
|
else if (red) {
|
|
69
69
|
if (secondary) color = 'color-red-secondary';
|
|
70
|
-
else color = '
|
|
70
|
+
else color = 'rgb(255,0,0)';
|
|
71
71
|
} else if (secondary) color = context.contrastColor;
|
|
72
72
|
else color = context.baseColor;
|
|
73
73
|
color = convertColor(color);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import './style/dvrdSelect.scss';
|
|
5
5
|
|
|
6
|
-
import React, {MouseEventHandler, PureComponent} from 'react';
|
|
6
|
+
import React, {CSSProperties, MouseEventHandler, PureComponent} from 'react';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import {ChangeFunction, ErrorType, SelectItemShape} from '../util/interfaces';
|
|
9
9
|
import {hasHover, stopPropagation } from '../util/controlUtil';
|
|
@@ -27,6 +27,7 @@ interface Props {
|
|
|
27
27
|
itemsPosition: 'top' | 'bottom';
|
|
28
28
|
selectOnly: boolean;
|
|
29
29
|
searchValue: string;
|
|
30
|
+
optionsContainerHeight: number | string;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
interface State {
|
|
@@ -84,6 +85,12 @@ export default class DvrdSelect extends PureComponent<Props, State> {
|
|
|
84
85
|
return '';
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
getItemsContainerStyle = (): CSSProperties => {
|
|
89
|
+
let {optionsContainerHeight} = this.props;
|
|
90
|
+
if(typeof optionsContainerHeight === 'number') optionsContainerHeight = `${optionsContainerHeight}px`;
|
|
91
|
+
return {maxHeight: optionsContainerHeight};
|
|
92
|
+
}
|
|
93
|
+
|
|
87
94
|
renderLabel = () => {
|
|
88
95
|
const {labelClassName, label} = this.props;
|
|
89
96
|
if (!label) return null;
|
|
@@ -118,7 +125,7 @@ export default class DvrdSelect extends PureComponent<Props, State> {
|
|
|
118
125
|
return (
|
|
119
126
|
<div
|
|
120
127
|
className={classNames('dvrd-select-items', (open && !disabled) && 'open', itemsPosition,
|
|
121
|
-
itemContainerClassName)}>
|
|
128
|
+
itemContainerClassName)} style={this.getItemsContainerStyle()}>
|
|
122
129
|
{items.filter((item) => item.label.toString().length > 0 && item.selectable !== false)
|
|
123
130
|
.map((item: SelectItemShape, index: number) => (
|
|
124
131
|
<label key={index} className={classNames('dvrd-select-item', itemClassName)}
|
|
@@ -23,6 +23,7 @@ interface Props {
|
|
|
23
23
|
itemClassName?: string;
|
|
24
24
|
itemsPosition: 'top' | 'bottom';
|
|
25
25
|
selectOnly: boolean;
|
|
26
|
+
optionsContainerHeight?: number | string;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
interface State {
|
|
@@ -35,6 +36,7 @@ export default class DvrdSelectController extends PureComponent<Props, State> {
|
|
|
35
36
|
static defaultProps = {
|
|
36
37
|
itemsPosition: 'bottom',
|
|
37
38
|
selectOnly: true,
|
|
39
|
+
optionsContainerHeight: '15rem',
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
state: State = {
|
|
@@ -63,7 +65,7 @@ export default class DvrdSelectController extends PureComponent<Props, State> {
|
|
|
63
65
|
render = () => {
|
|
64
66
|
const {
|
|
65
67
|
arrowClassName, label, error, className, labelClassName, valueClassName, itemContainerClassName,
|
|
66
|
-
itemClassName, errorClassName, disabled, value, itemsPosition, selectOnly
|
|
68
|
+
itemClassName, errorClassName, disabled, value, itemsPosition, selectOnly, optionsContainerHeight
|
|
67
69
|
} = this.props, {searchValue} = this.state;
|
|
68
70
|
return (
|
|
69
71
|
<DvrdSelect onChange={this.onChange} value={value} items={this.getItems()} disabled={disabled}
|
|
@@ -72,7 +74,8 @@ export default class DvrdSelectController extends PureComponent<Props, State> {
|
|
|
72
74
|
labelClassName={labelClassName} className={className} error={error} label={label}
|
|
73
75
|
arrowClassName={arrowClassName} itemsPosition={itemsPosition} ref={(ref: DvrdSelect) => {
|
|
74
76
|
this.select = ref
|
|
75
|
-
}} searchValue={searchValue} onChangeSearch={this.onChangeSearch} selectOnly={selectOnly}
|
|
77
|
+
}} searchValue={searchValue} onChangeSearch={this.onChangeSearch} selectOnly={selectOnly}
|
|
78
|
+
optionsContainerHeight={optionsContainerHeight}/>
|
|
76
79
|
);
|
|
77
80
|
}
|
|
78
81
|
};
|