pixelize-design-library 2.2.197 → 2.2.199
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/PaymentCard/PaymentCard.d.ts +1 -1
- package/dist/Components/Card/PaymentCard/PaymentCard.js +3 -3
- package/dist/Components/Card/PaymentCard/PaymentCardProps.d.ts +1 -0
- package/dist/Components/KanbanBoard/KanbanBoard.js +5 -5
- package/dist/Components/KanbanBoard/MeasuredItem.js +21 -8
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaymentCardProps } from "./PaymentCardProps";
|
|
3
|
-
declare const PaymentCard: ({ plan, isActive, isNextUpgrade, billingCycle, onSelect, onHover, buttonLoading, isLoading, }: PaymentCardProps) => React.JSX.Element;
|
|
3
|
+
declare const PaymentCard: ({ plan, isActive, isNextUpgrade, billingCycle, onSelect, onHover, buttonLoading, isLoading, isRenewal, }: PaymentCardProps) => React.JSX.Element;
|
|
4
4
|
export default PaymentCard;
|
|
@@ -52,9 +52,9 @@ var getCardStyles = function (isActive, isNextUpgrade, popular, theme) {
|
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
54
|
var PaymentCard = function (_a) {
|
|
55
|
-
var plan = _a.plan, _b = _a.isActive, isActive = _b === void 0 ? false : _b, _c = _a.isNextUpgrade, isNextUpgrade = _c === void 0 ? false : _c, billingCycle = _a.billingCycle, onSelect = _a.onSelect, onHover = _a.onHover, buttonLoading = _a.buttonLoading, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d;
|
|
55
|
+
var plan = _a.plan, _b = _a.isActive, isActive = _b === void 0 ? false : _b, _c = _a.isNextUpgrade, isNextUpgrade = _c === void 0 ? false : _c, billingCycle = _a.billingCycle, onSelect = _a.onSelect, onHover = _a.onHover, buttonLoading = _a.buttonLoading, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d, _e = _a.isRenewal, isRenewal = _e === void 0 ? false : _e;
|
|
56
56
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
57
|
-
var
|
|
57
|
+
var _f = getCardStyles(isActive, isNextUpgrade, !!plan.popular, theme), badgeText = _f.badgeText, badgeColor = _f.badgeColor, buttonColor = _f.buttonColor, buttonColor50 = _f.buttonColor50;
|
|
58
58
|
var variantStyles = plan.buttonVariant === "outline"
|
|
59
59
|
? {
|
|
60
60
|
borderColor: buttonColor,
|
|
@@ -93,7 +93,7 @@ var PaymentCard = function (_a) {
|
|
|
93
93
|
react_1.default.createElement(react_2.Text, { fontSize: "0.7rem", fontWeight: "normal", color: theme.colors.gray[600] }, plan.tax)))),
|
|
94
94
|
plan.priceDescription && (react_1.default.createElement(react_2.Text, { color: theme.colors.green[800], mt: 2 }, plan === null || plan === void 0 ? void 0 : plan.priceDescription)),
|
|
95
95
|
react_1.default.createElement(react_2.Text, { color: theme.colors.gray[600], mt: 2 }, plan.description)),
|
|
96
|
-
!isActive && plan.buttonText && (react_1.default.createElement(Button_1.default, __assign({ isLoading: plan.plan_id === buttonLoading, loadingText: plan.buttonLoadingText, width: "full", variant: plan.buttonVariant, size: "lg", onClick: function () { return onSelect === null || onSelect === void 0 ? void 0 : onSelect(plan.plan_id); }, onMouseEnter: function () { return onHover === null || onHover === void 0 ? void 0 : onHover(plan.plan_id, "button", true); }, onMouseLeave: function () { return onHover === null || onHover === void 0 ? void 0 : onHover(plan.plan_id, "button", false); } }, variantStyles), plan.buttonText)),
|
|
96
|
+
((!isActive && plan.buttonText) || isRenewal) && (react_1.default.createElement(Button_1.default, __assign({ isLoading: plan.plan_id === buttonLoading, loadingText: plan.buttonLoadingText, width: "full", variant: plan.buttonVariant, size: "lg", onClick: function () { return onSelect === null || onSelect === void 0 ? void 0 : onSelect(plan.plan_id); }, onMouseEnter: function () { return onHover === null || onHover === void 0 ? void 0 : onHover(plan.plan_id, "button", true); }, onMouseLeave: function () { return onHover === null || onHover === void 0 ? void 0 : onHover(plan.plan_id, "button", false); } }, variantStyles), plan.buttonText)),
|
|
97
97
|
react_1.default.createElement(react_2.VStack, { align: "start", spacing: 3, mt: 6 }, plan.features.map(function (feature, i) { return (react_1.default.createElement(react_2.Flex, { key: i, align: "center" },
|
|
98
98
|
react_1.default.createElement(react_2.Icon, { as: lucide_react_1.Check, color: theme.colors.green[500], mr: 2 }),
|
|
99
99
|
react_1.default.createElement(react_2.Text, { fontSize: "sm" }, feature))); })))))));
|
|
@@ -79,8 +79,8 @@ var KanbanRow = react_1.default.memo(function (_a) {
|
|
|
79
79
|
return react_1.default.createElement("div", { style: style });
|
|
80
80
|
}
|
|
81
81
|
return (react_1.default.createElement("div", { style: style },
|
|
82
|
-
react_1.default.createElement(
|
|
83
|
-
react_1.default.createElement(
|
|
82
|
+
react_1.default.createElement("div", { style: { paddingBottom: KANBAN_CARD_GAP } },
|
|
83
|
+
react_1.default.createElement(MeasuredItem_1.default, { index: index, setSize: function (i, h) { return setSize(i, h, colId); } },
|
|
84
84
|
react_1.default.createElement(dnd_1.Draggable, { draggableId: account.id.toString(), index: index, key: account.id, isDragDisabled: !canDrag }, function (provided) {
|
|
85
85
|
var _a;
|
|
86
86
|
return (react_1.default.createElement("div", __assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { style: provided.draggableProps.style }), (account === null || account === void 0 ? void 0 : account.customNode) ? (_a = account === null || account === void 0 ? void 0 : account.customNode) === null || _a === void 0 ? void 0 : _a.call(account) : (react_1.default.createElement(AccountCard_1.default, { key: account.id, account: account, index: index, onDelete: onDelete, onOpen: onOpen, isExpanded: expanded[account.id], onToggleExpand: function () {
|
|
@@ -248,8 +248,8 @@ var KanbanBoard = function (_a) {
|
|
|
248
248
|
return changed ? pruned : prev;
|
|
249
249
|
});
|
|
250
250
|
}, [columns]);
|
|
251
|
-
// AccountCard
|
|
252
|
-
var DEFAULT_ITEM_HEIGHT = 80
|
|
251
|
+
// AccountCard's minHeight floor — kept tight so unmeasured rows don't reserve excess space; KANBAN_CARD_GAP is added below.
|
|
252
|
+
var DEFAULT_ITEM_HEIGHT = 80;
|
|
253
253
|
// update height for an item
|
|
254
254
|
var setSize = (0, react_1.useCallback)(function (index, size, colId) {
|
|
255
255
|
var key = "".concat(colId, "-").concat(index);
|
|
@@ -265,7 +265,7 @@ var KanbanBoard = function (_a) {
|
|
|
265
265
|
}, []);
|
|
266
266
|
var getItemSize = (0, react_1.useCallback)(function (index, _items, colId) {
|
|
267
267
|
var key = "".concat(colId, "-").concat(index);
|
|
268
|
-
return sizes[key] || DEFAULT_ITEM_HEIGHT;
|
|
268
|
+
return (sizes[key] || DEFAULT_ITEM_HEIGHT) + KANBAN_CARD_GAP;
|
|
269
269
|
}, [sizes]);
|
|
270
270
|
// Calculate container height
|
|
271
271
|
(0, react_1.useEffect)(function () {
|
|
@@ -38,19 +38,26 @@ var MeasuredItem = function (_a) {
|
|
|
38
38
|
var index = _a.index, setSize = _a.setSize, children = _a.children;
|
|
39
39
|
var ref = (0, react_1.useRef)(null);
|
|
40
40
|
var prevHeight = (0, react_1.useRef)(null);
|
|
41
|
+
// Stable ref to the latest setSize so we don't tear down the ResizeObserver on every render.
|
|
42
|
+
var setSizeRef = (0, react_1.useRef)(setSize);
|
|
43
|
+
setSizeRef.current = setSize;
|
|
44
|
+
var indexRef = (0, react_1.useRef)(index);
|
|
45
|
+
indexRef.current = index;
|
|
41
46
|
var measure = function () {
|
|
42
47
|
if (ref.current) {
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
// offsetHeight is the integer border-box layout height — more reliable than getBoundingClientRect for our purposes.
|
|
49
|
+
var height = ref.current.offsetHeight;
|
|
50
|
+
if (height > 0 && prevHeight.current !== height) {
|
|
45
51
|
prevHeight.current = height;
|
|
46
|
-
|
|
52
|
+
setSizeRef.current(indexRef.current, height);
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
};
|
|
50
56
|
(0, react_1.useLayoutEffect)(function () {
|
|
51
|
-
var element = ref.current;
|
|
52
|
-
// Initial measure
|
|
57
|
+
var element = ref.current;
|
|
53
58
|
measure();
|
|
59
|
+
// A second measure after paint catches any layout that finishes after the synchronous tick (font loads, async CSS, etc).
|
|
60
|
+
var raf = requestAnimationFrame(measure);
|
|
54
61
|
var ro;
|
|
55
62
|
if (typeof ResizeObserver !== "undefined" && element) {
|
|
56
63
|
ro = new ResizeObserver(function () {
|
|
@@ -59,18 +66,24 @@ var MeasuredItem = function (_a) {
|
|
|
59
66
|
ro.observe(element);
|
|
60
67
|
}
|
|
61
68
|
else {
|
|
62
|
-
// Fallback for browsers without ResizeObserver
|
|
63
69
|
window.addEventListener("resize", measure);
|
|
64
70
|
}
|
|
65
71
|
return function () {
|
|
66
|
-
|
|
72
|
+
cancelAnimationFrame(raf);
|
|
67
73
|
if (ro && element)
|
|
68
74
|
ro.unobserve(element);
|
|
69
75
|
if (!ro)
|
|
70
76
|
window.removeEventListener("resize", measure);
|
|
71
77
|
};
|
|
78
|
+
// Intentionally empty deps — setSize/index are read through refs so the observer is set up exactly once per mount.
|
|
72
79
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
|
-
}, [
|
|
80
|
+
}, []);
|
|
81
|
+
// If index changes for the same DOM node (item shuffled), re-report the cached size under the new index.
|
|
82
|
+
(0, react_1.useEffect)(function () {
|
|
83
|
+
if (prevHeight.current != null) {
|
|
84
|
+
setSizeRef.current(indexRef.current, prevHeight.current);
|
|
85
|
+
}
|
|
86
|
+
}, [index]);
|
|
74
87
|
return react_1.default.createElement("div", { ref: ref }, children);
|
|
75
88
|
};
|
|
76
89
|
exports.default = MeasuredItem;
|