@uni-design-system/uni-core 10.2.1 → 10.4.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,93 @@
1
1
  # @uni-design-system/uni-core
2
2
 
3
+ ## 10.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`cb5f08f`](https://github.com/uni-design-system/uni/commit/cb5f08f7bc7f73492688d33388c905941762ea0b) Thanks [@gaenglish](https://github.com/gaenglish)! - Give `uni-dialog` the drawer's three-row layout: a pinned `[uni-dialog-header]`, a scrolling body, and pinned `[uni-dialog-buttons]`.
8
+
9
+ The surface is now a flex column that is `overflow: clip` on both axes, so it is never the scroll container — previously a long form scrolled the dialog's own title and action buttons off the screen. Unlike the drawer, the dialog declares no height and stays sized by its content, growing until it reaches `calc(100dvh - 2 × inset)` and only then scrolling its body.
10
+
11
+ New theme options: `dialog.inset` (gap from the viewport edge before the body scrolls, default `lg`), `dialog.bodyPadding` (pads the scrolling row alone; `dialog.padding` still insets all three rows), and `divider` on `dialogHeader` / `dialogButtons` for a border between a pinned row and the body — all off or unchanged by default, so existing dialogs keep their appearance.
12
+
13
+ `[uni-dialog-header]` gains the shorter `[dialog-header]` alias, matching `[dialog-buttons]`; the long form keeps working. The `defaultCloseButton` now actually floats in the corner — its `position: absolute` was being lost to the icon button's own class, which left it inline at the top of the surface.
14
+
15
+ The drawer's overlay scrim now fades in and out with the panel instead of snapping. Its `::backdrop` had a background and no animation at all, so the dimming appeared and vanished instantly around a panel that took 250ms to slide. A new `drawer.motion` option (default `panel`) times the slide, the scrim's fade and the side panel's width transition together, replacing the hardcoded 250ms literals. The global reduced-motion rule now also reaches `::backdrop`, so both the drawer's and the dialog's scrim honour the preference (WCAG 2.3.3).
16
+
17
+ Dialog and drawer scrims now come from one token. `UniTheme` gains a `backdrops` scale — open and named like `shadows` and `motion` — and both components' `backdrop` option points at a name (`'scrim'`) instead of carrying its own CSS. They had drifted: the dialog washed the page white and blurred it while the drawer dimmed it dark, and a theme that dressed the dialog left the drawer on the library default. A raw style object is still accepted on either option, so a theme that states one keeps working.
18
+
19
+ The dialog's fade now reads the theme's `motion` token too (new `dialog.motion` option, default `panel`), replacing a hardcoded `350ms ease-in`. It shared the drawer's scrim but not its timing, so the same surface arrived at two speeds; both are now 250ms and a theme retimes them together.
20
+
21
+ ## 10.3.0
22
+
23
+ ### Minor Changes
24
+
25
+ - [`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.
26
+
27
+ **Five of the twelve variants had no visible keyboard focus ring.** The ring
28
+ resolved the variant _name_ as a colour token — the pattern 10.2.0 removed from
29
+ checkbox, radio and toggle, missed on the one component where it costs an
30
+ accessibility failure rather than a wrong colour:
31
+
32
+ ```ts
33
+ outline: `2px solid ${this.theme.colors()[this.variant()]}`;
34
+ ```
35
+
36
+ `ghost` resolves to `transparent`, so its ring was drawn invisibly.
37
+ `light`, `onLight`, `dark` and `onDark` have no colour token at all, so the
38
+ declaration became `2px solid undefined` and the parser dropped it — as would
39
+ any intent a consumer registers. In every case `outline-offset` survived, so
40
+ the element still shifted on focus and the missing ring went unnoticed. This
41
+ was live without the registry involved.
42
+
43
+ The colour now comes from the variant's theme entry via `variantOptions`, the
44
+ mechanism the selection controls already use, and falls back to the reserved
45
+ `primary` accent rather than to nothing. Each variant keeps the ring colour it
46
+ had; `ghost` gains a visible one. The ring also routes through the shared
47
+ `focusRingStyle`, so a theme defining `focusRing` primitives restyles the button
48
+ alongside every other control.
49
+
50
+ **A theme could not give a button a border.** `border`, `outline`, `overflow`
51
+ and `transition` were applied _after_ the theme's styles, so a variant
52
+ declaring a border was silently erased and `!important` was the only way
53
+ through — which then spread to every state adjusting that border, since the
54
+ shorthand outranks the longhand.
55
+
56
+ The base theme was caught by its own reset: `secondary` is commented "Hollow"
57
+ and declares `1px solid`, and has been rendering borderless. **It now renders
58
+ its border** — the one visible change here for anyone on the default theme.
59
+
60
+ Those four properties move ahead of the theme's styles, resolving the
61
+ `TODO: Set priority on theme-defined styles` that sat on this line. Structure
62
+ the component genuinely owns — `position` for the ripple, the symbol slots —
63
+ stays after, and the reset still applies to every variant that does not
64
+ override it.
65
+
66
+ **`uni-icon-button`'s hover moved to the theme too.** It branched on
67
+ `variant() === 'ghost'` to choose between a raised shadow and a translucent
68
+ wash, after the theme's own styles. Being a binary partition, every intent a
69
+ consumer registered fell into the not-ghost half and was given a lift whether
70
+ or not it suited — a recessive intent included — and no theme could correct it.
71
+ Both themes in this repo declare a ghost hover and had it silently overridden.
72
+
73
+ Both treatments now live in `iconButton.variants` beside the colours they belong
74
+ with. Rendering is unchanged for the variants the theme styles; a variant it
75
+ does not style no longer receives a hover it never asked for, and the `disabled`
76
+ variant loses one it should never have had, since its block is also spread into
77
+ `&:disabled`.
78
+
79
+ **`uni-icon-button` had no focus indicator at all.** Its structural block cleared
80
+ the user-agent outline and put nothing back, in every variant — so the close
81
+ affordance in every dialog and drawer header was unreachable-looking under
82
+ keyboard navigation. This was not reported; it was found while verifying the
83
+ button fix above.
84
+
85
+ It now draws the shared ring, with its colour read from the same
86
+ `variantOptions.focusColor` the button uses. The indicator is applied last on
87
+ purpose: its appearance is the theme's, through `focusColor` and the `focusRing`
88
+ primitives, but whether one exists is not a style a theme should be able to
89
+ switch off by accident.
90
+
3
91
  ## 10.2.1
4
92
 
5
93
  ## 10.2.0
@@ -1031,6 +1031,16 @@ var BaseMotion = {
1031
1031
  easing: "ease"
1032
1032
  }
1033
1033
  };
1034
+ /**
1035
+ * The one wash every modal surface lays over the page it covers. Dialog and
1036
+ * drawer both point at `scrim` by name, so a theme redresses them together —
1037
+ * before this they owned a `backdrop` blob each and had drifted apart, the
1038
+ * dialog washing the page white and blurred while the drawer dimmed it dark.
1039
+ */
1040
+ var BaseBackdrops = { scrim: {
1041
+ background: "rgba(255, 255, 255, 0.6)",
1042
+ backdropFilter: "blur(2px)"
1043
+ } };
1034
1044
  var BaseRadii = {
1035
1045
  none: "none",
1036
1046
  xxs: "4px",
@@ -1123,9 +1133,10 @@ var buildComponents = (c) => ({
1123
1133
  divider: "light",
1124
1134
  elevation: "menu",
1125
1135
  padding: "md",
1126
- backdrop: { background: "rgba(0, 0, 0, 0.4)" },
1136
+ backdrop: "scrim",
1127
1137
  scrim: true,
1128
- background: "solid"
1138
+ background: "solid",
1139
+ motion: "panel"
1129
1140
  } },
1130
1141
  drawerHeader: { options: {
1131
1142
  color: void 0,
@@ -1240,17 +1251,18 @@ var buildComponents = (c) => ({
1240
1251
  color: "primary-surface",
1241
1252
  border: "quaternary",
1242
1253
  padding: "sm",
1254
+ bodyPadding: void 0,
1255
+ inset: "lg",
1243
1256
  elevation: "dialog",
1244
- backdrop: {
1245
- background: "rgba(255, 255, 255, 0.6)",
1246
- backdropFilter: "blur(2px)"
1247
- }
1257
+ backdrop: "scrim",
1258
+ motion: "panel"
1248
1259
  } },
1249
1260
  dialogButtons: { options: {
1250
1261
  gap: "md",
1251
1262
  padding: "md",
1252
1263
  paddingBottom: "lg",
1253
1264
  justifyContent: "center",
1265
+ divider: void 0,
1254
1266
  confirmButtonVariant: "primary",
1255
1267
  cancelButtonVariant: "warn",
1256
1268
  buttonSize: "lg",
@@ -1263,6 +1275,7 @@ var buildComponents = (c) => ({
1263
1275
  height: 48,
1264
1276
  textRole: "title-large",
1265
1277
  textAlign: "center",
1278
+ divider: void 0,
1266
1279
  closeButtonIcon: "close",
1267
1280
  closeButtonSize: "md"
1268
1281
  } },
@@ -1559,6 +1572,15 @@ var buildComponents = (c) => ({
1559
1572
  cursor: "pointer",
1560
1573
  transition: "all 0.28s ease"
1561
1574
  },
1575
+ variantOptions: {
1576
+ primary: { focusColor: "primary" },
1577
+ secondary: { focusColor: "secondary" },
1578
+ tertiary: { focusColor: "tertiary" },
1579
+ warn: { focusColor: "warn" },
1580
+ success: { focusColor: "success" },
1581
+ disabled: { focusColor: "disabled" },
1582
+ ghost: { focusColor: "primary" }
1583
+ },
1562
1584
  variants: {
1563
1585
  ghost: {
1564
1586
  backgroundColor: "transparent",
@@ -1630,30 +1652,45 @@ var buildComponents = (c) => ({
1630
1652
  },
1631
1653
  iconButton: {
1632
1654
  options: { borderRadius: "max" },
1655
+ variantOptions: {
1656
+ primary: { focusColor: "primary" },
1657
+ secondary: { focusColor: "secondary" },
1658
+ tertiary: { focusColor: "tertiary" },
1659
+ warn: { focusColor: "warn" },
1660
+ success: { focusColor: "success" },
1661
+ disabled: { focusColor: "disabled" },
1662
+ ghost: { focusColor: "primary" }
1663
+ },
1633
1664
  variants: {
1634
1665
  ghost: {
1635
1666
  backgroundColor: "transparent",
1636
- color: "currentcolor"
1667
+ color: "currentcolor",
1668
+ "&:hover": { backgroundColor: "rgba(0,0,0,0.1)" }
1637
1669
  },
1638
1670
  primary: {
1639
1671
  backgroundColor: c.primary,
1640
- color: c["on-primary"]
1672
+ color: c["on-primary"],
1673
+ "&:hover": { boxShadow: BaseShadows.raised }
1641
1674
  },
1642
1675
  secondary: {
1643
1676
  backgroundColor: c.secondary,
1644
- color: c["on-secondary"]
1677
+ color: c["on-secondary"],
1678
+ "&:hover": { boxShadow: BaseShadows.raised }
1645
1679
  },
1646
1680
  tertiary: {
1647
1681
  backgroundColor: c.tertiary,
1648
- color: c["on-tertiary"]
1682
+ color: c["on-tertiary"],
1683
+ "&:hover": { boxShadow: BaseShadows.raised }
1649
1684
  },
1650
1685
  warn: {
1651
1686
  backgroundColor: c.warn,
1652
- color: c["on-warn"]
1687
+ color: c["on-warn"],
1688
+ "&:hover": { boxShadow: BaseShadows.raised }
1653
1689
  },
1654
1690
  success: {
1655
1691
  backgroundColor: c.success,
1656
- color: c["on-success"]
1692
+ color: c["on-success"],
1693
+ "&:hover": { boxShadow: BaseShadows.raised }
1657
1694
  },
1658
1695
  disabled: {
1659
1696
  backgroundColor: "transparent !important",
@@ -1909,7 +1946,7 @@ var deepMerge = (base, override) => {
1909
1946
  for (const [key, value] of Object.entries(override)) out[key] = isRecord$1(value) && isRecord$1(out[key]) ? deepMerge(out[key], value) : value;
1910
1947
  return out;
1911
1948
  };
1912
- var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, motion, typography, borders, thicknesses, spacing, components }) => ({
1949
+ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, motion, backdrops, typography, borders, thicknesses, spacing, components }) => ({
1913
1950
  id,
1914
1951
  name,
1915
1952
  colors,
@@ -1925,6 +1962,10 @@ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows =
1925
1962
  ...BaseMotion,
1926
1963
  ...motion
1927
1964
  },
1965
+ backdrops: {
1966
+ ...BaseBackdrops,
1967
+ ...backdrops
1968
+ },
1928
1969
  thicknesses: {
1929
1970
  ...BaseThicknesses,
1930
1971
  ...thicknesses