finance-shared 0.0.11 → 0.0.12

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.
@@ -8645,7 +8645,8 @@ function InfoDialog({
8645
8645
  color: color2 = "inherit",
8646
8646
  isLoading = false,
8647
8647
  t: t2,
8648
- discardText = "Cancel"
8648
+ discardText = "Cancel",
8649
+ buttonDataTestId
8649
8650
  }) {
8650
8651
  const handleClose = (_2, reason) => {
8651
8652
  if (reason && reason === "backdropClick") return;
@@ -8665,7 +8666,15 @@ function InfoDialog({
8665
8666
  }
8666
8667
  ) }),
8667
8668
  /* @__PURE__ */ jsxs(DialogActions$1, { className: "flex flex-col gap-10 pointer-events-auto", children: [
8668
- /* @__PURE__ */ jsx(CustomButton, { onClick: onButtonClick, className: "capitalize", children: isLoading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, className: "button-progress" }) : buttonText }),
8669
+ /* @__PURE__ */ jsx(
8670
+ CustomButton,
8671
+ {
8672
+ onClick: onButtonClick,
8673
+ className: "capitalize",
8674
+ ...buttonDataTestId && { "data-test-id": buttonDataTestId },
8675
+ children: isLoading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, className: "button-progress" }) : buttonText
8676
+ }
8677
+ ),
8669
8678
  /* @__PURE__ */ jsx(
8670
8679
  Typography$1,
8671
8680
  {
@@ -21950,6 +21959,7 @@ const CustomAutocomplete = React.memo(
21950
21959
  getListboxProps = {},
21951
21960
  ref,
21952
21961
  disableClearable = false,
21962
+ optionTestId,
21953
21963
  ...props
21954
21964
  }) => {
21955
21965
  const { t: t2 } = useTranslation("Autocomplete");
@@ -21981,8 +21991,19 @@ const CustomAutocomplete = React.memo(
21981
21991
  }, []);
21982
21992
  const renderOption = React.useCallback((props2, option) => {
21983
21993
  const { key, ...otherProps } = props2;
21984
- return /* @__PURE__ */ createElement("li", { ...otherProps, key: typeof option === "object" ? option.id : option }, typeof option === "object" ? option.label : option);
21985
- }, []);
21994
+ const optionLabel = typeof option === "object" ? option.label : option;
21995
+ const testIdPrefix = optionTestId || "autocomplete-option";
21996
+ const testIdSafeLabel = optionLabel ? String(optionLabel).trim().replace(/\s+/g, "-") : "";
21997
+ return /* @__PURE__ */ createElement(
21998
+ "li",
21999
+ {
22000
+ ...otherProps,
22001
+ key: typeof option === "object" ? option.id : option,
22002
+ "data-test-id": `${testIdPrefix}-${testIdSafeLabel}`
22003
+ },
22004
+ optionLabel
22005
+ );
22006
+ }, [optionTestId]);
21986
22007
  const listboxProps = React.useMemo(() => ({
21987
22008
  onScroll: getListboxProps == null ? void 0 : getListboxProps.onScroll,
21988
22009
  style: {
@@ -27552,6 +27573,7 @@ function useDebounce(callback, delay) {
27552
27573
  const SearchableAutocomplete = memo(
27553
27574
  ({
27554
27575
  dataTestId = "",
27576
+ optionTestId = "autocomplete-option",
27555
27577
  label,
27556
27578
  value,
27557
27579
  variant = "filled",
@@ -27680,6 +27702,7 @@ const SearchableAutocomplete = memo(
27680
27702
  CustomAutocomplete,
27681
27703
  {
27682
27704
  "data-test-id": dataTestId,
27705
+ optionTestId,
27683
27706
  ref,
27684
27707
  label,
27685
27708
  variant,
@@ -27711,6 +27734,7 @@ const MemberAutoComplete = ({
27711
27734
  isTooltipShow = true,
27712
27735
  variant = "filled",
27713
27736
  dataTestId = "",
27737
+ optionTestId = "autocomplete-option",
27714
27738
  tenantId,
27715
27739
  initialSearchTerm = ""
27716
27740
  }) => {
@@ -27754,6 +27778,7 @@ const MemberAutoComplete = ({
27754
27778
  SearchableAutocomplete,
27755
27779
  {
27756
27780
  dataTestId,
27781
+ optionTestId,
27757
27782
  label,
27758
27783
  variant,
27759
27784
  value,
@@ -57395,39 +57420,67 @@ const CustomDatePicker = ({
57395
57420
  required = false,
57396
57421
  locale: locale$12 = locale,
57397
57422
  dataTestId,
57398
- iconColor
57423
+ iconColor,
57424
+ open,
57425
+ anchorEl,
57426
+ onClose,
57427
+ hideTextField = false,
57428
+ applyCustomStyling = false,
57429
+ style: style2
57399
57430
  }) => {
57400
- return /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDateFns, adapterLocale: locale$12, children: /* @__PURE__ */ jsx(
57401
- DatePicker,
57402
- {
57403
- value,
57404
- onChange,
57405
- maxDate,
57406
- minDate,
57407
- disabled,
57408
- className: "w-full",
57409
- sx: {
57410
- "& .MuiSvgIcon-root": {
57411
- color: iconColor
57412
- }
57431
+ const conditionalStyling = applyCustomStyling && style2 ? {
57432
+ ...style2,
57433
+ "& .MuiFilledInput-root": {
57434
+ backgroundColor: "#ffffff"
57435
+ }
57436
+ } : style2 || {};
57437
+ const datePickerProps = {
57438
+ value,
57439
+ onChange,
57440
+ maxDate,
57441
+ minDate,
57442
+ disabled,
57443
+ className: "w-full",
57444
+ sx: {
57445
+ "& .MuiSvgIcon-root": {
57446
+ color: iconColor
57447
+ }
57448
+ },
57449
+ slotProps: {
57450
+ actionBar: {
57451
+ actions: ["clear", "cancel"]
57413
57452
  },
57414
- slotProps: {
57415
- actionBar: {
57416
- actions: ["clear", "cancel"]
57453
+ textField: hideTextField ? { sx: { display: "none" } } : {
57454
+ label,
57455
+ variant,
57456
+ error: !!error,
57457
+ helperText: error || "",
57458
+ required,
57459
+ inputProps: {
57460
+ "data-test-id": dataTestId
57417
57461
  },
57418
- textField: {
57419
- label,
57420
- variant,
57421
- error: !!error,
57422
- helperText: error || "",
57423
- required,
57424
- inputProps: {
57425
- "data-test-id": dataTestId
57426
- }
57427
- }
57462
+ sx: conditionalStyling
57428
57463
  }
57429
57464
  }
57430
- ) });
57465
+ };
57466
+ if (hideTextField) {
57467
+ datePickerProps.open = open;
57468
+ datePickerProps.onClose = onClose;
57469
+ datePickerProps.slotProps.popper = {
57470
+ anchorEl,
57471
+ placement: "top-start"
57472
+ };
57473
+ }
57474
+ return /* @__PURE__ */ jsx(
57475
+ Tooltip,
57476
+ {
57477
+ title: label,
57478
+ arrow: true,
57479
+ TransitionComponent: Zoom,
57480
+ placement: "top-start",
57481
+ children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDateFns, adapterLocale: locale$12, children: /* @__PURE__ */ jsx(DatePicker, { ...datePickerProps }) }) })
57482
+ }
57483
+ );
57431
57484
  };
57432
57485
  const defaultConfig = {
57433
57486
  apiUrl: "",
@@ -57492,6 +57545,7 @@ export {
57492
57545
  PdfDialog,
57493
57546
  PreviewMedia,
57494
57547
  RemarksDialog,
57548
+ SaveButton,
57495
57549
  SearchableAutocomplete,
57496
57550
  TenantAutocomplete,
57497
57551
  addSectionWiseRemark,