@arcblock/ux 2.1.31 → 2.1.34
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/Footer/index.js +1 -1
- package/lib/Locale/selector.js +35 -13
- package/lib/NavMenu/style.js +1 -1
- package/package.json +4 -4
- package/src/Footer/index.js +1 -1
- package/src/Locale/selector.js +36 -5
- package/src/NavMenu/style.js +2 -0
package/lib/Footer/index.js
CHANGED
|
@@ -88,7 +88,7 @@ Footer.defaultProps = {
|
|
|
88
88
|
const Container = _styledComponents.default.div.withConfig({
|
|
89
89
|
displayName: "Footer__Container",
|
|
90
90
|
componentId: "sc-1qpifuv-0"
|
|
91
|
-
})(["margin-top:64px;padding:24px 0 32px;border-top:1px solid ", ";box-sizing:border-box;width:100%;@media (max-width:540px){padding:8px 0;}.footer{display:flex;align-items:center;justify-content:space-between;.footer-item{color:", ";display:flex;align-items:center;flex-wrap:wrap;font-size:0.9rem;}.footer-brand{margin-left:8px;margin-right:8px;}.logo-container{margin:
|
|
91
|
+
})(["margin-top:64px;padding:24px 0 32px;border-top:1px solid ", ";box-sizing:border-box;width:100%;@media (max-width:540px){padding:8px 0;}.footer{display:flex;align-items:center;justify-content:space-between;.footer-item{color:", ";display:flex;align-items:center;flex-wrap:wrap;font-size:0.9rem;}.footer-brand{margin-left:8px;margin-right:8px;}.logo-container{margin-left:24px;width:90px;opacity:0.5;}@media (max-width:540px){.footer-item{font-size:0.7rem;}.logo-container{margin:0 0 0 16px;width:70px;height:40px;}}@media (max-width:380px){.footer-item{font-size:0.65rem;}.logo-container{margin:0 0 0 8px;height:24px;}}}"], props => props.dark ? props.theme.palette.grey[900] : '#dee2e7', _ref => {
|
|
92
92
|
let {
|
|
93
93
|
theme,
|
|
94
94
|
dark
|
package/lib/Locale/selector.js
CHANGED
|
@@ -41,7 +41,7 @@ var _globeLight = _interopRequireDefault(require("./images/globe-light.png"));
|
|
|
41
41
|
|
|
42
42
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
43
43
|
|
|
44
|
-
const _excluded = ["dark", "showText", "popperProps"];
|
|
44
|
+
const _excluded = ["dark", "showText", "popperProps", "popperType", "icon"];
|
|
45
45
|
|
|
46
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
47
47
|
|
|
@@ -59,7 +59,9 @@ function LocaleSelector(props) {
|
|
|
59
59
|
const {
|
|
60
60
|
dark,
|
|
61
61
|
showText,
|
|
62
|
-
popperProps
|
|
62
|
+
popperProps,
|
|
63
|
+
popperType,
|
|
64
|
+
icon: Icon
|
|
63
65
|
} = props,
|
|
64
66
|
rest = _objectWithoutProperties(props, _excluded);
|
|
65
67
|
|
|
@@ -88,23 +90,39 @@ function LocaleSelector(props) {
|
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
const ButtonComponent = showText ? _Button.default : _IconButton.default;
|
|
91
|
-
|
|
93
|
+
const handleEventProps = popperType === 'hover' ? {
|
|
94
|
+
onMouseEnter: () => {
|
|
95
|
+
setOpen(true);
|
|
96
|
+
},
|
|
97
|
+
onMouseLeave: onClose
|
|
98
|
+
} : {
|
|
99
|
+
onClick: () => {
|
|
100
|
+
setOpen(!open);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const renderIcon = (0, _react.useMemo)(() => {
|
|
104
|
+
if (Icon) {
|
|
105
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
109
|
+
src: dark ? _globeDark.default : _globeLight.default,
|
|
110
|
+
className: "trigger-image",
|
|
111
|
+
alt: "globe"
|
|
112
|
+
});
|
|
113
|
+
}, [Icon, dark]);
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Div, _objectSpread(_objectSpread(_objectSpread({
|
|
92
115
|
component: "div",
|
|
93
116
|
dark: dark,
|
|
94
117
|
theme: theme
|
|
95
|
-
}, rest), {}, {
|
|
118
|
+
}, rest), handleEventProps), {}, {
|
|
96
119
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonComponent, {
|
|
97
120
|
ref: anchorEl,
|
|
98
121
|
className: "trigger",
|
|
99
|
-
onClick: () => setOpen(!open),
|
|
100
122
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
101
123
|
display: "flex",
|
|
102
124
|
alignItems: "center",
|
|
103
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
104
|
-
src: dark ? _globeDark.default : _globeLight.default,
|
|
105
|
-
className: "trigger-image",
|
|
106
|
-
alt: "globe"
|
|
107
|
-
}), showText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
125
|
+
children: [renderIcon, showText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
108
126
|
component: "strong",
|
|
109
127
|
className: "trigger-text",
|
|
110
128
|
children: _context.languages.find(x => x.value === locale).text
|
|
@@ -146,14 +164,18 @@ LocaleSelector.propTypes = {
|
|
|
146
164
|
size: _propTypes.default.number,
|
|
147
165
|
showText: _propTypes.default.bool,
|
|
148
166
|
popperProps: _propTypes.default.object,
|
|
149
|
-
onChange: _propTypes.default.func
|
|
167
|
+
onChange: _propTypes.default.func,
|
|
168
|
+
popperType: _propTypes.default.oneOf(['hover', 'click']),
|
|
169
|
+
icon: _propTypes.default.any
|
|
150
170
|
};
|
|
151
171
|
LocaleSelector.defaultProps = {
|
|
152
172
|
dark: false,
|
|
153
173
|
showText: true,
|
|
154
174
|
size: 24,
|
|
155
175
|
popperProps: {},
|
|
156
|
-
onChange: () => {}
|
|
176
|
+
onChange: () => {},
|
|
177
|
+
popperType: 'click',
|
|
178
|
+
icon: null
|
|
157
179
|
};
|
|
158
180
|
var _default = LocaleSelector;
|
|
159
181
|
exports.default = _default;
|
|
@@ -161,4 +183,4 @@ exports.default = _default;
|
|
|
161
183
|
const Div = _styledComponents.default.div.withConfig({
|
|
162
184
|
displayName: "selector__Div",
|
|
163
185
|
componentId: "sc-wfz3sf-0"
|
|
164
|
-
})(["
|
|
186
|
+
})(["display:inline-block;.trigger{display:flex;flex-direction:column;justify-content:center;font-size:14px;.trigger-image{width:", "px;height:", "px;}.trigger-text{margin-left:5px;font-size:14px;color:", ";}}.locales{background:", ";}.locale-item{font-size:16px;font-style:normal;font-stretch:normal;line-height:normal;letter-spacing:2px;text-align:center;color:", ";cursor:pointer;display:flex;padding:16px;align-items:center;.check-icon{visibility:hidden;margin-right:4px;}.check-icon-visible{visibility:visible;}}"], props => props.size, props => props.size, props => (0, _Util.getColor)(props), props => (0, _Util.getBackground)(props), props => (0, _Util.getColor)(props));
|
package/lib/NavMenu/style.js
CHANGED
|
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
const NavMenuBase = _styledComponents.default.nav.withConfig({
|
|
13
13
|
displayName: "style__NavMenuBase",
|
|
14
14
|
componentId: "sc-2g7isz-0"
|
|
15
|
-
})(["background-color:", ";font-size:14px;ul{list-style:none;margin:0;padding:0;}.navmenu-item,.navmenu-sub{display:flex;align-items:center;}a{color:inherit;}.navmenu-item,.navmenu-sub{color:", ";}.navmenu-item--active,.navmenu-item:hover,.navmenu-sub--opened{color:", ";}.navmenu-item{position:relative;cursor:pointer;transition:color 0.2s ease-in-out;a{text-decoration:none;white-space:nowrap;}a::before{position:absolute;top:0;right:0;bottom:0;left:0;background-color:transparent;content:'';}}.navmenu-sub{position:relative;cursor:pointer;}.navmenu-item-icon,.navmenu-sub-icon,.navmenu-sub-expand-icon{display:flex;line-height:1;}.navmenu-item-icon,.navmenu-sub-icon{margin-right:4px;}.navmenu-item-icon > *,.navmenu-sub-icon > *{font-size:1.5em;}.navmenu-sub-expand-icon{margin-left:8px;> *{width:0.8em;height:0.8em;transition:transform 0.2s ease-in-out;}}"], props => props.$bgColor, props => props.$textColor, props => props.$activeTextColor);
|
|
15
|
+
})(["background-color:", ";font-size:14px;ul{list-style:none;margin:0;padding:0;}.navmenu-item,.navmenu-sub{display:flex;align-items:center;}a{color:inherit;}.navmenu-item,.navmenu-sub{color:", ";}.navmenu-item--active,.navmenu-item:hover,.navmenu-sub--opened{color:", ";}.navmenu-item{position:relative;cursor:pointer;transition:color 0.2s ease-in-out;a{text-decoration:none;white-space:nowrap;}a::before{position:absolute;top:0;right:0;bottom:0;left:0;background-color:transparent;content:'';}}.navmenu-sub{position:relative;cursor:pointer;}.navmenu-item-icon,.navmenu-sub-icon,.navmenu-sub-expand-icon{display:flex;line-height:1;}.navmenu-item-icon,.navmenu-sub-icon{margin-right:4px;}.navmenu-item-icon > *,.navmenu-sub-icon > *{width:auto;max-height:20px;font-size:1.5em;}.navmenu-sub-expand-icon{margin-left:8px;> *{width:0.8em;height:0.8em;transition:transform 0.2s ease-in-out;}}"], props => props.$bgColor, props => props.$textColor, props => props.$activeTextColor);
|
|
16
16
|
|
|
17
17
|
const HorizontalStyle = (0, _styledComponents.default)(NavMenuBase).withConfig({
|
|
18
18
|
displayName: "style__HorizontalStyle",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.34",
|
|
4
4
|
"description": "Common used react components for arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"react": ">=18.1.0",
|
|
53
53
|
"react-ga": "^2.7.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "cf0c00b60dfa2819e06e0e063614b99eeb392c79",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@arcblock/icons": "^2.1.
|
|
58
|
-
"@arcblock/react-hooks": "^2.1.
|
|
57
|
+
"@arcblock/icons": "^2.1.34",
|
|
58
|
+
"@arcblock/react-hooks": "^2.1.34",
|
|
59
59
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
60
60
|
"@emotion/react": "^11.9.0",
|
|
61
61
|
"@emotion/styled": "^11.8.1",
|
package/src/Footer/index.js
CHANGED
package/src/Locale/selector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-no-bind */
|
|
2
|
-
import { useState, useContext, useRef } from 'react';
|
|
2
|
+
import { useState, useContext, useRef, useMemo } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
|
|
@@ -22,7 +22,7 @@ import globeDark from './images/globe-dark.png';
|
|
|
22
22
|
import globeLight from './images/globe-light.png';
|
|
23
23
|
|
|
24
24
|
function LocaleSelector(props) {
|
|
25
|
-
const { dark, showText, popperProps, ...rest } = props;
|
|
25
|
+
const { dark, showText, popperProps, popperType, icon: Icon, ...rest } = props;
|
|
26
26
|
const { locale, changeLocale } = useContext(LocaleContext);
|
|
27
27
|
const anchorEl = useRef(null);
|
|
28
28
|
const [open, setOpen] = useState(false);
|
|
@@ -43,11 +43,34 @@ function LocaleSelector(props) {
|
|
|
43
43
|
|
|
44
44
|
const ButtonComponent = showText ? Button : IconButton;
|
|
45
45
|
|
|
46
|
+
const handleEventProps =
|
|
47
|
+
popperType === 'hover'
|
|
48
|
+
? {
|
|
49
|
+
onMouseEnter: () => {
|
|
50
|
+
setOpen(true);
|
|
51
|
+
},
|
|
52
|
+
onMouseLeave: onClose,
|
|
53
|
+
}
|
|
54
|
+
: {
|
|
55
|
+
onClick: () => {
|
|
56
|
+
setOpen(!open);
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const renderIcon = useMemo(() => {
|
|
61
|
+
if (Icon) {
|
|
62
|
+
return <Icon />;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return <img src={dark ? globeDark : globeLight} className="trigger-image" alt="globe" />;
|
|
66
|
+
}, [Icon, dark]);
|
|
67
|
+
|
|
46
68
|
return (
|
|
47
|
-
<Div component="div" dark={dark} theme={theme} {...rest}>
|
|
48
|
-
<ButtonComponent ref={anchorEl} className="trigger"
|
|
69
|
+
<Div component="div" dark={dark} theme={theme} {...rest} {...handleEventProps}>
|
|
70
|
+
<ButtonComponent ref={anchorEl} className="trigger">
|
|
49
71
|
<Box display="flex" alignItems="center">
|
|
50
|
-
|
|
72
|
+
{renderIcon}
|
|
73
|
+
|
|
51
74
|
{showText ? (
|
|
52
75
|
<Typography component="strong" className="trigger-text">
|
|
53
76
|
{languages.find((x) => x.value === locale).text}
|
|
@@ -57,6 +80,7 @@ function LocaleSelector(props) {
|
|
|
57
80
|
)}
|
|
58
81
|
</Box>
|
|
59
82
|
</ButtonComponent>
|
|
83
|
+
|
|
60
84
|
<Popper open={open} anchorEl={anchorEl.current} {...popperProps} disablePortal>
|
|
61
85
|
<div className="locales">
|
|
62
86
|
<ClickAwayListener onClickAway={onClose}>
|
|
@@ -84,6 +108,8 @@ LocaleSelector.propTypes = {
|
|
|
84
108
|
showText: PropTypes.bool,
|
|
85
109
|
popperProps: PropTypes.object,
|
|
86
110
|
onChange: PropTypes.func,
|
|
111
|
+
popperType: PropTypes.oneOf(['hover', 'click']),
|
|
112
|
+
icon: PropTypes.any,
|
|
87
113
|
};
|
|
88
114
|
|
|
89
115
|
LocaleSelector.defaultProps = {
|
|
@@ -92,20 +118,25 @@ LocaleSelector.defaultProps = {
|
|
|
92
118
|
size: 24,
|
|
93
119
|
popperProps: {},
|
|
94
120
|
onChange: () => {},
|
|
121
|
+
popperType: 'click',
|
|
122
|
+
icon: null,
|
|
95
123
|
};
|
|
96
124
|
|
|
97
125
|
export default LocaleSelector;
|
|
98
126
|
|
|
99
127
|
const Div = styled.div`
|
|
128
|
+
display: inline-block;
|
|
100
129
|
.trigger {
|
|
101
130
|
display: flex;
|
|
102
131
|
flex-direction: column;
|
|
103
132
|
justify-content: center;
|
|
104
133
|
font-size: 14px;
|
|
134
|
+
|
|
105
135
|
.trigger-image {
|
|
106
136
|
width: ${(props) => props.size}px;
|
|
107
137
|
height: ${(props) => props.size}px;
|
|
108
138
|
}
|
|
139
|
+
|
|
109
140
|
.trigger-text {
|
|
110
141
|
margin-left: 5px;
|
|
111
142
|
font-size: 14px;
|