@lobehub/ui 2.23.1 → 2.23.2

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.
@@ -215,13 +215,13 @@ var AccordionItem = /*#__PURE__*/memo(function (_ref) {
215
215
  paddingBlock: paddingBlock,
216
216
  paddingInline: paddingInline,
217
217
  ref: ref,
218
- style: {
218
+ style: _objectSpread({
219
219
  alignItems: 'center',
220
220
  cursor: disabled ? 'not-allowed' : 'pointer',
221
221
  opacity: disabled ? 0.5 : undefined,
222
222
  overflow: 'hidden',
223
223
  width: '100%'
224
- },
224
+ }, customStyles === null || customStyles === void 0 ? void 0 : customStyles.header),
225
225
  variant: customVariant || variant,
226
226
  children: indicatorPlacementFinal === 'start' ? /*#__PURE__*/_jsxs(_Fragment, {
227
227
  children: [/*#__PURE__*/_jsxs(Flexbox, {
@@ -11,9 +11,9 @@ export var useStyles = createStyles(function (_ref) {
11
11
  contentInner: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n /* Content wrapper for animation */\n "]))),
12
12
  divider: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-block: 0;\n "]))),
13
13
  header: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n &:hover .accordion-action {\n width: auto;\n opacity: 1;\n }\n\n &:focus-visible {\n border-radius: ", "px;\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n "])), token.borderRadiusLG, token.colorPrimary),
14
- icon: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n color: ", ";\n transition: transform 200ms ", ";\n "])), token.colorTextDescription, token.motionEaseOut),
14
+ icon: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n transition: transform 200ms ", ";\n "])), token.motionEaseOut),
15
15
  iconRotate: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n transform: rotate(90deg);\n "]))),
16
- indicator: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: flex;\n flex-shrink: 0;\n align-items: center;\n\n font-size: 18px;\n\n transition: transform 200ms ", ";\n "])), token.motionEaseOut),
16
+ indicator: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: flex;\n flex-shrink: 0;\n align-items: center;\n\n font-size: 18px;\n color: ", ";\n\n transition: transform 200ms ", ";\n "])), token.colorTextDescription, token.motionEaseOut),
17
17
  item: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n flex-direction: column;\n "])))
18
18
  };
19
19
  });
package/es/Alert/Alert.js CHANGED
@@ -1,26 +1,21 @@
1
1
  'use client';
2
2
 
3
3
  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); }
4
- var _excluded = ["closeIcon", "closable", "description", "showIcon", "type", "glass", "icon", "colorfulText", "iconProps", "style", "extra", "classNames", "text", "extraDefaultExpand", "extraIsolate", "banner", "variant", "ref"];
4
+ var _excluded = ["closeIcon", "closable", "description", "showIcon", "type", "glass", "icon", "colorfulText", "iconProps", "style", "extra", "classNames", "styles", "text", "extraDefaultExpand", "extraIsolate", "banner", "variant", "ref"];
5
5
  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; }
6
6
  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; }
7
7
  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
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
9
  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); }
10
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
- 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."); }
12
- 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); }
13
- 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; }
14
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
10
  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; }
17
11
  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; }
18
- import { Alert as AntdAlert, message } from 'antd';
12
+ import { Alert as AntdAlert } from 'antd';
19
13
  import { cva } from 'class-variance-authority';
20
14
  import { camelCase } from 'lodash-es';
21
- import { AlertTriangle, CheckCircle, ChevronDown, ChevronRight, Info, X, XCircle } from 'lucide-react';
22
- import { memo, useMemo, useState } from 'react';
15
+ import { AlertTriangle, CheckCircle, Info, X, XCircle } from 'lucide-react';
16
+ import { memo, useMemo } from 'react';
23
17
  import { Flexbox } from 'react-layout-kit';
18
+ import { Accordion, AccordionItem } from "../Accordion";
24
19
  import ActionIcon from "../ActionIcon";
25
20
  import Icon from "../Icon";
26
21
  import { useStyles } from "./style";
