@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/CHANGELOG.md CHANGED
@@ -1,5 +1,104 @@
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
+
33
+ ## 9.0.0
34
+
35
+ ### Major Changes
36
+
37
+ - [`8250162`](https://github.com/uni-design-system/uni/commit/8250162c35e418f976080904df4c20783feeb6e2) Thanks [@gaenglish](https://github.com/gaenglish)! - Every deprecated API is removed. The library now carries no `@deprecated`
38
+ symbols at all.
39
+
40
+ **Per-component duration options → the `motion` scale.** Six components carried
41
+ their own duration knob that predated the motion scale and _won over_ it:
42
+ `expand.transitionSpeed`, `callout.transitionMs`, `radio.transitionSpeed`,
43
+ `menuItem.transitionSpeed`, `alert.transitionSpeed` and
44
+ `snackbar.transitionDelay`. All are gone, along with the precedence branch each
45
+ one required — timing now comes from the token, full stop.
46
+
47
+ Retime the token instead; one edit covers every component pointing at it. To
48
+ retime a single component, define a token of your own and point that
49
+ component's `motion` option at it:
50
+
51
+ ```ts
52
+ createTheme({
53
+ …,
54
+ motion: { productive: { duration: 110, easing: 'ease' } },
55
+ components: { menuItem: { options: { motion: 'productive' } } },
56
+ });
57
+ ```
58
+
59
+ A `duration: 0` token is how a theme opts out of motion — that is what
60
+ `transitionSpeed: 0` used to mean. Both showcase themes are migrated this way
61
+ (Carbon to a 110ms `productive` token, Wellsourced to an `instant` one).
62
+
63
+ **Options that never did anything.** `card.transitionSpeed` and
64
+ `inputBox.transitionSpeed` were read by nothing and never had been. Delete them
65
+ from your theme; nothing replaces them.
66
+
67
+ **Renames and obsolete APIs**
68
+ - `inputBox.typeFace` → `typeface` (the casing every other component uses).
69
+ - `uni-tooltip`'s `appendToBody` input — inert since the tooltip moved to the
70
+ native top layer, which escapes any overflow context by itself.
71
+ - Box's `elevation` input → `shadow`, in both the Angular and React packages.
72
+ It was a second name for the same thing.
73
+ - The Angular `icons` re-export → import `BaseIcons` from
74
+ `@uni-design-system/uni-core`. The default set ships with every theme.
75
+
76
+ **The HSL color legacy is gone from uni-core.** `uniColor`, `randomRangeValue`,
77
+ `CategorySaturation` and `CategoryLightness` are removed, superseded by the
78
+ deterministic OKLCH engine (`generateThemes` / `generatePalette`) — same input,
79
+ same theme, WCAG-checked. `RoleHues` and the `UniColor` type go with them: they
80
+ were reachable only through `uniColor`, and `RoleHues` had gone stale enough to
81
+ hold saturation values in a table of hues.
82
+
83
+ **Deferred output renames.** Three outputs were held back because renaming is
84
+ breaking; this is that release. Each also drops an eslint escape it needed for
85
+ shadowing a native event name or using an `on` prefix.
86
+
87
+ | Component | Before | After |
88
+ | -------------------- | ----------------- | ---------------- |
89
+ | `uni-debounce-input` | `(change)` | `(valueChange)` |
90
+ | `uni-search-input` | `(change)` | `(searchChange)` |
91
+ | `uni-search-input` | `(search)` | `(searchSubmit)` |
92
+ | `dragAndDrop` | `(onFileDropped)` | `(fileDropped)` |
93
+
94
+ **`uni-dropdown`'s `color` input → `containerColor`,** completing the rule the
95
+ layout directives set: every container-pair input in the library is now
96
+ `containerColor`, and plain `color` always means the CSS property.
97
+
98
+ **`ThemeService.getSpacing('none')` now returns `0`, not the string `'none'`.**
99
+ `'none'` is not a valid length, so it was silently dropped wherever it landed —
100
+ `uni-menu` carried a comment working around exactly that, which is now deleted.
101
+
3
102
  ## 8.4.0
4
103
 
5
104
  ### Minor 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 }) });
@@ -19751,7 +19756,6 @@ const BOX_STYLE_PROP_KEYS = [
19751
19756
  "gridColumn",
19752
19757
  "gridRow",
19753
19758
  "overflow",
19754
- "elevation",
19755
19759
  "shadow",
19756
19760
  "gap",
19757
19761
  "fullWidth",
@@ -19796,7 +19800,6 @@ function boxClassName(props, styles) {
19796
19800
  ...styles.paddingRight(props.paddingRight),
19797
19801
  ...styles.paddingTop(props.paddingTop),
19798
19802
  ...styles.paddingBottom(props.paddingBottom),
19799
- ...styles.boxShadow(props.elevation),
19800
19803
  ...styles.boxShadow(props.shadow),
19801
19804
  ...styles.radius(props.borderRadius),
19802
19805
  ...styles.getRadiusLeft(props.borderRadiusLeft),
@@ -19973,7 +19976,7 @@ const SwitchConfigs = {
19973
19976
  };
19974
19977
  const Switch = ({ size = "sm", on = false, onChange }) => {
19975
19978
  const [isOn, setIsOn] = require$$0.useState(on);
19976
- const successColor = `hsl(${uniCore.RoleHues.success.default}, 32%, 50%)`;
19979
+ const successColor = useTheme().colors.success;
19977
19980
  const toggleSwitch = () => {
19978
19981
  setIsOn(!isOn);
19979
19982
  onChange && onChange(!isOn);