@shlinkio/shlink-frontend-kit 1.2.1 → 1.3.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/index.d.ts +41 -0
- package/dist/index.js +507 -506
- package/package.json +17 -16
package/dist/index.d.ts
CHANGED
|
@@ -424,6 +424,11 @@ export declare type NavPillsProps = PropsWithChildren<{
|
|
|
424
424
|
className?: string;
|
|
425
425
|
}>;
|
|
426
426
|
|
|
427
|
+
/**
|
|
428
|
+
* Normalizes a tag, making it lowercase, trimmed and replacing space characters with dashes
|
|
429
|
+
*/
|
|
430
|
+
export declare const normalizeTag: (tag: string) => string;
|
|
431
|
+
|
|
427
432
|
declare type NoTitleProps = {
|
|
428
433
|
title?: never;
|
|
429
434
|
titleSize?: never;
|
|
@@ -689,6 +694,36 @@ export declare type TagsAutocompleteProps = {
|
|
|
689
694
|
searchMode?: 'startsWith' | 'includes';
|
|
690
695
|
} & Pick<SearchComboboxProps<string>, 'placeholder' | 'size' | 'disabled' | 'aria-label'>;
|
|
691
696
|
|
|
697
|
+
export declare type TagsSearchOptions = {
|
|
698
|
+
/** Full list of tags to search on */
|
|
699
|
+
tags: string[];
|
|
700
|
+
/** Tags that are already selected, to ignore them while searching */
|
|
701
|
+
selectedTags: string[];
|
|
702
|
+
/** How to do the search term matching on tags, via `startsWith` or `includes` */
|
|
703
|
+
searchMode: 'startsWith' | 'includes';
|
|
704
|
+
/** Max amount of matching tags to return. Defaults to 5 */
|
|
705
|
+
searchLimit?: number;
|
|
706
|
+
/**
|
|
707
|
+
* Whether new entries are allowed or not.
|
|
708
|
+
* When this is true, it will be allowed to add the search term verbatim in the search result.
|
|
709
|
+
*/
|
|
710
|
+
allowAdding?: boolean;
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
export declare type TagsSearchResult = {
|
|
714
|
+
/**
|
|
715
|
+
* A Map with the list of tags that match the search result, with the tag used both as key and value.
|
|
716
|
+
* Returned as a Map for convenience to use with SearchCombobox.
|
|
717
|
+
*
|
|
718
|
+
* When no tags match the search term, or the search term is empty, then `undefined` is returned.
|
|
719
|
+
*
|
|
720
|
+
* @see {SearchCombobox}
|
|
721
|
+
*/
|
|
722
|
+
searchResults: Map<string, string> | undefined;
|
|
723
|
+
/** A callback used to perform a search in the list of tags */
|
|
724
|
+
onSearch: (searchTerm: string) => void;
|
|
725
|
+
};
|
|
726
|
+
|
|
692
727
|
export declare type Theme = 'dark' | 'light';
|
|
693
728
|
|
|
694
729
|
export declare type TimeoutToggle = typeof useTimeoutToggle;
|
|
@@ -751,6 +786,12 @@ export declare const useGoBack: () => () => void | Promise<void>;
|
|
|
751
786
|
|
|
752
787
|
export declare const useParsedQuery: <T>() => T;
|
|
753
788
|
|
|
789
|
+
/**
|
|
790
|
+
* Allows to search on a list of tags and only return the ones that match.
|
|
791
|
+
* Search can be done by `startsWith` or `includes`.
|
|
792
|
+
*/
|
|
793
|
+
export declare function useTagsSearch({ tags, selectedTags, searchMode, searchLimit, allowAdding }: TagsSearchOptions): TagsSearchResult;
|
|
794
|
+
|
|
754
795
|
export declare const useTheme: (initialTheme?: Theme) => readonly [Theme, Dispatch<SetStateAction<Theme>>];
|
|
755
796
|
|
|
756
797
|
export declare function useTimeout(defaultDelay: number,
|