@keycloak/keycloak-ui-shared 25.0.6 → 26.0.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/alerts/AlertPanel.d.ts +6 -0
- package/dist/alerts/Alerts.d.ts +2 -4
- package/dist/buttons/FormSubmitButton.d.ts +0 -1
- package/dist/context/HelpContext.d.ts +0 -1
- package/dist/context/KeycloakContext.d.ts +0 -1
- package/dist/continue-cancel/ContinueCancelModal.d.ts +0 -1
- package/dist/controls/FormErrorText.d.ts +0 -1
- package/dist/controls/FormLabel.d.ts +0 -1
- package/dist/controls/HelpItem.d.ts +0 -1
- package/dist/controls/KeycloakSpinner.d.ts +1 -0
- package/dist/controls/NumberControl.d.ts +0 -1
- package/dist/controls/OrganizationTable.d.ts +16 -0
- package/dist/controls/PasswordControl.d.ts +0 -1
- package/dist/controls/PasswordInput.d.ts +1 -2
- package/dist/controls/SwitchControl.d.ts +0 -1
- package/dist/controls/TextAreaControl.d.ts +0 -1
- package/dist/controls/TextControl.d.ts +0 -1
- package/dist/controls/keycloak-text-area/KeycloakTextArea.d.ts +1 -2
- package/dist/controls/select-control/SelectControl.d.ts +0 -1
- package/dist/controls/select-control/SingleSelectControl.d.ts +0 -1
- package/dist/controls/select-control/TypeaheadSelectControl.d.ts +0 -1
- package/dist/controls/table/KeycloakDataTable.d.ts +64 -0
- package/dist/controls/table/ListEmptyState.d.ts +20 -0
- package/dist/controls/table/PaginatingTableToolbar.d.ts +21 -0
- package/dist/controls/table/TableToolbar.d.ts +12 -0
- package/dist/keycloak-ui-shared.d.ts +1 -0
- package/dist/keycloak-ui-shared.js +1426 -786
- package/dist/main.d.ts +15 -1
- package/dist/masthead/KeycloakDropdown.d.ts +0 -1
- package/dist/masthead/Masthead.d.ts +4 -8
- package/dist/scroll-form/FormPanel.d.ts +0 -1
- package/dist/scroll-form/FormTitle.d.ts +0 -1
- package/dist/scroll-form/ScrollForm.d.ts +0 -1
- package/dist/scroll-form/ScrollPanel.d.ts +0 -1
- package/dist/select/KeycloakSelect.d.ts +0 -1
- package/dist/select/SingleSelect.d.ts +1 -2
- package/dist/select/TypeaheadSelect.d.ts +1 -2
- package/dist/user-profile/LocaleSelector.d.ts +0 -1
- package/dist/user-profile/MultiInputComponent.d.ts +0 -1
- package/dist/user-profile/OptionsComponent.d.ts +0 -1
- package/dist/user-profile/SelectComponent.d.ts +0 -1
- package/dist/user-profile/TextAreaComponent.d.ts +0 -1
- package/dist/user-profile/TextComponent.d.ts +0 -1
- package/dist/user-profile/UserProfileFields.d.ts +2 -5
- package/dist/user-profile/UserProfileGroup.d.ts +0 -1
- package/dist/user-profile/utils.d.ts +2 -2
- package/dist/utils/ErrorBoundary.d.ts +26 -0
- package/dist/utils/createNamedContext.d.ts +0 -1
- package/dist/utils/darkMode.d.ts +1 -0
- package/dist/utils/errors.d.ts +4 -0
- package/dist/utils/generateId.d.ts +1 -0
- package/dist/utils/getRuleValue.d.ts +0 -1
- package/dist/utils/useFetch.d.ts +17 -0
- package/dist/utils/useRequiredContext.d.ts +0 -1
- package/dist/utils/useSetTimeout.d.ts +1 -0
- package/dist/utils/useStorageItem.d.ts +0 -1
- package/dist/utils/useStoredState.d.ts +0 -1
- package/package.json +19 -15
package/dist/alerts/Alerts.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { AlertVariant } from '@patternfly/react-core';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
|
|
4
3
|
export type AddAlertFunction = (message: string, variant?: AlertVariant, description?: string) => void;
|
|
5
|
-
export type AddErrorFunction = (
|
|
4
|
+
export type AddErrorFunction = (messageKey: string, error: unknown) => void;
|
|
6
5
|
export type AlertProps = {
|
|
7
6
|
addAlert: AddAlertFunction;
|
|
8
7
|
addError: AddErrorFunction;
|
|
9
8
|
};
|
|
10
|
-
export declare const AlertContext: import('react').Context<AlertProps | undefined>;
|
|
11
9
|
export declare const useAlerts: () => AlertProps;
|
|
12
|
-
export type
|
|
10
|
+
export type AlertEntry = {
|
|
13
11
|
id: number;
|
|
14
12
|
message: string;
|
|
15
13
|
variant: AlertVariant;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ButtonProps } from '@patternfly/react-core';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import { FieldValues, FormState } from 'react-hook-form';
|
|
4
|
-
|
|
5
4
|
export type FormSubmitButtonProps = Omit<ButtonProps, "isDisabled"> & {
|
|
6
5
|
formState: FormState<FieldValues>;
|
|
7
6
|
allowNonDirty?: boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { default as Keycloak } from 'keycloak-js';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import { BaseEnvironment } from './environment';
|
|
4
|
-
|
|
5
4
|
export type KeycloakContext<T extends BaseEnvironment = BaseEnvironment> = KeycloakContextProps<T> & {
|
|
6
5
|
keycloak: Keycloak;
|
|
7
6
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FormGroupProps } from '@patternfly/react-core';
|
|
2
2
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
import { FieldError, FieldValues, Merge } from 'react-hook-form';
|
|
4
|
-
|
|
5
4
|
export type FieldProps<T extends FieldValues = FieldValues> = {
|
|
6
5
|
label?: string;
|
|
7
6
|
name: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KeycloakSpinner: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as OrganizationRepresentation } from '@keycloak/keycloak-admin-client/lib/defs/organizationRepresentation';
|
|
2
|
+
import { FunctionComponent, PropsWithChildren, ReactNode } from 'react';
|
|
3
|
+
import { LoaderFunction } from './table/KeycloakDataTable';
|
|
4
|
+
type OrganizationTableProps = PropsWithChildren & {
|
|
5
|
+
loader: LoaderFunction<OrganizationRepresentation> | OrganizationRepresentation[];
|
|
6
|
+
link: FunctionComponent<PropsWithChildren<{
|
|
7
|
+
organization: OrganizationRepresentation;
|
|
8
|
+
}>>;
|
|
9
|
+
toolbarItem?: ReactNode;
|
|
10
|
+
isPaginated?: boolean;
|
|
11
|
+
onSelect?: (orgs: OrganizationRepresentation[]) => void;
|
|
12
|
+
onDelete?: (org: OrganizationRepresentation) => void;
|
|
13
|
+
deleteLabel?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const OrganizationTable: ({ loader, toolbarItem, isPaginated, onSelect, onDelete, deleteLabel, link, children, }: OrganizationTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FieldPath, FieldValues, UseControllerProps } from 'react-hook-form';
|
|
2
2
|
import { PasswordInputProps } from './PasswordInput';
|
|
3
|
-
|
|
4
3
|
export type PasswordControlProps<T extends FieldValues, P extends FieldPath<T> = FieldPath<T>> = UseControllerProps<T, P> & Omit<PasswordInputProps, "name" | "isRequired" | "required"> & {
|
|
5
4
|
label: string;
|
|
6
5
|
labelIcon?: string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { TextInputProps } from '@patternfly/react-core';
|
|
2
|
-
|
|
3
2
|
export type PasswordInputProps = TextInputProps & {
|
|
4
3
|
hasReveal?: boolean;
|
|
5
4
|
};
|
|
6
5
|
export declare const PasswordInput: import('react').ForwardRefExoticComponent<TextInputProps & {
|
|
7
|
-
hasReveal?: boolean
|
|
6
|
+
hasReveal?: boolean;
|
|
8
7
|
} & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FieldValues, FieldPath, UseControllerProps } from 'react-hook-form';
|
|
2
2
|
import { SwitchProps } from '@patternfly/react-core';
|
|
3
|
-
|
|
4
3
|
export type SwitchControlProps<T extends FieldValues, P extends FieldPath<T> = FieldPath<T>> = Omit<SwitchProps, "name" | "defaultValue" | "ref"> & UseControllerProps<T, P> & {
|
|
5
4
|
name: string;
|
|
6
5
|
label?: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TextAreaProps } from '@patternfly/react-core';
|
|
2
2
|
import { FieldPath, FieldValues, UseControllerProps } from 'react-hook-form';
|
|
3
|
-
|
|
4
3
|
export type TextAreaControlProps<T extends FieldValues, P extends FieldPath<T> = FieldPath<T>> = UseControllerProps<T, P> & TextAreaProps & {
|
|
5
4
|
label: string;
|
|
6
5
|
labelIcon?: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TextInputProps } from '@patternfly/react-core';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { FieldPath, FieldValues, UseControllerProps } from 'react-hook-form';
|
|
4
|
-
|
|
5
4
|
export type TextControlProps<T extends FieldValues, P extends FieldPath<T> = FieldPath<T>> = UseControllerProps<T, P> & Omit<TextInputProps, "name" | "isRequired" | "required"> & {
|
|
6
5
|
label: string;
|
|
7
6
|
labelIcon?: string | ReactNode;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TextArea } from '@patternfly/react-core';
|
|
2
2
|
import { ComponentProps, HTMLProps, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
3
|
-
|
|
4
3
|
export type KeycloakTextAreaProps = Omit<ComponentProps<typeof TextArea>, "onFocus" | "onBlur"> & Pick<HTMLProps<HTMLTextAreaElement>, "onFocus" | "onBlur">;
|
|
5
|
-
export declare const KeycloakTextArea: ForwardRefExoticComponent<
|
|
4
|
+
export declare const KeycloakTextArea: ForwardRefExoticComponent<KeycloakTextAreaProps & RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { FieldPath, FieldValues } from 'react-hook-form';
|
|
2
2
|
import { SelectControlProps } from './SelectControl';
|
|
3
|
-
|
|
4
3
|
export declare const SingleSelectControl: <T extends FieldValues, P extends FieldPath<T> = FieldPath<T>>({ id, name, label, options, controller, labelIcon, ...rest }: SelectControlProps<T, P>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { FieldPath, FieldValues } from 'react-hook-form';
|
|
2
2
|
import { SelectControlProps } from './SelectControl';
|
|
3
|
-
|
|
4
3
|
export declare const TypeaheadSelectControl: <T extends FieldValues, P extends FieldPath<T> = FieldPath<T>>({ id, name, label, options, controller, labelIcon, placeholderText, onFilter, variant, ...rest }: SelectControlProps<T, P>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { SVGIconProps } from '@patternfly/react-icons/dist/js/createIcon';
|
|
2
|
+
import { IAction, IActionsResolver, IFormatter, ITransform, TableProps } from '@patternfly/react-table';
|
|
3
|
+
import { ComponentClass, ReactNode, JSX } from 'react';
|
|
4
|
+
export type Field<T> = {
|
|
5
|
+
name: string;
|
|
6
|
+
displayKey?: string;
|
|
7
|
+
cellFormatters?: IFormatter[];
|
|
8
|
+
transforms?: ITransform[];
|
|
9
|
+
cellRenderer?: (row: T) => JSX.Element | string;
|
|
10
|
+
};
|
|
11
|
+
export type DetailField<T> = {
|
|
12
|
+
name: string;
|
|
13
|
+
enabled?: (row: T) => boolean;
|
|
14
|
+
cellRenderer?: (row: T) => JSX.Element | string;
|
|
15
|
+
};
|
|
16
|
+
export type Action<T> = IAction & {
|
|
17
|
+
onRowClick?: (row: T) => Promise<boolean | void> | void;
|
|
18
|
+
};
|
|
19
|
+
export type LoaderFunction<T> = (first?: number, max?: number, search?: string) => Promise<T[]>;
|
|
20
|
+
export type DataListProps<T> = Omit<TableProps, "rows" | "cells" | "onSelect"> & {
|
|
21
|
+
loader: T[] | LoaderFunction<T>;
|
|
22
|
+
onSelect?: (value: T[]) => void;
|
|
23
|
+
canSelectAll?: boolean;
|
|
24
|
+
detailColumns?: DetailField<T>[];
|
|
25
|
+
isRowDisabled?: (value: T) => boolean;
|
|
26
|
+
isPaginated?: boolean;
|
|
27
|
+
ariaLabelKey: string;
|
|
28
|
+
searchPlaceholderKey?: string;
|
|
29
|
+
columns: Field<T>[];
|
|
30
|
+
actions?: Action<T>[];
|
|
31
|
+
actionResolver?: IActionsResolver;
|
|
32
|
+
searchTypeComponent?: ReactNode;
|
|
33
|
+
toolbarItem?: ReactNode;
|
|
34
|
+
subToolbar?: ReactNode;
|
|
35
|
+
emptyState?: ReactNode;
|
|
36
|
+
icon?: ComponentClass<SVGIconProps>;
|
|
37
|
+
isNotCompact?: boolean;
|
|
38
|
+
isRadio?: boolean;
|
|
39
|
+
isSearching?: boolean;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* A generic component that can be used to show the initial list most sections have. Takes care of the loading of the date and filtering.
|
|
43
|
+
* All you have to define is how the columns are displayed.
|
|
44
|
+
* @example
|
|
45
|
+
* <KeycloakDataTable columns={[
|
|
46
|
+
* {
|
|
47
|
+
* name: "clientId", //name of the field from the array of object the loader returns to display in this column
|
|
48
|
+
* displayKey: "clientId", //i18n key to use to lookup the name of the column header
|
|
49
|
+
* cellRenderer: ClientDetailLink, //optionally you can use a component to render the column when you don't want just the content of the field, the whole row / entire object is passed in.
|
|
50
|
+
* }
|
|
51
|
+
* ]}
|
|
52
|
+
* @param {DataListProps} props - The properties.
|
|
53
|
+
* @param {string} props.ariaLabelKey - The aria label key i18n key to lookup the label
|
|
54
|
+
* @param {string} props.searchPlaceholderKey - The i18n key to lookup the placeholder for the search box
|
|
55
|
+
* @param {boolean} props.isPaginated - if true the the loader will be called with first, max and search and a pager will be added in the header
|
|
56
|
+
* @param {(first?: number, max?: number, search?: string) => Promise<T[]>} props.loader - loader function that will fetch the data to display first, max and search are only applicable when isPaginated = true
|
|
57
|
+
* @param {Field<T>} props.columns - definition of the columns
|
|
58
|
+
* @param {Field<T>} props.detailColumns - definition of the columns expandable columns
|
|
59
|
+
* @param {Action[]} props.actions - the actions that appear on the row
|
|
60
|
+
* @param {IActionsResolver} props.actionResolver Resolver for the given action
|
|
61
|
+
* @param {ReactNode} props.toolbarItem - Toolbar items that appear on the top of the table {@link toolbarItem}
|
|
62
|
+
* @param {ReactNode} props.emptyState - ReactNode show when the list is empty could be any component but best to use {@link ListEmptyState}
|
|
63
|
+
*/
|
|
64
|
+
export declare function KeycloakDataTable<T>({ ariaLabelKey, searchPlaceholderKey, isPaginated, onSelect, canSelectAll, isNotCompact, isRadio, detailColumns, isRowDisabled, loader, columns, actions, actionResolver, searchTypeComponent, toolbarItem, subToolbar, emptyState, icon, isSearching, ...props }: DataListProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentClass, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
import { ButtonVariant } from '@patternfly/react-core';
|
|
3
|
+
import { SVGIconProps } from '@patternfly/react-icons/dist/js/createIcon';
|
|
4
|
+
export type Action = {
|
|
5
|
+
text: string;
|
|
6
|
+
type?: ButtonVariant;
|
|
7
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
8
|
+
};
|
|
9
|
+
export type ListEmptyStateProps = {
|
|
10
|
+
message: string;
|
|
11
|
+
instructions: ReactNode;
|
|
12
|
+
primaryActionText?: string;
|
|
13
|
+
onPrimaryAction?: MouseEventHandler<HTMLButtonElement>;
|
|
14
|
+
hasIcon?: boolean;
|
|
15
|
+
icon?: ComponentClass<SVGIconProps>;
|
|
16
|
+
isSearchVariant?: boolean;
|
|
17
|
+
secondaryActions?: Action[];
|
|
18
|
+
isDisabled?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare const ListEmptyState: ({ message, instructions, onPrimaryAction, hasIcon, isSearchVariant, primaryActionText, secondaryActions, icon, isDisabled, }: ListEmptyStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
type KeycloakPaginationProps = {
|
|
3
|
+
id?: string;
|
|
4
|
+
count: number;
|
|
5
|
+
first: number;
|
|
6
|
+
max: number;
|
|
7
|
+
onNextClick: (page: number) => void;
|
|
8
|
+
onPreviousClick: (page: number) => void;
|
|
9
|
+
onPerPageSelect: (max: number, first: number) => void;
|
|
10
|
+
variant?: "top" | "bottom";
|
|
11
|
+
};
|
|
12
|
+
type TableToolbarProps = KeycloakPaginationProps & {
|
|
13
|
+
searchTypeComponent?: ReactNode;
|
|
14
|
+
toolbarItem?: ReactNode;
|
|
15
|
+
subToolbar?: ReactNode;
|
|
16
|
+
inputGroupName?: string;
|
|
17
|
+
inputGroupPlaceholder?: string;
|
|
18
|
+
inputGroupOnEnter?: (value: string) => void;
|
|
19
|
+
};
|
|
20
|
+
export declare const PaginatingTableToolbar: ({ count, searchTypeComponent, toolbarItem, subToolbar, children, inputGroupName, inputGroupPlaceholder, inputGroupOnEnter, ...rest }: PropsWithChildren<TableToolbarProps>) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
type TableToolbarProps = {
|
|
3
|
+
toolbarItem?: ReactNode;
|
|
4
|
+
subToolbar?: ReactNode;
|
|
5
|
+
toolbarItemFooter?: ReactNode;
|
|
6
|
+
searchTypeComponent?: ReactNode;
|
|
7
|
+
inputGroupName?: string;
|
|
8
|
+
inputGroupPlaceholder?: string;
|
|
9
|
+
inputGroupOnEnter?: (value: string) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const TableToolbar: ({ toolbarItem, subToolbar, toolbarItemFooter, children, searchTypeComponent, inputGroupName, inputGroupPlaceholder, inputGroupOnEnter, }: PropsWithChildren<TableToolbarProps>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|