@uni-design-system/uni-react 9.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @uni-design-system/uni-react
2
2
 
3
+ ## 9.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f926cd5`](https://github.com/uni-design-system/uni/commit/f926cd513a5cac593adef559e21bada4dada76ee) Thanks [@gaenglish](https://github.com/gaenglish)! - `uni-react`'s Switch reads the `success` color token instead of hand-rolling an
8
+ HSL string from a color-generation internal, and both packages now typecheck as
9
+ part of their build.
10
+
11
+ The Switch built its "on" color as `hsl(${RoleHues.success.default}, 32%, 50%)`
12
+ — a fixed green assembled from the HSL generation tables rather than the theme,
13
+ so it never recolored with the theme and broke when those tables were removed.
14
+ It now reads `useTheme().colors.success`.
15
+
16
+ The reason that reached a deploy is the build. `vite build` transpiles with
17
+ esbuild, which strips types without checking them, and it treats
18
+ `@uni-design-system/uni-core` as an external — so neither the type layer nor the
19
+ module graph ever verified that an imported core export exists. `pnpm turbo run
20
+ build` passed on a package whose source did not compile.
21
+ - `core` and `react` now run `tsc --noEmit` as the first half of `build`, so a
22
+ removed or renamed core export fails the consumer's build.
23
+ - A `type-check` turbo task exists for running that pass alone.
24
+ - CI builds **both** Storybooks, not just Angular's. These bundle uni-core
25
+ instead of externalizing it, so they are the step that resolves its exports
26
+ against real consumer source.
27
+
28
+ This also cleared four pre-existing type errors in `IconTextRow`, which did
29
+ arithmetic on `fontSize` / `lineHeight` — typed `CssLength` (`number | string`)
30
+ — and passed the result to props typed `number`. They are coerced through one
31
+ documented helper now.
32
+
3
33
  ## 9.0.0
4
34
 
5
35
  ### Major Changes
@@ -15068,6 +15068,11 @@ const Slide = require$$0.forwardRef(function Slide2(props, ref) {
15068
15068
  ) });
15069
15069
  });
15070
15070
  Slide.displayName = "Slide";
15071
+ const toPx = (value, fallback) => {
15072
+ if (typeof value === "number") return value;
15073
+ const parsed = typeof value === "string" ? parseFloat(value) : NaN;
15074
+ return Number.isFinite(parsed) ? parsed : fallback;
15075
+ };
15071
15076
  const IconTextRow = ({
15072
15077
  iconName,
15073
15078
  color: color2,
@@ -15078,8 +15083,8 @@ const IconTextRow = ({
15078
15083
  }) => {
15079
15084
  const theme = useTheme();
15080
15085
  const textProps = uniCore.getValue(theme, `typography.${textRole}`, theme.typography["title-medium"]);
15081
- const textHeight = textProps.fontSize;
15082
- const textLineHeight = textProps.lineHeight || textHeight;
15086
+ const textHeight = toPx(textProps.fontSize, 16);
15087
+ const textLineHeight = toPx(textProps.lineHeight, textHeight);
15083
15088
  const textMargin = text || children ? textLineHeight - textHeight : 0;
15084
15089
  function RowIcon() {
15085
15090
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { ...fix, maxHeight: textLineHeight }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { name: iconName, width: textLineHeight, height: textLineHeight, color: color2 }) });
@@ -19971,7 +19976,7 @@ const SwitchConfigs = {
19971
19976
  };
19972
19977
  const Switch = ({ size = "sm", on = false, onChange }) => {
19973
19978
  const [isOn, setIsOn] = require$$0.useState(on);
19974
- const successColor = `hsl(${uniCore.RoleHues.success.default}, 32%, 50%)`;
19979
+ const successColor = useTheme().colors.success;
19975
19980
  const toggleSwitch = () => {
19976
19981
  setIsOn(!isOn);
19977
19982
  onChange && onChange(!isOn);