@autobusal/common 1.34.1 → 1.35.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 +5 -0
- package/Calendar/Calendar.tsx +19 -3
- package/RouteFeature/RouteFeature.tsx +21 -2
- package/RouteFeature/styles.ts +44 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.35.0 (2026-08-29)
|
|
4
|
+
|
|
5
|
+
- RouteFeature's compact chip draws a real tooltip on hover AND on focus, so a tap reveals the amenity name; `title` alone was invisible on touch and slow on desktop.
|
|
6
|
+
- Calendar treats an unparseable defaultValue as nothing chosen, and anchors an empty picker on its minDate - so a floored picker (the return leg) opens on the month being travelled rather than on today or on January.
|
|
7
|
+
|
|
3
8
|
## 1.34.1 (2026-08-29)
|
|
4
9
|
|
|
5
10
|
- Meta's stale-tag cleanup can no longer remove a tag React owns: it now identifies leftovers by having existed before React rendered, not by comparing values (Sentry BUSMAGUS-7 - on a prerendered page the leftover and the live tag carry the same value, so the old comparison deleted React's own node and the next navigation crashed on removeChild).
|
package/Calendar/Calendar.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { useState, useRef } from 'react';
|
|
|
2
2
|
import { UseFormRegister, UseFormSetValue } from 'react-hook-form';
|
|
3
3
|
import { TFunction } from 'i18next';
|
|
4
4
|
import { useOutside } from '@autobusal/hooks';
|
|
5
|
-
import { Validate, prepareDate } from '@autobusal/utilities';
|
|
5
|
+
import { Validate, prepareDate, isPreparedDate } from '@autobusal/utilities';
|
|
6
6
|
import Picker from './Picker';
|
|
7
7
|
import { Container } from './styles';
|
|
8
8
|
|
|
@@ -68,8 +68,18 @@ const Calendar = ({ type, name, label, id, defaultValue, t, validation, minDate,
|
|
|
68
68
|
* Empty instead, so the field reads as unanswered and the API's
|
|
69
69
|
* `required|date_format:d/m/Y|before:today` says so if it is left that way.
|
|
70
70
|
*/
|
|
71
|
+
/*
|
|
72
|
+
* Edited: Claude - Date: 2026-08-29
|
|
73
|
+
*
|
|
74
|
+
* A defaultValue that is not a date is NOTHING CHOSEN, not a value.
|
|
75
|
+
* `??` only catches null/undefined, so the search URL's literal "none"
|
|
76
|
+
* (what it carries for "no return leg") came through as a real value:
|
|
77
|
+
* the input displayed the word, and the picker built its grid from
|
|
78
|
+
* createDate('none') - an Invalid Date - so the round-trip calendar
|
|
79
|
+
* opened on January instead of the month being travelled.
|
|
80
|
+
*/
|
|
71
81
|
const [ prepared, setPrepared ] = useState<string>(
|
|
72
|
-
defaultValue
|
|
82
|
+
isPreparedDate(defaultValue) ? String(defaultValue) : (type === 'dob' ? '' : prepareDate(new Date()))
|
|
73
83
|
);
|
|
74
84
|
const [ selected, setSelected ] = useState<string>(prepared);
|
|
75
85
|
|
|
@@ -99,7 +109,13 @@ const Calendar = ({ type, name, label, id, defaultValue, t, validation, minDate,
|
|
|
99
109
|
// is an Invalid Date and the grid built from it renders as nothing.
|
|
100
110
|
// The anchor is display only - what the form submits stays empty
|
|
101
111
|
// until a day is actually clicked.
|
|
102
|
-
|
|
112
|
+
/*
|
|
113
|
+
* Edited: Claude - Date: 2026-08-29: with nothing chosen, open on
|
|
114
|
+
* the FLOOR when there is one - the return leg's floor is the
|
|
115
|
+
* outbound's date, so its picker opens on the month being
|
|
116
|
+
* travelled rather than on today.
|
|
117
|
+
*/
|
|
118
|
+
value={ prepared || (isPreparedDate(minDate) ? String(minDate) : prepareDate(new Date())) }
|
|
103
119
|
selected={ selected }
|
|
104
120
|
minDate={ minDate }
|
|
105
121
|
maxYears={ maxYears }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Container, Image, Name } from './styles';
|
|
1
|
+
import { Container, Image, Name, Tooltip } from './styles';
|
|
2
2
|
import { FeatureData } from '@autobusal/providers/types/routes';
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
@@ -16,14 +16,33 @@ interface Props {
|
|
|
16
16
|
compact?: boolean
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Edited: Claude - Date: 2026-08-29
|
|
21
|
+
*
|
|
22
|
+
* THE NAME IS DRAWN, not merely promised to the browser.
|
|
23
|
+
*
|
|
24
|
+
* The compact chip carried the amenity name in `title` alone, which is the
|
|
25
|
+
* one tooltip mechanism nobody can rely on: desktop browsers wait about a
|
|
26
|
+
* second before drawing it, and touch devices never draw it at all - so on
|
|
27
|
+
* a phone these icons were unlabelled decoration with no way to find out
|
|
28
|
+
* what they meant. The title stays (it is what screen readers and the
|
|
29
|
+
* native tooltip use) and a real one is drawn on hover AND on focus, which
|
|
30
|
+
* a tap produces through tabIndex.
|
|
31
|
+
*/
|
|
19
32
|
const RouteFeature = ({ item, compact = false }: Props): JSX.Element => (
|
|
20
|
-
<Container
|
|
33
|
+
<Container
|
|
34
|
+
$compact={ compact }
|
|
35
|
+
title={ item.name }
|
|
36
|
+
tabIndex={ compact ? 0 : undefined }
|
|
37
|
+
>
|
|
21
38
|
{ /* alt was missing entirely before. It matters more now: with the
|
|
22
39
|
label hidden the image IS the content, so without it a screen
|
|
23
40
|
reader announces nothing at all for each amenity. */ }
|
|
24
41
|
<Image src={ item.image_url } alt={ item.name } />
|
|
25
42
|
|
|
26
43
|
{ !compact && <Name>{ item.name }</Name> }
|
|
44
|
+
|
|
45
|
+
{ compact && <Tooltip role="tooltip">{ item.name }</Tooltip> }
|
|
27
46
|
</Container>
|
|
28
47
|
);
|
|
29
48
|
|
package/RouteFeature/styles.ts
CHANGED
|
@@ -19,8 +19,24 @@ export const Container = styled.div<{ $compact?: boolean }>`
|
|
|
19
19
|
* template literal, where a backtick terminates the string.)
|
|
20
20
|
*/
|
|
21
21
|
${ props => props.$compact && css`
|
|
22
|
+
position: relative;
|
|
22
23
|
padding: 5px;
|
|
23
24
|
cursor: help;
|
|
25
|
+
|
|
26
|
+
/* Claude - 2026-08-29: the tooltip below is positioned against this
|
|
27
|
+
chip, and appears on hover or on focus - a tap focuses it, which is
|
|
28
|
+
the only way a touch device can ever reveal an icon's meaning. */
|
|
29
|
+
&:hover > span,
|
|
30
|
+
&:focus > span,
|
|
31
|
+
&:focus-within > span {
|
|
32
|
+
opacity: 1;
|
|
33
|
+
visibility: visible;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:focus {
|
|
37
|
+
outline: 2px solid ${ props => props.theme.primary.normal };
|
|
38
|
+
outline-offset: 2px;
|
|
39
|
+
}
|
|
24
40
|
` }
|
|
25
41
|
`;
|
|
26
42
|
|
|
@@ -32,3 +48,31 @@ export const Image = styled.img`
|
|
|
32
48
|
export const Name = styled.span`
|
|
33
49
|
font-size: ${ props => props.theme.size.xs };
|
|
34
50
|
`;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The amenity's name, drawn above its chip.
|
|
54
|
+
*
|
|
55
|
+
* Claude - Date: 2026-08-29
|
|
56
|
+
*
|
|
57
|
+
* `visibility` alongside `opacity` so the label is genuinely inert while
|
|
58
|
+
* hidden - a transparent tooltip still takes the pointer, and one sitting
|
|
59
|
+
* over the chip below it would eat that chip's own hover.
|
|
60
|
+
*/
|
|
61
|
+
export const Tooltip = styled.span`
|
|
62
|
+
position: absolute;
|
|
63
|
+
bottom: calc(100% + 6px);
|
|
64
|
+
left: 50%;
|
|
65
|
+
z-index: 20;
|
|
66
|
+
transform: translateX(-50%);
|
|
67
|
+
padding: 4px 8px;
|
|
68
|
+
font-size: ${ props => props.theme.size.xs };
|
|
69
|
+
line-height: 1.4;
|
|
70
|
+
white-space: nowrap;
|
|
71
|
+
color: ${ props => props.theme.primary.contrast };
|
|
72
|
+
background: ${ props => props.theme.primary.normal };
|
|
73
|
+
border-radius: ${ props => props.theme.borderRadius };
|
|
74
|
+
opacity: 0;
|
|
75
|
+
visibility: hidden;
|
|
76
|
+
pointer-events: none;
|
|
77
|
+
transition: opacity 0.2s ease;
|
|
78
|
+
`;
|