@gridsuite/commons-ui 0.65.1 → 0.65.2

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 (36) hide show
  1. package/dist/components/authentication/AuthenticationRouter.d.ts +1 -27
  2. package/dist/components/authentication/AuthenticationRouter.js +14 -56
  3. package/dist/components/authentication/AuthenticationRouterErrorDisplay.d.ts +9 -0
  4. package/dist/components/authentication/AuthenticationRouterErrorDisplay.js +26 -0
  5. package/dist/components/authentication/alert/ErrorInLogoutAlert.d.ts +12 -0
  6. package/dist/components/authentication/alert/ErrorInLogoutAlert.js +14 -0
  7. package/dist/components/authentication/alert/ErrorInUserValidationAlert.d.ts +12 -0
  8. package/dist/components/authentication/alert/ErrorInUserValidationAlert.js +14 -0
  9. package/dist/components/authentication/alert/UnauthorizedAccessAlert.d.ts +11 -0
  10. package/dist/components/authentication/alert/UnauthorizedAccessAlert.js +13 -0
  11. package/dist/components/authentication/alert/index.d.ts +9 -0
  12. package/dist/components/authentication/alert/index.js +8 -0
  13. package/dist/components/authentication/authenticationType.d.ts +28 -0
  14. package/dist/components/authentication/authenticationType.js +1 -0
  15. package/dist/components/authentication/index.d.ts +5 -2
  16. package/dist/components/authentication/index.js +22 -7
  17. package/dist/components/authentication/utils/authService.js +1 -1
  18. package/dist/components/authentication/utils/index.d.ts +8 -0
  19. package/dist/components/authentication/utils/index.js +13 -0
  20. package/dist/components/authentication/utils/userManagerMock.d.ts +2 -2
  21. package/dist/components/authentication/utils/userManagerMock.js +1 -0
  22. package/dist/components/checkBoxList/CheckBoxListItem.d.ts +1 -1
  23. package/dist/components/checkBoxList/CheckBoxListItem.js +12 -3
  24. package/dist/components/checkBoxList/CheckBoxListItems.d.ts +1 -1
  25. package/dist/components/checkBoxList/CheckBoxListItems.js +11 -13
  26. package/dist/components/checkBoxList/ClickableCheckBoxItem.d.ts +2 -2
  27. package/dist/components/checkBoxList/ClickableRowItem.d.ts +2 -2
  28. package/dist/components/checkBoxList/ClickableRowItem.js +44 -14
  29. package/dist/components/checkBoxList/DraggableCheckBoxListItem.d.ts +1 -1
  30. package/dist/components/checkBoxList/DraggableCheckBoxListItem.js +8 -3
  31. package/dist/components/checkBoxList/DraggableClickableCheckBoxItem.d.ts +2 -2
  32. package/dist/components/checkBoxList/DraggableClickableRowItem.d.ts +2 -2
  33. package/dist/components/checkBoxList/DraggableClickableRowItem.js +53 -27
  34. package/dist/components/checkBoxList/checkBoxList.type.d.ts +35 -18
  35. package/dist/index.js +202 -187
  36. package/package.json +1 -1
@@ -1,30 +1,4 @@
1
- import { AuthenticationActions } from '../../redux/actions/authActions';
2
- import { UserManager } from 'oidc-client';
3
- import { Location, NavigateFunction } from 'react-router-dom';
4
- import { Dispatch } from 'react';
1
+ import { AuthenticationRouterProps } from './authenticationType';
5
2
 
6
- export type AuthenticationRouterErrorState = {
7
- userName?: string;
8
- userValidationError?: {
9
- error: Error;
10
- };
11
- logoutError?: {
12
- error: Error;
13
- };
14
- unauthorizedUserInfo?: string;
15
- };
16
- export type UserManagerState = {
17
- instance: UserManager | null;
18
- error: string | null;
19
- };
20
- export interface AuthenticationRouterProps {
21
- userManager: UserManagerState;
22
- signInCallbackError: Error | null;
23
- authenticationRouterError: AuthenticationRouterErrorState | null;
24
- showAuthenticationRouterLogin: boolean;
25
- dispatch: Dispatch<AuthenticationActions>;
26
- navigate: NavigateFunction;
27
- location: Location;
28
- }
29
3
  declare function AuthenticationRouter({ userManager, signInCallbackError, authenticationRouterError, showAuthenticationRouterLogin, dispatch, navigate, location, }: Readonly<AuthenticationRouterProps>): import("react/jsx-runtime").JSX.Element;
