@awsui/components-react
Version:
On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en
29 lines • 1.43 kB
TypeScript
import { TagEditorProps } from './interfaces';
/**
* Ponyfill for Array.prototype.findIndex.
*/
export declare function findIndex<T>(array: ReadonlyArray<T>, condition: (t: T) => unknown): number;
export declare function useMemoizedArray<T>(array: ReadonlyArray<T>, isEqual: (prev: T, next: T) => boolean): ReadonlyArray<T>;
interface GetTagsDiffResult {
created: Record<string, string>;
removed: string[];
}
/**
* Compares the initial tags with the current tags passed to the tag editor
* and returns the differences, identifying which tags have been created or removed.
*
* This utility can be used to track tag changes and inform your tagging service about
* the removed and added tags.
*
* @param initialTags - The original tags fetched from the backend or tagging service.
* @param tags - The current tags provided to the tag editor, including any new or modified tags.
* @returns An object containing two arrays:
* - `created`: An record of tags that are new or updated (with modified values).
* Each tag is represented by its `key` and `value`.
* - `removed`: An array of tag keys that were present in the initial tags but marked for removal.
*
* Updated tags are treated as both `created` and `removed` tags.
*/
export declare function getTagsDiff(initialTags: readonly TagEditorProps.Tag[], tags: readonly TagEditorProps.Tag[]): GetTagsDiffResult;
export {};
//# sourceMappingURL=utils.d.ts.map