@aloudata/aloudata-design 2.5.2 → 2.6.0

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.
@@ -0,0 +1,11 @@
1
+ import type { SVGProps } from 'react';
2
+ import * as React from 'react';
3
+ interface SVGRProps {
4
+ size?: number | string;
5
+ title?: string;
6
+ titleId?: string;
7
+ desc?: string;
8
+ descId?: string;
9
+ }
10
+ declare const Memo: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement> & SVGRProps, "ref"> & React.RefAttributes<SVGSVGElement>>>;
11
+ export default Memo;
@@ -0,0 +1,35 @@
1
+ var _excluded = ["title", "titleId", "desc", "descId"];
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); }
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; }
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 * as React from 'react';
6
+ import { forwardRef, memo } from 'react';
7
+ var CancelledCircleFill = function CancelledCircleFill(_ref, ref) {
8
+ var title = _ref.title,
9
+ titleId = _ref.titleId,
10
+ desc = _ref.desc,
11
+ descId = _ref.descId,
12
+ props = _objectWithoutProperties(_ref, _excluded);
13
+ return /*#__PURE__*/React.createElement("svg", _extends({
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ width: props.width || props.size || 16,
16
+ height: props.height || props.size || 16,
17
+ fill: "none",
18
+ viewBox: "0 0 20 20",
19
+ ref: ref,
20
+ "aria-labelledby": titleId,
21
+ "aria-describedby": descId
22
+ }, props), desc ? /*#__PURE__*/React.createElement("desc", {
23
+ id: descId
24
+ }, desc) : null, title ? /*#__PURE__*/React.createElement("title", {
25
+ id: titleId
26
+ }, title) : null, /*#__PURE__*/React.createElement("path", {
27
+ fill: "#6B7280",
28
+ fillRule: "evenodd",
29
+ d: "M1.667 10a8.333 8.333 0 1 1 16.666 0 8.333 8.333 0 0 1-16.666 0Zm5.976-.833a.833.833 0 1 0 0 1.666h4.714a.833.833 0 0 0 0-1.666H7.643Z",
30
+ clipRule: "evenodd"
31
+ }));
32
+ };
33
+ var ForwardRef = /*#__PURE__*/forwardRef(CancelledCircleFill);
34
+ var Memo = /*#__PURE__*/memo(ForwardRef);
35
+ export default Memo;
@@ -0,0 +1,11 @@
1
+ import type { SVGProps } from 'react';
2
+ import * as React from 'react';
3
+ interface SVGRProps {
4
+ size?: number | string;
5
+ title?: string;
6
+ titleId?: string;
7
+ desc?: string;
8
+ descId?: string;
9
+ }
10
+ declare const Memo: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement> & SVGRProps, "ref"> & React.RefAttributes<SVGSVGElement>>>;
11
+ export default Memo;
@@ -0,0 +1,38 @@
1
+ var _excluded = ["title", "titleId", "desc", "descId"];
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); }
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; }
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 * as React from 'react';
6
+ import { forwardRef, memo } from 'react';
7
+ var InProgressFill = function InProgressFill(_ref, ref) {
8
+ var title = _ref.title,
9
+ titleId = _ref.titleId,
10
+ desc = _ref.desc,
11
+ descId = _ref.descId,
12
+ props = _objectWithoutProperties(_ref, _excluded);
13
+ return /*#__PURE__*/React.createElement("svg", _extends({
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ width: props.width || props.size || 16,
16
+ height: props.height || props.size || 16,
17
+ fill: "none",
18
+ viewBox: "0 0 20 20",
19
+ ref: ref,
20
+ "aria-labelledby": titleId,
21
+ "aria-describedby": descId
22
+ }, props), desc ? /*#__PURE__*/React.createElement("desc", {
23
+ id: descId
24
+ }, desc) : null, title ? /*#__PURE__*/React.createElement("title", {
25
+ id: titleId
26
+ }, title) : null, /*#__PURE__*/React.createElement("g", {
27
+ fill: "#2986F4"
28
+ }, /*#__PURE__*/React.createElement("path", {
29
+ d: "M15 10a5 5 0 0 1-5 5V5a5 5 0 0 1 5 5Z"
30
+ }), /*#__PURE__*/React.createElement("path", {
31
+ fillRule: "evenodd",
32
+ d: "M18.333 10a8.333 8.333 0 1 1-16.666 0 8.333 8.333 0 0 1 16.666 0Zm-1.666 0a6.667 6.667 0 1 1-13.334 0 6.667 6.667 0 0 1 13.334 0Z",
33
+ clipRule: "evenodd"
34
+ })));
35
+ };
36
+ var ForwardRef = /*#__PURE__*/forwardRef(InProgressFill);
37
+ var Memo = /*#__PURE__*/memo(ForwardRef);
38
+ export default Memo;
@@ -6,6 +6,7 @@ export { default as AttentionCircleFill } from './components/AttentionCircleFill
6
6
  export { default as AttentionTriangleFill } from './components/AttentionTriangleFill';
