@nypl/design-system-react-components 3.4.0-rc-hero-1 → 3.4.0-rc-hero-2

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.
@@ -38701,7 +38701,21 @@ const db = [
38701
38701
  variant: v
38702
38702
  }), O = R.heading, P = d && X.cloneElement(d, { __css: O });
38703
38703
  let I = {}, Y = {};
38704
- L.src && !L.alt && console.warn(
38704
+ const A = L.component || /* @__PURE__ */ H.jsx(
38705
+ ua,
38706
+ {
38707
+ alt: L.alt,
38708
+ fallbackSrc: L.fallbackSrc,
38709
+ id: L.id,
38710
+ onError: L.onError,
38711
+ src: L.src
38712
+ }
38713
+ );
38714
+ if (L.component) {
38715
+ const { src: e1, id: c1, alt: v1, fallbackSrc: w1, onError: y1 } = L.component.props;
38716
+ Object.assign(L, { src: e1, id: c1, alt: v1, fallbackSrc: w1, onError: y1 });
38717
+ }
38718
+ console.log("pre check", L), L.src && !L.alt && console.warn(
38705
38719
  'NYPL Reservoir Hero: The "imageProps.src" prop was passed but the "imageProps.alt" props was not. This will make the rendered image inaccessible.'
38706
38720
  ), v === "primary" ? (i || console.warn(
38707
38721
  "NYPL Reservoir Hero: It is recommended to use the `backgroundImageSrc` prop for the `'primary'` `heroType` variant."
@@ -38722,7 +38736,7 @@ const db = [
38722
38736
  ), v !== "campaign" && E && console.warn(
38723
38737
  "NYPL Reservoir Hero: The `isDarkBackgroundImage` prop has been passed, but the `'campaign'` `heroType` variant was not set. It will be ignored."
38724
38738
  );
38725
- const A = {
38739
+ const $ = {
38726
38740
  primary: a5("ui.black", "dark.ui.bg.default"),
38727
38741
  secondary: a5("ui.bg.default", "dark.ui.bg.default"),
38728
38742
  tertiary: a5("ui.gray.x-dark", "dark.ui.bg.default"),
@@ -38732,14 +38746,14 @@ const db = [
38732
38746
  "dark.ui.bg.active"
38733
38747
  ),
38734
38748
  fiftyFifty: a5("ui.bg.default", "dark.ui.bg.default")
38735
- }, $ = A[v];
38749
+ }, j = $[v];
38736
38750
  if (v === "primary")
38737
38751
  I = i ? {
38738
- bgColor: $,
38752
+ bgColor: j,
38739
38753
  backgroundImage: `/**/url("${i}")`
38740
38754
  } : {};
38741
38755
  else if (v === "secondary")
38742
- I = { bgColor: $ };
38756
+ I = { bgColor: j };
38743
38757
  else if (v === "campaign") {
38744
38758
  const e1 = {
38745
38759
  content: '""',
@@ -38771,33 +38785,19 @@ const db = [
38771
38785
  } : {
38772
38786
  _before: {
38773
38787
  ...e1,
38774
- bgColor: A.campaignBackdrop
38788
+ bgColor: $.campaignBackdrop
38775
38789
  }
38776
38790
  };
38777
38791
  } else
38778
- (v === "tertiary" || v === "fiftyFifty") && (I = s ? { bgColor: s } : { bgColor: s || $ });
38792
+ (v === "tertiary" || v === "fiftyFifty") && (I = s ? { bgColor: s } : { bgColor: s || j });
38779
38793
  db.includes(v) ? (p || s || o) && console.warn(
38780
38794
  "NYPL Reservoir Hero: The `foregroundColor`, `backgroundColor`, or `backdropBackgroundColor` props have been passed, but the `'secondary'` `heroType` variant will not use them."
38781
38795
  ) : Y = {
38782
38796
  ...p && { color: p },
38783
- ...s ? { backgroundColor: s } : { bgColor: $ }
38797
+ ...s ? { backgroundColor: s } : { bgColor: j }
38784
38798
  }, p && M && console.warn(
38785
38799
  "NYPL Reservoir Hero: The `foregroundColor` and `isDarkText` props have both been passed. Thse props can not be used at the same time, so the `foregroundColor` prop will override the `isDarkText` prop."
38786
38800
  );
38787
- const j = L.component || /* @__PURE__ */ H.jsx(
38788
- ua,
38789
- {
38790
- alt: L.alt,
38791
- fallbackSrc: L.fallbackSrc,
38792
- id: L.id,
38793
- onError: L.onError,
38794
- src: L.src
38795
- }
38796
- );
38797
- if (L.component) {
38798
- const { src: e1, id: c1, alt: v1, fallbackSrc: w1, onError: y1 } = L.component.props;
38799
- Object.assign(L, { src: e1, id: c1, alt: v1, fallbackSrc: w1, onError: y1 });
38800
- }
38801
38801
  const i1 = v === "campaign" ? /* @__PURE__ */ H.jsxs(H.Fragment, { children: [
38802
38802
  /* @__PURE__ */ H.jsx(
38803
38803
  g1,
@@ -38808,7 +38808,7 @@ const db = [
38808
38808
  style: {
38809
38809
  backgroundImage: `/**/url("${L.src}")`
38810
38810
  },
38811
- children: j
38811
+ children: A
38812
38812
  }
38813
38813
  ),
38814
38814
  /* @__PURE__ */ H.jsxs(g1, { __css: R.interior, children: [
@@ -38825,7 +38825,7 @@ const db = [
38825
38825
  style: {
38826
38826
  backgroundImage: v === "fiftyFifty" ? `/**/url("${L.src}")` : void 0
38827
38827
  },
38828
- children: j
38828
+ children: A
38829
38829
  }
38830
38830
  ),
38831
38831
  P,
@@ -29,13 +29,12 @@ export interface HeroProps {
29
29
  heroType?: HeroTypes;
30
30
  /** ID that other components can cross reference for accessibility purposes. */
31
31
  id?: string;
32
- /** Object used to create and render the `Image` component. Note that only
33
- * `alt`, `component`, and `src` are the available attributes to pass. If
34
- * `imageProps.alt` is left blank, a warning will be logged to the console and
32
+ /** Object used to create and render the `Image` component. You can pass either `component`
33
+ * (with its own internal props) or `src`, `alt`, and `id`.
34
+ * You can also pass `fallBackSrc` and `onError` (only needed for the "campaign" variant).
35
+ * If `imageProps.alt` is left blank, a warning will be logged to the console and
35
36
  * will cause accessibility issues. For `imageProps.src`, it will only work for
36
- * the "secondary", "fiftyFifty" and "campaign" `Hero` types; Note: `imageProps.src`
37
- * can only be used in conjunction with `backgroundImageSrc` for the "campaign"
38
- * `Hero` type. Note: not all `Hero` variations utilize this prop. */
37
+ * the "secondary", "fiftyFifty" and "campaign" `Hero` types. */
39
38
  imageProps?: ComponentImageProps;
40
39
  /** Optional boolean used to toggle the default text color from light to dark.
41
40
  * Set isDarkText to `true` if the backgroundColor is set to a light color. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nypl/design-system-react-components",
3
- "version": "3.4.0-rc-hero-1",
3
+ "version": "3.4.0-rc-hero-2",
4
4
  "description": "NYPL Reservoir Design System React Components",
5
5
  "repository": {
6
6
  "type": "git",