@uncinc/uncinc-react-kitchen-sink 2.2.12 → 2.2.15
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/Accordion/AccordionItem/index.js +3 -2
- package/dist/components/Cookie/index.js +88 -22
- package/dist/components/Cookie/stories.js +15 -6
- package/dist/components/Cookie/style.scss +9 -0
- package/dist/components/Form/RadioButtons/index.js +1 -1
- package/dist/pages/api/graphql.js +25 -0
- package/package.json +1 -1
- package/dist/components/Button/stories.scss +0 -45
- package/dist/components/WysiwygField/stories.scss +0 -3
- package/dist/helpers/makeSafeForCSS.js +0 -5
|
@@ -30,10 +30,11 @@ const AccordionItem = ({
|
|
|
30
30
|
iconClassName,
|
|
31
31
|
duration,
|
|
32
32
|
easing,
|
|
33
|
-
titleComponent
|
|
33
|
+
titleComponent,
|
|
34
|
+
className
|
|
34
35
|
}) => {
|
|
35
36
|
const [collapsed, setCollapsed] = useState(true);
|
|
36
|
-
const classes = c('Accordion__item', {
|
|
37
|
+
const classes = c(className, 'Accordion__item', {
|
|
37
38
|
collapsed: collapsed
|
|
38
39
|
});
|
|
39
40
|
const iconClasses = c('icon', iconClassName);
|
|
@@ -11,13 +11,19 @@ import './style.scss';
|
|
|
11
11
|
const CookieCompliancePopup = props => {
|
|
12
12
|
const {
|
|
13
13
|
className,
|
|
14
|
-
cookieLevels,
|
|
15
14
|
children,
|
|
16
15
|
manualText,
|
|
17
16
|
agreeText,
|
|
17
|
+
disagreeText,
|
|
18
|
+
showDisagree,
|
|
19
|
+
onAgree,
|
|
18
20
|
onDisagree,
|
|
21
|
+
cookieLevels,
|
|
19
22
|
cookieOptions,
|
|
20
|
-
cookieDomain
|
|
23
|
+
cookieDomain,
|
|
24
|
+
defaultValues,
|
|
25
|
+
manualHeader,
|
|
26
|
+
manualButtonClassname
|
|
21
27
|
} = props; // This is an internal state to check whether we should show the options.
|
|
22
28
|
|
|
23
29
|
const [manualChoiceVisible, setManualChoiceVisible] = useState(false); // This is an extra hidden variable to internally check if we should show the notification.
|
|
@@ -30,14 +36,16 @@ const CookieCompliancePopup = props => {
|
|
|
30
36
|
|
|
31
37
|
const [didConsent, setDidConsent] = useCookie('cookie-agreed', null); // Cookie stating whether we should render the notification.
|
|
32
38
|
|
|
33
|
-
const [hidden, setHidden] = useState(didConsent !== null);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
necessary: true,
|
|
37
|
-
voorkeuren: false,
|
|
38
|
-
statistieken: false,
|
|
39
|
-
marketing: false
|
|
39
|
+
const [hidden, setHidden] = useState(didConsent !== null);
|
|
40
|
+
const categories = cookieLevels.map(item => {
|
|
41
|
+
return item.value;
|
|
40
42
|
});
|
|
43
|
+
const defaultState = categories.reduce((prev, category) => {
|
|
44
|
+
prev[category] = typeof defaultValues[category] !== undefined ? defaultValues[category] : true;
|
|
45
|
+
return prev;
|
|
46
|
+
}, {}); // Default choices for select, this way we can locally manage the state of the form.
|
|
47
|
+
|
|
48
|
+
const [choicesSelected, setChoicesSelected] = useState(defaultState);
|
|
41
49
|
useEffect(() => {
|
|
42
50
|
if (hidden) {
|
|
43
51
|
setHiddenInternal(true);
|
|
@@ -61,7 +69,7 @@ const CookieCompliancePopup = props => {
|
|
|
61
69
|
// and also sets the accepted categories in CookieAgreedCategories.
|
|
62
70
|
|
|
63
71
|
|
|
64
|
-
const
|
|
72
|
+
const _onAgree = choices => {
|
|
65
73
|
const selectedChoices = Object.keys(choices).filter(key => {
|
|
66
74
|
return choices[key];
|
|
67
75
|
});
|
|
@@ -84,18 +92,37 @@ const CookieCompliancePopup = props => {
|
|
|
84
92
|
|
|
85
93
|
const timestamp = Math.round(new Date().getTime() / 1000);
|
|
86
94
|
const value = {
|
|
87
|
-
necessary: true,
|
|
88
|
-
preferences: true,
|
|
89
|
-
statistics: true,
|
|
90
|
-
marketing: true,
|
|
91
95
|
ver: 1,
|
|
92
96
|
utc: timestamp,
|
|
93
97
|
region: 'nl'
|
|
94
98
|
};
|
|
95
|
-
|
|
99
|
+
categories.forEach(category => {
|
|
100
|
+
value[category] = true;
|
|
101
|
+
}, {});
|
|
102
|
+
Cookies.set('cookie-consent', JSON.stringify(value), {
|
|
96
103
|
expires: 365,
|
|
97
104
|
domain: cookieDomain
|
|
98
105
|
});
|
|
106
|
+
onAgree(choices);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const _onDisagree = () => {
|
|
110
|
+
setDidConsent('0', cookieOptions);
|
|
111
|
+
Cookies.set('cookie-agreed-categories', JSON.stringify([]), {
|
|
112
|
+
expires: 365,
|
|
113
|
+
domain: cookieDomain
|
|
114
|
+
});
|
|
115
|
+
const timestamp = Math.round(new Date().getTime() / 1000);
|
|
116
|
+
const value = {
|
|
117
|
+
ver: 1,
|
|
118
|
+
utc: timestamp,
|
|
119
|
+
region: 'nl'
|
|
120
|
+
};
|
|
121
|
+
Cookies.set('cookie-consent', JSON.stringify(value), {
|
|
122
|
+
expires: 365,
|
|
123
|
+
domain: cookieDomain
|
|
124
|
+
});
|
|
125
|
+
onDisagree();
|
|
99
126
|
}; // This function is fired when the accept button is pressed.
|
|
100
127
|
// Also has eventual support for a false case.
|
|
101
128
|
|
|
@@ -103,9 +130,9 @@ const CookieCompliancePopup = props => {
|
|
|
103
130
|
const onConsent = value => {
|
|
104
131
|
return () => {
|
|
105
132
|
if (value === true) {
|
|
106
|
-
|
|
133
|
+
_onAgree(choicesSelected);
|
|
107
134
|
} else {
|
|
108
|
-
|
|
135
|
+
_onDisagree();
|
|
109
136
|
}
|
|
110
137
|
};
|
|
111
138
|
}; // This function sets the value of the checkmark in the form state.
|
|
@@ -168,8 +195,11 @@ const CookieCompliancePopup = props => {
|
|
|
168
195
|
className: "Button--cta",
|
|
169
196
|
primary: true,
|
|
170
197
|
onClick: onConsent(true)
|
|
171
|
-
}, agreeText), /*#__PURE__*/React.createElement("
|
|
172
|
-
className:
|
|
198
|
+
}, agreeText), showDisagree && /*#__PURE__*/React.createElement("button", {
|
|
199
|
+
className: `Cookie__content__buttons__manual Cookie__content__buttons__manual-disagree ${manualButtonClassname}`,
|
|
200
|
+
onClick: onConsent(false)
|
|
201
|
+
}, disagreeText), /*#__PURE__*/React.createElement("button", {
|
|
202
|
+
className: `Cookie__content__buttons__manual Cookie__content__buttons__manual-agree ${manualButtonClassname}`,
|
|
173
203
|
onClick: e => {
|
|
174
204
|
displayConsentChoices(e);
|
|
175
205
|
}
|
|
@@ -177,7 +207,9 @@ const CookieCompliancePopup = props => {
|
|
|
177
207
|
className: "Cookie__content__message"
|
|
178
208
|
}, /*#__PURE__*/React.createElement("div", {
|
|
179
209
|
className: "Cookie__checkboxes-container row"
|
|
180
|
-
},
|
|
210
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
211
|
+
className: "col-12"
|
|
212
|
+
}, manualHeader), renderChoices())), /*#__PURE__*/React.createElement("div", {
|
|
181
213
|
className: "Cookie__content__buttons"
|
|
182
214
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
183
215
|
className: "Button--cta",
|
|
@@ -188,9 +220,40 @@ const CookieCompliancePopup = props => {
|
|
|
188
220
|
export default CookieCompliancePopup;
|
|
189
221
|
CookieCompliancePopup.defaultProps = {
|
|
190
222
|
agreeText: 'Accepteren',
|
|
223
|
+
disagreeText: 'Alles weigeren',
|
|
191
224
|
manualText: 'Zelf instellen',
|
|
225
|
+
manualHeader: () => {},
|
|
226
|
+
onAgree: () => {},
|
|
192
227
|
onDisagree: () => {},
|
|
193
|
-
|
|
228
|
+
showDisagree: false,
|
|
229
|
+
manualButtonClassname: "icon-after icon-chevron-right icon-variant-2",
|
|
230
|
+
cookieLevels: [{
|
|
231
|
+
value: "necessary",
|
|
232
|
+
label: 'Benodigd',
|
|
233
|
+
description: "",
|
|
234
|
+
disabled: true
|
|
235
|
+
}, {
|
|
236
|
+
value: "voorkeuren",
|
|
237
|
+
label: "Voorkeuren",
|
|
238
|
+
description: "",
|
|
239
|
+
disabled: false
|
|
240
|
+
}, {
|
|
241
|
+
value: "statistieken",
|
|
242
|
+
label: "Statistieken",
|
|
243
|
+
description: "",
|
|
244
|
+
disabled: false
|
|
245
|
+
}, {
|
|
246
|
+
value: "marketing",
|
|
247
|
+
label: "Marketing",
|
|
248
|
+
description: "",
|
|
249
|
+
disabled: false
|
|
250
|
+
}],
|
|
251
|
+
defaultValues: {
|
|
252
|
+
necessary: true,
|
|
253
|
+
voorkeuren: false,
|
|
254
|
+
statistieken: false,
|
|
255
|
+
marketing: false
|
|
256
|
+
},
|
|
194
257
|
cookieDomain: null,
|
|
195
258
|
cookieOptions: {
|
|
196
259
|
days: 365,
|
|
@@ -200,8 +263,11 @@ CookieCompliancePopup.defaultProps = {
|
|
|
200
263
|
CookieCompliancePopup.propTypes = {
|
|
201
264
|
agreeText: PropTypes.string,
|
|
202
265
|
manualText: PropTypes.string,
|
|
266
|
+
manualHeader: PropTypes.func,
|
|
267
|
+
manualButtonClassname: PropTypes.string,
|
|
268
|
+
onAgree: PropTypes.func,
|
|
203
269
|
onDisagree: PropTypes.func,
|
|
204
|
-
|
|
270
|
+
showDisagree: PropTypes.bool,
|
|
205
271
|
cookieLevels: PropTypes.arrayOf(PropTypes.shape({
|
|
206
272
|
value: PropTypes.string,
|
|
207
273
|
label: PropTypes.string,
|
|
@@ -7,7 +7,15 @@ export default {
|
|
|
7
7
|
export const Default = () => /*#__PURE__*/React.createElement(Cookie, {
|
|
8
8
|
agreeText: 'Accepteren',
|
|
9
9
|
manualText: 'Zelf instellen',
|
|
10
|
+
onAgree: choices => console.log("User agreed to", choices),
|
|
11
|
+
onDisagree: () => console.log("User did NOT agree")
|
|
12
|
+
}, /*#__PURE__*/React.createElement("h1", null, "Wij gebruiken cookies"), /*#__PURE__*/React.createElement("p", null, "Aliquam accumsan sem lacus, ut laoreet urna aliquam quis. Ut ut imperdiet tortor, sed vestibulum felis. Etiam a eleifend leo, eu interdum nulla. Etiam id elit ex. Etiam condimentum facilisis venenatis. Curabitur accumsan ut dui vel laoreet. Donec dapibus convallis diam, at sodales nulla laoreet ac. Nunc maximus, orci ac tristique dapibus, dolor felis semper lorem, eu dapibus turpis enim quis urna."));
|
|
13
|
+
export const Advanced = () => /*#__PURE__*/React.createElement(Cookie, {
|
|
14
|
+
agreeText: 'Accepteren',
|
|
15
|
+
manualText: 'Zelf instellen',
|
|
16
|
+
showDisagree: true,
|
|
10
17
|
onDisagree: () => {},
|
|
18
|
+
manualButtonClassname: "",
|
|
11
19
|
cookieLevels: [{
|
|
12
20
|
value: "necessary",
|
|
13
21
|
label: "Noodzakelijk",
|
|
@@ -23,10 +31,11 @@ export const Default = () => /*#__PURE__*/React.createElement(Cookie, {
|
|
|
23
31
|
label: "Statistieken",
|
|
24
32
|
description: "Statistische cookies helpen eigenaren van websites begrijpen hoe bezoekers hun website gebruiken, door anoniem gegevens te verzamelen en te rapporteren.",
|
|
25
33
|
disabled: false
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
34
|
+
}],
|
|
35
|
+
defaultValues: {
|
|
36
|
+
necessary: true,
|
|
37
|
+
voorkeuren: true,
|
|
38
|
+
statistieken: true
|
|
39
|
+
},
|
|
40
|
+
manualHeader: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", null, "Manual choice"), /*#__PURE__*/React.createElement("p", null, "You have a choice."))
|
|
32
41
|
}, /*#__PURE__*/React.createElement("h1", null, "Wij gebruiken cookies"), /*#__PURE__*/React.createElement("p", null, "Aliquam accumsan sem lacus, ut laoreet urna aliquam quis. Ut ut imperdiet tortor, sed vestibulum felis. Etiam a eleifend leo, eu interdum nulla. Etiam id elit ex. Etiam condimentum facilisis venenatis. Curabitur accumsan ut dui vel laoreet. Donec dapibus convallis diam, at sodales nulla laoreet ac. Nunc maximus, orci ac tristique dapibus, dolor felis semper lorem, eu dapibus turpis enim quis urna."));
|
|
@@ -22,7 +22,7 @@ const Radio = props => {
|
|
|
22
22
|
const classes = c('WebformRadios__radio__input', {
|
|
23
23
|
'icon-before': true,
|
|
24
24
|
'icon-radio': true,
|
|
25
|
-
'icon-variant-1': field.value && field.value
|
|
25
|
+
'icon-variant-1': field.value && field.value === props.value
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
if (props.value === '__other__') {
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
});
|
package/package.json
CHANGED
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
}
|