@keycloak/keycloak-ui-shared 25.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.
Files changed (51) hide show
  1. package/LICENSE.txt +202 -0
  2. package/dist/alerts/Alerts.d.ts +18 -0
  3. package/dist/buttons/FormSubmitButton.d.ts +11 -0
  4. package/dist/context/ErrorPage.d.ts +5 -0
  5. package/dist/context/HelpContext.d.ts +10 -0
  6. package/dist/context/KeycloakContext.d.ts +13 -0
  7. package/dist/context/environment.d.ts +27 -0
  8. package/dist/continue-cancel/ContinueCancelModal.d.ts +16 -0
  9. package/dist/controls/FormErrorText.d.ts +6 -0
  10. package/dist/controls/FormLabel.d.ts +14 -0
  11. package/dist/controls/HelpItem.d.ts +10 -0
  12. package/dist/controls/NumberControl.d.ts +14 -0
  13. package/dist/controls/PasswordControl.d.ts +10 -0
  14. package/dist/controls/PasswordInput.d.ts +8 -0
  15. package/dist/controls/SwitchControl.d.ts +12 -0
  16. package/dist/controls/TextAreaControl.d.ts +9 -0
  17. package/dist/controls/TextControl.d.ts +11 -0
  18. package/dist/controls/keycloak-text-area/KeycloakTextArea.d.ts +5 -0
  19. package/dist/controls/select-control/SelectControl.d.ts +32 -0
  20. package/dist/controls/select-control/SingleSelectControl.d.ts +4 -0
  21. package/dist/controls/select-control/TypeaheadSelectControl.d.ts +4 -0
  22. package/dist/icons/IconMapper.d.ts +5 -0
  23. package/dist/keycloak-ui-shared.d.ts +1 -0
  24. package/dist/keycloak-ui-shared.js +1687 -0
  25. package/dist/main.css +1 -0
  26. package/dist/main.d.ts +31 -0
  27. package/dist/masthead/DefaultAvatar.d.ts +7 -0
  28. package/dist/masthead/KeycloakDropdown.d.ts +11 -0
  29. package/dist/masthead/Masthead.d.ts +23 -0
  30. package/dist/scroll-form/FormPanel.d.ts +9 -0
  31. package/dist/scroll-form/FormTitle.d.ts +9 -0
  32. package/dist/scroll-form/ScrollForm.d.ts +16 -0
  33. package/dist/scroll-form/ScrollPanel.d.ts +8 -0
  34. package/dist/select/KeycloakSelect.d.ts +31 -0
  35. package/dist/select/SingleSelect.d.ts +5 -0
  36. package/dist/select/TypeaheadSelect.d.ts +3 -0
  37. package/dist/user-profile/LocaleSelector.d.ts +8 -0
  38. package/dist/user-profile/MultiInputComponent.d.ts +16 -0
  39. package/dist/user-profile/OptionsComponent.d.ts +3 -0
  40. package/dist/user-profile/SelectComponent.d.ts +3 -0
  41. package/dist/user-profile/TextAreaComponent.d.ts +3 -0
  42. package/dist/user-profile/TextComponent.d.ts +3 -0
  43. package/dist/user-profile/UserProfileFields.d.ts +40 -0
  44. package/dist/user-profile/UserProfileGroup.d.ts +13 -0
  45. package/dist/user-profile/utils.d.ts +32 -0
  46. package/dist/utils/createNamedContext.d.ts +4 -0
  47. package/dist/utils/isDefined.d.ts +1 -0
  48. package/dist/utils/useRequiredContext.d.ts +10 -0
  49. package/dist/utils/useStorageItem.d.ts +11 -0
  50. package/dist/utils/useStoredState.d.ts +14 -0
  51. package/package.json +68 -0
