@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
@@ -11,7 +11,8 @@ function DraggableCheckBoxListItem({
11
11
  isDragDisable,
12
12
  provided,
13
13
  divider,
14
- isCheckboxClickableOnly,
14
+ onItemClick,
15
+ isItemClickable,
15
16
  ...props
16
17
  }) {
17
18
  const [hover, setHover] = useState("");
@@ -22,16 +23,17 @@ function DraggableCheckBoxListItem({
22
23
  sx: { minWidth: 0, ...sx == null ? void 0 : sx.checkboxListItem },
23
24
  onMouseEnter: () => setHover(getItemId(item)),
24
25
  onMouseLeave: () => setHover(""),
25
- disablePadding: !isCheckboxClickableOnly,
26
+ disablePadding: !!onItemClick,
26
27
  disableGutters: true,
27
28
  divider,
28
29
  ref: provided.innerRef,
29
30
  ...provided.draggableProps,
30
- children: isCheckboxClickableOnly ? /* @__PURE__ */ jsx(
31
+ children: !onItemClick ? /* @__PURE__ */ jsx(
31
32
  DraggableClickableCheckBoxItem,
32
33
  {
33
34
  provided,
34
35
  isHighlighted: hover === getItemId(item) && !isDragDisable,
36
+ sx,
35
37
  ...props
36
38
  }
37
39
  ) : /* @__PURE__ */ jsx(
@@ -39,6 +41,9 @@ function DraggableCheckBoxListItem({
39
41
  {
40
42
  provided,
41
43
  isHighlighted: hover === getItemId(item) && !isDragDisable,
44
+ onItemClick: () => onItemClick(item),
45
+ isItemClickable: isItemClickable == null ? void 0 : isItemClickable(item),
46
+ sx,
42
47
  ...props
43
48
  }
44
49
  )
@@ -1,4 +1,4 @@
1
- import { DraggableClickableItemProps } from './checkBoxList.type';
1
+ import { DraggableClickableCheckBoxItemProps } from './checkBoxList.type';
2
2
 
3
- export declare function DraggableClickableCheckBoxItem({ sx, disabled, provided, isHighlighted, label, ...props }: DraggableClickableItemProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function DraggableClickableCheckBoxItem({ sx, disabled, provided, isHighlighted, label, ...props }: Readonly<DraggableClickableCheckBoxItemProps>): import("react/jsx-runtime").JSX.Element;
4
4
  export default DraggableClickableCheckBoxItem;
@@ -1,4 +1,4 @@
1
- import { DraggableClickableItemProps } from './checkBoxList.type';
1
+ import { DraggableClickableRowItemProps } from './checkBoxList.type';
2
2
 
3
- export declare function DraggableClickableRowItem({ sx, disabled, onClick, provided, isHighlighted, label, ...props }: DraggableClickableItemProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function DraggableClickableRowItem({ sx, disabled, onClick, provided, isHighlighted, label, onItemClick, isItemClickable, ...props }: Readonly<DraggableClickableRowItemProps>): import("react/jsx-runtime").JSX.Element;
4
4
  export default DraggableClickableRowItem;
@@ -8,7 +8,13 @@ const styles = {
8
8
  border: theme.spacing(0),
9
9
  borderRadius: theme.spacing(0),
10
10
  zIndex: 90
11
- })
11
+ }),
12
+ unclickableItem: {
13
+ "&:hover": {
14
+ backgroundColor: "transparent"
15
+ },
16
+ cursor: "inherit"
17
+ }
12
18
  };
13
19
  function DraggableClickableRowItem({
14
20
  sx,
@@ -17,34 +23,54 @@ function DraggableClickableRowItem({
17
23
  provided,
18
24
  isHighlighted,
19
25
  label,
26
+ onItemClick,
27
+ isItemClickable = true,
20
28
  ...props
21
29
  }) {
22
- return /* @__PURE__ */ jsxs(ListItemButton, { sx: { paddingLeft: 0, ...sx == null ? void 0 : sx.checkboxButton }, disabled, onClick, children: [
23
- /* @__PURE__ */ jsx(
24
- IconButton,
25
- {
26
- ...provided.dragHandleProps,
27
- size: "small",
28
- sx: {
29
- opacity: isHighlighted ? "1" : "0",
30
- padding: "unset",
31
- ...styles.dragIcon
32
- },
33
- children: /* @__PURE__ */ jsx(DragIndicatorIcon, { spacing: 0 })
34
- }
35
- ),
36
- /* @__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 }) }),
37
- /* @__PURE__ */ jsx(
38
- ListItemText,
39
- {
40
- sx: {
41
- display: "flex"
42
- },
43
- disableTypography: true,
44
- children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label })
45
- }
46
- )
47
- ] });
30
+ const onCheckboxClick = (event) => {
31
+ event.stopPropagation();
32
+ onClick();
33
+ };
34
+ const handleItemClick = () => isItemClickable && onItemClick();
35
+ return /* @__PURE__ */ jsxs(
36
+ ListItemButton,
37
+ {
38
+ disableTouchRipple: !isItemClickable,
39
+ sx: {
40
+ paddingLeft: 0,
41
+ ...sx == null ? void 0 : sx.checkboxButton,
42
+ ...!isItemClickable && styles.unclickableItem
43
+ },
44
+ disabled,
45
+ onClick: handleItemClick,
46
+ children: [
47
+ /* @__PURE__ */ jsx(
48
+ IconButton,
49
+ {
50
+ ...provided.dragHandleProps,
51
+ size: "small",
52
+ sx: {
53
+ opacity: isHighlighted ? "1" : "0",
54
+ padding: "unset",
55
+ ...styles.dragIcon
56
+ },
57
+ children: /* @__PURE__ */ jsx(DragIndicatorIcon, { spacing: 0 })
58
+ }
59
+ ),
60
+ /* @__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 }) }),
61
+ /* @__PURE__ */ jsx(
62
+ ListItemText,
63
+ {
64
+ sx: {
65
+ display: "flex"
66
+ },
67
+ disableTypography: true,
68
+ children: /* @__PURE__ */ jsx(OverflowableText, { sx: sx == null ? void 0 : sx.label, text: label })
69
+ }
70
+ )
71
+ ]
72
+ }
73
+ );
48
74
  }
49
75
  export {
50
76
  DraggableClickableRowItem,
@@ -1,19 +1,26 @@
1
+ import { Theme } from '@mui/material';
1
2
  import { SxProps } from '@mui/system';
2
3
  import { DraggableProvided, DragStart, DropResult } from 'react-beautiful-dnd';
3
4
  import { default as React } from 'react';
4
5
 
5
- export interface CheckBoxListItemSxProps {
6
- checkBoxIcon?: SxProps;
7
- label?: SxProps;
8
- checkboxListItem?: SxProps;
9
- checkboxButton?: SxProps;
10
- checkbox?: SxProps;
11
- dragAndDropContainer?: SxProps;
12
- checkboxList?: SxProps;
13
- }
6
+ export type CheckBoxListItemSx = {
7
+ checkBoxIcon?: SxProps<Theme>;
8
+ label?: SxProps<Theme>;
9
+ checkboxListItem?: SxProps<Theme>;
10
+ checkboxButton?: SxProps<Theme>;
11
+ checkbox?: SxProps<Theme>;
12
+ };
13
+ export type CheckBoxListSx = {
14
+ dragAndDropContainer?: SxProps<Theme>;
15
+ checkboxList?: SxProps<Theme>;
16
+ };
17
+ export type CheckBoxListItemSxMethod<T> = (item: T) => CheckBoxListItemSx;
18
+ type CheckBoxListItemSxProps<T> = CheckBoxListSx & {
19
+ items: CheckBoxListItemSx | CheckBoxListItemSxMethod<T>;
20
+ };
14
21
  export interface CheckBoxListItemProps<T> {
15
22
  item: T;
16
- sx?: CheckBoxListItemSxProps;
23
+ sx?: CheckBoxListItemSx;
17
24
  label: string;
18
25
  onClick: () => void;
19
26
  secondaryAction?: (item: T, hover: string) => React.ReactElement | null;
@@ -21,7 +28,8 @@ export interface CheckBoxListItemProps<T> {
21
28
  disabled?: boolean;
22
29
  divider?: boolean;
23
30
  checked: boolean;
24
- isCheckboxClickableOnly?: boolean;
31
+ onItemClick?: (item: T) => void;
32
+ isItemClickable?: (item: T) => boolean;
25
33
  }
26
34
  export interface DraggableCheckBoxListItemProps<T> extends CheckBoxListItemProps<T> {
27
35
  isDragDisable?: boolean;
@@ -33,29 +41,38 @@ export interface CheckBoxListItemsProps<T> {
33
41
  onSelectionChange?: (selectedItems: T[]) => void;
34
42
  getItemId: (item: T) => string;
35
43
  getItemLabel?: (item: T) => string;
36
- secondaryAction?: (item: T) => React.ReactElement | null;
37
- enableSecondaryActionOnHover?: boolean;
44
+ secondaryAction?: (item: T, hover: boolean) => React.ReactElement | null;
38
45
  isDisabled?: (item: T) => boolean;
39
46
  addSelectAllCheckbox?: boolean;
40
47
  selectAllCheckBoxLabel?: string;
41
- sx?: CheckBoxListItemSxProps;
48
+ sx?: CheckBoxListItemSxProps<T>;
42
49
  isDndDragAndDropActive?: boolean;
43
50
  isDragDisable?: boolean;
44
51
  divider?: boolean;
45
- isCheckboxClickableOnly?: boolean;
52
+ onItemClick?: (item: T) => void;
53
+ isItemClickable?: (item: T) => boolean;
46
54
  }
47
55
  export interface CheckboxListProps<T> extends CheckBoxListItemsProps<T> {
48
56
  onDragStart?: (dragStart: DragStart) => void;
49
57
  onDragEnd?: (dropResult: DropResult) => void;
50
58
  }
51
- export interface ClickableItemProps {
52
- sx?: CheckBoxListItemSxProps;
59
+ export interface ClickableCheckBoxItemProps {
60
+ sx?: CheckBoxListItemSx;
53
61
  label: string;
54
62
  onClick: () => void;
55
63
  disabled?: boolean;
56
64
  checked: boolean;
57
65
  }
58
- export interface DraggableClickableItemProps extends ClickableItemProps {
66
+ export interface DraggableClickableCheckBoxItemProps extends ClickableCheckBoxItemProps {
59
67
  provided: DraggableProvided;
60
68
  isHighlighted: boolean;
61
69
  }
70
+ interface ClickableItem {
71
+ onItemClick: () => void;
72
+ isItemClickable?: boolean;
73
+ }
74
+ export interface ClickableRowItemProps extends ClickableCheckBoxItemProps, ClickableItem {
75
+ }
76
+ export interface DraggableClickableRowItemProps extends DraggableClickableCheckBoxItemProps, ClickableItem {
77
+ }
78
+ export {};