@uni-design-system/uni-react 9.0.0 → 10.0.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.
- package/CHANGELOG.md +32 -0
- package/dist/cjs/index.cjs +8 -3
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +9 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/icon-text-row/icon-text-row.component.d.ts.map +1 -1
- package/dist/types/components/switch/switch.component.d.ts.map +1 -1
- package/package.json +5 -4
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
|
|
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
|
|
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 }) });
|
|
@@ -19953,7 +19958,7 @@ const SwitchConfigs = {
|
|
|
19953
19958
|
};
|
|
19954
19959
|
const Switch = ({ size = "sm", on = false, onChange }) => {
|
|
19955
19960
|
const [isOn, setIsOn] = useState(on);
|
|
19956
|
-
const successColor =
|
|
19961
|
+
const successColor = useTheme().colors.success;
|
|
19957
19962
|
const toggleSwitch = () => {
|
|
19958
19963
|
setIsOn(!isOn);
|
|
19959
19964
|
onChange && onChange(!isOn);
|