@algorithm-shift/design-system 1.2.32 → 1.2.34
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 +222 -84
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +234 -96
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -691,7 +691,6 @@ function Textarea({ className, ...props }) {
|
|
|
691
691
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
692
692
|
var Textarea2 = ({ className, style, ...props }) => {
|
|
693
693
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
694
|
-
const isRequired = props.isRequired ?? false;
|
|
695
694
|
const isEditable = props.isEditable ?? true;
|
|
696
695
|
const isDisabled = props.isDisabled ?? false;
|
|
697
696
|
const isReadonly = props.isReadonly ?? false;
|
|
@@ -720,8 +719,7 @@ var Textarea2 = ({ className, style, ...props }) => {
|
|
|
720
719
|
placeholder,
|
|
721
720
|
onChange: handleChange,
|
|
722
721
|
disabled: isDisabled || !isEditable,
|
|
723
|
-
readOnly: isReadonly
|
|
724
|
-
required: isRequired
|
|
722
|
+
readOnly: isReadonly
|
|
725
723
|
}
|
|
726
724
|
),
|
|
727
725
|
error && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
@@ -774,6 +772,9 @@ var UrlInput = ({ className, style, ...props }) => {
|
|
|
774
772
|
};
|
|
775
773
|
var UrlInput_default = UrlInput;
|
|
776
774
|
|
|
775
|
+
// src/components/Inputs/Checkbox/Checkbox.tsx
|
|
776
|
+
var import_react5 = require("react");
|
|
777
|
+
|
|
777
778
|
// src/components/ui/checkbox.tsx
|
|
778
779
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
779
780
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
@@ -825,14 +826,38 @@ function Label({
|
|
|
825
826
|
// src/components/Inputs/Checkbox/Checkbox.tsx
|
|
826
827
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
827
828
|
var CheckboxInput = ({ className, style, ...props }) => {
|
|
829
|
+
const isEditable = props.isEditable ?? true;
|
|
830
|
+
const isDisabled = props.isDisabled ?? false;
|
|
828
831
|
const text = props.text ? props.text : "Subscribe";
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
832
|
+
const [error, setError] = (0, import_react5.useState)(null);
|
|
833
|
+
(0, import_react5.useEffect)(() => {
|
|
834
|
+
if (!props.validateOnMount) return;
|
|
835
|
+
setError(props.errorMessage || null);
|
|
836
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
837
|
+
const handleChange = (value) => {
|
|
838
|
+
props.onChange?.(value);
|
|
839
|
+
};
|
|
840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
843
|
+
Checkbox,
|
|
844
|
+
{
|
|
845
|
+
id: props.name || "checkbox",
|
|
846
|
+
checked: !!props.value,
|
|
847
|
+
onCheckedChange: handleChange,
|
|
848
|
+
disabled: !isEditable || isDisabled
|
|
849
|
+
}
|
|
850
|
+
),
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Label, { htmlFor: props.name || "checkbox", children: text })
|
|
852
|
+
] }) }),
|
|
853
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
854
|
+
] });
|
|
833
855
|
};
|
|
834
856
|
var Checkbox_default = CheckboxInput;
|
|
835
857
|
|
|
858
|
+
// src/components/Inputs/RadioInput/RadioInput.tsx
|
|
859
|
+
var import_react6 = require("react");
|
|
860
|
+
|
|
836
861
|
// src/components/ui/radio-group.tsx
|
|
837
862
|
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"));
|
|
838
863
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
@@ -876,39 +901,108 @@ function RadioGroupItem({
|
|
|
876
901
|
|
|
877
902
|
// src/components/Inputs/RadioInput/RadioInput.tsx
|
|
878
903
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
879
|
-
var RadioInput = ({
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
904
|
+
var RadioInput = ({
|
|
905
|
+
className,
|
|
906
|
+
style,
|
|
907
|
+
defaultValue,
|
|
908
|
+
onChange,
|
|
909
|
+
data = [],
|
|
910
|
+
dataKey,
|
|
911
|
+
dataLabel,
|
|
912
|
+
...props
|
|
913
|
+
}) => {
|
|
914
|
+
const [error, setError] = (0, import_react6.useState)(null);
|
|
915
|
+
(0, import_react6.useEffect)(() => {
|
|
916
|
+
if (!props.validateOnMount) return;
|
|
917
|
+
setError(props.errorMessage || null);
|
|
918
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
919
|
+
const options = (data || []).map((item) => ({
|
|
920
|
+
value: item[dataKey || "value"],
|
|
921
|
+
label: item[dataLabel || "label"]
|
|
884
922
|
}));
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
923
|
+
const handleChange = (value) => {
|
|
924
|
+
onChange?.(value);
|
|
925
|
+
};
|
|
926
|
+
const resolvedDefaultValue = (typeof defaultValue === "string" ? defaultValue : void 0) ?? options[0]?.value;
|
|
927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
928
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
929
|
+
RadioGroup,
|
|
930
|
+
{
|
|
931
|
+
defaultValue: resolvedDefaultValue,
|
|
932
|
+
onValueChange: handleChange,
|
|
933
|
+
children: [
|
|
934
|
+
options.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-sm text-gray-500", children: "No options available" }),
|
|
935
|
+
options.map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RadioGroupItem, { value: item.value, id: `radio-${item.value}` }),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Label, { htmlFor: `radio-${item.value}`, children: item.label })
|
|
938
|
+
] }, item.value))
|
|
939
|
+
]
|
|
940
|
+
}
|
|
941
|
+
) }),
|
|
942
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
943
|
+
] });
|
|
889
944
|
};
|
|
890
945
|
var RadioInput_default = RadioInput;
|
|
891
946
|
|
|
892
947
|
// src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx
|
|
948
|
+
var import_react7 = require("react");
|
|
893
949
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
894
|
-
var MultiCheckbox = ({
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
950
|
+
var MultiCheckbox = ({
|
|
951
|
+
className,
|
|
952
|
+
style,
|
|
953
|
+
data = [],
|
|
954
|
+
dataKey = "value",
|
|
955
|
+
dataLabel = "label",
|
|
956
|
+
value: propValue = {},
|
|
957
|
+
onChange,
|
|
958
|
+
isEditable = true,
|
|
959
|
+
isDisabled = false
|
|
960
|
+
}) => {
|
|
961
|
+
const [value, setValue] = (0, import_react7.useState)(propValue);
|
|
962
|
+
const options = (data || []).map((item) => ({
|
|
963
|
+
value: item[dataKey || "value"],
|
|
964
|
+
label: item[dataLabel || "label"]
|
|
899
965
|
}));
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
966
|
+
const handleChange = (0, import_react7.useCallback)(
|
|
967
|
+
(key, checked) => {
|
|
968
|
+
setValue((prev) => {
|
|
969
|
+
const newValue = { ...prev, [key]: checked };
|
|
970
|
+
onChange?.(newValue);
|
|
971
|
+
return newValue;
|
|
972
|
+
});
|
|
973
|
+
},
|
|
974
|
+
[onChange]
|
|
975
|
+
);
|
|
976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
977
|
+
"div",
|
|
978
|
+
{
|
|
979
|
+
className: cn("flex flex-col gap-3", className),
|
|
980
|
+
style,
|
|
981
|
+
children: [
|
|
982
|
+
options.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm text-gray-500", children: "No options available." }),
|
|
983
|
+
options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
985
|
+
Checkbox,
|
|
986
|
+
{
|
|
987
|
+
id: opt.value,
|
|
988
|
+
checked: !!value[opt.value],
|
|
989
|
+
onCheckedChange: (checked) => handleChange(opt.value, checked === true),
|
|
990
|
+
disabled: !isEditable || isDisabled
|
|
991
|
+
}
|
|
992
|
+
),
|
|
993
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Label, { htmlFor: opt.value, children: opt.label })
|
|
994
|
+
] }, opt.value))
|
|
995
|
+
]
|
|
996
|
+
}
|
|
997
|
+
);
|
|
904
998
|
};
|
|
905
999
|
var MultiCheckbox_default = MultiCheckbox;
|
|
906
1000
|
|
|
907
1001
|
// src/components/Inputs/RichText/RichText.tsx
|
|
908
|
-
var
|
|
1002
|
+
var import_react9 = require("react");
|
|
909
1003
|
|
|
910
1004
|
// src/components/Global/TinyMceEditor.tsx
|
|
911
|
-
var
|
|
1005
|
+
var import_react8 = require("react");
|
|
912
1006
|
var import_tinymce_react = require("@tinymce/tinymce-react");
|
|
913
1007
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
914
1008
|
function MyEditor({
|
|
@@ -916,7 +1010,7 @@ function MyEditor({
|
|
|
916
1010
|
onChange,
|
|
917
1011
|
isDefault
|
|
918
1012
|
}) {
|
|
919
|
-
const editorRef = (0,
|
|
1013
|
+
const editorRef = (0, import_react8.useRef)(null);
|
|
920
1014
|
function stripOuterP(html) {
|
|
921
1015
|
const trimmedHtml = html.trim();
|
|
922
1016
|
if (!trimmedHtml) return "";
|
|
@@ -928,7 +1022,7 @@ function MyEditor({
|
|
|
928
1022
|
}
|
|
929
1023
|
return trimmedHtml;
|
|
930
1024
|
}
|
|
931
|
-
const isDefaultToolbar = (0,
|
|
1025
|
+
const isDefaultToolbar = (0, import_react8.useMemo)(() => {
|
|
932
1026
|
let toolbar = "undo redo | formatselect | bold italic forecolor";
|
|
933
1027
|
if (isDefault) {
|
|
934
1028
|
toolbar = "undo redo | blocks | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help";
|
|
@@ -981,8 +1075,8 @@ function MyEditor({
|
|
|
981
1075
|
// src/components/Inputs/RichText/RichText.tsx
|
|
982
1076
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
983
1077
|
function RichText({ className, style, ...props }) {
|
|
984
|
-
const [error, setError] = (0,
|
|
985
|
-
(0,
|
|
1078
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
1079
|
+
(0, import_react9.useEffect)(() => {
|
|
986
1080
|
if (!props.validateOnMount) return;
|
|
987
1081
|
setError(props.errorMessage || null);
|
|
988
1082
|
}, [props.errorMessage, props.validateOnMount]);
|
|
@@ -1147,10 +1241,10 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
1147
1241
|
const handleChange = (value) => {
|
|
1148
1242
|
props.onChange?.(value);
|
|
1149
1243
|
};
|
|
1150
|
-
const dataKey = props.dataKey || "
|
|
1244
|
+
const dataKey = props.dataKey || "value";
|
|
1151
1245
|
const dataLabel = props.dataLabel || "label";
|
|
1152
1246
|
const options = list.map((item) => ({
|
|
1153
|
-
|
|
1247
|
+
value: item[dataKey],
|
|
1154
1248
|
label: item[dataLabel]
|
|
1155
1249
|
}));
|
|
1156
1250
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
@@ -1168,13 +1262,16 @@ var Dropdown = ({ className, style, ...props }) => {
|
|
|
1168
1262
|
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectValue, { placeholder })
|
|
1169
1263
|
}
|
|
1170
1264
|
),
|
|
1171
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectContent, { children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectItem, { value: opt.
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectContent, { children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })
|
|
1172
1266
|
] }),
|
|
1173
1267
|
error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
1174
1268
|
] });
|
|
1175
1269
|
};
|
|
1176
1270
|
var Dropdown_default = Dropdown;
|
|
1177
1271
|
|
|
1272
|
+
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
1273
|
+
var import_react10 = require("react");
|
|
1274
|
+
|
|
1178
1275
|
// src/components/ui/switch.tsx
|
|
1179
1276
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
1180
1277
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
@@ -1207,11 +1304,31 @@ function Switch({
|
|
|
1207
1304
|
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
1208
1305
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1209
1306
|
var SwitchToggle = ({ className, style, ...props }) => {
|
|
1210
|
-
const
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1307
|
+
const isEditable = props.isEditable ?? true;
|
|
1308
|
+
const isDisabled = props.isDisabled ?? false;
|
|
1309
|
+
const [error, setError] = (0, import_react10.useState)(null);
|
|
1310
|
+
(0, import_react10.useEffect)(() => {
|
|
1311
|
+
if (!props.validateOnMount) return;
|
|
1312
|
+
setError(props.errorMessage || null);
|
|
1313
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
1314
|
+
const handleChange = (value) => {
|
|
1315
|
+
props.onChange?.(value);
|
|
1316
|
+
};
|
|
1317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
1318
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center space-x-2 mb-2", children: [
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1320
|
+
Switch,
|
|
1321
|
+
{
|
|
1322
|
+
id: props.name || "switch",
|
|
1323
|
+
checked: !!props.value,
|
|
1324
|
+
onCheckedChange: handleChange,
|
|
1325
|
+
disabled: isDisabled || !isEditable
|
|
1326
|
+
}
|
|
1327
|
+
),
|
|
1328
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Label, { htmlFor: props.name || "switch", children: props.text })
|
|
1329
|
+
] }) }),
|
|
1330
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
1331
|
+
] });
|
|
1215
1332
|
};
|
|
1216
1333
|
var SwitchToggle_default = SwitchToggle;
|
|
1217
1334
|
|
|
@@ -1303,12 +1420,12 @@ var SearchInput = ({ className, style, ...props }) => {
|
|
|
1303
1420
|
var SearchInput_default = SearchInput;
|
|
1304
1421
|
|
|
1305
1422
|
// src/components/Inputs/FileInput/FileInput.tsx
|
|
1306
|
-
var
|
|
1423
|
+
var import_react11 = require("react");
|
|
1307
1424
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1308
1425
|
var FileInput = ({ className, style, ...props }) => {
|
|
1309
1426
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
1310
|
-
const [error, setError] = (0,
|
|
1311
|
-
(0,
|
|
1427
|
+
const [error, setError] = (0, import_react11.useState)(null);
|
|
1428
|
+
(0, import_react11.useEffect)(() => {
|
|
1312
1429
|
if (!props.validateOnMount) return;
|
|
1313
1430
|
setError(props.errorMessage || null);
|
|
1314
1431
|
}, [props.errorMessage, props.validateOnMount]);
|
|
@@ -1338,7 +1455,7 @@ var FileInput = ({ className, style, ...props }) => {
|
|
|
1338
1455
|
var FileInput_default = FileInput;
|
|
1339
1456
|
|
|
1340
1457
|
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
1341
|
-
var
|
|
1458
|
+
var import_react12 = __toESM(require("react"));
|
|
1342
1459
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1343
1460
|
function DatePicker({ className, style, ...props }) {
|
|
1344
1461
|
const placeholder = props.placeholder ?? "Placeholder text";
|
|
@@ -1350,7 +1467,7 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1350
1467
|
const isDisabled = props.isDisabled ?? false;
|
|
1351
1468
|
const isReadonly = props.isReadonly ?? false;
|
|
1352
1469
|
const isAutocomplete = props.isAutocomplete ?? false;
|
|
1353
|
-
const [error, setError] =
|
|
1470
|
+
const [error, setError] = import_react12.default.useState(null);
|
|
1354
1471
|
const resolveDate = (option, customOption) => {
|
|
1355
1472
|
if (!option) return void 0;
|
|
1356
1473
|
switch (option) {
|
|
@@ -1365,7 +1482,7 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1365
1482
|
};
|
|
1366
1483
|
const minDate = resolveDate(minimumDate, customMinimumDate);
|
|
1367
1484
|
const maxDate = resolveDate(maximumDate, customMaximumDate);
|
|
1368
|
-
(0,
|
|
1485
|
+
(0, import_react12.useEffect)(() => {
|
|
1369
1486
|
if (!props.validateOnMount) return;
|
|
1370
1487
|
setError(props.errorMessage || null);
|
|
1371
1488
|
}, [props.errorMessage, props.validateOnMount]);
|
|
@@ -1385,7 +1502,11 @@ function DatePicker({ className, style, ...props }) {
|
|
|
1385
1502
|
disabled: isDisabled || !isEditable,
|
|
1386
1503
|
name: props.name,
|
|
1387
1504
|
value: props.value,
|
|
1388
|
-
className: cn(
|
|
1505
|
+
className: cn(
|
|
1506
|
+
className,
|
|
1507
|
+
error ? "border-red-500" : "",
|
|
1508
|
+
"appearance-auto"
|
|
1509
|
+
),
|
|
1389
1510
|
style: {
|
|
1390
1511
|
...style,
|
|
1391
1512
|
borderColor: error ? "#f87171" : style?.borderColor
|
|
@@ -1622,40 +1743,57 @@ function PopoverContent({
|
|
|
1622
1743
|
|
|
1623
1744
|
// src/components/Inputs/DateRange/DateRange.tsx
|
|
1624
1745
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1625
|
-
var DateRange = ({ className, style }) => {
|
|
1626
|
-
const [
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1746
|
+
var DateRange = ({ className, style, ...props }) => {
|
|
1747
|
+
const [error, setError] = React13.useState(null);
|
|
1748
|
+
const isDateRange = (val) => !!val && val.from instanceof Date;
|
|
1749
|
+
const [date, setDate] = React13.useState(
|
|
1750
|
+
isDateRange(props.value) ? props.value : {
|
|
1751
|
+
from: /* @__PURE__ */ new Date(),
|
|
1752
|
+
to: (0, import_date_fns.addDays)(/* @__PURE__ */ new Date(), 7)
|
|
1753
|
+
}
|
|
1754
|
+
);
|
|
1755
|
+
React13.useEffect(() => {
|
|
1756
|
+
if (!props.validateOnMount) return;
|
|
1757
|
+
setError(props.errorMessage || null);
|
|
1758
|
+
}, [props.errorMessage, props.validateOnMount]);
|
|
1759
|
+
const handleChange = (value) => {
|
|
1760
|
+
setDate(value);
|
|
1761
|
+
if (value) {
|
|
1762
|
+
props.onChange?.(value);
|
|
1763
|
+
}
|
|
1764
|
+
};
|
|
1765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
1766
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Popover, { children: [
|
|
1767
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1768
|
+
Button,
|
|
1769
|
+
{
|
|
1770
|
+
id: "date",
|
|
1771
|
+
variant: "outline",
|
|
1772
|
+
className: cn(
|
|
1773
|
+
"w-[300px] justify-start text-left font-normal text-[11px]",
|
|
1774
|
+
!date && "text-muted-foreground"
|
|
1775
|
+
),
|
|
1776
|
+
children: date?.from ? date.to ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
1777
|
+
(0, import_date_fns.format)(date.from, "LLL dd, y"),
|
|
1778
|
+
" -",
|
|
1779
|
+
" ",
|
|
1780
|
+
(0, import_date_fns.format)(date.to, "LLL dd, y")
|
|
1781
|
+
] }) : (0, import_date_fns.format)(date.from, "LLL dd, y") : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Pick a date range" })
|
|
1782
|
+
}
|
|
1783
|
+
) }),
|
|
1784
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1785
|
+
Calendar2,
|
|
1786
|
+
{
|
|
1787
|
+
mode: "range",
|
|
1788
|
+
defaultMonth: date?.from,
|
|
1789
|
+
selected: date,
|
|
1790
|
+
onSelect: handleChange,
|
|
1791
|
+
numberOfMonths: 2
|
|
1792
|
+
}
|
|
1793
|
+
) })
|
|
1794
|
+
] }) }),
|
|
1795
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
1796
|
+
] });
|
|
1659
1797
|
};
|
|
1660
1798
|
var DateRange_default = DateRange;
|
|
1661
1799
|
|
|
@@ -1993,13 +2131,13 @@ var CustomPagination = ({
|
|
|
1993
2131
|
var Pagination_default = CustomPagination;
|
|
1994
2132
|
|
|
1995
2133
|
// src/components/DataDisplay/Table/Table.tsx
|
|
1996
|
-
var
|
|
2134
|
+
var import_react13 = require("react");
|
|
1997
2135
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1998
2136
|
var Table2 = ({ columns, data, rowActions, className, style, pagination = false, itemsPerPage = 10, onPageChange, loading = false }) => {
|
|
1999
2137
|
const rawColumns = Array.isArray(columns) ? columns : [];
|
|
2000
2138
|
const rawData = Array.isArray(data) ? data : [];
|
|
2001
2139
|
const rawRowActions = Array.isArray(rowActions) ? rowActions : [];
|
|
2002
|
-
const [currentPage, setCurrentPage] = (0,
|
|
2140
|
+
const [currentPage, setCurrentPage] = (0, import_react13.useState)(1);
|
|
2003
2141
|
const enablePagination = pagination && rawData.length > itemsPerPage;
|
|
2004
2142
|
const handlePageChange = (page) => {
|
|
2005
2143
|
setCurrentPage(page);
|
|
@@ -2164,12 +2302,12 @@ var Tabs = ({ tabs, className, style, pathname, LinkComponent }) => {
|
|
|
2164
2302
|
var Tabs_default = Tabs;
|
|
2165
2303
|
|
|
2166
2304
|
// src/components/Navigation/Stages/Stages.tsx
|
|
2167
|
-
var
|
|
2305
|
+
var import_react14 = __toESM(require("react"));
|
|
2168
2306
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2169
2307
|
var StagesComponent = ({ stages, isShowBtn, buttonText, className, style }) => {
|
|
2170
2308
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between bg-gray-50 p-2 rounded-lg border border-gray-200 w-full", children: [
|
|
2171
2309
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { className: "p-2 hover:bg-gray-100 rounded", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("svg", { className: "w-4 h-4 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }) }),
|
|
2172
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex items-center flex-1 px-2", children: stages?.length > 0 && stages?.map((stage, index) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
2310
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex items-center flex-1 px-2", children: stages?.length > 0 && stages?.map((stage, index) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react14.default.Fragment, { children: [
|
|
2173
2311
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2174
2312
|
"button",
|
|
2175
2313
|
{
|