@shopgate/pwa-ui-shared 7.30.3 → 7.31.0-alpha.1

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/Availability/index.js +24 -6
  4. package/Button/index.js +105 -82
  5. package/Button/spec.js +3 -4
  6. package/Card/index.js +26 -7
  7. package/CardList/components/Item/index.js +15 -3
  8. package/CartTotalLine/components/Amount/index.js +13 -4
  9. package/CartTotalLine/components/Hint/index.js +13 -4
  10. package/CartTotalLine/components/Label/index.js +23 -10
  11. package/CartTotalLine/index.js +41 -7
  12. package/Checkbox/index.js +41 -17
  13. package/Chip/index.js +82 -7
  14. package/ContextMenu/components/Item/index.js +38 -20
  15. package/ContextMenu/components/Position/index.js +38 -56
  16. package/ContextMenu/index.js +64 -28
  17. package/Dialog/components/BasicDialog/index.js +1 -0
  18. package/Dialog/components/HtmlContentDialog/spec.js +39 -0
  19. package/Dialog/components/PipelineErrorDialog/index.js +108 -157
  20. package/Dialog/components/PipelineErrorDialog/spec.js +12 -18
  21. package/Dialog/components/TextMessageDialog/index.js +1 -1
  22. package/Dialog/components/VariantSelectModal/index.js +1 -1
  23. package/Dialog/index.js +1 -1
  24. package/DiscountBadge/index.js +48 -15
  25. package/FavoritesButton/index.js +95 -100
  26. package/FavoritesButton/spec.js +5 -2
  27. package/Form/Builder/classes/ActionListener/index.js +1 -0
  28. package/Form/Checkbox/index.js +64 -56
  29. package/Form/InfoField/index.js +18 -6
  30. package/Form/Password/index.js +39 -52
  31. package/Form/RadioGroup/components/Item/index.js +72 -56
  32. package/Form/RadioGroup/index.js +79 -90
  33. package/Form/Select/index.js +108 -130
  34. package/Form/SelectContextChoices/index.js +30 -8
  35. package/Form/TextField/index.js +106 -82
  36. package/Form/TextField/spec.js +4 -3
  37. package/FormElement/components/ErrorText/index.js +32 -14
  38. package/FormElement/components/Label/index.js +56 -6
  39. package/FormElement/components/Placeholder/index.js +44 -11
  40. package/FormElement/components/Underline/index.js +63 -12
  41. package/FormElement/index.js +62 -85
  42. package/Glow/index.js +73 -83
  43. package/IndicatorCircle/index.js +73 -17
  44. package/IndicatorCircle/spec.js +2 -5
  45. package/LoadingIndicator/index.js +34 -12
  46. package/Manufacturer/index.js +21 -10
  47. package/MessageBar/index.js +12 -38
  48. package/NoResults/components/Icon/index.js +30 -14
  49. package/NoResults/index.js +35 -7
  50. package/Placeholder/index.js +34 -23
  51. package/PlaceholderLabel/index.js +17 -3
  52. package/Price/index.js +34 -21
  53. package/PriceInfo/index.js +23 -9
  54. package/PriceStriked/index.js +67 -77
  55. package/ProgressBar/index.js +112 -77
  56. package/RadioButton/index.js +29 -11
  57. package/RatingStars/index.js +122 -137
  58. package/Ripple/components/RippleAnimation/index.js +13 -3
  59. package/Ripple/index.js +158 -212
  60. package/RippleButton/index.js +63 -60
  61. package/RippleButton/spec.js +15 -9
  62. package/ScannerOverlay/components/CameraOverlay/index.js +54 -10
  63. package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +53 -27
  64. package/ScannerOverlay/components/ScannerBar/index.js +50 -26
  65. package/Sheet/components/Header/components/SearchBar/index.js +54 -10
  66. package/Sheet/components/Header/index.js +96 -76
  67. package/Sheet/index.js +295 -157
  68. package/Sheet/spec.js +8 -6
  69. package/TaxDisclaimer/index.js +17 -4
  70. package/TaxDisclaimer/spec.js +16 -5
  71. package/TextField/components/ErrorText/index.js +35 -14
  72. package/TextField/components/FormElement/index.js +29 -4
  73. package/TextField/components/Hint/index.js +39 -10
  74. package/TextField/components/Label/index.js +43 -6
  75. package/TextField/components/Underline/index.js +64 -13
  76. package/TextField/index.js +157 -171
  77. package/TextField/spec.js +5 -3
  78. package/icons/AccountBoxIcon.d.ts +7 -0
  79. package/icons/AccountBoxIcon.d.ts.map +1 -0
  80. package/icons/AccountBoxIcon.js +1 -4
  81. package/icons/AddMoreIcon.d.ts +7 -0
  82. package/icons/AddMoreIcon.d.ts.map +1 -0
  83. package/icons/AddMoreIcon.js +0 -3
  84. package/icons/ArrowDropIcon.d.ts +7 -0
  85. package/icons/ArrowDropIcon.d.ts.map +1 -0
  86. package/icons/ArrowDropIcon.js +0 -3
  87. package/icons/ArrowIcon.d.ts +10 -0
  88. package/icons/ArrowIcon.d.ts.map +1 -0
  89. package/icons/ArrowIcon.js +2 -11
  90. package/icons/BarcodeScannerIcon.d.ts +7 -0
  91. package/icons/BarcodeScannerIcon.d.ts.map +1 -0
  92. package/icons/BarcodeScannerIcon.js +0 -3
  93. package/icons/BoxIcon.d.ts +7 -0
  94. package/icons/BoxIcon.d.ts.map +1 -0
  95. package/icons/BoxIcon.js +0 -3
  96. package/icons/BrowseIcon.d.ts +7 -0
  97. package/icons/BrowseIcon.d.ts.map +1 -0
  98. package/icons/BrowseIcon.js +1 -3
  99. package/icons/BurgerIcon.d.ts +7 -0
  100. package/icons/BurgerIcon.d.ts.map +1 -0
  101. package/icons/BurgerIcon.js +0 -3
  102. package/icons/CalendarIcon.d.ts +7 -0
  103. package/icons/CalendarIcon.d.ts.map +1 -0
  104. package/icons/CalendarIcon.js +0 -2
  105. package/icons/CartCouponIcon.d.ts +7 -0
  106. package/icons/CartCouponIcon.d.ts.map +1 -0
  107. package/icons/CartCouponIcon.js +0 -2
  108. package/icons/CartIcon.d.ts +7 -0
  109. package/icons/CartIcon.d.ts.map +1 -0
  110. package/icons/CartIcon.js +0 -2
  111. package/icons/CartPlusIcon.d.ts +7 -0
  112. package/icons/CartPlusIcon.d.ts.map +1 -0
  113. package/icons/CartPlusIcon.js +0 -2
  114. package/icons/CheckIcon.d.ts +7 -0
  115. package/icons/CheckIcon.d.ts.map +1 -0
  116. package/icons/CheckIcon.js +0 -2
  117. package/icons/CheckedIcon.d.ts +7 -0
  118. package/icons/CheckedIcon.d.ts.map +1 -0
  119. package/icons/CheckedIcon.js +0 -3
  120. package/icons/ChevronIcon.d.ts +7 -0
  121. package/icons/ChevronIcon.d.ts.map +1 -0
  122. package/icons/ChevronIcon.js +0 -2
  123. package/icons/CreditCardIcon.d.ts +7 -0
  124. package/icons/CreditCardIcon.d.ts.map +1 -0
  125. package/icons/CreditCardIcon.js +0 -2
  126. package/icons/CrossIcon.d.ts +7 -0
  127. package/icons/CrossIcon.d.ts.map +1 -0
  128. package/icons/CrossIcon.js +0 -2
  129. package/icons/DescriptionIcon.d.ts +7 -0
  130. package/icons/DescriptionIcon.d.ts.map +1 -0
  131. package/icons/DescriptionIcon.js +0 -2
  132. package/icons/FilterIcon.d.ts +7 -0
  133. package/icons/FilterIcon.d.ts.map +1 -0
  134. package/icons/FilterIcon.js +0 -2
  135. package/icons/FlashDisabledIcon.d.ts +7 -0
  136. package/icons/FlashDisabledIcon.d.ts.map +1 -0
  137. package/icons/FlashDisabledIcon.js +0 -2
  138. package/icons/FlashEnabledIcon.d.ts +7 -0
  139. package/icons/FlashEnabledIcon.d.ts.map +1 -0
  140. package/icons/FlashEnabledIcon.js +0 -2
  141. package/icons/GridIcon.d.ts +7 -0
  142. package/icons/GridIcon.d.ts.map +1 -0
  143. package/icons/GridIcon.js +1 -3
  144. package/icons/HeartIcon.d.ts +7 -0
  145. package/icons/HeartIcon.d.ts.map +1 -0
  146. package/icons/HeartIcon.js +0 -2
  147. package/icons/HeartOutlineIcon.d.ts +7 -0
  148. package/icons/HeartOutlineIcon.d.ts.map +1 -0
  149. package/icons/HeartOutlineIcon.js +1 -3
  150. package/icons/HeartPlusIcon.d.ts +7 -0
  151. package/icons/HeartPlusIcon.d.ts.map +1 -0
  152. package/icons/HeartPlusIcon.js +1 -3
  153. package/icons/HeartPlusOutlineIcon.d.ts +7 -0
  154. package/icons/HeartPlusOutlineIcon.d.ts.map +1 -0
  155. package/icons/HeartPlusOutlineIcon.js +1 -3
  156. package/icons/HomeIcon.d.ts +7 -0
  157. package/icons/HomeIcon.d.ts.map +1 -0
  158. package/icons/HomeIcon.js +0 -2
  159. package/icons/InfoIcon.d.ts +7 -0
  160. package/icons/InfoIcon.d.ts.map +1 -0
  161. package/icons/InfoIcon.js +0 -2
  162. package/icons/InfoOutlineIcon.d.ts +7 -0
  163. package/icons/InfoOutlineIcon.d.ts.map +1 -0
  164. package/icons/InfoOutlineIcon.js +0 -2
  165. package/icons/ListIcon.d.ts +7 -0
  166. package/icons/ListIcon.d.ts.map +1 -0
  167. package/icons/ListIcon.js +0 -2
  168. package/icons/LocalShippingIcon.d.ts +7 -0
  169. package/icons/LocalShippingIcon.d.ts.map +1 -0
  170. package/icons/LocalShippingIcon.js +0 -2
  171. package/icons/LocationIcon.d.ts +7 -0
  172. package/icons/LocationIcon.d.ts.map +1 -0
  173. package/icons/LocationIcon.js +1 -4
  174. package/icons/LocatorIcon.d.ts +7 -0
  175. package/icons/LocatorIcon.d.ts.map +1 -0
  176. package/icons/LocatorIcon.js +1 -3
  177. package/icons/LockIcon.d.ts +9 -0
  178. package/icons/LockIcon.d.ts.map +1 -0
  179. package/icons/LockIcon.js +1 -2
  180. package/icons/LogoutIcon.d.ts +7 -0
  181. package/icons/LogoutIcon.d.ts.map +1 -0
  182. package/icons/LogoutIcon.js +0 -2
  183. package/icons/MagnifierIcon.d.ts +7 -0
  184. package/icons/MagnifierIcon.d.ts.map +1 -0
  185. package/icons/MagnifierIcon.js +0 -2
  186. package/icons/MapMarkerIcon.d.ts +7 -0
  187. package/icons/MapMarkerIcon.d.ts.map +1 -0
  188. package/icons/MapMarkerIcon.js +1 -3
  189. package/icons/MoreIcon.d.ts +7 -0
  190. package/icons/MoreIcon.d.ts.map +1 -0
  191. package/icons/MoreIcon.js +1 -3
  192. package/icons/MoreVertIcon.d.ts +7 -0
  193. package/icons/MoreVertIcon.d.ts.map +1 -0
  194. package/icons/MoreVertIcon.js +1 -3
  195. package/icons/NotificationIcon.d.ts +7 -0
  196. package/icons/NotificationIcon.d.ts.map +1 -0
  197. package/icons/NotificationIcon.js +1 -3
  198. package/icons/PersonIcon.d.ts +9 -0
  199. package/icons/PersonIcon.d.ts.map +1 -0
  200. package/icons/PersonIcon.js +0 -3
  201. package/icons/PhoneIcon.d.ts +7 -0
  202. package/icons/PhoneIcon.d.ts.map +1 -0
  203. package/icons/PhoneIcon.js +1 -4
  204. package/icons/PlaceholderIcon.d.ts +7 -0
  205. package/icons/PlaceholderIcon.d.ts.map +1 -0
  206. package/icons/PlaceholderIcon.js +0 -2
  207. package/icons/RadioCheckedIcon.d.ts +10 -0
  208. package/icons/RadioCheckedIcon.d.ts.map +1 -0
  209. package/icons/RadioCheckedIcon.js +0 -2
  210. package/icons/RadioUncheckedIcon.d.ts +10 -0
  211. package/icons/RadioUncheckedIcon.d.ts.map +1 -0
  212. package/icons/RadioUncheckedIcon.js +0 -2
  213. package/icons/SecurityIcon.d.ts +7 -0
  214. package/icons/SecurityIcon.d.ts.map +1 -0
  215. package/icons/SecurityIcon.js +0 -2
  216. package/icons/ShippingMethodIcon.d.ts +7 -0
  217. package/icons/ShippingMethodIcon.d.ts.map +1 -0
  218. package/icons/ShippingMethodIcon.js +0 -2
  219. package/icons/ShoppingCartIcon.d.ts +7 -0
  220. package/icons/ShoppingCartIcon.d.ts.map +1 -0
  221. package/icons/ShoppingCartIcon.js +0 -2
  222. package/icons/SortIcon.d.ts +7 -0
  223. package/icons/SortIcon.d.ts.map +1 -0
  224. package/icons/SortIcon.js +0 -2
  225. package/icons/StarHalfIcon.d.ts +7 -0
  226. package/icons/StarHalfIcon.d.ts.map +1 -0
  227. package/icons/StarHalfIcon.js +0 -9
  228. package/icons/StarIcon.d.ts +7 -0
  229. package/icons/StarIcon.d.ts.map +1 -0
  230. package/icons/StarIcon.js +0 -9
  231. package/icons/StarOutlineIcon.d.ts +7 -0
  232. package/icons/StarOutlineIcon.d.ts.map +1 -0
  233. package/icons/StarOutlineIcon.js +0 -2
  234. package/icons/StopIcon.d.ts +7 -0
  235. package/icons/StopIcon.d.ts.map +1 -0
  236. package/icons/StopIcon.js +0 -2
  237. package/icons/TickIcon.d.ts +7 -0
  238. package/icons/TickIcon.d.ts.map +1 -0
  239. package/icons/TickIcon.js +0 -2
  240. package/icons/TimeIcon.d.ts +7 -0
  241. package/icons/TimeIcon.d.ts.map +1 -0
  242. package/icons/TimeIcon.js +0 -2
  243. package/icons/TrashIcon.d.ts +7 -0
  244. package/icons/TrashIcon.d.ts.map +1 -0
  245. package/icons/TrashIcon.js +0 -3
  246. package/icons/TrashOutlineIcon.d.ts +8 -0
  247. package/icons/TrashOutlineIcon.d.ts.map +1 -0
  248. package/icons/TrashOutlineIcon.js +0 -2
  249. package/icons/UncheckedIcon.d.ts +7 -0
  250. package/icons/UncheckedIcon.d.ts.map +1 -0
  251. package/icons/UncheckedIcon.js +0 -2
  252. package/icons/ViewListIcon.d.ts +7 -0
  253. package/icons/ViewListIcon.d.ts.map +1 -0
  254. package/icons/ViewListIcon.js +0 -2
  255. package/icons/VisibilityIcon.d.ts +8 -0
  256. package/icons/VisibilityIcon.d.ts.map +1 -0
  257. package/icons/VisibilityIcon.js +2 -4
  258. package/icons/VisibilityOffIcon.d.ts +8 -0
  259. package/icons/VisibilityOffIcon.d.ts.map +1 -0
  260. package/icons/VisibilityOffIcon.js +2 -4
  261. package/icons/WarningIcon.d.ts +7 -0
  262. package/icons/WarningIcon.d.ts.map +1 -0
  263. package/icons/WarningIcon.js +1 -3
  264. package/package.json +5 -5
  265. package/tsconfig.build.json +16 -0
  266. package/tsconfig.json +3 -0
  267. package/ActionButton/style.js +0 -22
  268. package/AddToCartButton/style.js +0 -148
  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
