@dbcdk/react-components 0.0.60 → 0.0.61

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.
@@ -27,10 +27,11 @@ export interface FilterFieldProps extends Omit<React.InputHTMLAttributes<HTMLInp
27
27
  minWidth?: string;
28
28
  width?: string;
29
29
  maxWidth?: string;
30
+ popoverWidth?: string;
30
31
  debounceTime?: number;
31
32
  }
32
33
  export declare const NUMBER_OPERATORS: Operator[];
33
- export declare function FilterField({ field, control, operator, value, onChange, operators, options, single, size, variant, label, placeholder, disabled, 'data-cy': dataCy, minWidth, width, maxWidth, debounceTime, ...inputProps }: FilterFieldProps & {
34
+ export declare function FilterField({ field, control, operator, value, onChange, operators, options, single, size, variant, label, placeholder, disabled, 'data-cy': dataCy, minWidth, width, maxWidth, popoverWidth, debounceTime, ...inputProps }: FilterFieldProps & {
34
35
  'data-cy'?: string;
35
36
  }): React.ReactElement;
36
37
  export {};
@@ -69,7 +69,7 @@ function isFilterActive(value) {
69
69
  return value.trim().length > 0;
70
70
  return value != null;
71
71
  }
72
- export function FilterField({ field, control, operator, value, onChange, operators, options = [], single = true, size = 'md', variant = 'surface', label, placeholder = 'Type value…', disabled, 'data-cy': dataCy, minWidth, width, maxWidth, debounceTime = INPUT_DEBOUNCE_MS, ...inputProps }) {
72
+ export function FilterField({ field, control, operator, value, onChange, operators, options = [], single = true, size = 'md', variant = 'surface', label, placeholder = 'Type value…', disabled, 'data-cy': dataCy, minWidth, width, maxWidth, popoverWidth, debounceTime = INPUT_DEBOUNCE_MS, ...inputProps }) {
73
73
  var _a, _b, _c, _d, _e, _f;
74
74
  const filterFieldRef = useRef(null);
75
75
  const ops = useMemo(() => operators !== null && operators !== void 0 ? operators : DEFAULT_TEXT_OPERATORS, [operators]);
@@ -183,7 +183,7 @@ export function FilterField({ field, control, operator, value, onChange, operato
183
183
  pendingValueRef.current = '';
184
184
  setLocalValue('');
185
185
  emit({ value: '' });
186
- } })) : (_jsx(Typeahead, { options: options, mode: single ? 'single' : 'multi', selectedValue: single ? ((_f = value) !== null && _f !== void 0 ? _f : null) : Array.isArray(value) ? value : [], onChange: v => emit({ value: v }), minWidth: minWidth, popoverAnchorRef: filterFieldRef, placeholder: placeholder, variant: "embedded", inputProps: {
186
+ } })) : (_jsx(Typeahead, { options: options, mode: single ? 'single' : 'multi', selectedValue: single ? ((_f = value) !== null && _f !== void 0 ? _f : null) : Array.isArray(value) ? value : [], onChange: v => emit({ value: v }), minWidth: minWidth, popoverWidth: popoverWidth, popoverAnchorRef: filterFieldRef, placeholder: placeholder, variant: "embedded", inputProps: {
187
187
  inputSize: size,
188
188
  fieldClassName: styles.embeddedInputField,
189
189
  inputClassName: styles.embeddedInputElement,
@@ -26,6 +26,7 @@ interface TypeaheadProps<T> {
26
26
  inputSize?: InputProps['inputSize'];
27
27
  width?: InputProps['width'];
28
28
  minWidth?: string;
29
+ popoverWidth?: string;
29
30
  autoComplete?: InputProps['autoComplete'];
30
31
  autoCorrect?: InputProps['autoCorrect'];
31
32
  autoCapitalize?: InputProps['autoCapitalize'];
@@ -33,5 +34,5 @@ interface TypeaheadProps<T> {
33
34
  popoverAnchorRef?: React.RefObject<HTMLElement | null>;
34
35
  fitContent?: boolean;
35
36
  }
36
- export declare function Typeahead<T extends string | number>({ options, mode, multiValueDisplayMode, multiSelectedValuesDisplayMode, multiSelectedValueChipContent, selectedValue, onChange, placeholder, variant, disabled, fullWidth, onClear, emptyMessage, filterOptions, inputProps, inputSize, width, minWidth, autoComplete, autoCorrect, autoCapitalize, spellCheck, popoverAnchorRef, fitContent, }: TypeaheadProps<T>): React.ReactElement;
37
+ export declare function Typeahead<T extends string | number>({ options, mode, multiValueDisplayMode, multiSelectedValuesDisplayMode, multiSelectedValueChipContent, selectedValue, onChange, placeholder, variant, disabled, fullWidth, onClear, emptyMessage, filterOptions, inputProps, inputSize, width, minWidth, popoverWidth, autoComplete, autoCorrect, autoCapitalize, spellCheck, popoverAnchorRef, fitContent, }: TypeaheadProps<T>): React.ReactElement;
37
38
  export {};
@@ -86,7 +86,7 @@ function measureFitContentWidth(input, text, minWidth) {
86
86
  endAdornmentWidth);
87
87
  return Math.max(parseLengthToPx(minWidth, inputFontSize) || 120, nextWidth);
88
88
  }
89
- export function Typeahead({ options, mode = 'single', multiValueDisplayMode = 'chips', multiSelectedValuesDisplayMode = 'hidden', multiSelectedValueChipContent = 'label', selectedValue = null, onChange, placeholder, variant = 'outlined', disabled = false, fullWidth = false, onClear, emptyMessage = 'Ingen resultater', filterOptions, inputProps, inputSize, width, minWidth, autoComplete, autoCorrect, autoCapitalize, spellCheck, popoverAnchorRef, fitContent = false, }) {
89
+ export function Typeahead({ options, mode = 'single', multiValueDisplayMode = 'chips', multiSelectedValuesDisplayMode = 'hidden', multiSelectedValueChipContent = 'label', selectedValue = null, onChange, placeholder, variant = 'outlined', disabled = false, fullWidth = false, onClear, emptyMessage = 'Ingen resultater', filterOptions, inputProps, inputSize, width, minWidth, popoverWidth, autoComplete, autoCorrect, autoCapitalize, spellCheck, popoverAnchorRef, fitContent = false, }) {
90
90
  var _a, _b;
91
91
  const rootRef = useRef(null);
92
92
  const inputRef = useRef(null);
@@ -528,7 +528,7 @@ export function Typeahead({ options, mode = 'single', multiValueDisplayMode = 'c
528
528
  flex: fullWidth || shouldFitContent ? '1 1 auto' : undefined,
529
529
  minWidth: 0,
530
530
  maxWidth: shouldFitContent ? '100%' : undefined,
531
- }, children: [_jsx(Popover, { open: open, minWidth: minWidth, matchTriggerWidth: true, fillTrigger: true, anchorRef: popoverAnchorRef, onOpenChange: nextOpen => {
531
+ }, children: [_jsx(Popover, { open: open, minWidth: popoverWidth !== null && popoverWidth !== void 0 ? popoverWidth : minWidth, matchTriggerWidth: true, fillTrigger: true, anchorRef: popoverAnchorRef, onOpenChange: nextOpen => {
532
532
  setOpen(nextOpen);
533
533
  if (nextOpen) {
534
534
  if (mode === 'single' && selectedOption) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.60",
3
+ "version": "0.0.61",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",