@shopgate/engage 7.32.0-beta.7 → 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.
Files changed (149) hide show
  1. package/account/components/Profile/ProfileAddressBook.d.ts.map +1 -1
  2. package/account/components/Profile/ProfileAddressBook.js +13 -22
  3. package/account/components/Profile/ProfileAddressCard.d.ts.map +1 -1
  4. package/account/components/Profile/ProfileAddressCard.js +8 -18
  5. package/account/components/Profile/ProfileForm.d.ts.map +1 -1
  6. package/account/components/Profile/ProfileForm.js +15 -42
  7. package/account/components/ProfileContact/ProfileContact.js +13 -21
  8. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts.map +1 -1
  9. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +40 -6
  10. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +7 -0
  11. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
  12. package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts +32 -0
  13. package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts.map +1 -0
  14. package/admin-preview/initialization/_internal/initialFrontendSettings.js +43 -0
  15. package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts +22 -0
  16. package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts.map +1 -0
  17. package/admin-preview/initialization/awaitInitialFrontendSettings.js +84 -0
  18. package/back-in-stock/components/BackInStockButton/index.js +5 -5
  19. package/cart/components/CartItem/CartItemProductLayout.js +1 -0
  20. package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.js +7 -14
  21. package/cart/components/CartItems/CartItemCardReservationLabelChangeStore.js +6 -24
  22. package/cart/components/CartSummaryWide/CartSummaryWide.js +2 -2
  23. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.js +9 -23
  24. package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +8 -30
  25. package/cart/components/PaymentBar/testUtils/mockFactories.js +4 -11
  26. package/category/components/CategoryImage/index.js +13 -2
  27. package/checkout/components/AddressBook/AddressList.js +14 -23
  28. package/checkout/components/Checkout/CheckoutActions.js +4 -3
  29. package/checkout/components/Checkout/CheckoutAddress.js +8 -0
  30. package/checkout/components/Checkout/CheckoutSection.js +6 -2
  31. package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +6 -7
  32. package/checkout/components/ResponsiveBackButton/ResponsiveBackButton.js +7 -17
  33. package/components/Card/Card.js +1 -1
  34. package/components/ChipLayout/index.js +2 -4
  35. package/components/NavigationHandler/connector.js +1 -1
  36. package/components/NavigationHandler/spec.js +10 -1
  37. package/components/Paper/Paper.d.ts +1 -2
  38. package/components/Paper/Paper.d.ts.map +1 -1
  39. package/components/Tabs/components/Tab.d.ts.map +1 -1
  40. package/components/Tabs/components/Tab.js +14 -16
  41. package/components/Typography/Typography.d.ts +1 -1
  42. package/components/v2/Button/Button.d.ts +24 -13
  43. package/components/v2/Button/Button.d.ts.map +1 -1
  44. package/components/v2/Button/Button.js +89 -37
  45. package/components/v2/ButtonBase/ButtonBase.d.ts +50 -10
  46. package/components/v2/ButtonBase/ButtonBase.d.ts.map +1 -1
  47. package/components/v2/ButtonBase/ButtonBase.js +153 -16
  48. package/components/v2/ButtonBase/hooks.d.ts +0 -1
  49. package/components/v2/ButtonBase/hooks.d.ts.map +1 -1
  50. package/components/v2/ButtonBase/hooks.js +36 -12
  51. package/components/v2/ButtonGroup/ButtonGroup.d.ts +11 -5
  52. package/components/v2/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  53. package/components/v2/ButtonGroup/ButtonGroup.js +30 -18
  54. package/components/v2/CircularProgress/CircularProgress.d.ts.map +1 -1
  55. package/components/v2/CircularProgress/CircularProgress.js +10 -5
  56. package/core/hooks/useNavigation.d.ts +10 -2
  57. package/core/hooks/useNavigation.d.ts.map +1 -1
  58. package/core/hooks/useNavigation.js +1 -2
  59. package/core/initialization/index.d.ts.map +1 -1
  60. package/core/initialization/index.js +24 -5
  61. package/core/router/conductor.d.ts +9 -0
  62. package/core/router/helpers.d.ts +28 -15
  63. package/core/router/helpers.d.ts.map +1 -1
  64. package/core/router/helpers.js +8 -8
  65. package/development/components/DevelopmentSettings/DevelopmentSettings.js +3 -3
  66. package/favorites/components/FavoriteButtonWide/FavoriteButtonWide.js +7 -17
  67. package/favorites/components/List/List.d.ts.map +1 -1
  68. package/favorites/components/List/List.js +0 -1
  69. package/favorites/components/List/ListContent.js +4 -5
  70. package/favorites/components/Lists/Lists.js +4 -5
  71. package/filter/components/FilterPageContent/components/ApplyButton/index.js +8 -10
  72. package/filter/components/FilterPageContent/components/ResetButton/index.js +8 -6
  73. package/locations/components/ChangeLocationButton/ChangeLocationButton.js +10 -14
  74. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +4 -8
  75. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcher.js +1 -1
  76. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.js +8 -13
  77. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherDefault.js +10 -10
  78. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +8 -14
  79. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherDefault.js +9 -10
  80. package/locations/components/ReserveForm/ReserveForm.js +6 -7
  81. package/locations/components/StoreDetails/components/GetDirectionsButton.js +2 -4
  82. package/locations/components/StoreDetails/components/StoreDetails.js +5 -10
  83. package/locations/components/StoreDetails/components/StoresNearbyListItem.js +13 -21
  84. package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +5 -11
  85. package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +5 -11
  86. package/locations/components/StoreList/StoreSelectLocationButton.js +5 -11
  87. package/login/components/ForgotPassword/ForgotPassword.js +11 -23
  88. package/orders/components/OrderDetails/OrderDetailsAuthenticate.js +5 -7
  89. package/package.json +7 -7
  90. package/page/components/NotFound.d.ts.map +1 -1
  91. package/page/components/NotFound.js +7 -6
  92. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +1 -1
  93. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.js +2 -2
  94. package/page/components/WidgetVideo/WidgetVideo.d.ts +1 -1
  95. package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -1
  96. package/page/helpers/index.d.ts +5 -2
  97. package/page/helpers/index.d.ts.map +1 -1
  98. package/page/helpers/index.js +8 -5
  99. package/page/widgets/Button/Button.js +2 -3
  100. package/page/widgets/NestedCategoryFilter/NestedCategoryFilter.js +8 -8
  101. package/page/widgets/ProductList/ProductList.js +18 -14
  102. package/page/widgets/Video/hooks.d.ts +2 -2
  103. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +1 -11
  104. package/product/components/ProductGrid/components/Item/index.js +3 -2
  105. package/product/components/ProductImage/ProductImage.d.ts.map +1 -1
  106. package/product/components/ProductImage/ProductImage.js +7 -2
  107. package/product/components/ProductImage/ProductImagePlaceholder.js +3 -3
  108. package/product/components/UnitQuantityPicker/UnitQuantityPicker.d.ts.map +1 -1
  109. package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +14 -33
  110. package/push-opt-in/components/PushOptInModal/index.js +4 -4
  111. package/registration/components/Registration/RegistrationFormActions.js +4 -4
  112. package/reviews/components/Reviews/components/AllReviewsLink/index.js +6 -6
  113. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +4 -3
  114. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +28 -22
  115. package/reviews/components/Reviews/spec.js +5 -6
  116. package/settings/reducers/appSettings.d.ts.map +1 -1
  117. package/settings/reducers/appSettings.js +9 -1
  118. package/settings/selectors/appSettings.d.ts +16 -0
  119. package/settings/selectors/appSettings.d.ts.map +1 -1
  120. package/settings/selectors/appSettings.js +11 -1
  121. package/settings/types/appSettings.d.ts +23 -2
  122. package/settings/types/appSettings.d.ts.map +1 -1
  123. package/styles/helpers/index.d.ts +1 -0
  124. package/styles/helpers/index.js +1 -0
  125. package/styles/helpers/loadFontCss.d.ts +22 -0
  126. package/styles/helpers/loadFontCss.d.ts.map +1 -0
  127. package/styles/helpers/loadFontCss.js +138 -0
  128. package/styles/helpers/loadThemeCss.d.ts.map +1 -1
  129. package/styles/helpers/loadThemeCss.js +11 -0
  130. package/styles/theme/createTheme/createComponents.types.d.ts +25 -0
  131. package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
  132. package/styles/theme/createTheme/createComponents.types.js +25 -0
  133. package/styles/theme/createTheme/createShape.d.ts +2 -3
  134. package/styles/theme/createTheme/createShape.d.ts.map +1 -1
  135. package/styles/theme/createTheme/createShape.js +1 -2
  136. package/styles/theme/createTheme/createThemeFromColorScheme.d.ts +3 -1
  137. package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
  138. package/styles/theme/createTheme/createThemeFromColorScheme.js +4 -2
  139. package/styles/theme/createTheme/createTypography.d.ts +2 -1
  140. package/styles/theme/createTheme/createTypography.js +58 -18
  141. package/styles/theme/createTheme/index.js +1 -1
  142. package/styles/theme/index.d.ts +1 -0
  143. package/styles/theme/index.d.ts.map +1 -1
  144. package/tracking/components/CookieConsentModal/index.js +3 -4
  145. package/tracking/components/PrivacySettings/index.js +3 -3
  146. package/cart/components/PaymentBar/PaymentBarReserveButton.connector.js +0 -6
  147. package/cart/components/PaymentBar/PaymentBarReserveButton.js +0 -71
  148. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.connector.js +0 -16
  149. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.js +0 -52
