@firecms/ui 3.0.0-canary.254 → 3.0.0-canary.256

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
@@ -742,18 +742,22 @@
742
742
  } else {
743
743
  onValueChange?.(!value);
744
744
  }
745
- }, className: cls(size === "small" ? "w-[38px] h-[22px] min-w-[38px] min-h-[22px]" : "w-[42px] h-[26px] min-w-[42px] min-h-[26px]", "outline-none rounded-full relative shadow-sm", value ? disabled ? "bg-white bg-opacity-54 dark:bg-surface-accent-950 border-surface-accent-100 dark:border-surface-accent-700 ring-1 ring-surface-accent-200 dark:ring-surface-accent-700" : "ring-secondary ring-1 bg-secondary dark:bg-secondary" : "bg-white bg-opacity-54 dark:bg-surface-accent-900 ring-1 ring-surface-accent-200 dark:ring-surface-accent-700", className), ...props, children: [
745
+ }, className: cls(size === "smallest" ? "w-[34px] h-[18px] min-w-[34px] min-h-[18px]" : size === "small" ? "w-[38px] h-[22px] min-w-[38px] min-h-[22px]" : "w-[42px] h-[26px] min-w-[42px] min-h-[26px]", "outline-none rounded-full relative shadow-sm", value ? disabled ? "bg-white bg-opacity-54 dark:bg-surface-accent-950 border-surface-accent-100 dark:border-surface-accent-700 ring-1 ring-surface-accent-200 dark:ring-surface-accent-700" : "ring-secondary ring-1 bg-secondary dark:bg-secondary" : "bg-white bg-opacity-54 dark:bg-surface-accent-900 ring-1 ring-surface-accent-200 dark:ring-surface-accent-700", className), ...props, children: [
746
746
  allowIndeterminate && (value === null || value === void 0) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls("block rounded-full transition-transform duration-100 transform will-change-auto", disabled ? "bg-surface-accent-400 dark:bg-surface-accent-600" : "bg-surface-accent-400 dark:bg-surface-accent-600", {
747
747
  "w-[21px] h-[10px]": size === "medium" || size === "large",
748
748
  "w-[19px] h-[8px]": size === "small",
749
+ "w-[16px] h-[6px]": size === "smallest",
749
750
  "translate-x-[10px]": size === "medium" || size === "large",
750
- "translate-x-[9px]": size === "small"
751
+ "translate-x-[9px]": size === "small",
752
+ "translate-x-[8px]": size === "smallest"
751
753
  }) }, "knob"),
752
754
  !(allowIndeterminate && (value === null || value === void 0)) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls("block rounded-full transition-transform duration-100 transform will-change-auto", disabled ? "bg-surface-accent-300 dark:bg-surface-accent-700" : value ? "bg-white" : "bg-surface-accent-600 dark:bg-surface-accent-400", {
753
755
  "w-[21px] h-[21px]": size === "medium" || size === "large",
754
756
  "w-[19px] h-[19px]": size === "small",
757
+ "w-[16px] h-[16px]": size === "smallest",
755
758
  [value ? "translate-x-[19px]" : "translate-x-[3px]"]: size === "medium" || size === "large",
756
- [value ? "translate-x-[17px]" : "translate-x-[2px]"]: size === "small"
759
+ [value ? "translate-x-[17px]" : "translate-x-[2px]"]: size === "small",
760
+ [value ? "translate-x-[16px]" : "translate-x-[1px]"]: size === "smallest"
757
761
  }) }, "knob")
758
762
  ] });
759
763
  });
@@ -785,7 +789,7 @@
785
789
  "min-h-[32px]": size === "small",
786
790
  "min-h-[42px]": size === "medium",
787
791
  "min-h-[64px]": size === "large"
788
- }, size === "small" ? "pl-2" : "pl-4", size === "small" ? "pr-4" : "pr-6", position === "end" ? "flex-row-reverse" : "flex-row", fullWidth ? "w-full" : "", className), onClick: disabled ? void 0 : (e) => {
792
+ }, size === "small" || size === "smallest" ? "pl-2" : "pl-4", size === "small" || size === "smallest" ? "pr-4" : "pr-6", position === "end" ? "flex-row-reverse" : "flex-row", fullWidth ? "w-full" : "", className), onClick: disabled ? void 0 : (e) => {
789
793
  if (props.allowIndeterminate) {
790
794
  if (value === null || value === void 0) onValueChange?.(true);
791
795
  else if (value) onValueChange?.(false);
@@ -795,7 +799,7 @@
795
799
  }
796
800
  }, children: [
797
801
  /* @__PURE__ */ jsxRuntime.jsx(BooleanSwitch, { value, ref: refInput, size, className: cls(invisible && focus ? focusedClasses : "", inputClassName), disabled, ...props }),
798
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls("flex-grow", position === "end" ? "mr-4" : "ml-4", size === "small" ? "text-sm" : "text-base"), children: label })
802
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls("flex-grow", position === "end" ? "mr-4" : "ml-4", size === "small" || size === "smallest" ? "text-sm" : "text-base"), children: label })
799
803
  ] });
