@uncinc/uncinc-react-kitchen-sink 2.2.8 → 2.2.11
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/components/Button/stories.scss +45 -0
- package/dist/components/Cookie/Checkbox/style.scss +2 -2
- package/dist/components/Cookie/stories.scss +2 -3
- package/dist/components/Cookie/style.scss +2 -2
- package/dist/components/Form/Checkboxes/index.js +32 -14
- package/dist/components/Form/Checkboxes/stories.js +9 -3
- package/dist/components/Form/RadioButtons/stories.js +9 -3
- package/dist/components/NavigationScroll/index.js +0 -1
- package/dist/components/SearchKit/SearchResults/index.js +6 -1
- package/dist/components/SearchKit/index.js +7 -4
- package/dist/components/SearchKit/stories.js +1 -1
- package/dist/components/Share/stories.scss +2 -2
- package/dist/components/WysiwygField/stories.scss +3 -0
- package/dist/helpers/makeSafeForCSS.js +5 -0
- package/package.json +1 -1
- package/dist/pages/api/graphql.js +0 -25
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@import '../../styles/assets/variables';
|
|
2
|
+
|
|
3
|
+
.Button {
|
|
4
|
+
&.Button--styled {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
text-align: center;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
|
|
11
|
+
&--primary {
|
|
12
|
+
font-size: 21px;
|
|
13
|
+
background-color: black;
|
|
14
|
+
color: #ffffff;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
line-height: 1.14;
|
|
17
|
+
padding: 19px 30px;
|
|
18
|
+
|
|
19
|
+
&:hover {
|
|
20
|
+
background-color: #434343;
|
|
21
|
+
}
|
|
22
|
+
&:disabled {
|
|
23
|
+
font-family: inherit;
|
|
24
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&--inverted {
|
|
29
|
+
border: solid 1px #888888;
|
|
30
|
+
background-color: #ffffff;
|
|
31
|
+
padding: 18px 34.5px;
|
|
32
|
+
font-size: 18px;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
color: #000000;
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
background-color: #f1f1f1;
|
|
38
|
+
}
|
|
39
|
+
&:disabled {
|
|
40
|
+
font-family: inherit;
|
|
41
|
+
opacity: .5;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -30,6 +30,32 @@ function Checkbox(props) {
|
|
|
30
30
|
'icon-checkmark': true,
|
|
31
31
|
'icon-variant-1': checked
|
|
32
32
|
});
|
|
33
|
+
|
|
34
|
+
if (props.value === '__other__') {
|
|
35
|
+
const inputClasses = c({
|
|
36
|
+
hidden: !field.value.includes('__other__')
|
|
37
|
+
});
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: classes
|
|
40
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
41
|
+
htmlFor: name
|
|
42
|
+
}, /*#__PURE__*/React.createElement("input", _extends({}, field, {
|
|
43
|
+
name: props.name,
|
|
44
|
+
value: value,
|
|
45
|
+
type: "checkbox",
|
|
46
|
+
id: name,
|
|
47
|
+
checked: checked,
|
|
48
|
+
disabled: disabled,
|
|
49
|
+
className: className
|
|
50
|
+
})), props.otherLabel), /*#__PURE__*/React.createElement("textarea", {
|
|
51
|
+
placeholder: props.otherPlaceholder,
|
|
52
|
+
className: inputClasses,
|
|
53
|
+
onChange: e => {
|
|
54
|
+
form.setFieldValue(`${props.name}--other`, e.target.value);
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
|
|
33
59
|
return /*#__PURE__*/React.createElement("label", {
|
|
34
60
|
className: classes,
|
|
35
61
|
htmlFor: name
|
|
@@ -39,18 +65,6 @@ function Checkbox(props) {
|
|
|
39
65
|
type: "checkbox",
|
|
40
66
|
id: name,
|
|
41
67
|
checked: checked,
|
|
42
|
-
onChange: e => {
|
|
43
|
-
const set = new Set(field.value);
|
|
44
|
-
|
|
45
|
-
if (set.has(value)) {
|
|
46
|
-
set.delete(value);
|
|
47
|
-
} else {
|
|
48
|
-
set.add(value);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
form.setFieldValue(field.name, Array.from(set));
|
|
52
|
-
form.setFieldTouched(field.name, true);
|
|
53
|
-
},
|
|
54
68
|
disabled: disabled,
|
|
55
69
|
className: className
|
|
56
70
|
})), props.label);
|
|
@@ -72,7 +86,9 @@ const Checkboxes = props => {
|
|
|
72
86
|
displayRequiredIndicator,
|
|
73
87
|
className,
|
|
74
88
|
wrapperClassName,
|
|
75
|
-
disabled = false
|
|
89
|
+
disabled = false,
|
|
90
|
+
otherLabel,
|
|
91
|
+
otherPlaceholder
|
|
76
92
|
} = props;
|
|
77
93
|
return /*#__PURE__*/React.createElement(GenericFormElement, {
|
|
78
94
|
className: c("Checkboxes", wrapperClassName),
|
|
@@ -96,7 +112,9 @@ const Checkboxes = props => {
|
|
|
96
112
|
value: value,
|
|
97
113
|
placeholder: placeholder,
|
|
98
114
|
validate: validation,
|
|
99
|
-
disabled: disabled
|
|
115
|
+
disabled: disabled,
|
|
116
|
+
otherLabel: otherLabel,
|
|
117
|
+
otherPlaceholder: otherPlaceholder
|
|
100
118
|
});
|
|
101
119
|
}));
|
|
102
120
|
};
|
|
@@ -10,7 +10,8 @@ export const Checkboxes = props => {
|
|
|
10
10
|
return /*#__PURE__*/React.createElement(FormikWrapper, _extends({}, props, {
|
|
11
11
|
initialValues: {
|
|
12
12
|
'poison': []
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
|
+
onSubmit: values => console.log(values)
|
|
14
15
|
}), /*#__PURE__*/React.createElement(FormikCheckboxes, {
|
|
15
16
|
title: "Pick your poison",
|
|
16
17
|
required: true,
|
|
@@ -20,7 +21,8 @@ export const Checkboxes = props => {
|
|
|
20
21
|
beer: 'Beer',
|
|
21
22
|
wine: 'Wine',
|
|
22
23
|
rum: 'Rum',
|
|
23
|
-
whisky: 'Whisk(e)y'
|
|
24
|
+
whisky: 'Whisk(e)y',
|
|
25
|
+
'__other__': 'Anders'
|
|
24
26
|
},
|
|
25
27
|
validation: value => {
|
|
26
28
|
let error;
|
|
@@ -30,6 +32,10 @@ export const Checkboxes = props => {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
return error;
|
|
33
|
-
}
|
|
35
|
+
},
|
|
36
|
+
otherLabel: "Anders"
|
|
37
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
38
|
+
type: "submit",
|
|
39
|
+
value: "Verzenden"
|
|
34
40
|
}));
|
|
35
41
|
};
|
|
@@ -10,7 +10,8 @@ export const RadioButtons = props => {
|
|
|
10
10
|
return /*#__PURE__*/React.createElement(FormikWrapper, _extends({}, props, {
|
|
11
11
|
initialValues: {
|
|
12
12
|
'poison': null
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
|
+
onSubmit: values => console.log(values)
|
|
14
15
|
}), /*#__PURE__*/React.createElement(FormikRadio, {
|
|
15
16
|
title: "Pick your poison",
|
|
16
17
|
required: true,
|
|
@@ -20,7 +21,8 @@ export const RadioButtons = props => {
|
|
|
20
21
|
beer: 'Beer',
|
|
21
22
|
wine: 'Wine',
|
|
22
23
|
rum: 'Rum',
|
|
23
|
-
whisky: 'Whisk(e)y'
|
|
24
|
+
whisky: 'Whisk(e)y',
|
|
25
|
+
'__other__': 'Anders'
|
|
24
26
|
},
|
|
25
27
|
validation: value => {
|
|
26
28
|
let error;
|
|
@@ -30,6 +32,10 @@ export const RadioButtons = props => {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
return error;
|
|
33
|
-
}
|
|
35
|
+
},
|
|
36
|
+
otherLabel: "Anders"
|
|
37
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
38
|
+
type: "submit",
|
|
39
|
+
value: "Verzenden"
|
|
34
40
|
}));
|
|
35
41
|
};
|
|
@@ -27,7 +27,12 @@ const SearchResults = ({
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
if (data && previousPage !== undefined && data.results.hits.page.pageNumber !== previousPage) {
|
|
30
|
-
|
|
30
|
+
if (typeof previousItems === 'undefined') {
|
|
31
|
+
setItems([...data.results.hits.items]);
|
|
32
|
+
} else {
|
|
33
|
+
setItems([...previousItems, ...data.results.hits.items]);
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
setCurrentPage(data.results.hits.page.pageNumber);
|
|
32
37
|
}
|
|
33
38
|
}, [data, previousPage, previousItems, appendResults]);
|
|
@@ -28,7 +28,8 @@ const SearchKit = ({
|
|
|
28
28
|
useRouting = true,
|
|
29
29
|
defaultFilters = [],
|
|
30
30
|
defaultQuery = '',
|
|
31
|
-
children
|
|
31
|
+
children,
|
|
32
|
+
defaultSorting = 'relevance'
|
|
32
33
|
}) => {
|
|
33
34
|
const client = useMemo(() => {
|
|
34
35
|
return new ApolloClient({
|
|
@@ -46,12 +47,13 @@ const SearchKit = ({
|
|
|
46
47
|
page: {
|
|
47
48
|
size: pageSize,
|
|
48
49
|
from: 0
|
|
49
|
-
}
|
|
50
|
+
},
|
|
51
|
+
sortBy: defaultSorting
|
|
50
52
|
});
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
return skClient;
|
|
54
|
-
}, [useRouting, defaultFilters, defaultQuery, pageSize]);
|
|
56
|
+
}, [useRouting, defaultFilters, defaultQuery, pageSize, defaultSorting]);
|
|
55
57
|
return /*#__PURE__*/React.createElement(ApolloProvider, {
|
|
56
58
|
client: client
|
|
57
59
|
}, /*#__PURE__*/React.createElement(SearchkitProvider, {
|
|
@@ -69,6 +71,7 @@ SearchKit.propTypes = {
|
|
|
69
71
|
pageSize: PropTypes.number,
|
|
70
72
|
useRouting: PropTypes.bool,
|
|
71
73
|
defaultFilters: PropTypes.object,
|
|
72
|
-
defaultQuery: PropTypes.string
|
|
74
|
+
defaultQuery: PropTypes.string,
|
|
75
|
+
defaultSorting: PropTypes.string
|
|
73
76
|
};
|
|
74
77
|
export default SearchKit;
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ApolloServer, gql } from 'apollo-server-micro';
|
|
2
|
-
export const config = {
|
|
3
|
-
api: {
|
|
4
|
-
bodyParser: false
|
|
5
|
-
}
|
|
6
|
-
};
|
|
7
|
-
const typeDefs = [gql`
|
|
8
|
-
type Query {
|
|
9
|
-
root: String
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type Mutation {
|
|
13
|
-
root: String
|
|
14
|
-
}
|
|
15
|
-
`];
|
|
16
|
-
const server = new ApolloServer({
|
|
17
|
-
typeDefs,
|
|
18
|
-
resolvers: {},
|
|
19
|
-
introspection: true,
|
|
20
|
-
playground: true,
|
|
21
|
-
context: {}
|
|
22
|
-
});
|
|
23
|
-
export default server.createHandler({
|
|
24
|
-
path: '/api/graphql'
|
|
25
|
-
});
|