@windstream/react-shared-components 0.0.37 → 0.0.38

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.
Files changed (57) hide show
  1. package/dist/contentful/index.d.ts +9 -29
  2. package/dist/contentful/index.esm.js +1 -1
  3. package/dist/contentful/index.esm.js.map +1 -1
  4. package/dist/contentful/index.js +1 -1
  5. package/dist/contentful/index.js.map +1 -1
  6. package/dist/core.d.ts +2 -2
  7. package/dist/index.esm.js +1 -1
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/styles.css +1 -1
  12. package/package.json +1 -1
  13. package/src/components/accordion/index.tsx +49 -49
  14. package/src/components/alert-card/types.ts +9 -9
  15. package/src/components/brand-button/index.tsx +93 -93
  16. package/src/components/button/index.tsx +27 -27
  17. package/src/components/button/types.ts +14 -14
  18. package/src/components/checkbox/index.tsx +197 -197
  19. package/src/components/collapse/index.tsx +46 -46
  20. package/src/components/image/types.ts +33 -33
  21. package/src/components/input/index.tsx +6 -6
  22. package/src/components/link/index.tsx +97 -97
  23. package/src/components/link/types.ts +25 -25
  24. package/src/components/list/index.tsx +88 -88
  25. package/src/components/list/list-item/index.tsx +38 -38
  26. package/src/components/list/list-item/types.ts +13 -13
  27. package/src/components/list/types.ts +29 -29
  28. package/src/components/material-icon/index.tsx +44 -44
  29. package/src/components/material-icon/types.ts +31 -31
  30. package/src/components/modal/index.tsx +164 -164
  31. package/src/components/see-more/index.tsx +44 -44
  32. package/src/components/select/index.tsx +150 -150
  33. package/src/components/skeleton/index.tsx +61 -61
  34. package/src/components/text/index.tsx +25 -25
  35. package/src/components/text/types.ts +45 -45
  36. package/src/contentful/blocks/accordion/Accordion.stories.tsx +29 -29
  37. package/src/contentful/blocks/accordion/index.tsx +52 -52
  38. package/src/contentful/blocks/accordion/types.ts +17 -17
  39. package/src/contentful/blocks/button/index.tsx +5 -0
  40. package/src/contentful/blocks/button/types.ts +1 -0
  41. package/src/contentful/blocks/callout/Callout.stories.tsx +1 -1
  42. package/src/contentful/blocks/callout/index.tsx +15 -52
  43. package/src/contentful/blocks/callout/types.ts +1 -14
  44. package/src/contentful/blocks/find-kinetic/FindKinetic.stories.tsx +23 -23
  45. package/src/contentful/blocks/find-kinetic/index.tsx +80 -80
  46. package/src/contentful/blocks/find-kinetic/types.ts +18 -18
  47. package/src/contentful/blocks/footer/index.tsx +79 -79
  48. package/src/contentful/blocks/image-promo-bar/index.tsx +154 -154
  49. package/src/contentful/blocks/navigation/index.tsx +1 -2
  50. package/src/contentful/blocks/navigation/link-groups.tsx/index.tsx +64 -62
  51. package/src/contentful/blocks/primary-hero/index.tsx +163 -64
  52. package/src/contentful/blocks/primary-hero/types.ts +1 -0
  53. package/src/contentful/index.ts +45 -48
  54. package/src/hooks/use-body-scroll-lock.ts +34 -34
  55. package/src/setupTests.ts +46 -46
  56. package/src/contentful/blocks/cards/simple-card/index.tsx +0 -45
  57. package/src/contentful/blocks/cards/simple-card/types.ts +0 -11
