@dvrd/dvr-controls 1.0.56 → 1.0.57

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvrd/dvr-controls",
3
- "version": "1.0.56",
3
+ "version": "1.0.57",
4
4
  "description": "Custom web controls",
5
5
  "main": "index.ts",
6
6
  "files": [
@@ -48,7 +48,7 @@
48
48
  "@types/react-color": "2.13.5",
49
49
  "@types/react-dom": "^18.0.11",
50
50
  "@types/uuid": "9.0.0",
51
- "classnames": "2.3.2",
51
+ "classnames": "2.5.1",
52
52
  "dompurify": "3.0.0",
53
53
  "js-cookie": "3.0.1",
54
54
  "lodash.defer": "^4.1.0",
@@ -64,6 +64,13 @@ function DVRDGroupedSelect(props: Props, ref: ForwardedRef<GroupedSelectRef>) {
64
64
  if (!selectedItem) return null;
65
65
  return selectedItem.valueLabel ?? selectedItem.label ?? '';
66
66
  }, [value, items]);
67
+ const longestValue = useMemo(() => {
68
+ let longest: string = '';
69
+ for (const item of items)
70
+ if (item.label.toString().length > longest.length)
71
+ longest = item.label.toString();
72
+ return longest;
73
+ }, [items]);
67
74
  const itemsContainer = useRef<HTMLDivElement>(null);
68
75
 
69
76
  function onSelectItem(item: GroupedSelectItem) {
@@ -129,6 +136,7 @@ function DVRDGroupedSelect(props: Props, ref: ForwardedRef<GroupedSelectRef>) {
129
136
  {placeholderHidden ? 'placeholder' : placeholder}</label>
130
137
  }
131
138
  <AwesomeIcon name={chevIcon} className='chev-icon'/>
139
+ <div style={{height: 0, visibility: 'hidden'}}>{longestValue}</div>
132
140
  </div>
133
141
  );
134
142
  }
@@ -218,7 +218,7 @@ export default class SelectController extends React.Component<SelectProps, State
218
218
 
219
219
  // noinspection JSUnusedGlobalSymbols
220
220
  /**
221
- * Function for external components to close the item container.
221
+ * Function for external component to close the item container.
222
222
  */
223
223
  closeItems = () => {
224
224
  this.setState({itemsOpen: false, isFocused: false});