@jonmilner/ui 0.21.2 → 0.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.
Files changed (97) hide show
  1. package/THIRD_PARTY_NOTICES.md +1 -1
  2. package/dist/AlertDialog/index.d.mts +1 -1
  3. package/dist/Avatar/index.d.mts +1 -1
  4. package/dist/Avatar/index.mjs +5 -5
  5. package/dist/Badge/index.d.mts +1 -1
  6. package/dist/Badge/index.mjs +12 -12
  7. package/dist/Box/index.mjs +1 -1
  8. package/dist/Button/index.d.mts +1 -1
  9. package/dist/Button/index.mjs +22 -22
  10. package/dist/Checkbox/index.mjs +7 -7
  11. package/dist/Chip/index.mjs +35 -35
  12. package/dist/Clickable/index.d.mts +1 -1
  13. package/dist/Clickable/index.mjs +4 -4
  14. package/dist/ColorField/client.mjs +6 -6
  15. package/dist/ColorField/index.mjs +14 -14
  16. package/dist/Combobox/Combobox.css +1 -1
  17. package/dist/Combobox/client.mjs +26 -26
  18. package/dist/Combobox/index.mjs +20 -20
  19. package/dist/Dialog/client.mjs +26 -26
  20. package/dist/Dialog/index.d.mts +1 -1
  21. package/dist/Dialog/index.mjs +19 -19
  22. package/dist/Field/client.mjs +6 -6
  23. package/dist/Field/index.mjs +29 -29
  24. package/dist/IconButton/IconButton.css +1 -1
  25. package/dist/IconButton/IconButton.css.mjs +2 -2
  26. package/dist/IconButton/index.d.mts +5 -2
  27. package/dist/IconButton/index.mjs +60 -21
  28. package/dist/Inline/index.d.mts +2 -2
  29. package/dist/Inline/index.mjs +4 -4
  30. package/dist/Menu/Menu.css +1 -1
  31. package/dist/Menu/Menu.css.mjs +2 -2
  32. package/dist/Menu/client.d.mts +1 -0
  33. package/dist/Menu/client.mjs +95 -53
  34. package/dist/Menu/index.d.mts +8 -0
  35. package/dist/Menu/index.mjs +123 -87
  36. package/dist/MultiSelect/MultiSelect.css +1 -1
  37. package/dist/MultiSelect/client.mjs +4 -4
  38. package/dist/MultiSelect/index.mjs +8 -8
  39. package/dist/NavList/NavList.css +1 -1
  40. package/dist/NavList/client.mjs +3 -3
  41. package/dist/NavList/index.d.mts +3 -3
  42. package/dist/NavList/index.mjs +67 -65
  43. package/dist/NumberField/index.mjs +17 -17
  44. package/dist/RadioGroup/index.mjs +23 -23
  45. package/dist/SearchField/client.mjs +13 -13
  46. package/dist/SearchField/index.mjs +16 -16
  47. package/dist/Select/Select.css +1 -1
  48. package/dist/Select/client.mjs +11 -11
  49. package/dist/Select/index.mjs +8 -8
  50. package/dist/Sidebar/index.d.mts +1 -1
  51. package/dist/Sidebar/index.mjs +21 -21
  52. package/dist/SidebarLayout/index.d.mts +1 -1
  53. package/dist/SidebarLayout/index.mjs +8 -8
  54. package/dist/Stack/index.d.mts +2 -2
  55. package/dist/Stack/index.mjs +4 -4
  56. package/dist/Switch/index.mjs +13 -13
  57. package/dist/Table/index.d.mts +1 -1
  58. package/dist/Table/index.mjs +59 -59
  59. package/dist/Tabs/index.mjs +26 -26
  60. package/dist/Tag/index.d.mts +1 -1
  61. package/dist/Tag/index.mjs +16 -16
  62. package/dist/Text/index.d.mts +2 -2
  63. package/dist/Text/index.mjs +4 -4
  64. package/dist/TextField/index.mjs +16 -16
  65. package/dist/Textarea/index.mjs +9 -9
  66. package/dist/Toast/client.d.mts +2 -1
  67. package/dist/Toast/client.mjs +62 -55
  68. package/dist/Tooltip/base.mjs +13 -13
  69. package/dist/contrast/contrast.d.mts +1 -1
  70. package/dist/contrast/contrast.mjs +9 -9
  71. package/dist/contrast/mixes.mjs +27 -27
  72. package/dist/docs/Combobox.md +1 -0
  73. package/dist/docs/IconButton.md +9 -1
  74. package/dist/docs/Menu.md +51 -3
  75. package/dist/docs/MultiSelect.md +1 -0
  76. package/dist/docs/NavList.md +2 -2
  77. package/dist/docs/Select.md +1 -0
  78. package/dist/docs/Toast.md +7 -0
  79. package/dist/docs/llms.txt +1 -1
  80. package/dist/docs/manifest.json +118 -1
  81. package/dist/docs/migrations/0.22.0.md +35 -0
  82. package/dist/icons/index.d.mts +3 -3
  83. package/dist/icons/index.mjs +33 -33
  84. package/dist/index.d.mts +16 -16
  85. package/dist/index.mjs +39 -39
  86. package/dist/lint/index.mjs +1 -0
  87. package/dist/popup/client.d.mts +1 -1
  88. package/dist/popup/client.mjs +49 -32
  89. package/dist/popup/direction.d.mts +1 -0
  90. package/dist/popup/direction.mjs +23 -0
  91. package/dist/popup/listbox-base.mjs +24 -24
  92. package/dist/popup/listbox-options.mjs +4 -4
  93. package/dist/popup/listbox-row.mjs +1 -0
  94. package/dist/popup/tooltip.d.mts +1 -0
  95. package/dist/popup/tooltip.mjs +48 -42
  96. package/dist/theme/define-theme.mjs +42 -42
  97. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -1,40 +1,40 @@
