@mintlify/components 0.4.5 → 0.4.7
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/badge/badge.js +22 -30
- package/dist/components/callout/callout.css +1 -0
- package/dist/components/callout/callout.js +139 -0
- package/dist/components/icon/icon.js +101 -24
- package/dist/constants/env.js +4 -0
- package/dist/index.d.ts +79 -41
- package/dist/index.js +9 -9
- package/package.json +4 -2
- package/dist/components/icon/base-icon.js +0 -98
- package/dist/components/icon/icon.css +0 -1
|
@@ -1,52 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { cn as
|
|
1
|
+
import { jsx as m, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { cn as b } from "../../utils/cn.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { Icon as
|
|
4
|
+
import { Icon as o } from "../icon/icon.js";
|
|
5
5
|
function y({
|
|
6
|
-
children:
|
|
6
|
+
children: n,
|
|
7
7
|
color: e = "gray",
|
|
8
|
-
shape:
|
|
9
|
-
size:
|
|
10
|
-
stroke:
|
|
8
|
+
shape: g = "rounded",
|
|
9
|
+
size: t = "md",
|
|
10
|
+
stroke: p = !1,
|
|
11
11
|
disabled: s = !1,
|
|
12
|
-
icon:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
className: c
|
|
12
|
+
icon: a,
|
|
13
|
+
className: c,
|
|
14
|
+
...i
|
|
16
15
|
}) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
icon: t,
|
|
21
|
-
iconType: n,
|
|
22
|
-
iconLibrary: i,
|
|
23
|
-
className: "mt-badge-icon",
|
|
24
|
-
size: b[a]
|
|
25
|
-
}
|
|
26
|
-
) : t;
|
|
27
|
-
return /* @__PURE__ */ p(
|
|
16
|
+
const d = typeof a == "string" ? /* @__PURE__ */ m(o, { icon: a, className: "mt-badge-icon", size: r[t] }) : a && typeof a == "object" && "icon" in a ? /* @__PURE__ */ m(o, { ...a, className: "mt-badge-icon", size: r[t] }) : a;
|
|
17
|
+
return /* @__PURE__ */ l(
|
|
28
18
|
"span",
|
|
29
19
|
{
|
|
30
|
-
"data-
|
|
31
|
-
"data-
|
|
20
|
+
"data-slot": "badge",
|
|
21
|
+
"data-shape": g,
|
|
22
|
+
"data-stroke": p,
|
|
32
23
|
"data-disabled": s,
|
|
33
24
|
"data-color": e,
|
|
34
|
-
"data-size":
|
|
25
|
+
"data-size": t,
|
|
35
26
|
"aria-disabled": s,
|
|
36
|
-
className:
|
|
27
|
+
className: b(
|
|
37
28
|
"mt-badge",
|
|
38
29
|
`mt-badge-${e}`,
|
|
39
|
-
`mt-badge-${
|
|
30
|
+
`mt-badge-${t}`,
|
|
40
31
|
c
|
|
41
32
|
),
|
|
33
|
+
...i,
|
|
42
34
|
children: [
|
|
43
|
-
!!
|
|
44
|
-
|
|
35
|
+
!!d && d,
|
|
36
|
+
n
|
|
45
37
|
]
|
|
46
38
|
}
|
|
47
39
|
);
|
|
48
40
|
}
|
|
49
|
-
const
|
|
41
|
+
const r = {
|
|
50
42
|
xs: 12,
|
|
51
43
|
sm: 14,
|
|
52
44
|
md: 16,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.mt-callout{display:flex;gap:.75rem;padding:1rem 1.25rem;border-radius:.75rem;border-width:1px;border-style:solid;margin:1rem 0;background-color:var(--callout-bg, rgb(250 250 250 / 50%));border-color:var(--callout-border, rgb(113 113 122 / 20%));color:var(--callout-text, rgb(24 24 27));--callout-icon-color: rgb(161 161 170)}:is(.dark,.dark-theme) .mt-callout{background-color:var(--callout-bg, rgb(113 113 122 / 10%));border-color:var(--callout-border, rgb(113 113 122 / 30%));color:var(--callout-text, rgb(228 228 231));--callout-icon-color: rgb(212 212 216)}.mt-callout-icon-wrapper{flex-shrink:0;display:flex;align-items:flex-start;padding-top:.125rem}.mt-callout-icon{color:var(--callout-icon-color)}.mt-callout-content{flex:1;min-width:0;font-size:.875rem;line-height:1.5}.mt-callout-body{color:var(--callout-text)}:is(.dark,.dark-theme) .mt-callout-custom .mt-callout-body{color:var(--dark-callout-text)}.mt-callout-info{--callout-bg: rgb(250 250 250 / 50%);--callout-border: rgb(113 113 122 / 20%);--callout-text: rgb(24 24 27);--callout-icon-color: rgb(161 161 170)}:is(.dark,.dark-theme) .mt-callout-info{--callout-bg: rgb(113 113 122 / 10%);--callout-border: rgb(113 113 122 / 30%);--callout-text: rgb(228 228 231);--callout-icon-color: rgb(212 212 216)}.mt-callout-warning{--callout-bg: rgb(255 251 235 / 50%);--callout-border: rgb(245 158 11 / 20%);--callout-text: rgb(120 53 15);--callout-icon-color: rgb(251 191 36)}:is(.dark,.dark-theme) .mt-callout-warning{--callout-bg: rgb(245 158 11 / 10%);--callout-border: rgb(245 158 11 / 30%);--callout-text: rgb(253 230 138);--callout-icon-color: rgb(252 211 77 / 80%)}.mt-callout-success{--callout-bg: rgb(236 253 245 / 50%);--callout-border: rgb(16 185 129 / 20%);--callout-text: rgb(6 78 59);--callout-icon-color: rgb(22 163 74)}:is(.dark,.dark-theme) .mt-callout-success{--callout-bg: rgb(16 185 129 / 10%);--callout-border: rgb(16 185 129 / 30%);--callout-text: rgb(167 243 208);--callout-icon-color: rgb(74 222 128 / 80%)}.mt-callout-danger{--callout-bg: rgb(254 242 242 / 50%);--callout-border: rgb(239 68 68 / 20%);--callout-text: rgb(127 29 29);--callout-icon-color: rgb(220 38 38)}:is(.dark,.dark-theme) .mt-callout-danger{--callout-bg: rgb(239 68 68 / 10%);--callout-border: rgb(239 68 68 / 30%);--callout-text: rgb(252 165 165);--callout-icon-color: rgb(248 113 113 / 80%)}.mt-callout-note{--callout-bg: rgb(240 249 255 / 50%);--callout-border: rgb(14 165 233 / 20%);--callout-text: rgb(12 74 110);--callout-icon-color: rgb(14 165 233)}:is(.dark,.dark-theme) .mt-callout-note{--callout-bg: rgb(14 165 233 / 10%);--callout-border: rgb(14 165 233 / 30%);--callout-text: rgb(186 230 253);--callout-icon-color: rgb(14 165 233)}.mt-callout-tip{--callout-bg: rgb(236 253 245 / 50%);--callout-border: rgb(16 185 129 / 20%);--callout-text: rgb(6 78 59);--callout-icon-color: rgb(5 150 105)}:is(.dark,.dark-theme) .mt-callout-tip{--callout-bg: rgb(16 185 129 / 10%);--callout-border: rgb(16 185 129 / 30%);--callout-text: rgb(167 243 208);--callout-icon-color: rgb(52 211 153 / 80%)}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx as l, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { cn as m } from "../../utils/cn.js";
|
|
3
|
+
import b from "color";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { Icon as r } from "../icon/icon.js";
|
|
6
|
+
function d({
|
|
7
|
+
children: n,
|
|
8
|
+
variant: o,
|
|
9
|
+
color: t,
|
|
10
|
+
className: c,
|
|
11
|
+
style: a,
|
|
12
|
+
...u
|
|
13
|
+
}) {
|
|
14
|
+
let s = {};
|
|
15
|
+
if (t) {
|
|
16
|
+
const e = b(t), i = e.isDark(), f = e.lighten(0.5), C = e.darken(0.5);
|
|
17
|
+
s = {
|
|
18
|
+
borderColor: `${t}33`,
|
|
19
|
+
backgroundColor: `${t}1a`,
|
|
20
|
+
"--callout-border": i ? `${t}66` : `${t}4d`,
|
|
21
|
+
"--callout-bg": i ? `${t}4d` : `${t}1a`,
|
|
22
|
+
"--callout-text": C.hex(),
|
|
23
|
+
"--callout-icon-color": t,
|
|
24
|
+
"--dark-callout-text": f.hex()
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ l(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "callout",
|
|
31
|
+
"data-variant": o,
|
|
32
|
+
className: m(
|
|
33
|
+
"mt-callout",
|
|
34
|
+
o && `mt-callout-${o}`,
|
|
35
|
+
t && "mt-callout-custom",
|
|
36
|
+
c
|
|
37
|
+
),
|
|
38
|
+
role: "note",
|
|
39
|
+
"aria-label": o ? `${o} callout` : "callout",
|
|
40
|
+
style: { ...s, ...a },
|
|
41
|
+
...u,
|
|
42
|
+
children: n
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function p({
|
|
47
|
+
children: n,
|
|
48
|
+
icon: o,
|
|
49
|
+
className: t,
|
|
50
|
+
...c
|
|
51
|
+
}) {
|
|
52
|
+
const a = n || (typeof o == "string" ? /* @__PURE__ */ l(r, { icon: o, className: "mt-callout-icon", size: 16 }) : o && typeof o == "object" && "icon" in o ? /* @__PURE__ */ l(r, { ...o, className: "mt-callout-icon", size: 16 }) : null);
|
|
53
|
+
return /* @__PURE__ */ l("div", { className: m("mt-callout-icon-wrapper", t), ...c, children: a });
|
|
54
|
+
}
|
|
55
|
+
function g({
|
|
56
|
+
children: n,
|
|
57
|
+
className: o,
|
|
58
|
+
...t
|
|
59
|
+
}) {
|
|
60
|
+
return /* @__PURE__ */ l(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
"data-slot": "callout-content",
|
|
64
|
+
className: m("mt-callout-content", o),
|
|
65
|
+
...t,
|
|
66
|
+
children: /* @__PURE__ */ l("div", { "data-slot": "callout-content-body", className: "mt-callout-body", children: n })
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function x({
|
|
71
|
+
children: n,
|
|
72
|
+
variant: o,
|
|
73
|
+
icon: t,
|
|
74
|
+
color: c,
|
|
75
|
+
className: a,
|
|
76
|
+
style: u,
|
|
77
|
+
...s
|
|
78
|
+
}) {
|
|
79
|
+
const e = o ? h(o) : null, i = typeof t == "string" ? /* @__PURE__ */ l(r, { icon: t, className: "mt-callout-icon", size: 16 }) : t && typeof t == "object" && "icon" in t ? /* @__PURE__ */ l(r, { ...t, className: "mt-callout-icon", size: 16 }) : t !== void 0 ? t : e ? /* @__PURE__ */ l(
|
|
80
|
+
r,
|
|
81
|
+
{
|
|
82
|
+
icon: e.icon,
|
|
83
|
+
className: "mt-callout-icon",
|
|
84
|
+
size: 16,
|
|
85
|
+
iconType: e.iconType
|
|
86
|
+
}
|
|
87
|
+
) : null;
|
|
88
|
+
return /* @__PURE__ */ y(
|
|
89
|
+
d,
|
|
90
|
+
{
|
|
91
|
+
"data-slot": "callout-root",
|
|
92
|
+
variant: o,
|
|
93
|
+
color: c,
|
|
94
|
+
className: a,
|
|
95
|
+
style: u,
|
|
96
|
+
...s,
|
|
97
|
+
children: [
|
|
98
|
+
i && /* @__PURE__ */ l(p, { children: i }),
|
|
99
|
+
/* @__PURE__ */ l(g, { children: n })
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
function h(n) {
|
|
105
|
+
return {
|
|
106
|
+
info: {
|
|
107
|
+
icon: "circle-info",
|
|
108
|
+
iconType: "regular"
|
|
109
|
+
},
|
|
110
|
+
warning: {
|
|
111
|
+
icon: "triangle-exclamation",
|
|
112
|
+
iconType: "regular"
|
|
113
|
+
},
|
|
114
|
+
success: {
|
|
115
|
+
icon: "check",
|
|
116
|
+
iconType: "regular"
|
|
117
|
+
},
|
|
118
|
+
danger: {
|
|
119
|
+
icon: "hexagon-exclamation",
|
|
120
|
+
iconType: "regular"
|
|
121
|
+
},
|
|
122
|
+
note: {
|
|
123
|
+
icon: "circle-exclamation",
|
|
124
|
+
iconType: "regular"
|
|
125
|
+
},
|
|
126
|
+
tip: {
|
|
127
|
+
icon: "lightbulb",
|
|
128
|
+
iconType: "regular"
|
|
129
|
+
}
|
|
130
|
+
}[n];
|
|
131
|
+
}
|
|
132
|
+
const j = Object.assign(x, {
|
|
133
|
+
Root: d,
|
|
134
|
+
Icon: p,
|
|
135
|
+
Content: g
|
|
136
|
+
});
|
|
137
|
+
export {
|
|
138
|
+
j as Callout
|
|
139
|
+
};
|
|
@@ -1,32 +1,109 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { cn as m } from "../../utils/cn.js";
|
|
3
|
+
import { isAbsoluteUrl as c } from "../../utils/isAbsoluteUrl.js";
|
|
4
|
+
import { MINTLIFY_ICONS_CDN_URL as o } from "../../constants/index.js";
|
|
5
|
+
import { FONT_AWESOME_BRANDS as f } from "../../constants/font-awesome-brands.js";
|
|
6
|
+
import { IS_DEV as $ } from "../../constants/env.js";
|
|
7
|
+
function N({
|
|
8
|
+
icon: t,
|
|
9
|
+
iconType: r,
|
|
10
|
+
iconLibrary: s,
|
|
11
|
+
color: a,
|
|
12
|
+
size: e = 16,
|
|
13
|
+
className: n,
|
|
14
|
+
style: i,
|
|
15
|
+
...l
|
|
12
16
|
}) {
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
if (r && !d.includes(r))
|
|
18
|
+
return $ && console.warn(
|
|
19
|
+
`Invalid iconType ${r} expected a string equal to one of: ${d.join(
|
|
20
|
+
", "
|
|
21
|
+
)}`
|
|
22
|
+
), null;
|
|
23
|
+
if (typeof t == "string" && (c(t) || t.startsWith("/"))) {
|
|
24
|
+
if (t.startsWith(o) || t.startsWith("https://mintlify.b-cdn.net")) {
|
|
25
|
+
const k = l;
|
|
26
|
+
return /* @__PURE__ */ u(
|
|
27
|
+
"svg",
|
|
28
|
+
{
|
|
29
|
+
className: m("mt-icon", n),
|
|
30
|
+
style: {
|
|
31
|
+
WebkitMaskImage: `url(${t})`,
|
|
32
|
+
WebkitMaskRepeat: "no-repeat",
|
|
33
|
+
WebkitMaskPosition: "center",
|
|
34
|
+
maskImage: `url(${t})`,
|
|
35
|
+
maskRepeat: "no-repeat",
|
|
36
|
+
maskPosition: "center",
|
|
37
|
+
maskSize: "100%",
|
|
38
|
+
backgroundColor: a || "currentColor",
|
|
39
|
+
width: e,
|
|
40
|
+
height: e,
|
|
41
|
+
...i
|
|
42
|
+
},
|
|
43
|
+
...k
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
const h = l;
|
|
48
|
+
return /* @__PURE__ */ u(
|
|
49
|
+
"img",
|
|
50
|
+
{
|
|
51
|
+
src: t,
|
|
52
|
+
alt: t,
|
|
53
|
+
className: m("mt-icon", n),
|
|
54
|
+
style: {
|
|
55
|
+
width: e,
|
|
56
|
+
height: e,
|
|
57
|
+
...i
|
|
58
|
+
},
|
|
59
|
+
...h
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
const g = v(t.toLowerCase(), r, s), p = l;
|
|
64
|
+
return /* @__PURE__ */ u(
|
|
65
|
+
"svg",
|
|
15
66
|
{
|
|
16
|
-
|
|
17
|
-
iconType: o,
|
|
18
|
-
iconLibrary: r,
|
|
19
|
-
color: n,
|
|
20
|
-
size: t,
|
|
21
|
-
className: e,
|
|
67
|
+
className: m("mt-icon", n),
|
|
22
68
|
style: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
69
|
+
WebkitMaskImage: `url(${g})`,
|
|
70
|
+
WebkitMaskRepeat: "no-repeat",
|
|
71
|
+
WebkitMaskPosition: "center",
|
|
72
|
+
maskImage: `url(${g})`,
|
|
73
|
+
maskRepeat: "no-repeat",
|
|
74
|
+
maskPosition: "center",
|
|
75
|
+
maskSize: s === "lucide" ? "100%" : void 0,
|
|
76
|
+
backgroundColor: a || "currentColor",
|
|
77
|
+
width: e,
|
|
78
|
+
height: e,
|
|
79
|
+
...i
|
|
80
|
+
},
|
|
81
|
+
...p
|
|
27
82
|
}
|
|
28
83
|
);
|
|
29
84
|
}
|
|
85
|
+
function b(t) {
|
|
86
|
+
return t ? f.includes(t.toLowerCase()) : !1;
|
|
87
|
+
}
|
|
88
|
+
function v(t, r, s) {
|
|
89
|
+
return b(t) ? `${o}/v7.1.0/brands/${t}.svg` : s === "lucide" ? `${o}/lucide/v0.545.0/${t}.svg` : `${o}/v7.1.0/${r ?? "regular"}/${t}.svg`;
|
|
90
|
+
}
|
|
91
|
+
const R = ["fontawesome", "lucide"], d = [
|
|
92
|
+
"brands",
|
|
93
|
+
"duotone",
|
|
94
|
+
"light",
|
|
95
|
+
"regular",
|
|
96
|
+
"sharp-duotone-solid",
|
|
97
|
+
"sharp-light",
|
|
98
|
+
"sharp-regular",
|
|
99
|
+
"sharp-solid",
|
|
100
|
+
"sharp-thin",
|
|
101
|
+
"solid",
|
|
102
|
+
"thin"
|
|
103
|
+
];
|
|
30
104
|
export {
|
|
31
|
-
|
|
105
|
+
N as Icon,
|
|
106
|
+
v as getIconUrl,
|
|
107
|
+
R as iconLibraries,
|
|
108
|
+
d as iconTypes
|
|
32
109
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
2
3
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
4
|
import { ReactNode } from 'react';
|
|
5
|
+
import { SVGAttributes } from 'react';
|
|
4
6
|
|
|
5
|
-
export declare function Badge({ children, color, shape, size, stroke, disabled, icon,
|
|
7
|
+
export declare function Badge({ children, color, shape, size, stroke, disabled, icon, className, ...props }: BadgeProps): JSX_2.Element;
|
|
6
8
|
|
|
7
|
-
export declare interface BadgeProps {
|
|
9
|
+
export declare interface BadgeProps extends Omit<HTMLAttributes<HTMLSpanElement>, "color"> {
|
|
8
10
|
/**
|
|
9
11
|
* @default "gray"
|
|
10
12
|
*/
|
|
@@ -29,62 +31,74 @@ export declare interface BadgeProps {
|
|
|
29
31
|
*/
|
|
30
32
|
disabled?: boolean;
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
33
|
-
* see {@link
|
|
34
|
-
* @example
|
|
35
|
-
* ```tsx
|
|
36
|
-
* <Badge icon="check" iconType="lucide">Verified</Badge>
|
|
37
|
-
* ```
|
|
34
|
+
* Icon before content. String (icon name) or IconProps object.
|
|
35
|
+
* @see {@link IconProps}
|
|
38
36
|
*/
|
|
39
|
-
icon?:
|
|
40
|
-
/**
|
|
41
|
-
* Icon set type when `icon` is a string.
|
|
42
|
-
* @see {@link IconType}
|
|
43
|
-
*/
|
|
44
|
-
iconType?: IconType;
|
|
45
|
-
/**
|
|
46
|
-
* Icon library when `icon` is a string.
|
|
47
|
-
* @see {@link IconLibrary}
|
|
48
|
-
*/
|
|
49
|
-
iconLibrary?: IconLibrary;
|
|
37
|
+
icon?: IconProp;
|
|
50
38
|
className?: string;
|
|
51
39
|
children: ReactNode;
|
|
52
40
|
}
|
|
53
41
|
|
|
54
|
-
export declare
|
|
42
|
+
export declare const Callout: typeof CalloutComponent & {
|
|
43
|
+
Root: typeof CalloutRoot;
|
|
44
|
+
Icon: typeof CalloutIcon;
|
|
45
|
+
Content: typeof CalloutContent;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
declare function CalloutComponent({ children, variant, icon, color, className, style, ...props }: CalloutProps): JSX_2.Element;
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
declare function CalloutContent({ children, className, ...props }: CalloutContentProps): JSX_2.Element;
|
|
51
|
+
|
|
52
|
+
export declare interface CalloutContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare function CalloutIcon({ children, icon, className, ...props }: CalloutIconProps): JSX_2.Element;
|
|
58
|
+
|
|
59
|
+
export declare interface CalloutIconProps extends HTMLAttributes<HTMLDivElement> {
|
|
60
|
+
children?: ReactNode;
|
|
62
61
|
/**
|
|
63
|
-
* Icon
|
|
64
|
-
* @
|
|
65
|
-
* @see {@link IconType}
|
|
62
|
+
* Icon before content. String (icon name) or IconProps object.
|
|
63
|
+
* @see {@link IconProp}
|
|
66
64
|
*/
|
|
67
|
-
|
|
65
|
+
icon?: string | Omit<IconProps, "size" | "className" | "style">;
|
|
66
|
+
className?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare interface CalloutProps extends HTMLAttributes<HTMLDivElement> {
|
|
68
70
|
/**
|
|
69
|
-
*
|
|
70
|
-
* @
|
|
71
|
-
* @see {@link IconLibrary}
|
|
71
|
+
* Callout variant.
|
|
72
|
+
* @see {@link CalloutVariant}
|
|
72
73
|
*/
|
|
73
|
-
|
|
74
|
+
variant?: CalloutVariant;
|
|
74
75
|
/**
|
|
75
|
-
* Icon
|
|
76
|
-
* @
|
|
76
|
+
* Icon before content. String (icon name) or IconProps object.
|
|
77
|
+
* @see {@link IconProp}
|
|
77
78
|
*/
|
|
79
|
+
icon?: IconProp;
|
|
78
80
|
color?: string;
|
|
81
|
+
children: ReactNode;
|
|
82
|
+
className?: string;
|
|
83
|
+
style?: CSSProperties;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare function CalloutRoot({ children, variant, color, className, style, ...props }: CalloutRootProps): JSX_2.Element;
|
|
87
|
+
|
|
88
|
+
export declare interface CalloutRootProps extends HTMLAttributes<HTMLDivElement> {
|
|
79
89
|
/**
|
|
80
|
-
*
|
|
81
|
-
* @
|
|
90
|
+
* Callout variant.
|
|
91
|
+
* @see {@link CalloutVariant}
|
|
82
92
|
*/
|
|
83
|
-
|
|
93
|
+
variant?: CalloutVariant;
|
|
94
|
+
color?: string;
|
|
95
|
+
children: ReactNode;
|
|
84
96
|
className?: string;
|
|
85
97
|
style?: CSSProperties;
|
|
86
98
|
}
|
|
87
99
|
|
|
100
|
+
export declare type CalloutVariant = "info" | "warning" | "success" | "danger" | "note" | "tip";
|
|
101
|
+
|
|
88
102
|
export declare const colors: {
|
|
89
103
|
"base-white": string;
|
|
90
104
|
"base-dark-1": string;
|
|
@@ -421,17 +435,41 @@ export { focus_2 as focus }
|
|
|
421
435
|
|
|
422
436
|
export declare function getIconUrl(icon: string, iconType?: IconType, iconLibrary?: IconLibrary): string;
|
|
423
437
|
|
|
424
|
-
export declare function Icon({ icon, iconType, iconLibrary, color, size, className, style, }: IconProps): JSX_2.Element;
|
|
438
|
+
export declare function Icon({ icon, iconType, iconLibrary, color, size, className, style, ...props }: IconProps): JSX_2.Element | null;
|
|
425
439
|
|
|
426
440
|
export declare const iconLibraries: readonly ["fontawesome", "lucide"];
|
|
427
441
|
|
|
428
442
|
export declare type IconLibrary = "fontawesome" | "lucide";
|
|
429
443
|
|
|
430
|
-
|
|
444
|
+
declare type IconProp = ReactNode | string | Omit<IconProps, "size" | "className" | "style">;
|
|
445
|
+
|
|
446
|
+
export declare interface IconProps extends Omit<SVGAttributes<SVGSVGElement>, "color"> {
|
|
447
|
+
/**
|
|
448
|
+
* Icon name or custom URL.
|
|
449
|
+
* Supports Font Awesome icons, Lucide icons, or any custom URL.
|
|
450
|
+
*/
|
|
431
451
|
icon: string;
|
|
452
|
+
/**
|
|
453
|
+
* Icon style variant.
|
|
454
|
+
* @default "regular"
|
|
455
|
+
* @see {@link IconType}
|
|
456
|
+
*/
|
|
432
457
|
iconType?: IconType;
|
|
458
|
+
/**
|
|
459
|
+
* Icon library to use.
|
|
460
|
+
* @default "fontawesome"
|
|
461
|
+
* @see {@link IconLibrary}
|
|
462
|
+
*/
|
|
433
463
|
iconLibrary?: IconLibrary;
|
|
464
|
+
/**
|
|
465
|
+
* Icon color.
|
|
466
|
+
* @default "currentColor"
|
|
467
|
+
*/
|
|
434
468
|
color?: string;
|
|
469
|
+
/**
|
|
470
|
+
* Icon size in pixels.
|
|
471
|
+
* @default 16
|
|
472
|
+
*/
|
|
435
473
|
size?: number;
|
|
436
474
|
className?: string;
|
|
437
475
|
style?: CSSProperties;
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
import { Badge as s } from "./components/badge/badge.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { colors as
|
|
3
|
+
import { Callout as c } from "./components/callout/callout.js";
|
|
4
|
+
import { Icon as n, getIconUrl as p, iconLibraries as f, iconTypes as m } from "./components/icon/icon.js";
|
|
5
|
+
import { colors as l, designTokens as x, focus as d, shadows as g } from "./styles/design-tokens.js";
|
|
6
6
|
export {
|
|
7
7
|
s as Badge,
|
|
8
|
-
|
|
8
|
+
c as Callout,
|
|
9
9
|
n as Icon,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
l as colors,
|
|
11
|
+
x as designTokens,
|
|
12
|
+
d as focus,
|
|
13
|
+
p as getIconUrl,
|
|
14
14
|
f as iconLibraries,
|
|
15
15
|
m as iconTypes,
|
|
16
|
-
|
|
16
|
+
g as shadows
|
|
17
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/components",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Mintlify Headless UI components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -61,12 +61,14 @@
|
|
|
61
61
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"clsx": "^2.1.1"
|
|
64
|
+
"clsx": "^2.1.1",
|
|
65
|
+
"color": "^5.0.3"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
68
|
"@storybook/addon-docs": "^10.0.8",
|
|
68
69
|
"@storybook/react-vite": "^10.0.8",
|
|
69
70
|
"@tailwindcss/postcss": "^4.1.17",
|
|
71
|
+
"@types/color": "^3.0.6",
|
|
70
72
|
"@types/node": "^22.10.1",
|
|
71
73
|
"@types/react": "^18.3.12",
|
|
72
74
|
"@types/react-dom": "^18.3.1",
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { cn as u } from "../../utils/cn.js";
|
|
3
|
-
import { isAbsoluteUrl as g } from "../../utils/isAbsoluteUrl.js";
|
|
4
|
-
import { MINTLIFY_ICONS_CDN_URL as a } from "../../constants/index.js";
|
|
5
|
-
import { FONT_AWESOME_BRANDS as p } from "../../constants/font-awesome-brands.js";
|
|
6
|
-
function v({
|
|
7
|
-
icon: t,
|
|
8
|
-
iconType: e,
|
|
9
|
-
iconLibrary: s,
|
|
10
|
-
color: o,
|
|
11
|
-
size: r = 16,
|
|
12
|
-
className: n,
|
|
13
|
-
style: i
|
|
14
|
-
}) {
|
|
15
|
-
if (e && !d.includes(e))
|
|
16
|
-
return console.warn(
|
|
17
|
-
`Invalid iconType ${e} expected a string equal to one of: ${d.join(
|
|
18
|
-
", "
|
|
19
|
-
)}`
|
|
20
|
-
), null;
|
|
21
|
-
if (typeof t == "string" && (g(t) || t.startsWith("/")))
|
|
22
|
-
return t.startsWith(a) || t.startsWith("https://mintlify.b-cdn.net") ? /* @__PURE__ */ l(
|
|
23
|
-
"svg",
|
|
24
|
-
{
|
|
25
|
-
className: u("mt-icon", n),
|
|
26
|
-
style: {
|
|
27
|
-
WebkitMaskImage: `url(${t})`,
|
|
28
|
-
WebkitMaskRepeat: "no-repeat",
|
|
29
|
-
WebkitMaskPosition: "center",
|
|
30
|
-
maskImage: `url(${t})`,
|
|
31
|
-
maskRepeat: "no-repeat",
|
|
32
|
-
maskPosition: "center",
|
|
33
|
-
maskSize: "100%",
|
|
34
|
-
backgroundColor: o || "currentColor",
|
|
35
|
-
width: r,
|
|
36
|
-
height: r,
|
|
37
|
-
...i
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
) : /* @__PURE__ */ l(
|
|
41
|
-
"img",
|
|
42
|
-
{
|
|
43
|
-
src: t,
|
|
44
|
-
alt: t,
|
|
45
|
-
className: u("mt-icon", n),
|
|
46
|
-
style: {
|
|
47
|
-
width: r,
|
|
48
|
-
height: r,
|
|
49
|
-
...i
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
const m = k(t.toLowerCase(), e, s);
|
|
54
|
-
return /* @__PURE__ */ l(
|
|
55
|
-
"svg",
|
|
56
|
-
{
|
|
57
|
-
className: u("mt-icon", n),
|
|
58
|
-
style: {
|
|
59
|
-
WebkitMaskImage: `url(${m})`,
|
|
60
|
-
WebkitMaskRepeat: "no-repeat",
|
|
61
|
-
WebkitMaskPosition: "center",
|
|
62
|
-
maskImage: `url(${m})`,
|
|
63
|
-
maskRepeat: "no-repeat",
|
|
64
|
-
maskPosition: "center",
|
|
65
|
-
maskSize: s === "lucide" ? "100%" : void 0,
|
|
66
|
-
backgroundColor: o || "currentColor",
|
|
67
|
-
width: r,
|
|
68
|
-
height: r,
|
|
69
|
-
...i
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
function h(t) {
|
|
75
|
-
return t ? p.includes(t.toLowerCase()) : !1;
|
|
76
|
-
}
|
|
77
|
-
function k(t, e, s) {
|
|
78
|
-
return h(t) ? `${a}/v7.1.0/brands/${t}.svg` : s === "lucide" ? `${a}/lucide/v0.545.0/${t}.svg` : `${a}/v7.1.0/${e ?? "regular"}/${t}.svg`;
|
|
79
|
-
}
|
|
80
|
-
const W = ["fontawesome", "lucide"], d = [
|
|
81
|
-
"brands",
|
|
82
|
-
"duotone",
|
|
83
|
-
"light",
|
|
84
|
-
"regular",
|
|
85
|
-
"sharp-duotone-solid",
|
|
86
|
-
"sharp-light",
|
|
87
|
-
"sharp-regular",
|
|
88
|
-
"sharp-solid",
|
|
89
|
-
"sharp-thin",
|
|
90
|
-
"solid",
|
|
91
|
-
"thin"
|
|
92
|
-
];
|
|
93
|
-
export {
|
|
94
|
-
v as BaseIcon,
|
|
95
|
-
k as getIconUrl,
|
|
96
|
-
W as iconLibraries,
|
|
97
|
-
d as iconTypes
|
|
98
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.mt-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
|