@mintlify/components 0.4.3 → 0.4.5
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 +15 -13
- package/dist/components/icon/base-icon.js +98 -0
- package/dist/components/icon/icon.js +22 -89
- package/dist/index.d.ts +41 -24
- package/dist/index.js +12 -10
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cn as
|
|
1
|
+
import { jsxs as p, jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { cn as f } from "../../utils/cn.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { Icon as
|
|
5
|
-
function
|
|
4
|
+
import { Icon as l } from "../icon/icon.js";
|
|
5
|
+
function y({
|
|
6
6
|
children: d,
|
|
7
7
|
color: e = "gray",
|
|
8
8
|
shape: m = "rounded",
|
|
@@ -11,18 +11,20 @@ function j({
|
|
|
11
11
|
disabled: s = !1,
|
|
12
12
|
icon: t,
|
|
13
13
|
iconType: n,
|
|
14
|
-
|
|
14
|
+
iconLibrary: i,
|
|
15
|
+
className: c
|
|
15
16
|
}) {
|
|
16
|
-
const o = typeof t == "string" ? /* @__PURE__ */
|
|
17
|
-
|
|
17
|
+
const o = typeof t == "string" ? /* @__PURE__ */ g(
|
|
18
|
+
l,
|
|
18
19
|
{
|
|
19
20
|
icon: t,
|
|
20
21
|
iconType: n,
|
|
22
|
+
iconLibrary: i,
|
|
21
23
|
className: "mt-badge-icon",
|
|
22
|
-
size:
|
|
24
|
+
size: b[a]
|
|
23
25
|
}
|
|
24
26
|
) : t;
|
|
25
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ p(
|
|
26
28
|
"span",
|
|
27
29
|
{
|
|
28
30
|
"data-shape": m,
|
|
@@ -31,11 +33,11 @@ function j({
|
|
|
31
33
|
"data-color": e,
|
|
32
34
|
"data-size": a,
|
|
33
35
|
"aria-disabled": s,
|
|
34
|
-
className:
|
|
36
|
+
className: f(
|
|
35
37
|
"mt-badge",
|
|
36
38
|
`mt-badge-${e}`,
|
|
37
39
|
`mt-badge-${a}`,
|
|
38
|
-
|
|
40
|
+
c
|
|
39
41
|
),
|
|
40
42
|
children: [
|
|
41
43
|
!!o && o,
|
|
@@ -44,12 +46,12 @@ function j({
|
|
|
44
46
|
}
|
|
45
47
|
);
|
|
46
48
|
}
|
|
47
|
-
const
|
|
49
|
+
const b = {
|
|
48
50
|
xs: 12,
|
|
49
51
|
sm: 14,
|
|
50
52
|
md: 16,
|
|
51
53
|
lg: 16
|
|
52
54
|
};
|
|
53
55
|
export {
|
|
54
|
-
|
|
56
|
+
y as Badge
|
|
55
57
|
};
|
|
@@ -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
|
@@ -2,7 +2,7 @@ import { CSSProperties } from 'react';
|
|
|
2
2
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
|
-
export declare function Badge({ children, color, shape, size, stroke, disabled, icon, iconType, className, }: BadgeProps): JSX_2.Element;
|
|
5
|
+
export declare function Badge({ children, color, shape, size, stroke, disabled, icon, iconType, iconLibrary, className, }: BadgeProps): JSX_2.Element;
|
|
6
6
|
|
|
7
7
|
export declare interface BadgeProps {
|
|
8
8
|
/**
|
|
@@ -42,10 +42,49 @@ export declare interface BadgeProps {
|
|
|
42
42
|
* @see {@link IconType}
|
|
43
43
|
*/
|
|
44
44
|
iconType?: IconType;
|
|
45
|
+
/**
|
|
46
|
+
* Icon library when `icon` is a string.
|
|
47
|
+
* @see {@link IconLibrary}
|
|
48
|
+
*/
|
|
49
|
+
iconLibrary?: IconLibrary;
|
|
45
50
|
className?: string;
|
|
46
51
|
children: ReactNode;
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
export declare function BaseIcon({ icon, iconType, iconLibrary, color, size, className, style, }: BaseIconProps): JSX_2.Element | null;
|
|
55
|
+
|
|
56
|
+
export declare interface BaseIconProps {
|
|
57
|
+
/**
|
|
58
|
+
* Icon name or custom URL.
|
|
59
|
+
* Supports Font Awesome icons, Lucide icons, or any custom URL.
|
|
60
|
+
*/
|
|
61
|
+
icon: string;
|
|
62
|
+
/**
|
|
63
|
+
* Icon style variant.
|
|
64
|
+
* @default "regular"
|
|
65
|
+
* @see {@link IconType}
|
|
66
|
+
*/
|
|
67
|
+
iconType?: IconType;
|
|
68
|
+
/**
|
|
69
|
+
* Icon library to use.
|
|
70
|
+
* @default "fontawesome"
|
|
71
|
+
* @see {@link IconLibrary}
|
|
72
|
+
*/
|
|
73
|
+
iconLibrary?: IconLibrary;
|
|
74
|
+
/**
|
|
75
|
+
* Icon color.
|
|
76
|
+
* @default "currentColor"
|
|
77
|
+
*/
|
|
78
|
+
color?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Icon size in pixels.
|
|
81
|
+
* @default 16
|
|
82
|
+
*/
|
|
83
|
+
size?: number;
|
|
84
|
+
className?: string;
|
|
85
|
+
style?: CSSProperties;
|
|
86
|
+
}
|
|
87
|
+
|
|
49
88
|
export declare const colors: {
|
|
50
89
|
"base-white": string;
|
|
51
90
|
"base-dark-1": string;
|
|
@@ -382,39 +421,17 @@ export { focus_2 as focus }
|
|
|
382
421
|
|
|
383
422
|
export declare function getIconUrl(icon: string, iconType?: IconType, iconLibrary?: IconLibrary): string;
|
|
384
423
|
|
|
385
|
-
export declare function Icon({ icon, iconType, iconLibrary, color, size, className, style, }: IconProps): JSX_2.Element
|
|
424
|
+
export declare function Icon({ icon, iconType, iconLibrary, color, size, className, style, }: IconProps): JSX_2.Element;
|
|
386
425
|
|
|
387
426
|
export declare const iconLibraries: readonly ["fontawesome", "lucide"];
|
|
388
427
|
|
|
389
428
|
export declare type IconLibrary = "fontawesome" | "lucide";
|
|
390
429
|
|
|
391
430
|
export declare interface IconProps {
|
|
392
|
-
/**
|
|
393
|
-
* Icon name or custom URL.
|
|
394
|
-
* Supports Font Awesome icons, Lucide icons, or any custom URL.
|
|
395
|
-
*/
|
|
396
431
|
icon: string;
|
|
397
|
-
/**
|
|
398
|
-
* Icon style variant.
|
|
399
|
-
* @default "regular"
|
|
400
|
-
* @see {@link IconType}
|
|
401
|
-
*/
|
|
402
432
|
iconType?: IconType;
|
|
403
|
-
/**
|
|
404
|
-
* Icon library to use.
|
|
405
|
-
* @default "fontawesome"
|
|
406
|
-
* @see {@link IconLibrary}
|
|
407
|
-
*/
|
|
408
433
|
iconLibrary?: IconLibrary;
|
|
409
|
-
/**
|
|
410
|
-
* Icon color.
|
|
411
|
-
* @default "currentColor"
|
|
412
|
-
*/
|
|
413
434
|
color?: string;
|
|
414
|
-
/**
|
|
415
|
-
* Icon size in pixels.
|
|
416
|
-
* @default 16
|
|
417
|
-
*/
|
|
418
435
|
size?: number;
|
|
419
436
|
className?: string;
|
|
420
437
|
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
|
};
|