@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.js CHANGED
@@ -2804,7 +2804,7 @@ function NumberInput({
2804
2804
  "div",
2805
2805
  {
2806
2806
  style,
2807
- 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`,
2807
+ 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`,
2808
2808
  children: [
2809
2809
  /* @__PURE__ */ jsx(
2810
2810
  "input",
@@ -3024,25 +3024,22 @@ function Switch({
3024
3024
  uncheckedIcon
3025
3025
  }) {
3026
3026
  const id = useId();
3027
- return /* @__PURE__ */ jsxs("div", { children: [
3028
- "// mr-12 was a hardcoded right margin that broke layouts; spacing // is the parent's responsibility now.",
3029
- /* @__PURE__ */ jsx("label", { htmlFor: id, className: "flex items-center cursor-pointer select-none", children: /* @__PURE__ */ jsx(
3030
- SwitchPrimitive.Root,
3031
- {
3032
- id,
3033
- checked,
3034
- onCheckedChange: (c) => onChange?.({ target: { checked: c } }),
3035
- 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",
3036
- children: /* @__PURE__ */ jsx(
3037
- SwitchPrimitive.Thumb,
3038
- {
3039
- 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]",
3040
- children: checkedIcon && uncheckedIcon ? checked ? checkedIcon : uncheckedIcon : null
3041
- }
3042
- )
3043
- }
3044
- ) })
3045
- ] });
3027
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("label", { htmlFor: id, className: "flex items-center cursor-pointer select-none", children: /* @__PURE__ */ jsx(
3028
+ SwitchPrimitive.Root,
3029
+ {
3030
+ id,
3031
+ checked,
3032
+ onCheckedChange: (c) => onChange?.({ target: { checked: c } }),
3033
+ 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",
3034
+ children: /* @__PURE__ */ jsx(
3035
+ SwitchPrimitive.Thumb,
3036
+ {
3037
+ 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]",
3038
+ children: checkedIcon && uncheckedIcon ? checked ? checkedIcon : uncheckedIcon : null
3039
+ }
3040
+ )
3041
+ }
3042
+ ) }) });
3046
3043
  }
3047
3044
  function AutoComplete({
3048
3045
  disabled,
@@ -3185,11 +3182,17 @@ function TreeSelect({
3185
3182
  const [activeIndex, setActiveIndex] = useState(0);
3186
3183
  const listRef = useRef(null);
3187
3184
  const visible = useMemo(() => flattenVisible(items, expanded), [items, expanded]);
3185
+ const didSyncOnOpenRef = useRef(false);
3188
3186
  useEffect(() => {
3189
- if (!open) return;
3187
+ if (!open) {
3188
+ didSyncOnOpenRef.current = false;
3189
+ return;
3190
+ }
3191
+ if (didSyncOnOpenRef.current) return;
3190
3192
  const selectedIdx = visible.findIndex((v) => v.node.key === value);
3191
3193
  setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
3192
- }, [open, visible, value]);
3194
+ didSyncOnOpenRef.current = true;
3195
+ }, [open, value]);
3193
3196
  const selectedNode = useMemo(
3194
3197
  () => value != null ? findNodeByKey(items, value) : null,
3195
3198
  [items, value]