pcm-shared-components 2.1.410 → 2.1.412

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.
@@ -18,15 +18,17 @@ export const openNativeDatePicker = e => {
18
18
  }
19
19
  };
20
20
 
21
- // Collapsed size for a notice's rich-text content before it needs a "Show More" link -- kept
22
- // deliberately small (3 text lines, clamped on a clean line boundary with an ellipsis via
23
- // -webkit-line-clamp) so a long admin-entered notice doesn't dominate the panel's vertical space;
24
- // anything longer is offered in full through the dialog below. Short content still renders in
25
- // full with no link at all (overflow-measured, not char-counted). NOTICE_COLLAPSED_MAX_HEIGHT is
26
- // only a fallback ceiling for engines without line-clamp support, sized generously enough that
27
- // the line-clamp is what actually cuts in normal browsers.
28
- const NOTICE_COLLAPSED_LINES = 3;
29
- const NOTICE_COLLAPSED_MAX_HEIGHT = 130;
21
+ // Collapsed size for a notice's rich-text content before it needs a "Show More" link -- clamped
22
+ // on a clean line boundary with an ellipsis via -webkit-line-clamp so a long admin-entered notice
23
+ // doesn't dominate the panel's vertical space; anything longer is offered in full through the
24
+ // dialog below. Short content still renders in full with no link at all (overflow-measured, not
25
+ // char-counted). 6 lines, not fewer: Quill content routinely contains blank spacer paragraphs
26
+ // (<p><br></p>) between sections, and each spacer costs a clamp line -- a tighter clamp left only
27
+ // a couple of REAL text lines visible, which read as "not enough" in practice.
28
+ // NOTICE_COLLAPSED_MAX_HEIGHT is only a fallback ceiling for engines without line-clamp support,
29
+ // sized generously enough that the line-clamp is what actually cuts in normal browsers.
30
+ const NOTICE_COLLAPSED_LINES = 6;
31
+ const NOTICE_COLLAPSED_MAX_HEIGHT = 200;
30
32
 
31
33
  /**
32
34
  * The control for a `notice` field: the admin's sanitized rich text inside a bounded-height
@@ -92,6 +92,7 @@ export const AnimalVehicleDetailsEditor = props => {
92
92
  canAddMore,
93
93
  maxItems,
94
94
  showHistoricalAnswers,
95
+ extraLiveKeys,
95
96
  bare,
96
97
  className,
97
98
  theme,
@@ -455,7 +456,12 @@ export const AnimalVehicleDetailsEditor = props => {
455
456
  }, requiredErrorText(field.type)));
456
457
  }));
457
458
  })())), showHistoricalAnswers && selectedItem && (() => {
458
- const liveKeys = new Set(fieldConfig.map(f => f.key));
459
+ // extraLiveKeys covers keys this component's own fieldConfig doesn't include but which
460
+ // are still genuinely live -- e.g. a once-per-reservation field, rendered by a sibling
461
+ // component (AnimalFieldsOnceBlock) but written into this same item's `values` object.
462
+ // Without this, a currently-checked notice/once field reads as a retired one the moment
463
+ // its value is set, since this component never saw it in its own fieldConfig.
464
+ const liveKeys = new Set([...fieldConfig.map(f => f.key), ...extraLiveKeys]);
459
465
  const historicalEntries = Object.keys(selectedItem.values || {}).filter(k => !liveKeys.has(k)).map(k => ({
460
466
  key: k,
461
467
  value: selectedItem.values[k]
@@ -615,6 +621,7 @@ AnimalVehicleDetailsEditor.defaultProps = {
615
621
  canAddMore: true,
616
622
  maxItems: 0,
617
623
  showHistoricalAnswers: true,
624
+ extraLiveKeys: [],
618
625
  bare: false,
619
626
  className: 'w-full',
620
627
  theme: undefined,
@@ -665,6 +672,13 @@ AnimalVehicleDetailsEditor.propTypes = {
665
672
  * since-retired answer on an EXISTING reservation is legitimate. A guest-facing booking widget
666
673
  * creating a brand-new reservation has no history to show and should pass false. */
667
674
  showHistoricalAnswers: PropTypes.bool,
675
+ /** Keys that should count as "live" for the Historical Answers check above even though they
676
+ * aren't in this instance's own `fieldConfig` -- for a caller that splits one lot's field list
677
+ * across two sibling components sharing the same item's `values` object (e.g. once-per-
678
+ * reservation fields rendered by AnimalFieldsOnceBlock instead of this component's own grid).
679
+ * Without this, a currently-answered field owned by that sibling component reads as retired the
680
+ * moment its value is set, since this component never sees it in its own fieldConfig. */
681
+ extraLiveKeys: PropTypes.arrayOf(PropTypes.string),
668
682
  /** Skip this component's own outer card (background/border/rounding) and render a plain
669
683
  * fragment instead -- for a caller placing this editor and AnimalFieldsOnceBlock's fields inside
670
684
  * one shared outer card. Defaults to false so every existing usage keeps its current look. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pcm-shared-components",
3
- "version": "2.1.410",
3
+ "version": "2.1.412",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "babel": {