@yuntijs/ui 1.0.0-beta.50 → 1.0.0-beta.51

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,16 +1,12 @@
1
- import type { BadgeProps } from 'antd';
2
1
  import React from 'react';
2
+ import { StatusProps } from "../../Status";
3
3
  import { type HeaderButtonGroupProps } from './ButtonGroup';
4
4
  import { HeaderIconProps } from './Icon';
5
5
  export interface PageHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
6
6
  /** 是否有边框,默认没有 */
7
7
  bordered?: boolean;
8
8
  /** 状态 */
9
- status?: {
10
- status: BadgeProps['status'];
11
- text: BadgeProps['text'];
12
- title?: BadgeProps['title'];
13
- };
9
+ status?: StatusProps;
14
10
  /** 图标 src 路径或者详细配置 */
15
11
  icon?: string | HeaderIconProps;
16
12
  /** 标题 */
@@ -7,9 +7,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
8
8
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
9
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
- import { Badge, Flex, Skeleton, Tooltip } from 'antd';
10
+ import { Flex, Skeleton, Tooltip } from 'antd';
11
11
  import React, { useContext, useMemo } from 'react';
12
12
  import Divider from "../../Divider";
13
+ import { Status } from "../../Status";
13
14
  import Typography from "../../Typography";
14
15
  import { PageContext } from "../PageContext";
15
16
  import { HeaderButtonGroup } from "./ButtonGroup";
@@ -187,7 +188,7 @@ export var PageHeader = function PageHeader(props) {
187
188
  align: "center",
188
189
  className: styles.descriptions,
189
190
  gap: 4,
190
- children: [status && /*#__PURE__*/_jsx(Badge, _objectSpread({}, status)), DescriptionsNode]
191
+ children: [status && /*#__PURE__*/_jsx(Status, _objectSpread({}, status)), DescriptionsNode]
191
192
  })]
192
193
  }), /*#__PURE__*/_jsx(Flex, {
193
194
  align: "center",
@@ -0,0 +1,7 @@
1
+ import { BadgeProps } from 'antd';
2
+ import React from 'react';
3
+ export interface StatusProps extends Pick<BadgeProps, 'className' | 'color' | 'status' | 'style' | 'text'> {
4
+ tooltip?: React.ReactNode;
5
+ title?: string;
6
+ }
7
+ export declare const Status: React.FC<StatusProps>;
@@ -0,0 +1,39 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["tooltip", "className", "status", "text", "color"];
4
+ 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; }
5
+ 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; }
6
+ import { Icon } from '@lobehub/ui';
7
+ import { Badge, Space, Tooltip } from 'antd';
8
+ import { Info } from 'lucide-react';
9
+ import React from 'react';
10
+ import { useStyles } from "./style";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ export var Status = function Status(_ref) {
14
+ var tooltip = _ref.tooltip,
15
+ className = _ref.className,
16
+ status = _ref.status,
17
+ text = _ref.text,
18
+ color = _ref.color,
19
+ props = _objectWithoutProperties(_ref, _excluded);
20
+ var _useStyles = useStyles(),
21
+ cx = _useStyles.cx,
22
+ styles = _useStyles.styles;
23
+ return /*#__PURE__*/_jsxs(Space, _objectSpread(_objectSpread({
24
+ className: cx(styles.root, className),
25
+ size: "small"
26
+ }, props), {}, {
27
+ children: [/*#__PURE__*/_jsx(Badge, {
28
+ status: status,
29
+ text: text,
30
+ color: color
31
+ }), tooltip && /*#__PURE__*/_jsx(Tooltip, {
32
+ className: styles.tooltip,
33
+ title: tooltip,
34
+ children: /*#__PURE__*/_jsx(Icon, {
35
+ icon: Info
36
+ })
37
+ })]
38
+ }));
39
+ };
@@ -0,0 +1,4 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ root: import("antd-style").SerializedStyles;
3
+ tooltip: import("antd-style").SerializedStyles;
4
+ }>;
@@ -0,0 +1,14 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref) {
5
+ var css = _ref.css,
6
+ token = _ref.token,
7
+ prefixCls = _ref.prefixCls;
8
+ return {
9
+ root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "-badge.", "-badge-status {\n .", "-badge-status-dot {\n width: 8px;\n height: 8px;\n }\n }\n "])), prefixCls, prefixCls, prefixCls),
10
+ tooltip: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &.anticon {\n cursor: help;\n color: ", ";\n }\n "])), token.colorTextTertiary)
11
+ };
12
+ }, {
13
+ hashPriority: 'low'
14
+ });
package/es/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export * from './MonacoEditor';
8
8
  export * from './Page';
9
9
  export * from './ProCard';
10
10
  export * from './SliderInput';
11
+ export * from './Status';
11
12
  export * from './Alert';
12
13
  export * from './App';
13
14
  export * from './Breadcrumb';
package/es/index.js CHANGED
@@ -8,6 +8,7 @@ export * from "./MonacoEditor";
8
8
  export * from "./Page";
9
9
  export * from "./ProCard";
10
10
  export * from "./SliderInput";
11
+ export * from "./Status";
11
12
 
12
13
  // ~ custom antd
13
14
  export * from "./Alert";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuntijs/ui",
3
- "version": "1.0.0-beta.50",
3
+ "version": "1.0.0-beta.51",
4
4
  "description": "☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps",
5
5
  "keywords": [
6
6
  "yuntijs",