@orion-ds/react 5.0.1 → 5.1.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.
Files changed (61) hide show
  1. package/dist/blocks/templates/index.cjs +1 -0
  2. package/dist/blocks/templates/index.mjs +18 -0
  3. package/dist/client.cjs +1 -1
  4. package/dist/client.mjs +143 -139
  5. package/dist/components/Calendar/Calendar.cjs +1 -1
  6. package/dist/components/Calendar/Calendar.d.ts.map +1 -1
  7. package/dist/components/Calendar/Calendar.mjs +105 -86
  8. package/dist/components/Chart/Chart.cjs +1 -1
  9. package/dist/components/Chart/Chart.d.ts +2 -3
  10. package/dist/components/Chart/Chart.d.ts.map +1 -1
  11. package/dist/components/Chart/Chart.mjs +124 -71
  12. package/dist/components/Chat/components/ChatMarkdown.cjs +1 -1
  13. package/dist/components/Chat/components/ChatMarkdown.d.ts.map +1 -1
  14. package/dist/components/Chat/components/ChatMarkdown.mjs +32 -17
  15. package/dist/components/CodeEditor/CodeEditor.cjs +6 -6
  16. package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
  17. package/dist/components/CodeEditor/CodeEditor.mjs +118 -99
  18. package/dist/components/CollapsibleFolder/CollapsibleFolder.cjs +1 -1
  19. package/dist/components/CollapsibleFolder/CollapsibleFolder.d.ts.map +1 -1
  20. package/dist/components/CollapsibleFolder/CollapsibleFolder.mjs +123 -105
  21. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  22. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  23. package/dist/components/DatePicker/DatePicker.mjs +70 -52
  24. package/dist/components/MissingDependencyError.cjs +1 -0
  25. package/dist/components/MissingDependencyError.d.ts +5 -0
  26. package/dist/components/MissingDependencyError.d.ts.map +1 -0
  27. package/dist/components/MissingDependencyError.mjs +140 -0
  28. package/dist/components/ThemeController/ThemeController.cjs +1 -1
  29. package/dist/components/ThemeController/ThemeController.d.ts.map +1 -1
  30. package/dist/components/ThemeController/ThemeController.mjs +14 -19
  31. package/dist/hooks/useTheme.cjs +1 -1
  32. package/dist/hooks/useTheme.d.ts +1 -1
  33. package/dist/hooks/useTheme.d.ts.map +1 -1
  34. package/dist/hooks/useTheme.mjs +1 -1
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.mjs +143 -139
  37. package/dist/sections/index.cjs +1 -0
  38. package/dist/sections/index.mjs +43 -0
  39. package/dist/tokens/brands.cjs +1 -1
  40. package/dist/tokens/brands.d.ts.map +1 -1
  41. package/dist/tokens/brands.mjs +0 -41
  42. package/dist/tokens/primitives.cjs +1 -1
  43. package/dist/tokens/primitives.d.ts.map +1 -1
  44. package/dist/tokens/primitives.mjs +22 -21
  45. package/dist/tokens/themes.cjs +1 -1
  46. package/dist/tokens/themes.d.ts.map +1 -1
  47. package/dist/tokens/themes.mjs +44 -0
  48. package/dist/tokens/types.d.ts +84 -106
  49. package/dist/tokens/types.d.ts.map +1 -1
  50. package/dist/tokens/utils.d.ts.map +1 -1
  51. package/dist/tokens/utils.mjs +1 -3
  52. package/dist/utils/fonts.cjs +1 -1
  53. package/dist/utils/fonts.d.ts.map +1 -1
  54. package/dist/utils/fonts.mjs +0 -1
  55. package/dist/utils/index.d.ts +1 -0
  56. package/dist/utils/index.d.ts.map +1 -1
  57. package/dist/utils/optionalDeps.cjs +1 -0
  58. package/dist/utils/optionalDeps.d.ts +63 -0
  59. package/dist/utils/optionalDeps.d.ts.map +1 -0
  60. package/dist/utils/optionalDeps.mjs +55 -0
  61. package/package.json +1 -1
@@ -1,135 +1,154 @@
1
- import { jsxs as M, jsx as c } from "react/jsx-runtime";
2
- import { useState as K, useMemo as N, useCallback as g, useId as Y } from "react";
3
- import { startOfMonth as S, endOfMonth as q, startOfWeek as G, endOfWeek as J, eachDayOfInterval as Q, isBefore as y, isAfter as k, isSameDay as i, format as b, isSameMonth as x, isToday as w, subMonths as U, addMonths as V } from "date-fns";
4
- import { ChevronLeft as X, ChevronRight as Z } from "lucide-react";
1
+ import { jsxs as O, jsx as i } from "react/jsx-runtime";
2
+ import { useState as V, useMemo as w, useCallback as M, useId as X } from "react";
3
+ import { ChevronLeft as Z, ChevronRight as $ } from "lucide-react";
4
+ import { MissingDependencyError as p } from "../MissingDependencyError.mjs";
5
5
  import o from "./Calendar.module.css.mjs";
6
6
  import { Button as I } from "../Button/Button.mjs";
