@windstream/react-shared-components 0.0.21 → 0.0.23

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 (53) hide show
  1. package/dist/contentful/index.d.ts +13 -4
  2. package/dist/contentful/index.esm.js +3 -1
  3. package/dist/contentful/index.esm.js.map +1 -1
  4. package/dist/contentful/index.js +3 -1
  5. package/dist/contentful/index.js.map +1 -1
  6. package/dist/core.d.ts +4 -2
  7. package/dist/index.d.ts +6 -4
  8. package/dist/index.esm.js +3 -1
  9. package/dist/index.esm.js.map +1 -1
  10. package/dist/index.js +3 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/next/index.d.ts +10 -0
  13. package/dist/next/index.esm.js +4 -0
  14. package/dist/next/index.esm.js.map +1 -0
  15. package/dist/next/index.js +4 -0
  16. package/dist/next/index.js.map +1 -0
  17. package/dist/styles.css +1 -1
  18. package/package.json +17 -1
  19. package/src/components/accordion/index.tsx +2 -0
  20. package/src/components/alert-card/types.ts +9 -9
  21. package/src/components/brand-button/index.tsx +2 -0
  22. package/src/components/button/index.tsx +2 -0
  23. package/src/components/button/types.ts +14 -14
  24. package/src/components/checkbox/index.tsx +2 -0
  25. package/src/components/collapse/index.tsx +2 -0
  26. package/src/components/image/index.tsx +6 -3
  27. package/src/components/image/types.ts +7 -2
  28. package/src/components/input/index.tsx +2 -0
  29. package/src/components/link/index.tsx +2 -0
  30. package/src/components/link/types.ts +25 -25
  31. package/src/components/list/index.tsx +88 -86
  32. package/src/components/list/list-item/index.tsx +38 -36
  33. package/src/components/list/list-item/types.ts +13 -13
  34. package/src/components/list/types.ts +29 -29
  35. package/src/components/material-icon/index.tsx +44 -44
  36. package/src/components/material-icon/types.ts +31 -31
  37. package/src/components/modal/index.tsx +2 -0
  38. package/src/components/next-image/index.tsx +25 -0
  39. package/src/components/next-image/types.ts +1 -0
  40. package/src/components/see-more/index.tsx +2 -0
  41. package/src/components/select/index.tsx +2 -0
  42. package/src/components/skeleton/index.tsx +61 -61
  43. package/src/components/text/index.tsx +2 -0
  44. package/src/components/text/types.ts +45 -45
  45. package/src/contentful/blocks/floating-banner/FloatingBanner.stories.tsx +34 -23
  46. package/src/contentful/blocks/floating-banner/index.tsx +99 -11
  47. package/src/contentful/blocks/floating-banner/types.ts +22 -1
  48. package/src/contentful/blocks/image-promo-bar/ImagePromoBar.stories.tsx +1 -1
  49. package/src/contentful/blocks/primary-hero/PrimaryHero.stories.tsx +1 -1
  50. package/src/hooks/use-body-scroll-lock.ts +2 -0
  51. package/src/next/index.ts +5 -0
  52. package/src/setupTests.ts +46 -46
  53. package/src/types/global.d.ts +9 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windstream/react-shared-components",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "type": "module",
5
5
  "description": "Shared React components for Kinetic applications",
6
6
  "main": "dist/index.js",
@@ -16,6 +16,9 @@
16
16
  ],
17
17
  "contentful": [
18
18
  "./dist/contentful/index.d.ts"
19
+ ],
20
+ "next": [
21
+ "./dist/next/index.d.ts"
19
22
  ]
20
23
  }
21
24
  },
@@ -40,6 +43,11 @@
40
43
  "import": "./dist/contentful/index.esm.js",
41
44
  "require": "./dist/contentful/index.js"
42
45
  },
46
+ "./next": {
47
+ "types": "./dist/next/index.d.ts",
48
+ "import": "./dist/next/index.esm.js",
49
+ "require": "./dist/next/index.js"
50
+ },
43
51
  "./tailwind.config": {
44
52
  "types": "./tailwind.config.cjs",
45
53
  "require": "./tailwind.config.cjs",
@@ -83,9 +91,15 @@
83
91
  "build-storybook": "storybook build"
84
92
  },
85
93
  "peerDependencies": {
94
+ "next": ">=13.0.0",
86
95
  "react": ">=18.0.0",
87
96
  "react-dom": ">=18.0.0"
88
97
  },
