react-pop-cards 0.2.2 → 0.2.3
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/Card.js +14 -2
- package/dist/index.css +11 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +3 -10
- package/package.json +5 -2
package/dist/components/Card.js
CHANGED
|
@@ -14,6 +14,7 @@ var _web = require("@react-spring/web");
|
|
|
14
14
|
var _reactResponsive = require("react-responsive");
|
|
15
15
|
require("../index.css");
|
|
16
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
var _chromaJs = _interopRequireDefault(require("chroma-js"));
|
|
17
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -132,6 +133,13 @@ const Card = _ref => {
|
|
|
132
133
|
return "grid grid-cols-5 h-full";
|
|
133
134
|
}
|
|
134
135
|
};
|
|
136
|
+
|
|
137
|
+
// NOTE: text color according to bg color
|
|
138
|
+
const [textColor, setTextColor] = (0, _react.useState)();
|
|
139
|
+
(0, _react.useEffect)(() => {
|
|
140
|
+
const luminance = (0, _chromaJs.default)(bgColor).luminance();
|
|
141
|
+
luminance < 0.5 ? setTextColor('#e5e5e5') : setTextColor('#1c2531');
|
|
142
|
+
}, [bgColor]);
|
|
135
143
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
136
144
|
className: getDisposition(disposition)
|
|
137
145
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -144,7 +152,11 @@ const Card = _ref => {
|
|
|
144
152
|
key: key,
|
|
145
153
|
className: getCardClasses(key),
|
|
146
154
|
ref: parentCard
|
|
147
|
-
}, /*#__PURE__*/_react.default.createElement("div",
|
|
155
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
156
|
+
style: {
|
|
157
|
+
color: textColor
|
|
158
|
+
}
|
|
159
|
+
}, /*#__PURE__*/_react.default.createElement(_web.animated.div, {
|
|
148
160
|
ref: activeCard === value.title ? activeCardRef : null,
|
|
149
161
|
style: animatedStyles[key],
|
|
150
162
|
onClick: () => handleCardClick(value.title),
|
|
@@ -169,7 +181,7 @@ const Card = _ref => {
|
|
|
169
181
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
170
182
|
key: key,
|
|
171
183
|
onClick: () => handleCardClick(value.title),
|
|
172
|
-
className: "".concat(activeCard === value.title ? "scale-105 shadow-xl" : "scale-90", " ").concat(miniCardClass, " ").concat(isRounded ? "rounded-2xl" : "rounded-none")
|
|
184
|
+
className: "bg-base-100 ".concat(activeCard === value.title ? "scale-105 shadow-xl" : "scale-90", " ").concat(miniCardClass, " ").concat(isRounded ? "rounded-2xl" : "rounded-none")
|
|
173
185
|
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
174
186
|
className: "text-center text-xs capitalize"
|
|
175
187
|
}, value.title));
|
package/dist/index.css
CHANGED
|
@@ -1491,6 +1491,17 @@ html {
|
|
|
1491
1491
|
outline: 2px solid currentColor;
|
|
1492
1492
|
outline-offset: 2px;
|
|
1493
1493
|
}
|
|
1494
|
+
.loading {
|
|
1495
|
+
pointer-events: none;
|
|
1496
|
+
display: inline-block;
|
|
1497
|
+
aspect-ratio: 1 / 1;
|
|
1498
|
+
width: 1.5rem;
|
|
1499
|
+
background-color: currentColor;
|
|
1500
|
+
mask-size: 100%;
|
|
1501
|
+
mask-repeat: no-repeat;
|
|
1502
|
+
mask-position: center;
|
|
1503
|
+
mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' stroke='%23000' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cstyle%3E.spinner_V8m1%7Btransform-origin:center;animation:spinner_zKoa 2s linear infinite%7D.spinner_V8m1 circle%7Bstroke-linecap:round;animation:spinner_YpZS 1.5s ease-out infinite%7D%40keyframes spinner_zKoa%7B100%25%7Btransform:rotate(360deg)%7D%7D%40keyframes spinner_YpZS%7B0%25%7Bstroke-dasharray:0 150;stroke-dashoffset:0%7D47.5%25%7Bstroke-dasharray:42 150;stroke-dashoffset:-16%7D95%25%2C100%25%7Bstroke-dasharray:42 150;stroke-dashoffset:-59%7D%7D%3C%2Fstyle%3E%3Cg class='spinner_V8m1'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3'%3E%3C%2Fcircle%3E%3C%2Fg%3E%3C%2Fsvg%3E");
|
|
1504
|
+
}
|
|
1494
1505
|
.menu li > *:not(ul):not(.menu-title):not(details):active,
|
|
1495
1506
|
.menu li > *:not(ul):not(.menu-title):not(details).active,
|
|
1496
1507
|
.menu li > details > summary:active {
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface CardDataItem {
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
image?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface CardProps {
|
|
8
|
+
data: CardDataItem[];
|
|
9
|
+
bgColor?: string;
|
|
10
|
+
disposition?: "LeftRight" | "RightLeft" | "TopBottom" | "BottomTop";
|
|
11
|
+
isRounded?: boolean;
|
|
12
|
+
tension?: number;
|
|
13
|
+
friction?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare const Card: React.FC<CardProps>;
|
|
17
|
+
|
|
18
|
+
export default Card;
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Card", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Card.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
3
|
var _react = _interopRequireDefault(require("react"));
|
|
13
4
|
var _client = _interopRequireDefault(require("react-dom/client"));
|
|
14
5
|
require("./index.css");
|
|
@@ -40,4 +31,6 @@ _client.default.createRoot(document.getElementById("root")).render( /*#__PURE__*
|
|
|
40
31
|
tension: 120,
|
|
41
32
|
friction: 10,
|
|
42
33
|
bgColor: "#e5e7eb"
|
|
43
|
-
})));
|
|
34
|
+
})));
|
|
35
|
+
|
|
36
|
+
// export { Card }
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-pop-cards",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
5
6
|
"module": "dist/index.js",
|
|
6
7
|
"keywords": [
|
|
7
8
|
"card",
|
|
@@ -26,14 +27,16 @@
|
|
|
26
27
|
"core-js": "^3.35.1",
|
|
27
28
|
"prop-types": "^15.8.1",
|
|
28
29
|
"react": "^18.2.0",
|
|
30
|
+
"react-best-gradient-color-picker": "^3.0.5",
|
|
29
31
|
"react-color": "^2.19.3",
|
|
30
32
|
"react-dom": "^18.2.0",
|
|
31
33
|
"react-responsive": "^9.0.2",
|
|
34
|
+
"chroma-js": "^2.4.2",
|
|
32
35
|
"react-scripts": "5.0.1",
|
|
33
36
|
"web-vitals": "^3.5.1"
|
|
34
37
|
},
|
|
35
38
|
"scripts": {
|
|
36
|
-
"
|
|
39
|
+
"dev": "react-scripts start",
|
|
37
40
|
"build": "rm -rf dist && NODE_ENV=production babel src/index.js --out-dir dist --copy-files && babel src/components/Card.js --out-dir dist/components --copy-files && postcss src/index.css -o dist/index.css",
|
|
38
41
|
"build:vercel": "react-scripts build",
|
|
39
42
|
"test": "react-scripts test",
|