@oceanbase/design 0.2.17 → 0.2.18

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.
@@ -1,12 +1,11 @@
1
- import type { BadgeProps as AntBadgeProps } from 'antd/es/badge';
2
1
  import React from 'react';
2
+ import type { BadgeProps as AntBadgeProps } from 'antd/es/badge';
3
3
  export * from 'antd/es/badge';
4
4
  export interface BadgeProps extends AntBadgeProps {
5
5
  icon?: boolean | React.ReactNode;
6
6
  }
7
7
  declare const Badge: {
8
- ({ prefixCls: customizePrefixCls, className, icon, ...restProps }: BadgeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
8
+ ({ prefixCls: customizePrefixCls, className, status, text, icon, ...restProps }: BadgeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
9
9
  displayName: string;
10
- Icon: ({ icon, status, text, className, ...restProps }: import("./IconBadge").IconBadgeProps) => React.JSX.Element;
11
10
  };
12
11
  export default Badge;
package/es/badge/index.js CHANGED
@@ -1,41 +1,58 @@
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 = ["prefixCls", "className", "icon"];
1
+ var _excluded = ["prefixCls", "className", "status", "text", "icon"];
3
2
  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 _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; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- 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); }
7
3
  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; }
8
4
  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; }
5
+ import React, { useContext } from 'react';
9
6
  import { Badge as AntBadge } from 'antd';
7
+ import { CloseCircleFilled, CheckCircleFilled, Loading3QuartersOutlined, StopFilled, ClockCircleFilled } from '@oceanbase/icons';
10
8
  import classNames from 'classnames';
11
- import React, { useContext } from 'react';
12
9
  import ConfigProvider from "../config-provider";
13
- import IconBadge from "./IconBadge";
14
10
  import useStyle from "./style";
15
11
  export * from 'antd/es/badge';
16
12
  var Badge = function Badge(_ref) {
17
13
  var customizePrefixCls = _ref.prefixCls,
18
14
  className = _ref.className,
15
+ status = _ref.status,
16
+ text = _ref.text,
19
17
  icon = _ref.icon,
20
18
  restProps = _objectWithoutProperties(_ref, _excluded);
21
19
  var _useContext = useContext(ConfigProvider.ConfigContext),
22
20
  getPrefixCls = _useContext.getPrefixCls,
23
- badge = _useContext.badge;
21
+ iconPrefixCls = _useContext.iconPrefixCls;
24
22
  var prefixCls = getPrefixCls('badge', customizePrefixCls);
25
23
  var _useStyle = useStyle(prefixCls),
26
- wrapSSR = _useStyle.wrapSSR;
27
- var badgeCls = classNames(_defineProperty({}, "".concat(prefixCls), true), className);
28
- return wrapSSR( /*#__PURE__*/React.createElement(React.Fragment, null, icon ? /*#__PURE__*/React.createElement(IconBadge, _extends({
24
+ wrapSSR = _useStyle.wrapSSR,
25
+ hashId = _useStyle.hashId;
26
+ var badgeCls = classNames(prefixCls, className);
27
+ var iconMap = {
28
+ default: /*#__PURE__*/React.createElement(StopFilled, null),
29
+ processing: /*#__PURE__*/React.createElement(Loading3QuartersOutlined, {
30
+ style: {
31
+ display: 'inline-block'
32
+ },
33
+ className: "".concat(iconPrefixCls, "-spin")
34
+ }),
35
+ success: /*#__PURE__*/React.createElement(CheckCircleFilled, null),
36
+ error: /*#__PURE__*/React.createElement(CloseCircleFilled, null),
37
+ warning: /*#__PURE__*/React.createElement(ClockCircleFilled, null)
38
+ };
39
+ return wrapSSR( /*#__PURE__*/React.createElement(React.Fragment, null, status && icon ? /*#__PURE__*/React.createElement("span", _extends({
40
+ className: classNames(badgeCls, "".concat(prefixCls, "-status"), hashId),
41
+ style: {
42
+ display: 'inline-block'
43
+ }
44
+ }, restProps), /*#__PURE__*/React.createElement("span", {
45
+ className: classNames("".concat(prefixCls, "-status-icon"), "".concat(prefixCls, "-status-").concat(status))
46
+ }, /*#__PURE__*/React.isValidElement(icon) ? icon : iconMap[status]), text && /*#__PURE__*/React.createElement("span", {
47
+ className: "".concat(prefixCls, "-status-text")
48
+ }, text)) : /*#__PURE__*/React.createElement(AntBadge, _extends({
29
49
  prefixCls: customizePrefixCls,
30
50
  className: badgeCls,
31
- icon: icon
32
- }, restProps)) : /*#__PURE__*/React.createElement(AntBadge, _extends({
33
- prefixCls: customizePrefixCls,
34
- className: badgeCls
51
+ status: status,
52
+ text: text
35
53
  }, restProps))));
36
54
  };
37
55
  if (process.env.NODE_ENV !== 'production') {
38
56
  Badge.displayName = AntBadge.displayName;
39
57
  }
40
- Badge.Icon = IconBadge;
41
58
  export default Badge;
@@ -1,33 +1,35 @@
1
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
- 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; }
3
- 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; }
4
2
  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; }
5
3
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
4
  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); }