30
4
  export default AuthenticationRouter;
@@ -1,13 +1,12 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
3
  import { Routes, Route, Navigate } from "react-router-dom";
4
- import { Grid, Alert, AlertTitle } from "@mui/material";
5
- import { FormattedMessage } from "react-intl";
4
+ import { Grid } from "@mui/material";
5
+ import AuthenticationRouterErrorDisplay from "./AuthenticationRouterErrorDisplay.js";
6
+ import { handleSigninCallback, handleSilentRenewCallback, login } from "./utils/authService.js";
6
7
  import SignInCallbackHandler from "./SignInCallbackHandler.js";
7
- import { handleSigninCallback, handleSilentRenewCallback, login, logout } from "./utils/authService.js";
8
8
  import SilentRenewCallbackHandler from "./SilentRenewCallbackHandler.js";
9
9
  import Login from "./Login.js";
10
- import Logout from "./Logout.js";
11
10
  function AuthenticationRouter({
12
11
  userManager,
13
12
  signInCallbackError,
@@ -18,12 +17,12 @@ function AuthenticationRouter({
18
17
  location
19
18
  }) {
20
19
  const handleSigninCallbackClosure = useCallback(() => {
21
- if (userManager.instance != null) {
20
+ if (userManager.instance) {
22
21
  handleSigninCallback(dispatch, navigate, userManager.instance);
23
22
  }
24
23
  }, [dispatch, navigate, userManager.instance]);
25
24
  const handleSilentRenewCallbackClosure = useCallback(() => {
26
- if (userManager.instance != null) {
25
+ if (userManager.instance) {
27
26
  handleSilentRenewCallback(userManager.instance);
28
27
  }
29
28
  }, [userManager.instance]);
@@ -78,55 +77,14 @@ function AuthenticationRouter({
78
77
  }
79
78
  )
80
79
  ] }),
81
- authenticationRouterError !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
82
- /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
83
- Logout,
84
- {
85
- disabled: userManager.instance === null,
86
- onLogoutClick: () => logout(dispatch, userManager.instance)
87
- }
88
- ) }),
89
- /* @__PURE__ */ jsxs(Grid, { item: true, xs: 4, children: [
90
- authenticationRouterError.logoutError != null && /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
91
- /* @__PURE__ */ jsx(AlertTitle, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "login/errorInLogout" }) }),
92
- /* @__PURE__ */ jsx(
93
- FormattedMessage,
94
- {
95
- id: "login/errorInLogoutMessage",
96
- values: {
97
- userName: authenticationRouterError.userName
98
- }
99
- }
100
- ),
101
- /* @__PURE__ */ jsx("p", { children: authenticationRouterError.logoutError.error.message })
102
- ] }),
103
- (authenticationRouterError == null ? void 0 : authenticationRouterError.userValidationError) != null && /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
104
- /* @__PURE__ */ jsx(AlertTitle, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "login/errorInUserValidation" }) }),
105
- /* @__PURE__ */ jsx(
106
- FormattedMessage,
107
- {
108
- id: "login/errorInUserValidationMessage",
109
- values: {
110
- userName: authenticationRouterError.userName
111
- }
112
- }
113
- ),
114
- /* @__PURE__ */ jsx("p", { children: authenticationRouterError.userValidationError.error.message })
115
- ] }),
116
- (authenticationRouterError == null ? void 0 : authenticationRouterError.unauthorizedUserInfo) != null && /* @__PURE__ */ jsxs(Alert, { severity: "info", children: [
117
- /* @__PURE__ */ jsx(AlertTitle, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "login/unauthorizedAccess" }) }),
118
- /* @__PURE__ */ jsx(
119
- FormattedMessage,
120
- {
121
- id: "login/unauthorizedAccessMessage",
122
- values: {
123
- userName: authenticationRouterError.userName
124
- }
125
- }
126
- )
127
- ] })
128
- ] })
129
- ] })
80
+ authenticationRouterError !== null && /* @__PURE__ */ jsx(
81
+ AuthenticationRouterErrorDisplay,
82
+ {
83
+ dispatch,
84
+ instance: userManager.instance,
85
+ errorState: authenticationRouterError
86
+ }
87
+ )
130
88
  ] });
