@windstream/react-shared-components 0.1.59 → 0.1.62

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/core.d.ts CHANGED
@@ -63,7 +63,7 @@ declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAtt
63
63
  size?: "slim" | "medium" | "large" | undefined;
64
64
  label?: string | undefined;
65
65
  errorText?: string | undefined;
66
- prefixIconName?: "search" | "location_on" | undefined;
66
+ prefixIconName?: "location_on" | "search" | undefined;
67
67
  prefixIconSize?: 20 | 24 | 40 | 48 | undefined;
68
68
  prefixIconFill?: boolean | undefined;
69
69
  suffixIconFill?: boolean | undefined;
package/dist/index.d.ts CHANGED
@@ -63,7 +63,7 @@ declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAtt
63
63
  size?: "slim" | "medium" | "large" | undefined;
64
64
  label?: string | undefined;
65
65
  errorText?: string | undefined;
66
- prefixIconName?: "location_on" | "search" | undefined;
66
+ prefixIconName?: "search" | "location_on" | undefined;
67
67
  prefixIconSize?: 20 | 24 | 40 | 48 | undefined;
68
68
  prefixIconFill?: boolean | undefined;
69
69
  suffixIconFill?: boolean | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windstream/react-shared-components",
3
- "version": "0.1.59",
3
+ "version": "0.1.62",
4
4
  "type": "module",
5
5
  "description": "Shared React components for Kinetic applications",
6
6
  "main": "dist/index.js",