7
5
  import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
8
6
  export var genBadgeStyle = function genBadgeStyle(token) {
9
- var _$concat;
7
+ var _$concat, _$concat$concat;
10
8
  var componentCls = token.componentCls;
11
- return _defineProperty({}, "".concat(componentCls), (_$concat = {}, _defineProperty(_$concat, "".concat(componentCls, "-status-dot"), {
9
+ return _defineProperty({}, "".concat(componentCls).concat(componentCls, "-status"), (_$concat$concat = {}, _defineProperty(_$concat$concat, "".concat(componentCls, "-status-dot"), {
12
10
  width: 8,
13
11
  height: 8
14
- }), _defineProperty(_$concat, "".concat(componentCls, "-status-icon"), {
12
+ }), _defineProperty(_$concat$concat, "".concat(componentCls, "-status-icon"), (_$concat = {
13
+ fontSize: 12,
14
+ // remove dot style
15
+ backgroundColor: 'transparent'
16
+ }, _defineProperty(_$concat, '&::after', {
17
+ display: 'none'
18
+ }), _defineProperty(_$concat, "&".concat(componentCls, "-status-success"), {
15
19
  color: token.colorSuccess
16
- }), _defineProperty(_$concat, "".concat(componentCls, "-status-success"), {
17
- color: token.colorSuccess
18
- }), _defineProperty(_$concat, "".concat(componentCls, "-status-processing"), {
20
+ }), _defineProperty(_$concat, "&".concat(componentCls, "-status-processing"), {
19
21
  color: token.colorPrimary
20
- }), _defineProperty(_$concat, "".concat(componentCls, "-status-default"), {
22
+ }), _defineProperty(_$concat, "&".concat(componentCls, "-status-default"), {
21
23
  color: token.colorTextPlaceholder
22
- }), _defineProperty(_$concat, "".concat(componentCls, "-status-error"), {
24
+ }), _defineProperty(_$concat, "&".concat(componentCls, "-status-error"), {
23
25
  color: token.colorError
24
- }), _defineProperty(_$concat, "".concat(componentCls, "-status-warning"), {
26
+ }), _defineProperty(_$concat, "&".concat(componentCls, "-status-warning"), {
25
27
  color: token.colorWarning
26
- }), _$concat));
28
+ }), _$concat)), _$concat$concat));
27
29
  };
28
30
  export default (function (prefixCls) {
29
31
  var useStyle = genComponentStyleHook('Badge', function (token) {
30
- return [genBadgeStyle(_objectSpread({}, token))];
32
+ return [genBadgeStyle(token)];
31
33
  });
32
34
  return useStyle(prefixCls);
33
35
  });
@@ -10,6 +10,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
10
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; }
11
11
  import React from 'react';
