@arcblock/ux 2.5.49 → 2.5.51
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/lib/Button/index.js +4 -1
- package/lib/Button/wrap.js +5 -1
- package/lib/Dialog/dialog.js +1 -1
- package/lib/SplitButton/index.js +8 -7
- package/lib/Toast/index.js +10 -16
- package/lib/Util/index.js +0 -21
- package/package.json +4 -4
- package/src/Button/index.js +6 -1
- package/src/Button/wrap.js +5 -1
- package/src/Dialog/dialog.js +1 -1
- package/src/SplitButton/index.js +7 -4
- package/src/Toast/index.js +10 -16
- package/src/Util/index.js +0 -16
package/lib/Button/index.js
CHANGED
@@ -11,6 +11,9 @@ var _wrap = _interopRequireDefault(require("./wrap"));
|
|
11
11
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
13
|
|
14
|
-
|
14
|
+
// @ts-check
|
15
15
|
|
16
|
+
/** @type {import('./wrap').ButtonComponent} */
|
17
|
+
const ButtonComponent = (0, _wrap.default)(_Button.default);
|
18
|
+
var _default = ButtonComponent;
|
16
19
|
exports.default = _default;
|
package/lib/Button/wrap.js
CHANGED
@@ -62,11 +62,15 @@ const extendedColors = {
|
|
62
62
|
* } & import('@mui/material').ButtonProps} ButtonProps
|
63
63
|
*/
|
64
64
|
|
65
|
+
/**
|
66
|
+
* @typedef {React.ForwardRefExoticComponent<React.PropsWithoutRef<ButtonProps> & React.RefAttributes<HTMLButtonElement>>} ButtonComponent
|
67
|
+
*/
|
68
|
+
|
65
69
|
/**
|
66
70
|
* @description
|
67
71
|
* @export
|
68
72
|
* @param {import('@mui/material').ExtendButtonBase<import('@mui/material').ButtonTypeMap<{}, "button">>} BaseComponent
|
69
|
-
* @return {
|
73
|
+
* @return {ButtonComponent}
|
70
74
|
*/
|
71
75
|
|
72
76
|
function _default(BaseComponent) {
|
package/lib/Dialog/dialog.js
CHANGED
@@ -72,7 +72,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
72
72
|
/**
|
73
73
|
* @description
|
74
74
|
* @param {DialogProps} props
|
75
|
-
* @return {React.ReactComponentElement}
|
75
|
+
* @return {React.ReactComponentElement<any, DialogProps>}
|
76
76
|
*/
|
77
77
|
function Dialog(_ref) {
|
78
78
|
let {
|
package/lib/SplitButton/index.js
CHANGED
@@ -52,7 +52,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
52
52
|
* @typedef {{
|
53
53
|
* size?: 'small' | 'medium' | 'large';
|
54
54
|
* color?: 'primary' | 'secondary' | 'inherit';
|
55
|
-
* menu?: Array<import('@mui/material').MenuItem> | import('@mui/material').MenuItem
|
55
|
+
* menu?: Array<import('@mui/material').MenuItem> | import('@mui/material').MenuItem;
|
56
56
|
* children?: JSX.Element | (() => JSX.Element);
|
57
57
|
* variant?: 'outlined' | 'contained';
|
58
58
|
* onClick?: () => void;
|
@@ -61,12 +61,13 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
61
61
|
*/
|
62
62
|
|
63
63
|
/**
|
64
|
-
* SplitButton allows the user to execute a default action which is bound to a Button or to choose a predefined action from a drop-down list.
|
64
|
+
* @description SplitButton allows the user to execute a default action which is bound to a Button or to choose a predefined action from a drop-down list.
|
65
|
+
* @export
|
65
66
|
* @param {SplitButtonProps} props
|
66
|
-
* @
|
67
|
+
* @return {JSX.Element}
|
67
68
|
*/
|
68
|
-
function SplitButton(
|
69
|
-
|
69
|
+
function SplitButton(props) {
|
70
|
+
const {
|
70
71
|
size,
|
71
72
|
color,
|
72
73
|
menu,
|
@@ -74,8 +75,8 @@ function SplitButton(_ref) {
|
|
74
75
|
variant,
|
75
76
|
onClick,
|
76
77
|
menuButtonProps
|
77
|
-
} =
|
78
|
-
|
78
|
+
} = props,
|
79
|
+
rest = _objectWithoutProperties(props, _excluded);
|
79
80
|
|
80
81
|
const [open, setOpen] = (0, _react.useState)(false);
|
81
82
|
const anchorRef = (0, _react.useRef)(null);
|
package/lib/Toast/index.js
CHANGED
@@ -24,6 +24,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
24
24
|
|
25
25
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
26
26
|
|
27
|
+
/**
|
28
|
+
*
|
29
|
+
* @typedef {(message: import('notistack').SnackbarMessage, options?: import('notistack').OptionsObject, ...args: any[]) => import('notistack').SnackbarKey} EnqueueSnackbarFunc
|
30
|
+
*
|
31
|
+
*/
|
32
|
+
|
27
33
|
/**
|
28
34
|
* @type {import('notistack').ProviderContext['enqueueSnackbar']}
|
29
35
|
*/
|
@@ -95,10 +101,7 @@ function Toast() {
|
|
95
101
|
|
96
102
|
var _default = {
|
97
103
|
/**
|
98
|
-
*
|
99
|
-
* @param {import('notistack').SnackbarMessage} message
|
100
|
-
* @param {import('notistack').OptionsObject} options
|
101
|
-
* @returns {import('notistack').SnackbarKey}
|
104
|
+
* @type {EnqueueSnackbarFunc}
|
102
105
|
*/
|
103
106
|
success: function success(message) {
|
104
107
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
@@ -111,10 +114,7 @@ var _default = {
|
|
111
114
|
},
|
112
115
|
|
113
116
|
/**
|
114
|
-
*
|
115
|
-
* @param {import('notistack').SnackbarMessage} message
|
116
|
-
* @param {import('notistack').OptionsObject} options
|
117
|
-
* @returns {import('notistack').SnackbarKey}
|
117
|
+
* @type {EnqueueSnackbarFunc}
|
118
118
|
*/
|
119
119
|
error: function error(message) {
|
120
120
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
@@ -127,10 +127,7 @@ var _default = {
|
|
127
127
|
},
|
128
128
|
|
129
129
|
/**
|
130
|
-
*
|
131
|
-
* @param {import('notistack').SnackbarMessage} message
|
132
|
-
* @param {import('notistack').OptionsObject} options
|
133
|
-
* @returns {import('notistack').SnackbarKey}
|
130
|
+
* @type {EnqueueSnackbarFunc}
|
134
131
|
*/
|
135
132
|
warning: function warning(message) {
|
136
133
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
@@ -143,10 +140,7 @@ var _default = {
|
|
143
140
|
},
|
144
141
|
|
145
142
|
/**
|
146
|
-
*
|
147
|
-
* @param {import('notistack').SnackbarMessage} message
|
148
|
-
* @param {import('notistack').OptionsObject} options
|
149
|
-
* @returns {import('notistack').SnackbarKey}
|
143
|
+
* @type {EnqueueSnackbarFunc}
|
150
144
|
*/
|
151
145
|
info: function info(message) {
|
152
146
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
package/lib/Util/index.js
CHANGED
@@ -82,27 +82,6 @@ function getCookieOptions() {
|
|
82
82
|
return options;
|
83
83
|
}
|
84
84
|
|
85
|
-
const {
|
86
|
-
host
|
87
|
-
} = window.location;
|
88
|
-
|
89
|
-
if (/^[.:0-9]+$/.test(host)) {
|
90
|
-
options.domain = '';
|
91
|
-
} else {
|
92
|
-
const parts = host.split('.');
|
93
|
-
|
94
|
-
if (parts.length === 1) {
|
95
|
-
options.domain = '';
|
96
|
-
} else {
|
97
|
-
// Remember the cookie on all sub domains.
|
98
|
-
while (parts.length > 2) {
|
99
|
-
parts.shift();
|
100
|
-
}
|
101
|
-
|
102
|
-
options.domain = ".".concat(parts.join('.'));
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
85
|
return options;
|
107
86
|
}
|
108
87
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.5.
|
3
|
+
"version": "2.5.51",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -47,11 +47,11 @@
|
|
47
47
|
"peerDependencies": {
|
48
48
|
"react": ">=18.1.0"
|
49
49
|
},
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "2b963c6c83dd57727de19ec4056e6febd0313009",
|
51
51
|
"dependencies": {
|
52
52
|
"@arcblock/did-motif": "^1.1.10",
|
53
|
-
"@arcblock/icons": "^2.5.
|
54
|
-
"@arcblock/react-hooks": "^2.5.
|
53
|
+
"@arcblock/icons": "^2.5.51",
|
54
|
+
"@arcblock/react-hooks": "^2.5.51",
|
55
55
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
56
56
|
"@emotion/react": "^11.10.4",
|
57
57
|
"@emotion/styled": "^11.10.4",
|
package/src/Button/index.js
CHANGED
package/src/Button/wrap.js
CHANGED
@@ -27,11 +27,15 @@ const extendedColors = {
|
|
27
27
|
* } & import('@mui/material').ButtonProps} ButtonProps
|
28
28
|
*/
|
29
29
|
|
30
|
+
/**
|
31
|
+
* @typedef {React.ForwardRefExoticComponent<React.PropsWithoutRef<ButtonProps> & React.RefAttributes<HTMLButtonElement>>} ButtonComponent
|
32
|
+
*/
|
33
|
+
|
30
34
|
/**
|
31
35
|
* @description
|
32
36
|
* @export
|
33
37
|
* @param {import('@mui/material').ExtendButtonBase<import('@mui/material').ButtonTypeMap<{}, "button">>} BaseComponent
|
34
|
-
* @return {
|
38
|
+
* @return {ButtonComponent}
|
35
39
|
*/
|
36
40
|
export default function (BaseComponent) {
|
37
41
|
/**
|
package/src/Dialog/dialog.js
CHANGED
@@ -38,7 +38,7 @@ import { styled, useTheme } from '../Theme';
|
|
38
38
|
/**
|
39
39
|
* @description
|
40
40
|
* @param {DialogProps} props
|
41
|
-
* @return {React.ReactComponentElement}
|
41
|
+
* @return {React.ReactComponentElement<any, DialogProps>}
|
42
42
|
*/
|
43
43
|
function Dialog({ children, title, prepend, toolbar, actions, showCloseButton, actionsPosition, PaperProps, ...rest }) {
|
44
44
|
const theme = useTheme();
|
package/src/SplitButton/index.js
CHANGED
@@ -16,7 +16,7 @@ import { styled } from '../Theme';
|
|
16
16
|
* @typedef {{
|
17
17
|
* size?: 'small' | 'medium' | 'large';
|
18
18
|
* color?: 'primary' | 'secondary' | 'inherit';
|
19
|
-
* menu?: Array<import('@mui/material').MenuItem> | import('@mui/material').MenuItem
|
19
|
+
* menu?: Array<import('@mui/material').MenuItem> | import('@mui/material').MenuItem;
|
20
20
|
* children?: JSX.Element | (() => JSX.Element);
|
21
21
|
* variant?: 'outlined' | 'contained';
|
22
22
|
* onClick?: () => void;
|
@@ -25,11 +25,14 @@ import { styled } from '../Theme';
|
|
25
25
|
*/
|
26
26
|
|
27
27
|
/**
|
28
|
-
* SplitButton allows the user to execute a default action which is bound to a Button or to choose a predefined action from a drop-down list.
|
28
|
+
* @description SplitButton allows the user to execute a default action which is bound to a Button or to choose a predefined action from a drop-down list.
|
29
|
+
* @export
|
29
30
|
* @param {SplitButtonProps} props
|
30
|
-
* @
|
31
|
+
* @return {JSX.Element}
|
31
32
|
*/
|
32
|
-
export default function SplitButton(
|
33
|
+
export default function SplitButton(props) {
|
34
|
+
const { size, color, menu, children, variant, onClick, menuButtonProps, ...rest } = props;
|
35
|
+
|
33
36
|
const [open, setOpen] = useState(false);
|
34
37
|
const anchorRef = useRef(null);
|
35
38
|
const menuItems = Array.isArray(menu)
|
package/src/Toast/index.js
CHANGED
@@ -3,6 +3,12 @@ import { SnackbarProvider, useSnackbar } from 'notistack';
|
|
3
3
|
import IconButton from '@mui/material/IconButton';
|
4
4
|
import CloseIcon from '@mui/icons-material/Close';
|
5
5
|
|
6
|
+
/**
|
7
|
+
*
|
8
|
+
* @typedef {(message: import('notistack').SnackbarMessage, options?: import('notistack').OptionsObject, ...args: any[]) => import('notistack').SnackbarKey} EnqueueSnackbarFunc
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
|
6
12
|
/**
|
7
13
|
* @type {import('notistack').ProviderContext['enqueueSnackbar']}
|
8
14
|
*/
|
@@ -70,34 +76,22 @@ export { ToastProvider };
|
|
70
76
|
|
71
77
|
export default {
|
72
78
|
/**
|
73
|
-
*
|
74
|
-
* @param {import('notistack').SnackbarMessage} message
|
75
|
-
* @param {import('notistack').OptionsObject} options
|
76
|
-
* @returns {import('notistack').SnackbarKey}
|
79
|
+
* @type {EnqueueSnackbarFunc}
|
77
80
|
*/
|
78
81
|
success: (message, options = {}, ...args) => success(message, options, ...args),
|
79
82
|
|
80
83
|
/**
|
81
|
-
*
|
82
|
-
* @param {import('notistack').SnackbarMessage} message
|
83
|
-
* @param {import('notistack').OptionsObject} options
|
84
|
-
* @returns {import('notistack').SnackbarKey}
|
84
|
+
* @type {EnqueueSnackbarFunc}
|
85
85
|
*/
|
86
86
|
error: (message, options = {}, ...args) => error(message, options, ...args),
|
87
87
|
|
88
88
|
/**
|
89
|
-
*
|
90
|
-
* @param {import('notistack').SnackbarMessage} message
|
91
|
-
* @param {import('notistack').OptionsObject} options
|
92
|
-
* @returns {import('notistack').SnackbarKey}
|
89
|
+
* @type {EnqueueSnackbarFunc}
|
93
90
|
*/
|
94
91
|
warning: (message, options = {}, ...args) => warning(message, options, ...args),
|
95
92
|
|
96
93
|
/**
|
97
|
-
*
|
98
|
-
* @param {import('notistack').SnackbarMessage} message
|
99
|
-
* @param {import('notistack').OptionsObject} options
|
100
|
-
* @returns {import('notistack').SnackbarKey}
|
94
|
+
* @type {EnqueueSnackbarFunc}
|
101
95
|
*/
|
102
96
|
info: (message, options = {}, ...args) => info(message, options, ...args),
|
103
97
|
};
|
package/src/Util/index.js
CHANGED
@@ -54,22 +54,6 @@ export function getCookieOptions(expireInDays = 1) {
|
|
54
54
|
return options;
|
55
55
|
}
|
56
56
|
|
57
|
-
const { host } = window.location;
|
58
|
-
if (/^[.:0-9]+$/.test(host)) {
|
59
|
-
options.domain = '';
|
60
|
-
} else {
|
61
|
-
const parts = host.split('.');
|
62
|
-
if (parts.length === 1) {
|
63
|
-
options.domain = '';
|
64
|
-
} else {
|
65
|
-
// Remember the cookie on all sub domains.
|
66
|
-
while (parts.length > 2) {
|
67
|
-
parts.shift();
|
68
|
-
}
|
69
|
-
options.domain = `.${parts.join('.')}`;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
57
|
return options;
|
74
58
|
}
|
75
59
|
|