@omniviewdev/ui 0.1.11 → 0.2.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/{Select-D61fKI8Y.js → Select-Dg7Xdulg.js} +70 -64
- package/dist/Select-mxLKNk8-.cjs +1 -0
- package/dist/buttons/ActionMenu.d.ts +3 -1
- package/dist/buttons.cjs +1 -1
- package/dist/buttons.js +102 -101
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +1 -1
- package/dist/editors/CodeEditor.d.ts +4 -1
- package/dist/editors/DiffViewer.d.ts +17 -1
- package/dist/editors.cjs +24 -24
- package/dist/editors.js +2147 -2118
- package/dist/index.cjs +1 -1
- package/dist/index.js +175 -163
- package/dist/inputs.cjs +1 -1
- package/dist/inputs.js +1 -1
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.js +66 -57
- package/package.json +1 -1
- package/dist/Select-BqA47TdK.cjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as p, jsx as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as P, useMemo as K } from "react";
|
|
3
3
|
import R from "@mui/material/Select";
|
|
4
|
-
import
|
|
4
|
+
import w from "@mui/material/MenuItem";
|
|
5
5
|
import U from "@mui/material/FormControl";
|
|
6
6
|
import V from "@mui/material/InputLabel";
|
|
7
7
|
import G from "@mui/material/FormHelperText";
|
|
@@ -14,32 +14,32 @@ import Y from "@mui/material/Chip";
|
|
|
14
14
|
import m from "@mui/material/Box";
|
|
15
15
|
import Z from "@mui/icons-material/Search";
|
|
16
16
|
import $ from "@mui/icons-material/Clear";
|
|
17
|
-
import { INPUT_HEIGHTS as oo, toMuiInputSize as
|
|
17
|
+
import { INPUT_HEIGHTS as oo, toMuiInputSize as to, toMuiColor as eo } from "./types.js";
|
|
18
18
|
function ro({
|
|
19
19
|
options: g,
|
|
20
20
|
value: h,
|
|
21
21
|
onChange: f,
|
|
22
22
|
size: v = "md",
|
|
23
|
-
color:
|
|
23
|
+
color: T = "neutral",
|
|
24
24
|
label: u,
|
|
25
|
-
helperText:
|
|
26
|
-
placeholder:
|
|
25
|
+
helperText: M,
|
|
26
|
+
placeholder: i,
|
|
27
27
|
searchable: c = !1,
|
|
28
28
|
multiple: x = !1,
|
|
29
29
|
loading: C = !1,
|
|
30
30
|
error: d,
|
|
31
|
-
fullWidth:
|
|
32
|
-
disabled:
|
|
33
|
-
clearable:
|
|
31
|
+
fullWidth: E,
|
|
32
|
+
disabled: H,
|
|
33
|
+
clearable: k = !1,
|
|
34
34
|
sx: A
|
|
35
35
|
}) {
|
|
36
|
-
const [
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
if (!c || !
|
|
40
|
-
const o =
|
|
41
|
-
return g.filter((
|
|
42
|
-
}, [g,
|
|
36
|
+
const [y, D] = P(""), [O, L] = P(!1), [s, a] = P(-1), F = to(v), I = eo(T), W = typeof d == "string" ? !!d : d, z = typeof d == "string" ? d : void 0, S = () => {
|
|
37
|
+
L(!1), a(-1), c && D("");
|
|
38
|
+
}, n = K(() => {
|
|
39
|
+
if (!c || !y) return g;
|
|
40
|
+
const o = y.toLowerCase();
|
|
41
|
+
return g.filter((t) => t.label.toLowerCase().includes(o));
|
|
42
|
+
}, [g, y, c]), N = (o) => {
|
|
43
43
|
f(o.target.value);
|
|
44
44
|
}, j = (o) => {
|
|
45
45
|
if (o.key === "Escape") {
|
|
@@ -47,26 +47,32 @@ function ro({
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
if (o.key === "ArrowDown") {
|
|
50
|
-
if (o.preventDefault(), o.stopPropagation(),
|
|
51
|
-
const
|
|
52
|
-
|
|
50
|
+
if (o.preventDefault(), o.stopPropagation(), n.length === 0) return;
|
|
51
|
+
const t = s + 1;
|
|
52
|
+
a(t >= n.length ? 0 : t);
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
if (o.key === "ArrowUp") {
|
|
56
56
|
o.preventDefault(), o.stopPropagation();
|
|
57
|
-
const
|
|
58
|
-
|
|
57
|
+
const t = s - 1;
|
|
58
|
+
a(t < 0 ? n.length - 1 : t);
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
if (o.key === "
|
|
61
|
+
if (o.key === "Tab") {
|
|
62
|
+
if (o.preventDefault(), o.stopPropagation(), n.length === 0) return;
|
|
63
|
+
const t = s + 1;
|
|
64
|
+
a(t >= n.length ? 0 : t);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (o.key === "Enter" && s >= 0 && s < n.length) {
|
|
62
68
|
o.preventDefault(), o.stopPropagation();
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
69
|
+
const t = n[s];
|
|
70
|
+
if (!t.disabled)
|
|
65
71
|
if (x) {
|
|
66
|
-
const r = Array.isArray(h) ? h : [], b = r.includes(
|
|
72
|
+
const r = Array.isArray(h) ? h : [], b = r.includes(t.value) ? r.filter((l) => l !== t.value) : [...r, t.value];
|
|
67
73
|
f(b);
|
|
68
74
|
} else
|
|
69
|
-
f(
|
|
75
|
+
f(t.value), S();
|
|
70
76
|
return;
|
|
71
77
|
}
|
|
72
78
|
o.stopPropagation();
|
|
@@ -75,17 +81,17 @@ function ro({
|
|
|
75
81
|
U,
|
|
76
82
|
{
|
|
77
83
|
size: F,
|
|
78
|
-
fullWidth:
|
|
84
|
+
fullWidth: E,
|
|
79
85
|
error: W,
|
|
80
|
-
disabled:
|
|
86
|
+
disabled: H,
|
|
81
87
|
style: { "--ov-input-height": oo[v] },
|
|
82
88
|
sx: A,
|
|
83
89
|
children: [
|
|
84
|
-
u && /* @__PURE__ */
|
|
90
|
+
u && /* @__PURE__ */ e(
|
|
85
91
|
V,
|
|
86
92
|
{
|
|
87
|
-
color:
|
|
88
|
-
shrink: !!
|
|
93
|
+
color: I === "default" || I === "inherit" ? void 0 : I,
|
|
94
|
+
shrink: !!i || void 0,
|
|
89
95
|
children: u
|
|
90
96
|
}
|
|
91
97
|
),
|
|
@@ -95,18 +101,18 @@ function ro({
|
|
|
95
101
|
value: h,
|
|
96
102
|
onChange: N,
|
|
97
103
|
multiple: x,
|
|
98
|
-
displayEmpty: !!
|
|
104
|
+
displayEmpty: !!i,
|
|
99
105
|
label: u,
|
|
100
|
-
notched: u && !!
|
|
101
|
-
input: x ? /* @__PURE__ */
|
|
106
|
+
notched: u && !!i || void 0,
|
|
107
|
+
input: x ? /* @__PURE__ */ e(Q, { label: u }) : void 0,
|
|
102
108
|
open: O,
|
|
103
109
|
onOpen: () => {
|
|
104
|
-
|
|
110
|
+
L(!0), a(-1);
|
|
105
111
|
},
|
|
106
112
|
onClose: S,
|
|
107
113
|
renderValue: x ? (o) => {
|
|
108
|
-
const
|
|
109
|
-
return
|
|
114
|
+
const t = o;
|
|
115
|
+
return t.length === 0 && i ? /* @__PURE__ */ e(m, { sx: { color: "var(--ov-fg-faint)" }, children: i }) : /* @__PURE__ */ p(
|
|
110
116
|
m,
|
|
111
117
|
{
|
|
112
118
|
sx: {
|
|
@@ -117,26 +123,26 @@ function ro({
|
|
|
117
123
|
alignItems: "center"
|
|
118
124
|
},
|
|
119
125
|
children: [
|
|
120
|
-
|
|
121
|
-
const b = g.find((
|
|
122
|
-
return /* @__PURE__ */
|
|
126
|
+
t.map((r) => {
|
|
127
|
+
const b = g.find((l) => l.value === r);
|
|
128
|
+
return /* @__PURE__ */ e(
|
|
123
129
|
Y,
|
|
124
130
|
{
|
|
125
131
|
label: b?.label ?? r,
|
|
126
132
|
size: "small",
|
|
127
|
-
...
|
|
128
|
-
onDelete: (
|
|
129
|
-
|
|
133
|
+
...k ? {
|
|
134
|
+
onDelete: (l) => {
|
|
135
|
+
l.stopPropagation(), f(t.filter((B) => B !== r));
|
|
130
136
|
},
|
|
131
|
-
onMouseDown: (
|
|
132
|
-
|
|
137
|
+
onMouseDown: (l) => {
|
|
138
|
+
l.stopPropagation();
|
|
133
139
|
}
|
|
134
140
|
} : {}
|
|
135
141
|
},
|
|
136
142
|
r
|
|
137
143
|
);
|
|
138
144
|
}),
|
|
139
|
-
|
|
145
|
+
k && t.length > 1 && /* @__PURE__ */ e(
|
|
140
146
|
"button",
|
|
141
147
|
{
|
|
142
148
|
type: "button",
|
|
@@ -156,13 +162,13 @@ function ro({
|
|
|
156
162
|
border: "none",
|
|
157
163
|
padding: 0
|
|
158
164
|
},
|
|
159
|
-
children: /* @__PURE__ */
|
|
165
|
+
children: /* @__PURE__ */ e($, { sx: { fontSize: 16 } })
|
|
160
166
|
}
|
|
161
167
|
)
|
|
162
168
|
]
|
|
163
169
|
}
|
|
164
170
|
);
|
|
165
|
-
} :
|
|
171
|
+
} : i && !h ? () => /* @__PURE__ */ e(m, { sx: { color: "var(--ov-fg-faint)" }, children: i }) : void 0,
|
|
166
172
|
MenuProps: {
|
|
167
173
|
PaperProps: {
|
|
168
174
|
sx: {
|
|
@@ -187,7 +193,7 @@ function ro({
|
|
|
187
193
|
}
|
|
188
194
|
},
|
|
189
195
|
children: [
|
|
190
|
-
c && /* @__PURE__ */
|
|
196
|
+
c && /* @__PURE__ */ e(
|
|
191
197
|
m,
|
|
192
198
|
{
|
|
193
199
|
sx: { px: 1, pb: 0.5, pt: 0.5 },
|
|
@@ -207,21 +213,21 @@ function ro({
|
|
|
207
213
|
"&:focus-within": { borderColor: "var(--ov-accent)" }
|
|
208
214
|
},
|
|
209
215
|
children: [
|
|
210
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ e(
|
|
211
217
|
Z,
|
|
212
218
|
{
|
|
213
219
|
sx: { fontSize: 14, color: "var(--ov-fg-faint)", mr: 0.5 }
|
|
214
220
|
}
|
|
215
221
|
),
|
|
216
|
-
/* @__PURE__ */
|
|
222
|
+
/* @__PURE__ */ e(
|
|
217
223
|
X,
|
|
218
224
|
{
|
|
219
225
|
autoFocus: !0,
|
|
220
226
|
fullWidth: !0,
|
|
221
227
|
placeholder: "Search...",
|
|
222
|
-
value:
|
|
228
|
+
value: y,
|
|
223
229
|
onChange: (o) => {
|
|
224
|
-
|
|
230
|
+
D(o.target.value), a(-1);
|
|
225
231
|
},
|
|
226
232
|
onKeyDown: j,
|
|
227
233
|
sx: {
|
|
@@ -241,31 +247,31 @@ function ro({
|
|
|
241
247
|
)
|
|
242
248
|
}
|
|
243
249
|
),
|
|
244
|
-
C && /* @__PURE__ */ p(
|
|
245
|
-
/* @__PURE__ */
|
|
250
|
+
C && /* @__PURE__ */ p(w, { disabled: !0, children: [
|
|
251
|
+
/* @__PURE__ */ e(J, { size: 16, sx: { mr: 1 } }),
|
|
246
252
|
" Loading..."
|
|
247
253
|
] }),
|
|
248
|
-
|
|
249
|
-
|
|
254
|
+
n.map((o, t) => /* @__PURE__ */ p(
|
|
255
|
+
w,
|
|
250
256
|
{
|
|
251
257
|
value: o.value,
|
|
252
258
|
disabled: o.disabled,
|
|
253
259
|
...c ? {
|
|
254
|
-
onMouseEnter: () =>
|
|
255
|
-
sx:
|
|
260
|
+
onMouseEnter: () => a(t),
|
|
261
|
+
sx: t === s ? { bgcolor: "action.focus" } : void 0
|
|
256
262
|
} : {},
|
|
257
263
|
children: [
|
|
258
|
-
o.icon && /* @__PURE__ */
|
|
259
|
-
/* @__PURE__ */
|
|
264
|
+
o.icon && /* @__PURE__ */ e(_, { sx: { minWidth: 28 }, children: o.icon }),
|
|
265
|
+
/* @__PURE__ */ e(q, { children: o.label })
|
|
260
266
|
]
|
|
261
267
|
},
|
|
262
268
|
o.value
|
|
263
269
|
)),
|
|
264
|
-
|
|
270
|
+
n.length === 0 && !C && /* @__PURE__ */ e(w, { disabled: !0, children: "No options" })
|
|
265
271
|
]
|
|
266
272
|
}
|
|
267
273
|
),
|
|
268
|
-
(z ||
|
|
274
|
+
(z || M) && /* @__PURE__ */ e(G, { children: z ?? M })
|
|
269
275
|
]
|
|
270
276
|
}
|
|
271
277
|
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),y=require("react"),B=require("@mui/material/Select"),q=require("@mui/material/MenuItem"),K=require("@mui/material/FormControl"),U=require("@mui/material/InputLabel"),V=require("@mui/material/FormHelperText"),G=require("@mui/material/ListItemIcon"),_=require("@mui/material/ListItemText"),J=require("@mui/material/CircularProgress"),Q=require("@mui/material/OutlinedInput"),X=require("@mui/material/InputBase"),Y=require("@mui/material/Chip"),f=require("@mui/material/Box"),Z=require("@mui/icons-material/Search"),$=require("@mui/icons-material/Clear"),b=require("./types.cjs");function L({options:x,value:g,onChange:l,size:h="md",color:z="neutral",label:c,helperText:P,placeholder:s,searchable:d=!1,multiple:v=!1,loading:w=!1,error:p,fullWidth:T,disabled:E,clearable:M=!1,sx:H}){const[m,C]=y.useState(""),[A,k]=y.useState(!1),[i,a]=y.useState(-1),O=b.toMuiInputSize(h),I=b.toMuiColor(z),F=typeof p=="string"?!!p:p,D=typeof p=="string"?p:void 0,j=()=>{k(!1),a(-1),d&&C("")},o=y.useMemo(()=>{if(!d||!m)return x;const e=m.toLowerCase();return x.filter(t=>t.label.toLowerCase().includes(e))},[x,m,d]),R=e=>{l(e.target.value)},W=e=>{if(e.key==="Escape"){j();return}if(e.key==="ArrowDown"){if(e.preventDefault(),e.stopPropagation(),o.length===0)return;const t=i+1;a(t>=o.length?0:t);return}if(e.key==="ArrowUp"){e.preventDefault(),e.stopPropagation();const t=i-1;a(t<0?o.length-1:t);return}if(e.key==="Tab"){if(e.preventDefault(),e.stopPropagation(),o.length===0)return;const t=i+1;a(t>=o.length?0:t);return}if(e.key==="Enter"&&i>=0&&i<o.length){e.preventDefault(),e.stopPropagation();const t=o[i];if(!t.disabled)if(v){const n=Array.isArray(g)?g:[],S=n.includes(t.value)?n.filter(u=>u!==t.value):[...n,t.value];l(S)}else l(t.value),j();return}e.stopPropagation()};return r.jsxs(K,{size:O,fullWidth:T,error:F,disabled:E,style:{"--ov-input-height":b.INPUT_HEIGHTS[h]},sx:H,children:[c&&r.jsx(U,{color:I==="default"||I==="inherit"?void 0:I,shrink:!!s||void 0,children:c}),r.jsxs(B,{value:g,onChange:R,multiple:v,displayEmpty:!!s,label:c,notched:c&&!!s||void 0,input:v?r.jsx(Q,{label:c}):void 0,open:A,onOpen:()=>{k(!0),a(-1)},onClose:j,renderValue:v?e=>{const t=e;return t.length===0&&s?r.jsx(f,{sx:{color:"var(--ov-fg-faint)"},children:s}):r.jsxs(f,{sx:{display:"flex",flexWrap:"nowrap",gap:.5,overflow:"hidden",alignItems:"center"},children:[t.map(n=>{const S=x.find(u=>u.value===n);return r.jsx(Y,{label:S?.label??n,size:"small",...M?{onDelete:u=>{u.stopPropagation(),l(t.filter(N=>N!==n))},onMouseDown:u=>{u.stopPropagation()}}:{}},n)}),M&&t.length>1&&r.jsx("button",{type:"button","aria-label":"Clear all",onClick:n=>{n.stopPropagation(),l([])},style:{display:"inline-flex",alignItems:"center",flexShrink:0,marginLeft:2,cursor:"pointer",color:"var(--ov-fg-faint)",lineHeight:0,background:"none",border:"none",padding:0},children:r.jsx($,{sx:{fontSize:16}})})]})}:s&&!g?()=>r.jsx(f,{sx:{color:"var(--ov-fg-faint)"},children:s}):void 0,MenuProps:{PaperProps:{sx:{maxHeight:300,...h==="xs"||h==="sm"?{"& .MuiMenuItem-root":{fontSize:"0.8rem",minHeight:28,padding:"3px 8px"},"& .MuiListItemText-root":{margin:0},"& .MuiListItemText-primary":{fontSize:"0.8rem"},"& .MuiListItemIcon-root":{minWidth:22}}:{}}}},children:[d&&r.jsx(f,{sx:{px:1,pb:.5,pt:.5},onClickCapture:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),children:r.jsxs(f,{sx:{display:"flex",alignItems:"center",height:28,border:"1px solid var(--ov-border-default)",borderRadius:"4px",bgcolor:"var(--ov-bg-base)",px:.75,"&:focus-within":{borderColor:"var(--ov-accent)"}},children:[r.jsx(Z,{sx:{fontSize:14,color:"var(--ov-fg-faint)",mr:.5}}),r.jsx(X,{autoFocus:!0,fullWidth:!0,placeholder:"Search...",value:m,onChange:e=>{C(e.target.value),a(-1)},onKeyDown:W,sx:{flex:1,fontSize:"0.75rem",color:"var(--ov-fg-default)","& input":{py:0,px:0},"& input::placeholder":{color:"var(--ov-fg-faint)",opacity:1}}})]})}),w&&r.jsxs(q,{disabled:!0,children:[r.jsx(J,{size:16,sx:{mr:1}})," Loading..."]}),o.map((e,t)=>r.jsxs(q,{value:e.value,disabled:e.disabled,...d?{onMouseEnter:()=>a(t),sx:t===i?{bgcolor:"action.focus"}:void 0}:{},children:[e.icon&&r.jsx(G,{sx:{minWidth:28},children:e.icon}),r.jsx(_,{children:e.label})]},e.value)),o.length===0&&!w&&r.jsx(q,{disabled:!0,children:"No options"})]}),(D||P)&&r.jsx(V,{children:D??P})]})}L.displayName="Select";exports.Select=L;
|
|
@@ -13,8 +13,10 @@ export interface ActionMenuProps {
|
|
|
13
13
|
items: ActionMenuItem[];
|
|
14
14
|
trigger?: React.ReactNode;
|
|
15
15
|
size?: ComponentSize;
|
|
16
|
+
/** Accessible label for the default trigger button. */
|
|
17
|
+
label?: string;
|
|
16
18
|
}
|
|
17
|
-
declare function ActionMenu({ items, trigger, size, }: ActionMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function ActionMenu({ items, trigger, size, label, }: ActionMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
declare namespace ActionMenu {
|
|
19
21
|
var displayName: string;
|
|
20
22
|
}
|
package/dist/buttons.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./Button-Dmu1cikC.cjs"),B=require("./CopyButton-3fq1UAiv.cjs"),o=require("react/jsx-runtime"),g=require("react"),O=require("@mui/material/Popover"),m=require("@mui/material/Box"),z=require("@mui/material/Typography"),w=require("@mui/material/Menu"),N=require("@mui/material/MenuItem"),E=require("@mui/material/ListItemIcon"),$=require("@mui/material/ListItemText"),D=require("@mui/material/Divider"),K=require("@mui/icons-material/MoreVert"),W=require("@mui/material/ButtonGroup"),d=require("./types.cjs"),v=require("@mui/material/IconButton"),C=require("@mui/material/Tooltip"),F=require("@mui/material/ToggleButton"),U=require("@mui/material/ToggleButtonGroup"),V=require("@mui/material/InputBase"),P=require("@mui/icons-material/Search"),b=require("react-icons/lu");function q({onConfirm:n,confirmMessage:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./Button-Dmu1cikC.cjs"),B=require("./CopyButton-3fq1UAiv.cjs"),o=require("react/jsx-runtime"),g=require("react"),O=require("@mui/material/Popover"),m=require("@mui/material/Box"),z=require("@mui/material/Typography"),w=require("@mui/material/Menu"),N=require("@mui/material/MenuItem"),E=require("@mui/material/ListItemIcon"),$=require("@mui/material/ListItemText"),D=require("@mui/material/Divider"),K=require("@mui/icons-material/MoreVert"),W=require("@mui/material/ButtonGroup"),d=require("./types.cjs"),v=require("@mui/material/IconButton"),C=require("@mui/material/Tooltip"),F=require("@mui/material/ToggleButton"),U=require("@mui/material/ToggleButtonGroup"),V=require("@mui/material/InputBase"),P=require("@mui/icons-material/Search"),b=require("react-icons/lu");function q({onConfirm:n,confirmMessage:r="Are you sure?",children:c,...e}){const[l,s]=g.useState(!1),i=g.useRef(null);return o.jsxs(o.Fragment,{children:[o.jsx(m,{component:"span",ref:i,sx:{display:"inline-flex"},children:o.jsx(y.Button,{...e,onClick:()=>s(!0),children:c})}),o.jsxs(O,{open:l,anchorEl:i.current,onClose:()=>s(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},slotProps:{paper:{sx:{p:2,mt:.5,minWidth:200,bgcolor:"var(--ov-bg-surface)",border:"1px solid var(--ov-border-default)"}}},children:[o.jsx(z,{variant:"body2",sx:{color:"var(--ov-fg-default)",mb:1.5},children:r}),o.jsxs(m,{sx:{display:"flex",gap:1,justifyContent:"flex-end"},children:[o.jsx(y.Button,{size:"xs",emphasis:"ghost",color:"neutral",onClick:()=>s(!1),children:"Cancel"}),o.jsx(y.Button,{size:"xs",emphasis:"solid",color:"danger",onClick:()=>{s(!1),n()},children:"Confirm"})]})]})]})}q.displayName="ConfirmButton";function S({items:n,trigger:r,size:c="sm",label:e="Actions"}){const[l,s]=g.useState(!1),i=g.useRef(null),u=()=>s(!1);return o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:i,children:r?o.jsx("span",{onClick:()=>s(!0),style:{cursor:"pointer"},children:r}):o.jsx(B.IconButton,{size:c,color:"neutral",onClick:()=>s(!0),"aria-label":e,children:o.jsx(K,{fontSize:"inherit"})})}),o.jsx(w,{open:l,anchorEl:i.current,onClose:u,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{minWidth:160,bgcolor:"var(--ov-bg-surface)",border:"1px solid var(--ov-border-default)"}}},children:n.map(t=>[o.jsxs(N,{disabled:t.disabled,onClick:()=>{u(),t.onClick()},sx:{fontSize:"var(--ov-text-sm)",color:t.color==="danger"||t.color==="error"?"var(--ov-danger-default)":"var(--ov-fg-default)"},children:[t.icon&&o.jsx(E,{sx:{color:"inherit",minWidth:28},children:t.icon}),o.jsx($,{children:t.label})]},t.key),t.dividerAfter&&o.jsx(D,{},`${t.key}-divider`)])})]})}S.displayName="ActionMenu";function k({children:n,emphasis:r="outline",size:c="sm",color:e="neutral",fullWidth:l,orientation:s="horizontal",disabled:i,sx:u}){const t=d.toMuiColor(e),p=d.toMuiVariant(r),a=d.toMuiSize(c);return o.jsx(W,{color:t,variant:p,size:a,fullWidth:l,orientation:s,disabled:i,sx:u,children:n})}k.displayName="ButtonGroup";const _={default:36,dense:28};function M({children:n,variant:r="default",dividers:c=!1,sx:e}){const l=_[r];return o.jsx(m,{sx:{display:"flex",alignItems:"center",height:l,gap:c?0:.5,px:.5,bgcolor:"var(--ov-bg-surface)",...c&&{"& > *:not(:last-child)::after":{content:'""',display:"block",width:"1px",height:"60%",bgcolor:"var(--ov-border-muted)",ml:.5,mr:.5,flexShrink:0}},...typeof e=="object"&&!Array.isArray(e)?e:{}},children:n})}M.displayName="Toolbar";function T({children:n,sx:r}){return o.jsx(m,{sx:{display:"flex",alignItems:"center",gap:"2px",...typeof r=="object"&&!Array.isArray(r)?r:{}},children:n})}T.displayName="ToolbarGroup";function A({selected:n,onChange:r,icon:c,label:e,size:l="sm",color:s="primary",disabled:i,sx:u}){const t=d.toMuiSize(l),p=d.toCssColor(s),a=o.jsx(v,{size:t,disabled:i,onClick:()=>r(!n),sx:{borderRadius:"4px",color:n?p:"var(--ov-fg-muted)",bgcolor:n?"var(--ov-state-hover)":"transparent","&:hover":{bgcolor:"var(--ov-state-hover)"},...typeof u=="object"&&!Array.isArray(u)?u:{}},children:c});return e?o.jsx(C,{title:e,children:a}):a}A.displayName="ToggleButton";function I({value:n,onChange:r,options:c,exclusive:e=!0,size:l="sm",color:s="primary",sx:i}){const u=d.toMuiSize(l),t=d.toCssColor(s),p=(a,x)=>{x!==null&&r(x)};return o.jsx(U,{value:n,exclusive:e,onChange:p,size:u,sx:{"& .Mui-selected":{color:`${t} !important`,bgcolor:"var(--ov-state-hover) !important"},...typeof i=="object"&&!Array.isArray(i)?i:{}},children:c.map(a=>o.jsxs(F,{value:a.key,disabled:a.disabled,sx:{fontSize:"var(--ov-text-sm)",textTransform:"none",px:1.5,gap:.5},children:[a.icon,a.label]},a.key))})}I.displayName="ToggleGroup";const H={xs:24,sm:28,md:32,lg:36,xl:40};function G({value:n,onChange:r,placeholder:c="Search...",regex:e,caseSensitive:l,onRegexChange:s,onCaseSensitiveChange:i,matchCount:u,currentMatch:t,onNext:p,onPrev:a,size:x="sm",sx:j}){const R=H[x],h=x==="xs"?12:14,L=g.useCallback(f=>{f.key==="Enter"&&(f.shiftKey?a?.():p?.()),f.key==="Escape"&&f.target.blur()},[p,a]);return o.jsxs(m,{sx:{display:"flex",alignItems:"center",height:R,border:"1px solid var(--ov-border-default)",borderRadius:"4px",bgcolor:"var(--ov-bg-surface)",px:.5,gap:"2px","&:focus-within":{borderColor:"var(--ov-accent)"},...typeof j=="object"&&!Array.isArray(j)?j:{}},children:[o.jsx(P,{sx:{fontSize:h+2,color:"var(--ov-fg-muted)",ml:.25}}),o.jsx(V,{value:n,onChange:f=>r(f.target.value),onKeyDown:L,placeholder:c,sx:{flex:1,fontSize:x==="xs"?"var(--ov-text-xs)":"var(--ov-text-sm)",color:"var(--ov-fg-default)","& input":{py:0,px:.5},"& input::placeholder":{color:"var(--ov-fg-faint)",opacity:1}}}),i&&o.jsx(C,{title:"Match Case",children:o.jsx(v,{size:"small",onClick:()=>i(!l),sx:{borderRadius:"3px",p:"2px",color:l?"var(--ov-accent-fg)":"var(--ov-fg-faint)",bgcolor:l?"var(--ov-accent-subtle)":"transparent"},children:o.jsx(b.LuCaseSensitive,{size:h})})}),s&&o.jsx(C,{title:"Use Regular Expression",children:o.jsx(v,{size:"small",onClick:()=>s(!e),sx:{borderRadius:"3px",p:"2px",color:e?"var(--ov-accent-fg)":"var(--ov-fg-faint)",bgcolor:e?"var(--ov-accent-subtle)":"transparent"},children:o.jsx(b.LuRegex,{size:h})})}),u!==void 0&&o.jsx(z,{sx:{fontSize:"var(--ov-text-xs)",color:"var(--ov-fg-muted)",whiteSpace:"nowrap",px:.5},children:u===0?"No results":`${(t??0)+1}/${u}`}),a&&o.jsx(v,{size:"small",onClick:a,sx:{p:"2px"},children:o.jsx(b.LuChevronUp,{size:h})}),p&&o.jsx(v,{size:"small",onClick:p,sx:{p:"2px"},children:o.jsx(b.LuChevronDown,{size:h})})]})}G.displayName="SearchBar";exports.Button=y.Button;exports.CopyButton=B.CopyButton;exports.IconButton=B.IconButton;exports.ActionMenu=S;exports.ButtonGroup=k;exports.ConfirmButton=q;exports.SearchBar=G;exports.ToggleButton=A;exports.ToggleGroup=I;exports.Toolbar=M;exports.ToolbarGroup=T;
|