@jsenv/navi 0.29.128 → 0.29.129

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.
@@ -17633,6 +17633,7 @@ const LAYOUT_PROPS = {
17633
17633
  flexWrap: applyToCssPropWhenTruthy("flexWrap", "wrap", "nowrap"),
17634
17634
  grid: () => {},
17635
17635
  gridTemplateColumns: PASS_THROUGH,
17636
+ gridTemplateRows: PASS_THROUGH,
17636
17637
  display: PASS_THROUGH, // in case people write "display: none" (even if hidden prop is recommended)
17637
17638
  row: () => {},
17638
17639
  column: () => {},
@@ -73474,6 +73475,7 @@ const TimeWheel = ({
73474
73475
  * size?: string,
73475
73476
  * startLabel?: import("ignore:preact").ComponentChildren,
73476
73477
  * endLabel?: import("ignore:preact").ComponentChildren,
73478
+ * labelPosition?: "before" | "above",
73477
73479
  * timeProps?: object,
73478
73480
  * [key: string]: any,
73479
73481
  * }>}
@@ -73482,6 +73484,13 @@ const TimeWheel = ({
73482
73484
  * @param {import("ignore:preact").ComponentChildren} [startLabel] What is written
73483
73485
  * before the first time ("De"), and `endLabel` between the two ("à"). Say
73484
73486
  * `null` for neither.
73487
+ * @param {"before"|"above"} [labelPosition="before"] Where each label stands.
73488
+ * Before its wheels, the span reads as one sentence ("De 9h00 à 18h00").
73489
+ * Above them, each bound is a column — "Début" over its wheels, "Fin" over
73490
+ * the other — two answers side by side, whose wheels land at the same place
73491
+ * whatever the width of the words. Labels that are nouns rather than
73492
+ * prepositions belong there; the group is still a row, and takes `flexWrap`
73493
+ * for screens too narrow to hold both columns.
73485
73494
  * @param {number} [minuteStep=1] How many minutes apart the values on both
73486
73495
  * minute wheels are.
73487
73496
  * @param {{min?: number, max?: number}|number[]} [hours] Which hours both
@@ -73510,6 +73519,7 @@ const TimeRangeWheel = ({
73510
73519
  size,
73511
73520
  startLabel = naviI18n("time_range.from"),
73512
73521
  endLabel = naviI18n("time_range.to"),
73522
+ labelPosition = "before",
73513
73523
  timeProps,
73514
73524
  startTimeProps,
73515
73525
  endTimeProps,
@@ -73577,53 +73587,61 @@ const TimeRangeWheel = ({
73577
73587
  ...rest,
73578
73588
  children: jsxs(AnsweredContext.Provider, {
73579
73589
  value: answeredRef,
73580
- children: [startLabel === null ? null : jsx(Text, {
73581
- size: size,
73582
- className: "navi_time_range_label",
73583
- children: startLabel
73584
- }), jsx(TimeWheel, {
73585
- id: startId,
73586
- ref: startRef,
73587
- name: "start",
73588
- minuteStep: minuteStep,
73589
- hours: hours,
73590
- loop: loop,
73591
- size: size,
73592
- placeholder: placeholder ? placeholder.start : undefined
73593
- // e.detail.value is the settled WHEEL's own value (an hour, a
73594
- // minute) — half a time. What the pair compares is this bound's
73595
- // whole time, read off the element the listener sits on.
73596
- ,
73590
+ children: [jsx(TimeBound, {
73591
+ labelPosition: labelPosition,
73592
+ label: startLabel === null ? null : jsx(Text, {
73593
+ size: size,
73594
+ className: "navi_time_range_label",
73595
+ children: startLabel
73596
+ }),
73597
+ children: jsx(TimeWheel, {
73598
+ id: startId,
73599
+ ref: startRef,
73600
+ name: "start",
73601
+ minuteStep: minuteStep,
73602
+ hours: hours,
73603
+ loop: loop,
73604
+ size: size,
73605
+ placeholder: placeholder ? placeholder.start : undefined
73606
+ // e.detail.value is the settled WHEEL's own value (an hour, a
73607
+ // minute) — half a time. What the pair compares is this bound's
73608
+ // whole time, read off the element the listener sits on.
73609
+ ,
73597
73610
 
73598
- onnavi_wheel_settle: e => {
73599
- keepBoundsApart("start", getUIStateFromElement(e.currentTarget), e);
73600
- },
73601
- ...timeProps,
73602
- ...startTimeProps
73603
- }), endLabel === null ? null : jsx(Text, {
73604
- size: size,
73605
- className: "navi_time_range_label",
73606
- children: endLabel
73607
- }), jsx(TimeWheel, {
73608
- ref: endRef,
73609
- name: "end",
73610
- minuteStep: minuteStep,
73611
- hours: hours,
73612
- loop: loop,
73613
- size: size,
73614
- placeholder: placeholder ? placeholder.end : undefined,
73615
- onnavi_wheel_settle: e => {
73616
- keepBoundsApart("end", getUIStateFromElement(e.currentTarget), e);
73617
- }
73618
- // Which time it comes after, and how much room there must be between
73619
- // the two: said on the LATER of the two, so the answer is given where
73620
- // the time one would have to move is (see time_range_constraint.js).
73621
- ,
73611
+ onnavi_wheel_settle: e => {
73612
+ keepBoundsApart("start", getUIStateFromElement(e.currentTarget), e);
73613
+ },
73614
+ ...timeProps,
73615
+ ...startTimeProps
73616
+ })
73617
+ }), jsx(TimeBound, {
73618
+ labelPosition: labelPosition,
73619
+ label: endLabel === null ? null : jsx(Text, {
73620
+ size: size,
73621
+ className: "navi_time_range_label",
73622
+ children: endLabel
73623
+ }),
73624
+ children: jsx(TimeWheel, {
73625
+ ref: endRef,
73626
+ name: "end",
73627
+ minuteStep: minuteStep,
73628
+ hours: hours,
73629
+ loop: loop,
73630
+ size: size,
73631
+ placeholder: placeholder ? placeholder.end : undefined,
73632
+ onnavi_wheel_settle: e => {
73633
+ keepBoundsApart("end", getUIStateFromElement(e.currentTarget), e);
73634
+ }
73635
+ // Which time it comes after, and how much room there must be between
73636
+ // the two: said on the LATER of the two, so the answer is given where
73637
+ // the time one would have to move is (see time_range_constraint.js).
73638
+ ,
73622
73639
 
73623
- "data-time-after": startId,
73624
- "data-time-min-duration": minDuration,
73625
- ...timeProps,
73626
- ...endTimeProps
73640
+ "data-time-after": startId,
73641
+ "data-time-min-duration": minDuration,
73642
+ ...timeProps,
73643
+ ...endTimeProps
73644
+ })
73627
73645
  })]
73628
73646
  })
73629
73647
  });
@@ -73742,6 +73760,27 @@ const resolveHourList = hours => {
73742
73760
  };
73743
73761
  const padTwo = value => String(value).padStart(2, "0");
73744
73762
 
73763
+ // A label and its wheels. Side by side, they are two items of the group's own
73764
+ // row. One above the other, they are one item: the two bounds then stand at
73765
+ // the same height and their wheels line up whatever the width of the words.
73766
+ const TimeBound = ({
73767
+ labelPosition,
73768
+ label,
73769
+ children
73770
+ }) => {
73771
+ if (labelPosition === "above") {
73772
+ return jsxs(Box, {
73773
+ flex: "y",
73774
+ alignX: "center",
73775
+ spacing: "xs",
73776
+ children: [label, children]
73777
+ });
73778
+ }
73779
+ return jsxs(Fragment$1, {
73780
+ children: [label, children]
73781
+ });
73782
+ };
73783
+
73745
73784
  // The two times as one span, { start, end } — the shape a pair carries.
73746
73785
  const aggregateSpan = childUIStateControllers => {
73747
73786
  const span = {};