@shortstravelmgmt/component-lib 0.3.0 → 0.3.1-canary.75.g5bfd320

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/index.d.ts CHANGED
@@ -5441,22 +5441,43 @@ interface SystemBanner {
5441
5441
  /** Identifier for the banner, used to key and dismiss it. */
5442
5442
  id: string;
5443
5443
  /**
5444
- * Banner body. Rendered as TEXT, not markup — this is announcement copy
5445
- * straight from the authoring form, so an author could otherwise store an
5446
- * `onerror` that ran for every recipient. The field keeps its `html` name
5447
- * because callers already send it under that key.
5444
+ * Banner body. A string renders as TEXT, never as markup — this is
5445
+ * announcement copy straight from the authoring form, so an author could
5446
+ * otherwise store an `onerror` that ran for every recipient; its entities
5447
+ * (`&`, ` `) are decoded. Formatting is the caller's to render: pass
5448
+ * an element (e.g. the host's own sanitized rich-text renderer) and it is
5449
+ * placed as given. The field keeps its `html` name because callers already
5450
+ * send it under that key. Non-interactive inline formatting only (no links
5451
+ * or buttons): it sits in a `<p>`.
5448
5452
  */
5449
- html: string;
5450
- /** Expanded detail revealed when the reader opens the banner. Also text. */
5451
- detailHtml?: string;
5453
+ html: ReactNode;
5454
+ /** Expanded detail revealed when the reader opens the banner. Same rules. */
5455
+ detailHtml?: ReactNode;
5456
+ /**
5457
+ * The source text an element field was rendered from. An element can't be
5458
+ * compared, so pass this with formatted copy: the banners reset (a dismissed
5459
+ * one reappears) when it changes, as they do when a string field changes.
5460
+ */
5461
+ revision?: string;
5452
5462
  }
5453
5463
  interface TravelAlertBanner {
5454
5464
  /** Identifier for the alert. */
5455
5465
  id: string;
5456
- /** Headline summarizing the disruption. */
5457
- title: string;
5458
- /** Supporting detail. */
5459
- body?: string;
5466
+ /**
5467
+ * Headline summarizing the disruption. A string renders as text; an
5468
+ * element as given — non-interactive inline formatting only (no links or
5469
+ * buttons): it sits in a `<p>`, inside the alert's own link when it has an
5470
+ * `href`.
5471
+ */
5472
+ title: ReactNode;
5473
+ /**
5474
+ * Supporting detail: a string renders as text; an element (formatted copy)
5475
+ * as given. Non-interactive inline formatting only (no links or buttons):
5476
+ * it sits in a `<p>`, inside the alert's own link when it has an `href`.
5477
+ */
5478
+ body?: ReactNode;
5479
+ /** The source text of element fields, for the reset identity — see SystemBanner.revision. */
5480
+ revision?: string;
5460
5481
  /** Link to the full advisory. */
5461
5482
  href?: string;
5462
5483
  }