7
- const $ = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
8
- function p(t, r) {
9
- const a = t.length, u = (r % a + a) % a;
10
- return [...t.slice(u), ...t.slice(0, u)];
7
+ let h, A, T, W, B, L, j, l, b, v, S, D, y, z = null;
8
+ try {
9
+ const e = require("date-fns");
10
+ h = e.startOfMonth, A = e.endOfMonth, T = e.startOfWeek, W = e.endOfWeek, B = e.eachDayOfInterval, L = e.addMonths, j = e.subMonths, l = e.isSameDay, b = e.isSameMonth, v = e.isToday, S = e.isBefore, D = e.isAfter, y = e.format;
11
+ } catch (e) {
12
+ z = e instanceof Error ? e : new Error("date-fns not found");
11
13
  }
12
- const ee = (t) => {
14
+ const ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
15
+ function te(e, r) {
16
+ const c = e.length, d = (r % c + c) % c;
17
+ return [...e.slice(d), ...e.slice(0, d)];
18
+ }
19
+ const ne = (e) => {
20
+ if (z)
21
+ return /* @__PURE__ */ i(
22
+ p,
23
+ {
24
+ available: !1,
25
+ componentName: "Calendar",
26
+ depName: "date-fns",
27
+ installCommand: "npm install date-fns",
28
+ pnpmCommand: "pnpm add date-fns",
29
+ docsUrl: "https://docs.orion-ds.dev/components/calendar"
30
+ }
31
+ );
13
32
  const {
14
33
  mode: r = "single",
15
- min: a,
16
- max: u,
17
- disabled: d,
18
- weekStartsOn: f = 0,
19
- showOutsideDays: A = !0,
20
- className: L,
21
- ...T
22
- } = t, {
23
- selected: re,
24
- onSelect: se,
25
- ...j
26
- } = T, [m, v] = K(() => r === "single" && t.mode !== "range" && t.mode !== "multiple" && t.selected ? S(t.selected) : r === "range" && t.mode === "range" && t.selected?.from ? S(t.selected.from) : S(/* @__PURE__ */ new Date())), z = N(() => {
27
- const e = S(m), n = q(m), s = G(e, { weekStartsOn: f }), l = J(n, { weekStartsOn: f });
28
- return Q({ start: s, end: l });
29
- }, [m, f]), B = N(
30
- () => p($, f),
31
- [f]
32
- ), h = g(
33
- (e) => a && y(e, te(a)) || u && k(e, ne(u)) ? !0 : d ? Array.isArray(d) ? d.some((n) => i(n, e)) : d(e) : !1,
34
- [a, u, d]
35
- ), O = g(
36
- (e) => r === "single" && t.mode !== "range" && t.mode !== "multiple" ? t.selected ? i(t.selected, e) : !1 : r === "multiple" && t.mode === "multiple" ? t.selected?.some((n) => i(n, e)) ?? !1 : !1,
37
- [r, t]
38
- ), C = g(
39
- (e) => {
40
- if (r !== "range" || t.mode !== "range" || !t.selected)
34
+ min: c,
35
+ max: d,
36
+ disabled: m,
37
+ weekStartsOn: u = 0,
38
+ showOutsideDays: _ = !0,
39
+ className: F,
40
+ ...P
41
+ } = e, {
42
+ selected: oe,
43
+ onSelect: le,
44
+ ...H
45
+ } = P, [f, E] = V(() => r === "single" && e.mode !== "range" && e.mode !== "multiple" && e.selected ? h(e.selected) : r === "range" && e.mode === "range" && e.selected?.from ? h(e.selected.from) : h(/* @__PURE__ */ new Date())), R = w(() => {
46
+ const t = h(f), n = A(f), s = T(t, { weekStartsOn: u }), a = W(n, { weekStartsOn: u });
47
+ return B({ start: s, end: a });
48
+ }, [f, u]), q = w(
49
+ () => te(ee, u),
50
+ [u]
51
+ ), g = M(
52
+ (t) => c && S(t, re(c)) || d && D(t, se(d)) ? !0 : m ? Array.isArray(m) ? m.some((n) => l(n, t)) : m(t) : !1,
53
+ [c, d, m]
54
+ ), C = M(
55
+ (t) => r === "single" && e.mode !== "range" && e.mode !== "multiple" ? e.selected ? l(e.selected, t) : !1 : r === "multiple" && e.mode === "multiple" ? e.selected?.some((n) => l(n, t)) ?? !1 : !1,
56
+ [r, e]
57
+ ), N = M(
58
+ (t) => {
59
+ if (r !== "range" || e.mode !== "range" || !e.selected)
41
60
  return null;
42
- const { from: n, to: s } = t.selected;
43
- return n ? s ? i(e, n) && i(e, s) || i(e, n) ? "start" : i(e, s) ? "end" : k(e, n) && y(e, s) ? "middle" : null : i(e, n) ? "start" : null : null;
61
+ const { from: n, to: s } = e.selected;
62
+ return n ? s ? l(t, n) && l(t, s) || l(t, n) ? "start" : l(t, s) ? "end" : D(t, n) && S(t, s) ? "middle" : null : l(t, n) ? "start" : null : null;
44
63
  },
45
- [r, t]
46
- ), W = g(
47
- (e) => {
48
- if (!h(e)) {
49
- if (r === "single" && t.mode !== "range" && t.mode !== "multiple") {
50
- const n = t.onSelect;
51
- n?.(e);
52
- } else if (r === "range" && t.mode === "range") {
53
- const n = t.onSelect, s = t.selected;
54
- !s?.from || s.from && s.to ? n?.({ from: e, to: void 0 }) : y(e, s.from) ? n?.({ from: e, to: s.from }) : n?.({ from: s.from, to: e });
55
- } else if (r === "multiple" && t.mode === "multiple") {
56
- const n = t.onSelect, s = t.selected ?? [], l = s.findIndex((E) => i(E, e));
57
- l >= 0 ? n?.(s.filter((E, F) => F !== l)) : n?.([...s, e]);
64
+ [r, e]
65
+ ), K = M(
66
+ (t) => {
67
+ if (!g(t)) {
68
+ if (r === "single" && e.mode !== "range" && e.mode !== "multiple") {
69
+ const n = e.onSelect;
70
+ n?.(t);
71
+ } else if (r === "range" && e.mode === "range") {
72
+ const n = e.onSelect, s = e.selected;
73
+ !s?.from || s.from && s.to ? n?.({ from: t, to: void 0 }) : S(t, s.from) ? n?.({ from: t, to: s.from }) : n?.({ from: s.from, to: t });
74
+ } else if (r === "multiple" && e.mode === "multiple") {
75
+ const n = e.onSelect, s = e.selected ?? [], a = s.findIndex((x) => l(x, t));
76
+ a >= 0 ? n?.(s.filter((x, Q) => Q !== a)) : n?.([...s, t]);
58
77
  }
59
78
  }
60
79
  },
61
- [r, t, h]
62
- ), _ = () => v((e) => U(e, 1)), P = () => v((e) => V(e, 1)), H = (e) => {
80
+ [r, e, g]
81
+ ), U = () => E((t) => j(t, 1)), Y = () => E((t) => L(t, 1)), G = (t) => {
63
82
  const n = [o.day];
64
- if (!x(e, m) && n.push(o.outside), w(e) && n.push(o.today), h(e) && n.push(o.disabled), r === "range") {
65
- const l = C(e);
66
- l === "start" && (n.push(o.rangeStart), t.mode === "range" && t.selected?.from && t.selected?.to && i(t.selected.from, t.selected.to) && n.push(o.rangeEnd)), l === "middle" && n.push(o.rangeMiddle), l === "end" && n.push(o.rangeEnd);
67
- } else O(e) && n.push(o.selected);
83
+ if (!b(t, f) && n.push(o.outside), v(t) && n.push(o.today), g(t) && n.push(o.disabled), r === "range") {
84
+ const a = N(t);
85
+ a === "start" && (n.push(o.rangeStart), e.mode === "range" && e.selected?.from && e.selected?.to && l(e.selected.from, e.selected.to) && n.push(o.rangeEnd)), a === "middle" && n.push(o.rangeMiddle), a === "end" && n.push(o.rangeEnd);
86
+ } else C(t) && n.push(o.selected);
68
87
  return n.join(" ");
69
- }, R = [o.calendar, L].filter(Boolean).join(" "), D = Y();
70
- return /* @__PURE__ */ M("div", { className: R, ...j, children: [
71
- /* @__PURE__ */ M("div", { className: o.header, children: [
72
- /* @__PURE__ */ c(
88
+ }, J = [o.calendar, F].filter(Boolean).join(" "), k = X();
89
+ return /* @__PURE__ */ O("div", { className: J, ...H, children: [
90
+ /* @__PURE__ */ O("div", { className: o.header, children: [
91
+ /* @__PURE__ */ i(
73
92
  I,
74
93
  {
75
94
  variant: "ghost",
76
95
  iconOnly: !0,
77
96
  size: "sm",
78
- icon: /* @__PURE__ */ c(X, { size: 16 }),
79
- onClick: _,
97
+ icon: /* @__PURE__ */ i(Z, { size: 16 }),
98
+ onClick: U,
80
99
  "aria-label": "Previous month"
81
100
  }
82
101
  ),
83
- /* @__PURE__ */ c("span", { id: D, className: o.monthLabel, children: b(m, "MMMM yyyy") }),
84
- /* @__PURE__ */ c(
102
+ /* @__PURE__ */ i("span", { id: k, className: o.monthLabel, children: y(f, "MMMM yyyy") }),
103
+ /* @__PURE__ */ i(
85
104
  I,
86
105
  {
87
106
  variant: "ghost",
88
107
  iconOnly: !0,
89
108
  size: "sm",
90
- icon: /* @__PURE__ */ c(Z, { size: 16 }),
91
- onClick: P,
109
+ icon: /* @__PURE__ */ i($, { size: 16 }),
110
+ onClick: Y,
92
111
  "aria-label": "Next month"
93
112
  }
94
113
  )
95
114
  ] }),
96
- /* @__PURE__ */ M("div", { className: o.grid, role: "grid", "aria-labelledby": D, children: [
97
- B.map((e) => /* @__PURE__ */ c(
115
+ /* @__PURE__ */ O("div", { className: o.grid, role: "grid", "aria-labelledby": k, children: [
116
+ q.map((t) => /* @__PURE__ */ i(
98
117
  "div",
99
118
  {
100
119
  className: o.weekday,
101
120
  role: "columnheader",
102
- "aria-label": e,
103
- children: e
121
+ "aria-label": t,
122
+ children: t
104
123
  },
105
- e
124
+ t
106
125
  )),
107
- z.map((e) => !x(e, m) && !A ? /* @__PURE__ */ c("div", {}, e.toISOString()) : /* @__PURE__ */ c(
126
+ R.map((t) => !b(t, f) && !_ ? /* @__PURE__ */ i("div", {}, t.toISOString()) : /* @__PURE__ */ i(
108
127
  "button",
109
128
  {
110
129
  type: "button",
111
- className: H(e),
112
- onClick: () => W(e),
113
- disabled: h(e),
114
- tabIndex: w(e) ? 0 : -1,
115
- "aria-label": b(e, "EEEE, MMMM d, yyyy"),
116
- "aria-selected": O(e) || C(e) !== null,
117
- children: b(e, "d")
130
+ className: G(t),
131
+ onClick: () => K(t),
132
+ disabled: g(t),
133
+ tabIndex: v(t) ? 0 : -1,
134
+ "aria-label": y(t, "EEEE, MMMM d, yyyy"),
135
+ "aria-selected": C(t) || N(t) !== null,
136
+ children: y(t, "d")
118
137
  },
119
- e.toISOString()
138
+ t.toISOString()
120
139
  ))
121
140
  ] })
122
141
  ] });
123
142
  };
124
- ee.displayName = "Calendar";
125
- function te(t) {
126
- const r = new Date(t);
143
+ ne.displayName = "Calendar";
144
+ function re(e) {
145
+ const r = new Date(e);
127
146
  return r.setHours(0, 0, 0, 0), r;
128
147
  }
129
- function ne(t) {
130
- const r = new Date(t);
148
+ function se(e) {
149
+ const r = new Date(e);
131
150
  return r.setHours(23, 59, 59, 999), r;
132
151
  }
133
152
  export {
134
- ee as Calendar
153
+ ne as Calendar
135
154
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("react"),p=require("recharts"),R=require("./useResolvedChartColors.cjs"),t=require("./Chart.module.css.cjs"),f=h.createContext({}),j=({config:s,children:o,className:a,style:n,...l})=>{const{resolvedConfig:r,resolvedColorVars:i}=R.useResolvedChartColors(s),d=[t.default.container,a].filter(Boolean).join(" ");return e.jsx(f.Provider,{value:r,children:e.jsx("div",{role:"figure",className:d,style:{...i,...n},...l,children:e.jsx(p.ResponsiveContainer,{width:"100%",height:"100%",children:o})})})};j.displayName="ChartContainer";const v=({active:s,payload:o,label:a,indicator:n="dot",hideLabel:l=!1,hideIndicator:r=!1,labelFormatter:i,formatter:d,className:u})=>{const L=h.useContext(f);if(!s||!o?.length)return null;const b=[t.default.tooltip,u].filter(Boolean).join(" "),g=i?i(String(a)):a,T={dot:t.default.tooltipDot,line:t.default.tooltipLine,dashed:t.default.tooltipDashed}[n];return e.jsxs("div",{className:b,children:[!l&&g&&e.jsx("div",{className:t.default.tooltipLabel,children:g}),e.jsx("div",{className:t.default.tooltipItems,children:o.map(c=>{const C=String(c.dataKey||c.name),m=L[C],q=m?.label||C,I=d?d(c.value,C):String(c.value),x=c.color||m?.color;return e.jsxs("div",{className:t.default.tooltipItem,children:[!r&&e.jsx("span",{className:T,style:{backgroundColor:x,borderColor:x}}),e.jsx("span",{className:t.default.tooltipName,children:q}),e.jsx("span",{className:t.default.tooltipValue,children:I})]},C)})})]})};v.displayName="ChartTooltipContent";const N=({payload:s,className:o})=>{const a=h.useContext(f);if(!s?.length)return null;const n=[t.default.legend,o].filter(Boolean).join(" ");return e.jsx("div",{className:n,children:s.map(l=>{const r=l.dataKey||l.value,i=a[r],d=i?.label||r,u=l.color||i?.color;return e.jsxs("div",{className:t.default.legendItem,children:[e.jsx("span",{className:t.default.legendDot,style:{backgroundColor:u}}),e.jsx("span",{children:d})]},r)})})};N.displayName="ChartLegendContent";const y=({id:s,color:o,startOpacity:a=.4,endOpacity:n=.05})=>e.jsxs("linearGradient",{id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:o,stopOpacity:a}),e.jsx("stop",{offset:"95%",stopColor:o,stopOpacity:n})]});y.displayName="ChartGradient";const S=p.Tooltip,G=p.Legend;exports.ChartContainer=j;exports.ChartGradient=y;exports.ChartLegend=G;exports.ChartLegendContent=N;exports.ChartTooltip=S;exports.ChartTooltipContent=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),S=require("./useResolvedChartColors.cjs"),h=require("../MissingDependencyError.cjs"),n=require("./Chart.module.css.cjs");let j,N,y,p=null;try{const t=require("recharts");j=t.ResponsiveContainer,N=t.Tooltip,y=t.Legend}catch(t){p=t instanceof Error?t:new Error("recharts not found")}const f=u.createContext({}),b=({config:t,children:o,className:s,style:a,...r})=>{if(p)return e.jsx(h.MissingDependencyError,{available:!1,componentName:"Chart",depName:"recharts",installCommand:"npm install recharts",pnpmCommand:"pnpm add recharts",docsUrl:"https://docs.orion-ds.dev/components/chart"});const{resolvedConfig:l,resolvedColorVars:i}=S.useResolvedChartColors(t),d=[n.default.container,s].filter(Boolean).join(" ");return e.jsx(f.Provider,{value:l,children:e.jsx("div",{role:"figure",className:d,style:{...i,...a},...r,children:e.jsx(j,{width:"100%",height:"100%",children:o})})})};b.displayName="ChartContainer";const L=({active:t,payload:o,label:s,indicator:a="dot",hideLabel:r=!1,hideIndicator:l=!1,labelFormatter:i,formatter:d,className:C})=>{if(p)return e.jsx(h.MissingDependencyError,{available:!1,componentName:"Chart",depName:"recharts",installCommand:"npm install recharts",pnpmCommand:"pnpm add recharts",docsUrl:"https://docs.orion-ds.dev/components/chart"});const T=u.useContext(f);if(!t||!o?.length)return null;const R=[n.default.tooltip,C].filter(Boolean).join(" "),g=i?i(String(s)):s,q={dot:n.default.tooltipDot,line:n.default.tooltipLine,dashed:n.default.tooltipDashed}[a];return e.jsxs("div",{className:R,children:[!r&&g&&e.jsx("div",{className:n.default.tooltipLabel,children:g}),e.jsx("div",{className:n.default.tooltipItems,children:o.map(c=>{const m=String(c.dataKey||c.name),x=T[m],M=x?.label||m,I=d?d(c.value,m):String(c.value),v=c.color||x?.color;return e.jsxs("div",{className:n.default.tooltipItem,children:[!l&&e.jsx("span",{className:q,style:{backgroundColor:v,borderColor:v}}),e.jsx("span",{className:n.default.tooltipName,children:M}),e.jsx("span",{className:n.default.tooltipValue,children:I})]},m)})})]})};L.displayName="ChartTooltipContent";const D=({payload:t,className:o})=>{if(p)return e.jsx(h.MissingDependencyError,{available:!1,componentName:"Chart",depName:"recharts",installCommand:"npm install recharts",pnpmCommand:"pnpm add recharts",docsUrl:"https://docs.orion-ds.dev/components/chart"});const s=u.useContext(f);if(!t?.length)return null;const a=[n.default.legend,o].filter(Boolean).join(" ");return e.jsx("div",{className:a,children:t.map(r=>{const l=r.dataKey||r.value,i=s[l],d=i?.label||l,C=r.color||i?.color;return e.jsxs("div",{className:n.default.legendItem,children:[e.jsx("span",{className:n.default.legendDot,style:{backgroundColor:C}}),e.jsx("span",{children:d})]},l)})})};D.displayName="ChartLegendContent";const E=({id:t,color:o,startOpacity:s=.4,endOpacity:a=.05})=>p?e.jsx(h.MissingDependencyError,{available:!1,componentName:"Chart",depName:"recharts",installCommand:"npm install recharts",pnpmCommand:"pnpm add recharts",docsUrl:"https://docs.orion-ds.dev/components/chart"}):e.jsxs("linearGradient",{id:t,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:o,stopOpacity:s}),e.jsx("stop",{offset:"95%",stopColor:o,stopOpacity:a})]});E.displayName="ChartGradient";const G=N||null,K=y||null;exports.ChartContainer=b;exports.ChartGradient=E;exports.ChartLegend=K;exports.ChartLegendContent=D;exports.ChartTooltip=G;exports.ChartTooltipContent=L;
@@ -1,5 +1,4 @@
1
1
  import { default as React } from 'react';
2
- import { Tooltip, Legend } from 'recharts';
3
2
  import { ChartContainerProps, ChartTooltipContentProps, ChartLegendContentProps, ChartGradientProps } from './Chart.types';
4
3
 
5
4
  /**
@@ -30,6 +29,6 @@ export declare const ChartLegendContent: React.FC<ChartLegendContentProps>;
30
29
  * ```
31
30
  */
32
31
  export declare const ChartGradient: React.FC<ChartGradientProps>;
33
- export declare const ChartTooltip: typeof Tooltip;
34
- export declare const ChartLegend: typeof Legend;
32
+ export declare const ChartTooltip: any;
33
+ export declare const ChartLegend: any;
35
34
  //# sourceMappingURL=Chart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/components/Chart/Chart.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAuB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAEV,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAOvB;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA4BxD,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAwDlE,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA8BhE,CAAC;AAIF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAUtD,CAAC;AAKF,eAAO,MAAM,YAAY,gBAAU,CAAC;AACpC,eAAO,MAAM,WAAW,eAAS,CAAC"}
1
+ {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/components/Chart/Chart.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAoC,MAAM,OAAO,CAAC;AAiBzD,OAAO,KAAK,EAEV,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAQvB;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA0CxD,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAsElE,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA4ChE,CAAC;AAIF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA0BtD,CAAC;AAMF,eAAO,MAAM,YAAY,KAAkB,CAAC;AAC5C,eAAO,MAAM,WAAW,KAAiB,CAAC"}
@@ -1,103 +1,156 @@
1
- import { jsx as t, jsxs as C } from "react/jsx-runtime";
2
- import { useContext as v, createContext as j } from "react";
3
- import { Legend as I, Tooltip as K, ResponsiveContainer as T } from "recharts";
4
- import { useResolvedChartColors as B } from "./useResolvedChartColors.mjs";
1
+ import { jsx as e, jsxs as h } from "react/jsx-runtime";
2
+ import { useContext as y, createContext as K } from "react";
3
+ import { useResolvedChartColors as R } from "./useResolvedChartColors.mjs";
4
+ import { MissingDependencyError as C } from "../MissingDependencyError.mjs";
5
5
  import o from "./Chart.module.css.mjs";
6
- const h = j({}), D = ({
7
- config: n,
8
- children: e,
9
- className: s,
10
- style: l,
11
- ...a
6
+ let b, L, x, p = null;
7
+ try {
8
+ const t = require("recharts");
9
+ b = t.ResponsiveContainer, L = t.Tooltip, x = t.Legend;
10
+ } catch (t) {
11
+ p = t instanceof Error ? t : new Error("recharts not found");
12
+ }
13
+ const u = K({}), U = ({
14
+ config: t,
15
+ children: n,
16
+ className: a,
17
+ style: r,
18
+ ...s
12
19
  }) => {
13
- const { resolvedConfig: i, resolvedColorVars: r } = B(n), c = [o.container, s].filter(Boolean).join(" ");
14
- return /* @__PURE__ */ t(h.Provider, { value: i, children: /* @__PURE__ */ t(
20
+ if (p)
21
+ return /* @__PURE__ */ e(
22
+ C,
23
+ {
24
+ available: !1,
25
+ componentName: "Chart",
26
+ depName: "recharts",
27
+ installCommand: "npm install recharts",
28
+ pnpmCommand: "pnpm add recharts",
29
+ docsUrl: "https://docs.orion-ds.dev/components/chart"
30
+ }
31
+ );
32
+ const { resolvedConfig: l, resolvedColorVars: i } = R(t), c = [o.container, a].filter(Boolean).join(" ");
33
+ return /* @__PURE__ */ e(u.Provider, { value: l, children: /* @__PURE__ */ e(
15
34
  "div",
16
35
  {
17
36
  role: "figure",
18
37
  className: c,
19
- style: { ...r, ...l },
20
- ...a,
21
- children: /* @__PURE__ */ t(T, { width: "100%", height: "100%", children: e })
38
+ style: { ...i, ...r },
39
+ ...s,
40
+ children: /* @__PURE__ */ e(b, { width: "100%", height: "100%", children: n })
22
41
  }
23
42
  ) });
24
43
  };
25
- D.displayName = "ChartContainer";
26
- const G = ({
27
- active: n,
28
- payload: e,
29
- label: s,
30
- indicator: l = "dot",
31
- hideLabel: a = !1,
32
- hideIndicator: i = !1,
33
- labelFormatter: r,
44
+ U.displayName = "ChartContainer";
45
+ const B = ({
46
+ active: t,
47
+ payload: n,
48
+ label: a,
49
+ indicator: r = "dot",
50
+ hideLabel: s = !1,
51
+ hideIndicator: l = !1,
52
+ labelFormatter: i,
34
53
  formatter: c,
35
- className: m
54
+ className: f
36
55
  }) => {
37
- const N = v(h);
38
- if (!n || !e?.length) return null;
39
- const y = [o.tooltip, m].filter(Boolean).join(" "), f = r ? r(String(s)) : s, L = {
56
+ if (p)
57
+ return /* @__PURE__ */ e(
58
+ C,
59
+ {
60
+ available: !1,
61
+ componentName: "Chart",
62
+ depName: "recharts",
63
+ installCommand: "npm install recharts",
64
+ pnpmCommand: "pnpm add recharts",
65
+ docsUrl: "https://docs.orion-ds.dev/components/chart"
66
+ }
67
+ );
68
+ const j = y(u);
69
+ if (!t || !n?.length) return null;
70
+ const I = [o.tooltip, f].filter(Boolean).join(" "), v = i ? i(String(a)) : a, T = {
40
71
  dot: o.tooltipDot,
41
72
  line: o.tooltipLine,
42
73
  dashed: o.tooltipDashed
43
- }[l];
44
- return /* @__PURE__ */ C("div", { className: y, children: [
45
- !a && f && /* @__PURE__ */ t("div", { className: o.tooltipLabel, children: f }),
46
- /* @__PURE__ */ t("div", { className: o.tooltipItems, children: e.map((d) => {
47
- const p = String(d.dataKey || d.name), g = N[p], x = g?.label || p, b = c ? c(d.value, p) : String(d.value), u = d.color || g?.color;
48
- return /* @__PURE__ */ C("div", { className: o.tooltipItem, children: [
49
- !i && /* @__PURE__ */ t(
74
+ }[r];
75
+ return /* @__PURE__ */ h("div", { className: I, children: [
76
+ !s && v && /* @__PURE__ */ e("div", { className: o.tooltipLabel, children: v }),
77
+ /* @__PURE__ */ e("div", { className: o.tooltipItems, children: n.map((d) => {
78
+ const m = String(d.dataKey || d.name), g = j[m], D = g?.label || m, E = c ? c(d.value, m) : String(d.value), N = d.color || g?.color;
79
+ return /* @__PURE__ */ h("div", { className: o.tooltipItem, children: [
80
+ !l && /* @__PURE__ */ e(
50
81
  "span",
51
82
  {
52
- className: L,
53
- style: { backgroundColor: u, borderColor: u }
83
+ className: T,
84
+ style: { backgroundColor: N, borderColor: N }
54
85
  }
55
86
  ),
56
- /* @__PURE__ */ t("span", { className: o.tooltipName, children: x }),
57
- /* @__PURE__ */ t("span", { className: o.tooltipValue, children: b })
58
- ] }, p);
87
+ /* @__PURE__ */ e("span", { className: o.tooltipName, children: D }),
88
+ /* @__PURE__ */ e("span", { className: o.tooltipValue, children: E })
89
+ ] }, m);
59
90
  }) })
60
91
  ] });
61
92
  };
62
- G.displayName = "ChartTooltipContent";
63
- const S = ({
64
- payload: n,
65
- className: e
93
+ B.displayName = "ChartTooltipContent";
94
+ const G = ({
95
+ payload: t,
96
+ className: n
66
97
  }) => {
67
- const s = v(h);
68
- if (!n?.length) return null;
69
- const l = [o.legend, e].filter(Boolean).join(" ");
70
- return /* @__PURE__ */ t("div", { className: l, children: n.map((a) => {
71
- const i = a.dataKey || a.value, r = s[i], c = r?.label || i, m = a.color || r?.color;
72
- return /* @__PURE__ */ C("div", { className: o.legendItem, children: [
73
- /* @__PURE__ */ t(
98
+ if (p)
99
+ return /* @__PURE__ */ e(
100
+ C,
101
+ {
102
+ available: !1,
103
+ componentName: "Chart",
104
+ depName: "recharts",
105
+ installCommand: "npm install recharts",
106
+ pnpmCommand: "pnpm add recharts",
107
+ docsUrl: "https://docs.orion-ds.dev/components/chart"
108
+ }
109
+ );
110
+ const a = y(u);
111
+ if (!t?.length) return null;
112
+ const r = [o.legend, n].filter(Boolean).join(" ");
113
+ return /* @__PURE__ */ e("div", { className: r, children: t.map((s) => {
114
+ const l = s.dataKey || s.value, i = a[l], c = i?.label || l, f = s.color || i?.color;
115
+ return /* @__PURE__ */ h("div", { className: o.legendItem, children: [
116
+ /* @__PURE__ */ e(
74
117
  "span",
75
118
  {
76
119
  className: o.legendDot,
77
- style: { backgroundColor: m }
120
+ style: { backgroundColor: f }
78
121
  }
79
122
  ),
80
- /* @__PURE__ */ t("span", { children: c })
81
- ] }, i);
123
+ /* @__PURE__ */ e("span", { children: c })
124
+ ] }, l);
82
125
  }) });
83
126
  };
84
- S.displayName = "ChartLegendContent";
85
- const V = ({
86
- id: n,
87
- color: e,
88
- startOpacity: s = 0.4,
89
- endOpacity: l = 0.05
90
- }) => /* @__PURE__ */ C("linearGradient", { id: n, x1: "0", y1: "0", x2: "0", y2: "1", children: [
91
- /* @__PURE__ */ t("stop", { offset: "5%", stopColor: e, stopOpacity: s }),
92
- /* @__PURE__ */ t("stop", { offset: "95%", stopColor: e, stopOpacity: l })
127
+ G.displayName = "ChartLegendContent";
128
+ const S = ({
129
+ id: t,
130
+ color: n,
131
+ startOpacity: a = 0.4,
132
+ endOpacity: r = 0.05
133
+ }) => p ? /* @__PURE__ */ e(
134
+ C,
135
+ {
136
+ available: !1,
137
+ componentName: "Chart",
138
+ depName: "recharts",
139
+ installCommand: "npm install recharts",
140
+ pnpmCommand: "pnpm add recharts",
141
+ docsUrl: "https://docs.orion-ds.dev/components/chart"
142
+ }
143
+ ) : /* @__PURE__ */ h("linearGradient", { id: t, x1: "0", y1: "0", x2: "0", y2: "1", children: [
144
+ /* @__PURE__ */ e("stop", { offset: "5%", stopColor: n, stopOpacity: a }),
145
+ /* @__PURE__ */ e("stop", { offset: "95%", stopColor: n, stopOpacity: r })
93
146
  ] });
94
- V.displayName = "ChartGradient";
95
- const q = K, z = I;
147
+ S.displayName = "ChartGradient";
148
+ const M = L || null, P = x || null;
96
149
  export {
97
- D as ChartContainer,
98
- V as ChartGradient,
99
- z as ChartLegend,
100
- S as ChartLegendContent,
101
- q as ChartTooltip,
102
- G as ChartTooltipContent
150
+ U as ChartContainer,
151
+ S as ChartGradient,
152
+ P as ChartLegend,
153
+ G as ChartLegendContent,
154
+ M as ChartTooltip,
155
+ B as ChartTooltipContent
103
156
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("react-markdown"),u=require("remark-gfm"),m=require("./ChatCodeBlock.cjs"),g=require("../Chat.module.css.cjs"),o=({content:s,className:c,...i})=>r.jsx("div",{className:[g.default.markdown,c].filter(Boolean).join(" "),...i,children:r.jsx(d,{remarkPlugins:[u],components:{code({className:e,children:t,...a}){const n=/language-(\w+)/.exec(e||"");if(!n)return r.jsx("code",{className:e,...a,children:t});const l=String(t).replace(/\n$/,"");return r.jsx(m.ChatCodeBlock,{code:l,language:n[1]})},pre({children:e}){return r.jsx(r.Fragment,{children:e})},a({href:e,children:t,...a}){const n=e?.startsWith("http");return r.jsx("a",{href:e,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0,...a,children:t})}},children:s})});o.displayName="ChatMarkdown";exports.ChatMarkdown=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),k=require("./ChatCodeBlock.cjs"),p=require("../../MissingDependencyError.cjs"),g=require("../Chat.module.css.cjs");let s,c,i=null;try{s=require("react-markdown"),c=require("remark-gfm")}catch(a){i=a instanceof Error?a:new Error("react-markdown or remark-gfm not found")}const d=({content:a,className:m,...l})=>i?r.jsx(p.MissingDependencyError,{available:!1,componentName:"Chat",depName:["react-markdown","remark-gfm"],installCommand:"npm install react-markdown remark-gfm",pnpmCommand:"pnpm add react-markdown remark-gfm",docsUrl:"https://docs.orion-ds.dev/components/chat"}):r.jsx("div",{className:[g.default.markdown,m].filter(Boolean).join(" "),...l,children:r.jsx(s,{remarkPlugins:[c],components:{code({className:e,children:t,...o}){const n=/language-(\w+)/.exec(e||"");if(!n)return r.jsx("code",{className:e,...o,children:t});const u=String(t).replace(/\n$/,"");return r.jsx(k.ChatCodeBlock,{code:u,language:n[1]})},pre({children:e}){return r.jsx(r.Fragment,{children:e})},a({href:e,children:t,...o}){const n=e?.startsWith("http");return r.jsx("a",{href:e,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0,...o,children:t})}},children:a})});d.displayName="ChatMarkdown";exports.ChatMarkdown=d;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMarkdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat/components/ChatMarkdown.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIvD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAyDpD,CAAC"}
1
+ {"version":3,"file":"ChatMarkdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat/components/ChatMarkdown.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAoBvD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuEpD,CAAC"}
@@ -1,33 +1,48 @@
1
- import { jsx as e, Fragment as c } from "react/jsx-runtime";
2
- import l from "react-markdown";
3
- import d from "remark-gfm";
4
- import { ChatCodeBlock as p } from "./ChatCodeBlock.mjs";
1
+ import { jsx as e, Fragment as p } from "react/jsx-runtime";
2
+ import { ChatCodeBlock as k } from "./ChatCodeBlock.mjs";
3
+ import { MissingDependencyError as f } from "../../MissingDependencyError.mjs";
5
4
  import g from "../Chat.module.css.mjs";
6
- const f = ({
5
+ let m, c, i = null;
6
+ try {
7
+ m = require("react-markdown"), c = require("remark-gfm");
8
+ } catch (a) {
9
+ i = a instanceof Error ? a : new Error("react-markdown or remark-gfm not found");
10
+ }
11
+ const u = ({
7
12
  content: a,
8
- className: i,
9
- ...m
10
- }) => /* @__PURE__ */ e(
13
+ className: s,
14
+ ...l
15
+ }) => i ? /* @__PURE__ */ e(
16
+ f,
17
+ {
18
+ available: !1,
19
+ componentName: "Chat",
20
+ depName: ["react-markdown", "remark-gfm"],
21
+ installCommand: "npm install react-markdown remark-gfm",
22
+ pnpmCommand: "pnpm add react-markdown remark-gfm",
23
+ docsUrl: "https://docs.orion-ds.dev/components/chat"
24
+ }
25
+ ) : /* @__PURE__ */ e(
11
26
  "div",
12
27
  {
13
- className: [g.markdown, i].filter(Boolean).join(" "),
14
- ...m,
28
+ className: [g.markdown, s].filter(Boolean).join(" "),
29
+ ...l,
15
30
  children: /* @__PURE__ */ e(
16
- l,
31
+ m,
17
32
  {
18
- remarkPlugins: [d],
33
+ remarkPlugins: [c],
19
34
  components: {
20
35
  // Custom code block rendering
21
36
  code({ className: r, children: o, ...t }) {
22
37
  const n = /language-(\w+)/.exec(r || "");
23
38
  if (!n)
24
39
  return /* @__PURE__ */ e("code", { className: r, ...t, children: o });
25
- const s = String(o).replace(/\n$/, "");
26
- return /* @__PURE__ */ e(p, { code: s, language: n[1] });
40
+ const d = String(o).replace(/\n$/, "");
41
+ return /* @__PURE__ */ e(k, { code: d, language: n[1] });
27
42
  },
28
43
  // Custom pre rendering (remove wrapper for code blocks)
29
44
  pre({ children: r }) {
30
- return /* @__PURE__ */ e(c, { children: r });
45
+ return /* @__PURE__ */ e(p, { children: r });
31
46
  },
32
47
  // Custom link rendering (open in new tab)
33
48
  a({ href: r, children: o, ...t }) {
@@ -49,7 +64,7 @@ const f = ({
49
64
  )
50
65
  }
51
66
  );
52
- f.displayName = "ChatMarkdown";
67
+ u.displayName = "ChatMarkdown";
53
68
  export {
54
- f as ChatMarkdown
69
+ u as ChatMarkdown
55
70
  };