@bytebrand/fe-ui-core-autobahn 1.0.218 → 1.0.220

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core-autobahn",
3
- "version": "1.0.218",
3
+ "version": "1.0.220",
4
4
  "description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
5
5
  "main": "index.ts",
6
6
  "license": "UNLICENSED",
package/theme/md3.css CHANGED
@@ -12244,11 +12244,13 @@ color: #005CFF;
12244
12244
  line-height: 28px;
12245
12245
  color: #1d2a38;
12246
12246
  }
12247
- .md3 #vdp-bewertungen > div:first-child > div {
12247
+ .md3 #vdp-bewertungen > div:first-child > div,
12248
+ .md3 #vdp-bewertungen > div:first-child > .rating-info-area {
12248
12249
  margin-left: 30px !important;
12249
12250
  gap: 50px !important;
12250
12251
  }
12251
- .md3 #vdp-bewertungen > div:first-child > div .num {
12252
+ .md3 #vdp-bewertungen > div:first-child > div .num,
12253
+ .md3 #vdp-bewertungen > div:first-child > .rating-info-area .num {
12252
12254
  font-family: Arial, Helvetica, Arimo, sans-serif;
12253
12255
  font-style: normal;
12254
12256
  font-weight: 700 !important;
@@ -12256,11 +12258,13 @@ color: #005CFF;
12256
12258
  line-height: 42px;
12257
12259
  color: #1d2a38 !important;
12258
12260
  }
12259
- .md3 #vdp-bewertungen > div:first-child > div .lucide {
12261
+ .md3 #vdp-bewertungen > div:first-child > div .lucide,
12262
+ .md3 #vdp-bewertungen > div:first-child > .rating-info-area .lucide {
12260
12263
  width: 19px;
12261
12264
  height: 19px;
12262
12265
  }
12263
- .md3 #vdp-bewertungen > div:first-child > div .md-label-sm {
12266
+ .md3 #vdp-bewertungen > div:first-child > div .md-label-sm,
12267
+ .md3 #vdp-bewertungen > div:first-child > .rating-info-area .md-label-sm {
12264
12268
  font-family: Arial, Helvetica, Arimo, sans-serif;
12265
12269
  font-style: normal;
12266
12270
  font-weight: 400;
@@ -15658,6 +15662,43 @@ color: #005CFF;
15658
15662
  outline: 2px solid var(--md-primary);
15659
15663
  outline-offset: 1px;
15660
15664
  }
