@axinom/mosaic-ui 0.51.0-rc.11 → 0.51.0-rc.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axinom/mosaic-ui",
3
- "version": "0.51.0-rc.11",
3
+ "version": "0.51.0-rc.12",
4
4
  "description": "UI components for building Axinom Mosaic applications",
5
5
  "author": "Axinom",
6
6
  "license": "PROPRIETARY",
@@ -32,7 +32,7 @@
32
32
  "build-storybook": "storybook build"
33
33
  },
34
34
  "dependencies": {
35
- "@axinom/mosaic-core": "^0.4.24-rc.11",
35
+ "@axinom/mosaic-core": "^0.4.24-rc.12",
36
36
  "@faker-js/faker": "^7.4.0",
37
37
  "@geoffcox/react-splitter": "^2.1.2",
38
38
  "@popperjs/core": "^2.11.8",
@@ -106,5 +106,5 @@
106
106
  "publishConfig": {
107
107
  "access": "public"
108
108
  },
109
- "gitHead": "e3645d77a2b5805138621b56f4746bae31849395"
109
+ "gitHead": "0b88f693bb9e9b890a37c4bc976c980a43c9f197"
110
110
  }
@@ -138,7 +138,7 @@ export const useQuickEdit = <T extends Data>({
138
138
  actionType:
139
139
  isQuickEditMode &&
140
140
  currentRegistration?.component === registration.component
141
- ? PageHeaderActionType.Active
141
+ ? PageHeaderActionType.Hightlight
142
142
  : PageHeaderActionType.Context,
143
143
  onClick: async () => {
144
144
  await saveCallbackRef.current?.();
@@ -53,7 +53,6 @@
53
53
  .actions {
54
54
  display: grid;
55
55
  grid-auto-flow: column;
56
- grid-auto-columns: minmax(0, min-content);
57
56
  grid-gap: 1px;
58
57
  }
59
58
 
@@ -1,5 +1,5 @@
1
1
  import clsx from 'clsx';
2
- import React from 'react';
2
+ import React, { useEffect, useState } from 'react';
3
3
  import { useTabTitle } from '../../hooks/useTabTitle/useTabTitle';
4
4
  import { PageHeaderProps } from './PageHeader.model';
5
5
  import classes from './PageHeader.scss';
@@ -31,10 +31,9 @@ export const PageHeader: React.FC<PageHeaderProps> = ({
31
31
  useTabTitle(title, setTabTitle);
32
32
  const { width, ref } = useElementWidthObserver<HTMLDivElement>();
33
33
 
34
- const [availableActionSpace, setAvailableActionSpace] =
35
- React.useState<number>(0);
34
+ const [availableActionSpace, setAvailableActionSpace] = useState<number>(0);
36
35
 
37
- React.useEffect(() => {
36
+ useEffect(() => {
38
37
  // Use up to 75% of the container width for actions
39
38
  const maxActionsWidth = width * 0.75;
40
39
 
@@ -5,6 +5,7 @@ import { ConfirmAction, DefaultHandler, LinkAction } from '../../models';
5
5
  export enum PageHeaderActionType {
6
6
  Active,
7
7
  Context,
8
+ Hightlight,
8
9
  }
9
10
 
10
11
  export type PageHeaderActionProps =
@@ -88,6 +88,13 @@
88
88
  }
89
89
  }
90
90
 
91
+ &.highlight {
92
+ background-color: var(
93
+ --page-header-action-context-hover-background-color,
94
+ $page-header-action-context-hover-background-color
95
+ );
96
+ }
97
+
91
98
  &.active {
92
99
  color: var(
93
100
  --page-header-action-context-background-color,
@@ -119,6 +119,7 @@ const PageHeaderJSAction: React.FC<PageHeaderJsActionProps> = ({
119
119
  {
120
120
  [classes.context]: actionType === PageHeaderActionType.Context,
121
121
  [classes.active]: actionType === PageHeaderActionType.Active,
122
+ [classes.highlight]: actionType === PageHeaderActionType.Hightlight,
122
123
  [classes.hasConfirm]: confirmation,
123
124
  },
124
125
  'page-header-action-container',
@@ -112,10 +112,14 @@ export const PageHeaderActionsGroup: React.FC<PageHeaderActionsGroupProps> = ({
112
112
  }
113
113
  }, [isConfirmOpen, isMouseOverMore, moreCollapse, moreExpanded]);
114
114
 
115
- const actionsSlice =
116
- availableActionSpace < actions.length
117
- ? availableActionSpace - 1
118
- : availableActionSpace;
115
+ const showMore = actions.length > availableActionSpace && actions.length > 1;
116
+ const visibleActions = showMore
117
+ ? Math.max(availableActionSpace, 1)
118
+ : actions.length;
119
+
120
+ const actionsSlice = showMore
121
+ ? Math.max(availableActionSpace - 1, 0)
122
+ : actions.length;
119
123
 
120
124
  return (
121
125
  <div
@@ -150,9 +154,7 @@ export const PageHeaderActionsGroup: React.FC<PageHeaderActionsGroupProps> = ({
150
154
  />
151
155
  <div
152
156
  style={{
153
- maxWidth: isExpanded
154
- ? `${Math.min(availableActionSpace, actions.length) * 121}px`
155
- : `0px`,
157
+ maxWidth: isExpanded ? `${visibleActions * 121}px` : `0px`,
156
158
  opacity: isExpanded ? 1 : 0,
157
159
  }}
158
160
  className={classes.actions}
@@ -178,7 +180,7 @@ export const PageHeaderActionsGroup: React.FC<PageHeaderActionsGroupProps> = ({
178
180
  <PageHeaderAction key={idx} {...action} />
179
181
  ),
180
182
  )}
181
- {actions.length > availableActionSpace && (
183
+ {showMore && (
182
184
  <div onMouseEnter={() => setIsMouseOverMore(true)}>
183
185
  <PageHeaderAction
184
186
  label="More"