@sonic-equipment/ui 0.0.103 → 0.0.104
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/index.d.ts +9 -12
- package/dist/index.js +152 -51
- package/dist/src/buttons/favorite/favorite-button.d.ts +2 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/shared/routing/route-button.d.ts +1 -8
- package/dist/src/shared/routing/route-button.stories.d.ts +1 -2
- package/dist/src/shared/routing/route-icon-button.d.ts +1 -0
- package/dist/src/shared/routing/route-link.d.ts +1 -9
- package/dist/src/shared/routing/route-link.stories.d.ts +1 -2
- package/dist/src/shared/routing/with-routing.d.ts +10 -0
- package/dist/src/shared/utils/local-storage.d.ts +6 -0
- package/dist/styles.css +77 -18
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4141,6 +4141,11 @@ declare function RouteProvider({ children, navigate }: RouteProviderProps): reac
|
|
|
4141
4141
|
declare function useOnNavigate(callback?: NavigateFn): NavigateFn;
|
|
4142
4142
|
declare function useNavigate(): NavigateFn;
|
|
4143
4143
|
|
|
4144
|
+
interface WithRoutingProps {
|
|
4145
|
+
href?: string;
|
|
4146
|
+
route?: NavigateOptions;
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4144
4149
|
interface LinkProps$1 extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
4145
4150
|
areaSelected?: boolean
|
|
4146
4151
|
color?: 'primary' | 'secondary'
|
|
@@ -4149,11 +4154,7 @@ interface LinkProps$1 extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
4149
4154
|
role?: 'option'
|
|
4150
4155
|
}
|
|
4151
4156
|
|
|
4152
|
-
|
|
4153
|
-
onClick?: (e: MouseEvent<HTMLAnchorElement>) => void;
|
|
4154
|
-
route?: NavigateOptions;
|
|
4155
|
-
}
|
|
4156
|
-
declare function RouteLink({ children, ...props }: RouteLinkProps): react_jsx_runtime.JSX.Element;
|
|
4157
|
+
declare const RouteLink: React.FC<LinkProps$1 & WithRoutingProps>;
|
|
4157
4158
|
|
|
4158
4159
|
interface ButtonProps$1 {
|
|
4159
4160
|
_pseudo?: 'none' | 'focus' | 'hover' | 'active'
|
|
@@ -4171,11 +4172,7 @@ interface ButtonProps$1 {
|
|
|
4171
4172
|
withArrow?: boolean
|
|
4172
4173
|
}
|
|
4173
4174
|
|
|
4174
|
-
|
|
4175
|
-
href?: string;
|
|
4176
|
-
route?: NavigateOptions;
|
|
4177
|
-
}
|
|
4178
|
-
declare function RouteButton({ children, onClick, ...props }: RouteButtonProps): react_jsx_runtime.JSX.Element;
|
|
4175
|
+
declare const RouteButton: React.FC<ButtonProps$1 & WithRoutingProps>;
|
|
4179
4176
|
|
|
4180
4177
|
interface DPRSrcSet {
|
|
4181
4178
|
1: string
|
|
@@ -4320,9 +4317,9 @@ declare function Button({ _pseudo, children, className, color, condensed, icon,
|
|
|
4320
4317
|
interface FavoriteButtonProps {
|
|
4321
4318
|
isDisabled?: boolean;
|
|
4322
4319
|
isFavorite: boolean;
|
|
4323
|
-
|
|
4320
|
+
onClick: () => void;
|
|
4324
4321
|
}
|
|
4325
|
-
declare function FavoriteButton({ isDisabled, isFavorite,
|
|
4322
|
+
declare function FavoriteButton({ isDisabled, isFavorite, onClick: onClick, }: FavoriteButtonProps): react_jsx_runtime.JSX.Element;
|
|
4326
4323
|
|
|
4327
4324
|
interface IconButtonProps {
|
|
4328
4325
|
children: React.ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import qs from 'query-string';
|
|
2
|
-
import React, { useMemo, useState, useCallback, useEffect, useRef, createContext, useContext, forwardRef, useLayoutEffect, Children, cloneElement,
|
|
2
|
+
import React, { useMemo, useState, useCallback, useEffect, useRef, createContext, useContext, createElement as createElement$1, forwardRef, useLayoutEffect, Children, cloneElement, Fragment as Fragment$1 } from 'react';
|
|
3
3
|
import { useQuery, useQueryClient, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
4
4
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
5
5
|
import { deepEqual } from 'fast-equals';
|
|
@@ -20,6 +20,119 @@ import { getAlgoliaResults, parseAlgoliaHitHighlight } from '@algolia/autocomple
|
|
|
20
20
|
import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query-suggestions';
|
|
21
21
|
import { createLocalStorageRecentSearchesPlugin, search } from '@algolia/autocomplete-plugin-recent-searches';
|
|
22
22
|
|
|
23
|
+
/* eslint-disable no-prototype-builtins */
|
|
24
|
+
/** Mocks the localStorage and sessionStorage API in Node.js
|
|
25
|
+
* @see https://gitlab.com/kaictl/node/mock-local-storage */
|
|
26
|
+
const HAS_LOCAL_STORAGE_SUPPORT = typeof localStorage !== 'undefined';
|
|
27
|
+
function mockStorage() {
|
|
28
|
+
if (HAS_LOCAL_STORAGE_SUPPORT)
|
|
29
|
+
return;
|
|
30
|
+
// const global = require('global')
|
|
31
|
+
// const window = require('global/window')
|
|
32
|
+
let win;
|
|
33
|
+
if (typeof global !== 'undefined') {
|
|
34
|
+
win = global;
|
|
35
|
+
}
|
|
36
|
+
else if (typeof self !== 'undefined') {
|
|
37
|
+
win = self;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
win = {};
|
|
41
|
+
}
|
|
42
|
+
Object.defineProperty(global, 'Storage', {
|
|
43
|
+
value: createStorage,
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(win, 'Storage', {
|
|
46
|
+
value: createStorage,
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(global, 'localStorage', {
|
|
49
|
+
value: createStorage(),
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(win, 'localStorage', {
|
|
52
|
+
value: global.localStorage,
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(global, 'sessionStorage', {
|
|
55
|
+
value: createStorage(),
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(win, 'sessionStorage', {
|
|
58
|
+
value: global.sessionStorage,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function createStorage() {
|
|
62
|
+
const UNSET = Symbol();
|
|
63
|
+
const s = {};
|
|
64
|
+
const noopCallback = () => { };
|
|
65
|
+
let _itemInsertionCallback = noopCallback;
|
|
66
|
+
Object.defineProperty(s, 'setItem', {
|
|
67
|
+
get: () => {
|
|
68
|
+
return (k, v = UNSET) => {
|
|
69
|
+
if (v === UNSET) {
|
|
70
|
+
throw new TypeError(`Failed to execute 'setItem' on 'Storage': 2 arguments required, but only 1 present.`);
|
|
71
|
+
}
|
|
72
|
+
if (!s.hasOwnProperty(String(k))) {
|
|
73
|
+
_itemInsertionCallback();
|
|
74
|
+
}
|
|
75
|
+
s[String(k)] = String(v);
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(s, 'getItem', {
|
|
80
|
+
get: () => {
|
|
81
|
+
return k => {
|
|
82
|
+
if (s.hasOwnProperty(String(k))) {
|
|
83
|
+
return s[String(k)];
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(s, 'removeItem', {
|
|
92
|
+
get: () => {
|
|
93
|
+
return k => {
|
|
94
|
+
if (s.hasOwnProperty(String(k))) {
|
|
95
|
+
delete s[String(k)];
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(s, 'clear', {
|
|
101
|
+
get: () => {
|
|
102
|
+
return () => {
|
|
103
|
+
for (const k in s) {
|
|
104
|
+
delete s[String(k)];
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(s, 'length', {
|
|
110
|
+
get: () => {
|
|
111
|
+
return Object.keys(s).length;
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(s, 'key', {
|
|
115
|
+
value: k => {
|
|
116
|
+
const key = Object.keys(s)[String(k)];
|
|
117
|
+
return !key ? null : key;
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(s, 'itemInsertionCallback', {
|
|
121
|
+
get: () => {
|
|
122
|
+
return _itemInsertionCallback;
|
|
123
|
+
},
|
|
124
|
+
set: v => {
|
|
125
|
+
if (!v || typeof v != 'function') {
|
|
126
|
+
v = noopCallback;
|
|
127
|
+
}
|
|
128
|
+
_itemInsertionCallback = v;
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
return s;
|
|
132
|
+
}
|
|
133
|
+
// Mock localStorage
|
|
134
|
+
mockStorage();
|
|
135
|
+
|
|
23
136
|
const environments = [
|
|
24
137
|
'sandbox',
|
|
25
138
|
'production',
|
|
@@ -375,7 +488,6 @@ const features = {
|
|
|
375
488
|
plpv1: 'plpV1',
|
|
376
489
|
searchv1: 'searchV1',
|
|
377
490
|
};
|
|
378
|
-
const HAS_LOCAL_STORAGE_SUPPORT = typeof localStorage !== 'undefined';
|
|
379
491
|
function useFeatureFlags() {
|
|
380
492
|
const { search } = typeof window !== 'undefined'
|
|
381
493
|
? window.location
|
|
@@ -389,9 +501,7 @@ function useFeatureFlags() {
|
|
|
389
501
|
/* When no new feature flags are set get them from localStorage */
|
|
390
502
|
return Object.entries(features).reduce((acc, [, value]) => ({
|
|
391
503
|
...acc,
|
|
392
|
-
[value]:
|
|
393
|
-
? localStorage.getItem(value) === 'true'
|
|
394
|
-
: false,
|
|
504
|
+
[value]: localStorage.getItem(value) === 'true',
|
|
395
505
|
}), {});
|
|
396
506
|
}
|
|
397
507
|
const queryStringFeatures = String(queryParams['features'])
|
|
@@ -403,8 +513,6 @@ function useFeatureFlags() {
|
|
|
403
513
|
value: value,
|
|
404
514
|
}));
|
|
405
515
|
featureResults.forEach(({ selected, value }) => {
|
|
406
|
-
if (!HAS_LOCAL_STORAGE_SUPPORT)
|
|
407
|
-
return;
|
|
408
516
|
localStorage.setItem(value, selected.toString());
|
|
409
517
|
});
|
|
410
518
|
return featureResults.reduce((acc, { selected, value }) => ({
|
|
@@ -1201,28 +1309,33 @@ function Link({ children, className, color = 'primary', hasUnderline, isDisabled
|
|
|
1201
1309
|
return (jsx("a", { className: clsx({ [styles$19['has-underline']]: hasUnderline }, styles$19['link'], styles$19[color], className), "data-disabled": isDisabled ? true : undefined, onClick: onClick, ...props, children: children }));
|
|
1202
1310
|
}
|
|
1203
1311
|
|
|
1204
|
-
function
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1207
|
-
props
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1312
|
+
function withRouting(component) {
|
|
1313
|
+
const Component = ({ href, onClick, route, ...rest }) => {
|
|
1314
|
+
const navigate = useNavigate();
|
|
1315
|
+
const props = {
|
|
1316
|
+
...rest,
|
|
1317
|
+
onClick(e) {
|
|
1318
|
+
onClick?.(e);
|
|
1319
|
+
if (!href)
|
|
1320
|
+
return;
|
|
1321
|
+
e.preventDefault();
|
|
1322
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1323
|
+
if (rest.isDisabled || rest.disabled)
|
|
1324
|
+
return;
|
|
1325
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
1326
|
+
return window.open(href, '_blank');
|
|
1327
|
+
}
|
|
1328
|
+
navigate(href, route);
|
|
1329
|
+
},
|
|
1330
|
+
};
|
|
1331
|
+
return createElement$1(component, props);
|
|
1332
|
+
};
|
|
1333
|
+
Component.displayName = component.displayName;
|
|
1334
|
+
return Component;
|
|
1224
1335
|
}
|
|
1225
1336
|
|
|
1337
|
+
const RouteLink = withRouting(Link);
|
|
1338
|
+
|
|
1226
1339
|
function GlyphsArrowBoldCapsRightIcon(props) {
|
|
1227
1340
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "11", viewBox: "0 0 11 11", width: "11", children: jsx("path", { d: "M2.31124163,11 C2.06716529,11 1.91839241,10.7730596 2.04771379,10.5980857 L6.08820761,5.13116556 C6.42092595,4.68081431 6.37243043,4.10595375 5.96732409,3.70073526 L2.70240329,0.432177991 C2.53178078,0.261409485 2.67540212,0 2.93972934,0 L5.48361239,0 C5.57518542,0 5.6619622,0.0340936243 5.72102726,0.0931942463 L8.14882304,2.52367916 C9.1607451,3.53657521 9.28198389,4.9729381 8.45036569,6.09787751 L4.91836426,10.876542 C4.86160851,10.9533653 4.7620417,11 4.65492523,11 L2.31124163,11 Z", fillRule: "evenodd" }) }));
|
|
1228
1341
|
}
|
|
@@ -1243,21 +1356,7 @@ function Button({ _pseudo = 'none', children, className, color = 'primary', cond
|
|
|
1243
1356
|
return (jsxs("button", { className: clsx({ [buttonStyles.condensed]: condensed }, { [buttonStyles.icon]: icon }, buttonStyles.button, buttonStyles[variant], buttonStyles[size], buttonStyles[color], buttonStyles[_pseudo], className), "data-disabled": isDisabled ? true : undefined, disabled: isDisabled, onClick: onClick, type: type, children: [jsx(Fragment, { children: showIconOnLeft && jsx("span", { className: buttonStyles.icon, children: icon }) }), children, withArrow && (jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })), showIconOnRight && jsx("span", { className: buttonStyles.icon, children: icon })] }));
|
|
1244
1357
|
}
|
|
1245
1358
|
|
|
1246
|
-
|
|
1247
|
-
const navigate = useNavigate();
|
|
1248
|
-
return (jsx(Button, { onClick: e => {
|
|
1249
|
-
onClick?.(e);
|
|
1250
|
-
if (!props.href)
|
|
1251
|
-
return;
|
|
1252
|
-
e.preventDefault();
|
|
1253
|
-
if (props.isDisabled)
|
|
1254
|
-
return;
|
|
1255
|
-
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
1256
|
-
return window.open(props.href, '_blank');
|
|
1257
|
-
}
|
|
1258
|
-
navigate(props.href, props.route);
|
|
1259
|
-
}, ...props, children: children }));
|
|
1260
|
-
}
|
|
1359
|
+
const RouteButton = withRouting(Button);
|
|
1261
1360
|
|
|
1262
1361
|
function transformAlgoliaPromoHitToPromoHit(algoliaPromoHit) {
|
|
1263
1362
|
return {
|
|
@@ -1341,9 +1440,9 @@ var styles$17 = {"icon-button":"icon-button-module-4PDK-","md":"icon-button-modu
|
|
|
1341
1440
|
|
|
1342
1441
|
function IconButton({ children, className, color = 'primary', isDisabled, onClick, size = 'md', type = 'button', }) {
|
|
1343
1442
|
return (jsx("button", { className: clsx(styles$17['icon-button'], styles$17[size], styles$17[color], className), "data-disabled": isDisabled ? true : undefined, disabled: isDisabled, onClick: e => {
|
|
1344
|
-
onClick?.(e);
|
|
1345
1443
|
e.preventDefault();
|
|
1346
1444
|
e.stopPropagation();
|
|
1445
|
+
onClick?.(e);
|
|
1347
1446
|
}, type: type, children: children }));
|
|
1348
1447
|
}
|
|
1349
1448
|
|
|
@@ -1357,10 +1456,10 @@ function StrokeFavoriteIcon(props) {
|
|
|
1357
1456
|
|
|
1358
1457
|
var styles$16 = {"favorite-button":"favorite-button-module-tXSS3","is-favorite":"favorite-button-module-l557q","favorite-on":"favorite-button-module-6Tsmy","favorite-off":"favorite-button-module-LQauU"};
|
|
1359
1458
|
|
|
1360
|
-
function FavoriteButton({ isDisabled, isFavorite,
|
|
1459
|
+
function FavoriteButton({ isDisabled, isFavorite, onClick: onClick, }) {
|
|
1361
1460
|
return (jsx(IconButton, { className: clsx(styles$16['favorite-button'], {
|
|
1362
1461
|
[styles$16['is-favorite']]: isFavorite,
|
|
1363
|
-
}), color: "secondary", isDisabled: isDisabled, onClick:
|
|
1462
|
+
}), color: "secondary", isDisabled: isDisabled, onClick: onClick, children: isFavorite ? jsx(SolidFavoriteIcon, {}) : jsx(StrokeFavoriteIcon, {}) }));
|
|
1364
1463
|
}
|
|
1365
1464
|
|
|
1366
1465
|
var styles$15 = {"field-error":"field-error-module-FXnIg"};
|
|
@@ -8101,9 +8200,11 @@ function useFetchCurrentCartCount() {
|
|
|
8101
8200
|
return data?.reduce((acc, cartLine) => acc + (cartLine.qtyOrdered || 0), 0);
|
|
8102
8201
|
}
|
|
8103
8202
|
|
|
8203
|
+
const RouteIconButton = withRouting(IconButton);
|
|
8204
|
+
|
|
8104
8205
|
function ConnectedCartIcon({ href }) {
|
|
8105
8206
|
const count = useFetchCurrentCartCount();
|
|
8106
|
-
return (jsx(
|
|
8207
|
+
return (jsx(RouteIconButton, { href: href, children: jsx(IconWithBadge, { badge: count ? jsx(Badge, { count: count }) : undefined, icon: jsx(SolidCartIcon, {}) }) }));
|
|
8107
8208
|
}
|
|
8108
8209
|
|
|
8109
8210
|
function IntlProvider({ children, formatMessage, languageCode: _languageCode, }) {
|
|
@@ -8217,7 +8318,7 @@ function ConnectedAnnouncement({ announcement: { endDate, startDate, ...announce
|
|
|
8217
8318
|
return jsx(Announcement, { announcement: announcement, onDismiss: onDismiss });
|
|
8218
8319
|
}
|
|
8219
8320
|
|
|
8220
|
-
var styles$B = {"announcement-enter":"announcement-provider-module-ksjgO","announcement-enter-active":"announcement-provider-module-k0zd-","announcement-exit":"announcement-provider-module-w2N0B","announcement-exit-active":"announcement-provider-module-4lfx2"};
|
|
8321
|
+
var styles$B = {"announcement-provider":"announcement-provider-module-sVIKY","announcement-enter":"announcement-provider-module-ksjgO","announcement-enter-active":"announcement-provider-module-k0zd-","announcement-exit":"announcement-provider-module-w2N0B","announcement-exit-active":"announcement-provider-module-4lfx2"};
|
|
8221
8322
|
|
|
8222
8323
|
function AnnouncementProvider() {
|
|
8223
8324
|
const languageCode = useLanguageCode();
|
|
@@ -8226,7 +8327,7 @@ function AnnouncementProvider() {
|
|
|
8226
8327
|
});
|
|
8227
8328
|
const [dismissedIds, setDismissedIds] = useLocalStorage('dismissedAnnouncementIds', []);
|
|
8228
8329
|
const filteredAnnouncements = announcements?.filter(({ id }) => !dismissedIds.includes(id));
|
|
8229
|
-
return (jsx(TransitionGroup, { children: filteredAnnouncements?.map(({ href, id, text, title, type }) => (jsx(CSSTransition, { classNames: {
|
|
8330
|
+
return (jsx(TransitionGroup, { className: styles$B['announcement-provider'], children: filteredAnnouncements?.map(({ href, id, text, title, type }) => (jsx(CSSTransition, { classNames: {
|
|
8230
8331
|
enter: styles$B['announcement-enter'],
|
|
8231
8332
|
enterActive: styles$B['announcement-enter-active'],
|
|
8232
8333
|
exit: styles$B['announcement-exit'],
|
|
@@ -8270,7 +8371,7 @@ var styles$x = {"sign-in-dialog":"sign-in-dialog-module-P-AHV"};
|
|
|
8270
8371
|
function SignInDialog({ isOpen, onOpenChange }) {
|
|
8271
8372
|
const { signInUrl } = useFavorite();
|
|
8272
8373
|
const t = useFormattedMessage();
|
|
8273
|
-
return (jsx(Dialog, { isDismissable: true, dialogClassName: styles$x['sign-in-dialog'], footer: jsxs(Fragment, { children: [jsx(RouteButton, { color: "primary", href: `${signInUrl}?returnUrl=${encodeURIComponent(window.location.pathname + window.location.search)}`, onClick: () => onOpenChange(false), variant: "solid", children: jsx(FormattedMessage, { id: "sign in" }) }), jsx(RouteButton, { color: "secondary", href: `${signInUrl}?returnUrl=${encodeURIComponent(window.location.pathname + window.location.search)}`, onClick: () => onOpenChange(false), variant: "outline", children: jsx(FormattedMessage, { id: "create account" }) })] }), isOpen: isOpen, onOpenChange: onOpenChange, title: t('Shop more efficiently and quicker with a favorites list'), children: jsxs(List, { children: [jsx(ListItem, { icon: jsx(SolidOkayIcon, { fill: "var(--color-status-available)" }), text: t('Easily add your favorite products') }), jsx(ListItem, { icon: jsx(SolidOkayIcon, { fill: "var(--color-status-available)" }), text: t('Your favorites are available on multiple devices') }), jsx(ListItem, { icon: jsx(SolidOkayIcon, { fill: "var(--color-status-available)" }), text: t('Share your favorite list with others') })] }) }));
|
|
8374
|
+
return (jsx(Dialog, { isDismissable: true, dialogClassName: styles$x['sign-in-dialog'], footer: jsxs(Fragment, { children: [jsx(RouteButton, { withArrow: true, color: "primary", href: `${signInUrl}?returnUrl=${encodeURIComponent(window.location.pathname + window.location.search)}`, onClick: () => onOpenChange(false), variant: "solid", children: jsx(FormattedMessage, { id: "sign in" }) }), jsx(RouteButton, { color: "secondary", href: `${signInUrl}?returnUrl=${encodeURIComponent(window.location.pathname + window.location.search)}`, onClick: () => onOpenChange(false), variant: "outline", children: jsx(FormattedMessage, { id: "create account" }) })] }), isOpen: isOpen, onOpenChange: onOpenChange, title: t('Shop more efficiently and quicker with a favorites list'), children: jsxs(List, { children: [jsx(ListItem, { icon: jsx(SolidOkayIcon, { fill: "var(--color-status-available)" }), text: t('Easily add your favorite products') }), jsx(ListItem, { icon: jsx(SolidOkayIcon, { fill: "var(--color-status-available)" }), text: t('Your favorites are available on multiple devices') }), jsx(ListItem, { icon: jsx(SolidOkayIcon, { fill: "var(--color-status-available)" }), text: t('Share your favorite list with others') })] }) }));
|
|
8274
8375
|
}
|
|
8275
8376
|
|
|
8276
8377
|
function ConnectedFavoriteButton({ onFavorited: _onFavorited, onFavoriting: _onFavoriting, productId, }) {
|
|
@@ -8321,7 +8422,7 @@ function ConnectedFavoriteButton({ onFavorited: _onFavorited, onFavoriting: _onF
|
|
|
8321
8422
|
}, [addWishListItemToCurrentWishListError, refetch]);
|
|
8322
8423
|
if (isFetching)
|
|
8323
8424
|
return null;
|
|
8324
|
-
return (jsxs(Fragment, { children: [jsx(FavoriteButton, { isDisabled: isFetching, isFavorite: isFavorite,
|
|
8425
|
+
return (jsxs(Fragment, { children: [jsx(FavoriteButton, { isDisabled: isFetching, isFavorite: isFavorite, onClick: onFavorite }), jsx(SignInDialog, { isOpen: showSignInDialog, onOpenChange: setShowSignInDialog })] }));
|
|
8325
8426
|
}
|
|
8326
8427
|
|
|
8327
8428
|
function ConnectedProductCard({ id, onAddToCart, onFavorited, onFavoriting, ...props }) {
|
|
@@ -8548,7 +8649,7 @@ const USPCarousel = ({ slides }) => {
|
|
|
8548
8649
|
};
|
|
8549
8650
|
|
|
8550
8651
|
function ProductUsp({ usp }) {
|
|
8551
|
-
return (jsxs("div", { className: styles$u['product-usp'], children: [jsx("div", { className: styles$u.left, children: jsx(Image, { className: styles$u.image, fit: "cover", image: usp.image, title: usp.image.altText }) }), jsx("div", { className: styles$u.right, children: jsxs("div", { "data-content": true, className: styles$u.content, children: [jsx(Image, { className: styles$u.icon, image: usp.icon, title: usp.icon.altText }), jsx(Heading, { italic: true, uppercase: true, className: styles$u.title, size: "xs", children: usp.heading }), jsx("
|
|
8652
|
+
return (jsxs("div", { className: styles$u['product-usp'], children: [jsx("div", { className: styles$u.left, children: jsx(Image, { className: styles$u.image, fit: "cover", image: usp.image, title: usp.image.altText }) }), jsx("div", { className: styles$u.right, children: jsxs("div", { "data-content": true, className: styles$u.content, children: [jsx(Image, { className: styles$u.icon, image: usp.icon, title: usp.icon.altText }), jsx(Heading, { italic: true, uppercase: true, className: styles$u.title, size: "xs", children: usp.heading }), jsx("div", { className: styles$u.text, dangerouslySetInnerHTML: { __html: usp.text } })] }) })] }));
|
|
8552
8653
|
}
|
|
8553
8654
|
|
|
8554
8655
|
function ProductUSPCarousel({ usps }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface FavoriteButtonProps {
|
|
2
2
|
isDisabled?: boolean;
|
|
3
3
|
isFavorite: boolean;
|
|
4
|
-
|
|
4
|
+
onClick: () => void;
|
|
5
5
|
}
|
|
6
|
-
export declare function FavoriteButton({ isDisabled, isFavorite,
|
|
6
|
+
export declare function FavoriteButton({ isDisabled, isFavorite, onClick: onClick, }: FavoriteButtonProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { NavigateOptions } from './route-provider';
|
|
3
|
-
interface RouteButtonProps extends ButtonProps {
|
|
4
|
-
href?: string;
|
|
5
|
-
route?: NavigateOptions;
|
|
6
|
-
}
|
|
7
|
-
export declare function RouteButton({ children, onClick, ...props }: RouteButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
1
|
+
export declare const RouteButton: React.FC<import("buttons/button/button").ButtonProps & import("./with-routing").WithRoutingProps>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
|
-
import { RouteButton } from './route-button';
|
|
3
2
|
declare const meta: {
|
|
4
3
|
args: {
|
|
5
4
|
children: string;
|
|
6
5
|
href: string;
|
|
7
6
|
};
|
|
8
|
-
component:
|
|
7
|
+
component: React.FC<import("../..").ButtonProps & import("./with-routing").WithRoutingProps>;
|
|
9
8
|
parameters: {
|
|
10
9
|
layout: string;
|
|
11
10
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RouteIconButton: React.FC<import("buttons/icon-button/icon-button").IconButtonProps & import("./with-routing").WithRoutingProps>;
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { LinkProps } from 'buttons/link/link';
|
|
3
|
-
import { NavigateOptions } from './route-provider';
|
|
4
|
-
interface RouteLinkProps extends Omit<LinkProps, 'onPress'> {
|
|
5
|
-
onClick?: (e: MouseEvent<HTMLAnchorElement>) => void;
|
|
6
|
-
route?: NavigateOptions;
|
|
7
|
-
}
|
|
8
|
-
export declare function RouteLink({ children, ...props }: RouteLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
1
|
+
export declare const RouteLink: React.FC<import("buttons/link/link").LinkProps & import("./with-routing").WithRoutingProps>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
|
-
import { RouteLink } from './route-link';
|
|
3
2
|
declare const meta: {
|
|
4
3
|
args: {
|
|
5
4
|
children: string;
|
|
6
5
|
href: string;
|
|
7
6
|
};
|
|
8
|
-
component:
|
|
7
|
+
component: React.FC<import("../..").LinkProps & import("./with-routing").WithRoutingProps>;
|
|
9
8
|
parameters: {
|
|
10
9
|
layout: string;
|
|
11
10
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentProps, ComponentType, FC, MouseEventHandler } from 'react';
|
|
2
|
+
import { NavigateOptions } from './route-provider';
|
|
3
|
+
export interface WithRoutingProps {
|
|
4
|
+
href?: string;
|
|
5
|
+
route?: NavigateOptions;
|
|
6
|
+
}
|
|
7
|
+
export declare function withRouting<TComponent extends ComponentType<TProps>, TProps extends {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
onClick?: MouseEventHandler<TElement> | undefined;
|
|
10
|
+
}, TElement extends HTMLElement>(component: TComponent): FC<ComponentProps<TComponent> & WithRoutingProps>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Mocks the localStorage and sessionStorage API in Node.js
|
|
2
|
+
* @see https://gitlab.com/kaictl/node/mock-local-storage */
|
|
3
|
+
declare const HAS_LOCAL_STORAGE_SUPPORT: boolean;
|
|
4
|
+
declare function mockStorage(): void;
|
|
5
|
+
declare function createStorage(): {};
|
|
6
|
+
declare const _: void;
|
package/dist/styles.css
CHANGED
|
@@ -44,39 +44,50 @@
|
|
|
44
44
|
--line-height-38: 2.375rem;
|
|
45
45
|
--line-height-42: 2.625rem;
|
|
46
46
|
--line-height-44: 2.75rem;
|
|
47
|
+
--line-height-46: 2.875rem;
|
|
48
|
+
--line-height-48: 3rem;
|
|
47
49
|
--line-height-56: 3.5rem;
|
|
50
|
+
--line-height-60: 3.75rem;
|
|
48
51
|
--line-height-84: 5.25rem;
|
|
52
|
+
--line-height-88: 5.5rem;
|
|
49
53
|
|
|
50
54
|
/* base line height */
|
|
51
55
|
--line-height-base: var(--line-height-24);
|
|
52
56
|
|
|
53
57
|
/* headings xxl */
|
|
54
58
|
--text-heading-xxl-size: var(--font-size-96);
|
|
55
|
-
--text-heading-xxl-line-height: var(--line-height-
|
|
59
|
+
--text-heading-xxl-line-height: var(--line-height-88);
|
|
60
|
+
--text-heading-xxl-line-height-uppercase: var(--line-height-84);
|
|
56
61
|
|
|
57
62
|
/* headings xl */
|
|
58
63
|
--text-heading-xl-size: var(--font-size-64);
|
|
59
|
-
--text-heading-xl-line-height: var(--line-height-
|
|
64
|
+
--text-heading-xl-line-height: var(--line-height-60);
|
|
65
|
+
--text-heading-xl-line-height-uppercase: var(--line-height-56);
|
|
60
66
|
|
|
61
67
|
/* headings l */
|
|
62
68
|
--text-heading-l-size: var(--font-size-52);
|
|
63
|
-
--text-heading-l-line-height: var(--line-height-
|
|
69
|
+
--text-heading-l-line-height: var(--line-height-48);
|
|
70
|
+
--text-heading-l-line-height-uppercase: var(--line-height-44);
|
|
64
71
|
|
|
65
72
|
/* headings m */
|
|
66
73
|
--text-heading-m-size: var(--font-size-48);
|
|
67
|
-
--text-heading-m-line-height: var(--line-height-
|
|
74
|
+
--text-heading-m-line-height: var(--line-height-46);
|
|
75
|
+
--text-heading-m-line-height-uppercase: var(--line-height-42);
|
|
68
76
|
|
|
69
77
|
/* headings s */
|
|
70
78
|
--text-heading-s-size: var(--font-size-44);
|
|
71
|
-
--text-heading-s-line-height: var(--line-height-
|
|
79
|
+
--text-heading-s-line-height: var(--line-height-42);
|
|
80
|
+
--text-heading-s-line-height-uppercase: var(--line-height-38);
|
|
72
81
|
|
|
73
82
|
/* headings xs */
|
|
74
83
|
--text-heading-xs-size: var(--font-size-32);
|
|
75
|
-
--text-heading-xs-line-height: var(--line-height-
|
|
84
|
+
--text-heading-xs-line-height: var(--line-height-32);
|
|
85
|
+
--text-heading-xs-line-height-uppercase: var(--line-height-28);
|
|
76
86
|
|
|
77
87
|
/* headings xxs */
|
|
78
88
|
--text-heading-xxs-size: var(--font-size-24);
|
|
79
89
|
--text-heading-xxs-line-height: var(--line-height-22);
|
|
90
|
+
--text-heading-xxs-line-height-uppercase: var(--line-height-24);
|
|
80
91
|
}
|
|
81
92
|
:root {
|
|
82
93
|
/*********************************************************
|
|
@@ -541,12 +552,10 @@
|
|
|
541
552
|
color: currentcolor;
|
|
542
553
|
}
|
|
543
554
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
.icon-button-module-fTeP4:where([data-pressed]), .icon-button-module-dM0eo:where([data-pressed]) {
|
|
549
|
-
color: var(--color-brand-dark-red);
|
|
555
|
+
@media (hover: hover) {
|
|
556
|
+
.icon-button-module-fTeP4:hover, .icon-button-module-dM0eo:hover {
|
|
557
|
+
color: var(--color-brand-red);
|
|
558
|
+
}
|
|
550
559
|
}
|
|
551
560
|
|
|
552
561
|
.favorite-button-module-tXSS3:where(.favorite-button-module-l557q) {
|
|
@@ -1405,11 +1414,11 @@
|
|
|
1405
1414
|
transition: background-color 0.2s ease;
|
|
1406
1415
|
}
|
|
1407
1416
|
|
|
1408
|
-
.carousel-navigation-button-module-a1-I4
|
|
1417
|
+
.carousel-navigation-button-module-a1-I4:hover {
|
|
1409
1418
|
background-color: var(--color-brand-light-gray);
|
|
1410
1419
|
}
|
|
1411
1420
|
|
|
1412
|
-
.carousel-navigation-button-module-a1-I4[
|
|
1421
|
+
.carousel-navigation-button-module-a1-I4[disabled],
|
|
1413
1422
|
.carousel-navigation-button-module-a1-I4.swiper-button-disabled {
|
|
1414
1423
|
background-color: var(--color-brand-white);
|
|
1415
1424
|
color: #bcbcbc66;
|
|
@@ -1527,6 +1536,14 @@
|
|
|
1527
1536
|
top: 50%;
|
|
1528
1537
|
}
|
|
1529
1538
|
|
|
1539
|
+
.carousel-module-ealh- .carousel-module-k7Z4S.carousel-module-5SGYn .carousel-module-kcqEE.carousel-module-984Rr {
|
|
1540
|
+
transform: translate(-50%, -50%);
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
.carousel-module-ealh- .carousel-module-k7Z4S.carousel-module-5SGYn .carousel-module-kcqEE.carousel-module-T7bTr {
|
|
1544
|
+
transform: translate(50%, -50%);
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1530
1547
|
@media (width < 1024px) {
|
|
1531
1548
|
.carousel-module-ealh-:has(.carousel-module-tPg7k) {
|
|
1532
1549
|
width: calc(100% + 20px);
|
|
@@ -2025,39 +2042,68 @@
|
|
|
2025
2042
|
line-height: var(--text-heading-xxl-line-height);
|
|
2026
2043
|
}
|
|
2027
2044
|
|
|
2045
|
+
.heading-module-pMC65:where(.heading-module-Kn3ZN).heading-module-6spgX {
|
|
2046
|
+
line-height: var(--text-heading-xxl-line-height-uppercase);
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2028
2049
|
.heading-module-pMC65:where(.heading-module--hZs-) {
|
|
2029
2050
|
font-size: var(--text-heading-xl-size);
|
|
2030
2051
|
line-height: var(--text-heading-xl-line-height);
|
|
2031
2052
|
}
|
|
2032
2053
|
|
|
2054
|
+
.heading-module-pMC65:where(.heading-module--hZs-).heading-module-6spgX {
|
|
2055
|
+
line-height: var(--text-heading-xl-line-height-uppercase);
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2033
2058
|
.heading-module-pMC65:where(.heading-module-WrJRY) {
|
|
2034
2059
|
font-size: var(--text-heading-l-size);
|
|
2035
2060
|
line-height: var(--text-heading-l-line-height);
|
|
2036
2061
|
}
|
|
2037
2062
|
|
|
2063
|
+
.heading-module-pMC65:where(.heading-module-WrJRY).heading-module-6spgX {
|
|
2064
|
+
line-height: var(--text-heading-l-line-height-uppercase);
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2038
2067
|
.heading-module-pMC65:where(.heading-module-hTexc) {
|
|
2039
2068
|
font-size: var(--text-heading-m-size);
|
|
2040
2069
|
line-height: var(--text-heading-m-line-height);
|
|
2041
2070
|
}
|
|
2042
2071
|
|
|
2072
|
+
.heading-module-pMC65:where(.heading-module-hTexc).heading-module-6spgX {
|
|
2073
|
+
line-height: var(--text-heading-m-line-height-uppercase);
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2043
2076
|
.heading-module-pMC65:where(.heading-module-7W29m) {
|
|
2044
2077
|
font-size: var(--text-heading-s-size);
|
|
2045
2078
|
line-height: var(--text-heading-s-line-height);
|
|
2046
2079
|
}
|
|
2047
2080
|
|
|
2081
|
+
.heading-module-pMC65:where(.heading-module-7W29m).heading-module-6spgX {
|
|
2082
|
+
line-height: var(--text-heading-s-line-height-uppercase);
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2048
2085
|
.heading-module-pMC65:where(.heading-module-SgaLB) {
|
|
2049
2086
|
font-size: var(--text-heading-xs-size);
|
|
2050
2087
|
line-height: var(--text-heading-xs-line-height);
|
|
2051
2088
|
}
|
|
2052
2089
|
|
|
2090
|
+
.heading-module-pMC65:where(.heading-module-SgaLB).heading-module-6spgX {
|
|
2091
|
+
line-height: var(--text-heading-xs-line-height-uppercase);
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2053
2094
|
.heading-module-pMC65:where(.heading-module-33en7) {
|
|
2054
2095
|
font-size: var(--text-heading-xxs-size);
|
|
2055
2096
|
line-height: var(--text-heading-xxs-line-height);
|
|
2056
2097
|
}
|
|
2057
2098
|
|
|
2099
|
+
.heading-module-pMC65:where(.heading-module-33en7).heading-module-6spgX {
|
|
2100
|
+
line-height: var(--text-heading-xxs-line-height-uppercase);
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2058
2103
|
.dialog-module-qKzgy {
|
|
2059
2104
|
position: relative;
|
|
2060
|
-
padding:
|
|
2105
|
+
padding: var(--space-24);
|
|
2106
|
+
padding-right: var(--space-32);
|
|
2061
2107
|
}
|
|
2062
2108
|
|
|
2063
2109
|
.dialog-module-qKzgy,
|
|
@@ -2069,6 +2115,7 @@
|
|
|
2069
2115
|
display: flex;
|
|
2070
2116
|
align-items: center;
|
|
2071
2117
|
justify-content: space-between;
|
|
2118
|
+
font-weight: var(--font-weight-bold);
|
|
2072
2119
|
gap: 8px;
|
|
2073
2120
|
line-height: 1;
|
|
2074
2121
|
}
|
|
@@ -2079,14 +2126,15 @@
|
|
|
2079
2126
|
|
|
2080
2127
|
.dialog-module-qKzgy .dialog-module-ZnsAe .dialog-module-Y7Tqg {
|
|
2081
2128
|
position: absolute;
|
|
2082
|
-
top:
|
|
2083
|
-
right:
|
|
2129
|
+
top: -8px;
|
|
2130
|
+
right: -8px;
|
|
2084
2131
|
}
|
|
2085
2132
|
|
|
2086
2133
|
.dialog-module-qKzgy .dialog-module-y7Axm {
|
|
2087
2134
|
display: flex;
|
|
2088
2135
|
flex-direction: column;
|
|
2089
2136
|
margin-top: var(--space-32);
|
|
2137
|
+
margin-right: calc(-1 * var(--space-8));
|
|
2090
2138
|
gap: 8px;
|
|
2091
2139
|
}
|
|
2092
2140
|
|
|
@@ -2693,6 +2741,11 @@
|
|
|
2693
2741
|
}
|
|
2694
2742
|
}
|
|
2695
2743
|
|
|
2744
|
+
.announcement-provider-module-sVIKY {
|
|
2745
|
+
position: relative;
|
|
2746
|
+
z-index: calc(var(--header-layer) + 1);
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2696
2749
|
.announcement-provider-module-ksjgO {
|
|
2697
2750
|
margin-top: calc(-1 * var(--announcement-bar-height));
|
|
2698
2751
|
}
|
|
@@ -2780,7 +2833,6 @@
|
|
|
2780
2833
|
|
|
2781
2834
|
.sign-in-dialog-module-P-AHV {
|
|
2782
2835
|
max-width: 403px;
|
|
2783
|
-
padding: 28px 24px 36px;
|
|
2784
2836
|
}
|
|
2785
2837
|
|
|
2786
2838
|
.card-carousel-module-JXQmk {
|
|
@@ -3243,8 +3295,15 @@ button.swiper-pagination-bullet {
|
|
|
3243
3295
|
margin: 0;
|
|
3244
3296
|
font-size: var(--text-font-size);
|
|
3245
3297
|
line-height: var(--text-line-height);
|
|
3298
|
+
|
|
3299
|
+
/* stylelint-disable-next-line max-nesting-depth */
|
|
3246
3300
|
}
|
|
3247
3301
|
|
|
3302
|
+
.usp-carousel-module-UCbpX .usp-carousel-module-rtIrb .usp-carousel-module-2fygw .usp-carousel-module-AOJJg .usp-carousel-module-tq8R8 b,
|
|
3303
|
+
.usp-carousel-module-UCbpX .usp-carousel-module-rtIrb .usp-carousel-module-2fygw .usp-carousel-module-AOJJg .usp-carousel-module-tq8R8 strong {
|
|
3304
|
+
font-weight: var(--font-weight-bold);
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3248
3307
|
.usp-carousel-module-UCbpX .usp-carousel-module-rtIrb .usp-carousel-module-2fygw .usp-carousel-module-L5Kmv {
|
|
3249
3308
|
position: absolute;
|
|
3250
3309
|
bottom: 0;
|