@plesk/ui-library 3.25.6 → 3.27.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.
Files changed (98) hide show
  1. package/README.md +35 -35
  2. package/cjs/components/Action/Action.js +3 -3
  3. package/cjs/components/Button/Button.js +50 -50
  4. package/cjs/components/Checkbox/Checkbox.js +3 -3
  5. package/cjs/components/CodeEditor/CodeEditor.js +40 -40
  6. package/cjs/components/Dialog/Dialog.js +63 -63
  7. package/cjs/components/Drawer/Drawer.js +100 -90
  8. package/cjs/components/Drawer/DrawerProgress.js +17 -14
  9. package/cjs/components/Drawer/Header.js +11 -4
  10. package/cjs/components/Form/Form.js +4 -4
  11. package/cjs/components/FormField/FormField.js +87 -82
  12. package/cjs/components/FormFieldCheckbox/FormFieldCheckbox.js +26 -26
  13. package/cjs/components/FormFieldPassword/FormFieldPassword.js +34 -34
  14. package/cjs/components/FormFieldRadioButtons/FormFieldRadioButtons.js +32 -32
  15. package/cjs/components/FormFieldSelect/FormFieldSelect.js +1 -1
  16. package/cjs/components/Icon/Icon.js +6 -6
  17. package/cjs/components/Icon/constants.js +2 -2
  18. package/cjs/components/Icon/images/symbols.svg +1653 -1639
  19. package/cjs/components/InputNumber/InputNumber.js +3 -3
  20. package/cjs/components/Item/Item.js +50 -41
  21. package/cjs/components/ItemLink/ItemLink.js +1 -0
  22. package/cjs/components/ItemList/ItemList.js +43 -12
  23. package/cjs/components/ItemList/ItemList.stories.js +35 -3
  24. package/cjs/components/Layout/Layout.js +55 -55
  25. package/cjs/components/List/List.js +139 -134
  26. package/cjs/components/LocaleProvider/LocaleProvider.js +3 -3
  27. package/cjs/components/Menu/MenuBaseItem.js +19 -19
  28. package/cjs/components/Overlay/Overlay.js +34 -34
  29. package/cjs/components/Pagination/Pagination.js +3 -3
  30. package/cjs/components/Panel/Panel.js +14 -4
  31. package/cjs/components/Popper/Popper.js +30 -30
  32. package/cjs/components/ProgressStep/ProgressStep.js +16 -14
  33. package/cjs/components/Section/Section.js +128 -68
  34. package/cjs/components/Select/Select.js +9 -9
  35. package/cjs/components/Select/SelectControl.js +1 -1
  36. package/cjs/components/Tabs/Tab.js +28 -28
  37. package/cjs/components/Tabs/Tabs.js +33 -33
  38. package/cjs/components/Translate/Translate.js +25 -25
  39. package/cjs/index.js +1 -1
  40. package/dist/images/symbols.svg +1653 -1639
  41. package/dist/plesk-ui-library-rtl.css +1 -1
  42. package/dist/plesk-ui-library-rtl.css.map +1 -1
  43. package/dist/plesk-ui-library.css +1 -1
  44. package/dist/plesk-ui-library.css.map +1 -1
  45. package/dist/plesk-ui-library.js +1116 -970
  46. package/dist/plesk-ui-library.js.map +1 -1
  47. package/dist/plesk-ui-library.min.js +5 -5
  48. package/dist/plesk-ui-library.min.js.map +1 -1
  49. package/esm/components/Action/Action.js +3 -3
  50. package/esm/components/Button/Button.js +50 -50
  51. package/esm/components/Checkbox/Checkbox.js +3 -3
  52. package/esm/components/CodeEditor/CodeEditor.js +40 -40
  53. package/esm/components/Dialog/Dialog.js +63 -63
  54. package/esm/components/Drawer/Drawer.js +100 -89
  55. package/esm/components/Drawer/DrawerProgress.js +16 -15
  56. package/esm/components/Drawer/Header.js +11 -4
  57. package/esm/components/Form/Form.js +4 -4
  58. package/esm/components/FormField/FormField.js +87 -82
  59. package/esm/components/FormFieldCheckbox/FormFieldCheckbox.js +26 -26
  60. package/esm/components/FormFieldPassword/FormFieldPassword.js +34 -34
  61. package/esm/components/FormFieldRadioButtons/FormFieldRadioButtons.js +32 -32
  62. package/esm/components/FormFieldSelect/FormFieldSelect.js +1 -1
  63. package/esm/components/Icon/Icon.js +6 -6
  64. package/esm/components/Icon/constants.js +2 -2
  65. package/esm/components/Icon/images/symbols.svg +1653 -1639
  66. package/esm/components/InputNumber/InputNumber.js +3 -3
  67. package/esm/components/Item/Item.js +50 -41
  68. package/esm/components/ItemLink/ItemLink.js +1 -0
  69. package/esm/components/ItemList/ItemList.js +43 -12
  70. package/esm/components/ItemList/ItemList.stories.js +32 -2
  71. package/esm/components/Layout/Layout.js +55 -55
  72. package/esm/components/List/List.js +139 -134
  73. package/esm/components/LocaleProvider/LocaleProvider.js +3 -3
  74. package/esm/components/Menu/MenuBaseItem.js +19 -19
  75. package/esm/components/Overlay/Overlay.js +34 -34
  76. package/esm/components/Pagination/Pagination.js +3 -3
  77. package/esm/components/Panel/Panel.js +14 -5
  78. package/esm/components/Popper/Popper.js +30 -30
  79. package/esm/components/ProgressStep/ProgressStep.js +17 -15
  80. package/esm/components/Section/Section.js +129 -72
  81. package/esm/components/Select/Select.js +9 -9
  82. package/esm/components/Select/SelectControl.js +1 -1
  83. package/esm/components/Tabs/Tab.js +28 -28
  84. package/esm/components/Tabs/Tabs.js +33 -33
  85. package/esm/components/Translate/Translate.js +25 -25
  86. package/esm/index.js +1 -1
  87. package/package.json +146 -146
  88. package/styleguide/build/bundle.ff1f903a.js +2 -0
  89. package/styleguide/build/{bundle.b7db9339.js.LICENSE.txt → bundle.ff1f903a.js.LICENSE.txt} +0 -0
  90. package/styleguide/images/symbols.svg +1653 -1639
  91. package/styleguide/index.html +6 -6
  92. package/types/src/components/Drawer/DrawerProgress.d.ts +7 -2
  93. package/types/src/components/Icon/constants.d.ts +1 -1
  94. package/types/src/components/ItemLink/ItemLink.d.ts +4 -0
  95. package/types/src/components/ItemLink/ItemLink.stories.d.ts +1 -0
  96. package/types/src/components/ItemList/ItemList.d.ts +8 -0
  97. package/types/src/components/ItemList/ItemList.stories.d.ts +104 -0
  98. package/styleguide/build/bundle.b7db9339.js +0 -2
