@riosst100/pwa-marketplace 1.3.3 → 1.3.5
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 +76 -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 +8 -8
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.module.css +58 -58
- 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,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;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { useAttributeType } from '@magento/peregrine/lib/talons/ProductFullDetail/CustomAttributes/AttributeType/useAttributeType';
|
|
4
|
+
|
|
5
|
+
import Boolean from './Boolean';
|
|
6
|
+
import Date from './Date';
|
|
7
|
+
import DateTime from './DateTime';
|
|
8
|
+
import Multiselect from './Multiselect';
|
|
9
|
+
import Price from './Price';
|
|
10
|
+
import Select from './Select';
|
|
11
|
+
import Text from './Text';
|
|
12
|
+
import Textarea from './Textarea';
|
|
13
|
+
|
|
14
|
+
const defaultTypeConfig = {
|
|
15
|
+
boolean: {
|
|
16
|
+
component: Boolean
|
|
17
|
+
},
|
|
18
|
+
date: {
|
|
19
|
+
component: Date
|
|
20
|
+
},
|
|
21
|
+
datetime: {
|
|
22
|
+
component: DateTime
|
|
23
|
+
},
|
|
24
|
+
multiselect: {
|
|
25
|
+
component: Multiselect
|
|
26
|
+
},
|
|
27
|
+
price: {
|
|
28
|
+
component: Price
|
|
29
|
+
},
|
|
30
|
+
select: {
|
|
31
|
+
component: Select
|
|
32
|
+
},
|
|
33
|
+
text: {
|
|
34
|
+
component: Text
|
|
35
|
+
},
|
|
36
|
+
textarea: {
|
|
37
|
+
component: Textarea
|
|
38
|
+
},
|
|
39
|
+
texteditor: {
|
|
40
|
+
component: Textarea
|
|
41
|
+
},
|
|
42
|
+
pagebuilder: {
|
|
43
|
+
component: Textarea
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const AttributeType = props => {
|
|
48
|
+
const { data, ...rest } = props;
|
|
49
|
+
const { ui_input_type: type } = data?.attribute_metadata.ui_input || {};
|
|
50
|
+
|
|
51
|
+
const { getAttributeTypeConfig } = useAttributeType({
|
|
52
|
+
typeConfig: defaultTypeConfig
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (type) {
|
|
56
|
+
const attributeTypeConfig = getAttributeTypeConfig(type.toLowerCase());
|
|
57
|
+
if (attributeTypeConfig && attributeTypeConfig.component) {
|
|
58
|
+
const Component = attributeTypeConfig.component;
|
|
59
|
+
|
|
60
|
+
return <Component {...data} {...rest} />;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return null;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default AttributeType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './attributeType';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { array, shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
|
|
6
|
+
import AttributeType from './AttributeType';
|
|
7
|
+
import defaultClasses from './customAttributes.module.css';
|
|
8
|
+
|
|
9
|
+
export const IS_VISIBLE_ON_FRONT = 'PRODUCT_DETAILS_PAGE';
|
|
10
|
+
|
|
11
|
+
const CustomAttributes = props => {
|
|
12
|
+
const { customAttributes, showLabels } = props;
|
|
13
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
14
|
+
|
|
15
|
+
const list = useMemo(
|
|
16
|
+
() =>
|
|
17
|
+
customAttributes.reduce((previousAttribute, currentAttribute) => {
|
|
18
|
+
const usedInComponents =
|
|
19
|
+
currentAttribute.attribute_metadata?.used_in_components ||
|
|
20
|
+
[];
|
|
21
|
+
// Visible on front attributes only
|
|
22
|
+
if (usedInComponents.includes(IS_VISIBLE_ON_FRONT)) {
|
|
23
|
+
const attributeContent = (
|
|
24
|
+
<li
|
|
25
|
+
key={currentAttribute.attribute_metadata.uid}
|
|
26
|
+
className={classes.listItem}
|
|
27
|
+
>
|
|
28
|
+
<AttributeType
|
|
29
|
+
showLabels={showLabels}
|
|
30
|
+
data={currentAttribute}
|
|
31
|
+
/>
|
|
32
|
+
</li>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
previousAttribute.push(attributeContent);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return previousAttribute;
|
|
39
|
+
}, []),
|
|
40
|
+
[classes, customAttributes, showLabels]
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
if (list.length === 0) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className={classes.root}>
|
|
49
|
+
<ul className={classes.list}>{list}</ul>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
CustomAttributes.propTypes = {
|
|
55
|
+
classes: shape({
|
|
56
|
+
root: string,
|
|
57
|
+
title: string,
|
|
58
|
+
list: string,
|
|
59
|
+
listItem: string
|
|
60
|
+
}),
|
|
61
|
+
customAttributes: array.isRequired
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default CustomAttributes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './customAttributes';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './productFullDetail';
|