98
+ "peerDependenciesMeta": {
99
+ "next": {
100
+ "optional": true
101
+ }
102
+ },
89
103
  "dependencies": {
90
104
  "@types/react-modal": "3.16.3",
91
105
  "@types/react-transition-group": "4.4.12",
@@ -123,6 +137,7 @@
123
137
  "eslint-plugin-storybook": "9.1.3",
124
138
  "jest": "30.0.5",
125
139
  "jest-environment-jsdom": "30.0.5",
140
+ "next": "^16.1.6",
126
141
  "postcss": "8.5.6",
127
142
  "postcss-loader": "8.1.1",
128
143
  "prettier": "3.6.2",
@@ -132,6 +147,7 @@
132
147
  "rollup-plugin-dts": "6.2.3",
133
148
  "rollup-plugin-peer-deps-external": "2.2.4",
134
149
  "rollup-plugin-postcss": "4.0.2",
150
+ "rollup-plugin-preserve-directives": "^0.4.0",
135
151
  "storybook": "9.1.3",
136
152
  "tailwind-merge": "3.3.1",
137
153
  "tailwindcss": "3.4.17",
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { useState } from "react";
2
4
 
3
5
  import { AccordionProps } from "@shared/components/accordion/types";
@@ -1,9 +1,9 @@
1
- import { ReactNode } from "react";
2
-
3
- import { TextVariant } from "@shared/components/text";
4
-
5
- export type AlertCardProps = {
6
- errorMessage?: string | ReactNode;
7
- className?: string;
8
- textVariant?: TextVariant;
9
- };
1
+ import { ReactNode } from "react";
2
+
3
+ import { TextVariant } from "@shared/components/text";
4
+
5
+ export type AlertCardProps = {
6
+ errorMessage?: string | ReactNode;
7
+ className?: string;
8
+ textVariant?: TextVariant;
9
+ };
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { forwardRef } from "react";
2
4
  import { getLabelSizeBasedOnButtonSize, sizeToClassNames } from "./helpers";
3
5
 
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { forwardRef } from "react";
2
4
 
3
5
  import { ButtonProps } from "@shared/components/button/types";
@@ -1,14 +1,14 @@
1
- import {
2
- type ButtonHTMLAttributes,
3
- type CSSProperties,
4
- type ReactNode,
5
- } from "react";
6
-
7
- export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
8
- /** Content to render inside the button */
9
- children?: ReactNode;
10
- /** Custom className for the button */
11
- className?: string;
12
- /** Custom styles */
13
- style?: CSSProperties;
14
- }
1
+ import {
2
+ type ButtonHTMLAttributes,
3
+ type CSSProperties,
4
+ type ReactNode,
5
+ } from "react";
6
+
7
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
8
+ /** Content to render inside the button */
9
+ children?: ReactNode;
10
+ /** Custom className for the button */
11
+ className?: string;
12
+ /** Custom styles */
13
+ style?: CSSProperties;
14
+ }
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import React, { useCallback } from "react";
2
4
  import { CheckboxProps } from "./types";
3
5
 
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { useEffect, useRef, useState } from "react";
2
4
  import { CollapsibleProps } from "./types";
3
5
 
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { forwardRef } from "react";
2
4
 
3
5
  import type { ImageProps } from "@shared/components/image/types";
