@adobe-commerce/elsie 1.0.0-alpha4 → 1.0.0-beta1

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 (226) hide show
  1. package/.elsie.js +9 -0
  2. package/.eslintrc.js +9 -0
  3. package/__mocks__/svg.js +9 -0
  4. package/bin/lib/validate-typeof.js +9 -0
  5. package/bin/lib/write-file.js +9 -0
  6. package/bin/lib/write-parent-index.js +9 -0
  7. package/config/eslint.js +9 -0
  8. package/config/jest.js +9 -0
  9. package/config/prettier.js +9 -0
  10. package/config/setEnvVars.js +9 -0
  11. package/config/storybook/addon.js +9 -0
  12. package/config/storybook/components/FileTree/FileTree.jsx +9 -0
  13. package/config/storybook/components/FileTree/index.js +9 -0
  14. package/config/storybook/components/Flex/Flex.jsx +9 -0
  15. package/config/storybook/components/Flex/Flex.module.css +9 -0
  16. package/config/storybook/components/Flex/index.js +9 -0
  17. package/config/storybook/components/OptionsTable/OptionsTable.jsx +9 -0
  18. package/config/storybook/components/OptionsTable/OptionsTable.module.css +9 -0
  19. package/config/storybook/components/OptionsTable/index.js +9 -0
  20. package/config/storybook/components/Panel/Panel.module.css +9 -0
  21. package/config/storybook/components/Panel/Panel.tsx +9 -0
  22. package/config/storybook/components/Panel/index.ts +9 -0
  23. package/config/storybook/components/Screenshot/Screenshot.jsx +9 -0
  24. package/config/storybook/components/Screenshot/Screenshot.module.css +9 -0
  25. package/config/storybook/components/Screenshot/index.js +9 -0
  26. package/config/storybook/components/Steps/Steps.jsx +9 -0
  27. package/config/storybook/components/Steps/Steps.module.css +9 -0
  28. package/config/storybook/components/Steps/index.js +9 -0
  29. package/config/storybook/components/StoryWrapper/StoryWrapper.jsx +9 -0
  30. package/config/storybook/components/StoryWrapper/StoryWrapper.module.css +9 -0
  31. package/config/storybook/components/StoryWrapper/index.js +9 -0
  32. package/config/storybook/components/Summary/Summary.jsx +9 -0
  33. package/config/storybook/components/Summary/Summary.module.css +9 -0
  34. package/config/storybook/components/Summary/index.js +9 -0
  35. package/config/storybook/components/Variants/Variants.js +9 -0
  36. package/config/storybook/components/Variants/docs.css +9 -0
  37. package/config/storybook/components/Variants/index.js +9 -0
  38. package/config/storybook/components/video/index.jsx +9 -0
  39. package/config/storybook/manager.js +9 -0
  40. package/config/storybook/preview.jsx +9 -0
  41. package/config/storybook/theming/fonts.css +9 -0
  42. package/config/storybook/theming/manager.css +9 -0
  43. package/config/storybook/theming/preview.css +9 -0
  44. package/config/storybook/theming/theme.js +9 -0
  45. package/config/vite.mjs +9 -0
  46. package/package.json +1 -1
  47. package/post-release.sh +5 -0
  48. package/src/components/Accordion/Accordion.css +10 -1
  49. package/src/components/Accordion/Accordion.stories.tsx +9 -0
  50. package/src/components/Accordion/Accordion.tsx +9 -0
  51. package/src/components/Accordion/index.ts +9 -0
  52. package/src/components/ActionButton/ActionButton.css +9 -0
  53. package/src/components/ActionButton/ActionButton.stories.tsx +9 -0
  54. package/src/components/ActionButton/ActionButton.tsx +9 -0
  55. package/src/components/ActionButton/index.ts +9 -0
  56. package/src/components/ActionButtonGroup/ActionButtonGroup.css +9 -0
  57. package/src/components/ActionButtonGroup/ActionButtonGroup.stories.tsx +9 -0
  58. package/src/components/ActionButtonGroup/ActionButtonGroup.tsx +9 -0
  59. package/src/components/ActionButtonGroup/index.ts +9 -0
  60. package/src/components/AlertBanner/AlertBanner.css +9 -0
  61. package/src/components/AlertBanner/AlertBanner.stories.tsx +9 -0
  62. package/src/components/AlertBanner/AlertBanner.tsx +9 -0
  63. package/src/components/AlertBanner/index.ts +9 -0
  64. package/src/components/Breadcrumbs/Breadcrumbs.css +9 -0
  65. package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +9 -0
  66. package/src/components/Breadcrumbs/Breadcrumbs.tsx +9 -0
  67. package/src/components/Breadcrumbs/index.ts +9 -0
  68. package/src/components/Button/Button.css +9 -0
  69. package/src/components/Button/Button.stories.tsx +9 -0
  70. package/src/components/Button/Button.tsx +9 -0
  71. package/src/components/Button/index.ts +9 -0
  72. package/src/components/Card/Card.css +9 -0
  73. package/src/components/Card/Card.stories.tsx +9 -0
  74. package/src/components/Card/Card.tsx +9 -0
  75. package/src/components/Card/index.ts +9 -0
  76. package/src/components/CartItem/CartItem.css +40 -5
  77. package/src/components/CartItem/CartItem.stories.tsx +84 -44
  78. package/src/components/CartItem/CartItem.tsx +343 -320
  79. package/src/components/CartItem/CartItemSkeleton.tsx +9 -0
  80. package/src/components/CartItem/index.ts +9 -0
  81. package/src/components/CartList/CartList.css +9 -0
  82. package/src/components/CartList/CartList.stories.tsx +9 -0
  83. package/src/components/CartList/CartList.tsx +9 -0
  84. package/src/components/CartList/index.ts +9 -0
  85. package/src/components/Checkbox/Checkbox.css +9 -0
  86. package/src/components/Checkbox/Checkbox.stories.tsx +9 -0
  87. package/src/components/Checkbox/Checkbox.tsx +9 -0
  88. package/src/components/Checkbox/index.ts +9 -0
  89. package/src/components/ColorSwatch/ColorSwatch.css +9 -0
  90. package/src/components/ColorSwatch/ColorSwatch.stories.tsx +9 -0
  91. package/src/components/ColorSwatch/ColorSwatch.tsx +9 -0
  92. package/src/components/ColorSwatch/index.ts +9 -0
  93. package/src/components/ContentGrid/ContentGrid.css +3 -11
  94. package/src/components/ContentGrid/ContentGrid.stories.tsx +3 -11
  95. package/src/components/ContentGrid/ContentGrid.tsx +3 -11
  96. package/src/components/ContentGrid/index.ts +3 -11
  97. package/src/components/Divider/Divider.css +9 -0
  98. package/src/components/Divider/Divider.stories.tsx +9 -0
  99. package/src/components/Divider/Divider.tsx +9 -0
  100. package/src/components/Divider/index.ts +9 -0
  101. package/src/components/Field/Field.css +9 -0
  102. package/src/components/Field/Field.stories.tsx +9 -0
  103. package/src/components/Field/Field.tsx +9 -0
  104. package/src/components/Field/index.ts +9 -0
  105. package/src/components/Header/Header.css +9 -0
  106. package/src/components/Header/Header.stories.tsx +52 -0
  107. package/src/components/Header/Header.tsx +31 -3
  108. package/src/components/Header/index.ts +9 -0
  109. package/src/components/Icon/Icon.css +9 -0
  110. package/src/components/Icon/Icon.stories.helpers.jsx +9 -0
  111. package/src/components/Icon/Icon.stories.tsx +9 -0
  112. package/src/components/Icon/Icon.tsx +9 -0
  113. package/src/components/Icon/index.ts +9 -0
  114. package/src/components/IllustratedMessage/IllustratedMessage.css +9 -0
  115. package/src/components/IllustratedMessage/IllustratedMessage.stories.tsx +9 -0
  116. package/src/components/IllustratedMessage/IllustratedMessage.tsx +9 -0
  117. package/src/components/IllustratedMessage/index.ts +9 -0
  118. package/src/components/Image/Image.css +9 -0
  119. package/src/components/Image/Image.stories.tsx +9 -0
  120. package/src/components/Image/Image.tsx +9 -0
  121. package/src/components/Image/index.ts +9 -0
  122. package/src/components/ImageSwatch/ImageSwatch.css +9 -0
  123. package/src/components/ImageSwatch/ImageSwatch.stories.tsx +58 -0
  124. package/src/components/ImageSwatch/ImageSwatch.tsx +22 -10
  125. package/src/components/ImageSwatch/index.ts +9 -0
  126. package/src/components/InLineAlert/InLineAlert.css +9 -0
  127. package/src/components/InLineAlert/InLineAlert.stories.tsx +9 -0
  128. package/src/components/InLineAlert/InLineAlert.tsx +9 -0
  129. package/src/components/InLineAlert/index.ts +9 -0
  130. package/src/components/Incrementer/Incrementer.css +9 -0
  131. package/src/components/Incrementer/Incrementer.stories.tsx +9 -0
  132. package/src/components/Incrementer/Incrementer.tsx +9 -0
  133. package/src/components/Incrementer/index.ts +9 -0
  134. package/src/components/Input/Input.css +9 -0
  135. package/src/components/Input/Input.stories.tsx +9 -0
  136. package/src/components/Input/Input.tsx +9 -0
  137. package/src/components/Input/index.ts +9 -0
  138. package/src/components/InputDate/InputDate.css +9 -0
  139. package/src/components/InputDate/InputDate.stories.tsx +9 -0
  140. package/src/components/InputDate/InputDate.tsx +9 -0
  141. package/src/components/InputDate/index.ts +9 -0
  142. package/src/components/InputPassword/InputPassword.css +9 -0
  143. package/src/components/InputPassword/InputPassword.stories.tsx +9 -0
  144. package/src/components/InputPassword/InputPassword.tsx +9 -0
  145. package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.css +9 -0
  146. package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.tsx +9 -0
  147. package/src/components/InputPassword/PasswordStatusIndicator/index.ts +9 -0
  148. package/src/components/InputPassword/index.ts +9 -0
  149. package/src/components/Modal/Modal.css +8 -13
  150. package/src/components/Modal/Modal.stories.tsx +8 -13
  151. package/src/components/Modal/Modal.tsx +8 -13
  152. package/src/components/Modal/index.ts +8 -13
  153. package/src/components/Pagination/Pagination.css +9 -0
  154. package/src/components/Pagination/Pagination.stories.tsx +9 -0
  155. package/src/components/Pagination/Pagination.tsx +9 -0
  156. package/src/components/Pagination/index.ts +9 -0
  157. package/src/components/Picker/Picker.css +9 -0
  158. package/src/components/Picker/Picker.stories.tsx +9 -0
  159. package/src/components/Picker/Picker.tsx +9 -0
  160. package/src/components/Picker/index.ts +9 -0
  161. package/src/components/Price/Price.css +9 -0
  162. package/src/components/Price/Price.stories.tsx +9 -0
  163. package/src/components/Price/Price.tsx +9 -0
  164. package/src/components/Price/index.ts +9 -0
  165. package/src/components/PriceRange/PriceRange.css +9 -0
  166. package/src/components/PriceRange/PriceRange.stories.tsx +9 -0
  167. package/src/components/PriceRange/PriceRange.tsx +9 -0
  168. package/src/components/PriceRange/index.ts +9 -0
  169. package/src/components/ProgressSpinner/ProgressSpinner.css +9 -0
  170. package/src/components/ProgressSpinner/ProgressSpinner.stories.tsx +9 -0
  171. package/src/components/ProgressSpinner/ProgressSpinner.tsx +9 -0
  172. package/src/components/ProgressSpinner/index.ts +9 -0
  173. package/src/components/RadioButton/RadioButton.css +9 -0
  174. package/src/components/RadioButton/RadioButton.stories.tsx +9 -0
  175. package/src/components/RadioButton/RadioButton.tsx +9 -0
  176. package/src/components/RadioButton/index.ts +9 -0
  177. package/src/components/Skeleton/Skeleton.css +9 -0
  178. package/src/components/Skeleton/Skeleton.stories.tsx +9 -0
  179. package/src/components/Skeleton/Skeleton.tsx +9 -0
  180. package/src/components/Skeleton/index.ts +9 -0
  181. package/src/components/Tag/Tag.css +9 -0
  182. package/src/components/Tag/Tag.stories.tsx +9 -0
  183. package/src/components/Tag/Tag.tsx +9 -0
  184. package/src/components/Tag/index.ts +9 -0
  185. package/src/components/TextArea/TextArea.css +9 -0
  186. package/src/components/TextArea/TextArea.stories.tsx +9 -0
  187. package/src/components/TextArea/TextArea.tsx +9 -0
  188. package/src/components/TextArea/index.ts +9 -0
  189. package/src/components/TextSwatch/TextSwatch.css +9 -0
  190. package/src/components/TextSwatch/TextSwatch.stories.tsx +9 -0
  191. package/src/components/TextSwatch/TextSwatch.tsx +9 -0
  192. package/src/components/TextSwatch/index.ts +9 -0
  193. package/src/components/ToggleButton/ToggleButton.css +18 -0
  194. package/src/components/ToggleButton/ToggleButton.stories.tsx +47 -3
  195. package/src/components/ToggleButton/ToggleButton.tsx +19 -11
  196. package/src/components/ToggleButton/index.ts +9 -0
  197. package/src/components/UIProvider/UIProvider.css +9 -0
  198. package/src/components/UIProvider/UIProvider.tsx +9 -0
  199. package/src/components/UIProvider/debugger.css +9 -0
  200. package/src/components/UIProvider/index.ts +9 -0
  201. package/src/components/UIProvider/normalize.css +9 -0
  202. package/src/components/index.ts +9 -0
  203. package/src/i18n/index.ts +9 -0
  204. package/src/lib/classes.ts +9 -0
  205. package/src/lib/config.ts +9 -0
  206. package/src/lib/debounce.ts +9 -0
  207. package/src/lib/deepmerge.ts +9 -0
  208. package/src/lib/deviceUtils.ts +9 -0
  209. package/src/lib/form-values.ts +9 -0
  210. package/src/lib/i18n.ts +9 -0
  211. package/src/lib/image-params-keymap.ts +9 -0
  212. package/src/lib/index.ts +9 -0
  213. package/src/lib/initializer.ts +9 -0
  214. package/src/lib/is-number.ts +9 -0
  215. package/src/lib/render.tsx +9 -0
  216. package/src/lib/resolve-image.ts +9 -0
  217. package/src/lib/signals.ts +9 -0
  218. package/src/lib/slot.tsx +9 -0
  219. package/src/lib/tests.tsx +9 -0
  220. package/src/lib/types.ts +9 -0
  221. package/src/lib/vcomponent.tsx +8 -13
  222. package/static/assets/images/index.ts +9 -0
  223. package/storybook-stories.js +9 -0
  224. package/tests/__mocks__/browserMocks.ts +9 -0
  225. package/tests/__mocks__/fileMocks.ts +9 -0
  226. package/types/icons.d.ts +9 -0
