@plesk/ui-library 3.40.6 → 3.40.7
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/cjs/components/Badge/Badge.js +2 -2
- package/cjs/components/SegmentedControl/SegmentedControl.js +12 -10
- package/cjs/components/Subnav/Subnav.js +1 -1
- package/cjs/components/Toolbar/RegistryContext.js +90 -31
- package/cjs/components/Toolbar/Toolbar.js +5 -80
- package/cjs/components/Toolbar/ToolbarGroup.js +6 -159
- package/cjs/components/Toolbar/ToolbarItem.js +15 -59
- package/cjs/index.js +1 -1
- package/dist/plesk-ui-library-rtl.css +1 -1
- package/dist/plesk-ui-library-rtl.css.map +1 -1
- package/dist/plesk-ui-library.css +1 -1
- package/dist/plesk-ui-library.css.map +1 -1
- package/dist/plesk-ui-library.js +48 -379
- package/dist/plesk-ui-library.js.map +1 -1
- package/dist/plesk-ui-library.min.js +6 -6
- package/dist/plesk-ui-library.min.js.map +1 -1
- package/esm/components/Badge/Badge.js +2 -2
- package/esm/components/SegmentedControl/SegmentedControl.js +12 -10
- package/esm/components/Subnav/Subnav.js +1 -1
- package/esm/components/Toolbar/RegistryContext.js +87 -30
- package/esm/components/Toolbar/Toolbar.js +7 -82
- package/esm/components/Toolbar/ToolbarGroup.js +7 -160
- package/esm/components/Toolbar/ToolbarItem.js +15 -59
- package/esm/index.js +1 -1
- package/package.json +20 -22
- package/styleguide/build/bundle.52d1d9a1.js +2 -0
- package/styleguide/index.html +2 -2
- package/types/src/components/Toolbar/RegistryContext.d.ts +22 -13
- package/types/src/components/Toolbar/Toolbar.d.ts +8 -8
- package/types/src/components/Toolbar/ToolbarGroup.d.ts +6 -16
- package/types/src/components/Toolbar/ToolbarItem.d.ts +1 -1
- package/cjs/components/Toolbar/RegistryContextBeta.js +0 -112
- package/esm/components/Toolbar/RegistryContextBeta.js +0 -103
- package/styleguide/build/bundle.9eeb2c9d.js +0 -2
- package/types/src/components/Toolbar/RegistryContextBeta.d.ts +0 -25
- /package/styleguide/build/{bundle.9eeb2c9d.js.LICENSE.txt → bundle.52d1d9a1.js.LICENSE.txt} +0 -0
package/styleguide/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
7
|
-
<title>Plesk UI Library 3.40.
|
|
7
|
+
<title>Plesk UI Library 3.40.7</title>
|
|
8
8
|
<meta name="msapplication-TileColor" content="#da532c">
|
|
9
9
|
<meta name="theme-color" content="#ffffff">
|
|
10
10
|
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KWST26V"
|
|
27
27
|
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|
28
28
|
<!-- End Google Tag Manager (noscript) -->
|
|
29
|
-
<script src="build/bundle.
|
|
29
|
+
<script src="build/bundle.52d1d9a1.js"></script>
|
|
30
30
|
</body>
|
|
31
31
|
</html>
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export type RegistryItem = {
|
|
3
|
-
setCompact: (compact: boolean) => void;
|
|
4
|
-
isCompact: (one: boolean) => boolean;
|
|
5
|
-
};
|
|
6
|
-
export type Registry = {
|
|
7
|
-
stack: RegistryItem[];
|
|
8
|
-
register: (item: RegistryItem) => void;
|
|
9
|
-
unregister: (item: RegistryItem) => void;
|
|
10
|
-
compact: () => boolean;
|
|
11
|
-
uncompact: () => boolean;
|
|
12
|
-
isCompact: (one: boolean) => boolean;
|
|
13
|
-
};
|
|
14
2
|
declare const RegistryContext: import("react").Context<Registry | undefined>;
|
|
15
3
|
export default RegistryContext;
|
|
16
|
-
|
|
4
|
+
declare class Registry {
|
|
5
|
+
private items;
|
|
6
|
+
register(item: RegistryItem | Registry): void;
|
|
7
|
+
unregister(item: RegistryItem | Registry): void;
|
|
8
|
+
compact(): boolean;
|
|
9
|
+
expand(): boolean;
|
|
10
|
+
get isCompact(): boolean;
|
|
11
|
+
get hasCompactItems(): boolean;
|
|
12
|
+
private checkItemIsCompactOrHasCompactItems;
|
|
13
|
+
}
|
|
14
|
+
declare class RegistryItem {
|
|
15
|
+
private _isCompact;
|
|
16
|
+
private readonly onCompactStateChange;
|
|
17
|
+
constructor({ onCompactStateChange }: {
|
|
18
|
+
onCompactStateChange: (state: boolean) => void;
|
|
19
|
+
});
|
|
20
|
+
compact(): void;
|
|
21
|
+
expand(): void;
|
|
22
|
+
get isCompact(): boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare const useRegistry: () => Registry;
|
|
25
|
+
export declare const useRegistryItem: () => boolean[];
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import '../../helpers/base.less';
|
|
3
3
|
import './Toolbar.less';
|
|
4
|
-
/**
|
|
5
|
-
* `Toolbar` component is a panel containing various instruments used for managing the contents of a large content block.
|
|
6
|
-
* Toolbar is located on top of the managed content block.
|
|
7
|
-
* It typically consists of three main parts: controls that add new elements, controls that work with existing elements,
|
|
8
|
-
* and controls for changing the way the content block looks.
|
|
9
|
-
* @since 0.0.57
|
|
10
|
-
*/
|
|
11
4
|
export interface ToolbarProps {
|
|
12
5
|
/**
|
|
13
6
|
* Content of the `Toolbar`.
|
|
@@ -23,5 +16,12 @@ export interface ToolbarProps {
|
|
|
23
16
|
*/
|
|
24
17
|
baseClassName?: string;
|
|
25
18
|
}
|
|
26
|
-
|
|
19
|
+
/**
|
|
20
|
+
* `Toolbar` component is a panel containing various instruments used for managing the contents of a large content block.
|
|
21
|
+
* Toolbar is located on top of the managed content block.
|
|
22
|
+
* It typically consists of three main parts: controls that add new elements, controls that work with existing elements,
|
|
23
|
+
* and controls for changing the way the content block looks.
|
|
24
|
+
* @since 0.0.57
|
|
25
|
+
*/
|
|
26
|
+
declare const Toolbar: ({ children, className, baseClassName, ...props }: ToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
export default Toolbar;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { ReactNode, ReactChild } from 'react';
|
|
2
|
-
import { Registry } from './RegistryContext';
|
|
3
|
-
import { DistractionFreeMode } from '../DistractionFreeModeContext';
|
|
4
|
-
/**
|
|
5
|
-
* `ToolbarGroup` is a part of [Toolbar](#!/Toolbar) component.
|
|
6
|
-
* It is used for grouping several toolbar controls together.
|
|
7
|
-
* @since 0.0.57
|
|
8
|
-
*/
|
|
9
2
|
export interface ToolbarGroupProps {
|
|
10
3
|
/**
|
|
11
4
|
* Title.
|
|
@@ -30,14 +23,11 @@ export interface ToolbarGroupProps {
|
|
|
30
23
|
* @ignore
|
|
31
24
|
*/
|
|
32
25
|
baseClassName?: string;
|
|
33
|
-
/**
|
|
34
|
-
* @ignore
|
|
35
|
-
*/
|
|
36
|
-
registry: Registry;
|
|
37
|
-
/**
|
|
38
|
-
* @ignore
|
|
39
|
-
*/
|
|
40
|
-
distractionFreeMode: DistractionFreeMode;
|
|
41
26
|
}
|
|
42
|
-
|
|
27
|
+
/**
|
|
28
|
+
* `ToolbarGroup` is a part of [Toolbar](#!/Toolbar) component.
|
|
29
|
+
* It is used for grouping several toolbar controls together.
|
|
30
|
+
* @since 0.0.57
|
|
31
|
+
*/
|
|
32
|
+
declare const ToolbarGroup: ({ baseClassName, className, title, children, groupable, ...props }: Omit<ToolbarGroupProps, 'distractionFreeMode' | 'registry'>) => import("react/jsx-runtime").JSX.Element | null;
|
|
43
33
|
export default ToolbarGroup;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export declare const toToolbarItems: (children: ReactNode
|
|
2
|
+
export declare const toToolbarItems: (children: ReactNode) => (string | number | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode>)[] | null | undefined;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.useRegistryItem = exports.useRegistry = exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
11
|
-
|
|
12
|
-
const RegistryContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
13
|
-
RegistryContext.displayName = 'RegistryContext';
|
|
14
|
-
const useRegistryContext = () => (0, _react.useContext)(RegistryContext);
|
|
15
|
-
var _default = exports.default = RegistryContext;
|
|
16
|
-
class Registry {
|
|
17
|
-
constructor() {
|
|
18
|
-
(0, _defineProperty2.default)(this, "items", []);
|
|
19
|
-
}
|
|
20
|
-
register(item) {
|
|
21
|
-
this.items.push(item);
|
|
22
|
-
}
|
|
23
|
-
unregister(item) {
|
|
24
|
-
this.items = this.items.filter(i => i !== item);
|
|
25
|
-
}
|
|
26
|
-
compact() {
|
|
27
|
-
let changed = false;
|
|
28
|
-
for (const item of [...this.items].reverse()) {
|
|
29
|
-
if (!item.isCompact) {
|
|
30
|
-
item.compact();
|
|
31
|
-
changed = true;
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return changed;
|
|
36
|
-
}
|
|
37
|
-
expand() {
|
|
38
|
-
let changed = false;
|
|
39
|
-
for (const item of this.items) {
|
|
40
|
-
if (this.checkItemIsCompactOrHasCompactItems(item)) {
|
|
41
|
-
item.expand();
|
|
42
|
-
changed = true;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return changed;
|
|
47
|
-
}
|
|
48
|
-
get isCompact() {
|
|
49
|
-
return this.items.every(_ref => {
|
|
50
|
-
let {
|
|
51
|
-
isCompact
|
|
52
|
-
} = _ref;
|
|
53
|
-
return isCompact;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
get hasCompactItems() {
|
|
57
|
-
return this.items.some(this.checkItemIsCompactOrHasCompactItems);
|
|
58
|
-
}
|
|
59
|
-
checkItemIsCompactOrHasCompactItems(item) {
|
|
60
|
-
return item.isCompact || 'hasCompactItems' in item && item.hasCompactItems;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
class RegistryItem {
|
|
64
|
-
constructor(_ref2) {
|
|
65
|
-
let {
|
|
66
|
-
onCompactStateChange
|
|
67
|
-
} = _ref2;
|
|
68
|
-
(0, _defineProperty2.default)(this, "_isCompact", false);
|
|
69
|
-
(0, _defineProperty2.default)(this, "onCompactStateChange", void 0);
|
|
70
|
-
this.onCompactStateChange = onCompactStateChange;
|
|
71
|
-
}
|
|
72
|
-
compact() {
|
|
73
|
-
this._isCompact = true;
|
|
74
|
-
this.onCompactStateChange(true);
|
|
75
|
-
}
|
|
76
|
-
expand() {
|
|
77
|
-
this._isCompact = false;
|
|
78
|
-
this.onCompactStateChange(false);
|
|
79
|
-
}
|
|
80
|
-
get isCompact() {
|
|
81
|
-
return this._isCompact;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
const useRegistry = () => {
|
|
85
|
-
const parentRegistry = useRegistryContext();
|
|
86
|
-
const [registry] = (0, _react.useState)(() => new Registry());
|
|
87
|
-
(0, _react.useLayoutEffect)(() => {
|
|
88
|
-
if (!parentRegistry) return undefined;
|
|
89
|
-
parentRegistry.register(registry);
|
|
90
|
-
return () => {
|
|
91
|
-
parentRegistry.unregister(registry);
|
|
92
|
-
};
|
|
93
|
-
}, [parentRegistry, registry]);
|
|
94
|
-
return registry;
|
|
95
|
-
};
|
|
96
|
-
exports.useRegistry = useRegistry;
|
|
97
|
-
const useRegistryItem = () => {
|
|
98
|
-
const registry = useRegistryContext();
|
|
99
|
-
const [isCompact, setIsCompact] = (0, _react.useState)(false);
|
|
100
|
-
const [registryItem] = (0, _react.useState)(() => new RegistryItem({
|
|
101
|
-
onCompactStateChange: setIsCompact
|
|
102
|
-
}));
|
|
103
|
-
(0, _react.useLayoutEffect)(() => {
|
|
104
|
-
if (!registry) return undefined;
|
|
105
|
-
registry.register(registryItem);
|
|
106
|
-
return () => {
|
|
107
|
-
registry.unregister(registryItem);
|
|
108
|
-
};
|
|
109
|
-
}, [registry, registryItem]);
|
|
110
|
-
return [isCompact];
|
|
111
|
-
};
|
|
112
|
-
exports.useRegistryItem = useRegistryItem;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
3
|
-
|
|
4
|
-
import { createContext, useContext, useState, useLayoutEffect } from 'react';
|
|
5
|
-
const RegistryContext = /*#__PURE__*/createContext(undefined);
|
|
6
|
-
RegistryContext.displayName = 'RegistryContext';
|
|
7
|
-
const useRegistryContext = () => useContext(RegistryContext);
|
|
8
|
-
export default RegistryContext;
|
|
9
|
-
class Registry {
|
|
10
|
-
constructor() {
|
|
11
|
-
_defineProperty(this, "items", []);
|
|
12
|
-
}
|
|
13
|
-
register(item) {
|
|
14
|
-
this.items.push(item);
|
|
15
|
-
}
|
|
16
|
-
unregister(item) {
|
|
17
|
-
this.items = this.items.filter(i => i !== item);
|
|
18
|
-
}
|
|
19
|
-
compact() {
|
|
20
|
-
let changed = false;
|
|
21
|
-
for (const item of [...this.items].reverse()) {
|
|
22
|
-
if (!item.isCompact) {
|
|
23
|
-
item.compact();
|
|
24
|
-
changed = true;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return changed;
|
|
29
|
-
}
|
|
30
|
-
expand() {
|
|
31
|
-
let changed = false;
|
|
32
|
-
for (const item of this.items) {
|
|
33
|
-
if (this.checkItemIsCompactOrHasCompactItems(item)) {
|
|
34
|
-
item.expand();
|
|
35
|
-
changed = true;
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return changed;
|
|
40
|
-
}
|
|
41
|
-
get isCompact() {
|
|
42
|
-
return this.items.every(_ref => {
|
|
43
|
-
let {
|
|
44
|
-
isCompact
|
|
45
|
-
} = _ref;
|
|
46
|
-
return isCompact;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
get hasCompactItems() {
|
|
50
|
-
return this.items.some(this.checkItemIsCompactOrHasCompactItems);
|
|
51
|
-
}
|
|
52
|
-
checkItemIsCompactOrHasCompactItems(item) {
|
|
53
|
-
return item.isCompact || 'hasCompactItems' in item && item.hasCompactItems;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
class RegistryItem {
|
|
57
|
-
constructor(_ref2) {
|
|
58
|
-
let {
|
|
59
|
-
onCompactStateChange
|
|
60
|
-
} = _ref2;
|
|
61
|
-
_defineProperty(this, "_isCompact", false);
|
|
62
|
-
_defineProperty(this, "onCompactStateChange", void 0);
|
|
63
|
-
this.onCompactStateChange = onCompactStateChange;
|
|
64
|
-
}
|
|
65
|
-
compact() {
|
|
66
|
-
this._isCompact = true;
|
|
67
|
-
this.onCompactStateChange(true);
|
|
68
|
-
}
|
|
69
|
-
expand() {
|
|
70
|
-
this._isCompact = false;
|
|
71
|
-
this.onCompactStateChange(false);
|
|
72
|
-
}
|
|
73
|
-
get isCompact() {
|
|
74
|
-
return this._isCompact;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
export const useRegistry = () => {
|
|
78
|
-
const parentRegistry = useRegistryContext();
|
|
79
|
-
const [registry] = useState(() => new Registry());
|
|
80
|
-
useLayoutEffect(() => {
|
|
81
|
-
if (!parentRegistry) return undefined;
|
|
82
|
-
parentRegistry.register(registry);
|
|
83
|
-
return () => {
|
|
84
|
-
parentRegistry.unregister(registry);
|
|
85
|
-
};
|
|
86
|
-
}, [parentRegistry, registry]);
|
|
87
|
-
return registry;
|
|
88
|
-
};
|
|
89
|
-
export const useRegistryItem = () => {
|
|
90
|
-
const registry = useRegistryContext();
|
|
91
|
-
const [isCompact, setIsCompact] = useState(false);
|
|
92
|
-
const [registryItem] = useState(() => new RegistryItem({
|
|
93
|
-
onCompactStateChange: setIsCompact
|
|
94
|
-
}));
|
|
95
|
-
useLayoutEffect(() => {
|
|
96
|
-
if (!registry) return undefined;
|
|
97
|
-
registry.register(registryItem);
|
|
98
|
-
return () => {
|
|
99
|
-
registry.unregister(registryItem);
|
|
100
|
-
};
|
|
101
|
-
}, [registry, registryItem]);
|
|
102
|
-
return [isCompact];
|
|
103
|
-
};
|