@oceanbase/design 0.2.9 → 0.2.11

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.
Files changed (74) hide show
  1. package/LICENSE +22 -0
  2. package/dist/design.min.js +1 -1
  3. package/es/_util/genComponentStyleHook.d.ts +9 -0
  4. package/es/alert/index.d.ts +13 -0
  5. package/es/alert/style/index.d.ts +8 -0
  6. package/es/button/index.d.ts +11 -0
  7. package/es/button/style/index.d.ts +9 -0
  8. package/es/config-provider/index.d.ts +10 -4
  9. package/es/config-provider/index.js +26 -5
  10. package/es/descriptions/Item.d.ts +8 -0
  11. package/es/descriptions/index.d.ts +11 -0
  12. package/es/descriptions/style/index.d.ts +11 -0
  13. package/es/form/FormItem.d.ts +16 -0
  14. package/es/form/index.d.ts +3 -0
  15. package/es/form/interface.d.ts +1 -0
  16. package/es/index.js +1 -1
  17. package/es/locale/index.d.ts +5 -0
  18. package/es/message/index.d.ts +1 -0
  19. package/es/message/index.js +1 -0
  20. package/es/message/interface.d.ts +1 -0
  21. package/es/modal/interface.d.ts +1 -0
  22. package/es/notification/index.d.ts +1 -0
  23. package/es/notification/index.js +1 -0
  24. package/es/notification/interface.d.ts +1 -0
  25. package/es/static-function/index.d.ts +7 -2
  26. package/es/static-function/index.js +7 -8
  27. package/es/table/interface.d.ts +1 -0
  28. package/es/tabs/TabPane.d.ts +7 -0
  29. package/es/tabs/hooks/useInkBar.d.ts +12 -0
  30. package/es/tabs/hooks/useLegacyItems.d.ts +4 -0
  31. package/es/tabs/index.d.ts +3 -3
  32. package/es/tabs/index.js +10 -1
  33. package/es/tabs/style/index.d.ts +8 -0
  34. package/es/theme/default.d.ts +74 -0
  35. package/es/theme/default.js +73 -0
  36. package/es/theme/index.d.ts +49 -117
  37. package/es/theme/index.js +2 -78
  38. package/es/tooltip/index.d.ts +19 -0
  39. package/lib/_util/genComponentStyleHook.d.ts +9 -0
  40. package/lib/alert/index.d.ts +13 -0
  41. package/lib/alert/style/index.d.ts +8 -0
  42. package/lib/button/index.d.ts +11 -0
  43. package/lib/button/style/index.d.ts +9 -0
  44. package/lib/config-provider/index.d.ts +10 -4
  45. package/lib/config-provider/index.js +33 -2
  46. package/lib/descriptions/Item.d.ts +8 -0
  47. package/lib/descriptions/index.d.ts +11 -0
  48. package/lib/descriptions/style/index.d.ts +11 -0
  49. package/lib/form/FormItem.d.ts +16 -0
  50. package/lib/form/index.d.ts +3 -0
  51. package/lib/form/interface.d.ts +1 -0
  52. package/lib/locale/index.d.ts +5 -0
  53. package/lib/message/index.d.ts +1 -0
  54. package/lib/message/index.js +23 -0
  55. package/lib/message/interface.d.ts +1 -0
  56. package/lib/modal/interface.d.ts +1 -0
  57. package/lib/notification/index.d.ts +1 -0
  58. package/lib/notification/index.js +23 -0
  59. package/lib/notification/interface.d.ts +1 -0
  60. package/lib/static-function/index.d.ts +7 -2
  61. package/lib/static-function/index.js +6 -8
  62. package/lib/table/interface.d.ts +1 -0
  63. package/lib/tabs/TabPane.d.ts +7 -0
  64. package/lib/tabs/hooks/useInkBar.d.ts +12 -0
  65. package/lib/tabs/hooks/useLegacyItems.d.ts +4 -0
  66. package/lib/tabs/index.d.ts +3 -3
  67. package/lib/tabs/index.js +7 -1
  68. package/lib/tabs/style/index.d.ts +8 -0
  69. package/lib/theme/default.d.ts +74 -0
  70. package/lib/theme/default.js +97 -0
  71. package/lib/theme/index.d.ts +49 -117
  72. package/lib/theme/index.js +3 -79
  73. package/lib/tooltip/index.d.ts +19 -0
  74. package/package.json +16 -16
