@windstream/react-shared-components 0.2.44 → 0.2.46
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/contentful/index.d.ts +2 -1
- package/dist/contentful/index.esm.js +3 -3
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +2 -2
- package/dist/contentful/index.js.map +1 -1
- package/dist/core.d.ts +151 -3
- package/dist/index.d.ts +152 -4
- package/dist/index.esm.js +6 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/next/index.esm.js +2 -2
- package/dist/next/index.esm.js.map +1 -1
- package/dist/next/index.js +2 -2
- package/dist/next/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.esm.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +4 -2
- package/src/components/brand-button/index.tsx +2 -2
- package/src/components/video-link/index.test.tsx +1 -1
- package/src/components/video-link/index.tsx +6 -6
- package/src/contentful/blocks/callout/index.tsx +4 -3
- package/src/contentful/blocks/cards/floating-image-card/index.tsx +1 -1
- package/src/contentful/blocks/cards/simple-card/index.tsx +21 -2
- package/src/contentful/blocks/fiber-form/constants.ts +81 -0
- package/src/contentful/blocks/fiber-form/index.tsx +557 -0
- package/src/contentful/blocks/fiber-form/types.ts +92 -0
- package/src/contentful/blocks/primary-hero/index.tsx +10 -10
- package/src/hooks/contentful/use-contentful-rich-text.test.tsx +118 -0
- package/src/hooks/contentful/use-contentful-rich-text.tsx +72 -13
- package/src/index.ts +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windstream/react-shared-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared React components for Kinetic applications",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -110,12 +110,14 @@
|
|
|
110
110
|
"@types/react-modal": "3.16.3",
|
|
111
111
|
"@types/react-transition-group": "4.4.12",
|
|
112
112
|
"clsx": "2.1.1",
|
|
113
|
+
"formik": "^2.4.6",
|
|
113
114
|
"framer-motion": "10.12.16",
|
|
114
115
|
"js-base64": "^3.7.7",
|
|
115
116
|
"js-cookie": "^3.0.5",
|
|
116
117
|
"react-modal": "3.16.3",
|
|
117
118
|
"react-select": "5.10.2",
|
|
118
|
-
"react-transition-group": "4.4.5"
|
|
119
|
+
"react-transition-group": "4.4.5",
|
|
120
|
+
"yup": "^1.7.0"
|
|
119
121
|
},
|
|
120
122
|
"optionalDependencies": {
|
|
121
123
|
"@types/js-cookie": "^3.0.6"
|
|
@@ -48,8 +48,8 @@ export const BrandButton = forwardRef<
|
|
|
48
48
|
const getVariantClasses = () => {
|
|
49
49
|
const baseClasses = cx(
|
|
50
50
|
sizeToClassNames(size),
|
|
51
|
-
"rounded-button
|
|
52
|
-
fullWidth ? "w-full" : "w-auto"
|
|
51
|
+
"rounded-button overflow-visible flex lg:inline-flex items-center justify-center text-center outline-none focus:ring-2 focus:ring-offset-2 cursor-pointer transition-colors duration-200 align-top lg:whitespace-nowrap",
|
|
52
|
+
fullWidth ? "w-full" : "w-full lg:w-auto"
|
|
53
53
|
);
|
|
54
54
|
|
|
55
55
|
const variantClasses: Record<ButtonVariantsT, string> = {
|
|
@@ -20,10 +20,10 @@ export const VideoLink: React.FC<VideoLinkComponentProps> = ({
|
|
|
20
20
|
const [isHovered, setIsHovered] = useState(false);
|
|
21
21
|
|
|
22
22
|
const videoSourceType = videoLink?.videoSourceType;
|
|
23
|
+
const usingContentfulAsset =
|
|
24
|
+
videoSourceType === "contentful" && !!videoLink?.videoAssetUrl;
|
|
23
25
|
const videoHref =
|
|
24
|
-
(
|
|
25
|
-
? videoLink?.videoAssetUrl
|
|
26
|
-
: videoLink?.link) ?? "";
|
|
26
|
+
(usingContentfulAsset ? videoLink?.videoAssetUrl : videoLink?.link) ?? "";
|
|
27
27
|
|
|
28
28
|
// The video's own poster - never the promo bar's plain image field.
|
|
29
29
|
const posterImage = videoLink?.image;
|
|
@@ -69,7 +69,7 @@ export const VideoLink: React.FC<VideoLinkComponentProps> = ({
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
const embedSelector = () => {
|
|
72
|
-
if (
|
|
72
|
+
if (usingContentfulAsset) {
|
|
73
73
|
return (
|
|
74
74
|
<ContentfulVideoEmbed
|
|
75
75
|
videoAssetUrl={videoLink?.videoAssetUrl}
|
|
@@ -92,7 +92,7 @@ export const VideoLink: React.FC<VideoLinkComponentProps> = ({
|
|
|
92
92
|
<>
|
|
93
93
|
<div
|
|
94
94
|
className={cx(
|
|
95
|
-
"video-section relative w-full cursor-pointer rounded-image transition-all duration-300 lg:w-[486px]",
|
|
95
|
+
"video-section relative mx-auto w-full cursor-pointer rounded-image transition-all duration-300 lg:w-[486px]",
|
|
96
96
|
!isPlaying && "hover:ring-2 hover:ring-border-focus"
|
|
97
97
|
)}
|
|
98
98
|
onClick={handlePlayClick}
|
|
@@ -167,4 +167,4 @@ export type {
|
|
|
167
167
|
VideoEmbedProps,
|
|
168
168
|
VideoLinkComponentProps,
|
|
169
169
|
VideoLinkProps,
|
|
170
|
-
} from "./types";
|
|
170
|
+
} from "./types";
|
|
@@ -99,12 +99,13 @@ export const Callout: React.FC<CalloutProps> = ({
|
|
|
99
99
|
const gridClass = isStackMode
|
|
100
100
|
? cx(
|
|
101
101
|
"flex flex-col items-stretch self-stretch",
|
|
102
|
-
noGutter ? "gap-0" : "gap-
|
|
102
|
+
noGutter ? "gap-0" : "gap-3"
|
|
103
103
|
)
|
|
104
104
|
: cx(
|
|
105
105
|
"flex flex-wrap items-stretch justify-center self-stretch",
|
|
106
|
-
|
|
107
|
-
noGutter ? "
|
|
106
|
+
// Mobile (e.g. 390px) uses 12px gap; md+ also uses 12px.
|
|
107
|
+
noGutter ? "gap-0" : "gap-3",
|
|
108
|
+
noGutter ? "md:gap-0" : "md:gap-3"
|
|
108
109
|
);
|
|
109
110
|
|
|
110
111
|
// Per-card width classes — only used for flex-wrap layout. Mobile is
|
|
@@ -166,6 +166,19 @@ export const SimpleCard: React.FC<SimpleCardProps> = ({
|
|
|
166
166
|
const hasTable =
|
|
167
167
|
(card.workingHours?.length ?? 0) > 0 || (card.phoneNumber?.length ?? 0) > 0;
|
|
168
168
|
|
|
169
|
+
// A card whose only content is the CTA renders as a bare button: card
|
|
170
|
+
// padding is dropped so the card-holder gap is the whole space between
|
|
171
|
+
// buttons, and the button gets a fixed width so siblings match.
|
|
172
|
+
const isCtaOnly =
|
|
173
|
+
!!card.cta &&
|
|
174
|
+
!card.title &&
|
|
175
|
+
!card.titleLocation &&
|
|
176
|
+
!card.body &&
|
|
177
|
+
!card.richText &&
|
|
178
|
+
!card.image &&
|
|
179
|
+
!hasTable &&
|
|
180
|
+
!(card.ctaBottom?.title && card.ctaBottom?.href);
|
|
181
|
+
|
|
169
182
|
return (
|
|
170
183
|
<section
|
|
171
184
|
className={cx(
|
|
@@ -204,7 +217,8 @@ export const SimpleCard: React.FC<SimpleCardProps> = ({
|
|
|
204
217
|
|
|
205
218
|
<div
|
|
206
219
|
className={cx(
|
|
207
|
-
"relative flex flex-1 flex-col justify-between
|
|
220
|
+
"relative flex flex-1 flex-col justify-between",
|
|
221
|
+
isCtaOnly ? "p-0" : "px-6 pb-8 pt-7 lg:px-8 lg:py-8",
|
|
208
222
|
contentClassName
|
|
209
223
|
)}
|
|
210
224
|
>
|
|
@@ -304,7 +318,7 @@ export const SimpleCard: React.FC<SimpleCardProps> = ({
|
|
|
304
318
|
</div>
|
|
305
319
|
|
|
306
320
|
{card.cta ? (
|
|
307
|
-
<div className={cx("mt-2", ctaAlignmentClass)}>
|
|
321
|
+
<div className={cx(!isCtaOnly && "mt-2", ctaAlignmentClass)}>
|
|
308
322
|
<Button
|
|
309
323
|
linkVariant="unstyled"
|
|
310
324
|
linkClassName={cx(
|
|
@@ -314,6 +328,11 @@ export const SimpleCard: React.FC<SimpleCardProps> = ({
|
|
|
314
328
|
{...card.cta}
|
|
315
329
|
iconName={card.cta.iconName ?? "expand_circle_right"}
|
|
316
330
|
iconFill={card.cta.iconFill ?? 1}
|
|
331
|
+
fullWidth={true}
|
|
332
|
+
buttonClassName={cx(
|
|
333
|
+
card.cta.buttonClassName,
|
|
334
|
+
isCtaOnly && "w-[342px] max-w-full lg:w-[342px]"
|
|
335
|
+
)}
|
|
317
336
|
/>
|
|
318
337
|
</div>
|
|
319
338
|
) : null}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { FiberFormInputList, FiberFormValues } from "../../blocks/fiber-form/types";
|
|
2
|
+
import * as Yup from "yup";
|
|
3
|
+
|
|
4
|
+
export const fiberFormInputInitialValues: FiberFormValues = {
|
|
5
|
+
firstName: "",
|
|
6
|
+
lastName: "",
|
|
7
|
+
address: "",
|
|
8
|
+
phone: "",
|
|
9
|
+
email: "",
|
|
10
|
+
unit: "",
|
|
11
|
+
zip: "",
|
|
12
|
+
isManualAddress: false,
|
|
13
|
+
isMarketingCom: false,
|
|
14
|
+
addressToSend: {},
|
|
15
|
+
notes: "",
|
|
16
|
+
referralCode: "",
|
|
17
|
+
hasUnits: false,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const fiberFormInputList: FiberFormInputList = {
|
|
21
|
+
firstName: { placeholder: "John" },
|
|
22
|
+
lastName: { placeholder: "Doe" },
|
|
23
|
+
address: { placeholder: "Street address" },
|
|
24
|
+
phoneNumber: { placeholder: "Phone number" },
|
|
25
|
+
emailAddress: { placeholder: "Email address" },
|
|
26
|
+
unit: { placeholder: "Unit (optional)" },
|
|
27
|
+
zip: { placeholder: "Zip" },
|
|
28
|
+
notes: { placeholder: "Notes or Comments" },
|
|
29
|
+
referralCode: { placeholder: "Referral Code" },
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const fiberFormAddressCollectionFormSchema = Yup.object({
|
|
33
|
+
firstName: Yup.string()
|
|
34
|
+
.required("First name is required")
|
|
35
|
+
.min(2, "Enter a valid First name")
|
|
36
|
+
.matches(/^[a-zA-Z\s]*$/, "Enter a valid First name"),
|
|
37
|
+
lastName: Yup.string()
|
|
38
|
+
.required("Last name is required")
|
|
39
|
+
.min(2, "Enter a valid Last name")
|
|
40
|
+
.matches(/^[a-zA-Z\s]*$/, "Enter a valid Last name"),
|
|
41
|
+
isManualAddress: Yup.boolean(),
|
|
42
|
+
isMarketingCom: Yup.boolean(),
|
|
43
|
+
hasUnits: Yup.boolean(),
|
|
44
|
+
unit: Yup.string().when("hasUnits", {
|
|
45
|
+
is: true,
|
|
46
|
+
then: schema => schema.required("Unit is required"),
|
|
47
|
+
otherwise: schema =>
|
|
48
|
+
schema.matches(/^[a-zA-Z0-9\s#]*$/, "Enter a valid Unit"),
|
|
49
|
+
}),
|
|
50
|
+
zip: Yup.string().when("isManualAddress", {
|
|
51
|
+
is: true,
|
|
52
|
+
then: schema =>
|
|
53
|
+
schema
|
|
54
|
+
.required("Zip is required")
|
|
55
|
+
.matches(/^\d{5}$/, "Enter a valid Zip"),
|
|
56
|
+
}),
|
|
57
|
+
address: Yup.string()
|
|
58
|
+
.required("Enter your home address (street, city, state, and ZIP below)")
|
|
59
|
+
.when("isManualAddress", {
|
|
60
|
+
is: true,
|
|
61
|
+
then: schema =>
|
|
62
|
+
schema.matches(
|
|
63
|
+
/^(\d{1,}) [a-zA-Z0-9\s]+(\,)? [a-zA-Z\s]+(\,)? [A-Z]{2}( [0-9]{5,6})?$/,
|
|
64
|
+
"Enter your home address (street, city, state, and ZIP below)"
|
|
65
|
+
),
|
|
66
|
+
}),
|
|
67
|
+
phone: Yup.string()
|
|
68
|
+
.required("Phone is required")
|
|
69
|
+
.matches(
|
|
70
|
+
/^\([0-9]{3}\)\s[0-9]{3}-[0-9]{4}$/,
|
|
71
|
+
"Please enter a valid phone number"
|
|
72
|
+
),
|
|
73
|
+
email: Yup.string()
|
|
74
|
+
.email("Invalid email")
|
|
75
|
+
.matches(/^[^\s@]+@[^\s@]+\.[^\s@]+$/, "Invalid email")
|
|
76
|
+
.required("Email is required"),
|
|
77
|
+
notes: Yup.string(),
|
|
78
|
+
referralCode: Yup.string()
|
|
79
|
+
.max(50, "Referral code must not exceed 50 characters")
|
|
80
|
+
.matches(/^\S*$/, "Referral code must not contain spaces"),
|
|
81
|
+
});
|