@ox0/ui 3.21.1 → 3.22.0

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.
@@ -7,8 +7,10 @@
7
7
  * waits for the cooldown period before hovering another element, the warmup
8
8
  * timer restarts."
9
9
  */
10
+ export declare const WARMUP_MS = 1000;
10
11
  export declare const tooltipManager: {
11
- getDelay(): number;
12
+ /** The wait before opening: none while warm, otherwise the tooltip's warmup. */
13
+ getDelay(warmup?: number): number;
12
14
  onOpen(): void;
13
15
  onClose(): void;
14
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-manager.d.ts","sourceRoot":"","sources":["../../src/components/tooltip-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,eAAO,MAAM,cAAc;IACzB,QAAQ,IAAI,MAAM;IAIlB,MAAM,IAAI,IAAI;IAQd,OAAO,IAAI,IAAI;CAOhB,CAAA"}
1
+ {"version":3,"file":"tooltip-manager.d.ts","sourceRoot":"","sources":["../../src/components/tooltip-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,SAAS,OAAO,CAAA;AAM7B,eAAO,MAAM,cAAc;IACzB,gFAAgF;IAChF,QAAQ,UAAS,MAAM,GAAe,MAAM;IAI5C,MAAM,IAAI,IAAI;IAQd,OAAO,IAAI,IAAI;CAOhB,CAAA"}
@@ -14,6 +14,12 @@ export interface TooltipProps {
14
14
  * content already exposed to assistive technology, like a truncated value shown in full.
15
15
  */
16
16
  readonly anchor?: Element | null;
17
+ /**
18
+ * Milliseconds to hover before the first tooltip opens. Once one is showing, others open
19
+ * immediately, and focus always opens at once. Shorten it for help icons whose only job is
20
+ * the tooltip. @default 1000
21
+ */
22
+ readonly delay?: number;
17
23
  }
18
24
  export interface TooltipTriggerProps {
19
25
  /**
@@ -26,7 +32,7 @@ export interface TooltipContentProps {
26
32
  /** Tooltip content. Keep it brief — use a Popover for rich content. */
27
33
  readonly children: ReactNode;
28
34
  }
29
- export declare function Tooltip({ children, placement, isDisabled, anchor, }: TooltipProps): ReactElement;
35
+ export declare function Tooltip({ children, placement, isDisabled, anchor, delay: warmup, }: TooltipProps): ReactElement;
30
36
  export declare function TooltipTrigger({ children }: TooltipTriggerProps): ReactElement;
31
37
  export declare function TooltipContent({ children }: TooltipContentProps): ReactElement | null;
32
38
  //# sourceMappingURL=tooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.tsx"],"names":[],"mappings":"AAaA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,SAAS,EASf,MAAM,OAAO,CAAA;AAOd,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,WAAW,GACX,SAAS,GACT,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,aAAa,GACb,WAAW,CAAA;AAyBf,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B,0FAA0F;IAC1F,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAA;IACrC,6CAA6C;IAC7C,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAC7B;AAID,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,SAAiB,EACjB,UAAkB,EAClB,MAAM,GACP,EAAE,YAAY,GAAG,YAAY,CA4H7B;AAID,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE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AAE,QAAQ,EAAE,EAAE,mBAAmB,GAAG,YAAY,GAAG,IAAI,CAkBrF"}
package/dist/index.js CHANGED
@@ -7660,8 +7660,8 @@ const COOLDOWN_MS = 500;
7660
7660
  let warm = false;
7661
7661
  let cooldownTimer = null;
7662
7662
  const tooltipManager = {
7663
- getDelay () {
7664
- return warm ? 0 : WARMUP_MS;
7663
+ getDelay (warmup = WARMUP_MS) {
7664
+ return warm ? 0 : warmup;
7665
7665
  },
7666
7666
  onOpen () {
7667
7667
  if (null !== cooldownTimer) {
@@ -7693,7 +7693,7 @@ function useTooltipContext() {
7693
7693
  if (!ctx) throw new Error("TooltipTrigger and TooltipContent must be used inside <Tooltip>");
7694
7694
  return ctx;
7695
7695
  }
7696
- function Tooltip({ children, placement = "top", isDisabled = false, anchor }) {
7696
+ function Tooltip({ children, placement = "top", isDisabled = false, anchor, delay: warmup = 1000 }) {
7697
7697
  const [open, setOpen] = useState(false);
7698
7698
  const openTimerRef = useRef(null);
7699
7699
  const isHoveringRef = useRef(false);
@@ -7766,7 +7766,7 @@ function Tooltip({ children, placement = "top", isDisabled = false, anchor }) {
7766
7766
  if ("touch" === e.pointerType) return;
7767
7767
  if (isHoveringRef.current) return;
7768
7768
  isHoveringRef.current = true;
7769
- const delay = tooltipManager.getDelay();
7769
+ const delay = tooltipManager.getDelay(warmup);
7770
7770
  if (0 === delay) doOpen();
7771
7771
  else openTimerRef.current = setTimeout(()=>{
7772
7772
  openTimerRef.current = null;
@@ -7795,13 +7795,13 @@ function Tooltip({ children, placement = "top", isDisabled = false, anchor }) {
7795
7795
  isHoveringRef.current = null !== anchor;
7796
7796
  let timer;
7797
7797
  if (null === anchor) tryClose();
7798
- else if (0 === tooltipManager.getDelay()) doOpen();
7798
+ else if (0 === tooltipManager.getDelay(warmup)) doOpen();
7799
7799
  else {
7800
7800
  clearOpenTimer();
7801
7801
  timer = setTimeout(()=>{
7802
7802
  openTimerRef.current = null;
7803
7803
  doOpen();
7804
- }, tooltipManager.getDelay());
7804
+ }, tooltipManager.getDelay(warmup));
7805
7805
  openTimerRef.current = timer;
7806
7806
  }
7807
7807
  return ()=>clearTimeout(timer);
@@ -7811,7 +7811,8 @@ function Tooltip({ children, placement = "top", isDisabled = false, anchor }) {
7811
7811
  refs,
7812
7812
  doOpen,
7813
7813
  tryClose,
7814
- clearOpenTimer
7814
+ clearOpenTimer,
7815
+ warmup
7815
7816
  ]);
7816
7817
  const value = {
7817
7818
  open,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox0/ui",
3
- "version": "3.21.1",
3
+ "version": "3.22.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/esturcke/ox0-platform.git",
@@ -25,9 +25,9 @@
25
25
  "@internationalized/date": "^3.12.4",
26
26
  "react-aria": "^3.53.1",
27
27
  "react-stately": "^3.51.0",
28
- "@ox0/i18n": "0.5.0",
29
28
  "@ox0/hooks": "0.4.0",
30
- "@ox0/tokens": "0.8.1"
29
+ "@ox0/tokens": "0.8.1",
30
+ "@ox0/i18n": "0.5.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "react-intl": "^12.1.5"