@hashsome/ui 0.3.0 → 0.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/dist/.tsbuildinfo +1 -1
- package/dist/entities/top-bar.js +8 -2
- package/package.json +2 -2
package/dist/entities/top-bar.js
CHANGED
|
@@ -143,6 +143,12 @@ function StatusChip({ children }) {
|
|
|
143
143
|
function WeatherChip({ entity }) {
|
|
144
144
|
return useEntity(entity)?.kind === 'weather' ? (_jsx(WeatherPill, { entity: entity })) : (_jsx(SensorWeather, { entity: entity }));
|
|
145
145
|
}
|
|
146
|
+
/** Text boxes cut to the height of the digits, so the reading and the range, in different sizes, are
|
|
147
|
+
* both centred on their digits and not on the font's line box (which sits a little low or high).
|
|
148
|
+
* Where the browser does not know `text-box` the text keeps its usual box. */
|
|
149
|
+
/** The height of one line of the 12px label text. */
|
|
150
|
+
const LABEL_LINE = 15;
|
|
151
|
+
const TRIM_TO_DIGITS = { textBox: 'trim-both cap alphabetic' };
|
|
146
152
|
function WeatherPill({ entity }) {
|
|
147
153
|
const handle = useEntityHandle('weather', entity);
|
|
148
154
|
const { status } = handle;
|
|
@@ -157,9 +163,9 @@ function WeatherPill({ entity }) {
|
|
|
157
163
|
const range = today?.temperature !== undefined && today.low !== undefined
|
|
158
164
|
? `${Math.round(today.temperature)}° / ${Math.round(today.low)}°`
|
|
159
165
|
: undefined;
|
|
160
|
-
const chip = (_jsxs(StatusChip, { children: [_jsx(Flex, { as: "span", children: _jsx(WeatherIcon, { condition: condition, size: 14 }) }), _jsx(Typography, { as: "span", variant: "label", children: ready
|
|
166
|
+
const chip = (_jsxs(StatusChip, { children: [_jsx(Flex, { as: "span", css: { minHeight: LABEL_LINE }, children: _jsx(WeatherIcon, { condition: condition, size: 14 }) }), _jsx(Typography, { as: "span", variant: "label", css: TRIM_TO_DIGITS, children: ready
|
|
161
167
|
? `${Math.round(weather.temperature ?? 0)}°`
|
|
162
|
-
: statusLabels[status] }), ready && range ? (_jsx(Typography, { as: "span", variant: "secondary", color: "textMuted", children: range })) : null] }));
|
|
168
|
+
: statusLabels[status] }), ready && range ? (_jsx(Typography, { as: "span", variant: "secondary", color: "textMuted", css: TRIM_TO_DIGITS, children: range })) : null] }));
|
|
163
169
|
if (!forecastable) {
|
|
164
170
|
return chip;
|
|
165
171
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashsome/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Design system components and hooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@emotion/react": "11.14.0",
|
|
19
|
-
"@hashsome/core": "0.
|
|
19
|
+
"@hashsome/core": "0.4.0",
|
|
20
20
|
"e-prim": "2.0.1",
|
|
21
21
|
"motion": "13.4.5",
|
|
22
22
|
"react": "19.3.0",
|