ml-ui-lib 1.0.12 → 1.0.14

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.
@@ -16,12 +16,14 @@ export const Accordion = ({ items }) => {
16
16
  }
17
17
  });
18
18
  }, [openIndexes]);
19
- return (_jsx("div", { className: "accordion", children: items.map((group, groupIndex) => (_jsxs("div", { className: "accordion-group", children: [group.title && _jsx("h3", { className: "accordion-group-title", children: group.title }), group.items.map((item, itemIndex) => {
19
+ return (_jsx("div", { className: "accordion", children: items.map((group, groupIndex) => (_jsxs("div", { className: "accordion-group", children: [group.title && (_jsx("h3", { className: "accordion-group-title", children: group.title })), group.items.map((item, itemIndex) => {
20
20
  const index = groupIndex * 1000 + itemIndex;
21
21
  const isOpen = openIndexes.includes(index);
22
- return (_jsxs("div", { className: `accordion-item ${isOpen ? "open" : ""}`, children: [_jsxs("button", { className: "accordion-header", onClick: () => toggleItem(index), children: [_jsx("span", { className: "accordion-title", children: item.title }), _jsx("span", { className: `accordion-icon ${isOpen ? "open" : ""}`, children: "\u25BC" })] }), _jsx("div", { ref: (el) => (contentRefs.current[index] = el), className: "accordion-content-wrapper", style: {
22
+ return (_jsxs("div", { className: `accordion-item ${isOpen ? "open" : ""}`, children: [_jsxs("button", { className: "accordion-header", onClick: () => toggleItem(index), children: [_jsx("span", { className: "accordion-title", children: item.title }), _jsx("span", { className: `accordion-icon ${isOpen ? "open" : ""}`, children: "\u25BC" })] }), _jsx("div", { ref: (el) => {
23
+ contentRefs.current[index] = el;
24
+ }, className: "accordion-content-wrapper", style: {
23
25
  maxHeight: isOpen
24
- ? `${contentRefs.current[index]?.scrollHeight}px`
26
+ ? `${contentRefs.current[index]?.scrollHeight || 0}px`
25
27
  : "0px",
26
28
  }, children: _jsx("div", { className: "accordion-content", children: item.content }) })] }, index));
27
29
  })] }, groupIndex))) }));
@@ -136,19 +136,29 @@
136
136
  }
137
137
 
138
138
  @media (max-width: 576px) {
139
- .carousel-image {
140
- display: none;
139
+ .carousel-track {
140
+ position: relative;
141
141
  }
142
142
 
143
143
  .carousel-slide {
144
+ opacity: 0;
145
+ position: absolute;
146
+ top: 0;
147
+ left: 0;
148
+ transition: none !important; /* ⬅ stop transitions */
144
149
  padding: 2rem 1rem;
145
150
  }
146
151
 
147
- .carousel-track > *:not(:first-child) {
148
- display: block !important;
152
+ .carousel-slide:first-child {
153
+ opacity: 1; /* ⬅ show only first item */
154
+ position: relative;
149
155
  }
150
156
 
151
157
  .carousel-control {
152
- visibility: hidden;
158
+ display: none !important; /* ⬅ hide arrows */
159
+ }
160
+
161
+ .carousel-image {
162
+ display: none;
153
163
  }
154
164
  }
@@ -9,6 +9,9 @@ export const Carousel = ({ items, autoSlide = true, interval = 5000, color }) =>
9
9
  useEffect(() => {
10
10
  if (!autoSlide)
11
11
  return;
12
+ // ⬇️ Disable auto-slide for mobile (<=576px)
13
+ if (window.innerWidth <= 576)
14
+ return;
12
15
  const timer = setInterval(() => {
13
16
  setCurrent((prev) => (prev + 1) % items.length);
14
17
  }, interval);
@@ -34,3 +34,39 @@
34
34
  color: #ff4d4f;
35
35
  font-size: 12px;
36
36
  }
37
+
38
+ .input-container {
39
+ position: relative;
40
+ width: 100%;
41
+ }
42
+
43
+ .has-search-icon .search-icon {
44
+ position: absolute;
45
+ left: 12px;
46
+ top: 50%;
47
+ transform: translateY(-50%);
48
+ width: 14px;
49
+ height: 14px;
50
+ border: 2px solid #888;
51
+ border-radius: 50%;
52
+ }
53
+
54
+ .has-search-icon .search-icon::after {
55
+ content: "";
56
+ position: absolute;
57
+ right: -4px;
58
+ bottom: -2px;
59
+ width: 7px;
60
+ height: 2px;
61
+ background: #888;
62
+ transform: rotate(45deg);
63
+ border-radius: 1px;
64
+ }
65
+
66
+ .input-with-icon {
67
+ padding-left: 36px; /* space for search icon */
68
+ }
69
+
70
+ input {
71
+ width: 100%;
72
+ }
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "./Input.css";
3
- export const Input = ({ label, error, ...props }) => {
4
- return (_jsxs("div", { className: "input-wrapper", children: [label && _jsx("label", { className: "input-label", children: label }), _jsx("input", { className: `input ${error ? "input-error" : ""}`, ...props, autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false }), error && _jsx("span", { className: "input-error-text", children: error })] }));
3
+ export const Input = ({ label, error, type, ...props }) => {
4
+ const isSearch = type === "search";
5
+ return (_jsxs("div", { className: "input-wrapper", children: [label && _jsx("label", { className: "input-label", children: label }), _jsxs("div", { className: `input-container ${isSearch ? "has-search-icon" : ""}`, children: [isSearch && _jsx("span", { className: "search-icon" }), _jsx("input", { type: type, className: `input ${error ? "input-error" : ""} ${isSearch ? "input-with-icon" : ""}`, ...props, autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false })] }), error && _jsx("span", { className: "input-error-text", children: error })] }));
5
6
  };
@@ -90,6 +90,13 @@
90
90
 
91
91
  }
92
92
 
93
+ @media (max-width: 500px) {
94
+ .navbar-container {
95
+ margin: 0!important;
96
+ }
97
+
98
+ }
99
+
93
100
  /* Responsive Menu */
94
101
  @media (max-width: 992px) {
95
102
  .burger {
@@ -21,6 +21,7 @@
21
21
  /* gap: 1rem; */
22
22
  position: relative;
23
23
  left: 55px;
24
+ z-index: 1;
24
25
  }
25
26
 
26
27
  /* Text */
@@ -0,0 +1,30 @@
1
+ .text-area {
2
+ width: 100%;
3
+ min-height: 4.5em; /* roughly 3 rows */
4
+ padding: 0.6rem 0.8rem;
5
+ border-radius: 8px;
6
+ border: 1px solid #d1d5db;
7
+ font-family: inherit;
8
+ font-size: 0.95rem;
9
+ line-height: 1.4;
10
+ color: #111827;
11
+ resize: vertical;
12
+ background-color: #fff;
13
+ transition: border-color 0.2s ease, box-shadow 0.2s ease;
14
+ }
15
+
16
+ .text-area::placeholder {
17
+ color: #9ca3af;
18
+ }
19
+
20
+ .text-area:focus {
21
+ outline: none;
22
+ border-color: #2563eb;
23
+ box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
24
+ }
25
+
26
+ .text-area[readonly] {
27
+ background-color: #f9fafb;
28
+ color: #6b7280;
29
+ cursor: not-allowed;
30
+ }
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import "./TextArea.css";
3
+ export interface TextAreaProps {
4
+ placeholder?: string;
5
+ rows?: number;
6
+ value?: string;
7
+ data?: any;
8
+ readOnly?: boolean;
9
+ className?: string;
10
+ style?: React.CSSProperties;
11
+ onChange?: (value: string) => void;
12
+ id?: string;
13
+ name?: string;
14
+ ariaLabel?: string;
15
+ }
16
+ export declare const TextArea: React.FC<TextAreaProps>;
17
+ export default TextArea;
@@ -0,0 +1,35 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useEffect, useState } from "react";
4
+ import "./TextArea.css";
5
+ export const TextArea = ({ placeholder, rows = 3, value, data, readOnly = false, className = "", style, onChange, id, name, ariaLabel, }) => {
6
+ const effectiveRows = Math.max(3, Math.floor(rows));
7
+ const [internalValue, setInternalValue] = useState(() => {
8
+ if (typeof value === "string")
9
+ return value;
10
+ if (data !== undefined) {
11
+ return typeof data === "string" ? data : JSON.stringify(data, null, 2);
12
+ }
13
+ return "";
14
+ });
15
+ useEffect(() => {
16
+ if (typeof value === "string") {
17
+ setInternalValue(value);
18
+ }
19
+ else if (data !== undefined && value === undefined) {
20
+ setInternalValue(typeof data === "string" ? data : JSON.stringify(data, null, 2));
21
+ }
22
+ }, [value, data]);
23
+ const handleChange = (e) => {
24
+ const v = e.target.value;
25
+ if (value !== undefined) {
26
+ onChange?.(v);
27
+ }
28
+ else {
29
+ setInternalValue(v);
30
+ onChange?.(v);
31
+ }
32
+ };
33
+ return (_jsx("textarea", { id: id, name: name, "aria-label": ariaLabel ?? placeholder ?? "text-area", placeholder: placeholder, rows: effectiveRows, className: `text-area ${className}`, style: style, readOnly: readOnly, value: internalValue, onChange: handleChange }));
34
+ };
35
+ export default TextArea;
package/dist/index.d.ts CHANGED
@@ -35,3 +35,5 @@ export { PageBanner } from "./components/PageBanner/PageBanner";
35
35
  export type { PageBannerProps } from "./components/PageBanner/PageBanner";
36
36
  export { Carousel } from "./components/Carousel/Carousel";
37
37
  export type { CarouselProps } from "./components/Carousel/Carousel";
38
+ export { TextArea } from "./components/TextArea/TextArea";
39
+ export type { TextAreaProps } from "./components/TextArea/TextArea";
package/dist/index.js CHANGED
@@ -17,3 +17,4 @@ export { Navbar } from "./components/Navbar/Navbar";
17
17
  export { Footer } from "./components/Footer/Footer";
18
18
  export { PageBanner } from "./components/PageBanner/PageBanner";
19
19
  export { Carousel } from "./components/Carousel/Carousel";
20
+ export { TextArea } from "./components/TextArea/TextArea";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ml-ui-lib",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",