7
7
  export { default as AttentionTriangleLightLine } from './components/AttentionTriangleLightLine';
8
8
  export { default as CancelCircleDuotone } from './components/CancelCircleDuotone';
9
+ export { default as CancelledCircleFill } from './components/CancelledCircleFill';
9
10
  export { default as CheckCircleDuotone } from './components/CheckCircleDuotone';
10
11
  export { default as CheckCircleFill } from './components/CheckCircleFill';
11
12
  export { default as CheckCircleLightLine } from './components/CheckCircleLightLine';
@@ -25,6 +26,7 @@ export { default as EyeOffLine } from './components/EyeOffLine';
25
26
  export { default as EyeOnLine } from './components/EyeOnLine';
26
27
  export { default as FoldDownFill } from './components/FoldDownFill';
27
28
  export { default as FoldUpFill } from './components/FoldUpFill';
29
+ export { default as InProgressFill } from './components/InProgressFill';
28
30
  export { default as InfoCircleDuotone } from './components/InfoCircleDuotone';
29
31
  export { default as InfoCircleLine } from './components/InfoCircleLine';
30
32
  export { default as InformationCircleFill } from './components/InformationCircleFill';
@@ -6,6 +6,7 @@ export { default as AttentionCircleFill } from "./components/AttentionCircleFill
6
6
  export { default as AttentionTriangleFill } from "./components/AttentionTriangleFill";
7
7
  export { default as AttentionTriangleLightLine } from "./components/AttentionTriangleLightLine";
8
8
  export { default as CancelCircleDuotone } from "./components/CancelCircleDuotone";
9
+ export { default as CancelledCircleFill } from "./components/CancelledCircleFill";
9
10
  export { default as CheckCircleDuotone } from "./components/CheckCircleDuotone";
10
11
  export { default as CheckCircleFill } from "./components/CheckCircleFill";
11
12
  export { default as CheckCircleLightLine } from "./components/CheckCircleLightLine";
@@ -25,6 +26,7 @@ export { default as EyeOffLine } from "./components/EyeOffLine";
25
26
  export { default as EyeOnLine } from "./components/EyeOnLine";
26
27
  export { default as FoldDownFill } from "./components/FoldDownFill";
27
28
  export { default as FoldUpFill } from "./components/FoldUpFill";
29
+ export { default as InProgressFill } from "./components/InProgressFill";
28
30
  export { default as InfoCircleDuotone } from "./components/InfoCircleDuotone";
29
31
  export { default as InfoCircleLine } from "./components/InfoCircleLine";
30
32
  export { default as InformationCircleFill } from "./components/InformationCircleFill";
@@ -0,0 +1,5 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id=" Icon / Fill / Interface /Cancelled-Circle-fill">
3
+ <path id="Icon" fill-rule="evenodd" clip-rule="evenodd" d="M1.66675 9.9999C1.66675 5.39753 5.39771 1.66656 10.0001 1.66656C14.6025 1.66656 18.3334 5.39753 18.3334 9.9999C18.3334 14.6023 14.6025 18.3332 10.0001 18.3332C5.39771 18.3332 1.66675 14.6023 1.66675 9.9999ZM7.64295 9.16667C7.18271 9.16667 6.80961 9.53976 6.80961 10C6.80961 10.4602 7.18271 10.8333 7.64295 10.8333H12.357C12.8172 10.8333 13.1903 10.4602 13.1903 10C13.1903 9.53976 12.8172 9.16667 12.357 9.16667H7.64295Z" fill="#6B7280"/>
4
+ </g>
5
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id=" Icon / Fill / Interface / In-Progress-fill">
3
+ <g id="Icon">
4
+ <path d="M15.0001 10C15.0001 12.7614 12.7615 15 10.0001 15V5.00001C12.7615 5.00001 15.0001 7.23858 15.0001 10Z" fill="#2986F4"/>
5
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M18.3334 10C18.3334 14.6024 14.6025 18.3333 10.0001 18.3333C5.39771 18.3333 1.66675 14.6024 1.66675 10C1.66675 5.39763 5.39771 1.66667 10.0001 1.66667C14.6025 1.66667 18.3334 5.39763 18.3334 10ZM16.6667 10C16.6667 13.6819 13.682 16.6667 10.0001 16.6667C6.31818 16.6667 3.33341 13.6819 3.33341 10C3.33341 6.31811 6.31818 3.33334 10.0001 3.33334C13.682 3.33334 16.6667 6.31811 16.6667 10Z" fill="#2986F4"/>
6
+ </g>
7
+ </g>
8
+ </svg>
@@ -1,4 +1,10 @@
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ 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); }
5
+ 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; }
6
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2
8
  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
