@serendie/ui 2.0.0-dev.202507240128 → 2.0.0-dev.202507240155

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.
@@ -0,0 +1,14 @@
1
+ import { ComponentProps } from 'react';
2
+ import { RecipeVariantProps } from '../../../styled-system/css';
3
+ declare const TooltipStyle: import('../../../styled-system/types').SlotRecipeRuntimeFn<"content" | "arrow" | "arrowTip", import('../../../styled-system/types').SlotRecipeVariantRecord<"content" | "arrow" | "arrowTip">>;
4
+ type TooltipVariantProps = RecipeVariantProps<typeof TooltipStyle>;
5
+ export type TooltipProps = {
6
+ content: string;
7
+ children: React.ReactNode;
8
+ placement?: "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "right";
9
+ openDelay?: number;
10
+ closeDelay?: number;
11
+ disabled?: boolean;
12
+ } & ComponentProps<"div"> & TooltipVariantProps;
13
+ export declare const Tooltip: React.FC<TooltipProps>;
14
+ export {};
@@ -0,0 +1,70 @@
1
+ import { jsxs as s, jsx as o } from "react/jsx-runtime";
2
+ import "../../styled-system/css/css.js";
3
+ import { cx as y } from "../../styled-system/css/cx.js";
4
+ import "../../styled-system/helpers.js";
5
+ import { sva as f } from "../../styled-system/css/sva.js";
6
+ import { TooltipRoot as w } from "../../node_modules/@ark-ui/react/dist/components/tooltip/tooltip-root.js";
7
+ import { TooltipTrigger as T } from "../../node_modules/@ark-ui/react/dist/components/tooltip/tooltip-trigger.js";
8
+ import { TooltipPositioner as g } from "../../node_modules/@ark-ui/react/dist/components/tooltip/tooltip-positioner.js";
9
+ import { TooltipContent as h } from "../../node_modules/@ark-ui/react/dist/components/tooltip/tooltip-content.js";
10
+ import { TooltipArrow as u } from "../../node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow.js";
11
+ import { TooltipArrowTip as S } from "../../node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow-tip.js";
12
+ const t = f({
13
+ slots: ["content", "arrow", "arrowTip"],
14
+ base: {
15
+ content: {
16
+ backgroundColor: "sd.system.color.component.inverseSurface",
17
+ color: "sd.system.color.component.inverseOnSurface",
18
+ borderRadius: "sd.system.dimension.radius.small",
19
+ px: "sd.system.dimension.spacing.extraSmall",
20
+ py: "sd.system.dimension.spacing.twoExtraSmall",
21
+ boxShadow: "sd.system.elevation.shadow.level3",
22
+ maxWidth: "200px",
23
+ textStyle: "sd.system.typography.body.extraSmall_expanded",
24
+ zIndex: 1e3
25
+ },
26
+ arrow: {
27
+ "--arrow-size": "8px",
28
+ "--arrow-background": "colors.sd.system.color.component.inverseSurface",
29
+ zIndex: 1001
30
+ }
31
+ }
32
+ }), v = ({
33
+ content: e,
34
+ children: i,
35
+ placement: a = "top",
36
+ openDelay: n = 700,
37
+ closeDelay: m = 300,
38
+ disabled: p = !1,
39
+ className: l,
40
+ ...d
41
+ }) => {
42
+ const [c, x] = t.splitVariantProps(d), r = t(c);
43
+ return /* @__PURE__ */ s(
44
+ w,
45
+ {
46
+ openDelay: n,
47
+ closeDelay: m,
48
+ positioning: { placement: a, arrowPadding: 8 },
49
+ disabled: p,
50
+ children: [
51
+ /* @__PURE__ */ o(T, { asChild: !0, children: i }),
52
+ /* @__PURE__ */ o(g, { children: /* @__PURE__ */ s(
53
+ h,
54
+ {
55
+ className: y(r.content, l),
56
+ ...x,
57
+ children: [
58
+ /* @__PURE__ */ o(u, { className: r.arrow, children: /* @__PURE__ */ o(S, { className: r.arrowTip }) }),
59
+ e
60
+ ]
61
+ }
62
+ ) })
63
+ ]
64
+ }
65
+ );
66
+ };
67
+ v.displayName = "Tooltip";
68
+ export {
69
+ v as Tooltip
70
+ };
@@ -0,0 +1 @@
1
+ export * from './Tooltip.tsx';
@@ -0,0 +1,4 @@
1
+ import { Tooltip as r } from "./Tooltip.js";
2
+ export {
3
+ r as Tooltip
4
+ };
package/dist/index.d.ts CHANGED
@@ -28,4 +28,5 @@ export * from './components/Tabs/index.ts';
28
28
  export * from './components/TextArea/index.ts';
29
29
  export * from './components/TextField/index.ts';
30
30
  export * from './components/Toast/index.ts';