@@ -7697,7 +7718,13 @@ interface DashboardUnusedTicketRecord {
7697
7718
  interface DashboardInfoCenterItem {
7698
7719
  id: string;
7699
7720
  title: string;
7700
- body?: string;
7721
+ /**
7722
+ * One-line preview under the title. A string renders as text; pass an
7723
+ * element (the host's own sanitized rich-text renderer) to keep the
7724
+ * article's formatting. Non-interactive inline formatting only (no links or
7725
+ * buttons): it sits in a `<small>` inside the row's own link or button.
7726
+ */
7727
+ body?: ReactNode;
7701
7728
  href?: string;
7702
7729
  }
7703
7730
  interface DashboardWidget {
package/dist/index.esm.js CHANGED
@@ -16551,6 +16551,10 @@ const decodeEntities = (value) => {
16551
16551
  element.innerHTML = value;
16552
16552
  return element.value;
16553
16553
  };
16554
+ /** A string as decoded text; an element (the caller's formatted copy) as given. */
16555
+ const content = (value) => (typeof value === 'string' ? decodeEntities(value) : value);
16556
+ /** The text a value contributes to the banners' identity: elements by position only. */
16557
+ const textOf = (value) => (typeof value === 'string' ? value : '');
16554
16558
  /**
16555
16559
  * Class names side by side, NOT merged.
16556
16560
  *
@@ -16574,7 +16578,20 @@ const PageBanners = ({ systemBanners, alertBanners, fullWidth = false, className
16574
16578
  // every parent render, and `onDismiss` invites a caller to set state from its
16575
16579
  // handler. Comparing references let that re-render clear `dismissed` and put
16576
16580
  // the banner the reader just closed straight back on screen.
16577
- const identity = JSON.stringify([systemBanners, alertBanners]);
16581
+ //
16582
+ // Built from ids, string fields and `revision`: a formatted value is a
16583
+ // React element, which can't be serialized (its owner fields are circular),
16584
+ // so the caller's `revision` stands in for its content.
16585
+ const identity = JSON.stringify([
16586
+ systemBanners.map((banner) => [banner.id, textOf(banner.html), textOf(banner.detailHtml), banner.revision ?? '']),
16587
+ alertBanners.map((banner) => [
16588
+ banner.id,
16589
+ textOf(banner.title),
16590
+ textOf(banner.body),
16591
+ banner.href ?? '',
16592
+ banner.revision ?? '',
16593
+ ]),
16594
+ ]);
16578
16595
  const previousIdentity = useRef(identity);
16579
16596
  useEffect(() => {
16580
16597
  if (previousIdentity.current !== identity) {
@@ -16590,9 +16607,9 @@ const PageBanners = ({ systemBanners, alertBanners, fullWidth = false, className
16590
16607
  const visibleAlerts = alertBanners.filter((banner) => !dismissed.has(banner.id));
16591
16608
  if (!visibleSystem.length && !visibleAlerts.length)
16592
16609
  return null;
16593
- return (jsxs("div", { className: classes(sx(stackStyle$3), fullWidth && sx(flushStyle), className), role: "region", "aria-label": "Page notices", children: [visibleSystem.map((banner) => (jsxs("div", { className: classes(sx(bannerStyle$1), sx(systemStyle)), role: "status", children: [jsx(InfoIcon$1, { className: sx(systemIconStyle), size: 20, "aria-hidden": "true" }), jsxs("div", { className: sx(contentStyle$5), children: [jsx("p", { className: sx(titleStyle$p), children: decodeEntities(banner.html) }), banner.detailHtml && jsx("p", { className: sx(detailStyle), children: decodeEntities(banner.detailHtml) })] }), jsx("button", { type: "button", className: sx(dismissStyle), "aria-label": "Dismiss notice", onClick: () => dismiss(banner.id), children: jsx(CloseIcon, { size: 16 }) })] }, banner.id))), visibleAlerts.map((banner) => {
16594
- const content = (jsxs("div", { className: sx(contentStyle$5), children: [jsx("p", { className: classes(sx(titleStyle$p), sx(alertTitleStyle)), children: decodeEntities(banner.title) }), banner.body && jsx("p", { className: classes(sx(detailStyle), sx(clampStyle)), children: decodeEntities(banner.body) })] }));
16595
- return (jsxs("div", { className: classes(sx(bannerStyle$1), sx(alertStyle$1)), role: "alert", children: [jsx(WarningIcon$1, { className: sx(alertIconStyle), size: 20, "aria-hidden": "true" }), banner.href ? (jsx("a", { href: banner.href, className: sx(alertLinkStyle), children: content })) : (content), jsx("button", { type: "button", className: classes(sx(dismissStyle), sx(alertDismissStyle)), "aria-label": "Dismiss alert", onClick: () => dismiss(banner.id), children: jsx(CloseIcon, { size: 16 }) })] }, banner.id));
16610
+ return (jsxs("div", { className: classes(sx(stackStyle$3), fullWidth && sx(flushStyle), className), role: "region", "aria-label": "Page notices", children: [visibleSystem.map((banner) => (jsxs("div", { className: classes(sx(bannerStyle$1), sx(systemStyle)), role: "status", children: [jsx(InfoIcon$1, { className: sx(systemIconStyle), size: 20, "aria-hidden": "true" }), jsxs("div", { className: sx(contentStyle$5), children: [jsx("p", { className: sx(titleStyle$p), children: content(banner.html) }), banner.detailHtml && jsx("p", { className: sx(detailStyle), children: content(banner.detailHtml) })] }), jsx("button", { type: "button", className: sx(dismissStyle), "aria-label": "Dismiss notice", onClick: () => dismiss(banner.id), children: jsx(CloseIcon, { size: 16 }) })] }, banner.id))), visibleAlerts.map((banner) => {
16611
+ const text = (jsxs("div", { className: sx(contentStyle$5), children: [jsx("p", { className: classes(sx(titleStyle$p), sx(alertTitleStyle)), children: content(banner.title) }), banner.body && jsx("p", { className: classes(sx(detailStyle), sx(clampStyle)), children: content(banner.body) })] }));
16612
+ return (jsxs("div", { className: classes(sx(bannerStyle$1), sx(alertStyle$1)), role: "alert", children: [jsx(WarningIcon$1, { className: sx(alertIconStyle), size: 20, "aria-hidden": "true" }), banner.href ? (jsx("a", { href: banner.href, className: sx(alertLinkStyle), children: text })) : (text), jsx("button", { type: "button", className: classes(sx(dismissStyle), sx(alertDismissStyle)), "aria-label": "Dismiss alert", onClick: () => dismiss(banner.id), children: jsx(CloseIcon, { size: 16 }) })] }, banner.id));
16596
16613
  })] }));
16597
16614
  };
16598
16615
 
@@ -32074,20 +32091,23 @@ const infoListStyle = {
32074
32091
  flex: 1,
32075
32092
  flexDirection: 'column',
32076
32093
  },
32077
- '& strong, & small': {
32094
+ // Scoped to each row's own title (strong), preview (small) and chevron (b):
32095
+ // a preview can carry the host's formatting (SAF-386), and a bare `& strong`
32096
+ // gave its bold words the title's size and weight.
32097
+ '& > * > span > strong, & > * > span > small': {
32078
32098
  overflow: 'hidden',
32079
32099
  textOverflow: 'ellipsis',
32080
32100
  whiteSpace: 'nowrap',
32081
32101
  },
32082
- '& strong': {
32102
+ '& > * > span > strong': {
32083
32103
  fontSize: 13,
32084
32104
  fontWeight: 500,
32085
32105
  },
32086
- '& small': {
32106
+ '& > * > span > small': {
32087
32107
  color: 'var(--color-slate, #5c5c5c)',
32088
32108
  fontSize: 11.5,
32089
32109
  },
32090
- '& b': {
32110
+ '& > * > b': {
32091
32111
  color: 'var(--color-slate, #5c5c5c)',
32092
32112
  },
32093
32113
  };