funuicss 3.4.1 → 3.4.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/css/fun.css +2 -1
- package/package.json +1 -1
- package/ui/sidebar/SideBar.d.ts +1 -5
- package/ui/sidebar/SideBar.js +11 -176
package/css/fun.css
CHANGED
|
@@ -2468,6 +2468,7 @@ h6, .h6 {
|
|
|
2468
2468
|
position: relative;
|
|
2469
2469
|
overflow: hidden;
|
|
2470
2470
|
font-weight: 500;
|
|
2471
|
+
z-index: 1;
|
|
2471
2472
|
line-height: 1 !important;
|
|
2472
2473
|
}
|
|
2473
2474
|
|
|
@@ -3630,7 +3631,7 @@ border-top: none;
|
|
|
3630
3631
|
border-radius: 0 0 0.5rem 0.5rem;
|
|
3631
3632
|
max-height: 250px;
|
|
3632
3633
|
overflow: hidden;
|
|
3633
|
-
z-index:
|
|
3634
|
+
z-index: 9999;
|
|
3634
3635
|
opacity: 0;
|
|
3635
3636
|
visibility: hidden;
|
|
3636
3637
|
transform: translateY(-10px);
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.4.
|
|
2
|
+
"version": "3.4.3",
|
|
3
3
|
"name": "funuicss",
|
|
4
4
|
"description": "React and Next.js component UI Library for creating Easy and good looking websites with fewer lines of code. Elevate your web development experience with our cutting-edge React/Next.js component UI Library. Craft stunning websites effortlessly, boasting both seamless functionality and aesthetic appeal—all achieved with minimal lines of code. Unleash the power of simplicity and style in your projects!",
|
|
5
5
|
"main": "index.js",
|
package/ui/sidebar/SideBar.d.ts
CHANGED
|
@@ -23,10 +23,6 @@ interface SideBarProps {
|
|
|
23
23
|
links?: SideBarLink[];
|
|
24
24
|
children?: ReactNode;
|
|
25
25
|
onClose?: () => void;
|
|
26
|
-
onOpen?: () => void;
|
|
27
|
-
swipeEnabled?: boolean;
|
|
28
|
-
swipeThreshold?: number;
|
|
29
|
-
swipeArea?: number;
|
|
30
26
|
}
|
|
31
|
-
export default function SideBar({ funcss, position, open, header, content, footer, top, sidebarWidth, iconCSS, sidebarCss, activeCss, bodyCss, popIcon, dividers, links, children, onClose,
|
|
27
|
+
export default function SideBar({ funcss, position, open, header, content, footer, top, sidebarWidth, iconCSS, sidebarCss, activeCss, bodyCss, popIcon, dividers, links, children, onClose, }: SideBarProps): React.JSX.Element;
|
|
32
28
|
export {};
|
package/ui/sidebar/SideBar.js
CHANGED
|
@@ -42,22 +42,15 @@ var react_1 = __importStar(require("react"));
|
|
|
42
42
|
var RowFlex_1 = __importDefault(require("../specials/RowFlex"));
|
|
43
43
|
var Text_1 = __importDefault(require("../text/Text"));
|
|
44
44
|
var navigation_1 = require("next/navigation");
|
|
45
|
-
var pi_1 = require("react-icons/pi");
|
|
46
45
|
var link_1 = __importDefault(require("next/link"));
|
|
47
46
|
function SideBar(_a) {
|
|
48
|
-
var _b
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var _w = (0, react_1.useState)(false), isTransitioning = _w[0], setIsTransitioning = _w[1];
|
|
54
|
-
var _x = (0, react_1.useState)(0), dragOffset = _x[0], setDragOffset = _x[1];
|
|
47
|
+
var _b;
|
|
48
|
+
var _c = _a.funcss, funcss = _c === void 0 ? '' : _c, _d = _a.position, position = _d === void 0 ? 'left' : _d, _e = _a.open, open = _e === void 0 ? false : _e, header = _a.header, content = _a.content, footer = _a.footer, _f = _a.top, top = _f === void 0 ? 0 : _f, _g = _a.sidebarWidth, sidebarWidth = _g === void 0 ? 250 : _g, _h = _a.iconCSS, iconCSS = _h === void 0 ? '' : _h, _j = _a.sidebarCss, sidebarCss = _j === void 0 ? '' : _j, activeCss = _a.activeCss, _k = _a.bodyCss, bodyCss = _k === void 0 ? '' : _k, _l = _a.popIcon, popIcon = _l === void 0 ? false : _l, _m = _a.dividers, dividers = _m === void 0 ? false : _m, _o = _a.links, links = _o === void 0 ? [] : _o, children = _a.children, onClose = _a.onClose;
|
|
49
|
+
var _p = (0, react_1.useState)(false), isMobile = _p[0], setIsMobile = _p[1];
|
|
50
|
+
var _q = (0, react_1.useState)(open), internalOpen = _q[0], setInternalOpen = _q[1];
|
|
51
|
+
var _r = (0, react_1.useState)('0px'), appBarHeight = _r[0], setAppBarHeight = _r[1];
|
|
55
52
|
var pathname = (0, navigation_1.usePathname)();
|
|
56
53
|
var sidebarRef = (0, react_1.useRef)(null);
|
|
57
|
-
var mainContentRef = (0, react_1.useRef)(null);
|
|
58
|
-
// Touch gesture state
|
|
59
|
-
var _y = (0, react_1.useState)(null), touchStart = _y[0], setTouchStart = _y[1];
|
|
60
|
-
var _z = (0, react_1.useState)(false), isDragging = _z[0], setIsDragging = _z[1];
|
|
61
54
|
var updateIsMobile = (0, react_1.useCallback)(function () {
|
|
62
55
|
setIsMobile(window.innerWidth <= 992);
|
|
63
56
|
}, []);
|
|
@@ -76,7 +69,6 @@ function SideBar(_a) {
|
|
|
76
69
|
setAppBarHeight("".concat(appBar.offsetHeight, "px"));
|
|
77
70
|
}
|
|
78
71
|
}, []);
|
|
79
|
-
// Handle outside clicks on mobile
|
|
80
72
|
(0, react_1.useEffect)(function () {
|
|
81
73
|
if (!isMobile || !internalOpen)
|
|
82
74
|
return;
|
|
@@ -92,120 +84,9 @@ function SideBar(_a) {
|
|
|
92
84
|
document.removeEventListener('touchstart', handleOutsideClick);
|
|
93
85
|
};
|
|
94
86
|
}, [isMobile, internalOpen]);
|
|
95
|
-
// Touch gesture handlers
|
|
96
|
-
var handleTouchStart = (0, react_1.useCallback)(function (e) {
|
|
97
|
-
var _a;
|
|
98
|
-
if (!isMobile || !swipeEnabled)
|
|
99
|
-
return;
|
|
100
|
-
var touch = e.touches[0];
|
|
101
|
-
var clientX = touch.clientX, clientY = touch.clientY;
|
|
102
|
-
var now = Date.now();
|
|
103
|
-
// Only initiate swipe from edge areas
|
|
104
|
-
var isLeftEdge = position === 'left' && clientX < swipeArea;
|
|
105
|
-
var isRightEdge = position === 'right' && clientX > window.innerWidth - swipeArea;
|
|
106
|
-
var isOnSidebar = internalOpen && ((_a = sidebarRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target));
|
|
107
|
-
if (isLeftEdge || isRightEdge || isOnSidebar) {
|
|
108
|
-
setTouchStart({ x: clientX, y: clientY, time: now });
|
|
109
|
-
setIsDragging(false);
|
|
110
|
-
e.preventDefault();
|
|
111
|
-
}
|
|
112
|
-
}, [isMobile, swipeEnabled, position, swipeArea, internalOpen]);
|
|
113
|
-
var handleTouchMove = (0, react_1.useCallback)(function (e) {
|
|
114
|
-
if (!touchStart || !isMobile || !swipeEnabled)
|
|
115
|
-
return;
|
|
116
|
-
var touch = e.touches[0];
|
|
117
|
-
var clientX = touch.clientX, clientY = touch.clientY;
|
|
118
|
-
var deltaX = clientX - touchStart.x;
|
|
119
|
-
var deltaY = clientY - touchStart.y;
|
|
120
|
-
// Check if it's a horizontal swipe (not vertical scroll)
|
|
121
|
-
if (Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > 10) {
|
|
122
|
-
if (!isDragging) {
|
|
123
|
-
setIsDragging(true);
|
|
124
|
-
}
|
|
125
|
-
// Calculate drag offset based on position and gesture direction
|
|
126
|
-
var offset = 0;
|
|
127
|
-
if (position === 'left') {
|
|
128
|
-
if (internalOpen) {
|
|
129
|
-
// Closing gesture: drag left
|
|
130
|
-
offset = Math.min(0, deltaX);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
// Opening gesture: drag right
|
|
134
|
-
offset = Math.max(0, deltaX);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
if (internalOpen) {
|
|
139
|
-
// Closing gesture: drag right
|
|
140
|
-
offset = Math.max(0, deltaX);
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
// Opening gesture: drag left
|
|
144
|
-
offset = Math.min(0, deltaX);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
setDragOffset(offset);
|
|
148
|
-
e.preventDefault();
|
|
149
|
-
}
|
|
150
|
-
}, [touchStart, isMobile, swipeEnabled, position, internalOpen, isDragging]);
|
|
151
|
-
var handleTouchEnd = (0, react_1.useCallback)(function (e) {
|
|
152
|
-
if (!touchStart || !isMobile || !swipeEnabled)
|
|
153
|
-
return;
|
|
154
|
-
var touch = e.changedTouches[0];
|
|
155
|
-
var clientX = touch.clientX;
|
|
156
|
-
var deltaX = clientX - touchStart.x;
|
|
157
|
-
var deltaTime = Date.now() - touchStart.time;
|
|
158
|
-
var velocity = Math.abs(deltaX) / deltaTime;
|
|
159
|
-
// Determine if gesture should trigger sidebar action
|
|
160
|
-
var shouldTrigger = Math.abs(deltaX) > swipeThreshold || velocity > 0.5;
|
|
161
|
-
if (shouldTrigger && isDragging) {
|
|
162
|
-
if (position === 'left') {
|
|
163
|
-
if (!internalOpen && deltaX > 0) {
|
|
164
|
-
handleOpen();
|
|
165
|
-
}
|
|
166
|
-
else if (internalOpen && deltaX < 0) {
|
|
167
|
-
handleClose();
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
if (!internalOpen && deltaX < 0) {
|
|
172
|
-
handleOpen();
|
|
173
|
-
}
|
|
174
|
-
else if (internalOpen && deltaX > 0) {
|
|
175
|
-
handleClose();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// Reset touch state
|
|
180
|
-
setTouchStart(null);
|
|
181
|
-
setIsDragging(false);
|
|
182
|
-
setDragOffset(0);
|
|
183
|
-
}, [touchStart, isMobile, swipeEnabled, position, internalOpen, isDragging, swipeThreshold]);
|
|
184
|
-
// Add touch event listeners
|
|
185
|
-
(0, react_1.useEffect)(function () {
|
|
186
|
-
if (!isMobile || !swipeEnabled)
|
|
187
|
-
return;
|
|
188
|
-
var element = mainContentRef.current || document.body;
|
|
189
|
-
element.addEventListener('touchstart', handleTouchStart, { passive: false });
|
|
190
|
-
element.addEventListener('touchmove', handleTouchMove, { passive: false });
|
|
191
|
-
element.addEventListener('touchend', handleTouchEnd, { passive: false });
|
|
192
|
-
return function () {
|
|
193
|
-
element.removeEventListener('touchstart', handleTouchStart);
|
|
194
|
-
element.removeEventListener('touchmove', handleTouchMove);
|
|
195
|
-
element.removeEventListener('touchend', handleTouchEnd);
|
|
196
|
-
};
|
|
197
|
-
}, [handleTouchStart, handleTouchMove, handleTouchEnd, isMobile, swipeEnabled]);
|
|
198
87
|
var handleClose = function () {
|
|
199
|
-
setIsTransitioning(true);
|
|
200
88
|
setInternalOpen(false);
|
|
201
89
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
202
|
-
setTimeout(function () { return setIsTransitioning(false); }, 300);
|
|
203
|
-
};
|
|
204
|
-
var handleOpen = function () {
|
|
205
|
-
setIsTransitioning(true);
|
|
206
|
-
setInternalOpen(true);
|
|
207
|
-
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
208
|
-
setTimeout(function () { return setIsTransitioning(false); }, 300);
|
|
209
90
|
};
|
|
210
91
|
var groupedLinks = links.reduce(function (acc, link) {
|
|
211
92
|
acc[link.section] = acc[link.section] || [];
|
|
@@ -213,48 +94,17 @@ function SideBar(_a) {
|
|
|
213
94
|
return acc;
|
|
214
95
|
}, {});
|
|
215
96
|
var isOverlay = isMobile;
|
|
216
|
-
// Calculate transform for drag gesture
|
|
217
|
-
var getSidebarTransform = function () {
|
|
218
|
-
if (!isDragging || !isOverlay)
|
|
219
|
-
return '';
|
|
220
|
-
if (position === 'left') {
|
|
221
|
-
var baseTransform = internalOpen ? 0 : -sidebarWidth;
|
|
222
|
-
return "translateX(".concat(baseTransform + dragOffset, "px)");
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
var baseTransform = internalOpen ? 0 : sidebarWidth;
|
|
226
|
-
return "translateX(".concat(baseTransform + dragOffset, "px)");
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
97
|
return (react_1.default.createElement("div", { className: "sidebar-container ".concat(isOverlay ? '' : 'with-content') },
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
top: 0,
|
|
233
|
-
left: 0,
|
|
234
|
-
right: 0,
|
|
235
|
-
bottom: 0,
|
|
236
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
237
|
-
zIndex: 998,
|
|
238
|
-
opacity: isDragging ? Math.abs(dragOffset) / sidebarWidth : 1,
|
|
239
|
-
transition: isDragging ? 'none' : 'opacity 0.3s ease',
|
|
240
|
-
}, onClick: handleClose })),
|
|
241
|
-
(internalOpen || isDragging) && (react_1.default.createElement("aside", { role: "complementary", ref: sidebarRef, className: "sidebar ".concat(funcss, " ").concat(sidebarCss, " ").concat(isOverlay ? 'nav_overlay' : ''), style: (_b = {
|
|
242
|
-
width: isOverlay ? "".concat(sidebarWidth, "px") : "".concat(sidebarWidth, "px"),
|
|
98
|
+
internalOpen && (react_1.default.createElement("aside", { role: "complementary", ref: sidebarRef, className: "sidebar ".concat(funcss, " ").concat(sidebarCss, " ").concat(isOverlay ? 'nav_overlay' : ''), style: (_b = {
|
|
99
|
+
width: isOverlay ? '100%' : "".concat(sidebarWidth, "px"),
|
|
243
100
|
height: "calc(100vh - ".concat(appBarHeight || top || '0px', ")"),
|
|
244
101
|
position: 'fixed',
|
|
245
102
|
top: appBarHeight || top
|
|
246
103
|
},
|
|
247
104
|
_b[position] = 0,
|
|
248
105
|
_b.padding = '1rem',
|
|
249
|
-
_b.zIndex = 999,
|
|
250
|
-
_b.transform = getSidebarTransform(),
|
|
251
|
-
_b.transition = isDragging || isTransitioning ? 'none' : 'transform 0.3s ease',
|
|
252
|
-
_b.willChange = 'transform',
|
|
253
106
|
_b) },
|
|
254
|
-
react_1.default.createElement(RowFlex_1.default, { justify: "space-between", funcss: "pl-2 pr-2" },
|
|
255
|
-
header && react_1.default.createElement("div", null, header),
|
|
256
|
-
isMobile && (react_1.default.createElement("div", { className: "hover-text-error pointer", onClick: handleClose, style: { cursor: 'pointer', zIndex: 1000 } },
|
|
257
|
-
react_1.default.createElement(pi_1.PiX, { size: 25 })))),
|
|
107
|
+
react_1.default.createElement(RowFlex_1.default, { justify: "space-between", funcss: "pl-2 pr-2" }, header && react_1.default.createElement("div", null, header)),
|
|
258
108
|
react_1.default.createElement("section", { className: "sidebar-body mt-3" },
|
|
259
109
|
links.length > 0 && (react_1.default.createElement("nav", { className: "sidebar-links" }, Object.entries(groupedLinks).map(function (_a) {
|
|
260
110
|
var section = _a[0], sectionLinks = _a[1];
|
|
@@ -267,14 +117,14 @@ function SideBar(_a) {
|
|
|
267
117
|
handleClose();
|
|
268
118
|
}
|
|
269
119
|
}, key: link.uri, href: link.uri },
|
|
270
|
-
react_1.default.createElement("div", { className: "p-1 pl-2 pr-2 sidebar-link
|
|
120
|
+
react_1.default.createElement("div", { className: "p-1 pl-2 pr-2 sidebar-link ".concat(isActive ? "primary50 outline-primary200 ".concat(activeCss || '') : 'hoverable') },
|
|
271
121
|
react_1.default.createElement("span", { className: "".concat(iconCSS || '', " ").concat(popIcon ? "p-1 border lighter central" : ""), style: { lineHeight: 0, borderRadius: "0.4rem" } }, link.icon),
|
|
272
122
|
react_1.default.createElement(Text_1.default, { text: link.text, size: "sm", weight: 400 }))));
|
|
273
123
|
})));
|
|
274
124
|
}))),
|
|
275
125
|
content),
|
|
276
126
|
footer && react_1.default.createElement("footer", { className: "sidebar-footer mt-2" }, footer))),
|
|
277
|
-
react_1.default.createElement("main", {
|
|
127
|
+
react_1.default.createElement("main", { className: "main-content ".concat(bodyCss), style: {
|
|
278
128
|
flex: 1,
|
|
279
129
|
marginLeft: position === 'left' && !isOverlay && internalOpen ? "".concat(sidebarWidth, "px") : 0,
|
|
280
130
|
marginRight: position === 'right' && !isOverlay && internalOpen ? "".concat(sidebarWidth, "px") : 0,
|
|
@@ -282,20 +132,5 @@ function SideBar(_a) {
|
|
|
282
132
|
height: '100vh',
|
|
283
133
|
paddingTop: appBarHeight || top,
|
|
284
134
|
transition: 'margin 0.3s ease',
|
|
285
|
-
|
|
286
|
-
} }, children),
|
|
287
|
-
isMobile && swipeEnabled && !internalOpen && (react_1.default.createElement("div", { className: "swipe-indicator", style: (_c = {
|
|
288
|
-
position: 'fixed'
|
|
289
|
-
},
|
|
290
|
-
_c[position] = 0,
|
|
291
|
-
_c.top = '50%',
|
|
292
|
-
_c.transform = 'translateY(-50%)',
|
|
293
|
-
_c.width = '4px',
|
|
294
|
-
_c.height = '40px',
|
|
295
|
-
_c.backgroundColor = 'rgba(128, 128, 128, 0.3)',
|
|
296
|
-
_c.borderRadius = position === 'left' ? '0 4px 4px 0' : '4px 0 0 4px',
|
|
297
|
-
_c.zIndex = 1000,
|
|
298
|
-
_c.pointerEvents = 'none',
|
|
299
|
-
_c.transition = 'opacity 0.3s ease',
|
|
300
|
-
_c) }))));
|
|
135
|
+
} }, children)));
|
|
301
136
|
}
|