@algorithm-shift/design-system 1.3.118 → 1.3.120

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.mjs CHANGED
@@ -2534,6 +2534,13 @@ import { useEffect as useEffect18, useRef as useRef6 } from "react";
2534
2534
  import { PhoneInput as PhoneInputField } from "react-international-phone";
2535
2535
  import "react-international-phone/style.css";
2536
2536
  import { Fragment as Fragment14, jsx as jsx40, jsxs as jsxs22 } from "react/jsx-runtime";
2537
+ var ensureDialcode = (val) => {
2538
+ if (!val) return "";
2539
+ const trimmed = val.trim();
2540
+ if (trimmed.startsWith("+")) return trimmed;
2541
+ const local = trimmed.replace(/^0+/, "");
2542
+ return `+91${local}`;
2543
+ };
2537
2544
  var PhoneInput = ({ className, style, ...props }) => {
2538
2545
  const ref = useRef6(null);
2539
2546
  const placeholder = props.placeholder ?? "Enter phone number";
@@ -2541,7 +2548,7 @@ var PhoneInput = ({ className, style, ...props }) => {
2541
2548
  const isDisabled = props.isDisabled ?? false;
2542
2549
  useEffect18(() => {
2543
2550
  if (props.value !== void 0) {
2544
- handleChange?.(props.value, ref.current?.state);
2551
+ handleChange?.(ensureDialcode(props.value), ref.current?.state);
2545
2552
  }
2546
2553
  }, []);
2547
2554
  const handleChange = (value, meta) => {
@@ -2559,9 +2566,9 @@ var PhoneInput = ({ className, style, ...props }) => {
2559
2566
  PhoneInputField,
2560
2567
  {
2561
2568
  ref,
2562
- defaultCountry: "in",
2569
+ defaultCountry: props.defaultCountry || "in",
2563
2570
  name: props.name,
2564
- value: props.value ? props.value : "",
2571
+ value: props.value ? ensureDialcode(props.value) : "",
2565
2572
  className: cn(
2566
2573
  "rounded-md border-1",
2567
2574
  className,
@@ -3367,7 +3374,6 @@ function LazyMultiSelectDropdown({
3367
3374
  onChange,
3368
3375
  placeholder,
3369
3376
  className,
3370
- id,
3371
3377
  disabled,
3372
3378
  readOnly,
3373
3379
  source,
@@ -3433,10 +3439,10 @@ function LazyMultiSelectDropdown({
3433
3439
  }
3434
3440
  };
3435
3441
  const selectedOptions = useMemo6(() => {
3436
- return normalizedValue.map((id2) => {
3437
- const fromLazy = lazyOptions.find((opt) => opt.value === id2);
3442
+ return normalizedValue.map((id) => {
3443
+ const fromLazy = lazyOptions.find((opt) => opt.value === id);
3438
3444
  if (fromLazy) return fromLazy;
3439
- return { value: id2, label: id2 };
3445
+ return { value: id, label: id };
3440
3446
  });
3441
3447
  }, [normalizedValue, lazyOptions]);
3442
3448
  useEffect25(() => {
@@ -3471,11 +3477,11 @@ function LazyMultiSelectDropdown({
3471
3477
  } else {
3472
3478
  updated = ensureUnique([...normalizedValue, val]);
3473
3479
  }
3474
- onChange?.(convertOutput(updated), id);
3480
+ onChange?.(convertOutput(updated), props.name ?? "");
3475
3481
  };
3476
3482
  const removeTag = (val) => {
3477
3483
  const updated = normalizedValue.filter((v) => v !== val);
3478
- onChange?.(convertOutput(updated), id);
3484
+ onChange?.(convertOutput(updated), props.name ?? "");
3479
3485
  };
3480
3486
  const handleFocus = () => {
3481
3487
  if (!disabled) {