@shopgate/pwa-ui-shared 7.30.4-beta.1 → 7.31.0-alpha.2

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 (326) hide show
  1. package/ActionButton/index.js +66 -67
  2. package/AddToCartButton/index.js +217 -185
  3. package/AddToCartButton/style.js +8 -0
  4. package/Availability/index.js +24 -6
  5. package/Button/index.js +105 -82
  6. package/Button/spec.js +3 -4
  7. package/Card/index.js +26 -7
  8. package/CardList/components/Item/index.js +15 -3
  9. package/CartTotalLine/components/Amount/index.js +13 -4
  10. package/CartTotalLine/components/Hint/index.js +13 -4
  11. package/CartTotalLine/components/Label/index.js +23 -10
  12. package/CartTotalLine/index.js +41 -7
  13. package/Checkbox/index.js +41 -17
  14. package/Chip/index.js +82 -7
  15. package/ContextMenu/components/Item/index.js +38 -20
  16. package/ContextMenu/components/Position/index.js +38 -56
  17. package/ContextMenu/index.js +64 -28
  18. package/Dialog/components/BasicDialog/index.js +1 -0
  19. package/Dialog/components/HtmlContentDialog/spec.js +39 -0
  20. package/Dialog/components/PipelineErrorDialog/index.js +108 -157
  21. package/Dialog/components/PipelineErrorDialog/spec.js +12 -18
  22. package/Dialog/components/TextMessageDialog/index.js +1 -1
  23. package/Dialog/components/VariantSelectModal/index.js +1 -1
  24. package/Dialog/index.js +1 -1
  25. package/DiscountBadge/index.js +48 -15
  26. package/FavoritesButton/index.js +95 -100
  27. package/FavoritesButton/spec.js +5 -2
  28. package/Form/Builder/classes/ActionListener/index.js +1 -0
  29. package/Form/Checkbox/index.js +64 -56
  30. package/Form/InfoField/index.js +18 -6
  31. package/Form/Password/index.js +39 -52
  32. package/Form/RadioGroup/components/Item/index.js +72 -56
  33. package/Form/RadioGroup/index.js +79 -90
  34. package/Form/Select/index.js +108 -130
  35. package/Form/SelectContextChoices/index.js +30 -8
  36. package/Form/TextField/index.js +106 -82
  37. package/Form/TextField/spec.js +4 -3
  38. package/FormElement/components/ErrorText/index.js +32 -14
  39. package/FormElement/components/Label/index.js +56 -6
  40. package/FormElement/components/Placeholder/index.js +44 -11
  41. package/FormElement/components/Underline/index.js +63 -12
  42. package/FormElement/index.js +62 -85
  43. package/Glow/index.js +73 -83
  44. package/IndicatorCircle/index.js +73 -17
  45. package/IndicatorCircle/spec.js +2 -5
  46. package/LoadingIndicator/index.js +34 -12
  47. package/Manufacturer/index.js +21 -10
  48. package/MessageBar/index.js +12 -38
  49. package/NoResults/components/Icon/index.js +30 -14
  50. package/NoResults/index.js +35 -7
  51. package/Placeholder/index.js +34 -23
  52. package/PlaceholderLabel/index.js +17 -3
  53. package/Price/index.js +34 -21
  54. package/PriceInfo/index.js +23 -9
  55. package/PriceStriked/index.js +67 -77
  56. package/ProgressBar/index.js +112 -77
  57. package/RadioButton/index.js +29 -11
  58. package/RatingStars/index.js +122 -137
  59. package/Ripple/components/RippleAnimation/index.js +13 -3
  60. package/Ripple/index.js +158 -212
  61. package/RippleButton/index.js +63 -60
  62. package/RippleButton/spec.js +15 -9
  63. package/ScannerOverlay/components/CameraOverlay/index.js +54 -10
  64. package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +53 -27
  65. package/ScannerOverlay/components/ScannerBar/index.js +50 -26
  66. package/Sheet/components/Header/components/SearchBar/index.js +54 -10
  67. package/Sheet/components/Header/index.js +96 -76
  68. package/Sheet/index.js +295 -157
  69. package/Sheet/spec.js +8 -6
  70. package/TaxDisclaimer/index.js +17 -4
  71. package/TaxDisclaimer/spec.js +16 -5
  72. package/TextField/components/ErrorText/index.js +35 -14
  73. package/TextField/components/FormElement/index.js +29 -4
  74. package/TextField/components/Hint/index.js +39 -10
  75. package/TextField/components/Label/index.js +43 -6
  76. package/TextField/components/Underline/index.js +64 -13
  77. package/TextField/index.js +157 -171
  78. package/TextField/spec.js +5 -3
  79. package/icons/AccountBoxIcon.d.ts +7 -0
  80. package/icons/AccountBoxIcon.d.ts.map +1 -0
  81. package/icons/AccountBoxIcon.js +1 -4
  82. package/icons/AddMoreIcon.d.ts +7 -0
  83. package/icons/AddMoreIcon.d.ts.map +1 -0
  84. package/icons/AddMoreIcon.js +0 -3
  85. package/icons/ArrowDropIcon.d.ts +7 -0
  86. package/icons/ArrowDropIcon.d.ts.map +1 -0
  87. package/icons/ArrowDropIcon.js +0 -3
  88. package/icons/ArrowIcon.d.ts +10 -0
  89. package/icons/ArrowIcon.d.ts.map +1 -0
  90. package/icons/ArrowIcon.js +2 -11
  91. package/icons/BarcodeScannerIcon.d.ts +7 -0
  92. package/icons/BarcodeScannerIcon.d.ts.map +1 -0
  93. package/icons/BarcodeScannerIcon.js +0 -3
  94. package/icons/BoxIcon.d.ts +7 -0
  95. package/icons/BoxIcon.d.ts.map +1 -0
  96. package/icons/BoxIcon.js +0 -3
  97. package/icons/BrowseIcon.d.ts +7 -0
  98. package/icons/BrowseIcon.d.ts.map +1 -0
  99. package/icons/BrowseIcon.js +1 -3
  100. package/icons/BurgerIcon.d.ts +7 -0
  101. package/icons/BurgerIcon.d.ts.map +1 -0
  102. package/icons/BurgerIcon.js +0 -3
  103. package/icons/CalendarIcon.d.ts +7 -0
  104. package/icons/CalendarIcon.d.ts.map +1 -0
  105. package/icons/CalendarIcon.js +0 -2
  106. package/icons/CartCouponIcon.d.ts +7 -0
  107. package/icons/CartCouponIcon.d.ts.map +1 -0
  108. package/icons/CartCouponIcon.js +0 -2
  109. package/icons/CartIcon.d.ts +7 -0
  110. package/icons/CartIcon.d.ts.map +1 -0
  111. package/icons/CartIcon.js +0 -2
  112. package/icons/CartPlusIcon.d.ts +7 -0
  113. package/icons/CartPlusIcon.d.ts.map +1 -0
  114. package/icons/CartPlusIcon.js +0 -2
  115. package/icons/CheckIcon.d.ts +7 -0
  116. package/icons/CheckIcon.d.ts.map +1 -0
  117. package/icons/CheckIcon.js +0 -2
  118. package/icons/CheckedIcon.d.ts +7 -0
  119. package/icons/CheckedIcon.d.ts.map +1 -0
  120. package/icons/CheckedIcon.js +0 -3
  121. package/icons/ChevronIcon.d.ts +7 -0
  122. package/icons/ChevronIcon.d.ts.map +1 -0
  123. package/icons/ChevronIcon.js +0 -2
  124. package/icons/CreditCardIcon.d.ts +7 -0
  125. package/icons/CreditCardIcon.d.ts.map +1 -0
  126. package/icons/CreditCardIcon.js +0 -2
  127. package/icons/CrossIcon.d.ts +7 -0
  128. package/icons/CrossIcon.d.ts.map +1 -0
  129. package/icons/CrossIcon.js +0 -2
  130. package/icons/DescriptionIcon.d.ts +7 -0
  131. package/icons/DescriptionIcon.d.ts.map +1 -0
  132. package/icons/DescriptionIcon.js +0 -2
  133. package/icons/FilterIcon.d.ts +7 -0
  134. package/icons/FilterIcon.d.ts.map +1 -0
  135. package/icons/FilterIcon.js +0 -2
  136. package/icons/FlashDisabledIcon.d.ts +7 -0
  137. package/icons/FlashDisabledIcon.d.ts.map +1 -0
  138. package/icons/FlashDisabledIcon.js +0 -2
  139. package/icons/FlashEnabledIcon.d.ts +7 -0
  140. package/icons/FlashEnabledIcon.d.ts.map +1 -0
  141. package/icons/FlashEnabledIcon.js +0 -2
  142. package/icons/GridIcon.d.ts +7 -0
  143. package/icons/GridIcon.d.ts.map +1 -0
  144. package/icons/GridIcon.js +1 -3
  145. package/icons/HeartIcon.d.ts +7 -0
  146. package/icons/HeartIcon.d.ts.map +1 -0
  147. package/icons/HeartIcon.js +0 -2
  148. package/icons/HeartOutlineIcon.d.ts +7 -0
  149. package/icons/HeartOutlineIcon.d.ts.map +1 -0
  150. package/icons/HeartOutlineIcon.js +1 -3
  151. package/icons/HeartPlusIcon.d.ts +7 -0
  152. package/icons/HeartPlusIcon.d.ts.map +1 -0
  153. package/icons/HeartPlusIcon.js +1 -3
  154. package/icons/HeartPlusOutlineIcon.d.ts +7 -0
  155. package/icons/HeartPlusOutlineIcon.d.ts.map +1 -0
  156. package/icons/HeartPlusOutlineIcon.js +1 -3
  157. package/icons/HomeIcon.d.ts +7 -0
  158. package/icons/HomeIcon.d.ts.map +1 -0
  159. package/icons/HomeIcon.js +0 -2
  160. package/icons/InfoIcon.d.ts +7 -0
  161. package/icons/InfoIcon.d.ts.map +1 -0
  162. package/icons/InfoIcon.js +0 -2
  163. package/icons/InfoOutlineIcon.d.ts +7 -0
  164. package/icons/InfoOutlineIcon.d.ts.map +1 -0
  165. package/icons/InfoOutlineIcon.js +0 -2
  166. package/icons/ListIcon.d.ts +7 -0
  167. package/icons/ListIcon.d.ts.map +1 -0
  168. package/icons/ListIcon.js +0 -2
  169. package/icons/LocalShippingIcon.d.ts +7 -0
  170. package/icons/LocalShippingIcon.d.ts.map +1 -0
  171. package/icons/LocalShippingIcon.js +0 -2
  172. package/icons/LocationIcon.d.ts +7 -0
  173. package/icons/LocationIcon.d.ts.map +1 -0
  174. package/icons/LocationIcon.js +1 -4
  175. package/icons/LocatorIcon.d.ts +7 -0
  176. package/icons/LocatorIcon.d.ts.map +1 -0
  177. package/icons/LocatorIcon.js +1 -3
  178. package/icons/LockIcon.d.ts +9 -0
  179. package/icons/LockIcon.d.ts.map +1 -0
  180. package/icons/LockIcon.js +1 -2
  181. package/icons/LogoutIcon.d.ts +7 -0
  182. package/icons/LogoutIcon.d.ts.map +1 -0
  183. package/icons/LogoutIcon.js +0 -2
  184. package/icons/MagnifierIcon.d.ts +7 -0
  185. package/icons/MagnifierIcon.d.ts.map +1 -0
  186. package/icons/MagnifierIcon.js +0 -2
  187. package/icons/MapMarkerIcon.d.ts +7 -0
  188. package/icons/MapMarkerIcon.d.ts.map +1 -0
  189. package/icons/MapMarkerIcon.js +1 -3
  190. package/icons/MoreIcon.d.ts +7 -0
  191. package/icons/MoreIcon.d.ts.map +1 -0
  192. package/icons/MoreIcon.js +1 -3
  193. package/icons/MoreVertIcon.d.ts +7 -0
  194. package/icons/MoreVertIcon.d.ts.map +1 -0
  195. package/icons/MoreVertIcon.js +1 -3
  196. package/icons/NotificationIcon.d.ts +7 -0
  197. package/icons/NotificationIcon.d.ts.map +1 -0
  198. package/icons/NotificationIcon.js +1 -3
  199. package/icons/PersonIcon.d.ts +9 -0
  200. package/icons/PersonIcon.d.ts.map +1 -0
  201. package/icons/PersonIcon.js +0 -3
  202. package/icons/PhoneIcon.d.ts +7 -0
  203. package/icons/PhoneIcon.d.ts.map +1 -0
  204. package/icons/PhoneIcon.js +1 -4
  205. package/icons/PlaceholderIcon.d.ts +7 -0
  206. package/icons/PlaceholderIcon.d.ts.map +1 -0
  207. package/icons/PlaceholderIcon.js +0 -2
  208. package/icons/RadioCheckedIcon.d.ts +10 -0
  209. package/icons/RadioCheckedIcon.d.ts.map +1 -0
  210. package/icons/RadioCheckedIcon.js +0 -2
  211. package/icons/RadioUncheckedIcon.d.ts +10 -0
  212. package/icons/RadioUncheckedIcon.d.ts.map +1 -0
  213. package/icons/RadioUncheckedIcon.js +0 -2
  214. package/icons/SecurityIcon.d.ts +7 -0
  215. package/icons/SecurityIcon.d.ts.map +1 -0
  216. package/icons/SecurityIcon.js +0 -2
  217. package/icons/ShippingMethodIcon.d.ts +7 -0
  218. package/icons/ShippingMethodIcon.d.ts.map +1 -0
  219. package/icons/ShippingMethodIcon.js +0 -2
  220. package/icons/ShoppingCartIcon.d.ts +7 -0
  221. package/icons/ShoppingCartIcon.d.ts.map +1 -0
  222. package/icons/ShoppingCartIcon.js +0 -2
  223. package/icons/SortIcon.d.ts +7 -0
  224. package/icons/SortIcon.d.ts.map +1 -0
  225. package/icons/SortIcon.js +0 -2
  226. package/icons/StarHalfIcon.d.ts +7 -0
  227. package/icons/StarHalfIcon.d.ts.map +1 -0
  228. package/icons/StarHalfIcon.js +0 -9
  229. package/icons/StarIcon.d.ts +7 -0
  230. package/icons/StarIcon.d.ts.map +1 -0
  231. package/icons/StarIcon.js +0 -9
  232. package/icons/StarOutlineIcon.d.ts +7 -0
  233. package/icons/StarOutlineIcon.d.ts.map +1 -0
  234. package/icons/StarOutlineIcon.js +0 -2
  235. package/icons/StopIcon.d.ts +7 -0
  236. package/icons/StopIcon.d.ts.map +1 -0
  237. package/icons/StopIcon.js +0 -2
  238. package/icons/TickIcon.d.ts +7 -0
  239. package/icons/TickIcon.d.ts.map +1 -0
  240. package/icons/TickIcon.js +0 -2
  241. package/icons/TimeIcon.d.ts +7 -0
  242. package/icons/TimeIcon.d.ts.map +1 -0
  243. package/icons/TimeIcon.js +0 -2
  244. package/icons/TrashIcon.d.ts +7 -0
  245. package/icons/TrashIcon.d.ts.map +1 -0
  246. package/icons/TrashIcon.js +0 -3
  247. package/icons/TrashOutlineIcon.d.ts +8 -0
  248. package/icons/TrashOutlineIcon.d.ts.map +1 -0
  249. package/icons/TrashOutlineIcon.js +0 -2
  250. package/icons/UncheckedIcon.d.ts +7 -0
  251. package/icons/UncheckedIcon.d.ts.map +1 -0
  252. package/icons/UncheckedIcon.js +0 -2
  253. package/icons/ViewListIcon.d.ts +7 -0
  254. package/icons/ViewListIcon.d.ts.map +1 -0
  255. package/icons/ViewListIcon.js +0 -2
  256. package/icons/VisibilityIcon.d.ts +8 -0
  257. package/icons/VisibilityIcon.d.ts.map +1 -0
  258. package/icons/VisibilityIcon.js +2 -4
  259. package/icons/VisibilityOffIcon.d.ts +8 -0
  260. package/icons/VisibilityOffIcon.d.ts.map +1 -0
  261. package/icons/VisibilityOffIcon.js +2 -4
  262. package/icons/WarningIcon.d.ts +7 -0
  263. package/icons/WarningIcon.d.ts.map +1 -0
  264. package/icons/WarningIcon.js +1 -3
  265. package/package.json +5 -5
  266. package/tsconfig.build.json +16 -0
  267. package/tsconfig.json +3 -0
  268. package/ActionButton/style.js +0 -22
  269. package/Availability/style.js +0 -19
  270. package/Button/style.js +0 -155
  271. package/Card/style.js +0 -11
  272. package/CardList/components/Item/style.js +0 -7
  273. package/CartTotalLine/components/Amount/style.js +0 -8
  274. package/CartTotalLine/components/Hint/style.js +0 -12
  275. package/CartTotalLine/components/Label/style.js +0 -17
  276. package/CartTotalLine/style.js +0 -31
  277. package/Checkbox/style.js +0 -18
  278. package/Chip/style.js +0 -78
  279. package/ContextMenu/components/Item/style.js +0 -34
  280. package/ContextMenu/components/Position/style.js +0 -11
  281. package/ContextMenu/style.js +0 -45
  282. package/DiscountBadge/style.js +0 -36
  283. package/FavoritesButton/style.js +0 -26
  284. package/Form/Checkbox/style.js +0 -25
  285. package/Form/InfoField/style.js +0 -11
  286. package/Form/Password/style.js +0 -11
  287. package/Form/RadioGroup/components/Item/style.js +0 -32
  288. package/Form/RadioGroup/style.js +0 -20
  289. package/Form/Select/style.js +0 -27
  290. package/Form/SelectContextChoices/style.js +0 -23
  291. package/Form/TextField/style.js +0 -70
  292. package/FormElement/components/ErrorText/style.js +0 -13
  293. package/FormElement/components/Label/style.js +0 -89
  294. package/FormElement/components/Placeholder/style.js +0 -56
  295. package/FormElement/components/Underline/style.js +0 -60
  296. package/FormElement/style.js +0 -14
  297. package/Glow/style.js +0 -18
  298. package/IndicatorCircle/style.js +0 -65
  299. package/LoadingIndicator/style.js +0 -20
  300. package/Manufacturer/style.js +0 -5
  301. package/MessageBar/spec.js +0 -80
  302. package/MessageBar/style.js +0 -38
  303. package/NoResults/components/Icon/style.js +0 -17
  304. package/NoResults/style.js +0 -31
  305. package/Placeholder/style.js +0 -11
  306. package/PlaceholderLabel/style.js +0 -12
  307. package/Price/style.js +0 -22
  308. package/PriceInfo/style.js +0 -5
  309. package/PriceStriked/style.js +0 -36
  310. package/ProgressBar/style.js +0 -85
  311. package/RadioButton/style.js +0 -21
  312. package/RatingStars/style.js +0 -53
  313. package/Ripple/style.js +0 -18
  314. package/ScannerOverlay/components/CameraOverlay/style.js +0 -40
  315. package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/style.js +0 -28
  316. package/ScannerOverlay/components/ScannerBar/style.js +0 -20
  317. package/Sheet/components/Header/components/SearchBar/style.js +0 -47
  318. package/Sheet/components/Header/style.js +0 -50
  319. package/Sheet/style.js +0 -143
  320. package/TaxDisclaimer/style.js +0 -9
  321. package/TextField/components/ErrorText/style.js +0 -27
  322. package/TextField/components/FormElement/style.js +0 -34
  323. package/TextField/components/Hint/style.js +0 -46
  324. package/TextField/components/Label/style.js +0 -80
  325. package/TextField/components/Underline/style.js +0 -60
  326. package/TextField/style.js +0 -35