@@ -8,9 +10,10 @@ export const Image = forwardRef<HTMLImageElement, ImageProps>(
8
10
  const combinedClassName = cx(className);
9
11
 
10
12
  if (ImageComponent) {
11
- return (
12
- <ImageComponent ref={ref} className={combinedClassName} {...rest} />
13
- );
13
+ // Cast to any to allow ref forwarding for custom components
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ const Component = ImageComponent as any;
16
+ return <Component ref={ref} className={combinedClassName} {...rest} />;
14
17
  }
15
18
 
16
19
  return <img ref={ref} className={combinedClassName} {...rest} />;
@@ -1,4 +1,4 @@
1
- import type { ComponentType, ImgHTMLAttributes } from "react";
1
+ import type { ComponentType, ForwardRefExoticComponent, ImgHTMLAttributes, RefAttributes } from "react";
2
2
 
3
3
  /**
4
4
  * Props passed to the custom image component when using the `as` prop.
@@ -22,7 +22,12 @@ export interface ImageComponentProps
22
22
  quality?: number;
23
23
  }
24
24
 
25
+ /** Type for custom image component that supports ref forwarding */
26
+ type ImageComponent =
27
+ | ComponentType<ImageComponentProps>
28
+ | ForwardRefExoticComponent<ImageComponentProps & RefAttributes<HTMLImageElement>>;
29
+
25
30
  export interface ImageProps extends ImageComponentProps {
26
31
  /** Custom component to render instead of native img (e.g. next/image) */
27
- as?: ComponentType<ImageComponentProps>;
32
+ as?: ImageComponent;
28
33
  }
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import {
2
4
  FocusEventHandler,
3
5
  forwardRef,
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import React, { forwardRef } from "react";
2
4
  import { cx } from "../../utils";
3
5
  import { LinkProps } from "./types";
@@ -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,86 +1,88 @@
1
- import React, { forwardRef } from "react";
2
- import { cx } from "../../utils";
3
- import { ListItem, ListItemProps } from "./list-item";
4
- import { ListProps } from "./types";
5
-
6
- export const List = forwardRef<HTMLUListElement | HTMLOListElement, ListProps>(
7
- (
8
- {
9
- type = "ul",
10
- items,
11
- className = "",
12
- renderItem,
13
- children,
14
- variant = "unstyled",
15
- style,
16
- ...props
17
- },
18
- ref
19
- ) => {
20
- // Get Tailwind classes for different variants
21
- const getVariantClasses = () => {
22
- if (variant === "unstyled") {
23
- return "";
24
- }
25
-
26
- // TODO: Add styles based on the figma design for all variants
27
- const baseClasses = "m-0 p-0";
28
- const typeClasses =
29
- type === "ol" ? "pl-6 list-decimal" : "pl-5 list-disc";
30
-
31
- return `${baseClasses} ${typeClasses}`;
32
- };
33
-
34
- const tailwindClasses = getVariantClasses();
35
- const combinedClassName = cx(
36
- tailwindClasses,
37
- `list--${type}`,
38
- `list--${variant}`,
39
- className
40
- );
41
-
42
- // Render items if provided
43
- const renderItems = () => {
44
- if (!items || items.length === 0) return null;
45
-
46
- return items.map((item, index) => {
47
- if (renderItem) {
48
- return renderItem(item, index);
49
- }
50
-
51
- return (
52
- <ListItem
53
- key={item.id || index}
54
- className={item.className}
55
- variant={variant}
56
- >
57
- {item.content}
58
- </ListItem>
59
- );
60
- });
61
- };
62
-
63
- const content = children || renderItems();
64
-
65
- // Create props object to avoid duplication
66
- const listProps = {
67
- className: combinedClassName,
68
- style,
69
- ...props,
70
- children: content,
71
- };
72
-
73
- // Return appropriate list type with conditional rendering for proper TypeScript inference
74
- if (type === "ol") {
75
- return <ol {...listProps} ref={ref as React.Ref<HTMLOListElement>} />;
76
- }
77
-
78
- return <ul {...listProps} ref={ref as React.Ref<HTMLUListElement>} />;
79
- }
80
- );
81
-
82
- List.displayName = "List";
83
-
84
- export { ListItem };
85
-
86
- 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,36 +1,38 @@
1
- import { forwardRef } from "react";
2
- import { cx } from "../../../utils";
3
- import { ListItemProps } from "./types";
4
-
5
- export const ListItem = forwardRef<HTMLLIElement, ListItemProps>(
6
- (
7
- { children, className = "", variant = "unstyled", style, ...props },
8
- ref
9
- ) => {
10
- // Get Tailwind classes for different variants
11
- const getVariantClasses = () => {
12
- if (variant === "unstyled") return "";
13
-
14
- // TODO: Add styles based on the figma design for all variants
15
- return "mb-1 leading-6";
16
- };
17
-
18
- const tailwindClasses = getVariantClasses();
19
- const combinedClassName = cx(
20
- tailwindClasses,
21
- "list-item",
22
- `list-item--${variant}`,
23
- className
24
- );
25
-
26
- return (
27
- <li ref={ref} className={combinedClassName} style={style} {...props}>
28
- {children}
29
- </li>
30
- );
31
- }
32
- );
33
-
34
- ListItem.displayName = "ListItem";
35
-
36
- 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
+ }