@lax-wp/design-system 0.8.18 → 0.8.20

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.es.js CHANGED
@@ -12067,8 +12067,12 @@ const FM = ({
12067
12067
  disabled: i = !1,
12068
12068
  errorMessage: s
12069
12069
  }) => {
12070
- const [o, a] = R(!1), c = ce(!1), d = (u) => {
12071
- u.stopPropagation(), e?.("");
12070
+ const [o, a] = R(!1), c = ce(!1), d = ce(null), u = ce(!1);
12071
+ ee(() => {
12072
+ u.current && !o && d.current?.focus(), u.current = o;
12073
+ }, [o]);
12074
+ const h = (f) => {
12075
+ f.stopPropagation(), e?.("");
12072
12076
  };
12073
12077
  return /* @__PURE__ */ l(
12074
12078
  aa,
@@ -12076,10 +12080,10 @@ const FM = ({
12076
12080
  arrow: !1,
12077
12081
  placement: "bottom",
12078
12082
  trigger: "click",
12079
- getPopupContainer: (u) => u?.parentElement || document.body,
12083
+ getPopupContainer: (f) => f?.parentElement || document.body,
12080
12084
  open: o,
12081
- onOpenChange: (u) => {
12082
- u ? (c.current && a(!0), c.current = !1) : a(!1);
12085
+ onOpenChange: (f) => {
12086
+ f ? (c.current && a(!0), c.current = !1) : a(!1);
12083
12087
  },
12084
12088
  content: /* @__PURE__ */ l(j7, { onChange: e, selectedIcon: A, setOpen: a }),
12085
12089
  children: /* @__PURE__ */ k("div", { className: "flex flex-col gap-1", children: [
@@ -12087,19 +12091,20 @@ const FM = ({
12087
12091
  /* @__PURE__ */ k(
12088
12092
  "button",
12089
12093
  {
12094
+ ref: d,
12090
12095
  type: "button",
12091
12096
  id: `btn-icon-picker-icon-${A ? "selected" : "unselected"}`,
12092
12097
  className: `min-w-[83px] py-1.5 px-3 rounded-md border ${i ? "cursor-not-allowed opacity-60 bg-neutral-50 dark:bg-black-800" : "bg-white dark:bg-black-800"} ${s ? "border-red-500" : "focus:border-primary-200 "} flex items-center justify-between gap-2`,
12093
12098
  disabled: i,
12094
- onClick: (u) => {
12099
+ onClick: (f) => {
12095
12100
  if (i) {
12096
- u.preventDefault(), u.stopPropagation();
12101
+ f.preventDefault(), f.stopPropagation();
12097
12102
  return;
12098
12103
  }
12099
- u.detail > 0 && (c.current = !0);
12104
+ f.detail > 0 && (c.current = !0);
12100
12105
  },
12101
- onKeyDown: (u) => {
12102
- u.key === "Enter" && (u.preventDefault(), o || u.currentTarget.closest("form")?.querySelector('button[type="submit"]')?.click());
12106
+ onKeyDown: (f) => {
12107
+ f.key === "Enter" && (f.preventDefault(), o || f.currentTarget.closest("form")?.querySelector('button[type="submit"]')?.click());
12103
12108
  },
12104
12109
  children: [
12105
12110
  A ? /* @__PURE__ */ l(V0, { iconName: A, sx: { width: 20, height: 20 }, className: "text-neutral-900 dark:text-white" }) : /* @__PURE__ */ l(
@@ -12116,7 +12121,7 @@ const FM = ({
12116
12121
  {
12117
12122
  sx: { width: 20, height: 20 },
12118
12123
  className: "hover:bg-neutral-100 dark:hover:bg-black-800 rounded-full transition-colors cursor-pointer text-neutral-400 dark:text-neutral-500",
12119
- onClick: d
12124
+ onClick: h
12120
12125
  }
12121
12126
  ) : null
12122
12127
  ]
@@ -12688,30 +12693,30 @@ const KM = ({
12688
12693
  const Z = typeof t == "string" && Y7(t);
12689
12694
  if (p && typeof t == "object")
12690
12695
  return t;
12691
- if (t || n === "boolean" && t === 0 || n === "currency" && Number(t) >= 0) {
12696
+ if (t || n?.toLowerCase() === "boolean" && t === 0 || n?.toLowerCase() === "currency" && Number(t) >= 0) {
12692
12697
  if ((t === !0 || t === "True") && !m)
12693
12698
  return "Yes";
12694
12699
  if ((t === !1 || t === "False") && !m)
12695
12700
  return "No";
12696
- if (n === "url")
12701
+ if (n?.toLowerCase() === "url")
12697
12702
  return /* @__PURE__ */ l("a", { href: t, className: "text-primary-600 truncate", children: t });
12698
- if (n === "boolean")
12703
+ if (n?.toLowerCase() === "boolean")
12699
12704
  return sh(t);
12700
- if (n === "currency")
12705
+ if (n?.toLowerCase() === "currency")
12701
12706
  return Ga(t, o?.currency_code) || "-";
12702
- if (n === "datetime") {
12707
+ if (n?.toLowerCase() === "datetime") {
12703
12708
  const re = typeof t == "string" && t.includes("Z") ? t.replace(/\.000Z$/, "Z") : t;
12704
12709
  return ks(re, {
12705
12710
  skipTimezone: !1,
12706
12711
  withTime: !0
12707
12712
  });
12708
- } else if (n === "date" || Z) {
12713
+ } else if (n?.toLowerCase() === "date" || Z) {
12709
12714
  const re = typeof t == "string" && t.includes("Z") ? t.replace(/\.000Z$/, "Z") : t;
12710
12715
  return ks(re, {
12711
12716
  skipTimezone: !0,
12712
12717
  withTime: !1
12713
12718
  });
12714
- } else return n === "percentage" ? `${t}%` : typeof t == "string" && t.length > 100 ? /* @__PURE__ */ k("p", { children: [
12719
+ } else return n?.toLowerCase() === "percentage" ? `${t}%` : typeof t == "string" && t.length > 100 ? /* @__PURE__ */ k("p", { children: [
12715
12720
  t.slice(0, N ? 100 : t.length),
12716
12721
  N ? "... " : " ",
12717
12722
  /* @__PURE__ */ l(
@@ -12818,7 +12823,7 @@ const KM = ({
12818
12823
  /* @__PURE__ */ l("span", { className: "line-through", children: h }),
12819
12824
  /* @__PURE__ */ l("span", { children: K() })
12820
12825
  ] }) : c || u ? /* @__PURE__ */ l("mark", { className: q("rounded-md py-0.5 px-1", Ae()), children: K() }) : K(),
12821
- n === "currency" && y !== 0 && y !== void 0 && y !== null && /* @__PURE__ */ k(
12826
+ n?.toLowerCase() === "currency" && y !== 0 && y !== void 0 && y !== null && /* @__PURE__ */ k(
12822
12827
  rt.span,
12823
12828
  {
12824
12829
  initial: { opacity: 0, y: 2 },
@@ -12866,13 +12871,13 @@ const KM = ({
12866
12871
  size: "extra-small",
12867
12872
  className: "pt-0.5",
12868
12873
  appearance: "body",
12869
- children: /* @__PURE__ */ l("mark", { className: "rounded-md py-0.5 px-1 bg-error-100", children: /* @__PURE__ */ l("del", { children: h || n === "boolean" && h === "0" ? h === "True" ? "Yes" : h === "False" ? "No" : n === "boolean" ? sh(h) : n === "currency" ? Ga(h, o?.currency_code) : n === "date" ? ks(h, {
12874
+ children: /* @__PURE__ */ l("mark", { className: "rounded-md py-0.5 px-1 bg-error-100", children: /* @__PURE__ */ l("del", { children: h || n?.toLowerCase() === "boolean" && h === "0" ? h === "True" ? "Yes" : h === "False" ? "No" : n?.toLowerCase() === "boolean" ? sh(h) : n?.toLowerCase() === "currency" ? Ga(h, o?.currency_code) : n?.toLowerCase() === "date" ? ks(h, {
12870
12875
  skipTimezone: !0,
12871
12876
  withTime: !1
12872
- }) : n === "datetime" ? ks(h, {
12877
+ }) : n?.toLowerCase() === "datetime" ? ks(h, {
12873
12878
  skipTimezone: !0,
12874
12879
  withTime: !0
12875
- }) : n === "percentage" ? `${h}%` : h.length > 100 ? /* @__PURE__ */ k("p", { children: [
12880
+ }) : n?.toLowerCase() === "percentage" ? `${h}%` : h.length > 100 ? /* @__PURE__ */ k("p", { children: [
12876
12881
  h.slice(0, N ? 100 : h.length),
12877
12882
  N ? "... " : " ",
12878
12883
  /* @__PURE__ */ l(