superdesk-ui-framework 3.0.19 → 3.0.21

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.
@@ -86,12 +86,6 @@ $icon-base-size: 16px;
86
86
  .icon--green {
87
87
  color: $green !important;
88
88
  }
89
- .icon--rotate-180 {
90
- transform: rotate(180deg);
91
- }
92
- .icon--rotate-90 {
93
- transform: rotate(90deg);
94
- }
95
89
  .icon--full-opacity {
96
90
  opacity: 1 !important;
97
91
  }
@@ -43,6 +43,9 @@ $side-panel-Bg-200: var(--sd-colour-panel-bg--200);
43
43
  position: relative;
44
44
  min-height: 4.8rem;
45
45
  }
46
+ .side-panel__header-wrapper {
47
+ display: flex;
48
+ }
46
49
  .side-panel__sliding-toolbar {
47
50
  @include sliding-toolbar; // See mixins.scss for details
48
51
  &.side-panel__sliding-toolbar {
@@ -53,7 +56,6 @@ $side-panel-Bg-200: var(--sd-colour-panel-bg--200);
53
56
  }
54
57
  }
55
58
  }
56
-
57
59
  .side-panel__heading {
58
60
  padding-inline-start: $sd-base-increment * 2;
59
61
  padding-inline-end: $sd-base-increment * 2;
@@ -70,10 +72,9 @@ $side-panel-Bg-200: var(--sd-colour-panel-bg--200);
70
72
  letter-spacing: 0.01em;
71
73
  }
72
74
  }
73
- .side-panel__close {
74
- position: absolute;
75
- inset-inline-end: $sd-base-increment; // equals 0.8rem or 8px
76
- inset-block-start: $sd-base-increment;
75
+ .side-panel__btn-group {
76
+ padding-inline: 0.8rem;
77
+ padding-block: 0.8rem;
77
78
  z-index: 2;
78
79
  color: var(--color-text-light);
79
80
  }
@@ -25,20 +25,26 @@ export class IconButton extends React.PureComponent<IProps> {
25
25
  [`icn-btn--${this.props.style}`]: this.props.style || this.props.style !== undefined,
26
26
  'icn-btn--disabled': this.props.disabled,
27
27
  });
28
+
28
29
  return (
29
30
  <Tooltip
30
- text={this.props.ariaValue}
31
- flow={this.props.toolTipFlow}
32
- appendToBody={this.props.toolTipAppend}
33
- disabled={this.props.disabled}>
31
+ text={this.props.ariaValue}
32
+ flow={this.props.toolTipFlow}
33
+ appendToBody={this.props.toolTipAppend}
34
+ disabled={this.props.disabled}
35
+ >
34
36
  <button
35
37
  id={this.props.id}
36
38
  tabIndex={0}
37
39
  onClick={this.props.onClick}
38
40
  className={classes}
39
41
  disabled={this.props.disabled}
40
- aria-label={this.props.ariaValue}>
41
- <Icon name={this.props.icon} ariaHidden={true}/>
42
+ aria-label={this.props.ariaValue}
43
+ >
44
+ <Icon
45
+ name={this.props.icon}
46
+ ariaHidden={true}
47
+ />
42
48
  </button>
43
49
  </Tooltip>
44
50
  );
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import { Icon } from '../Icon';
3
2
  import { IconButton } from '../IconButton';
4
3
  import { Spinner, LoadingOverlay } from '../Spinner';
5
4
  import classNames from 'classnames';
5
+ import {ButtonGroup} from '../ButtonGroup';
6
6
 
7
7
  // ============= Panel ============ //
8
8
 
@@ -23,11 +23,13 @@ export default class Panel extends React.PureComponent<IPropsPanel> {
23
23
  [`side-panel--${this.props.background}`]:
24
24
  this.props.background !== 'light' && this.props.background !== undefined,
25
25
  }, this.props.className);
26
+
26
27
  let classes2 = classNames('side-panel__container', {
27
28
  [`side-panel__container--${this.props.side}`]: this.props.side,
28
29
  [`side-panel__container--${this.props.size}`]: this.props.size,
29
30
  [`panel-open`]: this.props.open,
30
31
  });
