@4alldigital/foundation-ui--core 3.9.0 → 3.11.0

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 (133) hide show
  1. package/package.json +5 -2
  2. package/src/components/Accordion/Accordion.tsx +3 -1
  3. package/src/components/AddressForm/AddressForm.tsx +4 -1
  4. package/src/components/AnimationCounter/AnimationCounter.tsx +3 -1
  5. package/src/components/AnimationSet1/AnimationSet1.tsx +3 -1
  6. package/src/components/Authenticator/Authenticator.tsx +2 -0
  7. package/src/components/Avatar/Avatar.tsx +2 -0
  8. package/src/components/Banner/Banner.tsx +1 -1
  9. package/src/components/Blockquote/Blockquote.tsx +1 -1
  10. package/src/components/Button/Button.tsx +1 -2
  11. package/src/components/ButtonDeprecated/Button.tsx +3 -1
  12. package/src/components/ButtonGroup/ButtonGroup.tsx +1 -1
  13. package/src/components/Card/Card.types.ts +3 -3
  14. package/src/components/Card/types/CardBasic/CardBasic.tsx +44 -133
  15. package/src/components/Card/types/CardData/CardData.tsx +3 -1
  16. package/src/components/Card/types/CardHorz/CardHorz.tsx +3 -1
  17. package/src/components/Card/types/CardIcon/CardIcon.tsx +3 -1
  18. package/src/components/Card/types/CardMedia/CardMedia.tsx +3 -1
  19. package/src/components/Card/types/CardVideo/CardVideo.tsx +3 -1
  20. package/src/components/Carousel/Carousel.tsx +3 -1
  21. package/src/components/Cart/Cart.tsx +15 -5
  22. package/src/components/Checkbox/Checkbox.tsx +4 -4
  23. package/src/components/Chip/Chip.tsx +3 -1
  24. package/src/components/Collapsible/Collapsible.tsx +1 -1
  25. package/src/components/Container/Container.tsx +1 -1
  26. package/src/components/ContentPageLayout/ContentPageLayout.tsx +1 -1
  27. package/src/components/ContentRowsLayout/ContentRowsLayout.tsx +1 -1
  28. package/src/components/Copy/Copy.tsx +1 -1
  29. package/src/components/DisplayHeading/DisplayHeading.tsx +1 -1
  30. package/src/components/ErrorBoundary/ErrorBoundary.tsx +44 -0
  31. package/src/components/ErrorBoundary/ErrorBoundary.types.ts +12 -0
  32. package/src/components/ErrorBoundary/index.ts +2 -0
  33. package/src/components/FileUpload/FileUpload.tsx +3 -1
  34. package/src/components/Footer/Footer.tsx +3 -1
  35. package/src/components/Form/Form.tsx +10 -4
  36. package/src/components/Form/Form.types.ts +4 -3
  37. package/src/components/FormField/FormField.tsx +12 -10
  38. package/src/components/FormSelect/FormSelect.tsx +2 -2
  39. package/src/components/FormSelect/FormSelect.types.ts +5 -11
  40. package/src/components/FullScreenVideoModal/FullScreenVideoModal.tsx +3 -1
  41. package/src/components/Header/Header.tsx +27 -9
  42. package/src/components/Heading/Heading.tsx +12 -19
  43. package/src/components/Heading/Heading.types.ts +1 -1
  44. package/src/components/Hero/Hero.tsx +1 -1
  45. package/src/components/Hr/Hr.tsx +1 -1
  46. package/src/components/HtmlContent/HtmlContent.tsx +1 -1
  47. package/src/components/Image/Image.tsx +1 -1
  48. package/src/components/Label/Label.tsx +1 -1
  49. package/src/components/Link/Link.tsx +3 -1
  50. package/src/components/List/List.tsx +1 -1
  51. package/src/components/ListItem/ListItem.tsx +3 -1
  52. package/src/components/Loader/Loader.tsx +1 -1
  53. package/src/components/Logo/Logo.tsx +1 -1
  54. package/src/components/Menu/Menu.tsx +1 -1
  55. package/src/components/Notice/Notice.tsx +3 -1
  56. package/src/components/OTPInput/OTPInput.tsx +4 -2
  57. package/src/components/PanelCards/PanelCards.tsx +3 -1
  58. package/src/components/PanelCustom/PanelCustom.tsx +1 -1
  59. package/src/components/PanelFeature/PanelFeature.tsx +1 -1
  60. package/src/components/PanelHero/PanelHero.tsx +3 -1
  61. package/src/components/PanelIntro/PanelIntro.tsx +3 -1
  62. package/src/components/PanelProduct/PanelProduct.tsx +1 -1
  63. package/src/components/PanelScroller/PanelScroller.tsx +3 -1
  64. package/src/components/PanelVideo/PanelVideo.tsx +3 -1
  65. package/src/components/ProductCard/ProductCard.tsx +2 -0
  66. package/src/components/ProductDetail/ProductDetail.tsx +2 -0
  67. package/src/components/Radio/Radio.tsx +1 -1
  68. package/src/components/Schedule/Schedule.tsx +2 -2
  69. package/src/components/ScheduleItem/ScheduleItem.tsx +2 -0
  70. package/src/components/Screen/Screen.tsx +1 -1
  71. package/src/components/ShadcnCarousel/ShadcnCarousel.tsx +2 -0
  72. package/src/components/Share/Share.tsx +2 -0
  73. package/src/components/SubscriptionManager/SubscriptionManager.tsx +3 -1
  74. package/src/components/Switch/Switch.tsx +1 -1
  75. package/src/components/Tabs/Tabs.tsx +3 -1
  76. package/src/components/TextInput/TextInput.tsx +6 -3
  77. package/src/components/TextInput/TextInput.types.ts +4 -55
  78. package/src/components/Toast/Toast.tsx +12 -0
  79. package/src/components/Toast/Toast.types.ts +6 -0
  80. package/src/components/Toast/index.ts +3 -0
  81. package/src/components/VariantSelector/VariantSelector.tsx +2 -0
  82. package/src/components/Video/Video.tsx +14 -13
  83. package/src/components/VisitUs/VisitUs.tsx +2 -0
  84. package/src/components/index.ts +13 -0
  85. package/src/context/Amplify/index.tsx +2 -1
  86. package/src/context/App/index.tsx +2 -0
  87. package/src/context/Cart/index.tsx +2 -0
  88. package/src/context/ExampleContext/index.tsx +3 -1
  89. package/src/context/Theme/index.tsx +2 -0
  90. package/src/context/index.ts +2 -0
  91. package/src/features/Search/Search.tsx +11 -0
  92. package/src/features/Search/Search.types.ts +1 -0
  93. package/src/features/Search/config/config-helper.ts +2 -0
  94. package/src/features/Search/views/Layout/Layout.tsx +1 -1
  95. package/src/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.tsx +3 -1
  96. package/src/features/Search/views/Paging/Paging.tsx +3 -1
  97. package/src/features/Search/views/PagingInfo/PagingInfo.tsx +1 -1
  98. package/src/features/Search/views/Result/Result.tsx +1 -1
  99. package/src/features/Search/views/Results/Results.tsx +1 -1
  100. package/src/features/Search/views/ResultsPerPage/ResultsPerPage.tsx +3 -1
  101. package/src/features/Search/views/SearchBox/SearchBox.tsx +3 -1
  102. package/src/features/Search/views/SingleLinksFacet/SingleLinksFacet.tsx +3 -1
  103. package/src/features/Search/views/SingleSelectFacet/SingleSelectFacet.tsx +3 -1
  104. package/src/features/Search/views/Sorting/Sorting.tsx +3 -1
  105. package/src/features/index.ts +16 -0
  106. package/src/forms/ForgotPasswordForm/ForgotPasswordForm.types.ts +1 -1
  107. package/src/forms/LoginForm/LoginForm.stories.tsx +1 -1
  108. package/src/forms/LoginForm/LoginForm.tsx +7 -5
  109. package/src/forms/LoginForm/LoginForm.types.ts +7 -1
  110. package/src/forms/PromoCodeForm/PromoCodeForm.types.ts +1 -1
  111. package/src/forms/RegisterForm/RegisterForm.stories.tsx +1 -1
  112. package/src/forms/RegisterForm/RegisterForm.tsx +7 -10
  113. package/src/forms/RegisterForm/RegisterForm.types.ts +4 -2
  114. package/src/forms/ResetPasswordAuthForm/ResetPasswordAuthForm.types.ts +1 -1
  115. package/src/forms/ResetPasswordForm/ResetPasswordForm.types.ts +1 -1
  116. package/src/forms/index.ts +2 -0
  117. package/src/hooks/index.ts +2 -0
  118. package/src/hooks/useLanguage.ts +2 -0
  119. package/src/hooks/useTheme.ts +3 -1
  120. package/src/index.ts +2 -0
  121. package/src/templates/AccountScreen/AccountScreen.tsx +2 -0
  122. package/src/templates/ChallengeScreen/ChallengeScreen.tsx +2 -0
  123. package/src/templates/MenuScreen/MenuScreen.tsx +2 -0
  124. package/src/templates/OrderDetailScreen/OrderDetailScreen.tsx +2 -0
  125. package/src/templates/OrdersHistoryScreen/OrdersHistoryScreen.tsx +2 -0
  126. package/src/templates/PasswordResetScreen/PasswordResetScreen.types.ts +1 -1
  127. package/src/templates/ProductListScreen/ProductListScreen.tsx +2 -0
  128. package/src/templates/PurchaseConfirmationScreen/PurchaseConfirmationScreen.tsx +2 -0
  129. package/src/templates/SubscriptionScreen/SubscriptionScreen.tsx +2 -0
  130. package/src/templates/WorkoutScreen/WorkoutScreen.tsx +3 -1
  131. package/src/templates/index.ts +2 -0
  132. package/src/utils/htmlParser/index.tsx +11 -5
  133. package/src/utils/index.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { ChangeEvent } from "react";