131
89
  }
132
90
  export {
@@ -0,0 +1,9 @@
1
+ import { AuthenticationRouterErrorState, AuthenticationRouterProps, UserManagerState } from './authenticationType';
2
+
3
+ type AuthenticationRouterErrorDisplayProps = {
4
+ errorState: AuthenticationRouterErrorState;
5
+ instance: UserManagerState['instance'];
6
+ dispatch: AuthenticationRouterProps['dispatch'];
7
+ };
8
+ declare function AuthenticationRouterErrorDisplay({ errorState, instance, dispatch }: AuthenticationRouterErrorDisplayProps): import("react/jsx-runtime").JSX.Element;
9
+ export default AuthenticationRouterErrorDisplay;
@@ -0,0 +1,26 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { Grid } from "@mui/material";
3
+ import Logout from "./Logout.js";
4
+ import { logout } from "./utils/authService.js";
5
+ import { ErrorInLogoutAlert } from "./alert/ErrorInLogoutAlert.js";
6
+ import { ErrorInUserValidationAlert } from "./alert/ErrorInUserValidationAlert.js";
7
+ import { UnauthorizedAccessAlert } from "./alert/UnauthorizedAccessAlert.js";
8
+ function AuthenticationRouterErrorDisplay({ errorState, instance, dispatch }) {
9
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
10
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Logout, { disabled: instance === null, onLogoutClick: () => logout(dispatch, instance) }) }),
11
+ /* @__PURE__ */ jsxs(Grid, { item: true, xs: 4, children: [
12
+ errorState.logoutError && /* @__PURE__ */ jsx(ErrorInLogoutAlert, { userName: errorState.userName, message: errorState.logoutError.error.message }),
13
+ errorState.userValidationError && /* @__PURE__ */ jsx(
14
+ ErrorInUserValidationAlert,
15
+ {
16
+ userName: errorState.userName,
17
+ message: errorState.userValidationError.error.message
18
+ }
19
+ ),
20
+ errorState.unauthorizedUserInfo && /* @__PURE__ */ jsx(UnauthorizedAccessAlert, { userName: errorState.userName })
21
+ ] })
22
+ ] });
23
+ }
24
+ export {
25
+ AuthenticationRouterErrorDisplay as default
26
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2024, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+ type ErrorInLogoutAlertProps = {
8
+ userName?: string;
9
+ message: string;
10
+ };
11
+ export declare function ErrorInLogoutAlert({ userName, message }: ErrorInLogoutAlertProps): import("react/jsx-runtime").JSX.Element;
12
+ export default ErrorInLogoutAlert;
@@ -0,0 +1,14 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Alert, AlertTitle } from "@mui/material";
3
+ import { FormattedMessage } from "react-intl";
4
+ function ErrorInLogoutAlert({ userName, message }) {
5
+ return /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
6
+ /* @__PURE__ */ jsx(AlertTitle, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "login/errorInLogout" }) }),
7
+ /* @__PURE__ */ jsx(FormattedMessage, { id: "login/errorInLogoutMessage", values: { userName } }),
8
+ /* @__PURE__ */ jsx("p", { children: message })
9
+ ] });
10
+ }
11
+ export {
12
+ ErrorInLogoutAlert,
13
+ ErrorInLogoutAlert as default
14
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2024, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+ type ErrorInUserValidationAlertProps = {
8
+ userName?: string;
9
+ message: string;
10
+ };
11
+ export declare function ErrorInUserValidationAlert({ userName, message }: ErrorInUserValidationAlertProps): import("react/jsx-runtime").JSX.Element;
12
+ export default ErrorInUserValidationAlert;
@@ -0,0 +1,14 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Alert, AlertTitle } from "@mui/material";
3
+ import { FormattedMessage } from "react-intl";
4
+ function ErrorInUserValidationAlert({ userName, message }) {
5
+ return /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
6
+ /* @__PURE__ */ jsx(AlertTitle, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "login/errorInUserValidation" }) }),
7
+ /* @__PURE__ */ jsx(FormattedMessage, { id: "login/errorInUserValidationMessage", values: { userName } }),
8
+ /* @__PURE__ */ jsx("p", { children: message })
9
+ ] });
10
+ }
11
+ export {
12
+ ErrorInUserValidationAlert,
13
+ ErrorInUserValidationAlert as default
14
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) 2024, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+ type UnauthorizedAccessAlertProps = {
8
+ userName?: string;
9
+ };
10
+ export declare function UnauthorizedAccessAlert({ userName }: UnauthorizedAccessAlertProps): import("react/jsx-runtime").JSX.Element;
11
+ export default UnauthorizedAccessAlert;
@@ -0,0 +1,13 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Alert, AlertTitle } from "@mui/material";
3
+ import { FormattedMessage } from "react-intl";
4
+ function UnauthorizedAccessAlert({ userName }) {
5
+ return /* @__PURE__ */ jsxs(Alert, { severity: "info", children: [
6
+ /* @__PURE__ */ jsx(AlertTitle, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "login/unauthorizedAccess" }) }),
7
+ /* @__PURE__ */ jsx(FormattedMessage, { id: "login/unauthorizedAccessMessage", values: { userName } })
8
+ ] });
9
+ }
10
+ export {
11
+ UnauthorizedAccessAlert,
12
+ UnauthorizedAccessAlert as default
13
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) 2024, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+ export * from './ErrorInLogoutAlert';
8
+ export * from './ErrorInUserValidationAlert';
9
+ export * from './UnauthorizedAccessAlert';
@@ -0,0 +1,8 @@
1
+ import { ErrorInLogoutAlert } from "./ErrorInLogoutAlert.js";
2
+ import { ErrorInUserValidationAlert } from "./ErrorInUserValidationAlert.js";
3
+ import { UnauthorizedAccessAlert } from "./UnauthorizedAccessAlert.js";
4
+ export {
5
+ ErrorInLogoutAlert,
6
+ ErrorInUserValidationAlert,
7
+ UnauthorizedAccessAlert
8
+ };
@@ -0,0 +1,28 @@
1
+ import { AuthenticationActions } from '../../redux/actions/authActions';
2
+ import { NavigateFunction, Location } from 'react-router-dom';
3
+ import { Dispatch } from 'react';
4
+ import { UserManager } from 'oidc-client';
5
+
6
+ export type AuthenticationRouterErrorState = {
7
+ userName?: string;
8
+ userValidationError?: {
9
+ error: Error;
10
+ };
11
+ logoutError?: {
12
+ error: Error;
13
+ };
14
+ unauthorizedUserInfo?: string;
15
+ };
16
+ export type UserManagerState = {
17
+ instance: UserManager | null;
18
+ error: string | null;
19
+ };
20
+ export interface AuthenticationRouterProps {
21
+ userManager: UserManagerState;
22
+ signInCallbackError: Error | null;
23
+ authenticationRouterError: AuthenticationRouterErrorState | null;
24
+ showAuthenticationRouterLogin: boolean;
25
+ dispatch: Dispatch<AuthenticationActions>;
26
+ navigate: NavigateFunction;
27
+ location: Location;
28
+ }
@@ -5,8 +5,11 @@
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
7
  export { default as AuthenticationRouter } from './AuthenticationRouter';
