@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.d.mts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +420 -243
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +346 -243
- package/dist/index.mjs.map +1 -1
- package/package.json +52 -25
- package/dist/index.css +0 -2
- package/dist/index.css.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,244 +1,347 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
justify-content: center
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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
|