@@ -58,6 +53,7 @@ var Alert = /*#__PURE__*/memo(function (_ref) {
58
53
  style = _ref.style,
59
54
  extra = _ref.extra,
60
55
  classNames = _ref.classNames,
56
+ customStyles = _ref.styles,
61
57
  text = _ref.text,
62
58
  _ref$extraDefaultExpa = _ref.extraDefaultExpand,
63
59
  extraDefaultExpand = _ref$extraDefaultExpa === void 0 ? false : _ref$extraDefaultExpa,
@@ -67,10 +63,6 @@ var Alert = /*#__PURE__*/memo(function (_ref) {
67
63
  variant = _ref$variant === void 0 ? 'filled' : _ref$variant,
68
64
  ref = _ref.ref,
69
65
  rest = _objectWithoutProperties(_ref, _excluded);
70
- var _useState = useState(extraDefaultExpand),
71
- _useState2 = _slicedToArray(_useState, 2),
72
- expand = _useState2[0],
73
- setExpand = _useState2[1];
74
66
  var _useStyles = useStyles({
75
67
  closable: !!closable,
76
68
  hasTitle: !!description,
@@ -145,22 +137,6 @@ var Alert = /*#__PURE__*/memo(function (_ref) {
145
137
  /* eslint-enable sort-keys-fix/sort-keys-fix */
146
138
  });
147
139
  }, [styles]);
148
- var extraBodyVariants = useMemo(function () {
149
- return cva(styles.extraBody, {
150
- defaultVariants: {
151
- variant: 'filled'
152
- },
153
- /* eslint-disable sort-keys-fix/sort-keys-fix */
154
- variants: {
155
- variant: {
156
- filled: null,
157
- outlined: null,
158
- borderless: styles.borderless
159
- }
160
- }
161
- /* eslint-enable sort-keys-fix/sort-keys-fix */
162
- });
163
- }, [styles]);
164
140
  var isInsideExtra = Boolean(!extraIsolate && !!extra);
165
141
  var alert = /*#__PURE__*/_jsx(AntdAlert, _objectSpread({
166
142
  banner: banner,
@@ -184,11 +160,11 @@ var Alert = /*#__PURE__*/memo(function (_ref) {
184
160
  }, iconProps)),
185
161
  ref: ref,
186
162
  showIcon: showIcon,
187
- style: _objectSpread({
163
+ style: _objectSpread(_objectSpread({
188
164
  background: colors(theme, type, 'fillTertiary'),
189
165
  borderColor: colors(theme, type, 'fillSecondary'),
190
166
  color: colorfulText ? colors(theme, type) : undefined
191
- }, style),
167
+ }, style), customStyles === null || customStyles === void 0 ? void 0 : customStyles.alert),
192
168
  type: type === 'secondary' ? 'info' : type
193
169
  }, rest));
194
170
  if (!extra) return alert;
@@ -199,7 +175,8 @@ var Alert = /*#__PURE__*/memo(function (_ref) {
199
175
  });
200
176
  return /*#__PURE__*/_jsxs(Flexbox, {
201
177
  className: classNames === null || classNames === void 0 ? void 0 : classNames.container,
202
- children: [alert, /*#__PURE__*/_jsxs(Flexbox, {
178
+ style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.container,
179
+ children: [alert, /*#__PURE__*/_jsx(Flexbox, {
203
180
  className: extraVariants({
204
181
  banner: banner,
205
182
  variant: variant
@@ -210,36 +187,36 @@ var Alert = /*#__PURE__*/memo(function (_ref) {
210
187
  color: colors(theme, type),
211
188
  fontSize: description ? 14 : 12
212
189
  },
213
- children: [/*#__PURE__*/_jsxs(Flexbox, {
214
- align: 'center',
215
- className: extraHeaderVariants({
216
- variant: variant
217
- }),
218
- gap: message ? 6 : 10,
219
- horizontal: true,
220
- style: {
221
- borderColor: colors(theme, type, 'fillSecondary')
222
- },
223
- children: [/*#__PURE__*/_jsx(ActionIcon, {
224
- color: colors(theme, type),
225
- icon: expand ? ChevronDown : ChevronRight,
226
- onClick: function onClick() {
227
- return setExpand(!expand);
190
+ children: /*#__PURE__*/_jsx(Accordion, {
191
+ defaultExpandedKeys: extraDefaultExpand ? ['extra'] : [],
192
+ children: /*#__PURE__*/_jsx(AccordionItem, {
193
+ classNames: {
194
+ content: classNames === null || classNames === void 0 ? void 0 : classNames.extraContent,
195
+ header: extraHeaderVariants({
196
+ variant: variant
197
+ })
228
198
  },
229
- size: 18
230
- }), /*#__PURE__*/_jsx("div", {
231
- className: cx(styles.expandText),
232
- onClick: function onClick() {
233
- return setExpand(!expand);
199
+ itemKey: 'extra',
200
+ styles: {
201
+ content: _objectSpread({
202
+ fontSize: 12,
203
+ padding: 8
204
+ }, customStyles === null || customStyles === void 0 ? void 0 : customStyles.extraContent),
205
+ header: {
206
+ borderColor: colors(theme, type, 'fillSecondary')
207
+ },
208
+ indicator: {
209
+ color: colors(theme, type)
210
+ },
211
+ title: {
212
+ color: colors(theme, type),
213
+ fontSize: 12
214
+ }
234
215
  },
235
- children: (text === null || text === void 0 ? void 0 : text.detail) || 'Show Details'
236
- })]
237
- }), expand && /*#__PURE__*/_jsx("div", {
238
- className: extraBodyVariants({
239
- variant: variant
240
- }),
241
- children: extra
242
- })]
216
+ title: (text === null || text === void 0 ? void 0 : text.detail) || 'Show Details',
217
+ children: extra
218
+ })
219
+ })
243
220
  })]
244
221
  });
245
222
  });
@@ -9,7 +9,6 @@ export declare const useStyles: (props?: {
9
9
  colorfulText: import("antd-style").SerializedStyles;
10
10
  expandText: import("antd-style").SerializedStyles;
11
11
  extra: import("antd-style").SerializedStyles;
12
- extraBody: import("antd-style").SerializedStyles;
13
12
  extraHeader: import("antd-style").SerializedStyles;
14
13
  filled: import("antd-style").SerializedStyles;
15
14
  glass: string;
package/es/Alert/style.js CHANGED
@@ -1,4 +1,4 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
2
2
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
3
  import { createStyles } from 'antd-style';
4
4
  export var useStyles = createStyles(function (_ref, _ref2) {
@@ -15,16 +15,15 @@ export var useStyles = createStyles(function (_ref, _ref2) {
15
15
  return {
16
16
  banner: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: none !important;\n border-radius: 0 !important;\n "]))),
17
17
  borderless: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 0 !important;\n border: none !important;\n background: transparent !important;\n "]))),
18
- borderlessExtraHeader: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-block-start: ", "px;\n margin-inline-start: ", "px;\n padding-inline: 0;\n "])), baseBlockPadding, -baseInlinePadding * 0.25),
18
+ borderlessExtraHeader: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-block-start: ", "px;\n padding-inline: 0;\n "])), baseBlockPadding),
19
19
  colorfulText: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .", "-alert-message,.", "-alert-description {\n color: inherit;\n }\n "])), prefixCls, prefixCls),
20
20
  expandText: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-inline-end: 12px;\n\n &:hover {\n cursor: pointer;\n }\n "]))),
21
21
  extra: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n\n max-width: 100%;\n border: 1px solid;\n border-block-start: none;\n border-end-start-radius: ", "px;\n border-end-end-radius: ", "px;\n "])), token.borderRadiusLG, token.borderRadiusLG),
22
- extraBody: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n overflow-x: auto;\n width: 100%;\n padding-block-end: ", "px;\n padding-inline: ", "px;\n "])), baseBlockPadding * 0.5, baseInlinePadding * 0.5),
23
- extraHeader: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n padding-block: ", "px;\n padding-inline: ", "px;\n border-block-start: 1px dashed;\n "])), baseBlockPadding * 0.5, baseInlinePadding * 0.5),
24
- filled: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral([""]))),
22
+ extraHeader: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n border-block-start: 1px dashed;\n border-radius: 0;\n background: transparent !important;\n "]))),
23
+ filled: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral([""]))),
25
24
  glass: stylish.blur,
26
- hasExtra: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n border-block-end: none;\n border-end-start-radius: 0;\n border-end-end-radius: 0;\n "]))),
27
- outlined: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n background: transparent !important;\n "]))),
28
- root: cx(css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n flex-direction: row;\n gap: ", "px;\n align-items: flex-start;\n\n max-width: 100%;\n padding-block: ", "px;\n padding-inline: ", "px\n ", "px;\n\n .", "-alert-message {\n font-weight: ", ";\n line-height: 24px;\n word-break: normal;\n }\n .", "-alert-icon {\n display: flex;\n align-items: center;\n height: 24px;\n margin: 0;\n }\n .", "-alert-close-icon {\n display: flex;\n align-items: center;\n height: 24px;\n margin: 0;\n }\n "])), hasTitle ? 12 : 8, baseBlockPadding, showIcon ? baseInlinePadding * 0.75 : baseInlinePadding, closable ? baseInlinePadding * 0.75 : baseInlinePadding, prefixCls, hasTitle ? 600 : 400, prefixCls, prefixCls), hasTitle && css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n .", "-alert-description {\n line-height: 1.5;\n word-break: normal;\n opacity: 0.75;\n }\n "])), prefixCls))
25
+ hasExtra: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n border-block-end: none;\n border-end-start-radius: 0;\n border-end-end-radius: 0;\n "]))),
26
+ outlined: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n background: transparent !important;\n "]))),
27
+ root: cx(css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n flex-direction: row;\n gap: ", "px;\n align-items: flex-start;\n\n max-width: 100%;\n padding-block: ", "px;\n padding-inline: ", "px\n ", "px;\n\n .", "-alert-message {\n font-weight: ", ";\n line-height: 24px;\n word-break: normal;\n }\n .", "-alert-icon {\n display: flex;\n align-items: center;\n height: 24px;\n margin: 0;\n }\n .", "-alert-close-icon {\n display: flex;\n align-items: center;\n height: 24px;\n margin: 0;\n }\n "])), hasTitle ? 12 : 8, baseBlockPadding, showIcon ? baseInlinePadding * 0.75 : baseInlinePadding, closable ? baseInlinePadding * 0.75 : baseInlinePadding, prefixCls, hasTitle ? 600 : 400, prefixCls, prefixCls), hasTitle && css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n .", "-alert-description {\n line-height: 1.5;\n word-break: normal;\n opacity: 0.75;\n }\n "])), prefixCls))
29
28
  };
30
29
  });
@@ -1,11 +1,12 @@
1
1
  import type { AlertProps as AntAlertProps } from 'antd';
2
2
  import type { AlertRef } from 'antd/lib/alert/Alert';
3
- import type { ReactNode, Ref } from 'react';
3
+ import type { CSSProperties, ReactNode, Ref } from 'react';
4
4
  import type { IconProps } from "../Icon";
5
5
  export interface AlertProps extends Omit<AntAlertProps, 'icon' | 'type'> {
6
6
  classNames?: {
7
7
  alert?: string;
8
8
  container?: string;
9
+ extraContent?: string;
9
10
  };
10
11
  colorfulText?: boolean;
11
12
  extra?: ReactNode;
@@ -15,6 +16,11 @@ export interface AlertProps extends Omit<AntAlertProps, 'icon' | 'type'> {
15
16
  icon?: IconProps['icon'];
16
17
  iconProps?: Omit<IconProps, 'icon'>;
17
18
  ref?: Ref<AlertRef>;
19
+ styles?: {
20
+ alert?: CSSProperties;
21
+ container?: CSSProperties;
22
+ extraContent?: CSSProperties;
23
+ };
18
24
  text?: {
19
25
  detail?: string;
20
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "2.23.1",
3
+ "version": "2.23.2",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",