@try-at-software/input-elements 1.2.0-beta.7 → 1.2.0-beta.9

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.
@@ -6,8 +6,12 @@ import { IOperativeProps } from '../IOperativeProps';
6
6
  import { ISingleValueInputElementProps } from '../ISingleValueInputElementProps';
7
7
  import { IDropdownInputProps } from './IDropdownInputProps';
8
8
  import { IFluentUiDropdownInputProps } from './IFluentUiDropdownInputProps';
9
+ interface IDropdownInputStyles {
10
+ automaticHeight?: boolean;
11
+ }
9
12
  interface ISingleValueDropdownInputProps extends ISingleValueInputElementProps<string>, IOperativeProps<IBaseInputElementProps>, IDynamicProps<IDropdownInputProps & IFluentUiDropdownInputProps> {
10
13
  consistencyErrorMessage?: FormText;
14
+ styles?: IDropdownInputStyles;
11
15
  }
12
16
  export declare const DropdownInput: React.MemoExoticComponent<(props: ISingleValueDropdownInputProps) => JSX.Element>;
13
17
  export {};
@@ -9,8 +9,13 @@ const Utilities_1 = require("../../Utilities");
9
9
  const ConsistencyErrorMessage = 'The value is not present within the specified options.';
10
10
  const DropdownInputComponent = (props) => {
11
11
  var _a;
12
- const { dynamicProps, operativeProps } = props;
12
+ const { dynamicProps, operativeProps, styles: stylePreferences } = props;
13
13
  const normalizedOptions = react_2.useMemo(() => Utilities_1.DropdownHelper.getNormalizedOptions(dynamicProps.defaultOption, dynamicProps.options), [dynamicProps.defaultOption, dynamicProps.options]);
14
+ const styles = react_2.useMemo(() => {
15
+ if (!(stylePreferences === null || stylePreferences === void 0 ? void 0 : stylePreferences.automaticHeight))
16
+ return undefined;
17
+ return { dropdownItem: { height: 'auto' } };
18
+ }, [stylePreferences]);
14
19
  react_2.useEffect(() => {
15
20
  if (!props.value || normalizedOptions.some((o) => o.key === props.value))
16
21
  return;
@@ -28,7 +33,7 @@ const DropdownInputComponent = (props) => {
28
33
  React.createElement(Components_1.LabelRenderer, { label: props.label, required: !!props.renderRequiredIndicator }),
29
34
  React.createElement(DropdownComponent, { "data-automationid": "dropdown-input", options: normalizedOptions, onChange: onChange, onRenderOption: onRenderOption, placeholder: operativeProps.placeholder,
30
35
  // This value should never be `undefined`.
31
- selectedKey: props.value || ((_a = dynamicProps.defaultOption) === null || _a === void 0 ? void 0 : _a.key) || null, disabled: dynamicProps.isDisabled }),
36
+ selectedKey: props.value || ((_a = dynamicProps.defaultOption) === null || _a === void 0 ? void 0 : _a.key) || null, disabled: dynamicProps.isDisabled, styles: styles }),
32
37
  React.createElement(Components_1.ErrorRenderer, { error: props.errorMessage, messageBarType: react_1.MessageBarType.error })));
33
38
  };
34
39
  exports.DropdownInput = React.memo(DropdownInputComponent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@try-at-software/input-elements",
3
- "version": "1.2.0-beta.7",
3
+ "version": "1.2.0-beta.9",
4
4
  "description": "A package providing different input elements that are extensible and easily configurable for your custom needs.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",