8
- export type { AuthenticationRouterErrorState, AuthenticationRouterProps, UserManagerState, } from './AuthenticationRouter';
8
+ export { default as AuthenticationRouterErrorDisplay } from './AuthenticationRouterErrorDisplay';
9
9
  export { default as Login } from './Login';
10
+ export { default as Logout } from './Logout';
10
11
  export { default as SignInCallbackHandler } from './SignInCallbackHandler';
11
12
  export { default as SilentRenewCallbackHandler } from './SilentRenewCallbackHandler';
12
- export { initializeAuthenticationDev, initializeAuthenticationProd, logout, dispatchUser, getPreLoginPath, } from './utils/authService';
13
+ export * from './alert';
14
+ export * from './authenticationType';
15
+ export * from './utils';
@@ -1,16 +1,31 @@
1
1
  import { default as default2 } from "./AuthenticationRouter.js";
2
- import { default as default3 } from "./Login.js";
3
- import { default as default4 } from "./SignInCallbackHandler.js";
4
- import { default as default5 } from "./SilentRenewCallbackHandler.js";
5
- import { dispatchUser, getPreLoginPath, initializeAuthenticationDev, initializeAuthenticationProd, logout } from "./utils/authService.js";
2
+ import { default as default3 } from "./AuthenticationRouterErrorDisplay.js";
3
+ import { default as default4 } from "./Login.js";
4
+ import { default as default5 } from "./Logout.js";
5
+ import { default as default6 } from "./SignInCallbackHandler.js";
6
+ import { default as default7 } from "./SilentRenewCallbackHandler.js";
7
+ import { ErrorInLogoutAlert } from "./alert/ErrorInLogoutAlert.js";
8
+ import { ErrorInUserValidationAlert } from "./alert/ErrorInUserValidationAlert.js";
9
+ import { UnauthorizedAccessAlert } from "./alert/UnauthorizedAccessAlert.js";
10
+ import { dispatchUser, getPreLoginPath, handleSigninCallback, handleSilentRenewCallback, initializeAuthenticationDev, initializeAuthenticationProd, login, logout } from "./utils/authService.js";
11
+ import { UserManagerMock } from "./utils/userManagerMock.js";
6
12
  export {
7
13
  default2 as AuthenticationRouter,
8
- default3 as Login,
9
- default4 as SignInCallbackHandler,
10
- default5 as SilentRenewCallbackHandler,
14
+ default3 as AuthenticationRouterErrorDisplay,
15
+ ErrorInLogoutAlert,
16
+ ErrorInUserValidationAlert,
17
+ default4 as Login,
18
+ default5 as Logout,
19
+ default6 as SignInCallbackHandler,
20
+ default7 as SilentRenewCallbackHandler,
21
+ UnauthorizedAccessAlert,
22
+ UserManagerMock,
11
23
  dispatchUser,
12
24
  getPreLoginPath,
25
+ handleSigninCallback,
26
+ handleSilentRenewCallback,
13
27
  initializeAuthenticationDev,
14
28
  initializeAuthenticationProd,
29
+ login,
15
30
  logout
16
31
  };