@@ -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/pwa-ui-shared/Button';
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
- maxWidth: 200,
11
- minWidth: 72,
12
- position: 'relative',
13
- boxSizing: 'border-box',
14
- minHeight: 48,
15
- flexShrink: 0,
16
- flexGrow: 1,
17
- padding: '6px 6px',
18
- overflow: 'hidden',
19
- whiteSpace: 'normal',
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
- flat: true,
88
- type: selected ? 'secondary' : 'regular',
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" | "gutterBottom" | "noWrap" | "paragraph" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "fontWeightLight" | "fontWeightRegular" | "fontWeightMedium" | "fontWeightBold" | "srOnly" | "alignLeft" | "alignCenter" | "alignRight" | "alignJustify" | "colorInherit" | "colorPrimary" | "colorSecondary" | "colorTextPrimary" | "colorTextSecondary" | "colorError" | "colorWarning" | "colorSuccess" | "displayInline" | "displayBlock", string>;
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;
@@ -1,36 +1,38 @@
1
1
  import React from 'react';
2
2
  import type { PaletteColorsWithMain } from '@shopgate/engage/styles';
3
3
  import type { ButtonBaseProps } from '../ButtonBase';
4
- /**
5
- * The Button component is a versatile UI element that can be used to trigger actions or navigate users.
6
- * It supports multiple variants, colors, and sizes, making it suitable for a wide range of use cases.
7
- */
8
- declare const Button: React.ForwardRefExoticComponent<ButtonOwnProps & import("../ButtonBase").ButtonBaseOwnProps & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
9
4
  declare const useStyles: (params: ButtonOwnProps, muiStyleOverridesParams?: {
10
5
  props: Record<string, unknown>;
11
6
  ownerState?: Record<string, unknown> | undefined;
12
7
  } | undefined) => {
13
- classes: Record<"text" | "icon" | "small" | "large" | "label" | "root" | "disabled" | "outlined" | "contained" | "disableElevation" | "fullWidth" | "startIcon" | "endIcon" | "loader" | "loadingPlaceholder" | "loadingIndicator", string>;
8
+ classes: Record<"text" | "icon" | "small" | "large" | "label" | "link" | "root" | "disabled" | "dense" | "denseSmall" | "denseLarge" | "outlined" | "contained" | "enableElevation" | "fullWidth" | "startIcon" | "endIcon" | "loader" | "loadingPlaceholder" | "loadingIndicator", string>;
14
9
  theme: import("@shopgate/engage/styles").Theme;
15
10
  css: import("tss-react").Css;
16
11
  cx: import("tss-react").Cx;
17
12
  };
