diff --git a/packages/site/web/docs/migration-v3.md b/packages/site/web/docs/migration-v3.md index 5ba81d496..c209e2b35 100644 --- a/packages/site/web/docs/migration-v3.md +++ b/packages/site/web/docs/migration-v3.md @@ -55,8 +55,8 @@ ### Checkbox / Radio - - 组合使用时 `type` 类型可选值 `cell` 调整为 `list`。 - - 废弃样式相关属性 `size`、`shape`、`ghost`,可以通过 css 变量方式更改样式。 +- 组合使用时 `type` 类型可选值 `cell` 调整为 `list`。 +- 废弃样式相关属性 `size`、`shape`、`ghost`,可以通过 css 变量方式更改样式。 ```diff +``` + ## 常见问题 ### 如何在已经使用 Zarm 2.x 的项目中 Zarm 3.0 diff --git a/packages/zarm/src/__tests__/index.test.ts b/packages/zarm/src/__tests__/index.test.ts index b7eb5751b..ff4f15f27 100644 --- a/packages/zarm/src/__tests__/index.test.ts +++ b/packages/zarm/src/__tests__/index.test.ts @@ -465,9 +465,6 @@ describe('index', () => { "$$typeof": Symbol(react.forward_ref), "render": [Function], }, - "defaultProps": Object { - "visible": true, - }, "render": [Function], }, "Tabs": Object { diff --git a/packages/zarm/src/date-picker-view/__tests__/__snapshots__/index.test.tsx.snap b/packages/zarm/src/date-picker-view/__tests__/__snapshots__/index.test.tsx.snap index d934da236..7196e0725 100644 --- a/packages/zarm/src/date-picker-view/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/zarm/src/date-picker-view/__tests__/__snapshots__/index.test.tsx.snap @@ -91,7 +91,7 @@ exports[`DatePickerView meridiem hour snapshot 1`] = ` 8时
9时 @@ -376,7 +376,7 @@ exports[`DatePickerView meridiem hour snapshot 1`] = ` 42分
43分 @@ -671,7 +671,7 @@ exports[`DatePickerView snapshot 1`] = ` 5月
6月 @@ -746,7 +746,7 @@ exports[`DatePickerView snapshot 1`] = ` 4日
5日 @@ -901,12 +901,6 @@ exports[`DatePickerView snapshot 1`] = ` > 30日
-
- 31日 -
@@ -1203,7 +1197,7 @@ exports[`DatePickerView week snapshot 1`] = ` 22周
23周 diff --git a/packages/zarm/src/tab-bar/TabBar.tsx b/packages/zarm/src/tab-bar/TabBar.tsx index f447c68e3..23da597e0 100644 --- a/packages/zarm/src/tab-bar/TabBar.tsx +++ b/packages/zarm/src/tab-bar/TabBar.tsx @@ -27,8 +27,7 @@ const TabBar = React.forwardRef((props, ref) => { const bem = createBEM('tab-bar', { prefixCls }); - const { visible, className, children, onChange, activeKey, defaultActiveKey, safeArea, ...rest } = - props; + const { className, children, onChange, activeKey, defaultActiveKey, safeArea, ...rest } = props; const [selectedKey, setSelectedKey] = useState(defaultActiveKey); @@ -78,16 +77,7 @@ const TabBar = React.forwardRef((props, ref) => { }, ); return ( -
+
{items}
{safeArea && }
@@ -96,8 +86,4 @@ const TabBar = React.forwardRef((props, ref) => { TabBar.displayName = 'TabBar'; -TabBar.defaultProps = { - visible: true, -}; - export default TabBar; diff --git a/packages/zarm/src/tab-bar/__tests__/index.test.tsx b/packages/zarm/src/tab-bar/__tests__/index.test.tsx index 662f2f7c6..f069252ba 100644 --- a/packages/zarm/src/tab-bar/__tests__/index.test.tsx +++ b/packages/zarm/src/tab-bar/__tests__/index.test.tsx @@ -128,7 +128,7 @@ describe('TabBar', () => { it('should select first tab bar item if activeKey and defaultActivceKey are not existed', () => { const { container } = render( - + , @@ -166,52 +166,4 @@ describe('TabBar', () => { const el = container.querySelectorAll('.za-tab-bar__item'); expect(el[0].className).toEqual('za-tab-bar__item za-tab-bar__item--active'); }); - - // it('should use element index as the fallback itemKey', () => { - // const wrapper = shallow( - // - // - // - // , - // ); - // expect(wrapper.childAt(0).prop('itemKey')).toBe(0); - // expect(wrapper.childAt(1).prop('itemKey')).toBe(1); - // }); - - it('should have hidden class name if visible prop is false', () => { - const { container } = render( - - - , - ); - const el = container.querySelector('.za-tab-bar'); - expect(el?.classList.contains('test')).toBeTruthy(); - expect(el?.classList.contains('za-tab-bar')).toBeTruthy(); - expect(el?.classList.contains('za-tab-bar--hidden')).toBeTruthy(); - }); - - // it('should render children with extra props', () => { - // const wrapper = shallow( - // - // - // - // , - // ); - // expect(wrapper.childAt(0).props()).toEqual( - // expect.objectContaining({ - // title: '主页', - // itemKey: 'home', - // onChange: expect.any(Function), - // selected: true, - // }), - // ); - // expect(wrapper.childAt(1).props()).toEqual( - // expect.objectContaining({ - // title: '关于我们', - // itemKey: 'about us', - // onChange: expect.any(Function), - // selected: false, - // }), - // ); - // }); }); diff --git a/packages/zarm/src/tab-bar/demo.md b/packages/zarm/src/tab-bar/demo.md index 30e0cef8a..c555d80dd 100644 --- a/packages/zarm/src/tab-bar/demo.md +++ b/packages/zarm/src/tab-bar/demo.md @@ -176,7 +176,6 @@ ReactDOM.render(, mountNode); | 属性 | 类型 | 默认值 | 说明 | | :--------------- | :-------------------------------- | :----- | :------------------------- | -| visible | boolean | true | 是否显示 | | activeKey | number \| string | - | 当前选中项 | | defaultActiveKey | number \| string | - | 初始选中项, 默认第一个选中 | | safeArea | boolean | false | 是否适配安全区域 | diff --git a/packages/zarm/src/tab-bar/interface.ts b/packages/zarm/src/tab-bar/interface.ts index 1f6e5c37d..448820b68 100644 --- a/packages/zarm/src/tab-bar/interface.ts +++ b/packages/zarm/src/tab-bar/interface.ts @@ -2,7 +2,6 @@ import type { ReactNode } from 'react'; import type { BaseBadgeProps } from '../badge/interface'; export interface BaseTabBarProps { - visible?: boolean; defaultActiveKey?: string | number; activeKey?: string | number; safeArea?: boolean;