ml-ui-lib 1.0.45 → 1.0.47

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.
@@ -19,7 +19,7 @@
19
19
  border: 1px solid #ccc;
20
20
  border-radius: 6px;
21
21
  align-items: center;
22
- padding: 0.4rem 0.6rem;
22
+ padding: 0.55rem 0.6rem;
23
23
  display: flex;
24
24
  justify-content: space-between;
25
25
  width: 100%;
@@ -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%);
@@ -192,9 +196,9 @@
192
196
  color: #e00000;
193
197
  }
194
198
 
195
- .separator {
199
+ /* .separator {
196
200
  display: none !important;
197
- }
201
+ } */
198
202
 
199
203
  /* -------------------------
200
204
  Navbar Links
@@ -305,6 +309,7 @@
305
309
  z-index: 10000;
306
310
  }
307
311
 
312
+ .navbar-search-btn,
308
313
  .separator,
309
314
  .login-btn {
310
315
  display: none !important;
@@ -368,9 +373,9 @@
368
373
  color: #333;
369
374
  }
370
375
 
371
- .separator {
376
+ /* .separator {
372
377
  display: none !important;
373
- }
378
+ } */
374
379
 
375
380
  .navbar-links a:hover {
376
381
  background: #ff0000;
@@ -518,11 +523,11 @@
518
523
  }
519
524
 
520
525
  /* Right-side group */
521
- .navbar-right {
526
+ /* .navbar-right {
522
527
  display: flex;
523
528
  align-items: center;
524
529
  gap: 20px;
525
- }
530
+ } */
526
531
 
527
532
  /* Scrollbar styling */
528
533
  ::-webkit-scrollbar {
@@ -541,4 +546,109 @@
541
546
 
542
547
  ::-webkit-scrollbar-thumb:hover {
543
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 #9b9b9ba5 1px;
585
+ padding: 10px 35px 10px 10px;
586
+ font-size: 15px;
587
+ border-radius: 15px;
588
+ pointer-events: auto;
589
+ /* margin-left: -15px; */
590
+ }
591
+
592
+ .navbar-search-container.open .navbar-search-input {
593
+ opacity: 1;
594
+ margin-left: -15px;
595
+ margin-right: -30px;
596
+ }
597
+
598
+ .navbar-search-btn {
599
+ background: none;
600
+ border: none;
601
+ cursor: pointer;
602
+ display: flex;
603
+ align-items: center;
604
+ justify-content: center;
605
+ padding: 5px;
606
+ margin-left: -35px !important;
607
+ color: #fff;
608
+ z-index: 2;
609
+ }
610
+
611
+ .navbar-search-container.open .navbar-search-btn {
612
+ margin-left: auto !important
613
+ }
614
+
615
+
616
+ /* Container layout */
617
+ .navbar-right {
618
+ position: relative;
619
+ display: flex;
620
+ align-items: center;
621
+ }
622
+
623
+ /* Actions (burger + login) */
624
+ .navbar-actions {
625
+ display: flex;
626
+ align-items: center;
627
+ gap: 10px;
628
+ padding-right: 40px;
629
+ transition: opacity 0.25s ease, transform 0.25s ease;
630
+ }
631
+
632
+ /* Hide when search is active */
633
+ .navbar-right.search-active .navbar-actions {
634
+ opacity: 0;
635
+ transform: translateX(20px);
636
+ pointer-events: none;
637
+ }
638
+
639
+ /* OPTIONAL: fully remove after animation */
640
+ .navbar-right.search-active .navbar-actions {
641
+ display: none;
642
+ visibility: hidden;
643
+ }
644
+
645
+ /* Search expands more when active */
646
+ .navbar-search-container.open {
647
+ width: 350px;
648
+ border-left: solid #999 1px;
649
+ /* increase if needed */
650
+ }
651
+
652
+ .navbar-right.search-active .navbar-actions {
653
+ display: none;
544
654
  }
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useState, useEffect } from 'react';
3
+ import { useState, useEffect, useRef } from 'react';
4
4
  import './Navbar.css';
5
5
  import { SlidingPanel } from '../SlidingPanel/SlidingPanel';
6
6
  export const Navbar = ({ siteUrl, items, products, logoSrc = '', logoAlt = 'Logo', logoWidth = 220, logoHeight = 40, className = '', login = false, logedinData = null, loginContent, otherContent, onClose, }) => {
@@ -12,6 +12,19 @@ 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 searchContainerRef = useRef(null);
18
+ const hasValue = searchQuery.trim().length > 0;
19
+ const handleSearch = () => {
20
+ if (!searchQuery.trim())
21
+ return;
22
+ console.log('Searching for:', searchQuery);
23
+ // Example: redirect
24
+ window.location.href = `/search-results?q=${encodeURIComponent(searchQuery)}`;
25
+ // Optional: close search after
26
+ setSearchOpen(false);
27
+ };
15
28
  useEffect(() => {
16
29
  const handleResize = () => setIsMobile(window.innerWidth <= 992);
17
30
  handleResize();
@@ -78,28 +91,65 @@ export const Navbar = ({ siteUrl, items, products, logoSrc = '', logoAlt = 'Logo
78
91
  window.addEventListener('scroll', handleScroll, { passive: true });
79
92
  return () => window.removeEventListener('scroll', handleScroll);
80
93
  }, [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: [_jsx("div", { className: "nav-items", children: items.map(item => {
82
- const hasSubLinks = item.subLinks && item.subLinks.length > 0;
83
- const linkPath = new URL(item.link || '#', 'https://dummybase').pathname;
84
- const isActive = currentPath === linkPath;
85
- const isDropdownOpen = openDropdown === item.name;
86
- 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) => {
87
- if (hasSubLinks) {
88
- e.preventDefault();
89
- setOpenDropdown(prev => (prev === item.name ? null : item.name));
90
- }
91
- else {
92
- setMenuOpen(false);
93
- }
94
- }, 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: () => {
95
- setMenuOpen(false);
96
- setOpenDropdown(null);
97
- }, 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: () => {
98
- setMenuOpen(false);
99
- setOpenDropdown(null);
100
- }, children: _jsx("div", { className: 'navbar-services-item', children: _jsx("span", { style: {
101
- textAlign: 'center'
102
- }, children: product.name }) }) }, product.name))) }) })] }) }))] }, item.name));
103
- }) }), 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", 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" }))] })] })] }) }), 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 })] }) })) }))] }));
94
+ useEffect(() => {
95
+ const handleClickOutside = (event) => {
96
+ if (searchContainerRef.current &&
97
+ !searchContainerRef.current.contains(event.target)) {
98
+ setSearchOpen(false);
99
+ }
100
+ };
101
+ if (searchOpen) {
102
+ document.addEventListener('mousedown', handleClickOutside);
103
+ }
104
+ return () => {
105
+ document.removeEventListener('mousedown', handleClickOutside);
106
+ };
107
+ }, [searchOpen]);
108
+ useEffect(() => {
109
+ const handleEsc = (e) => {
110
+ if (e.key === 'Escape')
111
+ setSearchOpen(false);
112
+ };
113
+ document.addEventListener('keydown', handleEsc);
114
+ return () => document.removeEventListener('keydown', handleEsc);
115
+ }, []);
116
+ 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 => {
117
+ const hasSubLinks = item.subLinks && item.subLinks.length > 0;
118
+ const linkPath = new URL(item.link || '#', 'https://dummybase').pathname;
119
+ const isActive = currentPath === linkPath;
120
+ const isDropdownOpen = openDropdown === item.name;
121
+ 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) => {
122
+ if (hasSubLinks) {
123
+ e.preventDefault();
124
+ setOpenDropdown(prev => (prev === item.name ? null : item.name));
125
+ }
126
+ else {
127
+ setMenuOpen(false);
128
+ }
129
+ }, 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: () => {
130
+ setMenuOpen(false);
131
+ setOpenDropdown(null);
132
+ }, 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: () => {
133
+ setMenuOpen(false);
134
+ setOpenDropdown(null);
135
+ }, children: _jsx("div", { className: 'navbar-services-item', children: _jsx("span", { style: {
136
+ textAlign: 'center'
137
+ }, children: product.name }) }) }, product.name))) }) })] }) }))] }, item.name));
138
+ }) }) }), 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", { ref: searchContainerRef, 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) => {
139
+ if (e.key === 'Enter') {
140
+ handleSearch();
141
+ }
142
+ } }), _jsx("button", { className: `navbar-search-btn ${searchOpen && hasValue ? 'active' : ''}`, onClick: () => {
143
+ if (!searchOpen) {
144
+ setSearchOpen(true);
145
+ return;
146
+ }
147
+ if (hasValue) {
148
+ handleSearch(); // trigger search
149
+ }
150
+ else {
151
+ setSearchOpen(false); // close if empty
152
+ }
153
+ }, children: searchOpen && hasValue ? (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "red", strokeWidth: "2", children: [_jsx("circle", { cx: "11", cy: "11", r: "8" }), _jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })] })) : (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "red", strokeWidth: "2", 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
154
  };
105
155
  export default Navbar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ml-ui-lib",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",