9
  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
10
  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,7 +12,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
6
12
  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
13
  import classNames from 'classnames';
8
14
  import _ from 'lodash';
9
- import React, { useContext, useRef } from 'react';
15
+ import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
10
16
  import { getUUID } from "../../../_utils/hooks/useId";
11
17
  import { RadioGroupContext } from "../Group";
12
18
  export default function Radio(props) {
@@ -14,15 +20,26 @@ export default function Radio(props) {
14
20
  var labelRef = useRef(null);
15
21
  var id = getUUID().toString();
16
22
  var radioProps = _objectSpread({}, props);
23
+ var initChecked = useCallback(function () {
24
+ if (!_.isEmpty(groupContext)) {
25
+ return !props.disabled && groupContext.value === props.value;
26
+ } else {
27
+ return !('checked' in props) ? props.defaultChecked : radioProps.checked;
28
+ }
29
+ }, [groupContext, props, radioProps.checked]);
30
+ var _useState = useState(initChecked),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ checked = _useState2[0],
33
+ setChecked = _useState2[1];
34
+ useEffect(function () {
35
+ setChecked(initChecked);
36
+ }, [initChecked, groupContext.value, props.value, props.disabled]);
17
37
  if (!_.isEmpty(groupContext)) {
18
38
  radioProps.disabled = groupContext.disabled || props.disabled;
19
- radioProps.checked = !props.disabled && groupContext.value === props.value;
20
- } else {
21
- radioProps.checked = !('checked' in props) ? props.defaultChecked : radioProps.checked;
22
39
  }
23
40
  // 设置input外层盒子的class
24
41
  var aldRadioClass = classNames('ald-radio', {
25
- 'ald-radio-checked': radioProps.checked,
42
+ 'ald-radio-checked': checked,
26
43
  'ald-radio-disabled': radioProps.disabled
27
44
  });
28
45
  // 根据属性设置最外层的class
@@ -51,17 +68,25 @@ export default function Radio(props) {
51
68
  } else {
52
69
  // 当type未设置或者是radio时
53
70
  otherClass = 'ald-radio-wrapper';
71
+ if (props.indeterminate) {
72
+ otherClass = otherClass + ' ald-radio-wrapper-indeterminate';
73
+ }
54
74
  }
55
75
  return classNames('ald-radio-label', otherClass, {
56
- 'ald-radio-wrapper-checked': radioProps.checked,
76
+ 'ald-radio-wrapper-checked': checked,
57
77
  'ald-radio-wrapper-disabled': radioProps.disabled
58
78
  });
59
79
  };
60
- var onChange = function onChange() {
80
+ var onChange = function onChange(e) {
81
+ var _props$onChange;
61
82
  if (groupContext !== null && groupContext !== void 0 && groupContext.onChange) {
62
83
  // input事件的value会被toString,所以此处进行一个覆盖
63
84
  groupContext.onChange(props.value);
64
85
  }
86
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, e);
87
+ if (_.isEmpty(groupContext)) {
88
+ setChecked(e.target.checked);
89
+ }
65
90
  };
66
91
  return /*#__PURE__*/React.createElement("label", {
67
92
  className: getWrapperClass(),
@@ -73,10 +98,21 @@ export default function Radio(props) {
73
98
  id: id,
74
99
  type: "radio",
75
100
  className: "ald-radio-input",
76
- checked: radioProps.checked,
101
+ defaultChecked: checked,
77
102
  disabled: radioProps.disabled,
78
103
  value: props.value,
79
- onChange: onChange
104
+ onChange: onChange,
105
+ onClick: function onClick(e) {
106
+ var _props$onClick;
107
+ (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, e);
108
+ if (!_.isEmpty(groupContext)) {
109
+ if (groupContext !== null && groupContext !== void 0 && groupContext.onChange) {
110
+ // input事件的value会被toString,所以此处进行一个覆盖
111
+ groupContext.onChange(props.value);
112
+ }
113
+ setChecked(!checked);
114
+ }
115
+ }
80
116
  }), /*#__PURE__*/React.createElement("span", {
81
117
  className: "ald-radio-inner"
82
118
  })), /*#__PURE__*/React.createElement("span", {
@@ -21,4 +21,7 @@ export interface IRadioProps {
21
21
  */
22
22
  value?: any;
23
23
  children?: ReactNode[] | ReactNode;
24
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
25
+ onClick?: (e: React.MouseEvent<HTMLInputElement>) => void;
26
+ indeterminate?: boolean;
24
27
  }
@@ -79,8 +79,9 @@
79
79
  user-select: none;
80
80
  white-space: nowrap;
81
81
  }
82
+
82
83
  // 绘制选中时的圆圈样式
83
- .ald-radio-checked > .ald-radio-inner {
84
+ :not(.ald-radio-wrapper-indeterminate) > .ald-radio-checked > .ald-radio-inner {
84
85
  background-color: var(--alias-colors-bg-selected-strong-default, #126fdd);
85
86
  border: 0;
86
87
  transform: background 0.5s ease;
@@ -105,10 +106,39 @@
105
106
  background-color: var(--alias-colors-bg-selected-strong-press, #0b4385);
106
107
  }
107
108
  }
109
+ // 半选的样式
110
+ .ald-radio-wrapper-indeterminate > .ald-radio > .ald-radio-inner[class] {
111
+ background-color: var(--alias-colors-bg-selected-strong-default, #126fdd);
112
+ border: 0;
113
+ transform: background 0.5s ease;
114
+
115
+ &::after {
116
+ position: absolute;
117
+ top: 50%;
118
+ left: 50%;
119
+ width: 8.5px;
120
+ height: 2px;
121
+ background-color: var(--alias-colors-icon-inverse-default, #fff);
122
+ border-radius: 2px;
123
+ transform: translate(-50%, -50%);
124
+ content: '';
125
+ }
126
+
127
+ &:hover {
128
+ background-color: var(--alias-colors-bg-selected-strong-hover, #0f59b1);
129
+ }
130
+
131
+ &:active {
132
+ background-color: var(--alias-colors-bg-selected-strong-press, #0b4385);
133
+ }
134
+ }
108
135
 
109
136
  // 禁用状态下的样式
110
137
  .ald-radio-disabled > .ald-radio-inner {
111
- background-color: var(--alias-colors-bg-disabled, rgba(0, 0, 0, 0.05));
138
+ background-color: var(
139
+ --alias-colors-bg-disabled,
140
+ rgba(0, 0, 0, 0.05)
141
+ ) !important;
112
142
  border: 1px solid var(--alias-colors-border-disabled, rgba(0, 0, 0, 0.1));
113
143
 
114
144
  &::after {
@@ -1,6 +1,7 @@
1
1
  import classNames from 'classnames';
2
2
  import React from 'react';
3
3
  import { LoadingDuotone } from "../../Icon";
4
+ import { getUUID } from "../../_utils/hooks/useId";
4
5
  var Icon = function Icon(props) {
5
6
  var size = props.size,
6
7
  tip = props.tip,
@@ -10,7 +11,9 @@ var Icon = function Icon(props) {
10
11
  className = props.className,
11
12
  inContainer = props.inContainer;
12
13
  if (!spinning) return null;
13
- return /*#__PURE__*/React.createElement(React.Fragment, null, inContainer && /*#__PURE__*/React.createElement("div", {
14
+ return /*#__PURE__*/React.createElement(React.Fragment, {
15
+ key: getUUID().toString()
16
+ }, inContainer && /*#__PURE__*/React.createElement("div", {
14
17
  className: "spinner-mask"
15
18
  }), /*#__PURE__*/React.createElement("div", {
16
19
  className: classNames('spinner', className, {
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export interface IProps {
3
+ size?: 'middle' | 'small';
4
+ style?: 'dot' | 'icon';
5
+ dotColor?: string;
6
+ icon?: React.ReactNode;
7
+ text: string;
8
+ status?: 'info' | 'neutral' | 'danger' | 'success' | 'warning';
9
+ className?: string;
10
+ }
11
+ declare function StatusLight({ size, style, dotColor, icon, text, status, className, }: IProps): React.JSX.Element;
12
+ export default StatusLight;
@@ -0,0 +1,74 @@
1
+ import classNames from 'classnames';
2
+ import React from 'react';
3
+ import { AttentionCircleFill, CancelledCircleFill, CheckCircleFill, CloseCircleFill, InProgressFill } from "../Icon";
4
+ function StatusLight(_ref) {
5
+ var _ref$size = _ref.size,
6
+ size = _ref$size === void 0 ? 'middle' : _ref$size,
7
+ _ref$style = _ref.style,
8
+ style = _ref$style === void 0 ? 'dot' : _ref$style,
9
+ dotColor = _ref.dotColor,
10
+ icon = _ref.icon,
11
+ text = _ref.text,
12
+ _ref$status = _ref.status,
13
+ status = _ref$status === void 0 ? 'info' : _ref$status,
14
+ className = _ref.className;
15
+ var getIcon = function getIcon() {
16
+ if (icon) return icon;
17
+ var iconSize = size === 'middle' ? 20 : 16;
18
+ switch (status) {
19
+ case 'info':
20
+ return /*#__PURE__*/React.createElement(InProgressFill, {
21
+ color: "#2986F4",
22
+ size: iconSize
23
+ });
24
+ case 'neutral':
25
+ return /*#__PURE__*/React.createElement(CancelledCircleFill, {
26
+ color: "#6B7280",
27
+ size: iconSize
28
+ });
29
+ case 'danger':
30
+ return /*#__PURE__*/React.createElement(CloseCircleFill, {
31
+ color: "#EF4444",
32
+ size: iconSize
33
+ });
34
+ case 'success':
35
+ return /*#__PURE__*/React.createElement(CheckCircleFill, {
36
+ color: "#22C55E",
37
+ size: iconSize
38
+ });
39
+ case 'warning':
40
+ return /*#__PURE__*/React.createElement(AttentionCircleFill, {
41
+ color: "#EAB308",
42
+ size: iconSize
43
+ });
44
+ }
45
+ };
46
+ var getDotColor = function getDotColor() {
47
+ if (dotColor) return dotColor;
48
+ switch (status) {
49
+ case 'info':
50
+ return '#2986F4';
51
+ case 'neutral':
52
+ return '#6B7280';
53
+ case 'danger':
54
+ return '#EF4444';
55
+ case 'success':
56
+ return '#22C55E';
57
+ case 'warning':
58
+ return '#EAB308';
59
+ }
60
+ };
61
+ return /*#__PURE__*/React.createElement("div", {
62
+ className: classNames('ald-status-light', "ald-status-light-".concat(size), className)
63
+ }, style === 'dot' && /*#__PURE__*/React.createElement("div", {
64
+ className: "ald-prefix-dot",
65
+ style: {
66
+ backgroundColor: getDotColor()
67
+ }
68
+ }), style === 'icon' && /*#__PURE__*/React.createElement("div", {
69
+ className: "ald-prefix-icon"
70
+ }, getIcon()), /*#__PURE__*/React.createElement("div", {
71
+ className: "ald-text"
72
+ }, text));
73
+ }
74
+ export default StatusLight;
@@ -0,0 +1,2 @@
1
+ import '../../style';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import "../../style";
2
+ import "./index.less";
@@ -0,0 +1,47 @@
1
+ @import '../../style/index.less';
2
+
3
+ .ald-status-light {
4
+ display: flex;
5
+ align-items: center;
6
+ justify-content: flex-start;
7
+
8
+ .ald-prefix-icon {
9
+ height: 100%;
10
+ display: flex;
11
+ align-items: center;
12
+ }
13
+ }
14
+
15
+ .ald-status-light-small {
16
+ gap: 4px;
17
+
18
+ .ald-prefix-dot {
19
+ width: var(--global-grid-75, 6px);
20
+ height: var(--global-grid-75, 6px);
21
+ border-radius: 100%;
22
+ }
23
+
24
+ .ald-text {
25
+ color: var(--alias-colors-text-default, #1f2937);
26
+ font-size: 12px;
27
+ font-weight: 400;
28
+ line-height: 16px; /* 133.333% */
29
+ }
30
+ }
31
+
32
+ .ald-status-light-middle {
33
+ gap: 6px;
34
+
35
+ .ald-prefix-dot {
36
+ width: var(--global-grid-100, 8px);
37
+ height: var(--global-grid-100, 8px);
38
+ border-radius: 100%;
39
+ }
40
+
41
+ .ald-text {
42
+ color: var(--alias-colors-text-default, #1f2937);
43
+ font-size: 14px;
44
+ font-weight: 400;
45
+ line-height: 20px; /* 142.857% */
46
+ }
47
+ }