@autobusal/routes-order 1.37.0 → 1.37.2

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.
@@ -249,7 +249,7 @@ const Route = ({ data, type, date, passengers, t, onSave, children }: Props): JS
249
249
  per-person fare - so this says how many people it covers
250
250
  rather than the "per adult" line the competitors use, which
251
251
  would be wrong here for any multi-passenger search. */ }
252
- <PriceNotice>
252
+ <PriceNotice className="price-notice">
253
253
  { t(
254
254
  passengers === 1
255
255
  ? 'routes_order.step2.route.price_notice_single'
@@ -270,12 +270,43 @@ const Route = ({ data, type, date, passengers, t, onSave, children }: Props): JS
270
270
  }
271
271
  onClick={ () => (isExternalRedirect && bookOnUrl ? window.open(bookOnUrl, '_blank', 'noopener,noreferrer') : onSave(data)) }
272
272
  />
273
+
274
+ { /* Claude - 2026-08-31 (Ferjolt: "the 'Details' should be right
275
+ below 'Select route' button, in the same line as 'Taxes
276
+ included - total for 1 passenger'").
277
+
278
+ MOVED INTO the price block rather than positioned from outside
279
+ it. It used to be a sibling of the whole Trip, which put it in
280
+ a different container from the tax note it now shares a line
281
+ with - and two elements in different flex contexts cannot be
282
+ put on one row without pulling one of them out of flow, which
283
+ breaks the moment the note wraps to two lines in a longer
284
+ language.
285
+
286
+ Here they are simply the last two children of one flex row:
287
+ the note takes the space it needs on the left, this sits hard
288
+ right under the button, and a wrap moves both together. */ }
289
+ <ButtonDetails
290
+ className="details-toggle"
291
+ $only="narrow"
292
+ type="button"
293
+ aria-expanded={ details }
294
+ onClick={ () => setDetails(!details) }
295
+ >
296
+ { details ? <HiChevronUp /> : <HiChevronDown /> }
297
+ { t('routes_order.step2.route.details') }
298
+ </ButtonDetails>
273
299
  </Price>
274
300
  </Trip>
275
301
 
276
302
  { children }
277
303
 
304
+ { /* Claude - 2026-09-01: the wide-screen copy, back where it sat before
305
+ the phone rebuild - bottom-left of the card, below the itinerary
306
+ and whatever `children` adds, rather than inside the fare column.
307
+ Exactly one of the two is ever displayed; see ButtonDetails. */ }
278
308
  <ButtonDetails
309
+ $only="wide"
279
310
  type="button"
280
311
  aria-expanded={ details }
281
312
  onClick={ () => setDetails(!details) }
@@ -485,6 +485,31 @@ export const Price = styled.div`
485
485
 
486
486
  & > *:nth-child(3) { order: 2; }
487
487
 
488
+ /*
489
+ * Claude - 2026-08-31: the note and the details toggle share the second
490
+ * row - note left, toggle hard right under the button.
491
+ *
492
+ * BY CLASS, not by nth-child, and that is the point of the change. The
493
+ * rules above count positions, and this block has a conditional first
494
+ * child: a route with a dynamic-price drop renders a struck-through
495
+ * <Standard> before the amount, which shifts every index by one. Adding
496
+ * two more positional rules on top of that would have been two more things
497
+ * to be silently wrong on exactly the cards carrying an offer.
498
+ *
499
+ * These come after the positional rules and match on the same specificity,
500
+ * so they win where they overlap and leave the rest alone.
501
+ */
502
+ & > .price-notice {
503
+ order: 3;
504
+ flex: 1 1 auto;
505
+ flex-basis: auto;
506
+ }
507
+
508
+ & > .details-toggle {
509
+ order: 4;
510
+ flex: 0 0 auto;
511
+ }
512
+
488
513
  @media (min-width: 768px) {
489
514
  flex: 0 0 165px;
490
515
  flex-direction: column;
@@ -497,6 +522,18 @@ export const Price = styled.div`
497
522
  order: initial;
498
523
  flex-basis: auto;
499
524
  }
