trepur_components 0.3.32 → 0.3.35
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.
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.object.assign.js");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.imageProps = exports.default = void 0;
|
|
7
9
|
|
|
8
|
-
require("core-js/modules/
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
11
|
|
|
10
|
-
var _react =
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
13
|
|
|
12
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
15
|
|
|
@@ -15,6 +17,10 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
18
24
|
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; }
|
|
19
25
|
|
|
20
26
|
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; }
|
|
@@ -29,7 +35,11 @@ const imageProps = {
|
|
|
29
35
|
image: _propTypes.default.string,
|
|
30
36
|
altText: _propTypes.default.string,
|
|
31
37
|
title: _propTypes.default.string,
|
|
32
|
-
rounded: _propTypes.default.bool
|
|
38
|
+
rounded: _propTypes.default.bool,
|
|
39
|
+
height: _propTypes.default.number,
|
|
40
|
+
width: _propTypes.default.number,
|
|
41
|
+
overlayColour: _propTypes.default.string,
|
|
42
|
+
overlayTextColour: _propTypes.default.string
|
|
33
43
|
};
|
|
34
44
|
exports.imageProps = imageProps;
|
|
35
45
|
|
|
@@ -37,6 +47,7 @@ const Image = _ref => {
|
|
|
37
47
|
let {
|
|
38
48
|
imageProps
|
|
39
49
|
} = _ref;
|
|
50
|
+
const [isHovering, setIsHovering] = (0, _react.useState)(false);
|
|
40
51
|
const widthClassList = (0, _classnames.default)({
|
|
41
52
|
'w-6': imageProps.width === 1,
|
|
42
53
|
'w-10': imageProps.width === 2,
|
|
@@ -67,15 +78,27 @@ const Image = _ref => {
|
|
|
67
78
|
[imageProps === null || imageProps === void 0 ? void 0 : imageProps.classes]: imageProps === null || imageProps === void 0 ? void 0 : imageProps.classes,
|
|
68
79
|
'rounded-full': imageProps === null || imageProps === void 0 ? void 0 : imageProps.rounded
|
|
69
80
|
}, widthClassList, heightClassList);
|
|
70
|
-
return /*#__PURE__*/_react.default.createElement("
|
|
81
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
82
|
+
className: classList
|
|
83
|
+
}, (imageProps === null || imageProps === void 0 ? void 0 : imageProps.imageName) && /*#__PURE__*/_react.default.createElement("div", {
|
|
84
|
+
className: "absolute ".concat(widthClassList, " ").concat(heightClassList, " z-10 ").concat(imageProps === null || imageProps === void 0 ? void 0 : imageProps.overlayColour, " transition-opacity duration-700 ").concat(isHovering ? 'opacity-50' : 'opacity-0')
|
|
85
|
+
}), (imageProps === null || imageProps === void 0 ? void 0 : imageProps.imageName) && /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
+
className: "flex absolute ".concat(widthClassList, " ").concat(heightClassList, " z-20 transition-opacity duration-700 ").concat(isHovering ? 'opacity-100' : 'opacity-0'),
|
|
87
|
+
onMouseEnter: () => setIsHovering(true),
|
|
88
|
+
onMouseLeave: () => setIsHovering(false)
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
90
|
+
className: "m-auto text-center ".concat(imageProps === null || imageProps === void 0 ? void 0 : imageProps.overlayTextColour)
|
|
91
|
+
}, imageProps === null || imageProps === void 0 ? void 0 : imageProps.imageName)), /*#__PURE__*/_react.default.createElement("img", _extends({}, (imageProps === null || imageProps === void 0 ? void 0 : imageProps.id) && {
|
|
71
92
|
id: imageProps === null || imageProps === void 0 ? void 0 : imageProps.id
|
|
72
93
|
}, {
|
|
73
|
-
|
|
74
|
-
|
|
94
|
+
src: imageProps === null || imageProps === void 0 ? void 0 : imageProps.image,
|
|
95
|
+
className: classList
|
|
75
96
|
}, (imageProps === null || imageProps === void 0 ? void 0 : imageProps.altText) && {
|
|
76
97
|
alt: imageProps === null || imageProps === void 0 ? void 0 : imageProps.altText
|
|
77
98
|
}, (imageProps === null || imageProps === void 0 ? void 0 : imageProps.title) && {
|
|
78
99
|
title: imageProps === null || imageProps === void 0 ? void 0 : imageProps.title
|
|
100
|
+
})), (imageProps === null || imageProps === void 0 ? void 0 : imageProps.imageName) && isHovering && /*#__PURE__*/_react.default.createElement("p", {
|
|
101
|
+
className: "".concat(widthClassList, " text-center ").concat(isHovering ? 'block' : 'hidden')
|
|
79
102
|
}));
|
|
80
103
|
};
|
|
81
104
|
|