@ssa-ui-kit/core 2.16.3-canary-be61b75-20250507 → 2.16.3

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.
@@ -4,13 +4,13 @@ import { UseTypeaheadResult } from './useTypeahead';
4
4
  export declare const TypeaheadContext: React.Context<{
5
5
  isOpen: boolean;
6
6
  isDisabled: boolean | undefined;
7
- optionsWithKey: Record<string | number, import("./types").TypeaheadOptionProps>;
8
- selectedItems: import("./types").TypeaheadValue[];
7
+ optionsWithKey: Record<string | number, Record<string, string | number>>;
8
+ selectedItems: (string | number)[];
9
9
  inputRef: React.RefObject<HTMLInputElement>;
10
10
  firstSuggestion: string;
11
11
  isMultiple: boolean | undefined;
12
12
  typeaheadId: string;
13
- triggerRef: React.RefObject<HTMLDivElement>;
13
+ triggerRef: React.MutableRefObject<HTMLDivElement | null>;
14
14
  className: string | undefined;
15
15
  startIcon: React.ReactNode;
16
16
  endIcon: React.ReactNode;
@@ -21,18 +21,18 @@ export declare const TypeaheadContext: React.Context<{
21
21
  inputValue: string;
22
22
  validationSchema: Record<string, unknown> | undefined;
23
23
  status: "error" | "success" | "basic";
24
- error: import("react-hook-form").FieldError | import("react-hook-form").Merge<import("react-hook-form").FieldError, import("react-hook-form").FieldErrorsImpl<any>> | undefined;
25
24
  placeholder: string | null | undefined;
26
- options: (React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null)[];
25
+ options: React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
27
26
  useFormResult: UseFormReturn<FieldValues, any, undefined>;
28
- register: import("react-hook-form").UseFormRegister<FieldValues>;
29
- setValue: import("react-hook-form").UseFormSetValue<FieldValues>;
30
- onChange: ((selectedItem: import("./types").TypeaheadValue, isSelected: boolean) => void) | undefined;
31
- handleClearAll: (e: React.MouseEvent) => void;
32
- handleOpenChange: (open: boolean, event: Event, reason?: import("@floating-ui/react").OpenChangeReason) => void;
33
- handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
27
+ register: import("react-hook-form").UseFormRegister<FieldValues> | undefined;
28
+ setValue: import("react-hook-form").UseFormSetValue<FieldValues> | undefined;
29
+ handleChange: (changingValue?: string | number) => void;
30
+ handleClearAll: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
31
+ handleOpenChange: (open: boolean) => void;
32
+ handleInputChange: React.ChangeEventHandler<HTMLInputElement>;
34
33
  handleInputClick: React.MouseEventHandler<HTMLInputElement>;
35
34
  handleInputKeyDown: React.KeyboardEventHandler<HTMLInputElement>;
36
- handleRemoveSelectedClick: (value: string | number) => (e: React.MouseEvent) => void;
35
+ handleSelectedClick: React.MouseEventHandler<HTMLDivElement>;
36
+ handleRemoveSelectedClick: (selectedItem: number | string) => React.MouseEventHandler<HTMLButtonElement>;
37
37
  }>;
38
38
  export declare const useTypeaheadContext: () => UseTypeaheadResult;
@@ -8,4 +8,4 @@ import { TypeaheadProps } from './types';
8
8
  * Aria attributes are set according to
9
9
  * https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
10
10
  **/
11
- export declare const Typeahead: ({ name, label, selectedItems, defaultSelectedItems, isOpen, isDisabled, isMultiple, children, className, startIcon, endIcon, error, success, helperText, validationSchema, placeholder, startIconClassName, endIconClassName, optionsClassName, wrapperClassName, width, onChange, onEmptyChange, onClearAll, onRemoveSelectedClick, renderOption, }: TypeaheadProps) => import("@emotion/react/jsx-runtime").JSX.Element;
11
+ export declare const Typeahead: ({ name, label, selectedItems, isOpen, isDisabled, isMultiple, children, className, startIcon, endIcon, error, success, helperText, validationSchema, placeholder, startIconClassName, endIconClassName, optionsClassName, wrapperClassName, width, setValue, register, onChange, onEmptyChange, onClearAll, onRemoveSelectedClick, renderOption, }: TypeaheadProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,10 +1,9 @@
1
1
  import { CommonProps } from '../../types/emotion';
2
- import { FieldError } from 'react-hook-form';
2
+ import { FieldError, FieldValues, UseFormReturn, UseFormSetValue } from 'react-hook-form';
3
3
  export type TypeaheadValue = string | number;
4
4
  export type TypeaheadOptionProps = Record<string, TypeaheadValue>;
5
5
  export interface TypeaheadProps {
6
6
  selectedItems?: Array<TypeaheadValue>;
7
- defaultSelectedItems?: Array<TypeaheadValue>;
8
7
  isMultiple?: boolean;
9
8
  isDisabled?: boolean;
10
9
  children?: React.ReactNode;
@@ -24,8 +23,8 @@ export interface TypeaheadProps {
24
23
  success?: boolean;
25
24
  validationSchema?: Record<string, unknown>;
26
25
  placeholder?: string | null;
27
- filterOptions?: boolean;
28
- autoSelect?: boolean;
26
+ setValue?: UseFormSetValue<FieldValues>;
27
+ register?: UseFormReturn['register'];
29
28
  onChange?: (selectedItem: TypeaheadValue, isSelected: boolean) => void;
30
29
  onClearAll?: () => void;
31
30
  onRemoveSelectedClick?: (selectedItem: TypeaheadValue) => void;
@@ -36,7 +35,7 @@ export interface TypeaheadProps {
36
35
  label: string;
37
36
  }) => React.ReactNode;
38
37
  }
39
- export type UseTypeaheadProps = Pick<TypeaheadProps, 'selectedItems' | 'defaultSelectedItems' | 'isDisabled' | 'children' | 'isMultiple' | 'onChange' | 'onClearAll' | 'onRemoveSelectedClick' | 'onEmptyChange' | 'renderOption' | 'isOpen' | 'className' | 'startIcon' | 'endIcon' | 'startIconClassName' | 'endIconClassName' | 'name' | 'validationSchema' | 'error' | 'success' | 'placeholder' | 'filterOptions' | 'autoSelect'>;
38
+ export type UseTypeaheadProps = Pick<TypeaheadProps, 'selectedItems' | 'isDisabled' | 'children' | 'isMultiple' | 'onChange' | 'onClearAll' | 'onRemoveSelectedClick' | 'onEmptyChange' | 'renderOption' | 'isOpen' | 'className' | 'startIcon' | 'endIcon' | 'startIconClassName' | 'endIconClassName' | 'name' | 'register' | 'setValue' | 'validationSchema' | 'error' | 'success' | 'placeholder'>;
40
39
  export interface TypeaheadItemsListProps extends CommonProps {
41
40
  children?: React.ReactNode;
42
41
  noItemsMessage?: string;
@@ -1,16 +1,15 @@
1
- import React from 'react';
2
- import { OpenChangeReason } from '@floating-ui/react';
3
- import { TypeaheadOptionProps, TypeaheadValue, UseTypeaheadProps } from './types';
4
- export declare const useTypeahead: ({ name, isOpen: isInitOpen, selectedItems: providedSelectedItems, defaultSelectedItems, isDisabled, isMultiple, children, className, startIcon, endIcon, startIconClassName, endIconClassName, validationSchema, error, success, placeholder, filterOptions, autoSelect, onChange, onClearAll, onRemoveSelectedClick, onEmptyChange, renderOption, }: UseTypeaheadProps) => {
1
+ import React, { MouseEventHandler } from 'react';
2
+ import { UseTypeaheadProps } from './types';
3
+ export declare const useTypeahead: ({ name, isOpen: isInitOpen, selectedItems, isDisabled, isMultiple, children, className, startIcon, endIcon, startIconClassName, endIconClassName, validationSchema, error, success, placeholder, register, setValue, onChange, onClearAll, onRemoveSelectedClick, onEmptyChange, renderOption, }: UseTypeaheadProps) => {
5
4
  isOpen: boolean;
6
5
  isDisabled: boolean | undefined;
7
- optionsWithKey: Record<string | number, TypeaheadOptionProps>;
8
- selectedItems: TypeaheadValue[];
6
+ optionsWithKey: Record<string | number, Record<string, string | number>>;
7
+ selectedItems: (string | number)[];
9
8
  inputRef: React.RefObject<HTMLInputElement>;
10
9
  firstSuggestion: string;
11
10
  isMultiple: boolean | undefined;
12
11
  typeaheadId: string;
13
- triggerRef: React.RefObject<HTMLDivElement>;
12
+ triggerRef: React.MutableRefObject<HTMLDivElement | null>;
14
13
  className: string | undefined;
15
14
  startIcon: React.ReactNode;
16
15
  endIcon: React.ReactNode;
@@ -21,18 +20,18 @@ export declare const useTypeahead: ({ name, isOpen: isInitOpen, selectedItems: p
21
20
  inputValue: string;
22
21
  validationSchema: Record<string, unknown> | undefined;
23
22
  status: "error" | "success" | "basic";
24
- error: import("react-hook-form").FieldError | import("react-hook-form").Merge<import("react-hook-form").FieldError, import("react-hook-form").FieldErrorsImpl<any>> | undefined;
25
23
  placeholder: string | null | undefined;
26
- options: (React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null)[];
24
+ options: React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
27
25
  useFormResult: import("react-hook-form").UseFormReturn<import("react-hook-form").FieldValues, any, undefined>;
28
- register: import("react-hook-form").UseFormRegister<import("react-hook-form").FieldValues>;
29
- setValue: import("react-hook-form").UseFormSetValue<import("react-hook-form").FieldValues>;
30
- onChange: ((selectedItem: TypeaheadValue, isSelected: boolean) => void) | undefined;
31
- handleClearAll: (e: React.MouseEvent) => void;
32
- handleOpenChange: (open: boolean, event: Event, reason?: OpenChangeReason) => void;
33
- handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
26
+ register: import("react-hook-form").UseFormRegister<import("react-hook-form").FieldValues> | undefined;
27
+ setValue: import("react-hook-form").UseFormSetValue<import("react-hook-form").FieldValues> | undefined;
28
+ handleChange: (changingValue?: string | number) => void;
29
+ handleClearAll: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
30
+ handleOpenChange: (open: boolean) => void;
31
+ handleInputChange: React.ChangeEventHandler<HTMLInputElement>;
34
32
  handleInputClick: React.MouseEventHandler<HTMLInputElement>;
35
33
  handleInputKeyDown: React.KeyboardEventHandler<HTMLInputElement>;
36
- handleRemoveSelectedClick: (value: string | number) => (e: React.MouseEvent) => void;
34
+ handleSelectedClick: React.MouseEventHandler<HTMLDivElement>;
35
+ handleRemoveSelectedClick: (selectedItem: number | string) => MouseEventHandler<HTMLButtonElement>;
37
36
  };
38
37
  export type UseTypeaheadResult = ReturnType<typeof useTypeahead>;