@@ -1,6 +1,6 @@
1
1
  import { jwtDecode } from "jwt-decode";
2
2
  import { Log, UserManager } from "oidc-client";
3
- import UserManagerMock from "./userManagerMock.js";
3
+ import { UserManagerMock } from "./userManagerMock.js";
4
4
  import { setLoggedUser, setLogoutError, setUnauthorizedUserInfo, setUserValidationError, setSignInCallbackError, setShowAuthenticationRouterLogin, resetAuthenticationRouterError } from "../../../redux/actions/authActions.js";
5
5
  window.OIDCLog = Log;
6
6
  const hackAuthorityKey = "oidc.hack.authority";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) 2024, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+ export * from './authService';
8
+ export * from './userManagerMock';
@@ -0,0 +1,13 @@
1
+ import { dispatchUser, getPreLoginPath, handleSigninCallback, handleSilentRenewCallback, initializeAuthenticationDev, initializeAuthenticationProd, login, logout } from "./authService.js";
2
+ import { UserManagerMock } from "./userManagerMock.js";
3
+ export {
4
+ UserManagerMock,
5
+ dispatchUser,
6
+ getPreLoginPath,
7
+ handleSigninCallback,
8
+ handleSilentRenewCallback,
9
+ initializeAuthenticationDev,
10
+ initializeAuthenticationProd,
11
+ login,
12
+ logout
13
+ };
@@ -21,7 +21,7 @@ declare class Events implements UserManagerEvents {
21
21
  addAccessTokenExpired(): void;
22
22
  removeAccessTokenExpired(): void;
23
23
  }