@@ -1,97 +1,74 @@
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
- import classNames from 'classnames';
3
+ import { makeStyles } from '@shopgate/engage/styles';
6
4
  import Label from "./components/Label";
7
5
  import Underline from "./components/Underline";
8
6
  import ErrorText from "./components/ErrorText";
9
7
  import Placeholder from "./components/Placeholder";
10
- import style from "./style";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ const useStyles = makeStyles()(theme => ({
10
+ formElement: {
11
+ position: 'relative',
12
+ paddingBottom: theme.spacing(2),
13
+ width: '100%'
14
+ }
15
+ }));
11
16
 
12
17
  /**
13
18
  * A component that provides a styled form element in material design.
19
+ * @param {Object} props Props.
20
+ * @returns {JSX.Element}
14
21
  */
15
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
- let FormElement = /*#__PURE__*/function (_Component) {
17
- function FormElement() {
18
- return _Component.apply(this, arguments) || this;
19
- }
20
- _inheritsLoose(FormElement, _Component);
21
- var _proto = FormElement.prototype;
22
- /**
23
- * @return {JSX.Element}
24
- */
25
- _proto.render = function render() {
26
- const {
27
- isFocused,
28
- errorText,
29
- translateErrorText,
30
- placeholder,
31
- hasLeftElement,
32
- hasPlaceholder,
33
- htmlFor,
34
- label,
35
- className,
36
- disabled,
37
- labelStatic,
38
- showErrorText
39
- } = this.props;
40
- return /*#__PURE__*/_jsxs("div", {
41
- className: classNames(style.formElement, className, 'formElement', 'ui-shared__form-element', {
42
- disabled
43
- }),
44
- children: [hasPlaceholder && (placeholder || label) && /*#__PURE__*/_jsx(Placeholder, {
45
- visible: this.isPlaceholderVisible,
46
- placeholder: placeholder || label,
47
- hasLeftElement: hasLeftElement,
48
- "aria-hidden": true
49
- }), label && /*#__PURE__*/_jsx(Label, {
50
- htmlFor: htmlFor,
51
- label: label,
52
- labelStatic: labelStatic,
53
- isFocused: isFocused,
54
- isFloating: this.isLabelFloating,
55
- hasErrorMessage: this.hasErrorMessage
56
- }), this.props.children, this.props.hasUnderline && /*#__PURE__*/_jsx(Underline, {
57
- isFocused: isFocused,
58
- hasErrorMessage: this.hasErrorMessage
59
- }), errorText && showErrorText && /*#__PURE__*/_jsx(ErrorText, {
60
- errorText: errorText,
61
- translate: translateErrorText,
62
- elementName: htmlFor
63
- })]
64
- });
65
- };
66
- return _createClass(FormElement, [{
67
- key: "isLabelFloating",
68
- get:
69
- /**
70
- * @returns {boolean} Whether the label is currently floating.
71
- */
72
- function () {
73
- return !this.props.labelStatic && (this.props.isFocused || this.props.hasValue);
74
- }
75
-
76
- /**
77
- * @returns {boolean} Whether the hint text is currently visible.
78
- */
79
- }, {
80
- key: "isPlaceholderVisible",
81
- get: function () {
82
- return !this.props.isFocused && !this.props.hasValue;
83
- }
84
-
85
- /**
86
- * @returns {boolean} Whether the hint text is currently visible.
87
- */
88
- }, {
89
- key: "hasErrorMessage",
90
- get: function () {
91
- return !!this.props.errorText;
92
- }
93
- }]);
94
- }(Component);
22
+ const FormElement = ({
23
+ children,
24
+ className,
25
+ disabled,
26
+ errorText,
27
+ hasLeftElement,
28
+ hasPlaceholder,
29
+ hasUnderline,
30
+ hasValue,
31
+ htmlFor,
32
+ isFocused,
33
+ label,
34
+ labelStatic,
35
+ placeholder,
36
+ showErrorText,
37
+ translateErrorText
38
+ }) => {
39
+ const {
40
+ classes,
41
+ cx
42
+ } = useStyles();
43
+ const isLabelFloating = !labelStatic && (isFocused || hasValue);
44
+ const isPlaceholderVisible = !isFocused && !hasValue;
45
+ const hasErrorMessage = !!errorText;
46
+ return /*#__PURE__*/_jsxs("div", {
47
+ className: cx(classes.formElement, className, 'formElement', 'ui-shared__form-element', {
48
+ disabled
49
+ }),
50
+ children: [hasPlaceholder && (placeholder || label) && /*#__PURE__*/_jsx(Placeholder, {
51
+ visible: isPlaceholderVisible,
52
+ placeholder: placeholder || label,
53
+ hasLeftElement: hasLeftElement,
54
+ "aria-hidden": true
55
+ }), label && /*#__PURE__*/_jsx(Label, {
56
+ htmlFor: htmlFor,
57
+ label: label,
58
+ labelStatic: labelStatic,
59
+ isFocused: isFocused,
60
+ isFloating: isLabelFloating,
61
+ hasErrorMessage: hasErrorMessage
62
+ }), children, hasUnderline && /*#__PURE__*/_jsx(Underline, {
63
+ isFocused: isFocused,
64
+ hasErrorMessage: hasErrorMessage
65
+ }), errorText && showErrorText && /*#__PURE__*/_jsx(ErrorText, {
66
+ errorText: errorText,
67
+ translate: translateErrorText,
68
+ elementName: htmlFor
69
+ })]
70
+ });
71
+ };
95
72
  FormElement.defaultProps = {
96
73
  children: null,
97
74
  className: '',
package/Glow/index.js CHANGED
@@ -1,95 +1,85 @@
1
- import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
- import React, { Component } from 'react';
1
+ import React, { useState, useRef, useEffect, useCallback } from 'react';
3
2
  import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
3
  import { withForwardedRef } from '@shopgate/engage/core';
4
+ import { makeStyles } from '@shopgate/engage/styles';
6
5
  import { themeConfig } from '@shopgate/pwa-common/helpers/config';
7
- import styles from "./style";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ const useStyles = makeStyles()({
8
+ container: {
9
+ position: 'relative'
10
+ },
11
+ glow: {
12
+ position: 'absolute',
13
+ left: 0,
14
+ top: 0,
15
+ width: '100%',
16
+ height: '100%',
17
+ background: 'transparent',
18
+ transition: 'background 100ms cubic-bezier(0.25, 0.1, 0.25, 1)',
19
+ zIndex: 0
20
+ }
21
+ });
8
22
 
9
23
  /**
10
24
  * Renders a glowing component that is visible when the user interacts with the element.
25
+ * @param {Object} props Props.
26
+ * @returns {JSX.Element}
11
27
  */
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- let Glow = /*#__PURE__*/function (_Component) {
14
- /**
15
- * The component constructor.
16
- * @param {Object} props The component props.
17
- */
18
- function Glow(props) {
19
- var _this;
20
- _this = _Component.call(this, props) || this;
21
- _this.handleTouchTap = () => {
22
- if (_this.props.disabled) {
23
- return;
24
- }
25
- _this.setState({
26
- hover: true
27
- });
28
- _this.timeout = setTimeout(() => {
29
- _this.setState({
30
- hover: false
31
- });
32
- }, 250);
33
- };
34
- _this.timeout = null;
35
- _this.state = {
36
- hover: false
37
- };
38
- return _this;
39
- }
40
-
41
- /**
42
- * Clears any previously set timeout.
43
- */
44
- _inheritsLoose(Glow, _Component);
45
- var _proto = Glow.prototype;
46
- _proto.componentWillUnmount = function componentWillUnmount() {
47
- clearTimeout(this.timeout);
48
- };
49
- /**
50
- * Renders the component.
51
- * @returns {JSX.Element}
52
- */
53
- _proto.render = function render() {
54
- const {
55
- children,
56
- styles: propStyles,
57
- forwardedRef,
58
- className,
59
- color,
60
- ...rest
61
- } = this.props;
62
- let innerInlineStyles;
63
- if (this.state.hover) {
64
- innerInlineStyles = {
65
- ...propStyles.glow,
66
- ...propStyles.hover,
67
- background: color
68
- };
69
- } else {
70
- innerInlineStyles = {
71
- ...propStyles.glow
72
- };
28
+ const Glow = ({
29
+ children,
30
+ className,
31
+ color,
32
+ disabled,
33
+ forwardedRef,
34
+ styles: propStyles = {
35
+ container: null,
36
+ glow: null,
37
+ hover: null
38
+ },
39
+ ...rest
40
+ }) => {
41
+ const {
42
+ classes,
43
+ cx
44
+ } = useStyles();
45
+ const [hover, setHover] = useState(false);
46
+ const timeoutRef = useRef(null);
47
+ useEffect(() => () => {
48
+ if (timeoutRef.current) {
49
+ clearTimeout(timeoutRef.current);
73
50
  }
74
-
75
- /* eslint-disable jsx-a11y/no-static-element-interactions,
76
- jsx-a11y/click-events-have-key-events */
77
- return /*#__PURE__*/_jsxs("div", {
78
- ...rest,
79
- className: classNames(styles.container, className, 'ui-shared__glow'),
80
- onClick: this.handleTouchTap,
81
- style: propStyles.container,
82
- ref: forwardedRef,
83
- children: [/*#__PURE__*/_jsx("div", {
84
- className: styles.glow,
85
- style: innerInlineStyles
86
- }), children]
87
- });
88
- /* eslint-enable jsx-a11y/no-static-element-interactions,
89
- jsx-a11y/click-events-have-key-events */
51
+ }, []);
52
+ const handleTouchTap = useCallback(() => {
53
+ if (disabled) {
54
+ return;
55
+ }
56
+ setHover(true);
57
+ timeoutRef.current = setTimeout(() => setHover(false), 250);
58
+ }, [disabled]);
59
+ const innerInlineStyles = hover ? {
60
+ ...propStyles.glow,
61
+ ...propStyles.hover,
62
+ background: color
63
+ } : {
64
+ ...propStyles.glow
90
65
  };
91
- return Glow;
92
- }(Component);
66
+
67
+ /* eslint-disable jsx-a11y/no-static-element-interactions,
68
+ jsx-a11y/click-events-have-key-events */
69
+ return /*#__PURE__*/_jsxs("div", {
70
+ ...rest,
71
+ className: cx(classes.container, className, 'ui-shared__glow'),
72
+ onClick: handleTouchTap,
73
+ style: propStyles.container,
74
+ ref: forwardedRef,
75
+ children: [/*#__PURE__*/_jsx("div", {
76
+ className: classes.glow,
77
+ style: innerInlineStyles
78
+ }), children]
79
+ });
80
+ /* eslint-enable jsx-a11y/no-static-element-interactions,
81
+ jsx-a11y/click-events-have-key-events */
82
+ };
93
83
  Glow.defaultProps = {
94
84
  color: themeConfig.colors.shade8,
95
85
  className: null,
@@ -1,7 +1,54 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { themeConfig } from '@shopgate/pwa-common/helpers/config';
4
- import styles from "./style";
4
+ import { makeStyles, keyframes } from '@shopgate/engage/styles';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const rotate = keyframes({
7
+ '100%': {
8
+ transform: 'rotate(360deg)'
9
+ }
10
+ });
11
+ const dash = keyframes({
12
+ '0%': {
13
+ strokeDasharray: '1, 200',
14
+ strokeDashoffset: '0'
15
+ },
16
+ '50%': {
17
+ strokeDasharray: '89, 200',
18
+ strokeDashoffset: '-35px'
19
+ },
20
+ '100%': {
21
+ strokeDasharray: '89, 200',
22
+ strokeDashoffset: '-124px'
23
+ }
24
+ });
25
+ const useStyles = makeStyles()((_theme, {
26
+ paused,
27
+ color,
28
+ strokeWidth
29
+ }) => ({
30
+ spinner: {
31
+ margin: 'auto',
32
+ transformOrigin: 'center center',
33
+ maxWidth: '100%',
34
+ maxHeight: '100%',
35
+ ...(!paused ? {
36
+ animation: `${rotate} 1.6s linear infinite`
37
+ } : {})
38
+ },
39
+ circle: {
40
+ fill: 'none',
41
+ stroke: color,
42
+ strokeDasharray: '1, 200',
43
+ strokeDashoffset: 0,
44
+ strokeLinecap: 'round',
45
+ strokeMiterlimit: 10,
46
+ strokeWidth,
47
+ ...(!paused ? {
48
+ animation: `${dash} 1.2s ease-in-out infinite`
49
+ } : {})
50
+ }
51
+ }));
5
52
 
6
53
  /**
7
54
  * The circle indicator component.
@@ -12,28 +59,37 @@ import styles from "./style";
12
59
  * @param {boolean} props.paused Animation should be paused.
13
60
  * @returns {JSX}
14
61
  */
15
- import { jsx as _jsx } from "react/jsx-runtime";
16
62
  const IndicatorCircle = ({
17
63
  size,
18
64
  color,
19
65
  strokeWidth,
20
66
  paused
21
- }) => /*#__PURE__*/_jsx("svg", {
22
- className: `${styles.spinner(paused)} ui-shared__indicator-circle`,
23
- viewBox: "25 25 50 50",
24
- width: size,
25
- height: size,
26
- xmlns: "http://www.w3.org/2000/svg",
27
- "data-test-id": "loadingIndicator",
28
- children: /*#__PURE__*/_jsx("circle", {
29
- className: styles.circle(color, strokeWidth, paused),
30
- cx: "50",
31
- cy: "50",
32
- r: "20"
33
- })
34
- });
67
+ }) => {
68
+ const {
69
+ classes,
70
+ cx
71
+ } = useStyles({
72
+ paused,
73
+ color,
74
+ strokeWidth
75
+ });
76
+ return /*#__PURE__*/_jsx("svg", {
77
+ className: cx(classes.spinner, 'ui-shared__indicator-circle'),
78
+ viewBox: "25 25 50 50",
79
+ width: size,
80
+ height: size,
81
+ xmlns: "http://www.w3.org/2000/svg",
82
+ "data-test-id": "loadingIndicator",
83
+ children: /*#__PURE__*/_jsx("circle", {
84
+ className: classes.circle,
85
+ cx: "50",
86
+ cy: "50",
87
+ r: "20"
88
+ })
89
+ });
90
+ };
35
91
  IndicatorCircle.defaultProps = {
36
- color: `var(--color-secondary, ${themeConfig.colors.accent})`,
92
+ color: 'var(--color-secondary)',
37
93
  paused: false,
38
94
  size: themeConfig.variables.loadingIndicator.size,
39
95
  strokeWidth: themeConfig.variables.loadingIndicator.strokeWidth
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { shallow, mount } from 'enzyme';
3
3
  import IndicatorCircle from "./index";
4
- import styles from "./style";
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  describe('<IndicatorCircle />', () => {
7
6
  it('should apply the given size', () => {
@@ -20,10 +19,8 @@ describe('<IndicatorCircle />', () => {
20
19
  strokeWidth: 4
21
20
  }));
22
21
  expect(wrapper).toMatchSnapshot();
23
- const correctCssClass = styles.circle('#fff', 4, false);
24
- const wrongCssClass = styles.circle('#000', 0);
25
22
  const circleHtml = wrapper.find('circle');
26
- expect(circleHtml.html().indexOf(correctCssClass)).toBeGreaterThanOrEqual(0);
27
- expect(circleHtml.html().indexOf(wrongCssClass)).toBe(-1);
23
+ expect(circleHtml.html()).toMatch(/class="[^"]*"/);
24
+ expect(circleHtml.html()).not.toEqual('');
28
25
  });
29
26
  });
@@ -1,15 +1,31 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
3
  import { themeConfig } from '@shopgate/engage';
4
+ import { makeStyles } from '@shopgate/engage/styles';
5
5
  import IndicatorCircle from "../IndicatorCircle";
6
- import { container, imgContainer } from "./style";
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
8
7
  const {
9
8
  loadingIndicator: {
10
9
  imgSrc: loadingImageSrc
11
10
  } = {}
12
11
  } = themeConfig.variables;
12
+ const useStyles = makeStyles()(() => ({
13
+ container: {
14
+ display: 'block',
15
+ padding: '1em',
16
+ textAlign: 'center',
17
+ fontSize: '1.5em',
18
+ color: 'var(--color-secondary)'
19
+ },
20
+ imgContainer: {
21
+ display: 'flex',
22
+ justifyContent: 'center',
23
+ '& img': {
24
+ maxWidth: '50vw',
25
+ maxHeight: '50vh'
26
+ }
27
+ }
28
+ }));
13
29
 
14
30
  /**
15
31
  * Renders a loading indicator.
@@ -17,16 +33,22 @@ const {
17
33
  */
18
34
  const LoadingIndicator = ({
19
35
  className
20
- }) => /*#__PURE__*/_jsx("div", {
21
- className: classNames(className, {
22
- [container]: !loadingImageSrc,
23
- [imgContainer]: !!loadingImageSrc
24
- }, 'loading-indicator', 'ui-shared__loading-indicator'),
25
- children: loadingImageSrc ? /*#__PURE__*/_jsx("img", {
26
- src: loadingImageSrc,
27
- alt: ""
28
- }) : /*#__PURE__*/_jsx(IndicatorCircle, {})
29
- });
36
+ }) => {
37
+ const {
38
+ classes,
39
+ cx
40
+ } = useStyles();
41
+ return /*#__PURE__*/_jsx("div", {
42
+ className: cx(className, {
43
+ [classes.container]: !loadingImageSrc,
44
+ [classes.imgContainer]: !!loadingImageSrc
45
+ }, 'loading-indicator', 'ui-shared__loading-indicator'),
46
+ children: loadingImageSrc ? /*#__PURE__*/_jsx("img", {
47
+ src: loadingImageSrc,
48
+ alt: ""
49
+ }) : /*#__PURE__*/_jsx(IndicatorCircle, {})
50
+ });
51
+ };
30
52
  LoadingIndicator.defaultProps = {
31
53
  className: null
32
54
  };
