@uncinc/uncinc-react-kitchen-sink 2.5.4 → 2.6.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/KitchenSinkComponentMapperContext.d.ts +3 -0
- package/dist/Context/withMapping.d.ts +3 -0
- package/dist/components/Button/index.d.ts +41 -0
- package/dist/components/CallToAction/index.d.ts +15 -0
- package/dist/components/CallToAction/index.js +43 -0
- package/dist/components/CallToAction/stories.d.ts +8 -0
- package/dist/components/CallToAction/stories.js +37 -0
- package/dist/components/CallToAction/style.scss +25 -0
- package/dist/components/Cookie/index.js +39 -40
- package/dist/components/Cookie/style.scss +18 -1
- package/dist/components/Download/index.d.ts +13 -0
- package/dist/components/Download/index.js +58 -0
- package/dist/components/Download/stories.d.ts +8 -0
- package/dist/components/Download/stories.js +28 -0
- package/dist/components/Download/stories.scss +67 -0
- package/dist/components/Image/LazyLoadWrapper/index.d.ts +10 -0
- package/dist/components/Image/Picture/index.d.ts +23 -0
- package/dist/components/Image/Picture/index.js +7 -1
- package/dist/components/Image/index.d.ts +15 -0
- package/dist/components/Image/index.js +8 -2
- package/dist/components/MediaPlayer/index.d.ts +8 -0
- package/dist/components/MediaPlayer/index.js +154 -0
- package/dist/components/MediaPlayer/stories.d.ts +12 -0
- package/dist/components/MediaPlayer/stories.js +146 -0
- package/dist/components/MediaPlayer/style.scss +7 -0
- package/dist/components/MediaPlayer/types.d.ts +24 -0
- package/dist/components/MediaPlayer/types.js +1 -0
- package/dist/components/TitleWithText/index.d.ts +8 -0
- package/dist/components/TitleWithText/index.js +28 -0
- package/dist/components/TitleWithText/stories.d.ts +8 -0
- package/dist/components/TitleWithText/stories.js +24 -0
- package/dist/components/TitleWithText/stories.scss +0 -0
- package/dist/components/WysiwygField/index.d.ts +18 -0
- package/dist/components/index.js +7 -0
- package/dist/config/constants.d.ts +15 -0
- package/dist/config/i18next/locales/en.json +12 -0
- package/dist/config/i18next/locales/nl.json +9 -0
- package/dist/custom.d.js +1 -0
- package/dist/helpers/gtm.d.ts +44 -0
- package/dist/helpers/link.d.ts +2 -0
- package/dist/index.js +49 -0
- package/dist/organisms/Downloads/index.d.ts +11 -0
- package/dist/organisms/Downloads/index.js +37 -0
- package/dist/organisms/Downloads/stories.d.ts +8 -0
- package/dist/organisms/Downloads/stories.js +43 -0
- package/dist/organisms/Downloads/stories.scss +67 -0
- package/dist/organisms/Quote/index.d.ts +18 -0
- package/dist/organisms/Quote/index.js +53 -0
- package/dist/organisms/Quote/stories.d.ts +8 -0
- package/dist/organisms/Quote/stories.js +39 -0
- package/dist/organisms/Quote/stories.scss +48 -0
- package/dist/organisms/Text/index.d.ts +15 -0
- package/dist/organisms/Text/index.js +74 -0
- package/dist/organisms/Text/stories.d.ts +8 -0
- package/dist/organisms/Text/stories.js +30 -0
- package/dist/organisms/Text/stories.scss +29 -0
- package/package.json +6 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function Button({ href, dispatch, className, children, primary, inverted, language, enableLoader, loading, htmlType, ...props }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
href: any;
|
|
4
|
+
dispatch: any;
|
|
5
|
+
className: any;
|
|
6
|
+
children: any;
|
|
7
|
+
primary: any;
|
|
8
|
+
inverted: any;
|
|
9
|
+
language: any;
|
|
10
|
+
enableLoader: any;
|
|
11
|
+
loading: any;
|
|
12
|
+
htmlType: any;
|
|
13
|
+
}): React.JSX.Element;
|
|
14
|
+
export namespace Button {
|
|
15
|
+
namespace defaultProps {
|
|
16
|
+
let primary: boolean;
|
|
17
|
+
let inverted: boolean;
|
|
18
|
+
let disabled: boolean;
|
|
19
|
+
let href: any;
|
|
20
|
+
let enableLoader: boolean;
|
|
21
|
+
let htmlType: string;
|
|
22
|
+
}
|
|
23
|
+
namespace propTypes {
|
|
24
|
+
let href_1: PropTypes.Requireable<string>;
|
|
25
|
+
export { href_1 as href };
|
|
26
|
+
let primary_1: PropTypes.Requireable<boolean>;
|
|
27
|
+
export { primary_1 as primary };
|
|
28
|
+
let disabled_1: PropTypes.Requireable<boolean>;
|
|
29
|
+
export { disabled_1 as disabled };
|
|
30
|
+
let inverted_1: PropTypes.Requireable<boolean>;
|
|
31
|
+
export { inverted_1 as inverted };
|
|
32
|
+
let enableLoader_1: PropTypes.Requireable<boolean>;
|
|
33
|
+
export { enableLoader_1 as enableLoader };
|
|
34
|
+
let htmlType_1: PropTypes.Requireable<string>;
|
|
35
|
+
export { htmlType_1 as htmlType };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
declare const _default: (props: any) => React.JSX.Element;
|
|
39
|
+
export default _default;
|
|
40
|
+
import React from 'react';
|
|
41
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ButtonProps {
|
|
3
|
+
text: string;
|
|
4
|
+
link: string;
|
|
5
|
+
}
|
|
6
|
+
export interface CallToActionProps {
|
|
7
|
+
title: string;
|
|
8
|
+
text?: string;
|
|
9
|
+
button: ButtonProps;
|
|
10
|
+
buttonSecondary?: ButtonProps;
|
|
11
|
+
iconClasses?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const CallToAction: React.FC<CallToActionProps>;
|
|
15
|
+
export default CallToAction;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _WysiwygField = _interopRequireDefault(require("../WysiwygField"));
|
|
10
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
var CallToAction = function CallToAction(_ref) {
|
|
13
|
+
var title = _ref.title,
|
|
14
|
+
text = _ref.text,
|
|
15
|
+
button = _ref.button,
|
|
16
|
+
buttonSecondary = _ref.buttonSecondary,
|
|
17
|
+
_ref$iconClasses = _ref.iconClasses,
|
|
18
|
+
iconClasses = _ref$iconClasses === void 0 ? 'icon-arrow icon-after icon-variant-1' : _ref$iconClasses,
|
|
19
|
+
className = _ref.className;
|
|
20
|
+
var classes = (0, _classnames.default)('CallToAction', className);
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
22
|
+
className: classes
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement("h3", {
|
|
24
|
+
className: "CallToAction__title"
|
|
25
|
+
}, title), text && /*#__PURE__*/_react.default.createElement(_WysiwygField.default, {
|
|
26
|
+
className: "CallToAction__text",
|
|
27
|
+
property: "schema:text",
|
|
28
|
+
customElementHandler: function customElementHandler() {},
|
|
29
|
+
html: text
|
|
30
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
31
|
+
className: "CallToAction__buttonWrapper"
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
33
|
+
primary: true,
|
|
34
|
+
className: "CallToAction__button ".concat(iconClasses),
|
|
35
|
+
href: button.link
|
|
36
|
+
}, button.text), buttonSecondary && /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
37
|
+
inverted: true,
|
|
38
|
+
className: "CallToAction__button ".concat(iconClasses),
|
|
39
|
+
href: buttonSecondary.link
|
|
40
|
+
}, buttonSecondary.text)));
|
|
41
|
+
};
|
|
42
|
+
var _default = CallToAction;
|
|
43
|
+
exports.default = _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _ = _interopRequireDefault(require("."));
|
|
9
|
+
require("./style.scss");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
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); }
|
|
12
|
+
var _default = {
|
|
13
|
+
component: _.default,
|
|
14
|
+
title: 'Molecules/CallToAction'
|
|
15
|
+
};
|
|
16
|
+
exports.default = _default;
|
|
17
|
+
var Default = function Default(args) {
|
|
18
|
+
var title = "Call To Action";
|
|
19
|
+
var html = "\n <p>This is a <code>WysiwygField</code> component so you can put whatever you like in here.</p>\n <p>Lorem ipsum dolor sit amet, <abbr title=\"Ut ut tellus et augue feugiat sollicitudin sit amet viverra nisi.\">consectetur adipiscing</abbr> elit. Aliquam in sodales tellus. Ut ut tellus et augue feugiat sollicitudin sit amet viverra nisi. Nulla malesuada erat non massa pellentesque, ut ultricies tellus sodales. Fusce ac feugiat ligula. In vel metus diam. Maecenas diam ex, tincidunt tempor nibh sed, suscipit semper lectus. Sed eu enim vel erat tempus mollis. Integer eget gravida orci. Nunc volutpat velit id dui semper tincidunt. Nulla maximus nisl nec volutpat faucibus. Integer vitae ullamcorper ex. Vestibulum facilisis convallis arcu, ac interdum libero malesuada eget.</p>\n ";
|
|
20
|
+
var buttonText = "Button";
|
|
21
|
+
var buttonTextSecondary = "Button 2";
|
|
22
|
+
var buttonLink = "https://www.uncinc.nl";
|
|
23
|
+
var buttonLinkSecondary = "https://www.uncinc.nl/werk";
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_.default, _extends({
|
|
25
|
+
title: title,
|
|
26
|
+
text: html,
|
|
27
|
+
button: {
|
|
28
|
+
text: buttonText,
|
|
29
|
+
link: buttonLink
|
|
30
|
+
},
|
|
31
|
+
buttonSecondary: {
|
|
32
|
+
text: buttonTextSecondary,
|
|
33
|
+
link: buttonLinkSecondary
|
|
34
|
+
}
|
|
35
|
+
}, args));
|
|
36
|
+
};
|
|
37
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@import '../../styles/assets/variables';
|
|
2
|
+
|
|
3
|
+
.CallToAction {
|
|
4
|
+
text-align: center;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.Button {
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
border-radius: 5px;
|
|
11
|
+
margin: 2rem;
|
|
12
|
+
padding: 2rem 3rem;
|
|
13
|
+
|
|
14
|
+
&--primary {
|
|
15
|
+
background-color: #000;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&--inverted {
|
|
19
|
+
background-color: #555;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
background-color: #999;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -28,6 +28,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
28
28
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
29
29
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
30
30
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
var STATUS_DECLINED = '0';
|
|
32
|
+
var STATUS_NOT_YET_ANSWERED = '1';
|
|
33
|
+
var STATUS_ACCEPTED = '2';
|
|
31
34
|
var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
32
35
|
var className = props.className,
|
|
33
36
|
children = props.children,
|
|
@@ -43,34 +46,27 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
|
43
46
|
defaultValues = props.defaultValues,
|
|
44
47
|
manualHeader = props.manualHeader,
|
|
45
48
|
manualButtonClassname = props.manualButtonClassname;
|
|
46
|
-
|
|
47
49
|
// This is an internal state to check whether we should show the options.
|
|
48
50
|
var _useState = (0, _react.useState)(false),
|
|
49
51
|
_useState2 = _slicedToArray(_useState, 2),
|
|
50
52
|
manualChoiceVisible = _useState2[0],
|
|
51
53
|
setManualChoiceVisible = _useState2[1];
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
var _useState3 = (0, _react.useState)(false),
|
|
54
|
+
// This is an internal state to check whether the user has answered in the current session.
|
|
55
|
+
// It is either null (because we don't know if it was already in the cookies) or true
|
|
56
|
+
var _useState3 = (0, _react.useState)(null),
|
|
56
57
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
answeredInCurrentSession = _useState4[0],
|
|
59
|
+
setAnsweredInCurrentSession = _useState4[1];
|
|
59
60
|
|
|
60
61
|
// Cookie stating if the cookie has already been accepted. Uses the following states:
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
62
|
+
// null: unknown
|
|
63
|
+
// STATUS DECLINED (0 as cookie value)
|
|
64
|
+
// STATUS NOT YET ANSWERED (1 as cookie value)
|
|
65
|
+
// STATUS ACCEPTED (2 as cookie value)
|
|
64
66
|
var _useCookie = (0, _reactUseCookie.default)('cookie-agreed', null),
|
|
65
67
|
_useCookie2 = _slicedToArray(_useCookie, 2),
|
|
66
68
|
didConsent = _useCookie2[0],
|
|
67
69
|
setDidConsent = _useCookie2[1];
|
|
68
|
-
|
|
69
|
-
// Cookie stating whether we should render the notification.
|
|
70
|
-
var _useState5 = (0, _react.useState)(didConsent !== null),
|
|
71
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
72
|
-
hidden = _useState6[0],
|
|
73
|
-
setHidden = _useState6[1];
|
|
74
70
|
var categories = cookieLevels.map(function (item) {
|
|
75
71
|
return item.value;
|
|
76
72
|
});
|
|
@@ -81,26 +77,20 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
|
81
77
|
}, {});
|
|
82
78
|
|
|
83
79
|
// Default choices for select, this way we can locally manage the state of the form.
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
choicesSelected =
|
|
87
|
-
setChoicesSelected =
|
|
88
|
-
(0, _react.useEffect)(function () {
|
|
89
|
-
if (hidden) {
|
|
90
|
-
setHiddenInternal(true);
|
|
91
|
-
}
|
|
92
|
-
// We don't want to add hidden to the dependency list, as this would -
|
|
93
|
-
// unrender the notification immediately on save.
|
|
94
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
95
|
-
}, []);
|
|
96
|
-
|
|
97
|
-
// Check if didConsent has been changed.
|
|
98
|
-
// If so, set the hidden cookie for page reloads.
|
|
80
|
+
var _useState5 = (0, _react.useState)(defaultState),
|
|
81
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
82
|
+
choicesSelected = _useState6[0],
|
|
83
|
+
setChoicesSelected = _useState6[1];
|
|
99
84
|
(0, _react.useEffect)(function () {
|
|
100
|
-
|
|
101
|
-
|
|
85
|
+
// We now know the value of the cookie. If there is no cookie set,
|
|
86
|
+
// immediately set the didConsent state to STATUS_NOT_YET_ANSWERED.
|
|
87
|
+
if (didConsent === null) {
|
|
88
|
+
setDidConsent(STATUS_NOT_YET_ANSWERED, cookieOptions);
|
|
102
89
|
}
|
|
103
|
-
}, [didConsent, cookieOptions,
|
|
90
|
+
}, [didConsent, cookieOptions, setDidConsent]);
|
|
91
|
+
var isLoading = didConsent === null;
|
|
92
|
+
var isPrompting = didConsent === STATUS_NOT_YET_ANSWERED;
|
|
93
|
+
var isAnswered = didConsent === STATUS_ACCEPTED || didConsent === STATUS_DECLINED;
|
|
104
94
|
|
|
105
95
|
// This function expands the notification to show the options.
|
|
106
96
|
var displayConsentChoices = function displayConsentChoices(e) {
|
|
@@ -108,7 +98,7 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
|
108
98
|
setManualChoiceVisible(true);
|
|
109
99
|
};
|
|
110
100
|
|
|
111
|
-
// This function sets cookie-agreed to
|
|
101
|
+
// This function sets cookie-agreed to STATUS_ACCEPTED,
|
|
112
102
|
// and also sets the accepted categories in CookieAgreedCategories.
|
|
113
103
|
var _onAgree = function _onAgree(choices) {
|
|
114
104
|
var selectedChoices = Object.keys(choices).filter(function (key) {
|
|
@@ -122,7 +112,8 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
|
122
112
|
});
|
|
123
113
|
}
|
|
124
114
|
});
|
|
125
|
-
setDidConsent(
|
|
115
|
+
setDidConsent(STATUS_ACCEPTED, cookieOptions);
|
|
116
|
+
setAnsweredInCurrentSession(true);
|
|
126
117
|
|
|
127
118
|
// I used js-cookie for this insead of react-use-cookie because the encoding is not what we want
|
|
128
119
|
// for arrays in react-use-cookie. This shouldn't be an issue, as we don't want to keep track of
|
|
@@ -149,7 +140,8 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
|
149
140
|
onAgree(choices);
|
|
150
141
|
};
|
|
151
142
|
var _onDisagree = function _onDisagree() {
|
|
152
|
-
setDidConsent(
|
|
143
|
+
setDidConsent(STATUS_DECLINED, cookieOptions);
|
|
144
|
+
setAnsweredInCurrentSession(true);
|
|
153
145
|
_jsCookie.default.set('cookie-agreed-categories', JSON.stringify([]), {
|
|
154
146
|
expires: 365,
|
|
155
147
|
domain: cookieDomain
|
|
@@ -196,11 +188,18 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
|
196
188
|
setChoicesSelected(_objectSpread(_objectSpread({}, choicesSelected), {}, _defineProperty({}, value, checked)));
|
|
197
189
|
};
|
|
198
190
|
var classes = (0, _classnames.default)('Cookie', className, {
|
|
199
|
-
'Cookie--
|
|
191
|
+
'Cookie--prompting': isPrompting,
|
|
192
|
+
'Cookie--loading': isLoading,
|
|
193
|
+
'Cookie--answered': isAnswered,
|
|
194
|
+
// answering refers to the fact that the user has answered in the current session.
|
|
195
|
+
'Cookie--answering': answeredInCurrentSession,
|
|
196
|
+
'Cookie--hidden': isAnswered
|
|
200
197
|
});
|
|
201
198
|
|
|
202
|
-
//
|
|
203
|
-
if
|
|
199
|
+
// if it is answered in the current session, we still render the cookie but with the --hidden modifier,
|
|
200
|
+
// allowing consumers to apply an animation if desired. In other words, don't render only if a user has
|
|
201
|
+
// answered in a previous session.
|
|
202
|
+
if (isAnswered && !answeredInCurrentSession) {
|
|
204
203
|
return null;
|
|
205
204
|
}
|
|
206
205
|
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
@import '../../styles/assets/mixins';
|
|
2
2
|
@import '../../styles/assets/variables';
|
|
3
3
|
|
|
4
|
+
@keyframes slide {
|
|
5
|
+
0% {
|
|
6
|
+
transform: translateX(-50%) translateY(110vh);
|
|
7
|
+
}
|
|
8
|
+
100% {
|
|
9
|
+
transform: translateX(-50%) translateY(0vh);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
.Cookie {
|
|
5
14
|
width: 100%;
|
|
6
15
|
position: fixed;
|
|
7
16
|
left: 50%;
|
|
8
17
|
max-height: 100%;
|
|
9
18
|
bottom: 0;
|
|
10
|
-
transform: translateX(-50%);
|
|
11
19
|
z-index: 10000;
|
|
12
20
|
|
|
13
21
|
&--hidden {
|
|
@@ -20,6 +28,15 @@
|
|
|
20
28
|
}
|
|
21
29
|
}
|
|
22
30
|
|
|
31
|
+
&--prompting {
|
|
32
|
+
transform: translateX(-50%) translateY(0vh);
|
|
33
|
+
animation: slide 1s forwards;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&--loading {
|
|
37
|
+
transform: translateX(-50%) translateY(110vh);
|
|
38
|
+
}
|
|
39
|
+
|
|
23
40
|
&__content {
|
|
24
41
|
max-height: 100vh;
|
|
25
42
|
overflow-y: auto;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DownloadProps {
|
|
3
|
+
source: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
filesize?: number;
|
|
7
|
+
filename?: string;
|
|
8
|
+
mime: string;
|
|
9
|
+
target?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const Download: React.FC<DownloadProps>;
|
|
13
|
+
export default Download;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _prettyBytes = _interopRequireDefault(require("pretty-bytes"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
var Download = function Download(_ref) {
|
|
18
|
+
var source = _ref.source,
|
|
19
|
+
title = _ref.title,
|
|
20
|
+
_ref$description = _ref.description,
|
|
21
|
+
description = _ref$description === void 0 ? null : _ref$description,
|
|
22
|
+
_ref$filesize = _ref.filesize,
|
|
23
|
+
filesize = _ref$filesize === void 0 ? null : _ref$filesize,
|
|
24
|
+
_ref$filename = _ref.filename,
|
|
25
|
+
filename = _ref$filename === void 0 ? '' : _ref$filename,
|
|
26
|
+
mime = _ref.mime,
|
|
27
|
+
_ref$target = _ref.target,
|
|
28
|
+
target = _ref$target === void 0 ? '_self' : _ref$target,
|
|
29
|
+
className = _ref.className;
|
|
30
|
+
var classes = (0, _classnames.default)('Download', className);
|
|
31
|
+
var _mime$split = mime.split('/'),
|
|
32
|
+
_mime$split2 = _slicedToArray(_mime$split, 2),
|
|
33
|
+
mimeType = _mime$split2[0],
|
|
34
|
+
mimeSubType = _mime$split2[1];
|
|
35
|
+
var extension = filename.match(/\w+$/);
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement("a", {
|
|
37
|
+
className: classes,
|
|
38
|
+
target: target,
|
|
39
|
+
href: source,
|
|
40
|
+
rel: "noreferrer"
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
42
|
+
className: "Download__icon icon icon-dowload icon-".concat(mimeType, " icon-").concat(mimeSubType)
|
|
43
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
44
|
+
className: "Download__content"
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
46
|
+
className: "Download__title label"
|
|
47
|
+
}, title), description && /*#__PURE__*/_react.default.createElement("div", {
|
|
48
|
+
className: "Download__description"
|
|
49
|
+
}, description)), /*#__PURE__*/_react.default.createElement("div", {
|
|
50
|
+
className: "Download__attributes"
|
|
51
|
+
}, extension && /*#__PURE__*/_react.default.createElement("span", {
|
|
52
|
+
className: "Download__extension"
|
|
53
|
+
}, extension[0].toUpperCase()), filesize && /*#__PURE__*/_react.default.createElement("span", {
|
|
54
|
+
className: "Download__filesize"
|
|
55
|
+
}, "(", (0, _prettyBytes.default)(filesize), ")")));
|
|
56
|
+
};
|
|
57
|
+
var _default = Download;
|
|
58
|
+
exports.default = _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _ = _interopRequireDefault(require("."));
|
|
9
|
+
require("./stories.scss");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
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); }
|
|
12
|
+
var _default = {
|
|
13
|
+
title: 'Molecules/Download',
|
|
14
|
+
component: _.default
|
|
15
|
+
};
|
|
16
|
+
exports.default = _default;
|
|
17
|
+
var Default = function Default(args) {
|
|
18
|
+
var source = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf";
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_.default, _extends({
|
|
20
|
+
source: source,
|
|
21
|
+
title: "Download",
|
|
22
|
+
description: "Description",
|
|
23
|
+
filesize: 12594348,
|
|
24
|
+
filename: "dummy.pdf",
|
|
25
|
+
mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
26
|
+
}, args)), /*#__PURE__*/_react.default.createElement("p", null, "Borders have been added to show the nesting of elements. The orange colored box is an ", /*#__PURE__*/_react.default.createElement("code", null, "a-tag"), " which will contain the link.", /*#__PURE__*/_react.default.createElement("br", null), "The icon has been provided withclasses\xA0", /*#__PURE__*/_react.default.createElement("code", null, "icon-mimeType"), " and ", /*#__PURE__*/_react.default.createElement("code", null, "icon-mimeSubType"), ".", /*#__PURE__*/_react.default.createElement("br", null), "Based on that, you can overwrite the default ", /*#__PURE__*/_react.default.createElement("code", null, "icon-download"), " icon."));
|
|
27
|
+
};
|
|
28
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
@import '../../styles/assets/variables';
|
|
2
|
+
|
|
3
|
+
.Download {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
|
|
7
|
+
max-width: 80rem;
|
|
8
|
+
margin-bottom: 3rem;
|
|
9
|
+
padding: 1rem;
|
|
10
|
+
padding: 1rem;
|
|
11
|
+
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
|
|
14
|
+
background-color: $color--grey--lighter;
|
|
15
|
+
border: 2px solid $color--grey;
|
|
16
|
+
border-radius: 1rem;
|
|
17
|
+
border-radius: 1rem;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
color: $color--white;
|
|
22
|
+
background-color: $color--primary;
|
|
23
|
+
border-radius: 1rem;
|
|
24
|
+
|
|
25
|
+
div {
|
|
26
|
+
color: $color--white;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__icon {
|
|
30
|
+
background-position-y: -1em;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&__icon {
|
|
35
|
+
width: 3rem;
|
|
36
|
+
height: 3rem;
|
|
37
|
+
margin: 3rem 3rem 3rem 2rem;
|
|
38
|
+
font-size: 3rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&__content {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
flex-grow: 1;
|
|
45
|
+
gap: 1rem;
|
|
46
|
+
|
|
47
|
+
margin-right: 1rem;
|
|
48
|
+
padding: 1rem;
|
|
49
|
+
|
|
50
|
+
border: 2px solid $color--grey;
|
|
51
|
+
border-radius: 1rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&__title,
|
|
55
|
+
&__description,
|
|
56
|
+
&__attributes {
|
|
57
|
+
margin: 0;
|
|
58
|
+
padding: 1rem;
|
|
59
|
+
border: 2px solid $color--grey;
|
|
60
|
+
border-radius: 1rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&__extension {
|
|
64
|
+
margin-right: 1rem;
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default Picture;
|
|
2
|
+
declare function Picture({ src, className, onLoad, imageRef, includeWebP, ...props }: {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
src: any;
|
|
5
|
+
className: any;
|
|
6
|
+
onLoad: any;
|
|
7
|
+
imageRef: any;
|
|
8
|
+
includeWebP: any;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
declare namespace Picture {
|
|
11
|
+
namespace propTypes {
|
|
12
|
+
let onLoad: PropTypes.Requireable<(...args: any[]) => any>;
|
|
13
|
+
let alt: PropTypes.Requireable<string>;
|
|
14
|
+
}
|
|
15
|
+
namespace defaultProps {
|
|
16
|
+
export function onLoad_1(): void;
|
|
17
|
+
export { onLoad_1 as onLoad };
|
|
18
|
+
let alt_1: any;
|
|
19
|
+
export { alt_1 as alt };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
import React from 'react';
|
|
23
|
+
import PropTypes from 'prop-types';
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _immutable = _interopRequireDefault(require("immutable"));
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
11
|
var _extToMimeTypes = _interopRequireDefault(require("./data/ext-to-mime-types.json"));
|
|
11
12
|
require("./style.scss");
|
|
12
13
|
var _excluded = ["src", "className", "onLoad", "imageRef", "includeWebP"];
|
|
@@ -132,8 +133,13 @@ var Picture = function Picture(_ref) {
|
|
|
132
133
|
}
|
|
133
134
|
return null;
|
|
134
135
|
};
|
|
136
|
+
Picture.propTypes = {
|
|
137
|
+
onLoad: _propTypes.default.func,
|
|
138
|
+
alt: _propTypes.default.string
|
|
139
|
+
};
|
|
135
140
|
Picture.defaultProps = {
|
|
136
|
-
onLoad: function onLoad() {}
|
|
141
|
+
onLoad: function onLoad() {},
|
|
142
|
+
alt: null
|
|
137
143
|
};
|
|
138
144
|
var _default = Picture;
|
|
139
145
|
exports.default = _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default Image;
|
|
2
|
+
declare function Image(props: any): React.JSX.Element;
|
|
3
|
+
declare namespace Image {
|
|
4
|
+
let propTypes: {
|
|
5
|
+
onLoad: PropTypes.Requireable<(...args: any[]) => any>;
|
|
6
|
+
alt: PropTypes.Requireable<string>;
|
|
7
|
+
src: PropTypes.Validator<{}>;
|
|
8
|
+
lazyload: PropTypes.Requireable<boolean>;
|
|
9
|
+
};
|
|
10
|
+
namespace defaultProps {
|
|
11
|
+
let lazyload: boolean;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import PropTypes from 'prop-types';
|
|
@@ -10,6 +10,12 @@ var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-p
|
|
|
10
10
|
var _LazyLoadWrapper = _interopRequireDefault(require("./LazyLoadWrapper"));
|
|
11
11
|
var _Picture = _interopRequireDefault(require("./Picture"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
19
|
var Image = function Image(props) {
|
|
14
20
|
var lazyload = props.lazyload;
|
|
15
21
|
if (lazyload) {
|
|
@@ -19,10 +25,10 @@ var Image = function Image(props) {
|
|
|
19
25
|
}
|
|
20
26
|
return /*#__PURE__*/_react.default.createElement(_Picture.default, props);
|
|
21
27
|
};
|
|
22
|
-
Image.propTypes = {
|
|
28
|
+
Image.propTypes = _objectSpread({
|
|
23
29
|
src: _propTypes.default.oneOfType([_propTypes.default.string, _reactImmutableProptypes.default.map]).isRequired,
|
|
24
30
|
lazyload: _propTypes.default.bool
|
|
25
|
-
};
|
|
31
|
+
}, _Picture.default.propTypes);
|
|
26
32
|
Image.defaultProps = {
|
|
27
33
|
lazyload: true
|
|
28
34
|
};
|