@@ -1,6 +1,15 @@
1
+ /********************************************************************
2
+ * Copyright 2024 Adobe
3
+ * All Rights Reserved.
4
+ *
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
+ *******************************************************************/
9
+
1
10
  import { FunctionComponent, VNode } from 'preact';
2
11
  import { HTMLAttributes, useContext } from 'preact/compat';
3
- import { classes, VComponent } from '@adobe-commerce/elsie/lib';
12
+ import {classes, VComponent} from '@adobe-commerce/elsie/lib';
4
13
  import {
5
14
  Button,
6
15
  CartItemSkeleton,
@@ -16,7 +25,7 @@ import { Trash } from '@adobe-commerce/elsie/icons';
16
25
  import '@adobe-commerce/elsie/components/CartItem/CartItem.css';
17
26
 
18
27
  export interface CartItemProps
19
- extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'loading'> {
28
+ extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'loading'> {
20
29
  ariaLabel?: string;
21
30
  image?: VNode;
22
31
  title?: VNode;
@@ -35,6 +44,7 @@ export interface CartItemProps
35
44
  alert?: VNode;
36
45
  discount?: VNode;
37
46
  savings?: VNode;
47
+ actions?: VNode;
38
48
  loading?: boolean;
39
49
  updating?: boolean;
40
50
  onRemove?: () => void;
@@ -44,34 +54,35 @@ export interface CartItemProps
44
54
  }
45
55
 
46
56
  export const CartItem: FunctionComponent<CartItemProps> = ({
47
- className,
48
- children,
49
- ariaLabel,
50
- image,
51
- title,
52
- price,
53
- taxIncluded = false,
54
- taxExcluded = false,
55
- total,
56
- totalExcludingTax,
57
- sku,
58
- configurations,
59
- warning,
60
- alert,
61
- discount,
62
- savings,
63
- quantity,
64
- description,
65
- attributes,
66
- footer,
67
- loading = false,
68
- updating = false,
69
- quantityType,
70
- dropdownOptions,
71
- onQuantity,
72
- onRemove,
73
- ...props
74
- }) => {
57
+ className,
58
+ children,
59
+ ariaLabel,
60
+ image,
61
+ title,
62
+ price,
63
+ taxIncluded = false,
64
+ taxExcluded = false,
65
+ total,
66
+ totalExcludingTax,
67
+ sku,
68
+ configurations,
69
+ warning,
70
+ alert,
71
+ discount,
72
+ savings,
73
+ actions,
74
+ quantity,
75
+ description,
76
+ attributes,
77
+ footer,
78
+ loading = false,
79
+ updating = false,
80
+ quantityType,
81
+ dropdownOptions,
82
+ onQuantity,
83
+ onRemove,
84
+ ...props
85
+ }) => {
75
86
  const { locale } = useContext(UIContext);
76
87
 
77
88
  const labels = useText({
@@ -89,356 +100,368 @@ export const CartItem: FunctionComponent<CartItemProps> = ({
89
100
  if (loading) return <CartItemSkeleton />;
90
101
 
91
102
  const quantityComponent =
92
- quantityType === 'dropdown' ? (
93
- <Picker
94
- className={classes(['dropin-cart-item__quantity__picker'])}
95
- value={String(quantity)}
96
- name="quantity"
97
- aria-label={labels.quantity}
98
- disabled={updating}
99
- variant={'primary'}
100
- options={dropdownOptions}
101
- handleSelect={(event) =>
102
- onQuantity?.(Number((event.target as HTMLSelectElement).value))
103
- }
104
- />
105
- ) : (
106
- <Incrementer
107
- className={classes(['dropin-cart-item__quantity__incrementer'])}
108
- value={quantity}
109
- min={1}
110
- onValue={(value) => onQuantity?.(Number(value))}
111
- name="quantity"
112
- aria-label={labels.quantity}
113
- disabled={updating}
114
- />
115
- );
103
+ quantityType === 'dropdown' ? (
104
+ <Picker
105
+ className={classes(['dropin-cart-item__quantity__picker'])}
106
+ value={String(quantity)}
107
+ name="quantity"
108
+ aria-label={labels.quantity}
109
+ disabled={updating}
110
+ variant={'primary'}
111
+ options={dropdownOptions}
112
+ handleSelect={(event) =>
113
+ onQuantity?.(Number((event.target as HTMLSelectElement).value))
114
+ }
115
+ />
116
+ ) : (
117
+ <Incrementer
118
+ className={classes(['dropin-cart-item__quantity__incrementer'])}
119
+ value={quantity}
120
+ min={1}
121
+ onValue={(value) => onQuantity?.(Number(value))}
122
+ name="quantity"
123
+ aria-label={labels.quantity}
124
+ disabled={updating}
125
+ />
126
+ );
116
127
 
117
128
  return (
118
- <div
119
- {...props}
120
- className={classes([
121
- 'dropin-cart-item',
122
- ['dropin-cart-item--updating', updating],
123
- className,
124
- ])}
125
- >
126
- {updating && (
127
- <ProgressSpinner
128
- className={classes(['dropin-cart-item__spinner'])}
129
- ariaLabel={
130
- ariaLabel
131
- ? labels.updating?.replace('{product}', ariaLabel)
132
- : labels.updatingDefault
133
- }
134
- />
135
- )}
136
- <div className="dropin-cart-item__wrapper">
137
- {
138
- /* Image */
139
- image && (
140
- <VComponent
141
- node={image}
142
- className={classes(['dropin-cart-item__image'])}
143
- />
144
- )
145
- }
146
-
147
- {
148
- /* Title */
149
- title && (
150
- <VComponent
151
- node={title}
152
- className={classes([
153
- 'dropin-cart-item__title',
154
- ['dropin-cart-item__title--edit', !!onQuantity || !!onRemove],
155
- ])}
156
- />
157
- )
158
- }
159
-
160
- {
161
- /* Description */
162
- description && (
163
- <VComponent
164
- node={description}
165
- className={classes(['dropin-cart-item__description'])}
166
- />
167
- )
168
- }
169
-
170
- {
171
- /* SKU */
172
- sku && (
173
- <VComponent
174
- node={sku}
175
- className={classes(['dropin-cart-item__sku'])}
176
- />
177
- )
178
- }
179
- <div className={classes(['dropin-cart-item__savings__wrapper'])}>
180
- {/* Discount amount */}
181
- {discount && (
182
- <VComponent
183
- node={discount}
184
- className={classes([
185
- 'dropin-cart-item__discount',
186
- 'dropin-cart-item__discount__large-screen',
187
- ])}
129
+ <div
130
+ {...props}
131
+ className={classes([
132
+ 'dropin-cart-item',
133
+ ['dropin-cart-item--updating', updating],
134
+ className,
135
+ ])}
136
+ >
137
+ {updating && (
138
+ <ProgressSpinner
139
+ className={classes(['dropin-cart-item__spinner'])}
140
+ ariaLabel={
141
+ ariaLabel
142
+ ? labels.updating?.replace('{product}', ariaLabel)
143
+ : labels.updatingDefault
144
+ }
188
145
  />
189
- )}
146
+ )}
147
+ <div className="dropin-cart-item__wrapper">
148
+ {
149
+ /* Image */
150
+ image && (
151
+ <VComponent
152
+ node={image}
153
+ className={classes(['dropin-cart-item__image'])}
154
+ />
155
+ )
156
+ }
190
157
 
191
- {/* Savings amount */}
192
- {savings && (
193
- <VComponent
194
- node={savings}
195
- className={classes([
196
- 'dropin-cart-item__savings',
197
- 'dropin-cart-item__savings__large-screen',
198
- ])}
199
- />
200
- )}
201
- </div>
158
+ {
159
+ /* Title */
160
+ title && (
161
+ <VComponent
162
+ node={title}
163
+ className={classes([
164
+ 'dropin-cart-item__title',
165
+ ['dropin-cart-item__title--edit', !!onQuantity || !!onRemove],
166
+ ])}
167
+ />
168
+ )
169
+ }
202
170
 
203
- {/* Product Attributes */}
204
- {attributes && (
205
- <div className={classes(['dropin-cart-item__attributes'])}>
206
- <VComponent node={attributes} />
207
- </div>
208
- )}
171
+ {
172
+ /* Description */
173
+ description && (
174
+ <VComponent
175
+ node={description}
176
+ className={classes(['dropin-cart-item__description'])}
177
+ />
178
+ )
179
+ }
209
180
 
210
- {
211
- /* Configurations */
212
- configurations && (
213
- <ul className={classes(['dropin-cart-item__configurations'])}>
214
- {Object.entries(configurations).map(([key, value]) => (
215
- <li
216
- key={key}
217
- className={classes([
218
- 'dropin-cart-item__configurations__item',
219
- ])}
220
- >
221
- {key}:{' '}
222
- <strong
181
+ {
182
+ /* SKU */
183
+ sku && (
184
+ <VComponent
185
+ node={sku}
186
+ className={classes(['dropin-cart-item__sku'])}
187
+ />
188
+ )
189
+ }
190
+ <div className={classes(['dropin-cart-item__savings__wrapper'])}>
191
+ {/* Discount amount */}
192
+ {discount && (
193
+ <VComponent
194
+ node={discount}
195
+ className={classes([
196
+ 'dropin-cart-item__discount',
197
+ 'dropin-cart-item__discount__large-screen',
198
+ ])}
199
+ />
200
+ )}
201
+
202
+ {/* Savings amount */}
203
+ {savings && (
204
+ <VComponent
205
+ node={savings}
223
206
  className={classes([
224
- 'dropin-cart-item__configurations__item__value',
207
+ 'dropin-cart-item__savings',
208
+ 'dropin-cart-item__savings__large-screen',
225
209
  ])}
210
+ />
211
+ )}
212
+ </div>
213
+
214
+ {/* Product Attributes */}
215
+ {attributes && (
216
+ <div className={classes(['dropin-cart-item__attributes'])}>
217
+ <VComponent node={attributes} />
218
+ </div>
219
+ )}
220
+
221
+ {
222
+ /* Configurations */
223
+ configurations && (
224
+ <ul className={classes(['dropin-cart-item__configurations'])}>
225
+ {Object.entries(configurations).map(([key, value]) => (
226
+ <li
227
+ key={key}
228
+ className={classes([
229
+ 'dropin-cart-item__configurations__item',
230
+ ])}
231
+ >
232
+ {key}:{' '}
233
+ <strong
234
+ className={classes([
235
+ 'dropin-cart-item__configurations__item__value',
236
+ ])}
237
+ >
238
+ {value}
239
+ </strong>
240
+ </li>
241
+ ))}
242
+ </ul>
243
+ )
244
+ }
245
+
246
+ {
247
+ /* Price */
248
+ price && (
249
+ <span
250
+ className={classes(['dropin-cart-item__price'])}
251
+ aria-label={labels.pricePerItem}
226
252
  >
227
- {value}
228
- </strong>
229
- </li>
230
- ))}
231
- </ul>
232
- )
233
- }
234
-
235
- {
236
- /* Price */
237
- price && (
238
- <span
239
- className={classes(['dropin-cart-item__price'])}
240
- aria-label={labels.pricePerItem}
241
- >
242
253
  {quantity && !onQuantity && (
243
- <>
254
+ <>
244
255
  <span
245
- className="dropin-cart-item__price__quantity"
246
- aria-hidden={true}
256
+ className="dropin-cart-item__price__quantity"
257
+ aria-hidden={true}
247
258
  >
248
259
  {quantity.toLocaleString(locale)} x{' '}
249
260
  </span>
250
261
 
251
- <div className="dropin-cart-item__sr-only">
252
- {labels.quantity}: {quantity?.toLocaleString(locale)};
253
- </div>
254
- </>
262
+ <div className="dropin-cart-item__sr-only">
263
+ {labels.quantity}: {quantity?.toLocaleString(locale)};
264
+ </div>
265
+ </>
255
266
  )}
256
267
 
257
- <VComponent node={price} role="text" />
268
+ <VComponent node={price} role="text" />
258
269
 
259
- {quantity && quantity > 1 && (
260
- <>
261
- &nbsp;
262
- {labels.each}
263
- </>
264
- )}
270
+ {quantity && quantity > 1 && (
271
+ <>
272
+ &nbsp;
273
+ {labels.each}
274
+ </>
275
+ )}
265
276
 
266
- {taxIncluded && (
267
- <span
268
- data-testid="tax-message"
269
- className="dropin-cart-item__price-tax-message"
270
- >
277
+ {taxIncluded && (
278
+ <span
279
+ data-testid="tax-message"
280
+ className="dropin-cart-item__price-tax-message"
281
+ >
271
282
  &nbsp;
272
- {labels.taxIncluded}
283
+ {labels.taxIncluded}
273
284
  </span>
274
- )}
285
+ )}
275
286
 
276
- {taxExcluded && (
277
- <span
278
- data-testid="tax-message"
279
- className="dropin-cart-item__price-tax-message"
280
- >
287
+ {taxExcluded && (
288
+ <span
289
+ data-testid="tax-message"
290
+ className="dropin-cart-item__price-tax-message"
291
+ >
281
292
  &nbsp;
282
- {labels.taxExcluded}
293
+ {labels.taxExcluded}
283
294
  </span>
284
- )}
295
+ )}
285
296
  </span>
286
- )
287
- }
297
+ )
298
+ }
288
299
 
289
- {/* Quantity */}
290
- <div
291
- className={classes([
292
- 'dropin-cart-item__quantity',
293
- ['dropin-cart-item__quantity--edit', !!onQuantity],
294
- ])}
295
- >
296
- {onQuantity
297
- ? quantityComponent
298
- : quantity && (
300
+ {/* Quantity */}
301
+ <div
302
+ className={classes([
303
+ 'dropin-cart-item__quantity',
304
+ ['dropin-cart-item__quantity--edit', !!onQuantity],
305
+ ])}
306
+ >
307
+ {onQuantity
308
+ ? quantityComponent
309
+ : quantity && (
299
310
  <span
300
- className={classes(['dropin-cart-item__quantity__value'])}
311
+ className={classes(['dropin-cart-item__quantity__value'])}
301
312
  >
302
313
  {labels.quantity}:{' '}
303
314
  <strong className="dropin-cart-item__quantity__number">
304
315
  {Number(quantity).toLocaleString(locale)}
305
316
  </strong>
306
317
  </span>
307
- )}
318
+ )}
319
+
320
+ {/* Warning */}
321
+ {warning && (
322
+ <VComponent
323
+ node={warning}
324
+ className={classes([
325
+ 'dropin-cart-item__warning',
326
+ 'dropin-cart-item__warning--quantity',
327
+ ])}
328
+ />
329
+ )}
330
+
331
+ {/* Alert */}
332
+ {alert && (
333
+ <VComponent
334
+ node={alert}
335
+ className={classes([
336
+ 'dropin-cart-item__alert',
337
+ 'dropin-cart-item__alert--quantity',
338
+ ])}
339
+ />
340
+ )}
341
+
342
+ </div>
343
+
344
+ <div className={classes(['dropin-cart-item__actions'])}>
345
+ {/* Actions */}
346
+ {actions && (
347
+ <VComponent
348
+ node={actions}
349
+ className={classes(['dropin-cart-item__buttons'])}
350
+ />
351
+ )}
352
+ </div>
308
353
 
309
354
  {/* Warning */}
310
355
  {warning && (
311
- <VComponent
312
- node={warning}
313
- className={classes([
314
- 'dropin-cart-item__warning',
315
- 'dropin-cart-item__warning--quantity',
316
- ])}
317
- />
356
+ <VComponent
357
+ node={warning}
358
+ className={classes(['dropin-cart-item__warning'])}
359
+ />
318
360
  )}
319
361
 
320
362
  {/* Alert */}
321
363
  {alert && (
322
- <VComponent
323
- node={alert}
324
- className={classes([
325
- 'dropin-cart-item__alert',
326
- 'dropin-cart-item__alert--quantity',
327
- ])}
328
- />
364
+ <VComponent
365
+ node={alert}
366
+ className={classes(['dropin-cart-item__alert'])}
367
+ />
329
368
  )}
330
- </div>
331
369
 
332
- {/* Warning */}
333
- {warning && (
334
- <VComponent
335
- node={warning}
336
- className={classes(['dropin-cart-item__warning'])}
337
- />
338
- )}
339
-
340
- {/* Alert */}
341
- {alert && (
342
- <VComponent
343
- node={alert}
344
- className={classes(['dropin-cart-item__alert'])}
345
- />
346
- )}
347
-
348
- {/* Total */}
349
- <div
350
- className={classes([
351
- 'dropin-cart-item__total',
352
- ['dropin-cart-item__total--edit', !!onRemove],
353
- ])}
354
- >
355
- <div className="dropin-cart-item__row-total__wrapper">
356
- {
357
- /* Total */
358
- total && (
359
- <div className="dropin-cart-item__row-total">
360
- <VComponent node={total} role="text" />
361
- </div>
362
- )
363
- }
370
+ {/* Total */}
371
+ <div
372
+ className={classes([
373
+ 'dropin-cart-item__total',
374
+ ['dropin-cart-item__total--edit', !!onRemove],
375
+ ])}
376
+ >
377
+ <div className="dropin-cart-item__row-total__wrapper">
378
+ {
379
+ /* Total */
380
+ total && (
381
+ <div className="dropin-cart-item__row-total">
382
+ <VComponent node={total} role="text" />
383
+ </div>
384
+ )
385
+ }
364
386
 
365
- {taxIncluded && (
366
- <div className="dropin-cart-item__total-tax-included">
387
+ {taxIncluded && (
388
+ <div className="dropin-cart-item__total-tax-included">
367
389
  <span
368
- data-testid="tax-message"
369
- className={classes(['dropin-cart-item__total-tax-message'])}
390
+ data-testid="tax-message"
391
+ className={classes(['dropin-cart-item__total-tax-message'])}
370
392
  >
371
393
  {labels.taxIncluded}
372
394
  </span>
373
- </div>
374
- )}
375
- </div>
376
- {taxExcluded && (
377
- <div className="dropin-cart-item__total-tax-excluded">
395
+ </div>
396
+ )}
397
+ </div>
398
+ {taxExcluded && (
399
+ <div className="dropin-cart-item__total-tax-excluded">
378
400
  <span
379
- data-testid="tax-message"
380
- className={classes([
381
- 'dropin-cart-item__total-tax-excluded-message',
382
- ])}
401
+ data-testid="tax-message"
402
+ className={classes([
403
+ 'dropin-cart-item__total-tax-excluded-message',
404
+ ])}
383
405
  >
384
406
  {totalExcludingTax && (
385
- <VComponent node={totalExcludingTax} role="text" />
407
+ <VComponent node={totalExcludingTax} role="text" />
386
408
  )}
387
409
  &nbsp;
388
410
  {labels.taxExcluded}
389
411
  </span>
390
- </div>
391
- )}
412
+ </div>
413
+ )}
392
414
 
393
- {/* Discount amount */}
394
- {discount && (
395
- <VComponent
396
- node={discount}
397
- className={classes(['dropin-cart-item__discount'])}
398
- />
399
- )}
415
+ {/* Discount amount */}
416
+ {discount && (
417
+ <VComponent
418
+ node={discount}
419
+ className={classes(['dropin-cart-item__discount'])}
420
+ />
421
+ )}
400
422
 
401
- {/* Savings amount */}
402
- {savings && (
403
- <VComponent
404
- node={savings}
405
- className={classes(['dropin-cart-item__savings'])}
406
- />
423
+ {/* Savings amount */}
424
+ {savings && (
425
+ <VComponent
426
+ node={savings}
427
+ className={classes(['dropin-cart-item__savings'])}
428
+ />
429
+ )}
430
+
431
+ </div>
432
+
433
+ {/* Footer */}
434
+ {footer && (
435
+ <div className={classes(['dropin-cart-item__footer'])}>
436
+ <VComponent node={footer} />
437
+ </div>
407
438
  )}
408
439
  </div>
409
440
 
410
- {/* Footer */}
411
- {footer && (
412
- <div className={classes(['dropin-cart-item__footer'])}>
413
- <VComponent node={footer} />
414
- </div>
441
+ {/* Remove Item */}
442
+ {onRemove && (
443
+ <Button
444
+ data-testid="cart-item-remove-button"
445
+ className={classes(['dropin-cart-item__remove'])}
446
+ variant="tertiary"
447
+ onClick={() => onRemove?.()}
448
+ icon={
449
+ <Icon
450
+ data-testid="cart-item-remove-icon"
451
+ source={Trash}
452
+ size="24"
453
+ stroke="2"
454
+ viewBox="0 0 24 24"
455
+ aria-label={
456
+ ariaLabel
457
+ ? labels.remove?.replace('{product}', ariaLabel)
458
+ : labels.removeDefault
459
+ }
460
+ />
461
+ }
462
+ disabled={updating}
463
+ />
415
464
  )}
416
465
  </div>
417
-
418
- {/* Remove Item */}
419
- {onRemove && (
420
- <Button
421
- data-testid="cart-item-remove-button"
422
- className={classes(['dropin-cart-item__remove'])}
423
- variant="tertiary"
424
- onClick={() => onRemove?.()}
425
- icon={
426
- <Icon
427
- data-testid="cart-item-remove-icon"
428
- source={Trash}
429
- size="24"
430
- stroke="2"
431
- viewBox="0 0 24 24"
432
- aria-label={
433
- ariaLabel
434
- ? labels.remove?.replace('{product}', ariaLabel)
435
- : labels.removeDefault
436
- }
437
- />
438
- }
439
- disabled={updating}
440
- />
441
- )}
442
- </div>
443
466
  );
444
467
  };