Skip to content

Commit

Permalink
chore: Merge feature branch and fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dengfuping committed Jul 24, 2024
2 parents f5a98b1 + e79b1b6 commit 1f9408b
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 27 deletions.
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install lint-staged
1 change: 0 additions & 1 deletion packages/design/src/form/demo/form-item-tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const App: React.FC = () => {
name="password"
rules={[{ required: true, message: 'Please input your password!' }]}
tooltip={{
type: 'light',
title: 'This is password',
}}
>
Expand Down
6 changes: 5 additions & 1 deletion packages/design/src/theme/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const defaultTheme: ThemeConfig = {
colorBgBase: '#ffffff',
colorBgContainer: '#ffffff',
colorBgLayout: '#f3f6fc',
colorBgSpotlight: '#132039',
colorBorder: '#CDD5E4',
colorBorderSecondary: '#E2E8F3',
colorFillQuaternary: '#F8FAFE',
Expand All @@ -73,6 +72,7 @@ const defaultTheme: ThemeConfig = {
colorFill: '#cdd5e4',
colorBgMask: 'rgba(19, 32, 57, 0.45)',
colorBgElevated: '#ffffff',
colorBgSpotlight: '#ffffff',
boxShadowSecondary:
'0 6px 16px 0 rgba(54, 69, 99, 0.08), 0 3px 6px -4px rgba(54, 69, 99, 0.12), 0 9px 28px 8px rgba(54, 69, 99, 0.05)',
boxShadow:
Expand Down Expand Up @@ -108,6 +108,10 @@ const defaultTheme: ThemeConfig = {
cellPaddingBlockMD: 8,
cellPaddingBlockSM: 4,
},
Tooltip: {
colorBgSpotlight: '#ffffff',
colorTextLightSolid: '#132039',
},
},
};

Expand Down
2 changes: 1 addition & 1 deletion packages/design/src/theme/style/compact.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@cyan: #13C2C2;
@green: #0ac185;
@magenta: #EB2F96;
@pink: #eb2f96;
@pink: #EB2F96;
@red: #f93939;
@orange: #FA8C16;
@yellow: #ffa21a;
Expand Down
2 changes: 1 addition & 1 deletion packages/design/src/theme/style/dark.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@cyan: #13C2C2;
@green: #0ca774;
@magenta: #EB2F96;
@pink: #eb2f96;
@pink: #EB2F96;
@red: #d73333;
@orange: #FA8C16;
@yellow: #dc8d19;
Expand Down
2 changes: 1 addition & 1 deletion packages/design/src/theme/style/default.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@cyan: #13C2C2;
@green: #0ac185;
@magenta: #EB2F96;
@pink: #eb2f96;
@pink: #EB2F96;
@red: #f93939;
@orange: #FA8C16;
@yellow: #ffa21a;
Expand Down
7 changes: 5 additions & 2 deletions packages/design/src/tooltip/MouseTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ const MouseTooltip: React.FC<MouseTooltipProps> = ({
padding: '6px 8px',
boxShadow: token.boxShadowSecondary,
borderRadius: token.borderRadius,
color: textColor || token.colorTextLightSolid,
backgroundColor: backgroundColor || token.colorBgSpotlight,
// @ts-ignore
color: textColor || token.Tooltip.colorTextLightSolid || token.colorTextLightSolid,
backgroundColor:
// @ts-ignore
backgroundColor || token.Tooltip.colorBgSpotlight || token.colorBgSpotlight,
left: isOverWidth ? clientX - tooltipWidth - offset : clientX + offset,
top: isOverHeight ? clientY - tooltipHeight - offset : clientY + offset,
...restOverlayInnerStyle,
Expand Down
1 change: 0 additions & 1 deletion packages/design/src/tooltip/demo/mouse-follow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const App: React.FC = () => {
}}
>
<Radio.Button value="default">default</Radio.Button>
<Radio.Button value="light">light</Radio.Button>
<Radio.Button value="success">success</Radio.Button>
<Radio.Button value="info">info</Radio.Button>
<Radio.Button value="warning">warning</Radio.Button>
Expand Down
3 changes: 0 additions & 3 deletions packages/design/src/tooltip/demo/type.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ const App: React.FC = () => {
<Tooltip title="This is prompt text">
<Button>Default</Button>
</Tooltip>
<Tooltip title="This is prompt text" type="light">
<Button>Light</Button>
</Tooltip>
<Tooltip title="This is prompt text" type="info">
<Button>Info</Button>
</Tooltip>
Expand Down
5 changes: 0 additions & 5 deletions packages/design/src/tooltip/hooks/useTooltipTypeList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import theme from '../../theme';
export const useTooltipTypeList = () => {
const { token } = theme.useToken();
return [
{
type: 'light',
color: token.colorText,
backgroundColor: token.colorBgElevated,
},
{
type: 'success',
color: token.colorSuccess,
Expand Down
6 changes: 3 additions & 3 deletions packages/design/src/tooltip/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ nav:

- 🔥 完全继承 antd [Tooltip](https://ant.design/components/tooltip-cn) 的能力和 API,可无缝切换。
- 💄 定制主题和样式,符合 OceanBase Design 设计规范。
- 🆕 新增 `type` 属性,支持 `default``light``info``success``warning``error` 五种类型的 Tooltip。
- 🆕 新增 `type` 属性,支持 `default``info``success``warning``error` 五种类型的 Tooltip。
- 🆕 新增 `mouseFollow` 属性,支持鼠标跟随。
- 🆕 新增 `closeIcon` 属性,支持展示关闭按钮。
- 🆕 新增 `onClose` 属性,关闭按钮被点击时调用此函数,可以配合 `open``onOpenChange` 属性来控制 `Tooltip` 展示。
Expand All @@ -18,15 +18,15 @@ nav:

<code src="./demo/close-icon.tsx" title="关闭按钮" description="Tooltip 可以通过设置 closeIcon 变为可关闭 Tooltip, 并支持自定义关闭按钮,设置为 true 时将使用默认关闭按钮。可关闭 Tooltip 具有 onClose 事件"></code>

<code src="./demo/type.tsx" title="Tooltip 类型" description="Tooltip 有五种类型:default、light、info、success、warning 和 error,以满足不同场景的提示需求。"></code>
<code src="./demo/type.tsx" title="Tooltip 类型" description="Tooltip 有五种类型:default、info、success、warning 和 error,以满足不同场景的提示需求。"></code>

<code src="./demo/mouse-follow.tsx" title="鼠标跟随" description="设置 `mouseFollow: true` 可开启鼠标跟随,此时会去掉箭头,并且 `placement`、`open` 和 `trigger` 等属性也将失效。"></code>

## API

| 参数 | 说明 | 类型 | 默认值 | 版本 |
| :-- | :-- | :-- | :-- | :-- |
| type | 类型 | default \| light \| info \| success \| warning \| error | default | - |
| type | 类型 | default \| info \| success \| warning \| error | default | - |
| mouseFollow | 是否跟随鼠标移动,开启后会去掉箭头,并且 `placement``open``closeIcon``trigger` 等属性也将失效 | boolean | false | - |
| closeIcon | 自定义关闭按钮 | boolean \| ReactNode | false | - |
| closeTitle | 自定义关闭标题 | ReactNode | - | - |
Expand Down
3 changes: 1 addition & 2 deletions packages/design/src/tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import type {
TooltipPropsWithTitle as AntTooltipPropsWithTitle,
TooltipRef,
} from 'antd/es/tooltip';
import React, { useContext, useEffect, useState } from 'react';
import React, { useContext, useState } from 'react';
import { CloseOutlined } from '@oceanbase/icons';
import classNames from 'classnames';
import { isNil } from 'lodash';
import MouseTooltip from './MouseTooltip';
import ConfigProvider from '../config-provider';
import useStyle from './style';
Expand Down
4 changes: 0 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1f9408b

Please sign in to comment.