12
12
  import { App, ConfigProvider as AntConfigProvider } from 'antd';
13
+ import { merge } from 'lodash';
13
14
  import StaticFunction from "../static-function";
14
15
  import defaultTheme from "../theme";
15
16
  import defaultThemeToken from "../theme/default";
@@ -20,37 +21,34 @@ var ExtendedConfigContext = /*#__PURE__*/React.createContext({
20
21
  });
21
22
  var defaultSeed = defaultTheme.defaultSeed,
22
23
  components = defaultTheme.components;
23
-
24
- // ConfigProvider 默认设置主题和内嵌 App,支持 message, notification 和 Modal 等静态方法消费 ConfigProvider 配置
25
- // ref: https://ant.design/components/app-cn
26
24
  var ConfigProvider = function ConfigProvider(_ref) {
27
- var _theme$components;
28
25
  var children = _ref.children,
29
26
  theme = _ref.theme,
30
27
  navigate = _ref.navigate,
31
28
  spin = _ref.spin,
32
29
  restProps = _objectWithoutProperties(_ref, _excluded);
33
30
  // inherit from parent ConfigProvider
34
- var parentContext = React.useContext(ExtendedConfigContext);
31
+ var parentContext = React.useContext(AntConfigProvider.ConfigContext);
32
+ var parentExtendedContext = React.useContext(ExtendedConfigContext);
35
33
  return /*#__PURE__*/React.createElement(AntConfigProvider, _extends({
36
- spin: spin,
37
- theme: _objectSpread(_objectSpread({}, theme), {}, {
34
+ spin: merge(parentContext.spin, spin),
35
+ theme: merge({
38
36
  // Only set seed token for dark theme
39
37
  // Because defaultThemeToken is designed for light theme
40
- 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),
41
- components: _objectSpread(_objectSpread(_objectSpread({}, components), theme === null || theme === void 0 ? void 0 : theme.components), {}, {
42
- 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)
38
+ token: theme !== null && theme !== void 0 && theme.isDark ? _objectSpread({}, defaultSeed) : _objectSpread(_objectSpread({}, defaultSeed), defaultThemeToken),
39
+ components: _objectSpread(_objectSpread({}, components), {}, {
40
+ InputNumber: _objectSpread({}, components === null || components === void 0 ? void 0 : components.InputNumber)
43
41
  })
44
- })
42
+ }, parentContext.theme, theme)
45
43
  }, restProps), /*#__PURE__*/React.createElement(ExtendedConfigContext.Provider, {
46
44
  value: {
47
- navigate: navigate === undefined ? parentContext.navigate : navigate
45
+ navigate: navigate === undefined ? parentExtendedContext.navigate : navigate
48
46
  }
49
47
  }, /*#__PURE__*/React.createElement(App, null, children, /*#__PURE__*/React.createElement(StaticFunction, null))));
50
48
  };
51
49
  ConfigProvider.ConfigContext = AntConfigProvider.ConfigContext;
52
50
  ConfigProvider.ExtendedConfigContext = ExtendedConfigContext;
53
- // SizeContext”已弃用。ts(6385)
51
+ // SizeContext is deprecated
54
52
  // ConfigProvider.SizeContext = AntConfigProvider.SizeContext;
55
53
  ConfigProvider.config = AntConfigProvider.config;
56
54
  ConfigProvider.useConfig = AntConfigProvider.useConfig;
@@ -16,7 +16,7 @@ export interface Path {
16
16
  */
17
17
  hash: string;
18
18
  }
19
- export type To = string | Partial<Path>;
19
+ export type To = string | Partial<Path> | any;
20
20
  export type RelativeRoutingType = 'route' | 'path';
