@axinom/mosaic-ui 0.70.0 → 0.71.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axinom/mosaic-ui",
3
- "version": "0.70.0",
3
+ "version": "0.71.0",
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.32",
35
+ "@axinom/mosaic-core": "^0.4.33",
36
36
  "@faker-js/faker": "^7.4.0",
37
37
  "@geoffcox/react-splitter": "^2.1.2",
38
38
  "@mui/base": "5.0.0-beta.40",
@@ -113,5 +113,5 @@
113
113
  "publishConfig": {
114
114
  "access": "public"
115
115
  },
116
- "gitHead": "9732fd094fafedb5360d10405cc19fa202d42de6"
116
+ "gitHead": "75dcfd9bf92de1ef72a28f073e43a7dfaa7b430b"
117
117
  }
@@ -13,25 +13,7 @@
13
13
 
14
14
  color: var(--actions-color, $actions-color);
15
15
  background-color: var(--actions-background-color, $actions-background-color);
16
- }
17
-
18
- //Custom scrollbar for Chrome, Safari and Edge
19
- ::-webkit-scrollbar {
20
- width: var(--scrollbar-size, $scrollbar-size);
21
- height: var(--scrollbar-size, $scrollbar-size);
22
- }
23
- ::-webkit-scrollbar-track {
24
- background: var(--scrollbar-track-color, $scrollbar-track-color);
25
- }
26
-
27
- ::-webkit-scrollbar-thumb {
28
- background: var(--scrollbar-thumb-color, $scrollbar-thumb-color);
29
- }
30
-
31
- ::-webkit-scrollbar-thumb:hover {
32
- background: var(--scrollbar-thumb-hover-color, $scrollbar-thumb-hover-color);
33
- }
34
16
 
35
- ::-webkit-scrollbar-corner {
36
- background: var(--scrollbar-corner-color, $scrollbar-corner-color);
17
+ // Custom scrollbar for Chrome, Safari and Edge
18
+ @include customScrollbar;
37
19
  }
@@ -41,6 +41,9 @@ const meta: Meta<typeof Button> = {
41
41
  type: 'number',
42
42
  },
43
43
  },
44
+ customIcon: {
45
+ control: false,
46
+ },
44
47
  },
45
48
  decorators: [
46
49
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
@@ -74,6 +74,7 @@ export interface ButtonIconOptions {
74
74
  /**
75
75
  * Optional custom icon.
76
76
  * When provided, `icon` property is ignored.
77
+ * @deprecated Use `icon` property with a custom icon component instead for better accessibility and consistency. This property will be removed in future versions.
77
78
  */
78
79
  customIcon?: React.ReactNode;
79
80
  }
@@ -429,3 +429,26 @@ export const Editable: StoryObj<StoryDDLType> = {
429
429
  }),
430
430
  },
431
431
  };
432
+
433
+ export const EditableWithInlineMenu: StoryObj<StoryDDLType> = {
434
+ name: 'Editable with inline menu',
435
+ args: {
436
+ ...Editable.args,
437
+ inlineMenuActions: (_) => [
438
+ {
439
+ label: 'Action 1',
440
+ onActionSelected: action('onChange'),
441
+ },
442
+ {
443
+ label: 'Action 2',
444
+ onActionSelected: action('onChange'),
445
+ confirmationMode: 'Simple',
446
+ },
447
+ {
448
+ label: 'Action 3',
449
+ onActionSelected: action('onChange'),
450
+ confirmationMode: 'Advanced',
451
+ },
452
+ ],
453
+ },
454
+ };
@@ -256,6 +256,26 @@ describe('DynamicListRow', () => {
256
256
  expect(button).toBeInTheDocument();
257
257
  });
258
258
 