@@ -0,0 +1,9 @@
1
+ import type { CSSObject } from '@ant-design/cssinjs';
2
+ import type { ComponentTokenMap } from 'antd/es/theme/interface';
3
+ import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
4
+ export declare type ComponentName = keyof ComponentTokenMap;
5
+ export declare function genComponentStyleHook(componentName: ComponentName, styleFn: GenerateStyle<FullToken<ComponentName>>): (prefixCls: string) => {
6
+ wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
7
+ hashId: string;
8
+ };
9
+ export type { CSSObject, FullToken, GenerateStyle };
@@ -0,0 +1,13 @@
1
+ import type { AlertProps as AntAlertProps } from 'antd/es/alert';
2
+ import React from 'react';
3
+ export * from 'antd/es/alert';
4
+ export interface AlertProps extends AntAlertProps {
5
+ ghost?: boolean;
6
+ colored?: boolean;
7
+ }
8
+ declare const Alert: {
9
+ ({ ghost, colored, prefixCls: customizePrefixCls, className, ...restProps }: AlertProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
10
+ ErrorBoundary: typeof import("antd/es/alert/ErrorBoundary").default;
11
+ displayName: string;
12
+ };
13
+ export default Alert;
@@ -0,0 +1,8 @@
1
+ import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
2
+ export declare type AlertToken = FullToken<'Alert'>;
3
+ export declare const genAlertStyle: GenerateStyle<AlertToken>;
4
+ declare const _default: (prefixCls: string) => {
5
+ wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
6
+ hashId: string;
7
+ };
8
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import type { ButtonProps as AntButtonProps } from 'antd/es/button';
2
+ import React from 'react';
3
+ export * from 'antd/es/button';
4
+ export declare type ButtonProps = AntButtonProps;
5
+ declare const Button: {
6
+ ({ prefixCls: customizePrefixCls, className, ...restProps }: ButtonProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
7
+ Group: React.FC<import("antd/es/button").ButtonGroupProps>;
8
+ __ANT_BUTTON: any;
9
+ displayName: string;
10
+ };
11
+ export default Button;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
3
+ export declare type ButtonToken = FullToken<'Button'>;
4
+ export declare const genButtonStyle: GenerateStyle<ButtonToken>;
5
+ declare const _default: (prefixCls: string) => {
6
+ wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
7
+ hashId: string;
8
+ };
9
+ export default _default;
@@ -1,12 +1,18 @@
1
1
  import React from 'react';
2
- import type { ConfigProviderProps } from 'antd/es/config-provider';
2
+ import type { ConfigProviderProps as AntConfigProviderProps, ThemeConfig as AntThemeConfig } from 'antd/es/config-provider';
3
3
  export * from 'antd/es/config-provider';
4
+ export interface ThemeConfig extends AntThemeConfig {
5
+ isDark?: boolean;
6
+ }
7
+ export interface ConfigProviderProps extends AntConfigProviderProps {
8
+ theme?: ThemeConfig;
9
+ }
4
10
  declare const ConfigProvider: {
5
- ({ children, ...restProps }: ConfigProviderProps): React.JSX.Element;
11
+ ({ children, theme, ...restProps }: ConfigProviderProps): React.JSX.Element;
6
12
  ConfigContext: React.Context<import("antd/es/config-provider").ConfigConsumerProps>;
7
13
  SizeContext: React.Context<import("antd/es/button").ButtonSize>;
8
- config: ({ prefixCls, iconPrefixCls, theme, }: Pick<ConfigProviderProps, "prefixCls" | "iconPrefixCls"> & {
9
- theme?: import("antd").ThemeConfig | import("antd/es/config-provider/context").Theme;
14
+ config: ({ prefixCls, iconPrefixCls, theme, }: Pick<AntConfigProviderProps, "prefixCls" | "iconPrefixCls"> & {
15
+ theme?: AntThemeConfig | import("antd/es/config-provider/context").Theme;
10
16
  }) => void;
11
17
  useConfig: typeof import("antd/es/config-provider/hooks/useConfig").default;
12
18
  displayName: string;
@@ -1,17 +1,38 @@
1
- var _excluded = ["children"];
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _excluded = ["children", "theme"];
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
11
  import React from 'react';
5
12
  import { App, ConfigProvider as AntConfigProvider } from 'antd';
6
13
  import StaticFunction from "../static-function";
14
+ import defaultTheme from "../theme";
15
+ import defaultThemeToken from "../theme/default";
16
+ var defaultSeed = defaultTheme.defaultSeed,
17
+ components = defaultTheme.components;
7
18
  export * from 'antd/es/config-provider';
8
-
9
- // ConfigProvider 默认内嵌 App,支持 message, notification 和 Modal 等静态方法消费 ConfigProvider 配置
10
- // ref: https://ant-design.antgroup.com/components/app-cn
19
+ // ConfigProvider 默认设置主题和内嵌 App,支持 message, notification 和 Modal 等静态方法消费 ConfigProvider 配置
20
+ // ref: https://ant.design/components/app-cn
11
21
  var ConfigProvider = function ConfigProvider(_ref) {
22
+ var _theme$components;
12
23
  var children = _ref.children,
24
+ theme = _ref.theme,
13
25
  restProps = _objectWithoutProperties(_ref, _excluded);
14
- return /*#__PURE__*/React.createElement(AntConfigProvider, restProps, /*#__PURE__*/React.createElement(App, null, children, /*#__PURE__*/React.createElement(StaticFunction, null)));
26
+ return /*#__PURE__*/React.createElement(AntConfigProvider, _extends({
27
+ theme: _objectSpread(_objectSpread({}, theme), {}, {
28
+ // Only set seed token for dark theme
29
+ // Because defaultThemeToken is designed for light theme
30
+ token: theme !== null && theme !== void 0 && theme.isDark ? _objectSpread(_objectSpread({}, defaultSeed), theme === null || theme === void 0 ? void 0 : theme.token) : _objectSpread(_objectSpread(_objectSpread({}, defaultSeed), defaultThemeToken), theme === null || theme === void 0 ? void 0 : theme.token),
31
+ components: _objectSpread(_objectSpread(_objectSpread({}, components), theme === null || theme === void 0 ? void 0 : theme.components), {}, {
32
+ InputNumber: _objectSpread(_objectSpread({}, components === null || components === void 0 ? void 0 : components.InputNumber), theme === null || theme === void 0 ? void 0 : (_theme$components = theme.components) === null || _theme$components === void 0 ? void 0 : _theme$components.InputNumber)
33
+ })
34
+ })
35
+ }, restProps), /*#__PURE__*/React.createElement(App, null, children, /*#__PURE__*/React.createElement(StaticFunction, null)));
15
36
  };
16
37
  ConfigProvider.ConfigContext = AntConfigProvider.ConfigContext;
17
38
  ConfigProvider.SizeContext = AntConfigProvider.SizeContext;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { DescriptionsItemProps as AntDescriptionsItemProps } from 'antd/es/descriptions/Item';
3
+ import type { TextProps } from 'antd/es/typography/Text';
4
+ export interface DescriptionsItemProps extends AntDescriptionsItemProps {
5
+ contentProps?: TextProps;
6
+ }
7
+ declare const _default: import("react").FC<AntDescriptionsItemProps>;
8
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import type { DescriptionsProps as AntDescriptionsProps } from 'antd/es/descriptions';
2
+ import type { ReactElement } from 'react';
3
+ import React from 'react';
4
+ export * from 'antd/es/descriptions';
5
+ export declare type DescriptionsProps = AntDescriptionsProps;
6
+ declare const Descriptions: {
7
+ ({ children, bordered, prefixCls: customizePrefixCls, className, ...restProps }: DescriptionsProps): ReactElement<any, string | React.JSXElementConstructor<any>>;
8
+ displayName: string;
9
+ Item: React.FC<import("antd/es/descriptions/Item").DescriptionsItemProps>;
10
+ };
11
+ export default Descriptions;
@@ -0,0 +1,11 @@
1
+ import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
2
+ export declare type DescriptionsToken = FullToken<'Alert'> & {
3
+ typographyPrefixCls: string;
4
+ typographyComponentCls: string;
5
+ };
6
+ export declare const genDescriptionsStyle: GenerateStyle<DescriptionsToken>;
7
+ declare const _default: (prefixCls: string, typographyPrefixCls: string) => {
8
+ wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
9
+ hashId: string;
10
+ };
11
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import type { FormItemProps as AntFormItemProps } from 'antd/es/form';
2
+ import type { ReactNode } from 'react';
3
+ import React from 'react';
4
+ import type { TooltipProps } from '../tooltip';
5
+ export declare type WrapperTooltipProps = Omit<TooltipProps, 'mouseFollow'> & {
6
+ icon?: React.ReactElement;
7
+ };
8
+ export declare type LabelTooltipType = WrapperTooltipProps | React.ReactNode;
9
+ declare const FormItem: (<Values = any>(props: AntFormItemProps<Values>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
10
+ useStatus: () => {
11
+ status?: "" | "success" | "error" | "warning" | "validating";
12
+ errors: ReactNode[];
13
+ warnings: ReactNode[];
14
+ };
15
+ };
16
+ export default FormItem;
@@ -0,0 +1,3 @@
1
+ import { Form } from 'antd';
2
+ export * from 'antd/es/form';
3
+ export default Form;
@@ -0,0 +1 @@
1
+ export * from 'antd/es/form/interface';
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { theme } from 'antd';
2
2
 
3
3
  // 引入 antd/dist/reset.css,以重置基本样式,保证原生元素遵从 antd 规范样式
4
- // ref: https://ant-design.antgroup.com/docs/react/migration-v5-cn#%E6%8A%80%E6%9C%AF%E8%B0%83%E6%95%B4
4
+ // ref: https://ant.design/docs/react/migration-v5-cn#%E6%8A%80%E6%9C%AF%E8%B0%83%E6%95%B4
5
5
  import 'antd/dist/reset.css';
6
6
  export * from 'antd';
7
7
  export { version } from "../package.json";
@@ -0,0 +1,5 @@
1
+ import type { Locale as AntLocale } from 'antd/es/locale';
2
+ import type { TableLocale } from '../table';
3
+ export interface Locale extends AntLocale {
4
+ Table?: TableLocale;
5
+ }
@@ -0,0 +1 @@
1
+ export * from 'antd/es/message';
@@ -0,0 +1 @@
1
+ export * from 'antd/es/message';
@@ -0,0 +1 @@
1
+ export * from 'antd/es/message/interface';
@@ -0,0 +1 @@
1
+ export * from 'antd/es/modal/interface';
@@ -0,0 +1 @@
1
+ export * from 'antd/es/notification';
@@ -0,0 +1 @@
1
+ export * from 'antd/es/notification';
@@ -0,0 +1 @@
1
+ export * from 'antd/es/notification/interface';
@@ -1,9 +1,14 @@
1
+ import { message as antMessage, notification as antNotification } from 'antd';
1
2
  import type { MessageInstance } from 'antd/es/message/interface';
2
3
  import type { ModalStaticFunctions } from 'antd/es/modal/confirm';
3
4
  import type { NotificationInstance } from 'antd/es/notification/interface';
4
5
  declare let token: import("antd/lib/theme/internal").AliasToken;
5
- declare let message: MessageInstance;
6
- declare let notification: NotificationInstance;
6
+ declare let message: MessageInstance & {
7
+ useMessage: typeof antMessage.useMessage;
8
+ };
9
+ declare let notification: NotificationInstance & {
10
+ useNotification: typeof antNotification.useNotification;
11
+ };
7
12
  declare let modal: Omit<ModalStaticFunctions, 'warn'>;
8
13
  declare const _default: () => any;
9
14
  export default _default;
@@ -7,31 +7,30 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
7
7
  import { App, message as antMessage, Modal as AntModal, notification as antNotification } from 'antd';
8
8
  import formatToken from 'antd/lib/theme/util/alias';
9
9
  import theme from "../theme";
10
+ import defaultThemeToken from "../theme/default";
10
11
  var defaultAlgorithm = theme.defaultAlgorithm,
11
12
  defaultSeed = theme.defaultSeed,
12
13
  useToken = theme.useToken;
14
+
13
15
  // 设置默认 token
14
- var mapToken = _objectSpread(_objectSpread(_objectSpread({}, defaultAlgorithm(defaultSeed)), theme.token), {}, {
16
+ var mapToken = _objectSpread(_objectSpread(_objectSpread({}, defaultAlgorithm(defaultSeed)), defaultThemeToken), {}, {
15
17
  override: {}
16
18
  });
17
19
  var token = formatToken(mapToken);
18
20
  var message = antMessage;
19
21
  var notification = antNotification;
20
- var modal = {
21
- info: AntModal.info,
22
- success: AntModal.success,
23
- error: AntModal.error,
24
- warning: AntModal.warning,
25
- confirm: AntModal.confirm
26
- };
22
+ var modal = AntModal;
27
23
  export default (function () {
28
24
  // 自动注入 useToken,避免每次使用都要声明一遍,比较繁琐
29
25
  token = useToken().token;
30
26
  var staticFunction = App.useApp();
31
27
  // 替换 antd 的静态方法,支持消费 ConfigProvider 配置
32
28
  message = staticFunction.message;
29
+ message.useMessage = antMessage.useMessage;
33
30
  notification = staticFunction.notification;
31
+ notification.useNotification = antNotification.useNotification;
34
32
  modal = staticFunction.modal;
33
+ modal.useModal = AntModal.useModal;
35
34
  return null;
36
35
  });
37
36
  export { token, message, notification, modal };
@@ -0,0 +1 @@
1
+ export * from 'antd/es/table/interface';
@@ -0,0 +1,7 @@
1
+ import type { TabPaneProps as AntTabPaneProps } from 'antd/es/tabs/TabPane';
2
+ import type React from 'react';
3
+ export interface TabPaneProps extends AntTabPaneProps {
4
+ tag?: React.ReactNode;
5
+ }
6
+ declare const _default: React.FC<AntTabPaneProps>;
7
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import type { SizeType } from 'antd/es/config-provider/SizeContext';
2
+ import type { TabsPosition, TabsType } from 'antd/es/tabs';
3
+ import type { MutableRefObject } from 'react';
4
+ declare const _default: ({ prefixCls, activeKey, size, type, tabPosition, containerRef, }: {
5
+ prefixCls: string;
6
+ activeKey: string;
7
+ size: SizeType;
8
+ type: TabsType;
9
+ tabPosition: TabsPosition;
10
+ containerRef: MutableRefObject<HTMLDivElement>;
11
+ }) => void;
12
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import type { Tab } from 'rc-tabs/lib/interface';
2
+ import * as React from 'react';
3
+ import type { TabsProps } from '..';
4
+ export default function useLegacyItems(items?: TabsProps['items'], children?: React.ReactNode, prefixCls?: string): Tab[];
@@ -1,6 +1,6 @@
1
- import type { TabsPosition as AntTabsPosition, TabsProps as AntTabsProps } from 'antd/es/tabs';
2
- import type { Tab as AntTab } from 'rc-tabs/es/interface';
3
1
  import React from 'react';
2
+ import type { TabsProps as AntTabsProps, TabsPosition as AntTabsPosition } from 'antd/es/tabs';
3
+ import type { Tab as AntTab } from 'rc-tabs/es/interface';
4
4
  export * from 'antd/es/tabs';
5
5
  export type { TabPaneProps } from './TabPane';
6
6
  export interface Tab extends AntTab {
@@ -12,7 +12,7 @@ export interface TabsProps extends AntTabsProps {
12
12
  export declare type TabsPosition = AntTabsPosition;
13
13
  declare const Tabs: {
14
14
  ({ children, items, defaultActiveKey, activeKey: activeKeyProp, onChange, size, type, tabPosition, prefixCls: customizePrefixCls, className, ...restProps }: TabsProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
15
- TabPane: React.FC<TabPaneProps>;
15
+ TabPane: React.FC<import("antd").TabPaneProps>;
16
16
  displayName: string;
17
17
  };
18
18
  export default Tabs;
package/es/tabs/index.js CHANGED
@@ -16,12 +16,13 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
16
16
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
17
  import { isNullValue } from '@oceanbase/util';
18
18
  import { Space, Tabs as AntTabs, Tag } from 'antd';
19
+ import React, { useState, useRef, useContext } from 'react';
19
20
  import classNames from 'classnames';
20
- import React, { useContext, useRef, useState } from 'react';
21
21
  import ConfigProvider from "../config-provider";
22
22
  import useInkBar from "./hooks/useInkBar";
23
23
  import useLegacyItems from "./hooks/useLegacyItems";
24
24
  import useStyle from "./style";
25
+ import { useUpdateEffect } from 'ahooks';
25
26
  import TabPane from "./TabPane";
26
27
  export * from 'antd/es/tabs';
27
28
  var Tabs = function Tabs(_ref) {
@@ -64,6 +65,14 @@ var Tabs = function Tabs(_ref) {
64
65
  _useState2 = _slicedToArray(_useState, 2),
65
66
  activeKey = _useState2[0],
66
67
  setActiveKey = _useState2[1];
68
+
69
+ // 防止第一次顶掉默认值
70
+ useUpdateEffect(function () {
71
+ // 外部触发的 activeKey 更改,需要同步内部状态变化
72
+ if (activeKeyProp) {
73
+ setActiveKey(activeKeyProp);
74
+ }
75
+ }, [activeKeyProp]);
67
76
  useInkBar({
68
77
  prefixCls: prefixCls,
69
78
  activeKey: activeKey,
@@ -0,0 +1,8 @@
1
+ import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
2
+ export declare type TabsToken = FullToken<'Tabs'>;
3
+ export declare const genTagStyle: GenerateStyle<TabsToken>;
4
+ declare const _default: (prefixCls: string) => {
5
+ wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
6
+ hashId: string;
7
+ };
8
+ export default _default;
@@ -0,0 +1,74 @@
1
+ declare const _default: {
2
+ colorPrimaryBg: string;
3
+ colorPrimary: string;
4
+ colorPrimaryBgHover: string;
5
+ colorPrimaryBorder: string;
6
+ colorPrimaryBorderHover: string;
7
+ colorPrimaryHover: string;
8
+ colorPrimaryTextHover: string;
9
+ colorPrimaryText: string;
10
+ colorPrimaryTextActive: string;
11
+ colorSuccess: string;
12
+ colorSuccessBg: string;
13
+ colorSuccessBgHover: string;
14
+ colorSuccessBorder: string;
15
+ colorSuccessBorderHover: string;
16
+ colorSuccessHover: string;
17
+ colorSuccessActive: string;
18
+ colorSuccessTextHover: string;
19
+ colorSuccessText: string;
20
+ colorSuccessTextActive: string;
21
+ colorWarning: string;
22
+ colorWarningBg: string;
23
+ colorWarningBgHover: string;
24
+ colorWarningBorder: string;
25
+ colorWarningBorderHover: string;
26
+ colorWarningHover: string;
27
+ colorWarningActive: string;
28
+ colorWarningTextHover: string;
29
+ colorWarningText: string;
30
+ colorWarningTextActive: string;
31
+ colorErrorBg: string;
32
+ colorErrorBgHover: string;
33
+ colorErrorBorder: string;
34
+ colorErrorBorderHover: string;
35
+ colorErrorHover: string;
36
+ colorErrorActive: string;
37
+ colorErrorTextHover: string;
38
+ colorErrorText: string;
39
+ colorErrorTextActive: string;
40
+ colorError: string;
41
+ colorInfo: string;
42
+ colorInfoBg: string;
43
+ colorInfoBgHover: string;
44
+ colorInfoBorder: string;
45
+ colorInfoBorderHover: string;
46
+ colorInfoHover: string;
47
+ colorInfoActive: string;
48
+ colorInfoTextHover: string;
49
+ colorInfoText: string;
50
+ colorInfoTextActive: string;
51
+ colorTextBase: string;
52
+ colorBgBase: string;
53
+ colorText: string;
54
+ colorTextSecondary: string;
55
+ colorTextQuaternary: string;
56
+ colorTextTertiary: string;
57
+ colorBgContainer: string;
58
+ colorBgLayout: string;
59
+ colorBgSpotlight: string;
60
+ colorBgMask: string;
61
+ colorBorder: string;
62
+ colorBorderSecondary: string;
63
+ colorFillQuaternary: string;
64
+ colorFillTertiary: string;
65
+ colorFillSecondary: string;
66
+ colorFill: string;
67
+ colorIcon: string;
68
+ boxShadowSecondary: string;
69
+ boxShadow: string;
70
+ borderRadius: number;
71
+ wireframe: boolean;
72
+ colorPrimaryActive: string;
73
+ };
74
+ export default _default;
@@ -0,0 +1,73 @@
1
+ export default {
2
+ colorPrimaryBg: '#EAF1FF',
3
+ colorPrimary: '#006AFF',
4
+ colorPrimaryBgHover: '#EAF1FF',
5
+ colorPrimaryBorder: '#B3CCFF',
6
+ colorPrimaryBorderHover: '#5189FB',
7
+ colorPrimaryHover: '#004CE6',
8
+ colorPrimaryTextHover: '#5189FB',
9
+ colorPrimaryText: '#006AFF',
10
+ colorPrimaryTextActive: '#004CE6',
11
+ colorSuccess: '#0ac185',
12
+ colorSuccessBg: '#EEF8F5',
13
+ colorSuccessBgHover: '#B3E6D5',
14
+ colorSuccessBorder: '#B3E6D5',
15
+ colorSuccessBorderHover: '#4DCCA2',
16
+ colorSuccessHover: '#4DCCA2',
17
+ colorSuccessActive: '#00B378',
18
+ colorSuccessTextHover: '#4DCCA2',
19
+ colorSuccessText: '#0AC185',
20
+ colorSuccessTextActive: '#00B378',
21
+ colorWarning: '#ffac33',
22
+ colorWarningBg: '#FFF5E5',
23
+ colorWarningBgHover: '#FFD699',
24
+ colorWarningBorder: '#FFD699',
25
+ colorWarningBorderHover: '#FFC166',
26
+ colorWarningHover: '#FFC166',
27
+ colorWarningActive: '#FF9700',
28
+ colorWarningTextHover: '#FFC166',
29
+ colorWarningText: '#FFAC33',
30
+ colorWarningTextActive: '#FF9700',
31
+ colorErrorBg: '#FFEBEB',
32
+ colorErrorBgHover: '#FFB3B3',
33
+ colorErrorBorder: '#FFB3B3',
34
+ colorErrorBorderHover: '#FF8080',
35
+ colorErrorHover: '#FF8080',
36
+ colorErrorActive: '#EC1313',
37
+ colorErrorTextHover: '#FF8080',
38
+ colorErrorText: '#FF4B4B',
39
+ colorErrorTextActive: '#EC1313',
40
+ colorError: '#ff4b4b',
41
+ colorInfo: '#006aff',
42
+ colorInfoBg: '#EAF1FF',
43
+ colorInfoBgHover: '#EAF1FF',
44
+ colorInfoBorder: '#B3CCFF',
45
+ colorInfoBorderHover: '#5189FB',
46
+ colorInfoHover: '#5189FB',
47
+ colorInfoActive: '#004CE6',
48
+ colorInfoTextHover: '#5189FB',
49
+ colorInfoText: '#006AFF',
50
+ colorInfoTextActive: '#004CE6',
51
+ colorTextBase: '#132039',
52
+ colorBgBase: '#ffffff',
53
+ colorText: '#132039',
54
+ colorTextSecondary: '#364563',
55
+ colorTextQuaternary: '#CDD5E4',
56
+ colorTextTertiary: '#8592AD',
57
+ colorBgContainer: '#ffffff',
58
+ colorBgLayout: '#F5F8FE',
59
+ colorBgSpotlight: 'rgba(19, 32, 57, 0.85)',
60
+ colorBgMask: 'rgba(19, 32, 57, 0.65)',
61
+ colorBorder: '#CDD5E4',
62
+ colorBorderSecondary: '#E2E8F3',
63
+ colorFillQuaternary: 'rgb(245, 248, 254, 0.45)',
64
+ colorFillTertiary: 'rgb(245, 248, 254, 0.65)',
65
+ colorFillSecondary: 'rgb(245, 248, 254, 0.85)',
66
+ colorFill: '#F5F8FE',
67
+ colorIcon: '#8592AD',
68
+ 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)',
69
+ boxShadow: '0 1px 2px 0 rgba(54, 69, 99, 0.03), 0 1px 6px -1px rgba(54, 69, 99, 0.02), 0 2px 4px 0 rgba(54, 69, 99, 0.02)',
70
+ borderRadius: 6,
71
+ wireframe: false,
72
+ colorPrimaryActive: '#004CE6'
73
+ };