alope-ui 1.2.66 → 1.6.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/components/BottomNavbar/BottomNavbar.d.ts +1 -3
- package/dist/components/BottomNavbar/BottomNavbarAction.d.ts +1 -2
- package/dist/components/CodeInput/CodeInput.d.ts +9 -8
- package/dist/components/Collection/Collection.d.ts +10 -9
- package/dist/components/DatePicker/DatePicker.d.ts +42 -0
- package/dist/components/FAB/FAB.d.ts +12 -7
- package/dist/components/Masonry/Masonry.d.ts +6 -6
- package/dist/components/Skeleton/Skeleton.d.ts +4 -3
- package/dist/components/Slider/Slider.d.ts +17 -14
- package/dist/components/Timeline/Timeline.d.ts +13 -19
- package/dist/components/Tooltip/Tooltip.d.ts +15 -2
- package/dist/main.cjs +144 -120
- package/dist/main.d.ts +2 -3
- package/dist/main.js +804 -615
- package/package.json +1 -1
- /package/dist/components/FileUpload/{FIleUpload.d.ts → FileUpload.d.ts} +0 -0
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React, { useState, useEffect, isValidElement, cloneElement, useRef, Children, createContext, useContext, useId } from "react";
|
|
2
|
+
import React, { useState, useEffect, isValidElement, cloneElement, useRef, useLayoutEffect, Children, createContext, useContext, useId } from "react";
|
|
3
3
|
import { cn } from "clsx-for-tailwind";
|
|
4
4
|
import { Link } from "react-router-dom";
|
|
5
5
|
import Select from "react-select";
|
|
@@ -355,59 +355,53 @@ const BottomNavbarAction = ({
|
|
|
355
355
|
value,
|
|
356
356
|
selectedValue,
|
|
357
357
|
onChangeValue,
|
|
358
|
-
|
|
359
|
-
className
|
|
358
|
+
disabled = false
|
|
360
359
|
}) => {
|
|
361
360
|
const isActive = value === selectedValue;
|
|
362
361
|
return /* @__PURE__ */ jsxs(
|
|
363
362
|
"button",
|
|
364
363
|
{
|
|
365
|
-
|
|
364
|
+
type: "button",
|
|
365
|
+
disabled,
|
|
366
|
+
"aria-current": isActive ? "page" : void 0,
|
|
367
|
+
onClick: () => {
|
|
368
|
+
if (!disabled) onChangeValue?.(value);
|
|
369
|
+
},
|
|
366
370
|
className: cn(
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
className
|
|
371
|
+
"inline-flex flex-1 flex-col items-center justify-center gap-1 py-3 px-2 transition-colors select-none",
|
|
372
|
+
disabled ? "opacity-50 cursor-not-allowed text-gray-400 dark:text-neutral-600" : isActive ? "cursor-pointer bg-primary/10 dark:bg-primary/15 text-primary dark:text-primary-dark" : "cursor-pointer text-gray-500 hover:bg-gray-100 hover:text-gray-900 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-neutral-100"
|
|
370
373
|
),
|
|
371
374
|
children: [
|
|
372
|
-
icon,
|
|
373
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
374
|
-
`text-sm`,
|
|
375
|
-
isActive ? "text-primary" : "text-secondary-dark-700 dark:text-secondary-dark group-hover:text-secondary-700 dark:group-hover:text-white",
|
|
376
|
-
labelClassName
|
|
377
|
-
), children: label })
|
|
375
|
+
icon && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center justify-center", children: icon }),
|
|
376
|
+
label && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium leading-none", children: label })
|
|
378
377
|
]
|
|
379
378
|
}
|
|
380
379
|
);
|
|
381
380
|
};
|
|
382
381
|
const BottomNavbar = ({
|
|
383
382
|
children,
|
|
384
|
-
className,
|
|
385
383
|
value,
|
|
386
384
|
onChangeValue
|
|
387
385
|
}) => {
|
|
388
|
-
return /* @__PURE__ */ jsx(
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
386
|
+
return /* @__PURE__ */ jsx(
|
|
387
|
+
"nav",
|
|
388
|
+
{
|
|
389
|
+
"aria-label": "Bottom Navigation",
|
|
390
|
+
className: "fixed bottom-0 left-0 z-50 w-full bg-white border-t border-gray-200 dark:bg-neutral-900 dark:border-neutral-800",
|
|
391
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex items-stretch justify-center h-full max-w-lg mx-auto font-medium", children: React.Children.map(children, (child) => {
|
|
392
|
+
if (isValidElement(child) && child.type === BottomNavbarAction) {
|
|
393
|
+
return cloneElement(
|
|
394
|
+
child,
|
|
395
|
+
{
|
|
396
|
+
selectedValue: value,
|
|
397
|
+
onChangeValue
|
|
398
|
+
}
|
|
401
399
|
);
|
|
402
400
|
}
|
|
403
401
|
return null;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
if (process.env.NODE_ENV !== "production") {
|
|
407
|
-
console.warn(`[BottomNavbar] Invalid child: Only <BottomNavbarAction> components are allowed.`);
|
|
402
|
+
}) })
|
|
408
403
|
}
|
|
409
|
-
|
|
410
|
-
}) }) });
|
|
404
|
+
);
|
|
411
405
|
};
|
|
412
406
|
const colorStyles = {
|
|
413
407
|
primary: "text-primary dark:text-primary-dark-30",
|
|
@@ -880,118 +874,470 @@ const CodeInputSize = {
|
|
|
880
874
|
const CodeInput = ({
|
|
881
875
|
id,
|
|
882
876
|
label,
|
|
877
|
+
error,
|
|
883
878
|
length,
|
|
884
|
-
value,
|
|
879
|
+
value = "",
|
|
885
880
|
disabled,
|
|
886
|
-
labelClassName,
|
|
887
881
|
name,
|
|
888
882
|
onCodeChange,
|
|
889
883
|
inputSize = "md",
|
|
884
|
+
inputMode = "numeric",
|
|
890
885
|
...props
|
|
891
886
|
}) => {
|
|
892
887
|
const inputRefs = useRef([]);
|
|
893
888
|
const inputSizeClasses = CodeInputSize[inputSize];
|
|
894
|
-
const
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
};
|
|
902
|
-
const handleInputChange = (index) => {
|
|
903
|
-
const code = inputRefs.current.map((input) => input?.value || "").join("");
|
|
904
|
-
if (onCodeChange) {
|
|
905
|
-
onCodeChange(code);
|
|
906
|
-
}
|
|
907
|
-
if (inputRefs.current[index]?.value && index < length - 1) {
|
|
889
|
+
const handleInputChange = (index, newChar) => {
|
|
890
|
+
const sanitizedChar = newChar.slice(-1);
|
|
891
|
+
const chars = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
892
|
+
chars[index] = sanitizedChar;
|
|
893
|
+
const nextCode = chars.join("");
|
|
894
|
+
onCodeChange(nextCode);
|
|
895
|
+
if (sanitizedChar && index < length - 1) {
|
|
908
896
|
inputRefs.current[index + 1]?.focus();
|
|
909
897
|
}
|
|
910
898
|
};
|
|
911
899
|
const handleFocus = (index) => {
|
|
912
|
-
const firstEmptyIndex =
|
|
913
|
-
|
|
900
|
+
const firstEmptyIndex = Array.from({ length }, (_, i) => i).find(
|
|
901
|
+
(i) => !value[i]
|
|
902
|
+
);
|
|
903
|
+
if (firstEmptyIndex !== void 0 && firstEmptyIndex < index) {
|
|
914
904
|
inputRefs.current[firstEmptyIndex]?.focus();
|
|
915
905
|
}
|
|
916
906
|
};
|
|
917
907
|
const handleKeyDown = (e, index) => {
|
|
918
|
-
if (e.key === "Backspace"
|
|
908
|
+
if (e.key === "Backspace") {
|
|
909
|
+
if (value[index]) {
|
|
910
|
+
const chars = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
911
|
+
chars[index] = "";
|
|
912
|
+
onCodeChange(chars.join(""));
|
|
913
|
+
} else if (index > 0) {
|
|
914
|
+
inputRefs.current[index - 1]?.focus();
|
|
915
|
+
}
|
|
916
|
+
} else if (e.key === "ArrowLeft" && index > 0) {
|
|
917
|
+
e.preventDefault();
|
|
919
918
|
inputRefs.current[index - 1]?.focus();
|
|
919
|
+
} else if (e.key === "ArrowRight" && index < length - 1) {
|
|
920
|
+
e.preventDefault();
|
|
921
|
+
inputRefs.current[index + 1]?.focus();
|
|
920
922
|
}
|
|
921
923
|
};
|
|
922
924
|
const handlePaste = (e) => {
|
|
923
925
|
e.preventDefault();
|
|
924
|
-
|
|
925
|
-
pastedData.
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
926
|
+
if (disabled) return;
|
|
927
|
+
const pastedData = e.clipboardData.getData("text").trim().slice(0, length);
|
|
928
|
+
if (!pastedData) return;
|
|
929
|
+
const chars = Array.from({ length }, (_, i) => pastedData[i] ?? value[i] ?? "");
|
|
930
|
+
onCodeChange(chars.join(""));
|
|
931
|
+
const nextFocusIndex = Math.min(pastedData.length, length - 1);
|
|
932
|
+
inputRefs.current[nextFocusIndex]?.focus();
|
|
931
933
|
};
|
|
932
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
933
|
-
label && /* @__PURE__ */ jsx(
|
|
934
|
-
|
|
934
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
935
|
+
label && /* @__PURE__ */ jsx(
|
|
936
|
+
"label",
|
|
937
|
+
{
|
|
938
|
+
htmlFor: id || name ? `${id || name}-0` : void 0,
|
|
939
|
+
className: "block text-sm font-medium mb-1.5 text-gray-900 dark:text-neutral-100",
|
|
940
|
+
children: label
|
|
941
|
+
}
|
|
942
|
+
),
|
|
943
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", onPaste: handlePaste, children: Array.from({ length }, (_, index) => /* @__PURE__ */ jsx(
|
|
935
944
|
"input",
|
|
936
945
|
{
|
|
946
|
+
id: id || name ? `${id || name}-${index}` : void 0,
|
|
947
|
+
name: name ? `${name}[${index}]` : void 0,
|
|
937
948
|
ref: (el) => {
|
|
938
949
|
inputRefs.current[index] = el;
|
|
939
950
|
},
|
|
940
951
|
type: "text",
|
|
952
|
+
inputMode,
|
|
953
|
+
autoComplete: index === 0 ? "one-time-code" : "off",
|
|
954
|
+
"aria-label": `${label ?? "Code"} digit ${index + 1}`,
|
|
941
955
|
disabled,
|
|
942
|
-
value: value
|
|
956
|
+
value: value[index] ?? "",
|
|
943
957
|
maxLength: 1,
|
|
944
|
-
onChange: () => handleInputChange(index),
|
|
958
|
+
onChange: (e) => handleInputChange(index, e.target.value),
|
|
945
959
|
onKeyDown: (e) => handleKeyDown(e, index),
|
|
946
960
|
onFocus: () => handleFocus(index),
|
|
947
961
|
className: cn(
|
|
948
|
-
"text-center border rounded-md shadow-sm
|
|
962
|
+
"text-center font-semibold border rounded-md shadow-sm transition-colors",
|
|
963
|
+
"bg-white border-gray-200 text-gray-900 placeholder:text-gray-400",
|
|
964
|
+
"dark:bg-neutral-900 dark:border-neutral-800 dark:text-neutral-100 dark:placeholder:text-neutral-500",
|
|
965
|
+
"focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary dark:focus:ring-primary-dark dark:focus:border-primary-dark",
|
|
949
966
|
inputSizeClasses,
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
}
|
|
967
|
+
error && "border-error dark:border-error-dark focus:ring-error focus:border-error dark:focus:ring-error-dark dark:focus:border-error-dark",
|
|
968
|
+
disabled && "opacity-50 bg-gray-100 dark:bg-neutral-800 cursor-not-allowed"
|
|
953
969
|
),
|
|
954
970
|
...props
|
|
955
971
|
},
|
|
956
972
|
index
|
|
957
|
-
)) })
|
|
973
|
+
)) }),
|
|
974
|
+
error && /* @__PURE__ */ jsx("p", { className: "mt-1.5 text-sm text-error dark:text-error-dark", children: error })
|
|
958
975
|
] });
|
|
959
976
|
};
|
|
960
977
|
function Collection({
|
|
961
978
|
data,
|
|
962
979
|
title,
|
|
963
|
-
className,
|
|
964
|
-
wrapperClassName,
|
|
965
980
|
children,
|
|
966
981
|
suffixIcon,
|
|
967
982
|
activeItem,
|
|
968
|
-
onChangeActive
|
|
983
|
+
onChangeActive,
|
|
984
|
+
emptyMessage = "No items to display."
|
|
969
985
|
}) {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
986
|
+
const isInteractive = Boolean(onChangeActive);
|
|
987
|
+
const handleKeyDown = (e, item, index) => {
|
|
988
|
+
if (!onChangeActive) return;
|
|
989
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
990
|
+
e.preventDefault();
|
|
991
|
+
onChangeActive(item, index);
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full p-4 rounded-lg border border-gray-200 bg-white text-gray-900 dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-100", children: [
|
|
995
|
+
title && /* @__PURE__ */ jsx("h2", { className: "text-base font-semibold mb-3 text-gray-900 dark:text-neutral-100", children: title }),
|
|
996
|
+
data.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "space-y-2.5", children: data.map((item, index) => {
|
|
997
|
+
const isActive = activeItem !== void 0 && item.id === activeItem;
|
|
998
|
+
return /* @__PURE__ */ jsx("li", { children: children ? /* @__PURE__ */ jsx(
|
|
999
|
+
"div",
|
|
1000
|
+
{
|
|
1001
|
+
role: isInteractive ? "button" : void 0,
|
|
1002
|
+
tabIndex: isInteractive ? 0 : void 0,
|
|
1003
|
+
"aria-pressed": isInteractive ? isActive : void 0,
|
|
1004
|
+
onClick: () => onChangeActive?.(item, index),
|
|
1005
|
+
onKeyDown: (e) => handleKeyDown(e, item, index),
|
|
1006
|
+
className: cn(isInteractive && "cursor-pointer"),
|
|
1007
|
+
children: children(item, index, isActive)
|
|
1008
|
+
}
|
|
1009
|
+
) : /* @__PURE__ */ jsxs(
|
|
975
1010
|
"div",
|
|
976
1011
|
{
|
|
1012
|
+
role: isInteractive ? "button" : void 0,
|
|
1013
|
+
tabIndex: isInteractive ? 0 : void 0,
|
|
1014
|
+
"aria-pressed": isInteractive ? isActive : void 0,
|
|
977
1015
|
onClick: () => onChangeActive?.(item, index),
|
|
1016
|
+
onKeyDown: (e) => handleKeyDown(e, item, index),
|
|
978
1017
|
className: cn(
|
|
979
|
-
"
|
|
980
|
-
|
|
1018
|
+
"px-3.5 py-3 border rounded-lg flex gap-3 items-center justify-between transition-colors select-none",
|
|
1019
|
+
isInteractive && "cursor-pointer",
|
|
1020
|
+
isActive ? "border-primary bg-primary/10 text-primary dark:border-primary-dark dark:bg-primary/15 dark:text-neutral-100" : cn(
|
|
1021
|
+
"border-gray-200 bg-white text-gray-800 dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-200",
|
|
1022
|
+
isInteractive && "hover:bg-gray-50 dark:hover:bg-neutral-800/70"
|
|
1023
|
+
)
|
|
981
1024
|
),
|
|
982
1025
|
children: [
|
|
983
|
-
/* @__PURE__ */ jsx("
|
|
984
|
-
suffixIcon && /* @__PURE__ */ jsx(
|
|
1026
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: item.name ?? `Item ${item.id}` }),
|
|
1027
|
+
suffixIcon && /* @__PURE__ */ jsx(
|
|
1028
|
+
"span",
|
|
1029
|
+
{
|
|
1030
|
+
className: cn(
|
|
1031
|
+
"shrink-0 inline-flex items-center",
|
|
1032
|
+
isActive ? "text-primary dark:text-primary-dark" : "text-gray-400 dark:text-neutral-500"
|
|
1033
|
+
),
|
|
1034
|
+
children: typeof suffixIcon === "function" ? suffixIcon(item, index, isActive) : suffixIcon
|
|
1035
|
+
}
|
|
1036
|
+
)
|
|
985
1037
|
]
|
|
986
1038
|
}
|
|
987
1039
|
) }, item.id);
|
|
988
|
-
}) }) : /* @__PURE__ */ jsx("
|
|
1040
|
+
}) }) : /* @__PURE__ */ jsx("div", { className: "py-6 text-center text-sm text-gray-500 dark:text-neutral-400", children: emptyMessage })
|
|
989
1041
|
] });
|
|
990
1042
|
}
|
|
1043
|
+
const TextInput = React.forwardRef(
|
|
1044
|
+
({
|
|
1045
|
+
label,
|
|
1046
|
+
id,
|
|
1047
|
+
name,
|
|
1048
|
+
error,
|
|
1049
|
+
...props
|
|
1050
|
+
}, ref) => {
|
|
1051
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
1052
|
+
label && /* @__PURE__ */ jsx(
|
|
1053
|
+
"label",
|
|
1054
|
+
{
|
|
1055
|
+
htmlFor: id || name,
|
|
1056
|
+
className: "block text-sm font-medium mb-1 text-gray-900 dark:text-neutral-100",
|
|
1057
|
+
children: label
|
|
1058
|
+
}
|
|
1059
|
+
),
|
|
1060
|
+
/* @__PURE__ */ jsx(
|
|
1061
|
+
"input",
|
|
1062
|
+
{
|
|
1063
|
+
ref,
|
|
1064
|
+
id: id || name,
|
|
1065
|
+
name,
|
|
1066
|
+
className: cn(
|
|
1067
|
+
"block w-full px-3 py-2 border rounded-md shadow-sm sm:text-sm transition-colors",
|
|
1068
|
+
"bg-white border-gray-200 text-gray-900 placeholder:text-gray-400",
|
|
1069
|
+
"dark:bg-neutral-900 dark:border-neutral-800 dark:text-neutral-100 dark:placeholder:text-neutral-500",
|
|
1070
|
+
"focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary dark:focus:ring-primary-dark dark:focus:border-primary-dark",
|
|
1071
|
+
error && "border-error dark:border-error-dark focus:ring-error focus:border-error dark:focus:ring-error-dark dark:focus:border-error-dark",
|
|
1072
|
+
props.disabled && "opacity-50 bg-gray-100 dark:bg-neutral-800 cursor-not-allowed"
|
|
1073
|
+
),
|
|
1074
|
+
...props
|
|
1075
|
+
}
|
|
1076
|
+
),
|
|
1077
|
+
error && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-error dark:text-error-dark", children: error })
|
|
1078
|
+
] });
|
|
1079
|
+
}
|
|
1080
|
+
);
|
|
1081
|
+
TextInput.displayName = "TextInput";
|
|
1082
|
+
const DatePickerColors = {
|
|
1083
|
+
primary: {
|
|
1084
|
+
header: "bg-primary dark:bg-primary-dark",
|
|
1085
|
+
icon: "hover:bg-primary-700 dark:hover:bg-primary-dark-700",
|
|
1086
|
+
day: "bg-primary dark:bg-primary-dark text-white",
|
|
1087
|
+
today: "ring-1 ring-primary dark:ring-primary-dark"
|
|
1088
|
+
},
|
|
1089
|
+
success: {
|
|
1090
|
+
header: "bg-success dark:bg-success-dark",
|
|
1091
|
+
icon: "hover:bg-success-700 dark:hover:bg-success-dark-700",
|
|
1092
|
+
day: "bg-success dark:bg-success-dark text-white",
|
|
1093
|
+
today: "ring-1 ring-success dark:ring-success-dark"
|
|
1094
|
+
},
|
|
1095
|
+
info: {
|
|
1096
|
+
header: "bg-info dark:bg-info-dark",
|
|
1097
|
+
icon: "hover:bg-info-700 dark:hover:bg-info-dark-700",
|
|
1098
|
+
day: "bg-info dark:bg-info-dark text-white",
|
|
1099
|
+
today: "ring-1 ring-info dark:ring-info-dark"
|
|
1100
|
+
},
|
|
1101
|
+
error: {
|
|
1102
|
+
header: "bg-error dark:bg-error-dark",
|
|
1103
|
+
icon: "hover:bg-error-700 dark:hover:bg-error-dark-700",
|
|
1104
|
+
day: "bg-error dark:bg-error-dark text-white",
|
|
1105
|
+
today: "ring-1 ring-error dark:ring-error-dark"
|
|
1106
|
+
},
|
|
1107
|
+
warning: {
|
|
1108
|
+
header: "bg-warning dark:bg-warning-dark",
|
|
1109
|
+
icon: "hover:bg-warning-700 dark:hover:bg-warning-dark-700",
|
|
1110
|
+
day: "bg-warning dark:bg-warning-dark text-white",
|
|
1111
|
+
today: "ring-1 ring-warning dark:ring-warning-dark"
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
const DatePicker = ({
|
|
1115
|
+
label,
|
|
1116
|
+
error,
|
|
1117
|
+
id,
|
|
1118
|
+
name,
|
|
1119
|
+
color = "primary",
|
|
1120
|
+
selectedDate: initialSelectedDate,
|
|
1121
|
+
onDateChange,
|
|
1122
|
+
placeholder = "Select a date",
|
|
1123
|
+
disabled,
|
|
1124
|
+
...props
|
|
1125
|
+
}) => {
|
|
1126
|
+
const [selectedDate, setSelectedDate] = useState(
|
|
1127
|
+
initialSelectedDate ?? null
|
|
1128
|
+
);
|
|
1129
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
1130
|
+
const [currentMonth, setCurrentMonth] = useState(
|
|
1131
|
+
selectedDate ? selectedDate.getMonth() : (/* @__PURE__ */ new Date()).getMonth()
|
|
1132
|
+
);
|
|
1133
|
+
const [currentYear, setCurrentYear] = useState(
|
|
1134
|
+
selectedDate ? selectedDate.getFullYear() : (/* @__PURE__ */ new Date()).getFullYear()
|
|
1135
|
+
);
|
|
1136
|
+
const [calendarPosition, setCalendarPosition] = useState("bottom");
|
|
1137
|
+
const datePickerRef = useRef(null);
|
|
1138
|
+
const inputRef = useRef(null);
|
|
1139
|
+
const colorClasses = DatePickerColors[color];
|
|
1140
|
+
useLayoutEffect(() => {
|
|
1141
|
+
if (isOpen && inputRef.current) {
|
|
1142
|
+
const inputRect = inputRef.current.getBoundingClientRect();
|
|
1143
|
+
const spaceBelow = window.innerHeight - inputRect.bottom;
|
|
1144
|
+
const calendarHeight = 320;
|
|
1145
|
+
setCalendarPosition(spaceBelow < calendarHeight ? "top" : "bottom");
|
|
1146
|
+
}
|
|
1147
|
+
}, [isOpen]);
|
|
1148
|
+
useEffect(() => {
|
|
1149
|
+
if (initialSelectedDate !== void 0) {
|
|
1150
|
+
setSelectedDate(initialSelectedDate);
|
|
1151
|
+
if (initialSelectedDate) {
|
|
1152
|
+
setCurrentMonth(initialSelectedDate.getMonth());
|
|
1153
|
+
setCurrentYear(initialSelectedDate.getFullYear());
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
}, [initialSelectedDate]);
|
|
1157
|
+
useEffect(() => {
|
|
1158
|
+
if (!isOpen) return;
|
|
1159
|
+
const handleClickOutside = (event) => {
|
|
1160
|
+
if (datePickerRef.current && !datePickerRef.current.contains(event.target)) {
|
|
1161
|
+
setIsOpen(false);
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
const handleEsc = (event) => {
|
|
1165
|
+
if (event.key === "Escape") {
|
|
1166
|
+
setIsOpen(false);
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1170
|
+
document.addEventListener("keydown", handleEsc);
|
|
1171
|
+
return () => {
|
|
1172
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
1173
|
+
document.removeEventListener("keydown", handleEsc);
|
|
1174
|
+
};
|
|
1175
|
+
}, [isOpen]);
|
|
1176
|
+
const handleDateChange = (date) => {
|
|
1177
|
+
setSelectedDate(date);
|
|
1178
|
+
onDateChange?.(date);
|
|
1179
|
+
setIsOpen(false);
|
|
1180
|
+
};
|
|
1181
|
+
const daysInMonth = (month, year) => {
|
|
1182
|
+
return new Date(year, month + 1, 0).getDate();
|
|
1183
|
+
};
|
|
1184
|
+
const firstDayOfMonth = (month, year) => {
|
|
1185
|
+
return new Date(year, month, 1).getDay();
|
|
1186
|
+
};
|
|
1187
|
+
const handlePrevMonth = () => {
|
|
1188
|
+
if (currentMonth === 0) {
|
|
1189
|
+
setCurrentMonth(11);
|
|
1190
|
+
setCurrentYear((prev) => prev - 1);
|
|
1191
|
+
} else {
|
|
1192
|
+
setCurrentMonth((prev) => prev - 1);
|
|
1193
|
+
}
|
|
1194
|
+
};
|
|
1195
|
+
const handleNextMonth = () => {
|
|
1196
|
+
if (currentMonth === 11) {
|
|
1197
|
+
setCurrentMonth(0);
|
|
1198
|
+
setCurrentYear((prev) => prev + 1);
|
|
1199
|
+
} else {
|
|
1200
|
+
setCurrentMonth((prev) => prev + 1);
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1203
|
+
const renderCalendar = () => {
|
|
1204
|
+
const days = [];
|
|
1205
|
+
const safeYear = Number.isFinite(currentYear) && currentYear > 0 ? currentYear : (/* @__PURE__ */ new Date()).getFullYear();
|
|
1206
|
+
const totalDays = daysInMonth(currentMonth, safeYear);
|
|
1207
|
+
const firstDay = firstDayOfMonth(currentMonth, safeYear);
|
|
1208
|
+
const today = /* @__PURE__ */ new Date();
|
|
1209
|
+
for (let i = 0; i < firstDay; i++) {
|
|
1210
|
+
days.push(/* @__PURE__ */ jsx("div", { className: "h-9" }, `empty-${i}`));
|
|
1211
|
+
}
|
|
1212
|
+
for (let i = 1; i <= totalDays; i++) {
|
|
1213
|
+
const date = new Date(safeYear, currentMonth, i);
|
|
1214
|
+
const isSelected = selectedDate !== null && date.getDate() === selectedDate.getDate() && date.getMonth() === selectedDate.getMonth() && date.getFullYear() === selectedDate.getFullYear();
|
|
1215
|
+
const isToday = date.getDate() === today.getDate() && date.getMonth() === today.getMonth() && date.getFullYear() === today.getFullYear();
|
|
1216
|
+
days.push(
|
|
1217
|
+
/* @__PURE__ */ jsx(
|
|
1218
|
+
"button",
|
|
1219
|
+
{
|
|
1220
|
+
type: "button",
|
|
1221
|
+
onClick: () => handleDateChange(date),
|
|
1222
|
+
className: cn(
|
|
1223
|
+
"h-9 w-full flex items-center justify-center rounded-md text-sm font-medium transition-colors cursor-pointer select-none",
|
|
1224
|
+
isSelected ? colorClasses.day : cn(
|
|
1225
|
+
"text-gray-700 dark:text-neutral-300 hover:bg-gray-100 dark:hover:bg-neutral-800",
|
|
1226
|
+
isToday && colorClasses.today
|
|
1227
|
+
)
|
|
1228
|
+
),
|
|
1229
|
+
children: i
|
|
1230
|
+
},
|
|
1231
|
+
i
|
|
1232
|
+
)
|
|
1233
|
+
);
|
|
1234
|
+
}
|
|
1235
|
+
return /* @__PURE__ */ jsxs("div", { className: "p-3", children: [
|
|
1236
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1 mb-1", children: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"].map((day) => /* @__PURE__ */ jsx(
|
|
1237
|
+
"div",
|
|
1238
|
+
{
|
|
1239
|
+
className: "h-8 flex items-center justify-center text-xs font-semibold text-gray-500 dark:text-neutral-400 select-none",
|
|
1240
|
+
children: day
|
|
1241
|
+
},
|
|
1242
|
+
day
|
|
1243
|
+
)) }),
|
|
1244
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1", children: days })
|
|
1245
|
+
] });
|
|
1246
|
+
};
|
|
1247
|
+
const displayMonthYear = Number.isFinite(currentYear) && currentYear > 0 ? currentYear : (/* @__PURE__ */ new Date()).getFullYear();
|
|
1248
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative w-full", ref: datePickerRef, children: [
|
|
1249
|
+
/* @__PURE__ */ jsx(
|
|
1250
|
+
TextInput,
|
|
1251
|
+
{
|
|
1252
|
+
...props,
|
|
1253
|
+
id,
|
|
1254
|
+
name,
|
|
1255
|
+
label,
|
|
1256
|
+
error,
|
|
1257
|
+
type: "text",
|
|
1258
|
+
readOnly: true,
|
|
1259
|
+
disabled,
|
|
1260
|
+
ref: inputRef,
|
|
1261
|
+
value: selectedDate ? selectedDate.toLocaleDateString() : "",
|
|
1262
|
+
onClick: () => {
|
|
1263
|
+
if (!disabled) setIsOpen((prev) => !prev);
|
|
1264
|
+
},
|
|
1265
|
+
placeholder
|
|
1266
|
+
}
|
|
1267
|
+
),
|
|
1268
|
+
isOpen && !disabled && /* @__PURE__ */ jsxs(
|
|
1269
|
+
"div",
|
|
1270
|
+
{
|
|
1271
|
+
className: cn(
|
|
1272
|
+
"absolute z-30 w-full min-w-[280px] max-w-xs overflow-hidden rounded-xl border border-gray-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 shadow-xl",
|
|
1273
|
+
calendarPosition === "top" ? "bottom-full mb-2" : "top-full mt-2"
|
|
1274
|
+
),
|
|
1275
|
+
children: [
|
|
1276
|
+
/* @__PURE__ */ jsxs(
|
|
1277
|
+
"div",
|
|
1278
|
+
{
|
|
1279
|
+
className: cn(
|
|
1280
|
+
"flex items-center justify-between gap-2 px-3 py-2.5 text-white",
|
|
1281
|
+
colorClasses.header
|
|
1282
|
+
),
|
|
1283
|
+
children: [
|
|
1284
|
+
/* @__PURE__ */ jsx(
|
|
1285
|
+
"button",
|
|
1286
|
+
{
|
|
1287
|
+
type: "button",
|
|
1288
|
+
"aria-label": "Previous month",
|
|
1289
|
+
onClick: handlePrevMonth,
|
|
1290
|
+
className: cn(
|
|
1291
|
+
"p-1.5 rounded-lg transition-colors cursor-pointer",
|
|
1292
|
+
colorClasses.icon
|
|
1293
|
+
),
|
|
1294
|
+
children: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M15 19l-7-7 7-7", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
1295
|
+
}
|
|
1296
|
+
),
|
|
1297
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
1298
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold select-none", children: new Date(displayMonthYear, currentMonth).toLocaleString("default", {
|
|
1299
|
+
month: "long"
|
|
1300
|
+
}) }),
|
|
1301
|
+
/* @__PURE__ */ jsx(
|
|
1302
|
+
"input",
|
|
1303
|
+
{
|
|
1304
|
+
type: "number",
|
|
1305
|
+
"aria-label": "Year",
|
|
1306
|
+
value: currentYear || "",
|
|
1307
|
+
onChange: (e) => {
|
|
1308
|
+
const val = parseInt(e.target.value, 10);
|
|
1309
|
+
setCurrentYear(Number.isNaN(val) ? 0 : val);
|
|
1310
|
+
},
|
|
1311
|
+
className: "w-16 px-1.5 py-0.5 text-sm font-semibold text-center rounded bg-black/15 text-white border border-white/25 focus:outline-none focus:border-white"
|
|
1312
|
+
}
|
|
1313
|
+
)
|
|
1314
|
+
] }),
|
|
1315
|
+
/* @__PURE__ */ jsx(
|
|
1316
|
+
"button",
|
|
1317
|
+
{
|
|
1318
|
+
type: "button",
|
|
1319
|
+
"aria-label": "Next month",
|
|
1320
|
+
onClick: handleNextMonth,
|
|
1321
|
+
className: cn(
|
|
1322
|
+
"p-1.5 rounded-lg transition-colors cursor-pointer",
|
|
1323
|
+
colorClasses.icon
|
|
1324
|
+
),
|
|
1325
|
+
children: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M9 5l7 7-7 7", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
1326
|
+
}
|
|
1327
|
+
)
|
|
1328
|
+
]
|
|
1329
|
+
}
|
|
1330
|
+
),
|
|
1331
|
+
renderCalendar()
|
|
1332
|
+
]
|
|
1333
|
+
}
|
|
1334
|
+
)
|
|
1335
|
+
] });
|
|
1336
|
+
};
|
|
991
1337
|
const FABSizes = {
|
|
992
|
-
sm: "w-11 h-11 font-medium rounded-
|
|
993
|
-
md: "w-14 h-14 font-semibold tracking-[.2px] rounded-
|
|
994
|
-
lg: "w-
|
|
1338
|
+
sm: "w-11 h-11 text-sm font-medium rounded-full",
|
|
1339
|
+
md: "w-14 h-14 text-base font-semibold tracking-[.2px] rounded-full",
|
|
1340
|
+
lg: "w-16 h-16 text-lg font-semibold rounded-full"
|
|
995
1341
|
};
|
|
996
1342
|
const FAB = ({
|
|
997
1343
|
children,
|
|
@@ -1001,64 +1347,114 @@ const FAB = ({
|
|
|
1001
1347
|
variantType = "primary",
|
|
1002
1348
|
isOpen,
|
|
1003
1349
|
onOpen,
|
|
1004
|
-
icon
|
|
1350
|
+
icon,
|
|
1351
|
+
disabled = false,
|
|
1352
|
+
ariaLabel = "Toggle floating actions"
|
|
1005
1353
|
}) => {
|
|
1006
1354
|
const [shouldRender, setShouldRender] = useState(isOpen);
|
|
1007
1355
|
const [isAnimatingOut, setIsAnimatingOut] = useState(false);
|
|
1356
|
+
const validChildren = Children.toArray(children).filter(isValidElement);
|
|
1008
1357
|
useEffect(() => {
|
|
1009
1358
|
if (isOpen) {
|
|
1010
1359
|
setShouldRender(true);
|
|
1011
1360
|
setIsAnimatingOut(false);
|
|
1012
1361
|
} else if (shouldRender) {
|
|
1013
1362
|
setIsAnimatingOut(true);
|
|
1363
|
+
const totalDuration = 300 + Math.max(0, validChildren.length - 1) * 100;
|
|
1014
1364
|
const timeout = setTimeout(() => {
|
|
1015
1365
|
setShouldRender(false);
|
|
1016
1366
|
setIsAnimatingOut(false);
|
|
1017
|
-
},
|
|
1367
|
+
}, totalDuration);
|
|
1018
1368
|
return () => clearTimeout(timeout);
|
|
1019
1369
|
}
|
|
1020
|
-
}, [isOpen, shouldRender]);
|
|
1021
|
-
const directionClasses = {
|
|
1022
|
-
vertical: "flex-col-reverse space-y-2 space-y-reverse mb-2",
|
|
1023
|
-
horizontal: "flex-row-reverse space-x-2 space-x-reverse mr-2"
|
|
1024
|
-
};
|
|
1370
|
+
}, [isOpen, shouldRender, validChildren.length]);
|
|
1025
1371
|
const sizeClasses2 = FABSizes[size];
|
|
1026
1372
|
const variantClasses = getVariantClasses(variant, variantType);
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1373
|
+
const isDefaultIcon = icon === void 0;
|
|
1374
|
+
const animatedChildren = validChildren.map((child, index, arr) => {
|
|
1029
1375
|
const reverseIndex = arr.length - 1 - index;
|
|
1030
1376
|
return /* @__PURE__ */ jsx(
|
|
1031
1377
|
"div",
|
|
1032
1378
|
{
|
|
1033
|
-
style: {
|
|
1379
|
+
style: {
|
|
1380
|
+
animationDelay: `${isAnimatingOut ? reverseIndex * 100 : index * 100}ms`,
|
|
1381
|
+
animationFillMode: "forwards"
|
|
1382
|
+
},
|
|
1034
1383
|
className: cn(
|
|
1035
1384
|
!isAnimatingOut && "opacity-0",
|
|
1036
1385
|
isAnimatingOut ? "animate-pop-out" : "animate-pop"
|
|
1037
1386
|
),
|
|
1038
1387
|
children: child
|
|
1039
1388
|
},
|
|
1040
|
-
index
|
|
1389
|
+
child.key ?? index
|
|
1041
1390
|
);
|
|
1042
1391
|
});
|
|
1043
|
-
return /* @__PURE__ */
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
"span",
|
|
1392
|
+
return /* @__PURE__ */ jsxs(
|
|
1393
|
+
"div",
|
|
1394
|
+
{
|
|
1395
|
+
className: cn(
|
|
1396
|
+
"fixed bottom-8 right-8 z-50 flex gap-3",
|
|
1397
|
+
direction === "vertical" ? "flex-col items-end" : "flex-row items-center"
|
|
1398
|
+
),
|
|
1399
|
+
children: [
|
|
1400
|
+
shouldRender && /* @__PURE__ */ jsx(
|
|
1401
|
+
"div",
|
|
1054
1402
|
{
|
|
1055
|
-
|
|
1056
|
-
|
|
1403
|
+
role: "menu",
|
|
1404
|
+
className: cn(
|
|
1405
|
+
"flex items-center gap-2.5",
|
|
1406
|
+
direction === "vertical" ? "flex-col-reverse" : "flex-row-reverse"
|
|
1407
|
+
),
|
|
1408
|
+
children: animatedChildren
|
|
1409
|
+
}
|
|
1410
|
+
),
|
|
1411
|
+
/* @__PURE__ */ jsx(
|
|
1412
|
+
"button",
|
|
1413
|
+
{
|
|
1414
|
+
type: "button",
|
|
1415
|
+
onClick: onOpen,
|
|
1416
|
+
disabled,
|
|
1417
|
+
"aria-label": ariaLabel,
|
|
1418
|
+
"aria-expanded": isOpen,
|
|
1419
|
+
"aria-haspopup": "menu",
|
|
1420
|
+
className: cn(
|
|
1421
|
+
"shrink-0 shadow-lg flex items-center justify-center transition-all duration-200 select-none",
|
|
1422
|
+
disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer active:scale-95",
|
|
1423
|
+
sizeClasses2,
|
|
1424
|
+
variantClasses
|
|
1425
|
+
),
|
|
1426
|
+
children: /* @__PURE__ */ jsx(
|
|
1427
|
+
"span",
|
|
1428
|
+
{
|
|
1429
|
+
className: cn(
|
|
1430
|
+
"inline-flex items-center justify-center transition-transform duration-300",
|
|
1431
|
+
isDefaultIcon && (isOpen ? "rotate-45" : "rotate-0")
|
|
1432
|
+
),
|
|
1433
|
+
children: isDefaultIcon ? /* @__PURE__ */ jsx(
|
|
1434
|
+
"svg",
|
|
1435
|
+
{
|
|
1436
|
+
className: "w-6 h-6",
|
|
1437
|
+
viewBox: "0 0 24 24",
|
|
1438
|
+
fill: "none",
|
|
1439
|
+
stroke: "currentColor",
|
|
1440
|
+
children: /* @__PURE__ */ jsx(
|
|
1441
|
+
"path",
|
|
1442
|
+
{
|
|
1443
|
+
d: "M12 5v14M5 12h14",
|
|
1444
|
+
strokeWidth: "2.2",
|
|
1445
|
+
strokeLinecap: "round",
|
|
1446
|
+
strokeLinejoin: "round"
|
|
1447
|
+
}
|
|
1448
|
+
)
|
|
1449
|
+
}
|
|
1450
|
+
) : icon
|
|
1451
|
+
}
|
|
1452
|
+
)
|
|
1057
1453
|
}
|
|
1058
1454
|
)
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1455
|
+
]
|
|
1456
|
+
}
|
|
1457
|
+
);
|
|
1062
1458
|
};
|
|
1063
1459
|
const FileUpload = ({
|
|
1064
1460
|
acceptedFiles = "image/*",
|
|
@@ -1234,292 +1630,6 @@ const FileUpload = ({
|
|
|
1234
1630
|
errorMessage ? /* @__PURE__ */ jsx("p", { className: "text-error text-sm mt-2", children: errorMessage }) : helperText && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 dark:text-secondary-dark mt-2", children: helperText })
|
|
1235
1631
|
] });
|
|
1236
1632
|
};
|
|
1237
|
-
const responsiveColsClass$1 = {
|
|
1238
|
-
base: {
|
|
1239
|
-
1: "grid-cols-1",
|
|
1240
|
-
2: "grid-cols-2",
|
|
1241
|
-
3: "grid-cols-3",
|
|
1242
|
-
4: "grid-cols-4",
|
|
1243
|
-
5: "grid-cols-5",
|
|
1244
|
-
6: "grid-cols-6",
|
|
1245
|
-
7: "grid-cols-7",
|
|
1246
|
-
8: "grid-cols-8",
|
|
1247
|
-
9: "grid-cols-9",
|
|
1248
|
-
10: "grid-cols-10",
|
|
1249
|
-
11: "grid-cols-11",
|
|
1250
|
-
12: "grid-cols-12"
|
|
1251
|
-
},
|
|
1252
|
-
sm: {
|
|
1253
|
-
1: "sm:grid-cols-1",
|
|
1254
|
-
2: "sm:grid-cols-2",
|
|
1255
|
-
3: "sm:grid-cols-3",
|
|
1256
|
-
4: "sm:grid-cols-4",
|
|
1257
|
-
5: "sm:grid-cols-5",
|
|
1258
|
-
6: "sm:grid-cols-6",
|
|
1259
|
-
7: "sm:grid-cols-7",
|
|
1260
|
-
8: "sm:grid-cols-8",
|
|
1261
|
-
9: "sm:grid-cols-9",
|
|
1262
|
-
10: "sm:grid-cols-10",
|
|
1263
|
-
11: "sm:grid-cols-11",
|
|
1264
|
-
12: "sm:grid-cols-12"
|
|
1265
|
-
},
|
|
1266
|
-
md: {
|
|
1267
|
-
1: "md:grid-cols-1",
|
|
1268
|
-
2: "md:grid-cols-2",
|
|
1269
|
-
3: "md:grid-cols-3",
|
|
1270
|
-
4: "md:grid-cols-4",
|
|
1271
|
-
5: "md:grid-cols-5",
|
|
1272
|
-
6: "md:grid-cols-6",
|
|
1273
|
-
7: "md:grid-cols-7",
|
|
1274
|
-
8: "md:grid-cols-8",
|
|
1275
|
-
9: "md:grid-cols-9",
|
|
1276
|
-
10: "md:grid-cols-10",
|
|
1277
|
-
11: "md:grid-cols-11",
|
|
1278
|
-
12: "md:grid-cols-12"
|
|
1279
|
-
},
|
|
1280
|
-
lg: {
|
|
1281
|
-
1: "lg:grid-cols-1",
|
|
1282
|
-
2: "lg:grid-cols-2",
|
|
1283
|
-
3: "lg:grid-cols-3",
|
|
1284
|
-
4: "lg:grid-cols-4",
|
|
1285
|
-
5: "lg:grid-cols-5",
|
|
1286
|
-
6: "lg:grid-cols-6",
|
|
1287
|
-
7: "lg:grid-cols-7",
|
|
1288
|
-
8: "lg:grid-cols-8",
|
|
1289
|
-
9: "lg:grid-cols-9",
|
|
1290
|
-
10: "lg:grid-cols-10",
|
|
1291
|
-
11: "lg:grid-cols-11",
|
|
1292
|
-
12: "lg:grid-cols-12"
|
|
1293
|
-
},
|
|
1294
|
-
xl: {
|
|
1295
|
-
1: "xl:grid-cols-1",
|
|
1296
|
-
2: "xl:grid-cols-2",
|
|
1297
|
-
3: "xl:grid-cols-3",
|
|
1298
|
-
4: "xl:grid-cols-4",
|
|
1299
|
-
5: "xl:grid-cols-5",
|
|
1300
|
-
6: "xl:grid-cols-6",
|
|
1301
|
-
7: "xl:grid-cols-7",
|
|
1302
|
-
8: "xl:grid-cols-8",
|
|
1303
|
-
9: "xl:grid-cols-9",
|
|
1304
|
-
10: "xl:grid-cols-10",
|
|
1305
|
-
11: "xl:grid-cols-11",
|
|
1306
|
-
12: "xl:grid-cols-12"
|
|
1307
|
-
},
|
|
1308
|
-
"2xl": {
|
|
1309
|
-
1: "2xl:grid-cols-1",
|
|
1310
|
-
2: "2xl:grid-cols-2",
|
|
1311
|
-
3: "2xl:grid-cols-3",
|
|
1312
|
-
4: "2xl:grid-cols-4",
|
|
1313
|
-
5: "2xl:grid-cols-5",
|
|
1314
|
-
6: "2xl:grid-cols-6",
|
|
1315
|
-
7: "2xl:grid-cols-7",
|
|
1316
|
-
8: "2xl:grid-cols-8",
|
|
1317
|
-
9: "2xl:grid-cols-9",
|
|
1318
|
-
10: "2xl:grid-cols-10",
|
|
1319
|
-
11: "2xl:grid-cols-11",
|
|
1320
|
-
12: "2xl:grid-cols-12"
|
|
1321
|
-
}
|
|
1322
|
-
};
|
|
1323
|
-
const responsiveGapClass$1 = {
|
|
1324
|
-
base: {
|
|
1325
|
-
1: "gap-1",
|
|
1326
|
-
2: "gap-2",
|
|
1327
|
-
3: "gap-3",
|
|
1328
|
-
4: "gap-4",
|
|
1329
|
-
5: "gap-5",
|
|
1330
|
-
6: "gap-6"
|
|
1331
|
-
},
|
|
1332
|
-
sm: {
|
|
1333
|
-
1: "sm:gap-1",
|
|
1334
|
-
2: "sm:gap-2",
|
|
1335
|
-
3: "sm:gap-3",
|
|
1336
|
-
4: "sm:gap-4",
|
|
1337
|
-
5: "sm:gap-5",
|
|
1338
|
-
6: "sm:gap-6"
|
|
1339
|
-
},
|
|
1340
|
-
md: {
|
|
1341
|
-
1: "md:gap-1",
|
|
1342
|
-
2: "md:gap-2",
|
|
1343
|
-
3: "md:gap-3",
|
|
1344
|
-
4: "md:gap-4",
|
|
1345
|
-
5: "md:gap-5",
|
|
1346
|
-
6: "md:gap-6"
|
|
1347
|
-
},
|
|
1348
|
-
lg: {
|
|
1349
|
-
1: "lg:gap-1",
|
|
1350
|
-
2: "lg:gap-2",
|
|
1351
|
-
3: "lg:gap-3",
|
|
1352
|
-
4: "lg:gap-4",
|
|
1353
|
-
5: "lg:gap-5",
|
|
1354
|
-
6: "lg:gap-6"
|
|
1355
|
-
},
|
|
1356
|
-
xl: {
|
|
1357
|
-
1: "xl:gap-1",
|
|
1358
|
-
2: "xl:gap-2",
|
|
1359
|
-
3: "xl:gap-3",
|
|
1360
|
-
4: "xl:gap-4",
|
|
1361
|
-
5: "xl:gap-5",
|
|
1362
|
-
6: "xl:gap-6"
|
|
1363
|
-
},
|
|
1364
|
-
"2xl": {
|
|
1365
|
-
1: "2xl:gap-1",
|
|
1366
|
-
2: "2xl:gap-2",
|
|
1367
|
-
3: "2xl:gap-3",
|
|
1368
|
-
4: "2xl:gap-4",
|
|
1369
|
-
5: "2xl:gap-5",
|
|
1370
|
-
6: "2xl:gap-6"
|
|
1371
|
-
}
|
|
1372
|
-
};
|
|
1373
|
-
function normalizeResponsiveProp$2(value) {
|
|
1374
|
-
if (typeof value === "number") {
|
|
1375
|
-
return { base: value };
|
|
1376
|
-
}
|
|
1377
|
-
return value;
|
|
1378
|
-
}
|
|
1379
|
-
function getResponsiveColsClasses$1(values) {
|
|
1380
|
-
if (!values) return [];
|
|
1381
|
-
return Object.entries(values).map(([breakpoint, value]) => {
|
|
1382
|
-
return responsiveColsClass$1[breakpoint]?.[value] ?? "";
|
|
1383
|
-
});
|
|
1384
|
-
}
|
|
1385
|
-
function getResponsiveGapClasses$1(values) {
|
|
1386
|
-
if (!values) return [];
|
|
1387
|
-
return Object.entries(values).map(([breakpoint, value]) => {
|
|
1388
|
-
return responsiveGapClass$1[breakpoint]?.[value] ?? "";
|
|
1389
|
-
});
|
|
1390
|
-
}
|
|
1391
|
-
const Grid = ({ className, cols, gap, children, style, ...props }) => {
|
|
1392
|
-
const colsClasses = getResponsiveColsClasses$1(normalizeResponsiveProp$2(cols));
|
|
1393
|
-
const gapClasses = getResponsiveGapClasses$1(normalizeResponsiveProp$2(gap));
|
|
1394
|
-
return /* @__PURE__ */ jsx(
|
|
1395
|
-
"div",
|
|
1396
|
-
{
|
|
1397
|
-
className: cn(
|
|
1398
|
-
"grid",
|
|
1399
|
-
colsClasses,
|
|
1400
|
-
gapClasses,
|
|
1401
|
-
className
|
|
1402
|
-
),
|
|
1403
|
-
...props,
|
|
1404
|
-
children
|
|
1405
|
-
}
|
|
1406
|
-
);
|
|
1407
|
-
};
|
|
1408
|
-
const responsiveColSpanClass = {
|
|
1409
|
-
base: {
|
|
1410
|
-
1: "col-span-1",
|
|
1411
|
-
2: "col-span-2",
|
|
1412
|
-
3: "col-span-3",
|
|
1413
|
-
4: "col-span-4",
|
|
1414
|
-
5: "col-span-5",
|
|
1415
|
-
6: "col-span-6",
|
|
1416
|
-
7: "col-span-7",
|
|
1417
|
-
8: "col-span-8",
|
|
1418
|
-
9: "col-span-9",
|
|
1419
|
-
10: "col-span-10",
|
|
1420
|
-
11: "col-span-11",
|
|
1421
|
-
12: "col-span-12",
|
|
1422
|
-
full: "col-span-full"
|
|
1423
|
-
},
|
|
1424
|
-
sm: {
|
|
1425
|
-
1: "sm:col-span-1",
|
|
1426
|
-
2: "sm:col-span-2",
|
|
1427
|
-
3: "sm:col-span-3",
|
|
1428
|
-
4: "sm:col-span-4",
|
|
1429
|
-
5: "sm:col-span-5",
|
|
1430
|
-
6: "sm:col-span-6",
|
|
1431
|
-
7: "sm:col-span-7",
|
|
1432
|
-
8: "sm:col-span-8",
|
|
1433
|
-
9: "sm:col-span-9",
|
|
1434
|
-
10: "sm:col-span-10",
|
|
1435
|
-
11: "sm:col-span-11",
|
|
1436
|
-
12: "sm:col-span-12",
|
|
1437
|
-
full: "sm:col-span-full"
|
|
1438
|
-
},
|
|
1439
|
-
md: {
|
|
1440
|
-
1: "md:col-span-1",
|
|
1441
|
-
2: "md:col-span-2",
|
|
1442
|
-
3: "md:col-span-3",
|
|
1443
|
-
4: "md:col-span-4",
|
|
1444
|
-
5: "md:col-span-5",
|
|
1445
|
-
6: "md:col-span-6",
|
|
1446
|
-
7: "md:col-span-7",
|
|
1447
|
-
8: "md:col-span-8",
|
|
1448
|
-
9: "md:col-span-9",
|
|
1449
|
-
10: "md:col-span-10",
|
|
1450
|
-
11: "md:col-span-11",
|
|
1451
|
-
12: "md:col-span-12",
|
|
1452
|
-
full: "md:col-span-full"
|
|
1453
|
-
},
|
|
1454
|
-
lg: {
|
|
1455
|
-
1: "lg:col-span-1",
|
|
1456
|
-
2: "lg:col-span-2",
|
|
1457
|
-
3: "lg:col-span-3",
|
|
1458
|
-
4: "lg:col-span-4",
|
|
1459
|
-
5: "lg:col-span-5",
|
|
1460
|
-
6: "lg:col-span-6",
|
|
1461
|
-
7: "lg:col-span-7",
|
|
1462
|
-
8: "lg:col-span-8",
|
|
1463
|
-
9: "lg:col-span-9",
|
|
1464
|
-
10: "lg:col-span-10",
|
|
1465
|
-
11: "lg:col-span-11",
|
|
1466
|
-
12: "lg:col-span-12",
|
|
1467
|
-
full: "lg:col-span-full"
|
|
1468
|
-
},
|
|
1469
|
-
xl: {
|
|
1470
|
-
1: "xl:col-span-1",
|
|
1471
|
-
2: "xl:col-span-2",
|
|
1472
|
-
3: "xl:col-span-3",
|
|
1473
|
-
4: "xl:col-span-4",
|
|
1474
|
-
5: "xl:col-span-5",
|
|
1475
|
-
6: "xl:col-span-6",
|
|
1476
|
-
7: "xl:col-span-7",
|
|
1477
|
-
8: "xl:col-span-8",
|
|
1478
|
-
9: "xl:col-span-9",
|
|
1479
|
-
10: "xl:col-span-10",
|
|
1480
|
-
11: "xl:col-span-11",
|
|
1481
|
-
12: "xl:col-span-12",
|
|
1482
|
-
full: "xl:col-span-full"
|
|
1483
|
-
},
|
|
1484
|
-
"2xl": {
|
|
1485
|
-
1: "2xl:col-span-1",
|
|
1486
|
-
2: "2xl:col-span-2",
|
|
1487
|
-
3: "2xl:col-span-3",
|
|
1488
|
-
4: "2xl:col-span-4",
|
|
1489
|
-
5: "2xl:col-span-5",
|
|
1490
|
-
6: "2xl:col-span-6",
|
|
1491
|
-
7: "2xl:col-span-7",
|
|
1492
|
-
8: "2xl:col-span-8",
|
|
1493
|
-
9: "2xl:col-span-9",
|
|
1494
|
-
10: "2xl:col-span-10",
|
|
1495
|
-
11: "2xl:col-span-11",
|
|
1496
|
-
12: "2xl:col-span-12",
|
|
1497
|
-
full: "2xl:col-span-full"
|
|
1498
|
-
}
|
|
1499
|
-
};
|
|
1500
|
-
function normalizeResponsiveProp$1(value) {
|
|
1501
|
-
if (typeof value === "number") {
|
|
1502
|
-
return { base: value };
|
|
1503
|
-
}
|
|
1504
|
-
return value;
|
|
1505
|
-
}
|
|
1506
|
-
function getResponsiveColSpanClasses(values) {
|
|
1507
|
-
if (!values) return [];
|
|
1508
|
-
return Object.entries(values).map(([breakpoint, value]) => {
|
|
1509
|
-
return responsiveColSpanClass[breakpoint]?.[value] ?? "";
|
|
1510
|
-
});
|
|
1511
|
-
}
|
|
1512
|
-
const GridItem = ({
|
|
1513
|
-
className,
|
|
1514
|
-
colSpan,
|
|
1515
|
-
children,
|
|
1516
|
-
...props
|
|
1517
|
-
}) => {
|
|
1518
|
-
const colSpanClasses = getResponsiveColSpanClasses(
|
|
1519
|
-
normalizeResponsiveProp$1(colSpan)
|
|
1520
|
-
);
|
|
1521
|
-
return /* @__PURE__ */ jsx("div", { className: cn(...colSpanClasses, className), ...props, children });
|
|
1522
|
-
};
|
|
1523
1633
|
const responsiveColsClass = {
|
|
1524
1634
|
base: {
|
|
1525
1635
|
1: "columns-1",
|
|
@@ -1608,52 +1718,52 @@ const responsiveColsClass = {
|
|
|
1608
1718
|
};
|
|
1609
1719
|
const responsiveGapClass = {
|
|
1610
1720
|
base: {
|
|
1611
|
-
1: "gap-1",
|
|
1612
|
-
2: "gap-2",
|
|
1613
|
-
3: "gap-3",
|
|
1614
|
-
4: "gap-4",
|
|
1615
|
-
5: "gap-5",
|
|
1616
|
-
6: "gap-6"
|
|
1721
|
+
1: "gap-1 [&>*]:mb-1",
|
|
1722
|
+
2: "gap-2 [&>*]:mb-2",
|
|
1723
|
+
3: "gap-3 [&>*]:mb-3",
|
|
1724
|
+
4: "gap-4 [&>*]:mb-4",
|
|
1725
|
+
5: "gap-5 [&>*]:mb-5",
|
|
1726
|
+
6: "gap-6 [&>*]:mb-6"
|
|
1617
1727
|
},
|
|
1618
1728
|
sm: {
|
|
1619
|
-
1: "sm:gap-1",
|
|
1620
|
-
2: "sm:gap-2",
|
|
1621
|
-
3: "sm:gap-3",
|
|
1622
|
-
4: "sm:gap-4",
|
|
1623
|
-
5: "sm:gap-5",
|
|
1624
|
-
6: "sm:gap-6"
|
|
1729
|
+
1: "sm:gap-1 sm:[&>*]:mb-1",
|
|
1730
|
+
2: "sm:gap-2 sm:[&>*]:mb-2",
|
|
1731
|
+
3: "sm:gap-3 sm:[&>*]:mb-3",
|
|
1732
|
+
4: "sm:gap-4 sm:[&>*]:mb-4",
|
|
1733
|
+
5: "sm:gap-5 sm:[&>*]:mb-5",
|
|
1734
|
+
6: "sm:gap-6 sm:[&>*]:mb-6"
|
|
1625
1735
|
},
|
|
1626
1736
|
md: {
|
|
1627
|
-
1: "md:gap-1",
|
|
1628
|
-
2: "md:gap-2",
|
|
1629
|
-
3: "md:gap-3",
|
|
1630
|
-
4: "md:gap-4",
|
|
1631
|
-
5: "md:gap-5",
|
|
1632
|
-
6: "md:gap-6"
|
|
1737
|
+
1: "md:gap-1 md:[&>*]:mb-1",
|
|
1738
|
+
2: "md:gap-2 md:[&>*]:mb-2",
|
|
1739
|
+
3: "md:gap-3 md:[&>*]:mb-3",
|
|
1740
|
+
4: "md:gap-4 md:[&>*]:mb-4",
|
|
1741
|
+
5: "md:gap-5 md:[&>*]:mb-5",
|
|
1742
|
+
6: "md:gap-6 md:[&>*]:mb-6"
|
|
1633
1743
|
},
|
|
1634
1744
|
lg: {
|
|
1635
|
-
1: "lg:gap-1",
|
|
1636
|
-
2: "lg:gap-2",
|
|
1637
|
-
3: "lg:gap-3",
|
|
1638
|
-
4: "lg:gap-4",
|
|
1639
|
-
5: "lg:gap-5",
|
|
1640
|
-
6: "lg:gap-6"
|
|
1745
|
+
1: "lg:gap-1 lg:[&>*]:mb-1",
|
|
1746
|
+
2: "lg:gap-2 lg:[&>*]:mb-2",
|
|
1747
|
+
3: "lg:gap-3 lg:[&>*]:mb-3",
|
|
1748
|
+
4: "lg:gap-4 lg:[&>*]:mb-4",
|
|
1749
|
+
5: "lg:gap-5 lg:[&>*]:mb-5",
|
|
1750
|
+
6: "lg:gap-6 lg:[&>*]:mb-6"
|
|
1641
1751
|
},
|
|
1642
1752
|
xl: {
|
|
1643
|
-
1: "xl:gap-1",
|
|
1644
|
-
2: "xl:gap-2",
|
|
1645
|
-
3: "xl:gap-3",
|
|
1646
|
-
4: "xl:gap-4",
|
|
1647
|
-
5: "xl:gap-5",
|
|
1648
|
-
6: "xl:gap-6"
|
|
1753
|
+
1: "xl:gap-1 xl:[&>*]:mb-1",
|
|
1754
|
+
2: "xl:gap-2 xl:[&>*]:mb-2",
|
|
1755
|
+
3: "xl:gap-3 xl:[&>*]:mb-3",
|
|
1756
|
+
4: "xl:gap-4 xl:[&>*]:mb-4",
|
|
1757
|
+
5: "xl:gap-5 xl:[&>*]:mb-5",
|
|
1758
|
+
6: "xl:gap-6 xl:[&>*]:mb-6"
|
|
1649
1759
|
},
|
|
1650
1760
|
"2xl": {
|
|
1651
|
-
1: "2xl:gap-1",
|
|
1652
|
-
2: "2xl:gap-2",
|
|
1653
|
-
3: "2xl:gap-3",
|
|
1654
|
-
4: "2xl:gap-4",
|
|
1655
|
-
5: "2xl:gap-5",
|
|
1656
|
-
6: "2xl:gap-6"
|
|
1761
|
+
1: "2xl:gap-1 2xl:[&>*]:mb-1",
|
|
1762
|
+
2: "2xl:gap-2 2xl:[&>*]:mb-2",
|
|
1763
|
+
3: "2xl:gap-3 2xl:[&>*]:mb-3",
|
|
1764
|
+
4: "2xl:gap-4 2xl:[&>*]:mb-4",
|
|
1765
|
+
5: "2xl:gap-5 2xl:[&>*]:mb-5",
|
|
1766
|
+
6: "2xl:gap-6 2xl:[&>*]:mb-6"
|
|
1657
1767
|
}
|
|
1658
1768
|
};
|
|
1659
1769
|
function normalizeResponsiveProp(value) {
|
|
@@ -1675,20 +1785,25 @@ function getResponsiveGapClasses(values) {
|
|
|
1675
1785
|
});
|
|
1676
1786
|
}
|
|
1677
1787
|
const Masonry = React.forwardRef(
|
|
1678
|
-
({ children,
|
|
1788
|
+
({ children, cols = { base: 1, sm: 2, lg: 3 }, gap = 4, ...props }, ref) => {
|
|
1679
1789
|
const colsClasses = getResponsiveColsClasses(normalizeResponsiveProp(cols));
|
|
1680
1790
|
const gapClasses = getResponsiveGapClasses(normalizeResponsiveProp(gap));
|
|
1681
1791
|
return /* @__PURE__ */ jsx(
|
|
1682
1792
|
"div",
|
|
1683
1793
|
{
|
|
1684
1794
|
ref,
|
|
1685
|
-
className: cn(
|
|
1795
|
+
className: cn(
|
|
1796
|
+
"w-full [&>*]:break-inside-avoid",
|
|
1797
|
+
colsClasses,
|
|
1798
|
+
gapClasses
|
|
1799
|
+
),
|
|
1686
1800
|
...props,
|
|
1687
1801
|
children
|
|
1688
1802
|
}
|
|
1689
1803
|
);
|
|
1690
1804
|
}
|
|
1691
1805
|
);
|
|
1806
|
+
Masonry.displayName = "Masonry";
|
|
1692
1807
|
const ToastVariants = {
|
|
1693
1808
|
outline: "border border-current",
|
|
1694
1809
|
solid: ""
|
|
@@ -2589,43 +2704,76 @@ const Skeleton = ({
|
|
|
2589
2704
|
if (!isLoading) {
|
|
2590
2705
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
2591
2706
|
}
|
|
2592
|
-
const
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2707
|
+
const baseClasses = cn(
|
|
2708
|
+
"block overflow-hidden bg-gray-200 dark:bg-neutral-800",
|
|
2709
|
+
animode === "flash" ? "flash animate-pulse" : "shimmer",
|
|
2710
|
+
rounded ? "rounded-full" : "rounded-md"
|
|
2711
|
+
);
|
|
2596
2712
|
if (children) {
|
|
2597
|
-
|
|
2713
|
+
const style = {
|
|
2714
|
+
width: width ?? "fit-content",
|
|
2715
|
+
height: height ?? "auto"
|
|
2716
|
+
};
|
|
2717
|
+
return /* @__PURE__ */ jsx(Fragment, { children: React.Children.map(children, (child, index) => /* @__PURE__ */ jsx(
|
|
2598
2718
|
"div",
|
|
2599
2719
|
{
|
|
2600
|
-
|
|
2720
|
+
"aria-busy": "true",
|
|
2721
|
+
"aria-hidden": "true",
|
|
2722
|
+
className: baseClasses,
|
|
2601
2723
|
style,
|
|
2602
|
-
children: /* @__PURE__ */ jsx("
|
|
2724
|
+
children: /* @__PURE__ */ jsx("div", { className: "invisible pointer-events-none select-none", children: child })
|
|
2603
2725
|
},
|
|
2604
|
-
|
|
2726
|
+
index
|
|
2605
2727
|
)) });
|
|
2606
2728
|
}
|
|
2729
|
+
const standaloneStyle = {
|
|
2730
|
+
width: width ?? "100%",
|
|
2731
|
+
height: height ?? "1rem"
|
|
2732
|
+
};
|
|
2607
2733
|
return /* @__PURE__ */ jsx(
|
|
2608
2734
|
"div",
|
|
2609
2735
|
{
|
|
2610
|
-
|
|
2611
|
-
|
|
2736
|
+
"aria-busy": "true",
|
|
2737
|
+
"aria-hidden": "true",
|
|
2738
|
+
className: baseClasses,
|
|
2739
|
+
style: standaloneStyle
|
|
2612
2740
|
}
|
|
2613
2741
|
);
|
|
2614
2742
|
};
|
|
2743
|
+
const TooltipColors = {
|
|
2744
|
+
neutral: "bg-gray-900 text-white border-gray-900 dark:bg-neutral-800 dark:text-neutral-100 dark:border-neutral-700",
|
|
2745
|
+
primary: "bg-primary text-white border-primary dark:bg-primary-dark dark:border-primary-dark",
|
|
2746
|
+
secondary: "bg-secondary text-white border-secondary dark:bg-secondary-dark dark:border-secondary-dark",
|
|
2747
|
+
success: "bg-success text-white border-success dark:bg-success-dark dark:border-success-dark",
|
|
2748
|
+
warning: "bg-warning text-white border-warning dark:bg-warning-dark dark:border-warning-dark",
|
|
2749
|
+
error: "bg-error text-white border-error dark:bg-error-dark dark:border-error-dark",
|
|
2750
|
+
info: "bg-info text-white border-info dark:bg-info-dark dark:border-info-dark"
|
|
2751
|
+
};
|
|
2615
2752
|
const Tooltip = ({
|
|
2616
2753
|
children,
|
|
2617
2754
|
text,
|
|
2618
2755
|
showArrow = true,
|
|
2619
2756
|
placement = "top",
|
|
2620
2757
|
offset = 8,
|
|
2621
|
-
|
|
2758
|
+
color = "neutral",
|
|
2622
2759
|
isOpen: controlledIsOpen,
|
|
2623
2760
|
onOpenChange,
|
|
2624
2761
|
disabled = false,
|
|
2625
|
-
animationDuration =
|
|
2626
|
-
delay =
|
|
2762
|
+
animationDuration = 200,
|
|
2763
|
+
delay = 300
|
|
2627
2764
|
}) => {
|
|
2628
2765
|
const [isHovering, setIsHovering] = useState(false);
|
|
2766
|
+
const tooltipId = useId();
|
|
2767
|
+
const isControlled = controlledIsOpen !== void 0;
|
|
2768
|
+
const isVisible = isControlled ? controlledIsOpen : isHovering;
|
|
2769
|
+
const handleOpen = () => {
|
|
2770
|
+
if (!isControlled) setIsHovering(true);
|
|
2771
|
+
onOpenChange?.(true);
|
|
2772
|
+
};
|
|
2773
|
+
const handleClose = () => {
|
|
2774
|
+
if (!isControlled) setIsHovering(false);
|
|
2775
|
+
onOpenChange?.(false);
|
|
2776
|
+
};
|
|
2629
2777
|
const getTooltipPosition = () => {
|
|
2630
2778
|
switch (placement) {
|
|
2631
2779
|
case "top":
|
|
@@ -2636,59 +2784,61 @@ const Tooltip = ({
|
|
|
2636
2784
|
return { right: "100%", top: "50%", transform: "translateY(-50%)", marginRight: `${offset}px` };
|
|
2637
2785
|
case "right":
|
|
2638
2786
|
return { left: "100%", top: "50%", transform: "translateY(-50%)", marginLeft: `${offset}px` };
|
|
2639
|
-
default:
|
|
2640
|
-
return { bottom: "100%", left: "50%", transform: "translateX(-50%)", marginBottom: `${offset}px` };
|
|
2641
2787
|
}
|
|
2642
2788
|
};
|
|
2643
|
-
const
|
|
2789
|
+
const getArrowClass = () => {
|
|
2644
2790
|
switch (placement) {
|
|
2645
2791
|
case "top":
|
|
2646
|
-
return
|
|
2792
|
+
return "-bottom-[5px] left-1/2 -translate-x-1/2 border-r border-b";
|
|
2647
2793
|
case "bottom":
|
|
2648
|
-
return
|
|
2794
|
+
return "-top-[5px] left-1/2 -translate-x-1/2 border-l border-t";
|
|
2649
2795
|
case "left":
|
|
2650
|
-
return
|
|
2796
|
+
return "-right-[5px] top-1/2 -translate-y-1/2 border-t border-r";
|
|
2651
2797
|
case "right":
|
|
2652
|
-
return
|
|
2653
|
-
default:
|
|
2654
|
-
return { bottom: "-4px", left: "50%", transform: "translateX(-50%) rotate(45deg)" };
|
|
2798
|
+
return "-left-[5px] top-1/2 -translate-y-1/2 border-b border-l";
|
|
2655
2799
|
}
|
|
2656
2800
|
};
|
|
2657
|
-
|
|
2658
|
-
const tooltipStyle = {
|
|
2659
|
-
...getTooltipPosition(),
|
|
2660
|
-
transitionDelay: isVisible && !controlledIsOpen ? `${delay}ms` : "0ms",
|
|
2661
|
-
transitionDuration: `${animationDuration}ms`
|
|
2662
|
-
};
|
|
2663
|
-
if (disabled) {
|
|
2801
|
+
if (disabled || !text) {
|
|
2664
2802
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
2665
2803
|
}
|
|
2804
|
+
const colorClass = TooltipColors[color];
|
|
2666
2805
|
return /* @__PURE__ */ jsxs(
|
|
2667
2806
|
"div",
|
|
2668
2807
|
{
|
|
2669
|
-
className: "relative inline-
|
|
2670
|
-
onMouseEnter:
|
|
2671
|
-
onMouseLeave:
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2808
|
+
className: "relative inline-flex",
|
|
2809
|
+
onMouseEnter: handleOpen,
|
|
2810
|
+
onMouseLeave: handleClose,
|
|
2811
|
+
onFocus: handleOpen,
|
|
2812
|
+
onBlur: handleClose,
|
|
2813
|
+
"aria-describedby": isVisible ? tooltipId : void 0,
|
|
2675
2814
|
children: [
|
|
2676
2815
|
children,
|
|
2677
2816
|
/* @__PURE__ */ jsxs(
|
|
2678
2817
|
"div",
|
|
2679
2818
|
{
|
|
2819
|
+
id: tooltipId,
|
|
2820
|
+
role: "tooltip",
|
|
2680
2821
|
className: cn(
|
|
2681
|
-
|
|
2822
|
+
"absolute z-30 whitespace-nowrap rounded-md border px-2.5 py-1 text-xs font-medium tracking-tight shadow-md pointer-events-none transition-opacity",
|
|
2823
|
+
colorClass,
|
|
2682
2824
|
isVisible ? "opacity-100 visible" : "opacity-0 invisible"
|
|
2683
2825
|
),
|
|
2684
|
-
style:
|
|
2826
|
+
style: {
|
|
2827
|
+
...getTooltipPosition(),
|
|
2828
|
+
transitionDelay: isVisible && !isControlled ? `${delay}ms` : "0ms",
|
|
2829
|
+
transitionDuration: `${animationDuration}ms`
|
|
2830
|
+
},
|
|
2685
2831
|
children: [
|
|
2686
2832
|
text,
|
|
2687
2833
|
showArrow && /* @__PURE__ */ jsx(
|
|
2688
|
-
"
|
|
2834
|
+
"span",
|
|
2689
2835
|
{
|
|
2690
|
-
|
|
2691
|
-
|
|
2836
|
+
"aria-hidden": "true",
|
|
2837
|
+
className: cn(
|
|
2838
|
+
"absolute w-2 h-2 rotate-45",
|
|
2839
|
+
colorClass,
|
|
2840
|
+
getArrowClass()
|
|
2841
|
+
)
|
|
2692
2842
|
}
|
|
2693
2843
|
)
|
|
2694
2844
|
]
|
|
@@ -2698,52 +2848,21 @@ const Tooltip = ({
|
|
|
2698
2848
|
}
|
|
2699
2849
|
);
|
|
2700
2850
|
};
|
|
2701
|
-
const TextInput = React.forwardRef(
|
|
2702
|
-
({
|
|
2703
|
-
label,
|
|
2704
|
-
id,
|
|
2705
|
-
name,
|
|
2706
|
-
error,
|
|
2707
|
-
...props
|
|
2708
|
-
}, ref) => {
|
|
2709
|
-
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
2710
|
-
label && /* @__PURE__ */ jsx(
|
|
2711
|
-
"label",
|
|
2712
|
-
{
|
|
2713
|
-
htmlFor: id || name,
|
|
2714
|
-
className: "block text-sm font-medium mb-1 text-gray-900 dark:text-neutral-100",
|
|
2715
|
-
children: label
|
|
2716
|
-
}
|
|
2717
|
-
),
|
|
2718
|
-
/* @__PURE__ */ jsx(
|
|
2719
|
-
"input",
|
|
2720
|
-
{
|
|
2721
|
-
ref,
|
|
2722
|
-
id: id || name,
|
|
2723
|
-
name,
|
|
2724
|
-
className: cn(
|
|
2725
|
-
"block w-full px-3 py-2 border rounded-md shadow-sm sm:text-sm transition-colors",
|
|
2726
|
-
"bg-white border-gray-200 text-gray-900 placeholder:text-gray-400",
|
|
2727
|
-
"dark:bg-neutral-900 dark:border-neutral-800 dark:text-neutral-100 dark:placeholder:text-neutral-500",
|
|
2728
|
-
"focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary dark:focus:ring-primary-dark dark:focus:border-primary-dark",
|
|
2729
|
-
error && "border-error dark:border-error-dark focus:ring-error focus:border-error dark:focus:ring-error-dark dark:focus:border-error-dark",
|
|
2730
|
-
props.disabled && "opacity-50 bg-gray-100 dark:bg-neutral-800 cursor-not-allowed"
|
|
2731
|
-
),
|
|
2732
|
-
...props
|
|
2733
|
-
}
|
|
2734
|
-
),
|
|
2735
|
-
error && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-error dark:text-error-dark", children: error })
|
|
2736
|
-
] });
|
|
2737
|
-
}
|
|
2738
|
-
);
|
|
2739
|
-
TextInput.displayName = "TextInput";
|
|
2740
2851
|
const SliderColor = {
|
|
2741
|
-
primary: "bg-primary-30 dark:bg-primary-dark-30
|
|
2742
|
-
error: "bg-error-30 dark:bg-error-dark-30 [&::-webkit-slider-thumb]:
|
|
2743
|
-
warning: "bg-warning-30 dark:bg-warning-dark-30 [&::-webkit-slider-thumb]:
|
|
2744
|
-
success: "bg-success-30 dark:bg-success-dark-30 [&::-webkit-slider-thumb]:
|
|
2745
|
-
info: "bg-info-30 dark:bg-info-dark-30 [&::-webkit-slider-thumb]:
|
|
2746
|
-
secondary: "bg-secondary dark:bg-secondary-dark [&::-webkit-slider-thumb]:outline-5 [&::-webkit-slider-thumb]:outline-
|
|
2852
|
+
primary: "bg-primary-30 dark:bg-primary-dark-30 [&::-webkit-slider-thumb]:bg-primary dark:[&::-webkit-slider-thumb]:bg-primary-dark [&::-webkit-slider-thumb]:outline-5 hover:[&::-webkit-slider-thumb]:outline-10 [&::-webkit-slider-thumb]:outline-primary-30 dark:[&::-webkit-slider-thumb]:outline-primary-dark-30 [&::-moz-range-thumb]:bg-primary dark:[&::-moz-range-thumb]:bg-primary-dark",
|
|
2853
|
+
error: "bg-error-30 dark:bg-error-dark-30 [&::-webkit-slider-thumb]:bg-error dark:[&::-webkit-slider-thumb]:bg-error-dark [&::-webkit-slider-thumb]:outline-5 hover:[&::-webkit-slider-thumb]:outline-10 [&::-webkit-slider-thumb]:outline-error-30 dark:[&::-webkit-slider-thumb]:outline-error-dark-30 [&::-moz-range-thumb]:bg-error dark:[&::-moz-range-thumb]:bg-error-dark",
|
|
2854
|
+
warning: "bg-warning-30 dark:bg-warning-dark-30 [&::-webkit-slider-thumb]:bg-warning dark:[&::-webkit-slider-thumb]:bg-warning-dark [&::-webkit-slider-thumb]:outline-5 hover:[&::-webkit-slider-thumb]:outline-10 [&::-webkit-slider-thumb]:outline-warning-30 dark:[&::-webkit-slider-thumb]:outline-warning-dark-30 [&::-moz-range-thumb]:bg-warning dark:[&::-moz-range-thumb]:bg-warning-dark",
|
|
2855
|
+
success: "bg-success-30 dark:bg-success-dark-30 [&::-webkit-slider-thumb]:bg-success dark:[&::-webkit-slider-thumb]:bg-success-dark [&::-webkit-slider-thumb]:outline-5 hover:[&::-webkit-slider-thumb]:outline-10 [&::-webkit-slider-thumb]:outline-success-30 dark:[&::-webkit-slider-thumb]:outline-success-dark-30 [&::-moz-range-thumb]:bg-success dark:[&::-moz-range-thumb]:bg-success-dark",
|
|
2856
|
+
info: "bg-info-30 dark:bg-info-dark-30 [&::-webkit-slider-thumb]:bg-info dark:[&::-webkit-slider-thumb]:bg-info-dark [&::-webkit-slider-thumb]:outline-5 hover:[&::-webkit-slider-thumb]:outline-10 [&::-webkit-slider-thumb]:outline-info-30 dark:[&::-webkit-slider-thumb]:outline-info-dark-30 [&::-moz-range-thumb]:bg-info dark:[&::-moz-range-thumb]:bg-info-dark",
|
|
2857
|
+
secondary: "bg-gray-200 dark:bg-neutral-800 [&::-webkit-slider-thumb]:bg-secondary-700 dark:[&::-webkit-slider-thumb]:bg-secondary-dark-700 [&::-webkit-slider-thumb]:outline-5 hover:[&::-webkit-slider-thumb]:outline-10 [&::-webkit-slider-thumb]:outline-gray-200 dark:[&::-webkit-slider-thumb]:outline-neutral-800 [&::-moz-range-thumb]:bg-secondary-700 dark:[&::-moz-range-thumb]:bg-secondary-dark-700"
|
|
2858
|
+
};
|
|
2859
|
+
const SliderMarkColor = {
|
|
2860
|
+
primary: "bg-primary/50 dark:bg-primary-dark/60",
|
|
2861
|
+
error: "bg-error/50 dark:bg-error-dark/60",
|
|
2862
|
+
warning: "bg-warning/50 dark:bg-warning-dark/60",
|
|
2863
|
+
success: "bg-success/50 dark:bg-success-dark/60",
|
|
2864
|
+
info: "bg-info/50 dark:bg-info-dark/60",
|
|
2865
|
+
secondary: "bg-gray-400 dark:bg-neutral-600"
|
|
2747
2866
|
};
|
|
2748
2867
|
const SliderSize = {
|
|
2749
2868
|
sm: "h-1 [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3",
|
|
@@ -2756,28 +2875,44 @@ const Slider = ({
|
|
|
2756
2875
|
name,
|
|
2757
2876
|
label,
|
|
2758
2877
|
min = 0,
|
|
2759
|
-
disabled,
|
|
2760
2878
|
max = 100,
|
|
2761
2879
|
step = 1,
|
|
2762
|
-
value,
|
|
2880
|
+
value: controlledValue,
|
|
2881
|
+
defaultValue,
|
|
2882
|
+
disabled = false,
|
|
2763
2883
|
showTooltip = true,
|
|
2764
2884
|
showMarks = true,
|
|
2885
|
+
showInput = true,
|
|
2765
2886
|
onChange,
|
|
2766
2887
|
color = "primary",
|
|
2767
2888
|
prefixIcon,
|
|
2768
2889
|
suffixIcon,
|
|
2769
|
-
sliderSize = "md"
|
|
2890
|
+
sliderSize = "md",
|
|
2891
|
+
...props
|
|
2770
2892
|
}) => {
|
|
2893
|
+
const [internalValue, setInternalValue] = useState(
|
|
2894
|
+
defaultValue !== void 0 ? Number(defaultValue) : Number(min)
|
|
2895
|
+
);
|
|
2771
2896
|
const [isInteracting, setIsInteracting] = useState(false);
|
|
2897
|
+
const isControlled = controlledValue !== void 0;
|
|
2898
|
+
const currentValue = isControlled ? Number(controlledValue) : internalValue;
|
|
2772
2899
|
const sliderColorClassName = SliderColor[color];
|
|
2773
2900
|
const sliderSizeClassName = SliderSize[sliderSize];
|
|
2774
|
-
const webkitClassName = "[&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:appearance-none";
|
|
2775
|
-
const mozClassName = "[&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none";
|
|
2776
2901
|
const thumbWidthMap = { sm: 12, md: 16, lg: 20, xl: 24 };
|
|
2777
2902
|
const thumbWidth = thumbWidthMap[sliderSize];
|
|
2903
|
+
const handleValueChange = (e) => {
|
|
2904
|
+
if (!isControlled) {
|
|
2905
|
+
const parsed = Number(e.target.value);
|
|
2906
|
+
setInternalValue(Number.isNaN(parsed) ? Number(min) : parsed);
|
|
2907
|
+
}
|
|
2908
|
+
onChange?.(e);
|
|
2909
|
+
};
|
|
2778
2910
|
const getTooltipStyle = () => {
|
|
2779
|
-
const
|
|
2780
|
-
const
|
|
2911
|
+
const numericMin = Number(min);
|
|
2912
|
+
const numericMax = Number(max);
|
|
2913
|
+
const range = numericMax - numericMin;
|
|
2914
|
+
const clampedValue = Math.min(numericMax, Math.max(numericMin, currentValue || 0));
|
|
2915
|
+
const percentage = range === 0 ? 0 : (clampedValue - numericMin) / range;
|
|
2781
2916
|
const offset = percentage * -thumbWidth + thumbWidth / 2;
|
|
2782
2917
|
return {
|
|
2783
2918
|
left: `calc(${percentage * 100}% + ${offset}px)`,
|
|
@@ -2786,67 +2921,101 @@ const Slider = ({
|
|
|
2786
2921
|
};
|
|
2787
2922
|
};
|
|
2788
2923
|
const renderMarks = () => {
|
|
2789
|
-
|
|
2790
|
-
const
|
|
2791
|
-
const
|
|
2924
|
+
const numericStep = Number(step);
|
|
2925
|
+
const numericMin = Number(min);
|
|
2926
|
+
const numericMax = Number(max);
|
|
2927
|
+
const range = numericMax - numericMin;
|
|
2928
|
+
if (!showMarks || numericStep <= 1 || range <= 0) return null;
|
|
2929
|
+
const stepCount = Math.floor(range / numericStep);
|
|
2930
|
+
if (stepCount <= 0 || stepCount > 50) return null;
|
|
2792
2931
|
const marks = Array.from({ length: stepCount + 1 }, (_, i) => {
|
|
2793
2932
|
const left = i / stepCount * 100;
|
|
2794
2933
|
return /* @__PURE__ */ jsx(
|
|
2795
|
-
"
|
|
2934
|
+
"span",
|
|
2796
2935
|
{
|
|
2797
2936
|
className: cn(
|
|
2798
|
-
"absolute top-1/2 -translate-y-1/2 w-[2px] h-
|
|
2799
|
-
|
|
2937
|
+
"absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-[2px] h-1.5 rounded-full",
|
|
2938
|
+
disabled ? "bg-gray-300 dark:bg-neutral-700" : SliderMarkColor[color]
|
|
2800
2939
|
),
|
|
2801
2940
|
style: { left: `${left}%` }
|
|
2802
2941
|
},
|
|
2803
2942
|
i
|
|
2804
2943
|
);
|
|
2805
2944
|
});
|
|
2806
|
-
return /* @__PURE__ */ jsx(
|
|
2945
|
+
return /* @__PURE__ */ jsx(
|
|
2946
|
+
"div",
|
|
2947
|
+
{
|
|
2948
|
+
"aria-hidden": "true",
|
|
2949
|
+
className: "absolute top-full mt-2 pointer-events-none",
|
|
2950
|
+
style: {
|
|
2951
|
+
left: `${thumbWidth / 2}px`,
|
|
2952
|
+
right: `${thumbWidth / 2}px`
|
|
2953
|
+
},
|
|
2954
|
+
children: marks
|
|
2955
|
+
}
|
|
2956
|
+
);
|
|
2807
2957
|
};
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
/* @__PURE__ */
|
|
2811
|
-
|
|
2958
|
+
const inputId = id || name || "slider-range";
|
|
2959
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", showMarks && Number(step) > 1 && "pb-3"), children: [
|
|
2960
|
+
label && /* @__PURE__ */ jsx(
|
|
2961
|
+
"label",
|
|
2962
|
+
{
|
|
2963
|
+
htmlFor: inputId,
|
|
2964
|
+
className: "block text-sm font-medium mb-2 text-gray-900 dark:text-neutral-100",
|
|
2965
|
+
children: label
|
|
2966
|
+
}
|
|
2967
|
+
),
|
|
2968
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
2969
|
+
prefixIcon && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-gray-500 dark:text-neutral-400", children: prefixIcon }),
|
|
2812
2970
|
/* @__PURE__ */ jsxs(
|
|
2813
2971
|
"div",
|
|
2814
2972
|
{
|
|
2815
|
-
className: "relative w-full flex items-center",
|
|
2816
|
-
onMouseEnter: () => setIsInteracting(true),
|
|
2973
|
+
className: "relative w-full flex items-center py-2",
|
|
2974
|
+
onMouseEnter: () => !disabled && setIsInteracting(true),
|
|
2817
2975
|
onMouseLeave: () => setIsInteracting(false),
|
|
2818
2976
|
children: [
|
|
2819
|
-
showTooltip && /* @__PURE__ */ jsx(
|
|
2977
|
+
showTooltip && !disabled && /* @__PURE__ */ jsx(
|
|
2820
2978
|
"div",
|
|
2821
2979
|
{
|
|
2822
|
-
className: "absolute z-
|
|
2980
|
+
className: "absolute z-20 -top-6 transition-opacity duration-200",
|
|
2823
2981
|
style: getTooltipStyle(),
|
|
2824
|
-
children: /* @__PURE__ */ jsx(
|
|
2982
|
+
children: /* @__PURE__ */ jsx(
|
|
2983
|
+
Tooltip,
|
|
2984
|
+
{
|
|
2985
|
+
text: String(currentValue),
|
|
2986
|
+
isOpen: isInteracting,
|
|
2987
|
+
placement: "top",
|
|
2988
|
+
color: color === "secondary" ? "neutral" : color,
|
|
2989
|
+
children: /* @__PURE__ */ jsx("span", { className: "block w-0 h-0" })
|
|
2990
|
+
}
|
|
2991
|
+
)
|
|
2825
2992
|
}
|
|
2826
2993
|
),
|
|
2827
2994
|
/* @__PURE__ */ jsx(
|
|
2828
2995
|
"input",
|
|
2829
2996
|
{
|
|
2830
|
-
|
|
2997
|
+
...props,
|
|
2998
|
+
id: inputId,
|
|
2999
|
+
name,
|
|
2831
3000
|
type: "range",
|
|
2832
|
-
|
|
3001
|
+
disabled,
|
|
2833
3002
|
min,
|
|
2834
3003
|
max,
|
|
2835
3004
|
step,
|
|
2836
|
-
value,
|
|
2837
|
-
onChange,
|
|
2838
|
-
onMouseDown: () => setIsInteracting(true),
|
|
3005
|
+
value: currentValue,
|
|
3006
|
+
onChange: handleValueChange,
|
|
3007
|
+
onMouseDown: () => !disabled && setIsInteracting(true),
|
|
3008
|
+
onMouseUp: () => setIsInteracting(false),
|
|
3009
|
+
onTouchStart: () => !disabled && setIsInteracting(true),
|
|
3010
|
+
onTouchEnd: () => setIsInteracting(false),
|
|
3011
|
+
onFocus: () => !disabled && setIsInteracting(true),
|
|
3012
|
+
onBlur: () => setIsInteracting(false),
|
|
2839
3013
|
className: cn(
|
|
2840
|
-
"w-full rounded-full appearance-none
|
|
2841
|
-
"transition-all
|
|
3014
|
+
"w-full rounded-full appearance-none transition-all duration-200",
|
|
3015
|
+
"[&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:transition-all [&::-webkit-slider-thumb]:duration-200",
|
|
3016
|
+
"[&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:border-0",
|
|
2842
3017
|
sliderSizeClassName,
|
|
2843
|
-
|
|
2844
|
-
mozClassName,
|
|
2845
|
-
sliderColorClassName,
|
|
2846
|
-
{
|
|
2847
|
-
[SliderColor["secondary"]]: disabled,
|
|
2848
|
-
"bg-secondary opacity-50": disabled
|
|
2849
|
-
}
|
|
3018
|
+
disabled ? cn(SliderColor.secondary, "opacity-50 cursor-not-allowed") : cn(sliderColorClassName, "cursor-pointer")
|
|
2850
3019
|
)
|
|
2851
3020
|
}
|
|
2852
3021
|
),
|
|
@@ -2854,16 +3023,18 @@ const Slider = ({
|
|
|
2854
3023
|
]
|
|
2855
3024
|
}
|
|
2856
3025
|
),
|
|
2857
|
-
suffixIcon,
|
|
2858
|
-
/* @__PURE__ */ jsx("div", { className: "w-
|
|
3026
|
+
suffixIcon && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-gray-500 dark:text-neutral-400", children: suffixIcon }),
|
|
3027
|
+
showInput && /* @__PURE__ */ jsx("div", { className: "w-24 shrink-0", children: /* @__PURE__ */ jsx(
|
|
2859
3028
|
TextInput,
|
|
2860
3029
|
{
|
|
3030
|
+
type: "number",
|
|
3031
|
+
"aria-label": label ? `${label} value` : "Slider value",
|
|
2861
3032
|
min,
|
|
2862
3033
|
max,
|
|
2863
3034
|
step,
|
|
2864
|
-
|
|
2865
|
-
value: Number(
|
|
2866
|
-
onChange
|
|
3035
|
+
disabled,
|
|
3036
|
+
value: Number.isNaN(currentValue) ? "" : currentValue,
|
|
3037
|
+
onChange: handleValueChange
|
|
2867
3038
|
}
|
|
2868
3039
|
) })
|
|
2869
3040
|
] })
|
|
@@ -3282,20 +3453,20 @@ const Textarea = ({
|
|
|
3282
3453
|
] });
|
|
3283
3454
|
};
|
|
3284
3455
|
const DotColors = {
|
|
3456
|
+
default: "bg-gray-400 dark:bg-neutral-500",
|
|
3457
|
+
primary: "bg-primary dark:bg-primary-dark",
|
|
3285
3458
|
success: "bg-success dark:bg-success-dark",
|
|
3286
3459
|
info: "bg-info dark:bg-info-dark",
|
|
3287
3460
|
error: "bg-error dark:bg-error-dark",
|
|
3288
|
-
warning: "bg-warning dark:bg-warning-dark"
|
|
3289
|
-
primary: "bg-primary dark:bg-primary-dark",
|
|
3290
|
-
default: "bg-secondary-700 dark:bg-secondary-dark"
|
|
3461
|
+
warning: "bg-warning dark:bg-warning-dark"
|
|
3291
3462
|
};
|
|
3292
3463
|
const LineColors = {
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3464
|
+
default: "border-gray-200 dark:border-neutral-800 md:before:border-gray-200 md:dark:before:border-neutral-800",
|
|
3465
|
+
primary: "border-primary dark:border-primary-dark md:before:border-primary md:dark:before:border-primary-dark",
|
|
3466
|
+
success: "border-success dark:border-success-dark md:before:border-success md:dark:before:border-success-dark",
|
|
3467
|
+
info: "border-info dark:border-info-dark md:before:border-info md:dark:before:border-info-dark",
|
|
3468
|
+
error: "border-error dark:border-error-dark md:before:border-error md:dark:before:border-error-dark",
|
|
3469
|
+
warning: "border-warning dark:border-warning-dark md:before:border-warning md:dark:before:border-warning-dark"
|
|
3299
3470
|
};
|
|
3300
3471
|
const TimelineItem = ({
|
|
3301
3472
|
title,
|
|
@@ -3303,42 +3474,55 @@ const TimelineItem = ({
|
|
|
3303
3474
|
children,
|
|
3304
3475
|
dotColor = "default",
|
|
3305
3476
|
icon,
|
|
3306
|
-
position
|
|
3307
|
-
// prop from parent
|
|
3477
|
+
position = "left"
|
|
3308
3478
|
}) => {
|
|
3309
3479
|
const dotColorClassName = DotColors[dotColor];
|
|
3310
|
-
|
|
3311
|
-
"
|
|
3312
|
-
"
|
|
3313
|
-
"
|
|
3314
|
-
|
|
3315
|
-
icon
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3480
|
+
const markerPositionClass = cn({
|
|
3481
|
+
"-start-[21px]": icon && position === "left",
|
|
3482
|
+
"-end-[21px]": icon && position === "right",
|
|
3483
|
+
"-start-[21px] md:start-1/2 md:-translate-x-1/2": icon && position === "split",
|
|
3484
|
+
"-start-[7px]": !icon && position === "left",
|
|
3485
|
+
"-end-[7px]": !icon && position === "right",
|
|
3486
|
+
"-start-[7px] md:start-1/2 md:-translate-x-1/2": !icon && position === "split"
|
|
3487
|
+
});
|
|
3488
|
+
return /* @__PURE__ */ jsxs(
|
|
3489
|
+
"li",
|
|
3490
|
+
{
|
|
3491
|
+
className: cn("pb-8 last:pb-0", {
|
|
3492
|
+
"ms-7": position === "left",
|
|
3493
|
+
"me-7 text-end": position === "right",
|
|
3494
|
+
"ms-7 md:w-1/2 md:ms-0 md:odd:pe-8 md:odd:text-end md:even:ps-8 md:even:ms-auto": position === "split"
|
|
3495
|
+
}),
|
|
3496
|
+
children: [
|
|
3497
|
+
icon ? /* @__PURE__ */ jsx(
|
|
3498
|
+
"div",
|
|
3499
|
+
{
|
|
3500
|
+
className: cn(
|
|
3501
|
+
"absolute flex items-center justify-center w-10 h-10 rounded-full text-white ring-4 ring-white dark:ring-neutral-900",
|
|
3502
|
+
dotColorClassName,
|
|
3503
|
+
markerPositionClass
|
|
3504
|
+
),
|
|
3505
|
+
children: icon
|
|
3506
|
+
}
|
|
3507
|
+
) : /* @__PURE__ */ jsx(
|
|
3508
|
+
"span",
|
|
3509
|
+
{
|
|
3510
|
+
"aria-hidden": "true",
|
|
3511
|
+
className: cn(
|
|
3512
|
+
"absolute w-3 h-3 rounded-full mt-1.5 ring-4 ring-white dark:ring-neutral-900",
|
|
3513
|
+
dotColorClassName,
|
|
3514
|
+
markerPositionClass
|
|
3515
|
+
)
|
|
3516
|
+
}
|
|
3517
|
+
),
|
|
3518
|
+
/* @__PURE__ */ jsx("time", { className: "block mb-1 text-xs font-medium tracking-wide text-gray-500 dark:text-neutral-400", children: time }),
|
|
3519
|
+
/* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-gray-900 dark:text-neutral-100 leading-snug", children: title }),
|
|
3520
|
+
children && /* @__PURE__ */ jsx("div", { className: "mt-1.5 text-sm text-gray-600 dark:text-neutral-300 leading-relaxed", children })
|
|
3521
|
+
]
|
|
3522
|
+
}
|
|
3523
|
+
);
|
|
3336
3524
|
};
|
|
3337
|
-
const Timeline = ({
|
|
3338
|
-
position = "left",
|
|
3339
|
-
lineColor = "default",
|
|
3340
|
-
children
|
|
3341
|
-
}) => {
|
|
3525
|
+
const Timeline = ({ position = "left", lineColor = "default", children }) => {
|
|
3342
3526
|
const childrenWithProps = Children.map(children, (child) => {
|
|
3343
3527
|
if (isValidElement(child)) {
|
|
3344
3528
|
return cloneElement(child, { position });
|
|
@@ -3346,15 +3530,21 @@ const Timeline = ({
|
|
|
3346
3530
|
return child;
|
|
3347
3531
|
});
|
|
3348
3532
|
const lineColorClassName = LineColors[lineColor];
|
|
3349
|
-
return /* @__PURE__ */ jsx(
|
|
3350
|
-
"
|
|
3533
|
+
return /* @__PURE__ */ jsx(
|
|
3534
|
+
"ol",
|
|
3351
3535
|
{
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3536
|
+
className: cn(
|
|
3537
|
+
"relative",
|
|
3538
|
+
{
|
|
3539
|
+
"border-s-2": position === "left",
|
|
3540
|
+
"border-e-2": position === "right",
|
|
3541
|
+
"border-s-2 md:border-s-0 md:before:content-[''] md:before:absolute md:before:inset-y-0 md:before:left-1/2 md:before:-translate-x-1/2 md:before:border-s-2": position === "split"
|
|
3542
|
+
},
|
|
3543
|
+
lineColorClassName
|
|
3544
|
+
),
|
|
3545
|
+
children: childrenWithProps
|
|
3546
|
+
}
|
|
3547
|
+
);
|
|
3358
3548
|
};
|
|
3359
3549
|
Timeline.Item = TimelineItem;
|
|
3360
3550
|
const ToggleVariant = {
|
|
@@ -3433,10 +3623,9 @@ export {
|
|
|
3433
3623
|
CheckboxInput,
|
|
3434
3624
|
CodeInput,
|
|
3435
3625
|
Collection,
|
|
3626
|
+
DatePicker,
|
|
3436
3627
|
FAB,
|
|
3437
3628
|
FileUpload,
|
|
3438
|
-
Grid,
|
|
3439
|
-
GridItem,
|
|
3440
3629
|
ListCheckboxInput,
|
|
3441
3630
|
Masonry,
|
|
3442
3631
|
Modal,
|