@mintlify/components 0.4.3 → 0.4.4
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/icon/base-icon.js +98 -0
- package/dist/components/icon/icon.js +22 -89
- package/dist/index.d.ts +35 -23
- package/dist/index.js +12 -10
- package/package.json +1 -1
|
@@ -0,0 +1,98 @@
|
|
|
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,99 +1,32 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import { isAbsoluteUrl as d } from "../../utils/isAbsoluteUrl.js";
|
|
4
|
-
import { MINTLIFY_ICONS_CDN_URL as a } from "../../constants/index.js";
|
|
5
|
-
import { FONT_AWESOME_BRANDS as g } from "../../constants/font-awesome-brands.js";
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { BaseIcon as c } from "./base-icon.js";
|
|
6
3
|
/* empty css */
|
|
7
|
-
function
|
|
8
|
-
icon:
|
|
9
|
-
iconType:
|
|
10
|
-
iconLibrary:
|
|
11
|
-
color:
|
|
12
|
-
size:
|
|
13
|
-
className:
|
|
14
|
-
style:
|
|
4
|
+
function d({
|
|
5
|
+
icon: i,
|
|
6
|
+
iconType: o,
|
|
7
|
+
iconLibrary: r,
|
|
8
|
+
color: n,
|
|
9
|
+
size: t = 16,
|
|
10
|
+
className: e,
|
|
11
|
+
style: l
|
|
15
12
|
}) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
`Invalid iconType ${e} expected a string equal to one of: ${p.join(
|
|
19
|
-
", "
|
|
20
|
-
)}`
|
|
21
|
-
), null;
|
|
22
|
-
if (typeof t == "string" && (d(t) || t.startsWith("/")))
|
|
23
|
-
return t.startsWith(a) || t.startsWith("https://mintlify.b-cdn.net") ? /* @__PURE__ */ l(
|
|
24
|
-
"svg",
|
|
25
|
-
{
|
|
26
|
-
className: u("mt-icon", n),
|
|
27
|
-
style: {
|
|
28
|
-
WebkitMaskImage: `url(${t})`,
|
|
29
|
-
WebkitMaskRepeat: "no-repeat",
|
|
30
|
-
WebkitMaskPosition: "center",
|
|
31
|
-
maskImage: `url(${t})`,
|
|
32
|
-
maskRepeat: "no-repeat",
|
|
33
|
-
maskPosition: "center",
|
|
34
|
-
maskSize: "100%",
|
|
35
|
-
backgroundColor: o || "currentColor",
|
|
36
|
-
width: r,
|
|
37
|
-
height: r,
|
|
38
|
-
...i
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
) : /* @__PURE__ */ l(
|
|
42
|
-
"img",
|
|
43
|
-
{
|
|
44
|
-
src: t,
|
|
45
|
-
alt: t,
|
|
46
|
-
className: u("mt-icon", n),
|
|
47
|
-
style: {
|
|
48
|
-
width: r,
|
|
49
|
-
height: r,
|
|
50
|
-
...i
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
const m = k(t.toLowerCase(), e, s);
|
|
55
|
-
return /* @__PURE__ */ l(
|
|
56
|
-
"svg",
|
|
13
|
+
return /* @__PURE__ */ m(
|
|
14
|
+
c,
|
|
57
15
|
{
|
|
58
|
-
|
|
16
|
+
icon: i,
|
|
17
|
+
iconType: o,
|
|
18
|
+
iconLibrary: r,
|
|
19
|
+
color: n,
|
|
20
|
+
size: t,
|
|
21
|
+
className: e,
|
|
59
22
|
style: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
maskImage: `url(${m})`,
|
|
64
|
-
maskRepeat: "no-repeat",
|
|
65
|
-
maskPosition: "center",
|
|
66
|
-
maskSize: s === "lucide" ? "100%" : void 0,
|
|
67
|
-
backgroundColor: o || "currentColor",
|
|
68
|
-
width: r,
|
|
69
|
-
height: r,
|
|
70
|
-
...i
|
|
23
|
+
display: "inline-block",
|
|
24
|
+
verticalAlign: "middle",
|
|
25
|
+
...l
|
|
71
26
|
}
|
|
72
27
|
}
|
|
73
28
|
);
|
|
74
29
|
}
|
|
75
|
-
function h(t) {
|
|
76
|
-
return t ? g.includes(t.toLowerCase()) : !1;
|
|
77
|
-
}
|
|
78
|
-
function k(t, e, s) {
|
|
79
|
-
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`;
|
|
80
|
-
}
|
|
81
|
-
const C = ["fontawesome", "lucide"], p = [
|
|
82
|
-
"brands",
|
|
83
|
-
"duotone",
|
|
84
|
-
"light",
|
|
85
|
-
"regular",
|
|
86
|
-
"sharp-duotone-solid",
|
|
87
|
-
"sharp-light",
|
|
88
|
-
"sharp-regular",
|
|
89
|
-
"sharp-solid",
|
|
90
|
-
"sharp-thin",
|
|
91
|
-
"solid",
|
|
92
|
-
"thin"
|
|
93
|
-
];
|
|
94
30
|
export {
|
|
95
|
-
|
|
96
|
-
k as getIconUrl,
|
|
97
|
-
C as iconLibraries,
|
|
98
|
-
p as iconTypes
|
|
31
|
+
d as Icon
|
|
99
32
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,40 @@ export declare interface BadgeProps {
|
|
|
46
46
|
children: ReactNode;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
export declare function BaseIcon({ icon, iconType, iconLibrary, color, size, className, style, }: BaseIconProps): JSX_2.Element | null;
|
|
50
|
+
|
|
51
|
+
export declare interface BaseIconProps {
|
|
52
|
+
/**
|
|
53
|
+
* Icon name or custom URL.
|
|
54
|
+
* Supports Font Awesome icons, Lucide icons, or any custom URL.
|
|
55
|
+
*/
|
|
56
|
+
icon: string;
|
|
57
|
+
/**
|
|
58
|
+
* Icon style variant.
|
|
59
|
+
* @default "regular"
|
|
60
|
+
* @see {@link IconType}
|
|
61
|
+
*/
|
|
62
|
+
iconType?: IconType;
|
|
63
|
+
/**
|
|
64
|
+
* Icon library to use.
|
|
65
|
+
* @default "fontawesome"
|
|
66
|
+
* @see {@link IconLibrary}
|
|
67
|
+
*/
|
|
68
|
+
iconLibrary?: IconLibrary;
|
|
69
|
+
/**
|
|
70
|
+
* Icon color.
|
|
71
|
+
* @default "currentColor"
|
|
72
|
+
*/
|
|
73
|
+
color?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Icon size in pixels.
|
|
76
|
+
* @default 16
|
|
77
|
+
*/
|
|
78
|
+
size?: number;
|
|
79
|
+
className?: string;
|
|
80
|
+
style?: CSSProperties;
|
|
81
|
+
}
|
|
82
|
+
|
|
49
83
|
export declare const colors: {
|
|
50
84
|
"base-white": string;
|
|
51
85
|
"base-dark-1": string;
|
|
@@ -382,39 +416,17 @@ export { focus_2 as focus }
|
|
|
382
416
|
|
|
383
417
|
export declare function getIconUrl(icon: string, iconType?: IconType, iconLibrary?: IconLibrary): string;
|
|
384
418
|
|
|
385
|
-
export declare function Icon({ icon, iconType, iconLibrary, color, size, className, style, }: IconProps): JSX_2.Element
|
|
419
|
+
export declare function Icon({ icon, iconType, iconLibrary, color, size, className, style, }: IconProps): JSX_2.Element;
|
|
386
420
|
|
|
387
421
|
export declare const iconLibraries: readonly ["fontawesome", "lucide"];
|
|
388
422
|
|
|
389
423
|
export declare type IconLibrary = "fontawesome" | "lucide";
|
|
390
424
|
|
|
391
425
|
export declare interface IconProps {
|
|
392
|
-
/**
|
|
393
|
-
* Icon name or custom URL.
|
|
394
|
-
* Supports Font Awesome icons, Lucide icons, or any custom URL.
|
|
395
|
-
*/
|
|
396
426
|
icon: string;
|
|
397
|
-
/**
|
|
398
|
-
* Icon style variant.
|
|
399
|
-
* @default "regular"
|
|
400
|
-
* @see {@link IconType}
|
|
401
|
-
*/
|
|
402
427
|
iconType?: IconType;
|
|
403
|
-
/**
|
|
404
|
-
* Icon library to use.
|
|
405
|
-
* @default "fontawesome"
|
|
406
|
-
* @see {@link IconLibrary}
|
|
407
|
-
*/
|
|
408
428
|
iconLibrary?: IconLibrary;
|
|
409
|
-
/**
|
|
410
|
-
* Icon color.
|
|
411
|
-
* @default "currentColor"
|
|
412
|
-
*/
|
|
413
429
|
color?: string;
|
|
414
|
-
/**
|
|
415
|
-
* Icon size in pixels.
|
|
416
|
-
* @default 16
|
|
417
|
-
*/
|
|
418
430
|
size?: number;
|
|
419
431
|
className?: string;
|
|
420
432
|
style?: CSSProperties;
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
import { Badge as s } from "./components/badge/badge.js";
|
|
3
|
-
import { Icon as
|
|
4
|
-
import {
|
|
3
|
+
import { Icon as n } from "./components/icon/icon.js";
|
|
4
|
+
import { BaseIcon as p, getIconUrl as t, iconLibraries as f, iconTypes as m } from "./components/icon/base-icon.js";
|
|
5
|
+
import { colors as x, designTokens as d, focus as g, shadows as I } from "./styles/design-tokens.js";
|
|
5
6
|
export {
|
|
6
7
|
s as Badge,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
d as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
p as BaseIcon,
|
|
9
|
+
n as Icon,
|
|
10
|
+
x as colors,
|
|
11
|
+
d as designTokens,
|
|
12
|
+
g as focus,
|
|
13
|
+
t as getIconUrl,
|
|
14
|
+
f as iconLibraries,
|
|
15
|
+
m as iconTypes,
|
|
16
|
+
I as shadows
|
|
15
17
|
};
|