21
21
  export interface NavigateOptions {
22
22
  replace?: boolean;
@@ -26,5 +26,5 @@ export interface NavigateOptions {
26
26
  }
27
27
  export interface NavigateFunction {
28
28
  (to: To, options?: NavigateOptions): void;
29
- (delta: number): void;
29
+ (delta: number | any): void;
30
30
  }
@@ -1,12 +1,11 @@
1
- import type { BadgeProps as AntBadgeProps } from 'antd/es/badge';
2
1
  import React from 'react';
2
+ import type { BadgeProps as AntBadgeProps } from 'antd/es/badge';
3
3
  export * from 'antd/es/badge';
4
4
  export interface BadgeProps extends AntBadgeProps {
5
5
  icon?: boolean | React.ReactNode;
6
6
  }
7
7
  declare const Badge: {
8
- ({ prefixCls: customizePrefixCls, className, icon, ...restProps }: BadgeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
8
+ ({ prefixCls: customizePrefixCls, className, status, text, icon, ...restProps }: BadgeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
9
9
  displayName: string;
10
- Icon: ({ icon, status, text, className, ...restProps }: import("./IconBadge").IconBadgeProps) => React.JSX.Element;
11
10
  };
12
11
  export default Badge;
@@ -33,42 +33,59 @@ __export(badge_exports, {
33
33
  default: () => badge_default
34
34
  });
35
35
  module.exports = __toCommonJS(badge_exports);
36
+ var import_react = __toESM(require("react"));
36
37
  var import_antd = require("antd");
38
+ var import_icons = require("@oceanbase/icons");
37
39
  var import_classnames = __toESM(require("classnames"));
38
- var import_react = __toESM(require("react"));
39
40
  var import_config_provider = __toESM(require("../config-provider"));
40
- var import_IconBadge = __toESM(require("./IconBadge"));
41
41
  var import_style = __toESM(require("./style"));
42
42
  __reExport(badge_exports, require("antd/es/badge"), module.exports);
43
43
  var Badge = ({
44
44
  prefixCls: customizePrefixCls,
45
45
  className,
46
+ status,
47
+ text,
46
48
  icon,
47
49
  ...restProps
48
50
  }) => {
49
- const { getPrefixCls, badge } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
51
+ const { getPrefixCls, iconPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
50
52
  const prefixCls = getPrefixCls("badge", customizePrefixCls);
51
- const { wrapSSR } = (0, import_style.default)(prefixCls);
52
- const badgeCls = (0, import_classnames.default)(
53
- {
54
- [`${prefixCls}`]: true
55
- },
56
- className
57
- );
53
+ const { wrapSSR, hashId } = (0, import_style.default)(prefixCls);
54
+ const badgeCls = (0, import_classnames.default)(prefixCls, className);
55
+ const iconMap = {
56
+ default: /* @__PURE__ */ import_react.default.createElement(import_icons.StopFilled, null),
57
+ processing: /* @__PURE__ */ import_react.default.createElement(
58
+ import_icons.Loading3QuartersOutlined,
59
+ {
60
+ style: {
61
+ display: "inline-block"
62
+ },
63
+ className: `${iconPrefixCls}-spin`
64
+ }
65
+ ),
66
+ success: /* @__PURE__ */ import_react.default.createElement(import_icons.CheckCircleFilled, null),
67
+ error: /* @__PURE__ */ import_react.default.createElement(import_icons.CloseCircleFilled, null),
68
+ warning: /* @__PURE__ */ import_react.default.createElement(import_icons.ClockCircleFilled, null)
69
+ };
58
70
  return wrapSSR(
59
- /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, icon ? /* @__PURE__ */ import_react.default.createElement(
60
- import_IconBadge.default,
71
+ /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, status && icon ? /* @__PURE__ */ import_react.default.createElement(
72
+ "span",
61
73
  {
62
- prefixCls: customizePrefixCls,
63
- className: badgeCls,
64
- icon,
74
+ className: (0, import_classnames.default)(badgeCls, `${prefixCls}-status`, hashId),
75
+ style: {
76
+ display: "inline-block"
77
+ },
65
78
  ...restProps
66
- }
79
+ },
80
+ /* @__PURE__ */ import_react.default.createElement("span", { className: (0, import_classnames.default)(`${prefixCls}-status-icon`, `${prefixCls}-status-${status}`) }, import_react.default.isValidElement(icon) ? icon : iconMap[status]),
81
+ text && /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefixCls}-status-text` }, text)
67
82
  ) : /* @__PURE__ */ import_react.default.createElement(
68
83
  import_antd.Badge,
69
84
  {
70
85
  prefixCls: customizePrefixCls,
71
86
  className: badgeCls,
87
+ status,
88
+ text,
72
89
  ...restProps
73
90
  }
74
91
  ))
@@ -77,7 +94,6 @@ var Badge = ({
77
94
  if (process.env.NODE_ENV !== "production") {
78
95
  Badge.displayName = import_antd.Badge.displayName;
79
96
  }
80
- Badge.Icon = import_IconBadge.default;
81
97
  var badge_default = Badge;
82
98
  // Annotate the CommonJS export names for ESM import in node:
83
99
  0 && (module.exports = {
@@ -27,39 +27,42 @@ var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
27
27
  var genBadgeStyle = (token) => {
28
28
  const { componentCls } = token;
29
29
  return {
30
- [`${componentCls}`]: {
30
+ [`${componentCls}${componentCls}-status`]: {
31
+ // dot style
31
32
  [`${componentCls}-status-dot`]: {
32
33
  width: 8,
33
34
  height: 8
34
35
  },
36
+ // icon style
35
37
  [`${componentCls}-status-icon`]: {
36
- color: token.colorSuccess
37
- },
38
- [`${componentCls}-status-success`]: {
39
- color: token.colorSuccess
40
- },
41
- [`${componentCls}-status-processing`]: {
42
- color: token.colorPrimary
43
- },
44
- [`${componentCls}-status-default`]: {
45
- color: token.colorTextPlaceholder
46
- },
47
- [`${componentCls}-status-error`]: {
48
- color: token.colorError
49
- },
50
- [`${componentCls}-status-warning`]: {
51
- color: token.colorWarning
38
+ fontSize: 12,
39
+ // remove dot style
40
+ backgroundColor: "transparent",
41
+ ["&::after"]: {
42
+ display: "none"
43
+ },
44
+ [`&${componentCls}-status-success`]: {
45
+ color: token.colorSuccess
46
+ },
47
+ [`&${componentCls}-status-processing`]: {
48
+ color: token.colorPrimary
49
+ },
50
+ [`&${componentCls}-status-default`]: {
51
+ color: token.colorTextPlaceholder
52
+ },
53
+ [`&${componentCls}-status-error`]: {
54
+ color: token.colorError
55
+ },
56
+ [`&${componentCls}-status-warning`]: {
57
+ color: token.colorWarning
58
+ }
52
59
  }
53
60
  }
54
61
  };
55
62
  };
56
63
  var style_default = (prefixCls) => {
57
64
  const useStyle = (0, import_genComponentStyleHook.genComponentStyleHook)("Badge", (token) => {
58
- return [
59
- genBadgeStyle({
60
- ...token
61
- })
62
- ];
65
+ return [genBadgeStyle(token)];
63
66
  });
64
67
  return useStyle(prefixCls);
65
68
  };
@@ -35,6 +35,7 @@ __export(config_provider_exports, {
35
35
  module.exports = __toCommonJS(config_provider_exports);
36
36
  var import_react = __toESM(require("react"));
37
37
  var import_antd = require("antd");
38
+ var import_lodash = require("lodash");
38
39
  var import_static_function = __toESM(require("../static-function"));
39
40
  var import_theme = __toESM(require("../theme"));
40
41
  var import_default = __toESM(require("../theme/default"));
@@ -45,40 +46,39 @@ var ExtendedConfigContext = import_react.default.createContext({
45
46
  });
46
47
  var { defaultSeed, components } = import_theme.default;
47
48
  var ConfigProvider = ({ children, theme, navigate, spin, ...restProps }) => {
48
- var _a;
49
- const parentContext = import_react.default.useContext(ExtendedConfigContext);
49
+ const parentContext = import_react.default.useContext(import_antd.ConfigProvider.ConfigContext);
50
+ const parentExtendedContext = import_react.default.useContext(ExtendedConfigContext);
50
51
  return /* @__PURE__ */ import_react.default.createElement(
51
52
  import_antd.ConfigProvider,
52
53
  {
53
- spin,
54
- theme: {
55
- ...theme,
56
- // Only set seed token for dark theme
57
- // Because defaultThemeToken is designed for light theme
58
- token: (theme == null ? void 0 : theme.isDark) ? {
59
- ...defaultSeed,
60
- ...theme == null ? void 0 : theme.token
61
- } : {
62
- ...defaultSeed,
63
- ...import_default.default,
64
- ...theme == null ? void 0 : theme.token
65
- },
66
- components: {
67
- ...components,
68
- ...theme == null ? void 0 : theme.components,
69
- InputNumber: {
70
- ...components == null ? void 0 : components.InputNumber,
71
- ...(_a = theme == null ? void 0 : theme.components) == null ? void 0 : _a.InputNumber
54
+ spin: (0, import_lodash.merge)(parentContext.spin, spin),
55
+ theme: (0, import_lodash.merge)(
56
+ {
57
+ // Only set seed token for dark theme
58
+ // Because defaultThemeToken is designed for light theme
59
+ token: (theme == null ? void 0 : theme.isDark) ? {
60
+ ...defaultSeed
61
+ } : {
62
+ ...defaultSeed,
63
+ ...import_default.default
64
+ },
65
+ components: {
66
+ ...components,
67
+ InputNumber: {
68
+ ...components == null ? void 0 : components.InputNumber
69
+ }
72
70
  }
73
- }
74
- },
71
+ },
72
+ parentContext.theme,
73
+ theme
74
+ ),
75
75
  ...restProps
76
76
  },
77
77
  /* @__PURE__ */ import_react.default.createElement(
78
78
  ExtendedConfigContext.Provider,
79
79
  {
80
80
  value: {
81
- navigate: navigate === void 0 ? parentContext.navigate : navigate
81
+ navigate: navigate === void 0 ? parentExtendedContext.navigate : navigate
82
82
  }
83
83
  },
84
84
  /* @__PURE__ */ import_react.default.createElement(import_antd.App, null, children, /* @__PURE__ */ import_react.default.createElement(import_static_function.default, null))
@@ -16,7 +16,7 @@ export interface Path {
16
16
  */
17
17
  hash: string;
18
18
  }
19
- export type To = string | Partial<Path>;
19
+ export type To = string | Partial<Path> | any;
20
20
  export type RelativeRoutingType = 'route' | 'path';
21
21
  export interface NavigateOptions {
22
22
  replace?: boolean;
@@ -26,5 +26,5 @@ export interface NavigateOptions {
26
26
  }
27
27
  export interface NavigateFunction {
28
28
  (to: To, options?: NavigateOptions): void;
29
- (delta: number): void;
29
+ (delta: number | any): void;
30
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oceanbase/design",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "description": "The Design System of OceanBase",
5
5
  "keywords": [
6
6
  "oceanbase",
@@ -55,5 +55,5 @@
55
55
  "react": "^16.9.0",
56
56
  "react-dom": "^16.9.0"
57
57
  },
58
- "gitHead": "6f801e95ba5ddc345f6d2c462bcf2af1abc74c84"
58
+ "gitHead": "489ec76ca21b3a0448dae92fc001f2b03a4bf053"
59
59
  }
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- export interface IconBadgeProps {
3
- prefixCls: any;
4
- className?: string;
5
- status?: string;
6
- text?: React.ReactNode;
7
- icon?: boolean | React.ReactNode;
8
- }
9
- declare const IconBadge: ({ icon, status, text, className, ...restProps }: IconBadgeProps) => React.JSX.Element;
10
- export default IconBadge;
@@ -1,37 +0,0 @@
1
- var _excluded = ["icon", "status", "text", "className"];
2
- 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
- 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
- import React from 'react';
5
- import { Space } from 'antd';
6
- import { CloseCircleFilled, CheckCircleFilled, Loading3QuartersOutlined, StopFilled, ClockCircleFilled } from '@ant-design/icons';
7
- // @ts-ignore
8
- // import waitingIcon from './style/waiting.png';
9
- var IconBadge = function IconBadge(_ref) {
10
- var icon = _ref.icon,
11
- status = _ref.status,
12
- text = _ref.text,
13
- className = _ref.className,
14
- restProps = _objectWithoutProperties(_ref, _excluded);
15
- var classNameIcon = "".concat(className, "-status-icon ").concat(className, "-status-").concat(status);
16
- var statusTextNode = !text ? /*#__PURE__*/React.createElement(React.Fragment, null) : /*#__PURE__*/React.createElement("span", {
17
- className: "".concat(className, "-status-text")
18
- }, text);
19
- var iconMap = {
20
- default: /*#__PURE__*/React.createElement(StopFilled, null),
21
- processing: /*#__PURE__*/React.createElement(Loading3QuartersOutlined, {
22
- style: {
23
- display: 'inline-block',
24
- animation: 'loadingCircle 1s infinite linear'
25
- }
26
- }),
27
- success: /*#__PURE__*/React.createElement(CheckCircleFilled, null),
28
- error: /*#__PURE__*/React.createElement(CloseCircleFilled, null),
29
- warning: /*#__PURE__*/React.createElement(ClockCircleFilled, null)
30
- };
31
- return /*#__PURE__*/React.createElement(Space, {
32
- className: "".concat(className)
33
- }, /*#__PURE__*/React.createElement("span", {
34
- className: classNameIcon
35
- }, /*#__PURE__*/React.isValidElement(icon) ? icon : iconMap === null || iconMap === void 0 ? void 0 : iconMap[status]), statusTextNode);
36
- };
37
- export default IconBadge;
Binary file
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- export interface IconBadgeProps {
3
- prefixCls: any;
4
- className?: string;
5
- status?: string;
6
- text?: React.ReactNode;
7
- icon?: boolean | React.ReactNode;
8
- }
9
- declare const IconBadge: ({ icon, status, text, className, ...restProps }: IconBadgeProps) => React.JSX.Element;
10
- export default IconBadge;
@@ -1,53 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/badge/IconBadge.tsx
30
- var IconBadge_exports = {};
31
- __export(IconBadge_exports, {
32
- default: () => IconBadge_default
33
- });
34
- module.exports = __toCommonJS(IconBadge_exports);
35
- var import_react = __toESM(require("react"));
36
- var import_antd = require("antd");
37
- var import_icons = require("@ant-design/icons");
38
- var IconBadge = ({ icon, status, text, className, ...restProps }) => {
39
- const classNameIcon = `${className}-status-icon ${className}-status-${status}`;
40
- const statusTextNode = !text ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null) : /* @__PURE__ */ import_react.default.createElement("span", { className: `${className}-status-text` }, text);
41
- const iconMap = {
42
- default: /* @__PURE__ */ import_react.default.createElement(import_icons.StopFilled, null),
43
- processing: /* @__PURE__ */ import_react.default.createElement(import_icons.Loading3QuartersOutlined, { style: {
44
- display: "inline-block",
45
- animation: "loadingCircle 1s infinite linear"
46
- } }),
47
- success: /* @__PURE__ */ import_react.default.createElement(import_icons.CheckCircleFilled, null),
48
- error: /* @__PURE__ */ import_react.default.createElement(import_icons.CloseCircleFilled, null),
49
- warning: /* @__PURE__ */ import_react.default.createElement(import_icons.ClockCircleFilled, null)
50
- };
51
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { className: `${className}` }, /* @__PURE__ */ import_react.default.createElement("span", { className: classNameIcon }, import_react.default.isValidElement(icon) ? icon : iconMap == null ? void 0 : iconMap[status]), statusTextNode);
52
- };
53
- var IconBadge_default = IconBadge;
Binary file