@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,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
4
|
+
|
|
5
|
+
import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
|
|
6
|
+
import defaultClasses from '@magento/venia-ui/lib/components/Breadcrumbs/breadcrumbs.module.css';
|
|
7
|
+
|
|
8
|
+
const BreadcrumbsShimmer = props => {
|
|
9
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className={classes.root} aria-live="polite" aria-busy="true">
|
|
13
|
+
<Shimmer width={5} />
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
BreadcrumbsShimmer.propTypes = {
|
|
19
|
+
classes: shape({
|
|
20
|
+
root: string
|
|
21
|
+
})
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default BreadcrumbsShimmer;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { Fragment, useEffect } from 'react';
|
|
2
|
+
import { node, shape, string } from 'prop-types';
|
|
3
|
+
import { Checkbox as InformedCheckbox, useFieldApi } from 'informed';
|
|
4
|
+
import useFieldState from '@magento/peregrine/lib/hooks/hook-wrappers/useInformedFieldStateWrapper';
|
|
5
|
+
|
|
6
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
+
import { Message } from '@magento/venia-ui/lib/components/Field';
|
|
8
|
+
import { CheckSquare, Square } from 'react-feather';
|
|
9
|
+
import defaultClasses from './checkbox.module.css';
|
|
10
|
+
|
|
11
|
+
/* TODO: change lint config to use `label-has-associated-control` */
|
|
12
|
+
/* eslint-disable jsx-a11y/label-has-for */
|
|
13
|
+
|
|
14
|
+
const checkedIcon = <CheckSquare size={14} />;
|
|
15
|
+
const uncheckedIcon = <Square size={14} />;
|
|
16
|
+
|
|
17
|
+
const Checkbox = props => {
|
|
18
|
+
const {
|
|
19
|
+
ariaLabel,
|
|
20
|
+
classes: propClasses,
|
|
21
|
+
field,
|
|
22
|
+
fieldValue,
|
|
23
|
+
id,
|
|
24
|
+
label,
|
|
25
|
+
message,
|
|
26
|
+
...rest
|
|
27
|
+
} = props;
|
|
28
|
+
const fieldApi = useFieldApi(field);
|
|
29
|
+
const fieldState = useFieldState(field);
|
|
30
|
+
const classes = useStyle(defaultClasses, propClasses);
|
|
31
|
+
const icon = fieldState.value ? checkedIcon : uncheckedIcon;
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (fieldValue != null && fieldValue !== fieldState.value) {
|
|
35
|
+
fieldApi.setValue(fieldValue);
|
|
36
|
+
}
|
|
37
|
+
}, [fieldApi, fieldState.value, fieldValue]);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Fragment>
|
|
41
|
+
<label
|
|
42
|
+
data-cy="Checkbox-label"
|
|
43
|
+
aria-label={ariaLabel}
|
|
44
|
+
className={classes.root}
|
|
45
|
+
htmlFor={id}
|
|
46
|
+
>
|
|
47
|
+
<InformedCheckbox
|
|
48
|
+
{...rest}
|
|
49
|
+
className={classes.input}
|
|
50
|
+
field={field}
|
|
51
|
+
id={id}
|
|
52
|
+
/>
|
|
53
|
+
<span className={classes.icon}>{icon}</span>
|
|
54
|
+
<span className={classes.label}>{label}</span>
|
|
55
|
+
</label>
|
|
56
|
+
<Message fieldState={fieldState}>{message}</Message>
|
|
57
|
+
</Fragment>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default Checkbox;
|
|
62
|
+
|
|
63
|
+
Checkbox.propTypes = {
|
|
64
|
+
ariaLabel: string,
|
|
65
|
+
classes: shape({
|
|
66
|
+
icon: string,
|
|
67
|
+
input: string,
|
|
68
|
+
label: string,
|
|
69
|
+
message: string,
|
|
70
|
+
root: string
|
|
71
|
+
}),
|
|
72
|
+
field: string.isRequired,
|
|
73
|
+
id: string,
|
|
74
|
+
label: node.isRequired,
|
|
75
|
+
message: node
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/* eslint-enable jsx-a11y/label-has-for */
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
--stroke: var(--venia-global-color-gray-600);
|
|
3
|
+
|
|
4
|
+
composes: gap-[8px] from global;
|
|
5
|
+
composes: grid from global;
|
|
6
|
+
composes: grid-flow-col from global;
|
|
7
|
+
composes: items-center from global;
|
|
8
|
+
composes: justify-items-center from global;
|
|
9
|
+
composes: leading-normal from global;
|
|
10
|
+
composes: text-colorDefault from global;
|
|
11
|
+
grid-template-areas: 'input label';
|
|
12
|
+
grid-template-columns: min-content 1fr;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.input {
|
|
16
|
+
composes: appearance-none from global;
|
|
17
|
+
composes: bg-transparent from global;
|
|
18
|
+
composes: border-1 from global;
|
|
19
|
+
composes: border-solid from global;
|
|
20
|
+
composes: border-transparent from global;
|
|
21
|
+
composes: cursor-pointer from global;
|
|
22
|
+
composes: h-[14px] from global;
|
|
23
|
+
composes: rounded from global;
|
|
24
|
+
composes: w-[14px] from global;
|
|
25
|
+
grid-area: input;
|
|
26
|
+
|
|
27
|
+
/* TODO @TW: review, replaces input:disabled. Check if working. */
|
|
28
|
+
composes: disabled_cursor-not-allowed from global;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.icon {
|
|
32
|
+
composes: h-[14px] from global;
|
|
33
|
+
composes: pointer-events-none from global;
|
|
34
|
+
composes: w-[14px] from global;
|
|
35
|
+
grid-area: input;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.icon svg {
|
|
39
|
+
stroke: rgb(var(--stroke));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.label {
|
|
43
|
+
composes: cursor-pointer from global;
|
|
44
|
+
composes: justify-self-start from global;
|
|
45
|
+
composes: text-colorDefault from global;
|
|
46
|
+
grid-area: label;
|
|
47
|
+
composes: text-[13px] from global;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* When the input is disabled, update the cursor on the sibling label element. */
|
|
51
|
+
/* TODO @TW: cannot compose */
|
|
52
|
+
.input:disabled~.label {
|
|
53
|
+
cursor: default;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.input:checked:enabled+.icon {
|
|
57
|
+
/* --stroke: var(--venia-brand-color-1-700); */
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* TODO @TW: cannot compose, needs "checked" variant enabled. Cannot combine variants. */
|
|
61
|
+
.input:active:enabled,
|
|
62
|
+
.input:focus:enabled {
|
|
63
|
+
/* composes: active_shadow-radioActive from global; */
|
|
64
|
+
/* composes: focus_shadow-radioFocus from global; */
|
|
65
|
+
/* box-shadow: -3px 3px rgb(var(--venia-brand-color-1-100)); */
|
|
66
|
+
/* outline: none; */
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.input_shimmer {
|
|
70
|
+
composes: h-[14px] from global;
|
|
71
|
+
composes: rounded from global;
|
|
72
|
+
composes: w-[14px] from global;
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './checkbox';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { shape, string, func } from 'prop-types';
|
|
4
|
+
import { X as Remove } from 'react-feather';
|
|
5
|
+
|
|
6
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
+
import Icon from '@magento/venia-ui/lib/components/Icon';
|
|
8
|
+
import Trigger from '@magento/venia-ui/lib/components/Trigger';
|
|
9
|
+
import defaultClasses from './currentFilter.module.css';
|
|
10
|
+
|
|
11
|
+
const CurrentFilter = props => {
|
|
12
|
+
const { group, item, removeItem, onRemove } = props;
|
|
13
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
14
|
+
const { formatMessage } = useIntl();
|
|
15
|
+
|
|
16
|
+
const handleClick = useCallback(() => {
|
|
17
|
+
removeItem({ group, item });
|
|
18
|
+
if (typeof onRemove === 'function') {
|
|
19
|
+
onRemove(group, item);
|
|
20
|
+
}
|
|
21
|
+
}, [group, item, removeItem, onRemove]);
|
|
22
|
+
|
|
23
|
+
const ariaLabel = formatMessage(
|
|
24
|
+
{
|
|
25
|
+
id: 'filterModal.action.clearFilterItem.ariaLabel',
|
|
26
|
+
defaultMessage: 'Clear filter "{name}"'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: item.label ? item.label : item.title
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<span className={classes.root} data-cy="CurrentFilter-root">
|
|
35
|
+
<Trigger
|
|
36
|
+
action={handleClick}
|
|
37
|
+
ariaLabel={ariaLabel}
|
|
38
|
+
data-cy="CurrentFilter-trigger"
|
|
39
|
+
>
|
|
40
|
+
<Icon size={20} src={Remove} />
|
|
41
|
+
</Trigger>
|
|
42
|
+
<span className={classes.text}>
|
|
43
|
+
{item.label ? item.label : item.title}
|
|
44
|
+
</span>
|
|
45
|
+
</span>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default CurrentFilter;
|
|
50
|
+
|
|
51
|
+
CurrentFilter.defaultProps = {
|
|
52
|
+
onRemove: null
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
CurrentFilter.propTypes = {
|
|
56
|
+
classes: shape({
|
|
57
|
+
root: string
|
|
58
|
+
}),
|
|
59
|
+
onRemove: func
|
|
60
|
+
};
|
package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilter.module.css
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
min-height: 24px;
|
|
3
|
+
composes: bg-blue-700 from global;
|
|
4
|
+
composes: font-semibold from global;
|
|
5
|
+
composes: gap-2xs from global;
|
|
6
|
+
composes: grid-flow-col from global;
|
|
7
|
+
composes: inline-grid from global;
|
|
8
|
+
composes: items-center from global;
|
|
9
|
+
composes: justify-center from global;
|
|
10
|
+
composes: px-2 from global;
|
|
11
|
+
composes: py-2 from global;
|
|
12
|
+
composes: rounded-md from global;
|
|
13
|
+
/* composes: text-white from global; */
|
|
14
|
+
composes: text-[13px] from global;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* TODO @TW: cannot compose */
|
|
18
|
+
.root svg {
|
|
19
|
+
/* composes: stroke-white from global; */
|
|
20
|
+
stroke: rgb(var(--venia-global-color-gray-600));
|
|
21
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { func, shape, string } from 'prop-types';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
|
|
5
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
|
+
import CurrentFilter from './currentFilter';
|
|
7
|
+
import defaultClasses from './currentFilters.module.css';
|
|
8
|
+
|
|
9
|
+
const CurrentFilters = props => {
|
|
10
|
+
const { filterApi, filterState, onRemove } = props;
|
|
11
|
+
const { removeItem } = filterApi;
|
|
12
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
13
|
+
const { formatMessage } = useIntl();
|
|
14
|
+
|
|
15
|
+
// create elements and params at the same time for efficiency
|
|
16
|
+
const filterElements = useMemo(() => {
|
|
17
|
+
const elements = [];
|
|
18
|
+
for (const [group, items] of filterState) {
|
|
19
|
+
for (const item of items) {
|
|
20
|
+
const { title, value } = item || {};
|
|
21
|
+
const key = `${group}::${title}_${value}`;
|
|
22
|
+
|
|
23
|
+
elements.push(
|
|
24
|
+
<li key={key} className={classes.item}>
|
|
25
|
+
<CurrentFilter
|
|
26
|
+
group={group}
|
|
27
|
+
item={item}
|
|
28
|
+
removeItem={removeItem}
|
|
29
|
+
onRemove={onRemove}
|
|
30
|
+
/>
|
|
31
|
+
</li>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return elements;
|
|
37
|
+
}, [classes.item, filterState, removeItem, onRemove]);
|
|
38
|
+
|
|
39
|
+
const currentFiltersAriaLabel = formatMessage({
|
|
40
|
+
id: 'filterModal.currentFilters.ariaLabel',
|
|
41
|
+
defaultMessage: 'Current Filters'
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<ul className={classes.root} aria-label={currentFiltersAriaLabel}>
|
|
46
|
+
{filterElements}
|
|
47
|
+
</ul>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
CurrentFilters.defaultProps = {
|
|
52
|
+
onRemove: null
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
CurrentFilters.propTypes = {
|
|
56
|
+
classes: shape({
|
|
57
|
+
root: string,
|
|
58
|
+
item: string,
|
|
59
|
+
button: string,
|
|
60
|
+
icon: string
|
|
61
|
+
}),
|
|
62
|
+
onRemove: func
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default CurrentFilters;
|
package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.module.css
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: px-[10px] from global;
|
|
3
|
+
composes: py-2 from global;
|
|
4
|
+
composes: overflow-auto from global;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* TODO @TW: cannot compose */
|
|
8
|
+
.root:empty {
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.item {
|
|
13
|
+
composes: float-left from global;
|
|
14
|
+
composes: pb-0 from global;
|
|
15
|
+
composes: pl-0 from global;
|
|
16
|
+
composes: pr-2 from global;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './currentFilters';
|
|
@@ -4,7 +4,7 @@ import { bool, shape, string } from 'prop-types';
|
|
|
4
4
|
|
|
5
5
|
import Checkbox from '@magento/venia-ui/lib/components/Checkbox';
|
|
6
6
|
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
-
import defaultClasses from '
|
|
7
|
+
import defaultClasses from './filterDefault.module.css';
|
|
8
8
|
import { useCurrencySwitcher } from '@magento/peregrine/lib/talons/Header/useCurrencySwitcher';
|
|
9
9
|
|
|
10
10
|
const FilterDefault = props => {
|
|
@@ -27,29 +27,29 @@ const FilterDefault = props => {
|
|
|
27
27
|
const currencySymbol = currencySymbolMap[currentCurrencyCode] != undefined ? currencySymbolMap[currentCurrencyCode] : currentCurrencyCode;
|
|
28
28
|
const title =
|
|
29
29
|
group === 'price'
|
|
30
|
-
?
|
|
30
|
+
? label.replace('-', ' - ')
|
|
31
31
|
: label;
|
|
32
32
|
const { formatMessage } = useIntl();
|
|
33
33
|
|
|
34
34
|
const ariaLabel = !isSelected
|
|
35
35
|
? formatMessage(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
{
|
|
37
|
+
id: 'filterModal.item.applyFilter',
|
|
38
|
+
defaultMessage: 'Apply filter "{optionName}".'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
optionName: label
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
44
|
: formatMessage(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
{
|
|
46
|
+
id: 'filterModal.item.clearFilter',
|
|
47
|
+
defaultMessage: 'Remove filter "{optionName}".'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
optionName: label
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
55
|
<Checkbox
|
package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterDefault.module.css
ADDED
|
File without changes
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { func, number, oneOfType, shape, string } from 'prop-types';
|
|
3
|
+
import setValidator from '@magento/peregrine/lib/validators/set';
|
|
4
|
+
|
|
5
|
+
import FilterDefault from './filterDefault';
|
|
6
|
+
|
|
7
|
+
const FilterItem = props => {
|
|
8
|
+
const { filterApi, filterState, group, item, onApply } = props;
|
|
9
|
+
const { toggleItem } = filterApi;
|
|
10
|
+
const { title, value } = item;
|
|
11
|
+
const isSelected = filterState && filterState.has(item);
|
|
12
|
+
|
|
13
|
+
// create and memoize an item that matches the tile interface
|
|
14
|
+
const tileItem = useMemo(
|
|
15
|
+
() => ({
|
|
16
|
+
label: title,
|
|
17
|
+
value_index: value
|
|
18
|
+
}),
|
|
19
|
+
[title, value]
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const handleClick = useCallback(
|
|
23
|
+
e => {
|
|
24
|
+
// use only left click for selection
|
|
25
|
+
if (e.button !== 0) return;
|
|
26
|
+
|
|
27
|
+
toggleItem({ group, item });
|
|
28
|
+
|
|
29
|
+
if (typeof onApply === 'function') {
|
|
30
|
+
onApply(group, item);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
[group, item, toggleItem, onApply]
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const handleKeyDown = useCallback(
|
|
37
|
+
e => {
|
|
38
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
toggleItem({ group, item });
|
|
41
|
+
if (typeof onApply === 'function') {
|
|
42
|
+
onApply(group, item);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
[group, item, onApply, toggleItem]
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<FilterDefault
|
|
51
|
+
isSelected={isSelected}
|
|
52
|
+
item={tileItem}
|
|
53
|
+
onMouseDown={handleClick}
|
|
54
|
+
onKeyDown={handleKeyDown}
|
|
55
|
+
group={group}
|
|
56
|
+
title={title}
|
|
57
|
+
value={value}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
FilterItem.defaultProps = {
|
|
63
|
+
onChange: null
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
FilterItem.propTypes = {
|
|
67
|
+
filterApi: shape({
|
|
68
|
+
toggleItem: func.isRequired
|
|
69
|
+
}).isRequired,
|
|
70
|
+
filterState: setValidator,
|
|
71
|
+
group: string.isRequired,
|
|
72
|
+
item: shape({
|
|
73
|
+
title: string.isRequired,
|
|
74
|
+
value: oneOfType([number, string]).isRequired
|
|
75
|
+
}).isRequired,
|
|
76
|
+
onChange: func
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default FilterItem;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { func, number, oneOfType, shape, string, instanceOf } from 'prop-types';
|
|
3
|
+
import Radio from '@magento/venia-ui/lib/components/RadioGroup/radio';
|
|
4
|
+
import defaultClasses from './filterItemRadio.module.css';
|
|
5
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
|
+
import { useIntl } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
const FilterItemRadio = props => {
|
|
9
|
+
const { filterApi, group, item, onApply, labels } = props;
|
|
10
|
+
const { removeGroup, toggleItem } = filterApi;
|
|
11
|
+
const { title, value } = item;
|
|
12
|
+
const classes = useStyle(defaultClasses);
|
|
13
|
+
const { formatMessage } = useIntl();
|
|
14
|
+
|
|
15
|
+
const label = item.label ? item.label : item.title;
|
|
16
|
+
|
|
17
|
+
const ariaLabel = formatMessage(
|
|
18
|
+
{
|
|
19
|
+
id: 'filterModal.item.applyFilter',
|
|
20
|
+
defaultMessage: 'Apply filter "{optionName}".'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
optionName: label
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const handleOnchange = useCallback(
|
|
28
|
+
e => {
|
|
29
|
+
removeGroup({ group });
|
|
30
|
+
if (e.target.value === item.value) {
|
|
31
|
+
toggleItem({ group, item });
|
|
32
|
+
}
|
|
33
|
+
if (typeof onApply === 'function') {
|
|
34
|
+
onApply(group, item);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
[group, item, onApply, removeGroup, toggleItem]
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const element = (
|
|
41
|
+
<Radio
|
|
42
|
+
classes={classes}
|
|
43
|
+
id={`item-${group}-${value}`}
|
|
44
|
+
label={title}
|
|
45
|
+
value={value}
|
|
46
|
+
onChange={handleOnchange}
|
|
47
|
+
data-cy="FilterDefault-radio"
|
|
48
|
+
ariaLabel={ariaLabel}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
labels.set(element, label);
|
|
53
|
+
|
|
54
|
+
return element;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
FilterItemRadio.defaultProps = {
|
|
58
|
+
onApply: null
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
FilterItemRadio.propTypes = {
|
|
62
|
+
filterApi: shape({
|
|
63
|
+
toggleItem: func.isRequired,
|
|
64
|
+
removeGroup: func.isRequired
|
|
65
|
+
}).isRequired,
|
|
66
|
+
group: string.isRequired,
|
|
67
|
+
item: shape({
|
|
68
|
+
title: string.isRequired,
|
|
69
|
+
value: oneOfType([number, string]).isRequired,
|
|
70
|
+
label: string
|
|
71
|
+
}).isRequired,
|
|
72
|
+
onApply: func,
|
|
73
|
+
labels: instanceOf(Map).isRequired
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default FilterItemRadio;
|
package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadio.module.css
ADDED
|
File without changes
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { useMemo, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
arrayOf,
|
|
4
|
+
func,
|
|
5
|
+
number,
|
|
6
|
+
oneOfType,
|
|
7
|
+
shape,
|
|
8
|
+
string,
|
|
9
|
+
instanceOf
|
|
10
|
+
} from 'prop-types';
|
|
11
|
+
import setValidator from '@magento/peregrine/lib/validators/set';
|
|
12
|
+
import RadioGroup from '@magento/venia-ui/lib/components/RadioGroup';
|
|
13
|
+
import FilterItemRadio from './filterItemRadio';
|
|
14
|
+
import { useFieldApi } from 'informed';
|
|
15
|
+
import useFieldState from '@magento/peregrine/lib/hooks/hook-wrappers/useInformedFieldStateWrapper';
|
|
16
|
+
|
|
17
|
+
const FilterItemRadioGroup = props => {
|
|
18
|
+
const { filterApi, filterState, group, items, onApply, labels } = props;
|
|
19
|
+
|
|
20
|
+
const radioItems = useMemo(() => {
|
|
21
|
+
return items.map(item => {
|
|
22
|
+
const code = `item-${group}-${item.value}`;
|
|
23
|
+
return (
|
|
24
|
+
<FilterItemRadio
|
|
25
|
+
key={code}
|
|
26
|
+
filterApi={filterApi}
|
|
27
|
+
filterState={filterState}
|
|
28
|
+
group={group}
|
|
29
|
+
item={item}
|
|
30
|
+
onApply={onApply}
|
|
31
|
+
labels={labels}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
}, [filterApi, filterState, group, items, labels, onApply]);
|
|
36
|
+
|
|
37
|
+
const fieldValue = useMemo(() => {
|
|
38
|
+
if (filterState) {
|
|
39
|
+
for (const item of items) {
|
|
40
|
+
if (filterState.has(item)) {
|
|
41
|
+
return item.value;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return null;
|
|
47
|
+
}, [filterState, items]);
|
|
48
|
+
const field = `item-${group}`;
|
|
49
|
+
const fieldApi = useFieldApi(field);
|
|
50
|
+
const fieldState = useFieldState(field);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (field && fieldValue === null) {
|
|
53
|
+
fieldApi.reset();
|
|
54
|
+
} else if (field && fieldValue !== fieldState.value) {
|
|
55
|
+
fieldApi.setValue(fieldValue);
|
|
56
|
+
}
|
|
57
|
+
}, [field, fieldApi, fieldState.value, fieldValue]);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<RadioGroup field={field} data-cy="FilterDefault-radioGroup">
|
|
61
|
+
{radioItems}
|
|
62
|
+
</RadioGroup>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
FilterItemRadioGroup.defaultProps = {
|
|
67
|
+
onApply: null
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
FilterItemRadioGroup.propTypes = {
|
|
71
|
+
filterApi: shape({
|
|
72
|
+
toggleItem: func.isRequired
|
|
73
|
+
}).isRequired,
|
|
74
|
+
filterState: setValidator,
|
|
75
|
+
group: string.isRequired,
|
|
76
|
+
items: arrayOf(
|
|
77
|
+
shape({
|
|
78
|
+
title: string.isRequired,
|
|
79
|
+
value: oneOfType([number, string]).isRequired
|
|
80
|
+
})
|
|
81
|
+
).isRequired,
|
|
82
|
+
onApply: func,
|
|
83
|
+
labels: instanceOf(Map).isRequired
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default FilterItemRadioGroup;
|