@entur/dropdown 5.3.3 → 5.3.5

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;
@@ -1386,6 +1386,7 @@ var SelectedItemTag = function SelectedItemTag(_ref) {
1386
1386
  })) != null ? _getSelectedItemProps : {},
1387
1387
  selectedItemProps = _objectWithoutPropertiesLoose(_ref2, _excluded$4);
1388
1388
  return React.createElement(chip.TagChip, _extends({
1389
+ size: "small",
1389
1390
  className: classNames('eds-dropdown__selected-item-tag', {
1390
1391
  'eds-dropdown__selected-item-tag--readonly': readOnly,
1391
1392
  'eds-dropdown__selected-item-tag--disabled': disabled
@@ -1640,7 +1641,7 @@ function getA11yRemovalMessage(options) {
1640
1641
  }
1641
1642
  /* end a11y utils */
1642
1643
 
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"];
1644
+ 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
1645
  var SearchableDropdown = function SearchableDropdown(_ref) {
1645
1646
  var _document, _selectedItem$label;
1646
1647
  var ariaLabelChosenSingular = _ref.ariaLabelChosenSingular,
@@ -1662,6 +1663,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1662
1663
  label = _ref.label,
1663
1664
  _ref$labelClearSelect = _ref.labelClearSelectedItem,
1664
1665
  labelClearSelectedItem = _ref$labelClearSelect === void 0 ? 'fjern valgt' : _ref$labelClearSelect,
1666
+ labelTooltip = _ref.labelTooltip,
1665
1667
  listStyle = _ref.listStyle,
1666
1668
  loadingText = _ref.loadingText,
1667
1669
  noMatchesText = _ref.noMatchesText,
@@ -1820,7 +1822,9 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1820
1822
  setShowSelectedItem(false);
1821
1823
  };
1822
1824
  return React.createElement("div", {
1823
- className: classNames('eds-dropdown__wrapper', className),
1825
+ className: classNames('eds-dropdown__wrapper', className, {
1826
+ 'eds-dropdown__wrapper--has-tooltip': labelTooltip !== undefined
1827
+ }),
1824
1828
  style: style
1825
1829
  }, React.createElement(form.BaseFormControl, _extends({
1826
1830
  className: classNames('eds-dropdown', 'eds-dropdown--searchable'),
@@ -1831,6 +1835,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1831
1835
  label: label,
1832
1836
  labelId: getLabelProps().id,
1833
1837
  labelProps: getLabelProps(),
1838
+ labelTooltip: labelTooltip,
1834
1839
  onClick: function onClick(e) {
1835
1840
  var _inputRef$current2;
1836
1841
  if (e.target === e.currentTarget) (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.focus();
@@ -1896,7 +1901,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
1896
1901
  }));
1897
1902
  };
1898
1903
 
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"];
1904
+ 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
1905
  var MultiSelect = function MultiSelect(_ref) {
1901
1906
  var className = _ref.className,
1902
1907
  _ref$clearable = _ref.clearable,
@@ -1919,6 +1924,7 @@ var MultiSelect = function MultiSelect(_ref) {
1919
1924
  labelClearAllItems = _ref$labelClearAllIte === void 0 ? 'Fjern valgte' : _ref$labelClearAllIte,
1920
1925
  _ref$labelSelectAll = _ref.labelSelectAll,
1921
1926
  labelSelectAll = _ref$labelSelectAll === void 0 ? 'Velg alle' : _ref$labelSelectAll,
1927
+ labelTooltip = _ref.labelTooltip,
1922
1928
  listStyle = _ref.listStyle,
1923
1929
  loadingText = _ref.loadingText,
1924
1930
  _ref$maxChips = _ref.maxChips,
@@ -2166,7 +2172,9 @@ var MultiSelect = function MultiSelect(_ref) {
2166
2172
  });
2167
2173
  };
2168
2174
  return React.createElement("div", {
2169
- className: classNames('eds-dropdown__wrapper', className),
2175
+ className: classNames('eds-dropdown__wrapper', className, {
2176
+ 'eds-dropdown__wrapper--has-tooltip': labelTooltip !== undefined
2177
+ }),
2170
2178
  style: style
2171
2179
  }, React.createElement(form.BaseFormControl, _extends({
2172
2180
  append: React.createElement(FieldAppend$1, {
@@ -2190,6 +2198,7 @@ var MultiSelect = function MultiSelect(_ref) {
2190
2198
  label: label,
2191
2199
  labelId: getLabelProps().id,
2192
2200
  labelProps: getLabelProps(),
2201
+ labelTooltip: labelTooltip,
2193
2202
  onClick: function onClick(e) {
2194
2203
  var _inputRef$current4;
2195
2204
  if (e.target === e.currentTarget) (_inputRef$current4 = inputRef.current) == null ? void 0 : _inputRef$current4.focus();
@@ -2276,7 +2285,7 @@ var MultiSelect = function MultiSelect(_ref) {
2276
2285
  }));
2277
2286
  };
2278
2287
 
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"];
2288
+ 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
2289
  var Dropdown = function Dropdown(_ref) {
2281
2290
  var _ref3, _selectedItem$label;
2282
2291
  var ariaLabelChosenSingular = _ref.ariaLabelChosenSingular,
@@ -2294,6 +2303,7 @@ var Dropdown = function Dropdown(_ref) {
2294
2303
  label = _ref.label,
2295
2304
  _ref$labelClearSelect = _ref.labelClearSelectedItem,
2296
2305
  labelClearSelectedItem = _ref$labelClearSelect === void 0 ? 'fjern valgt' : _ref$labelClearSelect,
2306
+ labelTooltip = _ref.labelTooltip,
2297
2307
  listStyle = _ref.listStyle,
2298
2308
  loadingText = _ref.loadingText,
2299
2309
  onChange = _ref.onChange,
@@ -2344,7 +2354,9 @@ var Dropdown = function Dropdown(_ref) {
2344
2354
  getToggleButtonProps = _useSelect.getToggleButtonProps,
2345
2355
  highlightedIndex = _useSelect.highlightedIndex;
2346
2356
  return React.createElement("div", {
2347
- className: classNames('eds-dropdown__wrapper', className),
2357
+ className: classNames('eds-dropdown__wrapper', className, {
2358
+ 'eds-dropdown__wrapper--has-tooltip': labelTooltip !== undefined
2359
+ }),
2348
2360
  style: style
2349
2361
  }, React.createElement(form.BaseFormControl, _extends({
2350
2362
  append: React.createElement(FieldAppend$1, {
@@ -2376,6 +2388,7 @@ var Dropdown = function Dropdown(_ref) {
2376
2388
  label: label,
2377
2389
  labelId: getLabelProps().id,
2378
2390
  labelProps: getLabelProps(),
2391
+ labelTooltip: labelTooltip,
2379
2392
  prepend: prepend,
2380
2393
  readOnly: readOnly,
2381
2394
  variant: variant