superdesk-ui-framework 4.0.20 → 4.0.22

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.
@@ -152,6 +152,10 @@
152
152
  overflow: hidden;
153
153
  transition: all 0.2s ease;
154
154
  outline: 1px solid var(--sd-colour-line--x-light);
155
+
156
+ .toggle-box__content--animation {
157
+ animation: fadeIn 0.3s ease-in 0s 1;
158
+ }
155
159
  }
156
160
  .new-collapse-box__header {
157
161
  grid-row: 1 / 2;
@@ -1,6 +1,4 @@
1
1
  import * as React from 'react';
2
- // @ts-ignore
3
- import * as iconFont from '../../app/styles/_icon-font.scss';
4
2
  import { Button } from './Button';
5
3
  import { Icon } from './Icon';
6
4
  import { IItem, SelectGrid } from "./SelectGrid";
@@ -85,7 +83,7 @@ export class IconPicker extends React.PureComponent<IProps, IState> {
85
83
  }
86
84
 
87
85
  const getIcons = (translateFunction: (text: string) => string): Array<IItem> => {
88
- const translatedIconNameMap: any = {
86
+ const translatedIconNameMap = {
89
87
  'add-gallery': 'Add Gallery',
90
88
  'add-image': 'Add Image',
91
89
  'adjust': 'Adjust',
@@ -271,11 +269,8 @@ const getIcons = (translateFunction: (text: string) => string): Array<IItem> =>
271
269
  'zoom-out': 'Zoom Out',
272
270
  };
273
271
 
274
- return iconFont.icon
275
- .split(', ')
276
- .sort()
277
- .map((icon: string) => ({
278
- value: icon,
279
- label: translatedIconNameMap[icon] ? translateFunction(translatedIconNameMap[icon]) : icon,
280
- }));
272
+ return Object.keys(translatedIconNameMap).sort().map((icon) => ({
273
+ value: icon as keyof typeof translatedIconNameMap,
274
+ label: translateFunction(translatedIconNameMap[icon as keyof typeof translatedIconNameMap]),
275
+ }));
281
276
  };
@@ -32,9 +32,24 @@ export class CustomHeaderToggleBox extends React.PureComponent<IPropsCustomHeade
32
32
  return this.state.isOpen;
33
33
  }
34
34
 
35
- public toggle = (): void => {
36
- this.setState({isOpen: !this.state.isOpen}, () => {
37
- this.props.onToggle?.(this.state.isOpen);
35
+ public toggle = (): Promise<boolean> => {
36
+ return new Promise((resolve, reject) => {
37
+ this.setState(
38
+ {isOpen: !this.state.isOpen, isAnimating: true},
39
+ () => {
40
+ if (this.contentRef.current) {
41
+ const handleAnimation = () => {
42
+ this.props.onToggle?.(this.state.isOpen);
43
+ this.handleAnimationEnd();
44
+ resolve(this.state.isOpen);
45
+ };
46
+
47
+ this.contentRef.current.addEventListener("animationend", handleAnimation, {once: true});
48
+ } else {
49
+ reject();
50
+ }
51
+ },
52
+ );
38
53
  });
39
54
  }
40
55
 
@@ -91,6 +106,7 @@ export class CustomHeaderToggleBox extends React.PureComponent<IPropsCustomHeade
91
106
  {/** render wrapper unconditionally in order not to break the animation */}
92
107
  <div className='new-collapse-box__content'>
93
108
  <div
109
+ ref={this.contentRef}
94
110
  id={this.htmlId}
95
111
  aria-hidden={!isOpen}
96
112
  className={classNames('new-collapse-box__content-inner p-2 pt-0-5', {