@entur/dropdown 5.3.5 → 5.4.0

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.
@@ -1,7 +1,11 @@
1
1
  import React, { Dispatch, SetStateAction } from 'react';
2
- import { VariantType } from '@entur/form';
2
+ import { VariantType } from '@entur/utils';
3
3
  import { NormalizedDropdownItemType, PotentiallyAsyncDropdownItemType } from './types';
4
4
  import './Dropdown.scss';
5
+ /** @deprecated use variant="information" instead */
6
+ declare const info = "info";
7
+ /** @deprecated use variant="negative" instead */
8
+ declare const error = "error";
5
9
  export type DropdownProps<ValueType> = {
6
10
  /** Tilgjengelige valg i dropdown-en */
7
11
  items: PotentiallyAsyncDropdownItemType<ValueType>;
@@ -30,7 +34,7 @@ export type DropdownProps<ValueType> = {
30
34
  /** Setter dropdown-en i read-only modus */
31
35
  readOnly?: boolean;
32
36
  /** Hvilken valideringsvariant som gjelder */
33
- variant?: VariantType;
37
+ variant?: VariantType | typeof error | typeof info;
34
38
  /** Valideringsmelding, brukes sammen med `variant` */
35
39
  feedback?: string;
36
40
  /** Tekst eller ikon som kommer før dropdown-en */
@@ -78,3 +82,4 @@ export type DropdownProps<ValueType> = {
78
82
  ariaLabelSelectedItem?: string;
79
83
  };
80
84
  export declare const Dropdown: <ValueType extends unknown>({ ariaLabelChosenSingular, ariaLabelCloseList, ariaLabelOpenList, ariaLabelSelectedItem, className, clearable, disabled, disableLabelAnimation, feedback, items: initialItems, label, labelClearSelectedItem, labelTooltip, listStyle, loadingText, onChange, placeholder, prepend, readOnly, selectedItem, selectOnBlur, selectOnTab, style, variant, ...rest }: DropdownProps<ValueType>) => React.JSX.Element;
85
+ export {};
@@ -1,7 +1,11 @@
1
1
  import React, { Dispatch, SetStateAction } from 'react';
2
- import { VariantType } from '@entur/form';
2
+ import { VariantType } from '@entur/utils';
3
3
  import { NormalizedDropdownItemType, PotentiallyAsyncDropdownItemType } from './types';
4
4
  import './Dropdown.scss';
5
+ /** @deprecated use variant="information" instead */
6
+ declare const info = "info";
7
+ /** @deprecated use variant="negative" instead */
8
+ declare const error = "error";
5
9
  export type MultiSelectProps<ValueType> = {
6
10
  /** Beskrivende tekst som forklarer feltet */
7
11
  label: string;
@@ -18,7 +22,7 @@ export type MultiSelectProps<ValueType> = {
18
22
  */
19
23
  itemFilter?: (item: NormalizedDropdownItemType<ValueType>, inputValue: string | undefined) => boolean;
20
24
  /** Hvilken valideringsvariant som gjelder */
21
- variant?: VariantType;
25
+ variant?: VariantType | typeof error | typeof info;
22
26
  /** Valideringsmelding, brukes sammen med `variant` */
23
27
  feedback?: string;
24
28
  /** Om dropdown-en er deaktivert */
@@ -117,3 +121,4 @@ export type MultiSelectProps<ValueType> = {
117
121
  ariaLabelSelectedItem?: string;
118
122
  };
119
123
  export declare const MultiSelect: <ValueType extends unknown>({ className, clearable, clearInputOnSelect, debounceTimeout, disabled, feedback, hideSelectAll, items: initialItems, itemFilter, label, labelAllItemsSelected, labelClearAllItems, labelSelectAll, labelTooltip, listStyle, loadingText, maxChips, noMatchesText, onChange, placeholder, readOnly, selectedItems, selectOnBlur, selectOnTab, style, variant, ariaLabelChosenSingular, ariaLabelChosenPlural, ariaLabelCloseList, ariaLabelJumpToInput, ariaLabelOpenList, ariaLabelRemoveSelected, ariaLabelSelectedItem, ...rest }: MultiSelectProps<ValueType>) => React.JSX.Element;
124
+ export {};
@@ -1,7 +1,11 @@
1
1
  import React from 'react';
2
- import { VariantType } from '@entur/form';
2
+ import { VariantType } from '@entur/utils';
3
3
  import { NormalizedDropdownItemType, PotentiallyAsyncDropdownItemType } from './types';
4
4
  import './Dropdown.scss';
5
+ /** @deprecated use variant="information" instead */
6
+ declare const info = "info";
7
+ /** @deprecated use variant="negative" instead */
8
+ declare const error = "error";
5
9
  export type NativeDropdownProps<ValueType> = {
6
10
  /** Ekstra klassenavn */
7
11
  className?: string;
@@ -40,8 +44,8 @@ export type NativeDropdownProps<ValueType> = {
40
44
  * (Brukes når komponenten er 'controlled)
41
45
  */
42
46
  value?: string;
43
- /** Hvilken valideringsvariant som gjelder */
44
- variant?: VariantType;
47
+ /** Hvilken valideringsvariant som gjelder*/
48
+ variant?: VariantType | typeof error | typeof info;
45
49
  /** Plasserer labelen statisk på toppen av inputfeltet
46
50
  * @default false
47
51
  */
@@ -49,3 +53,4 @@ export type NativeDropdownProps<ValueType> = {
49
53
  [key: string]: any;
50
54
  };
51
55
  export declare const NativeDropdown: <ValueType extends string | number>({ className, disabled, disableLabelAnimation, feedback, items, label, loadingText, onChange, prepend, readOnly, selectedItem, style, value, variant, ...rest }: NativeDropdownProps<ValueType>) => React.JSX.Element;
56
+ export {};
@@ -1,7 +1,11 @@
1
1
  import React, { Dispatch, SetStateAction } from 'react';
2
- import { VariantType } from '@entur/form';
2
+ import { VariantType } from '@entur/utils';
3
3
  import { NormalizedDropdownItemType, PotentiallyAsyncDropdownItemType } from './types';
4
4
  import './Dropdown.scss';
5
+ /** @deprecated use variant="information" instead */
6
+ declare const info = "info";
7
+ /** @deprecated use variant="negative" instead */
8
+ declare const error = "error";
5
9
  export type SearchableDropdownProps<ValueType> = {
6
10
  /** Tilgjengelige valg i dropdown-en */
7
11
  items: PotentiallyAsyncDropdownItemType<ValueType>;
@@ -51,8 +55,8 @@ export type SearchableDropdownProps<ValueType> = {
51
55
  prepend?: React.ReactNode;
52
56
  /** En tekst som beskriver hva som skjer når man venter på items */
53
57
  loadingText?: string;
54
- /** Hvilken valideringsvariant som gjelder */
55
- variant?: VariantType;
58
+ /** Hvilken valideringsvariant som gjelder*/
59
+ variant?: VariantType | typeof error | typeof info;
56
60
  /** Valideringsmelding, brukes sammen med `variant` */
57
61
  feedback?: string;
58
62
  className?: string;
@@ -88,3 +92,4 @@ export type SearchableDropdownProps<ValueType> = {
88
92
  ariaLabelSelectedItem?: string;
89
93
  };
90
94
  export declare const SearchableDropdown: <ValueType extends unknown>({ ariaLabelChosenSingular, ariaLabelCloseList, ariaLabelOpenList, ariaLabelSelectedItem, className, clearable, debounceTimeout, disabled, disableLabelAnimation, feedback, items: initialItems, itemFilter, label, labelClearSelectedItem, labelTooltip, listStyle, loadingText, noMatchesText, onChange, placeholder, prepend, readOnly, selectedItem: value, selectOnBlur, selectOnTab, style, variant, ...rest }: SearchableDropdownProps<ValueType>) => React.JSX.Element;
95
+ export {};
@@ -1945,7 +1945,7 @@ var MultiSelect = function MultiSelect(_ref) {
1945
1945
  selectOnTab = _ref$selectOnTab === void 0 ? false : _ref$selectOnTab,
1946
1946
  style = _ref.style,
1947
1947
  _ref$variant = _ref.variant,
1948
- variant = _ref$variant === void 0 ? 'info' : _ref$variant,
1948
+ variant = _ref$variant === void 0 ? 'information' : _ref$variant,
1949
1949
  ariaLabelChosenSingular = _ref.ariaLabelChosenSingular,
1950
1950
  _ref$ariaLabelChosenP = _ref.ariaLabelChosenPlural,
1951
1951
  ariaLabelChosenPlural = _ref$ariaLabelChosenP === void 0 ? 'valgte' : _ref$ariaLabelChosenP,
@@ -2318,7 +2318,7 @@ var Dropdown = function Dropdown(_ref) {
2318
2318
  selectOnTab = _ref$selectOnTab === void 0 ? false : _ref$selectOnTab,
2319
2319
  style = _ref.style,
2320
2320
  _ref$variant = _ref.variant,
2321
- variant = _ref$variant === void 0 ? 'info' : _ref$variant,
2321
+ variant = _ref$variant === void 0 ? 'information' : _ref$variant,
2322
2322
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2323
2323
  var _useResolvedItems = useResolvedItems(initialItems),
2324
2324
  normalizedItems = _useResolvedItems.items,
@@ -2426,6 +2426,8 @@ var Dropdown = function Dropdown(_ref) {
2426
2426
  };
2427
2427
 
2428
2428
  var _excluded = ["className", "disabled", "disableLabelAnimation", "feedback", "items", "label", "loadingText", "onChange", "prepend", "readOnly", "selectedItem", "style", "value", "variant"];
2429
+ /** @deprecated use variant="negative" instead */
2430
+ var error = 'error';
2429
2431
  var NativeDropdown = function NativeDropdown(_ref) {
2430
2432
  var _ref2;
2431
2433
  var className = _ref.className,
@@ -2467,7 +2469,7 @@ var NativeDropdown = function NativeDropdown(_ref) {
2467
2469
  disableLabelAnimation: disableLabelAnimation,
2468
2470
  isFilled: true
2469
2471
  }, React.createElement("select", _extends({
2470
- "aria-invalid": variant === 'error',
2472
+ "aria-invalid": variant === 'negative' || variant === error,
2471
2473
  "aria-labelledby": nativeDropdownId,
2472
2474
  "aria-busy": loading,
2473
2475
  className: "eds-form-control eds-dropdown--native",