@entur/dropdown 5.1.2 → 5.2.0-beta.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.
- package/dist/Dropdown.d.ts +6 -7
- package/dist/MultiSelect.d.ts +7 -8
- package/dist/NativeDropdown.d.ts +6 -7
- package/dist/SearchableDropdown.d.ts +7 -8
- package/dist/components/DropdownList.d.ts +7 -7
- package/dist/components/FieldComponents.d.ts +10 -8
- package/dist/deprecated/BaseDropdown.d.ts +2 -2
- package/dist/deprecated/DownshiftProvider.d.ts +4 -4
- package/dist/deprecated/Dropdown.d.ts +4 -5
- package/dist/deprecated/DropdownList.d.ts +2 -2
- package/dist/deprecated/MultiSelect.d.ts +5 -6
- package/dist/deprecated/RegularDropdown.d.ts +2 -2
- package/dist/deprecated/SearchableDropdown.d.ts +3 -3
- package/dist/deprecated/types.d.ts +15 -0
- package/dist/dropdown.cjs.development.js +13 -2
- package/dist/dropdown.cjs.development.js.map +1 -1
- package/dist/dropdown.cjs.production.min.js +1 -1
- package/dist/dropdown.cjs.production.min.js.map +1 -1
- package/dist/dropdown.esm.js +13 -2
- package/dist/dropdown.esm.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/styles.css +7 -7
- package/dist/types.d.ts +14 -0
- package/dist/useNormalizedItems.d.ts +2 -12
- package/dist/useResolvedItems.d.ts +3 -8
- package/dist/utils.d.ts +23 -23
- package/package.json +8 -8
package/dist/dropdown.esm.js
CHANGED
|
@@ -780,6 +780,14 @@ var DropdownInputGroupDeprecated = function DropdownInputGroupDeprecated(_ref) {
|
|
|
780
780
|
}, feedback)));
|
|
781
781
|
};
|
|
782
782
|
|
|
783
|
+
// export type DropdownItemType<ValueType> =
|
|
784
|
+
// | { value?: ValueType; label: string; icons?: React.ComponentType<any>[] }
|
|
785
|
+
// | string;
|
|
786
|
+
// export type NormalizedDropdownItemType = {
|
|
787
|
+
// value: string | number | Record<any, any>;
|
|
788
|
+
// label: string;
|
|
789
|
+
// icons?: React.ComponentType<any>[];
|
|
790
|
+
// };
|
|
783
791
|
var useNormalizedItems = function useNormalizedItems(items) {
|
|
784
792
|
return React.useMemo(function () {
|
|
785
793
|
return items.map(function (item) {
|
|
@@ -991,7 +999,7 @@ var useMultiSelectOldContext = function useMultiSelectOldContext() {
|
|
|
991
999
|
return context;
|
|
992
1000
|
};
|
|
993
1001
|
function stateReducer(state,
|
|
994
|
-
//StateChangeOptions<
|
|
1002
|
+
//StateChangeOptions<NormalizedDropdownItemDeprecatedType>,
|
|
995
1003
|
actionAndChanges) {
|
|
996
1004
|
var changes = actionAndChanges.changes,
|
|
997
1005
|
type = actionAndChanges.type;
|
|
@@ -1334,6 +1342,9 @@ var DropdownList = function DropdownList(_ref) {
|
|
|
1334
1342
|
})
|
|
1335
1343
|
}, getItemProps({
|
|
1336
1344
|
key: (item == null ? void 0 : item.label) + (item == null ? void 0 : item.value),
|
|
1345
|
+
// @ts-expect-error Since getItemProps expects the same item type
|
|
1346
|
+
// here as items, it throws error when selectAllItem is a string.
|
|
1347
|
+
// This does, however, not cause any functional issues.
|
|
1337
1348
|
item: item,
|
|
1338
1349
|
index: index
|
|
1339
1350
|
})), itemIsSelectAll ? selectAllListItemContent() : listItemContent(item));
|
|
@@ -2209,7 +2220,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
2209
2220
|
disabled: disabled,
|
|
2210
2221
|
getSelectedItemProps: getSelectedItemProps,
|
|
2211
2222
|
index: index,
|
|
2212
|
-
key: selectedItem == null ? void 0 : selectedItem.value,
|
|
2223
|
+
key: (selectedItem == null ? void 0 : selectedItem.label) + (typeof (selectedItem == null ? void 0 : selectedItem.value) === 'string' ? selectedItem.value : ''),
|
|
2213
2224
|
readOnly: readOnly,
|
|
2214
2225
|
removeSelectedItem: function removeSelectedItem() {
|
|
2215
2226
|
var _inputRef$current6;
|