@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.
- package/package.json +5 -2
- package/src/components/Accordion/Accordion.tsx +3 -1
- package/src/components/AddressForm/AddressForm.tsx +4 -1
- package/src/components/AnimationCounter/AnimationCounter.tsx +3 -1
- package/src/components/AnimationSet1/AnimationSet1.tsx +3 -1
- package/src/components/Authenticator/Authenticator.tsx +2 -0
- package/src/components/Avatar/Avatar.tsx +2 -0
- package/src/components/Banner/Banner.tsx +1 -1
- package/src/components/Blockquote/Blockquote.tsx +1 -1
- package/src/components/Button/Button.tsx +1 -2
- package/src/components/ButtonDeprecated/Button.tsx +3 -1
- package/src/components/ButtonGroup/ButtonGroup.tsx +1 -1
- package/src/components/Card/Card.types.ts +3 -3
- package/src/components/Card/types/CardBasic/CardBasic.tsx +44 -133
- package/src/components/Card/types/CardData/CardData.tsx +3 -1
- package/src/components/Card/types/CardHorz/CardHorz.tsx +3 -1
- package/src/components/Card/types/CardIcon/CardIcon.tsx +3 -1
- package/src/components/Card/types/CardMedia/CardMedia.tsx +3 -1
- package/src/components/Card/types/CardVideo/CardVideo.tsx +3 -1
- package/src/components/Carousel/Carousel.tsx +3 -1
- package/src/components/Cart/Cart.tsx +15 -5
- package/src/components/Checkbox/Checkbox.tsx +4 -4
- package/src/components/Chip/Chip.tsx +3 -1
- package/src/components/Collapsible/Collapsible.tsx +1 -1
- package/src/components/Container/Container.tsx +1 -1
- package/src/components/ContentPageLayout/ContentPageLayout.tsx +1 -1
- package/src/components/ContentRowsLayout/ContentRowsLayout.tsx +1 -1
- package/src/components/Copy/Copy.tsx +1 -1
- package/src/components/DisplayHeading/DisplayHeading.tsx +1 -1
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +44 -0
- package/src/components/ErrorBoundary/ErrorBoundary.types.ts +12 -0
- package/src/components/ErrorBoundary/index.ts +2 -0
- package/src/components/FileUpload/FileUpload.tsx +3 -1
- package/src/components/Footer/Footer.tsx +3 -1
- package/src/components/Form/Form.tsx +10 -4
- package/src/components/Form/Form.types.ts +4 -3
- package/src/components/FormField/FormField.tsx +12 -10
- package/src/components/FormSelect/FormSelect.tsx +2 -2
- package/src/components/FormSelect/FormSelect.types.ts +5 -11
- package/src/components/FullScreenVideoModal/FullScreenVideoModal.tsx +3 -1
- package/src/components/Header/Header.tsx +27 -9
- package/src/components/Heading/Heading.tsx +12 -19
- package/src/components/Heading/Heading.types.ts +1 -1
- package/src/components/Hero/Hero.tsx +1 -1
- package/src/components/Hr/Hr.tsx +1 -1
- package/src/components/HtmlContent/HtmlContent.tsx +1 -1
- package/src/components/Image/Image.tsx +1 -1
- package/src/components/Label/Label.tsx +1 -1
- package/src/components/Link/Link.tsx +3 -1
- package/src/components/List/List.tsx +1 -1
- package/src/components/ListItem/ListItem.tsx +3 -1
- package/src/components/Loader/Loader.tsx +1 -1
- package/src/components/Logo/Logo.tsx +1 -1
- package/src/components/Menu/Menu.tsx +1 -1
- package/src/components/Notice/Notice.tsx +3 -1
- package/src/components/OTPInput/OTPInput.tsx +4 -2
- package/src/components/PanelCards/PanelCards.tsx +3 -1
- package/src/components/PanelCustom/PanelCustom.tsx +1 -1
- package/src/components/PanelFeature/PanelFeature.tsx +1 -1
- package/src/components/PanelHero/PanelHero.tsx +3 -1
- package/src/components/PanelIntro/PanelIntro.tsx +3 -1
- package/src/components/PanelProduct/PanelProduct.tsx +1 -1
- package/src/components/PanelScroller/PanelScroller.tsx +3 -1
- package/src/components/PanelVideo/PanelVideo.tsx +3 -1
- package/src/components/ProductCard/ProductCard.tsx +2 -0
- package/src/components/ProductDetail/ProductDetail.tsx +2 -0
- package/src/components/Radio/Radio.tsx +1 -1
- package/src/components/Schedule/Schedule.tsx +2 -2
- package/src/components/ScheduleItem/ScheduleItem.tsx +2 -0
- package/src/components/Screen/Screen.tsx +1 -1
- package/src/components/ShadcnCarousel/ShadcnCarousel.tsx +2 -0
- package/src/components/Share/Share.tsx +2 -0
- package/src/components/SubscriptionManager/SubscriptionManager.tsx +3 -1
- package/src/components/Switch/Switch.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +3 -1
- package/src/components/TextInput/TextInput.tsx +6 -3
- package/src/components/TextInput/TextInput.types.ts +4 -55
- package/src/components/Toast/Toast.tsx +12 -0
- package/src/components/Toast/Toast.types.ts +6 -0
- package/src/components/Toast/index.ts +3 -0
- package/src/components/VariantSelector/VariantSelector.tsx +2 -0
- package/src/components/Video/Video.tsx +14 -13
- package/src/components/VisitUs/VisitUs.tsx +2 -0
- package/src/components/index.ts +13 -0
- package/src/context/Amplify/index.tsx +2 -1
- package/src/context/App/index.tsx +2 -0
- package/src/context/Cart/index.tsx +2 -0
- package/src/context/ExampleContext/index.tsx +3 -1
- package/src/context/Theme/index.tsx +2 -0
- package/src/context/index.ts +2 -0
- package/src/features/Search/Search.tsx +11 -0
- package/src/features/Search/Search.types.ts +1 -0
- package/src/features/Search/config/config-helper.ts +2 -0
- package/src/features/Search/views/Layout/Layout.tsx +1 -1
- package/src/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.tsx +3 -1
- package/src/features/Search/views/Paging/Paging.tsx +3 -1
- package/src/features/Search/views/PagingInfo/PagingInfo.tsx +1 -1
- package/src/features/Search/views/Result/Result.tsx +1 -1
- package/src/features/Search/views/Results/Results.tsx +1 -1
- package/src/features/Search/views/ResultsPerPage/ResultsPerPage.tsx +3 -1
- package/src/features/Search/views/SearchBox/SearchBox.tsx +3 -1
- package/src/features/Search/views/SingleLinksFacet/SingleLinksFacet.tsx +3 -1
- package/src/features/Search/views/SingleSelectFacet/SingleSelectFacet.tsx +3 -1
- package/src/features/Search/views/Sorting/Sorting.tsx +3 -1
- package/src/features/index.ts +16 -0
- package/src/forms/ForgotPasswordForm/ForgotPasswordForm.types.ts +1 -1
- package/src/forms/LoginForm/LoginForm.stories.tsx +1 -1
- package/src/forms/LoginForm/LoginForm.tsx +7 -5
- package/src/forms/LoginForm/LoginForm.types.ts +7 -1
- package/src/forms/PromoCodeForm/PromoCodeForm.types.ts +1 -1
- package/src/forms/RegisterForm/RegisterForm.stories.tsx +1 -1
- package/src/forms/RegisterForm/RegisterForm.tsx +7 -10
- package/src/forms/RegisterForm/RegisterForm.types.ts +4 -2
- package/src/forms/ResetPasswordAuthForm/ResetPasswordAuthForm.types.ts +1 -1
- package/src/forms/ResetPasswordForm/ResetPasswordForm.types.ts +1 -1
- package/src/forms/index.ts +2 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useLanguage.ts +2 -0
- package/src/hooks/useTheme.ts +3 -1
- package/src/index.ts +2 -0
- package/src/templates/AccountScreen/AccountScreen.tsx +2 -0
- package/src/templates/ChallengeScreen/ChallengeScreen.tsx +2 -0
- package/src/templates/MenuScreen/MenuScreen.tsx +2 -0
- package/src/templates/OrderDetailScreen/OrderDetailScreen.tsx +2 -0
- package/src/templates/OrdersHistoryScreen/OrdersHistoryScreen.tsx +2 -0
- package/src/templates/PasswordResetScreen/PasswordResetScreen.types.ts +1 -1
- package/src/templates/ProductListScreen/ProductListScreen.tsx +2 -0
- package/src/templates/PurchaseConfirmationScreen/PurchaseConfirmationScreen.tsx +2 -0
- package/src/templates/SubscriptionScreen/SubscriptionScreen.tsx +2 -0
- package/src/templates/WorkoutScreen/WorkoutScreen.tsx +3 -1
- package/src/templates/index.ts +2 -0
- package/src/utils/htmlParser/index.tsx +11 -5
- 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
|
-
/**
|
|
37
|
-
|
|
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
|
+
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
2
|
-
import cx from '
|
|
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
|
-
|
|
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
|
|
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
|
-
}, [
|
|
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
|
-
|
|
262
|
+
rounded: rounded,
|
|
262
263
|
},
|
|
263
264
|
aspectRatioConfig.className,
|
|
264
265
|
className,
|
package/src/components/index.ts
CHANGED
|
@@ -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,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:
|
|
9
|
+
value: unknown;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
// Create the context with a default value
|
package/src/context/index.ts
CHANGED
|
@@ -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 = () => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import type { FieldValue } from '@elastic/search-ui';
|
|
2
|
-
import cx from '
|
|
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,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 '
|
|
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 '
|
|
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';
|
package/src/features/index.ts
CHANGED
|
@@ -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,5 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import { useEffect } from 'react';
|
|
2
|
-
import cx from '
|
|
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 '
|
|
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:
|
|
49
|
-
|
|
50
|
-
toast.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:
|
|
10
|
+
handleTokenCallback?: (tokens: AuthTokens) => void;
|
|
5
11
|
showSocialButtons?: boolean;
|
|
6
12
|
className?: string;
|
|
7
13
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import React, { useEffect } from 'react';
|
|
2
|
-
import cx from '
|
|
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 '
|
|
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:
|
|
45
|
-
|
|
46
|
-
|
|
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,
|
|
4
|
+
handleSubmit: (data: Record<string, string>) => void;
|
|
3
5
|
showSocialButtons?: boolean;
|
|
4
|
-
handleTokenCallback?: (tokens:
|
|
6
|
+
handleTokenCallback?: (tokens: AuthTokens) => void;
|
|
5
7
|
className?: string;
|
|
6
8
|
}
|
package/src/forms/index.ts
CHANGED
package/src/hooks/index.ts
CHANGED
package/src/hooks/useLanguage.ts
CHANGED
package/src/hooks/useTheme.ts
CHANGED
package/src/index.ts
CHANGED