@algorithm-shift/design-system 1.2.32 → 1.2.33
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 +30 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +39 -15
- package/dist/index.d.ts +39 -15
- package/dist/index.js +223 -85
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +235 -97
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -618,7 +618,6 @@ function Textarea({ className, ...props }) {
|
|
|
618
618
|
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
619
619
|
var Textarea2 = ({ className, style, ...props }) => {
|
|
620
620
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
621
|
-
const isRequired = props.isRequired ?? false;
|
|
622
621
|
const isEditable = props.isEditable ?? true;
|
|
623
622
|
const isDisabled = props.isDisabled ?? false;
|
|
624
623
|
const isReadonly = props.isReadonly ?? false;
|
|
@@ -647,8 +646,7 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
647
646
|
placeholder,
|
|
648
647
|
onChange: handleChange,
|
|
649
648
|
disabled: isDisabled || !isEditable,
|
|
650
|
-
readOnly: isReadonly
|
|
651
|
-
required: isRequired
|
|
649
|
+
readOnly: isReadonly
|
|
652
650
|
}
|
|
653
651
|
),
|
|
654
652
|
error && /* @__PURE__ */ jsx15("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
@@ -701,6 +699,9 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
701
699
|
};
|
|
702
700
|
var UrlInput_default = UrlInput;
|
|
703
701
|
|
|
702
|
+
// src/components/Inputs/Checkbox/Checkbox.tsx
|
|
703
|
+
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
704
|
+
|
|
704
705
|
// src/components/ui/checkbox.tsx
|
|
705
706
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
706
707
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
@@ -750,16 +751,40 @@ function Label({
|
|
|
750
751
|
}
|
|
751
752
|
|
|
752
753
|
// src/components/Inputs/Checkbox/Checkbox.tsx
|
|
753
|
-
import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
754
|
+
import { Fragment as Fragment7, jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
754
755
|
var CheckboxInput = ({ className, style, ...props }) => {
|
|
756
|
+
const isEditable = props.isEditable ?? true;
|
|
757
|
+
const isDisabled = props.isDisabled ?? false;
|
|
755
758
|
const text = props.text ? props.text : "Subscribe";
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
759
|
+
const [error, setError] = useState7(null);
|
|
760
|
+
useEffect7(() => {
|
|
761
|
+
if (!props.validateOnMount) return;
|
|
762
|
+
setError(props.errorMessage || null);
|
|
763
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
764
|
+
const handleChange = (value) => {
|
|
765
|
+
props.onChange?.(value);
|
|
766
|
+
};
|
|
767
|
+
return /* @__PURE__ */ jsxs8(Fragment7, { children: [
|
|
768
|
+
/* @__PURE__ */ jsx19("div", { className, style, children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center space-x-2", children: [
|
|
769
|
+
/* @__PURE__ */ jsx19(
|
|
770
|
+
Checkbox,
|
|
771
|
+
{
|
|
772
|
+
id: props.name || "checkbox",
|
|
773
|
+
checked: !!props.value,
|
|
774
|
+
onCheckedChange: handleChange,
|
|
775
|
+
disabled: !isEditable || isDisabled
|
|
776
|
+
}
|
|
777
|
+
),
|
|
778
|
+
/* @__PURE__ */ jsx19(Label, { htmlFor: props.name || "checkbox", children: text })
|
|
779
|
+
] }) }),
|
|
780
|
+
error && /* @__PURE__ */ jsx19("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
781
|
+
] });
|
|
760
782
|
};
|
|
761
783
|
var Checkbox_default = CheckboxInput;
|
|
762
784
|
|
|
785
|
+
// src/components/Inputs/RadioInput/RadioInput.tsx
|
|
786
|
+
import { useEffect as useEffect8, useState as useState8 } from "react";
|
|
787
|
+
|
|
763
788
|
// src/components/ui/radio-group.tsx
|
|
764
789
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
765
790
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
@@ -802,37 +827,106 @@ function RadioGroupItem({
|
|
|
802
827
|
}
|
|
803
828
|
|
|
804
829
|
// src/components/Inputs/RadioInput/RadioInput.tsx
|
|
805
|
-
import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
806
|
-
var RadioInput = ({
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
830
|
+
import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
831
|
+
var RadioInput = ({
|
|
832
|
+
className,
|
|
833
|
+
style,
|
|
834
|
+
defaultValue,
|
|
835
|
+
onChange,
|
|
836
|
+
data = [],
|
|
837
|
+
dataKey,
|
|
838
|
+
dataLabel,
|
|
839
|
+
...props
|
|
840
|
+
}) => {
|
|
841
|
+
const [error, setError] = useState8(null);
|
|
842
|
+
useEffect8(() => {
|
|
843
|
+
if (!props.validateOnMount) return;
|
|
844
|
+
setError(props.errorMessage || null);
|
|
845
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
846
|
+
const options = (data || []).map((item) => ({
|
|
847
|
+
value: item[dataKey || "value"],
|
|
848
|
+
label: item[dataLabel || "label"]
|
|
811
849
|
}));
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
850
|
+
const handleChange = (value) => {
|
|
851
|
+
onChange?.(value);
|
|
852
|
+
};
|
|
853
|
+
const resolvedDefaultValue = (typeof defaultValue === "string" ? defaultValue : void 0) ?? options[0]?.value;
|
|
854
|
+
return /* @__PURE__ */ jsxs9(Fragment8, { children: [
|
|
855
|
+
/* @__PURE__ */ jsx21("div", { className, style, children: /* @__PURE__ */ jsxs9(
|
|
856
|
+
RadioGroup,
|
|
857
|
+
{
|
|
858
|
+
defaultValue: resolvedDefaultValue,
|
|
859
|
+
onValueChange: handleChange,
|
|
860
|
+
children: [
|
|
861
|
+
options.length === 0 && /* @__PURE__ */ jsx21("div", { className: "text-sm text-gray-500", children: "No options available" }),
|
|
862
|
+
options.map((item) => /* @__PURE__ */ jsxs9("div", { className: "flex items-center space-x-2", children: [
|
|
863
|
+
/* @__PURE__ */ jsx21(RadioGroupItem, { value: item.value, id: `radio-${item.value}` }),
|
|
864
|
+
/* @__PURE__ */ jsx21(Label, { htmlFor: `radio-${item.value}`, children: item.label })
|
|
865
|
+
] }, item.value))
|
|
866
|
+
]
|
|
867
|
+
}
|
|
868
|
+
) }),
|
|
869
|
+
error && /* @__PURE__ */ jsx21("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
870
|
+
] });
|
|
816
871
|
};
|
|
817
872
|
var RadioInput_default = RadioInput;
|
|
818
873
|
|
|
819
874
|
// src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx
|
|
875
|
+
import { useCallback, useState as useState9 } from "react";
|
|
820
876
|
import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
821
|
-
var MultiCheckbox = ({
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
877
|
+
var MultiCheckbox = ({
|
|
878
|
+
className,
|
|
879
|
+
style,
|
|
880
|
+
data = [],
|
|
881
|
+
dataKey = "value",
|
|
882
|
+
dataLabel = "label",
|
|
883
|
+
value: propValue = {},
|
|
884
|
+
onChange,
|
|
885
|
+
isEditable = true,
|
|
886
|
+
isDisabled = false
|
|
887
|
+
}) => {
|
|
888
|
+
const [value, setValue] = useState9(propValue);
|
|
889
|
+
const options = (data || []).map((item) => ({
|
|
890
|
+
value: item[dataKey || "value"],
|
|
891
|
+
label: item[dataLabel || "label"]
|
|
826
892
|
}));
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
893
|
+
const handleChange = useCallback(
|
|
894
|
+
(key, checked) => {
|
|
895
|
+
setValue((prev) => {
|
|
896
|
+
const newValue = { ...prev, [key]: checked };
|
|
897
|
+
onChange?.(newValue);
|
|
898
|
+
return newValue;
|
|
899
|
+
});
|
|
900
|
+
},
|
|
901
|
+
[onChange]
|
|
902
|
+
);
|
|
903
|
+
return /* @__PURE__ */ jsxs10(
|
|
904
|
+
"div",
|
|
905
|
+
{
|
|
906
|
+
className: cn("flex flex-col gap-3", className),
|
|
907
|
+
style,
|
|
908
|
+
children: [
|
|
909
|
+
options.length === 0 && /* @__PURE__ */ jsx22("p", { className: "text-sm text-gray-500", children: "No options available." }),
|
|
910
|
+
options.map((opt) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center space-x-2", children: [
|
|
911
|
+
/* @__PURE__ */ jsx22(
|
|
912
|
+
Checkbox,
|
|
913
|
+
{
|
|
914
|
+
id: opt.value,
|
|
915
|
+
checked: !!value[opt.value],
|
|
916
|
+
onCheckedChange: (checked) => handleChange(opt.value, checked === true),
|
|
917
|
+
disabled: !isEditable || isDisabled
|
|
918
|
+
}
|
|
919
|
+
),
|
|
920
|
+
/* @__PURE__ */ jsx22(Label, { htmlFor: opt.value, children: opt.label })
|
|
921
|
+
] }, opt.value))
|
|
922
|
+
]
|
|
923
|
+
}
|
|
924
|
+
);
|
|
831
925
|
};
|
|
832
926
|
var MultiCheckbox_default = MultiCheckbox;
|
|
833
927
|
|
|
834
928
|
// src/components/Inputs/RichText/RichText.tsx
|
|
835
|
-
import { useEffect as
|
|
929
|
+
import { useEffect as useEffect9, useState as useState10 } from "react";
|
|
836
930
|
|
|
837
931
|
// src/components/Global/TinyMceEditor.tsx
|
|
838
932
|
import { useMemo, useRef } from "react";
|
|
@@ -908,8 +1002,8 @@ function MyEditor({
|
|
|
908
1002
|
// src/components/Inputs/RichText/RichText.tsx
|
|
909
1003
|
import { jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
910
1004
|
function RichText({ className, style, ...props }) {
|
|
911
|
-
const [error, setError] =
|
|
912
|
-
|
|
1005
|
+
const [error, setError] = useState10(null);
|
|
1006
|
+
useEffect9(() => {
|
|
913
1007
|
if (!props.validateOnMount) return;
|
|
914
1008
|
setError(props.errorMessage || null);
|
|
915
1009
|
}, [props.errorMessage, props.validateOnMount]);
|
|
@@ -1059,7 +1153,7 @@ function SelectScrollDownButton({
|
|
|
1059
1153
|
}
|
|
1060
1154
|
|
|
1061
1155
|
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
1062
|
-
import { Fragment as
|
|
1156
|
+
import { Fragment as Fragment9, jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1063
1157
|
var Dropdown = ({ className, style, ...props }) => {
|
|
1064
1158
|
const list = props.data || [];
|
|
1065
1159
|
const placeholder = props.placeholder ? props.placeholder : "Placeholder text";
|
|
@@ -1074,13 +1168,13 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
1074
1168
|
const handleChange = (value) => {
|
|
1075
1169
|
props.onChange?.(value);
|
|
1076
1170
|
};
|
|
1077
|
-
const dataKey = props.dataKey || "
|
|
1171
|
+
const dataKey = props.dataKey || "value";
|
|
1078
1172
|
const dataLabel = props.dataLabel || "label";
|
|
1079
1173
|
const options = list.map((item) => ({
|
|
1080
|
-
|
|
1174
|
+
value: item[dataKey],
|
|
1081
1175
|
label: item[dataLabel]
|
|
1082
1176
|
}));
|
|
1083
|
-
return /* @__PURE__ */ jsxs13(
|
|
1177
|
+
return /* @__PURE__ */ jsxs13(Fragment9, { children: [
|
|
1084
1178
|
/* @__PURE__ */ jsxs13(Select, { name: props.name, value: props.value, onValueChange: handleChange, disabled: isDisabled || !isEditable, children: [
|
|
1085
1179
|
/* @__PURE__ */ jsx26(
|
|
1086
1180
|
SelectTrigger,
|
|
@@ -1095,13 +1189,16 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
1095
1189
|
children: /* @__PURE__ */ jsx26(SelectValue, { placeholder })
|
|
1096
1190
|
}
|
|
1097
1191
|
),
|
|
1098
|
-
/* @__PURE__ */ jsx26(SelectContent, { children: options.map((opt) => /* @__PURE__ */ jsx26(SelectItem, { value: opt.
|
|
1192
|
+
/* @__PURE__ */ jsx26(SelectContent, { children: options.map((opt) => /* @__PURE__ */ jsx26(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })
|
|
1099
1193
|
] }),
|
|
1100
1194
|
error && /* @__PURE__ */ jsx26("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
1101
1195
|
] });
|
|
1102
1196
|
};
|
|
1103
1197
|
var Dropdown_default = Dropdown;
|
|
1104
1198
|
|
|
1199
|
+
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
1200
|
+
import { useEffect as useEffect11, useState as useState12 } from "react";
|
|
1201
|
+
|
|
1105
1202
|
// src/components/ui/switch.tsx
|
|
1106
1203
|
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
1107
1204
|
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
@@ -1132,13 +1229,33 @@ function Switch({
|
|
|
1132
1229
|
}
|
|
1133
1230
|
|
|
1134
1231
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
1135
|
-
import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1232
|
+
import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1136
1233
|
var SwitchToggle = ({ className, style, ...props }) => {
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1234
|
+
const isEditable = props.isEditable ?? true;
|
|
1235
|
+
const isDisabled = props.isDisabled ?? false;
|
|
1236
|
+
const [error, setError] = useState12(null);
|
|
1237
|
+
useEffect11(() => {
|
|
1238
|
+
if (!props.validateOnMount) return;
|
|
1239
|
+
setError(props.errorMessage || null);
|
|
1240
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
1241
|
+
const handleChange = (value) => {
|
|
1242
|
+
props.onChange?.(value);
|
|
1243
|
+
};
|
|
1244
|
+
return /* @__PURE__ */ jsxs14(Fragment10, { children: [
|
|
1245
|
+
/* @__PURE__ */ jsx28("div", { className, style, children: /* @__PURE__ */ jsxs14("div", { className: "flex items-center space-x-2 mb-2", children: [
|
|
1246
|
+
/* @__PURE__ */ jsx28(
|
|
1247
|
+
Switch,
|
|
1248
|
+
{
|
|
1249
|
+
id: props.name || "switch",
|
|
1250
|
+
checked: !!props.value,
|
|
1251
|
+
onCheckedChange: handleChange,
|
|
1252
|
+
disabled: isDisabled || !isEditable
|
|
1253
|
+
}
|
|
1254
|
+
),
|
|
1255
|
+
/* @__PURE__ */ jsx28(Label, { htmlFor: props.name || "switch", children: props.text })
|
|
1256
|
+
] }) }),
|
|
1257
|
+
error && /* @__PURE__ */ jsx28("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
1258
|
+
] });
|
|
1142
1259
|
};
|
|
1143
1260
|
var SwitchToggle_default = SwitchToggle;
|
|
1144
1261
|
|
|
@@ -1146,7 +1263,7 @@ var SwitchToggle_default = SwitchToggle;
|
|
|
1146
1263
|
import * as React9 from "react";
|
|
1147
1264
|
import { PhoneInput as PhoneInputField } from "react-international-phone";
|
|
1148
1265
|
import "react-international-phone/style.css";
|
|
1149
|
-
import { Fragment as
|
|
1266
|
+
import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1150
1267
|
var PhoneInput = ({ className, style, ...props }) => {
|
|
1151
1268
|
const placeholder = props.placeholder ?? "Enter phone number";
|
|
1152
1269
|
const isEditable = props.isEditable ?? true;
|
|
@@ -1159,7 +1276,7 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
1159
1276
|
const handleChange = (val) => {
|
|
1160
1277
|
props.onChange?.(val);
|
|
1161
1278
|
};
|
|
1162
|
-
return /* @__PURE__ */ jsxs15(
|
|
1279
|
+
return /* @__PURE__ */ jsxs15(Fragment11, { children: [
|
|
1163
1280
|
/* @__PURE__ */ jsx29(
|
|
1164
1281
|
PhoneInputField,
|
|
1165
1282
|
{
|
|
@@ -1186,7 +1303,7 @@ var PhoneInput_default = PhoneInput;
|
|
|
1186
1303
|
|
|
1187
1304
|
// src/components/Inputs/SearchInput/SearchInput.tsx
|
|
1188
1305
|
import * as React10 from "react";
|
|
1189
|
-
import { Fragment as
|
|
1306
|
+
import { Fragment as Fragment12, jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1190
1307
|
var SearchInput = ({ className, style, ...props }) => {
|
|
1191
1308
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
1192
1309
|
const isEditable = props.isEditable ?? true;
|
|
@@ -1201,9 +1318,9 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
1201
1318
|
const handleChange = (e) => {
|
|
1202
1319
|
props.onChange?.(e);
|
|
1203
1320
|
};
|
|
1204
|
-
return /* @__PURE__ */ jsxs16(
|
|
1321
|
+
return /* @__PURE__ */ jsxs16(Fragment12, { children: [
|
|
1205
1322
|
/* @__PURE__ */ jsxs16("div", { className: "flex justify-start items-center relative", children: [
|
|
1206
|
-
/* @__PURE__ */ jsx30(Search, { className: "
|
|
1323
|
+
/* @__PURE__ */ jsx30(Search, { className: "left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[#BDBDBD]" }),
|
|
1207
1324
|
/* @__PURE__ */ jsx30(
|
|
1208
1325
|
Input,
|
|
1209
1326
|
{
|
|
@@ -1230,12 +1347,12 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
1230
1347
|
var SearchInput_default = SearchInput;
|
|
1231
1348
|
|
|
1232
1349
|
// src/components/Inputs/FileInput/FileInput.tsx
|
|
1233
|
-
import { useEffect as
|
|
1350
|
+
import { useEffect as useEffect14, useState as useState15 } from "react";
|
|
1234
1351
|
import { jsx as jsx31, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1235
1352
|
var FileInput = ({ className, style, ...props }) => {
|
|
1236
1353
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
1237
|
-
const [error, setError] =
|
|
1238
|
-
|
|
1354
|
+
const [error, setError] = useState15(null);
|
|
1355
|
+
useEffect14(() => {
|
|
1239
1356
|
if (!props.validateOnMount) return;
|
|
1240
1357
|
setError(props.errorMessage || null);
|
|
1241
1358
|
}, [props.errorMessage, props.validateOnMount]);
|
|
@@ -1265,8 +1382,8 @@ var FileInput = ({ className, style, ...props }) => {
|
|
|
1265
1382
|
var FileInput_default = FileInput;
|
|
1266
1383
|
|
|
1267
1384
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
1268
|
-
import React11, { useEffect as
|
|
1269
|
-
import { Fragment as
|
|
1385
|
+
import React11, { useEffect as useEffect15 } from "react";
|
|
1386
|
+
import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1270
1387
|
function DatePicker({ className, style, ...props }) {
|
|
1271
1388
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
1272
1389
|
const minimumDate = props.minimumDate ?? "none";
|
|
@@ -1292,14 +1409,14 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1292
1409
|
};
|
|
1293
1410
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
1294
1411
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
1295
|
-
|
|
1412
|
+
useEffect15(() => {
|
|
1296
1413
|
if (!props.validateOnMount) return;
|
|
1297
1414
|
setError(props.errorMessage || null);
|
|
1298
1415
|
}, [props.errorMessage, props.validateOnMount]);
|
|
1299
1416
|
const handleChange = (e) => {
|
|
1300
1417
|
props.onChange?.(e);
|
|
1301
1418
|
};
|
|
1302
|
-
return /* @__PURE__ */ jsxs18(
|
|
1419
|
+
return /* @__PURE__ */ jsxs18(Fragment13, { children: [
|
|
1303
1420
|
/* @__PURE__ */ jsxs18("div", { className: "flex justify-start items-center relative", children: [
|
|
1304
1421
|
/* @__PURE__ */ jsx32(Calendar, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[#BDBDBD]" }),
|
|
1305
1422
|
/* @__PURE__ */ jsx32(
|
|
@@ -1312,7 +1429,11 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1312
1429
|
disabled: isDisabled || !isEditable,
|
|
1313
1430
|
name: props.name,
|
|
1314
1431
|
value: props.value,
|
|
1315
|
-
className: cn(
|
|
1432
|
+
className: cn(
|
|
1433
|
+
className,
|
|
1434
|
+
error ? "border-red-500" : "",
|
|
1435
|
+
"appearance-auto"
|
|
1436
|
+
),
|
|
1316
1437
|
style: {
|
|
1317
1438
|
...style,
|
|
1318
1439
|
borderColor: error ? "#f87171" : style?.borderColor
|
|
@@ -1548,41 +1669,58 @@ function PopoverContent({
|
|
|
1548
1669
|
}
|
|
1549
1670
|
|
|
1550
1671
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
1551
|
-
import { Fragment as
|
|
1552
|
-
var DateRange = ({ className, style }) => {
|
|
1553
|
-
const [
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1672
|
+
import { Fragment as Fragment14, jsx as jsx35, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1673
|
+
var DateRange = ({ className, style, ...props }) => {
|
|
1674
|
+
const [error, setError] = React13.useState(null);
|
|
1675
|
+
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
1676
|
+
const [date, setDate] = React13.useState(
|
|
1677
|
+
isDateRange(props.value) ? props.value : {
|
|
1678
|
+
from: /* @__PURE__ */ new Date(),
|
|
1679
|
+
to: addDays(/* @__PURE__ */ new Date(), 7)
|
|
1680
|
+
}
|
|
1681
|
+
);
|
|
1682
|
+
React13.useEffect(() => {
|
|
1683
|
+
if (!props.validateOnMount) return;
|
|
1684
|
+
setError(props.errorMessage || null);
|
|
1685
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
1686
|
+
const handleChange = (value) => {
|
|
1687
|
+
setDate(value);
|
|
1688
|
+
if (value) {
|
|
1689
|
+
props.onChange?.(value);
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
return /* @__PURE__ */ jsxs19(Fragment14, { children: [
|
|
1693
|
+
/* @__PURE__ */ jsx35("div", { className, style, children: /* @__PURE__ */ jsxs19(Popover, { children: [
|
|
1694
|
+
/* @__PURE__ */ jsx35(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx35(
|
|
1695
|
+
Button,
|
|
1696
|
+
{
|
|
1697
|
+
id: "date",
|
|
1698
|
+
variant: "outline",
|
|
1699
|
+
className: cn(
|
|
1700
|
+
"w-[300px] justify-start text-left font-normal text-[11px]",
|
|
1701
|
+
!date && "text-muted-foreground"
|
|
1702
|
+
),
|
|
1703
|
+
children: date?.from ? date.to ? /* @__PURE__ */ jsxs19(Fragment14, { children: [
|
|
1704
|
+
format(date.from, "LLL dd, y"),
|
|
1705
|
+
" -",
|
|
1706
|
+
" ",
|
|
1707
|
+
format(date.to, "LLL dd, y")
|
|
1708
|
+
] }) : format(date.from, "LLL dd, y") : /* @__PURE__ */ jsx35("span", { children: "Pick a date range" })
|
|
1709
|
+
}
|
|
1710
|
+
) }),
|
|
1711
|
+
/* @__PURE__ */ jsx35(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx35(
|
|
1712
|
+
Calendar2,
|
|
1713
|
+
{
|
|
1714
|
+
mode: "range",
|
|
1715
|
+
defaultMonth: date?.from,
|
|
1716
|
+
selected: date,
|
|
1717
|
+
onSelect: handleChange,
|
|
1718
|
+
numberOfMonths: 2
|
|
1719
|
+
}
|
|
1720
|
+
) })
|
|
1721
|
+
] }) }),
|
|
1722
|
+
error && /* @__PURE__ */ jsx35("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
1723
|
+
] });
|
|
1586
1724
|
};
|
|
1587
1725
|
var DateRange_default = DateRange;
|
|
1588
1726
|
|
|
@@ -1679,7 +1817,7 @@ function TableCell({ className, ...props }) {
|
|
|
1679
1817
|
}
|
|
1680
1818
|
|
|
1681
1819
|
// src/components/ui/data-table.tsx
|
|
1682
|
-
import { Fragment as
|
|
1820
|
+
import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1683
1821
|
function DataTable({
|
|
1684
1822
|
columns,
|
|
1685
1823
|
rowActions,
|
|
@@ -1711,7 +1849,7 @@ function DataTable({
|
|
|
1711
1849
|
header.getContext()
|
|
1712
1850
|
) }, header.id);
|
|
1713
1851
|
}) }, headerGroup.id)) }),
|
|
1714
|
-
/* @__PURE__ */ jsx37(TableBody, { children: loading ? /* @__PURE__ */ jsx37(TableRow, { children: /* @__PURE__ */ jsx37(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "Loading..." }) }) : /* @__PURE__ */ jsx37(
|
|
1852
|
+
/* @__PURE__ */ jsx37(TableBody, { children: loading ? /* @__PURE__ */ jsx37(TableRow, { children: /* @__PURE__ */ jsx37(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "Loading..." }) }) : /* @__PURE__ */ jsx37(Fragment15, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxs20(
|
|
1715
1853
|
TableRow,
|
|
1716
1854
|
{
|
|
1717
1855
|
"data-state": row.getIsSelected() && "selected",
|
|
@@ -1924,13 +2062,13 @@ var CustomPagination = ({
|
|
|
1924
2062
|
var Pagination_default = CustomPagination;
|
|
1925
2063
|
|
|
1926
2064
|
// src/components/DataDisplay/Table/Table.tsx
|
|
1927
|
-
import { useState as
|
|
2065
|
+
import { useState as useState17 } from "react";
|
|
1928
2066
|
import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1929
2067
|
var Table2 = ({ columns, data, rowActions, className, style, pagination = false, itemsPerPage = 10, onPageChange, loading = false }) => {
|
|
1930
2068
|
const rawColumns = Array.isArray(columns) ? columns : [];
|
|
1931
2069
|
const rawData = Array.isArray(data) ? data : [];
|
|
1932
2070
|
const rawRowActions = Array.isArray(rowActions) ? rowActions : [];
|
|
1933
|
-
const [currentPage, setCurrentPage] =
|
|
2071
|
+
const [currentPage, setCurrentPage] = useState17(1);
|
|
1934
2072
|
const enablePagination = pagination && rawData.length > itemsPerPage;
|
|
1935
2073
|
const handlePageChange = (page) => {
|
|
1936
2074
|
setCurrentPage(page);
|
|
@@ -2226,7 +2364,7 @@ var AvatarFallback = React15.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
2226
2364
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
2227
2365
|
|
|
2228
2366
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
2229
|
-
import { Fragment as
|
|
2367
|
+
import { Fragment as Fragment16, jsx as jsx49, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2230
2368
|
function Navbar({
|
|
2231
2369
|
style,
|
|
2232
2370
|
badgeType,
|
|
@@ -2263,7 +2401,7 @@ function Navbar({
|
|
|
2263
2401
|
/* @__PURE__ */ jsxs29(DropdownMenu, { children: [
|
|
2264
2402
|
/* @__PURE__ */ jsx49(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs29("div", { className: "flex items-center space-x-2", children: [
|
|
2265
2403
|
!isMobileView && showName && /* @__PURE__ */ jsx49("h4", { className: "text-[#000000] text-[13px] font-[500] mb-0", children: "Akbar Sheriff" }),
|
|
2266
|
-
!isMobileView ? /* @__PURE__ */ jsxs29(
|
|
2404
|
+
!isMobileView ? /* @__PURE__ */ jsxs29(Fragment16, { children: [
|
|
2267
2405
|
/* @__PURE__ */ jsx49(Avatar, { className: "cursor-pointer h-8 w-8 text-gray-900", children: profileType === "avatar" ? /* @__PURE__ */ jsx49(
|
|
2268
2406
|
AvatarImage,
|
|
2269
2407
|
{
|
|
@@ -2341,7 +2479,7 @@ var BarChart_default = ChartComponent;
|
|
|
2341
2479
|
|
|
2342
2480
|
// src/components/Chart/PieChart.tsx
|
|
2343
2481
|
import { PieChart, Pie, Cell, ResponsiveContainer as ResponsiveContainer2, Tooltip as Tooltip2, LabelList } from "recharts";
|
|
2344
|
-
import { Fragment as
|
|
2482
|
+
import { Fragment as Fragment17, jsx as jsx51, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2345
2483
|
var DonutChart = ({ className, style, ...props }) => {
|
|
2346
2484
|
const data = Array.isArray(props?.data) ? props.data : [];
|
|
2347
2485
|
const total = data.reduce((sum, d) => sum + d.value, 0);
|
|
@@ -2374,7 +2512,7 @@ var DonutChart = ({ className, style, ...props }) => {
|
|
|
2374
2512
|
const wrapperClass = canvasMode ? forceDesktop ? "flex-row" : "flex-col" : "flex-col md:flex-row";
|
|
2375
2513
|
const renderLegends = () => {
|
|
2376
2514
|
if (!showLegends) return null;
|
|
2377
|
-
return /* @__PURE__ */ jsx51(
|
|
2515
|
+
return /* @__PURE__ */ jsx51(Fragment17, { children: data.map((d) => /* @__PURE__ */ jsxs31(
|
|
2378
2516
|
"div",
|
|
2379
2517
|
{
|
|
2380
2518
|
className: "flex items-center space-x-2 rounded-md border border-gray-200 px-3 py-2 w-[48%] md:w-auto",
|