@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.
@@ -31,7 +31,7 @@ interface MultiSelectProps<T extends MultiSelectValue = string> {
31
31
  multiple?: boolean;
32
32
  includeSelectAll?: boolean;
33
33
  includeClear?: boolean;
34
- inputRef?: React.RefObject<HTMLButtonElement>;
34
+ inputRef?: React.RefObject<HTMLButtonElement | null>;
35
35
  padding?: boolean;
36
36
  invisible?: boolean;
37
37
  children: React.ReactNode;
@@ -20,7 +20,7 @@ export type SelectProps<T extends SelectValue = string> = {
20
20
  error?: boolean;
21
21
  position?: "item-aligned" | "popper";
22
22
  endAdornment?: React.ReactNode;
23
- inputRef?: React.RefObject<HTMLButtonElement>;
23
+ inputRef?: React.RefObject<HTMLButtonElement | null>;
24
24
  padding?: boolean;
25
25
  invisible?: boolean;
26
26
  children?: React.ReactNode;
@@ -2,4 +2,4 @@ import { RefObject } from "react";
2
2
  /**
3
3
  * Hook that alerts clicks outside the passed ref
4
4
  */
5
- export declare function useOutsideAlerter(ref: RefObject<HTMLElement>, onOutsideClick: () => void, active?: boolean): void;
5
+ export declare function useOutsideAlerter(ref: RefObject<HTMLElement | null>, onOutsideClick: () => void, active?: boolean): void;
package/dist/index.es.js CHANGED
@@ -34910,7 +34910,7 @@ const MultiSelect = React.forwardRef((t0, ref) => {
34910
34910
  let t12;
34911
34911
  let t13;
34912
34912
  if ($[9] !== children) {
34913
- t13 = children ? Children.map(children, _temp$2).filter(Boolean) : [];
34913
+ t13 = children ? Children.map(children, _temp$2)?.filter(Boolean) ?? [] : [];
34914
34914
  $[9] = children;
34915
34915
  $[10] = t13;
34916
34916
  } else {
@@ -37010,7 +37010,7 @@ const TextField = forwardRef(({
37010
37010
  });
37011
37011
  TextField.displayName = "TextField";
37012
37012
  function Tabs(t0) {
37013
- const $ = c(10);
37013
+ const $ = c(26);
37014
37014
  const {
37015
37015
  value,
37016
37016
  onValueChange,
@@ -37018,35 +37018,149 @@ function Tabs(t0) {
37018
37018
  innerClassName,
37019
37019
  children
37020
37020
  } = t0;
37021
+ const scrollContainerRef = useRef(null);
37022
+ const [showLeftScroll, setShowLeftScroll] = useState(false);
37023
+ const [showRightScroll, setShowRightScroll] = useState(false);
37024
+ const [isScrollable, setIsScrollable] = useState(false);
37021
37025
  let t1;
37022
- if ($[0] !== innerClassName) {
37023
- 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);
37024
- $[0] = innerClassName;
37025
- $[1] = t1;
37026
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
37027
+ t1 = () => {
37028
+ if (scrollContainerRef.current) {
37029
+ const {
37030
+ scrollLeft,
37031
+ scrollWidth,
37032
+ clientWidth
37033
+ } = scrollContainerRef.current;
37034
+ setShowLeftScroll(scrollLeft > 0);
37035
+ setShowRightScroll(Math.ceil(scrollLeft + clientWidth) < scrollWidth);
37036
+ setIsScrollable(scrollWidth > clientWidth);
37037
+ }
37038
+ };
37039
+ $[0] = t1;
37026
37040
  } else {
37027
- t1 = $[1];
37041
+ t1 = $[0];
37028
37042
  }
37043
+ const checkScroll = t1;
37029
37044
  let t2;
37030
- if ($[2] !== children || $[3] !== t1) {
37031
- t2 = /* @__PURE__ */ jsx(TabsPrimitive.List, { className: t1, children });
37032
- $[2] = children;
37033
- $[3] = t1;
37034
- $[4] = t2;
37045
+ if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
37046
+ t2 = () => {
37047
+ checkScroll();
37048
+ window.addEventListener("resize", checkScroll);
37049
+ let observer;
37050
+ if (scrollContainerRef.current) {
37051
+ observer = new ResizeObserver(checkScroll);
37052
+ observer.observe(scrollContainerRef.current);
37053
+ if (scrollContainerRef.current.firstElementChild) {
37054
+ observer.observe(scrollContainerRef.current.firstElementChild);
37055
+ }
37056
+ }
37057
+ return () => {
37058
+ window.removeEventListener("resize", checkScroll);
37059
+ observer?.disconnect();
37060
+ };
37061
+ };
37062
+ $[1] = t2;
37035
37063
  } else {
37036
- t2 = $[4];
37064
+ t2 = $[1];
37037
37065
  }
37038
37066
  let t3;
37039
- if ($[5] !== className || $[6] !== onValueChange || $[7] !== t2 || $[8] !== value) {
37040
- t3 = /* @__PURE__ */ jsx(TabsPrimitive.Root, { value, onValueChange, className, children: t2 });
37067
+ if ($[2] !== children) {
37068
+ t3 = [children];
37069
+ $[2] = children;
37070
+ $[3] = t3;
37071
+ } else {
37072
+ t3 = $[3];
37073
+ }
37074
+ useEffect(t2, t3);
37075
+ let t4;
37076
+ if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
37077
+ t4 = (direction) => {
37078
+ if (scrollContainerRef.current) {
37079
+ const container = scrollContainerRef.current;
37080
+ const scrollAmount = Math.max(container.clientWidth / 2, 200);
37081
+ const targetScroll = container.scrollLeft + (direction === "left" ? -scrollAmount : scrollAmount);
37082
+ container.scrollTo({
37083
+ left: targetScroll,
37084
+ behavior: "smooth"
37085
+ });
37086
+ }
37087
+ };
37088
+ $[4] = t4;
37089
+ } else {
37090
+ t4 = $[4];
37091
+ }
37092
+ const scroll = t4;
37093
+ let t5;
37094
+ if ($[5] !== className) {
37095
+ t5 = cls("flex flex-row items-center min-w-0", className);
37041
37096
  $[5] = className;
37042
- $[6] = onValueChange;
37043
- $[7] = t2;
37044
- $[8] = value;
37045
- $[9] = t3;
37097
+ $[6] = t5;
37046
37098
  } else {
37047
- t3 = $[9];
37099
+ t5 = $[6];
37048
37100
  }
37049
- return t3;
37101
+ let t6;
37102
+ if ($[7] !== isScrollable || $[8] !== showLeftScroll) {
37103
+ t6 = isScrollable && /* @__PURE__ */ 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__ */ jsx(ChevronLeftIcon, { size: "small" }) });
37104
+ $[7] = isScrollable;
37105
+ $[8] = showLeftScroll;
37106
+ $[9] = t6;
37107
+ } else {
37108
+ t6 = $[9];
37109
+ }
37110
+ let t7;
37111
+ if ($[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
37112
+ t7 = {
37113
+ scrollbarWidth: "none",
37114
+ msOverflowStyle: "none"
37115
+ };
37116
+ $[10] = t7;
37117
+ } else {
37118
+ t7 = $[10];
37119
+ }
37120
+ let t8;
37121
+ if ($[11] !== innerClassName) {
37122
+ 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);
37123
+ $[11] = innerClassName;
37124
+ $[12] = t8;
37125
+ } else {
37126
+ t8 = $[12];
37127
+ }
37128
+ let t9;
37129
+ if ($[13] !== children || $[14] !== t8) {
37130
+ t9 = /* @__PURE__ */ jsx("div", { ref: scrollContainerRef, className: "flex-1 overflow-x-auto no-scrollbar min-w-0", onScroll: checkScroll, style: t7, children: /* @__PURE__ */ jsx(TabsPrimitive.List, { className: t8, children }) });
37131
+ $[13] = children;
37132
+ $[14] = t8;
37133
+ $[15] = t9;
37134
+ } else {
37135
+ t9 = $[15];
37136
+ }
37137
+ let t10;
37138
+ if ($[16] !== isScrollable || $[17] !== showRightScroll) {
37139
+ t10 = isScrollable && /* @__PURE__ */ 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__ */ jsx(ChevronRightIcon, { size: "small" }) });
37140
+ $[16] = isScrollable;
37141
+ $[17] = showRightScroll;
37142
+ $[18] = t10;
37143
+ } else {
37144
+ t10 = $[18];
37145
+ }
37146
+ let t11;
37147
+ if ($[19] !== onValueChange || $[20] !== t10 || $[21] !== t5 || $[22] !== t6 || $[23] !== t9 || $[24] !== value) {
37148
+ t11 = /* @__PURE__ */ jsxs(TabsPrimitive.Root, { value, onValueChange, className: t5, children: [
37149
+ t6,
37150
+ t9,
37151
+ t10
37152
+ ] });
37153
+ $[19] = onValueChange;
37154
+ $[20] = t10;
37155
+ $[21] = t5;
37156
+ $[22] = t6;
37157
+ $[23] = t9;
37158
+ $[24] = value;
37159
+ $[25] = t11;
37160
+ } else {
37161
+ t11 = $[25];
37162
+ }
37163
+ return t11;
37050
37164
  }
37051
37165
  function Tab(t0) {
37052
37166
  const $ = c(8);
@@ -37520,7 +37634,7 @@ const Badge = React__default.forwardRef((t0, ref) => {
37520
37634
  Badge.displayName = "Badge";
37521
37635
  function DebouncedTextField(props) {
37522
37636
  const $ = c(13);
37523
- const previousEventRef = React__default.useRef();
37637
+ const previousEventRef = React__default.useRef(void 0);
37524
37638
  const [internalValue, setInternalValue] = React__default.useState(props.value);
37525
37639
  const deferredValue = useDeferredValue(internalValue);
37526
37640
  let t0;