@geomak/ui 5.0.0 → 5.0.1

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.cjs CHANGED
@@ -2837,7 +2837,7 @@ function NumberInput({
2837
2837
  "div",
2838
2838
  {
2839
2839
  style,
2840
- className: `flex items-center rounded-lg border ${hasError ? "border-status-error" : "border-border"} ${disabled ? "bg-surface-raised text-foreground-muted cursor-not-allowed" : "bg-surface text-foreground"} focus-within:ring-2 focus-within:ring-accent transition-colors`,
2840
+ className: `flex items-center rounded-lg border overflow-hidden ${hasError ? "border-status-error" : "border-border"} ${disabled ? "bg-surface-raised text-foreground-muted cursor-not-allowed" : "bg-surface text-foreground"} focus-within:ring-2 focus-within:ring-accent transition-colors`,
2841
2841
  children: [
2842
2842
  /* @__PURE__ */ jsxRuntime.jsx(
2843
2843
  "input",
@@ -3057,25 +3057,22 @@ function Switch({
3057
3057
  uncheckedIcon
3058
3058
  }) {
3059
3059
  const id = React8.useId();
3060
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3061
- "// mr-12 was a hardcoded right margin that broke layouts; spacing // is the parent's responsibility now.",
3062
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center cursor-pointer select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
3063
- SwitchPrimitive__namespace.Root,
3064
- {
3065
- id,
3066
- checked,
3067
- onCheckedChange: (c) => onChange?.({ target: { checked: c } }),
3068
- className: "relative inline-flex h-6 w-14 items-center rounded-full bg-foreground-secondary data-[state=checked]:bg-accent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2",
3069
- children: /* @__PURE__ */ jsxRuntime.jsx(
3070
- SwitchPrimitive__namespace.Thumb,
3071
- {
3072
- className: "pointer-events-none inline-flex h-8 w-8 items-center justify-center rounded-full bg-background text-foreground shadow transition-transform duration-200 data-[state=checked]:translate-x-[22px] data-[state=unchecked]:translate-x-[-4px]",
3073
- children: checkedIcon && uncheckedIcon ? checked ? checkedIcon : uncheckedIcon : null
3074
- }
3075
- )
3076
- }
3077
- ) })
3078
- ] });
3060
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center cursor-pointer select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
3061
+ SwitchPrimitive__namespace.Root,
3062
+ {
3063
+ id,
3064
+ checked,
3065
+ onCheckedChange: (c) => onChange?.({ target: { checked: c } }),
3066
+ className: "relative inline-flex h-6 w-14 items-center rounded-full bg-foreground-secondary data-[state=checked]:bg-accent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2",
3067
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3068
+ SwitchPrimitive__namespace.Thumb,
3069
+ {
3070
+ className: "pointer-events-none inline-flex h-8 w-8 items-center justify-center rounded-full bg-background text-foreground shadow transition-transform duration-200 data-[state=checked]:translate-x-[22px] data-[state=unchecked]:translate-x-[-4px]",
3071
+ children: checkedIcon && uncheckedIcon ? checked ? checkedIcon : uncheckedIcon : null
3072
+ }
3073
+ )
3074
+ }
3075
+ ) }) });
3079
3076
  }
3080
3077
  function AutoComplete({
3081
3078
  disabled,
@@ -3218,11 +3215,17 @@ function TreeSelect({
3218
3215
  const [activeIndex, setActiveIndex] = React8.useState(0);
3219
3216
  const listRef = React8.useRef(null);
3220
3217
  const visible = React8.useMemo(() => flattenVisible(items, expanded), [items, expanded]);
3218
+ const didSyncOnOpenRef = React8.useRef(false);
3221
3219
  React8.useEffect(() => {
3222
- if (!open) return;
3220
+ if (!open) {
3221
+ didSyncOnOpenRef.current = false;
3222
+ return;
3223
+ }
3224
+ if (didSyncOnOpenRef.current) return;
3223
3225
  const selectedIdx = visible.findIndex((v) => v.node.key === value);
3224
3226
  setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
3225
- }, [open, visible, value]);
3227
+ didSyncOnOpenRef.current = true;
3228
+ }, [open, value]);
3226
3229
  const selectedNode = React8.useMemo(
3227
3230
  () => value != null ? findNodeByKey(items, value) : null,
3228
3231
  [items, value]