@saleor/macaw-ui 1.1.6 → 1.1.7

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.
@@ -3,3 +3,4 @@ export * from './LoadingListItem';
3
3
  export * from './types';
4
4
  export * from './helpers';
5
5
  export * from './NoOptions';
6
+ export * from './useHighlightedIndex';
@@ -3,6 +3,7 @@ import { ReactNode } from 'react';
3
3
  export type Option = {
4
4
  label: string;
5
5
  value: string;
6
+ disabled?: boolean;
6
7
  startAdornment?: ReactNode;
7
8
  endAdornment?: ReactNode;
8
9
  };
@@ -0,0 +1,7 @@
1
+ import { Option } from '.';
2
+ import { UseComboboxStateChangeTypes, UseSelectStateChangeTypes } from 'downshift';
3
+
4
+ export declare function useHighlightedIndex<T extends Option>(items: T[], selectedItem: T | null | undefined): {
5
+ highlightedIndex: number | undefined;
6
+ onHighlightedIndexChange: (index: number | undefined, type: UseComboboxStateChangeTypes | UseSelectStateChangeTypes) => void;
7
+ };
@@ -19,7 +19,7 @@ export declare const useCombobox: <T extends Option, V extends string | Option>(
19
19
  getLabelProps: (options?: import('downshift').UseComboboxGetLabelPropsOptions | undefined) => any;
20
20
  getMenuProps: (options?: import('downshift').UseComboboxGetMenuPropsOptions | undefined, otherOptions?: GetPropsCommonOptions | undefined) => any;
21
21
  getInputProps: (options?: UseComboboxGetInputPropsOptions, otherOptions?: GetPropsCommonOptions) => any;
22
- highlightedIndex: number;
22
+ highlightedIndex: number | undefined;
23
23
  getItemProps: (options: import('downshift').UseComboboxGetItemPropsOptions<T>) => any;
24
24
  hasItemsToSelect: boolean;
25
25
  };
@@ -12,4 +12,5 @@ export declare const Example: () => JSX.Element;
12
12
  export declare const WithStringValue: () => JSX.Element;
13
13
  export declare const WithAdornment: () => JSX.Element;
14
14
  export declare const WithEllipsis: () => JSX.Element;
15
+ export declare const WithDisabledOption: () => JSX.Element;
15
16
  export declare const NoOptions: () => JSX.Element;
@@ -10,5 +10,6 @@ export declare const Disabled: Story;
10
10
  export declare const WithHelperText: Story;
11
11
  export declare const WithEndAdornment: Story;
12
12
  export declare const WithStringAsValues: () => JSX.Element;
13
+ export declare const WithDisabledOption: () => JSX.Element;
13
14
  export declare const Empty: () => JSX.Element;
14
15
  export declare const NoOptions: () => JSX.Element;
@@ -11,5 +11,6 @@ export declare const WithHelperText: Story;
11
11
  export declare const WithStringValue: () => JSX.Element;
12
12
  export declare const WithStartAdornment: () => JSX.Element;
13
13
  export declare const WithEllipsis: () => JSX.Element;
14
+ export declare const WithDisabledOption: () => JSX.Element;
14
15
  export declare const Empty: () => JSX.Element;
15
16
  export declare const NoOptions: () => JSX.Element;
@@ -17,7 +17,7 @@ export declare const useSelect: <T extends Option, V extends string | Option>({
17
17
  getToggleButtonProps: (options?: UseSelectGetToggleButtonPropsOptions | undefined, otherOptions?: GetPropsCommonOptions | undefined) => any;
18
18
  getLabelProps: (options?: import('downshift').UseSelectGetLabelPropsOptions | undefined) => any;
19
19
  getMenuProps: (options?: import('downshift').UseSelectGetMenuPropsOptions | undefined, otherOptions?: GetPropsCommonOptions | undefined) => any;
20
- highlightedIndex: number;
20
+ highlightedIndex: number | undefined;
21
21
  getItemProps: (options: import('downshift').UseSelectGetItemPropsOptions<T>) => any;
22
22
  selectedItem: T | null;
23
23
  hasItemsToSelect: boolean;