reaxify 0.0.14 → 0.0.16
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/components/Tooltip/index.cjs.js +1 -0
- package/dist/components/Tooltip/index.d.ts +11 -0
- package/dist/components/Tooltip/index.es.js +125 -0
- package/dist/components/index.cjs.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.es.js +14 -12
- package/dist/providers/ThemeProvider.d.ts +19 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const x=require("../../node_modules/react/jsx-runtime.cjs.js"),n=require("../../helpers/cn.cjs.js"),p=require("react"),E=require("../../hooks/useClasses.cjs.js");require("../Form/index.cjs.js");const v=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js");function q({title:b,color:g="dark",placement:u="top",className:d,children:i,...s}){const t=E(r=>r.tooltip),[f,c]=p.useState(!1),l=p.useMemo(()=>{var e,o,a,m,j,y,M,k;if(!g)return"border-transparent";const r={primary:n("bg-primary text-white",(e=t==null?void 0:t.color)==null?void 0:e.primary),secondary:n("bg-secondary text-white",(o=t==null?void 0:t.color)==null?void 0:o.secondary),success:n("bg-success text-white",(a=t==null?void 0:t.color)==null?void 0:a.success),info:n("bg-info text-white",(m=t==null?void 0:t.color)==null?void 0:m.info),warning:n("bg-warning text-white",(j=t==null?void 0:t.color)==null?void 0:j.warning),danger:n("bg-danger text-white",(y=t==null?void 0:t.color)==null?void 0:y.danger),dark:n("bg-dark text-white",(M=t==null?void 0:t.color)==null?void 0:M.dark),light:n("bg-light text-dark",(k=t==null?void 0:t.color)==null?void 0:k.light)};return(r==null?void 0:r[g])??null},[g,t==null?void 0:t.color]),w=p.useMemo(()=>{var e,o,a,m;return{top:n("bottom-[calc(100%+0.5rem)] left-0 right-0 flex-col origin-bottom",(e=t==null?void 0:t.placement)==null?void 0:e.top),end:n("start-[calc(100%+0.5rem)] top-0 bottom-0 flex-row-reverse origin-start",(o=t==null?void 0:t.placement)==null?void 0:o.end),bottom:n("top-[calc(100%+0.5rem)] left-0 right-0 flex-col-reverse origin-top",(a=t==null?void 0:t.placement)==null?void 0:a.bottom),start:n("end-[calc(100%+0.5rem)] top-0 bottom-0 flex-row origin-end",(m=t==null?void 0:t.placement)==null?void 0:m.start)}[u]},[u,t==null?void 0:t.placement]),h=p.useMemo(()=>({top:"mt-[-0.5rem]",end:"me-[-0.5rem]",bottom:"mb-[-0.5rem]",start:"ms-[-0.5rem]"})[u],[u]);return p.useMemo(()=>i?p.cloneElement(i,{onMouseEnter:r=>{var e,o;(o=(e=i.props).onMouseEnter)==null||o.call(e,r),c(!0)},onMouseLeave:r=>{var e,o;(o=(e=i.props).onMouseLeave)==null||o.call(e,r),c(!1)},onFocus:r=>{var e,o;(o=(e=i.props).onFocus)==null||o.call(e,r),c(!0)},onBlur:r=>{var e,o;(o=(e=i.props).onBlur)==null||o.call(e,r),c(!1)},className:n(i.props.className,"relative"),children:x.jsxRuntimeExports.jsxs(p.Fragment,{children:[i.props.children,x.jsxRuntimeExports.jsxs("div",{className:n("absolute flex justify-center items-center z-10 pointer-events-none transition-[scale,opacity]",w,f?"scale-100 opacity-100":"scale-75 opacity-0"),children:[x.jsxRuntimeExports.jsx("span",{className:v.twMerge("relative block w-fit h-fit bg-dark text-sm rounded px-2 py-px whitespace-nowrap z-[1]",t==null?void 0:t.base,l,d),...s,children:b}),x.jsxRuntimeExports.jsx("span",{className:v.twMerge("block size-3 bg-dark rotate-45",h,l)})]})]})}):null,[b,i,d,t==null?void 0:t.base,l,f,s,w,h])}module.exports=q;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Color, ComponentPropsWithoutAs } from '../../types';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
type Placement = "top" | "end" | "bottom" | "start";
|
|
4
|
+
type Props = {
|
|
5
|
+
title: string;
|
|
6
|
+
color?: Color;
|
|
7
|
+
placement?: Placement;
|
|
8
|
+
children?: ReactElement;
|
|
9
|
+
};
|
|
10
|
+
export default function Tooltip({ title, color, placement, className, children, ...props }: ComponentPropsWithoutAs<"span", Props>): ReactElement<any, string | import('react').JSXElementConstructor<any>> | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { j as u } from "../../node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import n from "../../helpers/cn.es.js";
|
|
3
|
+
import { useState as E, useMemo as l, cloneElement as N, Fragment as s } from "react";
|
|
4
|
+
import z from "../../hooks/useClasses.es.js";
|
|
5
|
+
import "../Form/index.es.js";
|
|
6
|
+
import { twMerge as M } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
|
|
7
|
+
function T({
|
|
8
|
+
title: b,
|
|
9
|
+
color: g = "dark",
|
|
10
|
+
placement: a = "top",
|
|
11
|
+
className: d,
|
|
12
|
+
children: i,
|
|
13
|
+
...x
|
|
14
|
+
}) {
|
|
15
|
+
const t = z((r) => r.tooltip), [w, c] = E(!1), f = l(() => {
|
|
16
|
+
var o, e, p, m, k, v, j, C;
|
|
17
|
+
if (!g) return "border-transparent";
|
|
18
|
+
const r = {
|
|
19
|
+
primary: n("bg-primary text-white", (o = t == null ? void 0 : t.color) == null ? void 0 : o.primary),
|
|
20
|
+
secondary: n("bg-secondary text-white", (e = t == null ? void 0 : t.color) == null ? void 0 : e.secondary),
|
|
21
|
+
success: n("bg-success text-white", (p = t == null ? void 0 : t.color) == null ? void 0 : p.success),
|
|
22
|
+
info: n("bg-info text-white", (m = t == null ? void 0 : t.color) == null ? void 0 : m.info),
|
|
23
|
+
warning: n("bg-warning text-white", (k = t == null ? void 0 : t.color) == null ? void 0 : k.warning),
|
|
24
|
+
danger: n("bg-danger text-white", (v = t == null ? void 0 : t.color) == null ? void 0 : v.danger),
|
|
25
|
+
dark: n("bg-dark text-white", (j = t == null ? void 0 : t.color) == null ? void 0 : j.dark),
|
|
26
|
+
light: n("bg-light text-dark", (C = t == null ? void 0 : t.color) == null ? void 0 : C.light)
|
|
27
|
+
};
|
|
28
|
+
return (r == null ? void 0 : r[g]) ?? null;
|
|
29
|
+
}, [g, t == null ? void 0 : t.color]), h = l(() => {
|
|
30
|
+
var o, e, p, m;
|
|
31
|
+
return {
|
|
32
|
+
top: n(
|
|
33
|
+
"bottom-[calc(100%+0.5rem)] left-0 right-0 flex-col origin-bottom",
|
|
34
|
+
(o = t == null ? void 0 : t.placement) == null ? void 0 : o.top
|
|
35
|
+
),
|
|
36
|
+
end: n(
|
|
37
|
+
"start-[calc(100%+0.5rem)] top-0 bottom-0 flex-row-reverse origin-start",
|
|
38
|
+
(e = t == null ? void 0 : t.placement) == null ? void 0 : e.end
|
|
39
|
+
),
|
|
40
|
+
bottom: n(
|
|
41
|
+
"top-[calc(100%+0.5rem)] left-0 right-0 flex-col-reverse origin-top",
|
|
42
|
+
(p = t == null ? void 0 : t.placement) == null ? void 0 : p.bottom
|
|
43
|
+
),
|
|
44
|
+
start: n(
|
|
45
|
+
"end-[calc(100%+0.5rem)] top-0 bottom-0 flex-row origin-end",
|
|
46
|
+
(m = t == null ? void 0 : t.placement) == null ? void 0 : m.start
|
|
47
|
+
)
|
|
48
|
+
}[a];
|
|
49
|
+
}, [a, t == null ? void 0 : t.placement]), y = l(() => ({
|
|
50
|
+
top: "mt-[-0.5rem]",
|
|
51
|
+
end: "me-[-0.5rem]",
|
|
52
|
+
bottom: "mb-[-0.5rem]",
|
|
53
|
+
start: "ms-[-0.5rem]"
|
|
54
|
+
})[a], [a]);
|
|
55
|
+
return l(() => i ? N(i, {
|
|
56
|
+
onMouseEnter: (r) => {
|
|
57
|
+
var o, e;
|
|
58
|
+
(e = (o = i.props).onMouseEnter) == null || e.call(o, r), c(!0);
|
|
59
|
+
},
|
|
60
|
+
onMouseLeave: (r) => {
|
|
61
|
+
var o, e;
|
|
62
|
+
(e = (o = i.props).onMouseLeave) == null || e.call(o, r), c(!1);
|
|
63
|
+
},
|
|
64
|
+
onFocus: (r) => {
|
|
65
|
+
var o, e;
|
|
66
|
+
(e = (o = i.props).onFocus) == null || e.call(o, r), c(!0);
|
|
67
|
+
},
|
|
68
|
+
onBlur: (r) => {
|
|
69
|
+
var o, e;
|
|
70
|
+
(e = (o = i.props).onBlur) == null || e.call(o, r), c(!1);
|
|
71
|
+
},
|
|
72
|
+
className: n(i.props.className, "relative"),
|
|
73
|
+
children: /* @__PURE__ */ u.jsxs(s, { children: [
|
|
74
|
+
i.props.children,
|
|
75
|
+
/* @__PURE__ */ u.jsxs(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
className: n(
|
|
79
|
+
"absolute flex justify-center items-center z-10 pointer-events-none transition-[scale,opacity]",
|
|
80
|
+
h,
|
|
81
|
+
w ? "scale-100 opacity-100" : "scale-75 opacity-0"
|
|
82
|
+
),
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ u.jsx(
|
|
85
|
+
"span",
|
|
86
|
+
{
|
|
87
|
+
className: M(
|
|
88
|
+
"relative block w-fit h-fit bg-dark text-sm rounded px-2 py-px whitespace-nowrap z-[1]",
|
|
89
|
+
t == null ? void 0 : t.base,
|
|
90
|
+
f,
|
|
91
|
+
d
|
|
92
|
+
),
|
|
93
|
+
...x,
|
|
94
|
+
children: b
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ u.jsx(
|
|
98
|
+
"span",
|
|
99
|
+
{
|
|
100
|
+
className: M(
|
|
101
|
+
"block size-3 bg-dark rotate-45",
|
|
102
|
+
y,
|
|
103
|
+
f
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
] })
|
|
111
|
+
}) : null, [
|
|
112
|
+
b,
|
|
113
|
+
i,
|
|
114
|
+
d,
|
|
115
|
+
t == null ? void 0 : t.base,
|
|
116
|
+
f,
|
|
117
|
+
w,
|
|
118
|
+
x,
|
|
119
|
+
h,
|
|
120
|
+
y
|
|
121
|
+
]);
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
T as default
|
|
125
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Accordion/index.cjs.js"),r=require("./Badge/index.cjs.js"),n=require("./Box/index.cjs.js"),i=require("./Button/index.cjs.js"),t=require("./ButtonGroup/index.cjs.js"),o=require("./Card/index.cjs.js"),u=require("./Drawer/index.cjs.js"),d=require("./Form/index.cjs.js"),c=require("./InputGroup/index.cjs.js"),s=require("./Menu/index.cjs.js"),q=require("./Modal/index.cjs.js"),x=require("./Portal/index.cjs.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Accordion/index.cjs.js"),r=require("./Badge/index.cjs.js"),n=require("./Box/index.cjs.js"),i=require("./Button/index.cjs.js"),t=require("./ButtonGroup/index.cjs.js"),o=require("./Card/index.cjs.js"),u=require("./Drawer/index.cjs.js"),d=require("./Form/index.cjs.js"),c=require("./InputGroup/index.cjs.js"),s=require("./Menu/index.cjs.js"),q=require("./Modal/index.cjs.js"),x=require("./Portal/index.cjs.js"),$=require("./Progress/index.cjs.js"),a=require("./Skeleton/index.cjs.js"),l=require("./Stack/index.cjs.js"),f=require("./Table/index.cjs.js"),p=require("./Tabs/index.cjs.js"),g=require("./Tooltip/index.cjs.js"),b=require("./Typography/index.cjs.js");;/* empty css */exports.Accordion=e;exports.Badge=r;exports.Box=n;exports.Button=i;exports.ButtonGroup=t.default;exports.Card=o;exports.Drawer=u.default;exports.Form=d.default;exports.InputGroup=c;exports.Menu=s;exports.Modal=q.default;exports.Portal=x;exports.Progress=$;exports.Skeleton=a;exports.Stack=l;exports.Table=f;exports.Tabs=p.default;exports.Tooltip=g;exports.Typography=b;
|
|
@@ -15,4 +15,5 @@ export { default as Skeleton } from './Skeleton';
|
|
|
15
15
|
export { default as Stack } from './Stack';
|
|
16
16
|
export { default as Table } from './Table';
|
|
17
17
|
export { default as Tabs } from './Tabs';
|
|
18
|
+
export { default as Tooltip } from './Tooltip';
|
|
18
19
|
export { default as Typography } from './Typography';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as a } from "./Accordion/index.es.js";
|
|
2
2
|
import { default as f } from "./Badge/index.es.js";
|
|
3
3
|
import { default as u } from "./Box/index.es.js";
|
|
4
|
-
import { default as
|
|
4
|
+
import { default as d } from "./Button/index.es.js";
|
|
5
5
|
import { default as m } from "./ButtonGroup/index.es.js";
|
|
6
6
|
import { default as n } from "./Card/index.es.js";
|
|
7
|
-
import { default as
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
7
|
+
import { default as T } from "./Drawer/index.es.js";
|
|
8
|
+
import { default as g } from "./Form/index.es.js";
|
|
9
|
+
import { default as b } from "./InputGroup/index.es.js";
|
|
10
10
|
import { default as y } from "./Menu/index.es.js";
|
|
11
11
|
import { default as M } from "./Modal/index.es.js";
|
|
12
12
|
import { default as S } from "./Portal/index.es.js";
|
|
@@ -15,18 +15,19 @@ import { default as C } from "./Skeleton/index.es.js";
|
|
|
15
15
|
import { default as F } from "./Stack/index.es.js";
|
|
16
16
|
import { default as j } from "./Table/index.es.js";
|
|
17
17
|
import { default as v } from "./Tabs/index.es.js";
|
|
18
|
-
import { default as E } from "./
|
|
18
|
+
import { default as E } from "./Tooltip/index.es.js";
|
|
19
|
+
import { default as J } from "./Typography/index.es.js";
|
|
19
20
|
/* empty css */
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
a as Accordion,
|
|
22
23
|
f as Badge,
|
|
23
24
|
u as Box,
|
|
24
|
-
|
|
25
|
+
d as Button,
|
|
25
26
|
m as ButtonGroup,
|
|
26
27
|
n as Card,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
T as Drawer,
|
|
29
|
+
g as Form,
|
|
30
|
+
b as InputGroup,
|
|
30
31
|
y as Menu,
|
|
31
32
|
M as Modal,
|
|
32
33
|
S as Portal,
|
|
@@ -35,5 +36,6 @@ export {
|
|
|
35
36
|
F as Stack,
|
|
36
37
|
j as Table,
|
|
37
38
|
v as Tabs,
|
|
38
|
-
E as
|
|
39
|
+
E as Tooltip,
|
|
40
|
+
J as Typography
|
|
39
41
|
};
|
|
@@ -292,6 +292,25 @@ export type ThemeProviderContextType = {
|
|
|
292
292
|
body2: string;
|
|
293
293
|
};
|
|
294
294
|
};
|
|
295
|
+
tooltip: {
|
|
296
|
+
base: string;
|
|
297
|
+
color: {
|
|
298
|
+
primary: string;
|
|
299
|
+
secondary: string;
|
|
300
|
+
success: string;
|
|
301
|
+
info: string;
|
|
302
|
+
warning: string;
|
|
303
|
+
danger: string;
|
|
304
|
+
dark: string;
|
|
305
|
+
light: string;
|
|
306
|
+
};
|
|
307
|
+
placement: {
|
|
308
|
+
top: string;
|
|
309
|
+
end: string;
|
|
310
|
+
bottom: string;
|
|
311
|
+
start: string;
|
|
312
|
+
};
|
|
313
|
+
};
|
|
295
314
|
};
|
|
296
315
|
};
|
|
297
316
|
type Props = ChildrenProps & DeepPartial<ThemeProviderContextType>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, ElementType, ReactNode } from 'react';
|
|
2
2
|
import { TransitionStatus } from 'react-transition-group';
|
|
3
|
+
export type ComponentPropsWithoutAs<E extends ElementType, P extends Record<string, unknown> = {}> = P & Omit<ComponentProps<E>, keyof P>;
|
|
3
4
|
export type ComponentPropsWithAs<E extends ElementType, P extends Record<string, unknown> = {}> = P & {
|
|
4
5
|
as?: E;
|
|
5
6
|
} & Omit<ComponentProps<E>, "as" | keyof P>;
|