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