moldekit-react 0.0.5 → 0.0.7
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/README.md +9 -13
- package/dist/components/MkAlert/MkAlert.d.ts +3 -0
- package/dist/components/MkAlert/MkAlert.props.d.ts +6 -0
- package/dist/components/MkAlert/index.d.ts +2 -0
- package/dist/components/MkBarChart/MkBarChart.d.ts +3 -0
- package/dist/components/MkBarChart/MkBarChart.props.d.ts +8 -0
- package/dist/components/MkBarChart/index.d.ts +2 -0
- package/dist/components/MkBarHistoryChart/MkBarHistoryChart.d.ts +3 -0
- package/dist/components/MkBarHistoryChart/MkBarHistoryChart.props.d.ts +8 -0
- package/dist/components/MkBarHistoryChart/index.d.ts +2 -0
- package/dist/components/MkBottomSheet/MkBottomSheet.d.ts +3 -0
- package/dist/components/MkBottomSheet/MkBottomSheet.props.d.ts +7 -0
- package/dist/components/MkBottomSheet/index.d.ts +2 -0
- package/dist/components/MkButton/MkButton.d.ts +1 -1
- package/dist/components/MkButton/MkButton.props.d.ts +6 -4
- package/dist/components/MkCard/MkCard.d.ts +3 -0
- package/dist/components/MkCard/MkCard.props.d.ts +5 -0
- package/dist/components/MkCard/index.d.ts +2 -0
- package/dist/components/MkCheckbox/MkCheckbox.d.ts +3 -0
- package/dist/components/MkCheckbox/MkCheckbox.props.d.ts +5 -0
- package/dist/components/MkCheckbox/index.d.ts +2 -0
- package/dist/components/MkComboBox/MkComboBox.d.ts +3 -0
- package/dist/components/MkComboBox/MkComboBox.props.d.ts +9 -0
- package/dist/components/MkComboBox/index.d.ts +2 -0
- package/dist/components/MkDateInput/MkDateInput.d.ts +3 -0
- package/dist/components/MkDateInput/MkDateInput.props.d.ts +6 -0
- package/dist/components/MkDateInput/index.d.ts +2 -0
- package/dist/components/MkDetailedList/MkDetailedList.d.ts +3 -0
- package/dist/components/MkDetailedList/MkDetailedList.props.d.ts +5 -0
- package/dist/components/MkDetailedList/MkDetailedListItem/MkDetailedListItem.d.ts +3 -0
- package/dist/components/MkDetailedList/MkDetailedListItem/MkDetailedListItem.props.d.ts +10 -0
- package/dist/components/MkDetailedList/index.d.ts +2 -0
- package/dist/components/MkDivider/MkDivider.d.ts +3 -0
- package/dist/components/MkDivider/MkDivider.props.d.ts +4 -0
- package/dist/components/MkDivider/index.d.ts +2 -0
- package/dist/components/MkDonutChart/MkDonutChart.d.ts +3 -0
- package/dist/components/MkDonutChart/MkDonutChart.props.d.ts +11 -0
- package/dist/components/MkDonutChart/index.d.ts +2 -0
- package/dist/components/MkHeader/MkHeader.d.ts +3 -0
- package/dist/components/MkHeader/MkHeader.props.d.ts +6 -0
- package/dist/components/MkHeader/index.d.ts +2 -0
- package/dist/components/MkHorizontalBarChart/MkHorizontalBarChart.d.ts +3 -0
- package/dist/components/MkHorizontalBarChart/MkHorizontalBarChart.props.d.ts +3 -0
- package/dist/components/MkHorizontalBarChart/index.d.ts +2 -0
- package/dist/components/MkIconBadge/MkIconBadge.d.ts +3 -0
- package/dist/components/MkIconBadge/MkIconBadge.props.d.ts +5 -0
- package/dist/components/MkIconBadge/index.d.ts +2 -0
- package/dist/components/MkLineChart/MkLineChart.d.ts +3 -0
- package/dist/components/MkLineChart/MkLineChart.props.d.ts +3 -0
- package/dist/components/MkLineChart/index.d.ts +2 -0
- package/dist/components/MkList/MkList.d.ts +3 -0
- package/dist/components/MkList/MkList.props.d.ts +5 -0
- package/dist/components/MkList/MkListItem/MkListItem.d.ts +3 -0
- package/dist/components/MkList/MkListItem/MkListItem.props.d.ts +8 -0
- package/dist/components/MkList/index.d.ts +2 -0
- package/dist/components/MkMain/MkMain.d.ts +3 -0
- package/dist/components/MkMain/MkMain.props.d.ts +4 -0
- package/dist/components/MkMain/index.d.ts +2 -0
- package/dist/components/MkModal/MkModal.d.ts +3 -0
- package/dist/components/MkModal/MkModal.props.d.ts +6 -0
- package/dist/components/MkModal/index.d.ts +2 -0
- package/dist/components/MkNavItem/MkNavItem.d.ts +3 -0
- package/dist/components/MkNavItem/MkNavItem.props.d.ts +10 -0
- package/dist/components/MkNavItem/index.d.ts +2 -0
- package/dist/components/MkNavList/MkNavList.d.ts +3 -0
- package/dist/components/MkNavList/MkNavList.props.d.ts +6 -0
- package/dist/components/MkNavList/index.d.ts +2 -0
- package/dist/components/MkNumberInput/MkNumberInput.d.ts +3 -0
- package/dist/components/MkNumberInput/MkNumberInput.props.d.ts +6 -0
- package/dist/components/MkNumberInput/index.d.ts +2 -0
- package/dist/components/MkPanel/MkPanel.d.ts +3 -0
- package/dist/components/MkPanel/MkPanel.props.d.ts +4 -0
- package/dist/components/MkPanel/index.d.ts +2 -0
- package/dist/components/MkProgressBar/MkProgressBar.d.ts +3 -0
- package/dist/components/MkProgressBar/MkProgressBar.props.d.ts +3 -0
- package/dist/components/MkProgressBar/index.d.ts +2 -0
- package/dist/components/MkRadioButton/MkRadioButton.d.ts +3 -0
- package/dist/components/MkRadioButton/MkRadioButton.props.d.ts +7 -0
- package/dist/components/MkRadioButton/index.d.ts +2 -0
- package/dist/components/MkSectionHeader/MkSectionHeader.d.ts +3 -0
- package/dist/components/MkSectionHeader/MkSectionHeader.props.d.ts +5 -0
- package/dist/components/MkSectionHeader/index.d.ts +2 -0
- package/dist/components/MkStackedBarChart/MkStackedBarChart.d.ts +3 -0
- package/dist/components/MkStackedBarChart/MkStackedBarChart.props.d.ts +8 -0
- package/dist/components/MkStackedBarChart/index.d.ts +2 -0
- package/dist/components/MkStatusIndicator/MkStatusIndicator.d.ts +3 -0
- package/dist/components/MkStatusIndicator/MkStatusIndicator.props.d.ts +4 -0
- package/dist/components/MkStatusIndicator/index.d.ts +2 -0
- package/dist/components/MkStepper/MkStepper.d.ts +3 -0
- package/dist/components/MkStepper/MkStepper.props.d.ts +4 -0
- package/dist/components/MkStepper/index.d.ts +2 -0
- package/dist/components/MkSubHeader/MkSubHeader.d.ts +3 -0
- package/dist/components/MkSubHeader/MkSubHeader.props.d.ts +6 -0
- package/dist/components/MkSubHeader/index.d.ts +2 -0
- package/dist/components/MkTab/MkTab.d.ts +3 -0
- package/dist/components/MkTab/MkTab.props.d.ts +5 -0
- package/dist/components/MkTab/index.d.ts +2 -0
- package/dist/components/MkTag/MkTag.d.ts +3 -0
- package/dist/components/MkTag/MkTag.props.d.ts +8 -0
- package/dist/components/MkTag/index.d.ts +2 -0
- package/dist/components/MkTextInput/MkTextInput.d.ts +3 -0
- package/dist/components/MkTextInput/MkTextInput.props.d.ts +6 -0
- package/dist/components/MkTextInput/index.d.ts +2 -0
- package/dist/components/MkTimeInput/MkTimeInput.d.ts +3 -0
- package/dist/components/MkTimeInput/MkTimeInput.props.d.ts +6 -0
- package/dist/components/MkTimeInput/index.d.ts +2 -0
- package/dist/components/MkTopBar/MkTopBar.d.ts +3 -0
- package/dist/components/MkTopBar/MkTopBar.props.d.ts +5 -0
- package/dist/components/MkTopBar/index.d.ts +2 -0
- package/dist/components/MkTotalizers/MkTotalizers.d.ts +3 -0
- package/dist/components/MkTotalizers/MkTotalizers.props.d.ts +3 -0
- package/dist/components/MkTotalizers/index.d.ts +2 -0
- package/dist/components/MkUserAvatar/MkUserAvatar.d.ts +3 -0
- package/dist/components/MkUserAvatar/MkUserAvatar.props.d.ts +3 -0
- package/dist/components/MkUserAvatar/index.d.ts +2 -0
- package/dist/index.cjs +1376 -34
- package/dist/index.d.ts +72 -0
- package/dist/index.js +1342 -36
- package/dist/style.css +1687 -249
- package/package.json +22 -2
- package/dist/foundations/typography/H1.d.ts +0 -15
package/dist/index.cjs
CHANGED
|
@@ -3,58 +3,156 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
const lucideReact = require('lucide-react');
|
|
6
7
|
const dynamic = require('lucide-react/dynamic');
|
|
8
|
+
const react = require('react');
|
|
7
9
|
|
|
8
10
|
function MkButton({
|
|
9
11
|
variant = "filled",
|
|
10
12
|
color = "neutral",
|
|
11
|
-
size = "
|
|
13
|
+
size = "md",
|
|
12
14
|
fullWidth = false,
|
|
15
|
+
iconOnly = false,
|
|
13
16
|
iconName,
|
|
14
17
|
className = "",
|
|
15
18
|
disabled,
|
|
16
19
|
children,
|
|
17
20
|
...props
|
|
18
21
|
}) {
|
|
19
|
-
const baseStyles = "flex items-center justify-center
|
|
20
|
-
const variantStyles = {
|
|
21
|
-
filled: "font-medium rounded-[7px] uppercase focus:outline-none transition-colors duration-300 disabled:pointer-events-none disabled:cursor-not-allowed",
|
|
22
|
-
outlined: "font-medium rounded-[7px] uppercase border focus:outline-none transition-colors duration-300 disabled:pointer-events-none disabled:cursor-not-allowed",
|
|
23
|
-
transparent: "font-medium rounded-[7px] uppercase bg-transparent focus:outline-none transition-colors duration-300 disabled:pointer-events-none disabled:cursor-not-allowed",
|
|
24
|
-
iconOnly: "rounded-[7px] focus:outline-none transition-colors duration-300 disabled:pointer-events-none disabled:cursor-not-allowed p-2"
|
|
25
|
-
};
|
|
22
|
+
const baseStyles = "flex items-center justify-center transition-colors duration-300text-center rounded-[7px] uppercasedisabled:pointer-events-none disabled:cursor-not-allowed focus:outline-none";
|
|
26
23
|
const colorStyles = {
|
|
27
24
|
filled: {
|
|
28
|
-
primary:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
primary: [
|
|
26
|
+
"bg-[var(--button-filled-primary-bg)]",
|
|
27
|
+
"text-[var(--button-filled-primary-text)]",
|
|
28
|
+
"hover:bg-[var(--button-filled-primary-hover-bg)]",
|
|
29
|
+
"hover:text-[var(--button-filled-primary-hover-text)]",
|
|
30
|
+
"disabled:bg-[var(--button-filled-primary-disabled-bg)]",
|
|
31
|
+
"disabled:text-[var(--button-filled-primary-disabled-text)]"
|
|
32
|
+
].join(" "),
|
|
33
|
+
neutral: [
|
|
34
|
+
"bg-[var(--button-filled-neutral-bg)]",
|
|
35
|
+
"text-[var(--button-filled-neutral-text)]",
|
|
36
|
+
"hover:bg-[var(--button-filled-neutral-hover-bg)]",
|
|
37
|
+
"hover:text-[var(--button-filled-neutral-hover-text)]",
|
|
38
|
+
"disabled:bg-[var(--button-filled-neutral-disabled-bg)]",
|
|
39
|
+
"disabled:text-[var(--button-filled-neutral-disabled-text)]"
|
|
40
|
+
].join(" "),
|
|
41
|
+
success: [
|
|
42
|
+
"bg-[var(--button-filled-success-bg)]",
|
|
43
|
+
"text-[var(--button-filled-success-text)]",
|
|
44
|
+
"hover:bg-[var(--button-filled-success-hover-bg)]",
|
|
45
|
+
"hover:text-[var(--button-filled-success-hover-text)]",
|
|
46
|
+
"disabled:bg-[var(--button-filled-success-disabled-bg)]",
|
|
47
|
+
"disabled:text-[var(--button-filled-success-disabled-text)]"
|
|
48
|
+
].join(" "),
|
|
49
|
+
info: [
|
|
50
|
+
"bg-[var(--button-filled-info-bg)]",
|
|
51
|
+
"text-[var(--button-filled-info-text)]",
|
|
52
|
+
"hover:bg-[var(--button-filled-info-hover-bg)]",
|
|
53
|
+
"hover:text-[var(--button-filled-info-hover-text)]",
|
|
54
|
+
"disabled:bg-[var(--button-filled-info-disabled-bg)]",
|
|
55
|
+
"disabled:text-[var(--button-filled-info-disabled-text)]"
|
|
56
|
+
].join(" "),
|
|
57
|
+
danger: [
|
|
58
|
+
"bg-[var(--button-filled-danger-bg)]",
|
|
59
|
+
"text-[var(--button-filled-danger-text)]",
|
|
60
|
+
"hover:bg-[var(--button-filled-danger-hover-bg)]",
|
|
61
|
+
"hover:text-[var(--button-filled-danger-hover-text)]",
|
|
62
|
+
"disabled:bg-[var(--button-filled-danger-disabled-bg)]",
|
|
63
|
+
"disabled:text-[var(--button-filled-danger-disabled-text)]"
|
|
64
|
+
].join(" "),
|
|
65
|
+
warning: [
|
|
66
|
+
"bg-[var(--button-filled-warning-bg)]",
|
|
67
|
+
"text-[var(--button-filled-warning-text)]",
|
|
68
|
+
"hover:bg-[var(--button-filled-warning-hover-bg)]",
|
|
69
|
+
"hover:text-[var(--button-filled-warning-hover-text)]",
|
|
70
|
+
"disabled:bg-[var(--button-filled-warning-disabled-bg)]",
|
|
71
|
+
"disabled:text-[var(--button-filled-warning-disabled-text)]"
|
|
72
|
+
].join(" ")
|
|
33
73
|
},
|
|
34
74
|
outlined: {
|
|
35
|
-
primary:
|
|
36
|
-
|
|
37
|
-
|
|
75
|
+
primary: [
|
|
76
|
+
"border border-[var(--button-outlined-primary-border)]",
|
|
77
|
+
"text-[var(--button-outlined-primary-text)]",
|
|
78
|
+
"bg-white",
|
|
79
|
+
"hover:bg-[var(--button-outlined-primary-hover-bg)]"
|
|
80
|
+
].join(" "),
|
|
81
|
+
neutral: [
|
|
82
|
+
"border border-[var(--button-outlined-neutral-border)]",
|
|
83
|
+
"text-[var(--button-outlined-neutral-text)]",
|
|
84
|
+
"bg-white",
|
|
85
|
+
"hover:bg-[var(--button-outlined-neutral-hover-bg)]"
|
|
86
|
+
].join(" "),
|
|
87
|
+
success: [
|
|
88
|
+
"border border-[var(--button-outlined-success-border)]",
|
|
89
|
+
"text-[var(--button-outlined-success-text)]",
|
|
90
|
+
"bg-white",
|
|
91
|
+
"hover:bg-[var(--button-outlined-success-hover-bg)]"
|
|
92
|
+
].join(" "),
|
|
93
|
+
info: [
|
|
94
|
+
"border border-[var(--button-outlined-info-border)]",
|
|
95
|
+
"text-[var(--button-outlined-info-text)]",
|
|
96
|
+
"bg-white",
|
|
97
|
+
"hover:bg-[var(--button-outlined-info-hover-bg)]"
|
|
98
|
+
].join(" "),
|
|
99
|
+
danger: [
|
|
100
|
+
"border border-[var(--button-outlined-danger-border)]",
|
|
101
|
+
"text-[var(--button-outlined-danger-text)]",
|
|
102
|
+
"bg-white",
|
|
103
|
+
"hover:bg-[var(--button-outlined-danger-hover-bg)]"
|
|
104
|
+
].join(" "),
|
|
105
|
+
warning: [
|
|
106
|
+
"border border-[var(--button-outlined-warning-border)]",
|
|
107
|
+
"text-[var(--button-outlined-warning-text)]",
|
|
108
|
+
"bg-white",
|
|
109
|
+
"hover:bg-[var(--button-outlined-warning-hover-bg)]"
|
|
110
|
+
].join(" ")
|
|
38
111
|
},
|
|
39
112
|
transparent: {
|
|
40
|
-
primary:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
113
|
+
primary: [
|
|
114
|
+
"text-[var(--button-transparent-primary-text)]",
|
|
115
|
+
"hover:bg-[var(--button-transparent-primary-hover-bg)]"
|
|
116
|
+
].join(" "),
|
|
117
|
+
neutral: [
|
|
118
|
+
"text-[var(--button-transparent-neutral-text)]",
|
|
119
|
+
"hover:bg-[var(--button-transparent-neutral-hover-bg)]"
|
|
120
|
+
].join(" "),
|
|
121
|
+
success: [
|
|
122
|
+
"text-[var(--button-transparent-success-text)]",
|
|
123
|
+
"hover:bg-[var(--button-transparent-success-hover-bg)]"
|
|
124
|
+
].join(" "),
|
|
125
|
+
info: [
|
|
126
|
+
"text-[var(--button-transparent-info-text)]",
|
|
127
|
+
"hover:bg-[var(--button-transparent-info-hover-bg)]"
|
|
128
|
+
].join(" "),
|
|
129
|
+
danger: [
|
|
130
|
+
"text-[var(--button-transparent-danger-text)]",
|
|
131
|
+
"hover:bg-[var(--button-transparent-danger-hover-bg)]"
|
|
132
|
+
].join(" "),
|
|
133
|
+
warning: [
|
|
134
|
+
"text-[var(--button-transparent-warning-text)]",
|
|
135
|
+
"hover:bg-[var(--button-transparent-warning-hover-bg)]"
|
|
136
|
+
].join(" ")
|
|
48
137
|
}
|
|
49
138
|
};
|
|
50
139
|
const sizeStyles = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
140
|
+
sm: "px-3 py-1 text-sm",
|
|
141
|
+
md: "px-4 py-2 text-md",
|
|
142
|
+
lg: "px-6 py-3 text-lg"
|
|
143
|
+
};
|
|
144
|
+
const iconOnlySizeStyles = {
|
|
145
|
+
small: "p-1 w-7 h-7",
|
|
146
|
+
medium: "p-2 w-10 h-10",
|
|
147
|
+
large: "p-2 w-13 h-13"
|
|
148
|
+
};
|
|
149
|
+
const iconSize = {
|
|
150
|
+
sm: "14",
|
|
151
|
+
md: "16",
|
|
152
|
+
lg: "18"
|
|
54
153
|
};
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const sizeStyleClass = variant === "iconOnly" ? "p-2 w-10 h-10" : sizeStyles[size];
|
|
154
|
+
const styleClass = colorStyles[variant][color];
|
|
155
|
+
const sizeStyleClass = iconOnly ? iconOnlySizeStyles[size] : sizeStyles[size];
|
|
58
156
|
const fullWidthClass = fullWidth ? "w-full" : "";
|
|
59
157
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
60
158
|
"button",
|
|
@@ -62,18 +160,1262 @@ function MkButton({
|
|
|
62
160
|
type: "button",
|
|
63
161
|
disabled,
|
|
64
162
|
className: `${baseStyles}
|
|
65
|
-
${
|
|
66
|
-
${colorStyleClass}
|
|
163
|
+
${styleClass}
|
|
67
164
|
${sizeStyleClass}
|
|
68
165
|
${fullWidthClass}
|
|
69
166
|
${className}`,
|
|
70
167
|
...props,
|
|
71
168
|
children: [
|
|
72
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
73
|
-
|
|
169
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
170
|
+
dynamic.DynamicIcon,
|
|
171
|
+
{
|
|
172
|
+
name: iconName,
|
|
173
|
+
size: iconSize[size],
|
|
174
|
+
className: !iconOnly ? "mr-2" : ""
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
iconOnly ? null : children
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function MkAlert({
|
|
184
|
+
label,
|
|
185
|
+
state = "info",
|
|
186
|
+
position = "top-right",
|
|
187
|
+
className
|
|
188
|
+
}) {
|
|
189
|
+
const positionStyles = {
|
|
190
|
+
"top-right": "top-4 right-4",
|
|
191
|
+
"top-center": "top-4 left-1/2 -translate-x-1/2",
|
|
192
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2"
|
|
193
|
+
};
|
|
194
|
+
const baseStyles = [
|
|
195
|
+
"absolute z-[60]",
|
|
196
|
+
positionStyles[position],
|
|
197
|
+
"p-[20px] w-[380px]",
|
|
198
|
+
"bg-neutral-50 border-1 border-neutral-200 rounded-[12px]",
|
|
199
|
+
"flex flex-row items-center justify-between"
|
|
200
|
+
].join(" ");
|
|
201
|
+
const labelStyles = "mk-caption inline-block align-middle pl-3.5 leading-none";
|
|
202
|
+
const stateStyle = {
|
|
203
|
+
info: "text-info-900"
|
|
204
|
+
};
|
|
205
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${baseStyles} ${className}`, children: [
|
|
206
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-block align-middle", children: [
|
|
207
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
208
|
+
lucideReact.InfoIcon,
|
|
209
|
+
{
|
|
210
|
+
className: "inline-block align-middle",
|
|
211
|
+
color: "var(--color-info-700)"
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `${labelStyles} ${stateStyle[state]}`, children: label })
|
|
215
|
+
] }),
|
|
216
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
217
|
+
MkButton,
|
|
218
|
+
{
|
|
219
|
+
color: "neutral",
|
|
220
|
+
iconOnly: true,
|
|
221
|
+
iconName: "x",
|
|
222
|
+
variant: "transparent"
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
] });
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function MkBottomSheet({
|
|
229
|
+
open = false,
|
|
230
|
+
onClose,
|
|
231
|
+
children,
|
|
232
|
+
height = "md",
|
|
233
|
+
className = ""
|
|
234
|
+
}) {
|
|
235
|
+
const [isOpen, setIsOpen] = react.useState(open);
|
|
236
|
+
const [isMounted, setIsMounted] = react.useState(open);
|
|
237
|
+
const timeoutRef = react.useRef(null);
|
|
238
|
+
const isInitialMount = react.useRef(true);
|
|
239
|
+
react.useEffect(() => {
|
|
240
|
+
if (open) {
|
|
241
|
+
if (timeoutRef.current) {
|
|
242
|
+
clearTimeout(timeoutRef.current);
|
|
243
|
+
timeoutRef.current = null;
|
|
244
|
+
}
|
|
245
|
+
setIsMounted(true);
|
|
246
|
+
if (isInitialMount.current) {
|
|
247
|
+
setIsOpen(true);
|
|
248
|
+
isInitialMount.current = false;
|
|
249
|
+
} else {
|
|
250
|
+
requestAnimationFrame(() => {
|
|
251
|
+
setIsOpen(true);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
isInitialMount.current = false;
|
|
256
|
+
setIsOpen(false);
|
|
257
|
+
timeoutRef.current = setTimeout(() => {
|
|
258
|
+
setIsMounted(false);
|
|
259
|
+
}, 300);
|
|
260
|
+
}
|
|
261
|
+
return () => {
|
|
262
|
+
if (timeoutRef.current) {
|
|
263
|
+
clearTimeout(timeoutRef.current);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}, [open]);
|
|
267
|
+
const heightClasses = {
|
|
268
|
+
sm: "max-h-[30vh]",
|
|
269
|
+
md: "max-h-[60vh]",
|
|
270
|
+
lg: "max-h-[85vh]",
|
|
271
|
+
full: "h-screen max-h-screen"
|
|
272
|
+
};
|
|
273
|
+
const backdropStyles = "fixed inset-0 z-40 backdrop-blur-sm transition-opacity duration-200";
|
|
274
|
+
const backdropOpcatityAnimation = isOpen ? "opacity-100" : "opacity-0";
|
|
275
|
+
const sheetStyles = [
|
|
276
|
+
"fixed bottom-0 left-0 right-0 z-50",
|
|
277
|
+
"w-full bg-[var(--surface-level1)]",
|
|
278
|
+
"border-t border-[var(--border-default)] rounded-t-[20px] shadow-2xl",
|
|
279
|
+
"transition-transform duration-300 ease-out"
|
|
280
|
+
].join(" ");
|
|
281
|
+
const sheetTranslateAnimation = isOpen ? "translate-y-0" : "translate-y-full";
|
|
282
|
+
const handleBackdropClick = (e) => {
|
|
283
|
+
if (e.target === e.currentTarget) {
|
|
284
|
+
onClose?.();
|
|
285
|
+
setIsOpen(false);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
const handleKeyDown = (e) => {
|
|
289
|
+
if (e.key === "Escape") {
|
|
290
|
+
onClose?.();
|
|
291
|
+
setIsOpen(false);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
if (!isMounted) {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
298
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
299
|
+
"div",
|
|
300
|
+
{
|
|
301
|
+
className: `${backdropStyles} ${backdropOpcatityAnimation}`,
|
|
302
|
+
onClick: handleBackdropClick
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
306
|
+
"div",
|
|
307
|
+
{
|
|
308
|
+
className: `${sheetStyles}
|
|
309
|
+
${heightClasses[height]}
|
|
310
|
+
${sheetTranslateAnimation}
|
|
311
|
+
${className}
|
|
312
|
+
`,
|
|
313
|
+
role: "dialog",
|
|
314
|
+
"aria-modal": "true",
|
|
315
|
+
onKeyDown: handleKeyDown,
|
|
316
|
+
tabIndex: -1,
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 pt-6 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-8 h-1.5 bg-neutral-300 rounded-full" }) }),
|
|
319
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6 pb-12 max-h-full overflow-y-auto", children })
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
] });
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function MkBarChart({ data, className }) {
|
|
327
|
+
const baseStyles = "flex flex-row flex-wrap justify-between p-1 w-full max-w-4xl";
|
|
328
|
+
const barContainerStyles = "flex flex-col items-center gap-2 w-12";
|
|
329
|
+
const barStyles = "w-[25px] rounded-[5px] shadow-sm absolute bottom-0 left-0";
|
|
330
|
+
const bgBarStyles = "w-[25px] h-32 rounded-[5px] relative";
|
|
331
|
+
const batColorStyles = {
|
|
332
|
+
faded: "bg-neutral-200",
|
|
333
|
+
regular: "bg-primary-500",
|
|
334
|
+
"no-data": "bg-primary-400"
|
|
335
|
+
};
|
|
336
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${baseStyles} ${className}`, children: data.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: barContainerStyles, children: [
|
|
337
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: bgBarStyles, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
338
|
+
"div",
|
|
339
|
+
{
|
|
340
|
+
className: `${barStyles} ${batColorStyles[item.type ? item.type : "regular"]}`,
|
|
341
|
+
style: { height: `${item.value}%` }
|
|
342
|
+
}
|
|
343
|
+
) }),
|
|
344
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mk-label text-xs font-medium text-neutral-700 text-center min-w-[40px]", children: item.label })
|
|
345
|
+
] }, index)) });
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function MkBarHistoryChart({ data, className }) {
|
|
349
|
+
const baseStyles = "flex flex-row flex-wrap justify-between p-1 w-full max-w-4xl";
|
|
350
|
+
const barContainerStyles = "flex flex-col items-center gap-2 w-12";
|
|
351
|
+
const barStyles = "w-[10px] rounded-full shadow-sm absolute bottom-0 left-0";
|
|
352
|
+
const bgBarStyles = "w-[10px] h-32 bg-neutral-200 rounded-full relative";
|
|
353
|
+
const batColorStyles = {
|
|
354
|
+
faded: "bg-primary-200",
|
|
355
|
+
regular: "bg-primary-500",
|
|
356
|
+
"no-data": "bg-primary-400"
|
|
357
|
+
};
|
|
358
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${baseStyles} ${className}`, children: data.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: barContainerStyles, children: [
|
|
359
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: bgBarStyles, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
360
|
+
"div",
|
|
361
|
+
{
|
|
362
|
+
className: `${barStyles} ${batColorStyles[item.type ? item.type : "regular"]}`,
|
|
363
|
+
style: { height: `${item.value}%` }
|
|
364
|
+
}
|
|
365
|
+
) }),
|
|
366
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mk-label text-xs font-medium text-neutral-700 text-center min-w-[40px]", children: item.label })
|
|
367
|
+
] }, index)) });
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function MkCard({ className = "", noPadding = false, children }) {
|
|
371
|
+
const baseStyles = [
|
|
372
|
+
"w-full h-full p-[3px]",
|
|
373
|
+
"bg-[var(--color-neutral-200)] ",
|
|
374
|
+
"rounded-[15px]"
|
|
375
|
+
].join(" ");
|
|
376
|
+
const contentStyles = [
|
|
377
|
+
"w-full h-full",
|
|
378
|
+
"bg-[var(--surface-level3)] ",
|
|
379
|
+
"border border-[var(--border-default)] rounded-[12px]",
|
|
380
|
+
"overflow-hidden"
|
|
381
|
+
].join(" ");
|
|
382
|
+
const paddingStyle = noPadding ? "" : "p-4";
|
|
383
|
+
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: `${baseStyles} ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${contentStyles} ${paddingStyle}`, children }) });
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function MkCheckbox({
|
|
387
|
+
label,
|
|
388
|
+
size = "md",
|
|
389
|
+
className = "",
|
|
390
|
+
checked,
|
|
391
|
+
disabled,
|
|
392
|
+
id,
|
|
393
|
+
onChange,
|
|
394
|
+
...props
|
|
395
|
+
}) {
|
|
396
|
+
const generatedId = react.useId();
|
|
397
|
+
const checkboxId = id || generatedId;
|
|
398
|
+
const [isChecked, setIsChecked] = react.useState(checked ?? false);
|
|
399
|
+
react.useEffect(() => {
|
|
400
|
+
if (checked !== void 0) {
|
|
401
|
+
setIsChecked(checked);
|
|
402
|
+
}
|
|
403
|
+
}, [checked]);
|
|
404
|
+
const handleChange = (event) => {
|
|
405
|
+
const newChecked = event.target.checked;
|
|
406
|
+
setIsChecked(newChecked);
|
|
407
|
+
onChange?.(event);
|
|
408
|
+
};
|
|
409
|
+
const baseStyle = [
|
|
410
|
+
"appearance-none cursor-pointer",
|
|
411
|
+
"bg-neutral-50 rounded-[7px] border-2 border-neutral-300",
|
|
412
|
+
"transition-all duration-300",
|
|
413
|
+
"disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:border-neutral-200",
|
|
414
|
+
"enabled:focus:border-primary-300 enabled:focus:outline-none enabled:focus:ring-0",
|
|
415
|
+
"enabled:hover:shadow-[0_0_4px_var(--color-primary-400)] enabled:hover:border-primary-300",
|
|
416
|
+
"checked:bg-neutral-600 checked:border-primary-600",
|
|
417
|
+
"checked:enabled:hover:bg-primary-700 checked:enabled:hover:border-primary-700",
|
|
418
|
+
"checked:enabled:hover:shadow-[0_0_4px_var(--color-primary-500)]",
|
|
419
|
+
"disabled:checked:bg-neutral-400 disabled:checked:border-neutral-400",
|
|
420
|
+
"relative flex items-center justify-center"
|
|
421
|
+
].join(" ");
|
|
422
|
+
const sizeStyles = {
|
|
423
|
+
sm: "w-4 h-4",
|
|
424
|
+
md: "w-5 h-5",
|
|
425
|
+
lg: "w-6 h-6"
|
|
426
|
+
};
|
|
427
|
+
const iconSizes = {
|
|
428
|
+
sm: 12,
|
|
429
|
+
md: 14,
|
|
430
|
+
lg: 16
|
|
431
|
+
};
|
|
432
|
+
const labelSizeStyles = {
|
|
433
|
+
sm: "text-sm",
|
|
434
|
+
md: "text-md",
|
|
435
|
+
lg: "text-lg"
|
|
436
|
+
};
|
|
437
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex items-center gap-2 ${className}`, children: [
|
|
438
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
439
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
440
|
+
"input",
|
|
441
|
+
{
|
|
442
|
+
type: "checkbox",
|
|
443
|
+
id: checkboxId,
|
|
444
|
+
className: `${baseStyle} ${sizeStyles[size]}`,
|
|
445
|
+
checked: isChecked,
|
|
446
|
+
disabled,
|
|
447
|
+
onChange: handleChange,
|
|
448
|
+
...props
|
|
449
|
+
}
|
|
450
|
+
),
|
|
451
|
+
isChecked && /* @__PURE__ */ jsxRuntime.jsx(
|
|
452
|
+
lucideReact.Check,
|
|
453
|
+
{
|
|
454
|
+
className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none text-white z-10",
|
|
455
|
+
size: iconSizes[size],
|
|
456
|
+
strokeWidth: 3,
|
|
457
|
+
"aria-hidden": "true"
|
|
458
|
+
}
|
|
459
|
+
)
|
|
460
|
+
] }),
|
|
461
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
462
|
+
"label",
|
|
463
|
+
{
|
|
464
|
+
htmlFor: checkboxId,
|
|
465
|
+
className: `${labelSizeStyles[size]} text-neutral-800 cursor-pointer select-none ${disabled ? "cursor-not-allowed text-neutral-600" : ""}`,
|
|
466
|
+
children: label
|
|
467
|
+
}
|
|
468
|
+
)
|
|
469
|
+
] });
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
function MkComboBox({
|
|
473
|
+
value,
|
|
474
|
+
size = "md",
|
|
475
|
+
list = [],
|
|
476
|
+
className,
|
|
477
|
+
...props
|
|
478
|
+
}) {
|
|
479
|
+
const baseStyle = [
|
|
480
|
+
"bg-neutral-50 rounded-[7px] border-2 border-neutral-300",
|
|
481
|
+
"appearance-none text-neutral-800",
|
|
482
|
+
"disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-600",
|
|
483
|
+
"enabled:focus:border-primary-300 enabled:focus:outline-none enabled:focus:ring-0focus:ring-offset-0",
|
|
484
|
+
"enabled:hover:shadow-[0_0_4px_var(--color-primary-400)] enabled:hover:border-primary-300",
|
|
485
|
+
"transition-shadow transition-border duration-300"
|
|
486
|
+
].join(" ");
|
|
487
|
+
const sizeStyles = {
|
|
488
|
+
sm: "px-3 py-1 pr-8 text-sm font-[14px]",
|
|
489
|
+
md: "px-4 py-2 pr-10 text-md font-[16px]",
|
|
490
|
+
lg: "px-6 py-3 pr-12 text-lg font-[18px]"
|
|
491
|
+
};
|
|
492
|
+
const iconSizes = {
|
|
493
|
+
sm: 16,
|
|
494
|
+
md: 18,
|
|
495
|
+
lg: 20
|
|
496
|
+
};
|
|
497
|
+
const iconPositions = {
|
|
498
|
+
sm: "right-2.5",
|
|
499
|
+
md: "right-3",
|
|
500
|
+
lg: "right-4"
|
|
501
|
+
};
|
|
502
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative block w-full", children: [
|
|
503
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
504
|
+
"select",
|
|
505
|
+
{
|
|
506
|
+
className: `${baseStyle} ${sizeStyles[size]} w-full ${className}`,
|
|
507
|
+
value,
|
|
508
|
+
...props,
|
|
509
|
+
children: list.map((item) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: item.value, children: item.label }, item.value))
|
|
510
|
+
}
|
|
511
|
+
),
|
|
512
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
513
|
+
lucideReact.ChevronDown,
|
|
514
|
+
{
|
|
515
|
+
className: `absolute top-1/2 -translate-y-1/2 ${iconPositions[size]} text-neutral-500 pointer-events-none`,
|
|
516
|
+
size: iconSizes[size],
|
|
517
|
+
"aria-hidden": "true"
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
] });
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function MkDateInput({
|
|
524
|
+
value,
|
|
525
|
+
placeholder = "00:00",
|
|
526
|
+
size = "md",
|
|
527
|
+
className,
|
|
528
|
+
...props
|
|
529
|
+
}) {
|
|
530
|
+
const baseStyle = [
|
|
531
|
+
"bg-neutral-50 rounded-[7px] border-2 border-neutral-300",
|
|
532
|
+
"text-neutral-800",
|
|
533
|
+
"disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-600",
|
|
534
|
+
"enabled:focus:border-primary-300 enabled:focus:outline-none enabled:focus:ring-0focus:ring-offset-0",
|
|
535
|
+
"enabled:hover:shadow-[0_0_4px_var(--color-primary-400)] enabled:hover:border-primary-300",
|
|
536
|
+
"transition-shadow transition-border duration-300"
|
|
537
|
+
].join(" ");
|
|
538
|
+
const sizeStyles = {
|
|
539
|
+
sm: "pl-9 pr-3 py-1 text-sm font-[14px]",
|
|
540
|
+
md: "pl-10 pr-4 py-2 text-md font-[16px]",
|
|
541
|
+
lg: "pl-12 pr-6 py-3 text-lg font-[18px]"
|
|
542
|
+
};
|
|
543
|
+
const iconSizes = {
|
|
544
|
+
sm: 16,
|
|
545
|
+
md: 18,
|
|
546
|
+
lg: 20
|
|
547
|
+
};
|
|
548
|
+
const iconPositions = {
|
|
549
|
+
sm: "left-2.5",
|
|
550
|
+
md: "left-3",
|
|
551
|
+
lg: "left-4"
|
|
552
|
+
};
|
|
553
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
554
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
555
|
+
lucideReact.Calendar,
|
|
556
|
+
{
|
|
557
|
+
className: `absolute top-1/2 -translate-y-1/2 ${iconPositions[size]} text-neutral-500`,
|
|
558
|
+
size: iconSizes[size],
|
|
559
|
+
"aria-hidden": "true"
|
|
560
|
+
}
|
|
561
|
+
),
|
|
562
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
563
|
+
"input",
|
|
564
|
+
{
|
|
565
|
+
type: "date",
|
|
566
|
+
className: `${baseStyle} ${sizeStyles[size]} ${className || ""}`,
|
|
567
|
+
placeholder,
|
|
568
|
+
value,
|
|
569
|
+
...props
|
|
570
|
+
}
|
|
571
|
+
)
|
|
572
|
+
] });
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function MkDivider({
|
|
576
|
+
className = "",
|
|
577
|
+
orientation = "horizontal"
|
|
578
|
+
}) {
|
|
579
|
+
const isVertical = orientation === "vertical";
|
|
580
|
+
const baseStyles = [
|
|
581
|
+
"bg-[var(--border-default)]",
|
|
582
|
+
"border-0",
|
|
583
|
+
isVertical ? "w-px self-stretch" : "h-px w-full"
|
|
584
|
+
].join(" ");
|
|
585
|
+
if (isVertical) {
|
|
586
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
587
|
+
"div",
|
|
588
|
+
{
|
|
589
|
+
className: `${baseStyles} ${className}`,
|
|
590
|
+
role: "separator",
|
|
591
|
+
"aria-orientation": "vertical"
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
596
|
+
"hr",
|
|
597
|
+
{
|
|
598
|
+
className: `${baseStyles} ${className}`,
|
|
599
|
+
role: "separator",
|
|
600
|
+
"aria-orientation": "horizontal"
|
|
601
|
+
}
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
function MkIconBadge({ color, iconName }) {
|
|
606
|
+
const baseStyle = "inline-flex items-center justify-center p-2 bg-var(--surface-level1) border-3 rounded-full w-fit h-fit";
|
|
607
|
+
const wrapperColorStyle = {
|
|
608
|
+
primary: "bg-primary-100 border-[var(--color-primary-200)]",
|
|
609
|
+
neutral: "bg-neutral-100 border-[var(--color-neutral-200)]",
|
|
610
|
+
success: "bg-success-100 border-[var(--color-success-200)]",
|
|
611
|
+
warning: "bg-warning-100 border-[var(--color-warning-200)]",
|
|
612
|
+
danger: "bg-danger-100 border-[var(--color-danger-200)]",
|
|
613
|
+
info: "bg-info-100 border-[var(--color-info-200)]"
|
|
614
|
+
};
|
|
615
|
+
const iconColorStyle = {
|
|
616
|
+
primary: "var(--color-primary-600)",
|
|
617
|
+
neutral: "var(--color-neutral-600)",
|
|
618
|
+
success: "var(--color-success-600)",
|
|
619
|
+
warning: "var(--color-warning-600)",
|
|
620
|
+
danger: "var(--color-danger-600)",
|
|
621
|
+
info: "var(--color-info-600)"
|
|
622
|
+
};
|
|
623
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${baseStyle} ${wrapperColorStyle[color]}`, children: /* @__PURE__ */ jsxRuntime.jsx(dynamic.DynamicIcon, { name: iconName, color: iconColorStyle[color], size: 35 }) });
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
function MkDetailedListItem({
|
|
627
|
+
title,
|
|
628
|
+
description,
|
|
629
|
+
numericValue,
|
|
630
|
+
icon
|
|
631
|
+
}) {
|
|
632
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
633
|
+
"div",
|
|
634
|
+
{
|
|
635
|
+
className: "flex justify-between items-center bg-var(--surface-level1) hover:bg-neutral-100 p-3 h-[70px] transition-all duration-300 border-1 border-[var(--border-default)] rounded-xl",
|
|
636
|
+
children: [
|
|
637
|
+
icon ? /* @__PURE__ */ jsxRuntime.jsx(MkIconBadge, { color: icon.color, iconName: icon.iconName }) : null,
|
|
638
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col justify-center", children: [
|
|
639
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mk-content", children: title }),
|
|
640
|
+
description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mk-subcontent", children: description }) : null
|
|
641
|
+
] }),
|
|
642
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
|
|
643
|
+
numericValue ? /* @__PURE__ */ jsxRuntime.jsx(MkDivider, { orientation: "vertical", className: "mx-2" }) : null,
|
|
644
|
+
numericValue ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mk-content-numeric", children: numericValue }) : null
|
|
645
|
+
] })
|
|
646
|
+
]
|
|
647
|
+
}
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
function MkDetailedList({ className, data }) {
|
|
652
|
+
const baseStyle = "flex flex-col gap-2";
|
|
653
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${baseStyle} ${className}`, children: data.map((element, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
654
|
+
MkDetailedListItem,
|
|
655
|
+
{
|
|
656
|
+
title: element.title,
|
|
657
|
+
description: element.description,
|
|
658
|
+
numericValue: element.numericValue,
|
|
659
|
+
icon: element.icon
|
|
660
|
+
}
|
|
661
|
+
) }, index)) });
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
function MkDonutChart({
|
|
665
|
+
data,
|
|
666
|
+
className,
|
|
667
|
+
sizePx = 160,
|
|
668
|
+
thicknessPx = 24,
|
|
669
|
+
centerLabel,
|
|
670
|
+
centerValue
|
|
671
|
+
}) {
|
|
672
|
+
const baseStyles = "flex items-center justify-center";
|
|
673
|
+
const wrapperStyles = "relative";
|
|
674
|
+
const total = data.reduce((sum, d) => sum + Math.max(0, d.value), 0);
|
|
675
|
+
const segmentColorByIndex = [
|
|
676
|
+
"var(--color-primary-500)",
|
|
677
|
+
"var(--color-primary-400)",
|
|
678
|
+
"var(--color-primary-300)",
|
|
679
|
+
"var(--color-primary-200)",
|
|
680
|
+
"var(--color-primary-100)"
|
|
681
|
+
];
|
|
682
|
+
const ringBackground = total > 0 ? (() => {
|
|
683
|
+
let acc = 0;
|
|
684
|
+
const stops = data.map((d, i) => {
|
|
685
|
+
const v = Math.max(0, d.value);
|
|
686
|
+
const start = acc;
|
|
687
|
+
acc += v / total * 100;
|
|
688
|
+
const color = segmentColorByIndex[i % segmentColorByIndex.length];
|
|
689
|
+
return `${color} ${start}% ${acc}%`;
|
|
690
|
+
});
|
|
691
|
+
return `conic-gradient(${stops.join(", ")})`;
|
|
692
|
+
})() : "conic-gradient(var(--color-neutral-200) 0% 100%)";
|
|
693
|
+
const sizeStyle = { width: sizePx, height: sizePx };
|
|
694
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${baseStyles} ${className ?? ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperStyles, style: sizeStyle, children: [
|
|
695
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
696
|
+
"div",
|
|
697
|
+
{
|
|
698
|
+
className: "rounded-full",
|
|
699
|
+
style: {
|
|
700
|
+
...sizeStyle,
|
|
701
|
+
background: ringBackground
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
),
|
|
705
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
706
|
+
"div",
|
|
707
|
+
{
|
|
708
|
+
className: "absolute rounded-full bg-white flex flex-col items-center justify-center text-center",
|
|
709
|
+
style: {
|
|
710
|
+
inset: thicknessPx
|
|
711
|
+
},
|
|
712
|
+
children: [
|
|
713
|
+
centerValue ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mk-label text-lg font-semibold text-neutral-900", children: centerValue }) : null,
|
|
714
|
+
centerLabel ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mk-label text-xs font-medium text-neutral-600", children: centerLabel }) : null
|
|
715
|
+
]
|
|
716
|
+
}
|
|
717
|
+
)
|
|
718
|
+
] }) });
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
function MkHeader({ title, subtitle, className, children }) {
|
|
722
|
+
const baseStyle = ["flex items-center justify-between", "py-1"].join(" ");
|
|
723
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("header", { className: `${baseStyle} ${className}`, children: [
|
|
724
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
725
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "mk-header-title", children: title }),
|
|
726
|
+
subtitle ? /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "mk-header-subtitle", children: subtitle }) : null
|
|
727
|
+
] }),
|
|
728
|
+
children ? /* @__PURE__ */ jsxRuntime.jsx("div", { children }) : null
|
|
729
|
+
] });
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
function MkHorizontalBarChart({ className }) {
|
|
733
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className });
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
function MkStatusIndicator({ color, text }) {
|
|
737
|
+
const baseStyle = text ? "flex items-center gap-1" : "";
|
|
738
|
+
const circle = "w-[15px] h-[15px] border-2 rounded-full p-[1px] flex items-center justify-center box-border";
|
|
739
|
+
const innerCircle = "w-[9px] h-[9px] rounded-full";
|
|
740
|
+
const textStyle = "font-bold leading-none text-[14px]";
|
|
741
|
+
const circleColorStyles = {
|
|
742
|
+
primary: "border-primary-400 shadow-[0_0_4px_var(--color-primary-400)]",
|
|
743
|
+
neutral: "border-neutral-400 shadow-[0_0_4px_var(--color-neutral-400)]",
|
|
744
|
+
success: "border-success-400 shadow-[0_0_4px_var(--color-success-400)]",
|
|
745
|
+
warning: "border-warning-400 shadow-[0_0_4px_var(--color-warning-400)]",
|
|
746
|
+
danger: "border-danger-400 shadow-[0_0_4px_var(--color-danger-400)]",
|
|
747
|
+
info: "border-info-400 shadow-[0_0_4px_var(--color-info-400)]"
|
|
748
|
+
};
|
|
749
|
+
const innerCircleColorStyles = {
|
|
750
|
+
primary: "bg-primary-400",
|
|
751
|
+
neutral: "bg-neutral-400",
|
|
752
|
+
success: "bg-success-400",
|
|
753
|
+
warning: "bg-warning-400",
|
|
754
|
+
danger: "bg-danger-400",
|
|
755
|
+
info: "bg-info-400"
|
|
756
|
+
};
|
|
757
|
+
const textColorStyles = {
|
|
758
|
+
primary: "text-primary-900",
|
|
759
|
+
neutral: "text-neutral-900",
|
|
760
|
+
success: "text-success-900",
|
|
761
|
+
warning: "text-warning-900",
|
|
762
|
+
danger: "text-danger-900",
|
|
763
|
+
info: "text-info-900"
|
|
764
|
+
};
|
|
765
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: baseStyle, children: [
|
|
766
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `${circle} ${circleColorStyles[color]}`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
767
|
+
"div",
|
|
768
|
+
{
|
|
769
|
+
className: `${innerCircle} ${innerCircleColorStyles[color]}`
|
|
770
|
+
}
|
|
771
|
+
) }),
|
|
772
|
+
text ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${textStyle} ${textColorStyles[color]}`, children: text }) : null
|
|
773
|
+
] });
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
function MkListItem({ title, numericValue, status }) {
|
|
777
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
778
|
+
"div",
|
|
779
|
+
{
|
|
780
|
+
className: "flex justify-between items-center bg-neutral-50 hover:bg-neutral-100 p-3 h-[70px] transition-all duration-300",
|
|
781
|
+
children: [
|
|
782
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col justify-center", children: [
|
|
783
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mk-content", children: title }),
|
|
784
|
+
status ? /* @__PURE__ */ jsxRuntime.jsx(MkStatusIndicator, { color: status.color, text: status.text }) : null
|
|
785
|
+
] }),
|
|
786
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
|
|
787
|
+
status && numericValue ? /* @__PURE__ */ jsxRuntime.jsx(MkDivider, { orientation: "vertical", className: "mx-2" }) : null,
|
|
788
|
+
numericValue ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mk-content-numeric", children: numericValue }) : null
|
|
789
|
+
] })
|
|
74
790
|
]
|
|
75
791
|
}
|
|
76
792
|
);
|
|
77
793
|
}
|
|
78
794
|
|
|
795
|
+
function MkList({ className, data }) {
|
|
796
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: data.map((element, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
797
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
798
|
+
MkListItem,
|
|
799
|
+
{
|
|
800
|
+
title: element.title,
|
|
801
|
+
description: element.description,
|
|
802
|
+
numericValue: element.numericValue,
|
|
803
|
+
status: element.status
|
|
804
|
+
}
|
|
805
|
+
),
|
|
806
|
+
index < data.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(MkDivider, {})
|
|
807
|
+
] }, index)) });
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
function MkLineChart({ className }) {
|
|
811
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className });
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
function MkMain({ className = "", children }) {
|
|
815
|
+
const baseStyles = [
|
|
816
|
+
"w-full h-full p-6",
|
|
817
|
+
"bg-[var(--surface-level1)] ",
|
|
818
|
+
"border border-[var(--border-default)] rounded-[15px]"
|
|
819
|
+
].join(" ");
|
|
820
|
+
return /* @__PURE__ */ jsxRuntime.jsx("main", { className: `${baseStyles} ${className}`, children });
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
function MkModal({
|
|
824
|
+
open = false,
|
|
825
|
+
onClose,
|
|
826
|
+
children,
|
|
827
|
+
className = ""
|
|
828
|
+
}) {
|
|
829
|
+
const dialogRef = react.useRef(null);
|
|
830
|
+
react.useEffect(() => {
|
|
831
|
+
const dialog = dialogRef.current;
|
|
832
|
+
if (!dialog) return;
|
|
833
|
+
if (open) {
|
|
834
|
+
dialog.showModal();
|
|
835
|
+
} else {
|
|
836
|
+
onClose?.();
|
|
837
|
+
dialog.close();
|
|
838
|
+
}
|
|
839
|
+
}, [open]);
|
|
840
|
+
const handleBackdropClick = (e) => {
|
|
841
|
+
if (e.target === e.currentTarget) {
|
|
842
|
+
onClose?.();
|
|
843
|
+
dialogRef.current?.close();
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
const handleClose = () => {
|
|
847
|
+
onClose?.();
|
|
848
|
+
dialogRef.current?.close();
|
|
849
|
+
};
|
|
850
|
+
const baseStyles = [
|
|
851
|
+
"rounded-[15px]",
|
|
852
|
+
"bg-transparent",
|
|
853
|
+
"shadow-2xl",
|
|
854
|
+
"overflow-hidden",
|
|
855
|
+
"backdrop:backdrop-blur-sm",
|
|
856
|
+
"m-auto",
|
|
857
|
+
className
|
|
858
|
+
].join(" ");
|
|
859
|
+
const borderContentStyles = [
|
|
860
|
+
"p-[3px]",
|
|
861
|
+
"bg-[var(--color-neutral-300)] ",
|
|
862
|
+
"rounded-[15px]"
|
|
863
|
+
].join(" ");
|
|
864
|
+
const contentStyles = [
|
|
865
|
+
"w-full h-full p-[3px]",
|
|
866
|
+
"bg-[var(--surface-level1)]",
|
|
867
|
+
"border border-[var(--border-default)] rounded-[12px]",
|
|
868
|
+
"overflow-hidden"
|
|
869
|
+
].join(" ");
|
|
870
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
871
|
+
"dialog",
|
|
872
|
+
{
|
|
873
|
+
ref: dialogRef,
|
|
874
|
+
className: baseStyles,
|
|
875
|
+
onCancel: handleClose,
|
|
876
|
+
onClick: handleBackdropClick,
|
|
877
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: borderContentStyles, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: contentStyles, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full max-h-[80vh] overflow-y-auto", children }) }) })
|
|
878
|
+
}
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
function MkNavItem({
|
|
883
|
+
label,
|
|
884
|
+
iconName,
|
|
885
|
+
link,
|
|
886
|
+
as,
|
|
887
|
+
isActive = false,
|
|
888
|
+
collapsed = false,
|
|
889
|
+
...props
|
|
890
|
+
}) {
|
|
891
|
+
const baseStyle = "group inline-flex flex-row items-center p-[10px] gap-[5px] hover:bg-primary-100 w-fit transition-all duration-300 cursor-pointer rounded-[7px]";
|
|
892
|
+
const iconStyle = "text-neutral-600 group-hover:text-primary-800 transition-all duration-300";
|
|
893
|
+
const activeBaseStyle = "bg-primary-200 text-primary-800";
|
|
894
|
+
const activeIconStyle = "text-primary-800";
|
|
895
|
+
let Component = "a";
|
|
896
|
+
const linkProps = {};
|
|
897
|
+
if (as) {
|
|
898
|
+
Component = as;
|
|
899
|
+
linkProps.to = link;
|
|
900
|
+
linkProps.href = link;
|
|
901
|
+
} else {
|
|
902
|
+
linkProps.href = link;
|
|
903
|
+
}
|
|
904
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
905
|
+
Component,
|
|
906
|
+
{
|
|
907
|
+
className: `${baseStyle} ${isActive ? activeBaseStyle : ""}`,
|
|
908
|
+
...linkProps,
|
|
909
|
+
...props,
|
|
910
|
+
children: [
|
|
911
|
+
iconName && /* @__PURE__ */ jsxRuntime.jsx(
|
|
912
|
+
dynamic.DynamicIcon,
|
|
913
|
+
{
|
|
914
|
+
name: iconName,
|
|
915
|
+
size: 20,
|
|
916
|
+
className: `${iconStyle} ${isActive ? activeIconStyle : ""}`
|
|
917
|
+
}
|
|
918
|
+
),
|
|
919
|
+
collapsed ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
920
|
+
"span",
|
|
921
|
+
{
|
|
922
|
+
className: "mk-caption group-hover:text-primary-800 transition-all duration-300 ",
|
|
923
|
+
children: label
|
|
924
|
+
}
|
|
925
|
+
)
|
|
926
|
+
]
|
|
927
|
+
}
|
|
928
|
+
);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
function MkNavList({ data, collapsed, className }) {
|
|
932
|
+
return /* @__PURE__ */ jsxRuntime.jsx("nav", { children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: `flex flex-col gap-[10px] ${className || ""}`, children: data.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
933
|
+
MkNavItem,
|
|
934
|
+
{
|
|
935
|
+
label: item.label,
|
|
936
|
+
iconName: item.iconName,
|
|
937
|
+
link: item.link,
|
|
938
|
+
isActive: item.isActive,
|
|
939
|
+
collapsed
|
|
940
|
+
},
|
|
941
|
+
index
|
|
942
|
+
) })) }) });
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
function MkNumberInput({
|
|
946
|
+
value,
|
|
947
|
+
placeholder,
|
|
948
|
+
size = "md",
|
|
949
|
+
className,
|
|
950
|
+
...props
|
|
951
|
+
}) {
|
|
952
|
+
const baseStyle = [
|
|
953
|
+
"bg-neutral-50 rounded-[7px] border-2 border-neutral-300",
|
|
954
|
+
"text-neutral-800",
|
|
955
|
+
"disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-600",
|
|
956
|
+
"enabled:focus:border-primary-300 enabled:focus:outline-none enabled:focus:ring-0focus:ring-offset-0",
|
|
957
|
+
"enabled:hover:shadow-[0_0_4px_var(--color-primary-400)] enabled:hover:border-primary-300",
|
|
958
|
+
"transition-shadow transition-border duration-300"
|
|
959
|
+
].join(" ");
|
|
960
|
+
const sizeStyles = {
|
|
961
|
+
sm: "px-3 py-1 text-sm font-[14px]",
|
|
962
|
+
md: 'px-4 py-2 text-md font-[16px]"',
|
|
963
|
+
lg: 'px-6 py-3 text-lg font-[18px]"'
|
|
964
|
+
};
|
|
965
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
966
|
+
"input",
|
|
967
|
+
{
|
|
968
|
+
type: "number",
|
|
969
|
+
className: `${baseStyle} ${sizeStyles[size]} ${className}`,
|
|
970
|
+
placeholder,
|
|
971
|
+
value,
|
|
972
|
+
...props
|
|
973
|
+
}
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
function MkPanel({ className = "", children }) {
|
|
978
|
+
const baseStyles = [
|
|
979
|
+
"w-full h-full p-3",
|
|
980
|
+
"bg-[var(--surface-level2)] ",
|
|
981
|
+
"rounded-[20px]"
|
|
982
|
+
].join(" ");
|
|
983
|
+
return /* @__PURE__ */ jsxRuntime.jsx("main", { className: `${baseStyles} ${className}`, children });
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
function MkProgressBar({ percentage }) {
|
|
987
|
+
const clampedPercentage = Math.min(Math.max(percentage, 0), 100);
|
|
988
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-[10px] bg-neutral-200 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
989
|
+
"div",
|
|
990
|
+
{
|
|
991
|
+
className: "h-[10px] bg-primary-400 rounded-full transition-all duration-300 block",
|
|
992
|
+
style: {
|
|
993
|
+
width: `${clampedPercentage}%`,
|
|
994
|
+
minHeight: "10px"
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
) });
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
function MkRadioButton({
|
|
1001
|
+
label,
|
|
1002
|
+
value,
|
|
1003
|
+
name,
|
|
1004
|
+
size = "md",
|
|
1005
|
+
className = "",
|
|
1006
|
+
checked,
|
|
1007
|
+
disabled,
|
|
1008
|
+
id,
|
|
1009
|
+
onChange,
|
|
1010
|
+
...props
|
|
1011
|
+
}) {
|
|
1012
|
+
const generatedId = react.useId();
|
|
1013
|
+
const checkboxId = id || generatedId;
|
|
1014
|
+
const [isChecked, setIsChecked] = react.useState(checked ?? false);
|
|
1015
|
+
react.useEffect(() => {
|
|
1016
|
+
if (checked !== void 0) {
|
|
1017
|
+
setIsChecked(checked);
|
|
1018
|
+
}
|
|
1019
|
+
}, [checked]);
|
|
1020
|
+
const handleChange = (event) => {
|
|
1021
|
+
const newChecked = event.target.checked;
|
|
1022
|
+
setIsChecked(newChecked);
|
|
1023
|
+
onChange?.(event);
|
|
1024
|
+
};
|
|
1025
|
+
const baseStyle = [
|
|
1026
|
+
"appearance-none cursor-pointer",
|
|
1027
|
+
"bg-neutral-50 rounded-full border-2 border-neutral-300",
|
|
1028
|
+
"transition-all duration-300",
|
|
1029
|
+
"disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:border-neutral-300",
|
|
1030
|
+
"enabled:focus:border-primary-300 enabled:focus:outline-none enabled:focus:ring-0",
|
|
1031
|
+
"enabled:hover:shadow-[0_0_4px_var(--color-primary-400)] enabled:hover:border-primary-300",
|
|
1032
|
+
"checked:bg-neutral-50 checked:border-primary-300",
|
|
1033
|
+
"checked:enabled:hover:bg-primary-100 checked:enabled:hover:border-primary-300",
|
|
1034
|
+
"checked:enabled:hover:shadow-[0_0_4px_var(--color-primary-500)]",
|
|
1035
|
+
"disabled:checked:bg-neutral-100 disabled:checked:border-neutral-400",
|
|
1036
|
+
"relative flex items-center justify-center"
|
|
1037
|
+
].join(" ");
|
|
1038
|
+
const sizeStyles = {
|
|
1039
|
+
sm: "w-5 h-5",
|
|
1040
|
+
md: "w-6 h-6",
|
|
1041
|
+
lg: "w-7 h-7"
|
|
1042
|
+
};
|
|
1043
|
+
const iconSizes = {
|
|
1044
|
+
sm: 50,
|
|
1045
|
+
md: 70,
|
|
1046
|
+
lg: 90
|
|
1047
|
+
};
|
|
1048
|
+
const labelSizeStyles = {
|
|
1049
|
+
sm: "text-sm",
|
|
1050
|
+
md: "text-md",
|
|
1051
|
+
lg: "text-lg"
|
|
1052
|
+
};
|
|
1053
|
+
const iconStyle = [
|
|
1054
|
+
"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none z-10",
|
|
1055
|
+
disabled === true ? "text-[var(--color-neutral-400)]" : "text-[var(--color-primary-300)]"
|
|
1056
|
+
].join(" ");
|
|
1057
|
+
const labelStyle = [
|
|
1058
|
+
"text-neutral-800 cursor-pointer select-none",
|
|
1059
|
+
disabled === true ? "cursor-not-allowed text-neutral-600" : ""
|
|
1060
|
+
].join(" ");
|
|
1061
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex items-center gap-2 ${className}`, children: [
|
|
1062
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
1063
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1064
|
+
"input",
|
|
1065
|
+
{
|
|
1066
|
+
type: "radio",
|
|
1067
|
+
name,
|
|
1068
|
+
value,
|
|
1069
|
+
id: checkboxId,
|
|
1070
|
+
className: `${baseStyle} ${sizeStyles[size]}`,
|
|
1071
|
+
checked: isChecked,
|
|
1072
|
+
disabled,
|
|
1073
|
+
onChange: handleChange,
|
|
1074
|
+
...props
|
|
1075
|
+
}
|
|
1076
|
+
),
|
|
1077
|
+
isChecked && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1078
|
+
lucideReact.DotIcon,
|
|
1079
|
+
{
|
|
1080
|
+
className: iconStyle,
|
|
1081
|
+
size: iconSizes[size],
|
|
1082
|
+
strokeWidth: 3,
|
|
1083
|
+
"aria-hidden": "true"
|
|
1084
|
+
}
|
|
1085
|
+
)
|
|
1086
|
+
] }),
|
|
1087
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1088
|
+
"label",
|
|
1089
|
+
{
|
|
1090
|
+
htmlFor: checkboxId,
|
|
1091
|
+
className: `${labelStyle} ${labelSizeStyles[size]}`,
|
|
1092
|
+
children: label
|
|
1093
|
+
}
|
|
1094
|
+
)
|
|
1095
|
+
] });
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
function MkSectionHeader({ title, className, children }) {
|
|
1099
|
+
const baseStyle = "flex items-center justify-between py-1";
|
|
1100
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${baseStyle} ${className}`, children: [
|
|
1101
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("h5", { className: "mk-section-title", children: title }) }),
|
|
1102
|
+
children ? /* @__PURE__ */ jsxRuntime.jsx("div", { children }) : null
|
|
1103
|
+
] });
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
function MkStackedBarChart({ data, className }) {
|
|
1107
|
+
const baseStyles = "flex flex-row flex-wrap justify-between p-1 w-full max-w-4xl";
|
|
1108
|
+
const barContainerStyles = "flex flex-col items-center gap-2 w-12";
|
|
1109
|
+
const bgBarStyles = "w-[25px] h-32 relative overflow-hidden flex items-end";
|
|
1110
|
+
const segmentBaseStyles = "w-full";
|
|
1111
|
+
const segmentColorByIndex = [
|
|
1112
|
+
"bg-primary-500",
|
|
1113
|
+
"bg-primary-400",
|
|
1114
|
+
"bg-neutral-300",
|
|
1115
|
+
"bg-neutral-500"
|
|
1116
|
+
];
|
|
1117
|
+
const barOpacityByType = {
|
|
1118
|
+
faded: "opacity-50",
|
|
1119
|
+
regular: "opacity-100",
|
|
1120
|
+
"no-data": "opacity-70"
|
|
1121
|
+
};
|
|
1122
|
+
const labelStyles = "mk-label text-xs font-medium text-neutral-700 text-center min-w-[40px]";
|
|
1123
|
+
const totals = data.map((item) => item.values.reduce((sum, v) => sum + v, 0));
|
|
1124
|
+
const maxTotal = Math.max(...totals, 1);
|
|
1125
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${baseStyles} ${className ?? ""}`, children: data.map((item, index) => {
|
|
1126
|
+
const total = totals[index] || 0;
|
|
1127
|
+
const barHeightPercent = total / maxTotal * 100;
|
|
1128
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: barContainerStyles, children: [
|
|
1129
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: bgBarStyles, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1130
|
+
"div",
|
|
1131
|
+
{
|
|
1132
|
+
className: `w-full flex flex-col justify-end rounded-[5px] ${barOpacityByType[item.type]}`,
|
|
1133
|
+
style: { height: `${barHeightPercent}%` },
|
|
1134
|
+
children: item.values.map((value, i) => {
|
|
1135
|
+
const segmentHeightPercent = total > 0 ? value / total * 100 : 0;
|
|
1136
|
+
const isFirst = i === 0;
|
|
1137
|
+
const isLast = i === item.values.length - 1;
|
|
1138
|
+
const radiusClass = [
|
|
1139
|
+
isFirst ? "rounded-t-[5px]" : "",
|
|
1140
|
+
isLast ? "rounded-b-[5px]" : ""
|
|
1141
|
+
].join(" ");
|
|
1142
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1143
|
+
"div",
|
|
1144
|
+
{
|
|
1145
|
+
className: `${segmentBaseStyles} ${segmentColorByIndex[i % segmentColorByIndex.length]} ${radiusClass}`,
|
|
1146
|
+
style: { height: `${segmentHeightPercent}%` }
|
|
1147
|
+
},
|
|
1148
|
+
i
|
|
1149
|
+
);
|
|
1150
|
+
})
|
|
1151
|
+
}
|
|
1152
|
+
) }),
|
|
1153
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: labelStyles, children: item.label })
|
|
1154
|
+
] }, index);
|
|
1155
|
+
}) });
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
function MkStepper({ steps, currentStep }) {
|
|
1159
|
+
const validSteps = Math.max(1, steps);
|
|
1160
|
+
const validCurrentStep = Math.max(0, Math.min(currentStep, validSteps));
|
|
1161
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-[10px] rounded-full overflow-hidden flex gap-1", children: Array.from({ length: validSteps }, (_, index) => {
|
|
1162
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1163
|
+
"div",
|
|
1164
|
+
{
|
|
1165
|
+
className: `h-[10px] transition-all duration-300 flex-shrink-0 ${index + 1 <= validCurrentStep ? "bg-primary-400" : "bg-neutral-200"}`,
|
|
1166
|
+
style: {
|
|
1167
|
+
width: `${100 / validSteps}%`,
|
|
1168
|
+
minHeight: "10px"
|
|
1169
|
+
}
|
|
1170
|
+
},
|
|
1171
|
+
index
|
|
1172
|
+
);
|
|
1173
|
+
}) });
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
function MkSubHeader({
|
|
1177
|
+
title,
|
|
1178
|
+
subtitle,
|
|
1179
|
+
className,
|
|
1180
|
+
children
|
|
1181
|
+
}) {
|
|
1182
|
+
const baseStyle = "flex items-center justify-between py-1";
|
|
1183
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${baseStyle} ${className}`, children: [
|
|
1184
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1185
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mk-subheader-title", children: title }),
|
|
1186
|
+
subtitle ? /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "mk-subheader-subtitle", children: subtitle }) : null
|
|
1187
|
+
] }),
|
|
1188
|
+
children ? /* @__PURE__ */ jsxRuntime.jsx("div", { children }) : null
|
|
1189
|
+
] });
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
function MkTab({ data, onTabSelect, selectedTab }) {
|
|
1193
|
+
const [selectedTabIndex, setSelectedTabIndex] = react.useState(
|
|
1194
|
+
selectedTab && selectedTab < data.length ? selectedTab : 0
|
|
1195
|
+
);
|
|
1196
|
+
const baseStyle = "w-full p-[2px] flex flex-row gap-1 bg-neutral-100 rounded-[7px]";
|
|
1197
|
+
const tabStyle = "px-[10px] py-[5px] rounded-[5px] hover:bg-neutral-200 cursor-pointer transition-all duration-300 flex-1 sm:flex-none flex items-center justify-center border border-transparent";
|
|
1198
|
+
const selectedTabStyle = "bg-[var(--surface-level1)] border-[var(--border-default)]";
|
|
1199
|
+
const handleSelect = (tabIndex) => {
|
|
1200
|
+
onTabSelect?.(tabIndex);
|
|
1201
|
+
setSelectedTabIndex(tabIndex);
|
|
1202
|
+
};
|
|
1203
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: baseStyle, children: data.map((item, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1204
|
+
"button",
|
|
1205
|
+
{
|
|
1206
|
+
className: `${tabStyle} ${selectedTabIndex == i ? selectedTabStyle : ""}`,
|
|
1207
|
+
onClick: () => handleSelect(i),
|
|
1208
|
+
type: "button",
|
|
1209
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mk-label", children: item })
|
|
1210
|
+
},
|
|
1211
|
+
i
|
|
1212
|
+
)) });
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
function MkTag({ data, onRemove, className }) {
|
|
1216
|
+
const baseStyle = "w-full p-[2px] flex flex-row gap-1";
|
|
1217
|
+
const tagStyle = [
|
|
1218
|
+
"flex items-center justify-center",
|
|
1219
|
+
"px-[10px] py-[5px] rounded-[5px] flex-1 sm:flex-none gap-2",
|
|
1220
|
+
"cursor-pointer transition-all duration-300",
|
|
1221
|
+
"bg-[var(--surface-level1)] hover:bg-neutral-200",
|
|
1222
|
+
"border border-[var(--border-default)]"
|
|
1223
|
+
].join(" ");
|
|
1224
|
+
const handleRemove = (id) => (e) => {
|
|
1225
|
+
e.stopPropagation();
|
|
1226
|
+
if (onRemove) {
|
|
1227
|
+
onRemove(id);
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${baseStyle} ${className}`, children: data.map((tag) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${tagStyle}`, children: [
|
|
1231
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mk-label", children: tag.label }),
|
|
1232
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1233
|
+
MkButton,
|
|
1234
|
+
{
|
|
1235
|
+
iconOnly: true,
|
|
1236
|
+
iconName: "x",
|
|
1237
|
+
variant: "transparent",
|
|
1238
|
+
onClick: handleRemove(tag.id)
|
|
1239
|
+
}
|
|
1240
|
+
)
|
|
1241
|
+
] })) });
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
function MkTextInput({
|
|
1245
|
+
value,
|
|
1246
|
+
placeholder,
|
|
1247
|
+
size = "md",
|
|
1248
|
+
className,
|
|
1249
|
+
...props
|
|
1250
|
+
}) {
|
|
1251
|
+
const baseStyle = [
|
|
1252
|
+
"bg-neutral-50 rounded-[7px] border-2 border-neutral-300",
|
|
1253
|
+
"text-neutral-800",
|
|
1254
|
+
"disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-600",
|
|
1255
|
+
"enabled:focus:border-primary-300 enabled:focus:outline-none enabled:focus:ring-0focus:ring-offset-0",
|
|
1256
|
+
"enabled:hover:shadow-[0_0_4px_var(--color-primary-400)] enabled:hover:border-primary-300",
|
|
1257
|
+
"transition-shadow transition-border duration-300"
|
|
1258
|
+
].join(" ");
|
|
1259
|
+
const sizeStyles = {
|
|
1260
|
+
sm: "px-3 py-1 text-sm font-[14px]",
|
|
1261
|
+
md: 'px-4 py-2 text-md font-[16px]"',
|
|
1262
|
+
lg: 'px-6 py-3 text-lg font-[18px]"'
|
|
1263
|
+
};
|
|
1264
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1265
|
+
"input",
|
|
1266
|
+
{
|
|
1267
|
+
className: `${baseStyle} ${sizeStyles[size]} ${className}`,
|
|
1268
|
+
placeholder,
|
|
1269
|
+
value,
|
|
1270
|
+
...props
|
|
1271
|
+
}
|
|
1272
|
+
);
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
function MkTimeInput({
|
|
1276
|
+
value,
|
|
1277
|
+
placeholder = "00:00",
|
|
1278
|
+
size = "md",
|
|
1279
|
+
className,
|
|
1280
|
+
onChange,
|
|
1281
|
+
...props
|
|
1282
|
+
}) {
|
|
1283
|
+
const [displayValue, setDisplayValue] = react.useState(value || "");
|
|
1284
|
+
react.useEffect(() => {
|
|
1285
|
+
if (value !== void 0) {
|
|
1286
|
+
setDisplayValue(value);
|
|
1287
|
+
}
|
|
1288
|
+
}, [value]);
|
|
1289
|
+
const applyMask = react.useCallback((inputValue) => {
|
|
1290
|
+
const digits = inputValue.replace(/\D/g, "");
|
|
1291
|
+
return digits.substring(0, 2) + ":" + digits.substring(2);
|
|
1292
|
+
}, []);
|
|
1293
|
+
const handleChange = react.useCallback(
|
|
1294
|
+
(e) => {
|
|
1295
|
+
const maskedValue = applyMask(e.target.value);
|
|
1296
|
+
setDisplayValue(maskedValue);
|
|
1297
|
+
if (onChange) {
|
|
1298
|
+
const syntheticEvent = {
|
|
1299
|
+
...e,
|
|
1300
|
+
target: { ...e.target, value: maskedValue }
|
|
1301
|
+
};
|
|
1302
|
+
onChange(syntheticEvent);
|
|
1303
|
+
}
|
|
1304
|
+
},
|
|
1305
|
+
[applyMask, onChange]
|
|
1306
|
+
);
|
|
1307
|
+
const baseStyle = [
|
|
1308
|
+
"bg-neutral-50 rounded-[7px] border-2 border-neutral-300",
|
|
1309
|
+
"text-neutral-800",
|
|
1310
|
+
"disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-600",
|
|
1311
|
+
"enabled:focus:border-primary-300 enabled:focus:outline-none enabled:focus:ring-0focus:ring-offset-0",
|
|
1312
|
+
"enabled:hover:shadow-[0_0_4px_var(--color-primary-400)] enabled:hover:border-primary-300",
|
|
1313
|
+
"transition-shadow transition-border duration-300"
|
|
1314
|
+
].join(" ");
|
|
1315
|
+
const sizeStyles = {
|
|
1316
|
+
sm: "pl-9 pr-3 py-1 text-sm font-[14px]",
|
|
1317
|
+
md: "pl-10 pr-4 py-2 text-md font-[16px]",
|
|
1318
|
+
lg: "pl-12 pr-6 py-3 text-lg font-[18px]"
|
|
1319
|
+
};
|
|
1320
|
+
const iconSizes = {
|
|
1321
|
+
sm: 16,
|
|
1322
|
+
md: 18,
|
|
1323
|
+
lg: 20
|
|
1324
|
+
};
|
|
1325
|
+
const iconPositions = {
|
|
1326
|
+
sm: "left-2.5",
|
|
1327
|
+
md: "left-3",
|
|
1328
|
+
lg: "left-4"
|
|
1329
|
+
};
|
|
1330
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
1331
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1332
|
+
lucideReact.Clock,
|
|
1333
|
+
{
|
|
1334
|
+
className: `absolute top-1/2 -translate-y-1/2 ${iconPositions[size]} text-neutral-500`,
|
|
1335
|
+
size: iconSizes[size],
|
|
1336
|
+
"aria-hidden": "true"
|
|
1337
|
+
}
|
|
1338
|
+
),
|
|
1339
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1340
|
+
"input",
|
|
1341
|
+
{
|
|
1342
|
+
type: "text",
|
|
1343
|
+
className: `${baseStyle} ${sizeStyles[size]} ${className || ""}`,
|
|
1344
|
+
placeholder,
|
|
1345
|
+
value: value !== void 0 ? value : displayValue,
|
|
1346
|
+
onChange: handleChange,
|
|
1347
|
+
maxLength: 5,
|
|
1348
|
+
...props
|
|
1349
|
+
}
|
|
1350
|
+
)
|
|
1351
|
+
] });
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
function MkTotalizers({ className }) {
|
|
1355
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className });
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
function MkTopBar({ rightMenu, className, children }) {
|
|
1359
|
+
const baseStyle = "w-full flex justify-between items-center p-3";
|
|
1360
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: `${baseStyle} ${className}`, children: [
|
|
1361
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1362
|
+
"button",
|
|
1363
|
+
{
|
|
1364
|
+
className: "w-[45px] h-[45px] flex items-center justify-center transition-colors duration-200 hover:bg-neutral-100 rounded-full",
|
|
1365
|
+
"aria-label": "Menu",
|
|
1366
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { size: 30, color: "var(--color-neutral-700)" })
|
|
1367
|
+
}
|
|
1368
|
+
),
|
|
1369
|
+
children ? children : null,
|
|
1370
|
+
rightMenu ? rightMenu : null
|
|
1371
|
+
] });
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
function MkUserAvatar({ initials }) {
|
|
1375
|
+
const baseStyle = [
|
|
1376
|
+
"w-[40px] h-[40px] min-w-[40px] min-h-[40px] p-1",
|
|
1377
|
+
"transition-all duration-300 cursor-pointer duration-200",
|
|
1378
|
+
"bg-neutral-100 hover:bg-neutral-200",
|
|
1379
|
+
"border-2 border-neutral-300 rounded-full",
|
|
1380
|
+
"flex items-center justify-center"
|
|
1381
|
+
].join(" ");
|
|
1382
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: baseStyle, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-neutral-700 font-bold text-base", children: initials.substring(0, 2) }) });
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
exports.MkAlert = MkAlert;
|
|
1386
|
+
exports.MkBarChart = MkBarChart;
|
|
1387
|
+
exports.MkBarHistoryChart = MkBarHistoryChart;
|
|
1388
|
+
exports.MkBottomSheet = MkBottomSheet;
|
|
79
1389
|
exports.MkButton = MkButton;
|
|
1390
|
+
exports.MkCard = MkCard;
|
|
1391
|
+
exports.MkCheckbox = MkCheckbox;
|
|
1392
|
+
exports.MkComboBox = MkComboBox;
|
|
1393
|
+
exports.MkDateInput = MkDateInput;
|
|
1394
|
+
exports.MkDetailedList = MkDetailedList;
|
|
1395
|
+
exports.MkDivider = MkDivider;
|
|
1396
|
+
exports.MkDonutChart = MkDonutChart;
|
|
1397
|
+
exports.MkHeader = MkHeader;
|
|
1398
|
+
exports.MkHorizontalBarChart = MkHorizontalBarChart;
|
|
1399
|
+
exports.MkIconBadge = MkIconBadge;
|
|
1400
|
+
exports.MkLineChart = MkLineChart;
|
|
1401
|
+
exports.MkList = MkList;
|
|
1402
|
+
exports.MkMain = MkMain;
|
|
1403
|
+
exports.MkModal = MkModal;
|
|
1404
|
+
exports.MkNavItem = MkNavItem;
|
|
1405
|
+
exports.MkNavList = MkNavList;
|
|
1406
|
+
exports.MkNumberInput = MkNumberInput;
|
|
1407
|
+
exports.MkPanel = MkPanel;
|
|
1408
|
+
exports.MkProgressBar = MkProgressBar;
|
|
1409
|
+
exports.MkRadioButton = MkRadioButton;
|
|
1410
|
+
exports.MkSectionHeader = MkSectionHeader;
|
|
1411
|
+
exports.MkStackedBarChart = MkStackedBarChart;
|
|
1412
|
+
exports.MkStatusIndicator = MkStatusIndicator;
|
|
1413
|
+
exports.MkStepper = MkStepper;
|
|
1414
|
+
exports.MkSubHeader = MkSubHeader;
|
|
1415
|
+
exports.MkTab = MkTab;
|
|
1416
|
+
exports.MkTag = MkTag;
|
|
1417
|
+
exports.MkTextInput = MkTextInput;
|
|
1418
|
+
exports.MkTimeInput = MkTimeInput;
|
|
1419
|
+
exports.MkTopBar = MkTopBar;
|
|
1420
|
+
exports.MkTotalizers = MkTotalizers;
|
|
1421
|
+
exports.MkUserAvatar = MkUserAvatar;
|