package/dist/main.css ADDED
@@ -0,0 +1 @@
1
+ ._title_180i0_2{margin-bottom:var(--pf-v5-global--spacer--lg)}._panel_1cdve_1{margin-top:var(--pf-v5-global--spacer--lg)}._sticky_1cdve_5{position:sticky;top:0}
package/dist/main.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ export { AlertProvider, useAlerts } from './alerts/Alerts';
2
+ export { ErrorPage } from './context/ErrorPage';
3
+ export { Help, useHelp } from './context/HelpContext';
4
+ export { KeycloakProvider, useEnvironment, type KeycloakContext, } from './context/KeycloakContext';
5
+ export { getInjectedEnvironment, type BaseEnvironment, } from './context/environment';
6
+ export { ContinueCancelModal } from './continue-cancel/ContinueCancelModal';
7
+ export { FormErrorText, type FormErrorTextProps, } from './controls/FormErrorText';
8
+ export { HelpItem } from './controls/HelpItem';
9
+ export { NumberControl } from './controls/NumberControl';
10
+ export { PasswordControl } from './controls/PasswordControl';
11
+ export { PasswordInput } from './controls/PasswordInput';
12
+ export { SelectControl, SelectVariant, } from './controls/select-control/SelectControl';
13
+ export type { SelectControlOption, SelectControlProps, } from './controls/select-control/SelectControl';
14
+ export { SwitchControl, type SwitchControlProps, } from './controls/SwitchControl';
15
+ export { TextAreaControl } from './controls/TextAreaControl';
16
+ export { TextControl } from './controls/TextControl';
17
+ export { KeycloakTextArea, type KeycloakTextAreaProps, } from './controls/keycloak-text-area/KeycloakTextArea';
18
+ export { IconMapper } from './icons/IconMapper';
19
+ export { FormPanel } from './scroll-form/FormPanel';
20
+ export { ScrollForm, mainPageContentId } from './scroll-form/ScrollForm';
21
+ export { FormSubmitButton, type FormSubmitButtonProps, } from './buttons/FormSubmitButton';
22
+ export { UserProfileFields } from './user-profile/UserProfileFields';
23
+ export { beerify, debeerify, isUserProfileError, label, setUserProfileServerError, } from './user-profile/utils';
24
+ export type { UserFormFields } from './user-profile/utils';
25
+ export { createNamedContext } from './utils/createNamedContext';
26
+ export { isDefined } from './utils/isDefined';
27
+ export { useRequiredContext } from './utils/useRequiredContext';
28
+ export { useStoredState } from './utils/useStoredState';
29
+ export { default as KeycloakMasthead } from './masthead/Masthead';
30
+ export { KeycloakSelect } from './select/KeycloakSelect';
31
+ export type { Variant, KeycloakSelectProps } from './select/KeycloakSelect';
@@ -0,0 +1,7 @@
1
+ type DefaultAvatarProps = {
2
+ className?: string;
3
+ border?: "light" | "dark";
4
+ size?: "sm" | "md" | "lg" | "xl";
5
+ };
6
+ export declare const DefaultAvatar: ({ className, border, size, }: DefaultAvatarProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ import { DropdownProps } from '@patternfly/react-core';
2
+ import { ReactNode } from 'react';
3
+
4
+ type KeycloakDropdownProps = Omit<DropdownProps, "toggle"> & {
5
+ "data-testid"?: string;
6
+ isKebab?: boolean;
7
+ title?: ReactNode;
8
+ dropDownItems: ReactNode[];
9
+ };
10
+ export declare const KeycloakDropdown: ({ isKebab, title, dropDownItems, ...rest }: KeycloakDropdownProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,23 @@
1
+ import { AvatarProps, BrandProps } from '@patternfly/react-core';
2
+ import { PageHeaderProps } from '@patternfly/react-core/deprecated';
3
+ import { default as Keycloak } from 'keycloak-js';
4
+ import { ReactNode } from 'react';
5
+
6
+ type BrandLogo = BrandProps & {
7
+ href: string;
8
+ };
9
+ type KeycloakMastheadProps = PageHeaderProps & {
10
+ keycloak: Keycloak;
11
+ brand: BrandLogo;
12
+ avatar?: AvatarProps;
13
+ features?: {
14
+ hasLogout?: boolean;
15
+ hasManageAccount?: boolean;
16
+ hasUsername?: boolean;
17
+ };
18
+ kebabDropdownItems?: ReactNode[];
19
+ dropdownItems?: ReactNode[];
20
+ toolbarItems?: ReactNode[];
21
+ };
22
+ declare const KeycloakMasthead: ({ keycloak, brand: { href: brandHref, ...brandProps }, avatar, features: { hasLogout, hasManageAccount, hasUsername, }, kebabDropdownItems, dropdownItems, toolbarItems, ...rest }: KeycloakMastheadProps) => import("react/jsx-runtime").JSX.Element;
23
+ export default KeycloakMasthead;
@@ -0,0 +1,9 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ type FormPanelProps = {
4
+ title: string;
5
+ scrollId?: string;
6
+ className?: string;
7
+ };
8
+ export declare const FormPanel: ({ title, children, scrollId, className, }: PropsWithChildren<FormPanelProps>) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { TitleProps } from '@patternfly/react-core';
2
+
3
+ type FormTitleProps = Omit<TitleProps, "headingLevel"> & {
4
+ id?: string;
5
+ title: string;
6
+ headingLevel?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
7
+ };
8
+ export declare const FormTitle: ({ id, title, headingLevel, size, ...rest }: FormTitleProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,16 @@
1
+ import { GridProps } from '@patternfly/react-core';
2
+ import { ReactNode } from 'react';
3
+
4
+ export declare const mainPageContentId = "kc-main-content-page-container";
5
+ type ScrollSection = {
6
+ title: string;
7
+ panel: ReactNode;
8
+ isHidden?: boolean;
9
+ };
10
+ type ScrollFormProps = GridProps & {
11
+ label: string;
12
+ sections: ScrollSection[];
13
+ borders?: boolean;
14
+ };
15
+ export declare const ScrollForm: ({ label, sections, borders, ...rest }: ScrollFormProps) => import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,8 @@
1
+ import { HTMLProps } from 'react';
2
+
3
+ type ScrollPanelProps = HTMLProps<HTMLFormElement> & {
4
+ title: string;
5
+ scrollId: string;
6
+ };
7
+ export declare const ScrollPanel: (props: ScrollPanelProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,31 @@
1
+ import { ChipGroupProps, SelectProps } from '@patternfly/react-core';
2
+
3
+ export type Variant = `${SelectVariant}`;
4
+ export declare enum SelectVariant {
5
+ single = "single",
6
+ typeahead = "typeahead",
7
+ typeaheadMulti = "typeaheadMulti"
8
+ }
9
+ export declare const propertyToString: (prop: string | number | undefined) => string | undefined;
10
+ export type KeycloakSelectProps = Omit<SelectProps, "name" | "toggle" | "selected" | "onClick" | "onSelect"> & {
11
+ toggleId?: string;
12
+ onFilter?: (value: string) => JSX.Element[];
13
+ onClear?: () => void;
14
+ variant?: Variant;
15
+ isDisabled?: boolean;
16
+ menuAppendTo?: string;
17
+ maxHeight?: string | number;
18
+ width?: string | number;
19
+ toggleIcon?: React.ReactElement;
20
+ direction?: "up" | "down";
21
+ placeholderText?: string;
22
+ onSelect?: (value: string | number | object) => void;
23
+ onToggle: (val: boolean) => void;
24
+ selections?: string | string[] | number | number[];
25
+ validated?: "success" | "warning" | "error" | "default";
26
+ typeAheadAriaLabel?: string;
27
+ chipGroupProps?: Omit<ChipGroupProps, "children" | "ref">;
28
+ chipGroupComponent?: React.ReactNode;
29
+ footer?: React.ReactNode;
30
+ };
31
+ export declare const KeycloakSelect: ({ variant, ...rest }: KeycloakSelectProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { KeycloakSelectProps } from './KeycloakSelect';
2
+
3
+ type SingleSelectProps = Omit<KeycloakSelectProps, "variant">;
4
+ export declare const SingleSelect: ({ toggleId, onToggle, onSelect, selections, isOpen, menuAppendTo, direction, width, maxHeight, toggleIcon, className, children, ...props }: SingleSelectProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,3 @@
1
+ import { KeycloakSelectProps } from './KeycloakSelect';
2
+
3
+ export declare const TypeaheadSelect: ({ toggleId, onSelect, onToggle, onFilter, variant, validated, placeholderText, maxHeight, width, toggleIcon, direction, selections, typeAheadAriaLabel, chipGroupComponent, chipGroupProps, footer, children, ...rest }: KeycloakSelectProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { UserProfileFieldProps } from './UserProfileFields';
2
+
3
+ type LocaleSelectorProps = Omit<UserProfileFieldProps, "inputType"> & {
4
+ supportedLocales: string[];
5
+ currentLocale: string;
6
+ };
7
+ export declare const LocaleSelector: ({ t, form, supportedLocales, currentLocale, }: LocaleSelectorProps) => import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,16 @@
1
+ import { TextInputProps } from '@patternfly/react-core';
2
+ import { TFunction } from 'i18next';
3
+ import { FieldPath, UseFormReturn } from 'react-hook-form';
4
+ import { InputType, UserProfileFieldProps } from './UserProfileFields';
5
+ import { UserFormFields } from './utils';
6
+
7
+ export declare const MultiInputComponent: ({ t, form, attribute, renderer, ...rest }: UserProfileFieldProps) => import("react/jsx-runtime").JSX.Element;
8
+ export type MultiLineInputProps = Omit<TextInputProps, "form"> & {
9
+ t: TFunction;
10
+ name: FieldPath<UserFormFields>;
11
+ form: UseFormReturn<UserFormFields>;
12
+ addButtonLabel?: string;
13
+ isDisabled?: boolean;
14
+ defaultValue?: string[];
15
+ inputType: InputType;
16
+ };
@@ -0,0 +1,3 @@
1
+ import { UserProfileFieldProps } from './UserProfileFields';
2
+
3
+ export declare const OptionComponent: (props: UserProfileFieldProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { UserProfileFieldProps } from './UserProfileFields';
2
+
3
+ export declare const SelectComponent: (props: UserProfileFieldProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { UserProfileFieldProps } from './UserProfileFields';
2
+
3
+ export declare const TextAreaComponent: (props: UserProfileFieldProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { UserProfileFieldProps } from './UserProfileFields';
2
+
3
+ export declare const TextComponent: (props: UserProfileFieldProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { UserProfileAttributeMetadata, UserProfileMetadata } from '@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata';
2
+ import { TFunction } from 'i18next';
3
+ import { ReactNode } from 'react';
4
+ import { UseFormReturn } from 'react-hook-form';
5
+ import { UserFormFields } from './utils';
6
+
7
+ export type UserProfileError = {
8
+ responseData: {
9
+ errors?: {
10
+ errorMessage: string;
11
+ }[];
12
+ };
13
+ };
14
+ export type Options = {
15
+ options?: string[];
16
+ };
17
+ declare const INPUT_TYPES: readonly ["text", "textarea", "select", "select-radiobuttons", "multiselect", "multiselect-checkboxes", "html5-email", "html5-tel", "html5-url", "html5-number", "html5-range", "html5-datetime-local", "html5-date", "html5-month", "html5-time", "multi-input"];
18
+ export type InputType = (typeof INPUT_TYPES)[number];
19
+ export type UserProfileFieldProps = {
20
+ t: TFunction;
21
+ form: UseFormReturn<UserFormFields>;
22
+ inputType: InputType;
23
+ attribute: UserProfileAttributeMetadata;
24
+ renderer?: (attribute: UserProfileAttributeMetadata) => ReactNode;
25
+ };
26
+ export type OptionLabel = Record<string, string> | undefined;
27
+ export declare const FIELDS: {
28
+ [type in InputType]: (props: UserProfileFieldProps) => JSX.Element;
29
+ };
30
+ export type UserProfileFieldsProps = {
31
+ t: TFunction;
32
+ form: UseFormReturn<UserFormFields>;
33
+ userProfileMetadata: UserProfileMetadata;
34
+ supportedLocales: string[];
35
+ currentLocale: string;
36
+ hideReadOnly?: boolean;
37
+ renderer?: (attribute: UserProfileAttributeMetadata) => JSX.Element | undefined;
38
+ };
39
+ export declare const UserProfileFields: ({ t, form, userProfileMetadata, supportedLocales, currentLocale, hideReadOnly, renderer, }: UserProfileFieldsProps) => import("react/jsx-runtime").JSX.Element | null;
40
+ export {};
@@ -0,0 +1,13 @@
1
+ import { UserProfileAttributeMetadata } from '@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata';
2
+ import { TFunction } from 'i18next';
3
+ import { PropsWithChildren, ReactNode } from 'react';
4
+ import { UseFormReturn } from 'react-hook-form';
5
+ import { UserFormFields } from './utils';
6
+
7
+ export type UserProfileGroupProps = {
8
+ t: TFunction;
9
+ form: UseFormReturn<UserFormFields>;
10
+ attribute: UserProfileAttributeMetadata;
11
+ renderer?: (attribute: UserProfileAttributeMetadata) => ReactNode;
12
+ };
13
+ export declare const UserProfileGroup: ({ t, form, attribute, renderer, children, }: PropsWithChildren<UserProfileGroupProps>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { UserProfileAttributeMetadata } from '@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata';
2
+ import { default as UserRepresentation } from '@keycloak/keycloak-admin-client/lib/defs/userRepresentation';
3
+ import { TFunction } from 'i18next';
4
+
5
+ export type KeyValueType = {
6
+ key: string;
7
+ value: string;
8
+ };
9
+ export type UserFormFields = Omit<UserRepresentation, "attributes" | "userProfileMetadata"> & {
10
+ attributes?: KeyValueType[] | Record<string, string | string[]>;
11
+ };
12
+ type FieldError = {
13
+ field: string;
14
+ errorMessage: string;
15
+ params?: string[];
16
+ };
17
+ type ErrorArray = {
18
+ errors?: FieldError[];
19
+ };
20
+ export type UserProfileError = {
21
+ responseData: ErrorArray | FieldError;
22
+ };
23
+ export declare const label: (t: TFunction, text: string | undefined, fallback?: string) => string | undefined;
24
+ export declare const labelAttribute: (t: TFunction, attribute: UserProfileAttributeMetadata) => string | undefined;
25
+ export declare const isRootAttribute: (attr?: string) => boolean | "" | undefined;
26
+ export declare const fieldName: (name?: string) => "id" | "enabled" | "email" | "attributes" | "createdTimestamp" | "username" | "totp" | "emailVerified" | "disableableCredentialTypes" | "requiredActions" | "notBefore" | "access" | "clientConsents" | "clientRoles" | "credentials" | "federatedIdentities" | "federationLink" | "firstName" | "groups" | "lastName" | "origin" | "realmRoles" | "self" | "serviceAccountClientId" | `attributes.${string}` | `attributes.${number}` | `attributes.${number}.value` | `attributes.${number}.key` | `disableableCredentialTypes.${number}` | `requiredActions.${number}` | `access.${string}` | `clientConsents.${number}` | `clientConsents.${number}.clientId` | `clientConsents.${number}.createDate` | `clientConsents.${number}.grantedClientScopes` | `clientConsents.${number}.lastUpdatedDate` | `clientConsents.${number}.grantedClientScopes.${number}` | `clientRoles.${string}` | `credentials.${number}` | `credentials.${number}.value` | `credentials.${number}.type` | `credentials.${number}.id` | `credentials.${number}.createdDate` | `credentials.${number}.credentialData` | `credentials.${number}.priority` | `credentials.${number}.secretData` | `credentials.${number}.temporary` | `credentials.${number}.userLabel` | `federatedIdentities.${number}` | `federatedIdentities.${number}.identityProvider` | `federatedIdentities.${number}.userId` | `federatedIdentities.${number}.userName` | `groups.${number}` | `realmRoles.${number}`;
27
+ export declare const beerify: <T extends string>(name: T) => string;
28
+ export declare const debeerify: <T extends string>(name: T) => string;
29
+ export declare function setUserProfileServerError<T>(error: UserProfileError, setError: (field: keyof T, params: object) => void, t: TFunction): void;
30
+ export declare function isRequiredAttribute({ required, validators, }: UserProfileAttributeMetadata): boolean;
31
+ export declare function isUserProfileError(error: unknown): error is UserProfileError;
32
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Context } from 'react';
2
+
3
+ export type NamedContext<T> = Context<T> & Required<Pick<Context<T>, "displayName">>;
4
+ export declare function createNamedContext<T>(displayName: string, defaultValue: T): NamedContext<T>;
@@ -0,0 +1 @@
1
+ export declare function isDefined<T>(value: T): value is NonNullable<T>;
@@ -0,0 +1,10 @@
1
+ import { Context } from 'react';
2
+
3
+ /**
4
+ * Passes the call to `useContext` and throw an exception if the resolved value is either `null` or `undefined`.
5
+ * Can be used for contexts that are required and should always have a non nullable value.
6
+ *
7
+ * @param context The context to pass to `useContext`
8
+ * @returns
9
+ */
10
+ export declare function useRequiredContext<T>(context: Context<T>): NonNullable<T>;
@@ -0,0 +1,11 @@
1
+ import { Dispatch } from 'react';
2
+
3
+ /**
4
+ * A hook that allows you to get a specific item stored by the [Web Storage API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API).
5
+ * Automatically updates the value when modified in the context of another document (such as an open tab) trough the [`storage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event) event.
6
+ *
7
+ * @param storageArea The storage area to target, must implement the [`Storage`](https://developer.mozilla.org/en-US/docs/Web/API/Storage) interface (such as [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)).
8
+ * @param keyName The key of the item to get from storage, same as passed to [`Storage.getItem()`](https://developer.mozilla.org/en-US/docs/Web/API/Storage/getItem)
9
+ * @param The default value to fall back to in case no stored value was retrieved.
10
+ */
11
+ export declare function useStorageItem(storageArea: Storage, keyName: string, defaultValue: string): [string, Dispatch<string>];
@@ -0,0 +1,14 @@
1
+ import { Dispatch } from 'react';
2
+
3
+ /**
4
+ * A hook that acts similarly to React's `useState()`, but persists the state using [Web Storage API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API).
5
+ * Automatically updates the value when modified in the context of another document (such as an open tab) trough the [`storage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event) event.
6
+ *
7
+ * The value is serialized as [JSON](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON) and therefore the value provided must be serializable as such.
8
+ * Because the value is always serialized it will never be referentially equal to originally provided value.
9
+ *
10
+ * @param storageArea The storage area to target, must implement the [`Storage`](https://developer.mozilla.org/en-US/docs/Web/API/Storage) interface (such as [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)).
11
+ * @param keyName The key of the item to get from storage, same as passed to [`Storage.getItem()`](https://developer.mozilla.org/en-US/docs/Web/API/Storage/getItem)
12
+ * @param defaultValue The default value to fall back to in case no stored value was retrieved (must be serializable as JSON).
13
+ */
14
+ export declare function useStoredState<S>(storageArea: Storage, keyName: string, defaultValue: S): [S, Dispatch<S>];
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@keycloak/keycloak-ui-shared",
3
+ "version": "25.0.0",
4
+ "type": "module",
5
+ "main": "./dist/keycloak-ui-shared.js",
6
+ "types": "./dist/keycloak-ui-shared.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/keycloak-ui-shared.js",
10
+ "types": "./dist/keycloak-ui-shared.d.ts"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "wireit": {
17
+ "build": {
18
+ "command": "vite build",
19
+ "dependencies": [
20
+ "../keycloak-admin-client:build"
21
+ ],
22
+ "files": [
23
+ "src/**",
24
+ "package.json",
25
+ "tsconfig.json",
26
+ "vite.config.ts"
27
+ ],
28
+ "output": [
29
+ "dist/**"
30
+ ]
31
+ },
32
+ "lint": {
33
+ "command": "eslint .",
34
+ "dependencies": [
35
+ "../keycloak-admin-client:build"
36
+ ]
37
+ }
38
+ },
39
+ "dependencies": {
40
+ "@patternfly/react-core": "^5.3.3",
41
+ "@patternfly/react-icons": "^5.3.2",
42
+ "@patternfly/react-styles": "^5.3.1",
43
+ "i18next": "^23.11.5",
44
+ "lodash-es": "^4.17.21",
45
+ "react": "^18.3.1",
46
+ "react-dom": "^18.3.1",
47
+ "react-hook-form": "7.51.5",
48
+ "react-i18next": "^14.1.2",
49
+ "@keycloak/keycloak-admin-client": "25.0.0",
50
+ "keycloak-js": "25.0.0"
51
+ },
52
+ "devDependencies": {
53
+ "@types/lodash-es": "^4.17.12",
54
+ "@types/react": "^18.3.3",
55
+ "@types/react-dom": "^18.3.0",
56
+ "@vitejs/plugin-react-swc": "^3.7.0",
57
+ "rollup-plugin-peer-deps-external": "^2.2.4",
58
+ "vite": "^5.2.12",
59
+ "vite-plugin-checker": "^0.6.4",
60
+ "vite-plugin-dts": "^3.9.1",
61
+ "vite-plugin-lib-inject-css": "^2.1.1",
62
+ "vitest": "^1.6.0"
63
+ },
64
+ "scripts": {
65
+ "build": "wireit",
66
+ "lint": "wireit"
67
+ }
68
+ }