@uni-design-system/uni-core 10.2.1 → 10.3.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 CHANGED
@@ -1,5 +1,75 @@
1
1
  # @uni-design-system/uni-core
2
2
 
3
+ ## 10.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`ab1689a`](https://github.com/uni-design-system/uni/commit/ab1689a8e6ddf26943403ec32e5d4871bc9f0fb6) Thanks [@gaenglish](https://github.com/gaenglish)! - `uni-button`: the focus ring is themed, and the theme now outranks the reset.
8
+
9
+ **Five of the twelve variants had no visible keyboard focus ring.** The ring
10
+ resolved the variant _name_ as a colour token — the pattern 10.2.0 removed from
11
+ checkbox, radio and toggle, missed on the one component where it costs an
12
+ accessibility failure rather than a wrong colour:
13
+
14
+ ```ts
15
+ outline: `2px solid ${this.theme.colors()[this.variant()]}`;
16
+ ```
17
+
18
+ `ghost` resolves to `transparent`, so its ring was drawn invisibly.
19
+ `light`, `onLight`, `dark` and `onDark` have no colour token at all, so the
20
+ declaration became `2px solid undefined` and the parser dropped it — as would
21
+ any intent a consumer registers. In every case `outline-offset` survived, so
22
+ the element still shifted on focus and the missing ring went unnoticed. This
23
+ was live without the registry involved.
24
+
25
+ The colour now comes from the variant's theme entry via `variantOptions`, the
26
+ mechanism the selection controls already use, and falls back to the reserved
27
+ `primary` accent rather than to nothing. Each variant keeps the ring colour it
28
+ had; `ghost` gains a visible one. The ring also routes through the shared
29
+ `focusRingStyle`, so a theme defining `focusRing` primitives restyles the button
30
+ alongside every other control.
31
+
32
+ **A theme could not give a button a border.** `border`, `outline`, `overflow`
33
+ and `transition` were applied _after_ the theme's styles, so a variant
34
+ declaring a border was silently erased and `!important` was the only way
35
+ through — which then spread to every state adjusting that border, since the
36
+ shorthand outranks the longhand.
37
+
38
+ The base theme was caught by its own reset: `secondary` is commented "Hollow"
39
+ and declares `1px solid`, and has been rendering borderless. **It now renders
40
+ its border** — the one visible change here for anyone on the default theme.
41
+
42
+ Those four properties move ahead of the theme's styles, resolving the
43
+ `TODO: Set priority on theme-defined styles` that sat on this line. Structure
44
+ the component genuinely owns — `position` for the ripple, the symbol slots —
45
+ stays after, and the reset still applies to every variant that does not
46
+ override it.
47
+
48
+ **`uni-icon-button`'s hover moved to the theme too.** It branched on
49
+ `variant() === 'ghost'` to choose between a raised shadow and a translucent
50
+ wash, after the theme's own styles. Being a binary partition, every intent a
51
+ consumer registered fell into the not-ghost half and was given a lift whether
52
+ or not it suited — a recessive intent included — and no theme could correct it.
53
+ Both themes in this repo declare a ghost hover and had it silently overridden.
54
+
55
+ Both treatments now live in `iconButton.variants` beside the colours they belong
56
+ with. Rendering is unchanged for the variants the theme styles; a variant it
57
+ does not style no longer receives a hover it never asked for, and the `disabled`
58
+ variant loses one it should never have had, since its block is also spread into
59
+ `&:disabled`.
60
+
61
+ **`uni-icon-button` had no focus indicator at all.** Its structural block cleared
62
+ the user-agent outline and put nothing back, in every variant — so the close
63
+ affordance in every dialog and drawer header was unreachable-looking under
64
+ keyboard navigation. This was not reported; it was found while verifying the
65
+ button fix above.
66
+
67
+ It now draws the shared ring, with its colour read from the same
68
+ `variantOptions.focusColor` the button uses. The indicator is applied last on
69
+ purpose: its appearance is the theme's, through `focusColor` and the `focusRing`
70
+ primitives, but whether one exists is not a style a theme should be able to
71
+ switch off by accident.
72
+
3
73
  ## 10.2.1
4
74
 
5
75
  ## 10.2.0
@@ -1559,6 +1559,15 @@ var buildComponents = (c) => ({
1559
1559
  cursor: "pointer",
1560
1560
  transition: "all 0.28s ease"
1561
1561
  },
1562
+ variantOptions: {
1563
+ primary: { focusColor: "primary" },
1564
+ secondary: { focusColor: "secondary" },
1565
+ tertiary: { focusColor: "tertiary" },
1566
+ warn: { focusColor: "warn" },
1567
+ success: { focusColor: "success" },
1568
+ disabled: { focusColor: "disabled" },
1569
+ ghost: { focusColor: "primary" }
1570
+ },
1562
1571
  variants: {
1563
1572
  ghost: {
1564
1573
  backgroundColor: "transparent",
@@ -1630,30 +1639,45 @@ var buildComponents = (c) => ({
1630
1639
  },
1631
1640
  iconButton: {
1632
1641
  options: { borderRadius: "max" },
1642
+ variantOptions: {
1643
+ primary: { focusColor: "primary" },
1644
+ secondary: { focusColor: "secondary" },
1645
+ tertiary: { focusColor: "tertiary" },
1646
+ warn: { focusColor: "warn" },
1647
+ success: { focusColor: "success" },
1648
+ disabled: { focusColor: "disabled" },
1649
+ ghost: { focusColor: "primary" }
1650
+ },
1633
1651
  variants: {
1634
1652
  ghost: {
1635
1653
  backgroundColor: "transparent",
1636
- color: "currentcolor"
1654
+ color: "currentcolor",
1655
+ "&:hover": { backgroundColor: "rgba(0,0,0,0.1)" }
1637
1656
  },
1638
1657
  primary: {
1639
1658
  backgroundColor: c.primary,
1640
- color: c["on-primary"]
1659
+ color: c["on-primary"],
1660
+ "&:hover": { boxShadow: BaseShadows.raised }
1641
1661
  },
1642
1662
  secondary: {
1643
1663
  backgroundColor: c.secondary,
1644
- color: c["on-secondary"]
1664
+ color: c["on-secondary"],
1665
+ "&:hover": { boxShadow: BaseShadows.raised }
1645
1666
  },
1646
1667
  tertiary: {
1647
1668
  backgroundColor: c.tertiary,
1648
- color: c["on-tertiary"]
1669
+ color: c["on-tertiary"],
1670
+ "&:hover": { boxShadow: BaseShadows.raised }
1649
1671
  },
1650
1672
  warn: {
1651
1673
  backgroundColor: c.warn,
1652
- color: c["on-warn"]
1674
+ color: c["on-warn"],
1675
+ "&:hover": { boxShadow: BaseShadows.raised }
1653
1676
  },
1654
1677
  success: {
1655
1678
  backgroundColor: c.success,
1656
- color: c["on-success"]
1679
+ color: c["on-success"],
1680
+ "&:hover": { boxShadow: BaseShadows.raised }
1657
1681
  },
1658
1682
  disabled: {
1659
1683
  backgroundColor: "transparent !important",