1
- import { Clickable as e } from "./Clickable/index.mjs";
2
- import { Icon as t } from "./Icon/index.mjs";
3
- import { Text as n } from "./Text/index.mjs";
4
- import { Button as r } from "./Button/index.mjs";
5
- import { Heading as i } from "./Heading/index.mjs";
6
- import { Dialog as a } from "./Dialog/index.mjs";
7
- import { AlertDialog as o } from "./AlertDialog/index.mjs";
8
- import { Avatar as s } from "./Avatar/index.mjs";
9
- import { Badge as c } from "./Badge/index.mjs";
10
- import { Box as l } from "./Box/index.mjs";
11
- import { Checkbox as u } from "./Checkbox/index.mjs";
12
- import { Chip as d, ChipGroup as f } from "./Chip/index.mjs";
13
- import { Field as p } from "./Field/index.mjs";
14
- import { ColorField as m } from "./ColorField/index.mjs";
15
- import { Combobox as h } from "./Combobox/index.mjs";
16
- import { IconButton as g } from "./IconButton/index.mjs";
17
- import { Inline as _ } from "./Inline/index.mjs";
18
- import { Menu as v } from "./Menu/index.mjs";
19
- import { MultiSelect as y } from "./MultiSelect/index.mjs";
20
- import { VisuallyHidden as b } from "./VisuallyHidden/index.mjs";
21
- import { NavList as x } from "./NavList/index.mjs";
22
- import { NumberField as S } from "./NumberField/index.mjs";
23
- import { RadioGroup as C } from "./RadioGroup/index.mjs";
24
- import { SearchField as w } from "./SearchField/index.mjs";
25
- import { Select as T } from "./Select/index.mjs";
26
- import { Sidebar as E } from "./Sidebar/index.mjs";
27
- import { SidebarLayout as D } from "./SidebarLayout/index.mjs";
28
- import { Stack as O } from "./Stack/index.mjs";
29
- import { Switch as k } from "./Switch/index.mjs";
30
- import { Table as A } from "./Table/index.mjs";
31
- import { Tabs as j } from "./Tabs/index.mjs";
32
- import { Tag as M } from "./Tag/index.mjs";
33
- import { Textarea as N } from "./Textarea/index.mjs";
34
- import { TextField as P } from "./TextField/index.mjs";
35
- import { defineTheme as F } from "./theme/define-theme.mjs";
36
- import { ThemeProvider as I } from "./theme/ThemeProvider.mjs";
1
+ import { AlertDialog as e } from "./AlertDialog/index.mjs";
2
+ import { Avatar as t } from "./Avatar/index.mjs";
3
+ import { Badge as n } from "./Badge/index.mjs";
4
+ import { Box as r } from "./Box/index.mjs";
5
+ import { Button as i } from "./Button/index.mjs";
6
+ import { Checkbox as a } from "./Checkbox/index.mjs";
7
+ import { Chip as o, ChipGroup as s } from "./Chip/index.mjs";
8
+ import { Clickable as c } from "./Clickable/index.mjs";
9
+ import { ColorField as l } from "./ColorField/index.mjs";
10
+ import { Combobox as u } from "./Combobox/index.mjs";
11
+ import { Dialog as d } from "./Dialog/index.mjs";
12
+ import { Field as f } from "./Field/index.mjs";
13
+ import { Heading as p } from "./Heading/index.mjs";
14
+ import { Icon as m } from "./Icon/index.mjs";
15
+ import { IconButton as h } from "./IconButton/index.mjs";
16
+ import { Inline as g } from "./Inline/index.mjs";
17
+ import { Menu as _ } from "./Menu/index.mjs";
18
+ import { MultiSelect as v } from "./MultiSelect/index.mjs";
19
+ import { NavList as y } from "./NavList/index.mjs";
20
+ import { NumberField as b } from "./NumberField/index.mjs";
21
+ import { RadioGroup as x } from "./RadioGroup/index.mjs";
22
+ import { SearchField as S } from "./SearchField/index.mjs";
23
+ import { Select as C } from "./Select/index.mjs";
24
+ import { Sidebar as w } from "./Sidebar/index.mjs";
25
+ import { SidebarLayout as T } from "./SidebarLayout/index.mjs";
26
+ import { Stack as E } from "./Stack/index.mjs";
27
+ import { Switch as D } from "./Switch/index.mjs";
28
+ import { Table as O } from "./Table/index.mjs";
29
+ import { Tabs as k } from "./Tabs/index.mjs";
30
+ import { Tag as A } from "./Tag/index.mjs";
31
+ import { Text as j } from "./Text/index.mjs";
32
+ import { Textarea as M } from "./Textarea/index.mjs";
33
+ import { TextField as N } from "./TextField/index.mjs";
34
+ import { defineTheme as P } from "./theme/define-theme.mjs";
35
+ import { ThemeProvider as F } from "./theme/ThemeProvider.mjs";
36
+ import { Toast as I } from "./Toast/index.mjs";
37
37
  import { useToast as L } from "./Toast/client.mjs";