800
804
  };
801
805
  const ButtonInner = React.forwardRef((t0, ref) => {
@@ -28007,7 +28011,7 @@
28007
28011
  full: "max-w-full min-w-full w-full"
28008
28012
  };
28009
28013
  const Dialog = (t0) => {
28010
- const $ = reactCompilerRuntime.c(39);
28014
+ const $ = reactCompilerRuntime.c(42);
28011
28015
  const {
28012
28016
  open,
28013
28017
  onOpenChange,
@@ -28023,17 +28027,19 @@
28023
28027
  onOpenAutoFocus,
28024
28028
  onEscapeKeyDown,
28025
28029
  onPointerDownOutside,
28026
- onInteractOutside
28030
+ onInteractOutside,
28031
+ disableInitialFocus: t5
28027
28032
  } = t0;
28028
28033
  const fullWidth = t1 === void 0 ? true : t1;
28029
28034
  const scrollable = t2 === void 0 ? true : t2;
28030
28035
  const maxWidth = t3 === void 0 ? "lg" : t3;
28031
28036
  const modal = t4 === void 0 ? true : t4;
28037
+ const disableInitialFocus = t5 === void 0 ? true : t5;
28032
28038
  const [displayed, setDisplayed] = React.useState(false);
28033
- let t5;
28034
28039
  let t6;
28040
+ let t7;
28035
28041
  if ($[0] !== open) {
28036
- t5 = () => {
28042
+ t6 = () => {
28037
28043
  if (!open) {
28038
28044
  const timeout = setTimeout(() => {
28039
28045
  setDisplayed(false);
@@ -28044,126 +28050,140 @@
28044
28050
  return _temp$2;
28045
28051
  }
28046
28052
  };
28047
- t6 = [open];
28053
+ t7 = [open];
28048
28054
  $[0] = open;
28049
- $[1] = t5;
28050
- $[2] = t6;
28055
+ $[1] = t6;
28056
+ $[2] = t7;
28051
28057
  } else {
28052
- t5 = $[1];
28053
- t6 = $[2];
28058
+ t6 = $[1];
28059
+ t7 = $[2];
28054
28060
  }
28055
- React.useEffect(t5, t6);
28056
- const t7 = displayed || open;
28057
- let t8;
28061
+ React.useEffect(t6, t7);
28062
+ const t8 = displayed || open;
28063
+ let t9;
28058
28064
  if ($[3] !== containerClassName) {
28059
- t8 = cls("fixed inset-0 z-30", containerClassName);
28065
+ t9 = cls("fixed inset-0 z-30", containerClassName);
28060
28066
  $[3] = containerClassName;
28061
- $[4] = t8;
28067
+ $[4] = t9;
28062
28068
  } else {
28063
- t8 = $[4];
28069
+ t9 = $[4];
28064
28070
  }
28065
- const t9 = displayed && open ? "opacity-100" : "opacity-0";
28066
- let t10;
28067
- if ($[5] !== t9) {
28068
- t10 = cls("fixed inset-0 transition-opacity z-20 ease-in-out duration-200 bg-black bg-opacity-50 dark:bg-opacity-60 backdrop-blur-sm ", t9, "z-20 fixed top-0 left-0 w-full h-full flex justify-center items-center");
28069
- $[5] = t9;
28070
- $[6] = t10;
28071
+ const t10 = displayed && open ? "opacity-100" : "opacity-0";
28072
+ let t11;
28073
+ if ($[5] !== t10) {
28074
+ t11 = cls("fixed inset-0 transition-opacity z-20 ease-in-out duration-200 bg-black bg-opacity-50 dark:bg-opacity-60 backdrop-blur-sm ", t10, "z-20 fixed top-0 left-0 w-full h-full flex justify-center items-center");
28075
+ $[5] = t10;
28076
+ $[6] = t11;
28071
28077
  } else {
28072
- t10 = $[6];
28078
+ t11 = $[6];
28073
28079
  }
28074
- const t11 = displayed ? "auto" : "none";
28075
- let t12;
28076
- if ($[7] !== t11) {
28077
- t12 = {
28078
- pointerEvents: t11
28080
+ const t12 = displayed ? "auto" : "none";
28081
+ let t13;
28082
+ if ($[7] !== t12) {
28083
+ t13 = {
28084
+ pointerEvents: t12
28079
28085
  };
28080
- $[7] = t11;
28081
- $[8] = t12;
28086
+ $[7] = t12;
28087
+ $[8] = t13;
28082
28088
  } else {
28083
- t12 = $[8];
28089
+ t13 = $[8];
28084
28090
  }
28085
- let t13;
28086
- if ($[9] !== t10 || $[10] !== t12) {
28087
- t13 = /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Overlay, { className: t10, style: t12 });
28088
- $[9] = t10;
28089
- $[10] = t12;
28090
- $[11] = t13;
28091
+ let t14;
28092
+ if ($[9] !== t11 || $[10] !== t13) {
28093
+ t14 = /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Overlay, { className: t11, style: t13 });
28094
+ $[9] = t11;
28095
+ $[10] = t13;
28096
+ $[11] = t14;
28091
28097
  } else {
28092
- t13 = $[11];
28098
+ t14 = $[11];
28093
28099
  }
28094
- let t14;
28095
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
28096
- t14 = cls("h-full outline-none flex justify-center items-center z-40 opacity-100 transition-all duration-200 ease-in-out");
28097
- $[12] = t14;
28098
- } else {
28099
- t14 = $[12];
28100
- }
28101
- const t15 = fullWidth && !fullScreen ? "w-11/12" : void 0;
28102
- const t16 = fullHeight && !fullScreen ? "h-full" : void 0;
28103
- const t17 = fullScreen ? "h-screen w-screen" : "max-h-[90vh] shadow-xl";
28104
- const t18 = scrollable && "overflow-y-auto";
28105
- const t19 = displayed && open ? "opacity-100" : "opacity-0";
28106
- const t20 = maxWidth && !fullScreen ? widthClasses[maxWidth] : void 0;
28107
- let t21;
28108
- if ($[13] !== className || $[14] !== t15 || $[15] !== t16 || $[16] !== t17 || $[17] !== t18 || $[18] !== t19 || $[19] !== t20) {
28109
- t21 = cls(paperMixin, "z-30", "relative", "outline-none focus:outline-none", t15, t16, "text-surface-accent-900 dark:text-white", "justify-center items-center", t17, "ease-in-out duration-200", t18, t19, t20, className);
28110
- $[13] = className;
28100
+ let t15;
28101
+ if ($[12] !== disableInitialFocus || $[13] !== onOpenAutoFocus) {
28102
+ t15 = (e) => {
28103
+ if (disableInitialFocus) {
28104
+ e.preventDefault();
28105
+ }
28106
+ onOpenAutoFocus?.(e);
28107
+ };
28108
+ $[12] = disableInitialFocus;
28109
+ $[13] = onOpenAutoFocus;
28111
28110
  $[14] = t15;
28112
- $[15] = t16;
28113
- $[16] = t17;
28114
- $[17] = t18;
28115
- $[18] = t19;
28116
- $[19] = t20;
28117
- $[20] = t21;
28118
28111
  } else {
28119
- t21 = $[20];
28112
+ t15 = $[14];
28120
28113
  }
28121
- let t22;
28122
- if ($[21] !== children || $[22] !== t21) {
28123
- t22 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: t21, children });
28124
- $[21] = children;
28125
- $[22] = t21;
28126
- $[23] = t22;
28114
+ let t16;
28115
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
28116
+ t16 = cls("h-full outline-none flex justify-center items-center z-40 opacity-100 transition-all duration-200 ease-in-out");
28117
+ $[15] = t16;
28127
28118
  } else {
28128
- t22 = $[23];
28119
+ t16 = $[15];
28129
28120
  }
28121
+ const t17 = fullWidth && !fullScreen ? "w-11/12" : void 0;
28122
+ const t18 = fullHeight && !fullScreen ? "h-full" : void 0;
28123
+ const t19 = fullScreen ? "h-screen w-screen" : "max-h-[90vh] shadow-xl";
28124
+ const t20 = scrollable && "overflow-y-auto";
28125
+ const t21 = displayed && open ? "opacity-100" : "opacity-0";
28126
+ const t22 = maxWidth && !fullScreen ? widthClasses[maxWidth] : void 0;
28130
28127
  let t23;
28131
- if ($[24] !== onEscapeKeyDown || $[25] !== onInteractOutside || $[26] !== onOpenAutoFocus || $[27] !== onPointerDownOutside || $[28] !== t22) {
28132
- t23 = /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Content, { onEscapeKeyDown, onOpenAutoFocus, onPointerDownOutside, onInteractOutside, className: t14, children: t22 });
28133
- $[24] = onEscapeKeyDown;
28134
- $[25] = onInteractOutside;
28135
- $[26] = onOpenAutoFocus;
28136
- $[27] = onPointerDownOutside;
28137
- $[28] = t22;
28138
- $[29] = t23;
28139
- } else {
28140
- t23 = $[29];
28128
+ if ($[16] !== className || $[17] !== t17 || $[18] !== t18 || $[19] !== t19 || $[20] !== t20 || $[21] !== t21 || $[22] !== t22) {
28129
+ t23 = cls(paperMixin, "z-30", "relative", "outline-none focus:outline-none", t17, t18, "text-surface-accent-900 dark:text-white", "justify-center items-center", t19, "ease-in-out duration-200", t20, t21, t22, className);
28130
+ $[16] = className;
28131
+ $[17] = t17;
28132
+ $[18] = t18;
28133
+ $[19] = t19;
28134
+ $[20] = t20;
28135
+ $[21] = t21;
28136
+ $[22] = t22;
28137
+ $[23] = t23;
28138
+ } else {
28139
+ t23 = $[23];
28141
28140
  }
28142
28141
  let t24;
28143
- if ($[30] !== t13 || $[31] !== t23 || $[32] !== t8) {
28144
- t24 = /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t8, children: [
28145
- t13,
28146
- t23
28147
- ] }) });
28148
- $[30] = t13;
28149
- $[31] = t23;
28150
- $[32] = t8;
28151
- $[33] = t24;
28142
+ if ($[24] !== children || $[25] !== t23) {
28143
+ t24 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: t23, children });
28144
+ $[24] = children;
28145
+ $[25] = t23;
28146
+ $[26] = t24;
28152
28147
  } else {
28153
- t24 = $[33];
28148
+ t24 = $[26];
28154
28149
  }
