@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 +25 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -22
- package/dist/index.js.map +1 -1
- package/dist/styles.css +21 -3
- package/package.json +1 -1
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__ */
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
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)
|
|
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
|
-
|
|
3194
|
+
didSyncOnOpenRef.current = true;
|
|
3195
|
+
}, [open, value]);
|
|
3193
3196
|
const selectedNode = useMemo(
|
|
3194
3197
|
() => value != null ? findNodeByKey(items, value) : null,
|
|
3195
3198
|
[items, value]
|