@axos-web-dev/shared-components 0.0.6 → 0.0.8

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.
@@ -1,20 +1,19 @@
1
1
  import { ChevronProps } from '../Chevron/Chevron.interface';
2
2
  import { ReactNode } from "react";
3
- export type large = "large" | "lg";
4
- export type medium = "medium" | "md";
5
- export type small = "small" | "sm";
6
3
  export interface CallToActionBarInterface {
7
4
  id?: string;
8
- image_overlap: boolean;
9
- bannerSize: large | medium | small;
10
- image: {
11
- src: string;
12
- alt?: string;
13
- };
5
+ bannerSize: "Large" | "Medium" | "Small";
6
+ image: ImageInterface;
14
7
  imageMobileView: boolean;
15
- imagePlacement: "left" | "right";
16
- bannerBehavior: "fixed" | "sticky" | "scroll";
8
+ imagePlacement: "Left" | "Right";
9
+ bannerBehavior: "Fixed" | "Fixed Overlap" | "Sticky" | "Scroll";
17
10
  headline: string | ReactNode;
18
11
  bodyCopy: string | ReactNode;
19
12
  callToActionRow: ChevronProps[];
20
13
  }
14
+ export interface ImageInterface {
15
+ src: string;
16
+ alt?: string;
17
+ width: number;
18
+ height: number;
19
+ }
@@ -3,16 +3,16 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import { Button } from "../Button/index.js";
4
4
  import { Chevron } from "../Chevron/index.js";
5
5
  import { getVariant } from "../utils/getVariant.js";
6
+ import clsx from "clsx";
6
7
  import { useState, useEffect } from "react";
7
8
  import { returnImageDimensions, imageOrientation, getBannerSizeClassName } from "../utils/ctaOptions.js";
8
9
  import { sticky_banner, is_sticky, cta, cta_image_section, cta_image_overlap, cta_body_section, cta_text, ctas_section } from "./CallToActionBar.css.js";
