haze-ui 1.12.2 → 1.13.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.
Files changed (52) hide show
  1. package/README.md +63 -0
  2. package/dist/components/ColorPicker/ColorPickerCore.js +2 -0
  3. package/dist/components/Combobox/Combobox.js +45 -34
  4. package/dist/components/Command/Command.js +72 -37
  5. package/dist/components/ContextMenu/ContextMenu.js +19 -17
  6. package/dist/components/ContextMenu/ContextMenuContent.js +24 -12
  7. package/dist/components/ContextMenu/ContextMenuItem.js +2 -0
  8. package/dist/components/DateRangePicker/DateRangePickerCore.js +2 -0
  9. package/dist/components/Datepicker/Calendar.js +58 -44
  10. package/dist/components/Datepicker/DatepickerCore.js +37 -29
  11. package/dist/components/DropdownMenu/DropdownMenu.js +20 -20
  12. package/dist/components/DropdownMenu/DropdownMenuContent.js +38 -45
  13. package/dist/components/DropdownMenu/DropdownMenuTrigger.js +9 -7
  14. package/dist/components/InlineEdit/InlineEdit.js +1 -0
  15. package/dist/components/Menu/Menu.js +38 -26
  16. package/dist/components/Menu/MenuItem.js +1 -0
  17. package/dist/components/ModelPicker/ModelPicker.js +1 -0
  18. package/dist/components/OTPInput/OTPInputCore.js +1 -0
  19. package/dist/components/PasswordInput/PasswordInputCore.js +1 -0
  20. package/dist/components/Popover/Popover.js +32 -75
  21. package/dist/components/Progress/Progress.js +2 -0
  22. package/dist/components/Tooltip/Tooltip.js +50 -24
  23. package/dist/components/Tree/TreeItem.js +44 -41
  24. package/dist/components/Upload/Upload.js +1 -0
  25. package/dist/css/combobox.css +2 -1
  26. package/dist/css/command.css +1 -1
  27. package/dist/css/context-menu.css +1 -0
  28. package/dist/css/datepicker.css +3 -2
  29. package/dist/css/dropdown-menu.css +2 -1
  30. package/dist/css/menu.css +2 -1
  31. package/dist/css/popover.css +2 -1
  32. package/dist/css/tooltip.css +2 -1
  33. package/dist/form/FormItem.js +23 -15
  34. package/dist/haze-ui.css +15 -8
  35. package/dist/types/components/ContextMenu/ContextMenuContent.d.ts +1 -1
  36. package/dist/types/components/ContextMenu/ContextMenuContext.d.ts +5 -1
  37. package/dist/types/components/DropdownMenu/DropdownMenuContent.d.ts +1 -1
  38. package/dist/types/components/DropdownMenu/DropdownMenuContext.d.ts +3 -0
  39. package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts +1 -1
  40. package/dist/types/components/Tooltip/Tooltip.d.ts +5 -1
  41. package/dist/types/form/FormItem.d.ts +63 -7
  42. package/dist/types/form/index.d.ts +1 -1
  43. package/dist/types/index.d.ts +1 -1
  44. package/dist/types/utils/floating.d.ts +99 -0
  45. package/dist/types/utils/menuKeyboard.d.ts +43 -0
  46. package/dist/utils/floating.js +181 -0
  47. package/dist/utils/menuKeyboard.js +88 -0
  48. package/package.json +34 -8
  49. package/dist/components/DropdownMenu/useMenuKeyboard.js +0 -52
  50. package/dist/types/components/DropdownMenu/useMenuKeyboard.d.ts +0 -19
  51. package/dist/types/hooks/index.d.ts +0 -1
  52. package/dist/types/utils/index.d.ts +0 -1
@@ -1,42 +1,50 @@
1
1
 
2
2
  import { classnames as e } from "../../utils/classnames.js";
3
- import t from "./Calendar.js";
3
+ import { FloatingPanel as t, useFloating as n } from "../../utils/floating.js";
4
+ import r from "./Calendar.js";
4
5
  /* empty css */
5
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
6
- import { useEffect as i, useRef as a } from "react";
6
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
7
+ import { useCallback as o, useId as s, useRef as c } from "react";
7
8
  //#region src/lib/components/Datepicker/DatepickerCore.tsx