24
- export default class UserManagerMock implements UserManager {
24
+ export declare class UserManagerMock implements UserManager {
25
25
  settings: UserManagerSettings;
26
26
  events: Events;
27
27
  user: User;
@@ -56,4 +56,4 @@ export default class UserManagerMock implements UserManager {
56
56
  createSignoutRequest(): Promise<SignoutRequest>;
57
57
  processSignoutResponse(): Promise<SignoutResponse>;
58
58
  }
59
- export {};
59
+ export default UserManagerMock;
@@ -165,5 +165,6 @@ class UserManagerMock {
165
165
  }
166
166
  }
167
167
  export {
168
+ UserManagerMock,
168
169
  UserManagerMock as default
169
170
  };
@@ -1,4 +1,4 @@
1
1
  import { CheckBoxListItemProps } from './checkBoxList.type';
2
2
 
3
- export declare function CheckBoxListItem<T>({ item, sx, secondaryAction, getItemId, divider, isCheckboxClickableOnly, ...props }: CheckBoxListItemProps<T>): import("react/jsx-runtime").JSX.Element;
3
+ export declare function CheckBoxListItem<T>({ item, sx, secondaryAction, getItemId, divider, onItemClick, isItemClickable, ...props }: Readonly<CheckBoxListItemProps<T>>): import("react/jsx-runtime").JSX.Element;
4
4
  export default CheckBoxListItem;
@@ -9,7 +9,8 @@ function CheckBoxListItem({
9
9
  secondaryAction,
10
10
  getItemId,
11
11
  divider,
12
- isCheckboxClickableOnly,
12
+ onItemClick,
13
+ isItemClickable,
13
14
  ...props
14
15
  }) {
15
16
  const [hover, setHover] = useState("");
@@ -20,10 +21,18 @@ function CheckBoxListItem({
20
21
  sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkboxListItem },
21
22
  onMouseEnter: () => setHover(getItemId(item)),
22
23
  onMouseLeave: () => setHover(""),
23
- disablePadding: !isCheckboxClickableOnly,
24
+ disablePadding: !!onItemClick,
24
25
  disableGutters: true,
25
26
  divider,
26
- children: isCheckboxClickableOnly ? /* @__PURE__ */ jsx(ClickableCheckBoxItem, { ...props }) : /* @__PURE__ */ jsx(ClickableRowItem, { ...props })
27
+ children: !onItemClick ? /* @__PURE__ */ jsx(ClickableCheckBoxItem, { sx, ...props }) : /* @__PURE__ */ jsx(
28
+ ClickableRowItem,
29
+ {
30
+ isItemClickable: isItemClickable == null ? void 0 : isItemClickable(item),
31
+ onItemClick: () => onItemClick(item),
32
+ sx,
33
+ ...props
34
+ }
35
+ )
27
36
  }
28
37
  );
29
38
  }
@@ -1,4 +1,4 @@
1
1
  import { CheckBoxListItemsProps } from './checkBoxList.type';
2
2
 
