@plesk/ui-library 3.40.7 → 3.40.9

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 (113) hide show
  1. package/cjs/components/Action/Action.js +1 -1
  2. package/cjs/components/Badge/Badge.js +1 -1
  3. package/cjs/components/Button/Button.js +1 -1
  4. package/cjs/components/Card/Card.js +3 -3
  5. package/cjs/components/CardList/CardListToolbar.js +1 -1
  6. package/cjs/components/CodeEditor/CodeEditor.js +1 -1
  7. package/cjs/components/ComboBox/ComboBox.js +1 -1
  8. package/cjs/components/ComboBoxDropdown/ComboBoxDropdown.js +2 -2
  9. package/cjs/components/Cuttable/Cuttable.js +59 -88
  10. package/cjs/components/Cuttable/useContentOverflow.js +35 -0
  11. package/cjs/components/Dialog/Dialog.js +2 -2
  12. package/cjs/components/Drawer/Drawer.js +1 -1
  13. package/cjs/components/Dropdown/Dropdown.js +1 -1
  14. package/cjs/components/Form/Form.js +1 -1
  15. package/cjs/components/Icon/utils.js +1 -1
  16. package/cjs/components/Item/Item.js +1 -1
  17. package/cjs/components/ItemList/ItemList.js +3 -3
  18. package/cjs/components/Layer/Layer.js +2 -2
  19. package/cjs/components/List/List.js +4 -4
  20. package/cjs/components/List/ListActions.js +2 -2
  21. package/cjs/components/LocaleProvider/LocaleProvider.js +1 -1
  22. package/cjs/components/Media/Media.js +1 -1
  23. package/cjs/components/Menu/Menu.js +1 -1
  24. package/cjs/components/Overlay/Overlay.js +1 -1
  25. package/cjs/components/Progress/Progress.js +1 -1
  26. package/cjs/components/SegmentedControl/ButtonGroupControl.js +65 -0
  27. package/cjs/components/SegmentedControl/DropdownControl.js +46 -0
  28. package/cjs/components/SegmentedControl/SegmentedControl.js +70 -265
  29. package/cjs/components/SegmentedControl/getSelectedValues.js +18 -0
  30. package/cjs/components/SegmentedControl/useResponsive.js +29 -0
  31. package/cjs/components/SegmentedControl/useSelected.js +55 -0
  32. package/cjs/components/Select/Select.js +2 -2
  33. package/cjs/components/Squeezer/Squeezer.js +10 -88
  34. package/cjs/components/Tabs/Tabs.js +1 -1
  35. package/cjs/components/Toaster/Toaster.js +1 -1
  36. package/cjs/components/Toolbar/RegistryContext.js +13 -8
  37. package/cjs/components/Toolbar/ToolbarMenu.js +2 -2
  38. package/cjs/components/Tour/Tour.js +1 -1
  39. package/cjs/components/Translate/isLikeText.js +1 -1
  40. package/cjs/hooks/index.js +7 -0
  41. package/cjs/hooks/useSqueeze.js +2 -1
  42. package/cjs/index.js +1 -1
  43. package/dist/plesk-ui-library-rtl.css +1 -1
  44. package/dist/plesk-ui-library-rtl.css.map +1 -1
  45. package/dist/plesk-ui-library.css +1 -1
  46. package/dist/plesk-ui-library.css.map +1 -1
  47. package/dist/plesk-ui-library.js +519 -500
  48. package/dist/plesk-ui-library.js.map +1 -1
  49. package/dist/plesk-ui-library.min.js +4 -4
  50. package/dist/plesk-ui-library.min.js.map +1 -1
  51. package/esm/components/Action/Action.js +1 -1
  52. package/esm/components/Badge/Badge.js +1 -1
  53. package/esm/components/Button/Button.js +1 -1
  54. package/esm/components/Card/Card.js +3 -3
  55. package/esm/components/CardList/CardListToolbar.js +1 -1
  56. package/esm/components/CodeEditor/CodeEditor.js +1 -1
  57. package/esm/components/ComboBox/ComboBox.js +1 -1
  58. package/esm/components/ComboBoxDropdown/ComboBoxDropdown.js +2 -2
  59. package/esm/components/Cuttable/Cuttable.js +60 -89
  60. package/esm/components/Cuttable/useContentOverflow.js +28 -0
  61. package/esm/components/Dialog/Dialog.js +2 -2
  62. package/esm/components/Drawer/Drawer.js +1 -1
  63. package/esm/components/Dropdown/Dropdown.js +1 -1
  64. package/esm/components/Form/Form.js +1 -1
  65. package/esm/components/Icon/utils.js +1 -1
  66. package/esm/components/Item/Item.js +1 -1
  67. package/esm/components/ItemList/ItemList.js +3 -3
  68. package/esm/components/Layer/Layer.js +2 -2
  69. package/esm/components/List/List.js +4 -4
  70. package/esm/components/List/ListActions.js +2 -2
  71. package/esm/components/LocaleProvider/LocaleProvider.js +1 -1
  72. package/esm/components/Media/Media.js +1 -1
  73. package/esm/components/Menu/Menu.js +1 -1
  74. package/esm/components/Overlay/Overlay.js +1 -1
  75. package/esm/components/Progress/Progress.js +1 -1
  76. package/esm/components/SegmentedControl/ButtonGroupControl.js +58 -0
  77. package/esm/components/SegmentedControl/DropdownControl.js +37 -0
  78. package/esm/components/SegmentedControl/SegmentedControl.js +71 -264
  79. package/esm/components/SegmentedControl/getSelectedValues.js +11 -0
  80. package/esm/components/SegmentedControl/useResponsive.js +21 -0
  81. package/esm/components/SegmentedControl/useSelected.js +48 -0
  82. package/esm/components/Select/Select.js +2 -2
  83. package/esm/components/Squeezer/Squeezer.js +11 -88
  84. package/esm/components/Tabs/Tabs.js +1 -1
  85. package/esm/components/Toaster/Toaster.js +1 -1
  86. package/esm/components/Toolbar/RegistryContext.js +13 -8
  87. package/esm/components/Toolbar/ToolbarMenu.js +2 -2
  88. package/esm/components/Tour/Tour.js +1 -1
  89. package/esm/components/Translate/isLikeText.js +1 -1
  90. package/esm/hooks/index.js +1 -0
  91. package/esm/hooks/useSqueeze.js +2 -1
  92. package/esm/index.js +1 -1
  93. package/package.json +19 -19
  94. package/styleguide/build/bundle.56f21860.js +2 -0
  95. package/styleguide/index.html +2 -2
  96. package/types/src/components/Cuttable/Cuttable.d.ts +3 -25
  97. package/types/src/components/Cuttable/useContentOverflow.d.ts +8 -0
  98. package/types/src/components/List/List.d.ts +1 -0
  99. package/types/src/components/SegmentedControl/ButtonGroupControl.d.ts +12 -0
  100. package/types/src/components/SegmentedControl/DropdownControl.d.ts +8 -0
  101. package/types/src/components/SegmentedControl/SegmentedControl.d.ts +6 -50
  102. package/types/src/components/SegmentedControl/getSelectedValues.d.ts +1 -0
  103. package/types/src/components/SegmentedControl/index.d.ts +1 -1
  104. package/types/src/components/SegmentedControl/types.d.ts +11 -0
  105. package/types/src/components/SegmentedControl/useResponsive.d.ts +6 -0
  106. package/types/src/components/SegmentedControl/useSelected.d.ts +17 -0
  107. package/types/src/components/Squeezer/Squeezer.d.ts +5 -21
  108. package/types/src/components/Toolbar/RegistryContext.d.ts +2 -2
  109. package/types/src/components/index.d.ts +1 -1
  110. package/types/src/hooks/index.d.ts +2 -0
  111. package/types/src/hooks/useSqueeze.d.ts +1 -4
  112. package/styleguide/build/bundle.52d1d9a1.js +0 -2
  113. /package/styleguide/build/{bundle.52d1d9a1.js.LICENSE.txt → bundle.56f21860.js.LICENSE.txt} +0 -0
