@uncinc/uncinc-react-kitchen-sink 2.3.5 → 2.4.0
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/dist/Context/ViewportContext.js +5 -5
- package/dist/components/AbbreviationAnnotation/stories.js +1 -1
- package/dist/components/AbbreviationAnnotation/stories.scss +1 -1
- package/dist/components/AbbreviationAnnotation/style.scss +0 -2
- package/dist/components/Accordion/AccordionItem/index.js +1 -0
- package/dist/components/Accordion/stories.js +1 -1
- package/dist/components/ApiAutocomplete/stories.js +1 -1
- package/dist/components/Button/index.js +11 -7
- package/dist/components/Button/stories.js +1 -1
- package/dist/components/Cookie/Checkbox/index.js +1 -1
- package/dist/components/Cookie/index.js +28 -13
- package/dist/components/Cookie/stories.js +16 -16
- package/dist/components/Dialog/index.js +89 -0
- package/dist/components/Dialog/stories.js +28 -0
- package/dist/components/Dialog/style.scss +72 -0
- package/dist/components/FontSizeSwitcher/index.js +10 -4
- package/dist/components/FontSizeSwitcher/stories.js +1 -1
- package/dist/components/Form/Checkbox/index.js +1 -1
- package/dist/components/Form/Checkboxes/index.js +1 -1
- package/dist/components/Form/Checkboxes/index.test.js +1 -1
- package/dist/components/Form/DatePicker/index.js +3 -3
- package/dist/components/Form/DateSelect/index.js +3 -4
- package/dist/components/Form/DateSelect/stories.js +1 -1
- package/dist/components/Form/GenericFormElement/index.js +2 -2
- package/dist/components/Form/Number/index.js +1 -1
- package/dist/components/Form/SearchField/index.js +2 -2
- package/dist/components/Form/Select/Input/index.js +21 -23
- package/dist/components/Form/Select/index.js +1 -1
- package/dist/components/Form/TextField/index.js +2 -2
- package/dist/components/Form/TextField/index.test.js +1 -1
- package/dist/components/Form/TextField/stories.js +1 -1
- package/dist/components/Form/Textarea/index.js +1 -1
- package/dist/components/Hamburger/stories.js +3 -3
- package/dist/components/Header/index.js +3 -3
- package/dist/components/Header/stories.js +1 -1
- package/dist/components/Image/Picture/index.js +0 -1
- package/dist/components/Image/stories.js +9 -9
- package/dist/components/InlineMenu/index.js +2 -4
- package/dist/components/InlineMenu/stories.js +1 -1
- package/dist/components/Layout/Container/stories.js +29 -29
- package/dist/components/Layout/QuickLayout/stories.js +1 -1
- package/dist/components/Lottie/LottieAnimation/index.js +21 -17
- package/dist/components/Lottie/LottieAnimationWithMousePosition.js +4 -4
- package/dist/components/Lottie/index.js +3 -2
- package/dist/components/Lottie/stories.js +1 -1
- package/dist/components/MagicLine/index.js +3 -3
- package/dist/components/MagicLine/stories.js +4 -4
- package/dist/components/NavigationScroll/index.js +8 -11
- package/dist/components/NavigationScroll/stories.js +1 -1
- package/dist/components/Pagination/index.js +6 -0
- package/dist/components/Pagination/stories.js +11 -11
- package/dist/components/SearchKit/Facets/ChipFacet/index.js +1 -1
- package/dist/components/SearchKit/Facets/ListFacet/index.js +1 -0
- package/dist/components/SearchKit/Facets/SelectFacet/index.js +2 -2
- package/dist/components/SearchKit/SearchFacets/index.js +1 -3
- package/dist/components/SearchKit/SearchField/index.js +4 -4
- package/dist/components/SearchKit/SearchPage/index.js +9 -2
- package/dist/components/SearchKit/SearchReset/index.js +20 -8
- package/dist/components/SearchKit/SearchResults/index.js +10 -6
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/CustomValue/index.js +15 -0
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/DateRange/index.js +17 -0
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/NumericRange/index.js +17 -0
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/Value/index.js +19 -0
- package/dist/components/SearchKit/SearchSelectedFilters/index.js +30 -23
- package/dist/components/SearchKit/SearchSelectedFilters/style.scss +4 -0
- package/dist/components/SearchKit/SearchSorting/index.js +1 -1
- package/dist/components/SearchKit/index.js +10 -3
- package/dist/components/SearchKit/stories.js +83 -77
- package/dist/components/Share/index.js +4 -4
- package/dist/components/Share/stories.js +1 -1
- package/dist/components/Sliders/SliderRelated/index.js +1 -1
- package/dist/components/Sliders/SliderRelated/stories.js +13 -13
- package/dist/components/Webform/WebformDate/index.js +5 -4
- package/dist/components/Webform/WebformNumber/index.js +1 -1
- package/dist/components/Webform/WebformTextField/index.js +1 -1
- package/dist/components/Webform/stories.actions.js +17 -17
- package/dist/components/Webform/stories.checkboxes.js +22 -22
- package/dist/components/Webform/stories.checked.js +35 -35
- package/dist/components/Webform/stories.container.js +29 -29
- package/dist/components/Webform/stories.date.js +17 -17
- package/dist/components/Webform/stories.filled.js +35 -35
- package/dist/components/Webform/stories.number.js +18 -18
- package/dist/components/Webform/stories.radiobuttons.js +22 -22
- package/dist/components/Webform/stories.select.js +22 -22
- package/dist/components/Webform/stories.textarea.js +1 -1
- package/dist/components/Webform/stories.textfield.js +1 -1
- package/dist/components/Webform/stories.wizard.js +115 -115
- package/dist/components/WysiwygField/index.js +0 -1
- package/dist/components/WysiwygField/stories.js +2 -2
- package/dist/config/i18next/locales/en.json +4 -0
- package/dist/config/i18next/locales/nl.json +7 -0
- package/dist/helpers/date.js +8 -0
- package/dist/hooks/useBoolean.ts +20 -0
- package/dist/hooks/useClickOutside.ts +38 -0
- package/dist/hooks/useDialog.ts +29 -0
- package/dist/hooks/useDialogHelpers.ts +95 -0
- package/dist/hooks/useEscape.ts +26 -0
- package/dist/hooks/usePrevious.js +1 -2
- package/dist/hooks/useTrapFocus.ts +80 -0
- package/dist/index.js +1 -0
- package/package.json +39 -17
- package/dist/components/Form/SearchField/stories.js +0 -0
- package/dist/components/SearchKit/Facets/HierarchicalFilterFacet/index.js +0 -60
- package/dist/components/SearchKit/Facets/HierarchicalMenuFacet/index.js +0 -60
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSearchkit } from '@searchkit/client';
|
|
3
|
-
import Button from '../../../Button';
|
|
4
3
|
import classNames from 'classnames';
|
|
4
|
+
import Button from '../../../Button';
|
|
5
5
|
const makeSafeForCSS = value => {
|
|
6
6
|
return encodeURIComponent(value).replace(/\.|%[0-9a-z]{2}/gi, '');
|
|
7
7
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSearchkit, useSearchkitVariables } from '@searchkit/client';
|
|
3
|
-
import Select from '../../../Form/Select';
|
|
4
|
-
import FormikWrapper from '../../../Form/FormikWrapper';
|
|
5
3
|
import { useTranslation } from 'react-i18next';
|
|
6
4
|
import classNames from 'classnames';
|
|
5
|
+
import Select from '../../../Form/Select';
|
|
6
|
+
import FormikWrapper from '../../../Form/FormikWrapper';
|
|
7
7
|
const useInitialValues = () => {
|
|
8
8
|
const parsed = useSearchkitVariables();
|
|
9
9
|
const filters = {};
|
|
@@ -2,10 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { SelectFacet } from '../Facets/SelectFacet';
|
|
3
3
|
import { ListFacet } from '../Facets/ListFacet';
|
|
4
4
|
import { ChipFacet } from '../Facets/ChipFacet';
|
|
5
|
-
import { HierarchicalFilterFacet } from '../Facets/HierarchicalFilterFacet';
|
|
6
|
-
import { HierarchicalMenuFacet } from '../Facets/HierarchicalMenuFacet';
|
|
7
5
|
const FacetList = (components = []) => {
|
|
8
|
-
const FacetsMapper = [
|
|
6
|
+
const FacetsMapper = [SelectFacet, ChipFacet, ListFacet, ...components].reduce((sum, component) => {
|
|
9
7
|
sum[component.DISPLAY] = component;
|
|
10
8
|
return sum;
|
|
11
9
|
}, {});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useRef } from
|
|
2
|
-
import { useSearchkit, useSearchkitQueryValue } from
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { useSearchkit, useSearchkitQueryValue } from '@searchkit/client';
|
|
3
3
|
import FormikWrapper from '../../Form/FormikWrapper';
|
|
4
4
|
import Button from '../../Button';
|
|
5
5
|
import TextField from '../../Form/TextField';
|
|
@@ -42,7 +42,7 @@ const SearchField = ({
|
|
|
42
42
|
displayRequiredIndicator: "required",
|
|
43
43
|
enableReinitialize: true,
|
|
44
44
|
onSubmit: onSubmit
|
|
45
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
45
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextField, {
|
|
46
46
|
fieldName: "query",
|
|
47
47
|
title: fieldLabel,
|
|
48
48
|
placeholder: placeholder,
|
|
@@ -50,7 +50,7 @@ const SearchField = ({
|
|
|
50
50
|
}), !autoSearch && /*#__PURE__*/React.createElement(Button, {
|
|
51
51
|
type: "submit",
|
|
52
52
|
primary: true
|
|
53
|
-
}, buttonText));
|
|
53
|
+
}, buttonText)));
|
|
54
54
|
};
|
|
55
55
|
SearchField.defaultProps = {
|
|
56
56
|
timeout: 1000,
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import c from 'classnames';
|
|
2
3
|
import { withSearchkitRouting } from '@searchkit/client';
|
|
3
|
-
import { EuiPage } from '@elastic/eui';
|
|
4
4
|
const SearchPage = ({
|
|
5
|
+
className,
|
|
5
6
|
children
|
|
6
|
-
}) =>
|
|
7
|
+
}) => {
|
|
8
|
+
// Adding euiPage className for backwards compatibility.
|
|
9
|
+
const classNames = c('euiPage', className);
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: classNames
|
|
12
|
+
}, children);
|
|
13
|
+
};
|
|
7
14
|
export const routeToStateFn = routeState => {
|
|
8
15
|
const value = {
|
|
9
16
|
query: routeState.query || '',
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
+
import { useSearchkit } from '@searchkit/client';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import Button from '../../Button';
|
|
3
6
|
const SearchReset = ({
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
loading,
|
|
8
|
+
children,
|
|
9
|
+
...props
|
|
6
10
|
}) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const {
|
|
12
|
+
t
|
|
13
|
+
} = useTranslation();
|
|
14
|
+
const api = useSearchkit();
|
|
15
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
16
|
+
htmlType: "button",
|
|
17
|
+
className: "SearchSorting",
|
|
18
|
+
disabled: !api.canResetSearch() || loading,
|
|
19
|
+
onClick: () => {
|
|
20
|
+
api.setQuery('');
|
|
21
|
+
api.search();
|
|
22
|
+
}
|
|
23
|
+
}, props), children || t('searchkit.reset_search', 'Reset search'));
|
|
12
24
|
};
|
|
13
25
|
export default SearchReset;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import usePrevious from '../../../hooks/usePrevious';
|
|
3
2
|
import { useSearchkitVariables } from '@searchkit/client';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import usePrevious from '../../../hooks/usePrevious';
|
|
5
5
|
const SearchResultItemDefault = ({
|
|
6
6
|
item
|
|
7
7
|
}) => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, item.fields.title[0]));
|
|
@@ -24,12 +24,14 @@ const SearchResults = ({
|
|
|
24
24
|
const [previousActiveFilters, setPreviousActiveFilters] = useState(variables.filters);
|
|
25
25
|
const [previousSortBy, setPreviousSortBy] = useState(variables.sortBy);
|
|
26
26
|
const [searchResultItems, setSearchResultItems] = useState( /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
27
|
-
const [currentData, setCurrentData] = useState(
|
|
27
|
+
const [currentData, setCurrentData] = useState('');
|
|
28
28
|
const previousPage = usePrevious(currentPage);
|
|
29
29
|
const previousItems = usePrevious(items);
|
|
30
30
|
useEffect(() => {
|
|
31
|
-
if (typeof data.results === 'undefined')
|
|
32
|
-
|
|
31
|
+
if (!data || typeof data.results === 'undefined') {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
setCurrentPage(data.results.hits?.page?.pageNumber || 0);
|
|
33
35
|
setPreviousQuery(variables.query);
|
|
34
36
|
setPreviousSortBy(variables.sortBy);
|
|
35
37
|
setPreviousActiveFilters(variables.filters);
|
|
@@ -71,8 +73,10 @@ const SearchResults = ({
|
|
|
71
73
|
|
|
72
74
|
// Scroll to top on every page.
|
|
73
75
|
useEffect(() => {
|
|
74
|
-
if (typeof data.results === 'undefined')
|
|
75
|
-
|
|
76
|
+
if (!data || typeof data.results === 'undefined') {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const currentPageNumber = data.results.hits?.page?.pageNumber || 0;
|
|
76
80
|
if (appendResults === false && scrollView && scrollView.current && currentPageNumber !== 0) {
|
|
77
81
|
scrollView.current.scrollIntoView({
|
|
78
82
|
behavior: 'smooth',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSearchkit } from '@searchkit/client';
|
|
3
|
+
import Button from '../../../../Button';
|
|
4
|
+
const CustomValueFilter = ({
|
|
5
|
+
filter
|
|
6
|
+
}) => {
|
|
7
|
+
const api = useSearchkit();
|
|
8
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
9
|
+
onClick: () => {
|
|
10
|
+
api.removeFilter(filter);
|
|
11
|
+
api.search();
|
|
12
|
+
}
|
|
13
|
+
}, filter.label, ": ", filter.value);
|
|
14
|
+
};
|
|
15
|
+
export default CustomValueFilter;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSearchkit } from '@searchkit/client';
|
|
3
|
+
import Button from '../../../../Button';
|
|
4
|
+
const DateRangeFilter = ({
|
|
5
|
+
filter,
|
|
6
|
+
loading
|
|
7
|
+
}) => {
|
|
8
|
+
const api = useSearchkit();
|
|
9
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
10
|
+
disabled: loading,
|
|
11
|
+
onClick: () => {
|
|
12
|
+
api.removeFilter(filter);
|
|
13
|
+
api.search();
|
|
14
|
+
}
|
|
15
|
+
}, filter.label, ": ", new Date(filter.dateMin).toDateString(), " -", ' ', new Date(filter.dateMax).toDateString());
|
|
16
|
+
};
|
|
17
|
+
export default DateRangeFilter;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSearchkit } from '@searchkit/client';
|
|
3
|
+
import Button from '../../../../Button';
|
|
4
|
+
const NumericRangeFilter = ({
|
|
5
|
+
filter,
|
|
6
|
+
loading
|
|
7
|
+
}) => {
|
|
8
|
+
const api = useSearchkit();
|
|
9
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
10
|
+
disabled: loading,
|
|
11
|
+
onClick: () => {
|
|
12
|
+
api.removeFilter(filter);
|
|
13
|
+
api.search();
|
|
14
|
+
}
|
|
15
|
+
}, filter.label, ": ", filter.min, " - ", filter.max);
|
|
16
|
+
};
|
|
17
|
+
export default NumericRangeFilter;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { FilterLink } from '@searchkit/client';
|
|
3
|
+
import Button from '../../../../Button';
|
|
4
|
+
const ValueFilter = ({
|
|
5
|
+
filter,
|
|
6
|
+
loading
|
|
7
|
+
}) => {
|
|
8
|
+
const ref = useRef();
|
|
9
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
10
|
+
disabled: loading,
|
|
11
|
+
onClick: e => {
|
|
12
|
+
ref.current.onClick(e);
|
|
13
|
+
}
|
|
14
|
+
}, /*#__PURE__*/React.createElement(FilterLink, {
|
|
15
|
+
ref: ref,
|
|
16
|
+
filter: filter
|
|
17
|
+
}, filter.label, ": ", filter.value));
|
|
18
|
+
};
|
|
19
|
+
export default ValueFilter;
|
|
@@ -1,37 +1,44 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import CustomValueFilter from './Filters/CustomValue';
|
|
3
|
+
import DateRangeFilter from './Filters/DateRange';
|
|
4
|
+
import NumericRangeFilter from './Filters/NumericRange';
|
|
5
|
+
import ValueFilter from './Filters/Value';
|
|
6
|
+
import './style.scss';
|
|
5
7
|
const SearchSelectedFilters = ({
|
|
6
8
|
data,
|
|
7
9
|
loading
|
|
8
10
|
}) => {
|
|
9
|
-
const ValueFilter = ({
|
|
10
|
-
filter,
|
|
11
|
-
loading
|
|
12
|
-
}) => {
|
|
13
|
-
const api = useSearchkit();
|
|
14
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
15
|
-
onClick: () => {
|
|
16
|
-
api.removeFilter(filter);
|
|
17
|
-
api.search();
|
|
18
|
-
}
|
|
19
|
-
}, filter.label, ": ", filter.value);
|
|
20
|
-
};
|
|
21
11
|
if (!data) {
|
|
22
12
|
return null;
|
|
23
13
|
}
|
|
14
|
+
const {
|
|
15
|
+
results
|
|
16
|
+
} = data;
|
|
17
|
+
|
|
18
|
+
// All filter components are copies of Searchkit's own filters, recreated within our library.
|
|
19
|
+
// Only the CustomValueFilter is a completely custom filter, written by us. Hence the name.
|
|
20
|
+
const filterComponentMap = {
|
|
21
|
+
ListFacet: CustomValueFilter,
|
|
22
|
+
RangeSliderFacet: NumericRangeFilter,
|
|
23
|
+
DateRangeFacet: DateRangeFilter,
|
|
24
|
+
ComboBoxFacet: ValueFilter,
|
|
25
|
+
HierarchicalMenuFacet: ValueFilter,
|
|
26
|
+
SelectFacet: CustomValueFilter,
|
|
27
|
+
ChipFacet: CustomValueFilter,
|
|
28
|
+
HierarchicalFilterFacet: CustomValueFilter
|
|
29
|
+
};
|
|
24
30
|
return /*#__PURE__*/React.createElement("div", {
|
|
25
31
|
className: "SearchSelectedFilters"
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
SelectFacet: ValueFilter,
|
|
31
|
-
ListFacet: ValueFilter,
|
|
32
|
-
ChipFacet: ValueFilter,
|
|
33
|
-
HierarchicalFilterFacet: ValueFilter
|
|
32
|
+
}, results?.summary?.appliedFilters.map(filter => {
|
|
33
|
+
const FilterComponent = filterComponentMap[filter.display] || ValueFilter;
|
|
34
|
+
if (!filterComponentMap[filter.display]) {
|
|
35
|
+
throw new Error(`could not display selected filters for ${filter.identifier} facet. Use customFilterComponents prop to pass a component to handle this filter for ${filter.display} display`);
|
|
34
36
|
}
|
|
37
|
+
return /*#__PURE__*/React.createElement(FilterComponent, {
|
|
38
|
+
filter: filter,
|
|
39
|
+
loading: loading,
|
|
40
|
+
key: filter.id
|
|
41
|
+
});
|
|
35
42
|
}));
|
|
36
43
|
};
|
|
37
44
|
export default SearchSelectedFilters;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { useEffect, useState, useMemo } from 'react';
|
|
2
|
-
import Query from './Query';
|
|
3
2
|
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
|
|
4
3
|
import { SearchkitProvider, SearchkitClient } from '@searchkit/client';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import Query from './Query';
|
|
6
6
|
import SearchField from './SearchField';
|
|
7
7
|
import SearchPagination from './SearchPagination';
|
|
8
8
|
import SearchResults from './SearchResults';
|
|
9
9
|
import SearchFacets from './SearchFacets';
|
|
10
|
-
import SearchSelectedFilters from './
|
|
10
|
+
import SearchSelectedFilters from './SearchSelectedFilters';
|
|
11
11
|
const defaultChildren = (data, loading) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchField, null), /*#__PURE__*/React.createElement(SearchFacets, {
|
|
12
12
|
data: data,
|
|
13
13
|
loading: loading
|
|
@@ -59,7 +59,6 @@ const SearchKit = ({
|
|
|
59
59
|
}, (data, loading) => children ? children(data, loading) : defaultChildren(data, loading))));
|
|
60
60
|
};
|
|
61
61
|
SearchKit.propTypes = {
|
|
62
|
-
queryString: PropTypes.string,
|
|
63
62
|
uri: PropTypes.string,
|
|
64
63
|
pageSize: PropTypes.number,
|
|
65
64
|
useRouting: PropTypes.bool,
|
|
@@ -67,4 +66,12 @@ SearchKit.propTypes = {
|
|
|
67
66
|
defaultQuery: PropTypes.string,
|
|
68
67
|
defaultSorting: PropTypes.string
|
|
69
68
|
};
|
|
69
|
+
SearchKit.defaultProps = {
|
|
70
|
+
uri: null,
|
|
71
|
+
pageSize: null,
|
|
72
|
+
useRouting: null,
|
|
73
|
+
defaultFilters: null,
|
|
74
|
+
defaultQuery: null,
|
|
75
|
+
defaultSorting: null
|
|
76
|
+
};
|
|
70
77
|
export default SearchKit;
|
|
@@ -14,77 +14,82 @@ export default {
|
|
|
14
14
|
title: 'Molecules/SearchKit'
|
|
15
15
|
};
|
|
16
16
|
const query = `
|
|
17
|
-
query
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
appliedFilters {
|
|
26
|
-
id
|
|
27
|
-
identifier
|
|
28
|
-
display
|
|
29
|
-
label
|
|
30
|
-
... on HierarchicalValueSelectedFilter {
|
|
31
|
-
level
|
|
32
|
-
value
|
|
33
|
-
}
|
|
34
|
-
... on DateRangeSelectedFilter {
|
|
35
|
-
dateMin
|
|
36
|
-
dateMax
|
|
17
|
+
query contentResultSet($query: String, $filters: [SKFiltersSet], $page: SKPageInput, $sortBy: String) {
|
|
18
|
+
content {
|
|
19
|
+
results(query: $query, filters: $filters) {
|
|
20
|
+
summary {
|
|
21
|
+
total
|
|
22
|
+
sortOptions {
|
|
23
|
+
id
|
|
24
|
+
label
|
|
37
25
|
}
|
|
26
|
+
appliedFilters {
|
|
27
|
+
id
|
|
28
|
+
identifier
|
|
29
|
+
display
|
|
30
|
+
label
|
|
31
|
+
... on DateRangeSelectedFilter {
|
|
32
|
+
dateMin
|
|
33
|
+
dateMax
|
|
34
|
+
}
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
... on NumericRangeSelectedFilter {
|
|
37
|
+
min
|
|
38
|
+
max
|
|
39
|
+
}
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
... on ValueSelectedFilter {
|
|
42
|
+
value
|
|
43
|
+
}
|
|
46
44
|
}
|
|
45
|
+
query
|
|
47
46
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
hits(page: $page, sortBy: $sortBy) {
|
|
48
|
+
sortedBy
|
|
49
|
+
page {
|
|
50
|
+
total
|
|
51
|
+
totalPages
|
|
52
|
+
pageNumber
|
|
53
|
+
from
|
|
54
|
+
size
|
|
55
|
+
}
|
|
56
|
+
items {
|
|
57
|
+
id
|
|
58
|
+
... on ContentResultHit {
|
|
59
|
+
fields {
|
|
60
|
+
nid
|
|
61
|
+
title
|
|
62
|
+
type
|
|
63
|
+
summary
|
|
64
|
+
milestone_summary
|
|
65
|
+
url
|
|
66
|
+
author_name
|
|
67
|
+
created
|
|
68
|
+
image_style_uri
|
|
69
|
+
field_article_type_name
|
|
70
|
+
field_download_type_name
|
|
71
|
+
field_elearning_type_name
|
|
72
|
+
field_event_type_name
|
|
73
|
+
field_intervention_type_name
|
|
74
|
+
field_research_type_name
|
|
75
|
+
field_practicalexample_type_name
|
|
76
|
+
field_tool_type_name
|
|
77
|
+
field_publication_date
|
|
78
|
+
field_domain_access
|
|
79
|
+
field_milestone_label
|
|
80
|
+
combined_types
|
|
81
|
+
}
|
|
66
82
|
}
|
|
67
83
|
}
|
|
68
84
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
type
|
|
73
|
-
label
|
|
74
|
-
display
|
|
75
|
-
entries {
|
|
85
|
+
facets {
|
|
86
|
+
identifier
|
|
87
|
+
type
|
|
76
88
|
label
|
|
77
|
-
|
|
78
|
-
level
|
|
89
|
+
display
|
|
79
90
|
entries {
|
|
80
91
|
label
|
|
81
92
|
count
|
|
82
|
-
level
|
|
83
|
-
entries {
|
|
84
|
-
label
|
|
85
|
-
count
|
|
86
|
-
level
|
|
87
|
-
}
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
95
|
}
|
|
@@ -101,22 +106,22 @@ export const Default = () => /*#__PURE__*/React.createElement(SearchKit, {
|
|
|
101
106
|
uri: "http://localhost:4000/api/graphql",
|
|
102
107
|
query: query
|
|
103
108
|
}, (data, loading) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchField, null), /*#__PURE__*/React.createElement(SearchFacets, {
|
|
104
|
-
data: data,
|
|
109
|
+
data: data?.content,
|
|
105
110
|
loading: loading
|
|
106
111
|
}), /*#__PURE__*/React.createElement(SearchSelectedFilters, {
|
|
107
|
-
data: data,
|
|
112
|
+
data: data?.content,
|
|
108
113
|
loading: loading
|
|
109
114
|
}), /*#__PURE__*/React.createElement(SearchSorting, {
|
|
110
|
-
data: data,
|
|
115
|
+
data: data?.content,
|
|
111
116
|
loading: loading
|
|
112
117
|
}), /*#__PURE__*/React.createElement(SearchReset, {
|
|
113
118
|
loading: loading
|
|
114
119
|
}), /*#__PURE__*/React.createElement(SearchResults, {
|
|
115
|
-
data: data,
|
|
120
|
+
data: data?.content,
|
|
116
121
|
renderItem: SearchItem,
|
|
117
122
|
renderHeader: SearchHeader
|
|
118
123
|
}), /*#__PURE__*/React.createElement(SearchPagination, {
|
|
119
|
-
data: data
|
|
124
|
+
data: data?.content
|
|
120
125
|
})));
|
|
121
126
|
const ListFacet = ({
|
|
122
127
|
facet
|
|
@@ -156,23 +161,23 @@ export const CustomFacets = () => {
|
|
|
156
161
|
uri: "http://localhost:4000/api/graphql",
|
|
157
162
|
query: query
|
|
158
163
|
}, (data, loading) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchField, null), /*#__PURE__*/React.createElement(SearchFacets, {
|
|
159
|
-
data: data,
|
|
164
|
+
data: data?.content,
|
|
160
165
|
loading: loading,
|
|
161
166
|
facets: customFacets
|
|
162
167
|
}), /*#__PURE__*/React.createElement(SearchSelectedFilters, {
|
|
163
|
-
data: data,
|
|
168
|
+
data: data?.content,
|
|
164
169
|
loading: loading
|
|
165
170
|
}), /*#__PURE__*/React.createElement(SearchSorting, {
|
|
166
|
-
data: data,
|
|
171
|
+
data: data?.content,
|
|
167
172
|
loading: loading
|
|
168
173
|
}), /*#__PURE__*/React.createElement(SearchReset, {
|
|
169
174
|
loading: loading
|
|
170
175
|
}), /*#__PURE__*/React.createElement(SearchResults, {
|
|
171
|
-
data: data,
|
|
176
|
+
data: data?.content,
|
|
172
177
|
renderItem: SearchItem,
|
|
173
178
|
renderHeader: SearchHeader
|
|
174
179
|
}), /*#__PURE__*/React.createElement(SearchPagination, {
|
|
175
|
-
data: data
|
|
180
|
+
data: data?.content
|
|
176
181
|
})));
|
|
177
182
|
};
|
|
178
183
|
export const Test = () => {
|
|
@@ -190,11 +195,11 @@ export const Test = () => {
|
|
|
190
195
|
}],
|
|
191
196
|
searchQuery: q
|
|
192
197
|
}, (data, loading) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchResults, {
|
|
193
|
-
data: data,
|
|
198
|
+
data: data?.content,
|
|
194
199
|
renderItem: SearchItem,
|
|
195
200
|
renderHeader: SearchHeader
|
|
196
201
|
}), /*#__PURE__*/React.createElement(SearchPagination, {
|
|
197
|
-
data: data
|
|
202
|
+
data: data?.content
|
|
198
203
|
}))), /*#__PURE__*/React.createElement(SearchKit, {
|
|
199
204
|
uri: "http://localhost:4000/api/graphql",
|
|
200
205
|
query: query,
|
|
@@ -205,11 +210,11 @@ export const Test = () => {
|
|
|
205
210
|
}],
|
|
206
211
|
searchQuery: q
|
|
207
212
|
}, (data, loading) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchResults, {
|
|
208
|
-
data: data,
|
|
213
|
+
data: data?.content,
|
|
209
214
|
renderItem: SearchItem,
|
|
210
215
|
renderHeader: SearchHeader
|
|
211
216
|
}), /*#__PURE__*/React.createElement(SearchPagination, {
|
|
212
|
-
data: data
|
|
217
|
+
data: data?.content
|
|
213
218
|
}))));
|
|
214
219
|
};
|
|
215
220
|
export const LoadMore = () => {
|
|
@@ -223,20 +228,21 @@ export const LoadMore = () => {
|
|
|
223
228
|
}, (data, loading) => {
|
|
224
229
|
const toggleFilter = () => {
|
|
225
230
|
api.toggleFilter({
|
|
226
|
-
identifier:
|
|
227
|
-
value:
|
|
231
|
+
identifier: 'type',
|
|
232
|
+
value: '22'
|
|
228
233
|
});
|
|
229
234
|
api.search();
|
|
230
235
|
};
|
|
231
236
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
237
|
+
type: "button",
|
|
232
238
|
onClick: toggleFilter
|
|
233
239
|
}, "Toggle"), /*#__PURE__*/React.createElement(SearchResults, {
|
|
234
|
-
data: data,
|
|
240
|
+
data: data?.content,
|
|
235
241
|
renderItem: SearchItem,
|
|
236
242
|
renderHeader: SearchHeader,
|
|
237
243
|
appendResults: true
|
|
238
244
|
}), /*#__PURE__*/React.createElement(SearchLoadMore, {
|
|
239
|
-
data: data
|
|
245
|
+
data: data?.content
|
|
240
246
|
}));
|
|
241
247
|
});
|
|
242
248
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { EmailShareButton, FacebookShareButton, LinkedinShareButton, TwitterShareButton, WhatsappShareButton } from
|
|
2
|
+
import { EmailShareButton, FacebookShareButton, LinkedinShareButton, TwitterShareButton, WhatsappShareButton } from 'react-share';
|
|
3
3
|
import './style.scss';
|
|
4
4
|
const ShareButton = ({
|
|
5
5
|
type,
|
|
@@ -55,10 +55,10 @@ const Share = ({
|
|
|
55
55
|
}, buttons)));
|
|
56
56
|
};
|
|
57
57
|
Share.defaultProps = {
|
|
58
|
-
title:
|
|
59
|
-
pageTitle:
|
|
58
|
+
title: 'Share this page:',
|
|
59
|
+
pageTitle: '',
|
|
60
60
|
url: null,
|
|
61
|
-
items: [
|
|
61
|
+
items: ['mail', 'facebook', 'linkedin', 'twitter', 'whatsapp'],
|
|
62
62
|
onClick: () => {}
|
|
63
63
|
};
|
|
64
64
|
export default Share;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import Slider from
|
|
3
|
+
import Slider from 'react-slick';
|
|
4
4
|
import useValueForCurrentViewPort from '../../../helpers/useValueForCurrentViewPort';
|
|
5
5
|
import './style.scss';
|
|
6
6
|
const SliderNextArrow = ({
|