8
- var o = "haze-DatepickerCore__wrapper", s = "haze-DatepickerCore__input", c = "haze-DatepickerCore__dropdown", l = "haze-DatepickerCore__hiddenStyle";
9
- function u({ value: u, onChange: d, open: f, onOpenChange: p, min: m, max: h, placeholder: g = "Select date", className: _ }) {
10
- let v = a(null);
11
- return i(() => {
12
- if (!f) return;
13
- let e = (e) => {
14
- v.current && !v.current.contains(e.target) && p(!1);
15
- };
16
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
17
- }, [f, p]), /* @__PURE__ */ r("div", {
18
- ref: v,
19
- className: e([o, _]),
20
- children: [/* @__PURE__ */ n("input", {
9
+ var l = "haze-DatepickerCore__wrapper", u = "haze-DatepickerCore__input", d = "haze-DatepickerCore__dropdown";
10
+ function f({ value: f, onChange: p, open: m, onOpenChange: h, min: g, max: _, placeholder: v = "Select date", className: y }) {
11
+ let b = c(null), x = c(null), S = s(), C = o((e) => h(typeof e == "function" ? e(m) : e), [h, m]), w = n({
12
+ open: m,
13
+ setOpen: C,
14
+ triggerRef: b,
15
+ panelRef: x
16
+ });
17
+ return /* @__PURE__ */ a("div", {
18
+ className: e([l, y]),
19
+ children: [/* @__PURE__ */ i("input", {
20
+ ref: b,
21
21
  readOnly: !0,
22
- className: s,
23
- value: u,
24
- placeholder: g,
25
- onClick: () => p(!f),
22
+ style: w.triggerStyle,
23
+ className: u,
24
+ value: f,
25
+ placeholder: v,
26
+ role: "combobox",
26
27
  "aria-haspopup": "dialog",
27
- "aria-expanded": f
28
- }), /* @__PURE__ */ n("div", {
29
- className: e([c, !f && l]),
30
- children: /* @__PURE__ */ n(t, {
31
- value: u,
32
- min: m,
33
- max: h,
28
+ "aria-expanded": m,
29
+ "aria-controls": S,
30
+ onPointerDown: w.onTriggerPointerDown,
31
+ onClick: w.onTriggerClick
32
+ }), /* @__PURE__ */ i(t, {
33
+ ref: x,
34
+ behavior: w,
35
+ placement: "bottom",
36
+ visualClass: d,
37
+ id: S,
38
+ children: /* @__PURE__ */ i(r, {
39
+ value: f,
40
+ min: g,
41
+ max: _,
34
42
  onSelect: (e) => {
35
- d(e), p(!1);
43
+ p(e), h(!1);
36
44
  }
37
45
  })
38
46
  })]
39
47
  });
40
48
  }
41
49
  //#endregion
42
- export { u as default };
50
+ export { f as default };
@@ -1,38 +1,38 @@
1
1
 
2
2
  import { classnames as e } from "../../utils/classnames.js";
3
- import { DropdownMenuProvider as t } from "./DropdownMenuContext.js";
3
+ import { useFloating as t } from "../../utils/floating.js";
4
+ import { DropdownMenuProvider as n } from "./DropdownMenuContext.js";
4
5
  /* empty css */
5
- import { jsx as n } from "react/jsx-runtime";
6
- import { useControl as r } from "react-use-control";
7
- import { useCallback as i, useEffect as a, useId as o, useRef as s } from "react";
6
+ import { jsx as r } from "react/jsx-runtime";
7
+ import { useControl as i } from "react-use-control";
8
+ import { useCallback as a, useId as o, useRef as s } from "react";
8
9
  //#region src/lib/components/DropdownMenu/DropdownMenu.tsx
9
10
  var c = "haze-DropdownMenu__wrapper";
10
11
  function l({ open: l, onOpenChange: u, children: d, className: f }) {
11
- let [p, m] = r(l, !1), h = s(null), g = s(null), _ = s(null), v = o(), y = s(null), b = i((e) => {
12
+ let [p, m] = i(l, !1), h = s(null), g = s(null), _ = o(), v = s(null), y = a((e) => {
12
13
  let t = typeof e == "function" ? e(p) : e;
13
14
  m(t), u?.(t);
14
15
  }, [
15
16
  p,
16
17
  m,
17
18
  u
18
- ]);
19
- return a(() => {
20
- if (!p) return;
21
- let e = (e) => {
22
- h.current && !h.current.contains(e.target) && b(!1);
23
- };
24
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
25
- }, [p, b]), /* @__PURE__ */ n(t, {
19
+ ]), b = t({
20
+ open: p,
21
+ setOpen: y,
22
+ triggerRef: h,
23
+ panelRef: g
24
+ });
25
+ return /* @__PURE__ */ r(n, {
26
26
  value: {
27
27
  open: p,
28
- setOpen: b,
29
- triggerRef: g,
30
- contentRef: _,
31
- contentId: v,
32
- focusRequestRef: y
28
+ setOpen: y,
29
+ triggerRef: h,
30
+ contentRef: g,
31
+ contentId: _,
32
+ focusRequestRef: v,
33
+ floating: b
33
34
  },
34
- children: n("div", {
35
- ref: h,
35
+ children: r("div", {
36
36
  className: e([c, f]),
37
37
  children: d
38
38
  })
@@ -1,55 +1,48 @@
1
1
 
2
- import { classnames as e } from "../../utils/classnames.js";
3
- import { useDropdownMenuContext as t } from "./DropdownMenuContext.js";
4
- import { getEnabledMenuItems as n, useMenuKeyboard as r } from "./useMenuKeyboard.js";
2
+ import { FloatingPanel as e } from "../../utils/floating.js";
3
+ import { getEnabledMenuItems as t, useMenuKeyboard as n, useRovingTabindex as r } from "../../utils/menuKeyboard.js";
4
+ import { useDropdownMenuContext as i } from "./DropdownMenuContext.js";
5
5
  /* empty css */
6
- import { jsx as i } from "react/jsx-runtime";
7
- import { useCallback as a, useEffect as o } from "react";
6
+ import { jsx as a } from "react/jsx-runtime";
7
+ import { useCallback as o, useEffect as s } from "react";
8
8
  //#region src/lib/components/DropdownMenu/DropdownMenuContent.tsx
9
- var s = "haze-DropdownMenuContent__content", c = {
10
- start: "haze-DropdownMenuContent__alignStart",
11
- center: "haze-DropdownMenuContent__alignCenter",
12
- end: "haze-DropdownMenuContent__alignEnd"
9
+ var c = "haze-DropdownMenuContent__content", l = {
10
+ start: "bottom",
11
+ center: "bottom-center",
12
+ end: "bottom-end"
13
13
  };
14
- function l({ children: l, align: u = "start", className: d }) {
15
- let { open: f, setOpen: p, triggerRef: m, contentRef: h, contentId: g, focusRequestRef: _ } = t(), v = a(() => {
16
- p(!1), m.current?.focus();
17
- }, [p, m]), y = r({
18
- menuRef: h,
19
- onClose: v
14
+ function u({ children: u, align: d = "start", className: f }) {
15
+ let { open: p, setOpen: m, triggerRef: h, contentRef: g, contentId: _, focusRequestRef: v, floating: y } = i(), b = o(() => {
16
+ m(!1), h.current?.focus();
17
+ }, [m, h]), x = n({
18
+ menuRef: g,
19
+ onClose: b
20
20
  });
21
- return o(() => {
22
- if (!f) return;
23
- let e = h.current;
24
- if (!e) return;
25
- let t = n(e);
26
- t.forEach((e) => {
27
- e.tabIndex = -1;
28
- }), t[0] && (t[0].tabIndex = 0);
29
- let r = _.current;
30
- _.current = null, r && (r === "first" ? t[0] : t[t.length - 1])?.focus();
31
- let i = (t) => {
32
- n(e).forEach((e) => {
33
- e.tabIndex = e === t.target ? 0 : -1;
34
- });
35
- };
36
- return e.addEventListener("focusin", i), () => e.removeEventListener("focusin", i);
21
+ return r({
22
+ menuRef: g,
23
+ active: p
24
+ }), s(() => {
25
+ if (!p || !y.shown) return;
26
+ let e = v.current;
27
+ if (v.current = null, !e) return;
28
+ let n = t(g.current);
29
+ (e === "first" ? n[0] : n[n.length - 1])?.focus();
37
30
  }, [
38
- f,
39
- h,
40
- _
41
- ]), f ? /* @__PURE__ */ i("div", {
42
- ref: h,
43
- id: g,
31
+ p,
32
+ y.shown,
33
+ g,
34
+ v
35
+ ]), p ? /* @__PURE__ */ a(e, {
36
+ ref: g,
37
+ behavior: y,
38
+ placement: l[d],
39
+ id: _,
44
40
  role: "menu",
45
- onKeyDown: y,
46
- className: e([
47
- s,
48
- c[u],
49
- d
50
- ]),
51
- children: l
41
+ visualClass: c,
42
+ className: f,
43
+ onKeyDown: x,
44
+ children: u
52
45
  }) : null;
53
46
  }
54
47
  //#endregion
55
- export { l as default };
48
+ export { u as default };
@@ -1,16 +1,16 @@
1
1
 
2
2
  import { classnames as e } from "../../utils/classnames.js";
3
- import { useDropdownMenuContext as t } from "./DropdownMenuContext.js";
4
- import { getEnabledMenuItems as n } from "./useMenuKeyboard.js";
3
+ import { getEnabledMenuItems as t } from "../../utils/menuKeyboard.js";
4
+ import { useDropdownMenuContext as n } from "./DropdownMenuContext.js";
5
5
  /* empty css */
6
6
  import { jsx as r } from "react/jsx-runtime";
7
7
  //#region src/lib/components/DropdownMenu/DropdownMenuTrigger.tsx
8
8
  var i = "haze-DropdownMenuTrigger__trigger";
9
9
  function a({ children: a, className: o }) {
10
- let { open: s, setOpen: c, triggerRef: l, contentRef: u, contentId: d, focusRequestRef: f } = t(), p = (e) => {
10
+ let { open: s, setOpen: c, triggerRef: l, contentRef: u, contentId: d, focusRequestRef: f, floating: p } = n(), m = (e) => {
11
11
  if (s) {
12
- let t = n(u.current);
13
- (e === "first" ? t[0] : t[t.length - 1])?.focus();
12
+ let n = t(u.current);
13
+ (e === "first" ? n[0] : n[n.length - 1])?.focus();
14
14
  } else f.current = e, c(!0);
15
15
  };
16
16
  return /* @__PURE__ */ r("button", {
@@ -19,9 +19,11 @@ function a({ children: a, className: o }) {
19
19
  "aria-haspopup": "menu",
20
20
  "aria-expanded": s,
21
21
  "aria-controls": s ? d : void 0,
22
- onClick: () => c((e) => !e),
22
+ style: p.triggerStyle,
23
+ onPointerDown: p.onTriggerPointerDown,
24
+ onClick: p.onTriggerClick,
23
25
  onKeyDown: (e) => {
24
- e.key === "ArrowDown" ? (e.preventDefault(), p("first")) : e.key === "ArrowUp" && (e.preventDefault(), p("last"));
26
+ e.key === "ArrowDown" ? (e.preventDefault(), m("first")) : e.key === "ArrowUp" && (e.preventDefault(), m("last"));
25
27
  },
26
28
  className: e([i, o]),
27
29
  children: a
@@ -20,6 +20,7 @@ function l({ value: l, onChange: u, placeholder: d = "Click to edit", disabled:
20
20
  };
21
21
  return g ? /* @__PURE__ */ t("input", {
22
22
  ref: b,
23
+ "aria-label": d,
23
24
  value: v,
24
25
  onChange: (e) => y(e.target.value),
25
26
  onBlur: S,
@@ -1,35 +1,47 @@
1
1
 
2
2
  import { classnames as e } from "../../utils/classnames.js";
3
+ import { FloatingPanel as t, useFloating as n } from "../../utils/floating.js";
4
+ import { useMenuKeyboard as r, useRovingTabindex as i } from "../../utils/menuKeyboard.js";
3
5
  /* empty css */
4
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
5
- import { useControl as r } from "react-use-control";
6
- import { useEffect as i, useRef as a } from "react";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ import { useControl as s } from "react-use-control";
8
+ import { useRef as c } from "react";
7
9
  //#region src/lib/components/Menu/Menu.tsx
8
- var o = "haze-Menu__container", s = "haze-Menu__panel", c = "haze-Menu__hidden";
9
- function l({ open: l, trigger: u, className: d, children: f }) {
10
- let [p, m] = r(l, !1), h = a(null);
11
- return i(() => {
12
- if (!p) return;
13
- let e = (e) => {
14
- h.current && !h.current.contains(e.target) && m(!1);
15
- };
16
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
17
- }, [p, m]), /* @__PURE__ */ n("div", {
18
- ref: h,
19
- className: o,
20
- children: [/* @__PURE__ */ t("span", {
21
- onClick: () => m((e) => !e),
22
- children: u
23
- }), /* @__PURE__ */ t("div", {
24
- role: "menu",
25
- className: e([
26
- s,
27
- !p && c,
28
- d
29
- ]),
10
+ var l = "haze-Menu__container", u = "haze-Menu__panel";
11
+ function d({ open: d, trigger: f, className: p, children: m }) {
12
+ let [h, g] = s(d, !1), _ = c(null), v = c(null), y = n({
13
+ open: h,
14
+ setOpen: g,
15
+ triggerRef: _,
16
+ panelRef: v
17
+ });
18
+ i({
19
+ menuRef: v,
20
+ active: h
21
+ });
22
+ let b = r({
23
+ menuRef: v,
24
+ onClose: () => g(!1)
25
+ });
26
+ return /* @__PURE__ */ o("div", {
27
+ className: e(l),
28
+ children: [/* @__PURE__ */ a("span", {
29
+ ref: _,
30
+ style: y.triggerStyle,
31
+ onPointerDown: y.onTriggerPointerDown,
32
+ onClick: y.onTriggerClick,
30
33
  children: f
34
+ }), /* @__PURE__ */ a(t, {
35
+ ref: v,
36
+ behavior: y,
37
+ placement: "bottom",
38
+ role: "menu",
39
+ visualClass: u,
40
+ className: p,
41
+ onKeyDown: b,
42
+ children: m
31
43
  })]
32
44
  });
33
45
  }
34
46
  //#endregion
35
- export { l as default };
47
+ export { d as default };
@@ -8,6 +8,7 @@ function r({ onSelect: r, disabled: i = !1, className: a, children: o }) {
8
8
  return /* @__PURE__ */ t("button", {
9
9
  type: "button",
10
10
  role: "menuitem",
11
+ tabIndex: -1,
11
12
  disabled: i,
12
13
  onClick: r,
13
14
  className: e([n, a]),
@@ -10,6 +10,7 @@ function o({ value: o, onChange: s, options: c, disabled: l, className: u }) {
10
10
  return /* @__PURE__ */ t("div", {
11
11
  className: e([i, u]),
12
12
  children: t("select", {
13
+ "aria-label": "Model",
13
14
  value: d,
14
15
  onChange: (e) => {
15
16
  f(e.target.value), s?.(e.target.value);
@@ -31,6 +31,7 @@ function o({ length: o = 6, value: s, onChange: c, className: l }) {
31
31
  type: "text",
32
32
  inputMode: "numeric",
33
33
  maxLength: 1,
34
+ "aria-label": `Digit ${r + 1} of ${o}`,
34
35
  value: s[r] ?? "",
35
36
  onChange: (e) => d(r, e.target.value),
36
37
  onKeyDown: (e) => f(r, e),
@@ -11,6 +11,7 @@ function s({ value: s, onChange: c, placeholder: l, disabled: u, className: d })
11
11
  className: e([i, d]),
12
12
  children: [/* @__PURE__ */ t("input", {
13
13
  type: f ? "text" : "password",
14
+ "aria-label": "Password",
14
15
  value: s,
15
16
  onChange: (e) => c(e.target.value),
16
17
  placeholder: l,
@@ -1,82 +1,39 @@
1
1
 
2
- import { classnames as e } from "../../utils/classnames.js";
2
+ import { FloatingPanel as e, useFloating as t } from "../../utils/floating.js";
3
3
  /* empty css */
4
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
5
- import { useControl as r } from "react-use-control";
6
- import { useEffect as i, useId as a, useRef as o } from "react";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ import { useControl as i } from "react-use-control";
6
+ import { useId as a, useRef as o } from "react";
7
7
  //#region src/lib/components/Popover/Popover.tsx
8
- var s = 500;
9
- function c() {
10
- return typeof HTMLElement < "u" && "popover" in HTMLElement.prototype;
11
- }
12
- function l() {
13
- return c() && typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --haze-popover-probe");
14
- }
15
- var u = "haze-Popover__container", d = "haze-Popover__panelVisuals", f = "haze-Popover__panelFallback", p = "haze-Popover__hidden", m = "haze-Popover__panelNative", h = "haze-Popover__panelAnchored", g = "haze-Popover__panelJsPositioned";
16
- function _({ content: _, open: v, className: y, children: b }) {
17
- let [x, S] = r(v, !1), C = a(), w = `--haze-popover-${C.replace(/[^a-zA-Z0-9]/g, "")}`, T = c(), E = l(), D = o(null), O = o(null), k = o(!1), A = o(0), j = o(0);
18
- return i(() => {
19
- let e = O.current;
20
- if (!e || !T) return;
21
- let t = (e) => {
22
- let t = e.newState;
23
- k.current = t === "open", t === "closed" && x ? (performance.now() - A.current < s && (j.current = performance.now()), A.current = 0, S(!1)) : t === "open" && !x && S(!0);
24
- };
25
- return e.addEventListener("toggle", t), x && !k.current ? e.showPopover() : !x && k.current && e.hidePopover(), () => e.removeEventListener("toggle", t);
26
- }, [
27
- T,
28
- x,
29
- S
30
- ]), i(() => {
31
- if (!T || E || !x) return;
32
- let e = O.current, t = D.current;
33
- if (!e || !t) return;
34
- let n = () => {
35
- let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).marginTop) || 0;
36
- e.style.top = `${n.bottom + r}px`, e.style.left = `${n.left}px`;
37
- };
38
- return n(), window.addEventListener("scroll", n, !0), window.addEventListener("resize", n), () => {
39
- window.removeEventListener("scroll", n, !0), window.removeEventListener("resize", n);
40
- };
41
- }, [
42
- T,
43
- E,
44
- x
45
- ]), /* @__PURE__ */ n("span", {
46
- className: u,
47
- children: [/* @__PURE__ */ t("span", {
48
- ref: D,
49
- "aria-expanded": x,
50
- "aria-controls": C,
51
- style: E ? { anchorName: w } : void 0,
52
- onPointerDown: () => {
53
- x && (A.current = performance.now());
54
- },
55
- onClick: () => {
56
- if (performance.now() - j.current < s) {
57
- j.current = 0;
58
- return;
59
- }
60
- S((e) => !e);
61
- },
62
- children: b
63
- }), /* @__PURE__ */ t("div", {
64
- id: C,
65
- ref: O,
66
- popover: T ? "auto" : void 0,
67
- style: T && E ? { "--haze-popover-anchor": w } : void 0,
68
- className: e([
69
- d,
70
- T && m,
71
- T && E && h,
72
- T && !E && g,
73
- !T && f,
74
- !T && !x && p,
75
- y
76
- ]),
77
- children: _
8
+ var s = "haze-Popover__container", c = "haze-Popover__panelVisuals";
9
+ function l({ content: l, open: u, className: d, children: f }) {
10
+ let [p, m] = i(u, !1), h = a(), g = o(null), _ = o(null), v = t({
11
+ open: p,
12
+ setOpen: m,
13
+ triggerRef: g,
14
+ panelRef: _
15
+ });
16
+ return /* @__PURE__ */ r("span", {
17
+ className: s,
18
+ children: [/* @__PURE__ */ n("span", {
19
+ ref: g,
20
+ style: v.triggerStyle,
21
+ role: "button",
22
+ "aria-expanded": p,
23
+ "aria-controls": h,
24
+ onPointerDown: v.onTriggerPointerDown,
25
+ onClick: v.onTriggerClick,
26
+ children: f
27
+ }), /* @__PURE__ */ n(e, {
28
+ ref: _,
29
+ behavior: v,
30
+ placement: "bottom-span",
31
+ id: h,
32
+ visualClass: c,
33
+ className: d,
34
+ children: l
78
35
  })]
79
36
  });
80
37
  }
81
38
  //#endregion
82
- export { _ as default };
39
+ export { l as default };
@@ -36,6 +36,7 @@ function m({ value: m = 0, variant: h = "bar", size: g = "md", color: _ = "prima
36
36
  let r = p[g], i = f[g], a = 2 * Math.PI * r, o = a - y / 100 * a;
37
37
  return /* @__PURE__ */ t("div", {
38
38
  role: "progressbar",
39
+ "aria-label": "Progress",
39
40
  "aria-valuemin": 0,
40
41
  "aria-valuemax": 100,
41
42
  "aria-valuenow": y,
@@ -66,6 +67,7 @@ function m({ value: m = 0, variant: h = "bar", size: g = "md", color: _ = "prima
66
67
  }
67
68
  return /* @__PURE__ */ t("div", {
68
69
  role: "progressbar",
70
+ "aria-label": "Progress",
69
71
  "aria-valuemin": 0,
70
72
  "aria-valuemax": 100,
71
73
  "aria-valuenow": y,
@@ -1,33 +1,59 @@
1
1
 
2
2
  import { classnames as e } from "../../utils/classnames.js";
3
+ import { floatingPlacementClasses as t, useFloating as n, useFloatingPosition as r } from "../../utils/floating.js";
3
4
  /* empty css */
4
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
5
- import { useId as r } from "react";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { useControl as o } from "react-use-control";
7
+ import { useEffect as s, useId as c, useRef as l } from "react";
6
8
  //#region src/lib/components/Tooltip/Tooltip.tsx
7
- var i = "haze-Tooltip__wrapper", a = "haze-Tooltip__bubble", o = {
8
- top: "haze-Tooltip__top",
9
- bottom: "haze-Tooltip__bottom",
10
- left: "haze-Tooltip__left",
11
- right: "haze-Tooltip__right"
12
- }, s = "haze-Tooltip__showOnInteract";
13
- function c({ content: c, position: l = "top", className: u, children: d }) {
14
- let f = r();
15
- return /* @__PURE__ */ n("span", {
16
- className: e([
17
- i,
18
- s,
19
- u
20
- ]),
21
- children: [/* @__PURE__ */ t("span", {
22
- "aria-describedby": f,
23
- children: d
24
- }), /* @__PURE__ */ t("span", {
25
- id: f,
9
+ var u = "haze-Tooltip__wrapper", d = "haze-Tooltip__bubble", f = {
10
+ top: "top",
11
+ bottom: "bottom-center",
12
+ left: "left",
13
+ right: "right"
14
+ };
15
+ function p({ content: p, position: m = "top", delay: h = 150, open: g, className: _, children: v }) {
16
+ let [y, b] = o(g, !1), x = c(), S = l(null), C = l(null), w = f[m], T = n({
17
+ open: y,
18
+ setOpen: b,
19
+ triggerRef: S,
20
+ panelRef: C
21
+ });
22
+ r({
23
+ behavior: T,
24
+ placement: w
25
+ });
26
+ let E = l(0);
27
+ s(() => () => window.clearTimeout(E.current), []);
28
+ let D = () => {
29
+ window.clearTimeout(E.current), E.current = window.setTimeout(() => b(!0), h);
30
+ }, O = () => {
31
+ window.clearTimeout(E.current), b(!1);
32
+ };
33
+ return /* @__PURE__ */ a("span", {
34
+ className: e([u, _]),
35
+ children: [/* @__PURE__ */ i("span", {
36
+ ref: S,
37
+ style: T.triggerStyle,
38
+ "aria-describedby": x,
39
+ onMouseEnter: D,
40
+ onMouseLeave: O,
41
+ onFocus: D,
42
+ onBlur: O,
43
+ children: v
44
+ }), /* @__PURE__ */ i("span", {
45
+ id: x,
46
+ ref: C,
26
47
  role: "tooltip",
27
- className: e([a, o[l]]),
28
- children: c
48
+ ...T.panelAttrs,
49
+ className: e([
50
+ d,
51
+ ...T.panelClasses,
52
+ ...t(T, w)
53
+ ]),
54
+ children: p
29
55
  })]
30
56
  });
31
57
  }
32
58
  //#endregion
33
- export { c as default };
59
+ export { p as default };