31
+ export * from './components/Tooltip/index.ts';
31
32
  export * from './components/TopAppBar/index.ts';
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { SerendiePreset as e } from "./preset.js";
2
2
  import { Accordion as a } from "./components/Accordion/Accordion.js";
3
3
  import { AccordionGroup as m } from "./components/Accordion/AccordionGroup.js";
4
4
  import { Avatar as x, AvatarStyle as n } from "./components/Avatar/Avatar.js";
5
- import { Badge as f, BadgeCloseButton as s, BadgeStyle as d } from "./components/Badge/Badge.js";
5
+ import { Badge as c, BadgeCloseButton as s, BadgeStyle as l } from "./components/Badge/Badge.js";
6
6
  import { Banner as h } from "./components/Banner/Banner.js";
7
7
  import { BottomNavigation as S } from "./components/BottomNavigation/BottomNavigation.js";
8
8
  import { BottomNavigationItem as g, BottomNavigationItemStyle as y } from "./components/BottomNavigation/BottomNavigationItem.js";
@@ -18,7 +18,7 @@ import { Drawer as oo } from "./components/Drawer/Drawer.js";
18
18
  import { DropdownMenu as eo, DropdownMenuStyle as to } from "./components/DropdownMenu/DropdownMenu.js";
19
19
  import { IconButton as po, IconButtonStyle as mo } from "./components/IconButton/IconButton.js";
20
20
  import { List as xo } from "./components/List/List.js";
21
- import { ListItem as co, ListItemStyle as fo } from "./components/List/ListItem.js";
21
+ import { ListItem as fo, ListItemStyle as co } from "./components/List/ListItem.js";
22
22
  import { ModalDialog as lo } from "./components/ModalDialog/ModalDialog.js";
23
23
  import { NotificationBadge as Co } from "./components/NotificationBadge/NotificationBadge.js";
24
24
  import { Pagination as Bo, PaginationStyle as go } from "./components/Pagination/Pagination.js";
@@ -34,16 +34,17 @@ import { TabItem as Oo, TabItemStyle as Qo } from "./components/Tabs/TabItem.js"
34
34
  import { TextArea as Xo } from "./components/TextArea/TextArea.js";
35
35
  import { TextField as Zo } from "./components/TextField/TextField.js";
36
36
  import { Toast as $o, ToastStyle as or, toaster as rr } from "./components/Toast/Toast.js";
