@mintlify/components 0.4.7 → 0.4.9

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.
@@ -1,27 +1,27 @@
1
- import { jsx as l, jsxs as y } from "react/jsx-runtime";
1
+ import { jsx as l, jsxs as b } from "react/jsx-runtime";
2
2
  import { cn as m } from "../../utils/cn.js";
3
- import b from "color";
3
+ import x from "color";
4
4
  /* empty css */
5
- import { Icon as r } from "../icon/icon.js";
5
+ import { Icon as u } from "../icon/icon.js";
6
6
  function d({
7
- children: n,
7
+ children: a,
8
8
  variant: o,
9
9
  color: t,
10
- className: c,
11
- style: a,
12
- ...u
10
+ className: n,
11
+ style: c,
12
+ ...i
13
13
  }) {
14
- let s = {};
14
+ let r = {};
15
15
  if (t) {
16
- const e = b(t), i = e.isDark(), f = e.lighten(0.5), C = e.darken(0.5);
17
- s = {
16
+ const e = x(t), s = e.isDark(), C = e.lighten(0.5), g = e.darken(0.5);
17
+ r = {
18
18
  borderColor: `${t}33`,
19
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(),
20
+ "--callout-border": s ? `${t}66` : `${t}4d`,
21
+ "--callout-bg": s ? `${t}4d` : `${t}1a`,
22
+ "--callout-text": g.hex(),
23
23
  "--callout-icon-color": t,
24
- "--dark-callout-text": f.hex()
24
+ "--dark-callout-text": C.hex()
25
25
  };
26
26
  }
27
27
  return /* @__PURE__ */ l(
@@ -33,27 +33,27 @@ function d({
33
33
  "mt-callout",
34
34
  o && `mt-callout-${o}`,
35
35
  t && "mt-callout-custom",
36
- c
36
+ n
37
37
  ),
38
38
  role: "note",
39
39
  "aria-label": o ? `${o} callout` : "callout",
40
- style: { ...s, ...a },
41
- ...u,
42
- children: n
40
+ style: { ...r, ...c },
41
+ ...i,
42
+ children: a
43
43
  }
44
44
  );
45
45
  }
46
- function p({
47
- children: n,
46
+ function f({
47
+ children: a,
48
48
  icon: o,
49
49
  className: t,
50
- ...c
50
+ ...n
51
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 });
52
+ const c = a || (typeof o == "string" ? /* @__PURE__ */ l(u, { icon: o, className: "mt-callout-icon", size: 16 }) : o && typeof o == "object" && "icon" in o ? /* @__PURE__ */ l(u, { ...o, className: "mt-callout-icon", size: 16 }) : null);
53
+ return /* @__PURE__ */ l("div", { className: m("mt-callout-icon-wrapper", t), ...n, children: c });
54
54
  }
55
- function g({
56
- children: n,
55
+ function p({
56
+ children: a,
57
57
  className: o,
58
58
  ...t
59
59
  }) {
@@ -63,77 +63,59 @@ function g({
63
63
  "data-slot": "callout-content",
64
64
  className: m("mt-callout-content", o),
65
65
  ...t,
66
- children: /* @__PURE__ */ l("div", { "data-slot": "callout-content-body", className: "mt-callout-body", children: n })
66
+ children: /* @__PURE__ */ l("div", { "data-slot": "callout-content-body", className: "mt-callout-body", children: a })
67
67
  }
68
68
  );
69
69
  }
70
- function x({
71
- children: n,
70
+ function h({
71
+ children: a,
72
72
  variant: o,
73
73
  icon: t,
74
- color: c,
75
- className: a,
76
- style: u,
77
- ...s
74
+ color: n,
75
+ className: c,
76
+ style: i,
77
+ ...r
78
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,
79
+ const e = o ? y(o) : null, s = typeof t == "string" ? /* @__PURE__ */ l(u, { icon: t, className: "mt-callout-icon", size: 16 }) : t && typeof t == "object" && "icon" in t ? /* @__PURE__ */ l(u, { ...t, className: "mt-callout-icon", size: 16 }) : t !== void 0 ? t : e ? /* @__PURE__ */ l(
80
+ u,
81
81
  {
82
- icon: e.icon,
82
+ icon: e,
83
83
  className: "mt-callout-icon",
84
84
  size: 16,
85
- iconType: e.iconType
85
+ iconType: "regular"
86
86
  }
87
87
  ) : null;
88
- return /* @__PURE__ */ y(
88
+ return /* @__PURE__ */ b(
89
89
  d,
90
90
  {
91
91
  "data-slot": "callout-root",
92
92
  variant: o,
93
- color: c,
94
- className: a,
95
- style: u,
96
- ...s,
93
+ color: n,
94
+ className: c,
95
+ style: i,
96
+ ...r,
97
97
  children: [
98
- i && /* @__PURE__ */ l(p, { children: i }),
99
- /* @__PURE__ */ l(g, { children: n })
98
+ s && /* @__PURE__ */ l(f, { children: s }),
99
+ /* @__PURE__ */ l(p, { children: a })
100
100
  ]
101
101
  }
102
102
  );
103
103
  }
104
- function h(n) {
104
+ function y(a) {
105
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];
106
+ info: "circle-info",
107
+ warning: "triangle-exclamation",
108
+ success: "check",
109
+ danger: "hexagon-exclamation",
110
+ note: "circle-exclamation",
111
+ tip: "lightbulb"
112
+ }[a];
131
113
  }
132
- const j = Object.assign(x, {
114
+ const z = Object.assign(h, {
133
115
  Root: d,
134
- Icon: p,
135
- Content: g
116
+ Icon: f,
117
+ Content: p
136
118
  });
137
119
  export {
138
- j as Callout
120
+ z as Callout
139
121
  };
@@ -0,0 +1 @@
1
+ .mt-frame-container{display:block}.mt-frame-hint{display:flex;align-items:center;gap:.5rem;margin-bottom:1rem}.mt-frame-hint-icon{flex-shrink:0;width:1rem;height:1rem;fill:#9ca3af}.mt-frame-hint-text{font-size:.875rem;font-weight:500;line-height:1.25rem;color:#374151}.mt-frame{position:relative;padding:.5rem;border-radius:1rem;overflow:hidden;background-color:#f9fafb7f}.mt-frame-background{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' width='32' height='32' fill='none' stroke='rgb(229 229 229 / 0.2)'%3e%3cpath d='M0 .5H31.5V32'/%3e%3c/svg%3e");background-position:10px 10px;mask-image:linear-gradient(0deg,#fff,#fff9);-webkit-mask-image:linear-gradient(0deg,#fff,rgb(255 255 255 / 60%))}.mt-frame-content{position:relative;display:flex;justify-content:center;border-radius:.75rem;overflow:hidden;background-color:#fff}.mt-frame-caption{position:relative;display:flex;justify-content:center;margin-top:.75rem;padding:0 2rem .5rem;font-size:.875rem;line-height:1.25rem;color:#374151}.mt-frame-border{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;border:1px solid rgb(0 0 0 / 5%);border-radius:1rem}:is(.dark,.dark-theme) .mt-frame{background-color:#1f293740}:is(.dark,.dark-theme) .mt-frame-hint-icon{fill:#d1d5db}:is(.dark,.dark-theme) .mt-frame-hint-text{color:#e5e7eb}:is(.dark,.dark-theme) .mt-frame-background{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' width='32' height='32' fill='none' stroke='rgb(255 255 255 / 0.05)'%3e%3cpath d='M0 .5H31.5V32'/%3e%3c/svg%3e");mask-image:linear-gradient(0deg,#ffffff1a,#ffffff7f);-webkit-mask-image:linear-gradient(0deg,rgb(255 255 255 / 10%),rgb(255 255 255 / 50%))}:is(.dark,.dark-theme) .mt-frame-content{background-color:#111827}:is(.dark,.dark-theme) .mt-frame-caption{color:#9ca3af}:is(.dark,.dark-theme) .mt-frame-border{border-color:#ffffff0d}
@@ -0,0 +1,144 @@
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { useRender as b } from "@base-ui-components/react/use-render";
3
+ import { cn as n } from "../../utils/cn.js";
4
+ /* empty css */
5
+ import { Icon as c } from "../icon/icon.js";
6
+ function C({
7
+ children: r,
8
+ caption: a,
9
+ hint: t,
10
+ hintIcon: o,
11
+ className: m,
12
+ containerClassName: s,
13
+ style: v,
14
+ render: F = /* @__PURE__ */ e("div", {}),
15
+ ...g
16
+ }) {
17
+ return /* @__PURE__ */ i(f, { className: s, children: [
18
+ t && /* @__PURE__ */ e(h, { icon: o, children: t }),
19
+ /* @__PURE__ */ i(
20
+ d,
21
+ {
22
+ ...g,
23
+ className: m,
24
+ style: v,
25
+ render: F,
26
+ children: [
27
+ /* @__PURE__ */ e(l, {}),
28
+ /* @__PURE__ */ e(u, { children: r }),
29
+ a && /* @__PURE__ */ e(N, { children: /* @__PURE__ */ e("p", { children: a }) }),
30
+ /* @__PURE__ */ e(p, {})
31
+ ]
32
+ }
33
+ )
34
+ ] });
35
+ }
36
+ function f({ children: r, className: a, ...t }) {
37
+ return /* @__PURE__ */ e(
38
+ "div",
39
+ {
40
+ "data-slot": "frame-container",
41
+ className: n("mt-frame-container", a),
42
+ ...t,
43
+ children: r
44
+ }
45
+ );
46
+ }
47
+ function d({
48
+ children: r,
49
+ className: a,
50
+ style: t,
51
+ render: o = /* @__PURE__ */ e("div", {}),
52
+ ...m
53
+ }) {
54
+ const s = b({
55
+ defaultTagName: "div",
56
+ render: o,
57
+ props: {
58
+ ...m,
59
+ style: t,
60
+ className: n("mt-frame", a),
61
+ "data-slot": "frame"
62
+ }
63
+ });
64
+ return /* @__PURE__ */ e(s.type, { ...s.props, children: r });
65
+ }
66
+ function l({
67
+ className: r,
68
+ ...a
69
+ }) {
70
+ return /* @__PURE__ */ e(
71
+ "div",
72
+ {
73
+ "data-slot": "frame-background",
74
+ className: n("mt-frame-background", r),
75
+ ...a
76
+ }
77
+ );
78
+ }
79
+ function p({ className: r, ...a }) {
80
+ return /* @__PURE__ */ e(
81
+ "div",
82
+ {
83
+ "data-slot": "frame-border",
84
+ className: n("mt-frame-border", r),
85
+ ...a
86
+ }
87
+ );
88
+ }
89
+ function u({ children: r, className: a, ...t }) {
90
+ return /* @__PURE__ */ e(
91
+ "div",
92
+ {
93
+ "data-slot": "frame-content",
94
+ className: n("mt-frame-content", a),
95
+ ...t,
96
+ children: r
97
+ }
98
+ );
99
+ }
100
+ function N({ children: r, className: a, ...t }) {
101
+ return /* @__PURE__ */ e(
102
+ "div",
103
+ {
104
+ "data-slot": "frame-caption",
105
+ className: n("mt-frame-caption", a),
106
+ ...t,
107
+ children: r
108
+ }
109
+ );
110
+ }
111
+ function h({ children: r, className: a, icon: t, ...o }) {
112
+ const m = typeof t == "string" ? /* @__PURE__ */ e(c, { icon: t, className: "mt-frame-hint-icon", size: 16 }) : t && typeof t == "object" && "icon" in t ? /* @__PURE__ */ e(c, { ...t, className: "mt-frame-hint-icon", size: 16 }) : t || null;
113
+ return /* @__PURE__ */ i(
114
+ "div",
115
+ {
116
+ "data-slot": "frame-hint",
117
+ className: n("mt-frame-hint", a),
118
+ ...o,
119
+ children: [
120
+ m || null,
121
+ r && /* @__PURE__ */ e("p", { className: "mt-frame-hint-text", children: r })
122
+ ]
123
+ }
124
+ );
125
+ }
126
+ const R = Object.assign(C, {
127
+ Root: f,
128
+ Wrapper: d,
129
+ Background: l,
130
+ Border: p,
131
+ Content: u,
132
+ Caption: N,
133
+ Hint: h
134
+ });
135
+ export {
136
+ R as Frame,
137
+ l as FrameBackground,
138
+ p as FrameBorder,
139
+ N as FrameCaption,
140
+ u as FrameContent,
141
+ h as FrameHint,
142
+ f as FrameRoot,
143
+ d as FrameWrapper
144
+ };
@@ -0,0 +1 @@
1
+ .mt-icon{flex-shrink:0}
@@ -4,7 +4,8 @@ import { isAbsoluteUrl as c } from "../../utils/isAbsoluteUrl.js";
4
4
  import { MINTLIFY_ICONS_CDN_URL as o } from "../../constants/index.js";
5
5
  import { FONT_AWESOME_BRANDS as f } from "../../constants/font-awesome-brands.js";
6
6
  import { IS_DEV as $ } from "../../constants/env.js";
7
- function N({
7
+ /* empty css */
8
+ function R({
8
9
  icon: t,
9
10
  iconType: r,
10
11
  iconLibrary: s,
@@ -14,9 +15,9 @@ function N({
14
15
  style: i,
15
16
  ...l
16
17
  }) {
17
- if (r && !d.includes(r))
18
+ if (r && !p.includes(r))
18
19
  return $ && console.warn(
19
- `Invalid iconType ${r} expected a string equal to one of: ${d.join(
20
+ `Invalid iconType ${r} expected a string equal to one of: ${p.join(
20
21
  ", "
21
22
  )}`
22
23
  ), null;
@@ -60,7 +61,7 @@ function N({
60
61
  }
61
62
  );
62
63
  }
63
- const g = v(t.toLowerCase(), r, s), p = l;
64
+ const g = v(t.toLowerCase(), r, s), d = l;
64
65
  return /* @__PURE__ */ u(
65
66
  "svg",
66
67
  {
@@ -78,7 +79,7 @@ function N({
78
79
  height: e,
79
80
  ...i
80
81
  },
81
- ...p
82
+ ...d
82
83
  }
83
84
  );
84
85
  }
@@ -88,7 +89,7 @@ function b(t) {
88
89
  function v(t, r, s) {
89
90
  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
  }
91
- const R = ["fontawesome", "lucide"], d = [
92
+ const S = ["fontawesome", "lucide"], p = [
92
93
  "brands",
93
94
  "duotone",
94
95
  "light",
@@ -102,8 +103,8 @@ const R = ["fontawesome", "lucide"], d = [
102
103
  "thin"
103
104
  ];
104
105
  export {
105
- N as Icon,
106
+ R as Icon,
106
107
  v as getIconUrl,
107
- R as iconLibraries,
108
- d as iconTypes
108
+ S as iconLibraries,
109
+ p as iconTypes
109
110
  };
package/dist/index.d.ts CHANGED
@@ -433,6 +433,81 @@ declare const focus_2: {
433
433
  };
434
434
  export { focus_2 as focus }
435
435
 
436
+ export declare const Frame: typeof FrameComponent & {
437
+ Root: typeof FrameRoot;
438
+ Wrapper: typeof FrameWrapper;
439
+ Background: typeof FrameBackground;
440
+ Border: typeof FrameBorder;
441
+ Content: typeof FrameContent;
442
+ Caption: typeof FrameCaption;
443
+ Hint: typeof FrameHint;
444
+ };
445
+
446
+ export declare function FrameBackground({ className, ...props }: HTMLAttributes<HTMLDivElement>): JSX_2.Element;
447
+
448
+ export declare function FrameBorder({ className, ...props }: HTMLAttributes<HTMLDivElement>): JSX_2.Element;
449
+
450
+ export declare function FrameCaption({ children, className, ...props }: FrameCaptionProps): JSX_2.Element;
451
+
452
+ declare interface FrameCaptionProps extends HTMLAttributes<HTMLDivElement> {
453
+ children: ReactNode;
454
+ className?: string;
455
+ }
456
+
457
+ declare function FrameComponent({ children, caption, hint, hintIcon, className, containerClassName, style, render, ...props }: FrameProps): JSX_2.Element;
458
+
459
+ export declare function FrameContent({ children, className, ...props }: FrameContentProps): JSX_2.Element;
460
+
461
+ declare interface FrameContentProps extends HTMLAttributes<HTMLDivElement> {
462
+ children: ReactNode;
463
+ className?: string;
464
+ }
465
+
466
+ export declare function FrameHint({ children, className, icon, ...props }: FrameHintProps): JSX_2.Element;
467
+
468
+ declare interface FrameHintProps extends HTMLAttributes<HTMLDivElement> {
469
+ icon?: IconProp;
470
+ children: ReactNode;
471
+ className?: string;
472
+ }
473
+
474
+ declare interface FrameProps extends HTMLAttributes<HTMLElement> {
475
+ /**
476
+ * Frame caption, at the bottom of the frame.
477
+ */
478
+ caption?: string;
479
+ /**
480
+ * Frame hint text, at the top of the frame.
481
+ */
482
+ hint?: string;
483
+ /**
484
+ * Frame hint icon, at the top of the frame.
485
+ * @see {@link IconProp}
486
+ */
487
+ hintIcon?: IconProp;
488
+ className?: string;
489
+ containerClassName?: string;
490
+ style?: CSSProperties;
491
+ children: ReactNode;
492
+ render?: React.ReactElement;
493
+ }
494
+
495
+ export declare function FrameRoot({ children, className, ...props }: FrameRootProps): JSX_2.Element;
496
+
497
+ declare interface FrameRootProps extends HTMLAttributes<HTMLDivElement> {
498
+ className?: string;
499
+ children: ReactNode;
500
+ }
501
+
502
+ export declare function FrameWrapper({ children, className, style, render, ...props }: FrameWrapperProps): JSX_2.Element;
503
+
504
+ declare interface FrameWrapperProps extends HTMLAttributes<HTMLElement> {
505
+ className?: string;
506
+ style?: CSSProperties;
507
+ children: ReactNode;
508
+ render?: React.ReactElement;
509
+ }
510
+
436
511
  export declare function getIconUrl(icon: string, iconType?: IconType, iconLibrary?: IconLibrary): string;
437
512
 
438
513
  export declare function Icon({ icon, iconType, iconLibrary, color, size, className, style, ...props }: IconProps): JSX_2.Element | null;
package/dist/index.js CHANGED
@@ -1,17 +1,19 @@
1
1
  /* empty css */
2
2
  import { Badge as s } from "./components/badge/badge.js";
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";
3
+ import { Callout as m } from "./components/callout/callout.js";
4
+ import { Frame as c } from "./components/frame/frame.js";
5
+ import { Icon as i, getIconUrl as n, iconLibraries as a, iconTypes as x } from "./components/icon/icon.js";
6
+ import { colors as d, designTokens as g, focus as u, shadows as I } from "./styles/design-tokens.js";
6
7
  export {
7
8
  s as Badge,
8
- c as Callout,
9
- n as Icon,
10
- l as colors,
11
- x as designTokens,
12
- d as focus,
13
- p as getIconUrl,
14
- f as iconLibraries,
15
- m as iconTypes,
16
- g as shadows
9
+ m as Callout,
10
+ c as Frame,
11
+ i as Icon,
12
+ d as colors,
13
+ g as designTokens,
14
+ u as focus,
15
+ n as getIconUrl,
16
+ a as iconLibraries,
17
+ x as iconTypes,
18
+ I as shadows
17
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/components",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "description": "Mintlify Headless UI components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -61,6 +61,7 @@
61
61
  "react-dom": "^18.0.0 || ^19.0.0"
62
62
  },
63
63
  "dependencies": {
64
+ "@base-ui-components/react": "1.0.0-beta.6",
64
65
  "clsx": "^2.1.1",
65
66
  "color": "^5.0.3"
66
67
  },