28155
28150
  let t25;
28156
- if ($[34] !== modal || $[35] !== onOpenChange || $[36] !== t24 || $[37] !== t7) {
28157
- t25 = /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Root, { open: t7, modal, onOpenChange, children: t24 });
28158
- $[34] = modal;
28159
- $[35] = onOpenChange;
28160
- $[36] = t24;
28161
- $[37] = t7;
28162
- $[38] = t25;
28151
+ if ($[27] !== onEscapeKeyDown || $[28] !== onInteractOutside || $[29] !== onPointerDownOutside || $[30] !== t15 || $[31] !== t24) {
28152
+ t25 = /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Content, { onEscapeKeyDown, onOpenAutoFocus: t15, onPointerDownOutside, onInteractOutside, className: t16, children: t24 });
28153
+ $[27] = onEscapeKeyDown;
28154
+ $[28] = onInteractOutside;
28155
+ $[29] = onPointerDownOutside;
28156
+ $[30] = t15;
28157
+ $[31] = t24;
28158
+ $[32] = t25;
28159
+ } else {
28160
+ t25 = $[32];
28161
+ }
28162
+ let t26;
28163
+ if ($[33] !== t14 || $[34] !== t25 || $[35] !== t9) {
28164
+ t26 = /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t9, children: [
28165
+ t14,
28166
+ t25
28167
+ ] }) });
28168
+ $[33] = t14;
28169
+ $[34] = t25;
28170
+ $[35] = t9;
28171
+ $[36] = t26;
28172
+ } else {
28173
+ t26 = $[36];
28174
+ }
28175
+ let t27;
28176
+ if ($[37] !== modal || $[38] !== onOpenChange || $[39] !== t26 || $[40] !== t8) {
28177
+ t27 = /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Root, { open: t8, modal, onOpenChange, children: t26 });
28178
+ $[37] = modal;
28179
+ $[38] = onOpenChange;
28180
+ $[39] = t26;
28181
+ $[40] = t8;
28182
+ $[41] = t27;
28163
28183
  } else {
28164
- t25 = $[38];
28184
+ t27 = $[41];
28165
28185
  }
28166
- return t25;
28186
+ return t27;
28167
28187
  };
28168
28188
  function _temp$2() {
28169
28189
  }