package/Button/index.js CHANGED
@@ -1,94 +1,117 @@
1
- import _createClass from "@babel/runtime/helpers/createClass";
2
- import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
3
- import React, { Component } from 'react';
1
+ import React from 'react';
4
2
  import PropTypes from 'prop-types';
5
3
  import BaseButton from '@shopgate/pwa-common/components/Button';
6
- import styles from "./style";
4
+ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
5
+ import { makeStyles } from '@shopgate/engage/styles';
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
+ const {
8
+ colors
9
+ } = themeConfig;
8
10
  /**
9
- * The basic button component. This components applies Material Design styles and acts as
10
- * base to more feature-rich button components such as ActionButton and RippleButton, but can
11
- * also be used as standalone component or any other kind of new button.
11
+ * @param {string} text Text color.
12
+ * @param {string|null} background Fill color.
13
+ * @returns {Object} JSS for root button.
12
14
  */
13
- let Button = /*#__PURE__*/function (_Component) {
14
- function Button() {
15
- return _Component.apply(this, arguments) || this;
15
+ const baseButton = (text, background) => ({
16
+ position: 'relative',
17
+ display: 'inline-block',
18
+ outline: 0,
19
+ color: text,
20
+ backgroundColor: background,
21
+ minWidth: 64,
22
+ overflow: 'hidden',
23
+ ':disabled': {
24
+ cursor: 'not-allowed'
25
+ },
26
+ ...themeConfig.variables.buttonBase
27
+ });
28
+
29
+ /**
30
+ * @param {string} textColor Text color.
31
+ * @param {string|null} fillColor Fill color.
32
+ * @param {Object} theme Theme with spacing().
33
+ * @returns {Object} Object with `button` and `content` style maps.
34
+ */
35
+ const pairFromColors = (textColor, fillColor, theme) => ({
36
+ button: baseButton(textColor, fillColor),
37
+ content: {
38
+ padding: theme.spacing(0, 2, 0),
39
+ color: textColor
16
40
  }
17
- _inheritsLoose(Button, _Component);
18
- var _proto = Button.prototype;
19
- /**
20
- * Renders the component.
21
- * @return {JSX}
22
- */
23
- _proto.render = function render() {
24
- const {
25
- style
26
- } = this;
27
- const content = this.props.wrapContent ? /*#__PURE__*/_jsx("div", {
28
- className: style.content,
29
- children: this.props.children
30
- }) : this.props.children;
31
- return /*#__PURE__*/_jsx(BaseButton, {
32
- ...this.buttonProps,
33
- className: `ui-shared__button ${style.button} ${this.props.className}`,
34
- testId: this.props.testId,
35
- children: content
36
- });
37
- };
38
- return _createClass(Button, [{
39
- key: "style",
40
- get:
41
- /**
42
- * Getter for style depending on prop type.
43
- * @returns {Object}
44
- */
45
- function () {
46
- const {
47
- flat,
48
- disabled
49
- } = this.props;
50
- switch (this.props.type) {
51
- case 'plain':
52
- return styles.plain();
53
- case 'regular':
54
- return styles.regular(disabled);
55
- case 'simple':
56
- return styles.simple(disabled);
57
- default:
58
- case 'primary':
59
- return styles.primary(disabled, flat);
60
- case 'secondary':
61
- return styles.secondary(disabled, flat);
41
+ });
42
+ const useStyles = makeStyles()((theme, {
43
+ type,
44
+ flat,
45
+ disabled
46
+ }) => {
47
+ if (type === 'plain') {
48
+ return {
49
+ button: {
50
+ padding: 0,
51
+ outline: 0,
52
+ border: 0,
53
+ textAlign: 'left'
62
54
  }
55
+ };
56
+ }
57
+ if (type === 'simple') {
58
+ return disabled ? pairFromColors(themeConfig.colors.shade4, themeConfig.colors.shade7, theme) : pairFromColors(themeConfig.colors.dark, themeConfig.colors.shade7, theme);
59
+ }
60
+ if (type === 'regular') {
61
+ return disabled ? pairFromColors(colors.shade4, null, theme) : pairFromColors(colors.dark, null, theme);
62
+ }
63
+ if (type === 'secondary') {
64
+ if (!flat) {
65
+ return disabled ? pairFromColors(colors.shade4, colors.shade7, theme) : pairFromColors('var(--color-primary-contrast)', 'var(--color-primary)', theme);
63
66
  }
67
+ return disabled ? pairFromColors(colors.shade4, null, theme) : pairFromColors('var(--color-primary)', null, theme);
68
+ }
69
+ if (!flat) {
70
+ return disabled ? pairFromColors(colors.shade4, colors.shade7, theme) : pairFromColors('var(--color-secondary-contrast)', 'var(--color-secondary)', theme);
71
+ }
72
+ return disabled ? pairFromColors(colors.shade4, null, theme) : pairFromColors('var(--color-secondary)', null, theme);
73
+ });
64
74
 
65
- /**
66
- * Getter for the calculated button props.
67
- * @returns {Object}
68
- */
69
- }, {
70
- key: "buttonProps",
71
- get: function () {
72
- const {
73
- className,
74
- disabled,
75
- onClick,
76
- testId,
77
- type,
78
- wrapContent,
79
- flat,
80
- ...rest
81
- } = this.props;
82
- const buttonProps = {
83
- className,
84
- disabled,
85
- onClick,
86
- ...rest
87
- };
88
- return buttonProps;
89
- }
90
- }]);
91
- }(Component);
75
+ /**
76
+ * The basic button component.
77
+ * @param {Object} props Props.
78
+ * @returns {JSX.Element}
79
+ */
80
+ const Button = props => {
81
+ const {
82
+ className,
83
+ flat,
84
+ disabled,
85
+ testId,
86
+ type,
87
+ wrapContent,
88
+ children,
89
+ onClick,
90
+ ...rest
91
+ } = props;
92
+ const {
93
+ classes,
94
+ cx
95
+ } = useStyles({
96
+ type,
97
+ flat,
98
+ disabled
99
+ });
100
+ const content = wrapContent ? /*#__PURE__*/_jsx("div", {
101
+ ...(classes.content ? {
102
+ className: classes.content
103
+ } : {}),
104
+ children: children
105
+ }) : children;
106
+ return /*#__PURE__*/_jsx(BaseButton, {
107
+ ...rest,
108
+ className: cx('ui-shared__button', classes.button, className),
109
+ disabled: disabled,
110
+ onClick: onClick,
111
+ testId: testId,
112
+ children: content
113
+ });
114
+ };
92
115
  Button.defaultProps = {
93
116
  ...BaseButton.defaultProps,
94
117
  className: '',
package/Button/spec.js CHANGED
@@ -2,7 +2,6 @@ import trim from 'lodash/trim';
2
2
  import React from 'react';
3
3
  import { shallow } from 'enzyme';
4
4
  import Button from "./index";
5
- import styles from "./style";
6
5
  import { jsx as _jsx } from "react/jsx-runtime";
7
6
  describe('<Button />', () => {
8
7
  it('should render as a regular button if type is omitted', () => {
@@ -18,14 +17,14 @@ describe('<Button />', () => {
18
17
  children: "Press me"
19
18
  }));
20
19
  expect(wrapper).toMatchSnapshot();
21
- expect(trim(wrapper.prop('className'))).toEqual(`ui-shared__button ${styles.regular(false).button}`);
20
+ expect(trim(wrapper.prop('className'))).toMatch(/^ui-shared__button\s+/);
22
21
  });
23
22
  it('should render as a primary button', () => {
24
23
  const wrapper = shallow(/*#__PURE__*/_jsx(Button, {
25
24
  type: "primary",
26
25
  children: "Press me"
27
26
  }));
28
- expect(trim(wrapper.prop('className'))).toEqual(`ui-shared__button ${styles.primary(false, false).button}`);
27
+ expect(trim(wrapper.prop('className'))).toMatch(/^ui-shared__button\s+/);
29
28
  expect(wrapper).toMatchSnapshot();
30
29
  });
31
30
  it('should render as a secondary button', () => {
@@ -33,7 +32,7 @@ describe('<Button />', () => {
33
32
  type: "secondary",
34
33
  children: "Press me"
35
34
  }));
36
- expect(trim(wrapper.prop('className'))).toEqual(`ui-shared__button ${styles.secondary(false, false).button}`);
35
+ expect(trim(wrapper.prop('className'))).toMatch(/^ui-shared__button\s+/);
37
36
  expect(wrapper).toMatchSnapshot();
38
37
  });
39
38
  });
package/Card/index.js CHANGED
@@ -1,22 +1,41 @@
1
+ import "core-js/modules/es.array.includes.js";
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
- import styles from "./style";
4
+ import { themeConfig, themeName } from '@shopgate/pwa-common/helpers/config';
5
+ import { makeStyles } from '@shopgate/engage/styles';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const isIOS = themeName.includes('ios');
8
+ const useStyles = makeStyles()({
9
+ root: {
10
+ boxShadow: themeConfig.shadows.productCard,
11
+ margin: '5px 5px 10px',
12
+ borderRadius: isIOS ? 10 : 2,
13
+ background: themeConfig.colors.light,
14
+ overflow: 'hidden',
15
+ position: 'relative'
16
+ }
17
+ });
4
18
 
5
19
  /**
6
20
  * Renders the card component.
7
21
  * @param {Object} props The component properties.
8
22
  * @returns {JSX}
9
23
  */
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
24
  const Card = ({
12
25
  className,
13
26
  children,
14
27
  id
15
- }) => /*#__PURE__*/_jsx("div", {
16
- className: `ui-shared__card ${styles} ${className}`,
17
- id: id,
18
- children: children
19
- });
28
+ }) => {
29
+ const {
30
+ classes,
31
+ cx
32
+ } = useStyles();
33
+ return /*#__PURE__*/_jsx("div", {
34
+ className: cx('ui-shared__card', classes.root, className),
35
+ id: id,
36
+ children: children
37
+ });
38
+ };
20
39
  Card.defaultProps = {
21
40
  className: '',
22
41
  id: null
@@ -1,24 +1,36 @@
1
1
  import React, { Children } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import ListItem from '@shopgate/pwa-common/components/List/components/Item';
4
- import styles from "./style";
4
+ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
5
+ import { makeStyles } from '@shopgate/engage/styles';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const useStyles = makeStyles()(theme => ({
8
+ root: {
9
+ background: themeConfig.colors.light,
10
+ marginBottom: theme.spacing(0.5),
11
+ position: 'relative'
12
+ }
13
+ }));
5
14
 
6
15
  /**
7
16
  * The Card List Item component implemented as class so that ref prop is available.
8
17
  * @param {Object} props The component props.
9
18
  * @return {JSX}
10
19
  */
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
20
  const Item = ({
13
21
  children,
14
22
  className,
15
23
  isSelected
16
24
  }) => {
25
+ const {
26
+ classes,
27
+ cx
28
+ } = useStyles();
17
29
  if (!Children.count(children)) {
18
30
  return null;
19
31
  }
20
32
  return /*#__PURE__*/_jsx(ListItem, {
21
- className: `${styles} ${className}`,
33
+ className: cx(classes.root, className),
22
34
  isSelected: isSelected,
23
35
  children: children
24
36
  });
@@ -1,23 +1,32 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import I18n from '@shopgate/pwa-common/components/I18n';
4
- import styles from "./style";
3
+ import { I18n } from '@shopgate/engage/components';
4
+ import { makeStyles } from '@shopgate/engage/styles';
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ const useStyles = makeStyles()({
7
+ amount: {
8
+ textAlign: 'right',
9
+ order: 4
10
+ }
11
+ });
5
12
 
6
13
  /**
7
14
  * The Amount component.
8
15
  * @param {Object} props The component props.
9
16
  * @return {JSX}
10
17
  */
11
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
18
  const Amount = ({
13
19
  amount,
14
20
  currency
15
21
  }) => {
22
+ const {
23
+ classes
24
+ } = useStyles();
16
25
  if (amount === null) {
17
26
  return null;
18
27
  }
19
28
  return /*#__PURE__*/_jsxs("div", {
20
- className: styles.amount,
29
+ className: classes.amount,
21
30
  children: [typeof amount === 'string' && /*#__PURE__*/_jsx(I18n.Text, {
22
31
  string: amount
23
32
  }), typeof amount === 'number' && /*#__PURE__*/_jsx(I18n.Price, {
@@ -1,22 +1,31 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import I18n from '@shopgate/pwa-common/components/I18n';
4
- import styles from "./style";
3
+ import { I18n } from '@shopgate/engage/components';
4
+ import { makeStyles } from '@shopgate/engage/styles';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const useStyles = makeStyles()(theme => ({
7
+ hint: {
8
+ paddingLeft: theme.spacing(1),
9
+ order: 5
10
+ }
11
+ }));
5
12
 
6
13
  /**
7
14
  * The Hint component.
8
15
  * @param {Object} props The component props.
9
16
  * @return {JSX|null}
10
17
  */
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
18
  const Hint = ({
13
19
  hint
14
20
  }) => {
21
+ const {
22
+ classes
23
+ } = useStyles();
15
24
  if (hint === null) {
16
25
  return null;
17
26
  }
18
27
  return /*#__PURE__*/_jsx("div", {
19
- className: styles.hint,
28
+ className: classes.hint,
20
29
  children: /*#__PURE__*/_jsx(I18n.Text, {
21
30
  string: hint
22
31
  })
@@ -1,37 +1,50 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
3
  import { I18n } from '@shopgate/engage/components';
5
- import styles from "./style";
4
+ import { makeStyles } from '@shopgate/engage/styles';
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ const useStyles = makeStyles()(theme => ({
7
+ label: {
8
+ flexGrow: 1,
9
+ paddingRight: theme.spacing(1),
10
+ order: 3
11
+ },
12
+ labelWithSuffix: {
13
+ paddingRight: theme.spacing(1)
14
+ }
15
+ }));
6
16
 
7
17
  /**
8
18
  * The ShippingCostsLabel component.
9
19
  * @param {Object} props The component props.
10
20
  * @return {JSX|null}
11
21
  */
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- function Label({
22
+ const Label = ({
14
23
  label,
15
24
  showSeparator,
16
25
  labelParams,
17
26
  suffix
18
- }) {
27
+ }) => {
28
+ const {
29
+ classes,
30
+ cx
31
+ } = useStyles();
19
32
  if (!label) {
20
33
  return /*#__PURE__*/_jsx("div", {
21
- className: styles.label
34
+ className: classes.label
22
35
  });
23
36
  }
24
37
  return /*#__PURE__*/_jsxs("div", {
25
- className: styles.label,
38
+ className: classes.label,
26
39
  children: [/*#__PURE__*/_jsx(I18n.Text, {
27
40
  string: label,
28
41
  params: labelParams,
29
- className: classNames({
30
- [styles.labelWithSuffix]: !!suffix
42
+ className: cx({
43
+ [classes.labelWithSuffix]: !!suffix
31
44
  })
32
45
  }), suffix, `${showSeparator ? ':' : ''}`]
33
46
  });
34
- }
47
+ };
35
48
  Label.defaultProps = {
36
49
  label: null,
37
50
  suffix: null,
@@ -1,30 +1,64 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
3
+ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
4
+ import { makeStyles } from '@shopgate/engage/styles';
4
5
  import Label from "./components/Label";
5
6
  import Amount from "./components/Amount";
6
7
  import Hint from "./components/Hint";
7
8
  import Spacer from "./components/Spacer";
8
- import styles from "./style";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const {
11
+ colors
12
+ } = themeConfig;
13
+ const useStyles = makeStyles()({
14
+ line: {
15
+ display: 'flex',
16
+ justifyContent: 'space-between',
17
+ fontSize: '0.875rem',
18
+ alignItems: 'baseline'
19
+ },
20
+ disabled: {
21
+ color: `${colors.shade4} !important`
22
+ },
23
+ base: {
24
+ color: colors.shade9
25
+ },
26
+ subTotal: {
27
+ color: `${colors.dark}`
28
+ },
29
+ grandTotal: {
30
+ color: `${colors.dark}`,
31
+ fontSize: '1rem !important'
32
+ }
33
+ });
9
34
 
10
35
  /**
11
36
  * @returns {JSX}
12
37
  */
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
38
  const CartTotalLine = ({
15
39
  children,
16
40
  type,
17
41
  isDisabled,
18
42
  className
19
43
  }) => {
44
+ const {
45
+ classes,
46
+ cx
47
+ } = useStyles();
20
48
  if (!children) {
21
49
  return null;
22
50
  }
51
+ let typeClass = classes.base;
52
+ if (type === 'subTotal') {
53
+ typeClass = classes.subTotal;
54
+ } else if (type === 'grandTotal') {
55
+ typeClass = classes.grandTotal;
56
+ }
23
57
  return /*#__PURE__*/_jsx("div", {
24
- className: classNames(className, `ui-shared__cart-total-line ui-shared__cart-${type}-line`, styles.line, {
25
- [styles.disabled]: isDisabled,
26
- [styles[type] || styles.base]: true
27
- }),
58
+ className: cx(`ui-shared__cart-total-line ui-shared__cart-${type}-line`, classes.line, {
59
+ [classes.disabled]: isDisabled,
60
+ [typeClass]: true
61
+ }, className),
28
62
  "data-test-id": `${type}CartTotal`,
29
63
  children: children
30
64
  });
package/Checkbox/index.js CHANGED
@@ -1,38 +1,62 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
3
+ import { makeStyles } from '@shopgate/engage/styles';
4
+ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
4
5
  import BaseCheckbox from '@shopgate/pwa-common/components/Checkbox';
5
6
  import CheckedIcon from "../icons/CheckedIcon";
6
7
  import UncheckedIcon from "../icons/UncheckedIcon";
7
- import styles from "./style";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const useStyles = makeStyles()(() => ({
10
+ icon: {
11
+ width: 24,
12
+ height: 24,
13
+ flexShrink: 0
14
+ },
15
+ checkedIcon: {
16
+ color: 'var(--color-secondary)'
17
+ },
18
+ uncheckedIcon: {
19
+ color: themeConfig.colors.shade6
20
+ }
21
+ }));
8
22
 
9
23
  /**
10
24
  * The checkbox template component.
11
25
  * @param {Object} props The component props
12
26
  * @param {string} props.className Class for the underlying Checkbox component
13
- * @param {string} props.checkedClassName Class for checked icon.
14
- * @param {string} props.unCheckedClassName Class for unchecked icon.
27
+ * @param {string} [props.checkedClassName] Extra class for checked icon; default: secondary color.
28
+ * @param {string} [props.unCheckedClassName] Extra class for unchecked icon; default: shade6.
15
29
  * @returns {JSX.Element}
16
30
  */
17
- import { jsx as _jsx } from "react/jsx-runtime";
18
31
  const Checkbox = ({
19
32
  checkedClassName,
20
33
  unCheckedClassName,
21
34
  className,
22
35
  ...props
23
- }) => /*#__PURE__*/_jsx(BaseCheckbox, {
24
- ...props,
25
- className: `ui-shared__checkbox ${className}`,
26
- checkedIcon: /*#__PURE__*/_jsx(CheckedIcon, {
27
- className: classNames(styles.icon, checkedClassName, 'checkedIcon')
28
- }),
29
- uncheckedIcon: /*#__PURE__*/_jsx(UncheckedIcon, {
30
- className: classNames(styles.icon, unCheckedClassName, 'uncheckedIcon')
31
- })
32
- });
36
+ }) => {
37
+ const {
38
+ classes,
39
+ cx
40
+ } = useStyles();
41
+
42
+ // Legacy default: theme classes for checked/unchecked unless props are passed.
43
+ // `??` keeps an explicit '' from restoring defaults (like old cx(icon, '', )).
44
+ const checkedCls = checkedClassName ?? classes.checkedIcon;
45
+ const uncheckedCls = unCheckedClassName ?? classes.uncheckedIcon;
46
+ return /*#__PURE__*/_jsx(BaseCheckbox, {
47
+ ...props,
48
+ className: cx('ui-shared__checkbox', className),
49
+ checkedIcon: /*#__PURE__*/_jsx(CheckedIcon, {
50
+ className: cx(classes.icon, checkedCls, 'checkedIcon')
51
+ }),
52
+ uncheckedIcon: /*#__PURE__*/_jsx(UncheckedIcon, {
53
+ className: cx(classes.icon, uncheckedCls, 'uncheckedIcon')
54
+ })
55
+ });
56
+ };
33
57
  Checkbox.defaultProps = {
34
- checkedClassName: styles.checkedIcon,
35
58
  className: '',
36
- unCheckedClassName: styles.uncheckedIcon
59
+ checkedClassName: undefined,
60
+ unCheckedClassName: undefined
37
61
  };
38
62
  export default Checkbox;