@@ -36,7 +36,7 @@ const Action = _ref => {
36
36
  size: ICON_SIZE_16
37
37
  });
38
38
  let size = ICON_SIZE_16;
39
- if ( /*#__PURE__*/isValidElement(icon) && icon.props.size) {
39
+ if (/*#__PURE__*/isValidElement(icon) && icon.props.size) {
40
40
  ({
41
41
  size
42
42
  } = icon.props);
@@ -28,7 +28,7 @@ const Badge = _ref => {
28
28
  children: label
29
29
  });
30
30
  }
31
- if ( /*#__PURE__*/isValidElement(label)) {
31
+ if (/*#__PURE__*/isValidElement(label)) {
32
32
  const cloneProps = {
33
33
  className: classNames(`${baseClassName}__value`, {
34
34
  [`${baseClassName}__value--dot`]: isEmpty
@@ -56,7 +56,7 @@ const renderCaret = _ref2 => {
56
56
  } else {
57
57
  caretElement = caret;
58
58
  }
59
- if ( /*#__PURE__*/isValidElement(caretElement)) {
59
+ if (/*#__PURE__*/isValidElement(caretElement)) {
60
60
  caretElement = /*#__PURE__*/cloneElement(caretElement, {
61
61
  className: classNames(`${baseClassName}__caret`, caretElement.props.className)
62
62
  });
@@ -193,13 +193,13 @@ class Card extends Component {
193
193
  const result = [];
194
194
  if (!this.isRow()) {
195
195
  buttons.forEach((btn, index) => {
196
- result.push( /*#__PURE__*/_jsx(CardButton, {
196
+ result.push(/*#__PURE__*/_jsx(CardButton, {
197
197
  ...btn
198
198
  }, btn.key || index));
199
199
  });
200
200
  }
201
201
  if (menu) {
202
- result.push( /*#__PURE__*/_jsx(Dropdown, {
202
+ result.push(/*#__PURE__*/_jsx(Dropdown, {
203
203
  menu: menu,
204
204
  menuPlacement: 'bottom-end',
205
205
  children: /*#__PURE__*/_jsx(CardButton, {
@@ -208,7 +208,7 @@ class Card extends Component {
208
208
  }, "menu"));
209
209
  }
210
210
  if (rowContent && !this.isTile()) {
211
- result.push( /*#__PURE__*/_jsx(CardButton, {
211
+ result.push(/*#__PURE__*/_jsx(CardButton, {
212
212
  icon: {
213
213
  name: 'chevron-down',
214
214
  flipVertical: this.isExtended()
@@ -125,7 +125,7 @@ const CardListToolbar = _ref2 => {
125
125
  if (onViewChange && currentView !== VIEW_RESPONSIVE) {
126
126
  const hasExpander = groups.filter(isToolbarExpander).length > 0;
127
127
  if (!hasExpander) {
128
- toolbar.push( /*#__PURE__*/_jsx(ToolbarExpander, {}, "expander"));
128
+ toolbar.push(/*#__PURE__*/_jsx(ToolbarExpander, {}, "expander"));
129
129
  }
130
130
  toolbar.push(renderView(onViewChange, currentView));
131
131
  }
@@ -81,7 +81,7 @@ class CodeEditor extends Component {
81
81
  };
82
82
  }
83
83
  componentDidMount() {
84
- import( /* webpackChunkName: "codemirror" */'./CodeMirror').then(_ref2 => {
84
+ import(/* webpackChunkName: "codemirror" */'./CodeMirror').then(_ref2 => {
85
85
  let {
86
86
  CodeMirror
87
87
  } = _ref2;
@@ -12,7 +12,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const collect = function (children) {
13
13
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
14
14
  Children.forEach(children, child => {
15
- if ( /*#__PURE__*/isValidElement(child) && child.type === ComboBoxOption) {
15
+ if (/*#__PURE__*/isValidElement(child) && child.type === ComboBoxOption) {
16
16
  // eslint-disable-next-line prefer-const
17
17
  let {
18
18
  disabled,
@@ -113,7 +113,7 @@ const ComboBoxDropdown = _ref => {
113
113
  className: `${baseClassName}__menu`,
114
114
  children: [groups.reduce((acc, group) => {
115
115
  if (group.label) {
116
- acc.push( /*#__PURE__*/_createElement(MenuHeader, {
116
+ acc.push(/*#__PURE__*/_createElement(MenuHeader, {
117
117
  ...group.props,
118
118
  key: `group_${group.label}`
119
119
  }, group.label));
@@ -148,7 +148,7 @@ const ComboBoxDropdown = _ref => {
148
148
  onMouseDown,
149
149
  'data-index': optionIndex
150
150
  };
151
- acc.push( /*#__PURE__*/_jsx(MenuItem, {
151
+ acc.push(/*#__PURE__*/_jsx(MenuItem, {
152
152
  ...menuItemProps,
153
153
  children: option.children
154
154
  }, `option_${option.value}`));
@@ -1,103 +1,74 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
1
  // Copyright 1999-2023. Plesk International GmbH. All rights reserved.
3
2
 
4
- import { Component, createRef } from 'react';
3
+ import { useRef, useState } from 'react';
5
4
  import classNames from 'classnames';
6
- import Measure from 'react-measure';
7
5
  import { CLS_PREFIX } from '../../constants';
8
6
  import Translate from '../Translate';
9
7
  import Link from '../Link';
8
+ import { useContentOverflow } from './useContentOverflow';
10
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
10
  /**
12
11
  * `Cuttable` component is used for showing and hiding part of content.
13
12
  * @since 0.0.42
14
13
  */
15
- class Cuttable extends Component {
16
- constructor() {
17
- super(...arguments);
18
- _defineProperty(this, "state", {
19
- collapsed: undefined,
20
- autofit: true
21
- });
22
- _defineProperty(this, "contentRef", /*#__PURE__*/createRef());
23
- _defineProperty(this, "handleToggle", () => {
24
- this.setState(_ref => {
25
- let {
26
- collapsed
27
- } = _ref;
28
- return {
29
- collapsed: !collapsed,
30
- autofit: false
31
- };
32
- });
33
- });
34
- _defineProperty(this, "handleResize", () => {
35
- if (!this.state.autofit) {
36
- return;
37
- }
38
- const content = this.contentRef.current;
39
- if (content && content.scrollHeight > content.clientHeight) {
40
- this.setState({
41
- collapsed: this.props.collapsed
42
- });
43
- }
44
- });
14
+ const Cuttable = _ref => {
15
+ let {
16
+ children,
17
+ collapsed: externalCollapsed = true,
18
+ maxHeight = '7rem',
19
+ locale = {
20
+ showMore: 'Show more',
21
+ showLess: 'Show less'
22
+ },
23
+ className,
24
+ baseClassName = `${CLS_PREFIX}cuttable`,
25
+ ...props
26
+ } = _ref;
27
+ const contentRef = useRef(null);
28
+ const hiddenElementRef = useRef(null);
29
+ const [collapsed, setCollapsed] = useState(externalCollapsed);
30
+ const [prevExternalCollapsed, setPrevExternalCollapsed] = useState(externalCollapsed);
31
+ if (prevExternalCollapsed !== externalCollapsed) {
32
+ setPrevExternalCollapsed(externalCollapsed);
33
+ setCollapsed(externalCollapsed);
45
34
  }
46
- render() {
47
- const {
48
- baseClassName,
49
- className,
50
- children,
51
- collapsed,
52
- maxHeight,
53
- locale,
54
- ...props
55
- } = this.props;
56
- const showMoreLessKey = this.state.collapsed ? 'showMore' : 'showLess';
57
- return /*#__PURE__*/_jsxs("div", {
58
- className: classNames(baseClassName, {
59
- [`${baseClassName}--collapse`]: this.state.collapsed === true,
60
- [`${baseClassName}--expand`]: this.state.collapsed === false
61
- }, className),
62
- ...props,
63
- children: [/*#__PURE__*/_jsx(Measure, {
64
- onResize: this.handleResize,
65
- innerRef: el => {
66
- this.contentRef.current = el;
67
- },
68
- children: _ref2 => {
69
- let {
70
- measureRef
71
- } = _ref2;
72
- return /*#__PURE__*/_jsx("div", {
73
- className: `${baseClassName}__content`,
74
- style: {
75
- maxHeight
76
- },
77
- ref: measureRef,
78
- children: children
79
- });
80
- }
81
- }), this.state.collapsed !== undefined && /*#__PURE__*/_jsx("div", {
82
- className: `${baseClassName}__action`,
83
- children: /*#__PURE__*/_jsx(Link, {
84
- onClick: this.handleToggle,
85
- children: /*#__PURE__*/_jsx(Translate, {
86
- content: `Cuttable.${showMoreLessKey}`,
87
- fallback: locale[showMoreLessKey]
88
- })
35
+ const actionLocaleKey = collapsed ? 'showMore' : 'showLess';
36
+ const isContentOverflowing = useContentOverflow({
37
+ contentRef,
38
+ hiddenElementRef,
39
+ maxHeight
40
+ });
41
+ const toggle = () => setCollapsed(!collapsed);
42
+ return /*#__PURE__*/_jsxs("div", {
43
+ className: classNames(baseClassName, {
44
+ [`${baseClassName}--collapse`]: collapsed,
45
+ [`${baseClassName}--expand`]: !collapsed
46
+ }, className),
47
+ ...props,
48
+ children: [/*#__PURE__*/_jsx("div", {
49
+ ref: contentRef,
50
+ className: `${baseClassName}__content`,
51
+ style: {
52
+ maxHeight
53
+ },
54
+ children: children
55
+ }), /*#__PURE__*/_jsx("div", {
56
+ ref: hiddenElementRef,
57
+ className: `${baseClassName}__height-meter `,
58
+ style: {
59
+ height: maxHeight
60
+ },
61
+ "aria-hidden": true
62
+ }), isContentOverflowing && /*#__PURE__*/_jsx("div", {
63
+ className: `${baseClassName}__action`,
64
+ children: /*#__PURE__*/_jsx(Link, {
65
+ onClick: toggle,
66
+ children: /*#__PURE__*/_jsx(Translate, {
67
+ content: `Cuttable.${actionLocaleKey}`,
68
+ fallback: locale[actionLocaleKey]
89
69
  })
90
- })]
91
- });
92
- }
93
- }
94
- _defineProperty(Cuttable, "defaultProps", {
95
- collapsed: true,
96
- maxHeight: '7rem',
97
- locale: {
98
- showMore: 'Show more',
99
- showLess: 'Show less'
100
- },
101
- baseClassName: `${CLS_PREFIX}cuttable`
102
- });
70
+ })
71
+ })]
72
+ });
73
+ };
103
74
  export default Cuttable;
@@ -0,0 +1,28 @@
1
+ // Copyright 1999-2023. Plesk International GmbH. All rights reserved.
2
+
3
+ import { useLayoutEffect, useRef, useState } from 'react';
4
+ import { useResizeObserver } from '../../hooks';
5
+ export const useContentOverflow = _ref => {
6
+ let {
7
+ contentRef,
8
+ hiddenElementRef,
9
+ maxHeight
10
+ } = _ref;
11
+ const [isOverflowing, setIsOverflowing] = useState(false);
12
+ const checkHeight = () => {
13
+ const contentElement = contentRef.current;
14
+ const hiddenElement = hiddenElementRef.current;
15
+ if (!contentElement || !hiddenElement) return;
16
+ setIsOverflowing(contentElement.scrollHeight > hiddenElement.getBoundingClientRect().height);
17
+ };
18
+ const checkHeightRef = useRef(checkHeight);
19
+ checkHeightRef.current = checkHeight;
20
+ useLayoutEffect(() => {
21
+ checkHeightRef.current();
22
+ }, [maxHeight]);
23
+ useResizeObserver({
24
+ ref: contentRef,
25
+ onResize: checkHeight
26
+ });
27
+ return isOverflowing;
28
+ };
@@ -56,7 +56,7 @@ const Dialog = _ref => {
56
56
  }, [isOpen]);
57
57
  const renderImage = (image, block) => {
58
58
  const classPrefix = `${baseClassName}__${block}`;
59
- if ( /*#__PURE__*/isValidElement(image)) {
59
+ if (/*#__PURE__*/isValidElement(image)) {
60
60
  return /*#__PURE__*/_jsx("div", {
61
61
  className: classPrefix,
62
62
  children: image
@@ -131,7 +131,7 @@ const Dialog = _ref => {
131
131
  };
132
132
  let childrenElement;
133
133
  if (form) {
134
- if ( /*#__PURE__*/isValidElement(form)) {
134
+ if (/*#__PURE__*/isValidElement(form)) {
135
135
  childrenElement = /*#__PURE__*/cloneElement(form, {
136
136
  cancelButton: getCancelButtonProps(form.props),
137
137
  footerClassName: classNames(form.props.footerClassName, `${baseClassName}__form-footer`)
@@ -68,7 +68,7 @@ const Drawer = _ref => {
68
68
  });
69
69
  }
70
70
  if (form) {
71
- if ( /*#__PURE__*/isValidElement(form)) {
71
+ if (/*#__PURE__*/isValidElement(form)) {
72
72
  return /*#__PURE__*/cloneElement(form, {
73
73
  className: classNames(`${baseClassName}__form`, form.props.className),
74
74
  cancelButton: form.props.cancelButton === false ? false : {
@@ -18,7 +18,7 @@ const createTarget = (node, _ref) => {
18
18
  onToggle,
19
19
  targetRef
20
20
  } = _ref;
21
- if (!( /*#__PURE__*/isValidElement(node) && node.type !== Translate)) {
21
+ if (!(/*#__PURE__*/isValidElement(node) && node.type !== Translate)) {
22
22
  node = /*#__PURE__*/_jsx(Button, {
23
23
  caret: true,
24
24
  children: node
@@ -340,7 +340,7 @@ class Form extends Component {
340
340
  } = this.props;
341
341
  if (Array.isArray(additionalButtons)) {
342
342
  return additionalButtons.map(element => {
343
- if ( /*#__PURE__*/isValidElement(element)) {
343
+ if (/*#__PURE__*/isValidElement(element)) {
344
344
  const props = {
345
345
  className: classNames(element.props.className, `${baseClassName}__additional-button`)
346
346
  };
@@ -9,7 +9,7 @@ export const create = function (icon) {
9
9
  if (!icon) {
10
10
  return icon;
11
11
  }
12
- if ( /*#__PURE__*/isValidElement(icon)) {
12
+ if (/*#__PURE__*/isValidElement(icon)) {
13
13
  const {
14
14
  className,
15
15
  ...props
@@ -54,7 +54,7 @@ const Item = _ref => {
54
54
  children: title
55
55
  });
56
56
  }
57
- if ( /*#__PURE__*/isValidElement(title)) {
57
+ if (/*#__PURE__*/isValidElement(title)) {
58
58
  title = /*#__PURE__*/cloneElement(title, {
59
59
  className: classNames(`${baseClassName}__title`, title.props.className)
60
60
  });
@@ -119,7 +119,7 @@ class ItemList extends Component {
119
119
  } = this.props;
120
120
  if (reorderable) {
121
121
  // @ts-ignore
122
- import( /* webpackChunkName: "react-sortable-hoc" */'react-sortable-hoc').then(_ref2 => {
122
+ import(/* webpackChunkName: "react-sortable-hoc" */'react-sortable-hoc').then(_ref2 => {
123
123
  let {
124
124
  sortableContainer,
125
125
  sortableElement
@@ -141,7 +141,7 @@ class ItemList extends Component {
141
141
  return /*#__PURE__*/_jsx(Grid, {
142
142
  ...props,
143
143
  children: Children.map(children, child => {
144
- if ( /*#__PURE__*/isValidElement(child)) {
144
+ if (/*#__PURE__*/isValidElement(child)) {
145
145
  return /*#__PURE__*/_jsx(GridCol, {
146
146
  className: classNames(`${baseClassName}__col`),
147
147
  children: /*#__PURE__*/cloneElement(child, this.createItemProps(child))
@@ -210,7 +210,7 @@ class ItemList extends Component {
210
210
  onSortEnd: onReorderEnd,
211
211
  ...props,
212
212
  children: Children.map(children, (child, index) => {
213
- if ( /*#__PURE__*/isValidElement(child)) {
213
+ if (/*#__PURE__*/isValidElement(child)) {
214
214
  const {
215
215
  disabled
216
216
  } = child.props;
@@ -22,7 +22,7 @@ const Layer = _ref => {
22
22
  const parentLevel = useContext(LevelContext);
23
23
  const container = useContext(PortalContext) || document.body;
24
24
  const renderChildren = () => {
25
- if ( /*#__PURE__*/isValidElement(children)) {
25
+ if (/*#__PURE__*/isValidElement(children)) {
26
26
  return /*#__PURE__*/cloneElement(children, {
27
27
  style: {
28
28
  ...children.props.style,
@@ -32,7 +32,7 @@ const Layer = _ref => {
32
32
  }
33
33
  return children;
34
34
  };
35
- return /*#__PURE__*/createPortal( /*#__PURE__*/_jsx(LevelContext.Provider, {
35
+ return /*#__PURE__*/createPortal(/*#__PURE__*/_jsx(LevelContext.Provider, {
36
36
  value: parentLevel + level,
37
37
  children: /*#__PURE__*/_jsx("div", {
38
38
  className: classNames(baseClassName, className),
@@ -72,7 +72,7 @@ const getHumanTotalRows = _ref2 => {
72
72
  });
73
73
  switch (mode) {
74
74
  case 'totalRows':
75
- return wrapToText( /*#__PURE__*/_jsx(Translate, {
75
+ return wrapToText(/*#__PURE__*/_jsx(Translate, {
76
76
  namespace: "List",
77
77
  content: "totalRows",
78
78
  fallback: "%%totalRows%% items total",
@@ -82,7 +82,7 @@ const getHumanTotalRows = _ref2 => {
82
82
  translators: translators
83
83
  }));
84
84
  case 'selectedRows':
85
- return wrapToText( /*#__PURE__*/_jsx(Translate, {
85
+ return wrapToText(/*#__PURE__*/_jsx(Translate, {
86
86
  namespace: "List",
87
87
  content: "selectedRows",
88
88
  fallback: "%%selectedRows%% of %%totalRows%% items selected",
@@ -96,7 +96,7 @@ const getHumanTotalRows = _ref2 => {
96
96
  translators: translators
97
97
  }));
98
98
  case 'selectedAllRows':
99
- return wrapToText( /*#__PURE__*/_jsx(Translate, {
99
+ return wrapToText(/*#__PURE__*/_jsx(Translate, {
100
100
  namespace: "List",
101
101
  content: "selectedRows",
102
102
  fallback: "%%selectedRows%% of %%totalRows%% items selected",
@@ -382,7 +382,7 @@ class List extends Component {
382
382
  }
383
383
  }
384
384
  applyReorderableList() {
385
- import( /* webpackChunkName: "react-movable" */'@plesk/react-movable').then(_ref6 => {
385
+ import(/* webpackChunkName: "react-movable" */'@plesk/react-movable').then(_ref6 => {
386
386
  let {
387
387
  List: ReorderableList
388
388
  } = _ref6;
@@ -41,7 +41,7 @@ const ListActions = _ref => {
41
41
  const secondaryItems = [];
42
42
  let secondaryCount = 0;
43
43
  Children.toArray(children).forEach((node, index) => {
44
- if ( /*#__PURE__*/isValidElement(node) && node.type === ListAction) {
44
+ if (/*#__PURE__*/isValidElement(node) && node.type === ListAction) {
45
45
  const {
46
46
  primary,
47
47
  hidden
@@ -54,7 +54,7 @@ const ListActions = _ref => {
54
54
  } else {
55
55
  secondaryCount++;
56
56
  if (!hidden) {
57
- secondaryItems.push( /*#__PURE__*/cloneElement(node, {
57
+ secondaryItems.push(/*#__PURE__*/cloneElement(node, {
58
58
  primary: false
59
59
  }));
60
60
  }
@@ -20,7 +20,7 @@ const applyParams = function (message) {
20
20
  if (param === undefined) {
21
21
  result.push(m[0]);
22
22
  } else if (typeof param === 'object' && /*#__PURE__*/isValidElement(param)) {
23
- result.push( /*#__PURE__*/cloneElement(param, {
23
+ result.push(/*#__PURE__*/cloneElement(param, {
24
24
  key: m[1]
25
25
  }));
26
26
  hasElements = true;
@@ -52,7 +52,7 @@ const Media = _ref => {
52
52
  children: title
53
53
  });
54
54
  }
55
- if ( /*#__PURE__*/isValidElement(title)) {
55
+ if (/*#__PURE__*/isValidElement(title)) {
56
56
  return /*#__PURE__*/cloneElement(title, {
57
57
  className: classNames(`${baseClassName}__title`, title.props.className)
58
58
  });
@@ -10,7 +10,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
10
10
  const hasIconItem = children => {
11
11
  let result = false;
12
12
  Children.forEach(children, child => {
13
- if ( /*#__PURE__*/isValidElement(child) && (child.type === MenuSelectableItem || child.props.icon)) {
13
+ if (/*#__PURE__*/isValidElement(child) && (child.type === MenuSelectableItem || child.props.icon)) {
14
14
  result = true;
15
15
  }
16
16
  });
@@ -68,7 +68,7 @@ const OverlayCore = _ref => {
68
68
  const renderImage = sideBanner => {
69
69
  const classPrefix = `${baseClassName}__side`;
70
70
  let element = null;
71
- if ( /*#__PURE__*/isValidElement(sideBanner)) {
71
+ if (/*#__PURE__*/isValidElement(sideBanner)) {
72
72
  element = sideBanner;
73
73
  } else if (typeof sideBanner === 'string') {
74
74
  element = /*#__PURE__*/_jsx("img", {
@@ -28,7 +28,7 @@ class Progress extends Component {
28
28
  let isFailed = false;
29
29
  if (children) {
30
30
  Children.forEach(children, child => {
31
- if ( /*#__PURE__*/isValidElement(child)) {
31
+ if (/*#__PURE__*/isValidElement(child)) {
32
32
  const status = child.props.status ?? PROGRESS_STEP_DEFAULT_STATUS;
33
33
  isNotStarted = isNotStarted && status === STATUS_NOT_STARTED;
34
34
  isFinished = isFinished && status === STATUS_DONE;
@@ -0,0 +1,58 @@
1
+ // Copyright 1999-2023. Plesk International GmbH. All rights reserved.
2
+
3
+ import { useState, useLayoutEffect, useRef } from 'react';
4
+ import classNames from 'classnames';
5
+ import Button from '../Button';
6
+ import ButtonGroup from '../ButtonGroup';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ const ButtonGroupControl = _ref => {
9
+ let {
10
+ buttons,
11
+ selectedValues,
12
+ onClick,
13
+ ghost,
14
+ monospaced,
15
+ isResponsive,
16
+ baseClassName
17
+ } = _ref;
18
+ const buttonsRef = useRef([]);
19
+ const [monoWidth, setMonoWidth] = useState(0);
20
+ useLayoutEffect(() => {
21
+ if (!monospaced) return;
22
+ const widths = buttonsRef.current.map(button => button.getBoundingClientRect().width);
23
+ const maxWidth = Math.max(...widths);
24
+ if (monoWidth !== maxWidth) {
25
+ setMonoWidth(maxWidth);
26
+ }
27
+ }, [monospaced, monoWidth]);
28
+ return /*#__PURE__*/_jsx(ButtonGroup, {
29
+ className: `${baseClassName}__button-group`,
30
+ children: buttons.map((_ref2, index) => {
31
+ let {
32
+ value,
33
+ title,
34
+ style = {},
35
+ ...buttonProps
36
+ } = _ref2;
37
+ const shouldApplyMonoWidth = !isResponsive && monospaced && monoWidth;
38
+ const buttonStyle = {
39
+ width: shouldApplyMonoWidth ? monoWidth : style.width,
40
+ ...style
41
+ };
42
+ return /*#__PURE__*/_jsx(Button, {
43
+ ref: node => {
44
+ index === 0 && (buttonsRef.current = []);
45
+ node && buttonsRef.current.push(node);
46
+ },
47
+ selected: selectedValues.includes(value),
48
+ ghost: ghost,
49
+ onClick: () => onClick(value),
50
+ ...buttonProps,
51
+ className: classNames(buttonProps.className, `${baseClassName}__button`),
52
+ style: buttonStyle,
53
+ children: title
54
+ }, `${value}`);
55
+ })
56
+ });
57
+ };
58
+ export default ButtonGroupControl;
@@ -0,0 +1,37 @@
1
+ // Copyright 1999-2023. Plesk International GmbH. All rights reserved.
2
+
3
+ import Dropdown from '../Dropdown';
4
+ import Menu, { MenuItem } from '../Menu';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const DropdownControl = _ref => {
7
+ let {
8
+ buttons,
9
+ selected,
10
+ onClick
11
+ } = _ref;
12
+ const {
13
+ title = ''
14
+ } = buttons.find(button => button.value === selected) || {};
15
+ const menu = /*#__PURE__*/_jsx(Menu, {
16
+ children: buttons.map(_ref2 => {
17
+ let {
18
+ title,
19
+ value,
20
+ ...buttonProps
21
+ } = _ref2;
22
+ const handleClick = () => {
23
+ onClick(value);
24
+ };
25
+ return /*#__PURE__*/_jsx(MenuItem, {
26
+ ...buttonProps,
27
+ onClick: handleClick,
28
+ children: title
29
+ }, `${value}`);
30
+ })
31
+ });
32
+ return /*#__PURE__*/_jsx(Dropdown, {
33
+ menu: menu,
34
+ children: title
35
+ });
36
+ };
37
+ export default DropdownControl;