@riosst100/pwa-marketplace 1.3.2 → 1.3.4
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/.github/workflows/dependabot.yml +28 -28
- package/package.json +18 -18
- package/src/componentOverrideMapping.js +14 -0
- package/src/components/BecomeSellerLink/becomeSellerLink.js +1 -1
- package/src/components/BecomeSellerLink/becomeSellerLink.module.css +0 -4
- package/src/components/CurrencySwitcher/currencySwitcher.himmer.js +6 -0
- package/src/components/CurrencySwitcher/currencySwitcher.module.css +102 -0
- package/src/components/CurrencySwitcher/index.js +107 -0
- package/src/components/CurrencySwitcher/switcherItem.js +47 -0
- package/src/components/CurrencySwitcher/switcherItem.module.css +20 -0
- package/src/components/FilterOption/FilterOptionModal.module.css +90 -0
- package/src/components/FilterOption/filterOptionModal.js +48 -0
- package/src/components/FilterOptionModal/filterOptionModal.js +66 -0
- package/src/components/Header/becomeSellerLink.module.css +0 -4
- package/src/components/Header/websiteSwitcher.js +0 -1
- package/src/components/Header/websiteSwitcher.module.css +107 -111
- package/src/components/WebsiteSwitcher/websiteSwitcher.js +18 -6
- package/src/components/WebsiteSwitcher/websiteSwitcher.module.css +107 -111
- package/src/overwrites/peregrine/lib/talons/FilterModal/useFilterList.js +62 -0
- package/src/overwrites/peregrine/lib/talons/MegaMenu/useMegaMenuItem.js +66 -0
- package/src/overwrites/peregrine/lib/talons/MegaMenu/useSubMenu.js +20 -0
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +0 -2
- package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/index.js +1 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/noProductsFound.js +77 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/noProductsFound.module.css +39 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/noProductsFound.png +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.gql.js +17 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +91 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.module.css +77 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +12 -14
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.shimmer.js +74 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/001.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/002.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/003.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/004.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/005.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/006.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/007.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/008.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/009.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/010.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/011.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/012.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/index.js +12 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/index.js +6 -0
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +112 -0
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.module.css +32 -0
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.shimmer.js +24 -0
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/index.js +2 -0
- package/src/overwrites/venia-ui/lib/components/Checkbox/checkbox.js +78 -0
- package/src/overwrites/venia-ui/lib/components/Checkbox/checkbox.module.css +73 -0
- package/src/overwrites/venia-ui/lib/components/Checkbox/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilter.js +60 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilter.module.css +21 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.js +65 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.module.css +17 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterDefault.js +18 -18
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterDefault.module.css +0 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItem.js +79 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadio.js +76 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadio.module.css +0 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadioGroup.js +86 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterList.js +265 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterList.module.css +20 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterBlock.js +135 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterBlock.module.css +25 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterFooter.js +49 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterFooter.module.css +10 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterModal.js +166 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterModal.module.css +87 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterSearch.module.css +3 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/__tests__/filterSidebar.spec.js +246 -0
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +10 -10
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.module.css +57 -0
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.shimmer.js +24 -0
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/index.js +2 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/addToCartButton.js +116 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/addToCartButton.module.css +38 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/gallery.js +56 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/gallery.module.css +28 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/gallery.shimmer.js +39 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/index.js +3 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/item.js +204 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/item.module.css +109 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/item.shimmer.js +38 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/star.js +12 -0
- package/src/overwrites/venia-ui/lib/components/Header/accountTrigger.js +98 -0
- package/src/overwrites/venia-ui/lib/components/Header/cartTrigger.js +116 -0
- package/src/overwrites/venia-ui/lib/components/Header/header.js +12 -9
- package/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.js +22 -8
- package/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.module.css +107 -0
- package/src/overwrites/venia-ui/lib/components/Header/wishlistTrigger.js +23 -0
- package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +1 -1
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +0 -1
- package/src/overwrites/venia-ui/lib/components/Pagination/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/Pagination/navButton.js +65 -0
- package/src/overwrites/venia-ui/lib/components/Pagination/pagination.js +107 -0
- package/src/overwrites/venia-ui/lib/components/Pagination/tile.js +41 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/boolean.js +74 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/boolean.module.css +9 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/date.js +82 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/date.module.css +9 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/dateTime.js +85 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/dateTime.module.css +9 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/multiselect.js +104 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/multiselect.module.css +22 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/price.js +74 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/price.module.css +9 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/select.js +99 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/select.module.css +13 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/text.js +88 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/text.module.css +13 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/textarea.js +94 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/textarea.module.css +13 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/attributeType.js +67 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/customAttributes.js +64 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/customAttributes.module.css +9 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.gql.js +7 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +413 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.module.css +203 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.js +180 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.module.css +102 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.shimmer.js +51 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.shimmer.module.css +7 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/thumbnail.js +108 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/thumbnail.module.css +47 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/index.js +2 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.js +233 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.module.css +65 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.shimmer.js +28 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.shimmer.module.css +10 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/sortItem.js +57 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/sortItem.module.css +23 -0
- package/src/overwrites/venia-ui/lib/components/QuantityStepper/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.js +94 -0
- package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.module.css +78 -0
- package/src/overwrites/venia-ui/lib/components/RichContent/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/RichContent/plainHtmlRenderer.js +17 -0
- package/src/overwrites/venia-ui/lib/components/RichContent/richContent.js +59 -0
- package/src/overwrites/venia-ui/lib/components/RichContent/richContent.module.css +146 -0
- package/src/overwrites/venia-ui/lib/components/RichContent/richContentRenderers.js +7 -0
- package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.module.css +1 -2
- package/src/overwrites/venia-ui/lib/components/SearchBar/searchField.js +3 -2
- package/src/overwrites/venia-ui/lib/components/TextInput/field.module.css +50 -0
- package/src/overwrites/venia-ui/lib/components/TextInput/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/TextInput/textInput.js +48 -0
- package/src/overwrites/venia-ui/lib/components/TextInput/textInput.module.css +21 -0
- package/src/talons/FilterOption/useFilterOptionModal.js +11 -0
- package/src/talons/FilterOptionModal/useFilterOptionModal.js +11 -0
- package/src/theme/vars.js +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './date';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import { FormattedDate, FormattedTime } from 'react-intl';
|
|
4
|
+
|
|
5
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
|
+
|
|
7
|
+
import defaultClasses from './dateTime.module.css';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Custom Attributes DateTime Type component.
|
|
11
|
+
*
|
|
12
|
+
* @typedef DateTime
|
|
13
|
+
* @kind functional component
|
|
14
|
+
*
|
|
15
|
+
* @param {props} props React component props
|
|
16
|
+
*
|
|
17
|
+
* @returns {React.Element} A React component that displays a DateTime Type Product Attribute.
|
|
18
|
+
*/
|
|
19
|
+
const DateTime = props => {
|
|
20
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
21
|
+
const { attribute_metadata = {}, entered_attribute_value = {} } = props;
|
|
22
|
+
|
|
23
|
+
const attributeLabel = attribute_metadata.label ? (
|
|
24
|
+
<div className={classes.label}>{attribute_metadata.label}</div>
|
|
25
|
+
) : null;
|
|
26
|
+
let attributeContent;
|
|
27
|
+
|
|
28
|
+
// TODO: Get correct data from GraphQl based on config time zone
|
|
29
|
+
if (entered_attribute_value.value) {
|
|
30
|
+
// Convert date to ISO-8601 format so Safari can also parse it
|
|
31
|
+
const isoFormattedDate = entered_attribute_value.value.replace(
|
|
32
|
+
' ',
|
|
33
|
+
'T'
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
attributeContent = (
|
|
37
|
+
<div className={classes.content}>
|
|
38
|
+
<FormattedDate
|
|
39
|
+
value={isoFormattedDate}
|
|
40
|
+
year="numeric"
|
|
41
|
+
month="short"
|
|
42
|
+
day="2-digit"
|
|
43
|
+
/>
|
|
44
|
+
{/* eslint-disable-next-line react/jsx-no-literals */}
|
|
45
|
+
{', '}
|
|
46
|
+
<FormattedTime value={isoFormattedDate} />
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Fragment>
|
|
53
|
+
{attributeLabel}
|
|
54
|
+
{attributeContent}
|
|
55
|
+
</Fragment>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Props for {@link DateTime}
|
|
61
|
+
*
|
|
62
|
+
* @typedef props
|
|
63
|
+
*
|
|
64
|
+
* @property {Object} classes An object containing the class names for the attribute
|
|
65
|
+
* @property {String} classes.label CSS class for the attribute label
|
|
66
|
+
* @property {String} classes.content CSS class for the attribute content
|
|
67
|
+
* @property {Object} attribute_metadata An object containing the attribute metadata
|
|
68
|
+
* @property {String} attribute_metadata.label The attribute label
|
|
69
|
+
* @property {Object} entered_attribute_value An object containing the attribute value
|
|
70
|
+
* @property {String} entered_attribute_value.value Attribute value
|
|
71
|
+
*/
|
|
72
|
+
DateTime.propTypes = {
|
|
73
|
+
classes: shape({
|
|
74
|
+
label: string,
|
|
75
|
+
content: string
|
|
76
|
+
}),
|
|
77
|
+
attribute_metadata: shape({
|
|
78
|
+
label: string
|
|
79
|
+
}),
|
|
80
|
+
entered_attribute_value: shape({
|
|
81
|
+
value: string
|
|
82
|
+
})
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default DateTime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './dateTime';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './multiselect';
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { arrayOf, bool, shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
import RichContent from '@magento/venia-ui/lib/components/RichContent';
|
|
6
|
+
|
|
7
|
+
import defaultClasses from './multiselect.module.css';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Custom Attributes Multiselect Type component.
|
|
11
|
+
*
|
|
12
|
+
* @typedef Multiselect
|
|
13
|
+
* @kind functional component
|
|
14
|
+
*
|
|
15
|
+
* @param {props} props React component props
|
|
16
|
+
*
|
|
17
|
+
* @returns {React.Element} A React component that displays a Multiselect Type Product Attribute.
|
|
18
|
+
*/
|
|
19
|
+
const Multiselect = props => {
|
|
20
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
21
|
+
const { attribute_metadata = {}, selected_attribute_options = {} } = props;
|
|
22
|
+
|
|
23
|
+
const attributeLabel = attribute_metadata.label ? (
|
|
24
|
+
<div className={classes.label}>{attribute_metadata.label}</div>
|
|
25
|
+
) : null;
|
|
26
|
+
let attributeContent;
|
|
27
|
+
|
|
28
|
+
if (selected_attribute_options.attribute_option?.length > 0) {
|
|
29
|
+
const { is_html_allowed: isHtml } = attribute_metadata.ui_input;
|
|
30
|
+
|
|
31
|
+
if (isHtml) {
|
|
32
|
+
const options = selected_attribute_options.attribute_option.map(
|
|
33
|
+
(option, key) => {
|
|
34
|
+
return (
|
|
35
|
+
// TODO: Get decoded wysiwyg widgets from GraphQl
|
|
36
|
+
<RichContent
|
|
37
|
+
classes={{ root: classes.option }}
|
|
38
|
+
key={key}
|
|
39
|
+
html={option.label}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
attributeContent = (
|
|
46
|
+
<div className={classes.contentHtml}>{options}</div>
|
|
47
|
+
);
|
|
48
|
+
} else {
|
|
49
|
+
const options = selected_attribute_options.attribute_option
|
|
50
|
+
.map(option => option.label)
|
|
51
|
+
.join(', ');
|
|
52
|
+
|
|
53
|
+
attributeContent = <div className={classes.content}>{options}</div>;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<Fragment>
|
|
59
|
+
{attributeLabel}
|
|
60
|
+
{attributeContent}
|
|
61
|
+
</Fragment>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Props for {@link Multiselect}
|
|
67
|
+
*
|
|
68
|
+
* @typedef props
|
|
69
|
+
*
|
|
70
|
+
* @property {Object} classes An object containing the class names for the attribute
|
|
71
|
+
* @property {String} classes.label CSS class for the attribute label
|
|
72
|
+
* @property {String} classes.content CSS class for the attribute content
|
|
73
|
+
* @property {String} classes.contentHtml CSS class for the attribute content containing html
|
|
74
|
+
* @property {Object} attribute_metadata An object containing the attribute metadata
|
|
75
|
+
* @property {String} attribute_metadata.label The attribute label
|
|
76
|
+
* @property {Object} attribute_metadata.ui_input An object containing the input ui data
|
|
77
|
+
* @property {Boolean} attribute_metadata.ui_input.is_html_allowed Indicates if value might contain html
|
|
78
|
+
* @property {Object} selected_attribute_options An object containing the attribute selected options
|
|
79
|
+
* @property {Array} selected_attribute_options.attribute_option An array of the selected options
|
|
80
|
+
* @property {String} selected_attribute_options.attribute_option.label Label of the selected option
|
|
81
|
+
*/
|
|
82
|
+
Multiselect.propTypes = {
|
|
83
|
+
classes: shape({
|
|
84
|
+
label: string,
|
|
85
|
+
content: string,
|
|
86
|
+
contentHtml: string,
|
|
87
|
+
option: string
|
|
88
|
+
}),
|
|
89
|
+
attribute_metadata: shape({
|
|
90
|
+
label: string,
|
|
91
|
+
ui_input: shape({
|
|
92
|
+
is_html_allowed: bool
|
|
93
|
+
})
|
|
94
|
+
}),
|
|
95
|
+
selected_attribute_options: shape({
|
|
96
|
+
attribute_option: arrayOf(
|
|
97
|
+
shape({
|
|
98
|
+
label: string
|
|
99
|
+
})
|
|
100
|
+
)
|
|
101
|
+
})
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export default Multiselect;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.label {
|
|
2
|
+
composes: font-bold from global;
|
|
3
|
+
composes: inline-block from global;
|
|
4
|
+
composes: mr-2 from global;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.content {
|
|
8
|
+
composes: inline from global;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.contentHtml {
|
|
12
|
+
composes: inline from global;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.option {
|
|
16
|
+
composes: inline-block from global;
|
|
17
|
+
composes: break-words from global;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.option:not(:last-child)::after {
|
|
21
|
+
content: ',\00a0';
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './price';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { BrowserPersistence } from '@magento/peregrine/lib/util';
|
|
5
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
|
+
import PriceComponent from '@magento/venia-ui/lib/components/Price';
|
|
7
|
+
|
|
8
|
+
import defaultClasses from './price.module.css';
|
|
9
|
+
|
|
10
|
+
const storage = new BrowserPersistence();
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Custom Attributes Price Type component.
|
|
14
|
+
*
|
|
15
|
+
* @typedef Price
|
|
16
|
+
* @kind functional component
|
|
17
|
+
*
|
|
18
|
+
* @param {props} props React component props
|
|
19
|
+
*
|
|
20
|
+
* @returns {React.Element} A React component that displays a Price Type Product Attribute.
|
|
21
|
+
*/
|
|
22
|
+
const Price = props => {
|
|
23
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
24
|
+
const { attribute_metadata = {}, entered_attribute_value = {} } = props;
|
|
25
|
+
|
|
26
|
+
// TODO: Get complete price data from GraphQl including currency
|
|
27
|
+
const storeCurrency = storage.getItem('store_view_currency') || 'USD';
|
|
28
|
+
const attributeLabel = attribute_metadata.label ? (
|
|
29
|
+
<div className={classes.label}>{attribute_metadata.label}</div>
|
|
30
|
+
) : null;
|
|
31
|
+
const attributeContent = entered_attribute_value.value ? (
|
|
32
|
+
<div className={classes.attributeContent}>
|
|
33
|
+
<PriceComponent
|
|
34
|
+
value={parseInt(entered_attribute_value.value)}
|
|
35
|
+
currencyCode={storeCurrency}
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
) : null;
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Fragment>
|
|
42
|
+
{attributeLabel}
|
|
43
|
+
{attributeContent}
|
|
44
|
+
</Fragment>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Props for {@link Price}
|
|
50
|
+
*
|
|
51
|
+
* @typedef props
|
|
52
|
+
*
|
|
53
|
+
* @property {Object} classes An object containing the class names for the attribute
|
|
54
|
+
* @property {String} classes.label CSS class for the attribute label
|
|
55
|
+
* @property {String} classes.content CSS class for the attribute content
|
|
56
|
+
* @property {Object} attribute_metadata An object containing the attribute metadata
|
|
57
|
+
* @property {String} attribute_metadata.label The attribute label
|
|
58
|
+
* @property {Object} entered_attribute_value An object containing the attribute value
|
|
59
|
+
* @property {String} entered_attribute_value.value Attribute value
|
|
60
|
+
*/
|
|
61
|
+
Price.propTypes = {
|
|
62
|
+
classes: shape({
|
|
63
|
+
label: string,
|
|
64
|
+
content: string
|
|
65
|
+
}),
|
|
66
|
+
attribute_metadata: shape({
|
|
67
|
+
label: string
|
|
68
|
+
}),
|
|
69
|
+
entered_attribute_value: shape({
|
|
70
|
+
value: string
|
|
71
|
+
})
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default Price;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './select';
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { arrayOf, bool, shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
import RichContent from '@magento/venia-ui/lib/components/RichContent';
|
|
6
|
+
|
|
7
|
+
import defaultClasses from './select.module.css';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Custom Attributes Select Type component.
|
|
11
|
+
*
|
|
12
|
+
* @typedef Select
|
|
13
|
+
* @kind functional component
|
|
14
|
+
*
|
|
15
|
+
* @param {props} props React component props
|
|
16
|
+
*
|
|
17
|
+
* @returns {React.Element} A React component that displays a Select Type Product Attribute.
|
|
18
|
+
*/
|
|
19
|
+
const Select = props => {
|
|
20
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
21
|
+
const { attribute_metadata = {}, selected_attribute_options = {} } = props;
|
|
22
|
+
|
|
23
|
+
const attributeLabel = attribute_metadata.label ? (
|
|
24
|
+
<div className={classes.label}>{attribute_metadata.label}</div>
|
|
25
|
+
) : null;
|
|
26
|
+
let attributeContent;
|
|
27
|
+
|
|
28
|
+
if (selected_attribute_options.attribute_option?.length > 0) {
|
|
29
|
+
const { is_html_allowed: isHtml } = attribute_metadata.ui_input;
|
|
30
|
+
|
|
31
|
+
if (isHtml) {
|
|
32
|
+
const options = selected_attribute_options.attribute_option.map(
|
|
33
|
+
(option, key) => {
|
|
34
|
+
return (
|
|
35
|
+
// TODO: Get decoded wysiwyg widgets from GraphQl
|
|
36
|
+
<RichContent key={key} html={option.label} />
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
attributeContent = (
|
|
42
|
+
<div className={classes.contentHtml}>{options}</div>
|
|
43
|
+
);
|
|
44
|
+
} else {
|
|
45
|
+
const options = selected_attribute_options.attribute_option
|
|
46
|
+
.map(option => option.label)
|
|
47
|
+
.join(', ');
|
|
48
|
+
|
|
49
|
+
attributeContent = <div className={classes.content}>{options}</div>;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Fragment>
|
|
55
|
+
{attributeLabel}
|
|
56
|
+
{attributeContent}
|
|
57
|
+
</Fragment>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Props for {@link Select}
|
|
63
|
+
*
|
|
64
|
+
* @typedef props
|
|
65
|
+
*
|
|
66
|
+
* @property {Object} classes An object containing the class names for the attribute
|
|
67
|
+
* @property {String} classes.label CSS class for the attribute label
|
|
68
|
+
* @property {String} classes.content CSS class for the attribute content
|
|
69
|
+
* @property {String} classes.contentHtml CSS class for the attribute content containing html
|
|
70
|
+
* @property {Object} attribute_metadata An object containing the attribute metadata
|
|
71
|
+
* @property {String} attribute_metadata.label The attribute label
|
|
72
|
+
* @property {Object} attribute_metadata.ui_input An object containing the input ui data
|
|
73
|
+
* @property {Boolean} attribute_metadata.ui_input.is_html_allowed Indicates if value might contain html
|
|
74
|
+
* @property {Object} selected_attribute_options An object containing the attribute selected options
|
|
75
|
+
* @property {Array} selected_attribute_options.attribute_option An array of the selected options
|
|
76
|
+
* @property {String} selected_attribute_options.attribute_option.label Label of the selected option
|
|
77
|
+
*/
|
|
78
|
+
Select.propTypes = {
|
|
79
|
+
classes: shape({
|
|
80
|
+
label: string,
|
|
81
|
+
content: string,
|
|
82
|
+
contentHtml: string
|
|
83
|
+
}),
|
|
84
|
+
attribute_metadata: shape({
|
|
85
|
+
label: string,
|
|
86
|
+
ui_input: shape({
|
|
87
|
+
is_html_allowed: bool
|
|
88
|
+
})
|
|
89
|
+
}),
|
|
90
|
+
selected_attribute_options: shape({
|
|
91
|
+
attribute_option: arrayOf(
|
|
92
|
+
shape({
|
|
93
|
+
label: string
|
|
94
|
+
})
|
|
95
|
+
)
|
|
96
|
+
})
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default Select;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './text';
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { bool, shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
import RichContent from '@magento/venia-ui/lib/components/RichContent';
|
|
6
|
+
|
|
7
|
+
import defaultClasses from './text.module.css';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Custom Attributes Text Type component.
|
|
11
|
+
*
|
|
12
|
+
* @typedef Text
|
|
13
|
+
* @kind functional component
|
|
14
|
+
*
|
|
15
|
+
* @param {props} props React component props
|
|
16
|
+
*
|
|
17
|
+
* @returns {React.Element} A React component that displays a Text Type Product Attribute.
|
|
18
|
+
*/
|
|
19
|
+
const Text = props => {
|
|
20
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
21
|
+
const { attribute_metadata = {}, entered_attribute_value = {} } = props;
|
|
22
|
+
|
|
23
|
+
const attributeLabel = attribute_metadata.label ? (
|
|
24
|
+
<div className={classes.label}>{attribute_metadata.label}</div>
|
|
25
|
+
) : null;
|
|
26
|
+
let attributeContent;
|
|
27
|
+
|
|
28
|
+
if (entered_attribute_value.value) {
|
|
29
|
+
const { is_html_allowed: isHtml } = attribute_metadata.ui_input;
|
|
30
|
+
|
|
31
|
+
if (isHtml) {
|
|
32
|
+
// TODO: Get decoded wysiwyg widgets from GraphQl
|
|
33
|
+
attributeContent = (
|
|
34
|
+
<div className={classes.contentHtml}>
|
|
35
|
+
<RichContent html={entered_attribute_value.value} />
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
} else {
|
|
39
|
+
attributeContent = (
|
|
40
|
+
<div className={classes.content}>
|
|
41
|
+
{entered_attribute_value.value}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Fragment>
|
|
49
|
+
{attributeLabel}
|
|
50
|
+
{attributeContent}
|
|
51
|
+
</Fragment>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Props for {@link Text}
|
|
57
|
+
*
|
|
58
|
+
* @typedef props
|
|
59
|
+
*
|
|
60
|
+
* @property {Object} classes An object containing the class names for the attribute
|
|
61
|
+
* @property {String} classes.label CSS class for the attribute label
|
|
62
|
+
* @property {String} classes.content CSS class for the attribute content
|
|
63
|
+
* @property {String} classes.contentHtml CSS class for the attribute content containing html
|
|
64
|
+
* @property {Object} attribute_metadata An object containing the attribute metadata
|
|
65
|
+
* @property {String} attribute_metadata.label The attribute label
|
|
66
|
+
* @property {Object} attribute_metadata.ui_input An object containing the input ui data
|
|
67
|
+
* @property {Boolean} attribute_metadata.ui_input.is_html_allowed Indicates if value might contain html
|
|
68
|
+
* @property {Object} entered_attribute_value An object containing the attribute value
|
|
69
|
+
* @property {String} entered_attribute_value.value Attribute value
|
|
70
|
+
*/
|
|
71
|
+
Text.propTypes = {
|
|
72
|
+
classes: shape({
|
|
73
|
+
label: string,
|
|
74
|
+
content: string,
|
|
75
|
+
contentHtml: string
|
|
76
|
+
}),
|
|
77
|
+
attribute_metadata: shape({
|
|
78
|
+
label: string,
|
|
79
|
+
ui_input: shape({
|
|
80
|
+
is_html_allowed: bool
|
|
81
|
+
})
|
|
82
|
+
}),
|
|
83
|
+
entered_attribute_value: shape({
|
|
84
|
+
value: string
|
|
85
|
+
})
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default Text;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './textarea';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { bool, shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
import RichContent from '@magento/venia-ui/lib/components/RichContent';
|
|
6
|
+
|
|
7
|
+
import defaultClasses from './textarea.module.css';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Custom Attributes Textarea Type component.
|
|
11
|
+
*
|
|
12
|
+
* @typedef Textarea
|
|
13
|
+
* @kind functional component
|
|
14
|
+
*
|
|
15
|
+
* @param {props} props React component props
|
|
16
|
+
*
|
|
17
|
+
* @returns {React.Element} A React component that displays a Textarea Type Product Attribute.
|
|
18
|
+
*/
|
|
19
|
+
const Textarea = props => {
|
|
20
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
21
|
+
const {
|
|
22
|
+
attribute_metadata = {},
|
|
23
|
+
entered_attribute_value = {},
|
|
24
|
+
showLabels = true
|
|
25
|
+
} = props;
|
|
26
|
+
|
|
27
|
+
const attributeLabel =
|
|
28
|
+
attribute_metadata.label && showLabels ? (
|
|
29
|
+
<div className={classes.label}>{attribute_metadata.label}</div>
|
|
30
|
+
) : null;
|
|
31
|
+
let attributeContent;
|
|
32
|
+
|
|
33
|
+
if (entered_attribute_value.value) {
|
|
34
|
+
const { is_html_allowed: isHtml } = attribute_metadata.ui_input;
|
|
35
|
+
|
|
36
|
+
if (isHtml) {
|
|
37
|
+
// TODO: Get decoded wysiwyg widgets from GraphQl
|
|
38
|
+
|
|
39
|
+
attributeContent = (
|
|
40
|
+
<div className={classes.contentHtml}>
|
|
41
|
+
<RichContent html={entered_attribute_value.value} />
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
} else {
|
|
45
|
+
attributeContent = (
|
|
46
|
+
<div className={classes.content}>
|
|
47
|
+
{entered_attribute_value.value}
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Fragment>
|
|
55
|
+
{attributeLabel}
|
|
56
|
+
{attributeContent}
|
|
57
|
+
</Fragment>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Props for {@link Textarea}
|
|
63
|
+
*
|
|
64
|
+
* @typedef props
|
|
65
|
+
*
|
|
66
|
+
* @property {Object} classes An object containing the class names for the attribute
|
|
67
|
+
* @property {String} classes.label CSS class for the attribute label
|
|
68
|
+
* @property {String} classes.content CSS class for the attribute content
|
|
69
|
+
* @property {String} classes.contentHtml CSS class for the attribute content containing html
|
|
70
|
+
* @property {Object} attribute_metadata An object containing the attribute metadata
|
|
71
|
+
* @property {String} attribute_metadata.label The attribute label
|
|
72
|
+
* @property {Object} attribute_metadata.ui_input An object containing the input ui data
|
|
73
|
+
* @property {Boolean} attribute_metadata.ui_input.is_html_allowed Indicates if value might contain html
|
|
74
|
+
* @property {Object} entered_attribute_value An object containing the attribute value
|
|
75
|
+
* @property {String} entered_attribute_value.value Attribute value
|
|
76
|
+
*/
|
|
77
|
+
Textarea.propTypes = {
|
|
78
|
+
classes: shape({
|
|
79
|
+
label: string,
|
|
80
|
+
content: string,
|
|
81
|
+
contentHtml: string
|
|
82
|
+
}),
|
|
83
|
+
attribute_metadata: shape({
|
|
84
|
+
label: string,
|
|
85
|
+
ui_input: shape({
|
|
86
|
+
is_html_allowed: bool
|
|
87
|
+
})
|
|
88
|
+
}),
|
|
89
|
+
entered_attribute_value: shape({
|
|
90
|
+
value: string
|
|
91
|
+
})
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default Textarea;
|