@@ -1,6 +1,12 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styles from "./style";
3
+ import { makeStyles } from '@shopgate/engage/styles';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const useStyles = makeStyles()(() => ({
6
+ root: {
7
+ color: 'var(--color-primary)'
8
+ }
9
+ }));
4
10
 
5
11
  /**
6
12
  * The manufacturer component.
@@ -9,18 +15,23 @@ import styles from "./style";
9
15
  * @param {string} [props.className] CSS classes.
10
16
  * @return {JSX}
11
17
  */
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
18
  const Manufacturer = ({
14
19
  className,
15
20
  text
16
- }) => /*#__PURE__*/_jsx("div", {
17
- className: `${styles} ${className} ui-shared__manufacturer`,
18
- children: /*#__PURE__*/_jsx("span", {
19
- dangerouslySetInnerHTML: {
20
- __html: text
21
- }
22
- })
23
- });
21
+ }) => {
22
+ const {
23
+ classes,
24
+ cx
25
+ } = useStyles();
26
+ return /*#__PURE__*/_jsx("div", {
27
+ className: cx(classes.root, className, 'ui-shared__manufacturer'),
28
+ children: /*#__PURE__*/_jsx("span", {
29
+ dangerouslySetInnerHTML: {
30
+ __html: text
31
+ }
32
+ })
33
+ });
34
+ };
24
35
  Manufacturer.defaultProps = {
25
36
  className: ''
26
37
  };
