@windstream/react-shared-components 0.1.36 → 0.1.37

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,6 +1,5 @@
1
1
  import { ClassValue } from 'clsx';
2
2
  export { ClassValue, clsx } from 'clsx';
3
- import Cookies from 'js-cookie';
4
3
 
5
4
  /**
6
5
  * UTM Parameter Types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windstream/react-shared-components",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "type": "module",
5
5
  "description": "Shared React components for Kinetic applications",
6
6
  "main": "dist/index.js",
@@ -1,109 +1,109 @@
1
- "use client";
2
-
3
- import React, { forwardRef } from "react";
4
- import { cx } from "../../utils";
5
- import { LinkProps } from "./types";
6
- import NextLink from "next/link";
7
-
8
- export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
9
- (
10
- {
11
- children,
12
- href,
13
- className = "",
14
- onClick,
15
- variant = "unstyled",
16
- style,
17
- external = false,
18
- disabled = false,
19
- ...props
20
- },
21
- ref
22
- ) => {
23
- // Get Tailwind classes for different variants
24
- const getVariantClasses = () => {
25
- if (variant === "unstyled") return "";
26
-
27
- // TODO: Add styles based on the figma design for all variants
28
- const baseClasses =
29
- "transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2";
30
-
31
- const variantClasses = {
32
- default: "text-text underline",
33
- };
34
-
35
- const stateClasses = [
36
- disabled
37
- ? "opacity-60 cursor-not-allowed pointer-events-none"
38
- : "cursor-pointer",
39
- ]
40
- .filter(Boolean)
41
- .join(" ");
42
-
43
- return [
44
- baseClasses,
45
- variantClasses[variant as keyof typeof variantClasses] ||
46
- variantClasses.default,
47
- stateClasses,
48
- ]
49
- .filter(Boolean)
50
- .join(" ");
51
- };
52
-
53
- const tailwindClasses = getVariantClasses();
54
-
55
- // Handle click events
56
- const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
57
- if (disabled) {
58
- event.preventDefault();
59
- return;
60
- }
61
-
62
- onClick?.(event);
63
- };
64
-
65
- // Combine all classes
66
- const combinedClassName = cx(
67
- tailwindClasses,
68
- `link--${variant}`,
69
- disabled && "link--disabled",
70
- className
71
- );
72
-
73
- // Determine link props based on external/internal
74
- const linkProps = {
75
- ...props,
76
- ref,
77
- className: combinedClassName,
78
- style,
79
- href: disabled ? undefined : href,
80
- onClick: handleClick,
81
- ...(external &&
82
- !disabled && {
83
- target: "_blank",
84
- rel: "noopener noreferrer",
85
- }),
86
- ...(disabled && {
87
- "aria-disabled": true,
88
- tabIndex: -1,
89
- }),
90
- };
91
- if (external || (typeof href === "string" && href.startsWith("http"))) {
92
- return <a {...linkProps}>{children}</a>;
93
- }
94
- return (
95
- <NextLink
96
- href={href || "#"}
97
- className={combinedClassName}
98
- onClick={handleClick}
99
- {...props}
100
- >
101
- {children}
102
- </NextLink>
103
- );
104
- }
105
- );
106
-
107
- Link.displayName = "Link";
108
-
109
- export type { LinkProps };
1
+ "use client";
2
+
3
+ import React, { forwardRef } from "react";
4
+ import { cx } from "../../utils";
5
+ import { LinkProps } from "./types";
6
+ import NextLink from "next/link";
7
+
8
+ export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
9
+ (
10
+ {
11
+ children,
12
+ href,
13
+ className = "",
14
+ onClick,
15
+ variant = "unstyled",
16
+ style,
17
+ external = false,
18
+ disabled = false,
19
+ ...props
20
+ },
21
+ ref
22
+ ) => {
23
+ // Get Tailwind classes for different variants
24
+ const getVariantClasses = () => {
25
+ if (variant === "unstyled") return "";
26
+
27
+ // TODO: Add styles based on the figma design for all variants
28
+ const baseClasses =
29
+ "transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2";
30
+
31
+ const variantClasses = {
32
+ default: "text-text underline",
33
+ };
34
+
35
+ const stateClasses = [
36
+ disabled
37
+ ? "opacity-60 cursor-not-allowed pointer-events-none"
38
+ : "cursor-pointer",
39
+ ]
40
+ .filter(Boolean)
41
+ .join(" ");
42
+
43
+ return [
44
+ baseClasses,
45
+ variantClasses[variant as keyof typeof variantClasses] ||
46
+ variantClasses.default,
47
+ stateClasses,
48
+ ]
49
+ .filter(Boolean)
50
+ .join(" ");
51
+ };
52
+
53
+ const tailwindClasses = getVariantClasses();
54
+
55
+ // Handle click events
56
+ const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
57
+ if (disabled) {
58
+ event.preventDefault();
59
+ return;
60
+ }
61
+
62
+ onClick?.(event);
63
+ };
64
+
65
+ // Combine all classes
66
+ const combinedClassName = cx(
67
+ tailwindClasses,
68
+ `link--${variant}`,
69
+ disabled && "link--disabled",
70
+ className
71
+ );
72
+
73
+ // Determine link props based on external/internal
74
+ const linkProps = {
75
+ ...props,
76
+ ref,
77
+ className: combinedClassName,
78
+ style,
79
+ href: disabled ? undefined : href,
80
+ onClick: handleClick,
81
+ ...(external &&
82
+ !disabled && {
83
+ target: "_blank",
84
+ rel: "noopener noreferrer",
85
+ }),
86
+ ...(disabled && {
87
+ "aria-disabled": true,
88
+ tabIndex: -1,
89
+ }),
90
+ };
91
+ if (external || (typeof href === "string" && href.startsWith("http"))) {
92
+ return <a {...linkProps}>{children}</a>;
93
+ }
94
+ return (
95
+ <NextLink
96
+ href={href || "#"}
97
+ className={combinedClassName}
98
+ onClick={handleClick}
99
+ {...props}
100
+ >
101
+ {children}
102
+ </NextLink>
103
+ );
104
+ }
105
+ );
106
+
107
+ Link.displayName = "Link";
108
+
109
+ export type { LinkProps };
@@ -1,29 +1,29 @@
1
- import { Accordion } from "./index";
2
-
3
- import { DocsPage } from "@shared/stories/DocsTemplate";
4
- import type { Meta, StoryObj } from "@storybook/react";
5
-
6
- const meta: Meta<typeof Accordion> = {
7
- title: "Contentful Blocks/Accordion",
8
- component: Accordion,
9
- tags: ["autodocs"],
10
- parameters: {
11
- layout: "centered",
12
- docs: {
13
- page: DocsPage,
14
- description: {
15
- component: "Contentful accordion block.",
16
- },
17
- },
18
- },
19
- args: {
20
- background: "white",
21
- enableHeading: false,
22
- items: [],
23
- maxWidth: true,
24
- title: "test",
25
- },
26
- };
27
- export default meta;
28
- type Story = StoryObj<typeof meta>;
29
- export const Default: Story = {};
1
+ import { Accordion } from "./index";
2
+
3
+ import { DocsPage } from "@shared/stories/DocsTemplate";
4
+ import type { Meta, StoryObj } from "@storybook/react";
5
+
6
+ const meta: Meta<typeof Accordion> = {
7
+ title: "Contentful Blocks/Accordion",
8
+ component: Accordion,
9
+ tags: ["autodocs"],
10
+ parameters: {
11
+ layout: "centered",
12
+ docs: {
13
+ page: DocsPage,
14
+ description: {
15
+ component: "Contentful accordion block.",
16
+ },
17
+ },
18
+ },
19
+ args: {
20
+ background: "white",
21
+ enableHeading: false,
22
+ items: [],
23
+ maxWidth: true,
24
+ title: "test",
25
+ },
26
+ };
27
+ export default meta;
28
+ type Story = StoryObj<typeof meta>;
29
+ export const Default: Story = {};
@@ -1,17 +1,17 @@
1
- import React from "react";
2
-
3
- export type AccordionProps = {
4
- title: string;
5
- enableHeading?: boolean;
6
- background?: "blue" | "green" | "navy" | "purple" | "white" | "yellow";
7
- items: { title: string; description: React.ReactNode }[];
8
- maxWidth?: boolean;
9
- };
10
-
11
- export type ThemeKey =
12
- | "blue"
13
- | "green"
14
- | "yellow"
15
- | "purple"
16
- | "white"
17
- | "navy";
1
+ import React from "react";
2
+
3
+ export type AccordionProps = {
4
+ title: string;
5
+ enableHeading?: boolean;
6
+ background?: "blue" | "green" | "navy" | "purple" | "white" | "yellow";
7
+ items: { title: string; description: React.ReactNode }[];
8
+ maxWidth?: boolean;
9
+ };
10
+
11
+ export type ThemeKey =
12
+ | "blue"
13
+ | "green"
14
+ | "yellow"
15
+ | "purple"
16
+ | "white"
17
+ | "navy";
@@ -1,51 +1,51 @@
1
- import React from "react";
2
- import Button from "../button";
3
- import { BreadcrumbNavigationProps } from "./types";
4
-
5
- import { MaterialIcon } from "@shared/components/material-icon";
6
- import { Text } from "@shared/components/text";
7
-
8
- export const BreadcrumbNavigation: React.FC<
9
- BreadcrumbNavigationProps
10
- > = props => {
11
- const { links = [], textColor = "dark", maxWidth = true } = props;
12
- const color =
13
- textColor === "dark"
14
- ? "text-white xl:text-text"
15
- : "text-text xl:text-white";
16
- if (!links.length) return null;
17
- return (
18
- <nav
19
- aria-label="Breadcrumb"
20
- className={`${maxWidth ? "mx-5 max-w-120 xl:mx-auto" : "mx-auto"} relative`}
21
- >
22
- <ol
23
- className={
24
- "relative right-0 z-10 mt-4 flex w-full flex-nowrap items-center gap-2 xl:absolute xl:flex-wrap"
25
- }
26
- >
27
- {links.map((link, index) => {
28
- const isLast = index === links.length - 1;
29
- return !isLast ? (
30
- <li key={index} className="flex flex-none items-center">
31
- <Button
32
- {...link}
33
- linkClassName={`label3 mr-2 whitespace-nowrap ${color}`}
34
- linkVariant="unstyled"
35
- />
36
- <MaterialIcon name="chevron_right" className={`${color} `} />
37
- </li>
38
- ) : (
39
- <li key={index} className="flex min-w-0 items-center">
40
- <Text as="span" className={`body3 mr-2 break-words ${color}`}>
41
- {link.buttonLabel}
42
- </Text>
43
- </li>
44
- );
45
- })}
46
- </ol>
47
- </nav>
48
- );
49
- };
50
-
51
- export default BreadcrumbNavigation;
1
+ import React from "react";
2
+ import Button from "../button";
3
+ import { BreadcrumbNavigationProps } from "./types";
4
+
5
+ import { MaterialIcon } from "@shared/components/material-icon";
6
+ import { Text } from "@shared/components/text";
7
+
8
+ export const BreadcrumbNavigation: React.FC<
9
+ BreadcrumbNavigationProps
10
+ > = props => {
11
+ const { links = [], textColor = "dark", maxWidth = true } = props;
12
+ const color =
13
+ textColor === "dark"
14
+ ? "text-white xl:text-text"
15
+ : "text-text xl:text-white";
16
+ if (!links.length) return null;
17
+ return (
18
+ <nav
19
+ aria-label="Breadcrumb"
20
+ className={`${maxWidth ? "mx-5 max-w-120 xl:mx-auto" : "mx-auto"} relative`}
21
+ >
22
+ <ol
23
+ className={
24
+ "relative right-0 z-10 mt-4 flex w-full flex-nowrap items-center gap-2 xl:absolute xl:flex-wrap"
25
+ }
26
+ >
27
+ {links.map((link, index) => {
28
+ const isLast = index === links.length - 1;
29
+ return !isLast ? (
30
+ <li key={index} className="flex flex-none items-center">
31
+ <Button
32
+ {...link}
33
+ linkClassName={`label3 mr-2 whitespace-nowrap ${color}`}
34
+ linkVariant="unstyled"
35
+ />
36
+ <MaterialIcon name="chevron_right" className={`${color} `} />
37
+ </li>
38
+ ) : (
39
+ <li key={index} className="flex min-w-0 items-center">
40
+ <Text as="span" className={`body3 mr-2 break-words ${color}`}>
41
+ {link.buttonLabel}
42
+ </Text>
43
+ </li>
44
+ );
45
+ })}
46
+ </ol>
47
+ </nav>
48
+ );
49
+ };
50
+
51
+ export default BreadcrumbNavigation;
@@ -1,5 +1,5 @@
1
- export type BreadcrumbNavigationProps = {
2
- links?: Array<any>;
3
- textColor?: "dark" | "light";
4
- maxWidth?: boolean;
5
- };
1
+ export type BreadcrumbNavigationProps = {
2
+ links?: Array<any>;
3
+ textColor?: "dark" | "light";
4
+ maxWidth?: boolean;
5
+ };
@@ -1,28 +1,28 @@
1
- import { ReactNode } from "react";
2
- import { ButtonProps } from "../../button/types";
3
-
4
- export type Item = {
5
- title?: string;
6
- image?: string;
7
- imageAlignment?: "left" | "right" | "center";
8
- imageView?: "standard" | "icon" | "full";
9
- cta?: ButtonProps;
10
- ctaAlignment?: "left" | "right" | "center";
11
- body?: ReactNode;
12
- backgroundColor?: string;
13
- };
14
-
15
- export type SimpleCardProps = {
16
- card: Item;
17
- lgWidth?: string;
18
- mdWidth?: string;
19
- };
20
-
21
- export const backgroundColorMap: Record<string, string> = {
22
- blue: "bg-fill-brand",
23
- green: "bg-fill-brand-accent",
24
- navy: "bg-fill-inverse",
25
- purple: "bg-fill-brand-tertiary",
26
- white: "bg-white",
27
- yellow: "bg-[#F5FF1E]",
28
- };
1
+ import { ReactNode } from "react";
2
+ import { ButtonProps } from "../../button/types";
3
+
4
+ export type Item = {
5
+ title?: string;
6
+ image?: string;
7
+ imageAlignment?: "left" | "right" | "center";
8
+ imageView?: "standard" | "icon" | "full";
9
+ cta?: ButtonProps;
10
+ ctaAlignment?: "left" | "right" | "center";
11
+ body?: ReactNode;
12
+ backgroundColor?: string;
13
+ };
14
+
15
+ export type SimpleCardProps = {
16
+ card: Item;
17
+ lgWidth?: string;
18
+ mdWidth?: string;
19
+ };
20
+
21
+ export const backgroundColorMap: Record<string, string> = {
22
+ blue: "bg-fill-brand",
23
+ green: "bg-fill-brand-accent",
24
+ navy: "bg-fill-inverse",
25
+ purple: "bg-fill-brand-tertiary",
26
+ white: "bg-white",
27
+ yellow: "bg-[#F5FF1E]",
28
+ };
@@ -1,27 +1,27 @@
1
- import React from "react";
2
- import { ComparisonTableProps } from "./types";
3
-
4
- import { Text } from "@shared/components/text";
5
-
6
- export const ComparisonTable: React.FC<ComparisonTableProps> = ({
7
- title,
8
- disclaimer,
9
- table,
10
- maxWidth = true,
11
- }) => {
12
- return (
13
- <div className="component-container">
14
- <div
15
- className={`mx-5 mb-5 mt-8 lg:mt-10 ${maxWidth ? "max-w-120 xl:mx-auto" : ""}`}
16
- >
17
- <Text as="h2" className="heading2 lg:heading1 lg:text-center">
18
- {title}
19
- </Text>
20
- <div className="comparison-table-container mt-20 xl:mt-10">{table}</div>
21
- <Text as="div" className="micro mt-8 text-center">
22
- {disclaimer}
23
- </Text>
24
- </div>
25
- </div>
26
- );
27
- };
1
+ import React from "react";
2
+ import { ComparisonTableProps } from "./types";
3
+
4
+ import { Text } from "@shared/components/text";
5
+
6
+ export const ComparisonTable: React.FC<ComparisonTableProps> = ({
7
+ title,
8
+ disclaimer,
9
+ table,
10
+ maxWidth = true,
11
+ }) => {
12
+ return (
13
+ <div className="component-container">
14
+ <div
15
+ className={`mx-5 mb-5 mt-8 lg:mt-10 ${maxWidth ? "max-w-120 xl:mx-auto" : ""}`}
16
+ >
17
+ <Text as="h2" className="heading2 lg:heading1 lg:text-center">
18
+ {title}
19
+ </Text>
20
+ <div className="comparison-table-container mt-20 xl:mt-10">{table}</div>
21
+ <Text as="div" className="micro mt-8 text-center">
22
+ {disclaimer}
23
+ </Text>
24
+ </div>
25
+ </div>
26
+ );
27
+ };
@@ -1,6 +1,6 @@
1
- export type ComparisonTableProps = {
2
- title?: string;
3
- disclaimer?: React.ReactNode;
4
- table: React.ReactNode;
5
- maxWidth?: boolean;
6
- };
1
+ export type ComparisonTableProps = {
2
+ title?: string;
3
+ disclaimer?: React.ReactNode;
4
+ table: React.ReactNode;
5
+ maxWidth?: boolean;
6
+ };
@@ -93,7 +93,7 @@ export default function CookieBanner({
93
93
  const handleClose = () => {
94
94
  const expirationDate = new Date(Date.now() + 43200 * 60 * 1000);
95
95
  setIsBannerVisible(false);
96
- setCookie("cookieBannerClosed", "true", {
96
+ setCookie("cookieBannerClosed", true, {
97
97
  expires: expirationDate,
98
98
  });
99
99
  };
@@ -1,23 +1,23 @@
1
- import { FindKinetic } from "./index";
2
-
3
- import { DocsPage } from "@shared/stories/DocsTemplate";
4
- import type { Meta, StoryObj } from "@storybook/react";
5
-
6
- const meta: Meta<typeof FindKinetic> = {
7
- title: "Contentful Blocks/FindKinetic",
8
- component: FindKinetic,
9
- tags: ["autodocs"],
10
- parameters: {
11
- layout: "centered",
12
- docs: {
13
- page: DocsPage,
14
- description: {
15
- component: "Contentful FindKinetic block.",
16
- },
17
- },
18
- },
19
- args: {},
20
- };
21
- export default meta;
22
- type Story = StoryObj<typeof meta>;
23
- export const Default: Story = {};
1
+ import { FindKinetic } from "./index";
2
+
3
+ import { DocsPage } from "@shared/stories/DocsTemplate";
4
+ import type { Meta, StoryObj } from "@storybook/react";
5
+
6
+ const meta: Meta<typeof FindKinetic> = {
7
+ title: "Contentful Blocks/FindKinetic",
8
+ component: FindKinetic,
9
+ tags: ["autodocs"],
10
+ parameters: {
11
+ layout: "centered",
12
+ docs: {
13
+ page: DocsPage,
14
+ description: {
15
+ component: "Contentful FindKinetic block.",
16
+ },
17
+ },
18
+ },
19
+ args: {},
20
+ };
21
+ export default meta;
22
+ type Story = StoryObj<typeof meta>;
23
+ export const Default: Story = {};
@@ -1,19 +1,19 @@
1
- export type FindKineticProps = {
2
- title?: string;
3
- enableHeading?: boolean;
4
- subTitle?: string;
5
- description?: string;
6
- background?: "blue" | "green" | "navy" | "purple" | "white" | "yellow";
7
- image?: string;
8
- list?: { name: string; code: string }[];
9
- maxWidth?: boolean;
10
- color?: "dark" | "light";
11
- };
12
-
13
- export type ThemeKey =
14
- | "blue"
15
- | "green"
16
- | "yellow"
17
- | "purple"
18
- | "white"
19
- | "navy";
1
+ export type FindKineticProps = {
2
+ title?: string;
3
+ enableHeading?: boolean;
4
+ subTitle?: string;
5
+ description?: string;
6
+ background?: "blue" | "green" | "navy" | "purple" | "white" | "yellow";
7
+ image?: string;
8
+ list?: { name: string; code: string }[];
9
+ maxWidth?: boolean;
10
+ color?: "dark" | "light";
11
+ };
12
+
13
+ export type ThemeKey =
14
+ | "blue"
15
+ | "green"
16
+ | "yellow"
17
+ | "purple"
18
+ | "white"
19
+ | "navy";