@krpkg/ui 0.4.0 → 0.4.2

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.mjs CHANGED
@@ -653,6 +653,7 @@ var TerminalWindow = forwardRef12(
653
653
  TerminalWindow.displayName = "TerminalWindow";
654
654
 
655
655
  // src/components/Tooltip.tsx
656
+ import { useState as useState3, useRef } from "react";
656
657
  import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
657
658
  var Tooltip = ({
658
659
  content,
@@ -662,18 +663,51 @@ var Tooltip = ({
662
663
  shortcut,
663
664
  className = ""
664
665
  }) => {
665
- return /* @__PURE__ */ jsxs11("div", { className: `kz-tooltip-wrapper ${className}`, children: [
666
- children,
667
- /* @__PURE__ */ jsxs11("div", { className: `kz-tooltip-bubble kz-tooltip-${position}`, children: [
668
- /* @__PURE__ */ jsxs11("div", { className: "kz-tooltip-content", children: [
669
- coord && /* @__PURE__ */ jsx15("span", { className: "kz-tooltip-coord", children: coord }),
670
- /* @__PURE__ */ jsx15("span", { className: "kz-tooltip-text", children: content }),
671
- shortcut && /* @__PURE__ */ jsx15("kbd", { className: "kz-tooltip-shortcut", children: shortcut })
672
- ] }),
673
- /* @__PURE__ */ jsx15("div", { className: "kz-tooltip-arrow" })
674
- ] })
675
- ] });
666
+ const [isVisible, setIsVisible] = useState3(false);
667
+ const timeoutRef = useRef(null);
668
+ const show = () => {
669
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
670
+ setIsVisible(true);
671
+ };
672
+ const hide = () => {
673
+ timeoutRef.current = setTimeout(() => {
674
+ setIsVisible(false);
675
+ }, 100);
676
+ };
677
+ return /* @__PURE__ */ jsxs11(
678
+ "div",
679
+ {
680
+ className: `kz-tooltip-wrapper ${className}`,
681
+ onMouseEnter: show,
682
+ onMouseLeave: hide,
683
+ onFocus: show,
684
+ onBlur: hide,
685
+ children: [
686
+ children,
687
+ isVisible && /* @__PURE__ */ jsxs11(
688
+ "div",
689
+ {
690
+ role: "tooltip",
691
+ className: `kz-tooltip-box kz-tooltip-${position}`,
692
+ children: [
693
+ coord && /* @__PURE__ */ jsxs11("span", { className: "kz-tooltip-coord", children: [
694
+ "[",
695
+ coord,
696
+ "]"
697
+ ] }),
698
+ /* @__PURE__ */ jsxs11("div", { className: "kz-tooltip-content", children: [
699
+ /* @__PURE__ */ jsx15("span", { className: "kz-tooltip-text", children: content }),
700
+ shortcut && /* @__PURE__ */ jsx15("kbd", { className: "kz-tooltip-shortcut", children: shortcut })
701
+ ] }),
702
+ /* @__PURE__ */ jsx15("div", { className: "kz-tooltip-arrow" })
703
+ ]
704
+ }
705
+ )
706
+ ]
707
+ }
708
+ );
676
709
  };
710
+ Tooltip.displayName = "Tooltip";
677
711
 
678
712
  // src/components/SegmentedControl.tsx
679
713
  import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
@@ -927,7 +961,7 @@ function TacticalDrawer({
927
961
  }
928
962
 
929
963
  // src/components/HudToast.tsx
930
- import { useEffect as useEffect3, useState as useState3 } from "react";
964
+ import { useEffect as useEffect3, useState as useState4 } from "react";
931
965
  import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
932
966
  function HudToast({
933
967
  isOpen,
@@ -939,7 +973,7 @@ function HudToast({
939
973
  coord = "HUD // NOTIFY",
940
974
  className = ""
941
975
  }) {
942
- const [progress, setProgress] = useState3(100);
976
+ const [progress, setProgress] = useState4(100);
943
977
  useEffect3(() => {
944
978
  if (!isOpen || duration <= 0) return;
945
979
  setProgress(100);
@@ -1046,9 +1080,9 @@ function BottomBar({
1046
1080
  }
1047
1081
 
1048
1082
  // src/components/Slider.tsx
1049
- import { forwardRef as forwardRef13 } from "react";
1083
+ import { forwardRef as forwardRef14 } from "react";
1050
1084
  import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
1051
- var Slider = forwardRef13(
1085
+ var Slider = forwardRef14(
1052
1086
  ({
1053
1087
  className = "",
1054
1088
  label,
@@ -1113,9 +1147,9 @@ var Slider = forwardRef13(
1113
1147
  Slider.displayName = "Slider";
1114
1148
 
1115
1149
  // src/components/ColorPicker.tsx
1116
- import { forwardRef as forwardRef14, useState as useState4, useRef, useEffect as useEffect4 } from "react";
1150
+ import { forwardRef as forwardRef15, useState as useState5, useRef as useRef2, useEffect as useEffect4 } from "react";
1117
1151
  import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
1118
- var ColorPicker = forwardRef14(
1152
+ var ColorPicker = forwardRef15(
1119
1153
  ({
1120
1154
  value,
1121
1155
  onChange,
@@ -1141,8 +1175,8 @@ var ColorPicker = forwardRef14(
1141
1175
  size = "md",
1142
1176
  className = ""
1143
1177
  }, ref) => {
1144
- const [isOpen, setIsOpen] = useState4(false);
1145
- const containerRef = useRef(null);
1178
+ const [isOpen, setIsOpen] = useState5(false);
1179
+ const containerRef = useRef2(null);
1146
1180
  useEffect4(() => {
1147
1181
  const handleOutsideClick = (e) => {
1148
1182
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -1237,9 +1271,9 @@ var ColorPicker = forwardRef14(
1237
1271
  ColorPicker.displayName = "ColorPicker";
1238
1272
 
1239
1273
  // src/components/DropdownMenu.tsx
1240
- import { forwardRef as forwardRef15, useState as useState5, useRef as useRef2, useEffect as useEffect5 } from "react";
1274
+ import { forwardRef as forwardRef16, useState as useState6, useRef as useRef3, useEffect as useEffect5 } from "react";
1241
1275
  import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
1242
- var DropdownMenu = forwardRef15(
1276
+ var DropdownMenu = forwardRef16(
1243
1277
  ({
1244
1278
  trigger,
1245
1279
  items,
@@ -1249,8 +1283,8 @@ var DropdownMenu = forwardRef15(
1249
1283
  className = "",
1250
1284
  disabled = false
1251
1285
  }, ref) => {
1252
- const [isOpen, setIsOpen] = useState5(false);
1253
- const containerRef = useRef2(null);
1286
+ const [isOpen, setIsOpen] = useState6(false);
1287
+ const containerRef = useRef3(null);
1254
1288
  useEffect5(() => {
1255
1289
  const handleOutsideClick = (e) => {
1256
1290
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -1333,9 +1367,9 @@ var DropdownMenu = forwardRef15(
1333
1367
  DropdownMenu.displayName = "DropdownMenu";
1334
1368
 
1335
1369
  // src/components/Popover.tsx
1336
- import { forwardRef as forwardRef16, useState as useState6, useRef as useRef3, useEffect as useEffect6 } from "react";
1370
+ import { forwardRef as forwardRef17, useState as useState7, useRef as useRef4, useEffect as useEffect6 } from "react";
1337
1371
  import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
1338
- var Popover = forwardRef16(
1372
+ var Popover = forwardRef17(
1339
1373
  ({
1340
1374
  trigger,
1341
1375
  children,
@@ -1349,10 +1383,10 @@ var Popover = forwardRef16(
1349
1383
  onOpenChange,
1350
1384
  disabled = false
1351
1385
  }, ref) => {
1352
- const [internalOpen, setInternalOpen] = useState6(defaultOpen);
1386
+ const [internalOpen, setInternalOpen] = useState7(defaultOpen);
1353
1387
  const isControlled = controlledOpen !== void 0;
1354
1388
  const open = isControlled ? controlledOpen : internalOpen;
1355
- const containerRef = useRef3(null);
1389
+ const containerRef = useRef4(null);
1356
1390
  const toggleOpen = () => {
1357
1391
  if (disabled) return;
1358
1392
  const next = !open;