@algorithm-shift/design-system 1.3.116 → 1.3.118

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
@@ -1972,6 +1972,9 @@ function useLazyDropdown(config) {
1972
1972
  const parts = path.split(/\./);
1973
1973
  return parts.reduce((acc, key) => acc?.[key], obj);
1974
1974
  }
1975
+ function isEmptyParamValue(value) {
1976
+ return value === "" || value === void 0 || value === null || value === "null" || value === "undefined";
1977
+ }
1975
1978
  const transformToOptions = useCallback2((data) => {
1976
1979
  if (!data || !Array.isArray(data)) return [];
1977
1980
  const cfg = configRef.current;
@@ -1996,7 +1999,7 @@ function useLazyDropdown(config) {
1996
1999
  let hasEmpty = false;
1997
2000
  const baseUrl = urlObj.origin + urlObj.pathname;
1998
2001
  urlObj.searchParams.forEach((value, key) => {
1999
- const isEmpty = value === "" || value === void 0 || value === null;
2002
+ const isEmpty = isEmptyParamValue(value);
2000
2003
  if (isEmpty) {
2001
2004
  hasEmpty = true;
2002
2005
  if (enforceStrict) return;
@@ -2173,7 +2176,9 @@ function useLazyDropdown(config) {
2173
2176
  );
2174
2177
  const queryParams = {};
2175
2178
  urlObj.searchParams.forEach((value, key) => {
2176
- queryParams[key] = value;
2179
+ if (!isEmptyParamValue(value)) {
2180
+ queryParams[key] = value;
2181
+ }
2177
2182
  });
2178
2183
  const body = {
2179
2184
  ...queryParams,
@@ -2525,44 +2530,38 @@ var SwitchToggle = ({ className, style, ...props }) => {
2525
2530
  var SwitchToggle_default = SwitchToggle;
2526
2531
 
2527
2532
  // src/components/Inputs/PhoneInput/PhoneInput.tsx
2528
- import { useEffect as useEffect18 } from "react";
2533
+ import { useEffect as useEffect18, useRef as useRef6 } from "react";
2529
2534
  import { PhoneInput as PhoneInputField } from "react-international-phone";
2530
2535
  import "react-international-phone/style.css";
2531
2536
  import { Fragment as Fragment14, jsx as jsx40, jsxs as jsxs22 } from "react/jsx-runtime";
2532
- var ensureIndiaCode = (val) => {
2533
- if (!val) return "";
2534
- const trimmed = val.trim();
2535
- if (trimmed.startsWith("+")) return trimmed;
2536
- const local = trimmed.replace(/^0+/, "");
2537
- return `+91${local}`;
2538
- };
2539
2537
  var PhoneInput = ({ className, style, ...props }) => {
2538
+ const ref = useRef6(null);
2540
2539
  const placeholder = props.placeholder ?? "Enter phone number";
2541
2540
  const isEditable = props.isEditable ?? true;
2542
2541
  const isDisabled = props.isDisabled ?? false;
2543
2542
  useEffect18(() => {
2544
2543
  if (props.value !== void 0) {
2545
- const normalized = ensureIndiaCode(props.value);
2546
- handleChange?.(normalized);
2544
+ handleChange?.(props.value, ref.current?.state);
2547
2545
  }
2548
2546
  }, []);
2549
- const handleChange = (val) => {
2550
- const normalized = ensureIndiaCode(val);
2547
+ const handleChange = (value, meta) => {
2551
2548
  const event = {
2552
2549
  target: {
2553
2550
  name: props.name || "",
2554
- value: normalized
2551
+ value
2555
2552
  }
2556
2553
  };
2557
2554
  props.onChange?.(event, props.name || "");
2555
+ props.getPhoneState?.(meta);
2558
2556
  };
2559
2557
  return /* @__PURE__ */ jsxs22(Fragment14, { children: [
2560
2558
  /* @__PURE__ */ jsx40(
2561
2559
  PhoneInputField,
2562
2560
  {
2561
+ ref,
2563
2562
  defaultCountry: "in",
2564
2563
  name: props.name,
2565
- value: props.value ? ensureIndiaCode(props.value) : "",
2564
+ value: props.value ? props.value : "",
2566
2565
  className: cn(
2567
2566
  "rounded-md border-1",
2568
2567
  className,
@@ -3360,7 +3359,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
3360
3359
  var TextInputGroup_default = TextInputGroup;
3361
3360
 
3362
3361
  // src/components/Inputs/Multiselect/MultiSelect.tsx
3363
- import { useState as useState10, useRef as useRef7, useEffect as useEffect25, useMemo as useMemo6 } from "react";
3362
+ import { useState as useState10, useRef as useRef8, useEffect as useEffect25, useMemo as useMemo6 } from "react";
3364
3363
  import { XIcon, XSquareIcon as XSquareIcon3 } from "lucide-react";
3365
3364
  import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs28 } from "react/jsx-runtime";
3366
3365
  function LazyMultiSelectDropdown({
@@ -3383,8 +3382,8 @@ function LazyMultiSelectDropdown({
3383
3382
  }) {
3384
3383
  const [isOpen, setIsOpen] = useState10(false);
3385
3384
  const [searchTerm, setSearchTerm] = useState10("");
3386
- const dropdownRef = useRef7(null);
3387
- const observerTarget = useRef7(null);
3385
+ const dropdownRef = useRef8(null);
3386
+ const observerTarget = useRef8(null);
3388
3387
  const ensureUnique = (arr) => {
3389
3388
  return Array.from(new Set(arr));
3390
3389
  };
@@ -5608,7 +5607,7 @@ var StagesComponent = ({
5608
5607
  const lastStage = stages && stages.length > 0 ? stages[stages.length - 1][dataKey] : null;
5609
5608
  const isMobile = canvasMode === "mobile";
5610
5609
  const onStageClick = (stageKey) => {
5611
- if (!stageKey || stageKey === activeStage || activeStage === lastStage) return;
5610
+ if (!stageKey || stageKey === activeStage) return;
5612
5611
  setActiveStage(stageKey);
5613
5612
  if (triggerOnClick) {
5614
5613
  onStageChange?.(stageKey);