9
10
  const CallToActionBar = ({
10
- image_overlap,
11
11
  bannerSize,
12
12
  image,
13
13
  imageMobileView,
14
14
  imagePlacement,
15
- bannerBehavior = "fixed",
15
+ bannerBehavior = "Fixed",
16
16
  headline,
17
17
  bodyCopy,
18
18
  callToActionRow,
@@ -22,16 +22,18 @@ const CallToActionBar = ({
22
22
  const [imageSize, setImageSize] = useState({ width: "0px", height: "0px" });
23
23
  const banner_size = bannerSize.toLowerCase();
24
24
  const row_reverse = imagePlacement.toLowerCase() === "right" ? true : false;
25
+ const banner_behavior = bannerBehavior.toLocaleLowerCase();
26
+ const image_overlap = bannerBehavior.toLowerCase().includes("overlap");
25
27
  useEffect(() => {
26
28
  var _a;
27
29
  const domRectStickyEl = (_a = document == null ? void 0 : document.querySelector(`.${sticky_banner}`)) == null ? void 0 : _a.getBoundingClientRect();
28
30
  if (domRectStickyEl) {
29
31
  setstickyTop(domRectStickyEl.top);
30
32
  }
31
- setImageSize(
32
- returnImageDimensions(banner_size, imageOrientation(image.src))
33
- );
34
- }, [image.src, banner_size]);
33
+ if (image) {
34
+ setImageSize(returnImageDimensions(banner_size, imageOrientation(image)));
35
+ }
36
+ }, [image, banner_size]);
35
37
  useEffect(() => {
36
38
  if (!stickyTop)
37
39
  return;
@@ -59,63 +61,80 @@ const CallToActionBar = ({
59
61
  className: `${cta} ${getBannerSizeClassName(
60
62
  banner_size,
61
63
  image_overlap
62
- )} ${bannerBehavior.toLowerCase() === "sticky" ? sticky_banner : ""} section_spacer`,
63
- children: /* @__PURE__ */ jsxs("div", { className: "containment flex middle", children: [
64
- banner_size !== "sm" && !imageMobileView ? /* @__PURE__ */ jsx("div", { className: `${cta_image_section}`, children: /* @__PURE__ */ jsx(
65
- "img",
66
- {
67
- src: image.src,
68
- alt: "",
69
- style: { ...imageSize },
70
- className: `${image_overlap ? `${cta_image_overlap}` : ""}`
71
- }
72
- ) }) : null,
73
- /* @__PURE__ */ jsxs(
74
- "div",
75
- {
76
- className: `${cta_body_section} ${banner_size !== "lg" ? "flex middle" : ""}`,
77
- style: row_reverse ? { flexDirection: "row-reverse" } : {},
78
- children: [
79
- /* @__PURE__ */ jsxs("div", { className: `${cta_text} mb_0`, children: [
80
- headline && /* @__PURE__ */ jsx("h2", { className: "header_3", children: headline }),
81
- banner_size === "lg" && bodyCopy && /* @__PURE__ */ jsx(Fragment, { children: bodyCopy })
82
- ] }),
83
- /* @__PURE__ */ jsx(
84
- "div",
85
- {
86
- className: `${ctas_section} flex text_center push_up_24`,
87
- style: banner_size === "sm" ? {
88
- flexShrink: 0,
89
- marginRight: `${row_reverse ? "40px" : "20px"}`,
90
- padding: 0
91
- } : {},
92
- children: callToActionRow.map(
93
- ({ id: id2, variant, displayText, targetUrl, type }) => type === "Button" ? /* @__PURE__ */ jsx(
94
- Button,
95
- {
96
- targetUrl,
97
- color: getVariant(variant),
98
- size: "medium",
99
- rounded: "medium",
100
- children: displayText
101
- },
102
- id2
103
- ) : /* @__PURE__ */ jsx(
104
- Chevron,
105
- {
106
- targetUrl,
107
- variant: getVariant(variant),
108
- children: displayText
109
- },
110
- id2
111
- )
64
+ )} ${banner_behavior === "sticky" ? sticky_banner : ""} section_spacer`,
65
+ children: /* @__PURE__ */ jsxs(
66
+ "div",
67
+ {
68
+ className: "containment flex middle",
69
+ style: !image || imageMobileView || banner_size === "small" ? { justifyContent: "center" } : {},
70
+ children: [
71
+ banner_size !== "small" && !imageMobileView && image ? /* @__PURE__ */ jsx("div", { className: `${cta_image_section}`, children: /* @__PURE__ */ jsx(
72
+ "img",
73
+ {
74
+ src: image.src,
75
+ alt: "",
76
+ style: { ...imageSize },
77
+ className: `${image_overlap ? `${cta_image_overlap}` : ""}`
78
+ }
79
+ ) }) : null,
80
+ /* @__PURE__ */ jsxs(
81
+ "div",
82
+ {
83
+ className: `${cta_body_section} ${banner_size !== "large" ? "flex middle" : ""}`,
84
+ style: row_reverse ? { flexDirection: "row-reverse" } : {},
85
+ children: [
86
+ /* @__PURE__ */ jsxs(
87
+ "div",
88
+ {
89
+ className: clsx(
90
+ cta_text,
91
+ "mb_0",
92
+ (imageMobileView || !image) && "text_center"
93
+ ),
94
+ children: [
95
+ headline && /* @__PURE__ */ jsx("h2", { className: "header_3", children: headline }),
96
+ banner_size === "large" && bodyCopy && /* @__PURE__ */ jsx(Fragment, { children: bodyCopy })
97
+ ]
98
+ }
99
+ ),
100
+ /* @__PURE__ */ jsx(
101
+ "div",
102
+ {
103
+ className: clsx(ctas_section, "flex", "text_center"),
104
+ style: banner_size === "small" ? {
105
+ flexShrink: 0,
106
+ marginRight: `${row_reverse ? "40px" : "20px"}`,
107
+ padding: 0
108
+ } : {},
109
+ children: callToActionRow.map(
110
+ ({ id: id2, variant, displayText, targetUrl, type }) => type === "Button" ? /* @__PURE__ */ jsx(
111
+ Button,
112
+ {
113
+ targetUrl,
114
+ color: getVariant(variant),
115
+ size: "medium",
116
+ rounded: "medium",
117
+ children: displayText
118
+ },
119
+ id2
120
+ ) : /* @__PURE__ */ jsx(
121
+ Chevron,
122
+ {
123
+ targetUrl,
124
+ variant: getVariant(variant),
125
+ children: displayText
126
+ },
127
+ id2
128
+ )
129
+ )
130
+ }
112
131
  )
113
- }
114
- )
115
- ]
116
- }
117
- )
118
- ] })
132
+ ]
133
+ }
134
+ )
135
+ ]
136
+ }
137
+ )
119
138
  },
120
139
  id
121
140
  );
@@ -1,5 +1,10 @@
1
- import { PropsWithChildren } from "react";
2
- export declare const FooterContent: (props: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
3
- export declare const FooterParagraph: (props: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
4
- export declare const FooterIcons: (props: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
5
- export declare const FooterDisclosure: (props: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
1
+ import { CSSProperties, PropsWithChildren } from "react";
2
+ type WithStyles = {
3
+ style?: CSSProperties;
4
+ className?: string;
5
+ };
6
+ export declare const FooterContent: (props: PropsWithChildren & WithStyles) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const FooterParagraph: (props: PropsWithChildren & WithStyles) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const FooterIcons: (props: PropsWithChildren & WithStyles) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const FooterDisclosure: (props: PropsWithChildren & WithStyles) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -1,16 +1,24 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
2
3
  import { footerContent, footerParagraph, iconsContent, footerDisclosure } from "./FooterDisclosure.css.js";
3
4
  const FooterContent = (props) => {
4
- return /* @__PURE__ */ jsx("div", { className: footerContent, children: props.children });
5
+ return /* @__PURE__ */ jsx("div", { className: clsx(footerContent, props.className), style: props.style, children: props.children });
5
6
  };
6
7
  const FooterParagraph = (props) => {
7
- return /* @__PURE__ */ jsx("div", { className: footerParagraph, children: props.children });
8
+ return /* @__PURE__ */ jsx("div", { className: clsx(footerParagraph, props.className), style: props.style, children: props.children });
8
9
  };
9
10
  const FooterIcons = (props) => {
10
- return /* @__PURE__ */ jsx("div", { className: iconsContent, children: props.children });
11
+ return /* @__PURE__ */ jsx("div", { className: clsx(iconsContent, props.className), style: props.style, children: props.children });
11
12
  };
12
13
  const FooterDisclosure = (props) => {
13
- return /* @__PURE__ */ jsx("footer", { className: footerDisclosure(), children: props.children });
14
+ return /* @__PURE__ */ jsx(
15
+ "footer",
16
+ {
17
+ className: clsx(footerDisclosure(), props.className),
18
+ style: props.style,
19
+ children: props.children
20
+ }
21
+ );
14
22
  };
15
23
  export {
16
24
  FooterContent,
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren } from "react";
2
2
  import { FormProps } from ".";
3
3
  export interface renderFormProps extends FormProps, PropsWithChildren {
4
- formName?: string;
4
+ form?: string;
5
5
  }
6
6
  export declare const renderSwitch: (form: string | undefined, props: FormProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export declare const RenderWebForm: (props: renderFormProps) => import("react/jsx-runtime").JSX.Element;
@@ -11,7 +11,7 @@ const renderSwitch = (form = "Contact Form", props) => {
11
11
  }
12
12
  };
13
13
  const RenderWebForm = (props) => {
14
- return /* @__PURE__ */ jsx(Fragment, { children: renderSwitch(props.formName, props) });
14
+ return /* @__PURE__ */ jsx(Fragment, { children: renderSwitch(props.form, props) });
15
15
  };
16
16
  export {
17
17
  RenderWebForm,
@@ -6,8 +6,8 @@ export interface FormProps extends PropsWithChildren {
6
6
  [index: string]: string;
7
7
  }) => void;
8
8
  icon?: boolean;
9
- headline?: ReactNode;
10
- disclosure?: ReactNode;
9
+ headline?: ReactNode | string;
10
+ disclosure?: ReactNode | string;
11
11
  variant?: QuaternaryTypes;
12
12
  validateEmail: (email: string) => Promise<boolean>;
13
13
  callToAction: Omit<ChevronProps, "targetUrl">;
@@ -7,12 +7,13 @@ import { containerIconBillboard, layout, billboard_icon, content, headerIconBill
7
7
  const IconBillboard = (props) => {
8
8
  const {
9
9
  callToActionRow,
10
- variant,
10
+ variant: fullVariant = "primary",
11
11
  side = false,
12
12
  items,
13
13
  headline,
14
14
  body
15
15
  } = props;
16
+ const variant = getVariant(fullVariant);
16
17
  return /* @__PURE__ */ jsxs("div", { className: containerIconBillboard({ variant }), children: [
17
18
  /* @__PURE__ */ jsxs("div", { className: layout({ side }), children: [
18
19
  /* @__PURE__ */ jsx("div", { className: billboard_icon, children: props.icon }),
@@ -25,52 +25,61 @@ const IconBillboardSet = ({
25
25
  bodyCopy && /* @__PURE__ */ jsx(Fragment, { children: bodyCopy })
26
26
  ] }),
27
27
  /* @__PURE__ */ jsx("div", { className: section_container, children: iconBillboards.map(
28
- ({ id, icon, headline: headline2, bodyCopy: bodyCopy2, bullets, callToActionRow }) => /* @__PURE__ */ jsxs("div", { className: containerIconBillboard({ variant }), children: [
29
- /* @__PURE__ */ jsxs("div", { className: layout({ side }), children: [
30
- icon && /* @__PURE__ */ jsx("div", { className: billboard_icon, children: /* @__PURE__ */ jsx(
31
- "img",
32
- {
33
- src: icon == null ? void 0 : icon.src,
34
- className: "img_fluid",
35
- alt: icon == null ? void 0 : icon.alt
36
- }
37
- ) }),
38
- /* @__PURE__ */ jsxs("div", { className: content, children: [
39
- /* @__PURE__ */ jsxs("div", { className: headerIconBillboard, children: [
40
- /* @__PURE__ */ jsx("div", { className: title({ variant }), children: headline2 }),
41
- /* @__PURE__ */ jsx("div", { children: bodyCopy2 })
28
+ ({ id, icon, headline: headline2, bodyCopy: bodyCopy2, bullets, callToActionRow }) => /* @__PURE__ */ jsxs(
29
+ "div",
30
+ {
31
+ className: containerIconBillboard({
32
+ variant: getVariant(variant)
33
+ }),
34
+ children: [
35
+ /* @__PURE__ */ jsxs("div", { className: layout({ side }), children: [
36
+ icon && /* @__PURE__ */ jsx("div", { className: billboard_icon, children: /* @__PURE__ */ jsx(
37
+ "img",
38
+ {
39
+ src: icon == null ? void 0 : icon.src,
40
+ className: "img_fluid",
41
+ alt: icon == null ? void 0 : icon.alt
42
+ }
43
+ ) }),
44
+ /* @__PURE__ */ jsxs("div", { className: content, children: [
45
+ /* @__PURE__ */ jsxs("div", { className: headerIconBillboard, children: [
46
+ /* @__PURE__ */ jsx("div", { className: title({ variant }), children: headline2 }),
47
+ /* @__PURE__ */ jsx("div", { children: bodyCopy2 })
48
+ ] }),
49
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("ul", { className: list, children: bullets.map((item) => /* @__PURE__ */ jsx(BulletItem, { id: item.id, children: item.copy }, item.id)) }) })
50
+ ] })
42
51
  ] }),
43
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("ul", { className: list, children: bullets.map((item) => /* @__PURE__ */ jsx(BulletItem, { id: item.id, children: item.copy }, item.id)) }) })
44
- ] })
45
- ] }),
46
- callToActionRow && /* @__PURE__ */ jsx("div", { className: buttons, children: callToActionRow.map(
47
- ({
48
- id: id2,
49
- variant: variant2,
50
- displayText,
51
- targetUrl,
52
- type
53
- }) => type === "Button" ? /* @__PURE__ */ jsx(
54
- Button,
55
- {
56
- targetUrl,
57
- color: getVariant(variant2),
58
- size: "medium",
59
- rounded: "medium",
60
- children: displayText
61
- },
62
- id2
63
- ) : /* @__PURE__ */ jsx(
64
- Chevron,
65
- {
66
- targetUrl,
67
- variant: getVariant(variant2),
68
- children: displayText
69
- },
70
- id2
71
- )
72
- ) })
73
- ] }, id)
52
+ callToActionRow && /* @__PURE__ */ jsx("div", { className: buttons, children: callToActionRow.map(
53
+ ({
54
+ id: id2,
55
+ variant: variant2,
56
+ displayText,
57
+ targetUrl,
58
+ type
59
+ }) => type === "Button" ? /* @__PURE__ */ jsx(
60
+ Button,
61
+ {
62
+ targetUrl,
63
+ color: getVariant(variant2),
64
+ size: "medium",
65
+ rounded: "medium",
66
+ children: displayText
67
+ },
68
+ id2
69
+ ) : /* @__PURE__ */ jsx(
70
+ Chevron,
71
+ {
72
+ targetUrl,
73
+ variant: getVariant(variant2),
74
+ children: displayText
75
+ },
76
+ id2
77
+ )
78
+ ) })
79
+ ]
80
+ },
81
+ id
82
+ )
74
83
  ) }),
75
84
  additionalDetails && /* @__PURE__ */ jsx("div", { className: section_text, children: /* @__PURE__ */ jsx(Fragment, { children: additionalDetails }) })
76
85
  ] });
@@ -14,6 +14,7 @@ import "react";
14
14
  import "../IconBillboard/IconBillboard.css.js";
15
15
  /* empty css */
16
16
  /* empty css */
17
+ import "clsx";
17
18
  /* empty css */
18
19
  import "../Carousel/index.js";
19
20
  /* empty css */
@@ -26,7 +27,6 @@ import "../Forms/Forms.css.js";
26
27
  import "../Forms/SalesforceFieldsForm.js";
27
28
  import "@hookform/resolvers/zod";
28
29
  import "../Input/index.js";
29
- import "clsx";
30
30
  import "react-hook-form";
31
31
  /* empty css */
32
32
  import "../ImageBillboard/ImageBillboard.css.js";
@@ -4,7 +4,7 @@
4
4
  color: var(--_1073cm8g);
5
5
  }
6
6
  ._1tdyl740 .containment {
7
- height: -webkit-fit-content;
7
+ height: 100%;
8
8
  }
9
9
  ._1tdyl740 .flex {
10
10
  align-items: center;
@@ -52,7 +52,7 @@
52
52
  }
53
53
  ._1tdyl74c {
54
54
  position: relative;
55
- top: -40px;
55
+ top: -20px;
56
56
  }
57
57
  ._1tdyl74d {
58
58
  gap: 24px;
@@ -76,6 +76,9 @@
76
76
  ._1tdyl74g .sc__btn {
77
77
  margin-left: 0;
78
78
  }
79
+ ._1tdyl746 ._1tdyl74g, ._1tdyl747 ._1tdyl74g {
80
+ margin-top: 24px;
81
+ }
79
82
  @media screen and (max-width:1127px) {
80
83
  [class*=cta_section_lg] {
81
84
  max-height: 256px;
@@ -86,7 +86,6 @@
86
86
  object-fit: cover;
87
87
  aspect-ratio: 1 / 1;
88
88
  min-width: 600px;
89
- max-height: 480px;
90
89
  }
91
90
  ._1m7m2an {
92
91
  padding: 32px 28px;
@@ -1,4 +1,5 @@
1
- export declare const imageOrientation: (image_url: string) => string;
1
+ import { ImageInterface } from '../CallToActionBar/CallToActionBar.interface';
2
+ export declare const imageOrientation: (image: ImageInterface) => string;
2
3
  export declare const getBannerSizeClassName: (size: string, overlap: boolean) => string;
3
4
  export declare const returnImageDimensions: (size: string, image_orientation: string) => {
4
5
  width: string;
@@ -1,11 +1,9 @@
1
- import { cta_section_lg, cta_section_lg_overlap, cta_section_md, cta_section_md_overlap } from "../CallToActionBar/CallToActionBar.css.js";
2
- const imageOrientation = (image_url) => {
3
- let orientation;
4
- const img = new Image();
5
- img.src = image_url;
6
- if (img.naturalWidth > img.naturalHeight) {
1
+ import { cta_section_lg, cta_section_lg_overlap, cta_section_md, cta_section_md_overlap, cta_section_sm } from "../CallToActionBar/CallToActionBar.css.js";
2
+ const imageOrientation = (image) => {
3
+ let orientation = "landscape";
4
+ if (image.width > image.height) {
7
5
  orientation = "landscape";
8
- } else if (img.naturalWidth < img.naturalHeight) {
6
+ } else if (image.width < image.height) {
9
7
  orientation = "portrait";
10
8
  } else {
11
9
  orientation = "even";
@@ -13,31 +11,31 @@ const imageOrientation = (image_url) => {
13
11
  return orientation;
14
12
  };
15
13
  const getBannerSizeClassName = (size, overlap) => {
16
- if (size === "lg" && !overlap) {
14
+ if (size.includes("large") && !overlap) {
17
15
  return cta_section_lg;
18
16
  }
19
- if (size === "lg" && overlap) {
17
+ if (size.includes("large") && overlap) {
20
18
  return cta_section_lg_overlap;
21
19
  }
22
- if (size === "md" && !overlap) {
20
+ if (size.includes("medium") && !overlap) {
23
21
  return cta_section_md;
24
22
  }
25
- if (size === "md" && overlap) {
23
+ if (size.includes("medium") && overlap) {
26
24
  return cta_section_md_overlap;
27
25
  }
28
- return "cta_section_sm";
26
+ return cta_section_sm;
29
27
  };
30
28
  const returnImageDimensions = (size, image_orientation) => {
31
- if (image_orientation === "landscape" && size === "lg") {
29
+ if (image_orientation === "landscape" && size.includes("large")) {
32
30
  return { width: "491px", height: "256px" };
33
31
  }
34
- if (image_orientation === "even" && size === "lg") {
32
+ if (image_orientation === "even" && size.includes("large")) {
35
33
  return { width: "256px", height: "256px" };
36
34
  }
37
- if (image_orientation === "landscape" && size === "md") {
35
+ if (image_orientation === "landscape" && size.includes("medium")) {
38
36
  return { width: "306px", height: "160px" };
39
37
  }
40
- if (image_orientation === "even" && size === "md") {
38
+ if (image_orientation === "even" && size.includes("medium")) {
41
39
  return { width: "160px", height: "160px" };
42
40
  }
43
41
  return { width: "491px", height: "256px" };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@axos-web-dev/shared-components",
3
3
  "description": "Axos shared components library for web.",
4
- "version": "0.0.6",
4
+ "version": "0.0.8",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",