@wavv/ui 1.8.0-beta.8 → 1.8.1

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.
@@ -49,7 +49,7 @@ type DropdownProps<OptionType> = {
49
49
  id?: string;
50
50
  /** Sets the name of the Dropdown input */
51
51
  name?: string;
52
- /** An HTML element/React component to trigger the opening and closing of the dropdown instead of an input */
52
+ /** (DEPRECATED! Use the DropdownMenu component instead.) An HTML element/React component to trigger the opening and closing of the dropdown instead of an input */
53
53
  trigger?: ReactNode;
54
54
  /** Center the Dropdown options vertically with the trigger */
55
55
  centerY?: boolean;
@@ -1,5 +1,5 @@
1
- import React, { ChangeEvent, MouseEvent, ReactElement, ReactNode } from 'react';
2
- import { FlexPosition } from '../types';
1
+ import { ChangeEvent, MouseEvent, ReactElement, ReactNode } from 'react';
2
+ import { FlexPosition, ThemeProp } from '../types';
3
3
  export type OptionItem = {
4
4
  id: number | string;
5
5
  label: string;
@@ -41,7 +41,16 @@ type StatePieces = {
41
41
  };
42
42
  type FilterState = Omit<StatePieces, 'selected'>;
43
43
  export declare const getFilteredOptions: <OptionType extends OptionItem>(options: OptionType[], state: FilterState) => OptionType[];
44
+ export declare const getItemContentFromOption: <OptionType extends OptionItem>(option: OptionType) => import("react/jsx-runtime").JSX.Element;
44
45
  export declare const getOptionsFromArray: <OptionType extends OptionItem>(options: OptionType[], setValue: SetValueFunc, toggle: toggleFunc, state: FilterState) => import("react/jsx-runtime").JSX.Element[];
45
- export declare const getOptionsFromChildren: <OptionType extends OptionItem>(children: ReactNode, setValue: SetValueFunc, toggle: toggleFunc) => (React.ReactElement<DropdownItemProps<OptionType>, string | React.JSXElementConstructor<any>> | null)[];
46
- export declare const getCombinedChildren: <OptionType extends OptionItem>(options: OptionType[], children: ReactNode, setValue: SetValueFunc, toggle: toggleFunc, state: StatePieces) => (React.ReactElement<any, string | React.JSXElementConstructor<any>> | null)[];
46
+ export declare const getOptionsFromChildren: <OptionType extends OptionItem>(children: ReactNode, setValue: SetValueFunc, toggle: toggleFunc) => (ReactElement<DropdownItemProps<OptionType>, string | import("react").JSXElementConstructor<any>> | null)[];
47
+ export declare const getCombinedChildren: <OptionType extends OptionItem>(options: OptionType[], children: ReactNode, setValue: SetValueFunc, toggle: toggleFunc, state: StatePieces) => (ReactElement<any, string | import("react").JSXElementConstructor<any>> | null)[];
48
+ export declare const ItemHeader: import("@emotion/styled").StyledComponent<{
49
+ theme?: import("@emotion/react").Theme | undefined;
50
+ as?: import("react").ElementType<any> | undefined;
51
+ } & ThemeProp, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
52
+ export declare const ItemSubtext: import("@emotion/styled").StyledComponent<{
53
+ theme?: import("@emotion/react").Theme | undefined;
54
+ as?: import("react").ElementType<any> | undefined;
55
+ } & ThemeProp, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
47
56
  export {};
@@ -1,12 +1,15 @@
1
1
  import { HTMLProps, ReactNode } from 'react';
2
- import { As, FlexPosition, PopPosition } from './types';
3
2
  import { OptionItem } from './Dropdown/DropdownUtils';
4
- type DivProps = Omit<HTMLProps<HTMLDivElement>, 'as'> & As;
3
+ import { As, FlexPosition, PopPosition } from './types';
4
+ type DivProps = Omit<HTMLProps<HTMLDivElement>, 'onChange' | 'as'> & As;
5
5
  type WithChildren = {
6
6
  children: ReactNode;
7
+ onChange?: never;
7
8
  };
8
9
  type WithOptions<OptionType> = {
9
10
  options: OptionType[];
11
+ /** The function called after an option from the options array is selected */
12
+ onChange?: (option: OptionType, event: Event) => void;
10
13
  };
11
14
  type EitherChildrenOrOptions<OptionType> = WithChildren | WithOptions<OptionType>;
12
15
  type DropdownMenuProps<OptionType> = {
@@ -35,15 +38,13 @@ type DropdownMenuProps<OptionType> = {
35
38
  zIndex?: number;
36
39
  /** Enables the page to scroll when the menu is open */
37
40
  disableScrollLock?: boolean;
38
- /** The function called after an option from the options array is selected */
39
- onOptionSelect?: (option: OptionType, event: Event) => void;
40
41
  /** The function called after the menu opens */
41
42
  afterShow?: () => void;
42
43
  /** The function called after the menu closes */
43
44
  afterHide?: () => void;
44
45
  } & EitherChildrenOrOptions<OptionType> & DivProps;
45
46
  declare const DropdownMenu: {
46
- <OptionType extends OptionItem>({ children, options, id, position, trigger, open, offset, arrow, width, maxHeight, container, zIndex, disableScrollLock, onOptionSelect, afterShow, afterHide, ...props }: DropdownMenuProps<OptionType>): import("react/jsx-runtime").JSX.Element;
47
+ <OptionType extends OptionItem>({ children, options, id, position, trigger, open, offset, arrow, width, maxHeight, container, zIndex, disableScrollLock, onChange, afterShow, afterHide, ...props }: DropdownMenuProps<OptionType>): import("react/jsx-runtime").JSX.Element;
47
48
  Item: ({ children, id, disabled, onClick, ...props }: ItemProps) => import("react/jsx-runtime").JSX.Element;
48
49
  Sub({ children, id, label, zIndex, disabled, container, ...props }: SubProps): import("react/jsx-runtime").JSX.Element;
49
50
  Separator(): import("react/jsx-runtime").JSX.Element;