@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.
- package/.elsie.js +9 -0
- package/.eslintrc.js +9 -0
- package/__mocks__/svg.js +9 -0
- package/bin/lib/validate-typeof.js +9 -0
- package/bin/lib/write-file.js +9 -0
- package/bin/lib/write-parent-index.js +9 -0
- package/config/eslint.js +9 -0
- package/config/jest.js +9 -0
- package/config/prettier.js +9 -0
- package/config/setEnvVars.js +9 -0
- package/config/storybook/addon.js +9 -0
- package/config/storybook/components/FileTree/FileTree.jsx +9 -0
- package/config/storybook/components/FileTree/index.js +9 -0
- package/config/storybook/components/Flex/Flex.jsx +9 -0
- package/config/storybook/components/Flex/Flex.module.css +9 -0
- package/config/storybook/components/Flex/index.js +9 -0
- package/config/storybook/components/OptionsTable/OptionsTable.jsx +9 -0
- package/config/storybook/components/OptionsTable/OptionsTable.module.css +9 -0
- package/config/storybook/components/OptionsTable/index.js +9 -0
- package/config/storybook/components/Panel/Panel.module.css +9 -0
- package/config/storybook/components/Panel/Panel.tsx +9 -0
- package/config/storybook/components/Panel/index.ts +9 -0
- package/config/storybook/components/Screenshot/Screenshot.jsx +9 -0
- package/config/storybook/components/Screenshot/Screenshot.module.css +9 -0
- package/config/storybook/components/Screenshot/index.js +9 -0
- package/config/storybook/components/Steps/Steps.jsx +9 -0
- package/config/storybook/components/Steps/Steps.module.css +9 -0
- package/config/storybook/components/Steps/index.js +9 -0
- package/config/storybook/components/StoryWrapper/StoryWrapper.jsx +9 -0
- package/config/storybook/components/StoryWrapper/StoryWrapper.module.css +9 -0
- package/config/storybook/components/StoryWrapper/index.js +9 -0
- package/config/storybook/components/Summary/Summary.jsx +9 -0
- package/config/storybook/components/Summary/Summary.module.css +9 -0
- package/config/storybook/components/Summary/index.js +9 -0
- package/config/storybook/components/Variants/Variants.js +9 -0
- package/config/storybook/components/Variants/docs.css +9 -0
- package/config/storybook/components/Variants/index.js +9 -0
- package/config/storybook/components/video/index.jsx +9 -0
- package/config/storybook/manager.js +9 -0
- package/config/storybook/preview.jsx +9 -0
- package/config/storybook/theming/fonts.css +9 -0
- package/config/storybook/theming/manager.css +9 -0
- package/config/storybook/theming/preview.css +9 -0
- package/config/storybook/theming/theme.js +9 -0
- package/config/vite.mjs +9 -0
- package/package.json +1 -1
- package/post-release.sh +5 -0
- package/src/components/Accordion/Accordion.css +10 -1
- package/src/components/Accordion/Accordion.stories.tsx +9 -0
- package/src/components/Accordion/Accordion.tsx +9 -0
- package/src/components/Accordion/index.ts +9 -0
- package/src/components/ActionButton/ActionButton.css +9 -0
- package/src/components/ActionButton/ActionButton.stories.tsx +9 -0
- package/src/components/ActionButton/ActionButton.tsx +9 -0
- package/src/components/ActionButton/index.ts +9 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.css +9 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.stories.tsx +9 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.tsx +9 -0
- package/src/components/ActionButtonGroup/index.ts +9 -0
- package/src/components/AlertBanner/AlertBanner.css +9 -0
- package/src/components/AlertBanner/AlertBanner.stories.tsx +9 -0
- package/src/components/AlertBanner/AlertBanner.tsx +9 -0
- package/src/components/AlertBanner/index.ts +9 -0
- package/src/components/Breadcrumbs/Breadcrumbs.css +9 -0
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +9 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +9 -0
- package/src/components/Breadcrumbs/index.ts +9 -0
- package/src/components/Button/Button.css +9 -0
- package/src/components/Button/Button.stories.tsx +9 -0
- package/src/components/Button/Button.tsx +9 -0
- package/src/components/Button/index.ts +9 -0
- package/src/components/Card/Card.css +9 -0
- package/src/components/Card/Card.stories.tsx +9 -0
- package/src/components/Card/Card.tsx +9 -0
- package/src/components/Card/index.ts +9 -0
- package/src/components/CartItem/CartItem.css +40 -5
- package/src/components/CartItem/CartItem.stories.tsx +84 -44
- package/src/components/CartItem/CartItem.tsx +343 -320
- package/src/components/CartItem/CartItemSkeleton.tsx +9 -0
- package/src/components/CartItem/index.ts +9 -0
- package/src/components/CartList/CartList.css +9 -0
- package/src/components/CartList/CartList.stories.tsx +9 -0
- package/src/components/CartList/CartList.tsx +9 -0
- package/src/components/CartList/index.ts +9 -0
- package/src/components/Checkbox/Checkbox.css +9 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +9 -0
- package/src/components/Checkbox/Checkbox.tsx +9 -0
- package/src/components/Checkbox/index.ts +9 -0
- package/src/components/ColorSwatch/ColorSwatch.css +9 -0
- package/src/components/ColorSwatch/ColorSwatch.stories.tsx +9 -0
- package/src/components/ColorSwatch/ColorSwatch.tsx +9 -0
- package/src/components/ColorSwatch/index.ts +9 -0
- package/src/components/ContentGrid/ContentGrid.css +3 -11
- package/src/components/ContentGrid/ContentGrid.stories.tsx +3 -11
- package/src/components/ContentGrid/ContentGrid.tsx +3 -11
- package/src/components/ContentGrid/index.ts +3 -11
- package/src/components/Divider/Divider.css +9 -0
- package/src/components/Divider/Divider.stories.tsx +9 -0
- package/src/components/Divider/Divider.tsx +9 -0
- package/src/components/Divider/index.ts +9 -0
- package/src/components/Field/Field.css +9 -0
- package/src/components/Field/Field.stories.tsx +9 -0
- package/src/components/Field/Field.tsx +9 -0
- package/src/components/Field/index.ts +9 -0
- package/src/components/Header/Header.css +9 -0
- package/src/components/Header/Header.stories.tsx +52 -0
- package/src/components/Header/Header.tsx +31 -3
- package/src/components/Header/index.ts +9 -0
- package/src/components/Icon/Icon.css +9 -0
- package/src/components/Icon/Icon.stories.helpers.jsx +9 -0
- package/src/components/Icon/Icon.stories.tsx +9 -0
- package/src/components/Icon/Icon.tsx +9 -0
- package/src/components/Icon/index.ts +9 -0
- package/src/components/IllustratedMessage/IllustratedMessage.css +9 -0
- package/src/components/IllustratedMessage/IllustratedMessage.stories.tsx +9 -0
- package/src/components/IllustratedMessage/IllustratedMessage.tsx +9 -0
- package/src/components/IllustratedMessage/index.ts +9 -0
- package/src/components/Image/Image.css +9 -0
- package/src/components/Image/Image.stories.tsx +9 -0
- package/src/components/Image/Image.tsx +9 -0
- package/src/components/Image/index.ts +9 -0
- package/src/components/ImageSwatch/ImageSwatch.css +9 -0
- package/src/components/ImageSwatch/ImageSwatch.stories.tsx +58 -0
- package/src/components/ImageSwatch/ImageSwatch.tsx +22 -10
- package/src/components/ImageSwatch/index.ts +9 -0
- package/src/components/InLineAlert/InLineAlert.css +9 -0
- package/src/components/InLineAlert/InLineAlert.stories.tsx +9 -0
- package/src/components/InLineAlert/InLineAlert.tsx +9 -0
- package/src/components/InLineAlert/index.ts +9 -0
- package/src/components/Incrementer/Incrementer.css +9 -0
- package/src/components/Incrementer/Incrementer.stories.tsx +9 -0
- package/src/components/Incrementer/Incrementer.tsx +9 -0
- package/src/components/Incrementer/index.ts +9 -0
- package/src/components/Input/Input.css +9 -0
- package/src/components/Input/Input.stories.tsx +9 -0
- package/src/components/Input/Input.tsx +9 -0
- package/src/components/Input/index.ts +9 -0
- package/src/components/InputDate/InputDate.css +9 -0
- package/src/components/InputDate/InputDate.stories.tsx +9 -0
- package/src/components/InputDate/InputDate.tsx +9 -0
- package/src/components/InputDate/index.ts +9 -0
- package/src/components/InputPassword/InputPassword.css +9 -0
- package/src/components/InputPassword/InputPassword.stories.tsx +9 -0
- package/src/components/InputPassword/InputPassword.tsx +9 -0
- package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.css +9 -0
- package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.tsx +9 -0
- package/src/components/InputPassword/PasswordStatusIndicator/index.ts +9 -0
- package/src/components/InputPassword/index.ts +9 -0
- package/src/components/Modal/Modal.css +8 -13
- package/src/components/Modal/Modal.stories.tsx +8 -13
- package/src/components/Modal/Modal.tsx +8 -13
- package/src/components/Modal/index.ts +8 -13
- package/src/components/Pagination/Pagination.css +9 -0
- package/src/components/Pagination/Pagination.stories.tsx +9 -0
- package/src/components/Pagination/Pagination.tsx +9 -0
- package/src/components/Pagination/index.ts +9 -0
- package/src/components/Picker/Picker.css +9 -0
- package/src/components/Picker/Picker.stories.tsx +9 -0
- package/src/components/Picker/Picker.tsx +9 -0
- package/src/components/Picker/index.ts +9 -0
- package/src/components/Price/Price.css +9 -0
- package/src/components/Price/Price.stories.tsx +9 -0
- package/src/components/Price/Price.tsx +9 -0
- package/src/components/Price/index.ts +9 -0
- package/src/components/PriceRange/PriceRange.css +9 -0
- package/src/components/PriceRange/PriceRange.stories.tsx +9 -0
- package/src/components/PriceRange/PriceRange.tsx +9 -0
- package/src/components/PriceRange/index.ts +9 -0
- package/src/components/ProgressSpinner/ProgressSpinner.css +9 -0
- package/src/components/ProgressSpinner/ProgressSpinner.stories.tsx +9 -0
- package/src/components/ProgressSpinner/ProgressSpinner.tsx +9 -0
- package/src/components/ProgressSpinner/index.ts +9 -0
- package/src/components/RadioButton/RadioButton.css +9 -0
- package/src/components/RadioButton/RadioButton.stories.tsx +9 -0
- package/src/components/RadioButton/RadioButton.tsx +9 -0
- package/src/components/RadioButton/index.ts +9 -0
- package/src/components/Skeleton/Skeleton.css +9 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +9 -0
- package/src/components/Skeleton/Skeleton.tsx +9 -0
- package/src/components/Skeleton/index.ts +9 -0
- package/src/components/Tag/Tag.css +9 -0
- package/src/components/Tag/Tag.stories.tsx +9 -0
- package/src/components/Tag/Tag.tsx +9 -0
- package/src/components/Tag/index.ts +9 -0
- package/src/components/TextArea/TextArea.css +9 -0
- package/src/components/TextArea/TextArea.stories.tsx +9 -0
- package/src/components/TextArea/TextArea.tsx +9 -0
- package/src/components/TextArea/index.ts +9 -0
- package/src/components/TextSwatch/TextSwatch.css +9 -0
- package/src/components/TextSwatch/TextSwatch.stories.tsx +9 -0
- package/src/components/TextSwatch/TextSwatch.tsx +9 -0
- package/src/components/TextSwatch/index.ts +9 -0
- package/src/components/ToggleButton/ToggleButton.css +18 -0
- package/src/components/ToggleButton/ToggleButton.stories.tsx +47 -3
- package/src/components/ToggleButton/ToggleButton.tsx +19 -11
- package/src/components/ToggleButton/index.ts +9 -0
- package/src/components/UIProvider/UIProvider.css +9 -0
- package/src/components/UIProvider/UIProvider.tsx +9 -0
- package/src/components/UIProvider/debugger.css +9 -0
- package/src/components/UIProvider/index.ts +9 -0
- package/src/components/UIProvider/normalize.css +9 -0
- package/src/components/index.ts +9 -0
- package/src/i18n/index.ts +9 -0
- package/src/lib/classes.ts +9 -0
- package/src/lib/config.ts +9 -0
- package/src/lib/debounce.ts +9 -0
- package/src/lib/deepmerge.ts +9 -0
- package/src/lib/deviceUtils.ts +9 -0
- package/src/lib/form-values.ts +9 -0
- package/src/lib/i18n.ts +9 -0
- package/src/lib/image-params-keymap.ts +9 -0
- package/src/lib/index.ts +9 -0
- package/src/lib/initializer.ts +9 -0
- package/src/lib/is-number.ts +9 -0
- package/src/lib/render.tsx +9 -0
- package/src/lib/resolve-image.ts +9 -0
- package/src/lib/signals.ts +9 -0
- package/src/lib/slot.tsx +9 -0
- package/src/lib/tests.tsx +9 -0
- package/src/lib/types.ts +9 -0
- package/src/lib/vcomponent.tsx +8 -13
- package/static/assets/images/index.ts +9 -0
- package/storybook-stories.js +9 -0
- package/tests/__mocks__/browserMocks.ts +9 -0
- package/tests/__mocks__/fileMocks.ts +9 -0
- 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 {
|
|
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
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
{
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
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-
|
|
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
|
-
|
|
246
|
-
|
|
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
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
262
|
+
<div className="dropin-cart-item__sr-only">
|
|
263
|
+
{labels.quantity}: {quantity?.toLocaleString(locale)};
|
|
264
|
+
</div>
|
|
265
|
+
</>
|
|
255
266
|
)}
|
|
256
267
|
|
|
257
|
-
|
|
268
|
+
<VComponent node={price} role="text" />
|
|
258
269
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
270
|
+
{quantity && quantity > 1 && (
|
|
271
|
+
<>
|
|
272
|
+
|
|
273
|
+
{labels.each}
|
|
274
|
+
</>
|
|
275
|
+
)}
|
|
265
276
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
277
|
+
{taxIncluded && (
|
|
278
|
+
<span
|
|
279
|
+
data-testid="tax-message"
|
|
280
|
+
className="dropin-cart-item__price-tax-message"
|
|
281
|
+
>
|
|
271
282
|
|
|
272
|
-
|
|
283
|
+
{labels.taxIncluded}
|
|
273
284
|
</span>
|
|
274
|
-
|
|
285
|
+
)}
|
|
275
286
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
287
|
+
{taxExcluded && (
|
|
288
|
+
<span
|
|
289
|
+
data-testid="tax-message"
|
|
290
|
+
className="dropin-cart-item__price-tax-message"
|
|
291
|
+
>
|
|
281
292
|
|
|
282
|
-
|
|
293
|
+
{labels.taxExcluded}
|
|
283
294
|
</span>
|
|
284
|
-
|
|
295
|
+
)}
|
|
285
296
|
</span>
|
|
286
|
-
|
|
287
|
-
|
|
297
|
+
)
|
|
298
|
+
}
|
|
288
299
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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
|
-
|
|
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
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
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
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
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
|
-
|
|
366
|
-
|
|
387
|
+
{taxIncluded && (
|
|
388
|
+
<div className="dropin-cart-item__total-tax-included">
|
|
367
389
|
<span
|
|
368
|
-
|
|
369
|
-
|
|
390
|
+
data-testid="tax-message"
|
|
391
|
+
className={classes(['dropin-cart-item__total-tax-message'])}
|
|
370
392
|
>
|
|
371
393
|
{labels.taxIncluded}
|
|
372
394
|
</span>
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
395
|
+
</div>
|
|
396
|
+
)}
|
|
397
|
+
</div>
|
|
398
|
+
{taxExcluded && (
|
|
399
|
+
<div className="dropin-cart-item__total-tax-excluded">
|
|
378
400
|
<span
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
401
|
+
data-testid="tax-message"
|
|
402
|
+
className={classes([
|
|
403
|
+
'dropin-cart-item__total-tax-excluded-message',
|
|
404
|
+
])}
|
|
383
405
|
>
|
|
384
406
|
{totalExcludingTax && (
|
|
385
|
-
|
|
407
|
+
<VComponent node={totalExcludingTax} role="text" />
|
|
386
408
|
)}
|
|
387
409
|
|
|
388
410
|
{labels.taxExcluded}
|
|
389
411
|
</span>
|
|
390
|
-
|
|
391
|
-
|
|
412
|
+
</div>
|
|
413
|
+
)}
|
|
392
414
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
415
|
+
{/* Discount amount */}
|
|
416
|
+
{discount && (
|
|
417
|
+
<VComponent
|
|
418
|
+
node={discount}
|
|
419
|
+
className={classes(['dropin-cart-item__discount'])}
|
|
420
|
+
/>
|
|
421
|
+
)}
|
|
400
422
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
-
{/*
|
|
411
|
-
{
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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
|
};
|