1
+ import { ChangeEvent, InputHTMLAttributes } from "react";
2
2
 
3
3
  export enum InputType {
4
4
  TEXT = 'text',
@@ -18,64 +18,13 @@ export enum InputType {
18
18
  HIDDEN = 'hidden',
19
19
  }
20
20
 
21
- export interface Props {
21
+ export interface Props extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange'> {
22
22
  /** Input type. */
23
23
  type?: InputType;
24
- /** Specify if input is required. */
25
- required?: boolean;
26
- /** Custom style attributes. */
27
- className?: string;
28
24
  /** OnChange function handler. */
29
25
  onChange?: (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
30
- /** Placeholder text. */
31
- placeholder?: string;
32
- /** Input name attribute. */
33
- name?: string;
34
26
  /** Input icon value. */
35
27
  icon?: string;
36
- /** Input status. */
37
- disabled?: boolean;
38
- autoComplete?:
39
- | 'off'
40
- | 'honorific-prefix'
41
- | 'given-name'
42
- | 'additional-name'
43
- | 'family-name'
44
- | 'honorific-suffix'
45
- | 'nickname'
46
- | 'email'
47
- | 'username'
48
- | 'new-password'
49
- | 'current-password'
50
- | 'one-time-code'
51
- | 'organization-title'
52
- | 'organization'
53
- | 'street-address'
54
- | 'address-line1'
55
- | 'address-line2'
56
- | 'address-line3'
57
- | 'address-level4'
58
- | 'address-level3'
59
- | 'address-level2'
60
- | 'address-level1'
61
- | 'country'
62
- | 'country-name'
63
- | 'postal-code'
64
- | 'cc-name'
65
- | 'cc-given-name'
66
- | 'cc-additional-name'
67
- | 'cc-family-name'
68
- | 'cc-number'
69
- | 'cc-exp'
70
- | 'cc-exp-month'
71
- | 'cc-exp-year'
72
- | 'cc-csc'
73
- | 'cc-type'
74
- | 'transaction-currency'
75
- | 'transaction-amount'
76
- | 'language'
77
- | 'bday'
78
- | 'bday-day'
79
- | 'bday-month'
80
- | 'bday-year';
28
+ /** Validation error message (used by AddressForm). */
29
+ error?: string | false;
81
30
  }
@@ -0,0 +1,12 @@
1
+ "use client";
2
+
3
+ import { Toaster as SonnerToaster } from "sonner";
4
+ import type { ToasterProps } from "./Toast.types";
5
+
6
+ /**
7
+ * Toaster component — wraps Sonner with Foundation UI defaults.
8
+ * Place once in the root layout.
9
+ */
10
+ export function Toaster({ position = "top-right", ...props }: ToasterProps) {
11
+ return <SonnerToaster richColors position={position} {...props} />;
12
+ }
@@ -0,0 +1,6 @@
1
+ import type { ToasterProps as SonnerToasterProps } from "sonner";
2
+
3
+ export interface ToasterProps extends Partial<SonnerToasterProps> {
4
+ /** Position of the toast container */
5
+ position?: SonnerToasterProps["position"];
6
+ }
@@ -0,0 +1,3 @@
1
+ export { Toaster } from "./Toast";
2
+ export { toast } from "sonner";
3
+ export type { ToasterProps } from "./Toast.types";
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import * as React from 'react';
2
4
  import { cva, type VariantProps } from 'class-variance-authority';
3
5
  import { cn } from '../../utils';
@@ -1,10 +1,18 @@
1
+ "use client";
2
+
1
3
  import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
2
- import cx from 'classnames';
4
+ import { clsx as cx } from 'clsx';
3
5
  import ReactPlayer from 'react-player/youtube';
4
6
  import { isMobileOnly } from 'react-device-detect';
5
7
  import { Props } from './Video.types';
6
8
  import { twMerge } from 'tailwind-merge';
7
9
  import videojs from 'video.js';
10
+
11
+ const DEFAULT_VIDEO_OPTIONS = {
12
+ playsinline: true,
13
+ preferFullWindow: true,
14
+ } as const;
15
+
8
16
  export interface VideoPlayerMethods {
9
17
  play: () => void;
10
18
  pause: () => void;
@@ -18,10 +26,7 @@ const Video = forwardRef(function MyVideo(
18
26
  onReady,
19
27
  onExitFullScreenCallback,
20
28
  className,
21
- options = {
22
- playsinline: true,
23
- preferFullWindow: true,
24
- },
29
+ options = DEFAULT_VIDEO_OPTIONS,
25
30
  isYoutube = false,
26
31
  defaultAudioTrack = 'No Music',
27
32
  rounded = true,
@@ -168,11 +173,7 @@ const Video = forwardRef(function MyVideo(
168
173
  });
169
174
 
170
175
  player.on('fullscreenchange', function () {
171
- // If player is in fullscreen mode, log state to console
172
- if (player.isFullscreen()) {
173
- console.log('Player is in fullscreen');
174
- } else {
175
- console.log('Player is not in fullscreen');
176
+ if (!player.isFullscreen()) {
176
177
  if (onExitFullScreenCallback && typeof onExitFullScreenCallback === 'function') {
177
178
  onExitFullScreenCallback();
178
179
  }
@@ -187,7 +188,7 @@ const Video = forwardRef(function MyVideo(
187
188
  player.autoplay(options.autoplay);
188
189
  player.src(options.sources);
189
190
  }
190
- }, [options, videoRef]);
191
+ }, [options]);
191
192
 
192
193
  // Expose specific methods to parent
193
194
  useImperativeHandle(ref, () => ({
@@ -220,7 +221,7 @@ const Video = forwardRef(function MyVideo(
220
221
  playerRef.current = null;
221
222
  }
222
223
  };
223
- }, [playerRef]);
224
+ }, [isYoutube]);
224
225
 
225
226
  if (isYoutube && url) {
226
227
  return (
@@ -258,7 +259,7 @@ const Video = forwardRef(function MyVideo(
258
259
  cx(
259
260
  'relative w-full overflow-hidden h-full object-cover',
260
261
  {
261
- rouded: rounded,
262
+ rounded: rounded,
262
263
  },
263
264
  aspectRatioConfig.className,
264
265
  className,
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import React from 'react';
2
4
  import { Props } from './VisitUs.types';
3
5
  import Button from '../Button';
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // ATOMS
2
4
  export { default as AnimationCounter } from './AnimationCounter';
3
5
  export { default as Blockquote } from './Blockquote';
@@ -22,6 +24,7 @@ export { default as Notice } from './Notice';
22
24
  export { default as Radio } from './Radio';
23
25
  export { default as Switch } from './Switch';
24
26
  export { default as TextInput } from './TextInput';
27
+ export { InputType } from './TextInput/TextInput.types';
25
28
  export { default as Avatar } from './Avatar';
26
29
  export { default as Banner } from './Banner';
27
30
 
@@ -64,6 +67,9 @@ export { default as ContentRowsLayout } from './ContentRowsLayout';
64
67
  export { default as Footer } from './Footer';
65
68
  export { default as Header } from './Header';
66
69
 
70
+ // UTILITIES
71
+ export { default as ErrorBoundary } from './ErrorBoundary';
72
+
67
73
  // UI
68
74
  export { default as Loader } from './Loader';
69
75
  export { default as Video } from './Video';
@@ -72,6 +78,9 @@ export { default as FullScreenVideoModal } from './FullScreenVideoModal';
72
78
  export { default as Cart } from './Cart';
73
79
  export { default as FullContentBackgroundImage } from './FullContentBackgroundImage';
74
80
 
81
+ // TOAST
82
+ export { Toaster, toast } from './Toast';
83
+
75
84
  // SHADCN UI COMPONENTS
76
85
  export { ShadcnCarousel } from './ShadcnCarousel';
77
86
 
@@ -150,9 +159,13 @@ export type { Props as AccordionProps } from './Accordion/Accordion.types';
150
159
  export type { Props as SubscriptionManagerProps } from './SubscriptionManager/SubscriptionManager.types';
151
160
  export type { Props as FullScreenVideoModalProps } from './FullScreenVideoModal/FullScreenVideoModal.types';
152
161
  export type { Props as CartProps } from './Cart/Cart.types';
162
+ export type { Props as ErrorBoundaryProps } from './ErrorBoundary/ErrorBoundary.types';
153
163
  export type { Props as FullContentBackgroundImageProps } from './FullContentBackgroundImage/FullContentBackgroundImage.types';
154
164
  export type { Props as HeaderProps } from './Header/Header.types';
155
165
 
166
+ // TOAST TYPES
167
+ export type { ToasterProps } from './Toast';
168
+
156
169
  // SHADCN UI TYPES
157
170
 
158
171
  // PRODUCT COMPONENT TYPES
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import React, { createContext, ReactNode, useEffect } from 'react';
2
4
  import { Amplify } from 'aws-amplify';
3
5
 
@@ -35,7 +37,6 @@ interface AmplifyProviderProps {
35
37
  }
36
38
 
37
39
  export const AmplifyProvider = ({ children, value }: AmplifyProviderProps) => {
38
- console.log("value.config", value.config);
39
40
  useEffect(() => {
40
41
  if (value.config) {
41
42
  Amplify.configure({
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import React, { createContext, useContext } from 'react';
2
4
  import { ShareProps } from '../../components/VisitUs/VisitUs.types';
3
5
 
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { createContext, useContext, ReactNode } from 'react';
2
4
 
3
5
  // Define the context props (you can add more properties depending on your requirements)
@@ -1,10 +1,12 @@
1
+ "use client";
2
+
1
3
  import React, { createContext, useContext, useState, ReactNode } from 'react';
2
4
 
3
5
  // Define the context props (you can add more properties depending on your requirements)
4
6
  interface ContextProps {
5
7
  someState: string;
6
8
  setSomeState: React.Dispatch<React.SetStateAction<string>>;
7
- value: any;
9
+ value: unknown;
8
10
  }
9
11
 
10
12
  // Create the context with a default value
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // State management for theme with Context API
2
4
  // Theme provider for the application
3
5
  // keeps track of the current theme selected by user
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // export { default as ThemeContext } from './Theme';
2
4
  // export { default as AppContext } from './AppContext';
3
5
 
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import React, { useMemo, useState } from 'react';
2
4
  import ElasticSearchAPIConnector from '@elastic/search-ui-elasticsearch-connector';
3
5
  import {
@@ -46,6 +48,7 @@ export default function Search({
46
48
  gridClasses,
47
49
  initialState = {},
48
50
  showTextSearch = true,
51
+ children,
49
52
  }: Props) {
50
53
  const T = useLanguage();
51
54
  const connector = useMemo(() => {
@@ -117,6 +120,14 @@ export default function Search({
117
120
  };
118
121
  }, [config]);
119
122
 
123
+ if (typeof children === 'function') {
124
+ return (
125
+ <SearchProvider config={searchConfig}>
126
+ {children({ searchConfig })}
127
+ </SearchProvider>
128
+ );
129
+ }
130
+
120
131
  const [showSidebar, setShowSidebar] = useState(false);
121
132
 
122
133
  const handleShowFilters = () => {
@@ -37,5 +37,6 @@ export interface Props {
37
37
  gridClasses?: string;
38
38
  initialState?: RequestState;
39
39
  showTextSearch?: boolean;
40
+ children?: (context: { searchConfig: any }) => React.ReactNode;
40
41
  }
41
42
 
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // import config from "../config/engine.json";
2
4
 
3
5
  /**
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import cx from 'classnames';
2
+ import { clsx as cx } from 'clsx';
3
3
  import { isMobileOnly } from 'react-device-detect';
4
4
  import { Props } from './Layout.types';
5
5
  // import Sidebar from "../Sidebar";
@@ -1,5 +1,7 @@
1
+ "use client";
2
+
1
3
  import type { FieldValue } from '@elastic/search-ui';
2
- import cx from 'classnames';
4
+ import { clsx as cx } from 'clsx';
3
5
  import { getFilterValueDisplay } from '../../view-helpers';
4
6
  import { Props } from './MultiCheckboxFacet.types';
5
7
  import Copy from '../../../../components/Copy';
@@ -1,4 +1,6 @@
1
- import cx from 'classnames';
1
+ "use client";
2
+
3
+ import { clsx as cx } from 'clsx';
2
4
  import RCPagination from 'rc-pagination';
3
5
  import enUsLocale from 'rc-pagination/lib/locale/en_US';
4
6
  import { Props } from './Paging.types';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import cx from 'classnames';
2
+ import { clsx as cx } from 'clsx';
3
3
  import { Props } from './PagingInfo.types';
4
4
 
5
5
  function PagingInfo({
@@ -1,5 +1,5 @@
1
1
  import { Props } from './Result.types';
2
- import cx from 'classnames';
2
+ import { clsx as cx } from 'clsx';
3
3
  import he from 'he';
4
4
  import { getEscapedField } from '../../view-helpers';
5
5
  import Card from '../../../../components/Card';
@@ -1,4 +1,4 @@
1
- import cx from 'classnames';
1
+ import { clsx as cx } from 'clsx';
2
2
  import { Props } from './Results.types';
3
3
 
4
4
  function Results({ children, className, gridClasses, ...rest }: Props & React.HTMLAttributes<HTMLUListElement>) {
@@ -1,4 +1,6 @@
1
- import cx from 'classnames';
1
+ "use client";
2
+
3
+ import { clsx as cx } from 'clsx';
2
4
  import { Props } from './ResultsPerPage.types';
3
5
  import Label from '../../../../components/Label';
4
6
  import FormSelect from '../../../../components/FormSelect';
@@ -1,9 +1,11 @@
1
+ "use client";
2
+
1
3
  import { BTN_TYPES, BTN_VARIANTS } from '../../../../components/Button/Button.types';
2
4
  import Button from '../../../../components/Button';
3
5
  import TextInput from '../../../../components/TextInput';
4
6
  import { InputType } from '../../../../components/TextInput/TextInput.types';
5
7
  import { Props } from './SearchBox.types';
6
- import cx from 'classnames';
8
+ import { clsx as cx } from 'clsx';
7
9
 
8
10
  function SearchBox({
9
11
  className,
@@ -1,5 +1,7 @@
1
+ "use client";
2
+
1
3
  import React from 'react';
2
- import cx from 'classnames';
4
+ import { clsx as cx } from 'clsx';
3
5
  import { getFilterValueDisplay } from '../../view-helpers';
4
6
  import { Props } from './SingleLinksFacet.types';
5
7
  import type { FieldValue } from '@elastic/search-ui';
@@ -1,4 +1,6 @@
1
- import cx from 'classnames';
1
+ "use client";
2
+
3
+ import { clsx as cx } from 'clsx';
2
4
  import { Props } from './SingleSelectFacet.types';
3
5
  import FormSelect from '../../../../components/FormSelect';
4
6
  import Label from '../../../../components/Label';
@@ -1,4 +1,6 @@
1
- import cx from 'classnames';
1
+ "use client";
2
+
3
+ import { clsx as cx } from 'clsx';
2
4
  import { Props } from './Sorting.types';
3
5
  import FormSelect from '../../../../components/FormSelect';
4
6
  import { COPY_TRANSFORM } from '../../../../components/Copy/Copy.types';
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // Features
2
4
  export { default as Search } from './Search';
3
5
 
@@ -6,6 +8,20 @@ export { default as SingleSelectFacet } from './Search/views/SingleSelectFacet';
6
8
  export { default as SingleLinksFacet } from './Search/views/SingleLinksFacet';
7
9
  export { default as MultiCheckboxFacet } from './Search/views/MultiCheckboxFacet';
8
10
 
11
+ // View Helpers
12
+ export { getEscapedField } from './Search/view-helpers';
13
+
14
+ // Re-export Elastic Search UI components so consumers share the same module instance
15
+ // (avoids React context mismatch when using the children render prop)
16
+ export {
17
+ WithSearch,
18
+ Results,
19
+ Facet,
20
+ Paging,
21
+ Sorting,
22
+ SearchBox,
23
+ } from '@elastic/react-search-ui';
24
+
9
25
  // Types
10
26
  export { ResultAsTypes } from './Search/Search.types';
11
27
  export type { Props as SearchProps } from './Search/Search.types';
@@ -1,3 +1,3 @@
1
1
  export interface Props {
2
- handleSubmit: (values: any) => void;
2
+ handleSubmit: (values: Record<string, string>) => void;
3
3
  }
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/nextjs';
3
- import { toast } from 'react-toastify';
3
+ import { toast } from 'sonner';
4
4
  import LoginForm from '.';
5
5
 
6
6
  const meta: Meta<typeof LoginForm> = {
@@ -1,5 +1,7 @@
1
+ "use client";
2
+
1
3
  import { useEffect } from 'react';
2
- import cx from 'classnames';
4
+ import { clsx as cx } from 'clsx';
3
5
  import { Props } from './LoginForm.types';
4
6
  import { socialLoginUrlApple, socialLoginUrlGoogle } from '../constants';
5
7
  import { Auth, Hub } from 'aws-amplify';
@@ -12,7 +14,7 @@ import { FIELD_TYPES } from '../../components/FormField/FormField.types';
12
14
  import Button from '../../components/Button';
13
15
  import { BTN_VARIANTS } from '../../components/Button/Button.types';
14
16
  import Hr from '../../components/Hr';
15
- import { toast } from 'react-toastify';
17
+ import { toast } from 'sonner';
16
18
  import { useLanguage } from '../../hooks';
17
19
 
18
20
  const LoginForm = ({
@@ -45,9 +47,9 @@ const LoginForm = ({
45
47
  Auth.federatedSignIn({
46
48
  provider: provider,
47
49
  });
48
- } catch (error: any) {
49
- console.log(error);
50
- toast.error(error.message || T?.ERRORS?.GENERIC_ERROR);
50
+ } catch (error: unknown) {
51
+ const message = error instanceof Error ? error.message : T?.ERRORS?.GENERIC_ERROR;
52
+ toast.error(message || T?.ERRORS?.GENERIC_ERROR);
51
53
  }
52
54
  };
53
55
 
@@ -1,7 +1,13 @@
1
+ export interface AuthTokens {
2
+ accessToken?: { jwtToken?: string };
3
+ idToken?: { jwtToken?: string };
4
+ refreshToken?: { token?: string };
5
+ }
6
+
1
7
  export interface Props {
2
8
  initialValues?: Record<string, string>;
3
9
  handleSubmit: (values: Record<string, string>) => void;
4
- handleTokenCallback?: (tokens: any) => void;
10
+ handleTokenCallback?: (tokens: AuthTokens) => void;
5
11
  showSocialButtons?: boolean;
6
12
  className?: string;
7
13
  }
@@ -1,4 +1,4 @@
1
1
  export interface Props {
2
2
  testID?: string;
3
- handleSubmit?: (values: any) => void;
3
+ handleSubmit?: (values: Record<string, string>) => void;
4
4
  }
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/nextjs';
2
2
  import RegisterForm from '.';
3
- import { toast } from 'react-toastify';
3
+ import { toast } from 'sonner';
4
4
 
5
5
  const meta: Meta<typeof RegisterForm> = {
6
6
  title: 'FORMS/RegisterForm',
@@ -1,5 +1,7 @@
1
+ "use client";
2
+
1
3
  import React, { useEffect } from 'react';
2
- import cx from 'classnames';
4
+ import { clsx as cx } from 'clsx';
3
5
  import { Auth, Hub } from 'aws-amplify';
4
6
  import { CognitoHostedUIIdentityProvider } from '@aws-amplify/auth';
5
7
  import Form from '../../components/Form';
@@ -13,7 +15,7 @@ import { validEmail, validPassword } from '../validations';
13
15
  import STRINGS from '../../translations';
14
16
  import { useLanguage } from '../../hooks';
15
17
  import { Props } from './RegisterForm.types';
16
- import { toast } from 'react-toastify';
18
+ import { toast } from 'sonner';
17
19
 
18
20
  const RegisterForm = ({
19
21
  handleSubmit,
@@ -41,14 +43,9 @@ const RegisterForm = ({
41
43
  Auth.federatedSignIn({
42
44
  provider: provider,
43
45
  });
44
- } catch (error: any) {
45
- console.log(error);
46
- // Toast.show({
47
- // type: 'error',
48
- // text1: T.UI.ERROR,
49
- // text2: error.message || T.ERRORS.GENERIC_ERROR,
50
- // });
51
- toast.error(error.message || T?.ERRORS?.GENERIC_ERROR);
46
+ } catch (error: unknown) {
47
+ const message = error instanceof Error ? error.message : T?.ERRORS?.GENERIC_ERROR;
48
+ toast.error(message || T?.ERRORS?.GENERIC_ERROR);
52
49
  }
53
50
  };
54
51
 
@@ -1,6 +1,8 @@
1
+ import { type AuthTokens } from '../LoginForm/LoginForm.types';
2
+
1
3
  export interface Props {
2
- handleSubmit: (data: Record<string, any>) => void;
4
+ handleSubmit: (data: Record<string, string>) => void;
3
5
  showSocialButtons?: boolean;
4
- handleTokenCallback?: (tokens: any) => void;
6
+ handleTokenCallback?: (tokens: AuthTokens) => void;
5
7
  className?: string;
6
8
  }
@@ -1,3 +1,3 @@
1
1
  export interface Props {
2
- handleSubmit: (values: any) => void;
2
+ handleSubmit: (values: Record<string, string>) => void;
3
3
  }
@@ -1,3 +1,3 @@
1
1
  export interface Props {
2
- handleSubmit: (values: any) => void;
2
+ handleSubmit: (values: Record<string, string>) => void;
3
3
  }
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  export { default as LoginForm } from './LoginForm';
2
4
  export { default as RegisterForm } from './RegisterForm';
3
5
  export { default as ResetPasswordForm } from './ResetPasswordForm';
@@ -1,2 +1,4 @@
1
+ "use client";
2
+
1
3
  export { default as useLanguage } from './useLanguage';
2
4
  export { default as useTheme } from './useTheme';
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { STRINGS_EN } from '../translations';
2
4
  import { useContext } from 'react';
3
5
  import { AppContext } from '../context/App';
@@ -1,6 +1,8 @@
1
+ "use client";
2
+
1
3
  import { useContext } from 'react';
2
4
  import { ThemeContext } from '../context/Theme';
3
5
 
4
- export default function useTheme(): any {
6
+ export default function useTheme() {
5
7
  return useContext(ThemeContext);
6
8
  }
package/src/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  export * from './components';
2
4
  export * from './features';
3
5
  export * from './forms';
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import React from 'react';
2
4
  import { FacebookShareButton, LinkedinShareButton, TwitterShareButton, WhatsappShareButton } from 'react-share';
3
5
  import Screen from '../../components/Screen';