@@ -45,9 +45,9 @@ const toNumber = value => {
45
45
  const isMinDisabled = (value, min) => min !== undefined && value !== '' && value <= min;
46
46
 
47
47
  const isMaxDisabled = (value, max) => max !== undefined && value !== '' && value >= max;
48
- /**
49
- * `InputNumber` component is used for entering integer numbers.
50
- * @since 2.2.0
48
+ /**
49
+ * `InputNumber` component is used for entering integer numbers.
50
+ * @since 2.2.0
51
51
  */
52
52
 
53
53
 
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- // Copyright 1999-2020. Plesk International GmbH. All rights reserved.
2
+ // Copyright 1999-2021. Plesk International GmbH. All rights reserved.
3
3
  import React, { Component, cloneElement, isValidElement, Children } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import classNames from 'classnames';
@@ -11,10 +11,10 @@ import Tooltip from '../Tooltip';
11
11
  import { createProxyProps, wrapFunction } from '../utils';
12
12
  const VIEW_SIMPLE = 'simple';
13
13
  const VIEW_CARD = 'card';
14
- /**
15
- * `Item` component is element of [ItemList](#!/ItemList) and it is presented as
16
- * a combination of icon, text title and content (similar to [Media](#!/Media)).
17
- * @since 0.0.48
14
+ /**
15
+ * `Item` component is element of [ItemList](#!/ItemList) and it is presented as
16
+ * a combination of icon, text title and content (similar to [Media](#!/Media)).
17
+ * @since 0.0.48
18
18
  */
19
19
 
20
20
  class Item extends Component {
@@ -83,6 +83,7 @@ class Item extends Component {
83
83
  value,
84
84
  tooltip,
85
85
  disabled,
86
+ hoverable,
86
87
  ...props
87
88
  } = this.props;
88
89
 
@@ -103,7 +104,8 @@ class Item extends Component {
103
104
  const item = /*#__PURE__*/React.createElement(Tag, _extends({
104
105
  className: classNames(baseClassName, {
105
106
  [`${baseClassName}--card`]: view === 'card',
106
- [`${baseClassName}--disabled`]: disabled
107
+ [`${baseClassName}--disabled`]: disabled,
108
+ [`${baseClassName}--hoverable`]: hoverable
107
109
  }, className)
108
110
  }, props), /*#__PURE__*/React.createElement(Media, {
109
111
  image: this.renderIcon(icon),
@@ -129,79 +131,86 @@ class Item extends Component {
129
131
  }
130
132
 
131
133
  Item.propTypes = {
132
- /**
133
- * Component to render as the root element. Useful when rendering a `Item` as `<a>` or `<Link>`.
134
- * @since 0.0.48
134
+ /**
135
+ * Component to render as the root element. Useful when rendering a `Item` as `<a>` or `<Link>`.
136
+ * @since 0.0.48
135
137
  */
136
138
  component: PropTypes.elementType,
137
139
 
138
- /**
139
- * View mode.
140
- * @since 2.1.0
140
+ /**
141
+ * View mode.
142
+ * @since 2.1.0
141
143
  */
142
144
  view: PropTypes.oneOf([VIEW_SIMPLE, VIEW_CARD]),
143
145
 
144
- /**
145
- * Icon.
146
- * @since 0.0.48
146
+ /**
147
+ * Icon.
148
+ * @since 0.0.48
147
149
  */
148
150
  icon: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.element]),
149
151
 
150
- /**
151
- * Title.
152
- * @since 0.0.48
152
+ /**
153
+ * Title.
154
+ * @since 0.0.48
153
155
  */
154
156
  title: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.element]),
155
157
 
156
- /**
157
- * Content for footer.
158
- * @since 2.1.0
158
+ /**
159
+ * Content for footer.
160
+ * @since 2.1.0
159
161
  */
160
162
  footer: PropTypes.node,
161
163
 
162
- /**
163
- * Description. Renders as small grey text.
164
- * @since 2.1.0
164
+ /**
165
+ * Description. Renders as small grey text.
166
+ * @since 2.1.0
165
167
  */
166
168
  description: PropTypes.node,
167
169
 
168
- /**
169
- * Content of the `Item`.
170
- * @since 0.0.48
170
+ /**
171
+ * Content of the `Item`.
172
+ * @since 0.0.48
171
173
  */
172
174
  children: PropTypes.node,
173
175
 
174
- /**
175
- * An unique value. It needs only in ItemList with selectable view.
176
- * @since 2.3.0
176
+ /**
177
+ * An unique value. It needs only in ItemList with selectable view.
178
+ * @since 2.3.0
177
179
  */
178
180
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
179
181
 
180
- /**
181
- * Tooltip for component.
182
- * @since 2.5.1
182
+ /**
183
+ * Tooltip for component.
184
+ * @since 2.5.1
183
185
  */
184
186
  tooltip: PropTypes.node,
185
187
 
186
- /**
187
- * @ignore
188
+ /**
189
+ * @ignore
188
190
  */
189
191
  className: PropTypes.string,
190
192
 
191
- /**
192
- * @ignore
193
+ /**
194
+ * @ignore
193
195
  */
194
196
  baseClassName: PropTypes.string,
195
197
 
196
- /**
197
- * Whether disabled or not.
198
- * @since 3.15.0
198
+ /**
199
+ * Whether disabled or not.
200
+ * @since 3.15.0
199
201
  */
200
- disabled: PropTypes.bool
202
+ disabled: PropTypes.bool,
203
+
204
+ /**
205
+ * Add hover shadow and pointer cursor.
206
+ * @since 3.26.0
207
+ */
208
+ hoverable: PropTypes.bool
201
209
  };
202
210
  Item.defaultProps = {
203
211
  component: 'div',
204
212
  view: VIEW_SIMPLE,
213
+ hoverable: undefined,
205
214
  title: undefined,
206
215
  description: undefined,
207
216
  icon: undefined,
@@ -14,6 +14,7 @@ const ItemLink = ({
14
14
  baseClassName = `${CLS_PREFIX}item-link`,
15
15
  className,
16
16
  children,
17
+ hoverable,
17
18
  ...props
18
19
  }) => {
19
20
  if (props.onClick) {
@@ -28,10 +28,10 @@ const getNextSelectedValue = (value, prevValue, toggleable) => {
28
28
  return value;
29
29
  };
30
30
 
31
- /**
32
- * `ItemList` component is used for displaying list of [Items](#!/Item)
33
- * according to [Grid](#!/Grid) principle.
34
- * @since 0.0.48
31
+ /**
32
+ * `ItemList` component is used for displaying list of [Items](#!/Item)
33
+ * according to [Grid](#!/Grid) principle.
34
+ * @since 0.0.48
35
35
  */
36
36
  class ItemList extends Component {
37
37
  constructor(_props) {
@@ -42,7 +42,8 @@ class ItemList extends Component {
42
42
  baseClassName,
43
43
  selectable,
44
44
  onSelect,
45
- reorderable
45
+ reorderable,
46
+ hoverable
46
47
  } = this.props;
47
48
  const classNameList = [`${baseClassName}__item`];
48
49
  const props = {};
@@ -67,6 +68,11 @@ class ItemList extends Component {
67
68
  });
68
69
  safeInvoke(onSelect, nextValue);
69
70
  };
71
+ } // Extends hoverable behavior from the ItemList in case if its child doesn't have its own
72
+
73
+
74
+ if (item.props.hoverable === undefined) {
75
+ props.hoverable = hoverable && this.canManageHoverableState();
70
76
  }
71
77
 
72
78
  if (reorderable) {
@@ -161,18 +167,43 @@ class ItemList extends Component {
161
167
  }));
162
168
  }
163
169
 
164
- hasViewCard() {
165
- const {
166
- children
167
- } = this.props;
170
+ someChild(predicate) {
168
171
  let result = false;
169
- Children.forEach(children, child => {
170
- if (child && child.props && child.props.view === 'card') {
172
+ Children.forEach(this.props.children, child => {
173
+ if (child && predicate(child)) {
171
174
  result = true;
172
175
  }
173
176
  });
174
177
  return result;
175
178
  }
179
+ /**
180
+ * There are some states where we can't manage hoverable state
181
+ */
182
+
183
+
184
+ canManageHoverableState() {
185
+ const {
186
+ reorderable,
187
+ selectable
188
+ } = this.props;
189
+ return !reorderable && !selectable;
190
+ }
191
+
192
+ isHoverable() {
193
+ if (!this.canManageHoverableState()) {
194
+ return false;
195
+ }
196
+
197
+ return this.props.hoverable || this.hasHoverableCard();
198
+ }
199
+
200
+ hasViewCard() {
201
+ return this.someChild(child => child.props && child.props.view === 'card');
202
+ }
203
+
204
+ hasHoverableCard() {
205
+ return this.someChild(child => child.props && !!child.props.hoverable);
206
+ }
176
207
 
177
208
  renderReorderable({
178
209
  baseClassName,
@@ -231,7 +262,7 @@ class ItemList extends Component {
231
262
  } = this.props;
232
263
  return /*#__PURE__*/React.createElement("div", {
233
264
  className: classNames(this.props.baseClassName, {
234
- [`${this.props.baseClassName}--hoverable`]: hoverable && !reorderable && !selectable,
265
+ [`${this.props.baseClassName}--hoverable`]: this.isHoverable(),
235
266
  [`${this.props.baseClassName}--stretchable`]: stretchable,
236
267
  [`${this.props.baseClassName}--selectable`]: selectable,
237
268
  [`${this.props.baseClassName}--cards`]: this.hasViewCard()
@@ -39,7 +39,8 @@ Basic.args = {
39
39
  name: "star-circle-filled",
40
40
  intent: "warning"
41
41
  }),
42
- onClick: () => {}
42
+ onClick: () => {},
43
+ hoverable: true
43
44
  }, 'Content 3'), /*#__PURE__*/React.createElement(Item, {
44
45
  key: "4",
45
46
  value: "4",
@@ -51,7 +52,8 @@ Basic.args = {
51
52
  intent: "danger"
52
53
  }),
53
54
  onClick: () => {},
54
- disabled: true
55
+ disabled: true,
56
+ hoverable: true
55
57
  }, 'Content 4')]
56
58
  };
57
59
  export const Cards = Basic.bind(null);
@@ -71,4 +73,32 @@ export const Selectables = Basic.bind(null);
71
73
  Selectables.args = { ...Basic.args,
72
74
  selectable: true,
73
75
  defaultValue: '2'
76
+ };
77
+ export const HoverableItemList = Basic.bind(null);
78
+ HoverableItemList.args = { ...Basic.args,
79
+ hoverable: true,
80
+ defaultValue: '2',
81
+ children: Basic.args.children.map((child, index) => {
82
+ if (!child) {
83
+ return null;
84
+ }
85
+
86
+ return /*#__PURE__*/cloneElement(child, {
87
+ hoverable: index === 0 ? false : undefined
88
+ });
89
+ })
90
+ };
91
+ export const HoverableItems = Basic.bind(null);
92
+ HoverableItems.args = { ...Basic.args,
93
+ hoverable: false,
94
+ defaultValue: '2',
95
+ children: Basic.args.children.map((child, index) => {
96
+ if (!child) {
97
+ return null;
98
+ }
99
+
100
+ return /*#__PURE__*/cloneElement(child, {
101
+ hoverable: index % 2 === 0
102
+ });
103
+ })
74
104
  };
@@ -8,104 +8,104 @@ import classNames from 'classnames';
8
8
  import { CSSTransition } from 'react-transition-group';
9
9
  import { CLS_PREFIX } from '../../constants';
10
10
  const propTypes = {
11
- /**
12
- * Type of the `Layout`
13
- * @since 1.4.0
11
+ /**
12
+ * Type of the `Layout`
13
+ * @since 1.4.0
14
14
  */
15
15
  type: PropTypes.oneOf(['fluid', 'simplified']),
16
16
 
17
- /**
18
- * Header content.
19
- * @since 1.4.0
17
+ /**
18
+ * Header content.
19
+ * @since 1.4.0
20
20
  */
21
21
  header: PropTypes.node,
22
22
 
23
- /**
24
- * Define header position - always on top (fixed) or static.
25
- * @since 1.4.0
23
+ /**
24
+ * Define header position - always on top (fixed) or static.
25
+ * @since 1.4.0
26
26
  */
27
27
  headerFixed: PropTypes.bool,
28
28
 
29
- /**
30
- * Additional content at the top of the header.
31
- * @since 3.2.0
29
+ /**
30
+ * Additional content at the top of the header.
31
+ * @since 3.2.0
32
32
  */
33
33
  headerAddon: PropTypes.node,
34
34
 
35
- /**
36
- * Sidebar content.
37
- * @since 1.4.0
35
+ /**
36
+ * Sidebar content.
37
+ * @since 1.4.0
38
38
  */
39
39
  sidebar: PropTypes.node,
40
40
 
41
- /**
42
- * Sidebar type.
43
- * @since 3.2.0
41
+ /**
42
+ * Sidebar type.
43
+ * @since 3.2.0
44
44
  */
45
45
  sidebarType: PropTypes.oneOf(['collapsed', 'folded']),
46
46
 
47
- /**
48
- * Define if sidebar can collapse.
49
- * @since 1.4.0
47
+ /**
48
+ * Define if sidebar can collapse.
49
+ * @since 1.4.0
50
50
  */
51
51
  sidebarCollapsible: PropTypes.bool,
52
52
 
53
- /**
54
- * Sidebar collapsed state.
55
- * A boolean value is used for desktop mode only, but you can set an array with collapsed states for all modes, e.g. `['responsive', 'desktop']`.
56
- *
57
- * @since 1.4.0
53
+ /**
54
+ * Sidebar collapsed state.
55
+ * A boolean value is used for desktop mode only, but you can set an array with collapsed states for all modes, e.g. `['responsive', 'desktop']`.
56
+ *
57
+ * @since 1.4.0
58
58
  */
59
59
  sidebarCollapsed: PropTypes.oneOfType([PropTypes.bool, PropTypes.array]),
60
60
 
61
- /**
62
- * Additional content between header and main content.
63
- * @since 1.4.0
61
+ /**
62
+ * Additional content between header and main content.
63
+ * @since 1.4.0
64
64
  */
65
65
  contentAddon: PropTypes.node,
66
66
 
67
- /**
68
- * Content header.
69
- * @since 3.0.0
67
+ /**
68
+ * Content header.
69
+ * @since 3.0.0
70
70
  */
71
71
  contentHeader: PropTypes.node,
72
72
 
73
- /**
74
- * Footer content.
75
- * @since 1.4.0
73
+ /**
74
+ * Footer content.
75
+ * @since 1.4.0
76
76
  */
77
77
  footer: PropTypes.node,
78
78
 
79
- /**
80
- * Main content of the `Layout`.
81
- * @since 1.4.0
79
+ /**
80
+ * Main content of the `Layout`.
81
+ * @since 1.4.0
82
82
  */
83
83
  children: PropTypes.node,
84
84
 
85
- /**
86
- * Width of the content
87
- * @since 3.0.0
85
+ /**
86
+ * Width of the content
87
+ * @since 3.0.0
88
88
  */
89
89
  width: PropTypes.oneOf(['sm', 'md', 'lg']),
90
90
 
91
- /**
92
- * Sidebar onToggle handler.
93
- * The handler is called with two args:
94
- *
95
- * * Whether collapsed or not.
96
- * * In which mode: responsive or desktop.
97
- *
98
- * @since 1.4.0
91
+ /**
92
+ * Sidebar onToggle handler.
93
+ * The handler is called with two args:
94
+ *
95
+ * * Whether collapsed or not.
96
+ * * In which mode: responsive or desktop.
97
+ *
98
+ * @since 1.4.0
99
99
  */
100
100
  onSidebarToggle: PropTypes.func,
101
101
 
102
- /**
103
- * @ignore
102
+ /**
103
+ * @ignore
104
104
  */
105
105
  className: PropTypes.string,
106
106
 
107
- /**
108
- * @ignore
107
+ /**
108
+ * @ignore
109
109
  */
110
110
  baseClassName: PropTypes.string
111
111
  };
@@ -155,8 +155,8 @@ const subscribeClickOutside = (refs, handler) => {
155
155
  document.removeEventListener('touchstart', listener);
156
156
  };
157
157
  };
158
- /**
159
- * @since 1.4.0
158
+ /**
159
+ * @since 1.4.0
160
160
  */
161
161
 
162
162