38
- import { Toast as R } from "./Toast/index.mjs";
39
- import { Tooltip as z } from "./Tooltip/index.mjs";
40
- export { o as AlertDialog, s as Avatar, c as Badge, l as Box, r as Button, u as Checkbox, d as Chip, f as ChipGroup, e as Clickable, m as ColorField, h as Combobox, a as Dialog, p as Field, i as Heading, t as Icon, g as IconButton, _ as Inline, v as Menu, y as MultiSelect, x as NavList, S as NumberField, C as RadioGroup, w as SearchField, T as Select, E as Sidebar, D as SidebarLayout, O as Stack, k as Switch, A as Table, j as Tabs, M as Tag, n as Text, P as TextField, N as Textarea, I as ThemeProvider, R as Toast, z as Tooltip, b as VisuallyHidden, F as defineTheme, L as useToast };
38
+ import { Tooltip as R } from "./Tooltip/index.mjs";
39
+ import { VisuallyHidden as z } from "./VisuallyHidden/index.mjs";
40
+ export { e as AlertDialog, t as Avatar, n as Badge, r as Box, i as Button, a as Checkbox, o as Chip, s as ChipGroup, c as Clickable, l as ColorField, u as Combobox, d as Dialog, f as Field, p as Heading, m as Icon, h as IconButton, g as Inline, _ as Menu, v as MultiSelect, y as NavList, b as NumberField, x as RadioGroup, S as SearchField, C as Select, w as Sidebar, T as SidebarLayout, E as Stack, D as Switch, O as Table, k as Tabs, A as Tag, j as Text, N as TextField, M as Textarea, F as ThemeProvider, I as Toast, R as Tooltip, z as VisuallyHidden, P as defineTheme, L as useToast };
@@ -13,6 +13,7 @@ var e = Object.freeze([
13
13
  "Error",
14
14
  "Description",
15
15
  "Trigger",
16
+ "SubmenuTrigger",
16
17
  "Close",
17
18
  "HeaderCell",
18
19
  "Cell",
@@ -1,5 +1,5 @@
1
- import { ClickableProps } from "../Clickable/index.mjs";
2
1
  import { ButtonOwnProps } from "../Button/index.mjs";
2
+ import { ClickableProps } from "../Clickable/index.mjs";
3
3
  import { ReactNode } from "react";
4
4
  export type TriggerLookProps = {
5
5
  variant?: Exclude<ButtonOwnProps["variant"], "danger">;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { Clickable as e } from "../Clickable/index.mjs";
3
- import { Button as t } from "../Button/index.mjs";
2
+ import { Button as e } from "../Button/index.mjs";
3
+ import { Clickable as t } from "../Clickable/index.mjs";
4
4
  import { useThemeContainer as n } from "../theme/use-theme-container.mjs";
5
5
  import { createContext as r, use as i, useCallback as a, useLayoutEffect as o, useRef as s } from "react";
6
6
  import { jsx as c } from "react/jsx-runtime";
@@ -12,34 +12,49 @@ var l = r({
12
12
  }), u = r({ current: {
13
13
  keyboard: !1,
14
14
  opener: null
15
- } });
16
- function d({ children: e }) {
17
- let t = s({
15
+ } }), d = r(null);
16
+ function f(e, t) {
17
+ return e.element = t, e.parent?.current.nested.add(e), () => {
18
+ e.element = null, e.parent?.current.nested.delete(e);
19
+ };
20
+ }
21
+ function p(e, t) {
22
+ return !!e.element?.contains(t) || [...e.nested].some((e) => p(e, t));
23
+ }
24
+ function m({ children: e, nested: t = !1 }) {
25
+ let r = s({
18
26
  keyboard: !1,
19
27
  opener: null
28
+ }), a = i(d), o = s({
29
+ element: null,
30
+ nested: /* @__PURE__ */ new Set(),
31
+ parent: t ? a : null
20
32
  });
21
33
  return /* @__PURE__ */ c(l, {
22
34
  value: n(),
23
35
  children: /* @__PURE__ */ c(u, {
24
- value: t,
25
- children: e
36
+ value: r,
37
+ children: /* @__PURE__ */ c(d, {
38
+ value: o,
39
+ children: e
40
+ })
26
41
  })
27
42
  });
28
43
  }
29
- function f() {
44
+ function h() {
30
45
  return i(l);
31
46
  }
32
- function p({ variant: n, size: r, iconStart: i, iconEnd: a, uppercase: o, ...s }) {
33
- return n || r || i || a || o ? /* @__PURE__ */ c(t, {
47
+ function g({ variant: n, size: r, iconStart: i, iconEnd: a, uppercase: o, ...s }) {
48
+ return n || r || i || a || o ? /* @__PURE__ */ c(e, {
34
49
  ...s,
35
50
  variant: n,
36
51
  size: r,
37
52
  iconStart: i,
38
53
  iconEnd: a,
39
54
  uppercase: o
40
- }) : /* @__PURE__ */ c(e, { ...s });
55
+ }) : /* @__PURE__ */ c(t, { ...s });
41
56
  }
42
- function m(e) {
57
+ function _(e) {
43
58
  let t = i(u);
44
59
  return (n, r) => {
45
60
  t.current = n ? {
@@ -54,7 +69,7 @@ function m(e) {
54
69
  }, e?.(n, r);
55
70
  };
56
71
  }
57
- function h(e, t) {
72
+ function v(e, t) {
58
73
  if (typeof e == "function") {
59
74
  let n = e(t);
60
75
  return typeof n == "function" ? n : () => e(null);
@@ -63,26 +78,27 @@ function h(e, t) {
63
78
  e && (e.current = null);
64
79
  };
65
80
  }
66
- var g = /* @__PURE__ */ new Set([
81
+ var y = /* @__PURE__ */ new Set([
67
82
  "trigger-hover",
68
83
  "focus-out",
69
- "outside-press"
70
- ]), _;
71
- function v(e) {
72
- return _ === void 0 && (_ = !1, e.createElement("div").focus({ get preventScroll() {
73
- return _ = !0, !1;
74
- } })), _;
84
+ "outside-press",
85
+ "sibling-open"
86
+ ]), b;
87
+ function x(e) {
88
+ return b === void 0 && (b = !1, e.createElement("div").focus({ get preventScroll() {
89
+ return b = !0, !1;
90
+ } })), b;
75
91
  }
76
- function y(e, { finalFocus: t, modal: n = !1, open: r }) {
77
- let { trigger: c } = f(), l = i(u), d = s(null), p = a((t) => {
78
- d.current = t;
79
- let n = h(e, t);
92
+ function S(e, { finalFocus: t, modal: n = !1, open: r }) {
93
+ let { trigger: c } = h(), l = i(u), m = i(d), g = s(null), _ = a((t) => {
94
+ g.current = t;
95
+ let n = v(e, t), r = m && f(m.current, t);
80
96
  return () => {
81
- d.current = null, n();
97
+ g.current = null, r?.(), n();
82
98
  };
83
- }, [e]);
99
+ }, [e, m]);
84
100
  return o(() => {
85
- let e = d.current;
101
+ let e = g.current;
86
102
  if (!r || !e || l.current.recorded) return;
87
103
  let { activeElement: t, body: n } = e.ownerDocument, i = t === n || e.contains(t) ? null : t;
88
104
  l.current = {
@@ -90,7 +106,7 @@ function y(e, { finalFocus: t, modal: n = !1, open: r }) {
90
106
  opener: i
91
107
  };
92
108
  }, [r, l]), o(() => {
93
- let e = d.current;
109
+ let e = g.current;
94
110
  if (!e) return;
95
111
  if (r) {
96
112
  e.inert = !1;
@@ -98,8 +114,8 @@ function y(e, { finalFocus: t, modal: n = !1, open: r }) {
98
114
  }
99
115
  let { reason: i, keyboard: a, opener: o } = l.current;
100
116
  l.current.recorded = !1;
101
- let s = o?.isConnected ? o : c.current, { activeElement: u } = e.ownerDocument, f = n && i === "outside-press" && v(e.ownerDocument);
102
- if (!t && s instanceof HTMLElement && (f || e.contains(u) && !g.has(i ?? ""))) {
117
+ let s = o?.isConnected ? o : c.current, { activeElement: u } = e.ownerDocument, d = n && i === "outside-press" && x(e.ownerDocument), f = e.contains(u) || [...m?.current.nested ?? []].some((e) => p(e, u));
118
+ if (!t && s instanceof HTMLElement && (d || f && !y.has(i ?? ""))) {
103
119
  let e = { preventScroll: !0 };
104
120
  a && (e.focusVisible = !0), s.focus(e);
105
121
  }
@@ -109,10 +125,11 @@ function y(e, { finalFocus: t, modal: n = !1, open: r }) {
109
125
  t,
110
126
  n,
111
127
  l,
128
+ m,
112
129
  c
113
130
  ]), {
114
131
  "aria-hidden": !r || void 0,
115
- ref: p
132
+ ref: _
116
133
  };
117
134
  }
118
- export { d as PopupScope, p as triggerElement, y as useClosingRule, f as usePopupScope, m as useRecordOpenChange };
135
+ export { m as PopupScope, g as triggerElement, S as useClosingRule, h as usePopupScope, _ as useRecordOpenChange };
@@ -0,0 +1 @@
1
+ import "react";
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { createContext as e, use as t, useCallback as n, useLayoutEffect as r, useMemo as i, useRef as a, useState as o } from "react";
3
+ // src/popup/direction.tsx
4
+ var s = e({ rtl: !1 });
5
+ function c(e, t, s) {
6
+ let [c, l] = o(!1), u = a(!1), d = n((e) => {
7
+ e?.isConnected && (u.current = !0, l(getComputedStyle(e).direction === "rtl"));
8
+ }, []);
9
+ return r(() => {
10
+ e ? u.current || d(t.current) : u.current = !1;
11
+ }, [
12
+ e,
13
+ t,
14
+ d
15
+ ]), [i(() => ({ rtl: c }), [c]), (e, n) => {
16
+ s?.(e, n), e && !n.isCanceled && d(n.trigger ?? t.current);
17
+ }];
18
+ }
19
+ function l(e) {
20
+ let { rtl: n } = t(s);
21
+ return e === "inline-start" ? n ? "right" : "left" : e === "inline-end" ? n ? "left" : "right" : e;
22
+ }
23
+ export { s as TriggerDirection, l as usePhysicalSide, c as useTriggerDirection };
@@ -1,22 +1,22 @@
1
1
  "use client";
2
- import { splitStyleProps as e } from "../styles/split-style-props.mjs";
3
- import { Box as t } from "../Box/base.mjs";
4
- import { PopupScope as n, triggerElement as r, useClosingRule as i } from "./client.mjs";
5
- import { Field as a } from "../Field/index.mjs";
6
- import { ChevronDownIcon as o } from "../icons/ChevronDownIcon.mjs";
2
+ import { Box as e } from "../Box/base.mjs";
3
+ import { Field as t } from "../Field/index.mjs";
4
+ import { ChevronDownIcon as n } from "../icons/ChevronDownIcon.mjs";
5
+ import { splitStyleProps as r } from "../styles/split-style-props.mjs";
6
+ import { PopupScope as i, triggerElement as a, useClosingRule as o } from "./client.mjs";
7
7
  import { createContext as s, use as c, useId as l } from "react";
8
8
  import { jsx as u } from "react/jsx-runtime";
9
9
  // src/popup/listbox-base.tsx
10
10
  var d = s(void 0);
11
11
  function f({ children: e }) {
12
- return /* @__PURE__ */ u(n, { children: /* @__PURE__ */ u(d, {
12
+ return /* @__PURE__ */ u(i, { children: /* @__PURE__ */ u(d, {
13
13
  value: l(),
14
14
  children: e
15
15
  }) });
16
16
  }
17
- function p({ children: e, className: t }) {
18
- return /* @__PURE__ */ u(a.Label, {
19
- className: t,
17
+ function p({ children: e, className: n }) {
18
+ return /* @__PURE__ */ u(t.Label, {
19
+ className: n,
20
20
  id: c(d),
21
21
  nativeLabel: !1,
22
22
  children: e
@@ -25,24 +25,24 @@ function p({ children: e, className: t }) {
25
25
  function m() {
26
26
  return c(d);
27
27
  }
28
- function h({ children: e, className: t, iconStart: n, size: i }) {
29
- return r({
28
+ function h({ children: e, className: t, iconStart: r, size: i }) {
29
+ return a({
30
30
  variant: "secondary",
31
31
  size: i,
32
32
  backgroundColor: "bg",
33
33
  color: "fg",
34
- iconStart: n,
35
- iconEnd: o,
34
+ iconStart: r,
35
+ iconEnd: n,
36
36
  className: t,
37
37
  children: e
38
38
  });
39
39
  }
40
- function g(e) {
41
- return /* @__PURE__ */ u(t, {
40
+ function g(t) {
41
+ return /* @__PURE__ */ u(e, {
42
42
  backgroundColor: "bgRaised",
43
43
  borderRadius: "med",
44
44
  boxShadow: "med",
45
- className: e,
45
+ className: t,
46
46
  padding: "4"
47
47
  });
48
48
  }
@@ -52,19 +52,19 @@ var _ = {
52
52
  side: "bottom",
53
53
  sideOffset: 4
54
54
  };
55
- function v(t, { open: n }) {
56
- let [, r] = e(t);
55
+ function v(e, { open: t }) {
56
+ let [, n] = r(e);
57
57
  return /* @__PURE__ */ u(y, {
58
- ...r,
59
- open: n
58
+ ...n,
59
+ open: t
60
60
  });
61
61
  }
62
- function y({ open: e, ref: n, ...r }) {
63
- return /* @__PURE__ */ u(t, {
62
+ function y({ open: t, ref: n, ...r }) {
63
+ return /* @__PURE__ */ u(e, {
64
64
  ...r,
65
- ...i(n, {
65
+ ...o(n, {
66
66
  finalFocus: !1,
67
- open: e
67
+ open: t
68
68
  }),
69
69
  zIndex: "popover"
70
70
  });
@@ -1,5 +1,5 @@
1
- import { Text as e } from "../Text/index.mjs";
2
- import { CheckIcon as t } from "../icons/CheckIcon.mjs";
1
+ import { CheckIcon as e } from "../icons/CheckIcon.mjs";
2
+ import { Text as t } from "../Text/index.mjs";
3
3
  import { listboxRow as n } from "./listbox-row.mjs";
4
4
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
5
  import { Select as a } from "@base-ui/react/select";
@@ -11,13 +11,13 @@ function o({ checkClassName: o, itemClassName: s, options: c }) {
11
11
  render: n(s),
12
12
  value: c.value,
13
13
  children: [/* @__PURE__ */ r(a.ItemText, {
14
- render: /* @__PURE__ */ r(e, {
14
+ render: /* @__PURE__ */ r(t, {
15
15
  as: "span",
16
16
  font: "label",
17
17
  size: "sm"
18
18
  }),
19
19
  children: c.label
20
- }), /* @__PURE__ */ r(t, {
20
+ }), /* @__PURE__ */ r(e, {
21
21
  className: o,
22
22
  size: "sm"
23
23
  })]
@@ -10,6 +10,7 @@ function n(n) {
10
10
  gap: "8",
11
11
  justifyContent: "space-between",
12
12
  minBlockSize: "sm",
13
+ paddingBlock: "8",
13
14
  paddingInline: "12"
14
15
  });
15
16
  }
@@ -1,3 +1,4 @@
1
+ import "./direction.mjs";
1
2
  import { ReactElement, ReactNode } from "react";
2
3
  import { Tooltip } from "@base-ui/react/tooltip";
3
4
  export type TooltipRootScopeProps = Pick<Tooltip.Root.Props, "open" | "defaultOpen" | "onOpenChange" | "disabled"> & {
@@ -1,81 +1,87 @@
1
1
  "use client";
2
- import { join as e } from "../styles/join.mjs";
3
- import { splitStyleProps as t } from "../styles/split-style-props.mjs";
4
- import { Box as n } from "../Box/base.mjs";
5
- import { createContext as r, use as i, useCallback as a, useId as o, useMemo as s, useState as c } from "react";
6
- import { jsx as l } from "react/jsx-runtime";
7
- import { Tooltip as u } from "@base-ui/react/tooltip";
2
+ import { Box as e } from "../Box/base.mjs";
3
+ import { join as t } from "../styles/join.mjs";
4
+ import { splitStyleProps as n } from "../styles/split-style-props.mjs";
5
+ import { TriggerDirection as r, usePhysicalSide as i, useTriggerDirection as a } from "./direction.mjs";
6
+ import { createContext as o, use as s, useCallback as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
7
+ import { jsx as p } from "react/jsx-runtime";
8
+ import { Tooltip as m } from "@base-ui/react/tooltip";
8
9
  // src/popup/tooltip.tsx
9
- var d = r({
10
+ var h = o({
10
11
  attach: () => {},
11
12
  container: null,
12
13
  describes: !0,
13
14
  id: void 0
14
15
  });
15
- function f({ describes: e = !0, children: t, ...n }) {
16
- let r = o(), [i, f] = c(null), p = a((e) => {
17
- e && f(e.closest("[data-brand]") ?? e.ownerDocument.body);
18
- }, []), m = s(() => ({
19
- id: n.disabled || !e ? void 0 : r,
16
+ function g({ describes: e = !0, children: t, onOpenChange: n, ...i }) {
17
+ let o = l(), s = d(null), [g, _] = a(i.open ?? i.defaultOpen, s, n), [v, y] = f(null), b = c((e) => {
18
+ s.current = e, e && y(e.closest("[data-brand]") ?? e.ownerDocument.body);
19
+ }, []), x = u(() => ({
20
+ id: i.disabled || !e ? void 0 : o,
20
21
  describes: e,
21
- container: i,
22
- attach: p
22
+ container: v,
23
+ attach: b
23
24
  }), [
24
- n.disabled,
25
+ i.disabled,
25
26
  e,
26
- r,
27
- i,
28
- p
27
+ o,
28
+ v,
29
+ b
29
30
  ]);
30
- return /* @__PURE__ */ l(d, {
31
- value: m,
32
- children: /* @__PURE__ */ l(u.Root, {
33
- ...n,
34
- children: t
31
+ return /* @__PURE__ */ p(h, {
32
+ value: x,
33
+ children: /* @__PURE__ */ p(r, {
34
+ value: g,
35
+ children: /* @__PURE__ */ p(m.Root, {
36
+ ...i,
37
+ onOpenChange: _,
38
+ children: t
39
+ })
35
40
  })
36
41
  });
37
42
  }
38
- function p({ render: e }) {
39
- let { attach: t } = i(d);
40
- return /* @__PURE__ */ l(u.Trigger, {
43
+ function _({ render: e }) {
44
+ let { attach: t } = s(h);
45
+ return /* @__PURE__ */ p(m.Trigger, {
41
46
  id: e.props.id,
42
47
  ref: t,
43
48
  render: e
44
49
  });
45
50
  }
46
- function m({ children: e }) {
47
- let { container: t, describes: n } = i(d);
48
- return /* @__PURE__ */ l(u.Portal, {
51
+ function v({ children: e }) {
52
+ let { container: t, describes: n } = s(h);
53
+ return /* @__PURE__ */ p(m.Portal, {
49
54
  container: t,
50
55
  keepMounted: n,
51
56
  children: e
52
57
  });
53
58
  }
54
- function h({ className: n, ...r }) {
55
- return /* @__PURE__ */ l(u.Positioner, {
56
- ...r,
59
+ function y({ className: e, side: r = "top", ...a }) {
60
+ return /* @__PURE__ */ p(m.Positioner, {
61
+ ...a,
57
62
  collisionPadding: 8,
58
63
  render: (r) => {
59
- let [, i] = t(r);
60
- return /* @__PURE__ */ l(g, {
64
+ let [, i] = n(r);
65
+ return /* @__PURE__ */ p(b, {
61
66
  ...i,
62
- className: e(n, i.className)
67
+ className: t(e, i.className)
63
68
  });
64
69
  },
70
+ side: i(r),
65
71
  sideOffset: 4
66
72
  });
67
73
  }
68
- function g(e) {
69
- return /* @__PURE__ */ l(n, {
70
- ...e,
74
+ function b(t) {
75
+ return /* @__PURE__ */ p(e, {
76
+ ...t,
71
77
  zIndex: "tooltip"
72
78
  });
73
79
  }
74
- function _(e) {
75
- return /* @__PURE__ */ l(u.Popup, {
80
+ function x(e) {
81
+ return /* @__PURE__ */ p(m.Popup, {
76
82
  ...e,
77
- id: i(d).id,
83
+ id: s(h).id,
78
84
  role: "tooltip"
79
85
  });
80
86
  }
81
- export { p as TooltipElementTrigger, d as TooltipLink, _ as TooltipPopupPart, m as TooltipPortal, h as TooltipPositioner, f as TooltipRootScope };
87
+ export { _ as TooltipElementTrigger, h as TooltipLink, x as TooltipPopupPart, v as TooltipPortal, y as TooltipPositioner, g as TooltipRootScope };