@algorithm-shift/design-system 1.2.968 → 1.2.969
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 +3 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +370 -137
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +352 -119
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -28363,82 +28363,13 @@ var FileInput2 = ({ className, style, ...props }) => {
|
|
|
28363
28363
|
var FileInput_default = FileInput2;
|
|
28364
28364
|
|
|
28365
28365
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
28366
|
-
import
|
|
28367
|
-
import {
|
|
28368
|
-
function DatePicker({ className, style, ...props }) {
|
|
28369
|
-
const placeholder = props.placeholder ?? "Placeholder text";
|
|
28370
|
-
const minimumDate = props.minimumDate ?? "none";
|
|
28371
|
-
const customMinimumDate = props.customMinimumDate ?? "";
|
|
28372
|
-
const maximumDate = props.maximumDate ?? "none";
|
|
28373
|
-
const customMaximumDate = props.customMaximumDate ?? "";
|
|
28374
|
-
const isEditable = props.isEditable ?? true;
|
|
28375
|
-
const isDisabled = props.isDisabled ?? false;
|
|
28376
|
-
const isReadonly = props.isReadonly ?? false;
|
|
28377
|
-
const isAutocomplete = props.isAutocomplete ?? false;
|
|
28378
|
-
const resolveDate = (option, customOption) => {
|
|
28379
|
-
if (!option) return void 0;
|
|
28380
|
-
switch (option) {
|
|
28381
|
-
case "today":
|
|
28382
|
-
return (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
28383
|
-
case "custom":
|
|
28384
|
-
return customOption ?? void 0;
|
|
28385
|
-
case "none":
|
|
28386
|
-
default:
|
|
28387
|
-
return void 0;
|
|
28388
|
-
}
|
|
28389
|
-
};
|
|
28390
|
-
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
28391
|
-
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
28392
|
-
useEffect20(() => {
|
|
28393
|
-
if (props.value !== void 0) {
|
|
28394
|
-
handleChange(props.value);
|
|
28395
|
-
}
|
|
28396
|
-
}, []);
|
|
28397
|
-
const handleChange = (e) => {
|
|
28398
|
-
props.onChange?.(e, props?.name || "");
|
|
28399
|
-
};
|
|
28400
|
-
const toDateInputValue = (value) => {
|
|
28401
|
-
if (!value) return "";
|
|
28402
|
-
return new Date(value).toISOString().split("T")[0];
|
|
28403
|
-
};
|
|
28404
|
-
return /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
28405
|
-
/* @__PURE__ */ jsx43("div", { className: "flex justify-start items-center relative", children: /* @__PURE__ */ jsx43(
|
|
28406
|
-
Input,
|
|
28407
|
-
{
|
|
28408
|
-
type: "date",
|
|
28409
|
-
id: "date",
|
|
28410
|
-
autoComplete: isAutocomplete ? "on" : "off",
|
|
28411
|
-
onChange: handleChange,
|
|
28412
|
-
disabled: isDisabled || !isEditable,
|
|
28413
|
-
name: props.name,
|
|
28414
|
-
value: toDateInputValue(props.value),
|
|
28415
|
-
className: cn(
|
|
28416
|
-
className,
|
|
28417
|
-
props.errorMessage ? "border-red-500" : "",
|
|
28418
|
-
"appearance-auto"
|
|
28419
|
-
),
|
|
28420
|
-
style: {
|
|
28421
|
-
...style,
|
|
28422
|
-
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
28423
|
-
},
|
|
28424
|
-
readOnly: isReadonly,
|
|
28425
|
-
placeholder,
|
|
28426
|
-
min: minDate,
|
|
28427
|
-
max: maxDate
|
|
28428
|
-
}
|
|
28429
|
-
) }),
|
|
28430
|
-
props.errorMessage && /* @__PURE__ */ jsx43("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
28431
|
-
] });
|
|
28432
|
-
}
|
|
28433
|
-
|
|
28434
|
-
// src/components/Inputs/DateRange/DateRange.tsx
|
|
28435
|
-
import React7, { useEffect as useEffect22 } from "react";
|
|
28436
|
-
import { addDays, format } from "date-fns";
|
|
28366
|
+
import * as React6 from "react";
|
|
28367
|
+
import { format } from "date-fns";
|
|
28437
28368
|
|
|
28438
28369
|
// src/components/ui/calendar.tsx
|
|
28439
|
-
import * as
|
|
28370
|
+
import * as React5 from "react";
|
|
28440
28371
|
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
28441
|
-
import { jsx as
|
|
28372
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
28442
28373
|
function Calendar2({
|
|
28443
28374
|
className,
|
|
28444
28375
|
classNames,
|
|
@@ -28450,7 +28381,7 @@ function Calendar2({
|
|
|
28450
28381
|
...props
|
|
28451
28382
|
}) {
|
|
28452
28383
|
const defaultClassNames = getDefaultClassNames();
|
|
28453
|
-
return /* @__PURE__ */
|
|
28384
|
+
return /* @__PURE__ */ jsx43(
|
|
28454
28385
|
DayPicker,
|
|
28455
28386
|
{
|
|
28456
28387
|
showOutsideDays,
|
|
@@ -28549,7 +28480,7 @@ function Calendar2({
|
|
|
28549
28480
|
},
|
|
28550
28481
|
components: {
|
|
28551
28482
|
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
28552
|
-
return /* @__PURE__ */
|
|
28483
|
+
return /* @__PURE__ */ jsx43(
|
|
28553
28484
|
"div",
|
|
28554
28485
|
{
|
|
28555
28486
|
"data-slot": "calendar",
|
|
@@ -28561,10 +28492,10 @@ function Calendar2({
|
|
|
28561
28492
|
},
|
|
28562
28493
|
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
28563
28494
|
if (orientation === "left") {
|
|
28564
|
-
return /* @__PURE__ */
|
|
28495
|
+
return /* @__PURE__ */ jsx43(ChevronLeft, { className: cn("size-4", className2), ...props2 });
|
|
28565
28496
|
}
|
|
28566
28497
|
if (orientation === "right") {
|
|
28567
|
-
return /* @__PURE__ */
|
|
28498
|
+
return /* @__PURE__ */ jsx43(
|
|
28568
28499
|
ChevronRight,
|
|
28569
28500
|
{
|
|
28570
28501
|
className: cn("size-4", className2),
|
|
@@ -28572,11 +28503,11 @@ function Calendar2({
|
|
|
28572
28503
|
}
|
|
28573
28504
|
);
|
|
28574
28505
|
}
|
|
28575
|
-
return /* @__PURE__ */
|
|
28506
|
+
return /* @__PURE__ */ jsx43(ChevronDown, { className: cn("size-4", className2), ...props2 });
|
|
28576
28507
|
},
|
|
28577
28508
|
DayButton: CalendarDayButton,
|
|
28578
28509
|
WeekNumber: ({ children, ...props2 }) => {
|
|
28579
|
-
return /* @__PURE__ */
|
|
28510
|
+
return /* @__PURE__ */ jsx43("td", { ...props2, children: /* @__PURE__ */ jsx43("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
28580
28511
|
},
|
|
28581
28512
|
...components
|
|
28582
28513
|
},
|
|
@@ -28591,11 +28522,11 @@ function CalendarDayButton({
|
|
|
28591
28522
|
...props
|
|
28592
28523
|
}) {
|
|
28593
28524
|
const defaultClassNames = getDefaultClassNames();
|
|
28594
|
-
const ref =
|
|
28595
|
-
|
|
28525
|
+
const ref = React5.useRef(null);
|
|
28526
|
+
React5.useEffect(() => {
|
|
28596
28527
|
if (modifiers.focused) ref.current?.focus();
|
|
28597
28528
|
}, [modifiers.focused]);
|
|
28598
|
-
return /* @__PURE__ */
|
|
28529
|
+
return /* @__PURE__ */ jsx43(
|
|
28599
28530
|
Button,
|
|
28600
28531
|
{
|
|
28601
28532
|
ref,
|
|
@@ -28618,16 +28549,16 @@ function CalendarDayButton({
|
|
|
28618
28549
|
|
|
28619
28550
|
// src/components/ui/popover.tsx
|
|
28620
28551
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
28621
|
-
import { jsx as
|
|
28552
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
28622
28553
|
function Popover({
|
|
28623
28554
|
...props
|
|
28624
28555
|
}) {
|
|
28625
|
-
return /* @__PURE__ */
|
|
28556
|
+
return /* @__PURE__ */ jsx44(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
28626
28557
|
}
|
|
28627
28558
|
function PopoverTrigger({
|
|
28628
28559
|
...props
|
|
28629
28560
|
}) {
|
|
28630
|
-
return /* @__PURE__ */
|
|
28561
|
+
return /* @__PURE__ */ jsx44(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
28631
28562
|
}
|
|
28632
28563
|
function PopoverContent({
|
|
28633
28564
|
className,
|
|
@@ -28635,7 +28566,7 @@ function PopoverContent({
|
|
|
28635
28566
|
sideOffset = 4,
|
|
28636
28567
|
...props
|
|
28637
28568
|
}) {
|
|
28638
|
-
return /* @__PURE__ */
|
|
28569
|
+
return /* @__PURE__ */ jsx44(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx44(
|
|
28639
28570
|
PopoverPrimitive.Content,
|
|
28640
28571
|
{
|
|
28641
28572
|
"data-slot": "popover-content",
|
|
@@ -28650,7 +28581,309 @@ function PopoverContent({
|
|
|
28650
28581
|
) });
|
|
28651
28582
|
}
|
|
28652
28583
|
|
|
28584
|
+
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
28585
|
+
import { Fragment as Fragment16, jsx as jsx45, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
28586
|
+
function resolveDate(option, customOption) {
|
|
28587
|
+
if (!option) return void 0;
|
|
28588
|
+
switch (option) {
|
|
28589
|
+
case "today":
|
|
28590
|
+
return /* @__PURE__ */ new Date();
|
|
28591
|
+
case "custom":
|
|
28592
|
+
return customOption ? new Date(customOption) : void 0;
|
|
28593
|
+
case "none":
|
|
28594
|
+
default:
|
|
28595
|
+
return void 0;
|
|
28596
|
+
}
|
|
28597
|
+
}
|
|
28598
|
+
function DateTimePicker({
|
|
28599
|
+
className,
|
|
28600
|
+
style,
|
|
28601
|
+
mode = "date",
|
|
28602
|
+
...props
|
|
28603
|
+
}) {
|
|
28604
|
+
const placeholderMap = {
|
|
28605
|
+
date: "Select date",
|
|
28606
|
+
datetime: "Select date & time",
|
|
28607
|
+
time: "Select time"
|
|
28608
|
+
};
|
|
28609
|
+
const placeholder = props.placeholder ?? placeholderMap[mode];
|
|
28610
|
+
const minimumDate = props.minimumDate ?? "none";
|
|
28611
|
+
const customMinimumDate = props.customMinimumDate ?? "";
|
|
28612
|
+
const maximumDate = props.maximumDate ?? "none";
|
|
28613
|
+
const customMaximumDate = props.customMaximumDate ?? "";
|
|
28614
|
+
const isEditable = props.isEditable ?? true;
|
|
28615
|
+
const isDisabled = props.isDisabled ?? false;
|
|
28616
|
+
const isReadonly = props.isReadonly ?? false;
|
|
28617
|
+
const isAutocomplete = props.isAutocomplete ?? false;
|
|
28618
|
+
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
28619
|
+
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
28620
|
+
const [date, setDate] = React6.useState(() => {
|
|
28621
|
+
if (!props.value) return void 0;
|
|
28622
|
+
const d = new Date(props.value);
|
|
28623
|
+
return isNaN(d.getTime()) ? void 0 : d;
|
|
28624
|
+
});
|
|
28625
|
+
const initialHours = date ? date.getHours() : 0;
|
|
28626
|
+
const initialMinutes = date ? date.getMinutes() : 0;
|
|
28627
|
+
const [hours, setHours] = React6.useState(initialHours);
|
|
28628
|
+
const [minutes, setMinutes] = React6.useState(initialMinutes);
|
|
28629
|
+
const [amPm, setAmPm] = React6.useState("AM");
|
|
28630
|
+
const displayHours = React6.useMemo(() => {
|
|
28631
|
+
if (hours === 0) return 12;
|
|
28632
|
+
if (hours > 12) return hours - 12;
|
|
28633
|
+
return hours;
|
|
28634
|
+
}, [hours]);
|
|
28635
|
+
React6.useEffect(() => {
|
|
28636
|
+
setAmPm(hours >= 12 ? "PM" : "AM");
|
|
28637
|
+
}, [hours]);
|
|
28638
|
+
React6.useEffect(() => {
|
|
28639
|
+
if (!props.value) {
|
|
28640
|
+
setDate(void 0);
|
|
28641
|
+
return;
|
|
28642
|
+
}
|
|
28643
|
+
const d = new Date(props.value);
|
|
28644
|
+
if (!isNaN(d.getTime())) {
|
|
28645
|
+
setDate(d);
|
|
28646
|
+
setHours(d.getHours());
|
|
28647
|
+
setMinutes(d.getMinutes());
|
|
28648
|
+
}
|
|
28649
|
+
}, [props.value]);
|
|
28650
|
+
const [year, setYear] = React6.useState(date ? date.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear());
|
|
28651
|
+
React6.useEffect(() => {
|
|
28652
|
+
if (!date) return;
|
|
28653
|
+
const newDate = new Date(date);
|
|
28654
|
+
newDate.setFullYear(year);
|
|
28655
|
+
setDate(newDate);
|
|
28656
|
+
emitChange(newDate);
|
|
28657
|
+
}, [year]);
|
|
28658
|
+
const emitChange = (nextDate) => {
|
|
28659
|
+
if (!props.onChange) return;
|
|
28660
|
+
let valueString = "";
|
|
28661
|
+
if (!nextDate) {
|
|
28662
|
+
valueString = "";
|
|
28663
|
+
} else if (mode === "date") {
|
|
28664
|
+
valueString = format(nextDate, "yyyy-MM-dd");
|
|
28665
|
+
} else if (mode === "time") {
|
|
28666
|
+
valueString = format(nextDate, "HH:mm:ss");
|
|
28667
|
+
} else {
|
|
28668
|
+
valueString = nextDate.toISOString();
|
|
28669
|
+
}
|
|
28670
|
+
const target = {
|
|
28671
|
+
name: props.name || "",
|
|
28672
|
+
value: valueString
|
|
28673
|
+
};
|
|
28674
|
+
const event = {
|
|
28675
|
+
target
|
|
28676
|
+
};
|
|
28677
|
+
props.onChange(event, props.name || "");
|
|
28678
|
+
};
|
|
28679
|
+
const updateDateTime = (nextBaseDate, h = hours, m = minutes) => {
|
|
28680
|
+
if (!nextBaseDate) {
|
|
28681
|
+
setDate(void 0);
|
|
28682
|
+
emitChange(void 0);
|
|
28683
|
+
return;
|
|
28684
|
+
}
|
|
28685
|
+
const d = new Date(nextBaseDate);
|
|
28686
|
+
if (mode !== "date") {
|
|
28687
|
+
d.setHours(h);
|
|
28688
|
+
d.setMinutes(m);
|
|
28689
|
+
d.setSeconds(0);
|
|
28690
|
+
d.setMilliseconds(0);
|
|
28691
|
+
} else {
|
|
28692
|
+
d.setHours(0, 0, 0, 0);
|
|
28693
|
+
}
|
|
28694
|
+
if (minDate && d < minDate) return;
|
|
28695
|
+
if (maxDate && d > maxDate) return;
|
|
28696
|
+
setDate(d);
|
|
28697
|
+
setYear(d.getFullYear());
|
|
28698
|
+
emitChange(d);
|
|
28699
|
+
};
|
|
28700
|
+
const handleDaySelect = (next) => {
|
|
28701
|
+
if (!next) {
|
|
28702
|
+
setDate(void 0);
|
|
28703
|
+
emitChange(void 0);
|
|
28704
|
+
return;
|
|
28705
|
+
}
|
|
28706
|
+
const clickedDate = new Date(next);
|
|
28707
|
+
const selectedYearDate = new Date(year, clickedDate.getMonth(), clickedDate.getDate());
|
|
28708
|
+
updateDateTime(selectedYearDate);
|
|
28709
|
+
};
|
|
28710
|
+
const updateTimeInDate = (h, m) => {
|
|
28711
|
+
if (!date) {
|
|
28712
|
+
const fallbackDate = /* @__PURE__ */ new Date();
|
|
28713
|
+
fallbackDate.setHours(h);
|
|
28714
|
+
fallbackDate.setMinutes(m);
|
|
28715
|
+
fallbackDate.setSeconds(0);
|
|
28716
|
+
fallbackDate.setMilliseconds(0);
|
|
28717
|
+
setDate(fallbackDate);
|
|
28718
|
+
emitChange(fallbackDate);
|
|
28719
|
+
} else {
|
|
28720
|
+
const newDate = new Date(date);
|
|
28721
|
+
newDate.setHours(h);
|
|
28722
|
+
newDate.setMinutes(m);
|
|
28723
|
+
newDate.setSeconds(0);
|
|
28724
|
+
newDate.setMilliseconds(0);
|
|
28725
|
+
setDate(newDate);
|
|
28726
|
+
emitChange(newDate);
|
|
28727
|
+
}
|
|
28728
|
+
};
|
|
28729
|
+
const handleHoursChange = (e) => {
|
|
28730
|
+
let h = Number(e.target.value);
|
|
28731
|
+
if (amPm === "PM" && h < 12) h += 12;
|
|
28732
|
+
if (amPm === "AM" && h === 12) h = 0;
|
|
28733
|
+
setHours(h);
|
|
28734
|
+
updateTimeInDate(h, minutes);
|
|
28735
|
+
};
|
|
28736
|
+
const handleMinutesChange = (e) => {
|
|
28737
|
+
const m = Number(e.target.value);
|
|
28738
|
+
setMinutes(m);
|
|
28739
|
+
updateTimeInDate(hours, m);
|
|
28740
|
+
};
|
|
28741
|
+
const handleAmPmChange = (e) => {
|
|
28742
|
+
const val = e.target.value;
|
|
28743
|
+
setAmPm(val);
|
|
28744
|
+
let h = displayHours;
|
|
28745
|
+
if (val === "PM" && h < 12) h += 12;
|
|
28746
|
+
if (val === "AM" && h === 12) h = 0;
|
|
28747
|
+
setHours(h);
|
|
28748
|
+
updateTimeInDate(h, minutes);
|
|
28749
|
+
};
|
|
28750
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
28751
|
+
const yearOptions = [];
|
|
28752
|
+
for (let y = currentYear - 50; y <= currentYear + 10; y++) {
|
|
28753
|
+
yearOptions.push(y);
|
|
28754
|
+
}
|
|
28755
|
+
const displayValue = React6.useMemo(() => {
|
|
28756
|
+
if (!date) return "";
|
|
28757
|
+
try {
|
|
28758
|
+
if (mode === "date") return format(date, "yyyy-MM-dd");
|
|
28759
|
+
if (mode === "time") return format(date, "hh:mm aa");
|
|
28760
|
+
return format(date, "yyyy-MM-dd hh:mm aa");
|
|
28761
|
+
} catch {
|
|
28762
|
+
return "";
|
|
28763
|
+
}
|
|
28764
|
+
}, [date, mode]);
|
|
28765
|
+
const isInputDisabled = isDisabled || !isEditable;
|
|
28766
|
+
const [calendarMonthState, setCalendarMonthState] = React6.useState(() => {
|
|
28767
|
+
return date ? new Date(date.getFullYear(), date.getMonth()) : new Date(year, 0);
|
|
28768
|
+
});
|
|
28769
|
+
React6.useEffect(() => {
|
|
28770
|
+
setCalendarMonthState(new Date(year, calendarMonthState.getMonth()));
|
|
28771
|
+
}, [year]);
|
|
28772
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col", children: [
|
|
28773
|
+
/* @__PURE__ */ jsxs24(Popover, { children: [
|
|
28774
|
+
/* @__PURE__ */ jsx45(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx45(
|
|
28775
|
+
Button,
|
|
28776
|
+
{
|
|
28777
|
+
type: "button",
|
|
28778
|
+
variant: "outline",
|
|
28779
|
+
className: cn(
|
|
28780
|
+
"w-full justify-start text-left font-normal",
|
|
28781
|
+
!date && "text-muted-foreground",
|
|
28782
|
+
props.errorMessage && "border-red-500",
|
|
28783
|
+
className
|
|
28784
|
+
),
|
|
28785
|
+
style: {
|
|
28786
|
+
...style,
|
|
28787
|
+
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
28788
|
+
},
|
|
28789
|
+
disabled: isInputDisabled,
|
|
28790
|
+
children: displayValue || placeholder
|
|
28791
|
+
}
|
|
28792
|
+
) }),
|
|
28793
|
+
/* @__PURE__ */ jsx45(PopoverContent, { className: "w-auto text-sm p-2", align: "start", style: { fontSize: "0.75rem" }, children: /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1", children: [
|
|
28794
|
+
(mode === "date" || mode === "datetime") && /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
28795
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between gap-1", children: [
|
|
28796
|
+
/* @__PURE__ */ jsx45("label", { className: "text-xs text-muted-foreground", children: "Year" }),
|
|
28797
|
+
/* @__PURE__ */ jsx45(
|
|
28798
|
+
"select",
|
|
28799
|
+
{
|
|
28800
|
+
className: "h-8 rounded border bg-background px-2 text-sm",
|
|
28801
|
+
value: year,
|
|
28802
|
+
onChange: (e) => setYear(Number(e.target.value)),
|
|
28803
|
+
disabled: isInputDisabled || isReadonly,
|
|
28804
|
+
children: yearOptions.map((y) => /* @__PURE__ */ jsx45("option", { value: y, children: y }, y))
|
|
28805
|
+
}
|
|
28806
|
+
)
|
|
28807
|
+
] }),
|
|
28808
|
+
/* @__PURE__ */ jsx45("div", { className: "calendar-container", children: /* @__PURE__ */ jsx45(
|
|
28809
|
+
Calendar2,
|
|
28810
|
+
{
|
|
28811
|
+
mode: "single",
|
|
28812
|
+
selected: date,
|
|
28813
|
+
onSelect: handleDaySelect,
|
|
28814
|
+
month: calendarMonthState,
|
|
28815
|
+
onMonthChange: (newMonth) => setCalendarMonthState(newMonth),
|
|
28816
|
+
disabled: (d) => {
|
|
28817
|
+
if (minDate && d < minDate) return true;
|
|
28818
|
+
if (maxDate && d > maxDate) return true;
|
|
28819
|
+
return false;
|
|
28820
|
+
},
|
|
28821
|
+
initialFocus: true
|
|
28822
|
+
}
|
|
28823
|
+
) })
|
|
28824
|
+
] }),
|
|
28825
|
+
(mode === "time" || mode === "datetime") && /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 mt-0", children: [
|
|
28826
|
+
/* @__PURE__ */ jsx45("label", { className: "text-xs text-muted-foreground", children: "Time" }),
|
|
28827
|
+
/* @__PURE__ */ jsx45(
|
|
28828
|
+
"select",
|
|
28829
|
+
{
|
|
28830
|
+
className: "h-8 rounded border bg-background px-2 text-sm",
|
|
28831
|
+
value: displayHours,
|
|
28832
|
+
onChange: handleHoursChange,
|
|
28833
|
+
disabled: isInputDisabled || isReadonly,
|
|
28834
|
+
children: Array.from({ length: 12 }, (_, i) => i + 1).map((hour) => /* @__PURE__ */ jsx45("option", { value: hour, children: hour.toString().padStart(2, "0") }, hour))
|
|
28835
|
+
}
|
|
28836
|
+
),
|
|
28837
|
+
/* @__PURE__ */ jsx45("span", { className: "text-sm", children: ":" }),
|
|
28838
|
+
/* @__PURE__ */ jsx45(
|
|
28839
|
+
"select",
|
|
28840
|
+
{
|
|
28841
|
+
className: "h-8 rounded border bg-background px-2 text-sm",
|
|
28842
|
+
value: minutes,
|
|
28843
|
+
onChange: handleMinutesChange,
|
|
28844
|
+
disabled: isInputDisabled || isReadonly,
|
|
28845
|
+
children: Array.from({ length: 12 }).map((_, i) => {
|
|
28846
|
+
const val = i * 5;
|
|
28847
|
+
return /* @__PURE__ */ jsx45("option", { value: val, children: val.toString().padStart(2, "0") }, val);
|
|
28848
|
+
})
|
|
28849
|
+
}
|
|
28850
|
+
),
|
|
28851
|
+
/* @__PURE__ */ jsxs24(
|
|
28852
|
+
"select",
|
|
28853
|
+
{
|
|
28854
|
+
className: "h-8 rounded border bg-background px-2 text-sm",
|
|
28855
|
+
value: amPm,
|
|
28856
|
+
onChange: handleAmPmChange,
|
|
28857
|
+
disabled: isInputDisabled || isReadonly,
|
|
28858
|
+
children: [
|
|
28859
|
+
/* @__PURE__ */ jsx45("option", { value: "AM", children: "AM" }),
|
|
28860
|
+
/* @__PURE__ */ jsx45("option", { value: "PM", children: "PM" })
|
|
28861
|
+
]
|
|
28862
|
+
}
|
|
28863
|
+
)
|
|
28864
|
+
] })
|
|
28865
|
+
] }) })
|
|
28866
|
+
] }),
|
|
28867
|
+
/* @__PURE__ */ jsx45(
|
|
28868
|
+
Input,
|
|
28869
|
+
{
|
|
28870
|
+
type: "hidden",
|
|
28871
|
+
id: props.name,
|
|
28872
|
+
name: props.name,
|
|
28873
|
+
autoComplete: isAutocomplete ? "on" : "off",
|
|
28874
|
+
readOnly: isReadonly,
|
|
28875
|
+
value: !date ? "" : mode === "date" ? format(date, "yyyy-MM-dd") : mode === "time" ? format(date, "HH:mm:ss") : date.toISOString(),
|
|
28876
|
+
onChange: () => {
|
|
28877
|
+
}
|
|
28878
|
+
}
|
|
28879
|
+
),
|
|
28880
|
+
props.errorMessage && /* @__PURE__ */ jsx45("p", { className: "mt-1 text-xs text-red-500", children: props.errorMessage })
|
|
28881
|
+
] });
|
|
28882
|
+
}
|
|
28883
|
+
|
|
28653
28884
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
28885
|
+
import React7, { useEffect as useEffect22 } from "react";
|
|
28886
|
+
import { addDays, format as format2 } from "date-fns";
|
|
28654
28887
|
import { Fragment as Fragment17, jsx as jsx46, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
28655
28888
|
var DateRange = ({ className, style, ...props }) => {
|
|
28656
28889
|
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
@@ -28683,11 +28916,11 @@ var DateRange = ({ className, style, ...props }) => {
|
|
|
28683
28916
|
!date && "text-muted-foreground"
|
|
28684
28917
|
),
|
|
28685
28918
|
children: date?.from ? date.to ? /* @__PURE__ */ jsxs25(Fragment17, { children: [
|
|
28686
|
-
|
|
28919
|
+
format2(date.from, "LLL dd, y"),
|
|
28687
28920
|
" -",
|
|
28688
28921
|
" ",
|
|
28689
|
-
|
|
28690
|
-
] }) :
|
|
28922
|
+
format2(date.to, "LLL dd, y")
|
|
28923
|
+
] }) : format2(date.from, "LLL dd, y") : /* @__PURE__ */ jsx46("span", { children: "Pick a date range" })
|
|
28691
28924
|
}
|
|
28692
28925
|
) }),
|
|
28693
28926
|
/* @__PURE__ */ jsx46(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx46(
|
|
@@ -28768,7 +29001,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
|
|
|
28768
29001
|
var TextInputGroup_default = TextInputGroup;
|
|
28769
29002
|
|
|
28770
29003
|
// src/components/Inputs/Multiselect/MultiSelect.tsx
|
|
28771
|
-
import { useState as
|
|
29004
|
+
import { useState as useState7, useRef as useRef6, useEffect as useEffect24, useMemo as useMemo5 } from "react";
|
|
28772
29005
|
import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
28773
29006
|
function LazyMultiSelectDropdown({
|
|
28774
29007
|
options = [],
|
|
@@ -28788,8 +29021,8 @@ function LazyMultiSelectDropdown({
|
|
|
28788
29021
|
axiosInstance,
|
|
28789
29022
|
outputFormat = "array"
|
|
28790
29023
|
}) {
|
|
28791
|
-
const [isOpen, setIsOpen] =
|
|
28792
|
-
const [searchTerm, setSearchTerm] =
|
|
29024
|
+
const [isOpen, setIsOpen] = useState7(false);
|
|
29025
|
+
const [searchTerm, setSearchTerm] = useState7("");
|
|
28793
29026
|
const dropdownRef = useRef6(null);
|
|
28794
29027
|
const observerTarget = useRef6(null);
|
|
28795
29028
|
const ensureUnique = (arr) => {
|
|
@@ -28839,7 +29072,7 @@ function LazyMultiSelectDropdown({
|
|
|
28839
29072
|
return unique;
|
|
28840
29073
|
}
|
|
28841
29074
|
};
|
|
28842
|
-
const selectedOptions =
|
|
29075
|
+
const selectedOptions = useMemo5(() => {
|
|
28843
29076
|
return lazyOptions.filter((opt) => normalizedValue.includes(opt.value));
|
|
28844
29077
|
}, [lazyOptions, normalizedValue]);
|
|
28845
29078
|
useEffect24(() => {
|
|
@@ -29089,14 +29322,14 @@ dayjs.extend(utc);
|
|
|
29089
29322
|
var dayjs_setup_default = dayjs;
|
|
29090
29323
|
|
|
29091
29324
|
// src/lib/table/valueFormatter.ts
|
|
29092
|
-
var valueFormatter = (value,
|
|
29093
|
-
if (!
|
|
29325
|
+
var valueFormatter = (value, format3, customFormatters = {}) => {
|
|
29326
|
+
if (!format3) return value;
|
|
29094
29327
|
if (value == null || value === "" || value === void 0) return "-";
|
|
29095
|
-
if (
|
|
29096
|
-
const key =
|
|
29328
|
+
if (format3.startsWith("custom:")) {
|
|
29329
|
+
const key = format3.replace("custom:", "");
|
|
29097
29330
|
return customFormatters[key] ? customFormatters[key](value) : value;
|
|
29098
29331
|
}
|
|
29099
|
-
const [type, arg] =
|
|
29332
|
+
const [type, arg] = format3.split(":");
|
|
29100
29333
|
switch (type) {
|
|
29101
29334
|
case "date":
|
|
29102
29335
|
return dayjs_setup_default(value).format(arg || "YYYY-MM-DD");
|
|
@@ -29179,8 +29412,8 @@ var sanitizeValue = (val) => {
|
|
|
29179
29412
|
}
|
|
29180
29413
|
return String(val);
|
|
29181
29414
|
};
|
|
29182
|
-
var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers = {},
|
|
29183
|
-
const formattedValue = valueFormatter(value,
|
|
29415
|
+
var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers = {}, format3, customFormatters = {}) => {
|
|
29416
|
+
const formattedValue = valueFormatter(value, format3, customFormatters);
|
|
29184
29417
|
const rowValue = row?.[rendererProps?.rowField];
|
|
29185
29418
|
switch (renderer) {
|
|
29186
29419
|
/* -------------------- BASIC -------------------- */
|
|
@@ -29189,7 +29422,7 @@ var cellRendererFactory = (renderer, rendererProps, value, row, customRenderers
|
|
|
29189
29422
|
case "number":
|
|
29190
29423
|
return /* @__PURE__ */ jsx50("span", { className: "tabular-nums text-right", children: valueFormatter(rowValue || value, "number:2") });
|
|
29191
29424
|
case "date":
|
|
29192
|
-
return /* @__PURE__ */ jsx50("span", { children: valueFormatter(rowValue || value,
|
|
29425
|
+
return /* @__PURE__ */ jsx50("span", { children: valueFormatter(rowValue || value, format3) });
|
|
29193
29426
|
case "link":
|
|
29194
29427
|
return /* @__PURE__ */ jsx50(
|
|
29195
29428
|
"a",
|
|
@@ -30002,7 +30235,7 @@ var CustomPagination = ({
|
|
|
30002
30235
|
var Pagination_default = CustomPagination;
|
|
30003
30236
|
|
|
30004
30237
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
30005
|
-
import { useCallback as useCallback3, useMemo as
|
|
30238
|
+
import { useCallback as useCallback3, useMemo as useMemo7, useState as useState9 } from "react";
|
|
30006
30239
|
import Link5 from "next/link";
|
|
30007
30240
|
import { usePathname, useRouter } from "next/navigation";
|
|
30008
30241
|
|
|
@@ -30160,7 +30393,7 @@ function showSonnerToast({
|
|
|
30160
30393
|
// src/components/Navigation/Tabs/Tabs.tsx
|
|
30161
30394
|
import { Fragment as Fragment22, jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
30162
30395
|
var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuilder = false, source, parentKey, menuNameKey, menuUrlKey, loading, bgActiveColor, textActiveColor }) => {
|
|
30163
|
-
const [openIndex, setOpenIndex] =
|
|
30396
|
+
const [openIndex, setOpenIndex] = useState9(null);
|
|
30164
30397
|
const currentPathname = usePathname();
|
|
30165
30398
|
function groupMenus(menus = []) {
|
|
30166
30399
|
const menuMap = /* @__PURE__ */ new Map();
|
|
@@ -30194,7 +30427,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30194
30427
|
});
|
|
30195
30428
|
return sortMenus(rootMenus);
|
|
30196
30429
|
}
|
|
30197
|
-
const rawTabs =
|
|
30430
|
+
const rawTabs = useMemo7(() => {
|
|
30198
30431
|
if (!Array.isArray(tabs)) return [];
|
|
30199
30432
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
30200
30433
|
return groupMenus(tabs);
|
|
@@ -30224,8 +30457,8 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30224
30457
|
return tab.children.some((child) => isActive(child.url));
|
|
30225
30458
|
};
|
|
30226
30459
|
const router = useRouter();
|
|
30227
|
-
const [showExitDialog, setShowExitDialog] =
|
|
30228
|
-
const [pendingUrl, setPendingUrl] =
|
|
30460
|
+
const [showExitDialog, setShowExitDialog] = useState9(false);
|
|
30461
|
+
const [pendingUrl, setPendingUrl] = useState9(null);
|
|
30229
30462
|
const handleBuilderExit = useCallback3(
|
|
30230
30463
|
(e, url) => {
|
|
30231
30464
|
if (isBuilder) {
|
|
@@ -30393,11 +30626,11 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30393
30626
|
var Tabs_default = Tabs;
|
|
30394
30627
|
|
|
30395
30628
|
// src/components/Navigation/Stages/Stages.tsx
|
|
30396
|
-
import React10, { useState as
|
|
30629
|
+
import React10, { useState as useState10 } from "react";
|
|
30397
30630
|
import { jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
30398
30631
|
var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStageChange, currentStage, dataKey = "key", dataLabel = "header", loading, saving, triggerOnClick = false }) => {
|
|
30399
|
-
const [activeStage, setActiveStage] =
|
|
30400
|
-
const [isCompleted, setIsCompleted] =
|
|
30632
|
+
const [activeStage, setActiveStage] = useState10(currentStage || (stages && stages.length > 0 ? stages[0].key : null));
|
|
30633
|
+
const [isCompleted, setIsCompleted] = useState10(false);
|
|
30401
30634
|
const updateStage = (stageKey) => {
|
|
30402
30635
|
setActiveStage(stageKey);
|
|
30403
30636
|
onStageChange?.(stageKey);
|
|
@@ -30533,7 +30766,7 @@ import Link6 from "next/link";
|
|
|
30533
30766
|
import Image4 from "next/image";
|
|
30534
30767
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
30535
30768
|
import { DropdownMenuSeparator } from "@radix-ui/react-dropdown-menu";
|
|
30536
|
-
import { useCallback as useCallback4, useMemo as
|
|
30769
|
+
import { useCallback as useCallback4, useMemo as useMemo8, useState as useState11 } from "react";
|
|
30537
30770
|
import { Fragment as Fragment23, jsx as jsx63, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
30538
30771
|
function Navbar({
|
|
30539
30772
|
style,
|
|
@@ -30554,8 +30787,8 @@ function Navbar({
|
|
|
30554
30787
|
}) {
|
|
30555
30788
|
const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
|
|
30556
30789
|
const router = useRouter2();
|
|
30557
|
-
const [showExitDialog, setShowExitDialog] =
|
|
30558
|
-
const [pendingUrl, setPendingUrl] =
|
|
30790
|
+
const [showExitDialog, setShowExitDialog] = useState11(false);
|
|
30791
|
+
const [pendingUrl, setPendingUrl] = useState11(null);
|
|
30559
30792
|
const handleBuilderExit = useCallback4(
|
|
30560
30793
|
(e, url) => {
|
|
30561
30794
|
if (isBuilder) {
|
|
@@ -30572,7 +30805,7 @@ function Navbar({
|
|
|
30572
30805
|
router.push(pendingUrl);
|
|
30573
30806
|
}
|
|
30574
30807
|
};
|
|
30575
|
-
const formatedMenu =
|
|
30808
|
+
const formatedMenu = useMemo8(() => {
|
|
30576
30809
|
if (source === "state" && navList && navList.length) {
|
|
30577
30810
|
return navList.map((i) => ({ ...i, header: i.name || "Menu" }));
|
|
30578
30811
|
}
|
|
@@ -30750,7 +30983,7 @@ var ChartComponent = ({ className, style, loading, ...props }) => {
|
|
|
30750
30983
|
var BarChart_default = React12.memo(ChartComponent);
|
|
30751
30984
|
|
|
30752
30985
|
// src/components/Chart/PieChart.tsx
|
|
30753
|
-
import React13, { useEffect as useEffect25, useMemo as
|
|
30986
|
+
import React13, { useEffect as useEffect25, useMemo as useMemo9, useState as useState12 } from "react";
|
|
30754
30987
|
import {
|
|
30755
30988
|
PieChart,
|
|
30756
30989
|
Pie,
|
|
@@ -30779,18 +31012,18 @@ var DonutChart = ({ className, style, loading, ...props }) => {
|
|
|
30779
31012
|
const showLegends = props.showLegends ?? true;
|
|
30780
31013
|
const labelType = props.labelType || "inside";
|
|
30781
31014
|
const canvasMode = props.canvasMode;
|
|
30782
|
-
const data =
|
|
31015
|
+
const data = useMemo9(() => {
|
|
30783
31016
|
if (!Array.isArray(props.data)) return [];
|
|
30784
31017
|
return props.data.map((item) => ({ ...item, color: getRandomColor() }));
|
|
30785
31018
|
}, [props.data]);
|
|
30786
|
-
const total =
|
|
31019
|
+
const total = useMemo9(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
|
|
30787
31020
|
const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
|
|
30788
|
-
const [mounted, setMounted] =
|
|
31021
|
+
const [mounted, setMounted] = useState12(false);
|
|
30789
31022
|
useEffect25(() => {
|
|
30790
31023
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
30791
31024
|
return () => clearTimeout(timeout);
|
|
30792
31025
|
}, []);
|
|
30793
|
-
const renderLegends =
|
|
31026
|
+
const renderLegends = useMemo9(() => {
|
|
30794
31027
|
if (!showLegends) return null;
|
|
30795
31028
|
return /* @__PURE__ */ jsx65(Fragment24, { children: data.map((d) => /* @__PURE__ */ jsxs39(
|
|
30796
31029
|
"div",
|
|
@@ -30990,7 +31223,7 @@ export {
|
|
|
30990
31223
|
SplitButton as ButtonGroup,
|
|
30991
31224
|
Checkbox_default as Checkbox,
|
|
30992
31225
|
Container_default as Container,
|
|
30993
|
-
DatePicker,
|
|
31226
|
+
DateTimePicker as DatePicker,
|
|
30994
31227
|
DateRange_default as DateRange,
|
|
30995
31228
|
Dropdown_default as Dropdown,
|
|
30996
31229
|
EmailInput_default as Email,
|