3
- export declare function CheckBoxListItems<T>({ items, selectedItems, onSelectionChange, getItemId, sx, secondaryAction, enableSecondaryActionOnHover, addSelectAllCheckbox, selectAllCheckBoxLabel, getItemLabel, isDisabled, isDndDragAndDropActive, isDragDisable, divider, isCheckboxClickableOnly, ...props }: CheckBoxListItemsProps<T>): import("react/jsx-runtime").JSX.Element;
3
+ export declare function CheckBoxListItems<T>({ items, selectedItems, onSelectionChange, getItemId, sx, secondaryAction, addSelectAllCheckbox, selectAllCheckBoxLabel, getItemLabel, isDisabled, isDndDragAndDropActive, isDragDisable, divider, onItemClick, isItemClickable, ...props }: Readonly<CheckBoxListItemsProps<T>>): import("react/jsx-runtime").JSX.Element;
4
4
  export default CheckBoxListItems;
@@ -13,7 +13,6 @@ function CheckBoxListItems({
13
13
  getItemId,
14
14
  sx,
15
15
  secondaryAction,
16
- enableSecondaryActionOnHover,
17
16
  addSelectAllCheckbox,
18
17
  selectAllCheckBoxLabel,
19
18
  getItemLabel,
@@ -21,7 +20,8 @@ function CheckBoxListItems({
21
20
  isDndDragAndDropActive,
22
21
  isDragDisable,
23
22
  divider,
24
- isCheckboxClickableOnly,
23
+ onItemClick,
24
+ isItemClickable,
25
25
  ...props
26
26
  }) {
27
27
  const handleOnchange = useCallback(
@@ -64,13 +64,8 @@ function CheckBoxListItems({
64
64
  if (!secondaryAction) {
65
65
  return null;
66
66
  }
67
- if (!enableSecondaryActionOnHover) {
68
- return secondaryAction(item);
69
- }
70
- if (hover === getItemId(item)) {
71
- return secondaryAction(item);
72
- }
73
- return null;
67
+ const isItemHovered = hover === getItemId(item);
68
+ return secondaryAction(item, isItemHovered);
74
69
  };
75
70
  const selectAllLabel = useMemo(
76
71
  () => selectAllCheckBoxLabel ?? "multiple_selection_dialog/selectAll",
@@ -109,6 +104,7 @@ function CheckBoxListItems({
109
104
  const label = getItemLabel ? getItemLabel(item) : getItemId(item);
110
105
  const disabled = isDisabled ? isDisabled(item) : false;
111
106
  const addDivider = divider && index < items.length - 1;
107
+ const calculatedItemSx = typeof (sx == null ? void 0 : sx.items) === "function" ? sx == null ? void 0 : sx.items(item) : sx == null ? void 0 : sx.items;
112
108
  if (isDndDragAndDropActive) {
113
109
  return /* @__PURE__ */ jsx(
114
110
  Draggable,
@@ -123,14 +119,15 @@ function CheckBoxListItems({
123
119
  checked: isChecked(item),
124
120
  label,
125
121
  onClick: () => toggleSelection(getItemId(item)),
126
- sx,
122
+ sx: calculatedItemSx,
127
123
  disabled,
128
124
  getItemId,
129
125
  secondaryAction: handleSecondaryAction,
130
126
  isDragDisable,
131
127
  provided,
132
128
  divider: addDivider,
133
- isCheckboxClickableOnly
129
+ onItemClick,
130
+ isItemClickable
134
131
  },
135
132
  getItemId(item)
136
133
  )
@@ -147,10 +144,11 @@ function CheckBoxListItems({
147
144
  onClick: () => toggleSelection(getItemId(item)),
148
145
  disabled,
149
146
  getItemId,
150
- sx,
147
+ sx: calculatedItemSx,
151
148
  secondaryAction: handleSecondaryAction,
152
149
  divider: addDivider,
153
- isCheckboxClickableOnly
150
+ onItemClick,
151
+ isItemClickable
154
152
  },
155
153
  getItemId(item)
156
154
  );
@@ -1,4 +1,4 @@
1
- import { ClickableItemProps } from './checkBoxList.type';
1
+ import { ClickableCheckBoxItemProps } from './checkBoxList.type';
2
2
 
3
- export declare function ClickableCheckBoxItem({ sx, label, ...props }: ClickableItemProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ClickableCheckBoxItem({ sx, label, ...props }: ClickableCheckBoxItemProps): import("react/jsx-runtime").JSX.Element;
4
4
  export default ClickableCheckBoxItem;
@@ -1,4 +1,4 @@
1
- import { ClickableItemProps } from './checkBoxList.type';
1
+ import { ClickableRowItemProps } from './checkBoxList.type';
2
2
 
3
- export declare function ClickableRowItem({ sx, disabled, label, onClick, ...props }: ClickableItemProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ClickableRowItem({ sx, disabled, label, onClick, onItemClick, isItemClickable, ...props }: Readonly<ClickableRowItemProps>): import("react/jsx-runtime").JSX.Element;
4
4
  export default ClickableRowItem;
@@ -1,20 +1,50 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { ListItemButton, ListItemIcon, Checkbox, ListItemText } from "@mui/material";
3
3
  import { OverflowableText } from "../overflowableText/OverflowableText.js";
4
- function ClickableRowItem({ sx, disabled, label, onClick, ...props }) {
5
- return /* @__PURE__ */ jsxs(ListItemButton, { sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkboxButton }, disabled, onClick, children: [
6
- /* @__PURE__ */ jsx(ListItemIcon, { sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkBoxIcon }, children: /* @__PURE__ */ jsx(Checkbox, { disableRipple: true, sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkbox }, ...props }) }),
7
- /* @__PURE__ */ jsx(
8
- ListItemText,
9
- {
10
- sx: {
11
- display: "flex"
12
- },
13
- disableTypography: true,
14
- children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label })
15
- }
16
- )
17
- ] });
4
+ const styles = {
5
+ unclickableItem: {
6
+ "&:hover": {
7
+ backgroundColor: "transparent"
8
+ },
9
+ cursor: "inherit"
10
+ }
11
+ };
12
+ function ClickableRowItem({
13
+ sx,
14
+ disabled,
15
+ label,
16
+ onClick,
17
+ onItemClick,
18
+ isItemClickable = true,
19
+ ...props
20
+ }) {
21
+ const onCheckboxClick = (event) => {
22
+ event.stopPropagation();
23
+ onClick();
24
+ };
25
+ const handleItemClick = () => isItemClickable && onItemClick();
26
+ return /* @__PURE__ */ jsxs(
27
+ ListItemButton,
28
+ {
29
+ disableTouchRipple: !isItemClickable,
30
+ sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkboxButton, ...!isItemClickable && styles.unclickableItem },
31
+ disabled,
32
+ onClick: handleItemClick,
33
+ children: [
34
+ /* @__PURE__ */ jsx(ListItemIcon, { sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkBoxIcon }, children: /* @__PURE__ */ jsx(Checkbox, { disableRipple: true, sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkbox }, onClick: onCheckboxClick, ...props }) }),
35
+ /* @__PURE__ */ jsx(
36
+ ListItemText,
37
+ {
38
+ sx: {
39
+ display: "flex"
40
+ },
41
+ disableTypography: true,
42
+ children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label })
43
+ }
44
+ )
45
+ ]
46
+ }
47
+ );
18
48
  }
19
49
  export {
20
50
  ClickableRowItem,
@@ -1,4 +1,4 @@
1
1
  import { DraggableCheckBoxListItemProps } from './checkBoxList.type';
2
2
 
3
- export declare function DraggableCheckBoxListItem<T>({ item, sx, secondaryAction, getItemId, isDragDisable, provided, divider, isCheckboxClickableOnly, ...props }: DraggableCheckBoxListItemProps<T>): import("react/jsx-runtime").JSX.Element;
3
+ export declare function DraggableCheckBoxListItem<T>({ item, sx, secondaryAction, getItemId, isDragDisable, provided, divider, onItemClick, isItemClickable, ...props }: Readonly<DraggableCheckBoxListItemProps<T>>): import("react/jsx-runtime").JSX.Element;
4
4
  export default DraggableCheckBoxListItem;