@uni-design-system/uni-react 8.4.0 → 9.0.1

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/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as require$$0 from "react";
2
2
  import require$$0__default, { createContext, forwardRef, useState, useMemo, useEffect, useContext, useRef, useLayoutEffect, useId, useInsertionEffect, useCallback, Children, isValidElement, Fragment, createElement, Component, memo as memo$1, useReducer, cloneElement } from "react";
3
- import { getValue, LightTheme, Z_INDEX, getDeviceSize, getDeviceOrientation, HSLAToString, ShadowCssMap, FontWeightMap, RoleHues } from "@uni-design-system/uni-core";
3
+ import { getValue, LightTheme, Z_INDEX, getDeviceSize, getDeviceOrientation, HSLAToString, ShadowCssMap, FontWeightMap } from "@uni-design-system/uni-core";
4
4
  import { unstable_batchedUpdates, createPortal } from "react-dom";
5
5
  import { css, cx as cx$1 } from "@emotion/css";
6
6
  var jsxRuntime = { exports: {} };
@@ -15050,6 +15050,11 @@ const Slide = forwardRef(function Slide2(props, ref) {
15050
15050
  ) });
15051
15051
  });
15052
15052
  Slide.displayName = "Slide";
15053
+ const toPx = (value, fallback) => {
15054
+ if (typeof value === "number") return value;
15055
+ const parsed = typeof value === "string" ? parseFloat(value) : NaN;
15056
+ return Number.isFinite(parsed) ? parsed : fallback;
15057
+ };
15053
15058
  const IconTextRow = ({
15054
15059
  iconName,
15055
15060
  color: color2,
@@ -15060,8 +15065,8 @@ const IconTextRow = ({
15060
15065
  }) => {
15061
15066
  const theme = useTheme();
15062
15067
  const textProps = getValue(theme, `typography.${textRole}`, theme.typography["title-medium"]);
15063
- const textHeight = textProps.fontSize;
15064
- const textLineHeight = textProps.lineHeight || textHeight;
15068
+ const textHeight = toPx(textProps.fontSize, 16);
15069
+ const textLineHeight = toPx(textProps.lineHeight, textHeight);
15065
15070
  const textMargin = text || children ? textLineHeight - textHeight : 0;
15066
15071
  function RowIcon() {
15067
15072
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { ...fix, maxHeight: textLineHeight }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { name: iconName, width: textLineHeight, height: textLineHeight, color: color2 }) });
@@ -19733,7 +19738,6 @@ const BOX_STYLE_PROP_KEYS = [
19733
19738
  "gridColumn",
19734
19739
  "gridRow",
19735
19740
  "overflow",
19736
- "elevation",
19737
19741
  "shadow",
19738
19742
  "gap",
19739
19743
  "fullWidth",
@@ -19778,7 +19782,6 @@ function boxClassName(props, styles) {
19778
19782
  ...styles.paddingRight(props.paddingRight),
19779
19783
  ...styles.paddingTop(props.paddingTop),
19780
19784
  ...styles.paddingBottom(props.paddingBottom),
19781
- ...styles.boxShadow(props.elevation),
19782
19785
  ...styles.boxShadow(props.shadow),
19783
19786
  ...styles.radius(props.borderRadius),
19784
19787
  ...styles.getRadiusLeft(props.borderRadiusLeft),
@@ -19955,7 +19958,7 @@ const SwitchConfigs = {
19955
19958
  };
19956
19959
  const Switch = ({ size = "sm", on = false, onChange }) => {
19957
19960
  const [isOn, setIsOn] = useState(on);
19958
- const successColor = `hsl(${RoleHues.success.default}, 32%, 50%)`;
19961
+ const successColor = useTheme().colors.success;
19959
19962
  const toggleSwitch = () => {
19960
19963
  setIsOn(!isOn);
19961
19964
  onChange && onChange(!isOn);