@leancodepl/kratos
Version:
Headless React components library for building Ory Kratos authentication flows
64 lines • 2.32 kB
TypeScript
import { UiNode, UiNodeAnchorAttributes, UiNodeDivisionAttributes, UiNodeImageAttributes, UiNodeInputAttributes, UiNodeScriptAttributes, UiNodeTextAttributes, UiText } from '../api.generated';
/**
* Returns the node's label.
*
* @param node - the node get the label from
* @returns label of the node
*/
export declare const getNodeLabel: (node: UiNode) => UiText | undefined;
type ObjWithNodeType = {
node_type: string;
};
/**
* A TypeScript type guard for nodes of the type <a>
*
* @param attrs - the attributes of the node
*/
export declare function isUiNodeAnchorAttributes(attrs: ObjWithNodeType): attrs is UiNodeAnchorAttributes;
/**
* A TypeScript type guard for nodes of the type <img>
*
* @param attrs - the attributes of the node
*/
export declare function isUiNodeImageAttributes(attrs: ObjWithNodeType): attrs is UiNodeImageAttributes;
/**
* A TypeScript type guard for nodes of the type <input>
*
* @param attrs - the attributes of the node
*/
export declare function isUiNodeInputAttributes(attrs: ObjWithNodeType): attrs is UiNodeInputAttributes;
/**
* A TypeScript type guard for nodes of the type <div>
*
* @param attrs - the attributes of the node
*/
export declare function isUiNodeDivAttributes(attrs: ObjWithNodeType): attrs is UiNodeDivisionAttributes;
/**
* A TypeScript type guard for nodes of the type `<span>{text}</span>`
*
* @param attrs - the attributes of the node
*/
export declare function isUiNodeTextAttributes(attrs: ObjWithNodeType): attrs is UiNodeTextAttributes;
/**
* A TypeScript type guard for nodes of the type <script>
*
* @param attrs - the attributes of the node
*/
export declare function isUiNodeScriptAttributes(attrs: ObjWithNodeType): attrs is UiNodeScriptAttributes;
/**
* Returns a node's ID.
*
* @param attributes - the attributes of the node
*/
export declare function getNodeId({ attributes }: UiNode): string;
/**
* Return the node input attribute type
* In <input> elements we have a variety of types, such as text, password, email, etc.
* When the attribute is null or the `type` attribute is not present, we assume it has no defined type.
*
* @param attr - the attributes of the node
* @returns type of node
*/
export declare const getNodeInputType: (attr: object) => string;
export {};
//# sourceMappingURL=ui.d.ts.map