259
+ it(`renders both the inline menu and the remove button when allowRemove and inlineMenuActions are set`, () => {
260
+ const { container } = render(
261
+ <DynamicListRow
262
+ columns={defaultColumns}
263
+ columnSizes={defaultProps.columnSizes}
264
+ data={defaultProps.data}
265
+ allowRemove={true}
266
+ showActionColumn={true}
267
+ inlineMenuActions={() => [{ label: 'Edit', onActionSelected: vi.fn() }]}
268
+ />,
269
+ );
270
+
271
+ expect(
272
+ container.querySelector('[data-test-id="inline-menu-button"]'),
273
+ ).toBeInTheDocument();
274
+ expect(
275
+ container.querySelector('[data-test-id="dynamic-list-remove-button"]'),
276
+ ).toBeInTheDocument();
277
+ });
278
+
259
279
  it(`emits onActionClicked with row data when the action button is clicked`, () => {
260
280
  const spy = vi.fn();
261
281
  const { container } = render(
@@ -211,7 +211,7 @@ export const DynamicListRow = <T extends Data>({
211
211
  onButtonClicked={(e) => e.stopPropagation()}
212
212
  />
213
213
  )}
214
- {allowRemove && !inlineMenuActions && (
214
+ {allowRemove && (
215
215
  <Button
216
216
  type="button"
217
217
  className={classes.actionButton}
@@ -31,7 +31,9 @@ export const useColumnDefs = function <T extends Data>(
31
31
  allowReordering,
32
32
  allowRowDragging,
33
33
  positionKey,
34
- allowNewData || showInlineMenu || allowEditing,
34
+ allowNewData,
35
+ allowEditing,
36
+ showInlineMenu,
35
37
  ),
36
38
  );
37
39
 
@@ -44,7 +46,9 @@ export const useColumnDefs = function <T extends Data>(
44
46
  allowReordering,
45
47
  allowRowDragging,
46
48
  positionKey,
47
- allowNewData || showInlineMenu || allowEditing,
49
+ allowNewData,
50
+ allowEditing,
51
+ showInlineMenu,
48
52
  ),
49
53
  );
50
54
  if (!isResized) {
@@ -90,7 +94,9 @@ function calculateColumnSizes<T extends Data>(
90
94
  allowReordering: boolean,
91
95
  allowRowDragging: boolean,
92
96
  positionKey?: keyof T,
93
- showActionColumn?: boolean,
97
+ allowNewData?: boolean,
98
+ allowEditing?: boolean,
99
+ showInlineMenu?: boolean,
94
100
  ): string {
95
101
  const positionColumn = getPositionColumnWidth(
96
102
  allowReordering,
@@ -104,7 +110,10 @@ function calculateColumnSizes<T extends Data>(
104
110
  .reduce((prev, current) => `${prev} ${current.size ?? '1fr'}`, '')
105
111
  .trim();
106
112
 
107
- if (showActionColumn) {
113
+ if (allowNewData && showInlineMenu) {
114
+ // both the remove button and the inline menu render side-by-side
115
+ actionColumn = '100px';
116
+ } else if (allowNewData || allowEditing || showInlineMenu) {
108
117
  actionColumn = '50px';
109
118
  }
110
119
 
@@ -26,29 +26,9 @@
26
26
  scrollbar-width: thin; //for Firefox only
27
27
  }
28
28
 
29
- //Custom scrollbar for Chrome, Safari and Edge
30
- ::-webkit-scrollbar {
31
- width: 7px;
32
- height: 7px;
33
- }
34
-
35
- ::-webkit-scrollbar-track {
36
- background: var(--scrollbar-track-color, $scrollbar-track-color);
37
- }
38
-
39
- ::-webkit-scrollbar-thumb {
40
- background: var(--scrollbar-thumb-color, $scrollbar-thumb-color);
41
- }
42
-
43
- ::-webkit-scrollbar-thumb:hover {
44
- background: var(
45
- --scrollbar-thumb-hover-color,
46
- $scrollbar-thumb-hover-color
47
- );
48
- }
49
-
50
- ::-webkit-scrollbar-corner {
51
- background: var(--scrollbar-corner-color, $scrollbar-corner-color);
29
+ // Custom scrollbar for all scrollable descendants (Chrome, Safari, Edge)
30
+ * {
31
+ @include customScrollbar;
52
32
  }
53
33
 
54
34
  &.hasStationError {
@@ -28,29 +28,9 @@
28
28
  scrollbar-width: thin; //for Firefox only
29
29
  }
30
30
 
31
- //Custom scrollbar for Chrome, Safari and Edge
32
- ::-webkit-scrollbar {
33
- width: var(--scrollbar-size, $scrollbar-size);
34
- height: var(--scrollbar-size, $scrollbar-size);
35
- }
36
-
37
- ::-webkit-scrollbar-track {
38
- background: var(--scrollbar-track-color, $scrollbar-track-color);
39
- }
40
-
41
- ::-webkit-scrollbar-thumb {
42
- background: var(--scrollbar-thumb-color, $scrollbar-thumb-color);
43
- }
44
-
45
- ::-webkit-scrollbar-thumb:hover {
46
- background: var(
47
- --scrollbar-thumb-hover-color,
48
- $scrollbar-thumb-hover-color
49
- );
50
- }
51
-
52
- ::-webkit-scrollbar-corner {
53
- background: var(--scrollbar-corner-color, $scrollbar-corner-color);
31
+ // Custom scrollbar for all scrollable descendants (Chrome, Safari, Edge)
32
+ * {
33
+ @include customScrollbar;
54
34
  }
55
35
 
56
36
  &.hasStationError {
@@ -61,6 +61,7 @@ export const Filter = <T extends Data>({
61
61
  FilterTypes.Numeric,
62
62
  FilterTypes.Date,
63
63
  FilterTypes.DateTime,
64
+ FilterTypes.SearcheableOptions,
64
65
  ];
65
66
 
66
67
  const onFilterValueChange = (
@@ -258,9 +259,9 @@ export const Filter = <T extends Data>({
258
259
  >
259
260
  <label
260
261
  id={labelId}
261
- {...(inputBasedFilter.includes(options.type)
262
- ? {}
263
- : { htmlFor: inputId })}
262
+ {...(inputBasedFilter.includes(options.type) && isExpanded
263
+ ? { htmlFor: inputId }
264
+ : {})}
264
265
  data-test-id="filter-label"
265
266
  >
266
267
  {options.label}
@@ -7,6 +7,8 @@
7
7
  grid-template-rows: 1fr;
8
8
  overflow: hidden;
9
9
 
10
+ @include customScrollbar;
11
+
10
12
  .main {
11
13
  position: relative;
12
14
  display: grid;
@@ -19,39 +21,16 @@
19
21
  grid: 1fr / 1fr;
20
22
  overflow-y: auto;
21
23
  min-height: 0;
22
- scrollbar-width: thin; //for Firefox only
23
24
  isolation: isolate;
24
25
 
26
+ @include customScrollbar;
27
+
25
28
  &.hasMessage {
26
29
  grid: min-content 1fr / minmax(740px, 1fr);
27
30
  }
28
31
  }
29
32
  }
30
33
 
31
- //Custom scrollbar for Chrome, Safari and Edge
32
- ::-webkit-scrollbar {
33
- width: var(--scrollbar-size, $scrollbar-size);
34
- height: var(--scrollbar-size, $scrollbar-size);
35
- }
36
- ::-webkit-scrollbar-track {
37
- background: var(--scrollbar-track-color, $scrollbar-track-color);
38
- }
39
-
40
- ::-webkit-scrollbar-thumb {
41
- background: var(--scrollbar-thumb-color, $scrollbar-thumb-color);
42
- }
43
-
44
- ::-webkit-scrollbar-thumb:hover {
45
- background: var(
46
- --scrollbar-thumb-hover-color,
47
- $scrollbar-thumb-hover-color
48
- );
49
- }
50
-
51
- ::-webkit-scrollbar-corner {
52
- background: var(--scrollbar-corner-color, $scrollbar-corner-color);
53
- }
54
-
55
34
  .formContainer {
56
35
  padding: 30px;
57
36
  }
@@ -24,3 +24,29 @@
24
24
 
25
25
  cursor: default;
26
26
  }
27
+
28
+ //Custom scrollbar for Chrome, Safari and Edge
29
+ @mixin customScrollbar {
30
+ &::-webkit-scrollbar {
31
+ width: var(--scrollbar-size, $scrollbar-size);
32
+ height: var(--scrollbar-size, $scrollbar-size);
33
+ }
34
+ &::-webkit-scrollbar-track {
35
+ background: var(--scrollbar-track-color, $scrollbar-track-color);
36
+ }
37
+
38
+ &::-webkit-scrollbar-thumb {
39
+ background: var(--scrollbar-thumb-color, $scrollbar-thumb-color);
40
+ }
41
+
42
+ &::-webkit-scrollbar-thumb:hover {
43
+ background: var(
44
+ --scrollbar-thumb-hover-color,
45
+ $scrollbar-thumb-hover-color
46
+ );
47
+ }
48
+
49
+ &::-webkit-scrollbar-corner {
50
+ background: var(--scrollbar-corner-color, $scrollbar-corner-color);
51
+ }
52
+ }