15665
+ /* the whole rating as one button (RatingSourcesInfo with children): looks exactly like the plain
15666
+ content, hovering anywhere lights up the "ⓘ" circle as hovering the circle alone did */
15667
+ .md3 .rating-info-area {
15668
+ position: relative;
15669
+ display: inline-flex;
15670
+ align-items: center;
15671
+ margin: 0;
15672
+ padding: 0;
15673
+ border: 0;
15674
+ border-radius: var(--md-r-sm);
15675
+ background: none;
15676
+ color: inherit;
15677
+ font: inherit;
15678
+ text-align: inherit;
15679
+ cursor: pointer;
15680
+ }
15681
+ .md3 .rating-info-area--static {
15682
+ cursor: auto;
15683
+ }
15684
+ .md3 .rating-info-area:hover .rating-info-btn {
15685
+ background: var(--md-sc-high);
15686
+ }
15687
+ .md3 .rating-info-area:focus-visible {
15688
+ outline: 2px solid var(--md-primary);
15689
+ outline-offset: 4px;
15690
+ }
15691
+ .md3 .rating-info-sr {
15692
+ position: absolute;
15693
+ width: 1px;
15694
+ height: 1px;
15695
+ margin: -1px;
15696
+ padding: 0;
15697
+ overflow: hidden;
15698
+ clip: rect(0 0 0 0);
15699
+ white-space: nowrap;
15700
+ border: 0;
15701
+ }
15661
15702
  .md3 .review-source {
15662
15703
  color: inherit;
15663
15704
  text-decoration: none;
@@ -3179,35 +3179,59 @@ export interface RatingSourcesInfoProps {
3179
3179
  size?: number;
3180
3180
  /** icon colour (default on-surface-variant). */
3181
3181
  color?: string;
3182
+ /**
3183
+ * The rating the popup explains (stars, "4,5 / 5", "876 Bewertungen" …). Given, that whole area
3184
+ * plus the "ⓘ" is ONE button that opens the popup, not just the circle. Called with the "ⓘ"
3185
+ * (null without portals) so the caller places it in its own layout. Without portals the area is
3186
+ * rendered as plain content, no button.
3187
+ */
3188
+ children?: (info: React.ReactElement | null) => React.ReactNode;
3189
+ /** layout of the area (children mode only), e.g. its gap. */
3190
+ style?: React.CSSProperties;
3182
3191
  t: TranslationFunction;
3183
3192
  }
3184
3193
 
3185
3194
  /**
3186
3195
  * "ⓘ" next to the site rating → a popup that explains it: the rating of each portal (Google,
3187
3196
  * Trustpilot) with its review count and a nofollow link to all auto.de reviews there, then the
3188
- * combined, count-weighted average that the page shows.
3197
+ * combined, count-weighted average that the page shows. With `children`, the rating next to the
3198
+ * "ⓘ" opens it too (PM 2026-11-24: "link the entire area, not just the circle").
3189
3199
  */
3190
- export const RatingSourcesInfo: React.FunctionComponent<RatingSourcesInfoProps> = ({ average, total, portals, size = 18, color, t }) => {
3200
+ export const RatingSourcesInfo: React.FunctionComponent<RatingSourcesInfoProps> = ({ average, total, portals, size = 18, color, children, style, t }) => {
3191
3201
  const [open, setOpen] = useState(false);
3192
3202
  const list = (portals || []).filter((p) => p && p.name && p.total > 0);
3193
- if (!list.length) return null;
3203
+ if (!list.length) {
3204
+ return children ? (
3205
+ <span className="rating-info-area rating-info-area--static" style={style}>
3206
+ {children(null)}
3207
+ </span>
3208
+ ) : null;
3209
+ }
3194
3210
  const names = list.map((p) => p.name).join(` ${t('autobahn:reviews.sources.and')} `);
3195
3211
  const avg = average.toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 });
3212
+ const label = t('autobahn:reviews.sources.open');
3213
+ const openPopup = (e: React.MouseEvent) => {
3214
+ e.stopPropagation();
3215
+ setOpen(true);
3216
+ };
3217
+ const icon = <Icon name="info" size={size} color={color || 'var(--md-on-surface-variant)'} style={{ width: size, height: size }} />;
3196
3218
  return (
3197
3219
  <>
3198
- <button
3199
- type="button"
3200
- className="rating-info-btn"
3201
- aria-label={t('autobahn:reviews.sources.open')}
3202
- aria-haspopup="dialog"
3203
- title={t('autobahn:reviews.sources.open')}
3204
- onClick={(e) => {
3205
- e.stopPropagation();
3206
- setOpen(true);
3207
- }}
3208
- >
3209
- <Icon name="info" size={size} color={color || 'var(--md-on-surface-variant)'} style={{ width: size, height: size }} />
3210
- </button>
3220
+ {children ? (
3221
+ // the visible rating names the button; the hidden text says what it opens
3222
+ <button type="button" className="rating-info-area" aria-haspopup="dialog" title={label} style={style} onClick={openPopup}>
3223
+ {children(
3224
+ <span className="rating-info-btn" aria-hidden="true">
3225
+ {icon}
3226
+ </span>,
3227
+ )}
3228
+ <span className="rating-info-sr">{label}</span>
3229
+ </button>
3230
+ ) : (
3231
+ <button type="button" className="rating-info-btn" aria-label={label} aria-haspopup="dialog" title={label} onClick={openPopup}>
3232
+ {icon}
3233
+ </button>
3234
+ )}
3211
3235
  <Modal open={open} onClose={() => setOpen(false)} size="sm" title={t('autobahn:reviews.sources.title')} className="rating-sources">
3212
3236
  <p className="md-body" style={{ margin: '0 0 16px', color: 'var(--md-on-surface-variant)' }}>
3213
3237
  {t('autobahn:reviews.sources.intro', { portals: names })}
@@ -3289,20 +3313,23 @@ export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({
3289
3313
  <h2 className="md-headline-sm" style={{ margin: 0 }}>
3290
3314
  {t('autobahn:reviews.title')}
3291
3315
  </h2>
3292
- <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginLeft: 'auto' }}>
3293
- <span className="num" style={{ fontWeight: 800, fontSize: 26, color: 'var(--md-on-surface)', letterSpacing: '-.5px' }}>
3294
- {avg.toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 })}
3295
- </span>
3296
- <span>
3297
- <Stars value={avg} size={16} />
3298
- <span className="md-label-sm" style={{ display: 'flex', alignItems: 'center', gap: 2 }}>
3299
- {t('autobahn:reviews.ratingCount', { count: headerCount })} · via {sourceLabel || 'Google'}
3300
- {portals && portals.length > 0 && (
3301
- <RatingSourcesInfo average={avg} total={headerCount} portals={portals} size={16} t={t} />
3302
- )}
3303
- </span>
3304
- </span>
3305
- </div>
3316
+ {/* the whole rating (number, stars, count, "ⓘ") opens the sources popup */}
3317
+ <RatingSourcesInfo average={avg} total={headerCount} portals={portals || []} size={16} t={t} style={{ gap: 10, marginLeft: 'auto' }}>
3318
+ {(info) => (
3319
+ <>
3320
+ <span className="num" style={{ fontWeight: 800, fontSize: 26, color: 'var(--md-on-surface)', letterSpacing: '-.5px' }}>
3321
+ {avg.toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 })}
3322
+ </span>
3323
+ <span>
3324
+ <Stars value={avg} size={16} />
3325
+ <span className="md-label-sm" style={{ display: 'flex', alignItems: 'center', gap: 2 }}>
3326
+ {t('autobahn:reviews.ratingCount', { count: headerCount })} · via {sourceLabel || 'Google'}
3327
+ {info}
3328
+ </span>
3329
+ </span>
3330
+ </>
3331
+ )}
3332
+ </RatingSourcesInfo>
3306
3333
  </div>
3307
3334
  <div className="eq-cols">
3308
3335
  {shown.map((r) => (