stratosphere-ui 0.1.8 → 0.1.9
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/components/Form/FormComboboxMulti.d.ts +5 -0
- package/dist/components/Form/FormComboboxSingle.d.ts +5 -0
- package/dist/components/Form/FormRangeSlider.d.ts +0 -2
- package/dist/components/Form/types.d.ts +10 -1
- package/dist/components/{Typeahead → TypeaheadSelect}/TypeaheadSelect.d.ts +3 -3
- package/dist/components/TypeaheadSelect/index.d.ts +2 -0
- package/dist/components/TypeaheadSelect/useTypeaheadSelect.d.ts +18 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useDebouncedValue.d.ts +1 -1
- package/dist/hooks/useFormValues.d.ts +2 -0
- package/dist/hooks/useTypeaheadQuery.d.ts +13 -0
- package/dist/stratosphere-ui.js +6183 -6186
- package/package.json +1 -1
- package/dist/components/Typeahead/TypeaheadDropdown.d.ts +0 -12
- package/dist/components/Typeahead/TypeaheadMultiSelect.d.ts +0 -6
- package/dist/components/Typeahead/TypeaheadSingleSelect.d.ts +0 -6
- package/dist/components/Typeahead/index.d.ts +0 -2
- package/dist/components/Typeahead/useTypeaheadInput.d.ts +0 -15
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { ComboboxProps } from './types';
|
|
4
|
+
import { GenericDataType } from '../../common';
|
|
5
|
+
export declare const ComboboxMulti: <DataItem extends GenericDataType, Values extends FieldValues>({ children, className, getItemValue, name, selectedItems, setSelectedItems, }: ComboboxProps<DataItem, Values>) => JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { ComboboxProps } from './types';
|
|
4
|
+
import { GenericDataType } from '../../common';
|
|
5
|
+
export declare const ComboboxSingle: <DataItem extends GenericDataType, Values extends FieldValues>({ children, className, getItemValue, name, selectedItems, setSelectedItems, value, }: ComboboxProps<DataItem, Values>) => JSX.Element;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
|
+
import { FieldValues, Path, PathValue, UseControllerProps } from 'react-hook-form';
|
|
3
|
+
import { TypeaheadSelectProps } from '../TypeaheadSelect';
|
|
4
|
+
import { GenericDataType } from '../../common';
|
|
2
5
|
export interface FormFieldProps<Values extends FieldValues> {
|
|
3
6
|
controllerProps?: Omit<UseControllerProps<Values>, 'name'>;
|
|
4
7
|
isRequired?: boolean;
|
|
@@ -6,6 +9,12 @@ export interface FormFieldProps<Values extends FieldValues> {
|
|
|
6
9
|
name: Path<Values>;
|
|
7
10
|
placeholder?: string;
|
|
8
11
|
}
|
|
12
|
+
export interface ComboboxProps<DataItem extends GenericDataType, Values extends FieldValues> extends Pick<TypeaheadSelectProps<DataItem, Values>, 'className' | 'getItemValue' | 'name'> {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
selectedItems: DataItem[];
|
|
15
|
+
setSelectedItems: Dispatch<SetStateAction<DataItem[]>>;
|
|
16
|
+
value: PathValue<Values, Path<Values>>;
|
|
17
|
+
}
|
|
9
18
|
export interface Transform<TOutput> {
|
|
10
19
|
output: (val: string) => TOutput;
|
|
11
20
|
input: (val: TOutput) => string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
|
-
import { UseTypeaheadInputOptions } from './useTypeaheadInput';
|
|
4
3
|
import { FormFieldProps } from '../Form';
|
|
5
4
|
import { GenericDataType } from '../../common';
|
|
6
|
-
|
|
5
|
+
import { UseTypeaheadQueryOptions } from '../../hooks';
|
|
6
|
+
export interface TypeaheadSelectProps<DataItem extends GenericDataType, Values extends FieldValues> extends UseTypeaheadQueryOptions<DataItem>, FormFieldProps<Values> {
|
|
7
7
|
className?: string;
|
|
8
8
|
getBadgeText?: (item: DataItem) => string;
|
|
9
9
|
getItemText: (data: DataItem) => string;
|
|
@@ -11,4 +11,4 @@ export interface TypeaheadSelectProps<DataItem extends GenericDataType, Values e
|
|
|
11
11
|
inputRef?: RefObject<HTMLInputElement>;
|
|
12
12
|
multi?: true;
|
|
13
13
|
}
|
|
14
|
-
export declare const TypeaheadSelect: <DataItem extends GenericDataType, Values extends FieldValues>({ multi,
|
|
14
|
+
export declare const TypeaheadSelect: <DataItem extends GenericDataType, Values extends FieldValues>({ className, controllerProps, debounceTime, getBadgeText, getItemText, getItemValue, inputRef, isRequired, labelText, multi, name, onDebouncedChange, options, placeholder, }: TypeaheadSelectProps<DataItem, Values>) => JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { TypeaheadSelectProps } from './TypeaheadSelect';
|
|
4
|
+
import { GenericDataType } from '../../common';
|
|
5
|
+
export declare type UseTypeaheadSelectOptions<DataItem extends GenericDataType, Values extends FieldValues> = Pick<TypeaheadSelectProps<DataItem, Values>, 'controllerProps' | 'debounceTime' | 'multi' | 'name' | 'onDebouncedChange' | 'options'>;
|
|
6
|
+
export declare const useTypeaheadSelect: <DataItem extends GenericDataType, Values extends FieldValues>({ controllerProps, debounceTime, multi, name, onDebouncedChange, options, }: UseTypeaheadSelectOptions<DataItem, Values>) => {
|
|
7
|
+
error: import("react-hook-form").FieldError | undefined;
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
query: string;
|
|
10
|
+
dropdownRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
11
|
+
searchInputRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
12
|
+
selectedItems: DataItem[];
|
|
13
|
+
setShowDropdown: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
14
|
+
setSelectedItems: import("react").Dispatch<import("react").SetStateAction<DataItem[]>>;
|
|
15
|
+
showDropdown: boolean;
|
|
16
|
+
setQuery: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
17
|
+
value: import("react-hook-form").PathValue<Values, import("react-hook-form").Path<Values>>;
|
|
18
|
+
};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
export declare type UseDebouncedStateValue = string | number | boolean | null;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const useDebouncedValue: <Value extends UseDebouncedStateValue>(value: Value, delay: number) => [Value, Dispatch<SetStateAction<Value>>, Value, boolean];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { GenericDataType } from '../common';
|
|
3
|
+
export interface UseTypeaheadQueryOptions<DataItem> {
|
|
4
|
+
debounceTime?: number;
|
|
5
|
+
onDebouncedChange: (value: string) => void;
|
|
6
|
+
options?: DataItem[];
|
|
7
|
+
}
|
|
8
|
+
export interface UseTypeaheadQueryResult {
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
query: string;
|
|
11
|
+
setQuery: Dispatch<SetStateAction<string>>;
|
|
12
|
+
}
|
|
13
|
+
export declare const useTypeaheadQuery: <DataItem extends GenericDataType>({ debounceTime, onDebouncedChange, options, }: UseTypeaheadQueryOptions<DataItem>) => UseTypeaheadQueryResult;
|