@lobehub/ui 3.4.0 → 3.4.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.
@@ -23,7 +23,6 @@ import { useStyles } from "./style";
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import { jsxs as _jsxs } from "react/jsx-runtime";
25
25
  var Avatar = /*#__PURE__*/memo(function (_ref) {
26
- var _ref2, _ref3;
27
26
  var bordered = _ref.bordered,
28
27
  className = _ref.className,
29
28
  avatar = _ref.avatar,
@@ -93,12 +92,15 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
93
92
  width: size
94
93
  }) : avatar;
95
94
  var hasBackground = background && background !== 'transparent' && background !== 'rgba(0,0,0,0)' && background !== null;
96
- var customAvatar = emoji ? /*#__PURE__*/_jsx(FluentEmoji, {
97
- emoji: emoji,
98
- size: emojiScaleWithBackground ? hasBackground ? size * 0.8 : size : size * 0.8,
99
- type: animation ? 'anim' : '3d',
100
- unoptimized: unoptimized
101
- }) : sliceText ? (_ref2 = text || title) === null || _ref2 === void 0 ? void 0 : _ref2.toUpperCase().slice(0, 2) : (_ref3 = text || title) === null || _ref3 === void 0 ? void 0 : _ref3.toUpperCase();
95
+ var customAvatar = useMemo(function () {
96
+ var _ref2, _ref3;
97
+ return emoji ? /*#__PURE__*/_jsx(FluentEmoji, {
98
+ emoji: emoji,
99
+ size: emojiScaleWithBackground ? hasBackground ? size * 0.85 : size : size * 0.85,
100
+ type: animation ? 'anim' : '3d',
101
+ unoptimized: unoptimized
102
+ }) : sliceText ? (_ref2 = text || title) === null || _ref2 === void 0 ? void 0 : _ref2.toUpperCase().slice(0, 2) : (_ref3 = text || title) === null || _ref3 === void 0 ? void 0 : _ref3.toUpperCase();
103
+ }, [animation, emoji, hasBackground, size, sliceText, text, title, unoptimized, emojiScaleWithBackground]);
102
104
  return /*#__PURE__*/_jsxs(AntAvatar, _objectSpread(_objectSpread({
103
105
  alt: imgAlt,
104
106
  className: cx(variants({
@@ -111,7 +113,7 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
111
113
  size: size,
112
114
  src: isDefaultAntAvatar ? defualtAvatar : undefined,
113
115
  style: _objectSpread({
114
- background: isDefaultAntAvatar && !emoji ? background : background || theme.colorBorder,
116
+ background: isDefaultAntAvatar || !!emoji ? background : background || theme.colorBorder,
115
117
  boxShadow: bordered ? "".concat(theme.colorBgLayout, " 0 0 0 2px, ").concat(borderedColor || theme.colorTextTertiary, " 0 0 0 4px") : undefined,
116
118
  color: readableColor(background || theme.colorBorder),
117
119
  cursor: rest !== null && rest !== void 0 && rest.onClick ? 'pointer' : undefined,
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import './style.css';
3
2
  import type { FlexBasicProps } from './type';
4
3
  declare const _default: import("react").NamedExoticComponent<FlexBasicProps>;
5
4
  export default _default;
@@ -10,7 +10,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
10
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; }
11
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; }
12
12
  import { memo } from 'react';
13
- import "./style.css";
14
13
  import { getCssValue, getFlexDirection, isHorizontal, isSpaceDistribution } from "./utils";
15
14
  import { jsx as _jsx } from "react/jsx-runtime";
16
15
  var FlexBasic = function FlexBasic(_ref) {
@@ -2,5 +2,5 @@ var _templateObject;
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 { css } from 'antd-style';
4
4
  export default (function (token) {
5
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :root {\n --font-settings: 'cv01', 'tnum', 'kern';\n --font-variations: 'opsz' auto, tabular-nums;\n\n text-autospace: normal;\n }\n\n html {\n overscroll-behavior: none;\n color-scheme: ", ";\n }\n\n body {\n overflow: hidden auto;\n\n min-height: 100vh;\n margin: 0;\n padding: 0;\n\n font-family: ", ";\n font-size: ", "px;\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n line-height: 1;\n color: ", ";\n text-size-adjust: none;\n text-rendering: optimizelegibility;\n word-wrap: break-word;\n vertical-align: baseline;\n\n background-color: ", ";\n\n -webkit-overflow-scrolling: touch;\n -webkit-tap-highlight-color: transparent;\n }\n\n code {\n font-family: ", " !important;\n\n span {\n font-family: ", " !important;\n }\n }\n\n ::selection {\n color: #000;\n background: ", ";\n\n -webkit-text-fill-color: unset !important;\n }\n\n * {\n scrollbar-color: ", " transparent;\n scrollbar-width: thin;\n box-sizing: border-box;\n vertical-align: baseline;\n }\n"])), token.isDarkMode ? 'dark' : 'light', token.fontFamily, token.fontSize, token.colorTextBase, token.colorBgLayout, token.fontFamilyCode, token.fontFamilyCode, token.yellow9, token.colorFill);
5
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :root {\n --font-settings: 'cv01', 'tnum', 'kern';\n --font-variations: 'opsz' auto, tabular-nums;\n\n text-autospace: normal;\n }\n\n html {\n overscroll-behavior: none;\n color-scheme: ", ";\n }\n\n body {\n overflow: hidden auto;\n\n min-height: 100vh;\n margin: 0;\n padding: 0;\n\n font-family: ", ";\n font-size: ", "px;\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n line-height: 1;\n color: ", ";\n text-size-adjust: none;\n text-rendering: optimizelegibility;\n word-wrap: break-word;\n vertical-align: baseline;\n\n background-color: ", ";\n\n -webkit-overflow-scrolling: touch;\n -webkit-tap-highlight-color: transparent;\n }\n\n code {\n font-family: ", " !important;\n\n span {\n font-family: ", " !important;\n }\n }\n\n ::selection {\n color: #000;\n background: ", ";\n\n -webkit-text-fill-color: unset !important;\n }\n\n * {\n scrollbar-color: ", " transparent;\n scrollbar-width: thin;\n box-sizing: border-box;\n vertical-align: baseline;\n }\n\n @layer lobe-base {\n :where(.lobe-flex) {\n /* Define defaults on the element itself to avoid CSS variable inheritance leaking to nested Flex */\n --lobe-flex: 0 1 auto;\n --lobe-flex-direction: column;\n --lobe-flex-wrap: nowrap;\n --lobe-flex-justify: flex-start;\n --lobe-flex-align: stretch;\n --lobe-flex-width: auto;\n --lobe-flex-height: auto;\n --lobe-flex-padding: 0;\n /* Keep padding-inline/block aligned with padding by default, and prevent inheriting from parent */\n --lobe-flex-padding-inline: var(--lobe-flex-padding);\n --lobe-flex-padding-block: var(--lobe-flex-padding);\n --lobe-flex-gap: 0;\n\n display: flex;\n\n flex: var(--lobe-flex);\n flex-direction: var(--lobe-flex-direction);\n flex-wrap: var(--lobe-flex-wrap);\n justify-content: var(--lobe-flex-justify);\n align-items: var(--lobe-flex-align);\n\n width: var(--lobe-flex-width);\n height: var(--lobe-flex-height);\n\n padding: var(--lobe-flex-padding);\n padding-inline: var(--lobe-flex-padding-inline);\n padding-block: var(--lobe-flex-padding-block);\n\n gap: var(--lobe-flex-gap);\n }\n\n .lobe-flex--hidden {\n display: none;\n }\n }\n"])), token.isDarkMode ? 'dark' : 'light', token.fontFamily, token.fontSize, token.colorTextBase, token.colorBgLayout, token.fontFamilyCode, token.fontFamilyCode, token.yellow9, token.colorFill);
6
6
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",
package/es/Flex/style.css DELETED
@@ -1,36 +0,0 @@
1
- .lobe-flex {
2
- /* Define defaults on the element itself to avoid CSS variable inheritance leaking to nested Flex */
3
- --lobe-flex: 0 1 auto;
4
- --lobe-flex-direction: column;
5
- --lobe-flex-wrap: nowrap;
6
- --lobe-flex-justify: flex-start;
7
- --lobe-flex-align: stretch;
8
- --lobe-flex-width: auto;
9
- --lobe-flex-height: auto;
10
- --lobe-flex-padding: 0;
11
- /* Keep padding-inline/block aligned with padding by default, and prevent inheriting from parent */
12
- --lobe-flex-padding-inline: var(--lobe-flex-padding);
13
- --lobe-flex-padding-block: var(--lobe-flex-padding);
14
- --lobe-flex-gap: 0;
15
-
16
- display: flex;
17
-
18
- flex: var(--lobe-flex);
19
- flex-direction: var(--lobe-flex-direction);
20
- flex-wrap: var(--lobe-flex-wrap);
21
- justify-content: var(--lobe-flex-justify);
22
- align-items: var(--lobe-flex-align);
23
-
24
- width: var(--lobe-flex-width);
25
- height: var(--lobe-flex-height);
26
-
27
- padding: var(--lobe-flex-padding);
28
- padding-inline: var(--lobe-flex-padding-inline);
29
- padding-block: var(--lobe-flex-padding-block);
30
-
31
- gap: var(--lobe-flex-gap);
32
- }
33
-
34
- .lobe-flex--hidden {
35
- display: none;
36
- }