@uni-design-system/uni-core 10.0.0 → 10.1.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 +103 -0
- package/dist/cjs/index.cjs +48 -9
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +48 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/types/concepts/component/component.types.d.ts +1 -1
- package/dist/types/concepts/component/component.types.d.ts.map +1 -1
- package/dist/types/concepts/theme/themes/base.theme.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,108 @@
|
|
|
1
1
|
# @uni-design-system/uni-core
|
|
2
2
|
|
|
3
|
+
## 10.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`f28c951`](https://github.com/uni-design-system/uni/commit/f28c95117f2844b58a265b59c2ea8b9715156670) Thanks [@gaenglish](https://github.com/gaenglish)! - `uni-drawer` is a three-row panel, and is no longer its own scroll container.
|
|
8
|
+
|
|
9
|
+
**The `<dialog>` used to be the scroller.** `over` mode set `overflowY: 'auto'`
|
|
10
|
+
on the panel and put the theme's padding there too, which made a pinned header
|
|
11
|
+
or footer impossible: padding on a scrolling box scrolls away with its content,
|
|
12
|
+
and any row you pinned against it could not sit flush to the panel edge. It also
|
|
13
|
+
set only the one axis — and a single explicit overflow axis computes the other
|
|
14
|
+
to `auto`, which is exactly how a container becomes an accidental scroller.
|
|
15
|
+
`side` had it right already, setting both.
|
|
16
|
+
|
|
17
|
+
The panel is now a flex column of three rows — an optional
|
|
18
|
+
`[uni-drawer-header]`, the projected body, an optional `[uni-drawer-buttons]`
|
|
19
|
+
(alias `[drawer-buttons]`) — and **only the body scrolls**. The panel itself is
|
|
20
|
+
`overflow: clip` on both axes, explicitly, never the shorthand. The body carries
|
|
21
|
+
`overscroll-behavior: contain`, so scrolling to its end does not start scrolling
|
|
22
|
+
the page behind it, and `position: relative`, so a stray absolutely positioned
|
|
23
|
+
descendant is contained rather than re-homed into an ancestor.
|
|
24
|
+
|
|
25
|
+
Those two must travel together: a positioned body _without_ a clipped shell is
|
|
26
|
+
worse than the status quo, because it pulls phantom overflow into the scroller
|
|
27
|
+
instead of out of the panel.
|
|
28
|
+
|
|
29
|
+
**`drawer.behavior.padding` is now the body's padding, not the panel's.** A
|
|
30
|
+
drawer with no header or footer looks the same as before. One that gains either
|
|
31
|
+
gets rows flush to the panel edge, which is the point.
|
|
32
|
+
|
|
33
|
+
Two new theme entries, `drawerHeader` and `drawerButtons`, mirror the dialog
|
|
34
|
+
pair knob for knob but default to a panel's posture rather than a dialog's: the
|
|
35
|
+
header's title is left-aligned rather than centered, and the footer trails its
|
|
36
|
+
actions rather than centering them.
|
|
37
|
+
|
|
38
|
+
Note one deliberate divergence from `[dialog-buttons]`: the drawer footer's
|
|
39
|
+
**confirm button does not close the drawer**. A panel's save is usually async
|
|
40
|
+
and can fail, so closing is left to the consumer via `(confirmed)`.
|
|
41
|
+
|
|
42
|
+
- [`67e17ea`](https://github.com/uni-design-system/uni/commit/67e17ea927e3ca24b7abecdcccf134d53ac3656b) Thanks [@gaenglish](https://github.com/gaenglish)! - `uni-toggle` honours `size`, and the checked colour has a theme home.
|
|
43
|
+
|
|
44
|
+
**`size` did nothing.** `uni-toggle` inherits a bindable `size` input from
|
|
45
|
+
`BaseComponent`, but its geometry came from a single `toggle.behavior.size`
|
|
46
|
+
number, so `<uni-toggle size="sm">` compiled, read as deliberate, and rendered
|
|
47
|
+
identically to every other switch. The theme now carries a `sizes` block and the
|
|
48
|
+
input selects from it.
|
|
49
|
+
|
|
50
|
+
**Geometry is stated per size, not derived from ratios.** Each size token is a
|
|
51
|
+
`width` / `height` / `padding` triple — `padding` being the knob's inset — and
|
|
52
|
+
the rest falls out: knob is `height - 2 * padding`, travel is `width - height`,
|
|
53
|
+
radius is `height / 2`. Real switch designs do not hold a constant proportion
|
|
54
|
+
across sizes (a consumer's 32x18 and 28x16 pair differs in both track and knob
|
|
55
|
+
ratio), so a single ratio token could match one size or the other but never
|
|
56
|
+
both.
|
|
57
|
+
|
|
58
|
+
`lg` is `BaseComponent`'s default and reproduces the previous geometry exactly —
|
|
59
|
+
40x20, knob 16 — so **no existing toggle moves**. A theme still setting the
|
|
60
|
+
legacy `toggle.behavior.size` number keeps the old derived-ratio behaviour; that
|
|
61
|
+
option is now deprecated in favour of the `sizes` block.
|
|
62
|
+
|
|
63
|
+
**Fixed: the knob would have overhung the track at any other proportion.** The
|
|
64
|
+
checked transform was hardcoded to translate by one track height, which is only
|
|
65
|
+
correct while the track is `2x` wide and the knob `0.8x`. It is now derived, so
|
|
66
|
+
the knob lands the same distance from each edge at every size.
|
|
67
|
+
|
|
68
|
+
**New `checkedColor`, as an input and a theme option.** The on-state used to be
|
|
69
|
+
the instance's `variant`, which meant an app wanting one switch colour repeated
|
|
70
|
+
an attribute on every call site. `toggle.behavior.checkedColor` sets it once;
|
|
71
|
+
the input overrides per instance; `variant` remains the fallback when neither is
|
|
72
|
+
set. The focus ring follows the resolved colour rather than staying on `variant`.
|
|
73
|
+
An input as well as an option is necessary because `variant` defaults to
|
|
74
|
+
`'primary'` and so cannot be distinguished from unset — without one, a themed
|
|
75
|
+
`checkedColor` would have silently made `variant` inert with no way back.
|
|
76
|
+
|
|
77
|
+
**Toggle transitions are a motion token.** It hardcoded `0.3s ease` while
|
|
78
|
+
`uni-radio` already read `theme.motion(options.motion ?? 'control')`, so a theme
|
|
79
|
+
setting a motion scale moved the radio and not the switch.
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- [`7545ff3`](https://github.com/uni-design-system/uni/commit/7545ff3e6dd85d29157963488f75f9e3681947c7) Thanks [@gaenglish](https://github.com/gaenglish)! - Stepper buttons now leave focus in their field, and `uni-quantity-stepper`
|
|
84
|
+
follows the theme's field chrome.
|
|
85
|
+
|
|
86
|
+
**Clicking `+` or `−` focused nothing.** Taking pointer capture means calling
|
|
87
|
+
`preventDefault()` on `pointerdown`, which also suppresses the browser's default
|
|
88
|
+
focus handling — and the buttons carry `tabindex="-1"`, so focus landed on
|
|
89
|
+
`<body>`. The arrow keys then did nothing, exactly when a user reaching for `+`
|
|
90
|
+
is most likely to try them. `createPressRepeat` gained a `focus` callback,
|
|
91
|
+
invoked on press and handed the pressed button; `uni-number-input` and
|
|
92
|
+
`uni-quantity-stepper` point it at their text field, the way a native spinner
|
|
93
|
+
does. Where there is no field — a read-only quantity stepper, whose buttons are
|
|
94
|
+
themselves the tab stops — focus goes to the button instead. **This affected
|
|
95
|
+
`uni-number-input` as well**, not just the stepper.
|
|
96
|
+
|
|
97
|
+
**`uni-quantity-stepper` ignored a theme's field styling.** It carried its own
|
|
98
|
+
`color` / `border` / `borderRadius` tokens, so a theme that restyles `input` —
|
|
99
|
+
Wellsourced fills its fields `#F3F2EF` — left the stepper stark white beside
|
|
100
|
+
them. Those three now default to the shared `input` chrome and are unset in the
|
|
101
|
+
base theme, so the stepper tracks whatever a theme does to its fields; they
|
|
102
|
+
remain available as per-component overrides for parting them deliberately. With
|
|
103
|
+
the focus indicator and the dividers already sourced this way, the container is
|
|
104
|
+
now consistently the field chrome unless a theme says otherwise.
|
|
105
|
+
|
|
3
106
|
## 10.0.0
|
|
4
107
|
|
|
5
108
|
### Major Changes
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1099,7 +1099,30 @@ var buildComponents = (c) => ({
|
|
|
1099
1099
|
divider: "light",
|
|
1100
1100
|
elevation: "menu",
|
|
1101
1101
|
padding: "md",
|
|
1102
|
-
backdrop: { background: "rgba(0, 0, 0, 0.4)" }
|
|
1102
|
+
backdrop: { background: "rgba(0, 0, 0, 0.4)" },
|
|
1103
|
+
scrim: true,
|
|
1104
|
+
background: "solid"
|
|
1105
|
+
} },
|
|
1106
|
+
drawerHeader: { options: {
|
|
1107
|
+
color: void 0,
|
|
1108
|
+
height: 56,
|
|
1109
|
+
padding: "md",
|
|
1110
|
+
textRole: "title-medium",
|
|
1111
|
+
textAlign: "left",
|
|
1112
|
+
divider: "light",
|
|
1113
|
+
closeButtonIcon: "close",
|
|
1114
|
+
closeButtonSize: "md"
|
|
1115
|
+
} },
|
|
1116
|
+
drawerButtons: { options: {
|
|
1117
|
+
gap: "sm",
|
|
1118
|
+
padding: "md",
|
|
1119
|
+
justifyContent: "flex-end",
|
|
1120
|
+
confirmButtonVariant: "primary",
|
|
1121
|
+
cancelButtonVariant: "quaternary",
|
|
1122
|
+
buttonSize: "md",
|
|
1123
|
+
divider: "light",
|
|
1124
|
+
stretch: false,
|
|
1125
|
+
reverseOrder: false
|
|
1103
1126
|
} },
|
|
1104
1127
|
avatar: {
|
|
1105
1128
|
options: {
|
|
@@ -1320,9 +1343,6 @@ var buildComponents = (c) => ({
|
|
|
1320
1343
|
} },
|
|
1321
1344
|
quantityStepper: {
|
|
1322
1345
|
options: {
|
|
1323
|
-
color: "primary-surface",
|
|
1324
|
-
border: "light",
|
|
1325
|
-
borderRadius: "xs",
|
|
1326
1346
|
incrementIcon: "plus",
|
|
1327
1347
|
decrementIcon: "minus",
|
|
1328
1348
|
deleteIcon: "delete",
|
|
@@ -1795,11 +1815,30 @@ var buildComponents = (c) => ({
|
|
|
1795
1815
|
grade: 0,
|
|
1796
1816
|
opticalSize: 24
|
|
1797
1817
|
} },
|
|
1798
|
-
toggle: {
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1818
|
+
toggle: {
|
|
1819
|
+
options: {
|
|
1820
|
+
trackColor: "surface-variant",
|
|
1821
|
+
knobColor: "surface",
|
|
1822
|
+
motion: "control"
|
|
1823
|
+
},
|
|
1824
|
+
sizes: {
|
|
1825
|
+
sm: {
|
|
1826
|
+
width: 28,
|
|
1827
|
+
height: 16,
|
|
1828
|
+
padding: 3
|
|
1829
|
+
},
|
|
1830
|
+
md: {
|
|
1831
|
+
width: 32,
|
|
1832
|
+
height: 18,
|
|
1833
|
+
padding: 3
|
|
1834
|
+
},
|
|
1835
|
+
lg: {
|
|
1836
|
+
width: 40,
|
|
1837
|
+
height: 20,
|
|
1838
|
+
padding: 2
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
},
|
|
1803
1842
|
tooltip: { options: {
|
|
1804
1843
|
border: void 0,
|
|
1805
1844
|
borderRadius: "xs",
|