@arcblock/ux 2.1.33 → 2.1.36

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.
@@ -183,4 +183,4 @@ exports.default = _default;
183
183
  const Div = _styledComponents.default.div.withConfig({
184
184
  displayName: "selector__Div",
185
185
  componentId: "sc-wfz3sf-0"
186
- })([".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));
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));
@@ -104,10 +104,14 @@ function NavMenu(_ref) {
104
104
  });
105
105
  }, [state, mode, activate, open, close]);
106
106
  (0, _react.useEffect)(() => {
107
- if (activeId) {
108
- activate(activeId);
107
+ // NavMenu#activeId 和 Item#active prop 都可以用来控制激活状态 (一般不会混用这两种方式)
108
+ // 如果未传入 NavMenu#activeId, 应该避免设置一个空值的 activeId 状态 (会与 Item#active 冲突)
109
+ if (activeId !== undefined && activeId !== null) {
110
+ setState(prev => _objectSpread(_objectSpread({}, prev), {}, {
111
+ activeId
112
+ }));
109
113
  }
110
- }, [activate, activeId]);
114
+ }, [activeId]);
111
115
  const classes = (0, _clsx.default)('navmenu', "navmenu--".concat(mode), rest.className);
112
116
 
113
117
  const renderItem = (item, index) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.1.33",
3
+ "version": "2.1.36",
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": "616c11e20c48d33f153258bcf00eba030dabf648",
55
+ "gitHead": "fc0e64437926f532b89f8e027da4df083a705fec",
56
56
  "dependencies": {
57
- "@arcblock/icons": "^2.1.33",
58
- "@arcblock/react-hooks": "^2.1.33",
57
+ "@arcblock/icons": "^2.1.36",
58
+ "@arcblock/react-hooks": "^2.1.36",
59
59
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
60
60
  "@emotion/react": "^11.9.0",
61
61
  "@emotion/styled": "^11.8.1",
@@ -125,6 +125,7 @@ LocaleSelector.defaultProps = {
125
125
  export default LocaleSelector;
126
126
 
127
127
  const Div = styled.div`
128
+ display: inline-block;
128
129
  .trigger {
129
130
  display: flex;
130
131
  flex-direction: column;
@@ -54,10 +54,12 @@ function NavMenu({ items, mode, children, activeId, textColor, activeTextColor,
54
54
  }, [state, mode, activate, open, close]);
55
55
 
56
56
  useEffect(() => {
57
- if (activeId) {
58
- activate(activeId);
57
+ // NavMenu#activeId 和 Item#active prop 都可以用来控制激活状态 (一般不会混用这两种方式)
58
+ // 如果未传入 NavMenu#activeId, 应该避免设置一个空值的 activeId 状态 (会与 Item#active 冲突)
59
+ if (activeId !== undefined && activeId !== null) {
60
+ setState((prev) => ({ ...prev, activeId }));
59
61
  }
60
- }, [activate, activeId]);
62
+ }, [activeId]);
61
63
 
62
64
  const classes = clsx('navmenu', `navmenu--${mode}`, rest.className);
63
65
  const renderItem = (item, index) => {