@sonic-equipment/ui 133.0.0 → 134.0.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/dist/algolia/{algolia-intialization.js → algolia-initialization.js} +7 -0
- package/dist/algolia/algolia-insights-provider.js +7 -0
- package/dist/algolia/algolia-search-provider.js +19 -0
- package/dist/algolia/use-algolia-insights.d.ts +13 -6
- package/dist/algolia/use-algolia-insights.js +93 -10
- package/dist/buttons/button/button.d.ts +4 -1
- package/dist/buttons/button/button.js +2 -2
- package/dist/country-selector/country-select/country-select.d.ts +1 -0
- package/dist/country-selector/country-select/country-select.js +2 -2
- package/dist/delivery-time/delivery-time.js +1 -1
- package/dist/exports.d.ts +7 -2
- package/dist/forms/checkbox/checkbox.d.ts +2 -1
- package/dist/forms/checkbox/checkbox.js +2 -2
- package/dist/forms/field-error/field-error.d.ts +2 -1
- package/dist/forms/field-error/field-error.js +3 -2
- package/dist/forms/input/input.d.ts +1 -0
- package/dist/forms/input/input.js +2 -2
- package/dist/forms/label/label.d.ts +3 -1
- package/dist/forms/label/label.js +3 -2
- package/dist/forms/switch/switch.d.ts +2 -1
- package/dist/forms/switch/switch.js +2 -2
- package/dist/forms/text-field/text-field.d.ts +3 -1
- package/dist/forms/text-field/text-field.js +4 -3
- package/dist/forms/text-field/text-field.module.css.js +1 -1
- package/dist/forms/textarea/textarea.d.ts +1 -0
- package/dist/forms/textarea/textarea.js +3 -2
- package/dist/global-search/plugins/categories-plugin.js +2 -1
- package/dist/global-search/plugins/popular-categories-plugin.js +2 -0
- package/dist/global-search/plugins/query-suggestions-plugin.js +1 -0
- package/dist/global-search/plugins/quick-access-plugin.js +2 -2
- package/dist/global-search/search-result-panel/sections/with-results.js +0 -1
- package/dist/index.js +8 -3
- package/dist/info-icon-tooltip/info-icon-tooltip.d.ts +7 -0
- package/dist/info-icon-tooltip/info-icon-tooltip.js +20 -0
- package/dist/info-icon-tooltip/info-icon-tooltip.module.css.js +3 -0
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.d.ts +5 -0
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +83 -0
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page.js +3 -77
- package/dist/pages/checkout/payment-page/components/payment.js +49 -4
- package/dist/pages/checkout/payment-page/payment-page-content.d.ts +15 -0
- package/dist/pages/checkout/payment-page/payment-page-content.js +43 -0
- package/dist/pages/checkout/payment-page/payment-page.js +3 -37
- package/dist/pages/checkout/shipping-page/components/edit-address.js +3 -3
- package/dist/pages/checkout/shipping-page/shipping-page-content.d.ts +14 -0
- package/dist/pages/checkout/shipping-page/shipping-page-content.js +40 -0
- package/dist/pages/checkout/shipping-page/shipping-page.js +45 -54
- package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +11 -1
- package/dist/pages/product/product-listing-page/product-listing-product-overview/product-listing-product-overview.js +0 -1
- package/dist/pages/product/search-result-page/search-result-product-overview/search-result-product-overview.js +0 -1
- package/dist/shared/fetch/request.d.ts +18 -13
- package/dist/shared/fetch/request.js +22 -9
- package/dist/shared/ga/use-data-layer.d.ts +7 -3
- package/dist/shared/ga/use-data-layer.js +6 -1
- package/dist/shared/utils/promise.d.ts +2 -0
- package/dist/shared/utils/promise.js +9 -0
- package/dist/sign-in-form/sign-in-form.d.ts +19 -0
- package/dist/sign-in-form/sign-in-form.js +49 -0
- package/dist/sign-in-form/sign-in-form.module.css.js +3 -0
- package/dist/styles.css +192 -44
- package/dist/tooltip/tooltip.d.ts +3 -2
- package/dist/tooltip/tooltip.js +5 -4
- package/package.json +1 -1
- package/dist/shared/utils/wait.d.ts +0 -1
- package/dist/shared/utils/wait.js +0 -5
- /package/dist/algolia/{algolia-intialization.d.ts → algolia-initialization.d.ts} +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { config } from '../config.js';
|
|
3
3
|
import Cookies from 'js-cookie';
|
|
4
4
|
import aa from 'search-insights';
|
|
5
|
+
import { request } from '../shared/fetch/request.js';
|
|
5
6
|
import { createUUID } from '../shared/utils/uuid.js';
|
|
6
7
|
|
|
7
8
|
let userToken = generateUserToken();
|
|
@@ -19,6 +20,12 @@ aa('getUserToken', {}, (err, value) => {
|
|
|
19
20
|
aa('onUserTokenChange', value => {
|
|
20
21
|
userToken = value === undefined ? generateUserToken() : String(value);
|
|
21
22
|
});
|
|
23
|
+
request.after(({ body, options: { url } }) => {
|
|
24
|
+
if (url.toLocaleLowerCase().includes('/api/v1/sessions/current')) {
|
|
25
|
+
const userToken = body?.userProfileId || generateUserToken();
|
|
26
|
+
aa('setUserToken', userToken);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
22
29
|
function generateUserToken() {
|
|
23
30
|
return `anonymous-${createUUID()}`;
|
|
24
31
|
}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, useContext } from 'react';
|
|
4
|
+
import { useCultureCode } from '../intl/use-culture-code.js';
|
|
5
|
+
import { getLanguageCodeFromCultureCode } from '../intl/utils.js';
|
|
6
|
+
import { environment } from '../shared/utils/environment.js';
|
|
7
|
+
import { getAlgoliaIndex } from './algolia-index-config.js';
|
|
4
8
|
import { useAlgoliaInsightsGlobalState } from './use-algolia-insights-provider-global-state.js';
|
|
5
9
|
|
|
6
10
|
const AlgoliaInsightsProviderContext = createContext({});
|
|
7
11
|
function AlgoliaInsightsProvider({ children, value, }) {
|
|
12
|
+
const cultureCode = useCultureCode();
|
|
13
|
+
const algoliaIndex = getAlgoliaIndex(environment, getLanguageCodeFromCultureCode(cultureCode));
|
|
8
14
|
const [globalState] = useAlgoliaInsightsGlobalState();
|
|
9
15
|
const context = useContext(AlgoliaInsightsProviderContext);
|
|
10
16
|
const combinedValue = {
|
|
17
|
+
index: algoliaIndex.default,
|
|
11
18
|
...globalState,
|
|
12
19
|
...context,
|
|
13
20
|
...value,
|
|
@@ -11,6 +11,7 @@ import { querySuggestionsPlugin } from '../global-search/plugins/query-suggestio
|
|
|
11
11
|
import { quickAccessPlugin } from '../global-search/plugins/quick-access-plugin.js';
|
|
12
12
|
import { recentSearchesPlugin } from '../global-search/plugins/recent-searches-plugin.js';
|
|
13
13
|
import { useLanguageCode } from '../intl/use-language-code.js';
|
|
14
|
+
import { useDataLayer } from '../shared/ga/use-data-layer.js';
|
|
14
15
|
import { useDebouncedCallback } from '../shared/hooks/use-debounced-callback.js';
|
|
15
16
|
import { environment } from '../shared/utils/environment.js';
|
|
16
17
|
import { getAlgoliaIndex } from './algolia-index-config.js';
|
|
@@ -19,6 +20,7 @@ import { createSonicSearchClient } from './algolia-sonic-searchclient.js';
|
|
|
19
20
|
|
|
20
21
|
const GlobalSearchContext = createContext(null);
|
|
21
22
|
function AlgoliaSearchProvider({ children, searchClient: _searchClient, }) {
|
|
23
|
+
const { dataLayer } = useDataLayer();
|
|
22
24
|
const [state, setState] = useState({
|
|
23
25
|
activeItemId: null,
|
|
24
26
|
collections: [],
|
|
@@ -42,6 +44,9 @@ function AlgoliaSearchProvider({ children, searchClient: _searchClient, }) {
|
|
|
42
44
|
return [
|
|
43
45
|
{
|
|
44
46
|
getItems() {
|
|
47
|
+
if (!query) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
45
50
|
return getAlgoliaResults({
|
|
46
51
|
queries: [
|
|
47
52
|
{
|
|
@@ -53,6 +58,20 @@ function AlgoliaSearchProvider({ children, searchClient: _searchClient, }) {
|
|
|
53
58
|
},
|
|
54
59
|
],
|
|
55
60
|
searchClient,
|
|
61
|
+
transformResponse({ hits, results }) {
|
|
62
|
+
dataLayer.push({
|
|
63
|
+
brands_numSearchResults: null,
|
|
64
|
+
categories_numSearchResults: null,
|
|
65
|
+
content_numSearchResults: null,
|
|
66
|
+
correctedQuery: undefined,
|
|
67
|
+
event: 'searchResults',
|
|
68
|
+
numSearchResults: results[0].nbHits,
|
|
69
|
+
product_numSearchResults: null,
|
|
70
|
+
searchQuery: query,
|
|
71
|
+
searchTerm: null,
|
|
72
|
+
});
|
|
73
|
+
return hits;
|
|
74
|
+
},
|
|
56
75
|
});
|
|
57
76
|
},
|
|
58
77
|
sourceId: 'productsPlugin',
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { CartLineModel } from '../shared/api/storefront/model/storefront.model';
|
|
1
|
+
import { CartLineModel, CartModel } from '../shared/api/storefront/model/storefront.model';
|
|
2
2
|
import { AlgoliaInsightsProviderGlobalState } from './use-algolia-insights-provider-global-state';
|
|
3
3
|
export interface UseAlgoliaEventResult {
|
|
4
4
|
context: Readonly<AlgoliaInsightsProviderGlobalState>;
|
|
5
|
-
|
|
5
|
+
sendAddToCartFromProductDetailsPageEvent({ cartLine, }: {
|
|
6
6
|
cartLine: CartLineModel;
|
|
7
|
-
objectId: string;
|
|
8
7
|
}): void;
|
|
9
|
-
|
|
8
|
+
sendAddToCartFromProductListPageEvent({ cartLine, }: {
|
|
9
|
+
cartLine: CartLineModel;
|
|
10
|
+
}): void;
|
|
11
|
+
sendAddToCartFromSearchEvent({ cartLine, queryId, }: {
|
|
10
12
|
cartLine: CartLineModel;
|
|
11
|
-
objectId: string;
|
|
12
13
|
queryId: string;
|
|
13
14
|
}): void;
|
|
14
|
-
sendAddToCartFromSearchResultPageEvent({ cartLine,
|
|
15
|
+
sendAddToCartFromSearchResultPageEvent({ cartLine, }: {
|
|
15
16
|
cartLine: CartLineModel;
|
|
17
|
+
}): void;
|
|
18
|
+
sendAddToWishListFromProductDetailsPageEvent({ objectId, position, }: {
|
|
16
19
|
objectId: string;
|
|
20
|
+
position?: number;
|
|
17
21
|
}): void;
|
|
18
22
|
sendAddToWishListFromProductListPageEvent({ objectId, position, }: {
|
|
19
23
|
objectId: string;
|
|
@@ -41,5 +45,8 @@ export interface UseAlgoliaEventResult {
|
|
|
41
45
|
objectId: string;
|
|
42
46
|
position: number;
|
|
43
47
|
}): void;
|
|
48
|
+
sendPurchaseEventFromPaymentPage({ cart }: {
|
|
49
|
+
cart: CartModel;
|
|
50
|
+
}): void;
|
|
44
51
|
}
|
|
45
52
|
export declare function useAlgoliaInsights(): UseAlgoliaEventResult;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useContext } from 'react';
|
|
2
|
+
import { useContext, useMemo } from 'react';
|
|
3
3
|
import aa from 'search-insights';
|
|
4
4
|
import { currencySymbolToISO } from '../shared/model/currency.js';
|
|
5
5
|
import { ensureArray } from '../shared/utils/array.js';
|
|
6
|
+
import { userToken } from './algolia-initialization.js';
|
|
6
7
|
import { AlgoliaInsightsProviderContext } from './algolia-insights-provider.js';
|
|
7
|
-
import { userToken } from './algolia-intialization.js';
|
|
8
8
|
import { useAlgoliaInsightsGlobalState } from './use-algolia-insights-provider-global-state.js';
|
|
9
9
|
|
|
10
10
|
function getCurrencyFromPriceString(priceString) {
|
|
@@ -14,9 +14,46 @@ function getCurrencyFromPriceString(priceString) {
|
|
|
14
14
|
function useAlgoliaInsights() {
|
|
15
15
|
const context = useContext(AlgoliaInsightsProviderContext);
|
|
16
16
|
const [, setGlobalState] = useAlgoliaInsightsGlobalState();
|
|
17
|
-
|
|
17
|
+
const result = useMemo(() => ({
|
|
18
18
|
context,
|
|
19
|
-
|
|
19
|
+
sendAddToCartFromProductDetailsPageEvent({ cartLine }) {
|
|
20
|
+
if (!context.index)
|
|
21
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
22
|
+
if (context.queryId) {
|
|
23
|
+
aa('addedToCartObjectIDsAfterSearch', {
|
|
24
|
+
currency: getCurrencyFromPriceString(cartLine.pricing?.actualPriceDisplay),
|
|
25
|
+
eventName: 'PDP: AddToCart Clicked',
|
|
26
|
+
index: context.index,
|
|
27
|
+
objectData: [
|
|
28
|
+
{
|
|
29
|
+
price: cartLine.pricing?.actualPrice || undefined,
|
|
30
|
+
quantity: cartLine.qtyOrdered || undefined,
|
|
31
|
+
queryID: context.queryId,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
objectIDs: [cartLine.erpNumber],
|
|
35
|
+
queryID: context.queryId,
|
|
36
|
+
userToken,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
aa('addedToCartObjectIDs', {
|
|
41
|
+
currency: getCurrencyFromPriceString(cartLine.pricing?.actualPriceDisplay),
|
|
42
|
+
eventName: 'PDP: AddToCart Clicked',
|
|
43
|
+
index: context.index,
|
|
44
|
+
objectData: [
|
|
45
|
+
{
|
|
46
|
+
price: cartLine.pricing?.actualPrice || undefined,
|
|
47
|
+
quantity: cartLine.qtyOrdered || undefined,
|
|
48
|
+
queryID: context.queryId,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
objectIDs: [cartLine.erpNumber],
|
|
52
|
+
userToken,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
sendAddToCartFromProductListPageEvent({ cartLine }) {
|
|
20
57
|
if (!context.index)
|
|
21
58
|
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
22
59
|
if (!context.queryId)
|
|
@@ -32,12 +69,12 @@ function useAlgoliaInsights() {
|
|
|
32
69
|
queryID: context.queryId,
|
|
33
70
|
},
|
|
34
71
|
],
|
|
35
|
-
objectIDs: [
|
|
72
|
+
objectIDs: [cartLine.erpNumber],
|
|
36
73
|
queryID: context.queryId,
|
|
37
74
|
userToken,
|
|
38
75
|
});
|
|
39
76
|
},
|
|
40
|
-
sendAddToCartFromSearchEvent({ cartLine,
|
|
77
|
+
sendAddToCartFromSearchEvent({ cartLine, queryId }) {
|
|
41
78
|
if (!context.index)
|
|
42
79
|
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
43
80
|
aa('addedToCartObjectIDsAfterSearch', {
|
|
@@ -51,12 +88,12 @@ function useAlgoliaInsights() {
|
|
|
51
88
|
queryID: context.queryId,
|
|
52
89
|
},
|
|
53
90
|
],
|
|
54
|
-
objectIDs: [
|
|
91
|
+
objectIDs: [cartLine.erpNumber],
|
|
55
92
|
queryID: queryId,
|
|
56
93
|
userToken,
|
|
57
94
|
});
|
|
58
95
|
},
|
|
59
|
-
sendAddToCartFromSearchResultPageEvent({ cartLine
|
|
96
|
+
sendAddToCartFromSearchResultPageEvent({ cartLine }) {
|
|
60
97
|
if (!context.index)
|
|
61
98
|
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
62
99
|
if (!context.queryId)
|
|
@@ -72,11 +109,35 @@ function useAlgoliaInsights() {
|
|
|
72
109
|
queryID: context.queryId,
|
|
73
110
|
},
|
|
74
111
|
],
|
|
75
|
-
objectIDs: [
|
|
112
|
+
objectIDs: [cartLine.erpNumber],
|
|
76
113
|
queryID: context.queryId,
|
|
77
114
|
userToken,
|
|
78
115
|
});
|
|
79
116
|
},
|
|
117
|
+
sendAddToWishListFromProductDetailsPageEvent({ objectId, position }) {
|
|
118
|
+
if (!context.index)
|
|
119
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
120
|
+
if (context.queryId) {
|
|
121
|
+
if (!position)
|
|
122
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no position', context, objectId);
|
|
123
|
+
aa('clickedObjectIDsAfterSearch', {
|
|
124
|
+
eventName: 'PDP: Product Added to Wishlist',
|
|
125
|
+
index: context.index,
|
|
126
|
+
objectIDs: [objectId],
|
|
127
|
+
positions: [position],
|
|
128
|
+
queryID: context.queryId,
|
|
129
|
+
userToken,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
aa('clickedObjectIDs', {
|
|
134
|
+
eventName: 'PDP: Product Added to Wishlist',
|
|
135
|
+
index: context.index,
|
|
136
|
+
objectIDs: [objectId],
|
|
137
|
+
userToken,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
},
|
|
80
141
|
sendAddToWishListFromProductListPageEvent({ objectId, position }) {
|
|
81
142
|
if (!context.index)
|
|
82
143
|
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
@@ -175,7 +236,29 @@ function useAlgoliaInsights() {
|
|
|
175
236
|
queryId: context.queryId,
|
|
176
237
|
});
|
|
177
238
|
},
|
|
178
|
-
|
|
239
|
+
sendPurchaseEventFromPaymentPage({ cart }) {
|
|
240
|
+
if (!context.index)
|
|
241
|
+
return console.warn('Unable to send clickedObjectIDsAfterSearch event, no index', context);
|
|
242
|
+
if (!cart.cartLines || cart.cartLines.length === 0)
|
|
243
|
+
return console.warn('Unable to send purchasedObjectIDs event, no cartLines', cart);
|
|
244
|
+
aa('purchasedObjectIDs', {
|
|
245
|
+
currency: currencySymbolToISO[cart.currencySymbol],
|
|
246
|
+
eventName: 'Purchase Successful',
|
|
247
|
+
index: context.index,
|
|
248
|
+
objectData: cart.cartLines.map(cartLine => ({
|
|
249
|
+
price: cartLine.pricing?.actualPrice || undefined,
|
|
250
|
+
quantity: cartLine.qtyOrdered || undefined,
|
|
251
|
+
queryID: context.queryId,
|
|
252
|
+
})),
|
|
253
|
+
objectIDs: cart.cartLines
|
|
254
|
+
.map(cartLine => cartLine.erpNumber)
|
|
255
|
+
.slice(0, 20),
|
|
256
|
+
userToken,
|
|
257
|
+
value: cart.orderSubTotal,
|
|
258
|
+
});
|
|
259
|
+
},
|
|
260
|
+
}), [context, setGlobalState]);
|
|
261
|
+
return result;
|
|
179
262
|
}
|
|
180
263
|
|
|
181
264
|
export { useAlgoliaInsights };
|
|
@@ -11,10 +11,13 @@ export interface ButtonProps {
|
|
|
11
11
|
iconPosition?: 'left' | 'right';
|
|
12
12
|
isDisabled?: boolean;
|
|
13
13
|
isLoading?: string | ReactNode | boolean;
|
|
14
|
+
isValidating?: boolean;
|
|
15
|
+
name?: string;
|
|
14
16
|
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
15
17
|
size?: 'sm' | 'md' | 'lg';
|
|
16
18
|
type?: 'button' | 'submit' | 'reset';
|
|
19
|
+
value?: string;
|
|
17
20
|
variant?: 'solid' | 'outline' | 'ghost';
|
|
18
21
|
withArrow?: boolean;
|
|
19
22
|
}
|
|
20
|
-
export declare function Button({ _pseudo, children, className, color, condensed, 'data-test-selector': dataTestSelector, form, icon, iconPosition, isDisabled, isLoading, onClick: _onClick, size, type, variant, withArrow, }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function Button({ _pseudo, children, className, color, condensed, 'data-test-selector': dataTestSelector, form, icon, iconPosition, isDisabled, isLoading, isValidating, name, onClick: _onClick, size, type, value, variant, withArrow, }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { ProgressCircle } from '../../loading/progress-circle.js';
|
|
|
6
6
|
import { GlyphsArrowBoldCapsRightIcon } from '../../icons/glyph/glyphs-arrow-boldcaps-right-icon.js';
|
|
7
7
|
import buttonStyles from './button.module.css.js';
|
|
8
8
|
|
|
9
|
-
function Button({ _pseudo = 'none', children, className, color = 'primary', condensed, 'data-test-selector': dataTestSelector, form, icon, iconPosition = 'left', isDisabled, isLoading = false, onClick: _onClick, size = 'lg', type = 'button', variant = 'solid', withArrow = false, }) {
|
|
9
|
+
function Button({ _pseudo = 'none', children, className, color = 'primary', condensed, 'data-test-selector': dataTestSelector, form, icon, iconPosition = 'left', isDisabled, isLoading = false, isValidating = true, name, onClick: _onClick, size = 'lg', type = 'button', value, variant = 'solid', withArrow = false, }) {
|
|
10
10
|
const showIconOnLeft = icon && iconPosition === 'left';
|
|
11
11
|
const showIconOnRight = icon && iconPosition === 'right';
|
|
12
12
|
const iconElement = icon && jsx("span", { className: buttonStyles.icon, children: icon });
|
|
@@ -21,7 +21,7 @@ function Button({ _pseudo = 'none', children, className, color = 'primary', cond
|
|
|
21
21
|
return (jsx("button", { className: clsx({ [buttonStyles.condensed]: condensed }, { [buttonStyles.icon]: icon }, { [buttonStyles['loading-uninformative']]: isLoading === true }, {
|
|
22
22
|
[buttonStyles['loading-informative']]: isLoading &&
|
|
23
23
|
(typeof isLoading === 'string' || isValidElement(isLoading)),
|
|
24
|
-
}, buttonStyles.button, buttonStyles[variant], buttonStyles[size], buttonStyles[color], buttonStyles[_pseudo], className), "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, form: form, onClick: onClick, type: type, children: jsxs(Fragment, { children: [showIconOnLeft && iconElement, jsx("span", { className: buttonStyles.children, children: isLoading ? (isLoading === true ? children : isLoading) : children }), withArrow && (jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })), showIconOnRight && iconElement, isLoading && (jsx(ProgressCircle, { className: buttonStyles.spinner, size: "sm", variant: color === 'primary' ? 'white' : 'gray' }))] }) }));
|
|
24
|
+
}, buttonStyles.button, buttonStyles[variant], buttonStyles[size], buttonStyles[color], buttonStyles[_pseudo], className), "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, form: form, formNoValidate: isValidating ? undefined : true, name: name, onClick: onClick, type: type, value: value, children: jsxs(Fragment, { children: [showIconOnLeft && iconElement, jsx("span", { className: buttonStyles.children, children: isLoading ? (isLoading === true ? children : isLoading) : children }), withArrow && (jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })), showIconOnRight && iconElement, isLoading && (jsx(ProgressCircle, { className: buttonStyles.spinner, size: "sm", variant: color === 'primary' ? 'white' : 'gray' }))] }) }));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export { Button };
|
|
@@ -3,6 +3,7 @@ import { Country } from '../../shared/model/countries-languages';
|
|
|
3
3
|
interface CountrySelectProps<T extends Country | CountryModel> {
|
|
4
4
|
countries: T[];
|
|
5
5
|
'data-test-selector'?: string;
|
|
6
|
+
isDisabled?: boolean;
|
|
6
7
|
isRequired?: boolean;
|
|
7
8
|
name?: string;
|
|
8
9
|
showLabel?: boolean;
|
|
@@ -3,7 +3,7 @@ import { useMemo } from 'react';
|
|
|
3
3
|
import { Select } from '../../forms/select/select.js';
|
|
4
4
|
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
5
5
|
|
|
6
|
-
function CountrySelect({ countries, 'data-test-selector': dataTestSelector, isRequired, name, onCountryChange, selectedCountry, showLabel = true, }) {
|
|
6
|
+
function CountrySelect({ countries, 'data-test-selector': dataTestSelector, isDisabled, isRequired, name, onCountryChange, selectedCountry, showLabel = true, }) {
|
|
7
7
|
const t = useFormattedMessage();
|
|
8
8
|
const countryOptions = useMemo(() => countries.reduce((acc, country) => ({
|
|
9
9
|
...acc,
|
|
@@ -11,7 +11,7 @@ function CountrySelect({ countries, 'data-test-selector': dataTestSelector, isRe
|
|
|
11
11
|
}), {}),
|
|
12
12
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13
13
|
[countries]);
|
|
14
|
-
return (jsx(Select, { "data-test-selector": dataTestSelector, isRequired: isRequired, label: t('Country'), name: name, onChange: value => onCountryChange?.(countries.find(country => country.id === value)), options: countryOptions, selectedOption: selectedCountry?.id, showLabel: showLabel, showPlaceholder: false, variant: "solid" }));
|
|
14
|
+
return (jsx(Select, { "data-test-selector": dataTestSelector, isDisabled: isDisabled, isRequired: isRequired, label: t('Country'), name: name, onChange: value => onCountryChange?.(countries.find(country => country.id === value)), options: countryOptions, selectedOption: selectedCountry?.id, showLabel: showLabel, showPlaceholder: false, variant: "solid" }));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export { CountrySelect };
|
|
@@ -13,7 +13,7 @@ function DeliveryTime({ className, deliveryDate }) {
|
|
|
13
13
|
return (jsxs("div", { className: clsx(styles['delivery-time'], className), children: [jsx("p", { children: jsx(FormattedMessage, { id: "Delivery expected in {0} {1}", replacementValues: {
|
|
14
14
|
'0': number.toString(),
|
|
15
15
|
'1': t.pluralize('unit', unit, number),
|
|
16
|
-
} }) }), jsx(Tooltip, {
|
|
16
|
+
} }) }), jsx(Tooltip, { children: jsx(FormattedMessage, { id: "The expected delivery is an indication based on the product availability and the shipping location." }) })] }));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export { DeliveryTime };
|
package/dist/exports.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ export * from './algolia/algolia-filter-panel';
|
|
|
7
7
|
export * from './algolia/algolia-hit-type';
|
|
8
8
|
export * from './algolia/algolia-hits-provider';
|
|
9
9
|
export * from './algolia/algolia-index-config';
|
|
10
|
+
export * from './algolia/algolia-initialization';
|
|
10
11
|
export * from './algolia/algolia-insight-instant-search-provider';
|
|
11
12
|
export * from './algolia/algolia-insights-provider';
|
|
12
13
|
export * from './algolia/algolia-instant-search-state-provider';
|
|
13
|
-
export * from './algolia/algolia-intialization';
|
|
14
14
|
export * from './algolia/algolia-multi-select-filter-section';
|
|
15
15
|
export * from './algolia/algolia-pagination';
|
|
16
16
|
export * from './algolia/algolia-provider';
|
|
@@ -108,6 +108,7 @@ export * from './global-search/search-section/search-list-item';
|
|
|
108
108
|
export * from './global-search/search-section/search-section';
|
|
109
109
|
export * from './global-search/types';
|
|
110
110
|
export * from './header/cart-icon/connected-cart-icon';
|
|
111
|
+
export * from './info-icon-tooltip/info-icon-tooltip';
|
|
111
112
|
export * from './intl/formatted-message';
|
|
112
113
|
export * from './intl/intl-context';
|
|
113
114
|
export * from './intl/intl-provider';
|
|
@@ -149,17 +150,20 @@ export * from './pages/checkout/layouts/checkout-page-layout/components/checkout
|
|
|
149
150
|
export * from './pages/checkout/layouts/checkout-page-layout/components/checkout-page-section-header';
|
|
150
151
|
export * from './pages/checkout/layouts/checkout-page-layout/components/checkout-page-section-link';
|
|
151
152
|
export * from './pages/checkout/order-confirmation-page/order-confirmation-page';
|
|
153
|
+
export * from './pages/checkout/order-confirmation-page/order-confirmation-page-content';
|
|
152
154
|
export * from './pages/checkout/payment-page/components/adyen-payment';
|
|
153
155
|
export * from './pages/checkout/payment-page/components/payment';
|
|
154
156
|
export * from './pages/checkout/payment-page/hooks/use-get-adyen-redirect-result';
|
|
155
157
|
export * from './pages/checkout/payment-page/hooks/use-has-returned-from-adyen';
|
|
156
158
|
export * from './pages/checkout/payment-page/payment-page';
|
|
159
|
+
export * from './pages/checkout/payment-page/payment-page-content';
|
|
157
160
|
export * from './pages/checkout/payment-page/utils/parse-amount';
|
|
158
161
|
export * from './pages/checkout/shipping-page/components/edit-address';
|
|
159
162
|
export * from './pages/checkout/shipping-page/components/readonly-address';
|
|
160
163
|
export * from './pages/checkout/shipping-page/components/sonic-address';
|
|
161
164
|
export * from './pages/checkout/shipping-page/hooks/use-patch-shipping-details';
|
|
162
165
|
export * from './pages/checkout/shipping-page/shipping-page';
|
|
166
|
+
export * from './pages/checkout/shipping-page/shipping-page-content';
|
|
163
167
|
export * from './pages/components/page-container/page-container';
|
|
164
168
|
export * from './pages/components/page-meta-data/page-meta-data';
|
|
165
169
|
export * from './pages/components/page/page';
|
|
@@ -287,17 +291,18 @@ export * from './shared/utils/environment';
|
|
|
287
291
|
export * from './shared/utils/event-emitter';
|
|
288
292
|
export * from './shared/utils/merge';
|
|
289
293
|
export * from './shared/utils/price';
|
|
294
|
+
export * from './shared/utils/promise';
|
|
290
295
|
export * from './shared/utils/random';
|
|
291
296
|
export * from './shared/utils/string';
|
|
292
297
|
export * from './shared/utils/time';
|
|
293
298
|
export * from './shared/utils/types';
|
|
294
299
|
export * from './shared/utils/uuid';
|
|
295
|
-
export * from './shared/utils/wait';
|
|
296
300
|
export * from './sidebar/sidebar';
|
|
297
301
|
export * from './sidebar/sidebar-provider';
|
|
298
302
|
export * from './sidebar/toggle-sidebar-button';
|
|
299
303
|
export * from './sidebar/types';
|
|
300
304
|
export * from './sidebar/use-sidebar';
|
|
305
|
+
export * from './sign-in-form/sign-in-form';
|
|
301
306
|
export * from './toast/toast';
|
|
302
307
|
export * from './toast/toast-provider';
|
|
303
308
|
export * from './toast/types';
|
|
@@ -4,9 +4,10 @@ export interface CheckboxProps {
|
|
|
4
4
|
children?: ReactNode;
|
|
5
5
|
className?: string;
|
|
6
6
|
'data-test-selector'?: string;
|
|
7
|
+
defaultSelected?: boolean;
|
|
7
8
|
isDisabled?: boolean;
|
|
8
9
|
isSelected?: boolean;
|
|
9
10
|
onChange?: (isSelected: boolean) => void;
|
|
10
11
|
value?: string;
|
|
11
12
|
}
|
|
12
|
-
export declare function Checkbox({ _pseudo, children, className, 'data-test-selector': dataTestSelector, isDisabled, isSelected, onChange, value, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function Checkbox({ _pseudo, children, className, 'data-test-selector': dataTestSelector, defaultSelected, isDisabled, isSelected, onChange, value, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,8 +4,8 @@ import { Checkbox as Checkbox$1 } from 'react-aria-components';
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import styles from './checkbox.module.css.js';
|
|
6
6
|
|
|
7
|
-
function Checkbox({ _pseudo = 'none', children, className, 'data-test-selector': dataTestSelector, isDisabled, isSelected, onChange, value, }) {
|
|
8
|
-
return (jsxs(Checkbox$1, { className: clsx(className, styles.checkbox, styles[_pseudo]), "data-test-selector": dataTestSelector, isDisabled: isDisabled, isSelected: isSelected, onChange: onChange, value: value, children: [jsx("div", { className: styles.box, children: jsx("svg", { "aria-hidden": "true", className: styles.checkmark, viewBox: "0 0
|
|
7
|
+
function Checkbox({ _pseudo = 'none', children, className, 'data-test-selector': dataTestSelector, defaultSelected, isDisabled, isSelected, onChange, value, }) {
|
|
8
|
+
return (jsxs(Checkbox$1, { className: clsx(className, styles.checkbox, styles[_pseudo]), "data-test-selector": dataTestSelector, defaultSelected: defaultSelected, isDisabled: isDisabled, isSelected: isSelected, onChange: onChange, value: value, children: [jsx("div", { className: styles.box, children: jsx("svg", { "aria-hidden": "true", className: styles.checkmark, viewBox: "0 0 10 7", children: jsx("path", { d: "m1 2.845 3 3L8.845 1" }) }) }), children] }));
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export { Checkbox };
|
|
@@ -13,6 +13,7 @@ interface FieldErrorProps {
|
|
|
13
13
|
children?: ReactNode | ((values: ValidationResult & {
|
|
14
14
|
defaultChildren: ReactNode;
|
|
15
15
|
}) => ReactNode);
|
|
16
|
+
className?: string;
|
|
16
17
|
}
|
|
17
|
-
export declare function FieldError({ children }: FieldErrorProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function FieldError({ children, className }: FieldErrorProps): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { FieldError as FieldError$1 } from 'react-aria-components';
|
|
4
|
+
import clsx from 'clsx';
|
|
4
5
|
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
5
6
|
import styles from './field-error.module.css.js';
|
|
6
7
|
|
|
7
|
-
function FieldError({ children }) {
|
|
8
|
+
function FieldError({ children, className }) {
|
|
8
9
|
const t = useFormattedMessage();
|
|
9
|
-
return (jsx(FieldError$1, { className: styles['field-error'], children: children ||
|
|
10
|
+
return (jsx(FieldError$1, { className: clsx(className, styles['field-error']), children: children ||
|
|
10
11
|
(result => {
|
|
11
12
|
if (!result.isInvalid)
|
|
12
13
|
return;
|
|
@@ -3,6 +3,7 @@ import { Input as AriaInput } from 'react-aria-components';
|
|
|
3
3
|
export interface InputProps extends Omit<ComponentProps<typeof AriaInput>, 'size'> {
|
|
4
4
|
_pseudo?: 'focus' | 'none';
|
|
5
5
|
autoGrow?: boolean;
|
|
6
|
+
className?: string;
|
|
6
7
|
inlineElement?: React.ReactNode;
|
|
7
8
|
label: string;
|
|
8
9
|
size?: 'md' | 'lg';
|
|
@@ -9,7 +9,7 @@ import styles from './input.module.css.js';
|
|
|
9
9
|
* This component is used to create an input that grows as the user types.
|
|
10
10
|
* It uses a shadow input to calculate the width of the input.
|
|
11
11
|
*/
|
|
12
|
-
const Input = forwardRef(({ _pseudo = 'none', autoGrow, inlineElement, label, size = 'lg', ...inputProps }, inputRef) => {
|
|
12
|
+
const Input = forwardRef(({ _pseudo = 'none', autoGrow, className, inlineElement, label, size = 'lg', ...inputProps }, inputRef) => {
|
|
13
13
|
const [props, ref] = useContextProps(inputProps, inputRef, InputContext);
|
|
14
14
|
const { defaultValue, onChange, value: controlledValue } = props;
|
|
15
15
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
@@ -18,7 +18,7 @@ const Input = forwardRef(({ _pseudo = 'none', autoGrow, inlineElement, label, si
|
|
|
18
18
|
const handleChange = (event) => isControlled
|
|
19
19
|
? onChange?.(event)
|
|
20
20
|
: setUncontrolledValue(event.target.value);
|
|
21
|
-
return (jsx("div", { className: clsx(styles['input-container'], styles[size], styles[_pseudo]), children: jsxs("div", { className: clsx(styles.input, {
|
|
21
|
+
return (jsx("div", { className: clsx(className, styles['input-container'], styles[size], styles[_pseudo]), children: jsxs("div", { className: clsx(styles.input, {
|
|
22
22
|
[styles['growing-input']]: autoGrow,
|
|
23
23
|
}), children: [jsx(Input$1, { "aria-label": label, size: autoGrow ? 1 : undefined, ...props, ref: ref, onChange: handleChange, onClick: e => {
|
|
24
24
|
e.preventDefault();
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
interface LabelProps {
|
|
2
2
|
children: string | React.ReactNode;
|
|
3
|
+
className?: string;
|
|
4
|
+
'data-test-selector'?: string;
|
|
3
5
|
isRequired?: boolean;
|
|
4
6
|
}
|
|
5
|
-
export declare function Label({ children, isRequired }: LabelProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export declare function Label({ children, className, 'data-test-selector': dataTestSelector, isRequired, }: LabelProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
8
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { Label as Label$1 } from 'react-aria-components';
|
|
4
|
+
import clsx from 'clsx';
|
|
4
5
|
import styles from './label.module.css.js';
|
|
5
6
|
|
|
6
|
-
function Label({ children, isRequired }) {
|
|
7
|
+
function Label({ children, className, 'data-test-selector': dataTestSelector, isRequired, }) {
|
|
7
8
|
if (!children)
|
|
8
9
|
return null;
|
|
9
|
-
return (jsxs(Label$1, { className: styles.label, children: [children, isRequired && jsx("span", { className: styles.required, children: "*" })] }));
|
|
10
|
+
return (jsxs(Label$1, { className: clsx(className, styles.label), "data-test-selector": dataTestSelector, children: [children, isRequired && jsx("span", { className: styles.required, children: "*" })] }));
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export { Label };
|
|
@@ -7,7 +7,8 @@ export interface SwitchProps {
|
|
|
7
7
|
defaultSelected?: boolean;
|
|
8
8
|
isDisabled?: boolean;
|
|
9
9
|
isSelected?: boolean;
|
|
10
|
+
name?: string;
|
|
10
11
|
onChange?: (isSelected: boolean) => void;
|
|
11
12
|
value?: string;
|
|
12
13
|
}
|
|
13
|
-
export declare function Switch({ _pseudo, children, className, 'data-test-selector': dataTestSelector, defaultSelected, isDisabled, isSelected, onChange, value, }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function Switch({ _pseudo, children, className, 'data-test-selector': dataTestSelector, defaultSelected, isDisabled, isSelected, name, onChange, value, }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,8 +4,8 @@ import { Switch as Switch$1 } from 'react-aria-components';
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import styles from './switch.module.css.js';
|
|
6
6
|
|
|
7
|
-
function Switch({ _pseudo = 'none', children, className, 'data-test-selector': dataTestSelector, defaultSelected, isDisabled, isSelected, onChange, value, }) {
|
|
8
|
-
return (jsxs(Switch$1, { className: clsx(className, styles.switch, styles[_pseudo]), "data-test-selector": dataTestSelector, defaultSelected: defaultSelected, isDisabled: isDisabled, isSelected: isSelected, onChange: onChange, value: value, children: [jsx("div", { className: styles.indicator }), children] }));
|
|
7
|
+
function Switch({ _pseudo = 'none', children, className, 'data-test-selector': dataTestSelector, defaultSelected, isDisabled, isSelected, name, onChange, value, }) {
|
|
8
|
+
return (jsxs(Switch$1, { className: clsx(className, styles.switch, styles[_pseudo]), "data-test-selector": dataTestSelector, defaultSelected: defaultSelected, isDisabled: isDisabled, isSelected: isSelected, name: name, onChange: onChange, value: value, children: [jsx("div", { className: styles.indicator }), children] }));
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export { Switch };
|
|
@@ -3,7 +3,9 @@ import { type ValidateFunction } from '../field-error/field-error';
|
|
|
3
3
|
interface TextFieldProps {
|
|
4
4
|
autoFocus?: boolean;
|
|
5
5
|
autoGrow?: boolean;
|
|
6
|
+
'data-test-selector'?: string;
|
|
6
7
|
defaultValue?: string;
|
|
8
|
+
info?: string;
|
|
7
9
|
isDisabled?: boolean;
|
|
8
10
|
isInvalid?: boolean;
|
|
9
11
|
isMultiline?: boolean;
|
|
@@ -29,5 +31,5 @@ interface TextFieldProps {
|
|
|
29
31
|
* It can be used as a single line input or as a textarea.
|
|
30
32
|
* This field can also grow when a user types in text.
|
|
31
33
|
*/
|
|
32
|
-
export declare function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel, size, type: defaultType, validate, value, }: TextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function TextField({ autoFocus, autoGrow, 'data-test-selector': dataTestSelector, defaultValue, info, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel, size, type: defaultType, validate, value, }: TextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
33
35
|
export {};
|
|
@@ -3,6 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useState, useCallback } from 'react';
|
|
4
4
|
import { TextField as TextField$1 } from 'react-aria-components';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
+
import { InfoIconTooltip } from '../../info-icon-tooltip/info-icon-tooltip.js';
|
|
6
7
|
import { FieldError } from '../field-error/field-error.js';
|
|
7
8
|
import { Input } from '../input/input.js';
|
|
8
9
|
import { Label } from '../label/label.js';
|
|
@@ -15,15 +16,15 @@ import styles from './text-field.module.css.js';
|
|
|
15
16
|
* It can be used as a single line input or as a textarea.
|
|
16
17
|
* This field can also grow when a user types in text.
|
|
17
18
|
*/
|
|
18
|
-
function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel = false, size = 'lg', type: defaultType = 'text', validate, value, }) {
|
|
19
|
+
function TextField({ autoFocus, autoGrow, 'data-test-selector': dataTestSelector, defaultValue, info, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel = false, size = 'lg', type: defaultType = 'text', validate, value, }) {
|
|
19
20
|
const [type, setType] = useState(defaultType);
|
|
20
21
|
const isPasswordInput = type === 'password';
|
|
21
22
|
const togglePasswordType = useCallback(() => {
|
|
22
23
|
setType(isPasswordInput ? 'text' : 'password');
|
|
23
24
|
}, [isPasswordInput]);
|
|
24
|
-
return (jsxs(TextField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles.field, styles[size]), defaultValue: defaultValue, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxLength: maxLength, minLength: minLength, name: name, onChange: value => {
|
|
25
|
+
return (jsxs(TextField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles.field, styles[size]), "data-info": info ? true : undefined, defaultValue: defaultValue, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxLength: maxLength, minLength: minLength, name: name, onChange: value => {
|
|
25
26
|
onChange?.(value);
|
|
26
|
-
}, onInput: onInput, onKeyUp: e => onKeyUp?.(e), validate: validate, value: value, children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), isMultiline ? (jsx(TextArea, { autoGrow: autoGrow, label: label, placeholder: placeholder, rows: rows, size: size })) : (jsx(Input, { autoGrow: autoGrow, inlineElement: defaultType === 'password' && (jsx(PasswordRevealToggle, { onChange: togglePasswordType, showPassword: !isPasswordInput })), label: label, placeholder: placeholder, size: size, type: type })), jsx(FieldError, {}, Math.random())] }));
|
|
27
|
+
}, onInput: onInput, onKeyUp: e => onKeyUp?.(e), validate: validate, value: value, children: [showLabel && (jsx(Label, { className: styles['label'], "data-test-selector": dataTestSelector ? `${dataTestSelector}-label` : undefined, isRequired: isRequired, children: label })), isMultiline ? (jsx(TextArea, { autoGrow: autoGrow, className: styles['input'], "data-test-selector": dataTestSelector, label: label, placeholder: placeholder, rows: rows, size: size })) : (jsx(Input, { autoGrow: autoGrow, className: styles['input'], "data-test-selector": dataTestSelector, inlineElement: defaultType === 'password' && (jsx(PasswordRevealToggle, { onChange: togglePasswordType, showPassword: !isPasswordInput })), label: label, placeholder: placeholder, size: size, type: type })), info && (jsx(InfoIconTooltip, { className: styles['info'], children: info })), jsx(FieldError, { className: styles['error'] }, Math.random())] }));
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export { TextField };
|
|
@@ -2,6 +2,7 @@ import { ComponentProps, FC } from 'react';
|
|
|
2
2
|
import { TextArea as AriaTextArea } from 'react-aria-components';
|
|
3
3
|
export interface TextAreaProps extends Omit<ComponentProps<typeof AriaTextArea>, 'size'> {
|
|
4
4
|
autoGrow?: boolean;
|
|
5
|
+
className?: string;
|
|
5
6
|
label: string;
|
|
6
7
|
size?: 'md' | 'lg';
|
|
7
8
|
}
|