@digigov/ui 0.14.0 → 0.16.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/CHANGELOG.md +25 -1
- package/admin/Dropdown/index.d.ts +15 -0
- package/admin/Dropdown/index.js +90 -0
- package/admin/index.d.ts +1 -0
- package/admin/index.js +18 -0
- package/api/APIErrors.d.ts +3 -3
- package/app/I18nText.d.ts +10 -0
- package/app/I18nText.js +94 -0
- package/app/i18n.d.ts +2 -0
- package/app/i18n.js +3 -1
- package/app/index.d.ts +1 -0
- package/app/index.js +13 -0
- package/core/PaginationLabel/index.js +4 -6
- package/core/Table/index.d.ts +1 -1
- package/core/Table/index.js +4 -4
- package/core/index.d.ts +8 -5
- package/core/index.js +78 -22
- package/es/admin/Dropdown/index.js +41 -0
- package/es/admin/index.js +1 -0
- package/es/app/I18nText.js +79 -0
- package/es/app/i18n.js +1 -3
- package/es/app/index.js +2 -1
- package/es/core/PaginationLabel/index.js +4 -6
- package/es/core/Table/index.js +1 -1
- package/es/core/index.js +8 -5
- package/es/index.js +2 -1
- package/es/locales/el.js +8 -1
- package/es/locales/en.js +8 -1
- package/esm/admin/Dropdown/index.js +41 -0
- package/esm/admin/index.js +1 -0
- package/esm/app/I18nText.js +79 -0
- package/esm/app/i18n.js +1 -3
- package/esm/app/index.js +2 -1
- package/esm/core/PaginationLabel/index.js +4 -6
- package/esm/core/Table/index.js +1 -1
- package/esm/core/index.js +8 -5
- package/esm/index.js +3 -2
- package/esm/locales/el.js +8 -1
- package/esm/locales/en.js +8 -1
- package/index.d.ts +1 -0
- package/index.js +13 -0
- package/locales/el.d.ts +7 -0
- package/locales/el.js +8 -1
- package/locales/en.d.ts +7 -0
- package/locales/en.js +8 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
# Change Log - @digigov/ui
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 14 Apr 2022 12:32:51 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.16.0
|
|
6
|
+
Thu, 14 Apr 2022 12:32:51 GMT
|
|
7
|
+
|
|
8
|
+
### Minor changes
|
|
9
|
+
|
|
10
|
+
- create I18nText component which translates complex sentences
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- add text translations in en and el locales
|
|
15
|
+
|
|
16
|
+
## 0.15.1
|
|
17
|
+
Wed, 30 Mar 2022 12:28:30 GMT
|
|
18
|
+
|
|
19
|
+
_Version update only_
|
|
20
|
+
|
|
21
|
+
## 0.15.0
|
|
22
|
+
Thu, 17 Mar 2022 10:24:06 GMT
|
|
23
|
+
|
|
24
|
+
### Minor changes
|
|
25
|
+
|
|
26
|
+
- Integrate @digigov/react-extensions/Dropdown component
|
|
27
|
+
- rename TableHeaderCell to TableHeadCell export
|
|
4
28
|
|
|
5
29
|
## 0.14.0
|
|
6
30
|
Wed, 09 Mar 2022 13:21:47 GMT
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DropdownProps as CoreDropdownProps } from '@digigov/react-extensions/admin/Dropdown';
|
|
3
|
+
export * from '@digigov/react-extensions/admin/DropdownButton';
|
|
4
|
+
export * from '@digigov/react-extensions/admin/DropdownContent';
|
|
5
|
+
export interface DropdownProps extends CoreDropdownProps {
|
|
6
|
+
/**
|
|
7
|
+
* Use closeBehaviour to set the way that the Dropdown will close.
|
|
8
|
+
*/
|
|
9
|
+
closeBehaviour?: 'clickButton' | 'clickOutside';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Dropdown component is used for showing more options with a button.
|
|
13
|
+
*/
|
|
14
|
+
export declare const Dropdown: ({ closeBehaviour, ...props }: DropdownProps) => React.ReactElement;
|
|
15
|
+
export default Dropdown;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
var _exportNames = {
|
|
11
|
+
Dropdown: true
|
|
12
|
+
};
|
|
13
|
+
exports["default"] = exports.Dropdown = void 0;
|
|
14
|
+
|
|
15
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
16
|
+
|
|
17
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
18
|
+
|
|
19
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
20
|
+
|
|
21
|
+
var _Dropdown = _interopRequireDefault(require("@digigov/react-extensions/admin/Dropdown"));
|
|
22
|
+
|
|
23
|
+
var _DropdownButton = require("@digigov/react-extensions/admin/DropdownButton");
|
|
24
|
+
|
|
25
|
+
Object.keys(_DropdownButton).forEach(function (key) {
|
|
26
|
+
if (key === "default" || key === "__esModule") return;
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
+
if (key in exports && exports[key] === _DropdownButton[key]) return;
|
|
29
|
+
Object.defineProperty(exports, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function get() {
|
|
32
|
+
return _DropdownButton[key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
var _DropdownContent = require("@digigov/react-extensions/admin/DropdownContent");
|
|
38
|
+
|
|
39
|
+
Object.keys(_DropdownContent).forEach(function (key) {
|
|
40
|
+
if (key === "default" || key === "__esModule") return;
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
42
|
+
if (key in exports && exports[key] === _DropdownContent[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _DropdownContent[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _excluded = ["closeBehaviour"];
|
|
51
|
+
|
|
52
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
53
|
+
|
|
54
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Dropdown component is used for showing more options with a button.
|
|
58
|
+
*/
|
|
59
|
+
var Dropdown = function Dropdown(_ref) {
|
|
60
|
+
var _ref$closeBehaviour = _ref.closeBehaviour,
|
|
61
|
+
closeBehaviour = _ref$closeBehaviour === void 0 ? 'clickOutside' : _ref$closeBehaviour,
|
|
62
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
63
|
+
var innerRef = (0, _react.useRef)();
|
|
64
|
+
(0, _react.useEffect)(function () {
|
|
65
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
66
|
+
if (innerRef.current && !innerRef.current.contains(event.target)) {
|
|
67
|
+
innerRef.current.open = false;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
if (closeBehaviour === 'clickOutside') {
|
|
72
|
+
document.addEventListener('click', handleClickOutside, true);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return function () {
|
|
76
|
+
if (closeBehaviour === 'clickOutside') {
|
|
77
|
+
document.removeEventListener('click', handleClickOutside, true);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}, []); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
|
|
83
|
+
return /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], (0, _extends2["default"])({
|
|
84
|
+
ref: innerRef
|
|
85
|
+
}, props));
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
exports.Dropdown = Dropdown;
|
|
89
|
+
var _default = Dropdown;
|
|
90
|
+
exports["default"] = _default;
|
package/admin/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@digigov/ui/admin/Dropdown';
|
package/admin/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _Dropdown = require("@digigov/ui/admin/Dropdown");
|
|
8
|
+
|
|
9
|
+
Object.keys(_Dropdown).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _Dropdown[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _Dropdown[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
package/api/APIErrors.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare class APIErrors extends React.Component<{
|
|
3
|
-
fallback:
|
|
3
|
+
fallback: any;
|
|
4
4
|
}> {
|
|
5
5
|
state: {
|
|
6
6
|
hasError: boolean;
|
|
7
7
|
error: null;
|
|
8
8
|
};
|
|
9
|
-
static getDerivedStateFromError(error: Error):
|
|
10
|
-
render():
|
|
9
|
+
static getDerivedStateFromError(error: Error): Record<string, any>;
|
|
10
|
+
render(): any;
|
|
11
11
|
}
|
|
12
12
|
export default APIErrors;
|
|
13
13
|
export declare class APIError extends Error {
|
package/app/I18nText.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.I18nText = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
|
|
18
|
+
var _i18n = require("@digigov/ui/app/i18n");
|
|
19
|
+
|
|
20
|
+
var _app = require("@digigov/ui/app");
|
|
21
|
+
|
|
22
|
+
var isObject = function isObject(value) {
|
|
23
|
+
return !!(value && (0, _typeof2["default"])(value) === 'object' && !Array.isArray(value));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var resultTranslate = function resultTranslate(translation, children) {
|
|
27
|
+
var parser = new DOMParser();
|
|
28
|
+
var childrenCloned = (0, _toConsumableArray2["default"])(children);
|
|
29
|
+
console.log('children cloned are', childrenCloned);
|
|
30
|
+
var doc1 = parser.parseFromString("<div>".concat(translation.replace(/<([0-9])>/g, '<t$1>').replace(/<\/([0-9])>/g, '</t$1>'), "</div>"), 'application/xml');
|
|
31
|
+
return recursiveReplace(childrenCloned, doc1.children[0].childNodes);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var recursiveReplace = function recursiveReplace(original, translation) {
|
|
35
|
+
if (!Array.isArray(original)) {
|
|
36
|
+
original = [original];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
original.forEach(function (element, i) {
|
|
40
|
+
if (typeof element === 'string' || typeof element === 'number') {
|
|
41
|
+
var text = [];
|
|
42
|
+
var regex = /{([^}]+)}/;
|
|
43
|
+
|
|
44
|
+
if (regex.test(translation[i].textContent)) {
|
|
45
|
+
var textArray = translation[i].textContent.split(' ');
|
|
46
|
+
console.log('textArray is', textArray);
|
|
47
|
+
|
|
48
|
+
if (textArray.length === 1) {
|
|
49
|
+
return false;
|
|
50
|
+
} else {
|
|
51
|
+
textArray.forEach(function (txt) {
|
|
52
|
+
if (!regex.test(txt)) {
|
|
53
|
+
text.push(txt);
|
|
54
|
+
} else {
|
|
55
|
+
text.push(original[i]);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return original[i] = text.join(' ');
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
return original[i] = translation[i].textContent;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (isObject(element)) {
|
|
66
|
+
original[i] = /*#__PURE__*/_react["default"].cloneElement(original[i], (0, _extends2["default"])({}, original[i].props, {
|
|
67
|
+
children: recursiveReplace(original[i].props.children, translation[i].childNodes)
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return original;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var I18nText = function I18nText(_ref) {
|
|
75
|
+
var i18nKey = _ref.i18nKey,
|
|
76
|
+
children = _ref.children;
|
|
77
|
+
var translation = (0, _i18n.defaultTranslate)(i18nKey);
|
|
78
|
+
var result = resultTranslate(translation, children);
|
|
79
|
+
|
|
80
|
+
var _useTranslation = (0, _app.useTranslation)(),
|
|
81
|
+
Trans = _useTranslation.Trans;
|
|
82
|
+
|
|
83
|
+
if (Trans) {
|
|
84
|
+
return /*#__PURE__*/_react["default"].createElement(Trans, {
|
|
85
|
+
i18nKey: i18nKey
|
|
86
|
+
}, children);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, result);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.I18nText = I18nText;
|
|
93
|
+
var _default = I18nText;
|
|
94
|
+
exports["default"] = _default;
|
package/app/i18n.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface I18NContextProps {
|
|
3
|
+
Trans?: any;
|
|
3
4
|
t: (str: string) => string;
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
i18n?: any;
|
|
6
7
|
}
|
|
8
|
+
export declare const defaultTranslate: (key: any) => any;
|
|
7
9
|
export declare const I18NContext: React.Context<I18NContextProps>;
|
|
8
10
|
export declare const I18NProvider: React.FC<I18NContextProps>;
|
|
9
11
|
export declare const useTranslation: () => I18NContextProps;
|
package/app/i18n.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.useTranslation = exports["default"] = exports.I18NProvider = exports.I18NContext = void 0;
|
|
8
|
+
exports.useTranslation = exports.defaultTranslate = exports["default"] = exports.I18NProvider = exports.I18NContext = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -34,6 +34,8 @@ var defaultTranslate = function defaultTranslate(key) {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
exports.defaultTranslate = defaultTranslate;
|
|
38
|
+
|
|
37
39
|
var I18NContext = /*#__PURE__*/_react["default"].createContext({
|
|
38
40
|
t: defaultTranslate
|
|
39
41
|
});
|
package/app/index.d.ts
CHANGED
package/app/index.js
CHANGED
|
@@ -67,4 +67,17 @@ Object.keys(_i18n).forEach(function (key) {
|
|
|
67
67
|
return _i18n[key];
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
var _I18nText = require("@digigov/ui/app/I18nText");
|
|
73
|
+
|
|
74
|
+
Object.keys(_I18nText).forEach(function (key) {
|
|
75
|
+
if (key === "default" || key === "__esModule") return;
|
|
76
|
+
if (key in exports && exports[key] === _I18nText[key]) return;
|
|
77
|
+
Object.defineProperty(exports, key, {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function get() {
|
|
80
|
+
return _I18nText[key];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
70
83
|
});
|
|
@@ -11,7 +11,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _PaginationLabel = _interopRequireDefault(require("@digigov/react-extensions/admin/PaginationLabel"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _I18nText = require("@digigov/ui/app/I18nText");
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* PaginationLabel component is used for placing the pagination results label.
|
|
@@ -20,13 +20,11 @@ var PaginationLabel = /*#__PURE__*/_react["default"].forwardRef(function Paginat
|
|
|
20
20
|
var start = _ref.start,
|
|
21
21
|
end = _ref.end,
|
|
22
22
|
total = _ref.total;
|
|
23
|
-
|
|
24
|
-
var _useTranslation = (0, _app.useTranslation)(),
|
|
25
|
-
t = _useTranslation.t;
|
|
26
|
-
|
|
27
23
|
return /*#__PURE__*/_react["default"].createElement(_PaginationLabel["default"], {
|
|
28
24
|
ref: ref
|
|
29
|
-
},
|
|
25
|
+
}, /*#__PURE__*/_react["default"].createElement(_I18nText.I18nText, {
|
|
26
|
+
i18nKey: "pagination.label"
|
|
27
|
+
}, "Showing ", /*#__PURE__*/_react["default"].createElement("b", null, start), " to ", /*#__PURE__*/_react["default"].createElement("b", null, end), " of ", /*#__PURE__*/_react["default"].createElement("b", null, total), " results."));
|
|
30
28
|
});
|
|
31
29
|
|
|
32
30
|
exports.PaginationLabel = PaginationLabel;
|
package/core/Table/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export * from '@digigov/react-core/TableBody';
|
|
|
3
3
|
export * from '@digigov/react-core/TableCaption';
|
|
4
4
|
export * from '@digigov/react-core/TableDataCell';
|
|
5
5
|
export * from '@digigov/react-core/TableHead';
|
|
6
|
-
export * from '@digigov/react-core/
|
|
6
|
+
export * from '@digigov/react-core/TableHeadCell';
|
|
7
7
|
export * from '@digigov/react-core/TableRow';
|
package/core/Table/index.js
CHANGED
|
@@ -69,15 +69,15 @@ Object.keys(_TableHead).forEach(function (key) {
|
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
var
|
|
72
|
+
var _TableHeadCell = require("@digigov/react-core/TableHeadCell");
|
|
73
73
|
|
|
74
|
-
Object.keys(
|
|
74
|
+
Object.keys(_TableHeadCell).forEach(function (key) {
|
|
75
75
|
if (key === "default" || key === "__esModule") return;
|
|
76
|
-
if (key in exports && exports[key] ===
|
|
76
|
+
if (key in exports && exports[key] === _TableHeadCell[key]) return;
|
|
77
77
|
Object.defineProperty(exports, key, {
|
|
78
78
|
enumerable: true,
|
|
79
79
|
get: function get() {
|
|
80
|
-
return
|
|
80
|
+
return _TableHeadCell[key];
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
});
|
package/core/index.d.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
export { default as Button } from '@digigov/ui/core/Button';
|
|
2
2
|
export * from '@digigov/ui/core/Button';
|
|
3
|
-
export { default as WarningText } from '@digigov/ui/core/WarningText';
|
|
4
3
|
export * from '@digigov/ui/core/Accordion';
|
|
5
4
|
export * from '@digigov/ui/core/Blockquote';
|
|
5
|
+
export * from '@digigov/ui/core/Breadcrumbs';
|
|
6
|
+
export * from '@digigov/ui/core/Card';
|
|
6
7
|
export * from '@digigov/ui/core/Details';
|
|
8
|
+
export * from '@digigov/ui/core/Divider';
|
|
7
9
|
export * from '@digigov/ui/core/ErrorSummary';
|
|
10
|
+
export * from '@digigov/ui/core/Hidden';
|
|
8
11
|
export * from '@digigov/ui/core/Link';
|
|
9
12
|
export * from '@digigov/ui/core/List';
|
|
10
13
|
export * from '@digigov/ui/core/NavList';
|
|
11
14
|
export * from '@digigov/ui/core/ServiceBadge';
|
|
12
|
-
export * from '@digigov/ui/core/SummaryList';
|
|
13
|
-
export * from '@digigov/ui/core/Tabs';
|
|
14
15
|
export * from '@digigov/ui/core/NotificationBanner';
|
|
16
|
+
export * from '@digigov/ui/core/SummaryList';
|
|
15
17
|
export * from '@digigov/ui/core/Table';
|
|
16
|
-
export * from '@digigov/ui/core/
|
|
17
|
-
export * from '@digigov/ui/core/
|
|
18
|
+
export * from '@digigov/ui/core/Tabs';
|
|
19
|
+
export * from '@digigov/ui/core/VisuallyHidden';
|
|
20
|
+
export { default as WarningText } from '@digigov/ui/core/WarningText';
|
|
18
21
|
export * from '@digigov/ui/core/PaginationLabel';
|
package/core/index.js
CHANGED
|
@@ -38,8 +38,6 @@ Object.keys(_Button).forEach(function (key) {
|
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
var _WarningText = _interopRequireDefault(require("@digigov/ui/core/WarningText"));
|
|
42
|
-
|
|
43
41
|
var _Accordion = require("@digigov/ui/core/Accordion");
|
|
44
42
|
|
|
45
43
|
Object.keys(_Accordion).forEach(function (key) {
|
|
@@ -68,6 +66,34 @@ Object.keys(_Blockquote).forEach(function (key) {
|
|
|
68
66
|
});
|
|
69
67
|
});
|
|
70
68
|
|
|
69
|
+
var _Breadcrumbs = require("@digigov/ui/core/Breadcrumbs");
|
|
70
|
+
|
|
71
|
+
Object.keys(_Breadcrumbs).forEach(function (key) {
|
|
72
|
+
if (key === "default" || key === "__esModule") return;
|
|
73
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
74
|
+
if (key in exports && exports[key] === _Breadcrumbs[key]) return;
|
|
75
|
+
Object.defineProperty(exports, key, {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function get() {
|
|
78
|
+
return _Breadcrumbs[key];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
var _Card = require("@digigov/ui/core/Card");
|
|
84
|
+
|
|
85
|
+
Object.keys(_Card).forEach(function (key) {
|
|
86
|
+
if (key === "default" || key === "__esModule") return;
|
|
87
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
88
|
+
if (key in exports && exports[key] === _Card[key]) return;
|
|
89
|
+
Object.defineProperty(exports, key, {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function get() {
|
|
92
|
+
return _Card[key];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
71
97
|
var _Details = require("@digigov/ui/core/Details");
|
|
72
98
|
|
|
73
99
|
Object.keys(_Details).forEach(function (key) {
|
|
@@ -82,6 +108,20 @@ Object.keys(_Details).forEach(function (key) {
|
|
|
82
108
|
});
|
|
83
109
|
});
|
|
84
110
|
|
|
111
|
+
var _Divider = require("@digigov/ui/core/Divider");
|
|
112
|
+
|
|
113
|
+
Object.keys(_Divider).forEach(function (key) {
|
|
114
|
+
if (key === "default" || key === "__esModule") return;
|
|
115
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
116
|
+
if (key in exports && exports[key] === _Divider[key]) return;
|
|
117
|
+
Object.defineProperty(exports, key, {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
get: function get() {
|
|
120
|
+
return _Divider[key];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
85
125
|
var _ErrorSummary = require("@digigov/ui/core/ErrorSummary");
|
|
86
126
|
|
|
87
127
|
Object.keys(_ErrorSummary).forEach(function (key) {
|
|
@@ -96,6 +136,20 @@ Object.keys(_ErrorSummary).forEach(function (key) {
|
|
|
96
136
|
});
|
|
97
137
|
});
|
|
98
138
|
|
|
139
|
+
var _Hidden = require("@digigov/ui/core/Hidden");
|
|
140
|
+
|
|
141
|
+
Object.keys(_Hidden).forEach(function (key) {
|
|
142
|
+
if (key === "default" || key === "__esModule") return;
|
|
143
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
144
|
+
if (key in exports && exports[key] === _Hidden[key]) return;
|
|
145
|
+
Object.defineProperty(exports, key, {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
get: function get() {
|
|
148
|
+
return _Hidden[key];
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
99
153
|
var _Link = require("@digigov/ui/core/Link");
|
|
100
154
|
|
|
101
155
|
Object.keys(_Link).forEach(function (key) {
|
|
@@ -152,76 +206,78 @@ Object.keys(_ServiceBadge).forEach(function (key) {
|
|
|
152
206
|
});
|
|
153
207
|
});
|
|
154
208
|
|
|
155
|
-
var
|
|
209
|
+
var _NotificationBanner = require("@digigov/ui/core/NotificationBanner");
|
|
156
210
|
|
|
157
|
-
Object.keys(
|
|
211
|
+
Object.keys(_NotificationBanner).forEach(function (key) {
|
|
158
212
|
if (key === "default" || key === "__esModule") return;
|
|
159
213
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
160
|
-
if (key in exports && exports[key] ===
|
|
214
|
+
if (key in exports && exports[key] === _NotificationBanner[key]) return;
|
|
161
215
|
Object.defineProperty(exports, key, {
|
|
162
216
|
enumerable: true,
|
|
163
217
|
get: function get() {
|
|
164
|
-
return
|
|
218
|
+
return _NotificationBanner[key];
|
|
165
219
|
}
|
|
166
220
|
});
|
|
167
221
|
});
|
|
168
222
|
|
|
169
|
-
var
|
|
223
|
+
var _SummaryList = require("@digigov/ui/core/SummaryList");
|
|
170
224
|
|
|
171
|
-
Object.keys(
|
|
225
|
+
Object.keys(_SummaryList).forEach(function (key) {
|
|
172
226
|
if (key === "default" || key === "__esModule") return;
|
|
173
227
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
174
|
-
if (key in exports && exports[key] ===
|
|
228
|
+
if (key in exports && exports[key] === _SummaryList[key]) return;
|
|
175
229
|
Object.defineProperty(exports, key, {
|
|
176
230
|
enumerable: true,
|
|
177
231
|
get: function get() {
|
|
178
|
-
return
|
|
232
|
+
return _SummaryList[key];
|
|
179
233
|
}
|
|
180
234
|
});
|
|
181
235
|
});
|
|
182
236
|
|
|
183
|
-
var
|
|
237
|
+
var _Table = require("@digigov/ui/core/Table");
|
|
184
238
|
|
|
185
|
-
Object.keys(
|
|
239
|
+
Object.keys(_Table).forEach(function (key) {
|
|
186
240
|
if (key === "default" || key === "__esModule") return;
|
|
187
241
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
188
|
-
if (key in exports && exports[key] ===
|
|
242
|
+
if (key in exports && exports[key] === _Table[key]) return;
|
|
189
243
|
Object.defineProperty(exports, key, {
|
|
190
244
|
enumerable: true,
|
|
191
245
|
get: function get() {
|
|
192
|
-
return
|
|
246
|
+
return _Table[key];
|
|
193
247
|
}
|
|
194
248
|
});
|
|
195
249
|
});
|
|
196
250
|
|
|
197
|
-
var
|
|
251
|
+
var _Tabs = require("@digigov/ui/core/Tabs");
|
|
198
252
|
|
|
199
|
-
Object.keys(
|
|
253
|
+
Object.keys(_Tabs).forEach(function (key) {
|
|
200
254
|
if (key === "default" || key === "__esModule") return;
|
|
201
255
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
202
|
-
if (key in exports && exports[key] ===
|
|
256
|
+
if (key in exports && exports[key] === _Tabs[key]) return;
|
|
203
257
|
Object.defineProperty(exports, key, {
|
|
204
258
|
enumerable: true,
|
|
205
259
|
get: function get() {
|
|
206
|
-
return
|
|
260
|
+
return _Tabs[key];
|
|
207
261
|
}
|
|
208
262
|
});
|
|
209
263
|
});
|
|
210
264
|
|
|
211
|
-
var
|
|
265
|
+
var _VisuallyHidden = require("@digigov/ui/core/VisuallyHidden");
|
|
212
266
|
|
|
213
|
-
Object.keys(
|
|
267
|
+
Object.keys(_VisuallyHidden).forEach(function (key) {
|
|
214
268
|
if (key === "default" || key === "__esModule") return;
|
|
215
269
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
216
|
-
if (key in exports && exports[key] ===
|
|
270
|
+
if (key in exports && exports[key] === _VisuallyHidden[key]) return;
|
|
217
271
|
Object.defineProperty(exports, key, {
|
|
218
272
|
enumerable: true,
|
|
219
273
|
get: function get() {
|
|
220
|
-
return
|
|
274
|
+
return _VisuallyHidden[key];
|
|
221
275
|
}
|
|
222
276
|
});
|
|
223
277
|
});
|
|
224
278
|
|
|
279
|
+
var _WarningText = _interopRequireDefault(require("@digigov/ui/core/WarningText"));
|
|
280
|
+
|
|
225
281
|
var _PaginationLabel = require("@digigov/ui/core/PaginationLabel");
|
|
226
282
|
|
|
227
283
|
Object.keys(_PaginationLabel).forEach(function (key) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["closeBehaviour"];
|
|
4
|
+
import React, { useEffect, useRef } from 'react';
|
|
5
|
+
import CoreDropdown from '@digigov/react-extensions/admin/Dropdown';
|
|
6
|
+
export * from '@digigov/react-extensions/admin/DropdownButton';
|
|
7
|
+
export * from '@digigov/react-extensions/admin/DropdownContent';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Dropdown component is used for showing more options with a button.
|
|
11
|
+
*/
|
|
12
|
+
export var Dropdown = function Dropdown(_ref) {
|
|
13
|
+
var _ref$closeBehaviour = _ref.closeBehaviour,
|
|
14
|
+
closeBehaviour = _ref$closeBehaviour === void 0 ? 'clickOutside' : _ref$closeBehaviour,
|
|
15
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
|
|
17
|
+
var innerRef = useRef();
|
|
18
|
+
useEffect(function () {
|
|
19
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
20
|
+
if (innerRef.current && !innerRef.current.contains(event.target)) {
|
|
21
|
+
innerRef.current.open = false;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
if (closeBehaviour === 'clickOutside') {
|
|
26
|
+
document.addEventListener('click', handleClickOutside, true);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return function () {
|
|
30
|
+
if (closeBehaviour === 'clickOutside') {
|
|
31
|
+
document.removeEventListener('click', handleClickOutside, true);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}, []); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
|
|
37
|
+
return /*#__PURE__*/React.createElement(CoreDropdown, _extends({
|
|
38
|
+
ref: innerRef
|
|
39
|
+
}, props));
|
|
40
|
+
};
|
|
41
|
+
export default Dropdown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@digigov/ui/admin/Dropdown';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { defaultTranslate } from '@digigov/ui/app/i18n';
|
|
6
|
+
import { useTranslation } from '@digigov/ui/app';
|
|
7
|
+
|
|
8
|
+
var isObject = function isObject(value) {
|
|
9
|
+
return !!(value && _typeof(value) === 'object' && !Array.isArray(value));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
var resultTranslate = function resultTranslate(translation, children) {
|
|
13
|
+
var parser = new DOMParser();
|
|
14
|
+
|
|
15
|
+
var childrenCloned = _toConsumableArray(children);
|
|
16
|
+
|
|
17
|
+
console.log('children cloned are', childrenCloned);
|
|
18
|
+
var doc1 = parser.parseFromString("<div>".concat(translation.replace(/<([0-9])>/g, '<t$1>').replace(/<\/([0-9])>/g, '</t$1>'), "</div>"), 'application/xml');
|
|
19
|
+
return recursiveReplace(childrenCloned, doc1.children[0].childNodes);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var recursiveReplace = function recursiveReplace(original, translation) {
|
|
23
|
+
if (!Array.isArray(original)) {
|
|
24
|
+
original = [original];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
original.forEach(function (element, i) {
|
|
28
|
+
if (typeof element === 'string' || typeof element === 'number') {
|
|
29
|
+
var text = [];
|
|
30
|
+
var regex = /{([^}]+)}/;
|
|
31
|
+
|
|
32
|
+
if (regex.test(translation[i].textContent)) {
|
|
33
|
+
var textArray = translation[i].textContent.split(' ');
|
|
34
|
+
console.log('textArray is', textArray);
|
|
35
|
+
|
|
36
|
+
if (textArray.length === 1) {
|
|
37
|
+
return false;
|
|
38
|
+
} else {
|
|
39
|
+
textArray.forEach(function (txt) {
|
|
40
|
+
if (!regex.test(txt)) {
|
|
41
|
+
text.push(txt);
|
|
42
|
+
} else {
|
|
43
|
+
text.push(original[i]);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return original[i] = text.join(' ');
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
return original[i] = translation[i].textContent;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (isObject(element)) {
|
|
54
|
+
original[i] = /*#__PURE__*/React.cloneElement(original[i], _extends({}, original[i].props, {
|
|
55
|
+
children: recursiveReplace(original[i].props.children, translation[i].childNodes)
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return original;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export var I18nText = function I18nText(_ref) {
|
|
63
|
+
var i18nKey = _ref.i18nKey,
|
|
64
|
+
children = _ref.children;
|
|
65
|
+
var translation = defaultTranslate(i18nKey);
|
|
66
|
+
var result = resultTranslate(translation, children);
|
|
67
|
+
|
|
68
|
+
var _useTranslation = useTranslation(),
|
|
69
|
+
Trans = _useTranslation.Trans;
|
|
70
|
+
|
|
71
|
+
if (Trans) {
|
|
72
|
+
return /*#__PURE__*/React.createElement(Trans, {
|
|
73
|
+
i18nKey: i18nKey
|
|
74
|
+
}, children);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, result);
|
|
78
|
+
};
|
|
79
|
+
export default I18nText;
|
package/es/app/i18n.js
CHANGED
|
@@ -3,8 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
var _excluded = ["t", "children"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import el from '@digigov/ui/locales/el';
|
|
6
|
-
|
|
7
|
-
var defaultTranslate = function defaultTranslate(key) {
|
|
6
|
+
export var defaultTranslate = function defaultTranslate(key) {
|
|
8
7
|
try {
|
|
9
8
|
if (key.split('.').length > 0) {
|
|
10
9
|
return key.split('.').reduce(function (locale, path) {
|
|
@@ -20,7 +19,6 @@ var defaultTranslate = function defaultTranslate(key) {
|
|
|
20
19
|
return key;
|
|
21
20
|
}
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
export var I18NContext = /*#__PURE__*/React.createContext({
|
|
25
23
|
t: defaultTranslate
|
|
26
24
|
});
|
package/es/app/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export * from '@digigov/ui/app/App';
|
|
|
2
2
|
export * from '@digigov/ui/app/PageTitle';
|
|
3
3
|
export * from '@digigov/ui/app/QrCodeScanner';
|
|
4
4
|
export * from '@digigov/ui/app/Header';
|
|
5
|
-
export * from '@digigov/ui/app/i18n';
|
|
5
|
+
export * from '@digigov/ui/app/i18n';
|
|
6
|
+
export * from '@digigov/ui/app/I18nText';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import CorePaginationLabel from '@digigov/react-extensions/admin/PaginationLabel';
|
|
3
|
-
import {
|
|
3
|
+
import { I18nText } from '@digigov/ui/app/I18nText';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* PaginationLabel component is used for placing the pagination results label.
|
|
@@ -9,12 +9,10 @@ export var PaginationLabel = /*#__PURE__*/React.forwardRef(function PaginationLa
|
|
|
9
9
|
var start = _ref.start,
|
|
10
10
|
end = _ref.end,
|
|
11
11
|
total = _ref.total;
|
|
12
|
-
|
|
13
|
-
var _useTranslation = useTranslation(),
|
|
14
|
-
t = _useTranslation.t;
|
|
15
|
-
|
|
16
12
|
return /*#__PURE__*/React.createElement(CorePaginationLabel, {
|
|
17
13
|
ref: ref
|
|
18
|
-
},
|
|
14
|
+
}, /*#__PURE__*/React.createElement(I18nText, {
|
|
15
|
+
i18nKey: "pagination.label"
|
|
16
|
+
}, "Showing ", /*#__PURE__*/React.createElement("b", null, start), " to ", /*#__PURE__*/React.createElement("b", null, end), " of ", /*#__PURE__*/React.createElement("b", null, total), " results."));
|
|
19
17
|
});
|
|
20
18
|
export default PaginationLabel;
|
package/es/core/Table/index.js
CHANGED
|
@@ -3,5 +3,5 @@ export * from '@digigov/react-core/TableBody';
|
|
|
3
3
|
export * from '@digigov/react-core/TableCaption';
|
|
4
4
|
export * from '@digigov/react-core/TableDataCell';
|
|
5
5
|
export * from '@digigov/react-core/TableHead';
|
|
6
|
-
export * from '@digigov/react-core/
|
|
6
|
+
export * from '@digigov/react-core/TableHeadCell';
|
|
7
7
|
export * from '@digigov/react-core/TableRow';
|
package/es/core/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
export { default as Button } from '@digigov/ui/core/Button';
|
|
2
2
|
export * from '@digigov/ui/core/Button';
|
|
3
|
-
export { default as WarningText } from '@digigov/ui/core/WarningText';
|
|
4
3
|
export * from '@digigov/ui/core/Accordion';
|
|
5
4
|
export * from '@digigov/ui/core/Blockquote';
|
|
5
|
+
export * from '@digigov/ui/core/Breadcrumbs';
|
|
6
|
+
export * from '@digigov/ui/core/Card';
|
|
6
7
|
export * from '@digigov/ui/core/Details';
|
|
8
|
+
export * from '@digigov/ui/core/Divider';
|
|
7
9
|
export * from '@digigov/ui/core/ErrorSummary';
|
|
10
|
+
export * from '@digigov/ui/core/Hidden';
|
|
8
11
|
export * from '@digigov/ui/core/Link';
|
|
9
12
|
export * from '@digigov/ui/core/List';
|
|
10
13
|
export * from '@digigov/ui/core/NavList';
|
|
11
14
|
export * from '@digigov/ui/core/ServiceBadge';
|
|
12
|
-
export * from '@digigov/ui/core/SummaryList';
|
|
13
|
-
export * from '@digigov/ui/core/Tabs';
|
|
14
15
|
export * from '@digigov/ui/core/NotificationBanner';
|
|
16
|
+
export * from '@digigov/ui/core/SummaryList';
|
|
15
17
|
export * from '@digigov/ui/core/Table';
|
|
16
|
-
export * from '@digigov/ui/core/
|
|
17
|
-
export * from '@digigov/ui/core/
|
|
18
|
+
export * from '@digigov/ui/core/Tabs';
|
|
19
|
+
export * from '@digigov/ui/core/VisuallyHidden';
|
|
20
|
+
export { default as WarningText } from '@digigov/ui/core/WarningText';
|
|
18
21
|
export * from '@digigov/ui/core/PaginationLabel';
|
package/es/index.js
CHANGED
package/es/locales/el.js
CHANGED
|
@@ -56,6 +56,13 @@ export default {
|
|
|
56
56
|
show: 'Εμφανίζονται',
|
|
57
57
|
to: 'έως',
|
|
58
58
|
of: 'από',
|
|
59
|
-
results: 'αποτελέσματα'
|
|
59
|
+
results: 'αποτελέσματα',
|
|
60
|
+
label: 'Εμφανίζονται <1>{{start}}</1> έως <3>{{end}}</3> από <5>{{total}}</5> αποτελέσματα.'
|
|
61
|
+
},
|
|
62
|
+
upload: {
|
|
63
|
+
file: 'Αρχείο',
|
|
64
|
+
choose_file: 'Επιλογή αρχείου',
|
|
65
|
+
change_file: 'Αντικατάσταση αρχείου',
|
|
66
|
+
no_file: 'Δεν έχετε επιλέξει αρχείο'
|
|
60
67
|
}
|
|
61
68
|
};
|
package/es/locales/en.js
CHANGED
|
@@ -56,6 +56,13 @@ export default {
|
|
|
56
56
|
show: 'Showing',
|
|
57
57
|
to: 'to',
|
|
58
58
|
of: 'of',
|
|
59
|
-
results: 'results'
|
|
59
|
+
results: 'results',
|
|
60
|
+
label: 'Showing <b>{start}</b> to <b>{end}</b> of <b>{total}</b> results'
|
|
61
|
+
},
|
|
62
|
+
upload: {
|
|
63
|
+
file: 'File',
|
|
64
|
+
choose_file: 'Choose file',
|
|
65
|
+
change_file: 'Change file',
|
|
66
|
+
no_file: 'You have not selected a file'
|
|
60
67
|
}
|
|
61
68
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["closeBehaviour"];
|
|
4
|
+
import React, { useEffect, useRef } from 'react';
|
|
5
|
+
import CoreDropdown from '@digigov/react-extensions/admin/Dropdown';
|
|
6
|
+
export * from '@digigov/react-extensions/admin/DropdownButton';
|
|
7
|
+
export * from '@digigov/react-extensions/admin/DropdownContent';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Dropdown component is used for showing more options with a button.
|
|
11
|
+
*/
|
|
12
|
+
export var Dropdown = function Dropdown(_ref) {
|
|
13
|
+
var _ref$closeBehaviour = _ref.closeBehaviour,
|
|
14
|
+
closeBehaviour = _ref$closeBehaviour === void 0 ? 'clickOutside' : _ref$closeBehaviour,
|
|
15
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
|
|
17
|
+
var innerRef = useRef();
|
|
18
|
+
useEffect(function () {
|
|
19
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
20
|
+
if (innerRef.current && !innerRef.current.contains(event.target)) {
|
|
21
|
+
innerRef.current.open = false;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
if (closeBehaviour === 'clickOutside') {
|
|
26
|
+
document.addEventListener('click', handleClickOutside, true);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return function () {
|
|
30
|
+
if (closeBehaviour === 'clickOutside') {
|
|
31
|
+
document.removeEventListener('click', handleClickOutside, true);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}, []); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
|
|
37
|
+
return /*#__PURE__*/React.createElement(CoreDropdown, _extends({
|
|
38
|
+
ref: innerRef
|
|
39
|
+
}, props));
|
|
40
|
+
};
|
|
41
|
+
export default Dropdown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@digigov/ui/admin/Dropdown';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { defaultTranslate } from '@digigov/ui/app/i18n';
|
|
6
|
+
import { useTranslation } from '@digigov/ui/app';
|
|
7
|
+
|
|
8
|
+
var isObject = function isObject(value) {
|
|
9
|
+
return !!(value && _typeof(value) === 'object' && !Array.isArray(value));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
var resultTranslate = function resultTranslate(translation, children) {
|
|
13
|
+
var parser = new DOMParser();
|
|
14
|
+
|
|
15
|
+
var childrenCloned = _toConsumableArray(children);
|
|
16
|
+
|
|
17
|
+
console.log('children cloned are', childrenCloned);
|
|
18
|
+
var doc1 = parser.parseFromString("<div>".concat(translation.replace(/<([0-9])>/g, '<t$1>').replace(/<\/([0-9])>/g, '</t$1>'), "</div>"), 'application/xml');
|
|
19
|
+
return recursiveReplace(childrenCloned, doc1.children[0].childNodes);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var recursiveReplace = function recursiveReplace(original, translation) {
|
|
23
|
+
if (!Array.isArray(original)) {
|
|
24
|
+
original = [original];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
original.forEach(function (element, i) {
|
|
28
|
+
if (typeof element === 'string' || typeof element === 'number') {
|
|
29
|
+
var text = [];
|
|
30
|
+
var regex = /{([^}]+)}/;
|
|
31
|
+
|
|
32
|
+
if (regex.test(translation[i].textContent)) {
|
|
33
|
+
var textArray = translation[i].textContent.split(' ');
|
|
34
|
+
console.log('textArray is', textArray);
|
|
35
|
+
|
|
36
|
+
if (textArray.length === 1) {
|
|
37
|
+
return false;
|
|
38
|
+
} else {
|
|
39
|
+
textArray.forEach(function (txt) {
|
|
40
|
+
if (!regex.test(txt)) {
|
|
41
|
+
text.push(txt);
|
|
42
|
+
} else {
|
|
43
|
+
text.push(original[i]);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return original[i] = text.join(' ');
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
return original[i] = translation[i].textContent;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (isObject(element)) {
|
|
54
|
+
original[i] = /*#__PURE__*/React.cloneElement(original[i], _extends({}, original[i].props, {
|
|
55
|
+
children: recursiveReplace(original[i].props.children, translation[i].childNodes)
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return original;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export var I18nText = function I18nText(_ref) {
|
|
63
|
+
var i18nKey = _ref.i18nKey,
|
|
64
|
+
children = _ref.children;
|
|
65
|
+
var translation = defaultTranslate(i18nKey);
|
|
66
|
+
var result = resultTranslate(translation, children);
|
|
67
|
+
|
|
68
|
+
var _useTranslation = useTranslation(),
|
|
69
|
+
Trans = _useTranslation.Trans;
|
|
70
|
+
|
|
71
|
+
if (Trans) {
|
|
72
|
+
return /*#__PURE__*/React.createElement(Trans, {
|
|
73
|
+
i18nKey: i18nKey
|
|
74
|
+
}, children);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, result);
|
|
78
|
+
};
|
|
79
|
+
export default I18nText;
|
package/esm/app/i18n.js
CHANGED
|
@@ -3,8 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
var _excluded = ["t", "children"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import el from '@digigov/ui/locales/el';
|
|
6
|
-
|
|
7
|
-
var defaultTranslate = function defaultTranslate(key) {
|
|
6
|
+
export var defaultTranslate = function defaultTranslate(key) {
|
|
8
7
|
try {
|
|
9
8
|
if (key.split('.').length > 0) {
|
|
10
9
|
return key.split('.').reduce(function (locale, path) {
|
|
@@ -20,7 +19,6 @@ var defaultTranslate = function defaultTranslate(key) {
|
|
|
20
19
|
return key;
|
|
21
20
|
}
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
export var I18NContext = /*#__PURE__*/React.createContext({
|
|
25
23
|
t: defaultTranslate
|
|
26
24
|
});
|
package/esm/app/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export * from '@digigov/ui/app/App';
|
|
|
2
2
|
export * from '@digigov/ui/app/PageTitle';
|
|
3
3
|
export * from '@digigov/ui/app/QrCodeScanner';
|
|
4
4
|
export * from '@digigov/ui/app/Header';
|
|
5
|
-
export * from '@digigov/ui/app/i18n';
|
|
5
|
+
export * from '@digigov/ui/app/i18n';
|
|
6
|
+
export * from '@digigov/ui/app/I18nText';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import CorePaginationLabel from '@digigov/react-extensions/admin/PaginationLabel';
|
|
3
|
-
import {
|
|
3
|
+
import { I18nText } from '@digigov/ui/app/I18nText';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* PaginationLabel component is used for placing the pagination results label.
|
|
@@ -9,12 +9,10 @@ export var PaginationLabel = /*#__PURE__*/React.forwardRef(function PaginationLa
|
|
|
9
9
|
var start = _ref.start,
|
|
10
10
|
end = _ref.end,
|
|
11
11
|
total = _ref.total;
|
|
12
|
-
|
|
13
|
-
var _useTranslation = useTranslation(),
|
|
14
|
-
t = _useTranslation.t;
|
|
15
|
-
|
|
16
12
|
return /*#__PURE__*/React.createElement(CorePaginationLabel, {
|
|
17
13
|
ref: ref
|
|
18
|
-
},
|
|
14
|
+
}, /*#__PURE__*/React.createElement(I18nText, {
|
|
15
|
+
i18nKey: "pagination.label"
|
|
16
|
+
}, "Showing ", /*#__PURE__*/React.createElement("b", null, start), " to ", /*#__PURE__*/React.createElement("b", null, end), " of ", /*#__PURE__*/React.createElement("b", null, total), " results."));
|
|
19
17
|
});
|
|
20
18
|
export default PaginationLabel;
|
package/esm/core/Table/index.js
CHANGED
|
@@ -3,5 +3,5 @@ export * from '@digigov/react-core/TableBody';
|
|
|
3
3
|
export * from '@digigov/react-core/TableCaption';
|
|
4
4
|
export * from '@digigov/react-core/TableDataCell';
|
|
5
5
|
export * from '@digigov/react-core/TableHead';
|
|
6
|
-
export * from '@digigov/react-core/
|
|
6
|
+
export * from '@digigov/react-core/TableHeadCell';
|
|
7
7
|
export * from '@digigov/react-core/TableRow';
|
package/esm/core/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
export { default as Button } from '@digigov/ui/core/Button';
|
|
2
2
|
export * from '@digigov/ui/core/Button';
|
|
3
|
-
export { default as WarningText } from '@digigov/ui/core/WarningText';
|
|
4
3
|
export * from '@digigov/ui/core/Accordion';
|
|
5
4
|
export * from '@digigov/ui/core/Blockquote';
|
|
5
|
+
export * from '@digigov/ui/core/Breadcrumbs';
|
|
6
|
+
export * from '@digigov/ui/core/Card';
|
|
6
7
|
export * from '@digigov/ui/core/Details';
|
|
8
|
+
export * from '@digigov/ui/core/Divider';
|
|
7
9
|
export * from '@digigov/ui/core/ErrorSummary';
|
|
10
|
+
export * from '@digigov/ui/core/Hidden';
|
|
8
11
|
export * from '@digigov/ui/core/Link';
|
|
9
12
|
export * from '@digigov/ui/core/List';
|
|
10
13
|
export * from '@digigov/ui/core/NavList';
|
|
11
14
|
export * from '@digigov/ui/core/ServiceBadge';
|
|
12
|
-
export * from '@digigov/ui/core/SummaryList';
|
|
13
|
-
export * from '@digigov/ui/core/Tabs';
|
|
14
15
|
export * from '@digigov/ui/core/NotificationBanner';
|
|
16
|
+
export * from '@digigov/ui/core/SummaryList';
|
|
15
17
|
export * from '@digigov/ui/core/Table';
|
|
16
|
-
export * from '@digigov/ui/core/
|
|
17
|
-
export * from '@digigov/ui/core/
|
|
18
|
+
export * from '@digigov/ui/core/Tabs';
|
|
19
|
+
export * from '@digigov/ui/core/VisuallyHidden';
|
|
20
|
+
export { default as WarningText } from '@digigov/ui/core/WarningText';
|
|
18
21
|
export * from '@digigov/ui/core/PaginationLabel';
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license Digigov v0.
|
|
1
|
+
/** @license Digigov v0.16.0
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -7,4 +7,5 @@ export * from '@digigov/ui/core';
|
|
|
7
7
|
export * from '@digigov/ui/layouts';
|
|
8
8
|
export * from '@digigov/ui/typography';
|
|
9
9
|
export * from '@digigov/ui/app';
|
|
10
|
-
export * from '@digigov/ui/govgr';
|
|
10
|
+
export * from '@digigov/ui/govgr';
|
|
11
|
+
export * from '@digigov/ui/admin';
|
package/esm/locales/el.js
CHANGED
|
@@ -56,6 +56,13 @@ export default {
|
|
|
56
56
|
show: 'Εμφανίζονται',
|
|
57
57
|
to: 'έως',
|
|
58
58
|
of: 'από',
|
|
59
|
-
results: 'αποτελέσματα'
|
|
59
|
+
results: 'αποτελέσματα',
|
|
60
|
+
label: 'Εμφανίζονται <1>{{start}}</1> έως <3>{{end}}</3> από <5>{{total}}</5> αποτελέσματα.'
|
|
61
|
+
},
|
|
62
|
+
upload: {
|
|
63
|
+
file: 'Αρχείο',
|
|
64
|
+
choose_file: 'Επιλογή αρχείου',
|
|
65
|
+
change_file: 'Αντικατάσταση αρχείου',
|
|
66
|
+
no_file: 'Δεν έχετε επιλέξει αρχείο'
|
|
60
67
|
}
|
|
61
68
|
};
|
package/esm/locales/en.js
CHANGED
|
@@ -56,6 +56,13 @@ export default {
|
|
|
56
56
|
show: 'Showing',
|
|
57
57
|
to: 'to',
|
|
58
58
|
of: 'of',
|
|
59
|
-
results: 'results'
|
|
59
|
+
results: 'results',
|
|
60
|
+
label: 'Showing <b>{start}</b> to <b>{end}</b> of <b>{total}</b> results'
|
|
61
|
+
},
|
|
62
|
+
upload: {
|
|
63
|
+
file: 'File',
|
|
64
|
+
choose_file: 'Choose file',
|
|
65
|
+
change_file: 'Change file',
|
|
66
|
+
no_file: 'You have not selected a file'
|
|
60
67
|
}
|
|
61
68
|
};
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -67,4 +67,17 @@ Object.keys(_govgr).forEach(function (key) {
|
|
|
67
67
|
return _govgr[key];
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
var _admin = require("@digigov/ui/admin");
|
|
73
|
+
|
|
74
|
+
Object.keys(_admin).forEach(function (key) {
|
|
75
|
+
if (key === "default" || key === "__esModule") return;
|
|
76
|
+
if (key in exports && exports[key] === _admin[key]) return;
|
|
77
|
+
Object.defineProperty(exports, key, {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function get() {
|
|
80
|
+
return _admin[key];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
70
83
|
});
|
package/locales/el.d.ts
CHANGED
package/locales/el.js
CHANGED
|
@@ -62,7 +62,14 @@ var _default = {
|
|
|
62
62
|
show: 'Εμφανίζονται',
|
|
63
63
|
to: 'έως',
|
|
64
64
|
of: 'από',
|
|
65
|
-
results: 'αποτελέσματα'
|
|
65
|
+
results: 'αποτελέσματα',
|
|
66
|
+
label: 'Εμφανίζονται <1>{{start}}</1> έως <3>{{end}}</3> από <5>{{total}}</5> αποτελέσματα.'
|
|
67
|
+
},
|
|
68
|
+
upload: {
|
|
69
|
+
file: 'Αρχείο',
|
|
70
|
+
choose_file: 'Επιλογή αρχείου',
|
|
71
|
+
change_file: 'Αντικατάσταση αρχείου',
|
|
72
|
+
no_file: 'Δεν έχετε επιλέξει αρχείο'
|
|
66
73
|
}
|
|
67
74
|
};
|
|
68
75
|
exports["default"] = _default;
|
package/locales/en.d.ts
CHANGED
package/locales/en.js
CHANGED
|
@@ -62,7 +62,14 @@ var _default = {
|
|
|
62
62
|
show: 'Showing',
|
|
63
63
|
to: 'to',
|
|
64
64
|
of: 'of',
|
|
65
|
-
results: 'results'
|
|
65
|
+
results: 'results',
|
|
66
|
+
label: 'Showing <b>{start}</b> to <b>{end}</b> of <b>{total}</b> results'
|
|
67
|
+
},
|
|
68
|
+
upload: {
|
|
69
|
+
file: 'File',
|
|
70
|
+
choose_file: 'Choose file',
|
|
71
|
+
change_file: 'Change file',
|
|
72
|
+
no_file: 'You have not selected a file'
|
|
66
73
|
}
|
|
67
74
|
};
|
|
68
75
|
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "@digigov reusable components toolkit",
|
|
5
5
|
"module": "./esm/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"clsx": "1.1.1",
|
|
19
19
|
"react": "16.14.0",
|
|
20
20
|
"react-dom": "16.14.0",
|
|
21
|
-
"@digigov/react-core": "0.
|
|
22
|
-
"@digigov/react-extensions": "0.
|
|
21
|
+
"@digigov/react-core": "0.10.1",
|
|
22
|
+
"@digigov/react-extensions": "0.9.2"
|
|
23
23
|
},
|
|
24
24
|
"gitHead": "c903a46306f77f55ad7fc4d2e274006f39a6c871",
|
|
25
25
|
"private": false,
|