@@ -1,45 +1,19 @@
1
- import React, { memo } from 'react';
2
- import classnames from 'classnames';
3
- import PropTypes from 'prop-types';
4
- import { i18n } from '@shopgate/engage/core';
5
- import styles from "./style";
1
+ import React, { useEffect } from 'react';
2
+ import { logger } from '@shopgate/engage/core/helpers';
3
+ import { MessageBar } from '@shopgate/engage/components';
6
4
 
7
5
  /**
8
- * The MessageBar component.
6
+ * @deprecated Use `import { MessageBar } from '@shopgate/engage/components'` instead.
9
7
  * @param {Object} props The component props.
10
- * @param {Array} props.messages The message content.
11
- * @param {Object} props.classNames Styling.
12
8
  * @returns {JSX}
13
- * @deprecated Please import from `@shopgate/engage/components` instead.
14
9
  */
15
10
  import { jsx as _jsx } from "react/jsx-runtime";
16
- const MessageBar = /*#__PURE__*/memo(({
17
- messages,
18
- classNames
19
- }) => /*#__PURE__*/_jsx("div", {
20
- className: classnames(styles.container, classNames.container, 'ui-shared__message-bar'),
21
- role: messages.length > 0 ? 'alert' : null,
22
- children: messages.map(item => {
23
- const {
24
- type = 'info',
25
- message,
26
- messageParams = null,
27
- translated
28
- } = item;
29
- const messageOutput = !translated ? i18n.text(message, messageParams) : message;
30
- return /*#__PURE__*/_jsx("div", {
31
- className: classnames(classNames.message, styles[type]),
32
- children: /*#__PURE__*/_jsx("span", {
33
- "aria-hidden": true,
34
- children: messageOutput
35
- })
36
- }, `${type}-${message}`);
37
- })
38
- }));
39
- MessageBar.defaultProps = {
40
- classNames: {
41
- container: null,
42
- message: null
43
- }
11
+ const DeprecatedMessageBar = props => {
12
+ useEffect(() => {
13
+ logger.warn('===== MessageBar deprecated =====\n' + 'The MessageBar component ' + '(@shopgate/pwa-ui-shared/MessageBar) is deprecated.\n' + 'Please use: import { MessageBar } from \'@shopgate/engage/components\'.\n' + '===================================');
14
+ }, []);
15
+ return /*#__PURE__*/_jsx(MessageBar, {
16
+ ...props
17
+ });
44
18
  };
45
- export default MessageBar;
19
+ export default DeprecatedMessageBar;