@beweco/aurora-ui 0.6.16 → 0.6.18
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/index.cjs.js
CHANGED
|
@@ -7013,7 +7013,157 @@ var ModalContent = react.ModalContent;
|
|
|
7013
7013
|
|
|
7014
7014
|
var ModalHeader = react.ModalHeader;
|
|
7015
7015
|
|
|
7016
|
-
var ModalBody =
|
|
7016
|
+
var ModalBody = React.forwardRef(function (props, forwardedRef) {
|
|
7017
|
+
var nodeRef = React.useRef(null);
|
|
7018
|
+
var callbackRef = React.useCallback(function (node) {
|
|
7019
|
+
nodeRef.current = node;
|
|
7020
|
+
if (forwardedRef) {
|
|
7021
|
+
if (typeof forwardedRef === "function")
|
|
7022
|
+
forwardedRef(node);
|
|
7023
|
+
else
|
|
7024
|
+
forwardedRef.current = node;
|
|
7025
|
+
}
|
|
7026
|
+
}, [forwardedRef]);
|
|
7027
|
+
React.useEffect(function () {
|
|
7028
|
+
var node = nodeRef.current;
|
|
7029
|
+
if (!node)
|
|
7030
|
+
return;
|
|
7031
|
+
var parent = node.parentElement;
|
|
7032
|
+
if (!parent)
|
|
7033
|
+
return;
|
|
7034
|
+
// Hide native scrollbar
|
|
7035
|
+
node.style.scrollbarWidth = "none";
|
|
7036
|
+
// Parent needs relative positioning for the track
|
|
7037
|
+
var parentPos = window.getComputedStyle(parent).position;
|
|
7038
|
+
if (parentPos === "static") {
|
|
7039
|
+
parent.style.position = "relative";
|
|
7040
|
+
}
|
|
7041
|
+
// Create track — placed on the PARENT so it doesn't scroll
|
|
7042
|
+
var track = document.createElement("div");
|
|
7043
|
+
track.setAttribute("data-auraui-scrollbar", "track");
|
|
7044
|
+
Object.assign(track.style, {
|
|
7045
|
+
position: "absolute",
|
|
7046
|
+
right: "20px",
|
|
7047
|
+
width: "6px",
|
|
7048
|
+
zIndex: "10",
|
|
7049
|
+
cursor: "pointer",
|
|
7050
|
+
});
|
|
7051
|
+
// Create thumb
|
|
7052
|
+
var thumb = document.createElement("div");
|
|
7053
|
+
thumb.setAttribute("data-auraui-scrollbar", "thumb");
|
|
7054
|
+
Object.assign(thumb.style, {
|
|
7055
|
+
width: "6px",
|
|
7056
|
+
borderRadius: "3px",
|
|
7057
|
+
backgroundColor: "rgba(255,255,255,0.28)",
|
|
7058
|
+
cursor: "grab",
|
|
7059
|
+
});
|
|
7060
|
+
track.appendChild(thumb);
|
|
7061
|
+
parent.appendChild(track);
|
|
7062
|
+
// --- Scroll position update ---
|
|
7063
|
+
var trackHeight = 0;
|
|
7064
|
+
var thumbH = 0;
|
|
7065
|
+
var update = function () {
|
|
7066
|
+
var scrollTop = node.scrollTop, scrollHeight = node.scrollHeight, clientHeight = node.clientHeight;
|
|
7067
|
+
var hasOverflow = scrollHeight > clientHeight;
|
|
7068
|
+
if (!hasOverflow) {
|
|
7069
|
+
track.style.display = "none";
|
|
7070
|
+
return;
|
|
7071
|
+
}
|
|
7072
|
+
track.style.display = "block";
|
|
7073
|
+
var nodeRect = node.getBoundingClientRect();
|
|
7074
|
+
var parentRect = parent.getBoundingClientRect();
|
|
7075
|
+
var trackTop = nodeRect.top - parentRect.top;
|
|
7076
|
+
trackHeight = nodeRect.height;
|
|
7077
|
+
track.style.top = "".concat(trackTop, "px");
|
|
7078
|
+
track.style.height = "".concat(trackHeight, "px");
|
|
7079
|
+
var ratio = clientHeight / scrollHeight;
|
|
7080
|
+
thumbH = Math.max(ratio * trackHeight, 30);
|
|
7081
|
+
var maxScroll = scrollHeight - clientHeight;
|
|
7082
|
+
var thumbTop = maxScroll > 0
|
|
7083
|
+
? (scrollTop / maxScroll) * (trackHeight - thumbH)
|
|
7084
|
+
: 0;
|
|
7085
|
+
thumb.style.height = "".concat(thumbH, "px");
|
|
7086
|
+
thumb.style.marginTop = "".concat(thumbTop, "px");
|
|
7087
|
+
};
|
|
7088
|
+
node.addEventListener("scroll", update, { passive: true });
|
|
7089
|
+
var ro = new ResizeObserver(update);
|
|
7090
|
+
ro.observe(node);
|
|
7091
|
+
requestAnimationFrame(update);
|
|
7092
|
+
// --- Drag support ---
|
|
7093
|
+
var isDragging = false;
|
|
7094
|
+
var startY = 0;
|
|
7095
|
+
var startScrollTop = 0;
|
|
7096
|
+
var getIsDark = function () {
|
|
7097
|
+
return document.documentElement.classList.contains("dark") ||
|
|
7098
|
+
document.documentElement.getAttribute("data-theme") === "dark" ||
|
|
7099
|
+
document.body.classList.contains("dark");
|
|
7100
|
+
};
|
|
7101
|
+
var onMouseDown = function (e) {
|
|
7102
|
+
e.preventDefault();
|
|
7103
|
+
e.stopPropagation();
|
|
7104
|
+
isDragging = true;
|
|
7105
|
+
startY = e.clientY;
|
|
7106
|
+
startScrollTop = node.scrollTop;
|
|
7107
|
+
thumb.style.cursor = "grabbing";
|
|
7108
|
+
thumb.style.backgroundColor = getIsDark()
|
|
7109
|
+
? "rgba(255,255,255,0.45)"
|
|
7110
|
+
: "rgba(0,0,0,0.55)";
|
|
7111
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
7112
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
7113
|
+
};
|
|
7114
|
+
var onMouseMove = function (e) {
|
|
7115
|
+
if (!isDragging)
|
|
7116
|
+
return;
|
|
7117
|
+
e.preventDefault();
|
|
7118
|
+
var deltaY = e.clientY - startY;
|
|
7119
|
+
var maxScroll = node.scrollHeight - node.clientHeight;
|
|
7120
|
+
var scrollDelta = (deltaY / (trackHeight - thumbH)) * maxScroll;
|
|
7121
|
+
node.scrollTop = startScrollTop + scrollDelta;
|
|
7122
|
+
};
|
|
7123
|
+
var onMouseUp = function () {
|
|
7124
|
+
isDragging = false;
|
|
7125
|
+
thumb.style.cursor = "grab";
|
|
7126
|
+
detectTheme(); // Reset thumb color
|
|
7127
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
7128
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
7129
|
+
};
|
|
7130
|
+
// Click on track to jump
|
|
7131
|
+
var onTrackClick = function (e) {
|
|
7132
|
+
if (e.target === thumb)
|
|
7133
|
+
return;
|
|
7134
|
+
var trackRect = track.getBoundingClientRect();
|
|
7135
|
+
var clickRatio = (e.clientY - trackRect.top) / trackHeight;
|
|
7136
|
+
node.scrollTop =
|
|
7137
|
+
clickRatio * (node.scrollHeight - node.clientHeight);
|
|
7138
|
+
};
|
|
7139
|
+
thumb.addEventListener("mousedown", onMouseDown);
|
|
7140
|
+
track.addEventListener("click", onTrackClick);
|
|
7141
|
+
// --- Theme detection ---
|
|
7142
|
+
var detectTheme = function () {
|
|
7143
|
+
if (isDragging)
|
|
7144
|
+
return;
|
|
7145
|
+
thumb.style.backgroundColor = getIsDark()
|
|
7146
|
+
? "rgba(255,255,255,0.28)"
|
|
7147
|
+
: "rgba(0,0,0,0.4)";
|
|
7148
|
+
};
|
|
7149
|
+
detectTheme();
|
|
7150
|
+
var mo = new MutationObserver(detectTheme);
|
|
7151
|
+
mo.observe(document.documentElement, {
|
|
7152
|
+
attributes: true,
|
|
7153
|
+
attributeFilter: ["class", "data-theme", "style"],
|
|
7154
|
+
});
|
|
7155
|
+
return function () {
|
|
7156
|
+
node.removeEventListener("scroll", update);
|
|
7157
|
+
ro.disconnect();
|
|
7158
|
+
mo.disconnect();
|
|
7159
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
7160
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
7161
|
+
track.remove();
|
|
7162
|
+
};
|
|
7163
|
+
}, []);
|
|
7164
|
+
return (jsxRuntime.jsx(react.ModalBody, __assign({ ref: callbackRef }, props)));
|
|
7165
|
+
});
|
|
7166
|
+
ModalBody.displayName = "ModalBody";
|
|
7017
7167
|
|
|
7018
7168
|
var ModalFooter = react.ModalFooter;
|
|
7019
7169
|
|
package/dist/index.esm.js
CHANGED
|
@@ -7014,7 +7014,157 @@ var ModalContent = ModalContent$1;
|
|
|
7014
7014
|
|
|
7015
7015
|
var ModalHeader = ModalHeader$1;
|
|
7016
7016
|
|
|
7017
|
-
var ModalBody =
|
|
7017
|
+
var ModalBody = forwardRef(function (props, forwardedRef) {
|
|
7018
|
+
var nodeRef = useRef(null);
|
|
7019
|
+
var callbackRef = useCallback(function (node) {
|
|
7020
|
+
nodeRef.current = node;
|
|
7021
|
+
if (forwardedRef) {
|
|
7022
|
+
if (typeof forwardedRef === "function")
|
|
7023
|
+
forwardedRef(node);
|
|
7024
|
+
else
|
|
7025
|
+
forwardedRef.current = node;
|
|
7026
|
+
}
|
|
7027
|
+
}, [forwardedRef]);
|
|
7028
|
+
useEffect(function () {
|
|
7029
|
+
var node = nodeRef.current;
|
|
7030
|
+
if (!node)
|
|
7031
|
+
return;
|
|
7032
|
+
var parent = node.parentElement;
|
|
7033
|
+
if (!parent)
|
|
7034
|
+
return;
|
|
7035
|
+
// Hide native scrollbar
|
|
7036
|
+
node.style.scrollbarWidth = "none";
|
|
7037
|
+
// Parent needs relative positioning for the track
|
|
7038
|
+
var parentPos = window.getComputedStyle(parent).position;
|
|
7039
|
+
if (parentPos === "static") {
|
|
7040
|
+
parent.style.position = "relative";
|
|
7041
|
+
}
|
|
7042
|
+
// Create track — placed on the PARENT so it doesn't scroll
|
|
7043
|
+
var track = document.createElement("div");
|
|
7044
|
+
track.setAttribute("data-auraui-scrollbar", "track");
|
|
7045
|
+
Object.assign(track.style, {
|
|
7046
|
+
position: "absolute",
|
|
7047
|
+
right: "20px",
|
|
7048
|
+
width: "6px",
|
|
7049
|
+
zIndex: "10",
|
|
7050
|
+
cursor: "pointer",
|
|
7051
|
+
});
|
|
7052
|
+
// Create thumb
|
|
7053
|
+
var thumb = document.createElement("div");
|
|
7054
|
+
thumb.setAttribute("data-auraui-scrollbar", "thumb");
|
|
7055
|
+
Object.assign(thumb.style, {
|
|
7056
|
+
width: "6px",
|
|
7057
|
+
borderRadius: "3px",
|
|
7058
|
+
backgroundColor: "rgba(255,255,255,0.28)",
|
|
7059
|
+
cursor: "grab",
|
|
7060
|
+
});
|
|
7061
|
+
track.appendChild(thumb);
|
|
7062
|
+
parent.appendChild(track);
|
|
7063
|
+
// --- Scroll position update ---
|
|
7064
|
+
var trackHeight = 0;
|
|
7065
|
+
var thumbH = 0;
|
|
7066
|
+
var update = function () {
|
|
7067
|
+
var scrollTop = node.scrollTop, scrollHeight = node.scrollHeight, clientHeight = node.clientHeight;
|
|
7068
|
+
var hasOverflow = scrollHeight > clientHeight;
|
|
7069
|
+
if (!hasOverflow) {
|
|
7070
|
+
track.style.display = "none";
|
|
7071
|
+
return;
|
|
7072
|
+
}
|
|
7073
|
+
track.style.display = "block";
|
|
7074
|
+
var nodeRect = node.getBoundingClientRect();
|
|
7075
|
+
var parentRect = parent.getBoundingClientRect();
|
|
7076
|
+
var trackTop = nodeRect.top - parentRect.top;
|
|
7077
|
+
trackHeight = nodeRect.height;
|
|
7078
|
+
track.style.top = "".concat(trackTop, "px");
|
|
7079
|
+
track.style.height = "".concat(trackHeight, "px");
|
|
7080
|
+
var ratio = clientHeight / scrollHeight;
|
|
7081
|
+
thumbH = Math.max(ratio * trackHeight, 30);
|
|
7082
|
+
var maxScroll = scrollHeight - clientHeight;
|
|
7083
|
+
var thumbTop = maxScroll > 0
|
|
7084
|
+
? (scrollTop / maxScroll) * (trackHeight - thumbH)
|
|
7085
|
+
: 0;
|
|
7086
|
+
thumb.style.height = "".concat(thumbH, "px");
|
|
7087
|
+
thumb.style.marginTop = "".concat(thumbTop, "px");
|
|
7088
|
+
};
|
|
7089
|
+
node.addEventListener("scroll", update, { passive: true });
|
|
7090
|
+
var ro = new ResizeObserver(update);
|
|
7091
|
+
ro.observe(node);
|
|
7092
|
+
requestAnimationFrame(update);
|
|
7093
|
+
// --- Drag support ---
|
|
7094
|
+
var isDragging = false;
|
|
7095
|
+
var startY = 0;
|
|
7096
|
+
var startScrollTop = 0;
|
|
7097
|
+
var getIsDark = function () {
|
|
7098
|
+
return document.documentElement.classList.contains("dark") ||
|
|
7099
|
+
document.documentElement.getAttribute("data-theme") === "dark" ||
|
|
7100
|
+
document.body.classList.contains("dark");
|
|
7101
|
+
};
|
|
7102
|
+
var onMouseDown = function (e) {
|
|
7103
|
+
e.preventDefault();
|
|
7104
|
+
e.stopPropagation();
|
|
7105
|
+
isDragging = true;
|
|
7106
|
+
startY = e.clientY;
|
|
7107
|
+
startScrollTop = node.scrollTop;
|
|
7108
|
+
thumb.style.cursor = "grabbing";
|
|
7109
|
+
thumb.style.backgroundColor = getIsDark()
|
|
7110
|
+
? "rgba(255,255,255,0.45)"
|
|
7111
|
+
: "rgba(0,0,0,0.55)";
|
|
7112
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
7113
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
7114
|
+
};
|
|
7115
|
+
var onMouseMove = function (e) {
|
|
7116
|
+
if (!isDragging)
|
|
7117
|
+
return;
|
|
7118
|
+
e.preventDefault();
|
|
7119
|
+
var deltaY = e.clientY - startY;
|
|
7120
|
+
var maxScroll = node.scrollHeight - node.clientHeight;
|
|
7121
|
+
var scrollDelta = (deltaY / (trackHeight - thumbH)) * maxScroll;
|
|
7122
|
+
node.scrollTop = startScrollTop + scrollDelta;
|
|
7123
|
+
};
|
|
7124
|
+
var onMouseUp = function () {
|
|
7125
|
+
isDragging = false;
|
|
7126
|
+
thumb.style.cursor = "grab";
|
|
7127
|
+
detectTheme(); // Reset thumb color
|
|
7128
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
7129
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
7130
|
+
};
|
|
7131
|
+
// Click on track to jump
|
|
7132
|
+
var onTrackClick = function (e) {
|
|
7133
|
+
if (e.target === thumb)
|
|
7134
|
+
return;
|
|
7135
|
+
var trackRect = track.getBoundingClientRect();
|
|
7136
|
+
var clickRatio = (e.clientY - trackRect.top) / trackHeight;
|
|
7137
|
+
node.scrollTop =
|
|
7138
|
+
clickRatio * (node.scrollHeight - node.clientHeight);
|
|
7139
|
+
};
|
|
7140
|
+
thumb.addEventListener("mousedown", onMouseDown);
|
|
7141
|
+
track.addEventListener("click", onTrackClick);
|
|
7142
|
+
// --- Theme detection ---
|
|
7143
|
+
var detectTheme = function () {
|
|
7144
|
+
if (isDragging)
|
|
7145
|
+
return;
|
|
7146
|
+
thumb.style.backgroundColor = getIsDark()
|
|
7147
|
+
? "rgba(255,255,255,0.28)"
|
|
7148
|
+
: "rgba(0,0,0,0.4)";
|
|
7149
|
+
};
|
|
7150
|
+
detectTheme();
|
|
7151
|
+
var mo = new MutationObserver(detectTheme);
|
|
7152
|
+
mo.observe(document.documentElement, {
|
|
7153
|
+
attributes: true,
|
|
7154
|
+
attributeFilter: ["class", "data-theme", "style"],
|
|
7155
|
+
});
|
|
7156
|
+
return function () {
|
|
7157
|
+
node.removeEventListener("scroll", update);
|
|
7158
|
+
ro.disconnect();
|
|
7159
|
+
mo.disconnect();
|
|
7160
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
7161
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
7162
|
+
track.remove();
|
|
7163
|
+
};
|
|
7164
|
+
}, []);
|
|
7165
|
+
return (jsx(ModalBody$1, __assign({ ref: callbackRef }, props)));
|
|
7166
|
+
});
|
|
7167
|
+
ModalBody.displayName = "ModalBody";
|
|
7018
7168
|
|
|
7019
7169
|
var ModalFooter = ModalFooter$1;
|
|
7020
7170
|
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
declare const ModalBody: import("@heroui/react").
|
|
1
|
+
declare const ModalBody: import("react").ForwardRefExoticComponent<((import("@heroui/react").OmitCommonProps<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof import("@heroui/react").ModalBodyProps> & import("@heroui/react").ModalBodyProps & {
|
|
2
|
+
as?: import("@heroui/react").As<any> | undefined;
|
|
3
|
+
}) | Omit<import("@heroui/react").OmitCommonProps<Omit<Omit<any, "ref">, never>, keyof import("@heroui/react").ModalBodyProps> & import("@heroui/react").ModalBodyProps & {
|
|
4
|
+
as?: import("@heroui/react").As<any> | undefined;
|
|
5
|
+
}, "ref">) & import("react").RefAttributes<HTMLElement>>;
|
|
2
6
|
export default ModalBody;
|
|
3
7
|
//# sourceMappingURL=ModalBody.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalBody.d.ts","sourceRoot":"","sources":["../../../../../src/components/modal/_internal/ModalBody.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModalBody.d.ts","sourceRoot":"","sources":["../../../../../src/components/modal/_internal/ModalBody.tsx"],"names":[],"mappings":"AAYA,QAAA,MAAM,SAAS;;;;wDAqLd,CAAC;AAIF,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beweco/aurora-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.18",
|
|
4
4
|
"description": "Bewe Aurora UI Component Library",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
"format": "biome format --write",
|
|
35
35
|
"storybook": "storybook dev --port 6006",
|
|
36
36
|
"chromatic": "npx chromatic --project-token=chpt_a33f7fd2ebb3349",
|
|
37
|
-
"prepare": "husky"
|
|
37
|
+
"prepare": "husky",
|
|
38
|
+
"publish:with-env": "dotenv -e .env -- npm publish --access public",
|
|
39
|
+
"npm:whoami": "dotenv -e .env -- npm whoami"
|
|
38
40
|
},
|
|
39
41
|
"dependencies": {
|
|
40
42
|
"@heroui/react": "2.7.11",
|
|
@@ -59,6 +61,7 @@
|
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
|
61
63
|
"@biomejs/biome": "^1.9.4",
|
|
64
|
+
"@internationalized/date": "^3.8.2",
|
|
62
65
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
63
66
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
64
67
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
@@ -75,6 +78,7 @@
|
|
|
75
78
|
"@types/react-dom": "^19.1.5",
|
|
76
79
|
"autoprefixer": "^10.4.21",
|
|
77
80
|
"chromatic": "^13.0.0",
|
|
81
|
+
"dotenv-cli": "^8.0.0",
|
|
78
82
|
"husky": "^9.1.7",
|
|
79
83
|
"postcss": "^8.5.5",
|
|
80
84
|
"postcss-loader": "^8.1.1",
|
|
@@ -87,8 +91,7 @@
|
|
|
87
91
|
"sass": "^1.89.2",
|
|
88
92
|
"storybook": "^8.0.0",
|
|
89
93
|
"tailwindcss": "3.4.17",
|
|
90
|
-
"typescript": "^5.8.3"
|
|
91
|
-
"@internationalized/date": "^3.8.2"
|
|
94
|
+
"typescript": "^5.8.3"
|
|
92
95
|
},
|
|
93
96
|
"type": "module"
|
|
94
97
|
}
|