diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml new file mode 100644 index 0000000000..4f45a8a046 --- /dev/null +++ b/.github/workflows/pkg.pr.new.yml @@ -0,0 +1,23 @@ +name: Publish Any Commit +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - run: corepack enable + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - run: npx pkg-pr-new publish diff --git a/components/divider/__tests__/index.test.tsx b/components/divider/__tests__/index.test.tsx index 31d3c46dfa..3728ac74b7 100644 --- a/components/divider/__tests__/index.test.tsx +++ b/components/divider/__tests__/index.test.tsx @@ -26,4 +26,15 @@ describe('Divider', () => { marginRight: 10, }); }); + + it('support bool dashed', () => { + const { container } = render( + + test test test + , + ); + expect(container?.querySelector('.ant-divider-dashed')).toHaveStyle({ + borderStyle: 'dashed', + }); + }); }); diff --git a/components/dropdown/__tests__/index.test.tsx b/components/dropdown/__tests__/index.test.tsx index a980f92c14..efaf21eac7 100644 --- a/components/dropdown/__tests__/index.test.tsx +++ b/components/dropdown/__tests__/index.test.tsx @@ -324,4 +324,31 @@ describe('Dropdown', () => { expect(container.querySelector('.ant-dropdown-hidden')).toBeFalsy(); jest.useRealTimers(); }); + + it('should respect trigger disabled prop', () => { + const { container: container1 } = render( + + + , + ); + expect(container1.querySelector('button')).toHaveAttribute('disabled'); + + const { container: container2 } = render( + + + , + ); + expect(container2.querySelector('button')).toHaveAttribute('disabled'); + + const { container: container3 } = render( + + + , + ); + expect(container3.querySelector('button')).not.toHaveAttribute('disabled'); + }); }); diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index 666e7e01a2..24ba9c49aa 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -185,9 +185,8 @@ const Dropdown: CompoundedComponent = (props) => { }, child.props.className, ), - disabled, + disabled: child.props.disabled ?? disabled, }); - const triggerActions = disabled ? [] : trigger; const alignPoint = !!triggerActions?.includes('contextMenu'); diff --git a/components/dropdown/style/index.ts b/components/dropdown/style/index.ts index cda8c45213..db1b1aa859 100644 --- a/components/dropdown/style/index.ts +++ b/components/dropdown/style/index.ts @@ -61,8 +61,6 @@ const genBaseStyle: GenerateStyle = (token) => { return [ { [componentCls]: { - ...resetComponent(token), - position: 'absolute', top: -9999, left: { @@ -185,6 +183,8 @@ const genBaseStyle: GenerateStyle = (token) => { }, [`${componentCls}, ${componentCls}-menu-submenu`]: { + ...resetComponent(token), + [menuCls]: { padding: dropdownEdgeChildPadding, listStyleType: 'none', diff --git a/components/input-number/__tests__/index.test.tsx b/components/input-number/__tests__/index.test.tsx index f6494c21cd..5e51036ac1 100644 --- a/components/input-number/__tests__/index.test.tsx +++ b/components/input-number/__tests__/index.test.tsx @@ -98,12 +98,18 @@ describe('InputNumber', () => { ).toBe(true); }); - it('deprecate bordered', () => { + it('Deprecation and usage tips', () => { const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); - const { container } = render(); - expect(errorSpy).toHaveBeenCalledWith( + const { container } = render(); + expect(errorSpy).toHaveBeenNthCalledWith( + 1, 'Warning: [antd: InputNumber] `bordered` is deprecated. Please use `variant` instead.', ); + expect(errorSpy).toHaveBeenNthCalledWith( + 2, + 'Warning: [antd: InputNumber] When `type=number` is used together with `changeOnWheel`, changeOnWheel may not work properly. Please delete `type=number` if it is not necessary.', + ); + expect(container.querySelector('.ant-input-number-borderless')).toBeTruthy(); errorSpy.mockRestore(); }); diff --git a/components/input-number/index.tsx b/components/input-number/index.tsx index 4fdb470e6b..3359b23b04 100644 --- a/components/input-number/index.tsx +++ b/components/input-number/index.tsx @@ -42,8 +42,13 @@ export interface InputNumberProps const InputNumber = React.forwardRef((props, ref) => { if (process.env.NODE_ENV !== 'production') { - const { deprecated } = devUseWarning('InputNumber'); - deprecated(!('bordered' in props), 'bordered', 'variant'); + const typeWarning = devUseWarning('InputNumber'); + typeWarning.deprecated(!('bordered' in props), 'bordered', 'variant'); + typeWarning( + !(props.type === 'number' && props.changeOnWheel), + 'usage', + 'When `type=number` is used together with `changeOnWheel`, changeOnWheel may not work properly. Please delete `type=number` if it is not necessary.', + ); } const { getPrefixCls, direction } = React.useContext(ConfigContext); diff --git a/package.json b/package.json index d8d0000585..53e9456c05 100644 --- a/package.json +++ b/package.json @@ -192,7 +192,6 @@ "@types/minimist": "^1.2.5", "@types/node": "^20.14.2", "@types/nprogress": "^0.2.3", - "@types/ora": "^3.2.0", "@types/pixelmatch": "^5.2.6", "@types/pngjs": "^6.0.5", "@types/prismjs": "^1.26.4", @@ -275,7 +274,7 @@ "nprogress": "^0.2.0", "open": "^10.1.0", "ora": "^8.0.1", - "pixelmatch": "^5.3.0", + "pixelmatch": "^6.0.0", "pngjs": "^7.0.0", "prettier": "^3.3.2", "prettier-plugin-jsdoc": "^1.3.0",