ml-ui-lib 1.0.44 → 1.0.46
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/DatePicker2/DatePicker2.css +1 -1
- package/dist/components/Dropdown/Dropdown.css +11 -0
- package/dist/components/Dropdown/Dropdown.d.ts +1 -0
- package/dist/components/Dropdown/Dropdown.js +12 -2
- package/dist/components/Footer/Footer.js +1 -1
- package/dist/components/Navbar/Navbar.css +114 -7
- package/dist/components/Navbar/Navbar.js +38 -23
- package/package.json +1 -1
|
@@ -81,3 +81,14 @@
|
|
|
81
81
|
.has-error .dropdown-trigger {
|
|
82
82
|
border-color: #ff4d4d;
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
.dropdown-trigger.disabled {
|
|
86
|
+
background: #f5f5f5;
|
|
87
|
+
color: #aaa;
|
|
88
|
+
cursor: not-allowed;
|
|
89
|
+
pointer-events: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.dropdown-wrapper.has-error .dropdown-trigger.disabled {
|
|
93
|
+
border-color: #ccc;
|
|
94
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect } from "react";
|
|
3
3
|
import "./Dropdown.css";
|
|
4
|
-
export const Dropdown = ({ label, value, options, onChange, placeholder = "Select", className = "", error, }) => {
|
|
4
|
+
export const Dropdown = ({ label, value, options, onChange, placeholder = "Select", className = "", error, disabled }) => {
|
|
5
5
|
const [dropdownOpen, setDropdownOpen] = useState(false);
|
|
6
6
|
const dropdownRef = useRef(null);
|
|
7
7
|
useEffect(() => {
|
|
@@ -13,7 +13,17 @@ export const Dropdown = ({ label, value, options, onChange, placeholder = "Selec
|
|
|
13
13
|
document.addEventListener("mousedown", handleClickOutside);
|
|
14
14
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
15
15
|
}, []);
|
|
16
|
-
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (disabled)
|
|
18
|
+
setDropdownOpen(false);
|
|
19
|
+
}, [disabled]);
|
|
20
|
+
return (_jsxs("div", { className: `dropdown-wrapper ${className} ${error ? "has-error" : ""}`, ref: dropdownRef, children: [label && _jsx("label", { className: "dropdown-label", children: label }), _jsxs("div", { className: `dropdown-trigger ${disabled ? "disabled" : ""}`, onClick: () => {
|
|
21
|
+
if (disabled)
|
|
22
|
+
return;
|
|
23
|
+
setDropdownOpen(!dropdownOpen);
|
|
24
|
+
}, children: [_jsx("span", { className: "dropdown-value", children: value === "" ? placeholder : value }), _jsx("span", { className: "dropdown-caret", children: "\u25BC" })] }), dropdownOpen && (_jsx("div", { className: "dropdown-list scrollbar", children: options.length > 0 ? (options.map((option, i) => (_jsx("div", { className: `dropdown-option ${value === option ? "selected" : ""}`, onClick: () => {
|
|
25
|
+
if (disabled)
|
|
26
|
+
return;
|
|
17
27
|
onChange(option);
|
|
18
28
|
setDropdownOpen(false);
|
|
19
29
|
}, children: option }, i)))) : (_jsx("div", { className: "dropdown-empty", children: "No options" })) })), error && _jsx("span", { className: "dropdown-error", children: error })] }));
|
|
@@ -31,6 +31,6 @@ export const Footer = ({ footerItems, logoSrc = '', logoAlt = 'M Lhuillier Logo'
|
|
|
31
31
|
{ name: 'ig', link: 'https://www.instagram.com/mlhuillier_official/' },
|
|
32
32
|
{ name: 'x', link: 'https://x.com/KaMLhuillier' },
|
|
33
33
|
{ name: 'yt', link: 'https://www.youtube.com/user/MLhuillierInc' },
|
|
34
|
-
].map((icon) => (_jsx("a", { href: icon.link, target: "_blank", rel: "noopener noreferrer", children: _jsx("img", { src: `/icons/${icon.name}.svg`, alt: icon.name }) }, icon.name))) })] }), _jsxs("div", { className: "apps", children: [_jsx("h4", { children: "Get the MCash App" }), _jsx("div", { className: "app-items", children: appLinksArr.map((item, index) => (_jsx("a", { href: item.link, children: _jsx("img", { src: item.url, alt: "App download" }) }, index))) })] })] }), _jsx("div", { className: 'emblems', children: empblemArr.map((item, index) => (_jsxs("div", { className: "emblem-item", children: [_jsx("img", { src: item.url, alt: item.name }), _jsx("span", { children: item.name })] }, index))) })] }) }), _jsx("div", { className: 'others' }), _jsxs("div", { className: "footer-bottom", children: [_jsxs("p", { children: ["Copyright \u00A9 ", new Date().getFullYear(), " M Lhuillier Financial Services, Inc."] }), " ", _jsx("p", { children: "All rights reserved." })] })] }) }));
|
|
34
|
+
].map((icon) => (_jsx("a", { href: icon.link, target: "_blank", rel: "noopener noreferrer", children: _jsx("img", { src: `/icons/${icon.name}.svg`, alt: icon.name }) }, icon.name))) })] }), _jsxs("div", { className: "apps", children: [_jsx("h4", { children: "Get the MCash App" }), _jsx("div", { className: "app-items", children: appLinksArr.map((item, index) => (_jsx("a", { href: item.link, children: _jsx("img", { src: item.url, alt: "App download", loading: "lazy" }) }, index))) })] })] }), _jsx("div", { className: 'emblems', children: empblemArr.map((item, index) => (_jsxs("div", { className: "emblem-item", children: [_jsx("img", { src: item.url, alt: item.name, loading: "lazy" }), _jsx("span", { children: item.name })] }, index))) })] }) }), _jsx("div", { className: 'others' }), _jsxs("div", { className: "footer-bottom", children: [_jsxs("p", { children: ["Copyright \u00A9 ", new Date().getFullYear(), " M Lhuillier Financial Services, Inc."] }), " ", _jsx("p", { children: "All rights reserved." })] })] }) }));
|
|
35
35
|
};
|
|
36
36
|
export default Footer;
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
transition: transform 0.2s ease-in-out;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
.has-dropdown {
|
|
15
|
+
min-width: 200px;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
/* Hide navbar when scrolling down */
|
|
15
19
|
.navbar--hidden {
|
|
16
20
|
transform: translateY(-100%);
|
|
@@ -92,11 +96,12 @@
|
|
|
92
96
|
flex-direction: row;
|
|
93
97
|
background-color: #f5f5f5;
|
|
94
98
|
box-shadow: 0 1px 10px #00000017;
|
|
99
|
+
border: .7px solid #ececec;
|
|
95
100
|
border-radius: 20px;
|
|
96
101
|
padding: 15px;
|
|
97
102
|
gap: 15px 40px;
|
|
98
103
|
align-items: center;
|
|
99
|
-
width:
|
|
104
|
+
width: 352px;
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
.navbar-services-item {
|
|
@@ -191,9 +196,9 @@
|
|
|
191
196
|
color: #e00000;
|
|
192
197
|
}
|
|
193
198
|
|
|
194
|
-
.separator {
|
|
199
|
+
/* .separator {
|
|
195
200
|
display: none !important;
|
|
196
|
-
}
|
|
201
|
+
} */
|
|
197
202
|
|
|
198
203
|
/* -------------------------
|
|
199
204
|
Navbar Links
|
|
@@ -304,6 +309,7 @@
|
|
|
304
309
|
z-index: 10000;
|
|
305
310
|
}
|
|
306
311
|
|
|
312
|
+
.navbar-search-btn,
|
|
307
313
|
.separator,
|
|
308
314
|
.login-btn {
|
|
309
315
|
display: none !important;
|
|
@@ -367,9 +373,9 @@
|
|
|
367
373
|
color: #333;
|
|
368
374
|
}
|
|
369
375
|
|
|
370
|
-
.separator {
|
|
376
|
+
/* .separator {
|
|
371
377
|
display: none !important;
|
|
372
|
-
}
|
|
378
|
+
} */
|
|
373
379
|
|
|
374
380
|
.navbar-links a:hover {
|
|
375
381
|
background: #ff0000;
|
|
@@ -517,11 +523,11 @@
|
|
|
517
523
|
}
|
|
518
524
|
|
|
519
525
|
/* Right-side group */
|
|
520
|
-
.navbar-right {
|
|
526
|
+
/* .navbar-right {
|
|
521
527
|
display: flex;
|
|
522
528
|
align-items: center;
|
|
523
529
|
gap: 20px;
|
|
524
|
-
}
|
|
530
|
+
} */
|
|
525
531
|
|
|
526
532
|
/* Scrollbar styling */
|
|
527
533
|
::-webkit-scrollbar {
|
|
@@ -540,4 +546,105 @@
|
|
|
540
546
|
|
|
541
547
|
::-webkit-scrollbar-thumb:hover {
|
|
542
548
|
background: #4f4f4f;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
.navbar-search-container {
|
|
553
|
+
position: absolute;
|
|
554
|
+
right: 0;
|
|
555
|
+
display: flex;
|
|
556
|
+
align-items: center;
|
|
557
|
+
overflow: hidden;
|
|
558
|
+
|
|
559
|
+
width: 40px;
|
|
560
|
+
height: 40px;
|
|
561
|
+
|
|
562
|
+
background: white;
|
|
563
|
+
/* important so it covers */
|
|
564
|
+
border-radius: 20px;
|
|
565
|
+
|
|
566
|
+
transition: width 0.35s ease;
|
|
567
|
+
z-index: 10;
|
|
568
|
+
/* sits above nav items */
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.navbar-search-container.open {
|
|
572
|
+
width: 400px;
|
|
573
|
+
padding-left: 30px;
|
|
574
|
+
/* adjust */
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
.navbar-search-input {
|
|
578
|
+
flex: 1;
|
|
579
|
+
border: none;
|
|
580
|
+
outline: none;
|
|
581
|
+
padding: 0 10px;
|
|
582
|
+
opacity: 0;
|
|
583
|
+
transition: opacity 0.2s ease;
|
|
584
|
+
border: solid #f3f3f3 1px;
|
|
585
|
+
padding: 10px 10px;
|
|
586
|
+
font-size: 15px;
|
|
587
|
+
border-radius: 15px;
|
|
588
|
+
/* margin-left: -15px; */
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
.navbar-search-container.open .navbar-search-input {
|
|
592
|
+
opacity: 1;
|
|
593
|
+
margin-left: -15px;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.navbar-search-btn {
|
|
597
|
+
background: none;
|
|
598
|
+
border: none;
|
|
599
|
+
cursor: pointer;
|
|
600
|
+
display: flex;
|
|
601
|
+
align-items: center;
|
|
602
|
+
justify-content: center;
|
|
603
|
+
padding: 5px;
|
|
604
|
+
margin-left: -15px !important;
|
|
605
|
+
color: #fff;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
.navbar-search-container.open .navbar-search-btn {
|
|
609
|
+
margin-left: auto !important
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
/* Container layout */
|
|
614
|
+
.navbar-right {
|
|
615
|
+
position: relative;
|
|
616
|
+
display: flex;
|
|
617
|
+
align-items: center;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/* Actions (burger + login) */
|
|
621
|
+
.navbar-actions {
|
|
622
|
+
display: flex;
|
|
623
|
+
align-items: center;
|
|
624
|
+
gap: 10px;
|
|
625
|
+
transition: opacity 0.25s ease, transform 0.25s ease;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/* Hide when search is active */
|
|
629
|
+
.navbar-right.search-active .navbar-actions {
|
|
630
|
+
opacity: 0;
|
|
631
|
+
transform: translateX(20px);
|
|
632
|
+
pointer-events: none;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/* OPTIONAL: fully remove after animation */
|
|
636
|
+
.navbar-right.search-active .navbar-actions {
|
|
637
|
+
display: none;
|
|
638
|
+
visibility: hidden;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/* Search expands more when active */
|
|
642
|
+
.navbar-search-container.open {
|
|
643
|
+
width: 350px;
|
|
644
|
+
border-left: solid #f3f3f3 1px;
|
|
645
|
+
/* increase if needed */
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
.navbar-right.search-active .navbar-actions {
|
|
649
|
+
display: none;
|
|
543
650
|
}
|
|
@@ -12,6 +12,17 @@ export const Navbar = ({ siteUrl, items, products, logoSrc = '', logoAlt = 'Logo
|
|
|
12
12
|
const [openDropdown, setOpenDropdown] = useState(null);
|
|
13
13
|
const [hideNavbar, setHideNavbar] = useState(false);
|
|
14
14
|
const [lastScrollY, setLastScrollY] = useState(0);
|
|
15
|
+
const [searchOpen, setSearchOpen] = useState(false);
|
|
16
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
17
|
+
const handleSearch = () => {
|
|
18
|
+
if (!searchQuery.trim())
|
|
19
|
+
return;
|
|
20
|
+
console.log('Searching for:', searchQuery);
|
|
21
|
+
// Example: redirect
|
|
22
|
+
window.location.href = `/search-results?q=${encodeURIComponent(searchQuery)}`;
|
|
23
|
+
// Optional: close search after
|
|
24
|
+
setSearchOpen(false);
|
|
25
|
+
};
|
|
15
26
|
useEffect(() => {
|
|
16
27
|
const handleResize = () => setIsMobile(window.innerWidth <= 992);
|
|
17
28
|
handleResize();
|
|
@@ -78,28 +89,32 @@ export const Navbar = ({ siteUrl, items, products, logoSrc = '', logoAlt = 'Logo
|
|
|
78
89
|
window.addEventListener('scroll', handleScroll, { passive: true });
|
|
79
90
|
return () => window.removeEventListener('scroll', handleScroll);
|
|
80
91
|
}, [lastScrollY, menuOpen]);
|
|
81
|
-
return (_jsxs(_Fragment, { children: [_jsx("nav", { className: `navbar ${hideNavbar ? 'navbar--hidden' : ''} ${className}`, children: _jsxs("div", { className: "navbar-container", children: [_jsx("div", { className: "navbar-logo", children: _jsx("a", { href: siteUrl, className: "navbar-brand", children: _jsx("img", { src: logoSrc, alt: logoAlt, width: logoWidth, height: logoHeight, style: { cursor: 'pointer', display: 'block' } }) }) }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', gap: '10px', alignItems: 'center' }, children: [_jsxs("div", { className: `navbar-links ${menuOpen ? 'open' : ''}`, children:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
92
|
+
return (_jsxs(_Fragment, { children: [_jsx("nav", { className: `navbar ${hideNavbar ? 'navbar--hidden' : ''} ${className}`, children: _jsxs("div", { className: "navbar-container", children: [_jsx("div", { className: "navbar-logo", children: _jsx("a", { href: siteUrl, className: "navbar-brand", children: _jsx("img", { src: logoSrc, alt: logoAlt, width: logoWidth, height: logoHeight, style: { cursor: 'pointer', display: 'block' } }) }) }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', gap: '10px', alignItems: 'center' }, children: [_jsxs("div", { className: "navbar-actions", children: [_jsx("div", { className: `navbar-links ${menuOpen ? 'open' : ''}`, children: _jsx("div", { className: "nav-items", children: items.map(item => {
|
|
93
|
+
const hasSubLinks = item.subLinks && item.subLinks.length > 0;
|
|
94
|
+
const linkPath = new URL(item.link || '#', 'https://dummybase').pathname;
|
|
95
|
+
const isActive = currentPath === linkPath;
|
|
96
|
+
const isDropdownOpen = openDropdown === item.name;
|
|
97
|
+
return (_jsxs("div", { className: `navbar-item ${hasSubLinks ? 'has-dropdown' : ''} ${isDropdownOpen ? 'open' : ''}`, children: [_jsx("a", { href: hasSubLinks ? '#' : item.link, target: item.target || '_self', className: `navbar-link ${isActive ? 'active' : ''} ${hasSubLinks ? 'parent-link' : ''}`, onClick: (e) => {
|
|
98
|
+
if (hasSubLinks) {
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
setOpenDropdown(prev => (prev === item.name ? null : item.name));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
setMenuOpen(false);
|
|
104
|
+
}
|
|
105
|
+
}, children: item.name }), hasSubLinks && (_jsx("div", { className: "navbar-dropdown", children: _jsxs("div", { className: "navbar-dropdown-content", children: [_jsx("div", { className: "navbar-services", children: Array.from({ length: Math.ceil(item.subLinks.length / 5) }, (_, i) => item.subLinks.slice(i * 5, i * 5 + 5)).map((column, index) => (_jsx("div", { className: 'navbar-services-cols', children: column.map(sub => (_jsx("a", { href: sub.link, target: sub.target || '_self', className: "navbar-dropdown-link", onClick: () => {
|
|
106
|
+
setMenuOpen(false);
|
|
107
|
+
setOpenDropdown(null);
|
|
108
|
+
}, children: sub.name }, sub.name))) }, index))) }), _jsx("div", { className: "navbar-products", children: _jsx("div", { className: 'navbar-services-container', children: products.map(product => (_jsx("a", { href: product.link, onClick: () => {
|
|
109
|
+
setMenuOpen(false);
|
|
110
|
+
setOpenDropdown(null);
|
|
111
|
+
}, children: _jsx("div", { className: 'navbar-services-item', children: _jsx("span", { style: {
|
|
112
|
+
textAlign: 'center'
|
|
113
|
+
}, children: product.name }) }) }, product.name))) }) })] }) }))] }, item.name));
|
|
114
|
+
}) }) }), isMobile && login && !logedinData && (_jsx("div", { className: 'navbar-item', style: { background: '#ffffff' }, children: _jsx("button", { className: "mobile-login-btn", onClick: toggleLogin, children: "Login" }) }))] }), _jsxs("div", { className: `navbar-right ${searchOpen ? 'search-active' : ''}`, children: [_jsxs("button", { className: `burger ${menuOpen ? 'active' : ''}`, onClick: toggleMenu, children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }), !isMobile && login && !logedinData && (_jsx("span", { className: "login-btn", onClick: toggleLogin, children: "Login" })), _jsxs("div", { className: `navbar-search-container ${searchOpen ? 'open' : ''}`, children: [_jsx("input", { type: "text", className: "navbar-search-input", placeholder: "Search...", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), onKeyDown: (e) => {
|
|
115
|
+
if (e.key === 'Enter') {
|
|
116
|
+
handleSearch();
|
|
117
|
+
}
|
|
118
|
+
} }), _jsx("button", { className: "navbar-search-btn", onClick: () => setSearchOpen(prev => !prev), children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "red", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "11", cy: "11", r: "8" }), _jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })] }) })] })] })] })] }) }), login && !logedinData && (_jsx(_Fragment, { children: !isMobile ? (showLogin && (_jsxs(_Fragment, { children: [_jsx("div", { className: "overlay-side-content", children: otherContent }), _jsx("div", { className: "navbar-login-panel", children: _jsxs(SlidingPanel, { isOpen: showLogin && !isClosing, width: "400px", height: "100%", position: "right", closeOnOverlayClick: false, onClose: handleInternalClose, children: [_jsx("div", { className: "navbar-panel-header" }), _jsx("div", { className: "navbar-panel-content", children: loginContent })] }) })] }))) : (_jsx("div", { className: "navbar-login-panel", children: _jsxs(SlidingPanel, { isOpen: showLogin, height: "70%", position: "bottom", onClose: handleInternalClose, children: [_jsx("div", { className: "navbar-panel-header" }), _jsx("div", { className: "navbar-panel-content", children: loginContent })] }) })) }))] }));
|
|
104
119
|
};
|
|
105
120
|
export default Navbar;
|