ml-ui-lib 1.0.43 → 1.0.45

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.
@@ -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
+ }
@@ -8,6 +8,7 @@ export interface DropdownProps {
8
8
  placeholder?: string;
9
9
  className?: string;
10
10
  error?: string;
11
+ disabled?: boolean;
11
12
  }
12
13
  export declare const Dropdown: React.FC<DropdownProps>;
13
14
  export default Dropdown;
@@ -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
- 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", onClick: () => setDropdownOpen(!dropdownOpen), 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: () => {
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 })] }));
@@ -92,11 +92,12 @@
92
92
  flex-direction: row;
93
93
  background-color: #f5f5f5;
94
94
  box-shadow: 0 1px 10px #00000017;
95
+ border: .7px solid #ececec;
95
96
  border-radius: 20px;
96
97
  padding: 15px;
97
98
  gap: 15px 40px;
98
99
  align-items: center;
99
- width: 350px;
100
+ width: 352px;
100
101
  }
101
102
 
102
103
  .navbar-services-item {
@@ -94,9 +94,12 @@ export const Navbar = ({ siteUrl, items, products, logoSrc = '', logoAlt = 'Logo
94
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
95
  setMenuOpen(false);
96
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("div", { className: 'navbar-services-item', children: _jsx("span", { style: {
98
- textAlign: 'center'
99
- }, children: product.name }) }))) }) })] }) }))] }, item.name));
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));
100
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 })] }) })) }))] }));
101
104
  };
102
105
  export default Navbar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ml-ui-lib",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",