@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.js CHANGED
@@ -16553,6 +16553,10 @@ const decodeEntities = (value) => {
16553
16553
  element.innerHTML = value;
16554
16554
  return element.value;
16555
16555
  };
16556
+ /** A string as decoded text; an element (the caller's formatted copy) as given. */
16557
+ const content = (value) => (typeof value === 'string' ? decodeEntities(value) : value);
16558
+ /** The text a value contributes to the banners' identity: elements by position only. */
16559
+ const textOf = (value) => (typeof value === 'string' ? value : '');
16556
16560
  /**
16557
16561
  * Class names side by side, NOT merged.
16558
16562
  *
@@ -16576,7 +16580,20 @@ const PageBanners = ({ systemBanners, alertBanners, fullWidth = false, className
16576
16580
  // every parent render, and `onDismiss` invites a caller to set state from its
16577
16581
  // handler. Comparing references let that re-render clear `dismissed` and put
16578
16582
  // the banner the reader just closed straight back on screen.
16579
- const identity = JSON.stringify([systemBanners, alertBanners]);
16583
+ //
16584
+ // Built from ids, string fields and `revision`: a formatted value is a
16585
+ // React element, which can't be serialized (its owner fields are circular),
16586
+ // so the caller's `revision` stands in for its content.
16587
+ const identity = JSON.stringify([
16588
+ systemBanners.map((banner) => [banner.id, textOf(banner.html), textOf(banner.detailHtml), banner.revision ?? '']),
16589
+ alertBanners.map((banner) => [
16590
+ banner.id,
16591
+ textOf(banner.title),
16592
+ textOf(banner.body),
16593
+ banner.href ?? '',
16594
+ banner.revision ?? '',
16595
+ ]),
16596
+ ]);
16580
16597
  const previousIdentity = React.useRef(identity);
16581
16598
  React.useEffect(() => {
16582
16599
  if (previousIdentity.current !== identity) {
@@ -16592,9 +16609,9 @@ const PageBanners = ({ systemBanners, alertBanners, fullWidth = false, className
16592
16609
  const visibleAlerts = alertBanners.filter((banner) => !dismissed.has(banner.id));
16593
16610
  if (!visibleSystem.length && !visibleAlerts.length)
16594
16611
  return null;
16595
- return (jsxRuntime.jsxs("div", { className: classes(sx(stackStyle$3), fullWidth && sx(flushStyle), className), role: "region", "aria-label": "Page notices", children: [visibleSystem.map((banner) => (jsxRuntime.jsxs("div", { className: classes(sx(bannerStyle$1), sx(systemStyle)), role: "status", children: [jsxRuntime.jsx(InfoIcon$1, { className: sx(systemIconStyle), size: 20, "aria-hidden": "true" }), jsxRuntime.jsxs("div", { className: sx(contentStyle$5), children: [jsxRuntime.jsx("p", { className: sx(titleStyle$p), children: decodeEntities(banner.html) }), banner.detailHtml && jsxRuntime.jsx("p", { className: sx(detailStyle), children: decodeEntities(banner.detailHtml) })] }), jsxRuntime.jsx("button", { type: "button", className: sx(dismissStyle), "aria-label": "Dismiss notice", onClick: () => dismiss(banner.id), children: jsxRuntime.jsx(CloseIcon, { size: 16 }) })] }, banner.id))), visibleAlerts.map((banner) => {
16596
- const content = (jsxRuntime.jsxs("div", { className: sx(contentStyle$5), children: [jsxRuntime.jsx("p", { className: classes(sx(titleStyle$p), sx(alertTitleStyle)), children: decodeEntities(banner.title) }), banner.body && jsxRuntime.jsx("p", { className: classes(sx(detailStyle), sx(clampStyle)), children: decodeEntities(banner.body) })] }));
16597
- return (jsxRuntime.jsxs("div", { className: classes(sx(bannerStyle$1), sx(alertStyle$1)), role: "alert", children: [jsxRuntime.jsx(WarningIcon$1, { className: sx(alertIconStyle), size: 20, "aria-hidden": "true" }), banner.href ? (jsxRuntime.jsx("a", { href: banner.href, className: sx(alertLinkStyle), children: content })) : (content), jsxRuntime.jsx("button", { type: "button", className: classes(sx(dismissStyle), sx(alertDismissStyle)), "aria-label": "Dismiss alert", onClick: () => dismiss(banner.id), children: jsxRuntime.jsx(CloseIcon, { size: 16 }) })] }, banner.id));
16612
+ return (jsxRuntime.jsxs("div", { className: classes(sx(stackStyle$3), fullWidth && sx(flushStyle), className), role: "region", "aria-label": "Page notices", children: [visibleSystem.map((banner) => (jsxRuntime.jsxs("div", { className: classes(sx(bannerStyle$1), sx(systemStyle)), role: "status", children: [jsxRuntime.jsx(InfoIcon$1, { className: sx(systemIconStyle), size: 20, "aria-hidden": "true" }), jsxRuntime.jsxs("div", { className: sx(contentStyle$5), children: [jsxRuntime.jsx("p", { className: sx(titleStyle$p), children: content(banner.html) }), banner.detailHtml && jsxRuntime.jsx("p", { className: sx(detailStyle), children: content(banner.detailHtml) })] }), jsxRuntime.jsx("button", { type: "button", className: sx(dismissStyle), "aria-label": "Dismiss notice", onClick: () => dismiss(banner.id), children: jsxRuntime.jsx(CloseIcon, { size: 16 }) })] }, banner.id))), visibleAlerts.map((banner) => {
16613
+ const text = (jsxRuntime.jsxs("div", { className: sx(contentStyle$5), children: [jsxRuntime.jsx("p", { className: classes(sx(titleStyle$p), sx(alertTitleStyle)), children: content(banner.title) }), banner.body && jsxRuntime.jsx("p", { className: classes(sx(detailStyle), sx(clampStyle)), children: content(banner.body) })] }));
16614
+ return (jsxRuntime.jsxs("div", { className: classes(sx(bannerStyle$1), sx(alertStyle$1)), role: "alert", children: [jsxRuntime.jsx(WarningIcon$1, { className: sx(alertIconStyle), size: 20, "aria-hidden": "true" }), banner.href ? (jsxRuntime.jsx("a", { href: banner.href, className: sx(alertLinkStyle), children: text })) : (text), jsxRuntime.jsx("button", { type: "button", className: classes(sx(dismissStyle), sx(alertDismissStyle)), "aria-label": "Dismiss alert", onClick: () => dismiss(banner.id), children: jsxRuntime.jsx(CloseIcon, { size: 16 }) })] }, banner.id));
16598
16615
  })] }));
16599
16616
  };
16600
16617
 
@@ -32076,20 +32093,23 @@ const infoListStyle = {
32076
32093
  flex: 1,
32077
32094
  flexDirection: 'column',
32078
32095
  },
32079
- '& strong, & small': {
32096
+ // Scoped to each row's own title (strong), preview (small) and chevron (b):
32097
+ // a preview can carry the host's formatting (SAF-386), and a bare `& strong`
32098
+ // gave its bold words the title's size and weight.
32099
+ '& > * > span > strong, & > * > span > small': {
32080
32100
  overflow: 'hidden',
32081
32101
  textOverflow: 'ellipsis',
32082
32102
  whiteSpace: 'nowrap',
32083
32103
  },
32084
- '& strong': {
32104
+ '& > * > span > strong': {
32085
32105
  fontSize: 13,
32086
32106
  fontWeight: 500,
32087
32107
  },
32088
- '& small': {
32108
+ '& > * > span > small': {
32089
32109
  color: 'var(--color-slate, #5c5c5c)',
32090
32110
  fontSize: 11.5,
32091
32111
  },
32092
- '& b': {
32112
+ '& > * > b': {
32093
32113
  color: 'var(--color-slate, #5c5c5c)',
32094
32114
  },
32095
32115
  };