@entur/dropdown 5.3.3 → 5.3.4

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.
@@ -43,6 +43,8 @@ export type DropdownProps<ValueType> = {
43
43
  * @default "fjern valgt"
44
44
  */
45
45
  labelClearSelectedItem?: string;
46
+ /** En tooltip som gir ekstra info om inputfeltet */
47
+ labelTooltip?: React.ReactNode;
46
48
  /** Plasserer labelen statisk på toppen av inputfeltet
47
49
  * @default false
48
50
  */
@@ -75,4 +77,4 @@ export type DropdownProps<ValueType> = {
75
77
  */
76
78
  ariaLabelSelectedItem?: string;
77
79
  };
78
- export declare const Dropdown: <ValueType extends unknown>({ ariaLabelChosenSingular, ariaLabelCloseList, ariaLabelOpenList, ariaLabelSelectedItem, className, clearable, disabled, disableLabelAnimation, feedback, items: initialItems, label, labelClearSelectedItem, listStyle, loadingText, onChange, placeholder, prepend, readOnly, selectedItem, selectOnBlur, selectOnTab, style, variant, ...rest }: DropdownProps<ValueType>) => React.JSX.Element;
80
+ 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;
@@ -84,6 +84,8 @@ export type MultiSelectProps<ValueType> = {
84
84
  * @default "Fjern valgte"
85
85
  */
86
86
  labelClearAllItems?: string;
87
+ /** En tooltip som gir ekstra info om inputfeltet */
88
+ labelTooltip?: React.ReactNode;
87
89
  /** Tekst for skjemleser på knapper for å fjerne valgt element
88
90
  * @default "trykk for å fjerne valg"
89
91
  */
@@ -114,4 +116,4 @@ export type MultiSelectProps<ValueType> = {
114
116
  */
115
117
  ariaLabelSelectedItem?: string;
116
118
  };
117
- export declare const MultiSelect: <ValueType extends unknown>({ className, clearable, clearInputOnSelect, debounceTimeout, disabled, feedback, hideSelectAll, items: initialItems, itemFilter, label, labelAllItemsSelected, labelClearAllItems, labelSelectAll, 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;
119
+ 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;
@@ -67,6 +67,8 @@ export type SearchableDropdownProps<ValueType> = {
67
67
  * @default "fjern valgt"
68
68
  */
69
69
  labelClearSelectedItem?: string;
70
+ /** En tooltip som gir ekstra info om inputfeltet */
71
+ labelTooltip?: React.ReactNode;
70
72
  /** Tekst for skjemleser for knapp som lukker listen med valg
71
73
  * @default "Lukk liste med valg"
72
74
  */
@@ -85,4 +87,4 @@ export type SearchableDropdownProps<ValueType> = {
85
87
  */
86
88
  ariaLabelSelectedItem?: string;
87
89
  };
88
- export declare const SearchableDropdown: <ValueType extends unknown>({ ariaLabelChosenSingular, ariaLabelCloseList, ariaLabelOpenList, ariaLabelSelectedItem, className, clearable, debounceTimeout, disabled, disableLabelAnimation, feedback, items: initialItems, itemFilter, label, labelClearSelectedItem, listStyle, loadingText, noMatchesText, onChange, placeholder, prepend, readOnly, selectedItem: value, selectOnBlur, selectOnTab, style, variant, ...rest }: SearchableDropdownProps<ValueType>) => React.JSX.Element;
90
+ 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;
@@ -1640,7 +1640,7 @@ function getA11yRemovalMessage(options) {
1640
1640
  }
1641
1641
  /* end a11y utils */
1642
1642
 
1643
- var _excluded$3 = ["ariaLabelChosenSingular", "ariaLabelCloseList", "ariaLabelOpenList", "ariaLabelSelectedItem", "className", "clearable", "debounceTimeout", "disabled", "disableLabelAnimation", "feedback", "items", "itemFilter", "label", "labelClearSelectedItem", "listStyle", "loadingText", "noMatchesText", "onChange", "placeholder", "prepend", "readOnly", "selectedItem", "selectOnBlur", "selectOnTab", "style", "variant"];
1643
+ var _excluded$3 = ["ariaLabelChosenSingular", "ariaLabelCloseList", "ariaLabelOpenList", "ariaLabelSelectedItem", "className", "clearable", "debounceTimeout", "disabled", "disableLabelAnimation", "feedback", "items", "itemFilter", "label", "labelClearSelectedItem", "labelTooltip", "listStyle", "loadingText", "noMatchesText", "onChange", "placeholder", "prepend", "readOnly", "selectedItem", "selectOnBlur", "selectOnTab", "style", "variant"];
1644
1644
  var SearchableDropdown = function SearchableDropdown(_ref) {
1645
1645
  var _document, _selectedItem$label;
1646
1646
  var ariaLabelChosenSingular = _ref.ariaLabelChosenSingular,
@@ -1662,6 +1662,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1662
1662
  label = _ref.label,
1663
1663
  _ref$labelClearSelect = _ref.labelClearSelectedItem,
1664
1664
  labelClearSelectedItem = _ref$labelClearSelect === void 0 ? 'fjern valgt' : _ref$labelClearSelect,
1665
+ labelTooltip = _ref.labelTooltip,
1665
1666
  listStyle = _ref.listStyle,
1666
1667
  loadingText = _ref.loadingText,
1667
1668
  noMatchesText = _ref.noMatchesText,
@@ -1820,7 +1821,9 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1820
1821
  setShowSelectedItem(false);
1821
1822
  };
1822
1823
  return React.createElement("div", {
1823
- className: classNames('eds-dropdown__wrapper', className),
1824
+ className: classNames('eds-dropdown__wrapper', className, {
1825
+ 'eds-dropdown__wrapper--has-tooltip': labelTooltip !== undefined
1826
+ }),
1824
1827
  style: style
1825
1828
  }, React.createElement(form.BaseFormControl, _extends({
1826
1829
  className: classNames('eds-dropdown', 'eds-dropdown--searchable'),
@@ -1831,6 +1834,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1831
1834
  label: label,
1832
1835
  labelId: getLabelProps().id,
1833
1836
  labelProps: getLabelProps(),
1837
+ labelTooltip: labelTooltip,
1834
1838
  onClick: function onClick(e) {
1835
1839
  var _inputRef$current2;
1836
1840
  if (e.target === e.currentTarget) (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.focus();
@@ -1896,7 +1900,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1896
1900
  }));
1897
1901
  };
1898
1902
 
1899
- var _excluded$2 = ["className", "clearable", "clearInputOnSelect", "debounceTimeout", "disabled", "feedback", "hideSelectAll", "items", "itemFilter", "label", "labelAllItemsSelected", "labelClearAllItems", "labelSelectAll", "listStyle", "loadingText", "maxChips", "noMatchesText", "onChange", "placeholder", "readOnly", "selectedItems", "selectOnBlur", "selectOnTab", "style", "variant", "ariaLabelChosenSingular", "ariaLabelChosenPlural", "ariaLabelCloseList", "ariaLabelJumpToInput", "ariaLabelOpenList", "ariaLabelRemoveSelected", "ariaLabelSelectedItem"];
1903
+ var _excluded$2 = ["className", "clearable", "clearInputOnSelect", "debounceTimeout", "disabled", "feedback", "hideSelectAll", "items", "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"];
1900
1904
  var MultiSelect = function MultiSelect(_ref) {
1901
1905
  var className = _ref.className,
1902
1906
  _ref$clearable = _ref.clearable,
@@ -1919,6 +1923,7 @@ var MultiSelect = function MultiSelect(_ref) {
1919
1923
  labelClearAllItems = _ref$labelClearAllIte === void 0 ? 'Fjern valgte' : _ref$labelClearAllIte,
1920
1924
  _ref$labelSelectAll = _ref.labelSelectAll,
1921
1925
  labelSelectAll = _ref$labelSelectAll === void 0 ? 'Velg alle' : _ref$labelSelectAll,
1926
+ labelTooltip = _ref.labelTooltip,
1922
1927
  listStyle = _ref.listStyle,
1923
1928
  loadingText = _ref.loadingText,
1924
1929
  _ref$maxChips = _ref.maxChips,
@@ -2166,7 +2171,9 @@ var MultiSelect = function MultiSelect(_ref) {
2166
2171
  });
2167
2172
  };
2168
2173
  return React.createElement("div", {
2169
- className: classNames('eds-dropdown__wrapper', className),
2174
+ className: classNames('eds-dropdown__wrapper', className, {
2175
+ 'eds-dropdown__wrapper--has-tooltip': labelTooltip !== undefined
2176
+ }),
2170
2177
  style: style
2171
2178
  }, React.createElement(form.BaseFormControl, _extends({
2172
2179
  append: React.createElement(FieldAppend$1, {
@@ -2190,6 +2197,7 @@ var MultiSelect = function MultiSelect(_ref) {
2190
2197
  label: label,
2191
2198
  labelId: getLabelProps().id,
2192
2199
  labelProps: getLabelProps(),
2200
+ labelTooltip: labelTooltip,
2193
2201
  onClick: function onClick(e) {
2194
2202
  var _inputRef$current4;
2195
2203
  if (e.target === e.currentTarget) (_inputRef$current4 = inputRef.current) == null ? void 0 : _inputRef$current4.focus();
@@ -2276,7 +2284,7 @@ var MultiSelect = function MultiSelect(_ref) {
2276
2284
  }));
2277
2285
  };
2278
2286
 
2279
- var _excluded$1 = ["ariaLabelChosenSingular", "ariaLabelCloseList", "ariaLabelOpenList", "ariaLabelSelectedItem", "className", "clearable", "disabled", "disableLabelAnimation", "feedback", "items", "label", "labelClearSelectedItem", "listStyle", "loadingText", "onChange", "placeholder", "prepend", "readOnly", "selectedItem", "selectOnBlur", "selectOnTab", "style", "variant"];
2287
+ var _excluded$1 = ["ariaLabelChosenSingular", "ariaLabelCloseList", "ariaLabelOpenList", "ariaLabelSelectedItem", "className", "clearable", "disabled", "disableLabelAnimation", "feedback", "items", "label", "labelClearSelectedItem", "labelTooltip", "listStyle", "loadingText", "onChange", "placeholder", "prepend", "readOnly", "selectedItem", "selectOnBlur", "selectOnTab", "style", "variant"];
2280
2288
  var Dropdown = function Dropdown(_ref) {
2281
2289
  var _ref3, _selectedItem$label;
2282
2290
  var ariaLabelChosenSingular = _ref.ariaLabelChosenSingular,
@@ -2294,6 +2302,7 @@ var Dropdown = function Dropdown(_ref) {
2294
2302
  label = _ref.label,
2295
2303
  _ref$labelClearSelect = _ref.labelClearSelectedItem,
2296
2304
  labelClearSelectedItem = _ref$labelClearSelect === void 0 ? 'fjern valgt' : _ref$labelClearSelect,
2305
+ labelTooltip = _ref.labelTooltip,
2297
2306
  listStyle = _ref.listStyle,
2298
2307
  loadingText = _ref.loadingText,
2299
2308
  onChange = _ref.onChange,
@@ -2344,7 +2353,9 @@ var Dropdown = function Dropdown(_ref) {
2344
2353
  getToggleButtonProps = _useSelect.getToggleButtonProps,
2345
2354
  highlightedIndex = _useSelect.highlightedIndex;
2346
2355
  return React.createElement("div", {
2347
- className: classNames('eds-dropdown__wrapper', className),
2356
+ className: classNames('eds-dropdown__wrapper', className, {
2357
+ 'eds-dropdown__wrapper--has-tooltip': labelTooltip !== undefined
2358
+ }),
2348
2359
  style: style
2349
2360
  }, React.createElement(form.BaseFormControl, _extends({
2350
2361
  append: React.createElement(FieldAppend$1, {
@@ -2376,6 +2387,7 @@ var Dropdown = function Dropdown(_ref) {
2376
2387
  label: label,
2377
2388
  labelId: getLabelProps().id,
2378
2389
  labelProps: getLabelProps(),
2390
+ labelTooltip: labelTooltip,
2379
2391
  prepend: prepend,
2380
2392
  readOnly: readOnly,
2381
2393
  variant: variant