@mahatisystems/mahati-ui-components 0.1.2 → 0.2.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.css +776 -85
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +316 -35
- package/dist/index.d.ts +316 -35
- package/dist/index.js +2035 -249
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2001 -227
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -7,6 +7,9 @@ function _array_like_to_array(arr, len) {
|
|
|
7
7
|
function _array_with_holes(arr) {
|
|
8
8
|
if (Array.isArray(arr)) return arr;
|
|
9
9
|
}
|
|
10
|
+
function _array_without_holes(arr) {
|
|
11
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
12
|
+
}
|
|
10
13
|
function _define_property(obj, key, value) {
|
|
11
14
|
if (key in obj) {
|
|
12
15
|
Object.defineProperty(obj, key, {
|
|
@@ -27,6 +30,9 @@ function _instanceof(left, right) {
|
|
|
27
30
|
return left instanceof right;
|
|
28
31
|
}
|
|
29
32
|
}
|
|
33
|
+
function _iterable_to_array(iter) {
|
|
34
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
35
|
+
}
|
|
30
36
|
function _iterable_to_array_limit(arr, i) {
|
|
31
37
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
32
38
|
if (_i == null) return;
|
|
@@ -54,6 +60,9 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
54
60
|
function _non_iterable_rest() {
|
|
55
61
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
56
62
|
}
|
|
63
|
+
function _non_iterable_spread() {
|
|
64
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
65
|
+
}
|
|
57
66
|
function _object_spread(target) {
|
|
58
67
|
for(var i = 1; i < arguments.length; i++){
|
|
59
68
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -123,6 +132,9 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
123
132
|
function _sliced_to_array(arr, i) {
|
|
124
133
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
125
134
|
}
|
|
135
|
+
function _to_consumable_array(arr) {
|
|
136
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
137
|
+
}
|
|
126
138
|
function _type_of(obj) {
|
|
127
139
|
"@swc/helpers - typeof";
|
|
128
140
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
@@ -135,6 +147,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
135
147
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
136
148
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
137
149
|
}
|
|
150
|
+
var _import_chart_Chart;
|
|
138
151
|
var __create = Object.create;
|
|
139
152
|
var __defProp = Object.defineProperty;
|
|
140
153
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -199,9 +212,15 @@ __export(index_exports, {
|
|
|
199
212
|
MahatiButton: function() {
|
|
200
213
|
return Button;
|
|
201
214
|
},
|
|
215
|
+
MahatiCalendar: function() {
|
|
216
|
+
return Calendar;
|
|
217
|
+
},
|
|
202
218
|
MahatiCard: function() {
|
|
203
219
|
return Card;
|
|
204
220
|
},
|
|
221
|
+
MahatiChart: function() {
|
|
222
|
+
return ChartInterface;
|
|
223
|
+
},
|
|
205
224
|
MahatiDropdown: function() {
|
|
206
225
|
return Dropdown;
|
|
207
226
|
},
|
|
@@ -217,11 +236,14 @@ __export(index_exports, {
|
|
|
217
236
|
MahatiTabbedInterface: function() {
|
|
218
237
|
return TabbedInterface;
|
|
219
238
|
},
|
|
239
|
+
MahatiTabbedInterfaceTailwind: function() {
|
|
240
|
+
return TabbedInterface2;
|
|
241
|
+
},
|
|
220
242
|
MahatiTable: function() {
|
|
221
243
|
return Table;
|
|
222
244
|
},
|
|
223
245
|
MahatiTableTailwind: function() {
|
|
224
|
-
return
|
|
246
|
+
return Table2;
|
|
225
247
|
},
|
|
226
248
|
MahatiTooltip: function() {
|
|
227
249
|
return Tooltip;
|
|
@@ -250,11 +272,13 @@ var buttonVariants = (0, import_class_variance_authority.cva)(// Use regular Tai
|
|
|
250
272
|
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
251
273
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
252
274
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
253
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
275
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
276
|
+
danger: "hover:text-white hover:bg-primary/90"
|
|
254
277
|
},
|
|
255
278
|
size: {
|
|
256
279
|
default: "h-10 px-4 py-2",
|
|
257
280
|
sm: "h-9 rounded-md px-3",
|
|
281
|
+
md: "rounded-md px-2",
|
|
258
282
|
lg: "h-11 rounded-md px-8",
|
|
259
283
|
icon: "h-10 w-10"
|
|
260
284
|
}
|
|
@@ -281,33 +305,11 @@ var Button = import_react.default.forwardRef(function(_param, ref) {
|
|
|
281
305
|
}, props));
|
|
282
306
|
});
|
|
283
307
|
Button.displayName = "Button";
|
|
284
|
-
// src/components/
|
|
285
|
-
var
|
|
286
|
-
var import_class_variance_authority2 = require("class-variance-authority");
|
|
308
|
+
// src/components/card.tsx
|
|
309
|
+
var import_react2 = __toESM(require("react"));
|
|
287
310
|
var import_lucide_react = require("lucide-react");
|
|
288
|
-
var
|
|
289
|
-
|
|
290
|
-
variant: {
|
|
291
|
-
default: "bg-white text-slate-800 border border-slate-200 hover:shadow-lg",
|
|
292
|
-
elevated: "bg-white shadow-md border border-transparent",
|
|
293
|
-
outline: "bg-slate-50 border border-slate-200",
|
|
294
|
-
subtle: "bg-slate-50 border border-transparent",
|
|
295
|
-
figma: ""
|
|
296
|
-
},
|
|
297
|
-
size: {
|
|
298
|
-
default: "p-6 rounded-[14px]",
|
|
299
|
-
sm: "p-4",
|
|
300
|
-
lg: "p-8",
|
|
301
|
-
figma: "w-[280px] p-6"
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
defaultVariants: {
|
|
305
|
-
variant: "default",
|
|
306
|
-
size: "default"
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
var Card = React2.forwardRef(function(_param, ref) {
|
|
310
|
-
var title = _param.title, cardContent = _param.cardContent, cardBackContent = _param.cardBackContent, _param_collapsible = _param.collapsible, collapsible = _param_collapsible === void 0 ? false : _param_collapsible, _param_flippable = _param.flippable, flippable = _param_flippable === void 0 ? false : _param_flippable, backgroundColor = _param.backgroundColor, borderRadius = _param.borderRadius, variant = _param.variant, size = _param.size, className = _param.className, children = _param.children, _param_defaultOpen = _param.defaultOpen, defaultOpen = _param_defaultOpen === void 0 ? true : _param_defaultOpen, onFlip = _param.onFlip, style = _param.style, props = _object_without_properties(_param, [
|
|
311
|
+
var Card = import_react2.default.forwardRef(function(_param, ref) {
|
|
312
|
+
var title = _param.title, cardContent = _param.cardContent, cardBackContent = _param.cardBackContent, _param_collapsible = _param.collapsible, collapsible = _param_collapsible === void 0 ? false : _param_collapsible, _param_flippable = _param.flippable, flippable = _param_flippable === void 0 ? false : _param_flippable, backgroundColor = _param.backgroundColor, borderRadius = _param.borderRadius, _param_variant = _param.variant, variant = _param_variant === void 0 ? "default" : _param_variant, _param_size = _param.size, size = _param_size === void 0 ? "default" : _param_size, _param_className = _param.className, className = _param_className === void 0 ? "" : _param_className, children = _param.children, _param_defaultOpen = _param.defaultOpen, defaultOpen = _param_defaultOpen === void 0 ? true : _param_defaultOpen, onFlip = _param.onFlip, style = _param.style, props = _object_without_properties(_param, [
|
|
311
313
|
"title",
|
|
312
314
|
"cardContent",
|
|
313
315
|
"cardBackContent",
|
|
@@ -323,9 +325,28 @@ var Card = React2.forwardRef(function(_param, ref) {
|
|
|
323
325
|
"onFlip",
|
|
324
326
|
"style"
|
|
325
327
|
]);
|
|
326
|
-
var
|
|
327
|
-
var
|
|
328
|
-
var contentId =
|
|
328
|
+
var _ref = _sliced_to_array((0, import_react2.useState)(defaultOpen), 2), open = _ref[0], setOpen = _ref[1];
|
|
329
|
+
var _ref1 = _sliced_to_array((0, import_react2.useState)(false), 2), isFlipped = _ref1[0], setIsFlipped = _ref1[1];
|
|
330
|
+
var contentId = import_react2.default.useId();
|
|
331
|
+
var getVariantStyles = function() {
|
|
332
|
+
var variants = {
|
|
333
|
+
default: "bg-white text-slate-800 border border-slate-200 hover:shadow-lg",
|
|
334
|
+
elevated: "bg-white shadow-md border border-transparent",
|
|
335
|
+
outline: "bg-slate-50 border border-slate-200",
|
|
336
|
+
subtle: "bg-slate-50 border border-transparent",
|
|
337
|
+
figma: ""
|
|
338
|
+
};
|
|
339
|
+
return variants[variant];
|
|
340
|
+
};
|
|
341
|
+
var getSizeStyles = function() {
|
|
342
|
+
var sizes = {
|
|
343
|
+
default: "p-6 rounded-[14px]",
|
|
344
|
+
sm: "p-4",
|
|
345
|
+
lg: "p-8",
|
|
346
|
+
figma: "w-[280px] p-6"
|
|
347
|
+
};
|
|
348
|
+
return sizes[size];
|
|
349
|
+
};
|
|
329
350
|
var figmaStyles = variant === "figma" ? _object_spread({
|
|
330
351
|
backgroundColor: backgroundColor || "rgba(77, 175, 131, 0.10)",
|
|
331
352
|
border: "1px solid #1761A3",
|
|
@@ -341,27 +362,21 @@ var Card = React2.forwardRef(function(_param, ref) {
|
|
|
341
362
|
onFlip === null || onFlip === void 0 ? void 0 : onFlip(newFlippedState);
|
|
342
363
|
};
|
|
343
364
|
var mainContent = cardContent || children;
|
|
344
|
-
return /* @__PURE__ */
|
|
345
|
-
className:
|
|
346
|
-
onClick: handleFlip
|
|
347
|
-
}, /* @__PURE__ */
|
|
365
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
366
|
+
className: flippable ? "perspective-[1000px] group" : "",
|
|
367
|
+
onClick: flippable ? handleFlip : void 0
|
|
368
|
+
}, /* @__PURE__ */ import_react2.default.createElement("div", _object_spread_props(_object_spread({
|
|
348
369
|
ref: ref
|
|
349
370
|
}, props), {
|
|
350
371
|
style: figmaStyles,
|
|
351
|
-
className:
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
className: cn(flippable && "[backface-visibility:hidden]")
|
|
358
|
-
}, title && /* @__PURE__ */ React2.createElement("div", {
|
|
359
|
-
className: cn("flex items-center justify-between", {
|
|
360
|
-
"mb-4": open && mainContent
|
|
361
|
-
})
|
|
362
|
-
}, /* @__PURE__ */ React2.createElement("h4", {
|
|
372
|
+
className: "\n rounded-[14px] transition-all duration-300 shadow-[0_4px_4px_0_rgba(0,0,0,0.25)]\n ".concat(getVariantStyles(), "\n ").concat(getSizeStyles(), "\n ").concat(flippable ? "relative transition-transform duration-700 [transform-style:preserve-3d]" : "", "\n ").concat(flippable && isFlipped ? "[transform:rotateY(180deg)]" : "", "\n ").concat(className, "\n ")
|
|
373
|
+
}), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
374
|
+
className: flippable ? "[backface-visibility:hidden]" : ""
|
|
375
|
+
}, title && /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
376
|
+
className: "flex items-center justify-between ".concat(open && mainContent ? "mb-4" : "")
|
|
377
|
+
}, /* @__PURE__ */ import_react2.default.createElement("h4", {
|
|
363
378
|
className: "text-xl font-semibold text-slate-800"
|
|
364
|
-
}, title), collapsible && /* @__PURE__ */
|
|
379
|
+
}, title), collapsible && /* @__PURE__ */ import_react2.default.createElement("button", {
|
|
365
380
|
type: "button",
|
|
366
381
|
style: {
|
|
367
382
|
backgroundColor: "#1761A3"
|
|
@@ -376,26 +391,35 @@ var Card = React2.forwardRef(function(_param, ref) {
|
|
|
376
391
|
"aria-label": open ? "Hide content" : "Show content",
|
|
377
392
|
"aria-expanded": open,
|
|
378
393
|
"aria-controls": contentId
|
|
379
|
-
}, open ? /* @__PURE__ */
|
|
394
|
+
}, open ? /* @__PURE__ */ import_react2.default.createElement(import_lucide_react.ChevronUp, {
|
|
380
395
|
className: "w-5 h-5 text-white"
|
|
381
|
-
}) : /* @__PURE__ */
|
|
396
|
+
}) : /* @__PURE__ */ import_react2.default.createElement(import_lucide_react.ChevronDown, {
|
|
382
397
|
className: "w-5 h-5 text-white"
|
|
383
|
-
}))), mainContent && /* @__PURE__ */
|
|
398
|
+
}))), mainContent && /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
384
399
|
id: contentId,
|
|
385
|
-
className:
|
|
386
|
-
}, /* @__PURE__ */
|
|
400
|
+
className: "\n grid overflow-hidden transition-all duration-500 ease-in-out\n ".concat(open ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0", "\n ")
|
|
401
|
+
}, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
387
402
|
className: "overflow-hidden"
|
|
388
|
-
}, mainContent))), flippable && cardBackContent && /* @__PURE__ */
|
|
403
|
+
}, mainContent))), flippable && cardBackContent && /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
389
404
|
className: "absolute inset-0 w-full h-full p-6 [backface-visibility:hidden] [transform:rotateY(180deg)]"
|
|
390
405
|
}, cardBackContent)));
|
|
391
406
|
});
|
|
392
407
|
Card.displayName = "Card";
|
|
393
408
|
// src/components/Modal.tsx
|
|
394
|
-
var
|
|
409
|
+
var import_react3 = __toESM(require("react"));
|
|
395
410
|
var import_lucide_react2 = require("lucide-react");
|
|
411
|
+
var MODAL_WIDTH_MAP = {
|
|
412
|
+
sm: "360px",
|
|
413
|
+
default: "562px",
|
|
414
|
+
md: "720px",
|
|
415
|
+
lg: "760px",
|
|
416
|
+
xl: "800px"
|
|
417
|
+
};
|
|
396
418
|
function Modal(param) {
|
|
397
|
-
var isOpen = param.isOpen, onClose = param.onClose, title = param.title, subtitle = param.subtitle, children = param.children, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className, primaryAction = param.primaryAction, secondaryAction = param.secondaryAction, headerIcon = param.headerIcon, _param_showDivider = param.showDivider, showDivider = _param_showDivider === void 0 ? true : _param_showDivider;
|
|
398
|
-
|
|
419
|
+
var isOpen = param.isOpen, onClose = param.onClose, title = param.title, subtitle = param.subtitle, children = param.children, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className, customWidth = param.width, height = param.height, margin = param.margin, primaryAction = param.primaryAction, secondaryAction = param.secondaryAction, headerIcon = param.headerIcon, _param_showDivider = param.showDivider, showDivider = _param_showDivider === void 0 ? true : _param_showDivider, _param_position = param.position, position = _param_position === void 0 ? "center" : _param_position, _param_size = param.size, size = _param_size === void 0 ? "default" : _param_size;
|
|
420
|
+
var _ref;
|
|
421
|
+
var width = (_ref = customWidth !== null && customWidth !== void 0 ? customWidth : MODAL_WIDTH_MAP[size]) !== null && _ref !== void 0 ? _ref : MODAL_WIDTH_MAP.default;
|
|
422
|
+
(0, import_react3.useEffect)(function() {
|
|
399
423
|
if (!isOpen) return;
|
|
400
424
|
var onKey = function(e) {
|
|
401
425
|
return e.key === "Escape" && onClose();
|
|
@@ -409,83 +433,235 @@ function Modal(param) {
|
|
|
409
433
|
onClose
|
|
410
434
|
]);
|
|
411
435
|
if (!isOpen) return null;
|
|
436
|
+
var getPositionStyles = function() {
|
|
437
|
+
switch(position || "center"){
|
|
438
|
+
// Ensure position is always a string for the switch
|
|
439
|
+
case "center":
|
|
440
|
+
return {
|
|
441
|
+
alignItems: "center",
|
|
442
|
+
justifyContent: "center"
|
|
443
|
+
};
|
|
444
|
+
case "top-left":
|
|
445
|
+
return {
|
|
446
|
+
alignItems: "flex-start",
|
|
447
|
+
justifyContent: "flex-start"
|
|
448
|
+
};
|
|
449
|
+
case "top-right":
|
|
450
|
+
return {
|
|
451
|
+
alignItems: "flex-start",
|
|
452
|
+
justifyContent: "flex-end"
|
|
453
|
+
};
|
|
454
|
+
case "top-center":
|
|
455
|
+
return {
|
|
456
|
+
alignItems: "flex-start",
|
|
457
|
+
justifyContent: "center"
|
|
458
|
+
};
|
|
459
|
+
case "bottom-left":
|
|
460
|
+
return {
|
|
461
|
+
alignItems: "flex-end",
|
|
462
|
+
justifyContent: "flex-start"
|
|
463
|
+
};
|
|
464
|
+
case "bottom-right":
|
|
465
|
+
return {
|
|
466
|
+
alignItems: "flex-end",
|
|
467
|
+
justifyContent: "flex-end"
|
|
468
|
+
};
|
|
469
|
+
case "bottom-center":
|
|
470
|
+
return {
|
|
471
|
+
alignItems: "flex-end",
|
|
472
|
+
justifyContent: "center"
|
|
473
|
+
};
|
|
474
|
+
case "center-left":
|
|
475
|
+
return {
|
|
476
|
+
alignItems: "center",
|
|
477
|
+
justifyContent: "flex-start"
|
|
478
|
+
};
|
|
479
|
+
case "center-right":
|
|
480
|
+
return {
|
|
481
|
+
alignItems: "center",
|
|
482
|
+
justifyContent: "flex-end"
|
|
483
|
+
};
|
|
484
|
+
default:
|
|
485
|
+
return {
|
|
486
|
+
alignItems: "center",
|
|
487
|
+
justifyContent: "center"
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
var borderRadiusClasses = {
|
|
492
|
+
center: "rounded-[8px]",
|
|
493
|
+
"top-left": "rounded-tr-[8px] rounded-br-[8px] rounded-bl-[8px]",
|
|
494
|
+
"top-right": "rounded-tl-[8px] rounded-bl-[8px] rounded-br-[8px]",
|
|
495
|
+
"top-center": "rounded-b-[8px]",
|
|
496
|
+
"bottom-left": "rounded-tr-[8px] rounded-tl-[8px] rounded-br-[8px]",
|
|
497
|
+
"bottom-right": "rounded-tl-[8px] rounded-tr-[8px] rounded-bl-[8px]",
|
|
498
|
+
"bottom-center": "rounded-t-[8px]",
|
|
499
|
+
"center-left": "rounded-r-[8px]",
|
|
500
|
+
"center-right": "rounded-l-[8px]"
|
|
501
|
+
};
|
|
412
502
|
var _secondaryAction_label, _primaryAction_label;
|
|
413
|
-
return /* @__PURE__ */
|
|
414
|
-
className: "fixed inset-0 bg-black/
|
|
415
|
-
onClick: onClose
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
503
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
504
|
+
className: "fixed inset-0 bg-black/40",
|
|
505
|
+
onClick: onClose,
|
|
506
|
+
"aria-hidden": "true"
|
|
507
|
+
}), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
508
|
+
className: "fixed flex p-4",
|
|
509
|
+
style: _object_spread({
|
|
510
|
+
inset: "0px",
|
|
511
|
+
zIndex: 9999,
|
|
512
|
+
pointerEvents: "none"
|
|
513
|
+
}, getPositionStyles())
|
|
514
|
+
}, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
423
515
|
role: "dialog",
|
|
424
516
|
"aria-modal": "true",
|
|
425
|
-
className: "relative w-[562px] shrink-0 bg-white rounded-[14px] shadow-xl pb-[10px] pt-5 transform transition-all",
|
|
426
517
|
onClick: function(e) {
|
|
427
518
|
return e.stopPropagation();
|
|
519
|
+
},
|
|
520
|
+
className: "\n relative bg-white\n shadow-2xl\n flex flex-col\n ".concat(position.includes("left") || position.includes("right") ? "" : "max-h-[90vh]", "\n ").concat(className, "\n "),
|
|
521
|
+
style: {
|
|
522
|
+
width: width,
|
|
523
|
+
height: height !== null && height !== void 0 ? height : position.includes("left") || position.includes("right") ? "90vh" : "auto",
|
|
524
|
+
pointerEvents: "auto",
|
|
525
|
+
margin: margin,
|
|
526
|
+
boxShadow: "0px 4px 24px 0px rgba(0, 0, 0, 0.15)",
|
|
527
|
+
border: "1px solid #E5E7EB"
|
|
428
528
|
}
|
|
429
|
-
}, /* @__PURE__ */
|
|
529
|
+
}, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
530
|
+
className: "px-6 py-4 pb-4 shrink-0 flex items-center justify-between border-b border-gray-200"
|
|
531
|
+
}, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
532
|
+
className: "flex items-center gap-3"
|
|
533
|
+
}, headerIcon && /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
534
|
+
className: "flex shrink-0 items-center justify-center"
|
|
535
|
+
}, headerIcon), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
536
|
+
className: "flex-1"
|
|
537
|
+
}, title && /* @__PURE__ */ import_react3.default.createElement("h3", {
|
|
538
|
+
className: "text-[#333333] font-['Poppins'] text-[16px] font-semibold leading-normal"
|
|
539
|
+
}, title), subtitle && /* @__PURE__ */ import_react3.default.createElement("p", {
|
|
540
|
+
className: "mt-1 text-sm text-gray-500"
|
|
541
|
+
}, subtitle))), /* @__PURE__ */ import_react3.default.createElement("button", {
|
|
430
542
|
onClick: onClose,
|
|
431
543
|
"aria-label": "Close dialog",
|
|
432
|
-
className: "
|
|
433
|
-
}, /* @__PURE__ */
|
|
434
|
-
size: 20
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}, headerIcon !== null && headerIcon !== void 0 ? headerIcon : /* @__PURE__ */ import_react2.default.createElement("span", {
|
|
442
|
-
className: "text-sm"
|
|
443
|
-
})), /* @__PURE__ */ import_react2.default.createElement("div", null, title && /* @__PURE__ */ import_react2.default.createElement("h3", {
|
|
444
|
-
className: "text-[20px] font-semibold text-slate-900 leading-6"
|
|
445
|
-
}, title), subtitle && /* @__PURE__ */ import_react2.default.createElement("p", {
|
|
446
|
-
className: "mt-1 text-sm text-slate-500"
|
|
447
|
-
}, subtitle)))), showDivider && /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
448
|
-
className: "mx-6 h-px shrink-0 [background:linear-gradient(90deg,#1761A3_0%,#4DAF83_100%)] rounded-lg"
|
|
449
|
-
}), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
450
|
-
className: "px-6"
|
|
451
|
-
}, children), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
452
|
-
className: "mt-6 mx-6 h-px shrink-0 bg-[linear-gradient(90deg,#1761A3_0%,#4DAF83_100%)] rounded-lg"
|
|
453
|
-
}), (primaryAction || secondaryAction) && /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
454
|
-
className: "pt-4 flex justify-end gap-3 px-6 pb-4",
|
|
455
|
-
style: {
|
|
456
|
-
float: "right",
|
|
457
|
-
marginBottom: "10px"
|
|
458
|
-
}
|
|
459
|
-
}, secondaryAction && /* @__PURE__ */ import_react2.default.createElement(Button, {
|
|
544
|
+
className: "text-gray-400 hover:text-gray-600 transition-colors"
|
|
545
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_lucide_react2.X, {
|
|
546
|
+
size: 20,
|
|
547
|
+
strokeWidth: 2
|
|
548
|
+
}))), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
549
|
+
className: "flex-grow overflow-y-auto"
|
|
550
|
+
}, children), (primaryAction || secondaryAction) && /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
551
|
+
className: "px-6 py-4 flex justify-center gap-3 shrink-0 border-t border-gray-200"
|
|
552
|
+
}, secondaryAction && /* @__PURE__ */ import_react3.default.createElement("button", {
|
|
460
553
|
onClick: secondaryAction.onClick,
|
|
461
|
-
|
|
554
|
+
className: "min-w-[140px] h-[36px] px-4 rounded-md border border-[#1761A3] bg-white text-[#1761A3] font-['Poppins'] text-[14px] font-medium hover:bg-gray-50 transition-colors",
|
|
462
555
|
type: "button"
|
|
463
|
-
}, (_secondaryAction_label = secondaryAction.label) !== null && _secondaryAction_label !== void 0 ? _secondaryAction_label : "Cancel"), primaryAction && /* @__PURE__ */
|
|
556
|
+
}, (_secondaryAction_label = secondaryAction.label) !== null && _secondaryAction_label !== void 0 ? _secondaryAction_label : "Cancel"), primaryAction && /* @__PURE__ */ import_react3.default.createElement("button", {
|
|
464
557
|
onClick: primaryAction.onClick,
|
|
465
558
|
disabled: primaryAction.disabled,
|
|
466
|
-
|
|
467
|
-
className: primaryAction.disabled ? "bg-blue-300 cursor-not-allowed" : "default",
|
|
559
|
+
className: "min-w-[140px] h-[36px] px-4 rounded-md font-['Poppins'] text-[14px] font-medium transition-colors ".concat(primaryAction.disabled ? "bg-blue-300 text-white cursor-not-allowed" : "bg-[#1761A3] text-white hover:bg-[#134a7a]"),
|
|
468
560
|
type: "button"
|
|
469
|
-
}, (_primaryAction_label = primaryAction.label) !== null && _primaryAction_label !== void 0 ? _primaryAction_label : "Save")))))
|
|
561
|
+
}, (_primaryAction_label = primaryAction.label) !== null && _primaryAction_label !== void 0 ? _primaryAction_label : "Save")))));
|
|
470
562
|
}
|
|
471
563
|
Modal.displayName = "Modal";
|
|
564
|
+
// src/components/ChartInterface.tsx
|
|
565
|
+
var import_react4 = __toESM(require("react"));
|
|
566
|
+
var import_chart = require("chart.js");
|
|
567
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
568
|
+
(_import_chart_Chart = import_chart.Chart).register.apply(_import_chart_Chart, _to_consumable_array(import_chart.registerables));
|
|
569
|
+
var cn2 = function() {
|
|
570
|
+
for(var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++){
|
|
571
|
+
classes[_key] = arguments[_key];
|
|
572
|
+
}
|
|
573
|
+
return classes.filter(Boolean).join(" ");
|
|
574
|
+
};
|
|
575
|
+
var chartVariants = (0, import_class_variance_authority2.cva)("rounded-lg transition-all", {
|
|
576
|
+
variants: {
|
|
577
|
+
variant: {
|
|
578
|
+
default: "bg-white border border-gray-200 p-4",
|
|
579
|
+
filled: "bg-gray-50 border border-gray-300 p-4",
|
|
580
|
+
elevated: "bg-white shadow-lg p-4",
|
|
581
|
+
flat: "bg-transparent p-0",
|
|
582
|
+
card: "bg-white border border-gray-200 shadow-sm p-6"
|
|
583
|
+
},
|
|
584
|
+
size: {
|
|
585
|
+
sm: "h-48",
|
|
586
|
+
default: "h-64",
|
|
587
|
+
lg: "h-96",
|
|
588
|
+
xl: "h-[500px]"
|
|
589
|
+
}
|
|
590
|
+
},
|
|
591
|
+
defaultVariants: {
|
|
592
|
+
variant: "default",
|
|
593
|
+
size: "default"
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
var ChartInterface = import_react4.default.forwardRef(function(_param, ref) {
|
|
597
|
+
var _param_type = _param.type, type = _param_type === void 0 ? "line" : _param_type, data = _param.data, _param_options = _param.options, options = _param_options === void 0 ? {} : _param_options, variant = _param.variant, size = _param.size, className = _param.className, props = _object_without_properties(_param, [
|
|
598
|
+
"type",
|
|
599
|
+
"data",
|
|
600
|
+
"options",
|
|
601
|
+
"variant",
|
|
602
|
+
"size",
|
|
603
|
+
"className"
|
|
604
|
+
]);
|
|
605
|
+
var canvasRef = (0, import_react4.useRef)(null);
|
|
606
|
+
var chartInstanceRef = (0, import_react4.useRef)(null);
|
|
607
|
+
(0, import_react4.useEffect)(function() {
|
|
608
|
+
var _canvasRef_current;
|
|
609
|
+
var ctx = (_canvasRef_current = canvasRef.current) === null || _canvasRef_current === void 0 ? void 0 : _canvasRef_current.getContext("2d");
|
|
610
|
+
if (!ctx) return;
|
|
611
|
+
if (chartInstanceRef.current) {
|
|
612
|
+
chartInstanceRef.current.destroy();
|
|
613
|
+
chartInstanceRef.current = null;
|
|
614
|
+
}
|
|
615
|
+
var safeData = JSON.parse(JSON.stringify(data));
|
|
616
|
+
var safeOptions = JSON.parse(JSON.stringify(options));
|
|
617
|
+
chartInstanceRef.current = new import_chart.Chart(ctx, {
|
|
618
|
+
type: type,
|
|
619
|
+
data: safeData,
|
|
620
|
+
options: _object_spread({
|
|
621
|
+
responsive: true,
|
|
622
|
+
maintainAspectRatio: false
|
|
623
|
+
}, safeOptions)
|
|
624
|
+
});
|
|
625
|
+
return function() {
|
|
626
|
+
if (chartInstanceRef.current) {
|
|
627
|
+
chartInstanceRef.current.destroy();
|
|
628
|
+
chartInstanceRef.current = null;
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
}, [
|
|
632
|
+
type,
|
|
633
|
+
JSON.stringify(data),
|
|
634
|
+
// Forces re-render on data change
|
|
635
|
+
JSON.stringify(options)
|
|
636
|
+
]);
|
|
637
|
+
return /* @__PURE__ */ import_react4.default.createElement("div", _object_spread({
|
|
638
|
+
ref: ref,
|
|
639
|
+
className: cn2(chartVariants({
|
|
640
|
+
variant: variant,
|
|
641
|
+
size: size
|
|
642
|
+
}), className)
|
|
643
|
+
}, props), /* @__PURE__ */ import_react4.default.createElement("canvas", {
|
|
644
|
+
ref: canvasRef
|
|
645
|
+
}));
|
|
646
|
+
});
|
|
647
|
+
ChartInterface.displayName = "ChartInterface";
|
|
472
648
|
// src/components/FormContainer.tsx
|
|
473
|
-
var
|
|
649
|
+
var import_react5 = __toESM(require("react"));
|
|
474
650
|
var FormContainer = function(param) {
|
|
475
651
|
var children = param.children, onSubmit = param.onSubmit, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
|
|
476
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ import_react5.default.createElement("form", {
|
|
477
653
|
onSubmit: onSubmit,
|
|
478
654
|
className: "\n flex flex-col items-center justify-center\n w-full max-w-[560px] min-h-[80vh] mx-auto p-6\n bg-white shadow-lg rounded-lg\n ".concat(className, "\n ")
|
|
479
655
|
}, children);
|
|
480
656
|
};
|
|
481
657
|
FormContainer.displayName = "FormContainer";
|
|
482
658
|
// src/components/Input.tsx
|
|
483
|
-
var
|
|
659
|
+
var import_react6 = __toESM(require("react"));
|
|
484
660
|
var Input = function(param) {
|
|
485
661
|
var _param_type = param.type, type = _param_type === void 0 ? "text" : _param_type, name = param.name, placeholder = param.placeholder, onChange = param.onChange, _param_hasError = param.hasError, hasError = _param_hasError === void 0 ? false : _param_hasError, _param_errorMessage = param.errorMessage, errorMessage = _param_errorMessage === void 0 ? "" : _param_errorMessage, _param_value = param.value, value = _param_value === void 0 ? "" : _param_value, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
|
|
486
|
-
var _ref = _sliced_to_array((0,
|
|
487
|
-
var _ref1 = _sliced_to_array((0,
|
|
488
|
-
(0,
|
|
662
|
+
var _ref = _sliced_to_array((0, import_react6.useState)(value), 2), internalValue = _ref[0], setInternalValue = _ref[1];
|
|
663
|
+
var _ref1 = _sliced_to_array((0, import_react6.useState)(false), 2), showError = _ref1[0], setShowError = _ref1[1];
|
|
664
|
+
(0, import_react6.useEffect)(function() {
|
|
489
665
|
setInternalValue(value);
|
|
490
666
|
setShowError(hasError || value === "");
|
|
491
667
|
}, [
|
|
@@ -498,27 +674,27 @@ var Input = function(param) {
|
|
|
498
674
|
onChange(e);
|
|
499
675
|
setShowError(newValue === "");
|
|
500
676
|
};
|
|
501
|
-
return /* @__PURE__ */
|
|
677
|
+
return /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
502
678
|
className: "mb-4"
|
|
503
|
-
}, /* @__PURE__ */
|
|
679
|
+
}, /* @__PURE__ */ import_react6.default.createElement("input", {
|
|
504
680
|
type: type,
|
|
505
681
|
name: name,
|
|
506
682
|
placeholder: placeholder,
|
|
507
683
|
value: internalValue,
|
|
508
684
|
onChange: handleChange,
|
|
509
685
|
className: "\n w-[438px] max-w-full h-[44px] flex-shrink-0\n rounded-[6px] border\n ".concat(showError ? "border-red-500" : "border-[#D9D9D9]", "\n bg-white\n text-base leading-5\n outline-none\n ").concat(className, "\n ")
|
|
510
|
-
}), /* @__PURE__ */
|
|
686
|
+
}), /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
511
687
|
className: "block text-sm text-red-500 h-[0.8rem]"
|
|
512
688
|
}, errorMessage));
|
|
513
689
|
};
|
|
514
690
|
Input.displayName = "Input";
|
|
515
691
|
// src/components/TabbedInterface.tsx
|
|
516
|
-
var
|
|
692
|
+
var import_react7 = __toESM(require("react"));
|
|
517
693
|
var TabbedInterface = function(param) {
|
|
518
694
|
var tabs = param.tabs, _param_variant = param.variant, variant = _param_variant === void 0 ? "basic" : _param_variant, _param_defaultActiveTab = param.defaultActiveTab, defaultActiveTab = _param_defaultActiveTab === void 0 ? 0 : _param_defaultActiveTab, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className, onTabChange = param.onTabChange;
|
|
519
695
|
var _tabs_activeTab;
|
|
520
|
-
var _ref = _sliced_to_array((0,
|
|
521
|
-
var id = (0,
|
|
696
|
+
var _ref = _sliced_to_array((0, import_react7.useState)(defaultActiveTab), 2), activeTab = _ref[0], setActiveTab = _ref[1];
|
|
697
|
+
var id = (0, import_react7.useId)();
|
|
522
698
|
var PRIMARY_COLOR = "#1e73be";
|
|
523
699
|
var ACCENT_COLOR = "#4DAF83";
|
|
524
700
|
var handleTabClick = function(index) {
|
|
@@ -563,13 +739,13 @@ var TabbedInterface = function(param) {
|
|
|
563
739
|
}
|
|
564
740
|
return "hidden";
|
|
565
741
|
};
|
|
566
|
-
return /* @__PURE__ */
|
|
742
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
567
743
|
className: "w-full bg-[#EEF4F7] rounded-lg border border-gray-200 shadow-sm ".concat(className)
|
|
568
|
-
}, /* @__PURE__ */
|
|
744
|
+
}, /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
569
745
|
className: "flex flex-row overflow-x-auto scrollbar-hide space-x-4 p-4",
|
|
570
746
|
role: "tablist"
|
|
571
747
|
}, tabs.map(function(tab, index) {
|
|
572
|
-
return /* @__PURE__ */
|
|
748
|
+
return /* @__PURE__ */ import_react7.default.createElement("button", {
|
|
573
749
|
key: tab.id || "tab-".concat(id, "-").concat(index),
|
|
574
750
|
className: getTabButtonStyles(index),
|
|
575
751
|
onClick: function() {
|
|
@@ -580,34 +756,231 @@ var TabbedInterface = function(param) {
|
|
|
580
756
|
"aria-controls": "".concat(id, "-tabpanel-").concat(index),
|
|
581
757
|
role: "tab",
|
|
582
758
|
type: "button"
|
|
583
|
-
}, tab.icon && /* @__PURE__ */
|
|
759
|
+
}, tab.icon && /* @__PURE__ */ import_react7.default.createElement("span", {
|
|
584
760
|
className: "flex-shrink-0 w-4 h-4"
|
|
585
|
-
}, tab.icon), /* @__PURE__ */
|
|
761
|
+
}, tab.icon), /* @__PURE__ */ import_react7.default.createElement("span", {
|
|
586
762
|
className: "truncate"
|
|
587
|
-
}, tab.label), variant === "underline" && /* @__PURE__ */
|
|
763
|
+
}, tab.label), variant === "underline" && /* @__PURE__ */ import_react7.default.createElement("span", {
|
|
588
764
|
className: getUnderlineBarClasses(index)
|
|
589
765
|
}));
|
|
590
|
-
})), /* @__PURE__ */
|
|
766
|
+
})), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
591
767
|
className: "h-[2px] flex-shrink-0 bg-[#D9D9D9]"
|
|
592
|
-
}), /* @__PURE__ */
|
|
768
|
+
}), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
593
769
|
id: "".concat(id, "-tabpanel-").concat(activeTab),
|
|
594
770
|
role: "tabpanel",
|
|
595
771
|
"aria-labelledby": "".concat(id, "-tab-").concat(activeTab),
|
|
596
772
|
className: "p-6 animate-fade-in bg-white"
|
|
597
|
-
}, ((_tabs_activeTab = tabs[activeTab]) === null || _tabs_activeTab === void 0 ? void 0 : _tabs_activeTab.content) || /* @__PURE__ */
|
|
773
|
+
}, ((_tabs_activeTab = tabs[activeTab]) === null || _tabs_activeTab === void 0 ? void 0 : _tabs_activeTab.content) || /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
598
774
|
className: "text-center text-gray-500 py-8"
|
|
599
775
|
}, "No content available for this tab")));
|
|
600
776
|
};
|
|
601
777
|
TabbedInterface.displayName = "TabbedInterface";
|
|
778
|
+
// src/components/TabedInterfaceTailwindCSS.tsx
|
|
779
|
+
var import_react8 = __toESM(require("react"));
|
|
780
|
+
var cn3 = function() {
|
|
781
|
+
for(var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++){
|
|
782
|
+
classes[_key] = arguments[_key];
|
|
783
|
+
}
|
|
784
|
+
return classes.filter(Boolean).join(" ");
|
|
785
|
+
};
|
|
786
|
+
var getFontClass = function(font) {
|
|
787
|
+
if (!font) return "font-sans";
|
|
788
|
+
var lower = font.toLowerCase().trim();
|
|
789
|
+
if (lower === "sans" || lower === "sans-serif") return "font-sans";
|
|
790
|
+
if (lower === "serif") return "font-serif";
|
|
791
|
+
if (lower === "mono" || lower === "monospace") return "font-mono";
|
|
792
|
+
if (font.startsWith("font-") || font.includes("[")) return font;
|
|
793
|
+
return "font-[".concat(font, "]");
|
|
794
|
+
};
|
|
795
|
+
var getContainerClasses = function(variant) {
|
|
796
|
+
var base = "w-full max-w-4xl mx-auto my-10 rounded-xl border p-8 box-border transition-all duration-300 overflow-hidden";
|
|
797
|
+
switch(variant){
|
|
798
|
+
case "dark":
|
|
799
|
+
return cn3(base, "bg-[#45484f] border-slate-700 text-slate-50 shadow-lg");
|
|
800
|
+
case "glass":
|
|
801
|
+
return cn3(base, "bg-white/10 border-white/30 text-slate-900 backdrop-blur-xl shadow-lg");
|
|
802
|
+
default:
|
|
803
|
+
return cn3(base, "bg-white border-[#b8d1f3] text-slate-900 shadow-sm");
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
var getTabButtonClasses = function(variant, active, isDragging, orientation, tabHeaderFontClass) {
|
|
807
|
+
var base = "relative flex items-center px-4 py-2 text-sm font-semibold cursor-pointer transition-all duration-300 select-none";
|
|
808
|
+
var alignment = orientation === "vertical" ? "text-left" : "text-center";
|
|
809
|
+
var iconSize = " [&>svg]:h-[18px] [&>svg]:w-[18px] [&>svg]:shrink-0";
|
|
810
|
+
var draggingRing = isDragging ? "ring-2 ring-[#1761A3]/60" : "";
|
|
811
|
+
switch(variant){
|
|
812
|
+
case "underline":
|
|
813
|
+
return cn3(base, alignment, iconSize, draggingRing, tabHeaderFontClass, active ? "text-[#1761A3]" : "text-slate-600 hover:text-[#1761A3] hover:bg-slate-50/60");
|
|
814
|
+
case "pill":
|
|
815
|
+
return cn3(base, alignment, iconSize, "rounded-full", draggingRing, tabHeaderFontClass, active ? "bg-[#1761A3] text-white shadow-md" : "bg-transparent text-[#1761A3] hover:bg-[#1761A3]/10");
|
|
816
|
+
case "outline":
|
|
817
|
+
return cn3(base, alignment, iconSize, "rounded-lg border-2", draggingRing, tabHeaderFontClass, active ? "border-[#1761A3] bg-[#F3F8FF] text-[#1761A3] shadow-sm" : "border-transparent text-slate-700 hover:border-slate-300 hover:bg-slate-50");
|
|
818
|
+
case "filled":
|
|
819
|
+
return cn3(base, alignment, iconSize, "rounded-lg", draggingRing, tabHeaderFontClass, active ? "bg-[#1761A3] text-white shadow-md" : "bg-[#EAF3FD] text-[#1761A3] hover:bg-[#d3e4fb]");
|
|
820
|
+
case "gradient":
|
|
821
|
+
return cn3(base, alignment, iconSize, "rounded-lg", draggingRing, tabHeaderFontClass, active ? "bg-gradient-to-r from-[#1761A3] to-[#4DAF83] text-white shadow-md" : "bg-[#F0F4F8] text-[#1761A3] hover:bg-[#e1e8f0]");
|
|
822
|
+
case "shadow":
|
|
823
|
+
return cn3(base, alignment, iconSize, "rounded-lg", draggingRing, tabHeaderFontClass, active ? "bg-white text-[#1761A3] shadow-lg" : "bg-[#F8FAFD] text-slate-600 shadow-sm hover:bg-white");
|
|
824
|
+
case "glass":
|
|
825
|
+
return cn3(base, alignment, iconSize, "rounded-lg border border-white/30 backdrop-blur-lg", draggingRing, tabHeaderFontClass, active ? "bg-[#1761A3]/40 text-white shadow-md" : "bg-white/20 text-[#1761A3] hover:bg-[#1761A3]/50 hover:text-white");
|
|
826
|
+
case "dark":
|
|
827
|
+
return cn3(base, alignment, iconSize, "rounded-none", draggingRing, tabHeaderFontClass, active ? "text-[#90cdf4] border-b-4 border-[#63b3ed]" : "text-[#cbd5e0] hover:text-[#63b3ed]");
|
|
828
|
+
default:
|
|
829
|
+
return cn3(base, alignment, iconSize, draggingRing, tabHeaderFontClass, active ? "text-[#1761A3]" : "text-slate-700 hover:text-[#1761A3] hover:bg-slate-50");
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
var getUnderlineInnerClasses = function(variant, active, orientation) {
|
|
833
|
+
if (variant !== "underline") return "hidden";
|
|
834
|
+
if (orientation === "vertical") {
|
|
835
|
+
return cn3("pointer-events-none absolute left-0 top-0 h-full w-[3px] rounded-full bg-gradient-to-b from-[#1761A3] to-[#4DAF83] transition-transform duration-300 origin-top", active ? "scale-y-100" : "scale-y-0");
|
|
836
|
+
}
|
|
837
|
+
return cn3("pointer-events-none absolute bottom-[-2px] left-0 h-[3px] w-full rounded-full bg-gradient-to-r from-[#1761A3] to-[#4DAF83] transition-transform duration-300 origin-left", active ? "scale-x-100" : "scale-x-0");
|
|
838
|
+
};
|
|
839
|
+
var TabbedInterface2 = function(param) {
|
|
840
|
+
var tabs = param.tabs, _param_variant = param.variant, variant = _param_variant === void 0 ? "underline" : _param_variant, onTabChange = param.onTabChange, _param_draggableTabs = param.draggableTabs, draggableTabs = _param_draggableTabs === void 0 ? false : _param_draggableTabs, onReorderTabs = param.onReorderTabs, _param_orientation = param.orientation, orientation = _param_orientation === void 0 ? "horizontal" : _param_orientation, _param_verticalPosition = param.verticalPosition, verticalPosition = _param_verticalPosition === void 0 ? "left" : _param_verticalPosition, _param_showTabCloseIconInHeader = param.showTabCloseIconInHeader, showTabCloseIconInHeader = _param_showTabCloseIconInHeader === void 0 ? false : _param_showTabCloseIconInHeader, _param_tabCloseIconPosition = param.tabCloseIconPosition, tabCloseIconPosition = _param_tabCloseIconPosition === void 0 ? "right" : _param_tabCloseIconPosition, tabCloseIconContent = param.tabCloseIconContent, onCloseTab = param.onCloseTab, tabHeaderFont = param.tabHeaderFont, tabContentFont = param.tabContentFont, sectionTitleFont = param.sectionTitleFont, sectionDescriptionFont = param.sectionDescriptionFont;
|
|
841
|
+
var _ref = _sliced_to_array((0, import_react8.useState)(0), 2), activeIndex = _ref[0], setActiveIndex = _ref[1];
|
|
842
|
+
var _ref1 = _sliced_to_array((0, import_react8.useState)(null), 2), draggingIndex = _ref1[0], setDraggingIndex = _ref1[1];
|
|
843
|
+
var effectiveCloseIconContent = tabCloseIconContent !== null && tabCloseIconContent !== void 0 ? tabCloseIconContent : "\xD7";
|
|
844
|
+
var tabHeaderFontClass = getFontClass(tabHeaderFont);
|
|
845
|
+
var tabContentFontClass = getFontClass(tabContentFont);
|
|
846
|
+
(0, import_react8.useEffect)(function() {
|
|
847
|
+
if (!tabs.length) {
|
|
848
|
+
setActiveIndex(0);
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
setActiveIndex(function(prev) {
|
|
852
|
+
return prev < 0 ? 0 : prev >= tabs.length ? tabs.length - 1 : prev;
|
|
853
|
+
});
|
|
854
|
+
}, [
|
|
855
|
+
tabs.length
|
|
856
|
+
]);
|
|
857
|
+
var handleTabClick = function(index) {
|
|
858
|
+
setActiveIndex(index);
|
|
859
|
+
onTabChange === null || onTabChange === void 0 ? void 0 : onTabChange(tabs[index].label);
|
|
860
|
+
};
|
|
861
|
+
var handleDragStart = function(index) {
|
|
862
|
+
if (!draggableTabs) return;
|
|
863
|
+
setDraggingIndex(index);
|
|
864
|
+
};
|
|
865
|
+
var handleDragOver = function(event) {
|
|
866
|
+
if (!draggableTabs) return;
|
|
867
|
+
event.preventDefault();
|
|
868
|
+
};
|
|
869
|
+
var handleDrop = function(index) {
|
|
870
|
+
if (!draggableTabs) return;
|
|
871
|
+
if (draggingIndex === null) {
|
|
872
|
+
setDraggingIndex(null);
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
var fromIndex = draggingIndex;
|
|
876
|
+
var toIndex = index;
|
|
877
|
+
if (fromIndex === toIndex) {
|
|
878
|
+
setDraggingIndex(null);
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
setActiveIndex(function(prevActive) {
|
|
882
|
+
var active = prevActive;
|
|
883
|
+
if (active === fromIndex) {
|
|
884
|
+
return toIndex;
|
|
885
|
+
}
|
|
886
|
+
if (fromIndex < toIndex) {
|
|
887
|
+
if (active > fromIndex && active <= toIndex) {
|
|
888
|
+
return active - 1;
|
|
889
|
+
}
|
|
890
|
+
} else if (fromIndex > toIndex) {
|
|
891
|
+
if (active >= toIndex && active < fromIndex) {
|
|
892
|
+
return active + 1;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
return active;
|
|
896
|
+
});
|
|
897
|
+
onReorderTabs === null || onReorderTabs === void 0 ? void 0 : onReorderTabs(fromIndex, toIndex);
|
|
898
|
+
setDraggingIndex(null);
|
|
899
|
+
};
|
|
900
|
+
var handleDragEnd = function() {
|
|
901
|
+
if (!draggableTabs) return;
|
|
902
|
+
setDraggingIndex(null);
|
|
903
|
+
};
|
|
904
|
+
var headerButtons = /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, tabs.map(function(tab, index) {
|
|
905
|
+
var active = index === activeIndex;
|
|
906
|
+
var isDragging = draggableTabs && draggingIndex === index;
|
|
907
|
+
var showClose = showTabCloseIconInHeader && !!onCloseTab;
|
|
908
|
+
var closeIcon = showClose ? /* @__PURE__ */ import_react8.default.createElement("span", {
|
|
909
|
+
"aria-label": "Close tab",
|
|
910
|
+
role: "button",
|
|
911
|
+
onClick: function(e) {
|
|
912
|
+
e.stopPropagation();
|
|
913
|
+
onCloseTab === null || onCloseTab === void 0 ? void 0 : onCloseTab(index);
|
|
914
|
+
},
|
|
915
|
+
className: cn3("inline-flex h-6 w-6 items-center justify-center rounded-full text-md font-bold hover:bg-slate-200 hover:text-slate-700", tabHeaderFontClass)
|
|
916
|
+
}, effectiveCloseIconContent) : null;
|
|
917
|
+
return /* @__PURE__ */ import_react8.default.createElement("button", {
|
|
918
|
+
type: "button",
|
|
919
|
+
key: index,
|
|
920
|
+
onClick: function() {
|
|
921
|
+
return handleTabClick(index);
|
|
922
|
+
},
|
|
923
|
+
className: getTabButtonClasses(variant, active, isDragging, orientation, tabHeaderFontClass),
|
|
924
|
+
draggable: draggableTabs,
|
|
925
|
+
onDragStart: function() {
|
|
926
|
+
return handleDragStart(index);
|
|
927
|
+
},
|
|
928
|
+
onDragOver: handleDragOver,
|
|
929
|
+
onDrop: function() {
|
|
930
|
+
return handleDrop(index);
|
|
931
|
+
},
|
|
932
|
+
onDragEnd: handleDragEnd
|
|
933
|
+
}, /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
934
|
+
className: "flex w-full items-center justify-between gap-2"
|
|
935
|
+
}, /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
936
|
+
className: "flex min-w-0 items-center gap-2"
|
|
937
|
+
}, tabCloseIconPosition === "left" && closeIcon, tab.icon && /* @__PURE__ */ import_react8.default.createElement("span", {
|
|
938
|
+
className: "[&>svg]:h-[18px] [&>svg]:w-[18px] [&>svg]:shrink-0"
|
|
939
|
+
}, tab.icon), /* @__PURE__ */ import_react8.default.createElement("span", {
|
|
940
|
+
className: "truncate"
|
|
941
|
+
}, tab.label)), tabCloseIconPosition === "right" && closeIcon), /* @__PURE__ */ import_react8.default.createElement("span", {
|
|
942
|
+
className: getUnderlineInnerClasses(variant, active, orientation)
|
|
943
|
+
}));
|
|
944
|
+
}));
|
|
945
|
+
var content = /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
946
|
+
className: cn3("relative min-h-[180px]", tabContentFontClass)
|
|
947
|
+
}, tabs.map(function(tab, index) {
|
|
948
|
+
var active = index === activeIndex;
|
|
949
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
950
|
+
key: index,
|
|
951
|
+
className: cn3("transition-opacity duration-300", active ? "relative opacity-100" : "pointer-events-none absolute inset-0 opacity-0")
|
|
952
|
+
}, tab.content);
|
|
953
|
+
}));
|
|
954
|
+
var containerClasses = getContainerClasses(variant);
|
|
955
|
+
if (orientation === "horizontal") {
|
|
956
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
957
|
+
className: containerClasses
|
|
958
|
+
}, /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
959
|
+
className: "mb-5 flex justify-around max-[600px]:flex-col max-[600px]:items-center"
|
|
960
|
+
}, headerButtons), content);
|
|
961
|
+
}
|
|
962
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
963
|
+
className: containerClasses
|
|
964
|
+
}, verticalPosition === "left" ? /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
965
|
+
className: "grid gap-6 md:grid-cols-[minmax(180px,220px)_1fr]"
|
|
966
|
+
}, /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
967
|
+
className: "flex flex-col gap-2 border-b border-slate-200 pb-3 md:border-b-0 md:border-r md:pb-0 md:pr-4"
|
|
968
|
+
}, headerButtons), /* @__PURE__ */ import_react8.default.createElement("div", null, content)) : /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
969
|
+
className: "grid gap-6 md:grid-cols-[1fr_minmax(180px,220px)]"
|
|
970
|
+
}, /* @__PURE__ */ import_react8.default.createElement("div", null, content), /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
971
|
+
className: "flex flex-col gap-2 border-t border-slate-200 pt-3 md:border-t-0 md:border-l md:pt-0 md:pl-4"
|
|
972
|
+
}, headerButtons)));
|
|
973
|
+
};
|
|
974
|
+
TabbedInterface2.displayName = "TabbedInterface";
|
|
602
975
|
// src/components/Table.tsx
|
|
603
|
-
var
|
|
976
|
+
var import_react9 = __toESM(require("react"));
|
|
604
977
|
var import_outline = require("@heroicons/react/24/outline");
|
|
605
978
|
var Table = function(param) {
|
|
606
979
|
var headers = param.headers, data = param.data, page = param.page, setPage = param.setPage, limit = param.limit, setLimit = param.setLimit, totalCount = param.totalCount, highlightRowColor = param.highlightRowColor, actions = param.actions, paginationRequired = param.paginationRequired, _param_paginationPosition = param.paginationPosition, paginationPosition = _param_paginationPosition === void 0 ? "bottom-center" : _param_paginationPosition, onDownloadPDF = param.onDownloadPDF, onDownloadExcel = param.onDownloadExcel, _param_searchable = param.searchable, searchable = _param_searchable === void 0 ? false : _param_searchable, _param_searchTerm = param.searchTerm, searchTerm = _param_searchTerm === void 0 ? "" : _param_searchTerm, onResetSearch = param.onResetSearch, onSearch = param.onSearch, _param_searchModeOptions = param.searchModeOptions, searchModeOptions = _param_searchModeOptions === void 0 ? [
|
|
607
980
|
"includes",
|
|
608
981
|
"startsWith"
|
|
609
982
|
] : _param_searchModeOptions;
|
|
610
|
-
var _ref = _sliced_to_array((0,
|
|
983
|
+
var _ref = _sliced_to_array((0, import_react9.useState)(searchModeOptions[0]), 2), searchMode = _ref[0], setSearchMode = _ref[1];
|
|
611
984
|
var isPaginated = paginationRequired;
|
|
612
985
|
var handleChange = function(e) {
|
|
613
986
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(e.target.value, searchMode);
|
|
@@ -621,7 +994,7 @@ var Table = function(param) {
|
|
|
621
994
|
};
|
|
622
995
|
var renderPageNumbers = function() {
|
|
623
996
|
var _loop = function(i) {
|
|
624
|
-
pages.push(/* @__PURE__ */
|
|
997
|
+
pages.push(/* @__PURE__ */ import_react9.default.createElement("button", {
|
|
625
998
|
key: i,
|
|
626
999
|
onClick: function() {
|
|
627
1000
|
return goToPage(i);
|
|
@@ -636,7 +1009,7 @@ var Table = function(param) {
|
|
|
636
1009
|
if (!isPaginated || totalPages <= 1) return null;
|
|
637
1010
|
var pages = [];
|
|
638
1011
|
var siblings = 1;
|
|
639
|
-
pages.push(/* @__PURE__ */
|
|
1012
|
+
pages.push(/* @__PURE__ */ import_react9.default.createElement("button", {
|
|
640
1013
|
key: 1,
|
|
641
1014
|
onClick: function() {
|
|
642
1015
|
return goToPage(1);
|
|
@@ -648,7 +1021,7 @@ var Table = function(param) {
|
|
|
648
1021
|
}
|
|
649
1022
|
}, "1"));
|
|
650
1023
|
if (currentPage > siblings + 2) {
|
|
651
|
-
pages.push(/* @__PURE__ */
|
|
1024
|
+
pages.push(/* @__PURE__ */ import_react9.default.createElement("span", {
|
|
652
1025
|
key: "start-ellipsis",
|
|
653
1026
|
className: "px-1 text-sm text-slate-500"
|
|
654
1027
|
}, "..."));
|
|
@@ -657,13 +1030,13 @@ var Table = function(param) {
|
|
|
657
1030
|
var end = Math.min(totalPages - 1, currentPage + siblings);
|
|
658
1031
|
for(var i = start; i <= end; i++)_loop(i);
|
|
659
1032
|
if (currentPage < totalPages - siblings - 1) {
|
|
660
|
-
pages.push(/* @__PURE__ */
|
|
1033
|
+
pages.push(/* @__PURE__ */ import_react9.default.createElement("span", {
|
|
661
1034
|
key: "end-ellipsis",
|
|
662
1035
|
className: "px-1 text-sm text-slate-500"
|
|
663
1036
|
}, "..."));
|
|
664
1037
|
}
|
|
665
1038
|
if (totalPages > 1) {
|
|
666
|
-
pages.push(/* @__PURE__ */
|
|
1039
|
+
pages.push(/* @__PURE__ */ import_react9.default.createElement("button", {
|
|
667
1040
|
key: totalPages,
|
|
668
1041
|
onClick: function() {
|
|
669
1042
|
return goToPage(totalPages);
|
|
@@ -680,11 +1053,11 @@ var Table = function(param) {
|
|
|
680
1053
|
var renderPagination = function() {
|
|
681
1054
|
if (!isPaginated) return null;
|
|
682
1055
|
var align = paginationPosition.includes("left") ? "justify-start" : paginationPosition.includes("right") ? "justify-end" : "justify-center";
|
|
683
|
-
return /* @__PURE__ */
|
|
1056
|
+
return /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
684
1057
|
className: "my-2 flex w-full ".concat(align)
|
|
685
|
-
}, /* @__PURE__ */
|
|
1058
|
+
}, /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
686
1059
|
className: "flex flex-wrap items-center justify-center gap-2"
|
|
687
|
-
}, /* @__PURE__ */
|
|
1060
|
+
}, /* @__PURE__ */ import_react9.default.createElement("button", {
|
|
688
1061
|
onClick: function() {
|
|
689
1062
|
return goToPage(currentPage - 1);
|
|
690
1063
|
},
|
|
@@ -693,7 +1066,7 @@ var Table = function(param) {
|
|
|
693
1066
|
style: {
|
|
694
1067
|
background: currentPage === 1 ? "#ccc" : "linear-gradient(to right, #1e73be, #28a97d)"
|
|
695
1068
|
}
|
|
696
|
-
}, "Previous"), renderPageNumbers(), /* @__PURE__ */
|
|
1069
|
+
}, "Previous"), renderPageNumbers(), /* @__PURE__ */ import_react9.default.createElement("button", {
|
|
697
1070
|
onClick: function() {
|
|
698
1071
|
return goToPage(currentPage + 1);
|
|
699
1072
|
},
|
|
@@ -702,7 +1075,7 @@ var Table = function(param) {
|
|
|
702
1075
|
style: {
|
|
703
1076
|
background: currentPage === totalPages ? "#ccc" : "linear-gradient(to right, #1e73be, #28a97d)"
|
|
704
1077
|
}
|
|
705
|
-
}, "Next"), /* @__PURE__ */
|
|
1078
|
+
}, "Next"), /* @__PURE__ */ import_react9.default.createElement("select", {
|
|
706
1079
|
value: limit,
|
|
707
1080
|
onChange: function(e) {
|
|
708
1081
|
setPage === null || setPage === void 0 ? void 0 : setPage(1);
|
|
@@ -714,46 +1087,46 @@ var Table = function(param) {
|
|
|
714
1087
|
10,
|
|
715
1088
|
15
|
|
716
1089
|
].map(function(size) {
|
|
717
|
-
return /* @__PURE__ */
|
|
1090
|
+
return /* @__PURE__ */ import_react9.default.createElement("option", {
|
|
718
1091
|
key: size,
|
|
719
1092
|
value: size
|
|
720
1093
|
}, size);
|
|
721
|
-
})), /* @__PURE__ */
|
|
1094
|
+
})), /* @__PURE__ */ import_react9.default.createElement("span", {
|
|
722
1095
|
className: "ml-2 text-xs text-slate-600"
|
|
723
1096
|
}, "Page ", currentPage, " of ", totalPages, " (Total: ", totalCount, " items)")));
|
|
724
1097
|
};
|
|
725
|
-
return /* @__PURE__ */
|
|
1098
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, (searchable || onDownloadExcel || onDownloadPDF) && /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
726
1099
|
className: "mb-3 flex flex-wrap items-center justify-between gap-3"
|
|
727
|
-
}, searchable && /* @__PURE__ */
|
|
1100
|
+
}, searchable && /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
728
1101
|
className: "flex items-center gap-2"
|
|
729
|
-
}, /* @__PURE__ */
|
|
1102
|
+
}, /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
730
1103
|
className: "relative flex items-center"
|
|
731
|
-
}, /* @__PURE__ */
|
|
1104
|
+
}, /* @__PURE__ */ import_react9.default.createElement("input", {
|
|
732
1105
|
type: "text",
|
|
733
1106
|
placeholder: "Search...",
|
|
734
1107
|
value: searchTerm,
|
|
735
1108
|
onChange: handleChange,
|
|
736
1109
|
className: "w-56 rounded-lg border border-transparent bg-white px-3 py-2 pr-8 text-sm font-medium text-[#1761A3] shadow-sm outline-none ring-1 ring-transparent transition focus:border-transparent focus:ring-2 focus:ring-emerald-400"
|
|
737
|
-
}), searchTerm && /* @__PURE__ */
|
|
1110
|
+
}), searchTerm && /* @__PURE__ */ import_react9.default.createElement("button", {
|
|
738
1111
|
onClick: onResetSearch,
|
|
739
1112
|
"aria-label": "Clear search",
|
|
740
1113
|
className: "absolute right-2 flex h-6 w-6 items-center justify-center rounded-full text-slate-400 transition hover:bg-slate-100 hover:text-slate-700"
|
|
741
|
-
}, /* @__PURE__ */
|
|
1114
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_outline.XMarkIcon, {
|
|
742
1115
|
className: "h-4 w-4"
|
|
743
|
-
}))), /* @__PURE__ */
|
|
1116
|
+
}))), /* @__PURE__ */ import_react9.default.createElement("select", {
|
|
744
1117
|
value: searchMode,
|
|
745
1118
|
onChange: function(e) {
|
|
746
1119
|
return setSearchMode(e.target.value);
|
|
747
1120
|
},
|
|
748
1121
|
className: "rounded-lg border border-transparent bg-white px-2 py-2 text-sm font-medium text-slate-700 shadow-sm outline-none ring-1 ring-transparent transition hover:bg-slate-50 focus:border-transparent focus:ring-2 focus:ring-emerald-400"
|
|
749
1122
|
}, searchModeOptions.map(function(mode) {
|
|
750
|
-
return /* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ import_react9.default.createElement("option", {
|
|
751
1124
|
key: mode,
|
|
752
1125
|
value: mode
|
|
753
1126
|
}, mode === "startsWith" ? "Starts With" : "Includes");
|
|
754
|
-
}))), (onDownloadPDF || onDownloadExcel) && /* @__PURE__ */
|
|
1127
|
+
}))), (onDownloadPDF || onDownloadExcel) && /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
755
1128
|
className: "mt-1 flex items-center gap-2"
|
|
756
|
-
}, onDownloadPDF && /* @__PURE__ */
|
|
1129
|
+
}, onDownloadPDF && /* @__PURE__ */ import_react9.default.createElement("button", {
|
|
757
1130
|
onClick: function() {
|
|
758
1131
|
return onDownloadPDF(data, headers);
|
|
759
1132
|
},
|
|
@@ -761,9 +1134,9 @@ var Table = function(param) {
|
|
|
761
1134
|
style: {
|
|
762
1135
|
background: "linear-gradient(to right, #1e73be, #28a97d)"
|
|
763
1136
|
}
|
|
764
|
-
}, /* @__PURE__ */
|
|
1137
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_outline.ArrowDownOnSquareIcon, {
|
|
765
1138
|
className: "h-5 w-5"
|
|
766
|
-
})), onDownloadExcel && /* @__PURE__ */
|
|
1139
|
+
})), onDownloadExcel && /* @__PURE__ */ import_react9.default.createElement("button", {
|
|
767
1140
|
onClick: function() {
|
|
768
1141
|
return onDownloadExcel(data, headers);
|
|
769
1142
|
},
|
|
@@ -771,44 +1144,44 @@ var Table = function(param) {
|
|
|
771
1144
|
style: {
|
|
772
1145
|
background: "linear-gradient(to right, #1e73be, #28a97d)"
|
|
773
1146
|
}
|
|
774
|
-
}, /* @__PURE__ */
|
|
1147
|
+
}, /* @__PURE__ */ import_react9.default.createElement(import_outline.ArrowDownOnSquareIcon, {
|
|
775
1148
|
className: "h-5 w-5"
|
|
776
|
-
}), /* @__PURE__ */
|
|
1149
|
+
}), /* @__PURE__ */ import_react9.default.createElement("span", null, "Excel")))), paginationPosition.startsWith("top") && data.length > 0 && renderPagination(), /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
777
1150
|
className: "mt-1 overflow-hidden rounded-xl border border-[#1761A3] bg-white"
|
|
778
|
-
}, /* @__PURE__ */
|
|
1151
|
+
}, /* @__PURE__ */ import_react9.default.createElement("table", {
|
|
779
1152
|
className: "w-full border-collapse"
|
|
780
|
-
}, /* @__PURE__ */
|
|
1153
|
+
}, /* @__PURE__ */ import_react9.default.createElement("thead", {
|
|
781
1154
|
style: {
|
|
782
1155
|
background: "linear-gradient(to right, #1e73be, #28a97d)"
|
|
783
1156
|
}
|
|
784
|
-
}, /* @__PURE__ */
|
|
785
|
-
return /* @__PURE__ */
|
|
1157
|
+
}, /* @__PURE__ */ import_react9.default.createElement("tr", null, headers.map(function(header, idx) {
|
|
1158
|
+
return /* @__PURE__ */ import_react9.default.createElement("th", {
|
|
786
1159
|
key: idx,
|
|
787
1160
|
className: "h-[50px] px-3 py-2 text-left text-sm font-bold text-white first:rounded-tl-xl last:rounded-tr-xl"
|
|
788
1161
|
}, header.label);
|
|
789
|
-
}), actions && /* @__PURE__ */
|
|
1162
|
+
}), actions && /* @__PURE__ */ import_react9.default.createElement("th", {
|
|
790
1163
|
className: "h-[50px] px-3 py-2 text-left text-sm font-bold text-white"
|
|
791
|
-
}, "Actions"))), /* @__PURE__ */
|
|
792
|
-
return /* @__PURE__ */
|
|
1164
|
+
}, "Actions"))), /* @__PURE__ */ import_react9.default.createElement("tbody", null, data.length > 0 ? data.map(function(row, rowIndex) {
|
|
1165
|
+
return /* @__PURE__ */ import_react9.default.createElement("tr", {
|
|
793
1166
|
key: rowIndex,
|
|
794
1167
|
className: "h-[57px] border-b border-slate-200 text-sm text-slate-900 even:bg-slate-50 hover:bg-slate-100 ".concat(highlightRowColor || "")
|
|
795
1168
|
}, headers.map(function(header, cellIdx) {
|
|
796
|
-
return /* @__PURE__ */
|
|
1169
|
+
return /* @__PURE__ */ import_react9.default.createElement("td", {
|
|
797
1170
|
key: cellIdx,
|
|
798
1171
|
className: "px-3 py-2"
|
|
799
1172
|
}, function() {
|
|
800
1173
|
var value = row[header.key];
|
|
801
|
-
if (
|
|
1174
|
+
if (import_react9.default.isValidElement(value)) return value;
|
|
802
1175
|
if (typeof value === "function") {
|
|
803
1176
|
try {
|
|
804
1177
|
var result = value();
|
|
805
|
-
if (
|
|
1178
|
+
if (import_react9.default.isValidElement(result)) return result;
|
|
806
1179
|
} catch (e) {
|
|
807
1180
|
console.warn("Error executing function in table cell:", e);
|
|
808
1181
|
}
|
|
809
1182
|
}
|
|
810
1183
|
if (typeof value === "string" && value.trim().startsWith("<") && value.trim().endsWith(">")) {
|
|
811
|
-
return /* @__PURE__ */
|
|
1184
|
+
return /* @__PURE__ */ import_react9.default.createElement("span", {
|
|
812
1185
|
dangerouslySetInnerHTML: {
|
|
813
1186
|
__html: value
|
|
814
1187
|
}
|
|
@@ -816,9 +1189,9 @@ var Table = function(param) {
|
|
|
816
1189
|
}
|
|
817
1190
|
if (Array.isArray(value)) {
|
|
818
1191
|
if (value.some(function(item) {
|
|
819
|
-
return
|
|
1192
|
+
return import_react9.default.isValidElement(item);
|
|
820
1193
|
})) {
|
|
821
|
-
return /* @__PURE__ */
|
|
1194
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, value);
|
|
822
1195
|
}
|
|
823
1196
|
return value.join(", ");
|
|
824
1197
|
}
|
|
@@ -829,34 +1202,36 @@ var Table = function(param) {
|
|
|
829
1202
|
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") return JSON.stringify(value);
|
|
830
1203
|
return String(value);
|
|
831
1204
|
}());
|
|
832
|
-
}), actions && /* @__PURE__ */
|
|
1205
|
+
}), actions && /* @__PURE__ */ import_react9.default.createElement("td", {
|
|
833
1206
|
className: "px-3 py-2"
|
|
834
1207
|
}, actions(row)));
|
|
835
|
-
}) : /* @__PURE__ */
|
|
1208
|
+
}) : /* @__PURE__ */ import_react9.default.createElement("tr", null, /* @__PURE__ */ import_react9.default.createElement("td", {
|
|
836
1209
|
colSpan: headers.length + (actions ? 1 : 0),
|
|
837
1210
|
className: "px-4 py-6 text-center text-slate-500"
|
|
838
|
-
}, /* @__PURE__ */
|
|
1211
|
+
}, /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
839
1212
|
className: "flex items-center justify-center gap-4"
|
|
840
|
-
}, /* @__PURE__ */
|
|
1213
|
+
}, /* @__PURE__ */ import_react9.default.createElement("span", null, "No records found."), onResetSearch && /* @__PURE__ */ import_react9.default.createElement("button", {
|
|
841
1214
|
onClick: onResetSearch,
|
|
842
1215
|
className: "inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-90",
|
|
843
1216
|
style: {
|
|
844
1217
|
background: "linear-gradient(to right, #1e73be, #28a97d)"
|
|
845
1218
|
}
|
|
846
|
-
}, /* @__PURE__ */
|
|
1219
|
+
}, /* @__PURE__ */ import_react9.default.createElement("span", null, "Reset"), /* @__PURE__ */ import_react9.default.createElement(import_outline.ArrowPathIcon, {
|
|
847
1220
|
className: "h-5 w-5"
|
|
848
1221
|
})))))))), paginationPosition.startsWith("bottom") && data.length > 0 && renderPagination());
|
|
849
1222
|
};
|
|
850
1223
|
Table.displayName = "Table";
|
|
851
1224
|
// src/components/TableTailwindCSS.tsx
|
|
852
|
-
var
|
|
1225
|
+
var import_react10 = __toESM(require("react"));
|
|
853
1226
|
var import_outline2 = require("@heroicons/react/24/outline");
|
|
854
|
-
var
|
|
1227
|
+
var Table2 = function(param) {
|
|
855
1228
|
var headers = param.headers, data = param.data, page = param.page, setPage = param.setPage, limit = param.limit, setLimit = param.setLimit, totalCount = param.totalCount, highlightRowColor = param.highlightRowColor, actions = param.actions, paginationRequired = param.paginationRequired, _param_paginationPosition = param.paginationPosition, paginationPosition = _param_paginationPosition === void 0 ? "bottom-center" : _param_paginationPosition, onDownloadPDF = param.onDownloadPDF, onDownloadExcel = param.onDownloadExcel, _param_searchable = param.searchable, searchable = _param_searchable === void 0 ? false : _param_searchable, _param_searchTerm = param.searchTerm, searchTerm = _param_searchTerm === void 0 ? "" : _param_searchTerm, onResetSearch = param.onResetSearch, onSearch = param.onSearch, _param_searchModeOptions = param.searchModeOptions, searchModeOptions = _param_searchModeOptions === void 0 ? [
|
|
856
1229
|
"includes",
|
|
857
1230
|
"startsWith"
|
|
858
|
-
] : _param_searchModeOptions;
|
|
859
|
-
var _ref = _sliced_to_array((0,
|
|
1231
|
+
] : _param_searchModeOptions, summary = param.summary, _param_summaryKey = param.summaryKey, summaryKey = _param_summaryKey === void 0 ? "summary" : _param_summaryKey, _param_summaryTitleField = param.summaryTitleField, summaryTitleField = _param_summaryTitleField === void 0 ? "name" : _param_summaryTitleField, _param_summaryColumn = param.summaryColumn, summaryColumn = _param_summaryColumn === void 0 ? false : _param_summaryColumn, summaryColumnKey = param.summaryColumnKey, _param_summaryColumnMaxLength = param.summaryColumnMaxLength, summaryColumnMaxLength = _param_summaryColumnMaxLength === void 0 ? 120 : _param_summaryColumnMaxLength, textWrapColumns = param.textWrapColumns, _param_textWrapMaxLength = param.textWrapMaxLength, textWrapMaxLength = _param_textWrapMaxLength === void 0 ? 120 : _param_textWrapMaxLength, textWrapColumnMaxLengths = param.textWrapColumnMaxLengths;
|
|
1232
|
+
var _ref = _sliced_to_array((0, import_react10.useState)(searchModeOptions[0]), 2), searchMode = _ref[0], setSearchMode = _ref[1];
|
|
1233
|
+
var _ref1 = _sliced_to_array((0, import_react10.useState)(null), 2), expandedRowIndex = _ref1[0], setExpandedRowIndex = _ref1[1];
|
|
1234
|
+
var _ref2 = _sliced_to_array((0, import_react10.useState)(/* @__PURE__ */ new Set()), 2), expandedRowIndexes = _ref2[0], setExpandedRowIndexes = _ref2[1];
|
|
860
1235
|
var isPaginated = paginationRequired;
|
|
861
1236
|
var handleChange = function(e) {
|
|
862
1237
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(e.target.value, searchMode);
|
|
@@ -870,28 +1245,34 @@ var TableTailwind = function(param) {
|
|
|
870
1245
|
};
|
|
871
1246
|
var renderPageNumbers = function() {
|
|
872
1247
|
var _loop = function(i) {
|
|
873
|
-
pages.push(/* @__PURE__ */
|
|
1248
|
+
pages.push(/* @__PURE__ */ import_react10.default.createElement("button", {
|
|
874
1249
|
key: i,
|
|
875
1250
|
onClick: function() {
|
|
876
1251
|
return goToPage(i);
|
|
877
1252
|
},
|
|
878
1253
|
disabled: currentPage === i,
|
|
879
|
-
className: "inline-flex items-center rounded-md
|
|
1254
|
+
className: "inline-flex items-center rounded-md px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
|
|
1255
|
+
style: {
|
|
1256
|
+
background: currentPage === i ? "#ccc" : "linear-gradient(to right, #1e73be, #28a97d)"
|
|
1257
|
+
}
|
|
880
1258
|
}, i));
|
|
881
1259
|
};
|
|
882
1260
|
if (!isPaginated || totalPages <= 1) return null;
|
|
883
1261
|
var pages = [];
|
|
884
1262
|
var siblings = 1;
|
|
885
|
-
pages.push(/* @__PURE__ */
|
|
1263
|
+
pages.push(/* @__PURE__ */ import_react10.default.createElement("button", {
|
|
886
1264
|
key: 1,
|
|
887
1265
|
onClick: function() {
|
|
888
1266
|
return goToPage(1);
|
|
889
1267
|
},
|
|
890
1268
|
disabled: currentPage === 1,
|
|
891
|
-
className: "inline-flex items-center rounded-md
|
|
1269
|
+
className: "inline-flex items-center rounded-md px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
|
|
1270
|
+
style: {
|
|
1271
|
+
background: currentPage === 1 ? "#ccc" : "linear-gradient(to right, #1e73beee, #28a97d)"
|
|
1272
|
+
}
|
|
892
1273
|
}, "1"));
|
|
893
1274
|
if (currentPage > siblings + 2) {
|
|
894
|
-
pages.push(/* @__PURE__ */
|
|
1275
|
+
pages.push(/* @__PURE__ */ import_react10.default.createElement("span", {
|
|
895
1276
|
key: "start-ellipsis",
|
|
896
1277
|
className: "px-1 text-sm text-slate-500"
|
|
897
1278
|
}, "..."));
|
|
@@ -900,19 +1281,22 @@ var TableTailwind = function(param) {
|
|
|
900
1281
|
var end = Math.min(totalPages - 1, currentPage + siblings);
|
|
901
1282
|
for(var i = start; i <= end; i++)_loop(i);
|
|
902
1283
|
if (currentPage < totalPages - siblings - 1) {
|
|
903
|
-
pages.push(/* @__PURE__ */
|
|
1284
|
+
pages.push(/* @__PURE__ */ import_react10.default.createElement("span", {
|
|
904
1285
|
key: "end-ellipsis",
|
|
905
1286
|
className: "px-1 text-sm text-slate-500"
|
|
906
1287
|
}, "..."));
|
|
907
1288
|
}
|
|
908
1289
|
if (totalPages > 1) {
|
|
909
|
-
pages.push(/* @__PURE__ */
|
|
1290
|
+
pages.push(/* @__PURE__ */ import_react10.default.createElement("button", {
|
|
910
1291
|
key: totalPages,
|
|
911
1292
|
onClick: function() {
|
|
912
1293
|
return goToPage(totalPages);
|
|
913
1294
|
},
|
|
914
1295
|
disabled: currentPage === totalPages,
|
|
915
|
-
className: "inline-flex items-center rounded-md
|
|
1296
|
+
className: "inline-flex items-center rounded-md px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
|
|
1297
|
+
style: {
|
|
1298
|
+
background: currentPage === totalPages ? "#ccc" : "linear-gradient(to right, #1e73be, #28a97d)"
|
|
1299
|
+
}
|
|
916
1300
|
}, totalPages));
|
|
917
1301
|
}
|
|
918
1302
|
return pages;
|
|
@@ -920,23 +1304,29 @@ var TableTailwind = function(param) {
|
|
|
920
1304
|
var renderPagination = function() {
|
|
921
1305
|
if (!isPaginated) return null;
|
|
922
1306
|
var align = paginationPosition.includes("left") ? "justify-start" : paginationPosition.includes("right") ? "justify-end" : "justify-center";
|
|
923
|
-
return /* @__PURE__ */
|
|
1307
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
924
1308
|
className: "my-2 flex w-full ".concat(align)
|
|
925
|
-
}, /* @__PURE__ */
|
|
1309
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
926
1310
|
className: "flex flex-wrap items-center justify-center gap-2"
|
|
927
|
-
}, /* @__PURE__ */
|
|
1311
|
+
}, /* @__PURE__ */ import_react10.default.createElement("button", {
|
|
928
1312
|
onClick: function() {
|
|
929
1313
|
return goToPage(currentPage - 1);
|
|
930
1314
|
},
|
|
931
1315
|
disabled: currentPage === 1,
|
|
932
|
-
className: "inline-flex items-center rounded-md
|
|
933
|
-
|
|
1316
|
+
className: "inline-flex items-center rounded-md px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
|
|
1317
|
+
style: {
|
|
1318
|
+
background: currentPage === 1 ? "#ccc" : "linear-gradient(to right, #1e73be, #28a97d)"
|
|
1319
|
+
}
|
|
1320
|
+
}, "Previous"), renderPageNumbers(), /* @__PURE__ */ import_react10.default.createElement("button", {
|
|
934
1321
|
onClick: function() {
|
|
935
1322
|
return goToPage(currentPage + 1);
|
|
936
1323
|
},
|
|
937
1324
|
disabled: currentPage === totalPages,
|
|
938
|
-
className: "inline-flex items-center rounded-md
|
|
939
|
-
|
|
1325
|
+
className: "inline-flex items-center rounded-md px-3 py-1 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
|
|
1326
|
+
style: {
|
|
1327
|
+
background: currentPage === totalPages ? "#ccc" : "linear-gradient(to right, #1e73be, #28a97d)"
|
|
1328
|
+
}
|
|
1329
|
+
}, "Next"), /* @__PURE__ */ import_react10.default.createElement("select", {
|
|
940
1330
|
value: limit,
|
|
941
1331
|
onChange: function(e) {
|
|
942
1332
|
setPage === null || setPage === void 0 ? void 0 : setPage(1);
|
|
@@ -948,93 +1338,191 @@ var TableTailwind = function(param) {
|
|
|
948
1338
|
10,
|
|
949
1339
|
15
|
|
950
1340
|
].map(function(size) {
|
|
951
|
-
return /* @__PURE__ */
|
|
1341
|
+
return /* @__PURE__ */ import_react10.default.createElement("option", {
|
|
952
1342
|
key: size,
|
|
953
1343
|
value: size
|
|
954
1344
|
}, size);
|
|
955
|
-
})), /* @__PURE__ */
|
|
1345
|
+
})), /* @__PURE__ */ import_react10.default.createElement("span", {
|
|
956
1346
|
className: "ml-2 text-xs text-slate-600"
|
|
957
1347
|
}, "Page ", currentPage, " of ", totalPages, " (Total: ", totalCount, " items)")));
|
|
958
1348
|
};
|
|
959
|
-
|
|
1349
|
+
var summaryColKeyToUse = summaryColumnKey || summaryKey;
|
|
1350
|
+
return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, (searchable || onDownloadExcel || onDownloadPDF) && /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
960
1351
|
className: "mb-3 flex flex-wrap items-center justify-between gap-3"
|
|
961
|
-
}, searchable && /* @__PURE__ */
|
|
1352
|
+
}, searchable && /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
962
1353
|
className: "flex items-center gap-2"
|
|
963
|
-
}, /* @__PURE__ */
|
|
1354
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
964
1355
|
className: "relative flex items-center"
|
|
965
|
-
}, /* @__PURE__ */
|
|
1356
|
+
}, /* @__PURE__ */ import_react10.default.createElement("input", {
|
|
966
1357
|
type: "text",
|
|
967
1358
|
placeholder: "Search...",
|
|
968
1359
|
value: searchTerm,
|
|
969
1360
|
onChange: handleChange,
|
|
970
1361
|
className: "w-56 rounded-lg border border-transparent bg-white px-3 py-2 pr-8 text-sm font-medium text-[#1761A3] shadow-sm outline-none ring-1 ring-transparent transition focus:border-transparent focus:ring-2 focus:ring-emerald-400"
|
|
971
|
-
}), searchTerm && /* @__PURE__ */
|
|
1362
|
+
}), searchTerm && /* @__PURE__ */ import_react10.default.createElement("button", {
|
|
972
1363
|
onClick: onResetSearch,
|
|
973
1364
|
"aria-label": "Clear search",
|
|
974
1365
|
className: "absolute right-2 flex h-6 w-6 items-center justify-center rounded-full text-slate-400 transition hover:bg-slate-100 hover:text-slate-700"
|
|
975
|
-
}, /* @__PURE__ */
|
|
1366
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_outline2.XMarkIcon, {
|
|
976
1367
|
className: "h-4 w-4"
|
|
977
|
-
}))), /* @__PURE__ */
|
|
1368
|
+
}))), /* @__PURE__ */ import_react10.default.createElement("select", {
|
|
978
1369
|
value: searchMode,
|
|
979
1370
|
onChange: function(e) {
|
|
980
1371
|
return setSearchMode(e.target.value);
|
|
981
1372
|
},
|
|
982
1373
|
className: "rounded-lg border border-transparent bg-white px-2 py-2 text-sm font-medium text-slate-700 shadow-sm outline-none ring-1 ring-transparent transition hover:bg-slate-50 focus:border-transparent focus:ring-2 focus:ring-emerald-400"
|
|
983
1374
|
}, searchModeOptions.map(function(mode) {
|
|
984
|
-
return /* @__PURE__ */
|
|
1375
|
+
return /* @__PURE__ */ import_react10.default.createElement("option", {
|
|
985
1376
|
key: mode,
|
|
986
1377
|
value: mode
|
|
987
1378
|
}, mode === "startsWith" ? "Starts With" : "Includes");
|
|
988
|
-
}))), (onDownloadPDF || onDownloadExcel) && /* @__PURE__ */
|
|
1379
|
+
}))), (onDownloadPDF || onDownloadExcel) && /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
989
1380
|
className: "mt-1 flex items-center gap-2"
|
|
990
|
-
}, onDownloadPDF && /* @__PURE__ */
|
|
1381
|
+
}, onDownloadPDF && /* @__PURE__ */ import_react10.default.createElement("button", {
|
|
991
1382
|
onClick: function() {
|
|
992
1383
|
return onDownloadPDF(data, headers);
|
|
993
1384
|
},
|
|
994
|
-
className: "inline-flex items-center gap-1 rounded-md
|
|
995
|
-
|
|
1385
|
+
className: "inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-90",
|
|
1386
|
+
style: {
|
|
1387
|
+
background: "linear-gradient(to right, #1e73be, #28a97d)"
|
|
1388
|
+
}
|
|
1389
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_outline2.ArrowDownOnSquareIcon, {
|
|
996
1390
|
className: "h-5 w-5"
|
|
997
|
-
})), onDownloadExcel && /* @__PURE__ */
|
|
1391
|
+
})), onDownloadExcel && /* @__PURE__ */ import_react10.default.createElement("button", {
|
|
998
1392
|
onClick: function() {
|
|
999
1393
|
return onDownloadExcel(data, headers);
|
|
1000
1394
|
},
|
|
1001
|
-
className: "inline-flex items-center gap-1 rounded-md
|
|
1002
|
-
|
|
1395
|
+
className: "inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-90",
|
|
1396
|
+
style: {
|
|
1397
|
+
background: "linear-gradient(to right, #1e73be, #28a97d)"
|
|
1398
|
+
}
|
|
1399
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_outline2.ArrowDownOnSquareIcon, {
|
|
1003
1400
|
className: "h-5 w-5"
|
|
1004
|
-
}), /* @__PURE__ */
|
|
1401
|
+
}), /* @__PURE__ */ import_react10.default.createElement("span", null, "Excel")))), paginationPosition.startsWith("top") && data.length > 0 && renderPagination(), /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
1005
1402
|
className: "mt-1 overflow-hidden rounded-xl border border-[#1761A3] bg-white"
|
|
1006
|
-
}, /* @__PURE__ */
|
|
1403
|
+
}, /* @__PURE__ */ import_react10.default.createElement("table", {
|
|
1007
1404
|
className: "w-full border-collapse"
|
|
1008
|
-
}, /* @__PURE__ */
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1405
|
+
}, /* @__PURE__ */ import_react10.default.createElement("thead", {
|
|
1406
|
+
style: {
|
|
1407
|
+
background: "linear-gradient(to right, #1e73be, #28a97d)"
|
|
1408
|
+
}
|
|
1409
|
+
}, /* @__PURE__ */ import_react10.default.createElement("tr", null, headers.map(function(header, idx) {
|
|
1410
|
+
return /* @__PURE__ */ import_react10.default.createElement("th", {
|
|
1012
1411
|
key: idx,
|
|
1013
1412
|
className: "h-[50px] px-3 py-2 text-left text-sm font-bold text-white first:rounded-tl-xl last:rounded-tr-xl"
|
|
1014
1413
|
}, header.label);
|
|
1015
|
-
}), actions && /* @__PURE__ */
|
|
1414
|
+
}), actions && /* @__PURE__ */ import_react10.default.createElement("th", {
|
|
1016
1415
|
className: "h-[50px] px-3 py-2 text-left text-sm font-bold text-white"
|
|
1017
|
-
}, "Actions"))), /* @__PURE__ */
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1416
|
+
}, "Actions"))), /* @__PURE__ */ import_react10.default.createElement("tbody", null, data.length > 0 ? data.map(function(row, rowIndex) {
|
|
1417
|
+
var isExpandable = !!summary;
|
|
1418
|
+
var isExpanded = summary === "single" ? expandedRowIndex === rowIndex : summary === "multi" ? expandedRowIndexes.has(rowIndex) : false;
|
|
1419
|
+
var handleRowClick = function() {
|
|
1420
|
+
if (!summary) return;
|
|
1421
|
+
if (summary === "single") {
|
|
1422
|
+
setExpandedRowIndex(function(prev) {
|
|
1423
|
+
return prev === rowIndex ? null : rowIndex;
|
|
1424
|
+
});
|
|
1425
|
+
} else if (summary === "multi") {
|
|
1426
|
+
setExpandedRowIndexes(function(prev) {
|
|
1427
|
+
var next = new Set(prev);
|
|
1428
|
+
if (next.has(rowIndex)) {
|
|
1429
|
+
next.delete(rowIndex);
|
|
1430
|
+
} else {
|
|
1431
|
+
next.add(rowIndex);
|
|
1432
|
+
}
|
|
1433
|
+
return next;
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
var handleCloseDrawer = function(e) {
|
|
1438
|
+
e.stopPropagation();
|
|
1439
|
+
if (summary === "single") {
|
|
1440
|
+
setExpandedRowIndex(null);
|
|
1441
|
+
} else if (summary === "multi") {
|
|
1442
|
+
setExpandedRowIndexes(function(prev) {
|
|
1443
|
+
var next = new Set(prev);
|
|
1444
|
+
next.delete(rowIndex);
|
|
1445
|
+
return next;
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1449
|
+
var titleValue = row[summaryTitleField];
|
|
1450
|
+
var summaryValue = row[summaryKey];
|
|
1451
|
+
return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, {
|
|
1452
|
+
key: rowIndex
|
|
1453
|
+
}, /* @__PURE__ */ import_react10.default.createElement("tr", {
|
|
1454
|
+
onClick: isExpandable ? handleRowClick : void 0,
|
|
1455
|
+
className: "h-[57px] border-b border-slate-200 text-sm text-slate-900 even:bg-slate-50 hover:bg-slate-100 ".concat(isExpandable ? "cursor-pointer transition-colors" : "", " ").concat(highlightRowColor || "", " ").concat(isExpanded ? "bg-[#1e73be80]" : ""),
|
|
1456
|
+
style: isExpanded ? {
|
|
1457
|
+
backgroundColor: "rgba(30, 190, 145, 0.38)"
|
|
1458
|
+
} : void 0
|
|
1021
1459
|
}, headers.map(function(header, cellIdx) {
|
|
1022
|
-
return /* @__PURE__ */
|
|
1460
|
+
return /* @__PURE__ */ import_react10.default.createElement("td", {
|
|
1023
1461
|
key: cellIdx,
|
|
1024
1462
|
className: "px-3 py-2"
|
|
1025
1463
|
}, function() {
|
|
1026
1464
|
var value = row[header.key];
|
|
1027
|
-
if (
|
|
1465
|
+
if (summaryColumn && header.key === summaryColKeyToUse) {
|
|
1466
|
+
if (value == null) {
|
|
1467
|
+
return "-";
|
|
1468
|
+
}
|
|
1469
|
+
if (import_react10.default.isValidElement(value)) {
|
|
1470
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
1471
|
+
className: "text-sm leading-relaxed text-slate-600 break-words whitespace-normal line-clamp-2"
|
|
1472
|
+
}, value);
|
|
1473
|
+
}
|
|
1474
|
+
var fullText;
|
|
1475
|
+
if (typeof value === "string") {
|
|
1476
|
+
fullText = value;
|
|
1477
|
+
} else if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") {
|
|
1478
|
+
fullText = JSON.stringify(value);
|
|
1479
|
+
} else {
|
|
1480
|
+
fullText = String(value);
|
|
1481
|
+
}
|
|
1482
|
+
var summaryOverride = textWrapColumnMaxLengths && textWrapColumnMaxLengths[summaryColKeyToUse];
|
|
1483
|
+
var maxLen = summaryOverride !== null && summaryOverride !== void 0 ? summaryOverride : summaryColumnMaxLength;
|
|
1484
|
+
var truncated = fullText.length <= maxLen ? fullText : fullText.substring(0, maxLen).trim() + "...";
|
|
1485
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
1486
|
+
className: "text-sm leading-relaxed text-slate-600 break-words whitespace-normal line-clamp-2",
|
|
1487
|
+
title: fullText
|
|
1488
|
+
}, truncated);
|
|
1489
|
+
}
|
|
1490
|
+
if (textWrapColumns && textWrapColumns.includes(header.key)) {
|
|
1491
|
+
if (value == null) {
|
|
1492
|
+
return "-";
|
|
1493
|
+
}
|
|
1494
|
+
if (import_react10.default.isValidElement(value)) {
|
|
1495
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
1496
|
+
className: "text-sm leading-relaxed text-slate-600 break-words whitespace-normal line-clamp-2"
|
|
1497
|
+
}, value);
|
|
1498
|
+
}
|
|
1499
|
+
var fullText1;
|
|
1500
|
+
if (typeof value === "string") {
|
|
1501
|
+
fullText1 = value;
|
|
1502
|
+
} else if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") {
|
|
1503
|
+
fullText1 = JSON.stringify(value);
|
|
1504
|
+
} else {
|
|
1505
|
+
fullText1 = String(value);
|
|
1506
|
+
}
|
|
1507
|
+
var perColMax = textWrapColumnMaxLengths && textWrapColumnMaxLengths[header.key];
|
|
1508
|
+
var maxLen1 = perColMax !== null && perColMax !== void 0 ? perColMax : textWrapMaxLength;
|
|
1509
|
+
var truncated1 = fullText1.length <= maxLen1 ? fullText1 : fullText1.substring(0, maxLen1).trim() + "...";
|
|
1510
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
1511
|
+
className: "text-sm leading-relaxed text-slate-600 break-words whitespace-normal line-clamp-2",
|
|
1512
|
+
title: fullText1
|
|
1513
|
+
}, truncated1);
|
|
1514
|
+
}
|
|
1515
|
+
if (import_react10.default.isValidElement(value)) return value;
|
|
1028
1516
|
if (typeof value === "function") {
|
|
1029
1517
|
try {
|
|
1030
1518
|
var result = value();
|
|
1031
|
-
if (
|
|
1519
|
+
if (import_react10.default.isValidElement(result)) return result;
|
|
1032
1520
|
} catch (e) {
|
|
1033
1521
|
console.warn("Error executing function in table cell:", e);
|
|
1034
1522
|
}
|
|
1035
1523
|
}
|
|
1036
1524
|
if (typeof value === "string" && value.trim().startsWith("<") && value.trim().endsWith(">")) {
|
|
1037
|
-
return /* @__PURE__ */
|
|
1525
|
+
return /* @__PURE__ */ import_react10.default.createElement("span", {
|
|
1038
1526
|
dangerouslySetInnerHTML: {
|
|
1039
1527
|
__html: value
|
|
1040
1528
|
}
|
|
@@ -1042,9 +1530,9 @@ var TableTailwind = function(param) {
|
|
|
1042
1530
|
}
|
|
1043
1531
|
if (Array.isArray(value)) {
|
|
1044
1532
|
if (value.some(function(item) {
|
|
1045
|
-
return
|
|
1533
|
+
return import_react10.default.isValidElement(item);
|
|
1046
1534
|
})) {
|
|
1047
|
-
return /* @__PURE__ */
|
|
1535
|
+
return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, value);
|
|
1048
1536
|
}
|
|
1049
1537
|
return value.join(", ");
|
|
1050
1538
|
}
|
|
@@ -1055,28 +1543,52 @@ var TableTailwind = function(param) {
|
|
|
1055
1543
|
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") return JSON.stringify(value);
|
|
1056
1544
|
return String(value);
|
|
1057
1545
|
}());
|
|
1058
|
-
}), actions && /* @__PURE__ */
|
|
1546
|
+
}), actions && /* @__PURE__ */ import_react10.default.createElement("td", {
|
|
1059
1547
|
className: "px-3 py-2"
|
|
1060
|
-
}, actions(row)))
|
|
1061
|
-
|
|
1548
|
+
}, actions(row))), isExpandable && isExpanded && /* @__PURE__ */ import_react10.default.createElement("tr", {
|
|
1549
|
+
className: "border-b border-blue-200"
|
|
1550
|
+
}, /* @__PURE__ */ import_react10.default.createElement("td", {
|
|
1551
|
+
colSpan: headers.length + (actions ? 1 : 0),
|
|
1552
|
+
className: "bg-gradient-to-r from-blue-25 to-blue-50 px-3 py-4"
|
|
1553
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
1554
|
+
className: "flex items-start gap-3"
|
|
1555
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
1556
|
+
className: "flex-1"
|
|
1557
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
1558
|
+
className: "mb-2 flex items-start justify-between"
|
|
1559
|
+
}, /* @__PURE__ */ import_react10.default.createElement("h4", {
|
|
1560
|
+
className: "text-sm font-semibold text-slate-800"
|
|
1561
|
+
}, titleValue ? "Summary for ".concat(String(titleValue)) : "Summary"), /* @__PURE__ */ import_react10.default.createElement("button", {
|
|
1562
|
+
onClick: handleCloseDrawer,
|
|
1563
|
+
className: "ml-2 flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full transition-colors hover:bg-blue-200",
|
|
1564
|
+
"aria-label": "Close summary"
|
|
1565
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_outline2.XMarkIcon, {
|
|
1566
|
+
className: "h-4 w-4 text-slate-600"
|
|
1567
|
+
}))), /* @__PURE__ */ import_react10.default.createElement("p", {
|
|
1568
|
+
className: "text-sm leading-relaxed text-slate-600"
|
|
1569
|
+
}, summaryValue == null ? "-" : import_react10.default.isValidElement(summaryValue) ? summaryValue : typeof summaryValue === "string" ? summaryValue : (typeof summaryValue === "undefined" ? "undefined" : _type_of(summaryValue)) === "object" ? JSON.stringify(summaryValue) : String(summaryValue)))))));
|
|
1570
|
+
}) : /* @__PURE__ */ import_react10.default.createElement("tr", null, /* @__PURE__ */ import_react10.default.createElement("td", {
|
|
1062
1571
|
colSpan: headers.length + (actions ? 1 : 0),
|
|
1063
1572
|
className: "px-4 py-6 text-center text-slate-500"
|
|
1064
|
-
}, /* @__PURE__ */
|
|
1573
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
1065
1574
|
className: "flex items-center justify-center gap-4"
|
|
1066
|
-
}, /* @__PURE__ */
|
|
1575
|
+
}, /* @__PURE__ */ import_react10.default.createElement("span", null, "No records found."), onResetSearch && /* @__PURE__ */ import_react10.default.createElement("button", {
|
|
1067
1576
|
onClick: onResetSearch,
|
|
1068
|
-
className: "inline-flex items-center gap-1 rounded-md
|
|
1069
|
-
|
|
1577
|
+
className: "inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium text-white shadow-sm hover:opacity-90",
|
|
1578
|
+
style: {
|
|
1579
|
+
background: "linear-gradient(to right, #1e73b, #28a97d)"
|
|
1580
|
+
}
|
|
1581
|
+
}, /* @__PURE__ */ import_react10.default.createElement("span", null, "Reset"), /* @__PURE__ */ import_react10.default.createElement(import_outline2.ArrowPathIcon, {
|
|
1070
1582
|
className: "h-5 w-5"
|
|
1071
1583
|
})))))))), paginationPosition.startsWith("bottom") && data.length > 0 && renderPagination());
|
|
1072
1584
|
};
|
|
1073
|
-
|
|
1585
|
+
Table2.displayName = "Table";
|
|
1074
1586
|
// src/components/TooltipTailwindCSS.tsx
|
|
1075
|
-
var
|
|
1587
|
+
var import_react11 = __toESM(require("react"));
|
|
1076
1588
|
var Tooltip = function(param) {
|
|
1077
|
-
var text = param.text, _param_position = param.position, position = _param_position === void 0 ? "top" : _param_position, children = param.children, _param_variant = param.variant, variant = _param_variant === void 0 ? "default" : _param_variant, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className, _param_textColor = param.textColor, textColor = _param_textColor === void 0 ? "text-gray-800" : _param_textColor, _param_backgroundColor = param.backgroundColor, backgroundColor = _param_backgroundColor === void 0 ? "bg-
|
|
1078
|
-
var _ref = _sliced_to_array((0,
|
|
1079
|
-
var _ref1 = _sliced_to_array((0,
|
|
1589
|
+
var text = param.text, _param_position = param.position, position = _param_position === void 0 ? "top" : _param_position, children = param.children, _param_variant = param.variant, variant = _param_variant === void 0 ? "default" : _param_variant, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className, _param_textColor = param.textColor, textColor = _param_textColor === void 0 ? "text-gray-800" : _param_textColor, _param_backgroundColor = param.backgroundColor, backgroundColor = _param_backgroundColor === void 0 ? "bg-gradient-to-r from-[rgba(23,97,163,1)] to-[rgba(77,175,131,1)]" : _param_backgroundColor, image = param.image, animation = param.animation;
|
|
1590
|
+
var _ref = _sliced_to_array((0, import_react11.useState)(false), 2), visible = _ref[0], setVisible = _ref[1];
|
|
1591
|
+
var _ref1 = _sliced_to_array((0, import_react11.useState)(false), 2), showAnimation = _ref1[0], setShowAnimation = _ref1[1];
|
|
1080
1592
|
var showTooltip = function() {
|
|
1081
1593
|
setVisible(true);
|
|
1082
1594
|
if (animation) {
|
|
@@ -1110,7 +1622,7 @@ var Tooltip = function(param) {
|
|
|
1110
1622
|
var tooltipClasses = variant === "transparent" ? "".concat(transparentTooltipClasses, " ").concat(positionClasses[position]) : "".concat(defaultTooltipClasses, " ").concat(positionClasses[position]);
|
|
1111
1623
|
var renderTooltipContent = function() {
|
|
1112
1624
|
if (image) {
|
|
1113
|
-
return /* @__PURE__ */
|
|
1625
|
+
return /* @__PURE__ */ import_react11.default.createElement("img", {
|
|
1114
1626
|
src: image.src,
|
|
1115
1627
|
alt: image.alt || "Tooltip image",
|
|
1116
1628
|
width: image.width || 200,
|
|
@@ -1124,26 +1636,1297 @@ var Tooltip = function(param) {
|
|
|
1124
1636
|
var renderAnimation = function() {
|
|
1125
1637
|
if (!animation || !showAnimation) return null;
|
|
1126
1638
|
var AnimationComponent = animation.component;
|
|
1127
|
-
return /* @__PURE__ */
|
|
1639
|
+
return /* @__PURE__ */ import_react11.default.createElement(AnimationComponent, _object_spread({
|
|
1128
1640
|
isActive: showAnimation
|
|
1129
1641
|
}, animation.props));
|
|
1130
1642
|
};
|
|
1131
|
-
return /* @__PURE__ */
|
|
1643
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
1132
1644
|
className: containerClasses,
|
|
1133
1645
|
onMouseEnter: showTooltip,
|
|
1134
1646
|
onMouseLeave: hideTooltip,
|
|
1135
1647
|
onFocus: showTooltip,
|
|
1136
1648
|
onBlur: hideTooltip
|
|
1137
|
-
}, children, renderAnimation(), /* @__PURE__ */
|
|
1649
|
+
}, children, renderAnimation(), /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
1138
1650
|
className: tooltipClasses,
|
|
1139
1651
|
role: "tooltip"
|
|
1140
|
-
}, renderTooltipContent(), variant === "default" && !image && /* @__PURE__ */
|
|
1652
|
+
}, renderTooltipContent(), variant === "default" && !image && /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
1141
1653
|
className: "".concat(arrowBaseClasses, " ").concat(arrowPositionClasses[position], " ").concat(arrowBackgroundClass, " rounded-sm")
|
|
1142
1654
|
})));
|
|
1143
1655
|
};
|
|
1144
1656
|
Tooltip.displayName = "Tooltip";
|
|
1657
|
+
// src/components/Calendar.tsx
|
|
1658
|
+
var import_react12 = __toESM(require("react"));
|
|
1659
|
+
var import_hi = require("react-icons/hi");
|
|
1660
|
+
var import_hi2 = require("react-icons/hi2");
|
|
1661
|
+
var convertToDateString = function(date) {
|
|
1662
|
+
if (!date) return "";
|
|
1663
|
+
var year = date.year;
|
|
1664
|
+
var month = String(date.month + 1).padStart(2, "0");
|
|
1665
|
+
var day = String(date.day).padStart(2, "0");
|
|
1666
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
1667
|
+
};
|
|
1668
|
+
var cn4 = function() {
|
|
1669
|
+
for(var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++){
|
|
1670
|
+
classes[_key] = arguments[_key];
|
|
1671
|
+
}
|
|
1672
|
+
return classes.filter(Boolean).join(" ");
|
|
1673
|
+
};
|
|
1674
|
+
var isSameDate = function(date1, date2) {
|
|
1675
|
+
if (!date1 || !date2) return false;
|
|
1676
|
+
return date1.year === date2.year && date1.month === date2.month && date1.day === date2.day;
|
|
1677
|
+
};
|
|
1678
|
+
var formatDate = function(date) {
|
|
1679
|
+
if (!date) return "";
|
|
1680
|
+
var month = String(date.month + 1).padStart(2, "0");
|
|
1681
|
+
var day = String(date.day).padStart(2, "0");
|
|
1682
|
+
var year = String(date.year);
|
|
1683
|
+
return "".concat(month, "-").concat(day, "-").concat(year);
|
|
1684
|
+
};
|
|
1685
|
+
var formatDateWithFormat = function(date, format) {
|
|
1686
|
+
if (!date) return "";
|
|
1687
|
+
var monthNum = date.month + 1;
|
|
1688
|
+
var month = String(monthNum).padStart(2, "0");
|
|
1689
|
+
var day = String(date.day).padStart(2, "0");
|
|
1690
|
+
var year = String(date.year);
|
|
1691
|
+
var monthNames = [
|
|
1692
|
+
"JAN",
|
|
1693
|
+
"FEB",
|
|
1694
|
+
"MAR",
|
|
1695
|
+
"APR",
|
|
1696
|
+
"MAY",
|
|
1697
|
+
"JUN",
|
|
1698
|
+
"JUL",
|
|
1699
|
+
"AUG",
|
|
1700
|
+
"SEP",
|
|
1701
|
+
"OCT",
|
|
1702
|
+
"NOV",
|
|
1703
|
+
"DEC"
|
|
1704
|
+
];
|
|
1705
|
+
var monthAbbr = monthNames[date.month];
|
|
1706
|
+
if (format === "none") {
|
|
1707
|
+
return "".concat(month, "-").concat(day, "-").concat(year);
|
|
1708
|
+
}
|
|
1709
|
+
switch(format){
|
|
1710
|
+
case "MM/DD/YYYY":
|
|
1711
|
+
return "".concat(month, "/").concat(day, "/").concat(year);
|
|
1712
|
+
case "DD/MM/YYYY":
|
|
1713
|
+
return "".concat(day, "/").concat(month, "/").concat(year);
|
|
1714
|
+
case "YYYY/MM/DD":
|
|
1715
|
+
return "".concat(year, "/").concat(month, "/").concat(day);
|
|
1716
|
+
case "MMM/DD/YYYY":
|
|
1717
|
+
return "".concat(monthAbbr, "/").concat(day, "/").concat(year);
|
|
1718
|
+
case "DD/MMM/YYYY":
|
|
1719
|
+
return "".concat(day, "/").concat(monthAbbr, "/").concat(year);
|
|
1720
|
+
case "YYYY/MMM/DD":
|
|
1721
|
+
return "".concat(year, "/").concat(monthAbbr, "/").concat(day);
|
|
1722
|
+
case "MMM DD, YYYY":
|
|
1723
|
+
return "".concat(monthAbbr, " ").concat(day, ", ").concat(year);
|
|
1724
|
+
case "DD MMM YYYY":
|
|
1725
|
+
return "".concat(day, " ").concat(monthAbbr, " ").concat(year);
|
|
1726
|
+
case "YYYY MMM DD":
|
|
1727
|
+
return "".concat(year, " ").concat(monthAbbr, " ").concat(day);
|
|
1728
|
+
case "MM-DD-YYYY":
|
|
1729
|
+
return "".concat(month, "-").concat(day, "-").concat(year);
|
|
1730
|
+
case "DD-MM-YYYY":
|
|
1731
|
+
return "".concat(day, "-").concat(month, "-").concat(year);
|
|
1732
|
+
case "YYYY-MM-DD":
|
|
1733
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
1734
|
+
case "MMM-DD-YYYY":
|
|
1735
|
+
return "".concat(monthAbbr, "-").concat(day, "-").concat(year);
|
|
1736
|
+
case "DD-MMM-YYYY":
|
|
1737
|
+
return "".concat(day, "-").concat(monthAbbr, "-").concat(year);
|
|
1738
|
+
case "YYYY-MMM-DD":
|
|
1739
|
+
return "".concat(year, "-").concat(monthAbbr, "-").concat(day);
|
|
1740
|
+
case "DD.MM.YYYY":
|
|
1741
|
+
return "".concat(day, ".").concat(month, ".").concat(year);
|
|
1742
|
+
case "MM.DD.YYYY":
|
|
1743
|
+
return "".concat(month, ".").concat(day, ".").concat(year);
|
|
1744
|
+
case "YYYY.MM.DD":
|
|
1745
|
+
return "".concat(year, ".").concat(month, ".").concat(day);
|
|
1746
|
+
default:
|
|
1747
|
+
return "".concat(month, "-").concat(day, "-").concat(year);
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
var formatTime = function(time) {
|
|
1751
|
+
var format = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "12h";
|
|
1752
|
+
if (!time) return "";
|
|
1753
|
+
if (format === "24h") {
|
|
1754
|
+
var hour24 = time.hour;
|
|
1755
|
+
if (time.period === "PM" && time.hour !== 12) {
|
|
1756
|
+
hour24 = time.hour + 12;
|
|
1757
|
+
} else if (time.period === "AM" && time.hour === 12) {
|
|
1758
|
+
hour24 = 0;
|
|
1759
|
+
}
|
|
1760
|
+
var hour2 = String(hour24).padStart(2, "0");
|
|
1761
|
+
var minute2 = String(time.minute).padStart(2, "0");
|
|
1762
|
+
return "".concat(hour2, ":").concat(minute2);
|
|
1763
|
+
}
|
|
1764
|
+
var hour = String(time.hour).padStart(2, "0");
|
|
1765
|
+
var minute = String(time.minute).padStart(2, "0");
|
|
1766
|
+
return "".concat(hour, ":").concat(minute, " ").concat(time.period);
|
|
1767
|
+
};
|
|
1768
|
+
var getDaysInMonth = function(year, monthIndex) {
|
|
1769
|
+
return new Date(year, monthIndex + 1, 0).getDate();
|
|
1770
|
+
};
|
|
1771
|
+
var getFirstDayOfMonth = function(year, monthIndex) {
|
|
1772
|
+
return new Date(year, monthIndex, 1).getDay();
|
|
1773
|
+
};
|
|
1774
|
+
var getMonthName = function(monthIndex) {
|
|
1775
|
+
return new Date(2024, monthIndex, 1).toLocaleDateString("en-US", {
|
|
1776
|
+
month: "long"
|
|
1777
|
+
});
|
|
1778
|
+
};
|
|
1779
|
+
var DAY_NAMES = [
|
|
1780
|
+
"SUN",
|
|
1781
|
+
"MON",
|
|
1782
|
+
"TUE",
|
|
1783
|
+
"WED",
|
|
1784
|
+
"THU",
|
|
1785
|
+
"FRI",
|
|
1786
|
+
"SAT"
|
|
1787
|
+
];
|
|
1788
|
+
var DATE_FORMAT_OPTIONS = [
|
|
1789
|
+
"none",
|
|
1790
|
+
"MM/DD/YYYY",
|
|
1791
|
+
"DD/MM/YYYY",
|
|
1792
|
+
"YYYY/MM/DD",
|
|
1793
|
+
"MMM/DD/YYYY",
|
|
1794
|
+
"DD/MMM/YYYY",
|
|
1795
|
+
"YYYY/MMM/DD",
|
|
1796
|
+
"MMM DD, YYYY",
|
|
1797
|
+
"DD MMM YYYY",
|
|
1798
|
+
"YYYY MMM DD",
|
|
1799
|
+
"MM-DD-YYYY",
|
|
1800
|
+
"DD-MM-YYYY",
|
|
1801
|
+
"YYYY-MM-DD",
|
|
1802
|
+
"MMM-DD-YYYY",
|
|
1803
|
+
"DD-MMM-YYYY",
|
|
1804
|
+
"YYYY-MMM-DD",
|
|
1805
|
+
"DD.MM.YYYY",
|
|
1806
|
+
"MM.DD.YYYY",
|
|
1807
|
+
"YYYY.MM.DD"
|
|
1808
|
+
];
|
|
1809
|
+
var TIME_ZONE_OPTIONS = [
|
|
1810
|
+
"none",
|
|
1811
|
+
"UTC",
|
|
1812
|
+
"GMT",
|
|
1813
|
+
"EST",
|
|
1814
|
+
"EDT",
|
|
1815
|
+
"CST",
|
|
1816
|
+
"CDT",
|
|
1817
|
+
"MST",
|
|
1818
|
+
"MDT",
|
|
1819
|
+
"PST",
|
|
1820
|
+
"PDT",
|
|
1821
|
+
"IST",
|
|
1822
|
+
"JST",
|
|
1823
|
+
"KST",
|
|
1824
|
+
"AEST",
|
|
1825
|
+
"AEDT",
|
|
1826
|
+
"NZST",
|
|
1827
|
+
"NZDT",
|
|
1828
|
+
"CET",
|
|
1829
|
+
"CEST",
|
|
1830
|
+
"BST",
|
|
1831
|
+
"AST",
|
|
1832
|
+
"HST",
|
|
1833
|
+
"AKST",
|
|
1834
|
+
"AKDT",
|
|
1835
|
+
"SST",
|
|
1836
|
+
"NST",
|
|
1837
|
+
"WET",
|
|
1838
|
+
"WEST",
|
|
1839
|
+
"EET",
|
|
1840
|
+
"EEST",
|
|
1841
|
+
"MSK",
|
|
1842
|
+
"HKT",
|
|
1843
|
+
"SGT",
|
|
1844
|
+
"PKT",
|
|
1845
|
+
"BDT",
|
|
1846
|
+
"AWST",
|
|
1847
|
+
"ACST",
|
|
1848
|
+
"ACDT",
|
|
1849
|
+
"NFT"
|
|
1850
|
+
];
|
|
1851
|
+
var compareInternalDates = function(a, b) {
|
|
1852
|
+
if (a.year !== b.year) return a.year - b.year;
|
|
1853
|
+
if (a.monthIndex !== b.monthIndex) return a.monthIndex - b.monthIndex;
|
|
1854
|
+
return a.day - b.day;
|
|
1855
|
+
};
|
|
1856
|
+
var addDaysInternal = function(start, daysToAdd) {
|
|
1857
|
+
var y = start.year;
|
|
1858
|
+
var m = start.monthIndex;
|
|
1859
|
+
var d = start.day + daysToAdd;
|
|
1860
|
+
while(true){
|
|
1861
|
+
var dim = getDaysInMonth(y, m);
|
|
1862
|
+
if (d <= dim) break;
|
|
1863
|
+
d -= dim;
|
|
1864
|
+
m += 1;
|
|
1865
|
+
if (m > 11) {
|
|
1866
|
+
m = 0;
|
|
1867
|
+
y += 1;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
return {
|
|
1871
|
+
year: y,
|
|
1872
|
+
monthIndex: m,
|
|
1873
|
+
day: d
|
|
1874
|
+
};
|
|
1875
|
+
};
|
|
1876
|
+
var isBlockedDateHelper = function(date, config) {
|
|
1877
|
+
if (!config || config.days <= 0) return false;
|
|
1878
|
+
var startInternal = {
|
|
1879
|
+
year: config.startDate.year,
|
|
1880
|
+
monthIndex: config.startDate.month - 1,
|
|
1881
|
+
day: config.startDate.day
|
|
1882
|
+
};
|
|
1883
|
+
var endInternal = addDaysInternal(startInternal, config.days - 1);
|
|
1884
|
+
var currentInternal = {
|
|
1885
|
+
year: date.year,
|
|
1886
|
+
monthIndex: date.month,
|
|
1887
|
+
day: date.day
|
|
1888
|
+
};
|
|
1889
|
+
var afterOrOnStart = compareInternalDates(currentInternal, startInternal) >= 0;
|
|
1890
|
+
var beforeOrOnEnd = compareInternalDates(currentInternal, endInternal) <= 0;
|
|
1891
|
+
return afterOrOnStart && beforeOrOnEnd;
|
|
1892
|
+
};
|
|
1893
|
+
var getLocalTimeZone = function() {
|
|
1894
|
+
var timeZoneString = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1895
|
+
var date = /* @__PURE__ */ new Date();
|
|
1896
|
+
var shortTimeZone = date.toLocaleTimeString("en-us", {
|
|
1897
|
+
timeZoneName: "short"
|
|
1898
|
+
}).split(" ")[2];
|
|
1899
|
+
return shortTimeZone || timeZoneString;
|
|
1900
|
+
};
|
|
1901
|
+
var SIZE_SCALES = {
|
|
1902
|
+
"small": 0.65,
|
|
1903
|
+
"medium": 0.8,
|
|
1904
|
+
"large": 0.9,
|
|
1905
|
+
"extra-large": 1
|
|
1906
|
+
};
|
|
1907
|
+
var getDeviceScale = function() {
|
|
1908
|
+
if (typeof window === "undefined") return 1;
|
|
1909
|
+
var width = window.innerWidth;
|
|
1910
|
+
if (width < 640) return 0.7;
|
|
1911
|
+
if (width < 1024) return 0.85;
|
|
1912
|
+
return 1;
|
|
1913
|
+
};
|
|
1914
|
+
var Calendar = function(param) {
|
|
1915
|
+
var value = param.value, onChange = param.onChange, _param_enableRangeSelection = param.enableRangeSelection, enableRangeSelection = _param_enableRangeSelection === void 0 ? false : _param_enableRangeSelection, rangeValue = param.rangeValue, onRangeChange = param.onRangeChange, _param_enableTimeSelection = param.enableTimeSelection, enableTimeSelection = _param_enableTimeSelection === void 0 ? false : _param_enableTimeSelection, timeValue = param.timeValue, onTimeChange = param.onTimeChange, _param_showTimeFormatToggle = param.showTimeFormatToggle, showTimeFormatToggle = _param_showTimeFormatToggle === void 0 ? false : _param_showTimeFormatToggle, _param_timeFormat = param.timeFormat, timeFormat = _param_timeFormat === void 0 ? "12h" : _param_timeFormat, onTimeFormatChange = param.onTimeFormatChange, _param_autoHide = param.autoHide, autoHide = _param_autoHide === void 0 ? false : _param_autoHide, _param_showTodayButton = param.showTodayButton, showTodayButton = _param_showTodayButton === void 0 ? false : _param_showTodayButton, _param_showClearButton = param.showClearButton, showClearButton = _param_showClearButton === void 0 ? false : _param_showClearButton, _param_placeholder = param.placeholder, placeholder = _param_placeholder === void 0 ? "Select date" : _param_placeholder, className = param.className, _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, onShow = param.onShow, onHide = param.onHide, icon = param.icon, _param_showIcon = param.showIcon, showIcon = _param_showIcon === void 0 ? true : _param_showIcon, _param_size = param.size, size = _param_size === void 0 ? "extra-large" : _param_size, _param_enableYearDropdown = param.enableYearDropdown, enableYearDropdown = _param_enableYearDropdown === void 0 ? false : _param_enableYearDropdown, _param_showDateFormatSelector = param.showDateFormatSelector, showDateFormatSelector = _param_showDateFormatSelector === void 0 ? false : _param_showDateFormatSelector, _param_dateFormat = param.dateFormat, dateFormat = _param_dateFormat === void 0 ? "none" : _param_dateFormat, onDateFormatChange = param.onDateFormatChange, _param_showTimeZoneSelector = param.showTimeZoneSelector, showTimeZoneSelector = _param_showTimeZoneSelector === void 0 ? false : _param_showTimeZoneSelector, _param_timeZoneFormat = param.timeZoneFormat, timeZoneFormat = _param_timeZoneFormat === void 0 ? "none" : _param_timeZoneFormat, onTimeZoneFormatChange = param.onTimeZoneFormatChange, blockDateConfig = param.blockDateConfig;
|
|
1916
|
+
var today = /* @__PURE__ */ new Date();
|
|
1917
|
+
var _ref = _sliced_to_array((0, import_react12.useState)((value === null || value === void 0 ? void 0 : value.year) || today.getFullYear()), 2), currentYear = _ref[0], setCurrentYear = _ref[1];
|
|
1918
|
+
var _value_month;
|
|
1919
|
+
var _ref1 = _sliced_to_array((0, import_react12.useState)((_value_month = value === null || value === void 0 ? void 0 : value.month) !== null && _value_month !== void 0 ? _value_month : today.getMonth()), 2), currentMonth = _ref1[0], setCurrentMonth = _ref1[1];
|
|
1920
|
+
var _ref2 = _sliced_to_array((0, import_react12.useState)(false), 2), isOpen = _ref2[0], setIsOpen = _ref2[1];
|
|
1921
|
+
var _ref3 = _sliced_to_array((0, import_react12.useState)("start"), 2), activeField = _ref3[0], setActiveField = _ref3[1];
|
|
1922
|
+
var _ref4 = _sliced_to_array((0, import_react12.useState)(false), 2), showTimeSelector = _ref4[0], setShowTimeSelector = _ref4[1];
|
|
1923
|
+
var _ref5 = _sliced_to_array((0, import_react12.useState)((timeValue === null || timeValue === void 0 ? void 0 : timeValue.hour) || 12), 2), selectedHour = _ref5[0], setSelectedHour = _ref5[1];
|
|
1924
|
+
var _ref6 = _sliced_to_array((0, import_react12.useState)((timeValue === null || timeValue === void 0 ? void 0 : timeValue.minute) || 0), 2), selectedMinute = _ref6[0], setSelectedMinute = _ref6[1];
|
|
1925
|
+
var _ref7 = _sliced_to_array((0, import_react12.useState)((timeValue === null || timeValue === void 0 ? void 0 : timeValue.period) || "AM"), 2), selectedPeriod = _ref7[0], setSelectedPeriod = _ref7[1];
|
|
1926
|
+
var _ref8 = _sliced_to_array((0, import_react12.useState)(timeFormat), 2), internalTimeFormat = _ref8[0], setInternalTimeFormat = _ref8[1];
|
|
1927
|
+
var _ref9 = _sliced_to_array((0, import_react12.useState)(false), 2), showYearDropdown = _ref9[0], setShowYearDropdown = _ref9[1];
|
|
1928
|
+
var _ref10 = _sliced_to_array((0, import_react12.useState)(dateFormat), 2), internalDateFormat = _ref10[0], setInternalDateFormat = _ref10[1];
|
|
1929
|
+
var _ref11 = _sliced_to_array((0, import_react12.useState)(timeZoneFormat), 2), internalTimeZoneFormat = _ref11[0], setInternalTimeZoneFormat = _ref11[1];
|
|
1930
|
+
var _ref12 = _sliced_to_array((0, import_react12.useState)(1), 2), deviceScale = _ref12[0], setDeviceScale = _ref12[1];
|
|
1931
|
+
var _ref13 = _sliced_to_array((0, import_react12.useState)(false), 2), positionAbove = _ref13[0], setPositionAbove = _ref13[1];
|
|
1932
|
+
var containerRef = (0, import_react12.useRef)(null);
|
|
1933
|
+
var calendarRef = (0, import_react12.useRef)(null);
|
|
1934
|
+
var sizeScale = SIZE_SCALES[size];
|
|
1935
|
+
var scale = sizeScale * deviceScale;
|
|
1936
|
+
var scaled = function(value2) {
|
|
1937
|
+
return Math.round(value2 * scale);
|
|
1938
|
+
};
|
|
1939
|
+
(0, import_react12.useEffect)(function() {
|
|
1940
|
+
var handleResize = function() {
|
|
1941
|
+
setDeviceScale(getDeviceScale());
|
|
1942
|
+
};
|
|
1943
|
+
handleResize();
|
|
1944
|
+
window.addEventListener("resize", handleResize);
|
|
1945
|
+
return function() {
|
|
1946
|
+
window.removeEventListener("resize", handleResize);
|
|
1947
|
+
};
|
|
1948
|
+
}, []);
|
|
1949
|
+
(0, import_react12.useEffect)(function() {
|
|
1950
|
+
if (!isOpen || !containerRef.current || !calendarRef.current) return;
|
|
1951
|
+
var calculatePosition = function() {
|
|
1952
|
+
var _containerRef_current, _calendarRef_current;
|
|
1953
|
+
var containerRect = (_containerRef_current = containerRef.current) === null || _containerRef_current === void 0 ? void 0 : _containerRef_current.getBoundingClientRect();
|
|
1954
|
+
var calendarHeight = ((_calendarRef_current = calendarRef.current) === null || _calendarRef_current === void 0 ? void 0 : _calendarRef_current.offsetHeight) || 526 * scale;
|
|
1955
|
+
if (!containerRect) return;
|
|
1956
|
+
var spaceBelow = window.innerHeight - containerRect.bottom;
|
|
1957
|
+
var spaceAbove = containerRect.top;
|
|
1958
|
+
var bufferSpace = 16;
|
|
1959
|
+
if (spaceBelow < calendarHeight + bufferSpace && spaceAbove > spaceBelow) {
|
|
1960
|
+
setPositionAbove(true);
|
|
1961
|
+
} else {
|
|
1962
|
+
setPositionAbove(false);
|
|
1963
|
+
}
|
|
1964
|
+
};
|
|
1965
|
+
calculatePosition();
|
|
1966
|
+
window.addEventListener("resize", calculatePosition);
|
|
1967
|
+
window.addEventListener("scroll", calculatePosition, true);
|
|
1968
|
+
return function() {
|
|
1969
|
+
window.removeEventListener("resize", calculatePosition);
|
|
1970
|
+
window.removeEventListener("scroll", calculatePosition, true);
|
|
1971
|
+
};
|
|
1972
|
+
}, [
|
|
1973
|
+
isOpen,
|
|
1974
|
+
scale
|
|
1975
|
+
]);
|
|
1976
|
+
(0, import_react12.useEffect)(function() {
|
|
1977
|
+
if (value) {
|
|
1978
|
+
setCurrentYear(value.year);
|
|
1979
|
+
setCurrentMonth(value.month);
|
|
1980
|
+
}
|
|
1981
|
+
}, [
|
|
1982
|
+
value
|
|
1983
|
+
]);
|
|
1984
|
+
(0, import_react12.useEffect)(function() {
|
|
1985
|
+
if (timeValue) {
|
|
1986
|
+
setSelectedHour(timeValue.hour);
|
|
1987
|
+
setSelectedMinute(timeValue.minute);
|
|
1988
|
+
setSelectedPeriod(timeValue.period);
|
|
1989
|
+
}
|
|
1990
|
+
}, [
|
|
1991
|
+
timeValue
|
|
1992
|
+
]);
|
|
1993
|
+
(0, import_react12.useEffect)(function() {
|
|
1994
|
+
setInternalTimeFormat(timeFormat);
|
|
1995
|
+
}, [
|
|
1996
|
+
timeFormat
|
|
1997
|
+
]);
|
|
1998
|
+
(0, import_react12.useEffect)(function() {
|
|
1999
|
+
setInternalDateFormat(dateFormat);
|
|
2000
|
+
}, [
|
|
2001
|
+
dateFormat
|
|
2002
|
+
]);
|
|
2003
|
+
(0, import_react12.useEffect)(function() {
|
|
2004
|
+
setInternalTimeZoneFormat(timeZoneFormat);
|
|
2005
|
+
}, [
|
|
2006
|
+
timeZoneFormat
|
|
2007
|
+
]);
|
|
2008
|
+
(0, import_react12.useEffect)(function() {
|
|
2009
|
+
var handleClickOutside = function(event) {
|
|
2010
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
2011
|
+
if (isOpen) {
|
|
2012
|
+
setIsOpen(false);
|
|
2013
|
+
setShowTimeSelector(false);
|
|
2014
|
+
setShowYearDropdown(false);
|
|
2015
|
+
onHide === null || onHide === void 0 ? void 0 : onHide();
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
};
|
|
2019
|
+
if (isOpen) {
|
|
2020
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2021
|
+
}
|
|
2022
|
+
return function() {
|
|
2023
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
2024
|
+
};
|
|
2025
|
+
}, [
|
|
2026
|
+
isOpen,
|
|
2027
|
+
onHide
|
|
2028
|
+
]);
|
|
2029
|
+
var daysInMonth = getDaysInMonth(currentYear, currentMonth);
|
|
2030
|
+
var firstDay = getFirstDayOfMonth(currentYear, currentMonth);
|
|
2031
|
+
var monthName = getMonthName(currentMonth);
|
|
2032
|
+
var previousMonth = function() {
|
|
2033
|
+
if (currentMonth === 0) {
|
|
2034
|
+
setCurrentMonth(11);
|
|
2035
|
+
setCurrentYear(currentYear - 1);
|
|
2036
|
+
} else {
|
|
2037
|
+
setCurrentMonth(currentMonth - 1);
|
|
2038
|
+
}
|
|
2039
|
+
};
|
|
2040
|
+
var nextMonth = function() {
|
|
2041
|
+
if (currentMonth === 11) {
|
|
2042
|
+
setCurrentMonth(0);
|
|
2043
|
+
setCurrentYear(currentYear + 1);
|
|
2044
|
+
} else {
|
|
2045
|
+
setCurrentMonth(currentMonth + 1);
|
|
2046
|
+
}
|
|
2047
|
+
};
|
|
2048
|
+
var selectDate = function(day) {
|
|
2049
|
+
var date = {
|
|
2050
|
+
year: currentYear,
|
|
2051
|
+
month: currentMonth,
|
|
2052
|
+
day: day
|
|
2053
|
+
};
|
|
2054
|
+
if (enableRangeSelection) {
|
|
2055
|
+
if (activeField === "start") {
|
|
2056
|
+
onRangeChange === null || onRangeChange === void 0 ? void 0 : onRangeChange({
|
|
2057
|
+
start: date,
|
|
2058
|
+
end: (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.end) || null
|
|
2059
|
+
});
|
|
2060
|
+
setActiveField("end");
|
|
2061
|
+
} else {
|
|
2062
|
+
var start = rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.start;
|
|
2063
|
+
if (start) {
|
|
2064
|
+
var startTime = new Date(start.year, start.month, start.day).getTime();
|
|
2065
|
+
var endTime = new Date(date.year, date.month, date.day).getTime();
|
|
2066
|
+
if (endTime < startTime) {
|
|
2067
|
+
onRangeChange === null || onRangeChange === void 0 ? void 0 : onRangeChange({
|
|
2068
|
+
start: date,
|
|
2069
|
+
end: start
|
|
2070
|
+
});
|
|
2071
|
+
} else {
|
|
2072
|
+
onRangeChange === null || onRangeChange === void 0 ? void 0 : onRangeChange({
|
|
2073
|
+
start: start,
|
|
2074
|
+
end: date
|
|
2075
|
+
});
|
|
2076
|
+
}
|
|
2077
|
+
} else {
|
|
2078
|
+
onRangeChange === null || onRangeChange === void 0 ? void 0 : onRangeChange({
|
|
2079
|
+
start: date,
|
|
2080
|
+
end: null
|
|
2081
|
+
});
|
|
2082
|
+
setActiveField("end");
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
} else {
|
|
2086
|
+
var dateString = convertToDateString(date);
|
|
2087
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(date, dateString);
|
|
2088
|
+
}
|
|
2089
|
+
if (showTimeSelector) {
|
|
2090
|
+
setShowTimeSelector(false);
|
|
2091
|
+
}
|
|
2092
|
+
if (autoHide && (!enableRangeSelection || enableRangeSelection && activeField === "end" && (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.start))) {
|
|
2093
|
+
setIsOpen(false);
|
|
2094
|
+
setShowTimeSelector(false);
|
|
2095
|
+
onHide === null || onHide === void 0 ? void 0 : onHide();
|
|
2096
|
+
}
|
|
2097
|
+
};
|
|
2098
|
+
var selectToday = function() {
|
|
2099
|
+
var todayDate = {
|
|
2100
|
+
year: today.getFullYear(),
|
|
2101
|
+
month: today.getMonth(),
|
|
2102
|
+
day: today.getDate()
|
|
2103
|
+
};
|
|
2104
|
+
setCurrentYear(todayDate.year);
|
|
2105
|
+
setCurrentMonth(todayDate.month);
|
|
2106
|
+
var dateString = convertToDateString(todayDate);
|
|
2107
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(todayDate, dateString);
|
|
2108
|
+
if (enableTimeSelection && showTimeSelector) {
|
|
2109
|
+
var now = /* @__PURE__ */ new Date();
|
|
2110
|
+
var currentHour = now.getHours();
|
|
2111
|
+
var currentMinute = now.getMinutes();
|
|
2112
|
+
var hour12;
|
|
2113
|
+
var period;
|
|
2114
|
+
if (currentHour === 0) {
|
|
2115
|
+
hour12 = 12;
|
|
2116
|
+
period = "AM";
|
|
2117
|
+
} else if (currentHour === 12) {
|
|
2118
|
+
hour12 = 12;
|
|
2119
|
+
period = "PM";
|
|
2120
|
+
} else if (currentHour > 12) {
|
|
2121
|
+
hour12 = currentHour - 12;
|
|
2122
|
+
period = "PM";
|
|
2123
|
+
} else {
|
|
2124
|
+
hour12 = currentHour;
|
|
2125
|
+
period = "AM";
|
|
2126
|
+
}
|
|
2127
|
+
setSelectedHour(hour12);
|
|
2128
|
+
setSelectedMinute(currentMinute);
|
|
2129
|
+
setSelectedPeriod(period);
|
|
2130
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange({
|
|
2131
|
+
hour: hour12,
|
|
2132
|
+
minute: currentMinute,
|
|
2133
|
+
period: period
|
|
2134
|
+
});
|
|
2135
|
+
if (showTimeZoneSelector) {
|
|
2136
|
+
var localTZ = getLocalTimeZone();
|
|
2137
|
+
setInternalTimeZoneFormat(localTZ);
|
|
2138
|
+
onTimeZoneFormatChange === null || onTimeZoneFormatChange === void 0 ? void 0 : onTimeZoneFormatChange(localTZ);
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
if (autoHide) {
|
|
2142
|
+
setIsOpen(false);
|
|
2143
|
+
setShowTimeSelector(false);
|
|
2144
|
+
onHide === null || onHide === void 0 ? void 0 : onHide();
|
|
2145
|
+
}
|
|
2146
|
+
};
|
|
2147
|
+
var clearDate = function() {
|
|
2148
|
+
if (enableRangeSelection) {
|
|
2149
|
+
onRangeChange === null || onRangeChange === void 0 ? void 0 : onRangeChange({
|
|
2150
|
+
start: null,
|
|
2151
|
+
end: null
|
|
2152
|
+
});
|
|
2153
|
+
setActiveField("start");
|
|
2154
|
+
} else {
|
|
2155
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null, "");
|
|
2156
|
+
}
|
|
2157
|
+
if (enableTimeSelection) {
|
|
2158
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange({
|
|
2159
|
+
hour: 12,
|
|
2160
|
+
minute: 0,
|
|
2161
|
+
period: "AM"
|
|
2162
|
+
});
|
|
2163
|
+
setSelectedHour(12);
|
|
2164
|
+
setSelectedMinute(0);
|
|
2165
|
+
setSelectedPeriod("AM");
|
|
2166
|
+
}
|
|
2167
|
+
};
|
|
2168
|
+
var toggleCalendar = function() {
|
|
2169
|
+
if (disabled) return;
|
|
2170
|
+
var newState = !isOpen;
|
|
2171
|
+
setIsOpen(newState);
|
|
2172
|
+
if (newState) {
|
|
2173
|
+
setShowTimeSelector(false);
|
|
2174
|
+
onShow === null || onShow === void 0 ? void 0 : onShow();
|
|
2175
|
+
} else {
|
|
2176
|
+
setShowTimeSelector(false);
|
|
2177
|
+
onHide === null || onHide === void 0 ? void 0 : onHide();
|
|
2178
|
+
}
|
|
2179
|
+
};
|
|
2180
|
+
var handleStartFieldClick = function() {
|
|
2181
|
+
if (!isOpen) {
|
|
2182
|
+
setIsOpen(true);
|
|
2183
|
+
onShow === null || onShow === void 0 ? void 0 : onShow();
|
|
2184
|
+
}
|
|
2185
|
+
setActiveField("start");
|
|
2186
|
+
setShowTimeSelector(false);
|
|
2187
|
+
};
|
|
2188
|
+
var handleEndFieldClick = function() {
|
|
2189
|
+
if (!isOpen) {
|
|
2190
|
+
setIsOpen(true);
|
|
2191
|
+
onShow === null || onShow === void 0 ? void 0 : onShow();
|
|
2192
|
+
}
|
|
2193
|
+
setActiveField("end");
|
|
2194
|
+
setShowTimeSelector(false);
|
|
2195
|
+
};
|
|
2196
|
+
var handleChooseTimeClick = function() {
|
|
2197
|
+
setShowTimeSelector(!showTimeSelector);
|
|
2198
|
+
};
|
|
2199
|
+
var handleChooseDateClick = function() {
|
|
2200
|
+
setShowTimeSelector(false);
|
|
2201
|
+
};
|
|
2202
|
+
var handleTimeFormatToggle = function() {
|
|
2203
|
+
var newFormat = internalTimeFormat === "12h" ? "24h" : "12h";
|
|
2204
|
+
setInternalTimeFormat(newFormat);
|
|
2205
|
+
onTimeFormatChange === null || onTimeFormatChange === void 0 ? void 0 : onTimeFormatChange(newFormat);
|
|
2206
|
+
};
|
|
2207
|
+
var handleTimeConfirm = function() {
|
|
2208
|
+
onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange({
|
|
2209
|
+
hour: selectedHour,
|
|
2210
|
+
minute: selectedMinute,
|
|
2211
|
+
period: selectedPeriod
|
|
2212
|
+
});
|
|
2213
|
+
setShowTimeSelector(false);
|
|
2214
|
+
};
|
|
2215
|
+
var handleDateConfirm = function() {
|
|
2216
|
+
setIsOpen(false);
|
|
2217
|
+
onHide === null || onHide === void 0 ? void 0 : onHide();
|
|
2218
|
+
};
|
|
2219
|
+
var handleMonthYearClick = function() {
|
|
2220
|
+
if (enableYearDropdown) {
|
|
2221
|
+
setShowYearDropdown(!showYearDropdown);
|
|
2222
|
+
}
|
|
2223
|
+
};
|
|
2224
|
+
var handleYearSelect = function(year) {
|
|
2225
|
+
setCurrentYear(year);
|
|
2226
|
+
setShowYearDropdown(false);
|
|
2227
|
+
};
|
|
2228
|
+
var renderDays = function() {
|
|
2229
|
+
var _loop = function(day) {
|
|
2230
|
+
var date = {
|
|
2231
|
+
year: currentYear,
|
|
2232
|
+
month: currentMonth,
|
|
2233
|
+
day: day
|
|
2234
|
+
};
|
|
2235
|
+
var isSelected = enableRangeSelection ? isSameDate(rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.start, date) || isSameDate(rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.end, date) : isSameDate(value, date);
|
|
2236
|
+
var isInRange = enableRangeSelection && (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.start) && (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.end) ? function() {
|
|
2237
|
+
var currentTime = new Date(date.year, date.month, date.day).getTime();
|
|
2238
|
+
var startTime = new Date(rangeValue.start.year, rangeValue.start.month, rangeValue.start.day).getTime();
|
|
2239
|
+
var endTime = new Date(rangeValue.end.year, rangeValue.end.month, rangeValue.end.day).getTime();
|
|
2240
|
+
return currentTime > startTime && currentTime < endTime;
|
|
2241
|
+
}() : false;
|
|
2242
|
+
var isToday = isSameDate({
|
|
2243
|
+
year: today.getFullYear(),
|
|
2244
|
+
month: today.getMonth(),
|
|
2245
|
+
day: today.getDate()
|
|
2246
|
+
}, date);
|
|
2247
|
+
var isBlocked = isBlockedDateHelper(date, blockDateConfig);
|
|
2248
|
+
days.push(/* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2249
|
+
type: "button",
|
|
2250
|
+
key: "current-".concat(day),
|
|
2251
|
+
onClick: function() {
|
|
2252
|
+
if (!isBlocked) selectDate(day);
|
|
2253
|
+
},
|
|
2254
|
+
disabled: isBlocked,
|
|
2255
|
+
className: cn4("flex items-center justify-center rounded transition-all duration-200", isSelected && "bg-gradient-to-b from-[#1761A3] to-[#4DAF83] text-white shadow-md", !isSelected && isToday && "border-2 border-[#1761A3] text-[#1761A3]", !isSelected && !isToday && !isInRange && "bg-[rgba(0,123,255,0.05)] text-gray-700", isInRange && !isSelected && "bg-[rgba(23,97,163,0.15)] text-gray-700", !isSelected && !isBlocked && "hover:bg-[rgba(23,97,163,0.1)]", isBlocked && "cursor-not-allowed opacity-40 text-gray-400"),
|
|
2256
|
+
style: {
|
|
2257
|
+
width: "".concat(scaled(32), "px"),
|
|
2258
|
+
height: "".concat(scaled(30), "px"),
|
|
2259
|
+
fontSize: "".concat(scaled(14), "px"),
|
|
2260
|
+
fontWeight: 600
|
|
2261
|
+
}
|
|
2262
|
+
}, day));
|
|
2263
|
+
};
|
|
2264
|
+
var days = [];
|
|
2265
|
+
for(var i = 0; i < firstDay; i++){
|
|
2266
|
+
days.push(/* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2267
|
+
key: "empty-start-".concat(i),
|
|
2268
|
+
className: "flex items-center justify-center",
|
|
2269
|
+
style: {
|
|
2270
|
+
width: "".concat(scaled(44), "px"),
|
|
2271
|
+
height: "".concat(scaled(44), "px")
|
|
2272
|
+
}
|
|
2273
|
+
}));
|
|
2274
|
+
}
|
|
2275
|
+
for(var day = 1; day <= daysInMonth; day++)_loop(day);
|
|
2276
|
+
var totalCells = firstDay + daysInMonth;
|
|
2277
|
+
var remainingCells = totalCells % 7 === 0 ? 0 : 7 - totalCells % 7;
|
|
2278
|
+
for(var i1 = 0; i1 < remainingCells; i1++){
|
|
2279
|
+
days.push(/* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2280
|
+
key: "empty-end-".concat(i1),
|
|
2281
|
+
className: "flex items-center justify-center",
|
|
2282
|
+
style: {
|
|
2283
|
+
width: "".concat(scaled(44), "px"),
|
|
2284
|
+
height: "".concat(scaled(44), "px")
|
|
2285
|
+
}
|
|
2286
|
+
}));
|
|
2287
|
+
}
|
|
2288
|
+
return days;
|
|
2289
|
+
};
|
|
2290
|
+
var renderTimeSelector = function() {
|
|
2291
|
+
var hours12 = Array.from({
|
|
2292
|
+
length: 12
|
|
2293
|
+
}, function(_, i) {
|
|
2294
|
+
return i + 1;
|
|
2295
|
+
});
|
|
2296
|
+
var hours24 = Array.from({
|
|
2297
|
+
length: 24
|
|
2298
|
+
}, function(_, i) {
|
|
2299
|
+
return i;
|
|
2300
|
+
});
|
|
2301
|
+
var minutes = Array.from({
|
|
2302
|
+
length: 60
|
|
2303
|
+
}, function(_, i) {
|
|
2304
|
+
return i;
|
|
2305
|
+
});
|
|
2306
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2307
|
+
className: "flex flex-col h-full"
|
|
2308
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2309
|
+
className: "flex-1"
|
|
2310
|
+
}, (showTimeFormatToggle || showDateFormatSelector || showTimeZoneSelector) && /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2311
|
+
style: {
|
|
2312
|
+
marginBottom: "".concat(scaled(12), "px")
|
|
2313
|
+
}
|
|
2314
|
+
}, showTimeFormatToggle && /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2315
|
+
style: {
|
|
2316
|
+
marginBottom: "".concat(scaled(12), "px")
|
|
2317
|
+
}
|
|
2318
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2319
|
+
className: "flex flex-col",
|
|
2320
|
+
style: {
|
|
2321
|
+
gap: "".concat(scaled(8), "px")
|
|
2322
|
+
}
|
|
2323
|
+
}, /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2324
|
+
className: "text-black font-semibold",
|
|
2325
|
+
style: {
|
|
2326
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2327
|
+
}
|
|
2328
|
+
}, "Format"), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2329
|
+
className: "flex items-center",
|
|
2330
|
+
style: {
|
|
2331
|
+
gap: "".concat(scaled(8), "px")
|
|
2332
|
+
}
|
|
2333
|
+
}, /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2334
|
+
className: cn4("transition-colors duration-200 font-semibold", internalTimeFormat === "12h" ? "text-gray-900" : "text-gray-500"),
|
|
2335
|
+
style: {
|
|
2336
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2337
|
+
}
|
|
2338
|
+
}, "12h"), /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2339
|
+
type: "button",
|
|
2340
|
+
onClick: handleTimeFormatToggle,
|
|
2341
|
+
className: cn4("relative inline-flex items-center rounded-[8px] transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2", internalTimeFormat === "24h" ? "bg-[#1761A3]" : "bg-slate-300"),
|
|
2342
|
+
style: {
|
|
2343
|
+
width: "".concat(scaled(38), "px"),
|
|
2344
|
+
height: "".concat(scaled(17), "px")
|
|
2345
|
+
},
|
|
2346
|
+
role: "switch",
|
|
2347
|
+
"aria-checked": internalTimeFormat === "24h"
|
|
2348
|
+
}, /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2349
|
+
className: "inline-block rounded-full transform bg-white shadow-md transition-transform duration-200",
|
|
2350
|
+
style: {
|
|
2351
|
+
width: "".concat(scaled(13), "px"),
|
|
2352
|
+
height: "".concat(scaled(13), "px"),
|
|
2353
|
+
transform: internalTimeFormat === "24h" ? "translateX(".concat(scaled(23), "px)") : "translateX(".concat(scaled(2), "px)")
|
|
2354
|
+
}
|
|
2355
|
+
})), /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2356
|
+
className: cn4("transition-colors duration-200 font-semibold", internalTimeFormat === "24h" ? "text-gray-900" : "text-gray-500"),
|
|
2357
|
+
style: {
|
|
2358
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2359
|
+
}
|
|
2360
|
+
}, "24h")))), (showDateFormatSelector || showTimeZoneSelector) && /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2361
|
+
className: "flex items-start",
|
|
2362
|
+
style: {
|
|
2363
|
+
gap: "".concat(scaled(15), "px")
|
|
2364
|
+
}
|
|
2365
|
+
}, showDateFormatSelector && /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2366
|
+
className: cn4("flex flex-col", showTimeZoneSelector ? "flex-1" : "w-full"),
|
|
2367
|
+
style: {
|
|
2368
|
+
gap: "".concat(scaled(8), "px")
|
|
2369
|
+
}
|
|
2370
|
+
}, /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2371
|
+
className: "text-black font-semibold",
|
|
2372
|
+
style: {
|
|
2373
|
+
fontSize: "".concat(scaled(12), "px"),
|
|
2374
|
+
paddingLeft: "".concat(scaled(36), "px")
|
|
2375
|
+
}
|
|
2376
|
+
}, "Date Format"), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2377
|
+
className: cn4("relative", showTimeZoneSelector ? "" : "w-full"),
|
|
2378
|
+
style: {
|
|
2379
|
+
height: "".concat(scaled(40), "px")
|
|
2380
|
+
}
|
|
2381
|
+
}, /* @__PURE__ */ import_react12.default.createElement("select", {
|
|
2382
|
+
value: internalDateFormat,
|
|
2383
|
+
onChange: function(e) {
|
|
2384
|
+
setInternalDateFormat(e.target.value);
|
|
2385
|
+
onDateFormatChange === null || onDateFormatChange === void 0 ? void 0 : onDateFormatChange(e.target.value);
|
|
2386
|
+
},
|
|
2387
|
+
className: cn4("block h-full border border-[rgba(23,97,163,0.4)] bg-[#F0F8FF] text-gray-900 font-semibold rounded-[6px] transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-blue-200 appearance-none", showTimeZoneSelector ? "w-full" : "w-full", "hover:bg-gradient-to-r hover:from-[rgba(23,97,163,0.4)] hover:to-[rgba(77,175,131,0.4)]"),
|
|
2388
|
+
style: {
|
|
2389
|
+
fontSize: "".concat(scaled(12), "px"),
|
|
2390
|
+
paddingLeft: "".concat(scaled(36), "px"),
|
|
2391
|
+
paddingRight: "".concat(scaled(32), "px")
|
|
2392
|
+
}
|
|
2393
|
+
}, DATE_FORMAT_OPTIONS.map(function(format) {
|
|
2394
|
+
return /* @__PURE__ */ import_react12.default.createElement("option", {
|
|
2395
|
+
key: format,
|
|
2396
|
+
value: format
|
|
2397
|
+
}, format);
|
|
2398
|
+
})), /* @__PURE__ */ import_react12.default.createElement(import_hi.HiChevronDown, {
|
|
2399
|
+
className: "pointer-events-none absolute top-1/2 -translate-y-1/2 text-gray-500",
|
|
2400
|
+
style: {
|
|
2401
|
+
right: "".concat(scaled(8), "px"),
|
|
2402
|
+
fontSize: "".concat(scaled(18), "px")
|
|
2403
|
+
}
|
|
2404
|
+
}))), showTimeZoneSelector && /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2405
|
+
className: cn4("flex flex-col", showDateFormatSelector ? "flex-1" : "w-full"),
|
|
2406
|
+
style: {
|
|
2407
|
+
gap: "".concat(scaled(8), "px")
|
|
2408
|
+
}
|
|
2409
|
+
}, /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2410
|
+
className: "text-black font-semibold text-right",
|
|
2411
|
+
style: {
|
|
2412
|
+
fontSize: "".concat(scaled(12), "px"),
|
|
2413
|
+
paddingRight: "".concat(scaled(36), "px")
|
|
2414
|
+
}
|
|
2415
|
+
}, "Time Format"), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2416
|
+
className: cn4("relative", showDateFormatSelector ? "" : "w-full"),
|
|
2417
|
+
style: {
|
|
2418
|
+
height: "".concat(scaled(40), "px")
|
|
2419
|
+
}
|
|
2420
|
+
}, /* @__PURE__ */ import_react12.default.createElement("select", {
|
|
2421
|
+
value: internalTimeZoneFormat,
|
|
2422
|
+
onChange: function(e) {
|
|
2423
|
+
setInternalTimeZoneFormat(e.target.value);
|
|
2424
|
+
onTimeZoneFormatChange === null || onTimeZoneFormatChange === void 0 ? void 0 : onTimeZoneFormatChange(e.target.value);
|
|
2425
|
+
},
|
|
2426
|
+
className: cn4("block h-full border border-[rgba(23,97,163,0.4)] bg-[#F0F8FF] text-gray-900 font-semibold rounded-[6px] transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-blue-200 appearance-none", showDateFormatSelector ? "w-full" : "w-full", "hover:bg-gradient-to-r hover:from-[rgba(23,97,163,0.4)] hover:to-[rgba(77,175,131,0.4)]"),
|
|
2427
|
+
style: {
|
|
2428
|
+
fontSize: "".concat(scaled(12), "px"),
|
|
2429
|
+
paddingRight: "".concat(scaled(36), "px"),
|
|
2430
|
+
paddingLeft: "".concat(scaled(32), "px")
|
|
2431
|
+
}
|
|
2432
|
+
}, TIME_ZONE_OPTIONS.map(function(zone) {
|
|
2433
|
+
return /* @__PURE__ */ import_react12.default.createElement("option", {
|
|
2434
|
+
key: zone,
|
|
2435
|
+
value: zone
|
|
2436
|
+
}, zone);
|
|
2437
|
+
})), /* @__PURE__ */ import_react12.default.createElement(import_hi.HiChevronDown, {
|
|
2438
|
+
className: "pointer-events-none absolute top-1/2 -translate-y-1/2 text-gray-500",
|
|
2439
|
+
style: {
|
|
2440
|
+
right: "".concat(scaled(8), "px"),
|
|
2441
|
+
fontSize: "".concat(scaled(18), "px")
|
|
2442
|
+
}
|
|
2443
|
+
}))))), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2444
|
+
style: {
|
|
2445
|
+
marginTop: "".concat(scaled(16), "px")
|
|
2446
|
+
}
|
|
2447
|
+
}, /* @__PURE__ */ import_react12.default.createElement("label", {
|
|
2448
|
+
className: "block text-gray-700 font-semibold",
|
|
2449
|
+
style: {
|
|
2450
|
+
marginBottom: "".concat(scaled(12), "px"),
|
|
2451
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2452
|
+
}
|
|
2453
|
+
}, "Time Select"), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2454
|
+
className: "flex",
|
|
2455
|
+
style: {
|
|
2456
|
+
gap: "".concat(scaled(12), "px")
|
|
2457
|
+
}
|
|
2458
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2459
|
+
className: "flex-1"
|
|
2460
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2461
|
+
className: "relative",
|
|
2462
|
+
style: {
|
|
2463
|
+
width: "".concat(scaled(106), "px")
|
|
2464
|
+
}
|
|
2465
|
+
}, /* @__PURE__ */ import_react12.default.createElement("select", {
|
|
2466
|
+
value: internalTimeFormat === "24h" ? selectedPeriod === "PM" && selectedHour !== 12 ? selectedHour + 12 : selectedPeriod === "AM" && selectedHour === 12 ? 0 : selectedHour : selectedHour,
|
|
2467
|
+
onChange: function(e) {
|
|
2468
|
+
var value2 = Number(e.target.value);
|
|
2469
|
+
if (internalTimeFormat === "24h") {
|
|
2470
|
+
if (value2 === 0) {
|
|
2471
|
+
setSelectedHour(12);
|
|
2472
|
+
setSelectedPeriod("AM");
|
|
2473
|
+
} else if (value2 === 12) {
|
|
2474
|
+
setSelectedHour(12);
|
|
2475
|
+
setSelectedPeriod("PM");
|
|
2476
|
+
} else if (value2 > 12) {
|
|
2477
|
+
setSelectedHour(value2 - 12);
|
|
2478
|
+
setSelectedPeriod("PM");
|
|
2479
|
+
} else {
|
|
2480
|
+
setSelectedHour(value2);
|
|
2481
|
+
setSelectedPeriod("AM");
|
|
2482
|
+
}
|
|
2483
|
+
} else {
|
|
2484
|
+
setSelectedHour(value2);
|
|
2485
|
+
}
|
|
2486
|
+
},
|
|
2487
|
+
className: "block w-full bg-white border border-[rgba(77,175,131,0.25)] text-gray-900 font-semibold rounded-[6px] transition-all duration-200 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 appearance-none",
|
|
2488
|
+
style: {
|
|
2489
|
+
height: "".concat(scaled(40), "px"),
|
|
2490
|
+
fontSize: "".concat(scaled(12), "px"),
|
|
2491
|
+
paddingLeft: "".concat(scaled(16), "px"),
|
|
2492
|
+
paddingRight: "".concat(scaled(32), "px")
|
|
2493
|
+
}
|
|
2494
|
+
}, (internalTimeFormat === "24h" ? hours24 : hours12).map(function(hour) {
|
|
2495
|
+
return /* @__PURE__ */ import_react12.default.createElement("option", {
|
|
2496
|
+
key: hour,
|
|
2497
|
+
value: hour
|
|
2498
|
+
}, String(hour).padStart(2, "0"));
|
|
2499
|
+
})), /* @__PURE__ */ import_react12.default.createElement(import_hi.HiChevronDown, {
|
|
2500
|
+
className: "pointer-events-none absolute top-1/2 -translate-y-1/2 text-gray-500",
|
|
2501
|
+
style: {
|
|
2502
|
+
right: "".concat(scaled(8), "px"),
|
|
2503
|
+
fontSize: "".concat(scaled(18), "px")
|
|
2504
|
+
}
|
|
2505
|
+
}))), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2506
|
+
className: "flex-1"
|
|
2507
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2508
|
+
className: "relative",
|
|
2509
|
+
style: {
|
|
2510
|
+
width: "".concat(scaled(106), "px")
|
|
2511
|
+
}
|
|
2512
|
+
}, /* @__PURE__ */ import_react12.default.createElement("select", {
|
|
2513
|
+
value: selectedMinute,
|
|
2514
|
+
onChange: function(e) {
|
|
2515
|
+
return setSelectedMinute(Number(e.target.value));
|
|
2516
|
+
},
|
|
2517
|
+
className: "block w-full bg-white border border-[rgba(77,175,131,0.25)] text-gray-900 font-semibold rounded-[6px] transition-all duration-200 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 appearance-none",
|
|
2518
|
+
style: {
|
|
2519
|
+
height: "".concat(scaled(40), "px"),
|
|
2520
|
+
fontSize: "".concat(scaled(12), "px"),
|
|
2521
|
+
paddingLeft: "".concat(scaled(16), "px"),
|
|
2522
|
+
paddingRight: "".concat(scaled(32), "px")
|
|
2523
|
+
}
|
|
2524
|
+
}, minutes.map(function(minute) {
|
|
2525
|
+
return /* @__PURE__ */ import_react12.default.createElement("option", {
|
|
2526
|
+
key: minute,
|
|
2527
|
+
value: minute
|
|
2528
|
+
}, String(minute).padStart(2, "0"));
|
|
2529
|
+
})), /* @__PURE__ */ import_react12.default.createElement(import_hi.HiChevronDown, {
|
|
2530
|
+
className: "pointer-events-none absolute top-1/2 -translate-y-1/2 text-gray-500",
|
|
2531
|
+
style: {
|
|
2532
|
+
right: "".concat(scaled(8), "px"),
|
|
2533
|
+
fontSize: "".concat(scaled(18), "px")
|
|
2534
|
+
}
|
|
2535
|
+
}))), internalTimeFormat === "12h" && /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2536
|
+
className: "flex-1"
|
|
2537
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2538
|
+
className: "relative",
|
|
2539
|
+
style: {
|
|
2540
|
+
width: "".concat(scaled(106), "px")
|
|
2541
|
+
}
|
|
2542
|
+
}, /* @__PURE__ */ import_react12.default.createElement("select", {
|
|
2543
|
+
value: selectedPeriod,
|
|
2544
|
+
onChange: function(e) {
|
|
2545
|
+
return setSelectedPeriod(e.target.value);
|
|
2546
|
+
},
|
|
2547
|
+
className: "block w-full bg-white border border-[rgba(77,175,131,0.25)] text-gray-900 font-semibold rounded-[6px] transition-all duration-200 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 appearance-none",
|
|
2548
|
+
style: {
|
|
2549
|
+
height: "".concat(scaled(40), "px"),
|
|
2550
|
+
fontSize: "".concat(scaled(12), "px"),
|
|
2551
|
+
paddingLeft: "".concat(scaled(16), "px"),
|
|
2552
|
+
paddingRight: "".concat(scaled(32), "px")
|
|
2553
|
+
}
|
|
2554
|
+
}, /* @__PURE__ */ import_react12.default.createElement("option", {
|
|
2555
|
+
value: "AM"
|
|
2556
|
+
}, "AM"), /* @__PURE__ */ import_react12.default.createElement("option", {
|
|
2557
|
+
value: "PM"
|
|
2558
|
+
}, "PM")), /* @__PURE__ */ import_react12.default.createElement(import_hi.HiChevronDown, {
|
|
2559
|
+
className: "pointer-events-none absolute top-1/2 -translate-y-1/2 text-gray-500",
|
|
2560
|
+
style: {
|
|
2561
|
+
right: "".concat(scaled(8), "px"),
|
|
2562
|
+
fontSize: "".concat(scaled(18), "px")
|
|
2563
|
+
}
|
|
2564
|
+
}))))), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2565
|
+
style: {
|
|
2566
|
+
marginTop: "".concat(scaled(12), "px")
|
|
2567
|
+
}
|
|
2568
|
+
}, /* @__PURE__ */ import_react12.default.createElement("label", {
|
|
2569
|
+
className: "block text-gray-700 font-semibold",
|
|
2570
|
+
style: {
|
|
2571
|
+
marginBottom: "".concat(scaled(8), "px"),
|
|
2572
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2573
|
+
}
|
|
2574
|
+
}, "Preview"), /* @__PURE__ */ import_react12.default.createElement("p", {
|
|
2575
|
+
className: "text-left text-[#1761A3] font-semibold",
|
|
2576
|
+
style: {
|
|
2577
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2578
|
+
}
|
|
2579
|
+
}, formatDateWithFormat(value !== null && value !== void 0 ? value : null, internalDateFormat), " ", formatTime({
|
|
2580
|
+
hour: selectedHour,
|
|
2581
|
+
minute: selectedMinute,
|
|
2582
|
+
period: selectedPeriod
|
|
2583
|
+
}, internalTimeFormat), internalTimeZoneFormat !== "none" ? " ".concat(internalTimeZoneFormat) : ""))), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2584
|
+
className: "mt-auto border-t border-gray-200",
|
|
2585
|
+
style: {
|
|
2586
|
+
paddingTop: "".concat(scaled(15), "px")
|
|
2587
|
+
}
|
|
2588
|
+
}, (showTodayButton || showClearButton) && /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2589
|
+
className: "flex",
|
|
2590
|
+
style: {
|
|
2591
|
+
gap: "".concat(scaled(12), "px"),
|
|
2592
|
+
marginBottom: "".concat(scaled(15), "px")
|
|
2593
|
+
}
|
|
2594
|
+
}, showTodayButton && /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2595
|
+
type: "button",
|
|
2596
|
+
onClick: selectToday,
|
|
2597
|
+
className: cn4("flex items-center justify-center rounded-[6px] text-[#1761A3] font-semibold bg-[rgba(23,97,163,0.15)] transition-all duration-200 hover:bg-gradient-to-b hover:from-[#1761A3] hover:to-[#4DAF83] hover:text-white", showClearButton ? "flex-1" : "w-full"),
|
|
2598
|
+
style: {
|
|
2599
|
+
height: "".concat(scaled(38), "px"),
|
|
2600
|
+
fontSize: "".concat(scaled(12), "px"),
|
|
2601
|
+
gap: "".concat(scaled(8), "px")
|
|
2602
|
+
}
|
|
2603
|
+
}, /* @__PURE__ */ import_react12.default.createElement(import_hi.HiOutlineClock, {
|
|
2604
|
+
style: {
|
|
2605
|
+
width: "".concat(scaled(14), "px"),
|
|
2606
|
+
height: "".concat(scaled(14), "px")
|
|
2607
|
+
}
|
|
2608
|
+
}), "Current Time"), showClearButton && /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2609
|
+
type: "button",
|
|
2610
|
+
onClick: clearDate,
|
|
2611
|
+
className: cn4("flex items-center justify-center rounded-[6px] text-[#EF4444] font-semibold bg-[rgba(239,68,68,0.15)] transition-all duration-200 hover:opacity-80", showTodayButton ? "flex-1" : "w-full"),
|
|
2612
|
+
style: {
|
|
2613
|
+
height: "".concat(scaled(38), "px"),
|
|
2614
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2615
|
+
}
|
|
2616
|
+
}, "Clear")), /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2617
|
+
type: "button",
|
|
2618
|
+
onClick: handleTimeConfirm,
|
|
2619
|
+
className: "w-full rounded-[6px] bg-gradient-to-r from-[#1761A3] to-[#4DAF83] text-white font-semibold transition-all duration-200 hover:opacity-90",
|
|
2620
|
+
style: {
|
|
2621
|
+
height: "".concat(scaled(38), "px"),
|
|
2622
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2623
|
+
}
|
|
2624
|
+
}, "Confirm Time")));
|
|
2625
|
+
};
|
|
2626
|
+
var defaultIcon = /* @__PURE__ */ import_react12.default.createElement(import_hi2.HiCalendarDays, {
|
|
2627
|
+
style: {
|
|
2628
|
+
width: "".concat(scaled(14), "px"),
|
|
2629
|
+
height: "".concat(scaled(14), "px")
|
|
2630
|
+
},
|
|
2631
|
+
className: "text-gray-700"
|
|
2632
|
+
});
|
|
2633
|
+
var _obj;
|
|
2634
|
+
var calendarContent = /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2635
|
+
ref: calendarRef,
|
|
2636
|
+
className: cn4("absolute left-0 z-50 border border-[#1761A3] bg-white shadow-xl transition-all duration-300 bg-gradient-to-b from-[rgba(23,97,163,0.08)] to-[rgba(77,175,131,0.08)]", positionAbove ? "bottom-full" : "top-full"),
|
|
2637
|
+
style: (_obj = {}, _define_property(_obj, positionAbove ? "marginBottom" : "marginTop", "".concat(scaled(8), "px")), _define_property(_obj, "width", "".concat(scaled(406), "px")), _define_property(_obj, "height", "".concat(scaled(526), "px")), _define_property(_obj, "borderRadius", "".concat(scaled(22), "px")), _define_property(_obj, "maxWidth", "95vw"), _obj)
|
|
2638
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2639
|
+
className: "h-full flex flex-col",
|
|
2640
|
+
style: {
|
|
2641
|
+
padding: "".concat(scaled(24), "px"),
|
|
2642
|
+
paddingBottom: "".concat(scaled(22), "px")
|
|
2643
|
+
}
|
|
2644
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2645
|
+
className: "text-left font-bold text-gray-900",
|
|
2646
|
+
style: {
|
|
2647
|
+
marginBottom: "".concat(scaled(20), "px"),
|
|
2648
|
+
fontSize: "".concat(scaled(20), "px")
|
|
2649
|
+
}
|
|
2650
|
+
}, enableRangeSelection ? "Select Date Range" : "Select Date & Time"), enableRangeSelection ? /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2651
|
+
className: "flex",
|
|
2652
|
+
style: {
|
|
2653
|
+
marginBottom: "".concat(scaled(24), "px"),
|
|
2654
|
+
gap: "".concat(scaled(12), "px")
|
|
2655
|
+
}
|
|
2656
|
+
}, /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2657
|
+
type: "button",
|
|
2658
|
+
onClick: handleStartFieldClick,
|
|
2659
|
+
className: cn4("flex flex-1 items-center rounded-[6px] bg-white border-2 border-gray-200 shadow-sm transition-all duration-200", activeField === "start" && "ring-2 ring-blue-500"),
|
|
2660
|
+
style: {
|
|
2661
|
+
width: "".concat(scaled(160), "px"),
|
|
2662
|
+
height: "".concat(scaled(40), "px"),
|
|
2663
|
+
gap: "".concat(scaled(12), "px"),
|
|
2664
|
+
padding: "0 ".concat(scaled(16), "px")
|
|
2665
|
+
}
|
|
2666
|
+
}, defaultIcon, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2667
|
+
className: "flex flex-col items-start"
|
|
2668
|
+
}, /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2669
|
+
className: "font-medium text-gray-500",
|
|
2670
|
+
style: {
|
|
2671
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2672
|
+
}
|
|
2673
|
+
}, "From Date"), /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2674
|
+
className: "font-semibold text-gray-900",
|
|
2675
|
+
style: {
|
|
2676
|
+
fontSize: "".concat(scaled(14), "px")
|
|
2677
|
+
}
|
|
2678
|
+
}, (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.start) ? formatDate(rangeValue.start) : "Select date"))), /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2679
|
+
type: "button",
|
|
2680
|
+
onClick: handleEndFieldClick,
|
|
2681
|
+
className: cn4("flex flex-1 items-center rounded-[6px] bg-white border-2 border-gray-200 shadow-sm transition-all duration-200", activeField === "end" && "ring-2 ring-blue-500"),
|
|
2682
|
+
style: {
|
|
2683
|
+
width: "".concat(scaled(160), "px"),
|
|
2684
|
+
height: "".concat(scaled(40), "px"),
|
|
2685
|
+
gap: "".concat(scaled(12), "px"),
|
|
2686
|
+
padding: "0 ".concat(scaled(16), "px")
|
|
2687
|
+
}
|
|
2688
|
+
}, defaultIcon, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2689
|
+
className: "flex flex-col items-start"
|
|
2690
|
+
}, /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2691
|
+
className: "font-medium text-gray-500",
|
|
2692
|
+
style: {
|
|
2693
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2694
|
+
}
|
|
2695
|
+
}, "To Date"), /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2696
|
+
className: "font-semibold text-gray-900",
|
|
2697
|
+
style: {
|
|
2698
|
+
fontSize: "".concat(scaled(14), "px")
|
|
2699
|
+
}
|
|
2700
|
+
}, (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.end) ? formatDate(rangeValue.end) : "Select date")))) : /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2701
|
+
className: "flex",
|
|
2702
|
+
style: {
|
|
2703
|
+
marginBottom: "".concat(scaled(24), "px"),
|
|
2704
|
+
gap: "".concat(scaled(12), "px")
|
|
2705
|
+
}
|
|
2706
|
+
}, /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2707
|
+
type: "button",
|
|
2708
|
+
onClick: handleChooseDateClick,
|
|
2709
|
+
className: cn4("flex items-center rounded-[6px] shadow-sm transition-all duration-200", enableTimeSelection ? "" : "w-full", !showTimeSelector && enableTimeSelection ? "bg-gradient-to-b from-[#1761A3] to-[#4DAF83] text-white border-2 border-transparent" : "bg-white border-2 border-gray-200 text-gray-900"),
|
|
2710
|
+
style: {
|
|
2711
|
+
width: enableTimeSelection ? "".concat(scaled(160), "px") : void 0,
|
|
2712
|
+
height: "".concat(scaled(40), "px"),
|
|
2713
|
+
gap: "".concat(scaled(12), "px"),
|
|
2714
|
+
padding: "0 ".concat(scaled(16), "px")
|
|
2715
|
+
}
|
|
2716
|
+
}, /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2717
|
+
style: {
|
|
2718
|
+
color: !showTimeSelector && enableTimeSelection ? "white" : void 0,
|
|
2719
|
+
width: "".concat(scaled(14), "px"),
|
|
2720
|
+
height: "".concat(scaled(14), "px"),
|
|
2721
|
+
display: "flex",
|
|
2722
|
+
alignItems: "center",
|
|
2723
|
+
justifyContent: "center"
|
|
2724
|
+
}
|
|
2725
|
+
}, import_react12.default.cloneElement(defaultIcon, {
|
|
2726
|
+
style: {
|
|
2727
|
+
width: "".concat(scaled(14), "px"),
|
|
2728
|
+
height: "".concat(scaled(14), "px"),
|
|
2729
|
+
color: !showTimeSelector && enableTimeSelection ? "white" : void 0
|
|
2730
|
+
},
|
|
2731
|
+
className: !showTimeSelector && enableTimeSelection ? "text-white" : "text-gray-700"
|
|
2732
|
+
})), /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2733
|
+
className: "font-semibold",
|
|
2734
|
+
style: {
|
|
2735
|
+
fontSize: "".concat(scaled(14), "px"),
|
|
2736
|
+
color: !showTimeSelector && enableTimeSelection ? "white" : "#111827"
|
|
2737
|
+
}
|
|
2738
|
+
}, formatDate(value !== null && value !== void 0 ? value : null) || "Choose Date")), enableTimeSelection && /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2739
|
+
type: "button",
|
|
2740
|
+
onClick: handleChooseTimeClick,
|
|
2741
|
+
className: cn4("flex items-center rounded-[6px] shadow-sm transition-all duration-200", showTimeSelector ? "bg-gradient-to-b from-[#1761A3] to-[#4DAF83] text-white border-2 border-transparent" : "bg-white border-2 border-gray-200"),
|
|
2742
|
+
style: {
|
|
2743
|
+
width: "".concat(scaled(160), "px"),
|
|
2744
|
+
height: "".concat(scaled(40), "px"),
|
|
2745
|
+
gap: "".concat(scaled(8), "px"),
|
|
2746
|
+
padding: "0 ".concat(scaled(16), "px"),
|
|
2747
|
+
fontSize: "".concat(scaled(14), "px")
|
|
2748
|
+
}
|
|
2749
|
+
}, /* @__PURE__ */ import_react12.default.createElement(import_hi.HiOutlineClock, {
|
|
2750
|
+
style: {
|
|
2751
|
+
width: "".concat(scaled(14), "px"),
|
|
2752
|
+
height: "".concat(scaled(14), "px"),
|
|
2753
|
+
color: showTimeSelector ? "white" : void 0
|
|
2754
|
+
},
|
|
2755
|
+
className: showTimeSelector ? "text-white" : "text-gray-700"
|
|
2756
|
+
}), /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2757
|
+
className: "font-semibold",
|
|
2758
|
+
style: {
|
|
2759
|
+
color: showTimeSelector ? "white" : "#374151"
|
|
2760
|
+
}
|
|
2761
|
+
}, timeValue ? formatTime(timeValue, internalTimeFormat) : "Choose Time"))), showTimeSelector ? renderTimeSelector() : /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2762
|
+
className: "flex flex-col h-full"
|
|
2763
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2764
|
+
className: "flex-1"
|
|
2765
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2766
|
+
className: "flex items-center justify-between",
|
|
2767
|
+
style: {
|
|
2768
|
+
marginBottom: "".concat(scaled(8), "px")
|
|
2769
|
+
}
|
|
2770
|
+
}, /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2771
|
+
type: "button",
|
|
2772
|
+
onClick: previousMonth,
|
|
2773
|
+
className: "flex items-center justify-center rounded-[6px] bg-[#1761A3] text-white transition-colors duration-200 hover:bg-gradient-to-b hover:from-[#1761A3] hover:to-[#4DAF83]",
|
|
2774
|
+
style: {
|
|
2775
|
+
width: "".concat(scaled(32), "px"),
|
|
2776
|
+
height: "".concat(scaled(30), "px")
|
|
2777
|
+
},
|
|
2778
|
+
"aria-label": "Previous month"
|
|
2779
|
+
}, /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2780
|
+
className: "inline-flex items-center justify-center"
|
|
2781
|
+
}, /* @__PURE__ */ import_react12.default.createElement(import_hi.HiChevronLeft, {
|
|
2782
|
+
style: {
|
|
2783
|
+
width: "".concat(scaled(10), "px"),
|
|
2784
|
+
height: "".concat(scaled(10), "px")
|
|
2785
|
+
}
|
|
2786
|
+
}))), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2787
|
+
className: "relative"
|
|
2788
|
+
}, enableYearDropdown ? /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2789
|
+
type: "button",
|
|
2790
|
+
onClick: handleMonthYearClick,
|
|
2791
|
+
className: "font-bold text-[#1761A3] transition-colors duration-200 hover:opacity-80",
|
|
2792
|
+
style: {
|
|
2793
|
+
fontSize: "".concat(scaled(18), "px")
|
|
2794
|
+
}
|
|
2795
|
+
}, monthName, " ", currentYear) : /* @__PURE__ */ import_react12.default.createElement("h2", {
|
|
2796
|
+
className: "font-bold text-[#1761A3]",
|
|
2797
|
+
style: {
|
|
2798
|
+
fontSize: "".concat(scaled(18), "px")
|
|
2799
|
+
}
|
|
2800
|
+
}, monthName, " ", currentYear), enableYearDropdown && showYearDropdown && /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2801
|
+
className: "absolute left-1/2 top-full z-50 overflow-y-auto bg-white shadow-xl border border-[rgba(77,175,131,0.25)] rounded-[6px] -translate-x-1/2",
|
|
2802
|
+
style: {
|
|
2803
|
+
marginTop: "".concat(scaled(8), "px"),
|
|
2804
|
+
width: "".concat(scaled(120), "px"),
|
|
2805
|
+
maxHeight: "".concat(scaled(240), "px")
|
|
2806
|
+
}
|
|
2807
|
+
}, Array.from({
|
|
2808
|
+
length: 201
|
|
2809
|
+
}, function(_, i) {
|
|
2810
|
+
var year = today.getFullYear() - 100 + i;
|
|
2811
|
+
return /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2812
|
+
key: year,
|
|
2813
|
+
type: "button",
|
|
2814
|
+
onClick: function() {
|
|
2815
|
+
return handleYearSelect(year);
|
|
2816
|
+
},
|
|
2817
|
+
className: cn4("block w-full text-left font-semibold transition-colors duration-150", year === currentYear ? "bg-[#1761A3] text-white" : "text-gray-900 hover:bg-blue-50"),
|
|
2818
|
+
style: {
|
|
2819
|
+
fontSize: "".concat(scaled(14), "px"),
|
|
2820
|
+
padding: "".concat(scaled(8), "px ").concat(scaled(12), "px")
|
|
2821
|
+
}
|
|
2822
|
+
}, year);
|
|
2823
|
+
}))), /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2824
|
+
type: "button",
|
|
2825
|
+
onClick: nextMonth,
|
|
2826
|
+
className: "flex items-center justify-center rounded-[6px] bg-[#1761A3] text-white transition-colors duration-200 hover:bg-gradient-to-b hover:from-[#1761A3] hover:to-[#4DAF83]",
|
|
2827
|
+
style: {
|
|
2828
|
+
width: "".concat(scaled(32), "px"),
|
|
2829
|
+
height: "".concat(scaled(30), "px")
|
|
2830
|
+
},
|
|
2831
|
+
"aria-label": "Next month"
|
|
2832
|
+
}, /* @__PURE__ */ import_react12.default.createElement("span", {
|
|
2833
|
+
className: "inline-flex items-center justify-center"
|
|
2834
|
+
}, /* @__PURE__ */ import_react12.default.createElement(import_hi.HiChevronRight, {
|
|
2835
|
+
style: {
|
|
2836
|
+
width: "".concat(scaled(10), "px"),
|
|
2837
|
+
height: "".concat(scaled(10), "px")
|
|
2838
|
+
}
|
|
2839
|
+
})))), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2840
|
+
style: {
|
|
2841
|
+
marginBottom: "".concat(scaled(6), "px")
|
|
2842
|
+
}
|
|
2843
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2844
|
+
className: "grid grid-cols-7",
|
|
2845
|
+
style: {
|
|
2846
|
+
gap: "".concat(scaled(8), "px ").concat(scaled(8), "px")
|
|
2847
|
+
}
|
|
2848
|
+
}, DAY_NAMES.map(function(day) {
|
|
2849
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2850
|
+
key: day,
|
|
2851
|
+
className: "flex items-center justify-center font-bold text-gray-600",
|
|
2852
|
+
style: {
|
|
2853
|
+
width: "".concat(scaled(44), "px"),
|
|
2854
|
+
height: "".concat(scaled(28), "px"),
|
|
2855
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2856
|
+
}
|
|
2857
|
+
}, day);
|
|
2858
|
+
}), renderDays()))), /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2859
|
+
className: "mt-auto border-t border-gray-200",
|
|
2860
|
+
style: {
|
|
2861
|
+
paddingTop: "".concat(scaled(2), "px")
|
|
2862
|
+
}
|
|
2863
|
+
}, (showTodayButton || showClearButton) && /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2864
|
+
className: "flex",
|
|
2865
|
+
style: {
|
|
2866
|
+
gap: "".concat(scaled(12), "px"),
|
|
2867
|
+
marginBottom: "".concat(scaled(3), "px")
|
|
2868
|
+
}
|
|
2869
|
+
}, showTodayButton && /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2870
|
+
type: "button",
|
|
2871
|
+
onClick: selectToday,
|
|
2872
|
+
className: cn4("flex items-center justify-center rounded-[6px] text-[#1761A3] font-semibold bg-[rgba(23,97,163,0.15)] transition-all duration-200 hover:bg-gradient-to-b hover:from-[#1761A3] hover:to-[#4DAF83] hover:text-white", showClearButton ? "flex-1" : "w-full"),
|
|
2873
|
+
style: {
|
|
2874
|
+
height: "".concat(scaled(38), "px"),
|
|
2875
|
+
fontSize: "".concat(scaled(12), "px"),
|
|
2876
|
+
gap: "".concat(scaled(8), "px")
|
|
2877
|
+
}
|
|
2878
|
+
}, /* @__PURE__ */ import_react12.default.createElement(import_hi2.HiCalendarDays, {
|
|
2879
|
+
style: {
|
|
2880
|
+
width: "".concat(scaled(14), "px"),
|
|
2881
|
+
height: "".concat(scaled(14), "px")
|
|
2882
|
+
}
|
|
2883
|
+
}), "Today"), showClearButton && /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2884
|
+
type: "button",
|
|
2885
|
+
onClick: clearDate,
|
|
2886
|
+
className: cn4("flex items-center justify-center rounded-[6px] text-[#EF4444] font-semibold bg-[rgba(239,68,68,0.15)] transition-all duration-200 hover:opacity-80", showTodayButton ? "flex-1" : "w-full"),
|
|
2887
|
+
style: {
|
|
2888
|
+
height: "".concat(scaled(38), "px"),
|
|
2889
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2890
|
+
}
|
|
2891
|
+
}, "Clear")), /* @__PURE__ */ import_react12.default.createElement("button", {
|
|
2892
|
+
type: "button",
|
|
2893
|
+
onClick: handleDateConfirm,
|
|
2894
|
+
className: "w-full rounded-[6px] bg-gradient-to-r from-[#1761A3] to-[#4DAF83] text-white font-semibold transition-all duration-200 hover:opacity-90",
|
|
2895
|
+
style: {
|
|
2896
|
+
height: "".concat(scaled(38), "px"),
|
|
2897
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2898
|
+
}
|
|
2899
|
+
}, "Confirm Date")))));
|
|
2900
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2901
|
+
ref: containerRef,
|
|
2902
|
+
className: cn4("relative", className)
|
|
2903
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2904
|
+
className: "relative"
|
|
2905
|
+
}, showIcon && /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2906
|
+
className: "pointer-events-none absolute inset-y-0 left-0 flex items-center",
|
|
2907
|
+
style: {
|
|
2908
|
+
paddingLeft: "".concat(scaled(12), "px")
|
|
2909
|
+
}
|
|
2910
|
+
}, icon || defaultIcon), /* @__PURE__ */ import_react12.default.createElement("input", {
|
|
2911
|
+
type: "text",
|
|
2912
|
+
value: enableRangeSelection && rangeValue ? rangeValue.start && rangeValue.end ? "".concat(formatDate(rangeValue.start), " - ").concat(formatDate(rangeValue.end)) : rangeValue.start ? "".concat(formatDate(rangeValue.start), " - ...") : "" : enableTimeSelection && value && timeValue ? "".concat(formatDate(value), " ").concat(formatTime(timeValue, internalTimeFormat)) : formatDate(value !== null && value !== void 0 ? value : null),
|
|
2913
|
+
onClick: toggleCalendar,
|
|
2914
|
+
readOnly: true,
|
|
2915
|
+
disabled: disabled,
|
|
2916
|
+
placeholder: placeholder,
|
|
2917
|
+
className: cn4("block w-full rounded-full border border-gray-300 bg-gray-50 font-semibold shadow-sm text-gray-900 placeholder-gray-500 transition-colors duration-200 focus:border-blue-500 focus:ring-blue-500", disabled && "cursor-not-allowed opacity-50"),
|
|
2918
|
+
style: {
|
|
2919
|
+
paddingTop: "".concat(scaled(10), "px"),
|
|
2920
|
+
paddingBottom: "".concat(scaled(10), "px"),
|
|
2921
|
+
paddingLeft: showIcon ? "".concat(scaled(40), "px") : "".concat(scaled(12), "px"),
|
|
2922
|
+
paddingRight: "".concat(scaled(12), "px"),
|
|
2923
|
+
fontSize: "".concat(scaled(12), "px")
|
|
2924
|
+
}
|
|
2925
|
+
})), isOpen && calendarContent);
|
|
2926
|
+
};
|
|
2927
|
+
Calendar.displayName = "Calendar";
|
|
1145
2928
|
// src/components/Dropdown.tsx
|
|
1146
|
-
var
|
|
2929
|
+
var import_react13 = __toESM(require("react"));
|
|
1147
2930
|
var variantStyles = {
|
|
1148
2931
|
basic: "bg-blue-600 text-white hover:bg-blue-700",
|
|
1149
2932
|
outline: "border border-blue-600 text-blue-600 hover:bg-blue-50",
|
|
@@ -1155,25 +2938,25 @@ var variantStyles = {
|
|
|
1155
2938
|
gradient: "bg-gradient-to-r from-blue-500 to-purple-500 text-white hover:opacity-90"
|
|
1156
2939
|
};
|
|
1157
2940
|
var Dropdown = function(param) {
|
|
1158
|
-
var options = param.options, onSelect = param.onSelect, _param_variant = param.variant, variant = _param_variant === void 0 ? "basic" : _param_variant;
|
|
1159
|
-
var _ref = _sliced_to_array((0,
|
|
1160
|
-
var _ref1 = _sliced_to_array((0,
|
|
2941
|
+
var options = param.options, onSelect = param.onSelect, _param_variant = param.variant, variant = _param_variant === void 0 ? "basic" : _param_variant, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
|
|
2942
|
+
var _ref = _sliced_to_array((0, import_react13.useState)(false), 2), open = _ref[0], setOpen = _ref[1];
|
|
2943
|
+
var _ref1 = _sliced_to_array((0, import_react13.useState)(null), 2), selected = _ref1[0], setSelected = _ref1[1];
|
|
1161
2944
|
var handleSelect = function(option) {
|
|
1162
2945
|
setSelected(option);
|
|
1163
2946
|
onSelect(option);
|
|
1164
2947
|
setOpen(false);
|
|
1165
2948
|
};
|
|
1166
|
-
return /* @__PURE__ */
|
|
1167
|
-
className: "relative w-56"
|
|
1168
|
-
}, /* @__PURE__ */
|
|
2949
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
2950
|
+
className: "relative w-56 ".concat(className)
|
|
2951
|
+
}, /* @__PURE__ */ import_react13.default.createElement("button", {
|
|
1169
2952
|
onClick: function() {
|
|
1170
2953
|
return setOpen(!open);
|
|
1171
2954
|
},
|
|
1172
|
-
className: "w-full text-left px-4 py-2 rounded-md transition-all duration-200 ".concat(variantStyles[variant])
|
|
1173
|
-
}, selected || "Select an option"), open && /* @__PURE__ */
|
|
2955
|
+
className: "w-full text-left px-4 py-2 rounded-md transition-all duration-200 ".concat(variantStyles[variant], " ")
|
|
2956
|
+
}, selected || "Select an option"), open && /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
1174
2957
|
className: "absolute mt-2 w-full bg-white border border-gray-200 rounded-md shadow-lg z-20"
|
|
1175
2958
|
}, options.map(function(opt, idx) {
|
|
1176
|
-
return /* @__PURE__ */
|
|
2959
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", {
|
|
1177
2960
|
key: idx,
|
|
1178
2961
|
onClick: function() {
|
|
1179
2962
|
return handleSelect(opt);
|
|
@@ -1186,12 +2969,15 @@ Dropdown.displayName = "Dropdown";
|
|
|
1186
2969
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1187
2970
|
0 && (module.exports = {
|
|
1188
2971
|
MahatiButton: MahatiButton,
|
|
2972
|
+
MahatiCalendar: MahatiCalendar,
|
|
1189
2973
|
MahatiCard: MahatiCard,
|
|
2974
|
+
MahatiChart: MahatiChart,
|
|
1190
2975
|
MahatiDropdown: MahatiDropdown,
|
|
1191
2976
|
MahatiFormContainer: MahatiFormContainer,
|
|
1192
2977
|
MahatiInput: MahatiInput,
|
|
1193
2978
|
MahatiModal: MahatiModal,
|
|
1194
2979
|
MahatiTabbedInterface: MahatiTabbedInterface,
|
|
2980
|
+
MahatiTabbedInterfaceTailwind: MahatiTabbedInterfaceTailwind,
|
|
1195
2981
|
MahatiTable: MahatiTable,
|
|
1196
2982
|
MahatiTableTailwind: MahatiTableTailwind,
|
|
1197
2983
|
MahatiTooltip: MahatiTooltip
|