@mahatisystems/mahati-ui-components 1.2.0 → 1.3.0

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/index.mjs CHANGED
@@ -1,244 +1,347 @@
1
- import{useState as L}from"react";import{jsx as O,jsxs as j}from"react/jsx-runtime";var V=({text:t,position:o,children:e})=>{let[i,s]=L(!1);return j("div",{className:"tooltipContainer",onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[e,i&&O("div",{className:`tooltip ${i?"tooltipVisible":""}`,children:t})]})},U=V;import H,{css as x}from"styled-components";var C={primary:{color:"#1e73be",textColor:"#ffffff"},success:{color:"#28a97d",textColor:"#ffffff"},danger:{color:"#e53e3e",textColor:"#ffffff"}},K=H.button.attrs(t=>({type:t.type||"button"}))`
2
- padding: ${t=>t.size==="large"?"12px 20px":t.size==="small"?"6px 12px":"10px 16px"};
3
- margin-top: 10px;
4
- color: ${t=>t.textColor||"#ffffff"};
5
- border: none;
6
- border-radius: ${t=>typeof t.radius=="number"?`${t.radius}px`:t.radius||"6px"};
7
- cursor: pointer;
8
-
9
- display: inline-flex;
10
- align-items: center;
11
- justify-content: center;
12
- gap: 8px; /* 👈 space between icon & text */
13
-
14
- font-weight: 600;
15
- font-size: 14px;
16
-
17
- /* --- VARIANT STYLES --- */
18
- ${({variant:t,color:o,danger:e})=>{let i=e?"danger":t;return o?x`
19
- background-color: ${o};
20
- `:i&&C[i]?x`
21
- background-color: ${C[i].color};
22
- color: ${C[i].textColor};
23
- `:x`
24
- background-color: #55b382;
25
- `}}
26
-
27
- &:disabled {
28
- background-color: #ccc;
29
- cursor: not-allowed;
30
- }
31
-
32
- ${({isLoading:t})=>t&&x`
33
- pointer-events: none;
34
- opacity: 0.8;
35
- `}
36
- `,Y=K;import y from"styled-components";import{jsx as z,jsxs as G}from"react/jsx-runtime";var _=y.div`
37
- background: #fff;
38
- border-radius: 8px;
39
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
40
- margin-top: 20px;
41
- display: flex;
42
- flex-direction: column;
43
- `,q=y.div`
44
- padding: 16px 20px;
45
- border-bottom: 1px solid #e2e8f0;
46
- font-size: 1.25rem;
47
- font-weight: 600;
48
- `,X=y.div`
49
- padding: 20px;
50
- flex: 1; /* Allows the body to grow */
51
- `,W=y.div`
52
- padding: 16px 20px;
53
- border-top: 1px solid #e2e8f0;
54
- background: #f7fafc;
55
- `,Z=({header:t,footer:o,children:e})=>G(_,{children:[t&&z(q,{children:t}),z(X,{children:e}),o&&z(W,{children:o})]}),J=Z;import{useState as I}from"react";import v from"styled-components";import{jsx as S,jsxs as nt}from"react/jsx-runtime";var Q=v.div`
56
- position: relative;
57
- display: inline-block;
58
- width: 200px;
59
- margin: 10px 0;
60
- `,tt=v.button`
61
- width: 100%;
62
- padding: 10px;
63
- background-color: #007bff;
64
- color: white;
65
- border: none;
66
- border-radius: 4px;
67
- cursor: pointer;
68
- text-align: left;
69
-
70
- &:hover {
71
- background-color: #0056b3;
72
- }
73
- `,et=v.div`
74
- display: ${({open:t})=>t?"block":"none"};
75
- position: absolute;
76
- background-color: white;
77
- min-width: 100%;
78
- box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
79
- z-index: 1;
80
- border-radius: 4px;
81
- `,ot=v.div`
82
- padding: 10px;
83
- cursor: pointer;
84
- color: #333;
85
-
86
- &:hover {
87
- background-color: #f1f1f1;
88
- }
89
- `,rt=({options:t,onSelect:o})=>{let[e,i]=I(!1),[s,h]=I(null),f=u=>{h(u),o(u),i(!1)};return nt(Q,{children:[S(tt,{onClick:()=>i(!e),children:s||"Select an option"}),S(et,{open:e,children:t.map((u,b)=>S(ot,{onClick:()=>f(u),children:u},b))})]})},it=rt;import at from"styled-components";var st=at.form`
90
- display: flex;
91
- flex-direction: column;
92
- align-items: center;
93
- justify-content: center;
94
- height: 80vh; /* Take full screen height */
95
- width: 100%; /* Full width of the screen */
96
- max-width: 400px; /* Limit form width */
97
- margin: 0 auto; /* Center horizontally */
98
- padding: 80px;
99
- background-color: white;
100
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Optional: Add a shadow for design */
101
- border-radius: 8px;
102
- `,lt=st;import R from"styled-components";import{jsx as $,jsxs as bt}from"react/jsx-runtime";var dt=R.div`
103
- margin-bottom: 1rem;
104
- `,ct=R.input`
105
- width: 300px; /* Set a fixed width to prevent expansion */
106
- max-width: 100%; /* Optional: Ensure it doesn't exceed the container width */
107
- padding: 0.75rem;
108
- border: 1px solid black;
109
- border-radius: 4px;
110
- background-color: ${t=>t.hasError?"#fff5f5":"#fff"};
111
- font-size: 1rem;
112
- transition: all 0.2s ease-in-out;
113
-
114
- &:focus {
115
- outline: none;
116
- border-color: ${t=>t.hasError?"red":"#0070f3"};
117
- }
118
- `,pt=R.span`
119
- color: red;
120
- font-size: 0.875rem;
121
- height: 0.8rem; /* Fixed height for error text to avoid layout shift */
122
- display: block;
123
- `,ft=({type:t="text",name:o,placeholder:e,onChange:i,hasError:s=!1,errorMessage:h="",value:f})=>bt(dt,{children:[$(ct,{type:t,name:o,placeholder:e,value:f,onChange:i,hasError:s}),$(pt,{children:h})]}),ut=ft;import k from"styled-components";import{jsx as T,jsxs as vt}from"react/jsx-runtime";var mt=k.div`
124
- display: flex;
125
- flex-direction: column;
126
- gap: 0.75rem;
127
- padding: 1.5rem;
128
- background-color: #f4f6f8;
129
- margin: 0 auto;
130
- @media (max-width: 600px) {
131
- padding: 0rem;
132
- }
133
- `,ht=k.div`
134
- display: flex;
135
- align-items: center;
136
- justify-content: space-between;
137
- padding: 0.5rem 0;
138
- border-bottom: 1px solid #e0e0e0;
139
- transition: background-color 0.2s;
140
-
141
- &:last-child {
142
- border-bottom: none;
143
- }
144
-
145
- &:hover {
146
- background-color: #55b382;
147
- }
148
- `,gt=k.div`
149
- font-weight: 600;
150
- font-size: 0.95rem;
151
- color: #333;
152
- display: flex;
153
- align-items: center;
154
- width: 45%;
155
- @media (max-width: 600px) {
156
- font-size: 0.85rem;
157
- }
158
- `,wt=k.div`
159
- font-size: 1.2rem;
160
- color: #555;
161
- text-align: left;
162
- word-wrap: break-word;
163
- font-weight: ${t=>t.isBold?"bold":"normal"};
164
- @media (max-width: 600px) {
165
- font-size: 0.85rem;
166
- }
167
- `,xt=({data:t})=>T(mt,{children:Object.entries(t).map(([o,e])=>vt(ht,{children:[T(gt,{children:o}),T(wt,{isBold:o==="SegmentName",children:e||"N/A"})]},o))}),yt=xt;import kt from"styled-components";var Ct=kt.label`
168
- display: block;
169
- margin-bottom: 5px;
170
- font-weight: bold;
171
- `,zt=Ct;import St from"styled-components";var Rt=St.main`
172
- display: flex;
173
- flex-direction: column;
174
- align-items: center;
175
- justify-content: center;
176
- min-height: 100vh;
177
- padding: 20px;
178
- background-color: #f9f9f9;
179
- `,Tt=Rt;import P from"react";import l from"styled-components";import{Fragment as N,jsx as n,jsxs as p}from"react/jsx-runtime";var Pt=l.div`margin-top: 10px;`,Mt=l.table`width: 100%; border-collapse: collapse;`,F=l.th`padding: 12px; `,Et=l.tr`&:nth-child(even) { background-color: #f9f9f9; } &:hover { background-color: #f1f1f1; }`,B=l.td`padding: 10px; border-bottom: 1px solid #ccc;`,It=l.td`text-align: center; padding: 20px; color: #999;`,$t=l.div`margin-top: 15px; display: flex; flex-direction: column; align-items: center;`,Ft=l.div`display: flex; gap: 6px; align-items: center; flex-wrap: wrap;`,g=l.button`
180
- padding: 6px 12px;
181
- background: linear-gradient(to right, #1e73be, #28a97d);
182
- color: white;
183
- border: none;
184
- border-radius: 4px;
185
- cursor: pointer;
186
-
187
- &:disabled {
188
- background: #ccc;
189
- cursor: not-allowed;
190
- }
191
- `,Bt=l.select`
192
- margin-left: 10px;
193
- padding: 6px;
194
- border-radius: 4px;
195
- border: 1px solid #aaa;
196
- `,Nt=l.div`margin-top: 8px; font-size: 13px;`,At=({headers:t,data:o,page:e=0,setPage:i,limit:s=0,setLimit:h,totalCount:f=0,highlightRowColor:u,actions:b})=>{let d=Math.ceil(f/s)||0,A=()=>{let a=[];if(d<=1)return null;a.push(n(g,{onClick:()=>i?.(1),disabled:e===1,children:"1"},1)),e>3&&a.push(n("span",{children:"..."},"start-ellipsis"));for(let c=Math.max(2,e-1);c<=Math.min(d-1,e+1);c++)a.push(n(g,{onClick:()=>i?.(c),disabled:e===c,children:c},c));return e<d-1-1&&a.push(n("span",{children:"..."},"end-ellipsis")),d>1&&a.push(n(g,{onClick:()=>i?.(1),disabled:e===1,children:d+1},1)),a};return p(N,{children:[n(Pt,{children:p(Mt,{children:[n("thead",{children:p("tr",{style:{background:"linear-gradient(to right, #1e73be, #28a97d)"},children:[t.map((a,w)=>n(F,{children:a.label},w)),b&&n(F,{children:"Actions"})]})}),n("tbody",{children:o.length>0?o.map((a,w)=>p(Et,{className:u,children:[t.map((c,D)=>n(B,{children:(()=>{let r=a[c.key];if(P.isValidElement(r))return r;if(typeof r=="function")try{let m=r();if(P.isValidElement(m))return m}catch(m){console.warn("Error executing function in table cell:",m)}return typeof r=="string"&&r.trim().startsWith("<")&&r.trim().endsWith(">")?n("div",{dangerouslySetInnerHTML:{__html:r}}):Array.isArray(r)?r.some(m=>P.isValidElement(m))?n(N,{children:r}):r.join(", "):r instanceof Date?r.toLocaleString():typeof r=="boolean"?r?"Yes":"No":r==null?"-":typeof r=="number"?r.toString():typeof r=="object"?JSON.stringify(r):String(r)})()},D)),b&&n(B,{children:b(a)})]},w)):n("tr",{children:n(It,{colSpan:t.length+(b?1:0),children:"No data available"})})})]})}),(d>1||f<=s)&&p($t,{children:[p(Ft,{children:[n(g,{onClick:()=>i?.(e-1),disabled:e===1,children:"Previous"}),A(),n(g,{onClick:()=>i?.(e+1),disabled:e===d,children:"Next"}),n(Bt,{value:s,onChange:a=>{i?.(1),h?.(Number(a.target.value))},children:[5,10,15].map(a=>p("option",{value:a,children:[a," per page"]},a))})]}),p(Nt,{children:["Page ",e+1," of ",d+1," (Total: ",f," items)"]})]})]})},Dt=At;import E from"styled-components";import{jsx as M,jsxs as Ht}from"react/jsx-runtime";var Lt=E.div`
197
- display: flex;
198
- background: #135f9b;
199
- color: #fff;
200
- `,Vt=E.div`
201
- padding: 12px 20px;
202
- font-size: 16px;
203
- font-weight: 600;
204
- cursor: pointer;
205
- border-bottom: ${({$active:t})=>t?"6px solid red":"none"};
206
- color: ${({$active:t})=>t?"#dcffed":"#fff"};
207
- transition: color 0.3s, border-bottom 0.3s;
208
-
209
- &:hover {
210
- color: #dcffed;
211
- }
212
- `,Ut=E.div`
213
- padding: 20px;
214
- background: #f9f9f9;
215
- border-radius: 10px;
216
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
217
- max-width: 1300px;
218
- `,Ot=({tabs:t,activeTabId:o,onTabClick:e,content:i})=>Ht("div",{children:[M(Lt,{children:t.map(s=>M(Vt,{$active:s.id===o,onClick:()=>e(s.id),children:s.label},s.id))}),M(Ut,{children:i})]}),jt=Ot;import Kt from"styled-components";var Yt=Kt.div`
219
- border: 4px solid rgba(0, 123, 255, 0.2);
220
- border-radius: 10%;
221
- border-top: 4px solid #007bff;
222
- width: 24px;
223
- height: 24px;
224
- animation: spin 1s linear infinite;
225
-
226
- @keyframes spin {
227
- 0% {
228
- transform: rotate(0deg);
229
- }
230
- 100% {
231
- transform: rotate(360deg);
232
- }
233
- }
234
- `,_t=Yt;import qt from"styled-components";var Xt=qt.section`
235
- text-align: center;
236
- `,Wt=Xt;import Zt from"styled-components";var Jt=Zt.div`
237
- display: flex;
238
- justify-content: space-around;
239
- margin-top: 20px;
240
- `,Gt=Jt;import Qt from"styled-components";var te=Qt.p`
241
- font-size: 20px;
242
- margin: 0;
243
- `,ee=te;var oe=t=>t?"":"This field is required.",re=t=>o=>o.length<=t?"":`This field must be at most ${t} characters.`,ie=t=>o=>o.length>=t?"":`This field must be at least ${t} characters.`,ne=t=>/^[a-zA-Z0-9_]+$/.test(t)?"":"Username can only contain alphanumeric characters and underscores.",ae=t=>/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$/.test(t)?"":"Password must be 6-20 characters long, include uppercase, lowercase, and a number.";export{Y as MahatiButton,J as MahatiCard,it as MahatiDropdown,lt as MahatiFormContainer,ut as MahatiInput,yt as MahatiKeyValueDisplay,zt as MahatiLabel,Tt as MahatiMain,ee as MahatiParagraph,Gt as MahatiRow,Wt as MahatiSection,_t as MahatiSpinner,jt as MahatiTabbedInterface,Dt as MahatiTable,U as MahatiTooltip,ae as isValidPassword,ne as isValidUsername,re as maxLength,ie as minLength,oe as required};
1
+ // src/components/Button.tsx
2
+ function _define_property(obj, key, value) {
3
+ if (key in obj) {
4
+ Object.defineProperty(obj, key, {
5
+ value: value,
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true
9
+ });
10
+ } else {
11
+ obj[key] = value;
12
+ }
13
+ return obj;
14
+ }
15
+ function _object_spread(target) {
16
+ for(var i = 1; i < arguments.length; i++){
17
+ var source = arguments[i] != null ? arguments[i] : {};
18
+ var ownKeys = Object.keys(source);
19
+ if (typeof Object.getOwnPropertySymbols === "function") {
20
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
21
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
22
+ }));
23
+ }
24
+ ownKeys.forEach(function(key) {
25
+ _define_property(target, key, source[key]);
26
+ });
27
+ }
28
+ return target;
29
+ }
30
+ function ownKeys(object, enumerableOnly) {
31
+ var keys = Object.keys(object);
32
+ if (Object.getOwnPropertySymbols) {
33
+ var symbols = Object.getOwnPropertySymbols(object);
34
+ if (enumerableOnly) {
35
+ symbols = symbols.filter(function(sym) {
36
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
37
+ });
38
+ }
39
+ keys.push.apply(keys, symbols);
40
+ }
41
+ return keys;
42
+ }
43
+ function _object_spread_props(target, source) {
44
+ source = source != null ? source : {};
45
+ if (Object.getOwnPropertyDescriptors) {
46
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
47
+ } else {
48
+ ownKeys(Object(source)).forEach(function(key) {
49
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
50
+ });
51
+ }
52
+ return target;
53
+ }
54
+ function _object_without_properties(source, excluded) {
55
+ if (source == null) return {};
56
+ var target = _object_without_properties_loose(source, excluded);
57
+ var key, i;
58
+ if (Object.getOwnPropertySymbols) {
59
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
60
+ for(i = 0; i < sourceSymbolKeys.length; i++){
61
+ key = sourceSymbolKeys[i];
62
+ if (excluded.indexOf(key) >= 0) continue;
63
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
64
+ target[key] = source[key];
65
+ }
66
+ }
67
+ return target;
68
+ }
69
+ function _object_without_properties_loose(source, excluded) {
70
+ if (source == null) return {};
71
+ var target = {};
72
+ var sourceKeys = Object.keys(source);
73
+ var key, i;
74
+ for(i = 0; i < sourceKeys.length; i++){
75
+ key = sourceKeys[i];
76
+ if (excluded.indexOf(key) >= 0) continue;
77
+ target[key] = source[key];
78
+ }
79
+ return target;
80
+ }
81
+ function _tagged_template_literal(strings, raw) {
82
+ if (!raw) {
83
+ raw = strings.slice(0);
84
+ }
85
+ return Object.freeze(Object.defineProperties(strings, {
86
+ raw: {
87
+ value: Object.freeze(raw)
88
+ }
89
+ }));
90
+ }
91
+ function _templateObject() {
92
+ var data = _tagged_template_literal([
93
+ "\n /* Base Styles */\n display: inline-flex;\n align-items: center;\n justify-content: center;\n white-space: nowrap;\n font-size: 14px;\n font-weight: 500;\n transition: all 200ms ease-in-out;\n cursor: pointer;\n border: none;\n outline: none;\n font-family: inherit;\n position: relative;\n \n /* Focus Styles */\n &:focus-visible {\n outline: 2px solid rgba(59, 130, 246, 0.5);\n outline-offset: 2px;\n }\n \n /* Disabled State */\n &:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n ",
94
+ "\n\n ",
95
+ "\n\n ",
96
+ "\n\n ",
97
+ "\n"
98
+ ]);
99
+ _templateObject = function _templateObject() {
100
+ return data;
101
+ };
102
+ return data;
103
+ }
104
+ function _templateObject1() {
105
+ var data = _tagged_template_literal([
106
+ "\n display: inline-flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: all 200ms ease-in-out;\n \n /* Name-based background for icon buttons */\n ",
107
+ ";\n \n /* Parse border radius from Tailwind classes */\n border-radius: ",
108
+ ";\n \n /* Parse padding from Tailwind classes */\n padding: ",
109
+ ";\n \n /* Parse background color from Tailwind classes (after name) */\n background: ",
110
+ ";\n \n width: 100%;\n height: 100%;\n \n /* Icon sizing */\n svg {\n width: 16px;\n height: 16px;\n flex-shrink: 0;\n }\n \n /* Hover and Active States */\n ",
111
+ "\n"
112
+ ]);
113
+ _templateObject1 = function _templateObject() {
114
+ return data;
115
+ };
116
+ return data;
117
+ }
118
+ function _templateObject2() {
119
+ var data = _tagged_template_literal([
120
+ "\n display: inline-flex;\n flex-direction: ",
121
+ ";\n align-items: ",
122
+ ";\n gap: ",
123
+ ";\n"
124
+ ]);
125
+ _templateObject2 = function _templateObject() {
126
+ return data;
127
+ };
128
+ return data;
129
+ }
130
+ import React from "react";
131
+ import styled from "@emotion/styled";
132
+ import { jsx } from "@emotion/react/jsx-runtime";
133
+ var parseHeightWidth = function(className) {
134
+ if (!className) return "36px";
135
+ var match = className.match(/[hw]-(\d+)/);
136
+ if (match) {
137
+ return "".concat(parseInt(match[1]) * 4, "px");
138
+ }
139
+ return "36px";
140
+ };
141
+ var parseGap = function(gapClass) {
142
+ if (!gapClass) return "8px";
143
+ var match = gapClass.match(/gap-(\d+)/);
144
+ if (match) {
145
+ return "".concat(parseInt(match[1]) * 4, "px");
146
+ }
147
+ return "8px";
148
+ };
149
+ var getColorByName = function(name) {
150
+ var colors = {
151
+ blue: "#3b82f6",
152
+ green: "#10b981",
153
+ red: "#ef4444",
154
+ orange: "#f59e0b",
155
+ purple: "#8b5cf6",
156
+ yellow: "#f59e0b",
157
+ pink: "#ec4899",
158
+ teal: "#14b8a6",
159
+ indigo: "#6366f1",
160
+ primary: "linear-gradient(to right, rgba(23, 97, 163, 1), rgba(77, 175, 131, 1))",
161
+ secondary: "#6b7280",
162
+ success: "#10b981",
163
+ danger: "#ef4444",
164
+ warning: "#f59e0b",
165
+ info: "#3b82f6"
166
+ };
167
+ return colors[name === null || name === void 0 ? void 0 : name.toLowerCase()] || colors.primary || "#3b82f6";
168
+ };
169
+ var StyledButton = styled.button(_templateObject(), function(props) {
170
+ var color = getColorByName(props.$name);
171
+ if (color) {
172
+ if (props.$iconButton) {
173
+ return "\n color: ".concat(color.startsWith("linear") || color.startsWith("rgba") ? "white" : color, ";\n ");
174
+ } else {
175
+ return "\n background: ".concat(color, ";\n color: white;\n border-radius: 6px;\n &:hover { opacity: 0.9; }\n &:active { opacity: 0.95; }\n ");
176
+ }
177
+ }
178
+ return "";
179
+ }, function(props) {
180
+ return props.$iconButton && "\n background: transparent !important;\n padding: 0;\n color: rgba(255, 255, 255, 0.9);\n height: ".concat(props.$height || "36px", ";\n width: ").concat(props.$width || "36px", ";\n min-height: ").concat(props.$height || "36px", ";\n min-width: ").concat(props.$width || "36px", ";\n border-radius: 6px;\n \n &:hover {\n background: transparent !important;\n color: rgba(255, 255, 255, 1);\n }\n \n &:active {\n background: transparent !important;\n }\n \n &:focus-visible {\n outline: 2px solid rgba(255, 255, 255, 0.7);\n outline-offset: 2px;\n }\n ");
181
+ }, function(props) {
182
+ if (props.$iconButton || props.$name) return "";
183
+ switch(props.$variant){
184
+ case "default":
185
+ return "\n background: linear-gradient(to right, rgba(23, 97, 163, 1), rgba(77, 175, 131, 1));\n color: white;\n border-radius: 6px;\n &:hover { opacity: 0.9; }\n &:active { opacity: 0.95; }\n ";
186
+ case "destructive":
187
+ return "\n background: #ef4444;\n color: white;\n border-radius: 6px;\n &:hover { background: #dc2626; }\n &:active { background: #b91c1c; }\n ";
188
+ case "outline":
189
+ return "\n border: 1px solid #e5e7eb;\n background: white;\n color: #374151;\n border-radius: 6px;\n &:hover { \n background: #f9fafb;\n border-color: #d1d5db;\n }\n &:active { background: #f3f4f6; }\n ";
190
+ case "secondary":
191
+ return "\n background: ".concat(getColorByName("blue"), ";\n color: #374151;\n border-radius: 6px;\n &:hover { background: #e5e7eb; }\n &:active { background: #d1d5db; }\n ");
192
+ case "ghost":
193
+ return "\n background: transparent;\n color: #374151;\n border-radius: 6px;\n &:hover { background: #f3f4f6; }\n &:active { background: #e5e7eb; }\n ";
194
+ case "link":
195
+ return "\n background: transparent;\n color: #2563eb;\n text-decoration: underline;\n text-underline-offset: 4px;\n padding: 0;\n height: auto;\n &:hover { \n text-decoration: none;\n color: #1d4ed8;\n }\n &:active { color: #1e40af; }\n ";
196
+ case "danger":
197
+ return "\n background: transparent;\n color: #ef4444;\n border-radius: 6px;\n &:hover {\n background: rgba(239, 68, 68, 0.1);\n }\n &:active {\n background: rgba(239, 68, 68, 0.2);\n }\n ";
198
+ case "dotted":
199
+ return "\n background: linear-gradient(to right, #1e73be, #28a97d);\n color: white;\n border-radius: 8px;\n position: relative;\n overflow: visible;\n \n &::before {\n content: '';\n position: absolute;\n inset: -2px;\n border-radius: 10px;\n padding: 2px;\n background: linear-gradient(to right, #1e73be, #28a97d);\n -webkit-mask: \n linear-gradient(#fff 0 0) content-box, \n linear-gradient(#fff 0 0);\n -webkit-mask-composite: xor;\n mask-composite: exclude;\n border: 2px dashed rgba(255, 255, 255, 0.5);\n }\n \n &:hover { opacity: 0.9; }\n &:active { opacity: 0.95; }\n ";
200
+ case "pill":
201
+ return "\n background: linear-gradient(to right, rgba(23, 97, 163, 1), rgba(77, 175, 131, 1));\n color: white;\n border-radius: 9999px;\n &:hover { opacity: 0.9; }\n &:active { opacity: 0.95; }\n ";
202
+ default:
203
+ return "\n background: linear-gradient(to right, rgba(23, 97, 163, 1), rgba(77, 175, 131, 1));\n color: white;\n border-radius: 6px;\n &:hover { opacity: 0.9; }\n ";
204
+ }
205
+ }, function(props) {
206
+ if (props.$iconButton) return "";
207
+ switch(props.$size){
208
+ case "sm":
209
+ return "height: 36px; padding: 0 12px; font-size: 13px;";
210
+ case "md":
211
+ return "height: 40px; padding: 0 16px; font-size: 14px;";
212
+ case "lg":
213
+ return "height: 44px; padding: 0 24px; font-size: 15px;";
214
+ case "icon":
215
+ return "height: 40px; width: 40px; padding: 0;";
216
+ default:
217
+ return "height: 40px; padding: 0 16px;";
218
+ }
219
+ });
220
+ var IconButtonInner = styled.span(_templateObject1(), function(props) {
221
+ var color = getColorByName(props.$name);
222
+ if (color) {
223
+ return "\n background: ".concat(color.startsWith("linear") ? color : "rgba(".concat(color.slice(1), ", 0.12)"), ";\n ");
224
+ }
225
+ return "";
226
+ }, function(props) {
227
+ if (!props.$radiusClass) return "6px";
228
+ var match = props.$radiusClass.match(/rounded-\[(\d+)px\]/);
229
+ if (match) return "".concat(match[1], "px");
230
+ if (props.$radiusClass === "rounded-md") return "6px";
231
+ if (props.$radiusClass === "rounded-lg") return "8px";
232
+ if (props.$radiusClass === "rounded-full") return "9999px";
233
+ return "6px";
234
+ }, function(props) {
235
+ if (!props.$paddingClass) return "2px";
236
+ var match = props.$paddingClass.match(/p-\[(\d+)px\]/);
237
+ if (match) return "".concat(match[1], "px");
238
+ return "2px";
239
+ }, function(props) {
240
+ if (props.$name) return "initial";
241
+ if (!props.$bgClass) return "rgba(255, 255, 255, 0.12)";
242
+ var rgbaMatch = props.$bgClass.match(/bg-\[(rgba?\([^)]+\))\]/);
243
+ if (rgbaMatch) return rgbaMatch[1];
244
+ return "rgba(255, 255, 255, 0.12)";
245
+ }, function(props) {
246
+ if (props.$hoverBgClass) {
247
+ var hoverMatch = props.$hoverBgClass.match(/hover:bg-\[(rgba?\([^)]+\))\]/);
248
+ var activeMatch = props.$hoverBgClass.match(/active:bg-\[(rgba?\([^)]+\))\]/);
249
+ var styles = "";
250
+ if (hoverMatch) {
251
+ styles += "button:hover & { background: ".concat(hoverMatch[1], "; }");
252
+ }
253
+ if (activeMatch) {
254
+ styles += "button:active & { background: ".concat(activeMatch[1], "; }");
255
+ }
256
+ return styles;
257
+ }
258
+ if (props.$intensity != null) {
259
+ var v = Math.max(0, Math.min(100, props.$intensity));
260
+ if (v === 0) return "";
261
+ if (v <= 10) return "button:hover & { opacity: 0.95; } button:active & { opacity: 0.90; }";
262
+ if (v <= 25) return "button:hover & { opacity: 0.90; } button:active & { opacity: 0.80; }";
263
+ if (v <= 40) return "button:hover & { opacity: 0.85; } button:active & { opacity: 0.75; }";
264
+ if (v <= 55) return "button:hover & { opacity: 0.80; } button:active & { opacity: 0.70; }";
265
+ if (v <= 70) return "button:hover & { opacity: 0.75; } button:active & { opacity: 0.65; }";
266
+ if (v <= 85) return "button:hover & { opacity: 0.70; } button:active & { opacity: 0.60; }";
267
+ return "button:hover & { opacity: 0.60; } button:active & { opacity: 0.50; }";
268
+ }
269
+ return "\n button:hover & { opacity: 0.85; }\n button:active & { opacity: 0.7; }\n ";
270
+ });
271
+ var IconButtonGroupWrapper = styled.div(_templateObject2(), function(props) {
272
+ return props.$direction === "col" ? "column" : "row";
273
+ }, function(props) {
274
+ return props.$direction === "col" ? "flex-start" : "center";
275
+ }, function(props) {
276
+ return props.$gap || "8px";
277
+ });
278
+ var IconButtonGroup = React.forwardRef(function(_param, ref) {
279
+ var className = _param.className, _param_direction = _param.direction, direction = _param_direction === void 0 ? "row" : _param_direction, gapClass = _param.gapClass, props = _object_without_properties(_param, [
280
+ "className",
281
+ "direction",
282
+ "gapClass"
283
+ ]);
284
+ var gap = parseGap(gapClass);
285
+ return /* @__PURE__ */ jsx(IconButtonGroupWrapper, _object_spread({
286
+ ref: ref,
287
+ $direction: direction,
288
+ $gap: gap,
289
+ className: className
290
+ }, props));
291
+ });
292
+ IconButtonGroup.displayName = "IconButtonGroup";
293
+ var ButtonBase = React.forwardRef(function(_param, ref) {
294
+ var className = _param.className, _param_variant = _param.variant, variant = _param_variant === void 0 ? "default" : _param_variant, _param_size = _param.size, size = _param_size === void 0 ? "default" : _param_size, name = _param.name, _param_iconButton = _param.iconButton, iconButton = _param_iconButton === void 0 ? false : _param_iconButton, iconButtonHeightClass = _param.iconButtonHeightClass, iconButtonWidthClass = _param.iconButtonWidthClass, iconButtonBgClass = _param.iconButtonBgClass, iconButtonRadiusClass = _param.iconButtonRadiusClass, iconButtonBgPaddingClass = _param.iconButtonBgPaddingClass, iconButtonHoverBgClass = _param.iconButtonHoverBgClass, iconButtonHoverIntensity = _param.iconButtonHoverIntensity, children = _param.children, props = _object_without_properties(_param, [
295
+ "className",
296
+ "variant",
297
+ "size",
298
+ "name",
299
+ "iconButton",
300
+ "iconButtonHeightClass",
301
+ "iconButtonWidthClass",
302
+ "iconButtonBgClass",
303
+ "iconButtonRadiusClass",
304
+ "iconButtonBgPaddingClass",
305
+ "iconButtonHoverBgClass",
306
+ "iconButtonHoverIntensity",
307
+ "children"
308
+ ]);
309
+ if (iconButton) {
310
+ var height = parseHeightWidth(iconButtonHeightClass);
311
+ var width = parseHeightWidth(iconButtonWidthClass);
312
+ return /* @__PURE__ */ jsx(StyledButton, _object_spread_props(_object_spread({
313
+ $variant: variant,
314
+ $size: size,
315
+ $iconButton: true,
316
+ $height: height,
317
+ $width: width,
318
+ $name: name,
319
+ className: className,
320
+ ref: ref
321
+ }, props), {
322
+ children: /* @__PURE__ */ jsx(IconButtonInner, {
323
+ $bgClass: iconButtonBgClass,
324
+ $radiusClass: iconButtonRadiusClass,
325
+ $paddingClass: iconButtonBgPaddingClass,
326
+ $hoverBgClass: iconButtonHoverBgClass,
327
+ $intensity: iconButtonHoverIntensity,
328
+ $name: name,
329
+ children: children
330
+ })
331
+ }));
332
+ }
333
+ return /* @__PURE__ */ jsx(StyledButton, _object_spread_props(_object_spread({
334
+ $variant: variant,
335
+ $size: size,
336
+ $name: name,
337
+ className: className,
338
+ ref: ref
339
+ }, props), {
340
+ children: children
341
+ }));
342
+ });
343
+ ButtonBase.displayName = "Button";
344
+ var Button = ButtonBase;
345
+ Button.IconButtonGroup = IconButtonGroup;
346
+ export { Button as MahatiButton };
244
347
  //# sourceMappingURL=index.mjs.map