@@ -1,97 +1,97 @@
1
- "use client";
2
-
3
- import React, { forwardRef } from "react";
4
- import { cx } from "../../utils";
5
- import { LinkProps } from "./types";
6
-
7
- export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
8
- (
9
- {
10
- children,
11
- href,
12
- className = "",
13
- onClick,
14
- variant = "unstyled",
15
- style,
16
- external = false,
17
- disabled = false,
18
- ...props
19
- },
20
- ref
21
- ) => {
22
- // Get Tailwind classes for different variants
23
- const getVariantClasses = () => {
24
- if (variant === "unstyled") return "";
25
-
26
- // TODO: Add styles based on the figma design for all variants
27
- const baseClasses =
28
- "transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2";
29
-
30
- const variantClasses = {
31
- default: "text-text underline",
32
- };
33
-
34
- const stateClasses = [
35
- disabled
36
- ? "opacity-60 cursor-not-allowed pointer-events-none"
37
- : "cursor-pointer",
38
- ]
39
- .filter(Boolean)
40
- .join(" ");
41
-
42
- return [
43
- baseClasses,
44
- variantClasses[variant as keyof typeof variantClasses] ||
45
- variantClasses.default,
46
- stateClasses,
47
- ]
48
- .filter(Boolean)
49
- .join(" ");
50
- };
51
-
52
- const tailwindClasses = getVariantClasses();
53
-
54
- // Handle click events
55
- const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
56
- if (disabled) {
57
- event.preventDefault();
58
- return;
59
- }
60
-
61
- onClick?.(event);
62
- };
63
-
64
- // Combine all classes
65
- const combinedClassName = cx(
66
- tailwindClasses,
67
- `link--${variant}`,
68
- disabled && "link--disabled",
69
- className
70
- );
71
-
72
- // Determine link props based on external/internal
73
- const linkProps = {
74
- ...props,
75
- ref,
76
- className: combinedClassName,
77
- style,
78
- href: disabled ? undefined : href,
79
- onClick: handleClick,
80
- ...(external &&
81
- !disabled && {
82
- target: "_blank",
83
- rel: "noopener noreferrer",
84
- }),
85
- ...(disabled && {
86
- "aria-disabled": true,
87
- tabIndex: -1,
88
- }),
89
- };
90
-
91
- return <a {...linkProps}>{children}</a>;
92
- }
93
- );
94
-
95
- Link.displayName = "Link";
96
-
97
- export type { LinkProps };
1
+ "use client";
2
+
3
+ import React, { forwardRef } from "react";
4
+ import { cx } from "../../utils";
5
+ import { LinkProps } from "./types";
6
+
7
+ export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
8
+ (
9
+ {
10
+ children,
11
+ href,
12
+ className = "",
13
+ onClick,
14
+ variant = "unstyled",
15
+ style,
16
+ external = false,
17
+ disabled = false,
18
+ ...props
19
+ },
20
+ ref
21
+ ) => {
22
+ // Get Tailwind classes for different variants
23
+ const getVariantClasses = () => {
24
+ if (variant === "unstyled") return "";
25
+
26
+ // TODO: Add styles based on the figma design for all variants
27
+ const baseClasses =
28
+ "transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2";
29
+
30
+ const variantClasses = {
31
+ default: "text-text underline",
32
+ };
33
+
34
+ const stateClasses = [
35
+ disabled
36
+ ? "opacity-60 cursor-not-allowed pointer-events-none"
37
+ : "cursor-pointer",
38
+ ]
39
+ .filter(Boolean)
40
+ .join(" ");
41
+
42
+ return [
43
+ baseClasses,
44
+ variantClasses[variant as keyof typeof variantClasses] ||
45
+ variantClasses.default,
46
+ stateClasses,
47
+ ]
48
+ .filter(Boolean)
49
+ .join(" ");
50
+ };
51
+
52
+ const tailwindClasses = getVariantClasses();
53
+
54
+ // Handle click events
55
+ const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
56
+ if (disabled) {
57
+ event.preventDefault();
58
+ return;
59
+ }
60
+
61
+ onClick?.(event);
62
+ };
63
+
64
+ // Combine all classes
65
+ const combinedClassName = cx(
66
+ tailwindClasses,
67
+ `link--${variant}`,
68
+ disabled && "link--disabled",
69
+ className
70
+ );
71
+
72
+ // Determine link props based on external/internal
73
+ const linkProps = {
74
+ ...props,
75
+ ref,
76
+ className: combinedClassName,
77
+ style,
78
+ href: disabled ? undefined : href,
79
+ onClick: handleClick,
80
+ ...(external &&
81
+ !disabled && {
82
+ target: "_blank",
83
+ rel: "noopener noreferrer",
84
+ }),
85
+ ...(disabled && {
86
+ "aria-disabled": true,
87
+ tabIndex: -1,
88
+ }),
89
+ };
90
+
91
+ return <a {...linkProps}>{children}</a>;
92
+ }
93
+ );
94
+
95
+ Link.displayName = "Link";
96
+
97
+ export type { LinkProps };
@@ -1,25 +1,25 @@
1
- import {
2
- type AnchorHTMLAttributes,
3
- type CSSProperties,
4
- type MouseEvent,
5
- type ReactNode,
6
- } from "react";
7
-
8
- export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
9
- /** Content to render inside the link */
10
- children: ReactNode;
11
- /** URL to navigate to */
12
- href?: string;
13
- /** Custom className for the link */
14
- className?: string;
15
- /** Click handler function */
16
- onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
17
- /** Additional styling options */
18
- variant?: "default" | "unstyled";
19
- /** Custom styles */
20
- style?: CSSProperties;
21
- /** External link behavior - opens in new tab */
22
- external?: boolean;
23
- /** Disable the link */
24
- disabled?: boolean;
25
- }
1
+ import {
2
+ type AnchorHTMLAttributes,
3
+ type CSSProperties,
4
+ type MouseEvent,
5
+ type ReactNode,
6
+ } from "react";
7
+
8
+ export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
9
+ /** Content to render inside the link */
10
+ children: ReactNode;
11
+ /** URL to navigate to */
12
+ href?: string;
13
+ /** Custom className for the link */
14
+ className?: string;
15
+ /** Click handler function */
16
+ onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
17
+ /** Additional styling options */
18
+ variant?: "default" | "unstyled";
19
+ /** Custom styles */
20
+ style?: CSSProperties;
21
+ /** External link behavior - opens in new tab */
22
+ external?: boolean;
23
+ /** Disable the link */
24
+ disabled?: boolean;
25
+ }
@@ -1,88 +1,88 @@
1
- "use client";
2
-
3
- import React, { forwardRef } from "react";
4
- import { cx } from "../../utils";
5
- import { ListItem, ListItemProps } from "./list-item";
6
- import { ListProps } from "./types";
7
-
8
- export const List = forwardRef<HTMLUListElement | HTMLOListElement, ListProps>(
9
- (
10
- {
11
- type = "ul",
12
- items,
13
- className = "",
14
- renderItem,
15
- children,
16
- variant = "unstyled",
17
- style,
18
- ...props
19
- },
20
- ref
21
- ) => {
22
- // Get Tailwind classes for different variants
23
- const getVariantClasses = () => {
24
- if (variant === "unstyled") {
25
- return "";
26
- }
27
-
28
- // TODO: Add styles based on the figma design for all variants
29
- const baseClasses = "m-0 p-0";
30
- const typeClasses =
31
- type === "ol" ? "pl-6 list-decimal" : "pl-5 list-disc";
32
-
33
- return `${baseClasses} ${typeClasses}`;
34
- };
35
-
36
- const tailwindClasses = getVariantClasses();
37
- const combinedClassName = cx(
38
- tailwindClasses,
39
- `list--${type}`,
40
- `list--${variant}`,
41
- className
42
- );
43
-
44
- // Render items if provided
45
- const renderItems = () => {
46
- if (!items || items.length === 0) return null;
47
-
48
- return items.map((item, index) => {
49
- if (renderItem) {
50
- return renderItem(item, index);
51
- }
52
-
53
- return (
54
- <ListItem
55
- key={item.id || index}
56
- className={item.className}
57
- variant={variant}
58
- >
59
- {item.content}
60
- </ListItem>
61
- );
62
- });
63
- };
64
-
65
- const content = children || renderItems();
66
-
67
- // Create props object to avoid duplication
68
- const listProps = {
69
- className: combinedClassName,
70
- style,
71
- ...props,
72
- children: content,
73
- };
74
-
75
- // Return appropriate list type with conditional rendering for proper TypeScript inference
76
- if (type === "ol") {
77
- return <ol {...listProps} ref={ref as React.Ref<HTMLOListElement>} />;
78
- }
79
-
80
- return <ul {...listProps} ref={ref as React.Ref<HTMLUListElement>} />;
81
- }
82
- );
83
-
84
- List.displayName = "List";
85
-
86
- export { ListItem };
87
-
88
- export type { ListProps, ListItemProps };
1
+ "use client";
2
+
3
+ import React, { forwardRef } from "react";
4
+ import { cx } from "../../utils";
5
+ import { ListItem, ListItemProps } from "./list-item";
6
+ import { ListProps } from "./types";
7
+
8
+ export const List = forwardRef<HTMLUListElement | HTMLOListElement, ListProps>(
9
+ (
10
+ {
11
+ type = "ul",
12
+ items,
13
+ className = "",
14
+ renderItem,
15
+ children,
16
+ variant = "unstyled",
17
+ style,
18
+ ...props
19
+ },
20
+ ref
21
+ ) => {
22
+ // Get Tailwind classes for different variants
23
+ const getVariantClasses = () => {
24
+ if (variant === "unstyled") {
25
+ return "";
26
+ }
27
+
28
+ // TODO: Add styles based on the figma design for all variants
29
+ const baseClasses = "m-0 p-0";
30
+ const typeClasses =
31
+ type === "ol" ? "pl-6 list-decimal" : "pl-5 list-disc";
32
+
33
+ return `${baseClasses} ${typeClasses}`;
34
+ };
35
+
36
+ const tailwindClasses = getVariantClasses();
37
+ const combinedClassName = cx(
38
+ tailwindClasses,
39
+ `list--${type}`,
40
+ `list--${variant}`,
41
+ className
42
+ );
43
+
44
+ // Render items if provided
45
+ const renderItems = () => {
46
+ if (!items || items.length === 0) return null;
47
+
48
+ return items.map((item, index) => {
49
+ if (renderItem) {
50
+ return renderItem(item, index);
51
+ }
52
+
53
+ return (
54
+ <ListItem
55
+ key={item.id || index}
56
+ className={item.className}
57
+ variant={variant}
58
+ >
59
+ {item.content}
60
+ </ListItem>
61
+ );
62
+ });
63
+ };
64
+
65
+ const content = children || renderItems();
66
+
67
+ // Create props object to avoid duplication
68
+ const listProps = {
69
+ className: combinedClassName,
70
+ style,
71
+ ...props,
72
+ children: content,
73
+ };
74
+
75
+ // Return appropriate list type with conditional rendering for proper TypeScript inference
76
+ if (type === "ol") {
77
+ return <ol {...listProps} ref={ref as React.Ref<HTMLOListElement>} />;
78
+ }
79
+
80
+ return <ul {...listProps} ref={ref as React.Ref<HTMLUListElement>} />;
81
+ }
82
+ );
83
+
84
+ List.displayName = "List";
85
+
86
+ export { ListItem };
87
+
88
+ export type { ListProps, ListItemProps };
@@ -1,38 +1,38 @@
1
- "use client";
2
-
3
- import { forwardRef } from "react";
4
- import { cx } from "../../../utils";
5
- import { ListItemProps } from "./types";
6
-
7
- export const ListItem = forwardRef<HTMLLIElement, ListItemProps>(
8
- (
9
- { children, className = "", variant = "unstyled", style, ...props },
10
- ref
11
- ) => {
12
- // Get Tailwind classes for different variants
13
- const getVariantClasses = () => {
14
- if (variant === "unstyled") return "";
15
-
16
- // TODO: Add styles based on the figma design for all variants
17
- return "mb-1 leading-6";
18
- };
19
-
20
- const tailwindClasses = getVariantClasses();
21
- const combinedClassName = cx(
22
- tailwindClasses,
23
- "list-item",
24
- `list-item--${variant}`,
25
- className
26
- );
27
-
28
- return (
29
- <li ref={ref} className={combinedClassName} style={style} {...props}>
30
- {children}
31
- </li>
32
- );
33
- }
34
- );
35
-
36
- ListItem.displayName = "ListItem";
37
-
38
- export type { ListItemProps };
1
+ "use client";
2
+
3
+ import { forwardRef } from "react";
4
+ import { cx } from "../../../utils";
5
+ import { ListItemProps } from "./types";
6
+
7
+ export const ListItem = forwardRef<HTMLLIElement, ListItemProps>(
8
+ (
9
+ { children, className = "", variant = "unstyled", style, ...props },
10
+ ref
11
+ ) => {
12
+ // Get Tailwind classes for different variants
13
+ const getVariantClasses = () => {
14
+ if (variant === "unstyled") return "";
15
+
16
+ // TODO: Add styles based on the figma design for all variants
17
+ return "mb-1 leading-6";
18
+ };
19
+
20
+ const tailwindClasses = getVariantClasses();
21
+ const combinedClassName = cx(
22
+ tailwindClasses,
23
+ "list-item",
24
+ `list-item--${variant}`,
25
+ className
26
+ );
27
+
28
+ return (
29
+ <li ref={ref} className={combinedClassName} style={style} {...props}>
30
+ {children}
31
+ </li>
32
+ );
33
+ }
34
+ );
35
+
36
+ ListItem.displayName = "ListItem";
37
+
38
+ export type { ListItemProps };
@@ -1,13 +1,13 @@
1
- import { CSSProperties, LiHTMLAttributes, ReactNode } from "react";
2
- import { ListVariant } from "../types";
3
-
4
- export interface ListItemProps extends LiHTMLAttributes<HTMLLIElement> {
5
- /** Content to render inside the list item */
6
- children: ReactNode;
7
- /** Custom className for the list item */
8
- className?: string;
9
- /** Additional styling options */
10
- variant?: ListVariant;
11
- /** Custom styles */
12
- style?: CSSProperties;
13
- }
1
+ import { CSSProperties, LiHTMLAttributes, ReactNode } from "react";
2
+ import { ListVariant } from "../types";
3
+
4
+ export interface ListItemProps extends LiHTMLAttributes<HTMLLIElement> {
5
+ /** Content to render inside the list item */
6
+ children: ReactNode;
7
+ /** Custom className for the list item */
8
+ className?: string;
9
+ /** Additional styling options */
10
+ variant?: ListVariant;
11
+ /** Custom styles */
12
+ style?: CSSProperties;
13
+ }
@@ -1,29 +1,29 @@
1
- import { CSSProperties, HTMLAttributes, ReactNode } from "react";
2
-
3
- export type ListType = "ul" | "ol";
4
- export type ListVariant = "default" | "unstyled";
5
-
6
- export type ListItem = {
7
- id: string | number;
8
- content: ReactNode;
9
- className?: string;
10
- [key: string]: any;
11
- };
12
-
13
- export interface ListProps
14
- extends Omit<HTMLAttributes<HTMLUListElement | HTMLOListElement>, "type"> {
15
- /** List type - unordered (ul) or ordered (ol) */
16
- type?: ListType;
17
- /** Array of items to render */
18
- items?: ListItem[];
19
- /** Custom className for the list */
20
- className?: string;
21
- /** Custom item renderer function */
22
- renderItem?: (item: ListItem, index: number) => ReactNode;
23
- /** Children to render instead of items */
24
- children?: ReactNode;
25
- /** Additional styling options */
26
- variant?: ListVariant;
27
- /** Custom styles */
28
- style?: CSSProperties;
29
- }
1
+ import { CSSProperties, HTMLAttributes, ReactNode } from "react";
2
+
3
+ export type ListType = "ul" | "ol";
4
+ export type ListVariant = "default" | "unstyled";
5
+
6
+ export type ListItem = {
7
+ id: string | number;
8
+ content: ReactNode;
9
+ className?: string;
10
+ [key: string]: any;
11
+ };
12
+
13
+ export interface ListProps
14
+ extends Omit<HTMLAttributes<HTMLUListElement | HTMLOListElement>, "type"> {
15
+ /** List type - unordered (ul) or ordered (ol) */
16
+ type?: ListType;
17
+ /** Array of items to render */
18
+ items?: ListItem[];
19
+ /** Custom className for the list */
20
+ className?: string;
21
+ /** Custom item renderer function */
22
+ renderItem?: (item: ListItem, index: number) => ReactNode;
23
+ /** Children to render instead of items */
24
+ children?: ReactNode;
25
+ /** Additional styling options */
26
+ variant?: ListVariant;
27
+ /** Custom styles */
28
+ style?: CSSProperties;
29
+ }
@@ -1,44 +1,44 @@
1
- import React from "react";
2
- import { cx } from "../../utils";
3
- import type { IconProps } from "./types";
4
-
5
- const MaterialIcon: React.FC<IconProps> = ({
6
- name,
7
- fill = 0,
8
- opticalSize = "48dp",
9
- weight = "200",
10
- emphasis = 145,
11
- size = 24,
12
- color = "currentColor",
13
- style = {},
14
- className,
15
- onClick,
16
- dataTestId,
17
- }) => {
18
- const fontVariationSettings = `'FILL' ${fill}, 'wght' ${weight}, 'GRAD' ${emphasis}, 'opsz' ${opticalSize.substring(0, 2)}`;
19
-
20
- const combinedStyle: React.CSSProperties = {
21
- fontVariationSettings,
22
- fontSize: `${size}px`,
23
- fontFamily: "'Material Symbols Rounded'",
24
- color: color || "currentColor",
25
- ...style,
26
- };
27
-
28
- return (
29
- <span
30
- style={combinedStyle}
31
- className={cx("material-symbols-rounded", className)}
32
- onClick={onClick}
33
- data-testid={dataTestId}
34
- >
35
- {name}
36
- </span>
37
- );
38
- };
39
-
40
- export { MaterialIcon };
41
-
42
- MaterialIcon.displayName = "MaterialIcon";
43
-
44
- export type { IconProps, IconName } from "./types";
1
+ import React from "react";
2
+ import { cx } from "../../utils";
3
+ import type { IconProps } from "./types";
4
+
5
+ const MaterialIcon: React.FC<IconProps> = ({
6
+ name,
7
+ fill = 0,
8
+ opticalSize = "48dp",
9
+ weight = "200",
10
+ emphasis = 145,
11
+ size = 24,
12
+ color = "currentColor",
13
+ style = {},
14
+ className,
15
+ onClick,
16
+ dataTestId,
17
+ }) => {
18
+ const fontVariationSettings = `'FILL' ${fill}, 'wght' ${weight}, 'GRAD' ${emphasis}, 'opsz' ${opticalSize.substring(0, 2)}`;
19
+
20
+ const combinedStyle: React.CSSProperties = {
21
+ fontVariationSettings,
22
+ fontSize: `${size}px`,
23
+ fontFamily: "'Material Symbols Rounded'",
24
+ color: color || "currentColor",
25
+ ...style,
26
+ };
27
+
28
+ return (
29
+ <span
30
+ style={combinedStyle}
31
+ className={cx("material-symbols-rounded", className)}
32
+ onClick={onClick}
33
+ data-testid={dataTestId}
34
+ >
35
+ {name}
36
+ </span>
37
+ );
38
+ };
39
+
40
+ export { MaterialIcon };
41
+
42
+ MaterialIcon.displayName = "MaterialIcon";
43
+
44
+ export type { IconProps, IconName } from "./types";