32
+
31
33
  return (
32
34
  <div className={classes2} data-theme={this.props.theme ? `${this.props.theme}-ui` : null}>
33
35
  <div className={classes}>
@@ -47,6 +49,7 @@ interface IPropsPanelHeader {
47
49
  theme?: 'light-ui' | 'dark-ui'; // defaults to 'light
48
50
  className?: string;
49
51
  onClose?(): void;
52
+ iconButtons?: Array<React.ReactNode>;
50
53
  }
51
54
 
52
55
  class PanelHeader extends React.PureComponent<IPropsPanelHeader> {
@@ -61,22 +64,43 @@ class PanelHeader extends React.PureComponent<IPropsPanelHeader> {
61
64
  [`side-panel__header--${this.props.color}`]: this.props.color || this.props.color !== undefined,
62
65
  'side-panel__header--has-close': this.props.onClose,
63
66
  }, this.props.className);
67
+
64
68
  let style = {
65
- zIndex: 10 + (this.props.zIndex ? this.props.zIndex : 0),
69
+ zIndex: this.props.zIndex ? this.props.zIndex : 10,
66
70
  };
71
+
67
72
  let defaultTheme = darkColors.includes(this.props.color || '') ? 'dark-ui' : null;
68
73
 
69
74
  return (
70
75
  <div data-theme={this.props.theme || defaultTheme} className={classes} style={style}>
71
- {this.props.onClose ?
72
- <a className="icn-btn side-panel__close"
73
- onClick={() => this.props.onClose ? this.props.onClose() : false}>
74
- <Icon name='close-small' />
75
- </a> : null}
76
- {this.props.title &&
77
- <div className="side-panel__header-inner">
78
- <h3 className="side-panel__heading">{this.props.title}</h3>
79
- </div>}
76
+ <div className='side-panel__header-wrapper'>
77
+ {this.props.title != null
78
+ && <div className="side-panel__header-inner">
79
+ <h3 className="side-panel__heading">{this.props.title}</h3>
80
+ </div>
81
+ }
82
+
83
+ {(this.props.onClose == null && this.props.iconButtons == null)
84
+ || (
85
+ <ButtonGroup
86
+ align='end'
87
+ spaces='no-space'
88
+ className='side-panel__btn-group'
89
+ >
90
+ {this.props.iconButtons != null
91
+ && this.props.iconButtons
92
+ }
93
+ {this.props.onClose != null
94
+ && <IconButton
95
+ icon='close-small'
96
+ ariaValue='Close'
97
+ onClick={this.props.onClose}
98
+ />
99
+ }
100
+ </ButtonGroup>
101
+ )
102
+ }
103
+ </div>
80
104
  {this.props.children}
81
105
  </div>
82
106
  );
@@ -95,15 +119,15 @@ class PanelContent extends React.PureComponent<IPropsPanelContent> {
95
119
  render() {
96
120
  return (
97
121
  <div className="side-panel__content">
98
- {this.props.loading ?
99
- <LoadingOverlay>
122
+ {this.props.loading
123
+ && <LoadingOverlay>
100
124
  <Spinner size="large" />
101
- </LoadingOverlay> : null
125
+ </LoadingOverlay>
102
126
  }
103
- {this.props.empty ?
104
- <LoadingOverlay>
127
+ {this.props.empty
128
+ && <LoadingOverlay>
105
129
  {this.props.emptyTemplate}
106
- </LoadingOverlay> : null
130
+ </LoadingOverlay>
107
131
  }
108
132
  {this.props.children}
109
133
  </div>
@@ -203,6 +227,11 @@ class PanelTools extends React.PureComponent<IPropsPanelTools> {
203
227
  }
204
228
 
205
229
  export {
206
- Panel, PanelHeader, PanelContent, PanelContentBlock, PanelFooter, PanelHeaderSlidingToolbar,
207
- PanelTools
230
+ Panel,
231
+ PanelHeader,
232
+ PanelContent,
233
+ PanelContentBlock,
234
+ PanelFooter,
235
+ PanelHeaderSlidingToolbar,
236
+ PanelTools,
208
237
  };
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+
3
+ interface IPropsRotate {
4
+ children: React.ReactNode;
5
+ degrees: number;
6
+ }
7
+
8
+ export class Rotate extends React.PureComponent<IPropsRotate> {
9
+ render() {
10
+ return (
11
+ <div
12
+ style={{
13
+ transform: `rotate(${this.props.degrees}deg)`,
14
+ }}
15
+ >
16
+ {this.props.children}
17
+ </div>
18
+ );
19
+ }
20
+ }
@@ -32,7 +32,10 @@ export class WithPopover extends React.PureComponent<IPropsWithPopover> {
32
32
  this.props.component,
33
33
  this.props.zIndex,
34
34
  this.props.closeOnHoverEnd,
35
- this.props.onClose,
35
+ () => {
36
+ this.closePopup = undefined;
37
+ this.props.onClose?.();
38
+ },
36
39
  ).close;
37
40
  }
38
41
  }
@@ -17,6 +17,7 @@ export { AvatarContentImage } from './components/avatar/avatar-image';
17
17
  export { AvatarGroup } from './components/avatar/avatar-group';
18
18
  export { Avatar } from './components/avatar/avatar';
19
19
  export { AvatarPlaceholder } from './components/avatar/avatar-placeholder';
20
+ export { Rotate } from './components/Rotate';
20
21
  export { IconButton } from './components/IconButton';
21
22
  export { IconLabel } from './components/IconLabel';
22
23
  export { Tooltip } from './components/Tooltip';
@@ -3660,12 +3660,6 @@ doc-react-playground {
3660
3660
  .icon--green {
3661
3661
  color: #46a446 !important; }
3662
3662
 
3663
- .icon--rotate-180 {
3664
- transform: rotate(180deg); }
3665
-
3666
- .icon--rotate-90 {
3667
- transform: rotate(90deg); }
3668
-
3669
3663
  .icon--full-opacity {
3670
3664
  opacity: 1 !important; }
3671
3665