525
+
526
+ /*
527
+ * The same reset for the two matched by class. This cell is a COLUMN
528
+ * above 768px, so both simply stack under the button in source order -
529
+ * which is where the details toggle has always sat on a wide screen,
530
+ * just now inside the price cell rather than under the whole card.
531
+ */
532
+ & > .price-notice,
533
+ & > .details-toggle {
534
+ order: initial;
535
+ flex-basis: auto;
536
+ }
500
537
  }
501
538
  `;
502
539
 
@@ -693,7 +730,35 @@ export const Details = styled.div<{ $open: boolean }>`
693
730
  * The disclosure. Small and quiet - it is a way to get at supporting detail,
694
731
  * not an action competing with "select".
695
732
  */
696
- export const ButtonDetails = styled.button`
733
+ /**
734
+ * Claude - 2026-09-01
735
+ *
736
+ * TWO PLACES, ONE AT A TIME, and the reason is a layout constraint rather
737
+ * than a preference.
738
+ *
739
+ * On a phone Ferjolt asked for this to sit "right below 'Select route'
740
+ * button, in the same line as 'Taxes included'". Sharing a line with the tax
741
+ * note means being its SIBLING - two elements in different flex contexts
742
+ * cannot be put on one row without taking one of them out of flow, which
743
+ * comes apart the moment the note wraps to two lines in a longer language.
744
+ * So on a phone it has to live inside the price cell.
745
+ *
746
+ * On a wide screen it belongs where it was before any of the mobile work:
747
+ * bottom-left of the whole card, under the itinerary. That is a sibling of
748
+ * Trip. The price cell is a narrow right-hand column up there, and putting
749
+ * the toggle in it moved a card-level control into the fare - which was
750
+ * never asked for and was only ever a side effect of the phone change.
751
+ *
752
+ * The two positions are in different containers, so no single element can
753
+ * occupy both. Rendering it twice and letting the breakpoint choose is the
754
+ * boring answer, and `display: none` keeps the unused one out of the
755
+ * accessibility tree entirely rather than merely out of sight - there is
756
+ * never a second "Details" control for a screen reader to find.
757
+ *
758
+ * 768px, not 640px, because that is where Price stops being a row and
759
+ * becomes the right-hand column - see Price above.
760
+ */
761
+ export const ButtonDetails = styled.button<{ $only?: 'narrow' | 'wide' }>`
697
762
  display: inline-flex;
698
763
  align-items: center;
699
764
  gap: 5px;
@@ -702,17 +767,24 @@ export const ButtonDetails = styled.button`
702
767
  font-size: ${ props => props.theme.size.s };
703
768
  color: ${ props => props.theme.font.faded };
704
769
 
770
+ @media (max-width: 767px) {
771
+ display: ${ props => (props.$only === 'wide' ? 'none' : 'inline-flex') };
772
+ }
773
+
774
+ @media (min-width: 768px) {
775
+ display: ${ props => (props.$only === 'narrow' ? 'none' : 'inline-flex') };
776
+ }
777
+
705
778
  /*
706
- * Claude - 2026-08-31 (Ferjolt: "'Details' should be displayed below
707
- * 'Select route' button").
779
+ * Claude - 2026-08-31 (Ferjolt: "the 'Details' should be right below
780
+ * 'Select route' button, in the same line as 'Taxes included - total for 1
781
+ * passenger'").
708
782
  *
709
- * On a phone the fare sits left and the button right, and this sat under
710
- * the FARE - the far side of the card from the control it belongs with.
711
- * Pushed to the right edge it lands directly beneath the button, which is
712
- * where the thumb already is after reading the price.
783
+ * No self-alignment on the phone copy: it is a child of the price row
784
+ * there, and that row's own rules put it hard right on the second line,
785
+ * beside the tax note. Only the size is set here.
713
786
  */
714
787
  @media (max-width: 639px) {
715
- align-self: flex-end;
716
788
  font-size: ${ props => props.theme.size.xs };
717
789
  }
718
790
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/routes-order",
3
- "version": "1.37.0",
3
+ "version": "1.37.2",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts",