@pontive/pontkit-react 1.5.2 → 1.7.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.
@@ -0,0 +1,68 @@
1
+ import { default as React } from 'react';
2
+ import { PontProviderElement, ProviderElementEvents } from './elements.generated';
3
+ import { AuthState, ProviderInputProps, ProviderSdk, SessionChange } from './types';
4
+ /**
5
+ * `<Provider>`: `<pont-provider>` for React.
6
+ *
7
+ * What the element can't do for itself is get the SDK: core never imports the
8
+ * auth client, it is injected (`provider.sdk = Auth`, pontkit-core
9
+ * docs/kit/provider.md). This injects it, and turns the element's
10
+ * `pont-auth-changed` / `pont-session-changed` into React context.
11
+ *
12
+ * **Which `Auth`.** `@pontive/oidc-client`'s, a dependency of this package, so
13
+ * the app bundles exactly one copy (shared with the app's own, when it imports
14
+ * the same package). An app with another client passes `sdk` instead. `Auth`
15
+ * is a singleton whose constructor touches nothing, so importing it on a
16
+ * server is safe; the element only calls it in the browser.
17
+ */
18
+ export interface ProviderProps extends ProviderInputProps, ProviderElementEvents {
19
+ children?: React.ReactNode;
20
+ /** The auth SDK. Default: `Auth` from `@pontive/oidc-client`. */
21
+ sdk?: ProviderSdk;
22
+ }
23
+ export declare const Provider: React.ForwardRefExoticComponent<ProviderProps & React.RefAttributes<PontProviderElement>>;
24
+ /**
25
+ * The session as the nearest `<Provider>` knows it. `resolved` is false until
26
+ * `restoreSession()` has come back; act on nothing before it.
27
+ */
28
+ export declare function useAuthState(): AuthState;
29
+ /**
30
+ * The last session change (`reason`: `signed-in`, `restored`, `refreshed`,
31
+ * `organization-changed`, `signed-out`, `expired`), here or in another tab.
32
+ * Null before the first. Use it to reload what depends on the organization.
33
+ */
34
+ export declare function useSession(): SessionChange | null;
35
+ /**
36
+ * The SDK the provider injected, for the calls the widgets don't make
37
+ * (`signOut()`, `getManagementToken()` …).
38
+ */
39
+ export declare function useSdk(): ProviderSdk;
40
+ export interface ControlProps {
41
+ children?: React.ReactNode;
42
+ /** Rendered until the session is known (default: nothing). */
43
+ fallback?: React.ReactNode | null;
44
+ }
45
+ /**
46
+ * Children for a signed-in user. A React component rather than a wrapper over
47
+ * `<pont-signed-in>`, which detaches its children: nodes React must keep
48
+ * owning (provider.md: framework hosts branch on `pont-auth-changed`).
49
+ */
50
+ export declare function SignedIn({ children, fallback }: ControlProps): React.ReactNode;
51
+ /** Children for everyone else, once the session is known. */
52
+ export declare function SignedOut({ children, fallback }: ControlProps): React.ReactNode;
53
+ /** Children once the session is known; `fallback` until then. */
54
+ export declare function AuthResolved({ children, fallback }: ControlProps): React.ReactNode;
55
+ export interface AuthenticatedProps {
56
+ children?: React.ReactNode;
57
+ /** Rendered while the session is being resolved. */
58
+ loading?: React.ReactNode;
59
+ /** Where to send a signed-out visitor. Default: the provider's `signinUrl`. */
60
+ redirectUrl?: string;
61
+ /** Navigate with the app's router (`router.push`) instead of a page load. */
62
+ onRedirect?: (url: string) => void;
63
+ }
64
+ /**
65
+ * Children for a signed-in user; everyone else is sent to the sign-in page,
66
+ * once the session has resolved (never on the interim "signed out").
67
+ */
68
+ export declare function Authenticated({ children, loading, redirectUrl, onRedirect, }: AuthenticatedProps): React.ReactNode;
package/dist/types.d.ts CHANGED
@@ -1,125 +1,117 @@
1
1
  import { ReactNode } from 'react';
2
- import { IProfileContentCustomizations, IProfileWidgetCustomization, MEMBER_MANAGEMENT_MODE, MenuItem, USER_PROFILE_MODE, USER_PROFILE_ORIENTATION, USER_PROFILE_SIDEBAR_DISPLAY_TYPE, USER_PROFILE_WIDGETS_LAYOUT } from './enums';
3
- import { EnvConfig } from '@pontive/pontkit-core';
4
- type WithChildren = {
5
- children?: ReactNode;
2
+ import { AccountClient, AccountMenuItem, AccountSettingsContent, AccountSettingsLayout, AccountSettingsMode, AccountSettingsOrientation, AppSdkConfig, BrandingEntitlements, MemberManagementMode, ProviderSdk, SessionChange, WidgetClient } from '@pontive/pontkit-core';
3
+ export type { AccountClient, AccountMenuItem, AuthState, ProviderSdk, SessionChange, WidgetClient, } from '@pontive/pontkit-core';
4
+ /**
5
+ * Events core declares on `HTMLElementEventMap` are typed from there; this
6
+ * covers the ones it fires without declaring.
7
+ */
8
+ interface UndeclaredEvents {
9
+ "pont-session-changed": CustomEvent<SessionChange>;
10
+ }
11
+ /** The event a generated `on…` callback receives: the DOM event itself. */
12
+ export type PontEvent<K extends string> = K extends keyof HTMLElementEventMap ? HTMLElementEventMap[K] : K extends keyof UndeclaredEvents ? UndeclaredEvents[K] : CustomEvent<unknown>;
13
+ /** The inputs of `<pont-provider>` (pontkit-core docs/kit/provider.md). */
14
+ export interface ProviderInputProps {
15
+ /** Required. */
16
+ appId: string;
17
+ /** Required: a hostname, a `/path` on this origin (the auth proxy, `/__pontive`), or a base URL. */
18
+ domain: string;
19
+ /** BCP-47 tags in preference order; empty lets the server negotiate. */
20
+ locales?: string;
21
+ signinUrl?: string;
22
+ signupUrl?: string;
23
+ invitationUrl?: string;
24
+ /** Where a signed-in user is sent from the sign-in, sign-up and invitation pages. */
25
+ signinRedirectUrl?: string;
26
+ /** "Continue here instead" (default: `signinRedirectUrl`). */
27
+ continueHereUrl?: string;
28
+ /** The OAuth scopes every flow asks for. Member management needs `pontive:org:member:*`. */
29
+ scope?: string | string[];
30
+ /** The organization a sign-in starts in. */
31
+ organizationId?: string;
6
32
  /**
7
- * Placeholder rendered inside the element until it has something real to
8
- * show, at which point the element removes it.
9
- *
10
- * `fallbackChildren` used to sit alongside this, asking for the children to
11
- * stand in as the placeholder while the CDN loaded. Widgets no longer wait on
12
- * the CDN to render — the tag goes out with the server response and upgrades
13
- * in place — so children are already on the page throughout that window and
14
- * the flag had nothing left to switch on.
33
+ * The management gateway the default account client calls
34
+ * (`https://api.us.pontive.com`). Absolute http(s) only: the auth proxy does
35
+ * not forward `/me` or `/mgmt/v1`.
15
36
  */
16
- fallback?: ReactNode | null;
17
- };
18
- type WithRenderSpec = {
19
- renderSpec?: string | null;
20
- };
21
- type WidgetLayout = "ROW" | "COLUMN" | typeof USER_PROFILE_WIDGETS_LAYOUT.ROW | typeof USER_PROFILE_WIDGETS_LAYOUT.COLUMN;
22
- type CommonWidgetProps = WithChildren & {
23
- showIcons?: boolean;
24
- Layout?: WidgetLayout;
25
- content?: IProfileWidgetCustomization | null;
26
- };
27
- export interface ProviderProps {
28
- children?: ReactNode;
37
+ apiBaseUrl?: string;
38
+ /** The identifier to pre-fill (default: the URL's `login_hint`). */
39
+ loginHint?: string;
40
+ /** Default on. `false` keeps a signed-in user on the auth pages. */
29
41
  autoRedirect?: boolean;
30
- env: EnvConfig;
31
- locale?: string;
32
- }
33
- export interface LayoutProps extends WithChildren, WithRenderSpec {
34
- }
35
- export interface PreviewProps extends WithChildren, WithRenderSpec {
36
- }
37
- export interface SignInProps extends WithChildren {
38
- }
39
- export interface SignUpProps extends WithChildren {
40
- }
41
- export interface AccountMenuProps extends WithChildren {
42
- accountSettingsPath?: string;
43
- menuItems?: MenuItem[];
42
+ /** `"none"` opts out of linking the published theme. */
43
+ theme?: string;
44
+ /** Extra request headers for the SDK and the default account client. */
45
+ headers?: Record<string, string>;
46
+ /** The app's own account client; wins over the default one. */
47
+ accountClient?: AccountClient;
48
+ /**
49
+ * The app's own SDK options and callbacks (`onFlowStateChange`,
50
+ * `onAuthenticated` …). The provider chains them after its own; don't call
51
+ * `Auth.configure()` yourself.
52
+ */
53
+ config?: AppSdkConfig;
44
54
  }
45
- /** What a switch reports: the organization and what the user holds there. */
46
- export interface OrganizationChangedDetail {
47
- organizationId: string;
48
- roles: string[];
49
- permissions: string[];
55
+ /** The raw `<pont-provider>` wrapper's props: the inputs plus the SDK. */
56
+ export interface ProviderElementProps extends ProviderInputProps {
57
+ children?: ReactNode;
58
+ sdk?: ProviderSdk;
50
59
  }
51
- /**
52
- * Props for `<OrganizationSwitcher>`, a menu of the organizations the signed-in
53
- * user belongs to. Choosing one moves the session there (new tokens, no
54
- * sign-in). Renders nothing for a signed-out user or one with no organizations.
55
- */
56
- export interface OrganizationSwitcherProps extends WithChildren {
57
- /** Reload the page after a switch — for server-rendered pages. */
60
+ /** `pont-signin`, `pont-signup`, `pont-invitation`. */
61
+ export interface FlowWidgetProps {
62
+ /**
63
+ * Shown until the first screen renders, then removed by the widget.
64
+ */
65
+ fallback?: ReactNode | null;
66
+ /** The widget's own client. Inside a `Provider` it uses the provider's. */
67
+ client?: WidgetClient;
68
+ /** Its own branding entitlements. Inside a `Provider` it uses the provider's. */
69
+ branding?: BrandingEntitlements;
70
+ /** Default `sys_signin-flow-passkey` / `sys_signup-flow`; none for the invitation. */
71
+ flowId?: string;
72
+ }
73
+ /** `pont-consent` (the OAuth consent page). */
74
+ export interface ConsentProps {
75
+ /** The page's `consent_request` parameter. */
76
+ consentRequest: string;
77
+ /** Where auth-api is (default: this origin, which the session cookie needs). */
78
+ baseUrl?: string;
79
+ locales?: string;
80
+ branding?: BrandingEntitlements;
81
+ }
82
+ /** What every account widget takes. */
83
+ interface AccountWidgetProps {
84
+ /** Its own account client. Inside a `Provider` it uses the provider's. */
85
+ client?: AccountClient;
86
+ }
87
+ export interface AccountMenuProps extends AccountWidgetProps {
88
+ /** Where "Account settings" goes when `onAccountSettings` doesn't cancel. */
89
+ accountSettingsUrl?: string;
90
+ /** Entries between "Account settings" and "Log out". */
91
+ items?: AccountMenuItem[];
92
+ }
93
+ export interface OrganizationSwitcherProps extends AccountWidgetProps {
94
+ /** Reload the page after a switch (for server-rendered pages). */
58
95
  reloadOnSwitch?: boolean;
59
- /** Trigger label while the session acts in no organization. */
96
+ /** The button's text while the session acts in no organization. */
60
97
  emptyLabel?: string;
61
- /** Called after a switch; refetch whatever depends on the organization. */
62
- onOrganizationChanged?: (detail: OrganizationChangedDetail) => void;
63
- /** Called when a switch is refused; the session is unchanged. */
64
- onSwitchFailed?: (detail: {
65
- organizationId: string;
66
- error: unknown;
67
- }) => void;
68
98
  }
69
- export interface AccountSettingsProps extends WithChildren {
70
- showAvatarMenu?: boolean;
71
- orientation?: "VERTICAL" | "HORIZONTAL" | typeof USER_PROFILE_ORIENTATION.HORIZONTAL | typeof USER_PROFILE_ORIENTATION.VERTICAL;
72
- mobileDisplay?: "REGULAR" | "BURGER" | typeof USER_PROFILE_SIDEBAR_DISPLAY_TYPE.REGULAR | typeof USER_PROFILE_SIDEBAR_DISPLAY_TYPE.BURGER;
73
- mode?: "PAGE" | "MODAL" | typeof USER_PROFILE_MODE.PAGE | typeof USER_PROFILE_MODE.MODAL;
74
- widgetsLayout?: WidgetLayout;
75
- content?: IProfileContentCustomizations | null;
76
- }
77
- export interface MemberManagementProps extends WithChildren {
78
- mode?: "PAGE" | "MODAL" | typeof MEMBER_MANAGEMENT_MODE.PAGE | typeof MEMBER_MANAGEMENT_MODE.MODAL;
79
- title?: string;
99
+ export interface AccountSettingsProps extends AccountWidgetProps {
100
+ mode?: AccountSettingsMode;
101
+ orientation?: AccountSettingsOrientation;
102
+ widgetsLayout?: AccountSettingsLayout;
103
+ /** Modal mode: whether the dialog is open. */
104
+ open?: boolean;
105
+ content?: AccountSettingsContent | null;
106
+ }
107
+ export interface MemberManagementProps extends AccountWidgetProps {
108
+ /** The organization to manage (default: the session's). */
109
+ organizationId?: string;
110
+ mode?: MemberManagementMode;
111
+ /** Modal mode: whether the dialog is open. */
112
+ open?: boolean;
113
+ heading?: string;
80
114
  description?: string;
81
- organizationId: string;
82
- }
83
- export interface AccountInfoProps extends WithChildren {
84
- account?: AccountInfo;
85
- showAvatarMenu?: boolean;
86
- toggleAvatarMenu: (e: Event) => void;
87
- onAvatarChange: () => void;
88
- onAvatarRemove: () => void;
89
- showIcons?: boolean;
90
- content?: IProfileWidgetCustomization | null;
91
- otpVariant?: "simple" | "with_spacing" | "with_separator" | "digits_only";
92
- otpLength?: number;
93
- Layout?: WidgetLayout;
94
- }
95
- export interface LocationInfoProps extends CommonWidgetProps {
96
- locationInfo?: LocationInfo;
97
- }
98
- export interface UrlsInfoProps extends CommonWidgetProps {
99
- URLsInfo?: URLsInfo;
100
- }
101
- export interface PersonalInfoProps extends CommonWidgetProps {
102
- personal?: PersonalInfo;
103
- }
104
- export interface PersonalInfo {
105
- username: string;
106
- first: string;
107
- middle: string;
108
- last: string;
109
- nickname: string;
110
- gender: string;
111
- bio: string;
112
- }
113
- export interface URLsInfo {
114
- website: string;
115
- }
116
- export interface LocationInfo {
117
- location: string;
118
- zoneInfo: string;
119
- }
120
- export interface AccountInfo {
121
- email: string;
122
- phone: string;
123
- avatar: string;
115
+ /** 5, 10 or 25. */
116
+ pageSize?: number;
124
117
  }
125
- export {};
package/dist/wrap.d.ts CHANGED
@@ -1,8 +1,22 @@
1
1
  import { default as React } from 'react';
2
- import { ProviderProps as ReactProviderProps } from './types';
3
- export declare function wrap<T extends HTMLElement, P = {}>(tagName: string): React.ForwardRefExoticComponent<React.PropsWithoutRef<P & React.RefAttributes<T> & (P extends ReactProviderProps ? {
4
- children?: React.ReactNode;
5
- } : {
6
- children?: React.ReactNode;
7
- fallback?: React.ReactNode | null;
8
- })> & React.RefAttributes<T>>;
2
+ /**
3
+ * What a wrapper says about its element (generated, see tools/gen-wrappers).
4
+ */
5
+ export interface WrapOptions {
6
+ /**
7
+ * Callback prop -> DOM event. The elements report through events, so these
8
+ * props are listened for instead of assigned, and the callback gets the
9
+ * event itself (a cancelable one can be `preventDefault()`ed).
10
+ */
11
+ events?: Readonly<Record<string, string>>;
12
+ /** Whether the element honours the `[part="fallback"]` contract. */
13
+ fallback?: boolean;
14
+ /** Starts the CDN load on mount. */
15
+ provider?: boolean;
16
+ }
17
+ /**
18
+ * A React component over the custom element `tagName`, typed by `P` alone:
19
+ * children and `fallback` are whatever its props type says, because only the
20
+ * provider takes children and only the flow widgets honour a fallback.
21
+ */
22
+ export declare function wrap<T extends HTMLElement, P = {}>(tagName: string, options?: WrapOptions): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@pontive/pontkit-react",
3
- "version": "1.5.2",
3
+ "version": "1.7.0",
4
4
  "license": "MIT",
5
- "description": "React components over the pont-* custom elements.",
5
+ "description": "React components over the PontKit (pont-*) custom elements.",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.js",
@@ -31,11 +31,11 @@
31
31
  "react-dom": "^18 || ^19"
32
32
  },
33
33
  "dependencies": {
34
- "@pontive/pontkit-loader": "^1.5.2"
34
+ "@pontive/oidc-client": "^1.7.0",
35
+ "@pontive/pontkit-loader": "^1.7.0"
35
36
  },
36
37
  "devDependencies": {
37
- "@pontive/oidc-client": "^1.0.0",
38
- "@pontive/pontkit-core": "1.5.0",
38
+ "@pontive/pontkit-core": "1.43.0",
39
39
  "@testing-library/dom": "^10.4.1",
40
40
  "@testing-library/react": "^16.3.3",
41
41
  "@types/react-dom": "^19.2.5",
package/dist/auth.d.ts DELETED
@@ -1,102 +0,0 @@
1
- import { default as React } from 'react';
2
- import { AuthState, EnvConfig } from '@pontive/pontkit-core';
3
- interface PontKitContextValue {
4
- auth: AuthState;
5
- /**
6
- * Carried alongside the session because `<Authenticated>` needs it: its
7
- * default redirect target is `env.signinUrl`, which the element read from the
8
- * provider's Lit `envContext`. React has the same need and no way into that
9
- * context, and the Provider already holds `env` as a prop.
10
- */
11
- env: EnvConfig | null;
12
- }
13
- /**
14
- * The current session state.
15
- *
16
- * Throws when there is no `<Provider>` above the caller, which is always a
17
- * wiring mistake rather than a state to handle.
18
- */
19
- export declare function useAuthState(): AuthState;
20
- /** The `env` the nearest `<Provider>` was configured with. */
21
- export declare function useEnvConfig(): EnvConfig | null;
22
- /**
23
- * Tracks the session by listening to the provider element.
24
- *
25
- * Subscribing is not enough on its own: the provider resolves after a network
26
- * round trip, but nothing guarantees that happens *after* this listener is
27
- * attached — a Provider mounted into an application that is already running has
28
- * missed the event entirely. So the element's own `auth` property is read as a
29
- * seed, both immediately and once the definition has arrived, since before the
30
- * upgrade there is no property to read.
31
- */
32
- export declare function useProviderAuthState(element: HTMLElement | null, tagName: string): AuthState;
33
- export declare function AuthStateProvider({ value, children, }: {
34
- value: PontKitContextValue;
35
- children?: React.ReactNode;
36
- }): React.FunctionComponentElement<React.ProviderProps<PontKitContextValue | undefined>>;
37
- export interface ControlProps {
38
- children?: React.ReactNode;
39
- /**
40
- * What to render while the session is still being resolved.
41
- *
42
- * Both components render nothing during that window by default, because the
43
- * interim answer is "signed out" and showing the signed-out branch to a
44
- * signed-in user is the flash this is here to avoid.
45
- */
46
- fallback?: React.ReactNode | null;
47
- }
48
- export declare function SignedIn({ children, fallback, }: ControlProps): React.ReactNode;
49
- export declare function SignedOut({ children, fallback, }: ControlProps): React.ReactNode;
50
- /**
51
- * Renders its children once the session is known, and a placeholder until then.
52
- *
53
- * This replaces `<pont-auth-state>`, whose real job was pruning: it removed
54
- * whichever of `<pont-signed-in>` / `<pont-signed-out>` did not apply, permanently,
55
- * with `querySelectorAll(...).forEach(el => el.remove())`. Those tags are React
56
- * components now and never reach the DOM, so the search finds nothing — the
57
- * element still runs, and quietly does nothing at all.
58
- *
59
- * What is left is the half that was always worth having: one placeholder for a
60
- * group, instead of a `fallback` on every child. `<SignedIn>` and `<SignedOut>`
61
- * each gate on `resolved` themselves, so this is only about what fills the space
62
- * while the answer is in flight.
63
- *
64
- * Named for the flag it gates on rather than inheriting the element's name,
65
- * which described a state rather than a behaviour — and which collided with the
66
- * `AuthState` type.
67
- */
68
- export declare function AuthResolved({ children, fallback, }: ControlProps): React.ReactNode;
69
- export interface AuthenticatedProps {
70
- children?: React.ReactNode;
71
- /**
72
- * Rendered while the session is being resolved.
73
- *
74
- * The element spelled this `slot="loading"` and partitioned the children on
75
- * capture, because it stayed in the light DOM and so had no real `<slot>` to
76
- * use. A prop says the same thing without the machinery.
77
- */
78
- loading?: React.ReactNode;
79
- /** Where to send an unauthenticated visitor. Defaults to `env.signinUrl`. */
80
- redirectUrl?: string;
81
- /**
82
- * Hand the navigation to the host's router instead of loading a new document.
83
- *
84
- * The default is a full page load, which is what the element did. In a single
85
- * page application that throws away the router's state and everything else in
86
- * memory, so a host with a router should pass its own navigate here —
87
- * `(url) => navigate(url)` for React Router, `router.push` for Next.
88
- */
89
- onRedirect?: (url: string) => void;
90
- }
91
- /**
92
- * Renders its children only for a signed-in visitor, and sends everyone else to
93
- * the sign-in page.
94
- *
95
- * The redirect runs in an effect, which is the substantive change from the
96
- * element this replaces. That one assigned `window.location.href` from inside
97
- * `render()` — a side effect in a method the framework may call whenever it
98
- * likes, and which React would call twice in StrictMode. An effect fires once,
99
- * after the commit, on a transition that actually happened.
100
- */
101
- export declare function Authenticated({ children, loading, redirectUrl, onRedirect, }: AuthenticatedProps): React.ReactNode;
102
- export {};
package/dist/enums.d.ts DELETED
@@ -1,58 +0,0 @@
1
- export declare enum USER_PROFILE_TAB_VALUES {
2
- PROFILE = "Profile",
3
- SECURITY = "Security",
4
- APPEARANCE = "Appearance",
5
- NOTIFICATION = "Notification"
6
- }
7
- export declare enum USER_PROFILE_TAB_LIST {
8
- PROFILE = "Profile",
9
- SECURITY = "Security",
10
- APPEARANCE = "Appearance",
11
- NOTIFICATION = "Notification"
12
- }
13
- export declare enum USER_PROFILE_MODE {
14
- MODAL = "MODAL",
15
- PAGE = "PAGE"
16
- }
17
- export declare enum USER_PROFILE_SIDEBAR_DISPLAY_TYPE {
18
- BURGER = "BURGER",
19
- REGULAR = "REGULAR"
20
- }
21
- export declare enum USER_PROFILE_ORIENTATION {
22
- VERTICAL = "VERTICAL",
23
- HORIZONTAL = "HORIZONTAL"
24
- }
25
- export declare enum USER_PROFILE_WIDGETS_LAYOUT {
26
- COLUMN = "COLUMN",
27
- ROW = "ROW"
28
- }
29
- export interface IProfileContentCustomizations {
30
- account?: IProfileWidgetCustomization;
31
- personalInfo?: IProfileWidgetCustomization;
32
- locations?: IProfileWidgetCustomization;
33
- urls?: IProfileWidgetCustomization;
34
- }
35
- export interface IProfileWidgetCustomization {
36
- icon?: HTMLElement | Element;
37
- title?: string;
38
- }
39
- export declare enum MEMBER_MANAGEMENT_MODE {
40
- MODAL = "MODAL",
41
- PAGE = "PAGE"
42
- }
43
- export type MenuItem = {
44
- id?: string;
45
- label: string;
46
- type?: "action" | "toggle" | "select";
47
- href?: string;
48
- onClick?: (e: Event, item?: MenuItem) => void;
49
- icon?: any | string;
50
- checked?: boolean;
51
- onToggle?: (checked: boolean) => void;
52
- options?: Array<{
53
- value: string;
54
- label: string;
55
- }>;
56
- value?: string;
57
- onSelect?: (value: string) => void;
58
- };