18
13
  export interface ButtonOwnProps {
19
14
  /**
20
- * The variant to use.
15
+ * The variant to use. `link` renders a sentence case button without padding or decoration, and
16
+ * dims on press instead of showing a ripple.
21
17
  * @default 'contained'
22
18
  */
23
- variant?: 'contained' | 'outlined' | 'text';
19
+ variant?: 'contained' | 'outlined' | 'text' | 'link';
20
+ /**
21
+ * If true, the ripple effect is disabled. Defaults to true for `variant="link"`, which dims on
22
+ * press instead.
23
+ * @default false
24
+ */
25
+ disableRipple?: boolean;
24
26
  /**
25
27
  * The color of the component.
26
28
  * @default 'inherit'
27
29
  */
28
- color?: PaletteColorsWithMain | 'inherit';
30
+ color?: PaletteColorsWithMain | 'inherit' | 'cta';
29
31
  /**
30
- * If `true`, no elevation is used for contained buttons.
32
+ * If `true`, a drop shadow is added to the button. Buttons are flat by default.
31
33
  * @default false
32
34
  */
33
- disableElevation?: boolean;
35
+ enableElevation?: boolean;
34
36
  /**
35
37
  * Element placed before the children.
36
38
  */
@@ -64,11 +66,20 @@ export interface ButtonOwnProps {
64
66
  * @default 'medium'
65
67
  */
66
68
  size?: 'small' | 'medium' | 'large';
69
+ /**
70
+ * If `true`, the button uses reduced padding. Combines with `size`, which keeps controlling the
71
+ * font size.
72
+ * @default false
73
+ */
74
+ dense?: boolean;
67
75
  /**
68
76
  * Override or extend the styles applied to the component.
69
77
  */
70
78
  classes?: Partial<ReturnType<typeof useStyles>['classes']>;
71
79
  }
72
- export type ButtonProps = ButtonOwnProps & ButtonBaseProps;
73
- export default Button;
80
+ export type ButtonProps<C extends React.ElementType = 'button'> = ButtonOwnProps & ButtonBaseProps<C>;
81
+ declare const _default: <C extends React.ElementType = "button">(props: ButtonProps<C> & {
82
+ ref?: React.ComponentPropsWithRef<C>["ref"];
83
+ }) => React.ReactElement | null;
84
+ export default _default;
74
85
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../components/v2/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KA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GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;CAAE,KACpE,KAAK,CAAC,YAAY,GAAG,IAAI;AAF9B,wBAE+B"}
@@ -7,7 +7,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
7
  * The Button component is a versatile UI element that can be used to trigger actions or navigate users.
8
8
  * It supports multiple variants, colors, and sizes, making it suitable for a wide range of use cases.
9
9
  */
10
- const Button = /*#__PURE__*/forwardRef((props, ref) => {
10
+ function Button(props, ref) {
11
11
  const {
12
12
  variant = 'contained',
13
13
  color = 'inherit',
@@ -17,10 +17,13 @@ const Button = /*#__PURE__*/forwardRef((props, ref) => {
17
17
  loadingPosition = 'center',
18
18
  loadingIndicator: loadingIndicatorProp,
19
19
  size = 'medium',
20
+ dense = false,
20
21
  disabled = false,
22
+ disableRipple = variant === 'link',
21
23
  fullWidth = false,
22
- disableElevation = false,
24
+ enableElevation = false,
23
25
  className,
26
+ classes: classesProp,
24
27
  children,
25
28
  ...other
26
29
  } = props;
@@ -36,9 +39,10 @@ const Button = /*#__PURE__*/forwardRef((props, ref) => {
36
39
  fullWidth
37
40
  }, {
38
41
  props: {
39
- classes: props.classes
42
+ classes: classesProp
40
43
  }
41
44
  });
45
+ const staticClassNames = ['engage__button', 'common__button', 'ui-shared__button', !disableRipple && 'ui-shared__ripple-button'].filter(Boolean).join(' ');
42
46
  const loadingIndicator = loadingIndicatorProp ?? /*#__PURE__*/_jsx(CircularProgress, {
43
47
  color: "inherit",
44
48
  size: 16
@@ -70,16 +74,29 @@ const Button = /*#__PURE__*/forwardRef((props, ref) => {
70
74
  }) : null;
71
75
  return /*#__PURE__*/_jsx(ButtonBase, {
72
76
  ref: ref,
73
- className: cx(classes.root, className, {
77
+ className: cx(classes.root, {
74
78
  [classes.text]: variant === 'text',
75
79
  [classes.outlined]: variant === 'outlined',
76
80
  [classes.contained]: variant === 'contained',
77
81
  [classes.small]: size === 'small',
78
82
  [classes.large]: size === 'large',
83
+ [classes.dense]: dense && size === 'medium',
84
+ [classes.denseSmall]: dense && size === 'small',
85
+ [classes.denseLarge]: dense && size === 'large',
86
+ [classes.link]: variant === 'link',
79
87
  [classes.disabled]: disabled || loading,
80
88
  [classes.fullWidth]: fullWidth,
81
- [classes.disableElevation]: disableElevation
82
- }),
89
+ [classes.enableElevation]: enableElevation
90
+ }, staticClassNames, className),
91
+ disableRipple: disableRipple,
92
+ disableBaseClassName: true,
93
+ "data-variant": variant,
94
+ "data-color": color,
95
+ "data-size": size,
96
+ "data-dense": dense || undefined,
97
+ "data-full-width": fullWidth || undefined,
98
+ "data-enable-elevation": enableElevation || undefined,
99
+ "data-loading": loading || undefined,
83
100
  disabled: disabled || loading,
84
101
  ...other,
85
102
  children: /*#__PURE__*/_jsxs("span", {
@@ -87,7 +104,7 @@ const Button = /*#__PURE__*/forwardRef((props, ref) => {
87
104
  children: [startIcon, loadingPosition !== 'end' && loader, children, loadingPosition === 'end' && loader, endIcon]
88
105
  })
89
106
  });
90
- });
107
+ }
91
108
  const useStyles = makeStyles({
92
109
  name: 'Button'
93
110
  })((theme, props) => {
@@ -101,7 +118,12 @@ const useStyles = makeStyles({
101
118
  } = props;
102
119
  let cssColor = '';
103
120
  let contrastText = '';
104
- if (color !== 'inherit') {
121
+ if (color === 'cta') {
122
+ // The call to action color is not part of the palette. It's a component token so that merchants
123
+ // can configure it separately from the primary color via `--color-button-cta`.
124
+ cssColor = theme.components.ctaButton.background;
125
+ contrastText = theme.components.ctaButton.color;
126
+ } else if (color !== 'inherit') {
105
127
  cssColor = color && theme.palette?.[color]?.main ? theme.palette[color].main : theme.palette.primary.main;
106
128
  contrastText = color && theme.palette?.[color]?.contrastText ? theme.palette[color].contrastText : theme.palette.primary.contrastText;
107
129
  } else if (variant === 'contained') {
@@ -113,9 +135,13 @@ const useStyles = makeStyles({
113
135
  }
114
136
  return {
115
137
  root: {
138
+ // The `components.button` vars are override hooks for CSS injection and are intentionally
139
+ // left unseeded, so these fallbacks are what render by default. Don't "fix" the empty values
140
+ // by skipping their generation - that would also drop them from `theme.vars`, which would
141
+ // turn these into `var(undefined, ...)`.
116
142
  '--button-color': `var(${theme.vars.components.button.color}, ${cssColor})`,
117
143
  '--text-color': `var(${theme.vars.components.button.textColor}, ${contrastText})`,
118
- '--border-radius': `var(${theme.vars.components.button.borderRadius}, ${theme.shape.borderRadius})`,
144
+ '--border-radius': theme.components.button.borderRadius,
119
145
  '--font-size': theme.typography.button.fontSize,
120
146
  '--variant-textColor': 'var(--button-color)',
121
147
  '--variant-textDisabledColor': theme.palette.action.disabled,
@@ -127,12 +153,14 @@ const useStyles = makeStyles({
127
153
  '--variant-containedBg': 'var(--button-color)',
128
154
  '--variant-containedDisabledColor': theme.palette.action.disabled,
129
155
  '--variant-containedDisabledBg': theme.palette.action.disabledBackground,
130
- '--icon-size': theme.vars.typography.button.fontSize,
131
156
  ...theme.typography.button,
132
157
  fontSize: 'var(--font-size)',
133
158
  boxSizing: 'border-box',
134
159
  minWidth: 64,
135
- padding: '6px 16px',
160
+ // Every variant reserves the same 1px border box, so that an outlined button doesn't render
161
+ // 2px larger than a contained one. The paddings are 1px smaller than they look because of it.
162
+ border: '1px solid transparent',
163
+ padding: '5px 15px',
136
164
  transition: theme.transitions.create(['background-color', 'box-shadow', 'border'], {
137
165
  duration: theme.transitions.duration.short
138
166
  }),
@@ -141,73 +169,93 @@ const useStyles = makeStyles({
141
169
  '--variant-textBg': theme.alpha(cssColor, 0.1),
142
170
  '--variant-outlinedBg': theme.alpha(cssColor, 0.1),
143
171
  textDecoration: 'none',
144
- '&:disabled': {
172
+ '&:disabled, &[aria-disabled="true"]': {
145
173
  backgroundColor: 'transparent'
146
174
  },
147
175
  // Reset on touch devices, it doesn't add specificity
148
176
  '@media (hover: none)': {
149
177
  backgroundColor: 'transparent'
150
178
  }
151
- },
152
- ...(loading && loadingPosition === 'center' && {})
179
+ }
153
180
  },
154
181
  small: {
155
182
  '--font-size': `calc(${theme.typography.button.fontSize} * 0.875)`,
156
- padding: '4px 10px'
183
+ padding: '4px 9px'
157
184
  },
158
185
  large: {
159
186
  '--font-size': `calc(${theme.typography.button.fontSize} * 1.125)`,
160
- padding: '8px 22px'
187
+ padding: '7px 21px'
188
+ },
189
+ // The dense paddings roughly halve the regular ones. They are applied after the size classes,
190
+ // so they win by declaration order without needing extra specificity.
191
+ dense: {
192
+ padding: '2px 7px'
193
+ },
194
+ denseSmall: {
195
+ padding: '2px 4px'
196
+ },
197
+ denseLarge: {
198
+ padding: '3px 10px'
199
+ },
200
+ link: {
201
+ padding: 0,
202
+ minWidth: 0,
203
+ border: 0,
204
+ textTransform: 'none',
205
+ color: 'var(--variant-textColor)',
206
+ '&:active': {
207
+ opacity: 0.5
208
+ },
209
+ '&:disabled, &[aria-disabled="true"]': {
210
+ color: 'var(--variant-textDisabledColor)'
211
+ }
161
212
  },
162
213
  disabled: {},
163
214
  text: {
164
215
  color: 'var(--variant-textColor)',
165
216
  background: 'var(--variant-textBg)',
166
- '&:disabled': {
217
+ '&:disabled, &[aria-disabled="true"]': {
167
218
  color: 'var(--variant-textDisabledColor)'
168
219
  }
169
220
  },
170
221
  outlined: {
171
222
  color: 'var(--variant-outlinedColor)',
172
- border: '1px solid var(--variant-outlinedBorder)',
223
+ borderColor: 'var(--variant-outlinedBorder)',
173
224
  background: 'var(--variant-outlinedBg)',
174
- '&:disabled': {
175
- border: '1px solid var(--variant-outlinedDisabledBorder)',
225
+ '&:disabled, &[aria-disabled="true"]': {
226
+ borderColor: 'var(--variant-outlinedDisabledBorder)',
176
227
  color: 'var(--variant-outlinedDisabledColor)'
177
228
  }
178
229
  },
179
230
  contained: {
180
231
  color: 'var(--variant-containedColor)',
181
232
  background: 'var(--variant-containedBg)',
182
- boxShadow: theme.shadows[2],
183
233
  '&:hover': {
184
234
  background: theme.darken('var(--variant-containedBg)'),
185
- boxShadow: theme.shadows[4],
186
235
  // Reset on touch devices, it doesn't add specificity
187
236
  '@media (hover: none)': {
188
- background: 'var(--variant-containedBg)',
189
- boxShadow: theme.shadows[2]
237
+ background: 'var(--variant-containedBg)'
190
238
  }
191
239
  },
192
- '&:active': {
193
- boxShadow: theme.shadows[6]
194
- },
195
- '&:disabled': {
240
+ '&:disabled, &[aria-disabled="true"]': {
196
241
  color: 'var(--variant-containedDisabledColor)',
197
- backgroundColor: 'var(--variant-containedDisabledBg)',
198
- boxShadow: theme.shadows[0]
242
+ backgroundColor: 'var(--variant-containedDisabledBg)'
199
243
  }
200
244
  },
201
- disableElevation: {
202
- boxShadow: 'none',
245
+ enableElevation: {
246
+ boxShadow: theme.shadows[2],
203
247
  '&:hover': {
204
- boxShadow: 'none'
248
+ boxShadow: theme.shadows[4],
249
+ // Reset on touch devices, it doesn't add specificity
250
+ '@media (hover: none)': {
251
+ boxShadow: theme.shadows[2]
252
+ }
205
253
  },
206
254
  '&:active': {
207
- boxShadow: 'none'
255
+ boxShadow: theme.shadows[6]
208
256
  },
209
- '&$disabled': {
210
- boxShadow: 'none'
257
+ '&:disabled, &[aria-disabled="true"]': {
258
+ boxShadow: theme.shadows[0]
211
259
  }
212
260
  },
213
261
  label: {
@@ -311,4 +359,8 @@ const useStyles = makeStyles({
311
359
  }
312
360
  };
313
361
  });
314
- export default Button;
362
+ const ButtonWithRef = /*#__PURE__*/forwardRef(Button);
363
+ ButtonWithRef.displayName = 'Button';
364
+
365
+ // `forwardRef` erases the generic, so the call signature is restored with a cast.
366
+ export default ButtonWithRef;
@@ -1,10 +1,5 @@
1
1
  import React from 'react';
2
- /**
3
- * The ButtonBase component serves as a foundational button element that can be extended with
4
- * additional styles and functionality. It handles basic button behavior, including disabled
5
- * state and type validation.
6
- */
7
- declare const ButtonBase: React.ForwardRefExoticComponent<ButtonBaseOwnProps & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
2
+ import type { NavigationState } from '@shopgate/engage/core/router/helpers';
8
3
  declare const useStyles: (params: void, muiStyleOverridesParams?: {
9
4
  props: Record<string, unknown>;
10
5
  ownerState?: Record<string, unknown> | undefined;
@@ -14,9 +9,41 @@ declare const useStyles: (params: void, muiStyleOverridesParams?: {
14
9
  css: import("tss-react").Css;
15
10
  cx: import("tss-react").Cx;
16
11
  };
17
- export interface ButtonBaseOwnProps {
12
+ export interface LinkOptions {
18
13
  /**
19
- * If true, the button will be disabled and not respond to user interactions.
14
+ * Meta state to attach to the target route.
15
+ */
16
+ state?: NavigationState;
17
+ /**
18
+ * Where to open the target, e.g. `_blank`. Read by the router when the target is an external
19
+ * or a native link.
20
+ */
21
+ target?: string;
22
+ /**
23
+ * If true, the current route is replaced instead of a new one being pushed.
24
+ * @default false
25
+ */
26
+ replace?: boolean;
27
+ }
28
+ export interface ButtonBaseOwnProps<C extends React.ElementType = 'button'> {
29
+ /**
30
+ * The element or component rendered as the root node. Defaults to `button`, or to `a` on web
31
+ * builds when `href` is set. Note that a non focusable element (e.g. `div`) needs its own
32
+ * `tabIndex` to stay keyboard operable.
33
+ */
34
+ component?: C;
35
+ /**
36
+ * Renders the button as a link to this path. Navigation goes through the app router rather than
37
+ * the browser, so external and native URLs are handled as well.
38
+ */
39
+ href?: string;
40
+ /**
41
+ * Navigation options. Only meaningful together with `href`.
42
+ */
43
+ linkOptions?: LinkOptions;
44
+ /**
45
+ * If true, the button will be disabled and not respond to user interactions. Rendered as the
46
+ * native attribute on a button, and as `aria-disabled` on any other element.
20
47
  * @default false
21
48
  */
22
49
  disabled?: boolean;
@@ -25,16 +52,29 @@ export interface ButtonBaseOwnProps {
25
52
  * @default false
26
53
  */
27
54
  disableRipple?: boolean;
55
+ /**
56
+ * If true, the `engage__button-base` css hook is not rendered. Set by wrappers that provide a
57
+ * hook of their own, such as `Button`.
58
+ * @default false
59
+ */
60
+ disableBaseClassName?: boolean;
28
61
  /**
29
62
  * Custom class name for the button.
30
63
  */
31
64
  className?: string;
65
+ /**
66
+ * Value for the `data-test-id` attribute of the button.
67
+ */
68
+ testId?: string;
32
69
  /**
33
70
  * Override or extend the styles applied to the component.
34
71
  */
35
72
  classes?: Partial<ReturnType<typeof useStyles>['classes']>;
36
73
  children: React.ReactNode;
37
74
  }
38
- export type ButtonBaseProps = ButtonBaseOwnProps & React.ButtonHTMLAttributes<HTMLButtonElement>;
39
- export default ButtonBase;
75
+ export type ButtonBaseProps<C extends React.ElementType = 'button'> = ButtonBaseOwnProps<C> & Omit<React.ComponentPropsWithRef<C>, keyof ButtonBaseOwnProps<C>>;
76
+ declare const _default: <C extends React.ElementType = "button">(props: ButtonBaseProps<C> & {
77
+ ref?: React.ComponentPropsWithRef<C>["ref"];
78
+ }) => React.ReactElement | null;
79
+ export default _default;
40
80
  //# sourceMappingURL=ButtonBase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../../../components/v2/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAQ1C;;;;GAIG;AACH,QAAA,MAAM,UAAU,8IAsEd,CAAC;AAEH,QAAA,MAAM,SAAS;;cAyCP,CAAC;;;;;;CAVP,CAAC;AAEH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,MAAM,eAAe,GAAG,kBAAkB,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAEjG,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../../../components/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