@oceanbase/design 0.4.12 → 0.4.13
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.
- package/dist/design.min.js +1 -1
- package/es/anchor/index.d.ts +1 -0
- package/es/anchor/index.js +1 -0
- package/es/avatar/index.d.ts +1 -0
- package/es/avatar/index.js +1 -0
- package/es/segmented/index.d.ts +3 -0
- package/es/segmented/index.js +26 -7
- package/es/segmented/style/index.js +13 -2
- package/es/slider/style/index.js +9 -2
- package/es/tabs/TabPane.d.ts +4 -0
- package/es/tabs/index.d.ts +4 -0
- package/es/tabs/index.js +19 -4
- package/es/tabs/style/index.js +10 -3
- package/lib/anchor/index.d.ts +1 -0
- package/lib/anchor/index.js +2 -0
- package/lib/avatar/index.d.ts +1 -0
- package/lib/avatar/index.js +2 -0
- package/lib/segmented/index.d.ts +3 -0
- package/lib/segmented/index.js +13 -3
- package/lib/segmented/style/index.js +26 -2
- package/lib/slider/style/index.js +5 -1
- package/lib/tabs/TabPane.d.ts +4 -0
- package/lib/tabs/index.d.ts +4 -0
- package/lib/tabs/index.js +15 -2
- package/lib/tabs/style/index.js +14 -1
- package/package.json +2 -2
package/es/anchor/index.d.ts
CHANGED
package/es/anchor/index.js
CHANGED
package/es/avatar/index.d.ts
CHANGED
package/es/avatar/index.js
CHANGED
package/es/segmented/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SegmentedProps as AntSegmentedProps, SegmentedLabeledOption as AntSegmentedLabeledOption } from 'antd/es/segmented';
|
|
3
3
|
import type { EllipsisConfig } from '../typography';
|
|
4
|
+
import type { BadgeProps } from '../badge';
|
|
4
5
|
import type { SegmentedRawOption } from 'rc-segmented';
|
|
5
6
|
export * from 'antd/es/segmented';
|
|
7
|
+
type BadgeType = BadgeProps | BadgeProps['count'];
|
|
6
8
|
export type SegmentedLabeledOption = AntSegmentedLabeledOption & {
|
|
7
9
|
ellipsis?: EllipsisConfig;
|
|
10
|
+
badge?: BadgeType;
|
|
8
11
|
};
|
|
9
12
|
export interface SegmentedProps extends Omit<AntSegmentedProps, 'ref'> {
|
|
10
13
|
options: (SegmentedRawOption | SegmentedLabeledOption)[];
|
package/es/segmented/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _excluded = ["prefixCls", "options"],
|
|
2
|
-
_excluded2 = ["label"];
|
|
2
|
+
_excluded2 = ["label", "badge"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
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; }
|
|
@@ -8,13 +8,18 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
8
8
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
9
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; }
|
|
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
|
-
import React, { useContext } from 'react';
|
|
12
|
-
import { Segmented as AntSegmented } from 'antd';
|
|
11
|
+
import React, { useCallback, useContext } from 'react';
|
|
12
|
+
import { Segmented as AntSegmented, Flex } from 'antd';
|
|
13
13
|
import ConfigProvider from "../config-provider";
|
|
14
14
|
import Typography from "../typography";
|
|
15
|
+
import Badge from "../badge";
|
|
15
16
|
import useStyle from "./style";
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
19
|
export * from 'antd/es/segmented';
|
|
20
|
+
var isReactNode = function isReactNode(item) {
|
|
21
|
+
return /*#__PURE__*/React.isValidElement(item);
|
|
22
|
+
};
|
|
18
23
|
var Segmented = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
19
24
|
var customizePrefixCls = _ref.prefixCls,
|
|
20
25
|
options = _ref.options,
|
|
@@ -24,14 +29,28 @@ var Segmented = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
24
29
|
var prefixCls = getPrefixCls('segmented', customizePrefixCls);
|
|
25
30
|
var _useStyle = useStyle(prefixCls),
|
|
26
31
|
wrapSSR = _useStyle.wrapSSR;
|
|
32
|
+
var renderBadge = useCallback(function (badge) {
|
|
33
|
+
if (_typeof(badge) === 'object' && !isReactNode(badge)) {
|
|
34
|
+
return /*#__PURE__*/_jsx(Badge, _objectSpread({}, badge));
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/_jsx(Badge, {
|
|
37
|
+
count: badge
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
27
40
|
var newOptions = options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
28
|
-
if (_typeof(item) === 'object'
|
|
41
|
+
if (_typeof(item) === 'object') {
|
|
29
42
|
var label = item.label,
|
|
43
|
+
badge = item.badge,
|
|
30
44
|
restItem = _objectWithoutProperties(item, _excluded2);
|
|
31
45
|
return _objectSpread(_objectSpread({}, restItem), {}, {
|
|
32
|
-
label: /*#__PURE__*/
|
|
33
|
-
|
|
34
|
-
|
|
46
|
+
label: /*#__PURE__*/_jsxs(Flex, {
|
|
47
|
+
gap: 4,
|
|
48
|
+
align: "center",
|
|
49
|
+
justify: "center",
|
|
50
|
+
children: [item !== null && item !== void 0 && item.ellipsis ? /*#__PURE__*/_jsx(Typography.Text, {
|
|
51
|
+
ellipsis: item.ellipsis,
|
|
52
|
+
children: label
|
|
53
|
+
}) : label, badge && renderBadge(badge)]
|
|
35
54
|
})
|
|
36
55
|
});
|
|
37
56
|
}
|
|
@@ -4,8 +4,19 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
4
4
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
5
|
import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
|
|
6
6
|
export var genSegmentedStyle = function genSegmentedStyle(token) {
|
|
7
|
-
var componentCls = token.componentCls
|
|
8
|
-
|
|
7
|
+
var componentCls = token.componentCls,
|
|
8
|
+
antCls = token.antCls,
|
|
9
|
+
colorFill = token.colorFill,
|
|
10
|
+
colorFillSecondary = token.colorFillSecondary;
|
|
11
|
+
return _defineProperty({}, "".concat(componentCls, " >").concat(componentCls, "-group"), _defineProperty(_defineProperty({}, "&:not(:has(".concat(componentCls, "-thumb)) >").concat(componentCls, "-item"), _defineProperty({}, "&:not(.ant-segmented-item-selected) >".concat(componentCls, "-item-label"), _defineProperty(_defineProperty({}, '&:hover', _defineProperty({}, "".concat(antCls, "-badge >").concat(antCls, "-badge-count"), {
|
|
12
|
+
backgroundColor: colorFill
|
|
13
|
+
})), '&:active', _defineProperty({}, "".concat(antCls, "-badge >").concat(antCls, "-badge-count"), {
|
|
14
|
+
backgroundColor: colorFillSecondary
|
|
15
|
+
})))), ">".concat(componentCls, "-item"), _defineProperty({}, ">".concat(componentCls, "-item-label"), _defineProperty({}, "".concat(antCls, "-badge >").concat(antCls, "-badge-count"), {
|
|
16
|
+
backgroundColor: colorFillSecondary,
|
|
17
|
+
color: 'inherit',
|
|
18
|
+
boxShadow: 'none'
|
|
19
|
+
}))));
|
|
9
20
|
};
|
|
10
21
|
export default (function (prefixCls) {
|
|
11
22
|
var useStyle = genComponentStyleHook('Segmented', function (token) {
|
package/es/slider/style/index.js
CHANGED
|
@@ -2,15 +2,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
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; }
|
|
3
3
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
4
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
+
import { toNumber } from 'lodash';
|
|
5
6
|
import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
|
|
6
7
|
export var genSliderStyle = function genSliderStyle(token) {
|
|
7
8
|
var componentCls = token.componentCls,
|
|
8
9
|
_token$dotSize = token.dotSize,
|
|
9
|
-
dotSize = _token$dotSize === void 0 ? 8 : _token$dotSize
|
|
10
|
-
|
|
10
|
+
dotSize = _token$dotSize === void 0 ? 8 : _token$dotSize,
|
|
11
|
+
_token$handleSize = token.handleSize,
|
|
12
|
+
handleSize = _token$handleSize === void 0 ? 10 : _token$handleSize,
|
|
13
|
+
_token$handleLineWidt = token.handleLineWidth,
|
|
14
|
+
handleLineWidth = _token$handleLineWidt === void 0 ? 2 : _token$handleLineWidt;
|
|
15
|
+
return _defineProperty({}, "".concat(componentCls).concat(componentCls, "-horizontal"), _defineProperty({}, "".concat(componentCls, "-mark"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls, "-mark-text[style*=\"left: 0%;\"]"), {
|
|
11
16
|
transform: "translateX(calc(0% - ".concat(dotSize / 2, "px)) !important")
|
|
12
17
|
}), "".concat(componentCls, "-mark-text[style*=\"left: 100%;\"]"), {
|
|
13
18
|
transform: "translateX(calc(-100% + ".concat(dotSize / 2, "px)) !important")
|
|
19
|
+
}), "".concat(componentCls, "-mark-text[style=\"transform: translateX(-50%);\"]"), {
|
|
20
|
+
transform: "translateX(calc(0% - ".concat((handleSize + toNumber(handleLineWidth) * 2) / 2, "px)) !important")
|
|
14
21
|
})));
|
|
15
22
|
};
|
|
16
23
|
export default (function (prefixCls) {
|
package/es/tabs/TabPane.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { TabPaneProps as AntTabPaneProps } from 'antd/es/tabs/TabPane';
|
|
2
2
|
import type React from 'react';
|
|
3
|
+
import type { BadgeProps } from '../badge';
|
|
4
|
+
type BadgeType = BadgeProps | BadgeProps['count'];
|
|
3
5
|
export interface TabPaneProps extends AntTabPaneProps {
|
|
6
|
+
/** @deprecated please use `badge` instead */
|
|
4
7
|
tag?: React.ReactNode;
|
|
5
8
|
divider?: boolean;
|
|
9
|
+
badge?: BadgeType;
|
|
6
10
|
}
|
|
7
11
|
declare const _default: React.FC<TabPaneProps>;
|
|
8
12
|
export default _default;
|
package/es/tabs/index.d.ts
CHANGED
|
@@ -2,15 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import type { TabsProps as AntTabsProps, TabsPosition as AntTabsPosition } from 'antd/es/tabs';
|
|
3
3
|
import type { Tab as AntTab } from 'rc-tabs/es/interface';
|
|
4
4
|
import type { TabPaneProps } from './TabPane';
|
|
5
|
+
import type { BadgeProps } from '../badge';
|
|
5
6
|
export * from 'antd/es/tabs';
|
|
6
7
|
export type { TabPaneProps };
|
|
8
|
+
type BadgeType = BadgeProps | BadgeProps['count'];
|
|
7
9
|
export interface AntTabOptional extends Omit<AntTab, 'key' | 'label'> {
|
|
8
10
|
key?: string;
|
|
9
11
|
label?: React.ReactNode;
|
|
10
12
|
}
|
|
11
13
|
export type Tab = {
|
|
14
|
+
/** @deprecated please use `badge` instead */
|
|
12
15
|
tag?: React.ReactNode;
|
|
13
16
|
divider?: boolean;
|
|
17
|
+
badge?: BadgeType;
|
|
14
18
|
} & (AntTab | AntTabOptional);
|
|
15
19
|
export interface TabsProps extends Omit<AntTabsProps, 'items'> {
|
|
16
20
|
items?: Tab[];
|
package/es/tabs/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
1
|
var _excluded = ["children", "items", "type", "tabPosition", "prefixCls", "className"];
|
|
3
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
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; }
|
|
6
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
10
10
|
import { isNullValue } from '@oceanbase/util';
|
|
11
11
|
import { Divider, Space, Tabs as AntTabs, Tag } from 'antd';
|
|
12
|
-
import React, { useContext } from 'react';
|
|
12
|
+
import React, { useCallback, useContext } from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
+
import Badge from "../badge";
|
|
14
15
|
import ConfigProvider from "../config-provider";
|
|
15
16
|
import useLegacyItems from "./hooks/useLegacyItems";
|
|
16
17
|
import useStyle, { genTabsStyle } from "./style";
|
|
@@ -18,6 +19,9 @@ import TabPane from "./TabPane";
|
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
21
|
export * from 'antd/es/tabs';
|
|
22
|
+
var isReactNode = function isReactNode(item) {
|
|
23
|
+
return /*#__PURE__*/React.isValidElement(item);
|
|
24
|
+
};
|
|
21
25
|
var Tabs = function Tabs(_ref) {
|
|
22
26
|
var _newItems;
|
|
23
27
|
var children = _ref.children,
|
|
@@ -37,6 +41,17 @@ var Tabs = function Tabs(_ref) {
|
|
|
37
41
|
var dividerList = (items === null || items === void 0 ? void 0 : items.filter(function (item) {
|
|
38
42
|
return item.divider;
|
|
39
43
|
})) || [];
|
|
44
|
+
var renderBadge = useCallback(function (badge) {
|
|
45
|
+
if (_typeof(badge) === 'object' && !isReactNode(badge)) {
|
|
46
|
+
return /*#__PURE__*/_jsx(Badge, _objectSpread(_objectSpread({}, badge), {}, {
|
|
47
|
+
className: classNames("".concat(prefixCls, "-tab-badge"), badge.className)
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
return /*#__PURE__*/_jsx(Badge, {
|
|
51
|
+
className: "".concat(prefixCls, "-tab-badge"),
|
|
52
|
+
count: badge
|
|
53
|
+
});
|
|
54
|
+
}, [prefixCls]);
|
|
40
55
|
var newItems = useLegacyItems(items, children);
|
|
41
56
|
newItems = (_newItems = newItems) === null || _newItems === void 0 ? void 0 : _newItems.map(function (item) {
|
|
42
57
|
if (!isNullValue(item.divider)) {
|
|
@@ -50,11 +65,11 @@ var Tabs = function Tabs(_ref) {
|
|
|
50
65
|
}),
|
|
51
66
|
disabled: true
|
|
52
67
|
});
|
|
53
|
-
} else if (!isNullValue(item.tag)) {
|
|
68
|
+
} else if (!isNullValue(item.tag) || !isNullValue(item.badge)) {
|
|
54
69
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
55
70
|
label: /*#__PURE__*/_jsxs(Space, {
|
|
56
71
|
size: 4,
|
|
57
|
-
children: [item.label, /*#__PURE__*/_jsx(Tag, {
|
|
72
|
+
children: [item.label, item.badge && renderBadge(item.badge), !isNullValue(item.tag) && /*#__PURE__*/_jsx(Tag, {
|
|
58
73
|
bordered: false,
|
|
59
74
|
className: "".concat(prefixCls, "-tab-tag"),
|
|
60
75
|
children: item.tag
|
package/es/tabs/style/index.js
CHANGED
|
@@ -8,18 +8,25 @@ export var genTabsStyle = function genTabsStyle(token) {
|
|
|
8
8
|
componentCls = token.componentCls,
|
|
9
9
|
colorInfo = token.colorInfo,
|
|
10
10
|
colorInfoBg = token.colorInfoBg,
|
|
11
|
-
colorTextSecondary = token.colorTextSecondary
|
|
11
|
+
colorTextSecondary = token.colorTextSecondary,
|
|
12
|
+
colorFillQuaternary = token.colorFillQuaternary;
|
|
12
13
|
return _defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "&".concat(componentCls, "-top, &").concat(componentCls, "-bottom"), _defineProperty({}, "".concat(componentCls, "-nav::before"), {
|
|
13
14
|
// 页签位置为 top 和 bottom 时,去掉分割线
|
|
14
15
|
border: 'none'
|
|
15
|
-
})), "".concat(componentCls, "-tab"), _defineProperty({}, "".concat(componentCls, "-tab-tag"), {
|
|
16
|
+
})), "".concat(componentCls, "-tab"), _defineProperty(_defineProperty({}, "".concat(componentCls, "-tab-tag"), {
|
|
16
17
|
color: colorTextSecondary,
|
|
17
18
|
fontFamily: 'PingFangSC',
|
|
18
19
|
fontSize: 12,
|
|
19
20
|
borderRadius: 12,
|
|
20
21
|
marginInlineEnd: 0,
|
|
21
22
|
height: 20
|
|
22
|
-
})
|
|
23
|
+
}), "".concat(componentCls, "-tab-badge"), _defineProperty(_defineProperty({}, ">".concat(antCls, "-badge-count"), {
|
|
24
|
+
color: colorTextSecondary,
|
|
25
|
+
backgroundColor: colorFillQuaternary
|
|
26
|
+
}), "borderRadius", 12))), "".concat(componentCls, "-tab-active"), _defineProperty(_defineProperty({}, "".concat(componentCls, "-tab-tag"), {
|
|
27
|
+
color: colorInfo,
|
|
28
|
+
backgroundColor: colorInfoBg
|
|
29
|
+
}), "".concat(componentCls, "-tab-badge >").concat(antCls, "-badge-count"), {
|
|
23
30
|
color: colorInfo,
|
|
24
31
|
backgroundColor: colorInfoBg
|
|
25
32
|
})), "".concat(componentCls, "-tab[data-node-key^=divider-]"), _defineProperty({
|
package/lib/anchor/index.d.ts
CHANGED
package/lib/anchor/index.js
CHANGED
|
@@ -16,8 +16,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
// src/anchor/index.ts
|
|
17
17
|
var anchor_exports = {};
|
|
18
18
|
module.exports = __toCommonJS(anchor_exports);
|
|
19
|
+
__reExport(anchor_exports, require("antd/es/anchor/Anchor"), module.exports);
|
|
19
20
|
__reExport(anchor_exports, require("antd/es/anchor"), module.exports);
|
|
20
21
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21
22
|
0 && (module.exports = {
|
|
23
|
+
...require("antd/es/anchor/Anchor"),
|
|
22
24
|
...require("antd/es/anchor")
|
|
23
25
|
});
|
package/lib/avatar/index.d.ts
CHANGED
package/lib/avatar/index.js
CHANGED
|
@@ -16,8 +16,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
// src/avatar/index.ts
|
|
17
17
|
var avatar_exports = {};
|
|
18
18
|
module.exports = __toCommonJS(avatar_exports);
|
|
19
|
+
__reExport(avatar_exports, require("antd/es/avatar/AvatarContext"), module.exports);
|
|
19
20
|
__reExport(avatar_exports, require("antd/es/avatar"), module.exports);
|
|
20
21
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21
22
|
0 && (module.exports = {
|
|
23
|
+
...require("antd/es/avatar/AvatarContext"),
|
|
22
24
|
...require("antd/es/avatar")
|
|
23
25
|
});
|
package/lib/segmented/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SegmentedProps as AntSegmentedProps, SegmentedLabeledOption as AntSegmentedLabeledOption } from 'antd/es/segmented';
|
|
3
3
|
import type { EllipsisConfig } from '../typography';
|
|
4
|
+
import type { BadgeProps } from '../badge';
|
|
4
5
|
import type { SegmentedRawOption } from 'rc-segmented';
|
|
5
6
|
export * from 'antd/es/segmented';
|
|
7
|
+
type BadgeType = BadgeProps | BadgeProps['count'];
|
|
6
8
|
export type SegmentedLabeledOption = AntSegmentedLabeledOption & {
|
|
7
9
|
ellipsis?: EllipsisConfig;
|
|
10
|
+
badge?: BadgeType;
|
|
8
11
|
};
|
|
9
12
|
export interface SegmentedProps extends Omit<AntSegmentedProps, 'ref'> {
|
|
10
13
|
options: (SegmentedRawOption | SegmentedLabeledOption)[];
|
package/lib/segmented/index.js
CHANGED
|
@@ -37,19 +37,29 @@ var import_react = __toESM(require("react"));
|
|
|
37
37
|
var import_antd = require("antd");
|
|
38
38
|
var import_config_provider = __toESM(require("../config-provider"));
|
|
39
39
|
var import_typography = __toESM(require("../typography"));
|
|
40
|
+
var import_badge = __toESM(require("../badge"));
|
|
40
41
|
var import_style = __toESM(require("./style"));
|
|
41
42
|
__reExport(segmented_exports, require("antd/es/segmented"), module.exports);
|
|
43
|
+
var isReactNode = (item) => {
|
|
44
|
+
return import_react.default.isValidElement(item);
|
|
45
|
+
};
|
|
42
46
|
var Segmented = import_react.default.forwardRef(
|
|
43
47
|
({ prefixCls: customizePrefixCls, options, ...restProps }, ref) => {
|
|
44
48
|
const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
45
49
|
const prefixCls = getPrefixCls("segmented", customizePrefixCls);
|
|
46
50
|
const { wrapSSR } = (0, import_style.default)(prefixCls);
|
|
51
|
+
const renderBadge = (0, import_react.useCallback)((badge) => {
|
|
52
|
+
if (typeof badge === "object" && !isReactNode(badge)) {
|
|
53
|
+
return /* @__PURE__ */ import_react.default.createElement(import_badge.default, { ...badge });
|
|
54
|
+
}
|
|
55
|
+
return /* @__PURE__ */ import_react.default.createElement(import_badge.default, { count: badge });
|
|
56
|
+
}, []);
|
|
47
57
|
const newOptions = options == null ? void 0 : options.map((item) => {
|
|
48
|
-
if (typeof item === "object"
|
|
49
|
-
const { label, ...restItem } = item;
|
|
58
|
+
if (typeof item === "object") {
|
|
59
|
+
const { label, badge, ...restItem } = item;
|
|
50
60
|
return {
|
|
51
61
|
...restItem,
|
|
52
|
-
label: /* @__PURE__ */ import_react.default.createElement(import_typography.default.Text, { ellipsis: item.ellipsis }, label)
|
|
62
|
+
label: /* @__PURE__ */ import_react.default.createElement(import_antd.Flex, { gap: 4, align: "center", justify: "center" }, (item == null ? void 0 : item.ellipsis) ? /* @__PURE__ */ import_react.default.createElement(import_typography.default.Text, { ellipsis: item.ellipsis }, label) : label, badge && renderBadge(badge))
|
|
53
63
|
};
|
|
54
64
|
}
|
|
55
65
|
return item;
|
|
@@ -25,9 +25,33 @@ __export(style_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(style_exports);
|
|
26
26
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
27
27
|
var genSegmentedStyle = (token) => {
|
|
28
|
-
const { componentCls } = token;
|
|
28
|
+
const { componentCls, antCls, colorFill, colorFillSecondary } = token;
|
|
29
29
|
return {
|
|
30
|
-
[`${componentCls}`]: {
|
|
30
|
+
[`${componentCls} >${componentCls}-group`]: {
|
|
31
|
+
[`&:not(:has(${componentCls}-thumb)) >${componentCls}-item`]: {
|
|
32
|
+
[`&:not(.ant-segmented-item-selected) >${componentCls}-item-label`]: {
|
|
33
|
+
["&:hover"]: {
|
|
34
|
+
[`${antCls}-badge >${antCls}-badge-count`]: {
|
|
35
|
+
backgroundColor: colorFill
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
["&:active"]: {
|
|
39
|
+
[`${antCls}-badge >${antCls}-badge-count`]: {
|
|
40
|
+
backgroundColor: colorFillSecondary
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
[`>${componentCls}-item`]: {
|
|
46
|
+
[`>${componentCls}-item-label`]: {
|
|
47
|
+
[`${antCls}-badge >${antCls}-badge-count`]: {
|
|
48
|
+
backgroundColor: colorFillSecondary,
|
|
49
|
+
color: "inherit",
|
|
50
|
+
boxShadow: "none"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
31
55
|
};
|
|
32
56
|
};
|
|
33
57
|
var style_default = (prefixCls) => {
|
|
@@ -23,9 +23,10 @@ __export(style_exports, {
|
|
|
23
23
|
genSliderStyle: () => genSliderStyle
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(style_exports);
|
|
26
|
+
var import_lodash = require("lodash");
|
|
26
27
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
27
28
|
var genSliderStyle = (token) => {
|
|
28
|
-
const { componentCls, dotSize = 8 } = token;
|
|
29
|
+
const { componentCls, dotSize = 8, handleSize = 10, handleLineWidth = 2 } = token;
|
|
29
30
|
return {
|
|
30
31
|
[`${componentCls}${componentCls}-horizontal`]: {
|
|
31
32
|
[`${componentCls}-mark`]: {
|
|
@@ -34,6 +35,9 @@ var genSliderStyle = (token) => {
|
|
|
34
35
|
},
|
|
35
36
|
[`${componentCls}-mark-text[style*="left: 100%;"]`]: {
|
|
36
37
|
transform: `translateX(calc(-100% + ${dotSize / 2}px)) !important`
|
|
38
|
+
},
|
|
39
|
+
[`${componentCls}-mark-text[style="transform: translateX(-50%);"]`]: {
|
|
40
|
+
transform: `translateX(calc(0% - ${(handleSize + (0, import_lodash.toNumber)(handleLineWidth) * 2) / 2}px)) !important`
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
}
|
package/lib/tabs/TabPane.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { TabPaneProps as AntTabPaneProps } from 'antd/es/tabs/TabPane';
|
|
2
2
|
import type React from 'react';
|
|
3
|
+
import type { BadgeProps } from '../badge';
|
|
4
|
+
type BadgeType = BadgeProps | BadgeProps['count'];
|
|
3
5
|
export interface TabPaneProps extends AntTabPaneProps {
|
|
6
|
+
/** @deprecated please use `badge` instead */
|
|
4
7
|
tag?: React.ReactNode;
|
|
5
8
|
divider?: boolean;
|
|
9
|
+
badge?: BadgeType;
|
|
6
10
|
}
|
|
7
11
|
declare const _default: React.FC<TabPaneProps>;
|
|
8
12
|
export default _default;
|
package/lib/tabs/index.d.ts
CHANGED
|
@@ -2,15 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import type { TabsProps as AntTabsProps, TabsPosition as AntTabsPosition } from 'antd/es/tabs';
|
|
3
3
|
import type { Tab as AntTab } from 'rc-tabs/es/interface';
|
|
4
4
|
import type { TabPaneProps } from './TabPane';
|
|
5
|
+
import type { BadgeProps } from '../badge';
|
|
5
6
|
export * from 'antd/es/tabs';
|
|
6
7
|
export type { TabPaneProps };
|
|
8
|
+
type BadgeType = BadgeProps | BadgeProps['count'];
|
|
7
9
|
export interface AntTabOptional extends Omit<AntTab, 'key' | 'label'> {
|
|
8
10
|
key?: string;
|
|
9
11
|
label?: React.ReactNode;
|
|
10
12
|
}
|
|
11
13
|
export type Tab = {
|
|
14
|
+
/** @deprecated please use `badge` instead */
|
|
12
15
|
tag?: React.ReactNode;
|
|
13
16
|
divider?: boolean;
|
|
17
|
+
badge?: BadgeType;
|
|
14
18
|
} & (AntTab | AntTabOptional);
|
|
15
19
|
export interface TabsProps extends Omit<AntTabsProps, 'items'> {
|
|
16
20
|
items?: Tab[];
|
package/lib/tabs/index.js
CHANGED
|
@@ -37,11 +37,15 @@ var import_util = require("@oceanbase/util");
|
|
|
37
37
|
var import_antd = require("antd");
|
|
38
38
|
var import_react = __toESM(require("react"));
|
|
39
39
|
var import_classnames = __toESM(require("classnames"));
|
|
40
|
+
var import_badge = __toESM(require("../badge"));
|
|
40
41
|
var import_config_provider = __toESM(require("../config-provider"));
|
|
41
42
|
var import_useLegacyItems = __toESM(require("./hooks/useLegacyItems"));
|
|
42
43
|
var import_style = __toESM(require("./style"));
|
|
43
44
|
var import_TabPane = __toESM(require("./TabPane"));
|
|
44
45
|
__reExport(tabs_exports, require("antd/es/tabs"), module.exports);
|
|
46
|
+
var isReactNode = (item) => {
|
|
47
|
+
return import_react.default.isValidElement(item);
|
|
48
|
+
};
|
|
45
49
|
var Tabs = ({
|
|
46
50
|
children,
|
|
47
51
|
items,
|
|
@@ -57,6 +61,15 @@ var Tabs = ({
|
|
|
57
61
|
const tabsCls = (0, import_classnames.default)(className);
|
|
58
62
|
const isHorizontal = !tabPosition || tabPosition === "top" || tabPosition === "bottom";
|
|
59
63
|
const dividerList = (items == null ? void 0 : items.filter((item) => item.divider)) || [];
|
|
64
|
+
const renderBadge = (0, import_react.useCallback)(
|
|
65
|
+
(badge) => {
|
|
66
|
+
if (typeof badge === "object" && !isReactNode(badge)) {
|
|
67
|
+
return /* @__PURE__ */ import_react.default.createElement(import_badge.default, { ...badge, className: (0, import_classnames.default)(`${prefixCls}-tab-badge`, badge.className) });
|
|
68
|
+
}
|
|
69
|
+
return /* @__PURE__ */ import_react.default.createElement(import_badge.default, { className: `${prefixCls}-tab-badge`, count: badge });
|
|
70
|
+
},
|
|
71
|
+
[prefixCls]
|
|
72
|
+
);
|
|
60
73
|
let newItems = (0, import_useLegacyItems.default)(items, children);
|
|
61
74
|
newItems = newItems == null ? void 0 : newItems.map((item) => {
|
|
62
75
|
if (!(0, import_util.isNullValue)(item.divider)) {
|
|
@@ -72,10 +85,10 @@ var Tabs = ({
|
|
|
72
85
|
),
|
|
73
86
|
disabled: true
|
|
74
87
|
};
|
|
75
|
-
} else if (!(0, import_util.isNullValue)(item.tag)) {
|
|
88
|
+
} else if (!(0, import_util.isNullValue)(item.tag) || !(0, import_util.isNullValue)(item.badge)) {
|
|
76
89
|
return {
|
|
77
90
|
...item,
|
|
78
|
-
label: /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { size: 4 }, item.label, /* @__PURE__ */ import_react.default.createElement(import_antd.Tag, { bordered: false, className: `${prefixCls}-tab-tag` }, item.tag))
|
|
91
|
+
label: /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { size: 4 }, item.label, item.badge && renderBadge(item.badge), !(0, import_util.isNullValue)(item.tag) && /* @__PURE__ */ import_react.default.createElement(import_antd.Tag, { bordered: false, className: `${prefixCls}-tab-tag` }, item.tag))
|
|
79
92
|
};
|
|
80
93
|
}
|
|
81
94
|
return item;
|
package/lib/tabs/style/index.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(style_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(style_exports);
|
|
26
26
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
27
27
|
var genTabsStyle = (token) => {
|
|
28
|
-
const { antCls, componentCls, colorInfo, colorInfoBg, colorTextSecondary } = token;
|
|
28
|
+
const { antCls, componentCls, colorInfo, colorInfoBg, colorTextSecondary, colorFillQuaternary } = token;
|
|
29
29
|
return {
|
|
30
30
|
[componentCls]: {
|
|
31
31
|
[`&${componentCls}-top, &${componentCls}-bottom`]: {
|
|
@@ -35,6 +35,7 @@ var genTabsStyle = (token) => {
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
[`${componentCls}-tab`]: {
|
|
38
|
+
/** @deprecated */
|
|
38
39
|
[`${componentCls}-tab-tag`]: {
|
|
39
40
|
color: colorTextSecondary,
|
|
40
41
|
fontFamily: "PingFangSC",
|
|
@@ -42,12 +43,24 @@ var genTabsStyle = (token) => {
|
|
|
42
43
|
borderRadius: 12,
|
|
43
44
|
marginInlineEnd: 0,
|
|
44
45
|
height: 20
|
|
46
|
+
},
|
|
47
|
+
[`${componentCls}-tab-badge`]: {
|
|
48
|
+
[`>${antCls}-badge-count`]: {
|
|
49
|
+
color: colorTextSecondary,
|
|
50
|
+
backgroundColor: colorFillQuaternary
|
|
51
|
+
},
|
|
52
|
+
borderRadius: 12
|
|
45
53
|
}
|
|
46
54
|
},
|
|
47
55
|
[`${componentCls}-tab-active`]: {
|
|
56
|
+
/** @deprecated */
|
|
48
57
|
[`${componentCls}-tab-tag`]: {
|
|
49
58
|
color: colorInfo,
|
|
50
59
|
backgroundColor: colorInfoBg
|
|
60
|
+
},
|
|
61
|
+
[`${componentCls}-tab-badge >${antCls}-badge-count`]: {
|
|
62
|
+
color: colorInfo,
|
|
63
|
+
backgroundColor: colorInfoBg
|
|
51
64
|
}
|
|
52
65
|
},
|
|
53
66
|
[`${componentCls}-tab[data-node-key^=divider-]`]: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanbase/design",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.13",
|
|
4
4
|
"description": "The Design System of OceanBase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oceanbase",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"react": ">=16.9.0",
|
|
67
67
|
"react-dom": ">=16.9.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "2d9213d7c374b9dc207ebd40663f1c50828e72b7"
|
|
70
70
|
}
|