@firecms/ui 3.1.0-canary.1df3b2c → 3.1.0-canary.24c8270

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.umd.js CHANGED
@@ -34920,7 +34920,7 @@
34920
34920
  let t12;
34921
34921
  let t13;
34922
34922
  if ($[9] !== children) {
34923
- t13 = children ? React.Children.map(children, _temp$2).filter(Boolean) : [];
34923
+ t13 = children ? React.Children.map(children, _temp$2)?.filter(Boolean) ?? [] : [];
34924
34924
  $[9] = children;
34925
34925
  $[10] = t13;
34926
34926
  } else {
@@ -37020,7 +37020,7 @@
37020
37020
  });
37021
37021
  TextField.displayName = "TextField";
37022
37022
  function Tabs(t0) {
37023
- const $ = reactCompilerRuntime.c(10);
37023
+ const $ = reactCompilerRuntime.c(26);
37024
37024
  const {
37025
37025
  value,
37026
37026
  onValueChange,
@@ -37028,35 +37028,149 @@
37028
37028
  innerClassName,
37029
37029
  children
37030
37030
  } = t0;
37031
+ const scrollContainerRef = React.useRef(null);
37032
+ const [showLeftScroll, setShowLeftScroll] = React.useState(false);
37033
+ const [showRightScroll, setShowRightScroll] = React.useState(false);
37034
+ const [isScrollable, setIsScrollable] = React.useState(false);
37031
37035
  let t1;
37032
- if ($[0] !== innerClassName) {
37033
- t1 = cls("border", defaultBorderMixin, "gap-2", "inline-flex h-10 items-center justify-center rounded-md bg-surface-50 p-1 text-surface-600 dark:bg-surface-900 dark:text-surface-400", innerClassName);
37034
- $[0] = innerClassName;
37035
- $[1] = t1;
37036
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
37037
+ t1 = () => {
37038
+ if (scrollContainerRef.current) {
37039
+ const {
37040
+ scrollLeft,
37041
+ scrollWidth,
37042
+ clientWidth
37043
+ } = scrollContainerRef.current;
37044
+ setShowLeftScroll(scrollLeft > 0);
37045
+ setShowRightScroll(Math.ceil(scrollLeft + clientWidth) < scrollWidth);
37046
+ setIsScrollable(scrollWidth > clientWidth);
37047
+ }
37048
+ };
37049
+ $[0] = t1;
37036
37050
  } else {
37037
- t1 = $[1];
37051
+ t1 = $[0];
37038
37052
  }
37053
+ const checkScroll = t1;
37039
37054
  let t2;
37040
- if ($[2] !== children || $[3] !== t1) {
37041
- t2 = /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.List, { className: t1, children });
37042
- $[2] = children;
37043
- $[3] = t1;
37044
- $[4] = t2;
37055
+ if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
37056
+ t2 = () => {
37057
+ checkScroll();
37058
+ window.addEventListener("resize", checkScroll);
37059
+ let observer;
37060
+ if (scrollContainerRef.current) {
37061
+ observer = new ResizeObserver(checkScroll);
37062
+ observer.observe(scrollContainerRef.current);
37063
+ if (scrollContainerRef.current.firstElementChild) {
37064
+ observer.observe(scrollContainerRef.current.firstElementChild);
37065
+ }
37066
+ }
37067
+ return () => {
37068
+ window.removeEventListener("resize", checkScroll);
37069
+ observer?.disconnect();
37070
+ };
37071
+ };
37072
+ $[1] = t2;
37045
37073
  } else {
37046
- t2 = $[4];
37074
+ t2 = $[1];
37047
37075
  }
37048
37076
  let t3;
37049
- if ($[5] !== className || $[6] !== onValueChange || $[7] !== t2 || $[8] !== value) {
37050
- t3 = /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.Root, { value, onValueChange, className, children: t2 });
37077
+ if ($[2] !== children) {
37078
+ t3 = [children];
37079
+ $[2] = children;
37080
+ $[3] = t3;
37081
+ } else {
37082
+ t3 = $[3];
37083
+ }
37084
+ React.useEffect(t2, t3);
37085
+ let t4;
37086
+ if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
37087
+ t4 = (direction) => {
37088
+ if (scrollContainerRef.current) {
37089
+ const container = scrollContainerRef.current;
37090
+ const scrollAmount = Math.max(container.clientWidth / 2, 200);
37091
+ const targetScroll = container.scrollLeft + (direction === "left" ? -scrollAmount : scrollAmount);
37092
+ container.scrollTo({
37093
+ left: targetScroll,
37094
+ behavior: "smooth"
37095
+ });
37096
+ }
37097
+ };
37098
+ $[4] = t4;
37099
+ } else {
37100
+ t4 = $[4];
37101
+ }
37102
+ const scroll = t4;
37103
+ let t5;
37104
+ if ($[5] !== className) {
37105
+ t5 = cls("flex flex-row items-center min-w-0", className);
37051
37106
  $[5] = className;
37052
- $[6] = onValueChange;
37053
- $[7] = t2;
37054
- $[8] = value;
37055
- $[9] = t3;
37107
+ $[6] = t5;
37056
37108
  } else {
37057
- t3 = $[9];
37109
+ t5 = $[6];
37058
37110
  }