@@ -78,23 +78,14 @@ function buildPageItems(current: number, total: number): (number | "...")[] {
78
78
  if (total <= 7) {
79
79
  return Array.from({ length: total }, (_, i) => i + 1);
80
80
  }
81
- const items: (number | "...")[] = [];
82
- items.push(1);
83
81
 
84
- if (current > 3) {
85
- items.push("...");
82
+ if (current <= 4) {
83
+ return [1, 2, 3, 4, 5, "...", total];
86
84
  }
87
- const rangeStart = Math.max(2, current - 1);
88
- const rangeEnd = Math.min(total - 1, current + 1);
89
85
 
90
- for (let i = rangeStart; i <= rangeEnd; i++) {
91
- items.push(i);
86
+ if (current >= total - 3) {
87
+ return [1, "...", total - 4, total - 3, total - 2, total - 1, total];
92
88
  }
93
89
 
94
- if (current < total - 2) {
95
- items.push("...");
96
- }
97
-
98
- items.push(total);
99
- return items;
90
+ return [1, "...", current - 1, current, current + 1, "...", total];
100
91
  }
@@ -14,6 +14,7 @@ export function BlogGridBase({
14
14
  categoryOptions,
15
15
  onCategoryChange,
16
16
  onPageChange,
17
+ imageComponent,
17
18
  }: BlogGridBaseProps) {
18
19
  function handleCategoryChange(value: unknown) {
19
20
  if (!value || Array.isArray(value)) return;
@@ -37,28 +38,30 @@ export function BlogGridBase({
37
38
  recent articles
38
39
  </Text>
39
40
 
40
- <div className="flex w-full flex-col-reverse gap-3 md:w-auto md:flex-row md:items-center md:gap-6">
41
- {/* Showing count */}
42
- <Text className="whitespace-nowrap text-center text-label3 font-bold text-text-info md:text-right md:text-label2">
43
- <Text as="span" className="hidden md:block">
44
- showing
45
- </Text>
46
- <strong className="block text-nowrap font-bold text-text-info">
47
- <Text as="span" className="md:hidden">
48
- showing{" "}
41
+ {categoryOptions.length > 0 && (
42
+ <div className="flex w-full flex-col-reverse gap-3 md:w-auto md:flex-row md:items-center md:gap-6">
43
+ {/* Showing count */}
44
+ <Text className="whitespace-nowrap text-center text-label3 font-bold text-text-info md:text-right md:text-label2">
45
+ <Text as="span" className="hidden md:block">
46
+ showing
49
47
  </Text>
50
- {paginatedArticles.length} of {totalArticles} articles
51
- </strong>
52
- </Text>
48
+ <strong className="block text-nowrap font-bold text-text-info">
49
+ <Text as="span" className="md:hidden">
50
+ showing{" "}
51
+ </Text>
52
+ {paginatedArticles.length} of {totalArticles} articles
53
+ </strong>
54
+ </Text>
53
55
 
54
- {/* Filter dropdown */}
55
- <Select
56
- options={categoryOptions}
57
- value={selectedCategory}
58
- onChange={handleCategoryChange}
59
- className="w-full md:w-[280px]"
60
- />
61
- </div>
56
+ {/* Filter dropdown */}
57
+ <Select
58
+ options={categoryOptions}
59
+ value={selectedCategory}
60
+ onChange={handleCategoryChange}
61
+ className="w-full md:w-[280px]"
62
+ />
63
+ </div>
64
+ )}
62
65
  </div>
63
66
 
64
67
  {/* Articles grid */}
@@ -89,6 +92,7 @@ export function BlogGridBase({
89
92
  date={article.blogCreationDate}
90
93
  category={article.category}
91
94
  image={coverImage}
95
+ imageComponent={imageComponent}
92
96
  index={index}
93
97
  />
94
98
  );
@@ -1,3 +1,6 @@
1
+ import React from "react";
2
+ import { BlogCardImageProps } from "@shared/contentful/blocks/cards/blog-card/types";
3
+
1
4
  export interface BlogCardProps {
2
5
  slug: string;
3
6
  title?: string;
@@ -21,6 +24,8 @@ export interface BlogGridBaseProps {
21
24
  categoryOptions: BlogCategoryOption[];
22
25
  onCategoryChange?: (category: BlogCategoryOption) => void;
23
26
  onPageChange?: (page: number) => void;
27
+ /** Pass next/image's Image component here to enable image optimization */
28
+ imageComponent?: React.ComponentType<BlogCardImageProps>;
24
29
  }
25
30
 
26
31
  export interface BlogCategoryOption {
@@ -1,15 +1,15 @@
1
1
  import React from "react";
2
2
  import { BlogCardProps } from "./types";
3
- import * as _NextImage from "next/image";
4
3
  import * as _NextLink from "next/link";
5
4
 
6
5
  // import { Button } from "@shared/components/button";
7
6
  import { MaterialIcon } from "@shared/components/material-icon";
8
7
  import { Text } from "@shared/components/text";
9
8
 
10
- // CJS/ESM interop: next/image and next/link export { default: Fn } in CJS context
11
- const Image = ((_NextImage as any).default ??
12
- _NextImage) as typeof import("next/image").default;
9
+ // CJS/ESM interop: next/link uses standard __esModule exports so this is safe.
10
+ // next/image is intentionally avoided — its image-external.js uses the
11
+ // `0 && (module.exports = {...})` tree-shaking hint which confuses webpack's
12
+ // CJS→ESM interop and causes "got: object" errors in consuming apps.
13
13
  const Link = ((_NextLink as any).default ??
14
14
  _NextLink) as typeof import("next/link").default;
15
15
 
@@ -20,6 +20,7 @@ export const BlogCard: React.FC<BlogCardProps> = ({
20
20
  date,
21
21
  category,
22
22
  image,
23
+ imageComponent: ImageComponent,
23
24
  readMoreText = "Read more",
24
25
  asGrid = true,
25
26
  lgWidth,
@@ -41,14 +42,26 @@ export const BlogCard: React.FC<BlogCardProps> = ({
41
42
  <Link href={href} tabIndex={-1} aria-hidden="true" className="block">
42
43
  <div className="h-[232px] w-full flex-shrink-0 overflow-hidden bg-gray-100">
43
44
  {image ? (
44
- <Image
45
- src={image.src}
46
- alt={image.alt}
47
- width={image.width}
48
- height={image.height}
49
- className="h-full w-full object-cover transition-transform duration-300 hover:scale-[1.03]"
50
- sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"
51
- />
45
+ ImageComponent ? (
46
+ <ImageComponent
47
+ src={image.src}
48
+ alt={image.alt}
49
+ width={image.width}
50
+ height={image.height}
51
+ className="h-full w-full object-cover transition-transform duration-300 hover:scale-[1.03]"
52
+ sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"
53
+ />
54
+ ) : (
55
+ <img
56
+ src={image.src}
57
+ alt={image.alt}
58
+ width={image.width}
59
+ height={image.height}
60
+ loading="lazy"
61
+ decoding="async"
62
+ className="h-full w-full object-cover transition-transform duration-300 hover:scale-[1.03]"
63
+ />
64
+ )
52
65
  ) : (
53
66
  <div
54
67
  className="h-full w-full bg-gradient-to-br from-gray-200 to-gray-100"
@@ -1,3 +1,17 @@
1
+ import React from "react";
2
+
3
+ export interface BlogCardImageProps {
4
+ src: string;
5
+ alt: string;
6
+ width: number;
7
+ height: number;
8
+ className?: string;
9
+ sizes?: string;
10
+ loading?: "lazy" | "eager";
11
+ decoding?: "async" | "auto" | "sync";
12
+ [key: string]: unknown;
13
+ }
14
+
1
15
  export interface BlogCardProps {
2
16
  href: string;
3
17
  title?: string;
@@ -10,6 +24,8 @@ export interface BlogCardProps {
10
24
  width: number;
11
25
  height: number;
12
26
  };
27
+ /** Pass next/image's Image component here to enable image optimization */
28
+ imageComponent?: React.ComponentType<BlogCardImageProps>;
13
29
  readMoreText?: string;
14
30
  asGrid?: boolean;
15
31
  lgWidth?: string;