@uncinc/uncinc-react-kitchen-sink 2.7.10 → 2.7.12
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/Form/RadioButtons/index.js +8 -2
- package/dist/components/PDFReader/ControlPanel/index.d.ts +20 -0
- package/dist/components/PDFReader/ControlPanel/index.js +166 -0
- package/dist/components/PDFReader/ControlPanel/style.scss +14 -0
- package/dist/components/PDFReader/index.d.ts +19 -0
- package/dist/components/PDFReader/index.js +89 -0
- package/dist/components/TitleWithText/index.d.ts +2 -3
- package/dist/components/TitleWithText/index.js +6 -3
- package/dist/config/i18next/locales/en.json +5 -0
- package/dist/config/i18next/locales/nl.json +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/organisms/Quote/index.js +1 -1
- package/dist/organisms/Text/index.d.ts +6 -3
- package/dist/organisms/Text/index.js +24 -11
- package/package.json +5 -4
|
@@ -20,9 +20,15 @@ var Radio = function Radio(props) {
|
|
|
20
20
|
var classes = c('WebformRadios__radio__input', {
|
|
21
21
|
'icon-before': true,
|
|
22
22
|
'icon-radio': true,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
// These double equals instead of triple equals are on purpose.
|
|
24
|
+
// JavaScript object keys are always strings even though they may be
|
|
25
|
+
// represented as numbers.
|
|
26
|
+
/* eslint-disable */
|
|
27
|
+
'icon-variant-0': !(field.value && field.value == props.value),
|
|
28
|
+
'icon-variant-1': field.value && field.value == props.value
|
|
29
|
+
/* eslint-enable */
|
|
25
30
|
});
|
|
31
|
+
|
|
26
32
|
if (props.value === '__other__') {
|
|
27
33
|
var inputClasses = c({
|
|
28
34
|
hidden: field.value !== '__other__'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
declare interface ControlPanelProps {
|
|
4
|
+
scale: number;
|
|
5
|
+
setScale: (scale: number) => void;
|
|
6
|
+
numPages: number;
|
|
7
|
+
pageNumber: number;
|
|
8
|
+
setPageNumber: (pageNumber: number) => void;
|
|
9
|
+
file: string;
|
|
10
|
+
goToFirstPageButton?: React.ReactNode;
|
|
11
|
+
goToNextPageButton?: React.ReactNode;
|
|
12
|
+
goToPreviousPageButton?: React.ReactNode;
|
|
13
|
+
goToLastPageButton?: React.ReactNode;
|
|
14
|
+
downloadButton?: React.ReactNode;
|
|
15
|
+
printButton?: React.ReactNode;
|
|
16
|
+
zoomInButton?: React.ReactNode;
|
|
17
|
+
zoomOutButton?: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
declare const ControlPanel: React.FC<ControlPanelProps>;
|
|
20
|
+
export default ControlPanel;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import Icon from '../../Icon';
|
|
4
|
+
import './style.scss';
|
|
5
|
+
var defaultButtons = {
|
|
6
|
+
goToFirstPageButton: /*#__PURE__*/React.createElement(Icon, {
|
|
7
|
+
name: "first_page",
|
|
8
|
+
flair: "filled"
|
|
9
|
+
}),
|
|
10
|
+
goToPreviousPageButton: /*#__PURE__*/React.createElement(Icon, {
|
|
11
|
+
name: "chevron_left",
|
|
12
|
+
flair: "filled"
|
|
13
|
+
}),
|
|
14
|
+
goToNextPageButton: /*#__PURE__*/React.createElement(Icon, {
|
|
15
|
+
name: "chevron_right",
|
|
16
|
+
flair: "filled"
|
|
17
|
+
}),
|
|
18
|
+
goToLastPageButton: /*#__PURE__*/React.createElement(Icon, {
|
|
19
|
+
name: "last_page",
|
|
20
|
+
flair: "filled"
|
|
21
|
+
}),
|
|
22
|
+
zoomInButton: /*#__PURE__*/React.createElement(Icon, {
|
|
23
|
+
name: "zoom_in",
|
|
24
|
+
flair: "filled"
|
|
25
|
+
}),
|
|
26
|
+
zoomOutButton: /*#__PURE__*/React.createElement(Icon, {
|
|
27
|
+
name: "zoom_out",
|
|
28
|
+
flair: "filled"
|
|
29
|
+
}),
|
|
30
|
+
download: /*#__PURE__*/React.createElement(Icon, {
|
|
31
|
+
name: "download",
|
|
32
|
+
flair: "filled"
|
|
33
|
+
}),
|
|
34
|
+
print: /*#__PURE__*/React.createElement(Icon, {
|
|
35
|
+
name: "print",
|
|
36
|
+
flair: "filled"
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
var MIN_ZOOM = 0.6;
|
|
40
|
+
var MAX_ZOOM = 2.0;
|
|
41
|
+
var ZOOM_STEP = 0.1;
|
|
42
|
+
var ControlPanel = function ControlPanel(props) {
|
|
43
|
+
var _useTranslation = useTranslation(),
|
|
44
|
+
t = _useTranslation.t;
|
|
45
|
+
var file = props.file,
|
|
46
|
+
pageNumber = props.pageNumber,
|
|
47
|
+
numPages = props.numPages,
|
|
48
|
+
setPageNumber = props.setPageNumber,
|
|
49
|
+
scale = props.scale,
|
|
50
|
+
setScale = props.setScale,
|
|
51
|
+
_props$goToFirstPageB = props.goToFirstPageButton,
|
|
52
|
+
goToFirstPageButton = _props$goToFirstPageB === void 0 ? defaultButtons.goToFirstPageButton : _props$goToFirstPageB,
|
|
53
|
+
_props$goToPreviousPa = props.goToPreviousPageButton,
|
|
54
|
+
goToPreviousPageButton = _props$goToPreviousPa === void 0 ? defaultButtons.goToPreviousPageButton : _props$goToPreviousPa,
|
|
55
|
+
_props$goToNextPageBu = props.goToNextPageButton,
|
|
56
|
+
goToNextPageButton = _props$goToNextPageBu === void 0 ? defaultButtons.goToNextPageButton : _props$goToNextPageBu,
|
|
57
|
+
_props$goToLastPageBu = props.goToLastPageButton,
|
|
58
|
+
goToLastPageButton = _props$goToLastPageBu === void 0 ? defaultButtons.goToLastPageButton : _props$goToLastPageBu,
|
|
59
|
+
_props$zoomInButton = props.zoomInButton,
|
|
60
|
+
zoomInButton = _props$zoomInButton === void 0 ? defaultButtons.zoomInButton : _props$zoomInButton,
|
|
61
|
+
_props$zoomOutButton = props.zoomOutButton,
|
|
62
|
+
zoomOutButton = _props$zoomOutButton === void 0 ? defaultButtons.zoomOutButton : _props$zoomOutButton,
|
|
63
|
+
_props$downloadButton = props.downloadButton,
|
|
64
|
+
downloadButton = _props$downloadButton === void 0 ? defaultButtons.download : _props$downloadButton,
|
|
65
|
+
_props$printButton = props.printButton,
|
|
66
|
+
printButton = _props$printButton === void 0 ? defaultButtons.print : _props$printButton;
|
|
67
|
+
var isFirstPage = pageNumber === 1;
|
|
68
|
+
var isLastPage = pageNumber === numPages;
|
|
69
|
+
var firstPageClass = isFirstPage ? 'disabled' : 'clickable';
|
|
70
|
+
var lastPageClass = isLastPage ? 'disabled' : 'clickable';
|
|
71
|
+
var goToFirstPage = function goToFirstPage() {
|
|
72
|
+
if (!isFirstPage) setPageNumber(1);
|
|
73
|
+
};
|
|
74
|
+
var goToPreviousPage = function goToPreviousPage() {
|
|
75
|
+
if (!isFirstPage) setPageNumber(pageNumber - 1);
|
|
76
|
+
};
|
|
77
|
+
var goToNextPage = function goToNextPage() {
|
|
78
|
+
if (!isLastPage) setPageNumber(pageNumber + 1);
|
|
79
|
+
};
|
|
80
|
+
var goToLastPage = function goToLastPage() {
|
|
81
|
+
if (!isLastPage) setPageNumber(numPages);
|
|
82
|
+
};
|
|
83
|
+
var onPageChange = function onPageChange(e) {
|
|
84
|
+
var value = e.target.value;
|
|
85
|
+
setPageNumber(Number(value));
|
|
86
|
+
};
|
|
87
|
+
var isMinZoom = scale < MIN_ZOOM;
|
|
88
|
+
var isMaxZoom = scale >= MAX_ZOOM;
|
|
89
|
+
var zoomOutClass = isMinZoom ? 'disabled' : 'clickable';
|
|
90
|
+
var zoomInClass = isMaxZoom ? 'disabled' : 'clickable';
|
|
91
|
+
var zoomOut = function zoomOut() {
|
|
92
|
+
if (!isMinZoom) setScale(scale - ZOOM_STEP);
|
|
93
|
+
};
|
|
94
|
+
var zoomIn = function zoomIn() {
|
|
95
|
+
if (!isMaxZoom) setScale(scale + ZOOM_STEP);
|
|
96
|
+
};
|
|
97
|
+
var print = function print() {
|
|
98
|
+
var pdfFrame = document.createElement('iframe');
|
|
99
|
+
pdfFrame.style.visibility = 'hidden';
|
|
100
|
+
pdfFrame.src = file;
|
|
101
|
+
document.body.appendChild(pdfFrame);
|
|
102
|
+
if (pdfFrame.contentWindow) {
|
|
103
|
+
pdfFrame.contentWindow.focus();
|
|
104
|
+
pdfFrame.contentWindow.print();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: "ControlPanel"
|
|
109
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
className: "ControlPanel__pageControl"
|
|
111
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
112
|
+
className: firstPageClass,
|
|
113
|
+
onClick: goToFirstPage,
|
|
114
|
+
type: "button"
|
|
115
|
+
}, goToFirstPageButton), /*#__PURE__*/React.createElement("button", {
|
|
116
|
+
className: firstPageClass,
|
|
117
|
+
onClick: goToPreviousPage,
|
|
118
|
+
type: "button"
|
|
119
|
+
}, goToPreviousPageButton), /*#__PURE__*/React.createElement("span", {
|
|
120
|
+
className: "ControlPanel__pageControl__pageIndicator"
|
|
121
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
122
|
+
className: "ControlPanel__pageControl__pageIndicator__current"
|
|
123
|
+
}, t('components.pdfreader.page')), /*#__PURE__*/React.createElement("input", {
|
|
124
|
+
name: "pageNumber",
|
|
125
|
+
type: "number",
|
|
126
|
+
min: 1,
|
|
127
|
+
max: numPages || 1,
|
|
128
|
+
value: pageNumber,
|
|
129
|
+
onChange: onPageChange
|
|
130
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
131
|
+
className: "ControlPanel__pageControl__pageIndicator__total"
|
|
132
|
+
}, t('components.pdfreader.of'), " ", numPages)), /*#__PURE__*/React.createElement("button", {
|
|
133
|
+
className: lastPageClass,
|
|
134
|
+
onClick: goToNextPage,
|
|
135
|
+
type: "button"
|
|
136
|
+
}, goToNextPageButton), /*#__PURE__*/React.createElement("button", {
|
|
137
|
+
className: lastPageClass,
|
|
138
|
+
onClick: goToLastPage,
|
|
139
|
+
type: "button"
|
|
140
|
+
}, goToLastPageButton)), /*#__PURE__*/React.createElement("div", {
|
|
141
|
+
className: "ControlPanel__pageControl"
|
|
142
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
143
|
+
className: zoomOutClass,
|
|
144
|
+
onClick: zoomOut,
|
|
145
|
+
type: "button"
|
|
146
|
+
}, zoomOutButton), /*#__PURE__*/React.createElement("span", {
|
|
147
|
+
className: "ControlPanel__pageControl__zoomLevel"
|
|
148
|
+
}, (scale * 100).toFixed(), "%"), /*#__PURE__*/React.createElement("button", {
|
|
149
|
+
className: zoomInClass,
|
|
150
|
+
onClick: zoomIn,
|
|
151
|
+
type: "button"
|
|
152
|
+
}, zoomInButton)), /*#__PURE__*/React.createElement("div", {
|
|
153
|
+
className: "ControlPanel__pageControl"
|
|
154
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
155
|
+
href: file,
|
|
156
|
+
download: "download"
|
|
157
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
158
|
+
className: zoomInClass,
|
|
159
|
+
type: "button"
|
|
160
|
+
}, downloadButton)), /*#__PURE__*/React.createElement("button", {
|
|
161
|
+
className: "clickable",
|
|
162
|
+
onClick: print,
|
|
163
|
+
type: "button"
|
|
164
|
+
}, printButton)));
|
|
165
|
+
};
|
|
166
|
+
export default ControlPanel;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { JSXElementConstructor } from 'react';
|
|
2
|
+
import 'react-pdf/dist/esm/Page/TextLayer.css';
|
|
3
|
+
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
|
|
4
|
+
export declare interface PDFReaderProps {
|
|
5
|
+
url: string;
|
|
6
|
+
goToFirstPageButton?: React.ReactNode;
|
|
7
|
+
goToNextPageButton?: React.ReactNode;
|
|
8
|
+
goToPreviousPageButton?: React.ReactNode;
|
|
9
|
+
goToLastPageButton?: React.ReactNode;
|
|
10
|
+
zoomInButton?: React.ReactNode;
|
|
11
|
+
zoomOutButton?: React.ReactNode;
|
|
12
|
+
downloadButton?: React.ReactNode;
|
|
13
|
+
printButton?: React.ReactNode;
|
|
14
|
+
loader?: React.ReactElement<any, string | JSXElementConstructor<any>>;
|
|
15
|
+
width?: number;
|
|
16
|
+
height?: number;
|
|
17
|
+
}
|
|
18
|
+
declare const PDFReader: React.FC<PDFReaderProps>;
|
|
19
|
+
export default PDFReader;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useState } from 'react';
|
|
8
|
+
import { Document, Page, pdfjs } from 'react-pdf';
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
import pdfjsWorker from 'pdfjs-dist/build/pdf.worker.entry';
|
|
11
|
+
import ControlPanel from './ControlPanel';
|
|
12
|
+
import 'react-pdf/dist/esm/Page/TextLayer.css';
|
|
13
|
+
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
|
|
14
|
+
pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker;
|
|
15
|
+
var PDFReader = function PDFReader(_ref) {
|
|
16
|
+
var url = _ref.url,
|
|
17
|
+
goToFirstPageButton = _ref.goToFirstPageButton,
|
|
18
|
+
goToNextPageButton = _ref.goToNextPageButton,
|
|
19
|
+
goToPreviousPageButton = _ref.goToPreviousPageButton,
|
|
20
|
+
goToLastPageButton = _ref.goToLastPageButton,
|
|
21
|
+
zoomInButton = _ref.zoomInButton,
|
|
22
|
+
zoomOutButton = _ref.zoomOutButton,
|
|
23
|
+
downloadButton = _ref.downloadButton,
|
|
24
|
+
printButton = _ref.printButton,
|
|
25
|
+
loader = _ref.loader,
|
|
26
|
+
width = _ref.width,
|
|
27
|
+
height = _ref.height;
|
|
28
|
+
var _useState = useState(1.0),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
scale = _useState2[0],
|
|
31
|
+
setScale = _useState2[1];
|
|
32
|
+
var _useState3 = useState(0),
|
|
33
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
34
|
+
numPages = _useState4[0],
|
|
35
|
+
setNumPages = _useState4[1];
|
|
36
|
+
var _useState5 = useState(1),
|
|
37
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
38
|
+
pageNumber = _useState6[0],
|
|
39
|
+
setPageNumber = _useState6[1];
|
|
40
|
+
var _useState7 = useState(1),
|
|
41
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
42
|
+
renderedPageNumber = _useState8[0],
|
|
43
|
+
setRenderedPageNumber = _useState8[1];
|
|
44
|
+
var isLoading = renderedPageNumber !== pageNumber;
|
|
45
|
+
function onDocumentLoadSuccess(_ref2) {
|
|
46
|
+
var numPagesTemp = _ref2.numPages;
|
|
47
|
+
setNumPages(numPagesTemp);
|
|
48
|
+
}
|
|
49
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: "PDFReader"
|
|
51
|
+
}, /*#__PURE__*/React.createElement(ControlPanel, {
|
|
52
|
+
scale: scale,
|
|
53
|
+
setScale: setScale,
|
|
54
|
+
numPages: numPages,
|
|
55
|
+
pageNumber: pageNumber,
|
|
56
|
+
setPageNumber: setPageNumber,
|
|
57
|
+
file: url,
|
|
58
|
+
goToFirstPageButton: goToFirstPageButton,
|
|
59
|
+
goToPreviousPageButton: goToPreviousPageButton,
|
|
60
|
+
goToNextPageButton: goToNextPageButton,
|
|
61
|
+
goToLastPageButton: goToLastPageButton,
|
|
62
|
+
zoomInButton: zoomInButton,
|
|
63
|
+
zoomOutButton: zoomOutButton,
|
|
64
|
+
downloadButton: downloadButton,
|
|
65
|
+
printButton: printButton
|
|
66
|
+
}), /*#__PURE__*/React.createElement(Document, {
|
|
67
|
+
file: url,
|
|
68
|
+
onLoadSuccess: onDocumentLoadSuccess,
|
|
69
|
+
onLoadError: console.error,
|
|
70
|
+
loading: loader
|
|
71
|
+
}, isLoading && renderedPageNumber ? /*#__PURE__*/React.createElement(Page, {
|
|
72
|
+
key: renderedPageNumber,
|
|
73
|
+
pageNumber: renderedPageNumber,
|
|
74
|
+
scale: scale,
|
|
75
|
+
width: width,
|
|
76
|
+
height: height
|
|
77
|
+
}) : null, /*#__PURE__*/React.createElement(Page, {
|
|
78
|
+
className: "".concat(isLoading ? 'loadingPage' : ''),
|
|
79
|
+
key: pageNumber,
|
|
80
|
+
pageNumber: pageNumber,
|
|
81
|
+
scale: scale,
|
|
82
|
+
width: width,
|
|
83
|
+
height: height,
|
|
84
|
+
onRenderSuccess: function onRenderSuccess() {
|
|
85
|
+
return setRenderedPageNumber(pageNumber);
|
|
86
|
+
}
|
|
87
|
+
})));
|
|
88
|
+
};
|
|
89
|
+
export default PDFReader;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface TitleWithTextProps {
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
export interface TitleWithTextProps extends React.HTMLProps<HTMLAttributes<HTMLDivElement>> {
|
|
3
3
|
title?: string;
|
|
4
4
|
titleProps?: React.ComponentPropsWithoutRef<'h2'>;
|
|
5
5
|
text?: string;
|
|
6
|
-
textProps?: React.HTMLProps<HTMLDivElement>;
|
|
7
6
|
className?: string;
|
|
8
7
|
}
|
|
9
8
|
declare const TitleWithText: React.FC<TitleWithTextProps>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
var _excluded = ["title", "titleProps", "text", "className"];
|
|
1
2
|
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); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
2
5
|
import React from 'react';
|
|
3
6
|
import c from 'classnames';
|
|
4
7
|
import WysiwygField from '../WysiwygField';
|
|
@@ -6,8 +9,8 @@ var TitleWithText = function TitleWithText(_ref) {
|
|
|
6
9
|
var title = _ref.title,
|
|
7
10
|
titleProps = _ref.titleProps,
|
|
8
11
|
text = _ref.text,
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
className = _ref.className,
|
|
13
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
11
14
|
var classes = c('TitleWithText', className);
|
|
12
15
|
return /*#__PURE__*/React.createElement("div", {
|
|
13
16
|
className: classes
|
|
@@ -16,7 +19,7 @@ var TitleWithText = function TitleWithText(_ref) {
|
|
|
16
19
|
}, titleProps), title), text && /*#__PURE__*/React.createElement(WysiwygField, _extends({
|
|
17
20
|
className: "TitleWithText__text",
|
|
18
21
|
property: "schema:text"
|
|
19
|
-
},
|
|
22
|
+
}, props, {
|
|
20
23
|
html: text
|
|
21
24
|
})));
|
|
22
25
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export { default as Cookie } from "./components/Cookie";
|
|
|
52
52
|
export { default as Downloads } from "./organisms/Downloads";
|
|
53
53
|
export { default as Header } from "./components/Header";
|
|
54
54
|
export { default as MediaPlayer } from "./components/MediaPlayer";
|
|
55
|
+
export { default as PDFReader } from "./components/PDFReader";
|
|
55
56
|
export { default as Quote } from "./organisms/Quote";
|
|
56
57
|
export { default as Share } from "./components/Share";
|
|
57
58
|
export { default as SliderRelated } from "./components/Sliders/SliderRelated";
|
package/dist/index.js
CHANGED
|
@@ -59,6 +59,7 @@ export { default as Cookie } from './components/Cookie';
|
|
|
59
59
|
export { default as Downloads } from './organisms/Downloads';
|
|
60
60
|
export { default as Header } from './components/Header';
|
|
61
61
|
export { default as MediaPlayer } from './components/MediaPlayer';
|
|
62
|
+
export { default as PDFReader } from './components/PDFReader';
|
|
62
63
|
export { default as Quote } from './organisms/Quote';
|
|
63
64
|
export { default as Share } from './components/Share';
|
|
64
65
|
export { default as SliderRelated } from './components/Sliders/SliderRelated';
|
|
@@ -27,7 +27,7 @@ var Quote = function Quote(_ref) {
|
|
|
27
27
|
className: "Quote__quotewrapper"
|
|
28
28
|
}, /*#__PURE__*/React.createElement("span", {
|
|
29
29
|
className: "Quote__icon icon icon-".concat(icon)
|
|
30
|
-
}), /*#__PURE__*/React.createElement("
|
|
30
|
+
}), /*#__PURE__*/React.createElement("blockquote", {
|
|
31
31
|
className: "Quote__quote"
|
|
32
32
|
}, quote), writer && /*#__PURE__*/React.createElement("div", {
|
|
33
33
|
className: "Quote__writer"
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface TextProps {
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
export interface TextProps extends React.HTMLProps<HTMLAttributes<HTMLDivElement>> {
|
|
3
3
|
title?: string;
|
|
4
4
|
titleProps?: React.ComponentProps<'h2'>;
|
|
5
5
|
text: string;
|
|
6
|
-
textProps?: React.HTMLProps<HTMLDivElement>;
|
|
7
6
|
readMore?: string;
|
|
8
7
|
duration?: number;
|
|
9
8
|
easing?: string;
|
|
@@ -14,6 +13,10 @@ export interface TextProps {
|
|
|
14
13
|
secondaryLink?: string;
|
|
15
14
|
secondaryLinkText?: string;
|
|
16
15
|
secondaryTarget?: string;
|
|
16
|
+
buttonClassName?: string;
|
|
17
|
+
buttonPrimary?: boolean;
|
|
18
|
+
secondaryButtonClassName?: string;
|
|
19
|
+
secondaryButtonPrimary?: boolean;
|
|
17
20
|
className?: string;
|
|
18
21
|
}
|
|
19
22
|
declare const Text: React.FC<TextProps>;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
var _excluded = ["title", "titleProps", "text", "readMore", "duration", "easing", "readMoreHeight", "link", "linkText", "target", "secondaryLink", "secondaryLinkText", "secondaryTarget", "buttonClassName", "buttonPrimary", "secondaryButtonPrimary", "secondaryButtonClassName", "className"];
|
|
2
|
+
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
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
4
|
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."); }
|
|
3
5
|
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); }
|
|
4
6
|
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; }
|
|
5
7
|
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; } }
|
|
6
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
11
|
import React, { useState } from 'react';
|
|
8
12
|
import { useTranslation } from 'react-i18next';
|
|
9
13
|
import AnimateHeight from 'react-animate-height';
|
|
@@ -14,7 +18,6 @@ var Text = function Text(_ref) {
|
|
|
14
18
|
var title = _ref.title,
|
|
15
19
|
titleProps = _ref.titleProps,
|
|
16
20
|
text = _ref.text,
|
|
17
|
-
textProps = _ref.textProps,
|
|
18
21
|
readMore = _ref.readMore,
|
|
19
22
|
_ref$duration = _ref.duration,
|
|
20
23
|
duration = _ref$duration === void 0 ? 333 : _ref$duration,
|
|
@@ -30,7 +33,14 @@ var Text = function Text(_ref) {
|
|
|
30
33
|
secondaryLinkText = _ref.secondaryLinkText,
|
|
31
34
|
_ref$secondaryTarget = _ref.secondaryTarget,
|
|
32
35
|
secondaryTarget = _ref$secondaryTarget === void 0 ? '_self' : _ref$secondaryTarget,
|
|
33
|
-
|
|
36
|
+
buttonClassName = _ref.buttonClassName,
|
|
37
|
+
_ref$buttonPrimary = _ref.buttonPrimary,
|
|
38
|
+
buttonPrimary = _ref$buttonPrimary === void 0 ? true : _ref$buttonPrimary,
|
|
39
|
+
_ref$secondaryButtonP = _ref.secondaryButtonPrimary,
|
|
40
|
+
secondaryButtonPrimary = _ref$secondaryButtonP === void 0 ? true : _ref$secondaryButtonP,
|
|
41
|
+
secondaryButtonClassName = _ref.secondaryButtonClassName,
|
|
42
|
+
className = _ref.className,
|
|
43
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
44
|
var _useState = useState(false),
|
|
35
45
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36
46
|
readMoreOpened = _useState2[0],
|
|
@@ -41,14 +51,15 @@ var Text = function Text(_ref) {
|
|
|
41
51
|
var readMoreClasses = c('Text__read_more', {
|
|
42
52
|
'Text__read_more--open': readMoreOpened
|
|
43
53
|
});
|
|
54
|
+
var buttonClasses = c('Text__link', buttonClassName);
|
|
55
|
+
var secondaryButtonClasses = c('Text__link__secondary', secondaryButtonClassName);
|
|
44
56
|
return /*#__PURE__*/React.createElement("div", {
|
|
45
57
|
className: classes
|
|
46
|
-
}, /*#__PURE__*/React.createElement(TitleWithText, {
|
|
58
|
+
}, /*#__PURE__*/React.createElement(TitleWithText, _extends({
|
|
47
59
|
title: title,
|
|
48
60
|
text: text,
|
|
49
|
-
titleProps: titleProps
|
|
50
|
-
|
|
51
|
-
}), readMore && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
titleProps: titleProps
|
|
62
|
+
}, props)), readMore && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
52
63
|
className: readMoreClasses
|
|
53
64
|
}, /*#__PURE__*/React.createElement(AnimateHeight, {
|
|
54
65
|
duration: duration,
|
|
@@ -65,16 +76,18 @@ var Text = function Text(_ref) {
|
|
|
65
76
|
}, readMoreOpened ? t('organisms.text.read_less') : t('organisms.text.read_more'))), (link || secondaryLink) && /*#__PURE__*/React.createElement("div", {
|
|
66
77
|
className: "Text__links"
|
|
67
78
|
}, link && /*#__PURE__*/React.createElement(Button, {
|
|
68
|
-
className:
|
|
79
|
+
className: buttonClasses,
|
|
69
80
|
href: link,
|
|
70
81
|
target: target,
|
|
71
|
-
rel: "noreferrer"
|
|
72
|
-
|
|
73
|
-
|
|
82
|
+
rel: "noreferrer",
|
|
83
|
+
primary: buttonPrimary
|
|
84
|
+
}, /*#__PURE__*/React.createElement("span", null, linkText)), secondaryLink && /*#__PURE__*/React.createElement(Button, {
|
|
85
|
+
className: secondaryButtonClasses,
|
|
74
86
|
href: secondaryLink,
|
|
75
87
|
target: secondaryTarget,
|
|
88
|
+
primary: secondaryButtonPrimary,
|
|
76
89
|
inverted: true,
|
|
77
90
|
rel: "noreferrer"
|
|
78
|
-
}, secondaryLinkText)));
|
|
91
|
+
}, /*#__PURE__*/React.createElement("span", null, secondaryLinkText))));
|
|
79
92
|
};
|
|
80
93
|
export default Text;
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uncinc/uncinc-react-kitchen-sink",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.12",
|
|
4
4
|
"description": "Default React components that are easily extended.",
|
|
5
5
|
"author": "uncinc",
|
|
6
|
-
"type": "module",
|
|
7
6
|
"license": "MIT",
|
|
8
7
|
"main": "dist/index.js",
|
|
9
8
|
"module": "dist/index.js",
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
},
|
|
29
28
|
"scripts": {
|
|
30
29
|
"start": "yarn run storybook",
|
|
31
|
-
"build": "
|
|
30
|
+
"build": "yarn build:js && yarn build:types",
|
|
32
31
|
"build:js": "cross-env NODE_ENV=production && rm -rf dist && mkdir dist && npx babel src --out-dir dist --copy-files --extensions .ts,.js,.tsx,.jsx,.cjs,.mjs",
|
|
33
32
|
"build:types": "tsc --outDir dist --rootDir src",
|
|
34
33
|
"build:cleanup": "find dist -type f -name 'stories.*' -delete -o -name '*.stories.*' -delete -o -name 'test.*' -delete -o -name '*.test.*' -delete",
|
|
@@ -39,7 +38,7 @@
|
|
|
39
38
|
"storybook": "storybook dev -p 6006",
|
|
40
39
|
"build-storybook": "storybook build",
|
|
41
40
|
"yalc-watch": "nodemon -e js,jsx,ts,tsx --ignore dist --exec \"yalc publish && yalc push\"",
|
|
42
|
-
"publish:npm": "yarn build
|
|
41
|
+
"publish:npm": "yarn build && yarn build:cleanup",
|
|
43
42
|
"extract": "sb extract",
|
|
44
43
|
"eslint": "NODE_ENV=development eslint './src/**/*.{js,jsx,ts,tsx}'",
|
|
45
44
|
"eslint:fix": "NODE_ENV=development eslint --fix './src/**/*.{js,jsx,ts,tsx}'",
|
|
@@ -60,6 +59,7 @@
|
|
|
60
59
|
"@types/react": "^18.2.6",
|
|
61
60
|
"@types/react-dom": "^18.2.4",
|
|
62
61
|
"@types/react-html-parser": "^2.0.2",
|
|
62
|
+
"@types/react-pdf": "^6",
|
|
63
63
|
"@types/react-router": "^5.1.20",
|
|
64
64
|
"@types/uuid": "^9.0.2",
|
|
65
65
|
"@types/video.js": "^7.3.52",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"react-immutable-proptypes": "^2.2.0",
|
|
93
93
|
"react-lazyload": "^3.0.0",
|
|
94
94
|
"react-paginate": "^7.1.3",
|
|
95
|
+
"react-pdf": "^6",
|
|
95
96
|
"react-redux": "^7.2.4",
|
|
96
97
|
"react-remove-scroll": "^2.5.5",
|
|
97
98
|
"react-router": "5.2.0",
|