37
- import { TopAppBar as tr } from "./components/TopAppBar/TopAppBar.js";
38
- import { DataTableComponent as pr } from "./components/DataTable/DataTableComponent.js";
37
+ import { Tooltip as tr } from "./components/Tooltip/Tooltip.js";
38
+ import { TopAppBar as pr } from "./components/TopAppBar/TopAppBar.js";
39
+ import { DataTableComponent as ir } from "./components/DataTable/DataTableComponent.js";
39
40
  export {
40
41
  a as Accordion,
41
42
  m as AccordionGroup,
42
43
  x as Avatar,
43
44
  n as AvatarStyle,
44
- f as Badge,
45
+ c as Badge,
45
46
  s as BadgeCloseButton,
46
- d as BadgeStyle,
47
+ l as BadgeStyle,
47
48
  h as Banner,
48
49
  S as BottomNavigation,
49
50
  g as BottomNavigationItem,
@@ -56,7 +57,7 @@ export {
56
57
  K as ChoiceBoxStyle,
57
58
  Q as DashboardWidget,
58
59
  X as DataTable,
59
- pr as DataTableComponent,
60
+ ir as DataTableComponent,
60
61
  Z as Divider,
61
62
  _ as DividerStyle,
62
63
  oo as Drawer,
@@ -65,8 +66,8 @@ export {
65
66
  po as IconButton,
66
67
  mo as IconButtonStyle,
67
68
  xo as List,
68
- co as ListItem,
69
- fo as ListItemStyle,
69
+ fo as ListItem,
70
+ co as ListItemStyle,
70
71
  lo as ModalDialog,
71
72
  Co as NotificationBadge,
72
73
  Bo as Pagination,
@@ -93,7 +94,8 @@ export {
93
94
  Zo as TextField,
94
95
  $o as Toast,
95
96
  or as ToastStyle,
96
- tr as TopAppBar,
97
+ tr as Tooltip,
98
+ pr as TopAppBar,
97
99
  q as checkboxCheckedIconCss,
98
100
  z as checkboxIconCss,
99
101
  E as checkboxUncheckedIconCss,
@@ -0,0 +1,13 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as m } from "react";
3
+ import { ark as e } from "../factory.js";
4
+ import { useTooltipContext as s } from "./use-tooltip-context.js";
5
+ import { mergeProps as f } from "../../../../../@zag-js/core/dist/index.js";
6
+ const T = m((o, r) => {
7
+ const t = s(), p = f(t.getArrowTipProps(), o);
8
+ return /* @__PURE__ */ i(e.div, { ...p, ref: r });
9
+ });
10
+ T.displayName = "TooltipArrowTip";
11
+ export {
12
+ T as TooltipArrowTip
13
+ };
@@ -0,0 +1,13 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { forwardRef as e } from "react";
3
+ import { ark as i } from "../factory.js";
4
+ import { useTooltipContext as s } from "./use-tooltip-context.js";
5
+ import { mergeProps as f } from "../../../../../@zag-js/core/dist/index.js";
6
+ const l = e((o, r) => {
7
+ const t = s(), p = f(t.getArrowProps(), o);
8
+ return /* @__PURE__ */ m(i.div, { ...p, ref: r });
9
+ });
10
+ l.displayName = "TooltipArrow";
11
+ export {
12
+ l as TooltipArrow
13
+ };
@@ -0,0 +1,15 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { forwardRef as p } from "react";
3
+ import { composeRefs as s } from "../../utils/compose-refs.js";
4
+ import { ark as i } from "../factory.js";
5
+ import { usePresenceContext as f } from "../presence/use-presence-context.js";
6
+ import { useTooltipContext as c } from "./use-tooltip-context.js";
7
+ import { mergeProps as l } from "../../../../../@zag-js/core/dist/index.js";
8
+ const u = p((r, e) => {
9
+ const t = c(), o = f(), n = l(t.getContentProps(), o.getPresenceProps(), r);
10
+ return o.unmounted ? null : /* @__PURE__ */ m(i.div, { ...n, ref: s(o.ref, e) });
11
+ });
12
+ u.displayName = "TooltipContent";
13
+ export {
14
+ u as TooltipContent
15
+ };
@@ -0,0 +1,14 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as n } from "react";
3
+ import { ark as p } from "../factory.js";
4
+ import { usePresenceContext as s } from "../presence/use-presence-context.js";
5
+ import { useTooltipContext as m } from "./use-tooltip-context.js";
6
+ import { mergeProps as f } from "../../../../../@zag-js/core/dist/index.js";
7
+ const c = n((o, r) => {
8
+ const e = m(), t = f(e.getPositionerProps(), o);
9
+ return s().unmounted ? null : /* @__PURE__ */ i(p.div, { ...t, ref: r });
10
+ });
11
+ c.displayName = "TooltipPositioner";
12
+ export {
13
+ c as TooltipPositioner
14
+ };
@@ -0,0 +1,14 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { splitPresenceProps as m } from "../presence/split-presence-props.js";
3
+ import { usePresence as n } from "../presence/use-presence.js";
4
+ import { PresenceProvider as c } from "../presence/use-presence-context.js";
5
+ import { useTooltip as l } from "./use-tooltip.js";
6
+ import { TooltipProvider as P } from "./use-tooltip-context.js";
7
+ import { mergeProps as f } from "../../../../../@zag-js/core/dist/index.js";
8
+ const g = (e) => {
9
+ const [p, { children: t, ...s }] = m(e), o = l(s), i = n(f({ present: o.open }, p));
10
+ return /* @__PURE__ */ r(P, { value: o, children: /* @__PURE__ */ r(c, { value: i, children: t }) });
11
+ };
12
+ export {
13
+ g as TooltipRoot
14
+ };
@@ -0,0 +1,13 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { forwardRef as i } from "react";
3
+ import { ark as m } from "../factory.js";
4
+ import { useTooltipContext as g } from "./use-tooltip-context.js";
5
+ import { mergeProps as s } from "../../../../../@zag-js/core/dist/index.js";
6
+ const f = i((o, r) => {
7
+ const t = g(), e = s(t.getTriggerProps(), o);
8
+ return /* @__PURE__ */ p(m.button, { ...e, ref: r });
9
+ });
10
+ f.displayName = "TooltipTrigger";
11
+ export {
12
+ f as TooltipTrigger
13
+ };
@@ -0,0 +1,10 @@
1
+ import { createContext as o } from "../../utils/create-context.js";
2
+ const [e, r] = o({
3
+ name: "TooltipContext",
4
+ hookName: "useTooltipContext",
5
+ providerName: "<TooltipProvider />"
6
+ });
7
+ export {
8
+ e as TooltipProvider,
9
+ r as useTooltipContext
10
+ };
@@ -0,0 +1,17 @@
1
+ import { useMachine as m, normalizeProps as s } from "../../../../../@zag-js/react/dist/index.js";
2
+ import { machine as c, connect as p } from "../../../../../@zag-js/tooltip/dist/index.js";
3
+ import { useId as u } from "react";
4
+ import { useEnvironmentContext as a } from "../../providers/environment/use-environment-context.js";
5
+ import { useLocaleContext as f } from "../../providers/locale/use-locale-context.js";
6
+ const C = (o) => {
7
+ const t = u(), { getRootNode: e } = a(), { dir: r } = f(), n = {
8
+ id: t,
9
+ dir: r,
10
+ getRootNode: e,
11
+ ...o
12
+ }, i = m(c, n);
13
+ return p(i, s);
14
+ };
15
+ export {
16
+ C as useTooltip
17
+ };