37059
- return t3;
37111
+ let t6;
37112
+ if ($[7] !== isScrollable || $[8] !== showLeftScroll) {
37113
+ t6 = isScrollable && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: !showLeftScroll, onClick: () => scroll("left"), className: cls("flex-shrink-0 z-10 flex items-center justify-center rounded-md px-0.5 py-1.5 transition-all h-10 w-6", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-surface-400", "disabled:pointer-events-none disabled:opacity-0", "text-surface-600 dark:text-surface-400 hover:bg-surface-200 dark:hover:bg-surface-800", "mr-1 bg-surface-50 dark:bg-surface-900 border", defaultBorderMixin), children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, { size: "small" }) });
37114
+ $[7] = isScrollable;
37115
+ $[8] = showLeftScroll;
37116
+ $[9] = t6;
37117
+ } else {
37118
+ t6 = $[9];
37119
+ }
37120
+ let t7;
37121
+ if ($[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
37122
+ t7 = {
37123
+ scrollbarWidth: "none",
37124
+ msOverflowStyle: "none"
37125
+ };
37126
+ $[10] = t7;
37127
+ } else {
37128
+ t7 = $[10];
37129
+ }
37130
+ let t8;
37131
+ if ($[11] !== innerClassName) {
37132
+ t8 = cls("border", defaultBorderMixin, "gap-2", "inline-flex h-10 items-center justify-center rounded-md bg-surface-50 p-1 text-surface-600 dark:bg-surface-900 dark:text-surface-400", innerClassName);
37133
+ $[11] = innerClassName;
37134
+ $[12] = t8;
37135
+ } else {
37136
+ t8 = $[12];
37137
+ }
37138
+ let t9;
37139
+ if ($[13] !== children || $[14] !== t8) {
37140
+ t9 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: scrollContainerRef, className: "flex-1 overflow-x-auto no-scrollbar min-w-0", onScroll: checkScroll, style: t7, children: /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.List, { className: t8, children }) });
37141
+ $[13] = children;
37142
+ $[14] = t8;
37143
+ $[15] = t9;
37144
+ } else {
37145
+ t9 = $[15];
37146
+ }
37147
+ let t10;
37148
+ if ($[16] !== isScrollable || $[17] !== showRightScroll) {
37149
+ t10 = isScrollable && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: !showRightScroll, onClick: () => scroll("right"), className: cls("flex-shrink-0 z-10 flex items-center justify-center rounded-md px-0.5 py-1.5 transition-all h-10 w-6", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-surface-400", "disabled:pointer-events-none disabled:opacity-0", "text-surface-600 dark:text-surface-400 hover:bg-surface-200 dark:hover:bg-surface-800", "ml-1 bg-surface-50 dark:bg-surface-900 border", defaultBorderMixin), children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, { size: "small" }) });
37150
+ $[16] = isScrollable;
37151
+ $[17] = showRightScroll;
37152
+ $[18] = t10;
37153
+ } else {
37154
+ t10 = $[18];
37155
+ }
37156
+ let t11;
37157
+ if ($[19] !== onValueChange || $[20] !== t10 || $[21] !== t5 || $[22] !== t6 || $[23] !== t9 || $[24] !== value) {
37158
+ t11 = /* @__PURE__ */ jsxRuntime.jsxs(TabsPrimitive__namespace.Root, { value, onValueChange, className: t5, children: [
37159
+ t6,
37160
+ t9,
37161
+ t10
37162
+ ] });
37163
+ $[19] = onValueChange;
37164
+ $[20] = t10;
37165
+ $[21] = t5;
37166
+ $[22] = t6;
37167
+ $[23] = t9;
37168
+ $[24] = value;
37169
+ $[25] = t11;
37170
+ } else {
37171
+ t11 = $[25];
37172
+ }
37173
+ return t11;
37060
37174
  }
37061
37175
  function Tab(t0) {
37062
37176
  const $ = reactCompilerRuntime.c(8);
@@ -37530,7 +37644,7 @@
37530
37644
  Badge.displayName = "Badge";
37531
37645
  function DebouncedTextField(props) {
37532
37646
  const $ = reactCompilerRuntime.c(13);
37533
- const previousEventRef = React.useRef();
37647
+ const previousEventRef = React.useRef(void 0);
37534
37648
  const [internalValue, setInternalValue] = React.useState(props.value);
37535
37649
  const deferredValue = React.useDeferredValue(internalValue);
37536
37650
  let t0;