@shopgate/engage 7.32.0-beta.6 → 7.32.0-beta.8
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/account/components/Profile/ProfileAddressBook.d.ts.map +1 -1
- package/account/components/Profile/ProfileAddressBook.js +13 -22
- package/account/components/Profile/ProfileAddressCard.d.ts.map +1 -1
- package/account/components/Profile/ProfileAddressCard.js +9 -18
- package/account/components/Profile/ProfileForm.d.ts.map +1 -1
- package/account/components/Profile/ProfileForm.js +15 -42
- package/account/components/ProfileContact/ProfileContact.js +13 -21
- package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts.map +1 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +40 -6
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +9 -2
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
- package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts +32 -0
- package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts.map +1 -0
- package/admin-preview/initialization/_internal/initialFrontendSettings.js +43 -0
- package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts +22 -0
- package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts.map +1 -0
- package/admin-preview/initialization/awaitInitialFrontendSettings.js +84 -0
- package/back-in-stock/components/BackInStockButton/index.js +5 -5
- package/cart/components/CartItem/CartItemProductLayout.js +1 -0
- package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.js +7 -14
- package/cart/components/CartItems/CartItemCardReservationLabelChangeStore.js +6 -24
- package/cart/components/CartItems/CartItems.js +8 -10
- package/cart/components/CartItems/CartItemsSubstitution.js +3 -2
- package/cart/components/CartSummaryWide/CartSummaryWide.js +2 -2
- package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.js +9 -23
- package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +8 -30
- package/cart/components/PaymentBar/testUtils/mockFactories.js +4 -11
- package/category/components/CategoryImage/index.js +13 -2
- package/checkout/components/AddressBook/AddressList.js +14 -23
- package/checkout/components/Checkout/CheckoutActions.js +4 -3
- package/checkout/components/Checkout/CheckoutAddress.js +8 -0
- package/checkout/components/Checkout/CheckoutSection.js +6 -2
- package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +6 -7
- package/checkout/components/ResponsiveBackButton/ResponsiveBackButton.js +7 -17
- package/components/Card/Card.d.ts +27 -0
- package/components/Card/Card.d.ts.map +1 -0
- package/components/Card/Card.js +57 -0
- package/components/Card/index.d.ts +4 -0
- package/components/Card/index.d.ts.map +1 -0
- package/components/Card/index.js +2 -0
- package/components/Card/spec.d.ts +2 -0
- package/components/Card/spec.d.ts.map +1 -0
- package/components/Card/spec.js +128 -0
- package/components/Card/useCardAppearance.d.ts +11 -0
- package/components/Card/useCardAppearance.d.ts.map +1 -0
- package/components/Card/useCardAppearance.js +22 -0
- package/components/ChipLayout/index.js +2 -4
- package/components/NavigationHandler/connector.js +1 -1
- package/components/NavigationHandler/spec.js +10 -1
- package/components/Paper/Paper.d.ts +48 -0
- package/components/Paper/Paper.d.ts.map +1 -0
- package/components/Paper/Paper.js +64 -0
- package/components/Paper/index.d.ts +3 -0
- package/components/Paper/index.d.ts.map +1 -0
- package/components/Paper/index.js +1 -0
- package/components/Paper/spec.d.ts +2 -0
- package/components/Paper/spec.d.ts.map +1 -0
- package/components/Paper/spec.js +131 -0
- package/components/RadioCard/RadioCard.d.ts.map +1 -1
- package/components/RadioCard/RadioCard.js +2 -1
- package/components/Tabs/components/Tab.d.ts.map +1 -1
- package/components/Tabs/components/Tab.js +14 -16
- package/components/Typography/Typography.d.ts +1 -1
- package/components/index.d.ts +4 -1
- package/components/index.d.ts.map +1 -1
- package/components/index.js +3 -2
- package/components/v2/Button/Button.d.ts +24 -13
- package/components/v2/Button/Button.d.ts.map +1 -1
- package/components/v2/Button/Button.js +89 -37
- package/components/v2/ButtonBase/ButtonBase.d.ts +50 -10
- package/components/v2/ButtonBase/ButtonBase.d.ts.map +1 -1
- package/components/v2/ButtonBase/ButtonBase.js +153 -16
- package/components/v2/ButtonBase/hooks.d.ts +0 -1
- package/components/v2/ButtonBase/hooks.d.ts.map +1 -1
- package/components/v2/ButtonBase/hooks.js +36 -12
- package/components/v2/ButtonGroup/ButtonGroup.d.ts +11 -5
- package/components/v2/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/components/v2/ButtonGroup/ButtonGroup.js +30 -18
- package/components/v2/CircularProgress/CircularProgress.d.ts.map +1 -1
- package/components/v2/CircularProgress/CircularProgress.js +10 -5
- package/core/hooks/useNavigation.d.ts +10 -2
- package/core/hooks/useNavigation.d.ts.map +1 -1
- package/core/hooks/useNavigation.js +1 -2
- package/core/initialization/index.d.ts.map +1 -1
- package/core/initialization/index.js +24 -5
- package/core/router/conductor.d.ts +9 -0
- package/core/router/helpers.d.ts +28 -15
- package/core/router/helpers.d.ts.map +1 -1
- package/core/router/helpers.js +8 -8
- package/development/components/DevelopmentSettings/DevelopmentSettings.js +3 -3
- package/favorites/components/FavoriteButtonWide/FavoriteButtonWide.js +7 -17
- package/favorites/components/Item/Item.d.ts +1 -1
- package/favorites/components/List/List.d.ts.map +1 -1
- package/favorites/components/List/List.js +0 -1
- package/favorites/components/List/ListContent.js +4 -5
- package/favorites/components/Lists/Lists.js +4 -5
- package/filter/components/FilterPageContent/components/ApplyButton/index.js +8 -10
- package/filter/components/FilterPageContent/components/ResetButton/index.js +8 -6
- package/locations/components/ChangeLocationButton/ChangeLocationButton.js +10 -14
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +4 -8
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcher.js +1 -1
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.js +8 -13
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherDefault.js +10 -10
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +8 -14
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherDefault.js +9 -10
- package/locations/components/ReserveForm/ReserveForm.js +6 -7
- package/locations/components/StoreDetails/components/GetDirectionsButton.js +2 -4
- package/locations/components/StoreDetails/components/StoreDetails.js +5 -10
- package/locations/components/StoreDetails/components/StoresNearbyListItem.js +13 -21
- package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +5 -11
- package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +5 -11
- package/locations/components/StoreList/StoreSelectLocationButton.js +5 -11
- package/login/components/ForgotPassword/ForgotPassword.js +11 -23
- package/orders/components/OrderDetails/OrderDetailsAuthenticate.js +5 -7
- package/orders/components/OrderHistory/OrderHistoryList.d.ts.map +1 -1
- package/orders/components/OrderHistory/OrderHistoryList.js +8 -9
- package/orders/components/OrderHistory/OrderHistoryTable.d.ts.map +1 -1
- package/orders/components/OrderHistory/OrderHistoryTable.js +4 -0
- package/package.json +7 -7
- package/page/components/NotFound.d.ts.map +1 -1
- package/page/components/NotFound.js +7 -6
- package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +1 -1
- package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.js +2 -2
- package/page/components/WidgetVideo/WidgetVideo.d.ts +1 -1
- package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -1
- package/page/helpers/index.d.ts +5 -2
- package/page/helpers/index.d.ts.map +1 -1
- package/page/helpers/index.js +8 -5
- package/page/widgets/Button/Button.js +2 -3
- package/page/widgets/NestedCategoryFilter/NestedCategoryFilter.js +8 -8
- package/page/widgets/ProductList/ProductList.js +18 -14
- package/page/widgets/Video/hooks.d.ts +2 -2
- package/product/components/ProductCard/index.js +27 -14
- package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +6 -3
- package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +1 -11
- package/product/components/ProductGrid/components/Item/components/ItemName/index.js +5 -1
- package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +19 -1
- package/product/components/ProductGrid/components/Item/index.js +10 -1
- package/product/components/ProductImage/ProductImage.d.ts.map +1 -1
- package/product/components/ProductImage/ProductImage.js +7 -2
- package/product/components/ProductImage/ProductImagePlaceholder.js +3 -3
- package/product/components/ProductSlider/index.js +4 -2
- package/product/components/RelationsSlider/RelationsSliderContent.js +3 -2
- package/product/components/RelationsSlider/constants.d.ts +3 -0
- package/product/components/RelationsSlider/constants.d.ts.map +1 -0
- package/product/components/RelationsSlider/constants.js +2 -1
- package/product/components/RelationsSlider/hooks.d.ts +6 -0
- package/product/components/RelationsSlider/hooks.d.ts.map +1 -0
- package/product/components/RelationsSlider/hooks.js +34 -0
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.d.ts.map +1 -1
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +14 -33
- package/push-opt-in/components/PushOptInModal/index.js +4 -4
- package/registration/components/Registration/RegistrationFormActions.js +4 -4
- package/reviews/components/Reviews/components/AllReviewsLink/index.js +6 -6
- package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +4 -3
- package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +28 -22
- package/reviews/components/Reviews/spec.js +5 -6
- package/settings/action-creators/appSettings.d.ts +3 -3
- package/settings/action-creators/appSettings.d.ts.map +1 -1
- package/settings/reducers/appSettings.d.ts.map +1 -1
- package/settings/reducers/appSettings.js +40 -18
- package/settings/reducers/index.d.ts +1 -1
- package/settings/selectors/appSettings.d.ts +48 -0
- package/settings/selectors/appSettings.d.ts.map +1 -1
- package/settings/selectors/appSettings.js +31 -1
- package/settings/types/appSettings.d.ts +69 -0
- package/settings/types/appSettings.d.ts.map +1 -1
- package/styles/helpers/index.d.ts +1 -0
- package/styles/helpers/index.js +1 -0
- package/styles/helpers/loadFontCss.d.ts +22 -0
- package/styles/helpers/loadFontCss.d.ts.map +1 -0
- package/styles/helpers/loadFontCss.js +138 -0
- package/styles/helpers/loadThemeCss.d.ts.map +1 -1
- package/styles/helpers/loadThemeCss.js +11 -0
- package/styles/index.d.ts +1 -1
- package/styles/index.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.types.d.ts +75 -0
- package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.types.js +75 -0
- package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
- package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +5 -1
- package/styles/theme/createTheme/createPalette.types.d.ts +4 -0
- package/styles/theme/createTheme/createPalette.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createPalette.types.js +5 -1
- package/styles/theme/createTheme/createShape.d.ts +3 -0
- package/styles/theme/createTheme/createShape.d.ts.map +1 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.d.ts +3 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.js +6 -3
- package/styles/theme/createTheme/createTypography.d.ts +2 -1
- package/styles/theme/createTheme/createTypography.js +58 -18
- package/styles/theme/createTheme/index.js +1 -1
- package/styles/theme/createTheme/shadows.d.ts +11 -1
- package/styles/theme/createTheme/shadows.d.ts.map +1 -1
- package/styles/theme/createTheme/shadows.js +41 -7
- package/styles/theme/createTheme/types.d.ts +5 -1
- package/styles/theme/createTheme/types.d.ts.map +1 -1
- package/styles/theme/index.d.ts +2 -0
- package/styles/theme/index.d.ts.map +1 -1
- package/tracking/components/CookieConsentModal/index.js +3 -4
- package/tracking/components/PrivacySettings/index.js +3 -3
- package/cart/components/PaymentBar/PaymentBarReserveButton.connector.js +0 -6
- package/cart/components/PaymentBar/PaymentBarReserveButton.js +0 -71
- package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.connector.js +0 -16
- package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.js +0 -52
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { useTheme, makeStyles } from '@shopgate/engage/styles';
|
|
3
|
+
import Paper from "../Paper";
|
|
4
|
+
import { useCardAppearance } from "./useCardAppearance";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const useStyles = makeStyles({
|
|
7
|
+
name: 'Card'
|
|
8
|
+
})((theme, {
|
|
9
|
+
variant
|
|
10
|
+
}) => ({
|
|
11
|
+
root: {
|
|
12
|
+
...(variant !== 'plain' && {
|
|
13
|
+
overflow: 'hidden'
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A themed content surface built on `Paper`, reading the merchant's card settings.
|
|
20
|
+
*/
|
|
21
|
+
const Card = /*#__PURE__*/forwardRef(({
|
|
22
|
+
className,
|
|
23
|
+
children,
|
|
24
|
+
id,
|
|
25
|
+
variant,
|
|
26
|
+
elevation,
|
|
27
|
+
square,
|
|
28
|
+
...rest
|
|
29
|
+
}, ref) => {
|
|
30
|
+
const theme = useTheme();
|
|
31
|
+
const appearance = useCardAppearance();
|
|
32
|
+
const resolvedVariant = variant ?? appearance.variant;
|
|
33
|
+
const isPlain = resolvedVariant === 'plain';
|
|
34
|
+
const paperVariant = resolvedVariant === 'outlined' ? 'outlined' : 'elevation';
|
|
35
|
+
const {
|
|
36
|
+
classes,
|
|
37
|
+
cx
|
|
38
|
+
} = useStyles({
|
|
39
|
+
variant: resolvedVariant
|
|
40
|
+
});
|
|
41
|
+
return /*#__PURE__*/_jsx(Paper, {
|
|
42
|
+
ref: ref,
|
|
43
|
+
id: id,
|
|
44
|
+
variant: paperVariant,
|
|
45
|
+
elevation: isPlain ? 0 : elevation ?? appearance.elevation,
|
|
46
|
+
square: square || isPlain,
|
|
47
|
+
borderRadius: theme.components.cards.borderRadius,
|
|
48
|
+
background: isPlain ? 'transparent' : theme.components.cards.backgroundColor,
|
|
49
|
+
border: theme.components.cards.border,
|
|
50
|
+
shadowColor: theme.components.cards.shadowColor,
|
|
51
|
+
className: cx(classes.root, 'engage__card', 'ui-shared__card', className),
|
|
52
|
+
...rest,
|
|
53
|
+
children: children
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
Card.displayName = 'Card';
|
|
57
|
+
export default Card;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../components/Card/spec.tsx"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import { Provider } from 'react-redux';
|
|
5
|
+
import { createStore } from 'redux';
|
|
6
|
+
import { ThemeProvider, createTheme } from '@shopgate/engage/styles';
|
|
7
|
+
import Card from "./Card";
|
|
8
|
+
|
|
9
|
+
// ThemeProvider resolves the active breakpoint via matchMedia, which jsdom doesn't implement.
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
12
|
+
writable: true,
|
|
13
|
+
value: query => ({
|
|
14
|
+
matches: false,
|
|
15
|
+
media: query,
|
|
16
|
+
addEventListener: jest.fn(),
|
|
17
|
+
removeEventListener: jest.fn()
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
const theme = createTheme();
|
|
21
|
+
const styleText = () => Array.from(document.styleSheets).flatMap(sheet => {
|
|
22
|
+
try {
|
|
23
|
+
return Array.from(sheet.cssRules);
|
|
24
|
+
} catch {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
}).map(rule => rule.cssText).join('');
|
|
28
|
+
const renderCard = (ui, cards = {
|
|
29
|
+
style: 'shadow',
|
|
30
|
+
shadow: {
|
|
31
|
+
size: 'medium'
|
|
32
|
+
}
|
|
33
|
+
}) => {
|
|
34
|
+
const store = createStore(() => ({
|
|
35
|
+
settings: {
|
|
36
|
+
appSettings: {
|
|
37
|
+
cards
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
return render(/*#__PURE__*/_jsx(Provider, {
|
|
42
|
+
store: store,
|
|
43
|
+
children: /*#__PURE__*/_jsx(ThemeProvider, {
|
|
44
|
+
theme: theme,
|
|
45
|
+
children: ui
|
|
46
|
+
})
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
describe('<Card />', () => {
|
|
50
|
+
it('passes id, className and children through', () => {
|
|
51
|
+
renderCard(/*#__PURE__*/_jsx(Card, {
|
|
52
|
+
id: "c1",
|
|
53
|
+
className: "custom",
|
|
54
|
+
"data-testid": "card",
|
|
55
|
+
children: "body"
|
|
56
|
+
}));
|
|
57
|
+
const el = screen.getByTestId('card');
|
|
58
|
+
expect(el).toHaveAttribute('id', 'c1');
|
|
59
|
+
expect(el).toHaveTextContent('body');
|
|
60
|
+
expect(el).toHaveClass('custom');
|
|
61
|
+
});
|
|
62
|
+
it('emits the engage__card, ui-shared__card and engage__paper classes', () => {
|
|
63
|
+
renderCard(/*#__PURE__*/_jsx(Card, {
|
|
64
|
+
"data-testid": "card",
|
|
65
|
+
children: "x"
|
|
66
|
+
}));
|
|
67
|
+
const el = screen.getByTestId('card');
|
|
68
|
+
expect(el).toHaveClass('engage__card');
|
|
69
|
+
expect(el).toHaveClass('ui-shared__card');
|
|
70
|
+
expect(el).toHaveClass('engage__paper');
|
|
71
|
+
});
|
|
72
|
+
it('draws a shadow for the configured shadow style', () => {
|
|
73
|
+
renderCard(/*#__PURE__*/_jsx(Card, {
|
|
74
|
+
"data-testid": "card",
|
|
75
|
+
children: "x"
|
|
76
|
+
}), {
|
|
77
|
+
style: 'shadow',
|
|
78
|
+
shadow: {
|
|
79
|
+
size: 'medium'
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
expect(styleText()).toContain('var(--sg-palette-shadow)');
|
|
83
|
+
});
|
|
84
|
+
it('draws the card border for the configured border style', () => {
|
|
85
|
+
renderCard(/*#__PURE__*/_jsx(Card, {
|
|
86
|
+
"data-testid": "card",
|
|
87
|
+
children: "x"
|
|
88
|
+
}), {
|
|
89
|
+
style: 'border',
|
|
90
|
+
shadow: {
|
|
91
|
+
size: 'none'
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
expect(styleText()).toContain('var(--sg-components-cards-border)');
|
|
95
|
+
});
|
|
96
|
+
it('lets an explicit variant override the configured appearance', () => {
|
|
97
|
+
renderCard(/*#__PURE__*/_jsx(Card, {
|
|
98
|
+
variant: "outlined",
|
|
99
|
+
"data-testid": "card",
|
|
100
|
+
children: "x"
|
|
101
|
+
}), {
|
|
102
|
+
style: 'shadow',
|
|
103
|
+
shadow: {
|
|
104
|
+
size: 'medium'
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
expect(styleText()).toContain('var(--sg-components-cards-border)');
|
|
108
|
+
});
|
|
109
|
+
it('forwards a ref to the rendered element', () => {
|
|
110
|
+
const ref = /*#__PURE__*/React.createRef();
|
|
111
|
+
renderCard(/*#__PURE__*/_jsx(Card, {
|
|
112
|
+
ref: ref,
|
|
113
|
+
"data-testid": "card",
|
|
114
|
+
children: "x"
|
|
115
|
+
}));
|
|
116
|
+
expect(ref.current).toBe(screen.getByTestId('card'));
|
|
117
|
+
});
|
|
118
|
+
it('renders the plain variant', () => {
|
|
119
|
+
renderCard(/*#__PURE__*/_jsx(Card, {
|
|
120
|
+
variant: "plain",
|
|
121
|
+
"data-testid": "card",
|
|
122
|
+
children: "x"
|
|
123
|
+
}));
|
|
124
|
+
const el = screen.getByTestId('card');
|
|
125
|
+
expect(el).toHaveClass('engage__card');
|
|
126
|
+
expect(el).toHaveClass('engage__paper');
|
|
127
|
+
});
|
|
128
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ShadowSize } from '@shopgate/engage/styles';
|
|
2
|
+
import type { CardVariant } from './Card';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the merchant-configured card appearance from app settings.
|
|
5
|
+
* @returns The card variant and, for the shadow style, its elevation size.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useCardAppearance: () => {
|
|
8
|
+
variant: CardVariant;
|
|
9
|
+
elevation: ShadowSize;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useCardAppearance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCardAppearance.d.ts","sourceRoot":"","sources":["../../../components/Card/useCardAppearance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAQ1C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAQjF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useSelector } from 'react-redux';
|
|
2
|
+
import { getCardSettings, getCardShadowSize } from '@shopgate/engage/settings/selectors/appSettings';
|
|
3
|
+
const VARIANT_BY_STYLE = {
|
|
4
|
+
shadow: 'elevation',
|
|
5
|
+
border: 'outlined',
|
|
6
|
+
flat: 'elevation'
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the merchant-configured card appearance from app settings.
|
|
11
|
+
* @returns The card variant and, for the shadow style, its elevation size.
|
|
12
|
+
*/
|
|
13
|
+
export const useCardAppearance = () => {
|
|
14
|
+
const {
|
|
15
|
+
style
|
|
16
|
+
} = useSelector(getCardSettings);
|
|
17
|
+
const elevation = useSelector(getCardShadowSize);
|
|
18
|
+
return {
|
|
19
|
+
variant: VARIANT_BY_STYLE[style] ?? 'elevation',
|
|
20
|
+
elevation
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -2,7 +2,7 @@ import React, { useRef, useEffect, useMemo, useCallback, memo } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import debounce from 'lodash/debounce';
|
|
4
4
|
import { I18n } from '@shopgate/engage/components';
|
|
5
|
-
import
|
|
5
|
+
import { ButtonBase } from '@shopgate/engage/components/v2';
|
|
6
6
|
import { makeStyles, useTheme } from '@shopgate/engage/styles';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -147,9 +147,7 @@ const ChipLayout = ({
|
|
|
147
147
|
}), /*#__PURE__*/_jsx("div", {
|
|
148
148
|
ref: moreButtonRef,
|
|
149
149
|
className: classes.moreButtonWrapper,
|
|
150
|
-
children: /*#__PURE__*/_jsx(
|
|
151
|
-
fill: true,
|
|
152
|
-
type: "plain",
|
|
150
|
+
children: /*#__PURE__*/_jsx(ButtonBase, {
|
|
153
151
|
className: moreButtonClassName,
|
|
154
152
|
onClick: handleMoreButton,
|
|
155
153
|
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
@@ -11,7 +11,7 @@ import { historyReset } from '@shopgate/pwa-common/actions/router/historyReset';
|
|
|
11
11
|
function mapDispatchToProps(dispatch) {
|
|
12
12
|
return {
|
|
13
13
|
push: params => dispatch(historyPush(params)),
|
|
14
|
-
pop:
|
|
14
|
+
pop: params => dispatch(historyPop(params)),
|
|
15
15
|
replace: params => dispatch(historyReplace(params)),
|
|
16
16
|
reset: () => dispatch(historyReset())
|
|
17
17
|
};
|
|
@@ -45,7 +45,16 @@ describe('<NavigationHandler />', () => {
|
|
|
45
45
|
});
|
|
46
46
|
it('should trigger the pop() callbacks on navigation.pop event', async () => {
|
|
47
47
|
await pop();
|
|
48
|
-
expect(UIEvents.emit).toBeCalledWith(NAVIGATION_POP);
|
|
48
|
+
expect(UIEvents.emit).toBeCalledWith(NAVIGATION_POP, undefined);
|
|
49
|
+
UIEvents.emit.mockClear();
|
|
50
|
+
});
|
|
51
|
+
it('should forward pop() params so that multiple routes can be popped', async () => {
|
|
52
|
+
await pop({
|
|
53
|
+
steps: 2
|
|
54
|
+
});
|
|
55
|
+
expect(UIEvents.emit).toBeCalledWith(NAVIGATION_POP, {
|
|
56
|
+
steps: 2
|
|
57
|
+
});
|
|
49
58
|
UIEvents.emit.mockClear();
|
|
50
59
|
});
|
|
51
60
|
it('should trigger the replace() callbacks on navigation.replace event', async () => {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ShadowSize } from '@shopgate/engage/styles';
|
|
3
|
+
export type PaperVariant = 'elevation' | 'outlined';
|
|
4
|
+
export interface PaperOwnProps {
|
|
5
|
+
/** Element or component to render as. @default 'div' */
|
|
6
|
+
component?: React.ElementType;
|
|
7
|
+
/**
|
|
8
|
+
* Depth of the drop shadow. A number indexes `theme.shadows` (0–24), a `ShadowSize` resolves
|
|
9
|
+
* through `theme.shadowSizes`. Ignored unless `variant` is `elevation`. @default 1
|
|
10
|
+
*/
|
|
11
|
+
elevation?: number | ShadowSize;
|
|
12
|
+
/** `elevation` draws a shadow, `outlined` a border instead. @default 'elevation' */
|
|
13
|
+
variant?: PaperVariant;
|
|
14
|
+
/** Removes the rounded corners. @default false */
|
|
15
|
+
square?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Corner radius per surface, e.g. `components.cards.borderRadius`. Ignored when `square`.
|
|
18
|
+
* @default theme.shape.borderRadius
|
|
19
|
+
*/
|
|
20
|
+
borderRadius?: number | string;
|
|
21
|
+
/**
|
|
22
|
+
* CSS `border` shorthand, drawn only when `variant` is `outlined`.
|
|
23
|
+
* @default `1px solid ${theme.components.border.light}`
|
|
24
|
+
*/
|
|
25
|
+
border?: string;
|
|
26
|
+
/**
|
|
27
|
+
* A key of `theme.palette.background` (`default` | `surface` | `emphasized`), or any CSS color.
|
|
28
|
+
* @default 'surface'
|
|
29
|
+
*/
|
|
30
|
+
background?: 'default' | 'surface' | 'emphasized' | (string & NonNullable<unknown>);
|
|
31
|
+
/**
|
|
32
|
+
* CSS color the shadow is drawn in. Sets `--sg-palette-shadow` on this element. Ignored unless
|
|
33
|
+
* `variant` is `elevation`.
|
|
34
|
+
*/
|
|
35
|
+
shadowColor?: string;
|
|
36
|
+
}
|
|
37
|
+
export type PaperProps = PaperOwnProps & Omit<React.HTMLAttributes<HTMLElement>, keyof PaperOwnProps> & {
|
|
38
|
+
[key: `data-${string}`]: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* A surface primitive that owns elevation, variant, corner radius and background — the base the
|
|
42
|
+
* themed `Card` composes. Settings-free; theme only.
|
|
43
|
+
*/
|
|
44
|
+
declare const Paper: React.ForwardRefExoticComponent<PaperOwnProps & Omit<React.HTMLAttributes<HTMLElement>, keyof PaperOwnProps> & {
|
|
45
|
+
[key: `data-${string}`]: string;
|
|
46
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
47
|
+
export default Paper;
|
|
48
|
+
//# sourceMappingURL=Paper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Paper.d.ts","sourceRoot":"","sources":["../../../components/Paper/Paper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,UAAU,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,oFAAoF;IACpF,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,kDAAkD;IAClD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IACpF;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,UAAU,GACpB,aAAa,GACX,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,aAAa,CAAC,GAC5D;IAAE,CAAC,GAAG,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,CAAA;CAAE,CAAC;AA2BxC;;;GAGG;AACH,QAAA,MAAM,KAAK;;qCAkCT,CAAC;AAIH,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
const useStyles = makeStyles({
|
|
5
|
+
name: 'Paper'
|
|
6
|
+
})((theme, p) => {
|
|
7
|
+
const palette = theme.palette.background[p.background];
|
|
8
|
+
return {
|
|
9
|
+
root: {
|
|
10
|
+
position: 'relative',
|
|
11
|
+
backgroundColor: typeof palette === 'string' ? palette : p.background,
|
|
12
|
+
borderRadius: p.square ? 0 : p.borderRadius ?? theme.shape.borderRadius,
|
|
13
|
+
...(p.variant === 'elevation' && {
|
|
14
|
+
boxShadow: typeof p.elevation === 'number' ? theme.shadows[p.elevation] : theme.shadowSizes[p.elevation],
|
|
15
|
+
...(p.shadowColor && {
|
|
16
|
+
[theme.vars.palette.shadow]: p.shadowColor
|
|
17
|
+
})
|
|
18
|
+
}),
|
|
19
|
+
...(p.variant === 'outlined' && {
|
|
20
|
+
border: p.border ?? `1px solid ${theme.components.border.light}`
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A surface primitive that owns elevation, variant, corner radius and background — the base the
|
|
28
|
+
* themed `Card` composes. Settings-free; theme only.
|
|
29
|
+
*/
|
|
30
|
+
const Paper = /*#__PURE__*/forwardRef((props, ref) => {
|
|
31
|
+
const {
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
component: Component = 'div',
|
|
35
|
+
elevation = 1,
|
|
36
|
+
variant = 'elevation',
|
|
37
|
+
square = false,
|
|
38
|
+
borderRadius,
|
|
39
|
+
border,
|
|
40
|
+
background = 'surface',
|
|
41
|
+
shadowColor,
|
|
42
|
+
...restProps
|
|
43
|
+
} = props;
|
|
44
|
+
const {
|
|
45
|
+
classes,
|
|
46
|
+
cx
|
|
47
|
+
} = useStyles({
|
|
48
|
+
variant,
|
|
49
|
+
elevation,
|
|
50
|
+
square,
|
|
51
|
+
borderRadius,
|
|
52
|
+
border,
|
|
53
|
+
background,
|
|
54
|
+
shadowColor
|
|
55
|
+
});
|
|
56
|
+
return /*#__PURE__*/_jsx(Component, {
|
|
57
|
+
ref: ref,
|
|
58
|
+
className: cx(classes.root, 'engage__paper', className),
|
|
59
|
+
...restProps,
|
|
60
|
+
children: children
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
Paper.displayName = 'Paper';
|
|
64
|
+
export default Paper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Paper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Paper";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../components/Paper/spec.tsx"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import { ThemeProvider, createTheme } from '@shopgate/engage/styles';
|
|
5
|
+
import Paper from "./Paper";
|
|
6
|
+
|
|
7
|
+
// ThemeProvider resolves the active breakpoint via matchMedia, which jsdom doesn't implement.
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
10
|
+
writable: true,
|
|
11
|
+
value: query => ({
|
|
12
|
+
matches: false,
|
|
13
|
+
media: query,
|
|
14
|
+
addEventListener: jest.fn(),
|
|
15
|
+
removeEventListener: jest.fn()
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
const theme = createTheme();
|
|
19
|
+
const renderWithTheme = ui => render(/*#__PURE__*/_jsx(ThemeProvider, {
|
|
20
|
+
theme: theme,
|
|
21
|
+
children: ui
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
// tss keeps injected rules in the document across tests, so assertions have to be scoped to the
|
|
25
|
+
// element under test — a global sweep would also match rules another test left behind.
|
|
26
|
+
const styleTextFor = element => Array.from(document.styleSheets).flatMap(sheet => {
|
|
27
|
+
try {
|
|
28
|
+
return Array.from(sheet.cssRules);
|
|
29
|
+
} catch {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
}).filter(rule => rule instanceof CSSStyleRule && element.matches(rule.selectorText)).map(rule => rule.cssText).join('');
|
|
33
|
+
const renderPaper = ui => {
|
|
34
|
+
renderWithTheme(ui);
|
|
35
|
+
return styleTextFor(screen.getByTestId('paper'));
|
|
36
|
+
};
|
|
37
|
+
describe('<Paper />', () => {
|
|
38
|
+
it('renders children and the engage__paper class next to a caller className', () => {
|
|
39
|
+
renderWithTheme(/*#__PURE__*/_jsx(Paper, {
|
|
40
|
+
className: "custom",
|
|
41
|
+
"data-testid": "paper",
|
|
42
|
+
children: "content"
|
|
43
|
+
}));
|
|
44
|
+
const el = screen.getByTestId('paper');
|
|
45
|
+
expect(el).toHaveTextContent('content');
|
|
46
|
+
expect(el).toHaveClass('engage__paper');
|
|
47
|
+
expect(el).toHaveClass('custom');
|
|
48
|
+
});
|
|
49
|
+
it('renders as the given component', () => {
|
|
50
|
+
renderWithTheme(/*#__PURE__*/_jsx(Paper, {
|
|
51
|
+
component: "section",
|
|
52
|
+
"data-testid": "paper",
|
|
53
|
+
children: "x"
|
|
54
|
+
}));
|
|
55
|
+
expect(screen.getByTestId('paper').tagName).toBe('SECTION');
|
|
56
|
+
});
|
|
57
|
+
it('passes data attributes through to the element', () => {
|
|
58
|
+
renderWithTheme(/*#__PURE__*/_jsx(Paper, {
|
|
59
|
+
"data-testid": "paper",
|
|
60
|
+
"data-foo": "bar",
|
|
61
|
+
children: "x"
|
|
62
|
+
}));
|
|
63
|
+
expect(screen.getByTestId('paper')).toHaveAttribute('data-foo', 'bar');
|
|
64
|
+
});
|
|
65
|
+
it('draws a shadow reading the shadow color variable for the elevation variant', () => {
|
|
66
|
+
const css = renderPaper(/*#__PURE__*/_jsx(Paper, {
|
|
67
|
+
elevation: 4,
|
|
68
|
+
"data-testid": "paper",
|
|
69
|
+
children: "x"
|
|
70
|
+
}));
|
|
71
|
+
expect(css).toContain('var(--sg-palette-shadow)');
|
|
72
|
+
});
|
|
73
|
+
it('sets the shadow color custom property when shadowColor is given', () => {
|
|
74
|
+
const css = renderPaper(/*#__PURE__*/_jsx(Paper, {
|
|
75
|
+
shadowColor: "#7a3cff",
|
|
76
|
+
"data-testid": "paper",
|
|
77
|
+
children: "x"
|
|
78
|
+
}));
|
|
79
|
+
expect(css).toContain('--sg-palette-shadow: #7a3cff');
|
|
80
|
+
});
|
|
81
|
+
it('draws the default border for the outlined variant', () => {
|
|
82
|
+
const css = renderPaper(/*#__PURE__*/_jsx(Paper, {
|
|
83
|
+
variant: "outlined",
|
|
84
|
+
"data-testid": "paper",
|
|
85
|
+
children: "x"
|
|
86
|
+
}));
|
|
87
|
+
expect(css).toContain('var(--sg-components-border-light)');
|
|
88
|
+
});
|
|
89
|
+
it('lets the border prop override the default outlined border', () => {
|
|
90
|
+
const css = renderPaper(/*#__PURE__*/_jsx(Paper, {
|
|
91
|
+
variant: "outlined",
|
|
92
|
+
border: "2px dashed #abc",
|
|
93
|
+
"data-testid": "paper",
|
|
94
|
+
children: "x"
|
|
95
|
+
}));
|
|
96
|
+
expect(css).toContain('2px dashed #abc');
|
|
97
|
+
});
|
|
98
|
+
it('resolves a palette key to its background color', () => {
|
|
99
|
+
const css = renderPaper(/*#__PURE__*/_jsx(Paper, {
|
|
100
|
+
background: "emphasized",
|
|
101
|
+
"data-testid": "paper",
|
|
102
|
+
children: "x"
|
|
103
|
+
}));
|
|
104
|
+
expect(css).toContain('var(--sg-palette-background-emphasized)');
|
|
105
|
+
});
|
|
106
|
+
it('passes an arbitrary background color through', () => {
|
|
107
|
+
const css = renderPaper(/*#__PURE__*/_jsx(Paper, {
|
|
108
|
+
background: "#123456",
|
|
109
|
+
"data-testid": "paper",
|
|
110
|
+
children: "x"
|
|
111
|
+
}));
|
|
112
|
+
expect(css).toContain('#123456');
|
|
113
|
+
});
|
|
114
|
+
it('applies the given border radius', () => {
|
|
115
|
+
const css = renderPaper(/*#__PURE__*/_jsx(Paper, {
|
|
116
|
+
borderRadius: 12,
|
|
117
|
+
"data-testid": "paper",
|
|
118
|
+
children: "x"
|
|
119
|
+
}));
|
|
120
|
+
expect(css).toContain('border-radius: 12px');
|
|
121
|
+
});
|
|
122
|
+
it('drops the border radius when square', () => {
|
|
123
|
+
const css = renderPaper(/*#__PURE__*/_jsx(Paper, {
|
|
124
|
+
square: true,
|
|
125
|
+
borderRadius: 12,
|
|
126
|
+
"data-testid": "paper",
|
|
127
|
+
children: "x"
|
|
128
|
+
}));
|
|
129
|
+
expect(css).toContain('border-radius: 0');
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioCard.d.ts","sourceRoot":"","sources":["../../../components/RadioCard/RadioCard.jsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"RadioCard.d.ts","sourceRoot":"","sources":["../../../components/RadioCard/RadioCard.jsx"],"names":[],"mappings":";AAmDA;;;;GAIG;AACH,yKAHW,MAAM,GACJ,GAAG,CAkDf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAvGqB,YAAY;AA2BlC;;;;GAIG;AACH,wDAHW,MAAM,GACJ,GAAG,CAQf"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
|
-
import Card from
|
|
4
|
+
import Card from "../Card";
|
|
5
5
|
import { useRadioGroup } from "../RadioGroup";
|
|
6
6
|
import Radio from "../Radio";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const useStyles = makeStyles()(theme => ({
|
|
9
9
|
card: {
|
|
10
|
+
margin: '5px 5px 10px',
|
|
10
11
|
borderRadius: 4,
|
|
11
12
|
padding: '8px 8px 8px 4px',
|
|
12
13
|
display: 'flex',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../../components/Tabs/components/Tab.jsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../../components/Tabs/components/Tab.jsx"],"names":[],"mappings":";AAmCA;;;;GAIG;AACH,4BAHW,MAAM,GACJ,GAAG,CA0Df;;;;;;;;;;;;;;;;;;;;;;;sBA/FqB,YAAY"}
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { makeStyles, responsiveMediaQuery } from '@shopgate/engage/styles';
|
|
4
|
-
import Button from '@shopgate/
|
|
4
|
+
import { Button } from '@shopgate/engage/components/v2';
|
|
5
5
|
import { ViewContext } from "../../View";
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
const useStyles = makeStyles()({
|
|
8
8
|
root: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
textAlign: 'center'
|
|
21
|
-
},
|
|
9
|
+
maxWidth: 200,
|
|
10
|
+
minWidth: 72,
|
|
11
|
+
position: 'relative',
|
|
12
|
+
boxSizing: 'border-box',
|
|
13
|
+
minHeight: 48,
|
|
14
|
+
flexShrink: 0,
|
|
15
|
+
flexGrow: 1,
|
|
16
|
+
padding: '6px 6px',
|
|
17
|
+
overflow: 'hidden',
|
|
18
|
+
whiteSpace: 'normal',
|
|
19
|
+
textAlign: 'center',
|
|
22
20
|
[responsiveMediaQuery('<=xs', {
|
|
23
21
|
appAlways: true
|
|
24
22
|
})]: {
|
|
@@ -84,8 +82,8 @@ const Tab = props => {
|
|
|
84
82
|
}
|
|
85
83
|
};
|
|
86
84
|
return /*#__PURE__*/_jsxs(Button, {
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
variant: "text",
|
|
86
|
+
color: selected ? 'primary' : 'inherit',
|
|
89
87
|
className: cx(classes.root, className),
|
|
90
88
|
role: "tab",
|
|
91
89
|
"aria-selected": selected,
|
|
@@ -9,7 +9,7 @@ declare const useStyles: (params: void, muiStyleOverridesParams?: {
|
|
|
9
9
|
props: Record<string, unknown>;
|
|
10
10
|
ownerState?: Record<string, unknown> | undefined;
|
|
11
11
|
} | undefined) => {
|
|
12
|
-
classes: Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "root" | "
|
|
12
|
+
classes: Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "root" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "fontWeightLight" | "fontWeightRegular" | "fontWeightMedium" | "fontWeightBold" | "gutterBottom" | "noWrap" | "paragraph" | "srOnly" | "alignLeft" | "alignCenter" | "alignRight" | "alignJustify" | "colorInherit" | "colorPrimary" | "colorSecondary" | "colorTextPrimary" | "colorTextSecondary" | "colorError" | "colorWarning" | "colorSuccess" | "displayInline" | "displayBlock", string>;
|
|
13
13
|
theme: import("@shopgate/engage/styles").Theme;
|
|
14
14
|
css: import("tss-react").Css;
|
|
15
15
|
cx: import("tss-react").Cx;
|