@orion-ds/react 5.0.1 → 5.1.0
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/client.cjs +1 -1
- package/dist/client.mjs +143 -139
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.mjs +105 -86
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.d.ts +2 -3
- package/dist/components/Chart/Chart.d.ts.map +1 -1
- package/dist/components/Chart/Chart.mjs +124 -71
- package/dist/components/Chat/components/ChatMarkdown.cjs +1 -1
- package/dist/components/Chat/components/ChatMarkdown.d.ts.map +1 -1
- package/dist/components/Chat/components/ChatMarkdown.mjs +32 -17
- package/dist/components/CodeEditor/CodeEditor.cjs +6 -6
- package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/components/CodeEditor/CodeEditor.mjs +118 -99
- package/dist/components/CollapsibleFolder/CollapsibleFolder.cjs +1 -1
- package/dist/components/CollapsibleFolder/CollapsibleFolder.d.ts.map +1 -1
- package/dist/components/CollapsibleFolder/CollapsibleFolder.mjs +123 -105
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.mjs +70 -52
- package/dist/components/MissingDependencyError.cjs +1 -0
- package/dist/components/MissingDependencyError.d.ts +5 -0
- package/dist/components/MissingDependencyError.d.ts.map +1 -0
- package/dist/components/MissingDependencyError.mjs +140 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +143 -139
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/optionalDeps.cjs +1 -0
- package/dist/utils/optionalDeps.d.ts +63 -0
- package/dist/utils/optionalDeps.d.ts.map +1 -0
- package/dist/utils/optionalDeps.mjs +55 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`).length,m);i.useEffect(()=>{if(
|
|
3
|
-
`),f=Math.max(a.length,m),b=[];for(let
|
|
4
|
-
`).length-1)},
|
|
5
|
-
`,
|
|
6
|
-
`})}),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),i=require("react"),W=require("../MissingDependencyError.cjs"),l=require("./CodeEditor.module.css.cjs"),I=require("../../contexts/ThemeContext.cjs");let D,$,A,B=null;try{D=require("react-syntax-highlighter").Prism;const d=require("react-syntax-highlighter/dist/esm/styles/prism");$=d.oneDark,A=d.oneLight}catch(r){B=r instanceof Error?r:new Error("react-syntax-highlighter not found")}try{const r=require("refractor/all");r.default&&r.default.registered&&r.default.registered("markdown")&&!r.default.languages.markdown?.["quoted-string"]&&r.default.languages.insertBefore("markdown","bold",{"quoted-string":{pattern:/"(?:\\.|[^"\\])*"/,greedy:!0,alias:"string"}})}catch{}const K=i.forwardRef(({value:r="",onChange:d,language:j,readOnly:C=!1,showLineNumbers:k=!0,placeholder:E,minRows:m=10,className:F,"aria-label":S,...T},O)=>{if(B)return n.jsx(W.MissingDependencyError,{available:!1,componentName:"CodeEditor",depName:"react-syntax-highlighter",installCommand:"npm install react-syntax-highlighter",pnpmCommand:"pnpm add react-syntax-highlighter",docsUrl:"https://docs.orion-ds.dev/components/code-editor"});const p=i.useRef(null),x=i.useRef(null),v=i.useRef(null),R=i.useRef(null),P=i.useRef(null),h=i.useRef(null),g=O||P,[y,U]=i.useState(0),[u,V]=i.useState([]);let q="dark";try{q=I.useThemeContext().theme}catch{}const _=q==="light"?A:$,L=Math.max(r.split(`
|
|
2
|
+
`).length,m);i.useEffect(()=>{if(h.current&&g.current){const{start:e,end:t}=h.current;g.current.setSelectionRange(e,t),h.current=null}}),i.useEffect(()=>{const e=v.current,t=R.current;if(!e||!t)return;const s=()=>{const c=t.clientWidth;if(c<=0)return;e.style.width=`${c}px`;const a=r.split(`
|
|
3
|
+
`),f=Math.max(a.length,m),b=[];for(let w=0;w<f;w++){const z=a[w]??"";e.textContent=z||" ",b.push(e.scrollHeight)}V(b)};s();const o=new ResizeObserver(s);return o.observe(t),()=>o.disconnect()},[r,m]),i.useEffect(()=>{const e=s=>{const o=s.target;p.current&&(p.current.scrollTop=o.scrollTop),x.current&&(x.current.scrollTop=o.scrollTop,x.current.scrollLeft=o.scrollLeft)},t=g?.current;if(t)return t.addEventListener("scroll",e),()=>{t.removeEventListener("scroll",e)}},[g]);const N=e=>{const t=e.value.substring(0,e.selectionStart);U(t.split(`
|
|
4
|
+
`).length-1)},M=e=>{if(e.key==="Tab"){e.preventDefault();const t=e.currentTarget,s=t.selectionStart,o=t.selectionEnd,c=" ";if(s===o){const a=r.substring(0,s)+c+r.substring(o);h.current={start:s+c.length,end:s+c.length},d?.(a)}else if(e.shiftKey){const a=r.lastIndexOf(`
|
|
5
|
+
`,s-1)+1,f=r.substring(a).match(/^ {1,2}/)?.[0]??"";if(f.length>0){const b=r.substring(0,a)+r.substring(a+f.length);h.current={start:Math.max(a,s-f.length),end:Math.max(a,o-f.length)},d?.(b)}}else{const a=r.substring(0,s)+c+r.substring(o);h.current={start:s+c.length,end:s+c.length},d?.(a)}}},H=[l.default.wrapper,F].filter(Boolean).join(" ");return j?n.jsxs("div",{className:H,style:{minHeight:`calc(${m} * 1.6em + 2 * var(--spacing-4))`},children:[n.jsx("div",{ref:v,className:l.default.lineMirror,"aria-hidden":"true"}),k&&n.jsx("div",{ref:p,className:l.default.lineNumbers,"aria-hidden":"true",children:Array.from({length:L}).map((e,t)=>n.jsx("div",{className:l.default.lineNumber,style:u[t]!==void 0?{height:`${u[t]}px`}:void 0,children:t+1},t))}),n.jsxs("div",{ref:R,className:l.default.editorArea,children:[n.jsx("div",{className:l.default.lineHighlight,style:{top:u.length>0?`calc(var(--spacing-4) + ${u.slice(0,y).reduce((e,t)=>e+t,0)}px)`:`calc(var(--spacing-4) + ${(y*1.6).toFixed(2)}em)`,...u[y]!==void 0?{height:`${u[y]}px`}:{}},"aria-hidden":"true"}),n.jsx("div",{ref:x,className:l.default.highlightLayer,"aria-hidden":"true",children:n.jsx(D,{language:j,style:_,customStyle:{margin:0,padding:0,background:"transparent",fontSize:"inherit",lineHeight:"inherit",fontFamily:"inherit",whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"visible"},codeTagProps:{style:{fontFamily:"inherit",background:"transparent",color:"var(--text-primary)",whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:r+`
|
|
6
|
+
`})}),n.jsx("textarea",{ref:g,className:l.default.textareaOverlay,value:r,onChange:e=>d?.(e.target.value),onKeyDown:M,onKeyUp:e=>N(e.currentTarget),onMouseUp:e=>N(e.currentTarget),onClick:e=>N(e.currentTarget),placeholder:E,readOnly:C,"aria-label":S||"Code editor",spellCheck:"false",...T})]})]}):n.jsxs("div",{className:H,style:{minHeight:`calc(${m} * 1.6em + 2 * var(--spacing-4))`},children:[n.jsx("div",{ref:v,className:l.default.lineMirror,"aria-hidden":"true"}),k&&n.jsx("div",{ref:p,className:l.default.lineNumbers,"aria-hidden":"true",children:Array.from({length:L}).map((e,t)=>n.jsx("div",{className:l.default.lineNumber,style:u[t]!==void 0?{height:`${u[t]}px`}:void 0,children:t+1},t))}),n.jsx("textarea",{ref:g,className:l.default.textarea,value:r,onChange:e=>d?.(e.target.value),onKeyDown:M,placeholder:E,readOnly:C,"aria-label":S||"Code editor",spellCheck:"false",...T})]})});K.displayName="CodeEditor";exports.CodeEditor=K;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../src/components/CodeEditor/CodeEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../src/components/CodeEditor/CodeEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA4C1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,6FA8UtB,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { jsxs as k, jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { jsxs as k, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as G, useRef as m, useState as B, useEffect as C } from "react";
|
|
3
|
+
import { MissingDependencyError as J } from "../MissingDependencyError.mjs";
|
|
4
|
+
import a from "./CodeEditor.module.css.mjs";
|
|
5
|
+
import { useThemeContext as Q } from "../../contexts/ThemeContext.mjs";
|
|
6
|
+
let K, j, F, U = null;
|
|
7
|
+
try {
|
|
8
|
+
K = require("react-syntax-highlighter").Prism;
|
|
9
|
+
const c = require("react-syntax-highlighter/dist/esm/styles/prism");
|
|
10
|
+
j = c.oneDark, F = c.oneLight;
|
|
11
|
+
} catch (r) {
|
|
12
|
+
U = r instanceof Error ? r : new Error("react-syntax-highlighter not found");
|
|
13
|
+
}
|
|
7
14
|
try {
|
|
8
15
|
const r = require("refractor/all");
|
|
9
16
|
r.default && r.default.registered && r.default.registered("markdown") && !r.default.languages.markdown?.["quoted-string"] && r.default.languages.insertBefore("markdown", "bold", {
|
|
@@ -15,149 +22,161 @@ try {
|
|
|
15
22
|
});
|
|
16
23
|
} catch {
|
|
17
24
|
}
|
|
18
|
-
const
|
|
25
|
+
const X = G(
|
|
19
26
|
({
|
|
20
27
|
value: r = "",
|
|
21
|
-
onChange:
|
|
22
|
-
language:
|
|
28
|
+
onChange: c,
|
|
29
|
+
language: T,
|
|
23
30
|
readOnly: S = !1,
|
|
24
|
-
showLineNumbers:
|
|
25
|
-
placeholder:
|
|
26
|
-
minRows:
|
|
27
|
-
className:
|
|
31
|
+
showLineNumbers: E = !0,
|
|
32
|
+
placeholder: L,
|
|
33
|
+
minRows: f = 10,
|
|
34
|
+
className: V,
|
|
28
35
|
"aria-label": H,
|
|
29
36
|
...M
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
}, z) => {
|
|
38
|
+
if (U)
|
|
39
|
+
return /* @__PURE__ */ i(
|
|
40
|
+
J,
|
|
41
|
+
{
|
|
42
|
+
available: !1,
|
|
43
|
+
componentName: "CodeEditor",
|
|
44
|
+
depName: "react-syntax-highlighter",
|
|
45
|
+
installCommand: "npm install react-syntax-highlighter",
|
|
46
|
+
pnpmCommand: "pnpm add react-syntax-highlighter",
|
|
47
|
+
docsUrl: "https://docs.orion-ds.dev/components/code-editor"
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
const p = m(null), y = m(null), v = m(null), $ = m(null), O = m(null), h = m(null), g = z || O, [x, P] = B(0), [d, W] = B([]);
|
|
51
|
+
let D = "dark";
|
|
33
52
|
try {
|
|
34
|
-
|
|
53
|
+
D = Q().theme;
|
|
35
54
|
} catch {
|
|
36
55
|
}
|
|
37
|
-
const
|
|
38
|
-
`).length,
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
const { start: e, end: t } =
|
|
42
|
-
|
|
56
|
+
const _ = D === "light" ? F : j, R = Math.max(r.split(`
|
|
57
|
+
`).length, f);
|
|
58
|
+
C(() => {
|
|
59
|
+
if (h.current && g.current) {
|
|
60
|
+
const { start: e, end: t } = h.current;
|
|
61
|
+
g.current.setSelectionRange(e, t), h.current = null;
|
|
43
62
|
}
|
|
44
|
-
}),
|
|
45
|
-
const e = v.current, t =
|
|
63
|
+
}), C(() => {
|
|
64
|
+
const e = v.current, t = $.current;
|
|
46
65
|
if (!e || !t) return;
|
|
47
66
|
const n = () => {
|
|
48
67
|
const o = t.clientWidth;
|
|
49
68
|
if (o <= 0) return;
|
|
50
69
|
e.style.width = `${o}px`;
|
|
51
70
|
const s = r.split(`
|
|
52
|
-
`), u = Math.max(s.length,
|
|
53
|
-
for (let
|
|
54
|
-
const
|
|
55
|
-
e.textContent =
|
|
71
|
+
`), u = Math.max(s.length, f), b = [];
|
|
72
|
+
for (let w = 0; w < u; w++) {
|
|
73
|
+
const I = s[w] ?? "";
|
|
74
|
+
e.textContent = I || " ", b.push(e.scrollHeight);
|
|
56
75
|
}
|
|
57
|
-
|
|
76
|
+
W(b);
|
|
58
77
|
};
|
|
59
78
|
n();
|
|
60
|
-
const
|
|
61
|
-
return
|
|
62
|
-
}, [r,
|
|
79
|
+
const l = new ResizeObserver(n);
|
|
80
|
+
return l.observe(t), () => l.disconnect();
|
|
81
|
+
}, [r, f]), C(() => {
|
|
63
82
|
const e = (n) => {
|
|
64
|
-
const
|
|
65
|
-
p.current && (p.current.scrollTop =
|
|
66
|
-
}, t =
|
|
83
|
+
const l = n.target;
|
|
84
|
+
p.current && (p.current.scrollTop = l.scrollTop), y.current && (y.current.scrollTop = l.scrollTop, y.current.scrollLeft = l.scrollLeft);
|
|
85
|
+
}, t = g?.current;
|
|
67
86
|
if (t)
|
|
68
87
|
return t.addEventListener("scroll", e), () => {
|
|
69
88
|
t.removeEventListener("scroll", e);
|
|
70
89
|
};
|
|
71
|
-
}, [
|
|
72
|
-
const
|
|
90
|
+
}, [g]);
|
|
91
|
+
const N = (e) => {
|
|
73
92
|
const t = e.value.substring(0, e.selectionStart);
|
|
74
|
-
|
|
93
|
+
P(t.split(`
|
|
75
94
|
`).length - 1);
|
|
76
|
-
},
|
|
95
|
+
}, A = (e) => {
|
|
77
96
|
if (e.key === "Tab") {
|
|
78
97
|
e.preventDefault();
|
|
79
|
-
const t = e.currentTarget, n = t.selectionStart,
|
|
80
|
-
if (n ===
|
|
81
|
-
const s = r.substring(0, n) + o + r.substring(
|
|
82
|
-
|
|
98
|
+
const t = e.currentTarget, n = t.selectionStart, l = t.selectionEnd, o = " ";
|
|
99
|
+
if (n === l) {
|
|
100
|
+
const s = r.substring(0, n) + o + r.substring(l);
|
|
101
|
+
h.current = {
|
|
83
102
|
start: n + o.length,
|
|
84
103
|
end: n + o.length
|
|
85
|
-
},
|
|
104
|
+
}, c?.(s);
|
|
86
105
|
} else if (e.shiftKey) {
|
|
87
106
|
const s = r.lastIndexOf(`
|
|
88
107
|
`, n - 1) + 1, u = r.substring(s).match(/^ {1,2}/)?.[0] ?? "";
|
|
89
108
|
if (u.length > 0) {
|
|
90
109
|
const b = r.substring(0, s) + r.substring(s + u.length);
|
|
91
|
-
|
|
110
|
+
h.current = {
|
|
92
111
|
start: Math.max(s, n - u.length),
|
|
93
|
-
end: Math.max(s,
|
|
94
|
-
},
|
|
112
|
+
end: Math.max(s, l - u.length)
|
|
113
|
+
}, c?.(b);
|
|
95
114
|
}
|
|
96
115
|
} else {
|
|
97
|
-
const s = r.substring(0, n) + o + r.substring(
|
|
98
|
-
|
|
116
|
+
const s = r.substring(0, n) + o + r.substring(l);
|
|
117
|
+
h.current = {
|
|
99
118
|
start: n + o.length,
|
|
100
119
|
end: n + o.length
|
|
101
|
-
},
|
|
120
|
+
}, c?.(s);
|
|
102
121
|
}
|
|
103
122
|
}
|
|
104
|
-
},
|
|
105
|
-
return
|
|
123
|
+
}, q = [a.wrapper, V].filter(Boolean).join(" ");
|
|
124
|
+
return T ? /* @__PURE__ */ k(
|
|
106
125
|
"div",
|
|
107
126
|
{
|
|
108
|
-
className:
|
|
127
|
+
className: q,
|
|
109
128
|
style: {
|
|
110
|
-
minHeight: `calc(${
|
|
129
|
+
minHeight: `calc(${f} * 1.6em + 2 * var(--spacing-4))`
|
|
111
130
|
},
|
|
112
131
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ i(
|
|
114
133
|
"div",
|
|
115
134
|
{
|
|
116
135
|
ref: v,
|
|
117
|
-
className:
|
|
136
|
+
className: a.lineMirror,
|
|
118
137
|
"aria-hidden": "true"
|
|
119
138
|
}
|
|
120
139
|
),
|
|
121
|
-
|
|
140
|
+
E && /* @__PURE__ */ i(
|
|
122
141
|
"div",
|
|
123
142
|
{
|
|
124
143
|
ref: p,
|
|
125
|
-
className:
|
|
144
|
+
className: a.lineNumbers,
|
|
126
145
|
"aria-hidden": "true",
|
|
127
|
-
children: Array.from({ length: R }).map((e, t) => /* @__PURE__ */
|
|
146
|
+
children: Array.from({ length: R }).map((e, t) => /* @__PURE__ */ i(
|
|
128
147
|
"div",
|
|
129
148
|
{
|
|
130
|
-
className:
|
|
131
|
-
style:
|
|
149
|
+
className: a.lineNumber,
|
|
150
|
+
style: d[t] !== void 0 ? { height: `${d[t]}px` } : void 0,
|
|
132
151
|
children: t + 1
|
|
133
152
|
},
|
|
134
153
|
t
|
|
135
154
|
))
|
|
136
155
|
}
|
|
137
156
|
),
|
|
138
|
-
/* @__PURE__ */ k("div", { ref:
|
|
139
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ k("div", { ref: $, className: a.editorArea, children: [
|
|
158
|
+
/* @__PURE__ */ i(
|
|
140
159
|
"div",
|
|
141
160
|
{
|
|
142
|
-
className:
|
|
161
|
+
className: a.lineHighlight,
|
|
143
162
|
style: {
|
|
144
|
-
top:
|
|
145
|
-
...
|
|
163
|
+
top: d.length > 0 ? `calc(var(--spacing-4) + ${d.slice(0, x).reduce((e, t) => e + t, 0)}px)` : `calc(var(--spacing-4) + ${(x * 1.6).toFixed(2)}em)`,
|
|
164
|
+
...d[x] !== void 0 ? { height: `${d[x]}px` } : {}
|
|
146
165
|
},
|
|
147
166
|
"aria-hidden": "true"
|
|
148
167
|
}
|
|
149
168
|
),
|
|
150
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ i(
|
|
151
170
|
"div",
|
|
152
171
|
{
|
|
153
|
-
ref:
|
|
154
|
-
className:
|
|
172
|
+
ref: y,
|
|
173
|
+
className: a.highlightLayer,
|
|
155
174
|
"aria-hidden": "true",
|
|
156
|
-
children: /* @__PURE__ */
|
|
157
|
-
|
|
175
|
+
children: /* @__PURE__ */ i(
|
|
176
|
+
K,
|
|
158
177
|
{
|
|
159
|
-
language:
|
|
160
|
-
style:
|
|
178
|
+
language: T,
|
|
179
|
+
style: _,
|
|
161
180
|
customStyle: {
|
|
162
181
|
margin: 0,
|
|
163
182
|
padding: 0,
|
|
@@ -184,18 +203,18 @@ const J = U(
|
|
|
184
203
|
)
|
|
185
204
|
}
|
|
186
205
|
),
|
|
187
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ i(
|
|
188
207
|
"textarea",
|
|
189
208
|
{
|
|
190
|
-
ref:
|
|
191
|
-
className:
|
|
209
|
+
ref: g,
|
|
210
|
+
className: a.textareaOverlay,
|
|
192
211
|
value: r,
|
|
193
|
-
onChange: (e) =>
|
|
194
|
-
onKeyDown:
|
|
195
|
-
onKeyUp: (e) =>
|
|
196
|
-
onMouseUp: (e) =>
|
|
197
|
-
onClick: (e) =>
|
|
198
|
-
placeholder:
|
|
212
|
+
onChange: (e) => c?.(e.target.value),
|
|
213
|
+
onKeyDown: A,
|
|
214
|
+
onKeyUp: (e) => N(e.currentTarget),
|
|
215
|
+
onMouseUp: (e) => N(e.currentTarget),
|
|
216
|
+
onClick: (e) => N(e.currentTarget),
|
|
217
|
+
placeholder: L,
|
|
199
218
|
readOnly: S,
|
|
200
219
|
"aria-label": H || "Code editor",
|
|
201
220
|
spellCheck: "false",
|
|
@@ -208,36 +227,36 @@ const J = U(
|
|
|
208
227
|
) : /* @__PURE__ */ k(
|
|
209
228
|
"div",
|
|
210
229
|
{
|
|
211
|
-
className:
|
|
212
|
-
style: { minHeight: `calc(${
|
|
230
|
+
className: q,
|
|
231
|
+
style: { minHeight: `calc(${f} * 1.6em + 2 * var(--spacing-4))` },
|
|
213
232
|
children: [
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
|
|
233
|
+
/* @__PURE__ */ i("div", { ref: v, className: a.lineMirror, "aria-hidden": "true" }),
|
|
234
|
+
E && /* @__PURE__ */ i(
|
|
216
235
|
"div",
|
|
217
236
|
{
|
|
218
237
|
ref: p,
|
|
219
|
-
className:
|
|
238
|
+
className: a.lineNumbers,
|
|
220
239
|
"aria-hidden": "true",
|
|
221
|
-
children: Array.from({ length: R }).map((e, t) => /* @__PURE__ */
|
|
240
|
+
children: Array.from({ length: R }).map((e, t) => /* @__PURE__ */ i(
|
|
222
241
|
"div",
|
|
223
242
|
{
|
|
224
|
-
className:
|
|
225
|
-
style:
|
|
243
|
+
className: a.lineNumber,
|
|
244
|
+
style: d[t] !== void 0 ? { height: `${d[t]}px` } : void 0,
|
|
226
245
|
children: t + 1
|
|
227
246
|
},
|
|
228
247
|
t
|
|
229
248
|
))
|
|
230
249
|
}
|
|
231
250
|
),
|
|
232
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ i(
|
|
233
252
|
"textarea",
|
|
234
253
|
{
|
|
235
|
-
ref:
|
|
236
|
-
className:
|
|
254
|
+
ref: g,
|
|
255
|
+
className: a.textarea,
|
|
237
256
|
value: r,
|
|
238
|
-
onChange: (e) =>
|
|
239
|
-
onKeyDown:
|
|
240
|
-
placeholder:
|
|
257
|
+
onChange: (e) => c?.(e.target.value),
|
|
258
|
+
onKeyDown: A,
|
|
259
|
+
placeholder: L,
|
|
241
260
|
readOnly: S,
|
|
242
261
|
"aria-label": H || "Code editor",
|
|
243
262
|
spellCheck: "false",
|
|
@@ -249,7 +268,7 @@ const J = U(
|
|
|
249
268
|
);
|
|
250
269
|
}
|
|
251
270
|
);
|
|
252
|
-
|
|
271
|
+
X.displayName = "CodeEditor";
|
|
253
272
|
export {
|
|
254
|
-
|
|
273
|
+
X as CodeEditor
|
|
255
274
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),h=require("lucide-react"),re=require("../MissingDependencyError.cjs"),a=require("./CollapsibleFolder.module.css.cjs"),x=require("../Collapsible/Collapsible.cjs"),se=require("../Badge/Badge.cjs"),q=require("../Dropdown/Dropdown.cjs"),F=require("../Button/Button.cjs");let w,R=null;try{w=require("@dnd-kit/core").useDroppable}catch(r){R=r instanceof Error?r:new Error("@dnd-kit/core not found")}function B(r){if(R)return e.jsx(re.MissingDependencyError,{available:!1,componentName:"CollapsibleFolder",depName:["@dnd-kit/core","@dnd-kit/sortable","@dnd-kit/utilities"],installCommand:"npm install @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities",pnpmCommand:"pnpm add @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities",docsUrl:"https://docs.orion-ds.dev/components/collapsible-folder"});const{id:p,title:z,itemCount:b,items:s,renderItem:O,itemLabel:A="Item",itemLabelPlural:M="Items",emptyText:K="No items in this folder",sortLabel:v="Sort",defaultExpanded:$=!0,sortOptions:d,selectedSort:P,onSortChange:Y,onDrop:D,onFolderEdit:j,onFolderDelete:C,onFolderInvite:N,isDropTarget:H=!1,isDropCompleted:U=!1,onDragEnter:Z,onDragLeaveFolder:y,className:_,...G}=r,[m,J]=i.useState($),[f,c]=i.useState(null),[T,g]=i.useState(!1),k=i.useRef(null),{setNodeRef:Q}=w({id:p}),V=t=>{if(t.preventDefault(),t.dataTransfer.dropEffect="move",T||(g(!0),Z?.()),!m||s.length===0){c(0);return}const n=k.current;if(!n)return;const l=Array.from(n.querySelectorAll("[data-item-id]")),le=t.clientY;let E=l.length;for(let u=0;u<l.length;u++){const L=l[u];if(!L)continue;const S=L.getBoundingClientRect();if(le<S.top+S.height/2){E=u;break}}c(E)},W=t=>{t.currentTarget.contains(t.relatedTarget)||(g(!1),c(null),y?.())},X=t=>{t.preventDefault();const n=t.dataTransfer.getData("text/plain")||t.dataTransfer.getData("itemId");if(n&&D){const l=f??s.length;D(n,p,l)}g(!1),c(null),y?.()},ee=(t,n)=>{t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",n)},te=d?.map(t=>({id:t.value,label:t.label,onClick:()=>Y?.(t.value)})),I=[...j?[{id:"rename",label:"Rename",onClick:j}]:[],...N?[{id:"invite",label:"Invite participants",onClick:N}]:[],...C?[{id:"delete",label:"Delete folder",danger:!0,onClick:C}]:[]],o=H||T,ae=[a.default.folder,o&&a.default.dropTarget,U&&a.default.dropCompleted,_].filter(Boolean).join(" "),ne=b===1?A:M;return e.jsx("div",{ref:Q,className:ae,"data-folder-id":p,"data-drop-active":o,onDragOver:V,onDragLeave:W,onDrop:X,...G,children:e.jsxs(x.Collapsible,{open:m,onOpenChange:J,children:[e.jsxs("div",{className:a.default.header,children:[e.jsxs(x.Collapsible.Trigger,{className:a.default.trigger,children:[e.jsx(h.ChevronDown,{size:20,className:`${a.default.chevron} ${m?a.default.expanded:""}`}),e.jsx("h2",{className:a.default.title,children:z}),e.jsxs(se.Badge,{variant:"secondary",className:a.default.badge,children:[b,e.jsxs("span",{className:a.default.badgeLabel,children:[" ",ne]})]})]}),e.jsxs("div",{className:a.default.actions,children:[d&&d.length>0&&e.jsx("div",{className:a.default.sortDropdown,children:e.jsx(q.Dropdown,{trigger:e.jsx(F.Button,{variant:"ghost",size:"sm",iconRight:e.jsx(h.ChevronDown,{size:16}),"aria-label":`Sort by ${v}`,children:d.find(t=>t.value===P)?.label||v}),items:te,placement:"bottom-end"})}),I.length>0&&e.jsx(q.Dropdown,{trigger:e.jsx(F.Button,{variant:"ghost",size:"sm",iconOnly:!0,icon:e.jsx(h.MoreHorizontal,{size:20}),"aria-label":"Folder actions"}),items:I,placement:"bottom-end"})]})]}),e.jsx(x.Collapsible.Content,{children:e.jsx("div",{className:a.default.content,children:s.length===0?o?e.jsx("div",{className:a.default.emptyDropZone,children:e.jsx("div",{className:a.default.insertionLine,role:"presentation"})}):e.jsx("div",{className:a.default.emptyState,children:e.jsx("p",{className:a.default.emptyText,children:K})}):e.jsxs("div",{className:a.default.grid,ref:k,children:[s.map((t,n)=>e.jsxs(i.Fragment,{children:[o&&f===n&&e.jsx("div",{className:a.default.insertionLine,role:"presentation"}),e.jsx("div",{"data-item-id":t.id,draggable:t.draggable,onDragStart:l=>ee(l,t.id),children:O(t,n)})]},t.id)),o&&f===s.length&&e.jsx("div",{className:a.default.insertionLine,role:"presentation"})]})})})]})})}B.displayName="CollapsibleFolder";exports.CollapsibleFolder=B;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsibleFolder.d.ts","sourceRoot":"","sources":["../../../src/components/CollapsibleFolder/CollapsibleFolder.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CollapsibleFolder.d.ts","sourceRoot":"","sources":["../../../src/components/CollapsibleFolder/CollapsibleFolder.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAoBxE,wBAAgB,iBAAiB,CAC/B,KAAK,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,EACjD,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,2CAoRrC;yBAtRe,iBAAiB"}
|