@mirror-physics/fractal-ui 0.2.0-next.46 → 0.2.0-next.48
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/index.cjs +500 -302
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +112 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +32 -2
- package/dist/index.d.ts +32 -2
- package/dist/index.js +477 -280
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
package/dist/index.js
CHANGED
|
@@ -165,22 +165,218 @@ var Button = React.forwardRef(
|
|
|
165
165
|
);
|
|
166
166
|
Button.displayName = "Button";
|
|
167
167
|
|
|
168
|
+
// src/components/CodeBlock/CodeBlock.tsx
|
|
169
|
+
import { useEffect, useMemo, useRef, useState as useState2 } from "react";
|
|
170
|
+
import CodeMirror from "@uiw/react-codemirror";
|
|
171
|
+
import { HighlightStyle, LanguageDescription, syntaxHighlighting } from "@codemirror/language";
|
|
172
|
+
import { languages } from "@codemirror/language-data";
|
|
173
|
+
import { EditorView } from "@codemirror/view";
|
|
174
|
+
import { tags } from "@lezer/highlight";
|
|
175
|
+
import { Check, Copy } from "@mirror-physics/fractal-icons";
|
|
176
|
+
import { jsx, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
177
|
+
var codeTheme = EditorView.theme({
|
|
178
|
+
"&": {
|
|
179
|
+
backgroundColor: "transparent",
|
|
180
|
+
color: "var(--fg-primary)",
|
|
181
|
+
fontSize: "0.75rem"
|
|
182
|
+
},
|
|
183
|
+
"&.cm-focused": { outline: "none" },
|
|
184
|
+
".cm-scroller": {
|
|
185
|
+
fontFamily: "var(--font-mono)",
|
|
186
|
+
lineHeight: "1.55",
|
|
187
|
+
overscrollBehavior: "contain"
|
|
188
|
+
},
|
|
189
|
+
".cm-content": { padding: "10px 0" },
|
|
190
|
+
".cm-line": { padding: "0 12px" },
|
|
191
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: "var(--fg-primary)" },
|
|
192
|
+
".cm-gutters": {
|
|
193
|
+
backgroundColor: "var(--bg-surface-1)",
|
|
194
|
+
borderRight: "1px solid var(--border-subtle)",
|
|
195
|
+
color: "var(--fg-tertiary)"
|
|
196
|
+
},
|
|
197
|
+
".cm-lineNumbers .cm-gutterElement": { padding: "0 10px 0 12px" },
|
|
198
|
+
".cm-foldGutter .cm-gutterElement": { padding: "0 8px 0 2px" },
|
|
199
|
+
".cm-activeLine, .cm-activeLineGutter": { backgroundColor: "var(--bg-surface-1)" },
|
|
200
|
+
".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection": {
|
|
201
|
+
backgroundColor: "var(--accent-surface-stroke) !important"
|
|
202
|
+
},
|
|
203
|
+
".cm-searchMatch": {
|
|
204
|
+
backgroundColor: "var(--warning-surface)",
|
|
205
|
+
outline: "1px solid var(--warning-surface-stroke)"
|
|
206
|
+
},
|
|
207
|
+
".cm-searchMatch.cm-searchMatch-selected": { backgroundColor: "var(--warning-subtle)" },
|
|
208
|
+
".cm-panels": { backgroundColor: "var(--bg-surface-1)", color: "var(--fg-primary)" },
|
|
209
|
+
".cm-tooltip": {
|
|
210
|
+
borderColor: "var(--border-subtle)",
|
|
211
|
+
backgroundColor: "var(--bg-canvas)",
|
|
212
|
+
color: "var(--fg-primary)"
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
var fractalHighlightStyle = HighlightStyle.define([
|
|
216
|
+
{ tag: tags.comment, color: "var(--fg-tertiary)", fontStyle: "italic" },
|
|
217
|
+
{ tag: [tags.keyword, tags.controlKeyword, tags.operatorKeyword], color: "var(--purple-default)" },
|
|
218
|
+
{ tag: [tags.string, tags.special(tags.string)], color: "var(--success-default)" },
|
|
219
|
+
{ tag: [tags.number, tags.bool, tags.null], color: "var(--orange-default)" },
|
|
220
|
+
{ tag: [tags.function(tags.variableName), tags.labelName], color: "var(--accent-default)" },
|
|
221
|
+
{ tag: [tags.typeName, tags.className, tags.namespace], color: "var(--pink-default)" },
|
|
222
|
+
{ tag: [tags.propertyName, tags.attributeName], color: "var(--fg-primary)" },
|
|
223
|
+
{ tag: [tags.operator, tags.punctuation, tags.bracket], color: "var(--fg-secondary)" },
|
|
224
|
+
{ tag: [tags.heading, tags.strong], color: "var(--fg-primary)", fontWeight: "600" },
|
|
225
|
+
{ tag: tags.emphasis, fontStyle: "italic" },
|
|
226
|
+
{ tag: tags.link, color: "var(--accent-default)", textDecoration: "underline" },
|
|
227
|
+
{ tag: tags.invalid, color: "var(--error-default)", textDecoration: "underline wavy" }
|
|
228
|
+
]);
|
|
229
|
+
function findLanguage(language, fileName) {
|
|
230
|
+
const normalized = language?.trim();
|
|
231
|
+
if (normalized && !["text", "txt", "plaintext", "plain"].includes(normalized.toLowerCase())) {
|
|
232
|
+
return LanguageDescription.matchLanguageName(languages, normalized, true);
|
|
233
|
+
}
|
|
234
|
+
return fileName ? LanguageDescription.matchFilename(languages, fileName) : null;
|
|
235
|
+
}
|
|
236
|
+
function useLanguageSupport(language, fileName) {
|
|
237
|
+
const description = useMemo(() => findLanguage(language, fileName), [fileName, language]);
|
|
238
|
+
const [support, setSupport] = useState2(null);
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
let cancelled = false;
|
|
241
|
+
setSupport(null);
|
|
242
|
+
if (!description) return () => {
|
|
243
|
+
cancelled = true;
|
|
244
|
+
};
|
|
245
|
+
void description.load().then((loaded) => {
|
|
246
|
+
if (!cancelled) setSupport(loaded);
|
|
247
|
+
}).catch(() => {
|
|
248
|
+
if (!cancelled) setSupport(null);
|
|
249
|
+
});
|
|
250
|
+
return () => {
|
|
251
|
+
cancelled = true;
|
|
252
|
+
};
|
|
253
|
+
}, [description]);
|
|
254
|
+
return { description, support };
|
|
255
|
+
}
|
|
256
|
+
function CodeBlock({
|
|
257
|
+
value,
|
|
258
|
+
language,
|
|
259
|
+
fileName,
|
|
260
|
+
label,
|
|
261
|
+
editable = false,
|
|
262
|
+
onChange,
|
|
263
|
+
lineNumbers = true,
|
|
264
|
+
wrap = true,
|
|
265
|
+
copyable = true,
|
|
266
|
+
ariaLabel,
|
|
267
|
+
height,
|
|
268
|
+
minHeight,
|
|
269
|
+
maxHeight = "28rem",
|
|
270
|
+
placeholder,
|
|
271
|
+
autoFocus,
|
|
272
|
+
className,
|
|
273
|
+
...props
|
|
274
|
+
}) {
|
|
275
|
+
const { description, support } = useLanguageSupport(language, fileName);
|
|
276
|
+
const [copyStatus, setCopyStatus] = useState2("idle");
|
|
277
|
+
const copyResetTimer = useRef(null);
|
|
278
|
+
useEffect(() => () => {
|
|
279
|
+
if (copyResetTimer.current) clearTimeout(copyResetTimer.current);
|
|
280
|
+
}, []);
|
|
281
|
+
const extensions = useMemo(() => [
|
|
282
|
+
codeTheme,
|
|
283
|
+
syntaxHighlighting(fractalHighlightStyle),
|
|
284
|
+
...support ? [support] : [],
|
|
285
|
+
...wrap ? [EditorView.lineWrapping] : []
|
|
286
|
+
], [support, wrap]);
|
|
287
|
+
const languageLabel = language?.trim() || description?.name;
|
|
288
|
+
const toolbarLabel = label ?? fileName ?? languageLabel;
|
|
289
|
+
const surfaceLabel = ariaLabel ?? (fileName ? `${fileName} ${editable ? "editor" : "viewer"}` : `Code ${editable ? "editor" : "viewer"}`);
|
|
290
|
+
const copyCode = async () => {
|
|
291
|
+
try {
|
|
292
|
+
await navigator.clipboard.writeText(value);
|
|
293
|
+
setCopyStatus("copied");
|
|
294
|
+
} catch {
|
|
295
|
+
setCopyStatus("error");
|
|
296
|
+
}
|
|
297
|
+
if (copyResetTimer.current) clearTimeout(copyResetTimer.current);
|
|
298
|
+
copyResetTimer.current = setTimeout(() => setCopyStatus("idle"), 1800);
|
|
299
|
+
};
|
|
300
|
+
const showToolbar = toolbarLabel !== void 0 || copyable || editable;
|
|
301
|
+
return /* @__PURE__ */ jsxs2(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
className: cn(
|
|
305
|
+
"fractal-code-block",
|
|
306
|
+
editable && "fractal-code-block--editable",
|
|
307
|
+
!lineNumbers && "fractal-code-block--no-line-numbers",
|
|
308
|
+
className
|
|
309
|
+
),
|
|
310
|
+
...props,
|
|
311
|
+
children: [
|
|
312
|
+
showToolbar && /* @__PURE__ */ jsxs2("div", { className: "fractal-code-block__toolbar", children: [
|
|
313
|
+
/* @__PURE__ */ jsxs2("div", { className: "fractal-code-block__identity", children: [
|
|
314
|
+
toolbarLabel !== void 0 && /* @__PURE__ */ jsx("span", { className: "fractal-code-block__label", title: typeof toolbarLabel === "string" ? toolbarLabel : void 0, children: toolbarLabel }),
|
|
315
|
+
fileName && languageLabel && /* @__PURE__ */ jsx("span", { className: "fractal-code-block__language", children: languageLabel }),
|
|
316
|
+
editable && /* @__PURE__ */ jsx("span", { className: "fractal-code-block__mode", children: "Editing" })
|
|
317
|
+
] }),
|
|
318
|
+
copyable && /* @__PURE__ */ jsxs2(
|
|
319
|
+
"button",
|
|
320
|
+
{
|
|
321
|
+
type: "button",
|
|
322
|
+
className: "fractal-code-block__copy",
|
|
323
|
+
"aria-label": copyStatus === "copied" ? "Code copied" : "Copy code",
|
|
324
|
+
onClick: () => void copyCode(),
|
|
325
|
+
children: [
|
|
326
|
+
copyStatus === "copied" ? /* @__PURE__ */ jsx(Check, { size: 14 }) : /* @__PURE__ */ jsx(Copy, { size: 14 }),
|
|
327
|
+
/* @__PURE__ */ jsx("span", { children: copyStatus === "copied" ? "Copied" : copyStatus === "error" ? "Copy failed" : "Copy" })
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
)
|
|
331
|
+
] }),
|
|
332
|
+
/* @__PURE__ */ jsx("div", { className: "fractal-code-block__surface", children: /* @__PURE__ */ jsx(
|
|
333
|
+
CodeMirror,
|
|
334
|
+
{
|
|
335
|
+
"aria-label": surfaceLabel,
|
|
336
|
+
value,
|
|
337
|
+
editable,
|
|
338
|
+
readOnly: !editable,
|
|
339
|
+
onChange,
|
|
340
|
+
extensions,
|
|
341
|
+
theme: "none",
|
|
342
|
+
basicSetup: {
|
|
343
|
+
lineNumbers,
|
|
344
|
+
foldGutter: lineNumbers,
|
|
345
|
+
highlightActiveLine: editable,
|
|
346
|
+
highlightActiveLineGutter: editable,
|
|
347
|
+
autocompletion: editable,
|
|
348
|
+
history: editable
|
|
349
|
+
},
|
|
350
|
+
indentWithTab: editable,
|
|
351
|
+
height,
|
|
352
|
+
minHeight,
|
|
353
|
+
maxHeight,
|
|
354
|
+
placeholder,
|
|
355
|
+
autoFocus
|
|
356
|
+
}
|
|
357
|
+
) }),
|
|
358
|
+
/* @__PURE__ */ jsx("span", { className: "fractal-code-block__status", "aria-live": "polite", children: copyStatus === "copied" ? "Code copied to clipboard." : copyStatus === "error" ? "Code could not be copied." : "" })
|
|
359
|
+
]
|
|
360
|
+
}
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
|
|
168
364
|
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
169
365
|
import { ChevronRight } from "@mirror-physics/fractal-icons";
|
|
170
|
-
import { jsx, jsxs as
|
|
366
|
+
import { jsx as jsx2, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
171
367
|
function Breadcrumbs({
|
|
172
368
|
items,
|
|
173
369
|
ariaLabel = "Breadcrumbs",
|
|
174
|
-
separator = /* @__PURE__ */
|
|
370
|
+
separator = /* @__PURE__ */ jsx2(ChevronRight, { "aria-hidden": "true", size: 14 }),
|
|
175
371
|
className,
|
|
176
372
|
...props
|
|
177
373
|
}) {
|
|
178
374
|
if (items.length === 0) return null;
|
|
179
|
-
return /* @__PURE__ */
|
|
375
|
+
return /* @__PURE__ */ jsx2("nav", { "aria-label": ariaLabel, className: cn("fractal-breadcrumbs", className), ...props, children: /* @__PURE__ */ jsx2("ol", { className: "fractal-breadcrumbs__list", children: items.map((item, index) => {
|
|
180
376
|
const isCurrent = index === items.length - 1;
|
|
181
|
-
const content = isCurrent ? /* @__PURE__ */
|
|
182
|
-
return /* @__PURE__ */
|
|
183
|
-
index > 0 && /* @__PURE__ */
|
|
377
|
+
const content = isCurrent ? /* @__PURE__ */ jsx2("span", { "aria-current": "page", className: "fractal-breadcrumbs__current", children: item.label }) : /* @__PURE__ */ jsx2("a", { className: "fractal-breadcrumbs__link", href: item.href ?? "#", onClick: item.onClick, children: item.label });
|
|
378
|
+
return /* @__PURE__ */ jsxs3("li", { className: "fractal-breadcrumbs__item", children: [
|
|
379
|
+
index > 0 && /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", className: "fractal-breadcrumbs__separator", children: separator }),
|
|
184
380
|
content
|
|
185
381
|
] }, index);
|
|
186
382
|
}) }) });
|
|
@@ -189,41 +385,41 @@ function Breadcrumbs({
|
|
|
189
385
|
// src/components/Card/Card.tsx
|
|
190
386
|
import * as React2 from "react";
|
|
191
387
|
import { Folder as FolderIcon } from "@mirror-physics/fractal-icons";
|
|
192
|
-
import { jsx as
|
|
388
|
+
import { jsx as jsx3, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
193
389
|
var Card = React2.forwardRef(
|
|
194
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
390
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx3("div", { ref, className: cn("fractal-card", className), ...props })
|
|
195
391
|
);
|
|
196
392
|
Card.displayName = "Card";
|
|
197
393
|
var CardHeader = React2.forwardRef(
|
|
198
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
394
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx3("div", { ref, className: cn("fractal-card-header", className), ...props })
|
|
199
395
|
);
|
|
200
396
|
CardHeader.displayName = "CardHeader";
|
|
201
397
|
var CardTitle = React2.forwardRef(
|
|
202
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
398
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx3("h3", { ref, className: cn("fractal-card-title", className), ...props })
|
|
203
399
|
);
|
|
204
400
|
CardTitle.displayName = "CardTitle";
|
|
205
401
|
var CardDescription = React2.forwardRef(
|
|
206
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
402
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx3("p", { ref, className: cn("fractal-card-description", className), ...props })
|
|
207
403
|
);
|
|
208
404
|
CardDescription.displayName = "CardDescription";
|
|
209
405
|
var CardContent = React2.forwardRef(
|
|
210
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
406
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx3("div", { ref, className: cn("fractal-card-content", className), ...props })
|
|
211
407
|
);
|
|
212
408
|
CardContent.displayName = "CardContent";
|
|
213
409
|
var CardFooter = React2.forwardRef(
|
|
214
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
410
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx3("div", { ref, className: cn("fractal-card-footer", className), ...props })
|
|
215
411
|
);
|
|
216
412
|
CardFooter.displayName = "CardFooter";
|
|
217
413
|
var FeatureCard = React2.forwardRef(
|
|
218
|
-
({ icon, title, description, className, ...props }, ref) => /* @__PURE__ */
|
|
219
|
-
icon && /* @__PURE__ */
|
|
220
|
-
/* @__PURE__ */
|
|
221
|
-
/* @__PURE__ */
|
|
414
|
+
({ icon, title, description, className, ...props }, ref) => /* @__PURE__ */ jsxs4("div", { ref, className: cn("fractal-feature-card", className), ...props, children: [
|
|
415
|
+
icon && /* @__PURE__ */ jsx3("div", { className: "fractal-feature-card__icon", children: icon }),
|
|
416
|
+
/* @__PURE__ */ jsx3("h3", { className: "fractal-feature-card__title", children: title }),
|
|
417
|
+
/* @__PURE__ */ jsx3("p", { className: "fractal-feature-card__description", children: description })
|
|
222
418
|
] })
|
|
223
419
|
);
|
|
224
420
|
FeatureCard.displayName = "FeatureCard";
|
|
225
421
|
var FolderCard = React2.forwardRef(
|
|
226
|
-
({ name, sessionCount, selected, className, onClick, ...props }, ref) => /* @__PURE__ */
|
|
422
|
+
({ name, sessionCount, selected, className, onClick, ...props }, ref) => /* @__PURE__ */ jsxs4(
|
|
227
423
|
"div",
|
|
228
424
|
{
|
|
229
425
|
ref,
|
|
@@ -239,11 +435,11 @@ var FolderCard = React2.forwardRef(
|
|
|
239
435
|
className: cn("fractal-folder-card", selected && "fractal-folder-card--selected", className),
|
|
240
436
|
...props,
|
|
241
437
|
children: [
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
/* @__PURE__ */
|
|
438
|
+
/* @__PURE__ */ jsxs4("div", { className: "fractal-folder-card__header", children: [
|
|
439
|
+
/* @__PURE__ */ jsx3(FolderIcon, { size: 16, className: "fractal-folder-card__icon", "aria-hidden": true }),
|
|
440
|
+
/* @__PURE__ */ jsx3("span", { className: "fractal-folder-card__name", children: name })
|
|
245
441
|
] }),
|
|
246
|
-
sessionCount !== void 0 && /* @__PURE__ */
|
|
442
|
+
sessionCount !== void 0 && /* @__PURE__ */ jsx3("div", { className: "fractal-folder-card__footer", children: /* @__PURE__ */ jsxs4("span", { className: "fractal-folder-card__sessions", children: [
|
|
247
443
|
sessionCount,
|
|
248
444
|
" ",
|
|
249
445
|
sessionCount === 1 ? "session" : "sessions"
|
|
@@ -256,7 +452,7 @@ FolderCard.displayName = "FolderCard";
|
|
|
256
452
|
|
|
257
453
|
// src/components/PromptCard/PromptCard.tsx
|
|
258
454
|
import * as React3 from "react";
|
|
259
|
-
import { jsx as
|
|
455
|
+
import { jsx as jsx4, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
260
456
|
var titleToPrompt = (title) => typeof title === "string" || typeof title === "number" ? String(title) : "";
|
|
261
457
|
var PromptCard = React3.forwardRef(
|
|
262
458
|
({
|
|
@@ -277,7 +473,7 @@ var PromptCard = React3.forwardRef(
|
|
|
277
473
|
onPromptSelect?.(prompt ?? titleToPrompt(title));
|
|
278
474
|
}
|
|
279
475
|
};
|
|
280
|
-
return /* @__PURE__ */
|
|
476
|
+
return /* @__PURE__ */ jsxs5(
|
|
281
477
|
"button",
|
|
282
478
|
{
|
|
283
479
|
ref,
|
|
@@ -292,8 +488,8 @@ var PromptCard = React3.forwardRef(
|
|
|
292
488
|
onClick: handleClick,
|
|
293
489
|
...props,
|
|
294
490
|
children: [
|
|
295
|
-
icon && /* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
491
|
+
icon && /* @__PURE__ */ jsx4("span", { className: "fractal-prompt-card__icon", "aria-hidden": "true", children: icon }),
|
|
492
|
+
/* @__PURE__ */ jsx4("span", { className: "fractal-prompt-card__title", children: title })
|
|
297
493
|
]
|
|
298
494
|
}
|
|
299
495
|
);
|
|
@@ -301,7 +497,7 @@ var PromptCard = React3.forwardRef(
|
|
|
301
497
|
);
|
|
302
498
|
PromptCard.displayName = "PromptCard";
|
|
303
499
|
var PromptGrid = React3.forwardRef(
|
|
304
|
-
({ compact, padded, className, ...props }, ref) => /* @__PURE__ */
|
|
500
|
+
({ compact, padded, className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
305
501
|
"div",
|
|
306
502
|
{
|
|
307
503
|
ref,
|
|
@@ -319,9 +515,9 @@ PromptGrid.displayName = "PromptGrid";
|
|
|
319
515
|
|
|
320
516
|
// src/components/Input/Input.tsx
|
|
321
517
|
import * as React4 from "react";
|
|
322
|
-
import { jsx as
|
|
518
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
323
519
|
var Input = React4.forwardRef(
|
|
324
|
-
({ className, type, ...props }, ref) => /* @__PURE__ */
|
|
520
|
+
({ className, type, ...props }, ref) => /* @__PURE__ */ jsx5(
|
|
325
521
|
"input",
|
|
326
522
|
{
|
|
327
523
|
type,
|
|
@@ -336,7 +532,7 @@ Input.displayName = "Input";
|
|
|
336
532
|
// src/components/NumberInput/NumberInput.tsx
|
|
337
533
|
import * as React5 from "react";
|
|
338
534
|
import { Minus, Plus } from "@mirror-physics/fractal-icons";
|
|
339
|
-
import { jsx as
|
|
535
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
340
536
|
function NumberInput({
|
|
341
537
|
unit,
|
|
342
538
|
className,
|
|
@@ -362,8 +558,8 @@ function NumberInput({
|
|
|
362
558
|
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
363
559
|
input.focus();
|
|
364
560
|
};
|
|
365
|
-
return /* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
561
|
+
return /* @__PURE__ */ jsxs6("div", { className: cn("fractal-number-input", unit && "fractal-number-input--with-unit", className), children: [
|
|
562
|
+
/* @__PURE__ */ jsx6(
|
|
367
563
|
Input,
|
|
368
564
|
{
|
|
369
565
|
ref: inputRef,
|
|
@@ -377,7 +573,7 @@ function NumberInput({
|
|
|
377
573
|
...props
|
|
378
574
|
}
|
|
379
575
|
),
|
|
380
|
-
unit && /* @__PURE__ */
|
|
576
|
+
unit && /* @__PURE__ */ jsx6(
|
|
381
577
|
"span",
|
|
382
578
|
{
|
|
383
579
|
className: "fractal-number-input-unit",
|
|
@@ -386,8 +582,8 @@ function NumberInput({
|
|
|
386
582
|
children: unit
|
|
387
583
|
}
|
|
388
584
|
),
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
-
/* @__PURE__ */
|
|
585
|
+
/* @__PURE__ */ jsxs6("div", { className: "fractal-number-input-controls", children: [
|
|
586
|
+
/* @__PURE__ */ jsx6(
|
|
391
587
|
"button",
|
|
392
588
|
{
|
|
393
589
|
type: "button",
|
|
@@ -395,10 +591,10 @@ function NumberInput({
|
|
|
395
591
|
"aria-label": `Decrease ${controlLabel}`,
|
|
396
592
|
disabled: decrementDisabled,
|
|
397
593
|
onClick: () => changeByStep(-1),
|
|
398
|
-
children: /* @__PURE__ */
|
|
594
|
+
children: /* @__PURE__ */ jsx6(Minus, { "aria-hidden": "true", size: 16 })
|
|
399
595
|
}
|
|
400
596
|
),
|
|
401
|
-
/* @__PURE__ */
|
|
597
|
+
/* @__PURE__ */ jsx6(
|
|
402
598
|
"button",
|
|
403
599
|
{
|
|
404
600
|
type: "button",
|
|
@@ -406,7 +602,7 @@ function NumberInput({
|
|
|
406
602
|
"aria-label": `Increase ${controlLabel}`,
|
|
407
603
|
disabled: incrementDisabled,
|
|
408
604
|
onClick: () => changeByStep(1),
|
|
409
|
-
children: /* @__PURE__ */
|
|
605
|
+
children: /* @__PURE__ */ jsx6(Plus, { "aria-hidden": "true", size: 16 })
|
|
410
606
|
}
|
|
411
607
|
)
|
|
412
608
|
] })
|
|
@@ -416,7 +612,7 @@ function NumberInput({
|
|
|
416
612
|
// src/components/PasswordInput/PasswordInput.tsx
|
|
417
613
|
import * as React6 from "react";
|
|
418
614
|
import { Eye, EyeSlash } from "@mirror-physics/fractal-icons";
|
|
419
|
-
import { jsx as
|
|
615
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
420
616
|
var PasswordInput = React6.forwardRef(
|
|
421
617
|
({
|
|
422
618
|
className,
|
|
@@ -427,13 +623,13 @@ var PasswordInput = React6.forwardRef(
|
|
|
427
623
|
}, ref) => {
|
|
428
624
|
const [passwordVisible, setPasswordVisible] = React6.useState(false);
|
|
429
625
|
const toggleLabel = passwordVisible ? hidePasswordLabel : showPasswordLabel;
|
|
430
|
-
return /* @__PURE__ */
|
|
626
|
+
return /* @__PURE__ */ jsxs7(
|
|
431
627
|
"div",
|
|
432
628
|
{
|
|
433
629
|
className: cn("fractal-password-input", className),
|
|
434
630
|
"data-password-visible": passwordVisible ? "" : void 0,
|
|
435
631
|
children: [
|
|
436
|
-
/* @__PURE__ */
|
|
632
|
+
/* @__PURE__ */ jsx7(
|
|
437
633
|
Input,
|
|
438
634
|
{
|
|
439
635
|
...props,
|
|
@@ -443,7 +639,7 @@ var PasswordInput = React6.forwardRef(
|
|
|
443
639
|
type: passwordVisible ? "text" : "password"
|
|
444
640
|
}
|
|
445
641
|
),
|
|
446
|
-
/* @__PURE__ */
|
|
642
|
+
/* @__PURE__ */ jsx7(
|
|
447
643
|
"button",
|
|
448
644
|
{
|
|
449
645
|
type: "button",
|
|
@@ -453,7 +649,7 @@ var PasswordInput = React6.forwardRef(
|
|
|
453
649
|
disabled,
|
|
454
650
|
title: toggleLabel,
|
|
455
651
|
onClick: () => setPasswordVisible((visible) => !visible),
|
|
456
|
-
children: passwordVisible ? /* @__PURE__ */
|
|
652
|
+
children: passwordVisible ? /* @__PURE__ */ jsx7(EyeSlash, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ jsx7(Eye, { "aria-hidden": "true", size: 18 })
|
|
457
653
|
}
|
|
458
654
|
)
|
|
459
655
|
]
|
|
@@ -465,9 +661,9 @@ PasswordInput.displayName = "PasswordInput";
|
|
|
465
661
|
|
|
466
662
|
// src/components/Label/Label.tsx
|
|
467
663
|
import * as React7 from "react";
|
|
468
|
-
import { jsx as
|
|
664
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
469
665
|
var Label = React7.forwardRef(
|
|
470
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
666
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
471
667
|
"label",
|
|
472
668
|
{
|
|
473
669
|
ref,
|
|
@@ -481,7 +677,7 @@ Label.displayName = "Label";
|
|
|
481
677
|
// src/components/Alert/Alert.tsx
|
|
482
678
|
import * as React8 from "react";
|
|
483
679
|
import { CircleCheck, CircleClose, CircleInfo, Warning } from "@mirror-physics/fractal-icons";
|
|
484
|
-
import { jsx as
|
|
680
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
485
681
|
var defaultIcons = {
|
|
486
682
|
default: CircleInfo,
|
|
487
683
|
info: CircleInfo,
|
|
@@ -492,7 +688,7 @@ var defaultIcons = {
|
|
|
492
688
|
var Alert = React8.forwardRef(
|
|
493
689
|
({ className, variant = "default", icon, children, ...props }, ref) => {
|
|
494
690
|
const DefaultIcon = defaultIcons[variant];
|
|
495
|
-
return /* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ jsxs8(
|
|
496
692
|
"div",
|
|
497
693
|
{
|
|
498
694
|
ref,
|
|
@@ -500,8 +696,8 @@ var Alert = React8.forwardRef(
|
|
|
500
696
|
className: cn("fractal-alert", `fractal-alert--${variant}`, className),
|
|
501
697
|
...props,
|
|
502
698
|
children: [
|
|
503
|
-
/* @__PURE__ */
|
|
504
|
-
/* @__PURE__ */
|
|
699
|
+
/* @__PURE__ */ jsx9("span", { className: "fractal-alert-icon", "aria-hidden": true, children: icon ?? /* @__PURE__ */ jsx9(DefaultIcon, { size: 18 }) }),
|
|
700
|
+
/* @__PURE__ */ jsx9("div", { className: "fractal-alert-content", children })
|
|
505
701
|
]
|
|
506
702
|
}
|
|
507
703
|
);
|
|
@@ -509,18 +705,18 @@ var Alert = React8.forwardRef(
|
|
|
509
705
|
);
|
|
510
706
|
Alert.displayName = "Alert";
|
|
511
707
|
var AlertTitle = React8.forwardRef(
|
|
512
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
708
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx9("h5", { ref, className: cn("fractal-alert-title", className), ...props })
|
|
513
709
|
);
|
|
514
710
|
AlertTitle.displayName = "AlertTitle";
|
|
515
711
|
var AlertDescription = React8.forwardRef(
|
|
516
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
712
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx9("div", { ref, className: cn("fractal-alert-description", className), ...props })
|
|
517
713
|
);
|
|
518
714
|
AlertDescription.displayName = "AlertDescription";
|
|
519
715
|
|
|
520
716
|
// src/components/Toggle/Toggle.tsx
|
|
521
|
-
import { jsx as
|
|
717
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
522
718
|
function Toggle({ checked, onChange, label, className }) {
|
|
523
|
-
return /* @__PURE__ */
|
|
719
|
+
return /* @__PURE__ */ jsxs9(
|
|
524
720
|
"button",
|
|
525
721
|
{
|
|
526
722
|
type: "button",
|
|
@@ -529,8 +725,8 @@ function Toggle({ checked, onChange, label, className }) {
|
|
|
529
725
|
className: cn("fractal-toggle", className),
|
|
530
726
|
onClick: () => onChange(!checked),
|
|
531
727
|
children: [
|
|
532
|
-
/* @__PURE__ */
|
|
533
|
-
label && /* @__PURE__ */
|
|
728
|
+
/* @__PURE__ */ jsx10("span", { className: cn("fractal-toggle-track", checked && "fractal-toggle-track--checked"), children: /* @__PURE__ */ jsx10("span", { className: cn("fractal-toggle-thumb", checked && "fractal-toggle-thumb--checked") }) }),
|
|
729
|
+
label && /* @__PURE__ */ jsx10("span", { className: "fractal-toggle-label", children: label })
|
|
534
730
|
]
|
|
535
731
|
}
|
|
536
732
|
);
|
|
@@ -540,7 +736,7 @@ function Toggle({ checked, onChange, label, className }) {
|
|
|
540
736
|
import { createPortal } from "react-dom";
|
|
541
737
|
|
|
542
738
|
// src/hooks/useEscapeDismiss.ts
|
|
543
|
-
import { useEffect, useRef as
|
|
739
|
+
import { useEffect as useEffect2, useRef as useRef3 } from "react";
|
|
544
740
|
var nextId = 0;
|
|
545
741
|
var stack = [];
|
|
546
742
|
function insertSorted(entry) {
|
|
@@ -573,9 +769,9 @@ function ensureGlobalListener() {
|
|
|
573
769
|
);
|
|
574
770
|
}
|
|
575
771
|
function useEscapeDismiss(priority, handler, enabled = true) {
|
|
576
|
-
const handlerRef =
|
|
772
|
+
const handlerRef = useRef3(handler);
|
|
577
773
|
handlerRef.current = handler;
|
|
578
|
-
|
|
774
|
+
useEffect2(() => {
|
|
579
775
|
if (!enabled) return;
|
|
580
776
|
ensureGlobalListener();
|
|
581
777
|
const id = nextId++;
|
|
@@ -591,7 +787,7 @@ function useEscapeDismiss(priority, handler, enabled = true) {
|
|
|
591
787
|
|
|
592
788
|
// src/components/UILoader/UILoader.tsx
|
|
593
789
|
import { useId } from "react";
|
|
594
|
-
import { jsx as
|
|
790
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
595
791
|
var LEFT = "M0 53C0 51 1.6 49.5 3.6 49.5h16.5c1 0 1.9.4 2.5 1L42.1 69.6c.7.7 1.1 1.6 1.1 2.5v16.2c0 2-1.6 3.5-3.6 3.5H23.1c-1 0-1.9-.4-2.5-1L1.1 71.7C.4 71 0 70.1 0 69.2V53Z";
|
|
596
792
|
var CENTER = "M0 3.5C0 1.6 1.6 0 3.6 0h16.5c1 0 1.9.4 2.5 1L92.5 69.6c.7.7 1 1.6 1 2.5v16.2c0 2-1.6 3.5-3.6 3.5H73.4c-1 0-1.9-.4-2.5-1L1.1 22.2C.4 21.6 0 20.7 0 19.7V3.5Z";
|
|
597
793
|
var RIGHT = "M50.4 3.5C50.4 1.6 52 0 54 0h16.5c1 0 1.9.4 2.5 1l69.8 68.6c.7.7 1.1 1.6 1.1 2.5v16.2c0 2-1.6 3.5-3.6 3.5h-16.5c-1 0-1.9-.4-2.5-1L51.4 22.2c-.7-.6-1-1.5-1-2.5V3.5Z";
|
|
@@ -600,7 +796,7 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
600
796
|
const clipId = `fractal-ui-loader-clip-${rawId}`;
|
|
601
797
|
const gradientId = `fractal-ui-loader-gradient-${rawId}`;
|
|
602
798
|
const height = typeof size === "number" ? `${size}px` : size;
|
|
603
|
-
return /* @__PURE__ */
|
|
799
|
+
return /* @__PURE__ */ jsx11(
|
|
604
800
|
"span",
|
|
605
801
|
{
|
|
606
802
|
"aria-hidden": ariaHidden || void 0,
|
|
@@ -608,52 +804,52 @@ function UILoader({ size = 48, tone = "neutral", className, style, label = "Load
|
|
|
608
804
|
className: cn("fractal-ui-loader", `fractal-ui-loader--${tone}`, className),
|
|
609
805
|
role: ariaHidden ? void 0 : "status",
|
|
610
806
|
style,
|
|
611
|
-
children: /* @__PURE__ */
|
|
612
|
-
/* @__PURE__ */
|
|
613
|
-
/* @__PURE__ */
|
|
614
|
-
/* @__PURE__ */
|
|
615
|
-
/* @__PURE__ */
|
|
807
|
+
children: /* @__PURE__ */ jsxs10("svg", { "aria-hidden": "true", fill: "none", viewBox: "0 0 144 92", style: { height, width: "auto" }, children: [
|
|
808
|
+
/* @__PURE__ */ jsxs10("defs", { children: [
|
|
809
|
+
/* @__PURE__ */ jsxs10("linearGradient", { id: gradientId, x1: "59", x2: "94.3", y1: "0", y2: "89.1", gradientUnits: "userSpaceOnUse", children: [
|
|
810
|
+
/* @__PURE__ */ jsx11("stop", { className: "fractal-ui-loader__stop-start", offset: "0" }),
|
|
811
|
+
/* @__PURE__ */ jsx11("stop", { className: "fractal-ui-loader__stop-end", offset: "1" })
|
|
616
812
|
] }),
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
/* @__PURE__ */
|
|
619
|
-
/* @__PURE__ */
|
|
620
|
-
/* @__PURE__ */
|
|
813
|
+
/* @__PURE__ */ jsxs10("linearGradient", { id: `${gradientId}-shine`, x1: "0", x2: "1", y1: "0", y2: "0", children: [
|
|
814
|
+
/* @__PURE__ */ jsx11("stop", { offset: "0.4", stopColor: "white", stopOpacity: "0" }),
|
|
815
|
+
/* @__PURE__ */ jsx11("stop", { offset: "0.5", stopColor: "white", stopOpacity: "0.62" }),
|
|
816
|
+
/* @__PURE__ */ jsx11("stop", { offset: "0.6", stopColor: "white", stopOpacity: "0" })
|
|
621
817
|
] }),
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
818
|
+
/* @__PURE__ */ jsxs10("clipPath", { id: clipId, children: [
|
|
819
|
+
/* @__PURE__ */ jsx11("path", { d: LEFT }),
|
|
820
|
+
/* @__PURE__ */ jsx11("path", { d: CENTER }),
|
|
821
|
+
/* @__PURE__ */ jsx11("path", { d: RIGHT })
|
|
626
822
|
] })
|
|
627
823
|
] }),
|
|
628
|
-
/* @__PURE__ */
|
|
629
|
-
/* @__PURE__ */
|
|
630
|
-
/* @__PURE__ */
|
|
631
|
-
/* @__PURE__ */
|
|
824
|
+
/* @__PURE__ */ jsx11("path", { d: CENTER, fill: `url(#${gradientId})` }),
|
|
825
|
+
/* @__PURE__ */ jsx11("path", { d: RIGHT, fill: `url(#${gradientId})` }),
|
|
826
|
+
/* @__PURE__ */ jsx11("path", { d: LEFT, fill: `url(#${gradientId})` }),
|
|
827
|
+
/* @__PURE__ */ jsx11("g", { clipPath: `url(#${clipId})`, children: /* @__PURE__ */ jsx11("g", { className: "fractal-ui-loader__shine-axis", transform: "translate(72 46) rotate(68.4)", children: /* @__PURE__ */ jsx11("rect", { className: "fractal-ui-loader__shine", x: "-160", y: "-100", width: "320", height: "200", fill: `url(#${gradientId}-shine)` }) }) })
|
|
632
828
|
] })
|
|
633
829
|
}
|
|
634
830
|
);
|
|
635
831
|
}
|
|
636
832
|
|
|
637
833
|
// src/components/Modal/Modal.tsx
|
|
638
|
-
import { jsx as
|
|
639
|
-
var CloseIcon = () => /* @__PURE__ */
|
|
834
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
835
|
+
var CloseIcon = () => /* @__PURE__ */ jsx12("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx12("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
640
836
|
function Modal({ open, onClose, title, children, danger, warn, footer, noClose, closeDisabled = false, size = "sm", loading = false, loadingLabel = "Loading", scrollable = false, className }) {
|
|
641
837
|
useEscapeDismiss(80, onClose, open && !noClose && !closeDisabled);
|
|
642
838
|
if (!open) return null;
|
|
643
839
|
const sizeClass = `fractal-modal-panel--${size}`;
|
|
644
840
|
const accentClass = danger ? "fractal-modal-panel--danger" : warn ? "fractal-modal-panel--warn" : "";
|
|
645
841
|
return createPortal(
|
|
646
|
-
/* @__PURE__ */
|
|
842
|
+
/* @__PURE__ */ jsx12("div", { className: "fractal-modal-overlay", onClick: noClose || closeDisabled ? void 0 : onClose, children: /* @__PURE__ */ jsxs11(
|
|
647
843
|
"div",
|
|
648
844
|
{
|
|
649
845
|
className: cn("fractal-modal-panel", sizeClass, accentClass, scrollable && "fractal-modal-panel--scrollable", className),
|
|
650
846
|
onClick: (e) => e.stopPropagation(),
|
|
651
847
|
children: [
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
!noClose && /* @__PURE__ */
|
|
848
|
+
/* @__PURE__ */ jsxs11("div", { className: "fractal-modal-title-row", children: [
|
|
849
|
+
/* @__PURE__ */ jsx12("h3", { className: cn("fractal-modal-title", danger && "fractal-modal-title--danger", warn && "fractal-modal-title--warn"), children: title }),
|
|
850
|
+
!noClose && /* @__PURE__ */ jsx12("button", { type: "button", onClick: onClose, title: "Close", disabled: closeDisabled, className: "fractal-modal-close", children: /* @__PURE__ */ jsx12(CloseIcon, {}) })
|
|
655
851
|
] }),
|
|
656
|
-
/* @__PURE__ */
|
|
852
|
+
/* @__PURE__ */ jsx12(
|
|
657
853
|
"div",
|
|
658
854
|
{
|
|
659
855
|
"aria-busy": loading || void 0,
|
|
@@ -663,10 +859,10 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
663
859
|
loading && "fractal-modal-body--loading",
|
|
664
860
|
scrollable && "fractal-modal-body--scrollable"
|
|
665
861
|
),
|
|
666
|
-
children: loading ? /* @__PURE__ */
|
|
862
|
+
children: loading ? /* @__PURE__ */ jsx12(UILoader, { label: loadingLabel }) : children
|
|
667
863
|
}
|
|
668
864
|
),
|
|
669
|
-
footer && /* @__PURE__ */
|
|
865
|
+
footer && /* @__PURE__ */ jsx12("div", { className: cn("fractal-modal-footer", scrollable && "fractal-modal-footer--divided"), children: footer })
|
|
670
866
|
]
|
|
671
867
|
}
|
|
672
868
|
) }),
|
|
@@ -675,17 +871,17 @@ function Modal({ open, onClose, title, children, danger, warn, footer, noClose,
|
|
|
675
871
|
}
|
|
676
872
|
|
|
677
873
|
// src/components/DataTable/DataTable.tsx
|
|
678
|
-
import { jsx as
|
|
874
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
679
875
|
function DataTable({ columns, data, emptyMessage, header, size = "md", className }) {
|
|
680
|
-
return /* @__PURE__ */
|
|
681
|
-
header && /* @__PURE__ */
|
|
682
|
-
data.length === 0 ? /* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
876
|
+
return /* @__PURE__ */ jsx13("div", { className: cn("fractal-datatable", `fractal-datatable--${size}`, className), children: /* @__PURE__ */ jsxs12("div", { className: "fractal-datatable-surface", children: [
|
|
877
|
+
header && /* @__PURE__ */ jsx13("div", { className: "fractal-datatable-header", children: header }),
|
|
878
|
+
data.length === 0 ? /* @__PURE__ */ jsx13("div", { className: "fractal-datatable-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ jsxs12("table", { className: "fractal-datatable-table", children: [
|
|
879
|
+
/* @__PURE__ */ jsx13("thead", { children: /* @__PURE__ */ jsx13("tr", { className: "fractal-datatable-thead-row", children: columns.map((col) => /* @__PURE__ */ jsx13("th", { className: "fractal-datatable-th", style: { width: col.width }, children: col.header }, col.key)) }) }),
|
|
880
|
+
/* @__PURE__ */ jsx13("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ jsx13(
|
|
685
881
|
"tr",
|
|
686
882
|
{
|
|
687
883
|
className: "fractal-datatable-row",
|
|
688
|
-
children: columns.map((col) => /* @__PURE__ */
|
|
884
|
+
children: columns.map((col) => /* @__PURE__ */ jsx13("td", { className: "fractal-datatable-td", style: { width: col.width }, children: col.render(row, rowIndex) }, col.key))
|
|
689
885
|
},
|
|
690
886
|
rowIndex
|
|
691
887
|
)) })
|
|
@@ -696,7 +892,7 @@ function DataTable({ columns, data, emptyMessage, header, size = "md", className
|
|
|
696
892
|
// src/components/Dropdown/Dropdown.tsx
|
|
697
893
|
import * as React9 from "react";
|
|
698
894
|
import { ChevronDown, ChevronUp } from "@mirror-physics/fractal-icons";
|
|
699
|
-
import { Fragment as Fragment2, jsx as
|
|
895
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
700
896
|
var MARGIN = 4;
|
|
701
897
|
function Dropdown({
|
|
702
898
|
items,
|
|
@@ -773,8 +969,8 @@ function Dropdown({
|
|
|
773
969
|
document.addEventListener("mousedown", handleClickOutside);
|
|
774
970
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
775
971
|
}, [open]);
|
|
776
|
-
return /* @__PURE__ */
|
|
777
|
-
/* @__PURE__ */
|
|
972
|
+
return /* @__PURE__ */ jsxs13("div", { className: cn("fractal-dropdown", className), children: [
|
|
973
|
+
/* @__PURE__ */ jsxs13(
|
|
778
974
|
"button",
|
|
779
975
|
{
|
|
780
976
|
ref: triggerRef,
|
|
@@ -792,15 +988,15 @@ function Dropdown({
|
|
|
792
988
|
triggerClassName
|
|
793
989
|
),
|
|
794
990
|
children: [
|
|
795
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */
|
|
796
|
-
selected.icon != null && /* @__PURE__ */
|
|
797
|
-
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */
|
|
991
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
992
|
+
selected.icon != null && /* @__PURE__ */ jsx14("span", { className: "fractal-dropdown-icon fractal-dropdown-icon--trigger", children: selected.icon }),
|
|
993
|
+
selected.description != null && (typeof selected.description !== "string" || selected.description !== "") && /* @__PURE__ */ jsx14("span", { className: "fractal-dropdown-selected-text", children: selected.description })
|
|
798
994
|
] }),
|
|
799
|
-
!noChevron && !iconOnly && /* @__PURE__ */
|
|
995
|
+
!noChevron && !iconOnly && /* @__PURE__ */ jsx14("span", { className: "fractal-dropdown-chevron", "aria-hidden": true, children: /* @__PURE__ */ jsx14(ChevronIcon, { size: size === "sm" ? 14 : 16 }) })
|
|
800
996
|
]
|
|
801
997
|
}
|
|
802
998
|
),
|
|
803
|
-
open && /* @__PURE__ */
|
|
999
|
+
open && /* @__PURE__ */ jsxs13(
|
|
804
1000
|
"div",
|
|
805
1001
|
{
|
|
806
1002
|
ref: panelRef,
|
|
@@ -809,21 +1005,21 @@ function Dropdown({
|
|
|
809
1005
|
className: cn("fractal-dropdown-panel", `fractal-dropdown-panel--${size}`, panelClassName),
|
|
810
1006
|
style: panelStyle,
|
|
811
1007
|
children: [
|
|
812
|
-
label != null && /* @__PURE__ */
|
|
1008
|
+
label != null && /* @__PURE__ */ jsx14("div", { className: "fractal-dropdown-label", children: label }),
|
|
813
1009
|
visibleItems.map((item, index) => {
|
|
814
|
-
const topDivider = item.border === "top" ? /* @__PURE__ */
|
|
815
|
-
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */
|
|
1010
|
+
const topDivider = item.border === "top" ? /* @__PURE__ */ jsx14("div", { className: "fractal-dropdown-separator" }) : null;
|
|
1011
|
+
const bottomDivider = item.border === "bottom" ? /* @__PURE__ */ jsx14("div", { className: "fractal-dropdown-separator" }) : null;
|
|
816
1012
|
if (item.kind === "header") {
|
|
817
|
-
return /* @__PURE__ */
|
|
1013
|
+
return /* @__PURE__ */ jsxs13(React9.Fragment, { children: [
|
|
818
1014
|
topDivider,
|
|
819
|
-
/* @__PURE__ */
|
|
1015
|
+
/* @__PURE__ */ jsx14("div", { role: "presentation", className: "fractal-dropdown-label", children: item.description }),
|
|
820
1016
|
bottomDivider
|
|
821
1017
|
] }, `header-${index}`);
|
|
822
1018
|
}
|
|
823
1019
|
const isSelected = item.value === selectedValue;
|
|
824
|
-
return /* @__PURE__ */
|
|
1020
|
+
return /* @__PURE__ */ jsxs13(React9.Fragment, { children: [
|
|
825
1021
|
topDivider,
|
|
826
|
-
/* @__PURE__ */
|
|
1022
|
+
/* @__PURE__ */ jsxs13(
|
|
827
1023
|
"button",
|
|
828
1024
|
{
|
|
829
1025
|
type: "button",
|
|
@@ -835,9 +1031,9 @@ function Dropdown({
|
|
|
835
1031
|
},
|
|
836
1032
|
className: "fractal-dropdown-option",
|
|
837
1033
|
children: [
|
|
838
|
-
item.icon != null && /* @__PURE__ */
|
|
839
|
-
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */
|
|
840
|
-
item.trailing != null && /* @__PURE__ */
|
|
1034
|
+
item.icon != null && /* @__PURE__ */ jsx14("span", { className: "fractal-dropdown-icon", children: item.icon }),
|
|
1035
|
+
item.description != null && (typeof item.description !== "string" || item.description !== "") && /* @__PURE__ */ jsx14("span", { className: "fractal-dropdown-option-text", children: item.description }),
|
|
1036
|
+
item.trailing != null && /* @__PURE__ */ jsx14("span", { className: "fractal-dropdown-trailing", children: item.trailing })
|
|
841
1037
|
]
|
|
842
1038
|
}
|
|
843
1039
|
),
|
|
@@ -852,9 +1048,9 @@ function Dropdown({
|
|
|
852
1048
|
|
|
853
1049
|
// src/components/Link/Link.tsx
|
|
854
1050
|
import * as React10 from "react";
|
|
855
|
-
import { jsx as
|
|
1051
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
856
1052
|
var Link = React10.forwardRef(
|
|
857
|
-
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */
|
|
1053
|
+
({ className, theme = "default", size = "md", ...props }, ref) => /* @__PURE__ */ jsx15(
|
|
858
1054
|
"a",
|
|
859
1055
|
{
|
|
860
1056
|
ref,
|
|
@@ -867,9 +1063,9 @@ Link.displayName = "Link";
|
|
|
867
1063
|
|
|
868
1064
|
// src/components/Chip/Chip.tsx
|
|
869
1065
|
import * as React11 from "react";
|
|
870
|
-
import { jsx as
|
|
1066
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
871
1067
|
var Chip = React11.forwardRef(
|
|
872
|
-
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */
|
|
1068
|
+
({ className, tone = "neutral", ...props }, ref) => /* @__PURE__ */ jsx16(
|
|
873
1069
|
"span",
|
|
874
1070
|
{
|
|
875
1071
|
ref,
|
|
@@ -882,7 +1078,7 @@ Chip.displayName = "Chip";
|
|
|
882
1078
|
|
|
883
1079
|
// src/components/Checkbox/Checkbox.tsx
|
|
884
1080
|
import { Checkbox as CheckboxIcon, CheckboxChecked, Minus as Minus2 } from "@mirror-physics/fractal-icons";
|
|
885
|
-
import { jsx as
|
|
1081
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
886
1082
|
function Checkbox({
|
|
887
1083
|
checked,
|
|
888
1084
|
indeterminate = false,
|
|
@@ -893,7 +1089,7 @@ function Checkbox({
|
|
|
893
1089
|
onKeyDown,
|
|
894
1090
|
...props
|
|
895
1091
|
}) {
|
|
896
|
-
return /* @__PURE__ */
|
|
1092
|
+
return /* @__PURE__ */ jsx17(
|
|
897
1093
|
"button",
|
|
898
1094
|
{
|
|
899
1095
|
...props,
|
|
@@ -915,18 +1111,18 @@ function Checkbox({
|
|
|
915
1111
|
onKeyDown?.(event);
|
|
916
1112
|
if (event.key === " " || event.key === "Enter") event.stopPropagation();
|
|
917
1113
|
},
|
|
918
|
-
children: indeterminate ? /* @__PURE__ */
|
|
919
|
-
/* @__PURE__ */
|
|
920
|
-
/* @__PURE__ */
|
|
921
|
-
] }) : checked ? /* @__PURE__ */
|
|
1114
|
+
children: indeterminate ? /* @__PURE__ */ jsxs14("span", { className: "fractal-checkbox__indeterminate-icon", "aria-hidden": "true", children: [
|
|
1115
|
+
/* @__PURE__ */ jsx17(CheckboxIcon, { size: 18 }),
|
|
1116
|
+
/* @__PURE__ */ jsx17(Minus2, { className: "fractal-checkbox__indeterminate-mark", size: 12 })
|
|
1117
|
+
] }) : checked ? /* @__PURE__ */ jsx17(CheckboxChecked, { "aria-hidden": "true", size: 18 }) : /* @__PURE__ */ jsx17(CheckboxIcon, { "aria-hidden": "true", size: 18 })
|
|
922
1118
|
}
|
|
923
1119
|
);
|
|
924
1120
|
}
|
|
925
1121
|
|
|
926
1122
|
// src/components/SortableTable/SortableTable.tsx
|
|
927
|
-
import { useMemo, useState as
|
|
1123
|
+
import { useMemo as useMemo2, useState as useState5 } from "react";
|
|
928
1124
|
import { ArrowUp, ArrowDown, ArrowsUpDown } from "@mirror-physics/fractal-icons";
|
|
929
|
-
import { jsx as
|
|
1125
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
930
1126
|
function SortableTable({
|
|
931
1127
|
columns,
|
|
932
1128
|
data,
|
|
@@ -945,8 +1141,8 @@ function SortableTable({
|
|
|
945
1141
|
onRowClick,
|
|
946
1142
|
rowAction
|
|
947
1143
|
}) {
|
|
948
|
-
const [internalKey, setInternalKey] =
|
|
949
|
-
const [internalDirection, setInternalDirection] =
|
|
1144
|
+
const [internalKey, setInternalKey] = useState5(defaultSortKey ?? null);
|
|
1145
|
+
const [internalDirection, setInternalDirection] = useState5(defaultSortDirection);
|
|
950
1146
|
const isControlled = controlledKey !== void 0 && controlledDirection !== void 0;
|
|
951
1147
|
const activeKey = isControlled ? controlledKey : internalKey;
|
|
952
1148
|
const activeDirection = isControlled ? controlledDirection : internalDirection;
|
|
@@ -954,7 +1150,7 @@ function SortableTable({
|
|
|
954
1150
|
const baselineDirection = defaultSort?.direction ?? null;
|
|
955
1151
|
const effectiveKey = activeKey && activeDirection ? activeKey : baselineKey;
|
|
956
1152
|
const effectiveDirection = activeKey && activeDirection ? activeDirection : baselineDirection;
|
|
957
|
-
const sorted =
|
|
1153
|
+
const sorted = useMemo2(() => {
|
|
958
1154
|
if (!effectiveKey || !effectiveDirection) return data;
|
|
959
1155
|
const col = columns.find((c) => c.key === effectiveKey);
|
|
960
1156
|
if (!col) return data;
|
|
@@ -1002,13 +1198,13 @@ function SortableTable({
|
|
|
1002
1198
|
onSortChange?.(nextKey, nextDirection);
|
|
1003
1199
|
}
|
|
1004
1200
|
};
|
|
1005
|
-
return /* @__PURE__ */
|
|
1006
|
-
header && /* @__PURE__ */
|
|
1007
|
-
sorted.length === 0 ? /* @__PURE__ */
|
|
1008
|
-
/* @__PURE__ */
|
|
1201
|
+
return /* @__PURE__ */ jsx18("div", { className: cn("fractal-sortable-table", `fractal-sortable-table--${size}`, embedded && "fractal-sortable-table--embedded", className), children: /* @__PURE__ */ jsxs15("div", { className: "fractal-sortable-table-surface", children: [
|
|
1202
|
+
header && /* @__PURE__ */ jsx18("div", { className: "fractal-sortable-table-header", children: header }),
|
|
1203
|
+
sorted.length === 0 ? /* @__PURE__ */ jsx18("div", { className: "fractal-sortable-table-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ jsxs15("table", { className: "fractal-sortable-table-table", children: [
|
|
1204
|
+
/* @__PURE__ */ jsx18("thead", { children: /* @__PURE__ */ jsx18("tr", { className: "fractal-sortable-table-thead-row", children: columns.map((col) => {
|
|
1009
1205
|
const isActive = activeKey === col.key && activeDirection !== null;
|
|
1010
1206
|
if (!col.sortable) {
|
|
1011
|
-
return /* @__PURE__ */
|
|
1207
|
+
return /* @__PURE__ */ jsx18(
|
|
1012
1208
|
"th",
|
|
1013
1209
|
{
|
|
1014
1210
|
className: "fractal-sortable-table-th",
|
|
@@ -1018,12 +1214,12 @@ function SortableTable({
|
|
|
1018
1214
|
col.key
|
|
1019
1215
|
);
|
|
1020
1216
|
}
|
|
1021
|
-
return /* @__PURE__ */
|
|
1217
|
+
return /* @__PURE__ */ jsx18(
|
|
1022
1218
|
"th",
|
|
1023
1219
|
{
|
|
1024
1220
|
className: "fractal-sortable-table-th fractal-sortable-table-th--sortable",
|
|
1025
1221
|
style: { width: col.width },
|
|
1026
|
-
children: /* @__PURE__ */
|
|
1222
|
+
children: /* @__PURE__ */ jsxs15(
|
|
1027
1223
|
"button",
|
|
1028
1224
|
{
|
|
1029
1225
|
type: "button",
|
|
@@ -1034,8 +1230,8 @@ function SortableTable({
|
|
|
1034
1230
|
onClick: () => handleSortClick(col.key),
|
|
1035
1231
|
"aria-sort": isActive ? activeDirection === "asc" ? "ascending" : "descending" : "none",
|
|
1036
1232
|
children: [
|
|
1037
|
-
/* @__PURE__ */
|
|
1038
|
-
/* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ jsx18("span", { children: col.header }),
|
|
1234
|
+
/* @__PURE__ */ jsx18("span", { className: "fractal-sortable-table-sort-icon", "aria-hidden": "true", children: isActive && activeDirection === "asc" ? /* @__PURE__ */ jsx18(ArrowUp, { size: 14 }) : isActive && activeDirection === "desc" ? /* @__PURE__ */ jsx18(ArrowDown, { size: 14 }) : /* @__PURE__ */ jsx18(ArrowsUpDown, { size: 14 }) })
|
|
1039
1235
|
]
|
|
1040
1236
|
}
|
|
1041
1237
|
)
|
|
@@ -1043,13 +1239,13 @@ function SortableTable({
|
|
|
1043
1239
|
col.key
|
|
1044
1240
|
);
|
|
1045
1241
|
}) }) }),
|
|
1046
|
-
/* @__PURE__ */
|
|
1242
|
+
/* @__PURE__ */ jsx18("tbody", { children: sorted.map((row, rowIndex) => {
|
|
1047
1243
|
const highlighted = highlightRow?.(row, rowIndex) ?? false;
|
|
1048
1244
|
const action = rowAction ? {
|
|
1049
1245
|
label: rowAction.label(row, rowIndex),
|
|
1050
1246
|
icon: rowAction.icon(row, rowIndex)
|
|
1051
1247
|
} : null;
|
|
1052
|
-
return /* @__PURE__ */
|
|
1248
|
+
return /* @__PURE__ */ jsx18(
|
|
1053
1249
|
"tr",
|
|
1054
1250
|
{
|
|
1055
1251
|
className: cn(
|
|
@@ -1067,7 +1263,7 @@ function SortableTable({
|
|
|
1067
1263
|
"aria-label": action?.label,
|
|
1068
1264
|
role: onRowClick ? "button" : void 0,
|
|
1069
1265
|
tabIndex: onRowClick ? 0 : void 0,
|
|
1070
|
-
children: columns.map((col, columnIndex) => /* @__PURE__ */
|
|
1266
|
+
children: columns.map((col, columnIndex) => /* @__PURE__ */ jsxs15(
|
|
1071
1267
|
"td",
|
|
1072
1268
|
{
|
|
1073
1269
|
className: cn(
|
|
@@ -1077,7 +1273,7 @@ function SortableTable({
|
|
|
1077
1273
|
style: { width: col.width, textAlign: col.align ?? "left" },
|
|
1078
1274
|
children: [
|
|
1079
1275
|
col.render(row, rowIndex),
|
|
1080
|
-
action && columnIndex === columns.length - 1 && /* @__PURE__ */
|
|
1276
|
+
action && columnIndex === columns.length - 1 && /* @__PURE__ */ jsx18("span", { className: "fractal-sortable-table-row-action", "aria-hidden": "true", children: /* @__PURE__ */ jsx18("span", { className: "fractal-sortable-table-row-action__icon", children: action.icon }) })
|
|
1081
1277
|
]
|
|
1082
1278
|
},
|
|
1083
1279
|
col.key
|
|
@@ -1091,8 +1287,8 @@ function SortableTable({
|
|
|
1091
1287
|
}
|
|
1092
1288
|
|
|
1093
1289
|
// src/components/Tabs/Tabs.tsx
|
|
1094
|
-
import { useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as
|
|
1095
|
-
import { jsx as
|
|
1290
|
+
import { useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState6 } from "react";
|
|
1291
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1096
1292
|
function Tabs({
|
|
1097
1293
|
items,
|
|
1098
1294
|
defaultValue,
|
|
@@ -1104,14 +1300,14 @@ function Tabs({
|
|
|
1104
1300
|
variant = "line"
|
|
1105
1301
|
}) {
|
|
1106
1302
|
const reactId = useId2();
|
|
1107
|
-
const [internalValue, setInternalValue] =
|
|
1303
|
+
const [internalValue, setInternalValue] = useState6(
|
|
1108
1304
|
defaultValue ?? items.find((i) => !i.disabled)?.id ?? items[0]?.id ?? ""
|
|
1109
1305
|
);
|
|
1110
1306
|
const isControlled = controlledValue !== void 0;
|
|
1111
1307
|
const activeId = isControlled ? controlledValue : internalValue;
|
|
1112
|
-
const tabListRef =
|
|
1113
|
-
const tabRefs =
|
|
1114
|
-
const [indicator, setIndicator] =
|
|
1308
|
+
const tabListRef = useRef5(null);
|
|
1309
|
+
const tabRefs = useRef5({});
|
|
1310
|
+
const [indicator, setIndicator] = useState6(null);
|
|
1115
1311
|
useLayoutEffect2(() => {
|
|
1116
1312
|
const updateIndicator = () => {
|
|
1117
1313
|
const activeTab = tabRefs.current[activeId];
|
|
@@ -1163,8 +1359,8 @@ function Tabs({
|
|
|
1163
1359
|
selectTab(nextId2);
|
|
1164
1360
|
requestAnimationFrame(() => tabRefs.current[nextId2]?.focus());
|
|
1165
1361
|
};
|
|
1166
|
-
return /* @__PURE__ */
|
|
1167
|
-
/* @__PURE__ */
|
|
1362
|
+
return /* @__PURE__ */ jsxs16("div", { className: cn("fractal-tabs", `fractal-tabs--${variant}`, divider && "fractal-tabs--divider", className), children: [
|
|
1363
|
+
/* @__PURE__ */ jsx19(
|
|
1168
1364
|
"div",
|
|
1169
1365
|
{
|
|
1170
1366
|
ref: tabListRef,
|
|
@@ -1177,7 +1373,7 @@ function Tabs({
|
|
|
1177
1373
|
const isActive = item.id === activeId;
|
|
1178
1374
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1179
1375
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1180
|
-
return /* @__PURE__ */
|
|
1376
|
+
return /* @__PURE__ */ jsx19(
|
|
1181
1377
|
"button",
|
|
1182
1378
|
{
|
|
1183
1379
|
ref: (el) => {
|
|
@@ -1208,7 +1404,7 @@ function Tabs({
|
|
|
1208
1404
|
const tabId = `${reactId}-tab-${item.id}`;
|
|
1209
1405
|
const panelId = `${reactId}-panel-${item.id}`;
|
|
1210
1406
|
const isActive = item.id === activeId;
|
|
1211
|
-
return /* @__PURE__ */
|
|
1407
|
+
return /* @__PURE__ */ jsx19(
|
|
1212
1408
|
"div",
|
|
1213
1409
|
{
|
|
1214
1410
|
id: panelId,
|
|
@@ -1226,7 +1422,7 @@ function Tabs({
|
|
|
1226
1422
|
|
|
1227
1423
|
// src/components/ContentSwitcher/ContentSwitcher.tsx
|
|
1228
1424
|
import * as React12 from "react";
|
|
1229
|
-
import { jsx as
|
|
1425
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1230
1426
|
function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = false, className }) {
|
|
1231
1427
|
const switcherRef = React12.useRef(null);
|
|
1232
1428
|
const buttonRefs = React12.useRef([]);
|
|
@@ -1284,7 +1480,7 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1284
1480
|
onValueChange(items[nextIndex].value);
|
|
1285
1481
|
}
|
|
1286
1482
|
};
|
|
1287
|
-
return /* @__PURE__ */
|
|
1483
|
+
return /* @__PURE__ */ jsxs17(
|
|
1288
1484
|
"div",
|
|
1289
1485
|
{
|
|
1290
1486
|
className: cn("fractal-content-switcher", fullWidth && "fractal-content-switcher--full-width", className),
|
|
@@ -1292,10 +1488,10 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1292
1488
|
"aria-label": ariaLabel,
|
|
1293
1489
|
ref: switcherRef,
|
|
1294
1490
|
children: [
|
|
1295
|
-
/* @__PURE__ */
|
|
1491
|
+
/* @__PURE__ */ jsx20("span", { className: "fractal-content-switcher__indicator", "aria-hidden": true }),
|
|
1296
1492
|
items.map((item, index) => {
|
|
1297
1493
|
const active = item.value === value;
|
|
1298
|
-
return /* @__PURE__ */
|
|
1494
|
+
return /* @__PURE__ */ jsx20(
|
|
1299
1495
|
"button",
|
|
1300
1496
|
{
|
|
1301
1497
|
className: cn("fractal-content-switcher__item", active && "fractal-content-switcher__item--active"),
|
|
@@ -1327,9 +1523,9 @@ function ContentSwitcher({ items, value, onValueChange, ariaLabel, fullWidth = f
|
|
|
1327
1523
|
}
|
|
1328
1524
|
|
|
1329
1525
|
// src/components/Disclosure/Disclosure.tsx
|
|
1330
|
-
import { useId as useId3, useState as
|
|
1526
|
+
import { useId as useId3, useState as useState7 } from "react";
|
|
1331
1527
|
import { ChevronRight as ChevronRight2, ChevronDown as ChevronDown2 } from "@mirror-physics/fractal-icons";
|
|
1332
|
-
import { jsx as
|
|
1528
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1333
1529
|
function Disclosure({
|
|
1334
1530
|
title,
|
|
1335
1531
|
meta,
|
|
@@ -1344,7 +1540,7 @@ function Disclosure({
|
|
|
1344
1540
|
const reactId = useId3();
|
|
1345
1541
|
const headerId = `${reactId}-header`;
|
|
1346
1542
|
const panelId = `${reactId}-panel`;
|
|
1347
|
-
const [internalOpen, setInternalOpen] =
|
|
1543
|
+
const [internalOpen, setInternalOpen] = useState7(defaultOpen);
|
|
1348
1544
|
const isControlled = controlledOpen !== void 0;
|
|
1349
1545
|
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
1350
1546
|
const toggle = () => {
|
|
@@ -1357,7 +1553,7 @@ function Disclosure({
|
|
|
1357
1553
|
onOpenChange?.(next);
|
|
1358
1554
|
}
|
|
1359
1555
|
};
|
|
1360
|
-
return /* @__PURE__ */
|
|
1556
|
+
return /* @__PURE__ */ jsxs18(
|
|
1361
1557
|
"div",
|
|
1362
1558
|
{
|
|
1363
1559
|
className: cn(
|
|
@@ -1368,7 +1564,7 @@ function Disclosure({
|
|
|
1368
1564
|
className
|
|
1369
1565
|
),
|
|
1370
1566
|
children: [
|
|
1371
|
-
/* @__PURE__ */
|
|
1567
|
+
/* @__PURE__ */ jsxs18(
|
|
1372
1568
|
"button",
|
|
1373
1569
|
{
|
|
1374
1570
|
type: "button",
|
|
@@ -1379,13 +1575,13 @@ function Disclosure({
|
|
|
1379
1575
|
disabled,
|
|
1380
1576
|
onClick: toggle,
|
|
1381
1577
|
children: [
|
|
1382
|
-
/* @__PURE__ */
|
|
1383
|
-
/* @__PURE__ */
|
|
1384
|
-
meta && /* @__PURE__ */
|
|
1578
|
+
/* @__PURE__ */ jsx21("span", { className: "fractal-disclosure-icon", "aria-hidden": "true", children: isOpen ? /* @__PURE__ */ jsx21(ChevronDown2, { size: 16 }) : /* @__PURE__ */ jsx21(ChevronRight2, { size: 16 }) }),
|
|
1579
|
+
/* @__PURE__ */ jsx21("span", { className: "fractal-disclosure-title", children: title }),
|
|
1580
|
+
meta && /* @__PURE__ */ jsx21("span", { className: "fractal-disclosure-meta", children: meta })
|
|
1385
1581
|
]
|
|
1386
1582
|
}
|
|
1387
1583
|
),
|
|
1388
|
-
/* @__PURE__ */
|
|
1584
|
+
/* @__PURE__ */ jsx21(
|
|
1389
1585
|
"div",
|
|
1390
1586
|
{
|
|
1391
1587
|
id: panelId,
|
|
@@ -1393,7 +1589,7 @@ function Disclosure({
|
|
|
1393
1589
|
"aria-labelledby": headerId,
|
|
1394
1590
|
className: "fractal-disclosure-panel",
|
|
1395
1591
|
hidden: !isOpen,
|
|
1396
|
-
children: /* @__PURE__ */
|
|
1592
|
+
children: /* @__PURE__ */ jsx21("div", { className: "fractal-disclosure-panel-inner", children })
|
|
1397
1593
|
}
|
|
1398
1594
|
)
|
|
1399
1595
|
]
|
|
@@ -1402,18 +1598,18 @@ function Disclosure({
|
|
|
1402
1598
|
}
|
|
1403
1599
|
|
|
1404
1600
|
// src/components/LatticeLoader/LatticeLoader.tsx
|
|
1405
|
-
import { jsx as
|
|
1601
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1406
1602
|
var LATTICE_COUNT = 160;
|
|
1407
1603
|
var WAVE_PERIOD = 80;
|
|
1408
1604
|
function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
1409
|
-
return /* @__PURE__ */
|
|
1605
|
+
return /* @__PURE__ */ jsx22(
|
|
1410
1606
|
"span",
|
|
1411
1607
|
{
|
|
1412
1608
|
"aria-label": label,
|
|
1413
1609
|
className: cn("fractal-lattice-loader", className),
|
|
1414
1610
|
role: "progressbar",
|
|
1415
1611
|
...props,
|
|
1416
|
-
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */
|
|
1612
|
+
children: Array.from({ length: LATTICE_COUNT }, (_, index) => /* @__PURE__ */ jsx22(
|
|
1417
1613
|
"span",
|
|
1418
1614
|
{
|
|
1419
1615
|
"aria-hidden": "true",
|
|
@@ -1427,10 +1623,10 @@ function LatticeLoader({ className, label = "Loading", ...props }) {
|
|
|
1427
1623
|
}
|
|
1428
1624
|
|
|
1429
1625
|
// src/components/Ghost/Ghost.tsx
|
|
1430
|
-
import { jsx as
|
|
1626
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1431
1627
|
var toCssLength = (value) => typeof value === "number" ? `${value}px` : value;
|
|
1432
1628
|
function Ghost({ className, width, height, radius, style, ...props }) {
|
|
1433
|
-
return /* @__PURE__ */
|
|
1629
|
+
return /* @__PURE__ */ jsx23(
|
|
1434
1630
|
"div",
|
|
1435
1631
|
{
|
|
1436
1632
|
"aria-hidden": "true",
|
|
@@ -1446,15 +1642,15 @@ function Ghost({ className, width, height, radius, style, ...props }) {
|
|
|
1446
1642
|
);
|
|
1447
1643
|
}
|
|
1448
1644
|
function GhostLine({ className, size = "md", width = "100%", ...props }) {
|
|
1449
|
-
return /* @__PURE__ */
|
|
1645
|
+
return /* @__PURE__ */ jsx23(Ghost, { className: cn("fractal-ghost-line", `fractal-ghost-line--${size}`, className), width, ...props });
|
|
1450
1646
|
}
|
|
1451
1647
|
function ButtonGhost({ className, size = "md", iconOnly = false, width, ...props }) {
|
|
1452
|
-
return /* @__PURE__ */
|
|
1648
|
+
return /* @__PURE__ */ jsx23(Ghost, { className: cn("fractal-ghost-button", `fractal-ghost-button--${size}`, iconOnly && "fractal-ghost-button--icon-only", className), width, ...props });
|
|
1453
1649
|
}
|
|
1454
1650
|
function CardGhost({ className, lines = 3, showHeader = true, ...props }) {
|
|
1455
|
-
return /* @__PURE__ */
|
|
1456
|
-
showHeader && /* @__PURE__ */
|
|
1457
|
-
/* @__PURE__ */
|
|
1651
|
+
return /* @__PURE__ */ jsxs19("div", { "aria-hidden": "true", className: cn("fractal-ghost-card", className), ...props, children: [
|
|
1652
|
+
showHeader && /* @__PURE__ */ jsx23(GhostLine, { width: "38%" }),
|
|
1653
|
+
/* @__PURE__ */ jsx23("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx23(GhostLine, { width: index === lines - 1 ? "62%" : "100%" }, index)) })
|
|
1458
1654
|
] });
|
|
1459
1655
|
}
|
|
1460
1656
|
function DataTableGhost({
|
|
@@ -1468,81 +1664,81 @@ function DataTableGhost({
|
|
|
1468
1664
|
...props
|
|
1469
1665
|
}) {
|
|
1470
1666
|
const cells = Array.from({ length: columns }, (_, index) => index);
|
|
1471
|
-
return /* @__PURE__ */
|
|
1472
|
-
(showHeader || headers) && /* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1667
|
+
return /* @__PURE__ */ jsx23("div", { "aria-busy": "true", "aria-label": "Loading table", className: cn("fractal-ghost-table", `fractal-ghost-table--${size}`, className), role: "status", ...props, children: /* @__PURE__ */ jsxs19("table", { className: "fractal-ghost-table__table", children: [
|
|
1668
|
+
(showHeader || headers) && /* @__PURE__ */ jsx23("thead", { children: /* @__PURE__ */ jsx23("tr", { className: "fractal-ghost-table__head-row", children: cells.map((index) => /* @__PURE__ */ jsx23("th", { style: { width: columnWidths?.[index] }, children: headers?.[index] ?? /* @__PURE__ */ jsx23(GhostLine, { size: "sm", width: index === columns - 1 ? "62%" : "76%" }) }, index)) }) }),
|
|
1669
|
+
/* @__PURE__ */ jsx23("tbody", { children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ jsx23("tr", { className: "fractal-ghost-table__row", children: cells.map((columnIndex) => /* @__PURE__ */ jsx23("td", { style: { width: columnWidths?.[columnIndex] }, children: /* @__PURE__ */ jsx23(GhostLine, { width: `${[72, 54, 82, 63, 46][(rowIndex + columnIndex) % 5]}%` }) }, columnIndex)) }, rowIndex)) })
|
|
1474
1670
|
] }) });
|
|
1475
1671
|
}
|
|
1476
1672
|
function InputGhost({ className, labelWidth = "26%", ...props }) {
|
|
1477
|
-
return /* @__PURE__ */
|
|
1673
|
+
return /* @__PURE__ */ jsx23(FormFieldGhost, { className, labelWidth, ...props });
|
|
1478
1674
|
}
|
|
1479
1675
|
function TextareaGhost({ className, labelWidth = "26%", ...props }) {
|
|
1480
|
-
return /* @__PURE__ */
|
|
1676
|
+
return /* @__PURE__ */ jsx23(FormFieldGhost, { className, labelWidth, multiline: true, ...props });
|
|
1481
1677
|
}
|
|
1482
1678
|
function LabelGhost({ className, width = "26%", ...props }) {
|
|
1483
|
-
return /* @__PURE__ */
|
|
1679
|
+
return /* @__PURE__ */ jsx23(GhostLine, { className: cn("fractal-ghost-label", className), size: "sm", width, ...props });
|
|
1484
1680
|
}
|
|
1485
1681
|
function FormFieldGhost({ className, labelWidth = "26%", multiline = false, ...props }) {
|
|
1486
|
-
return /* @__PURE__ */
|
|
1487
|
-
/* @__PURE__ */
|
|
1488
|
-
/* @__PURE__ */
|
|
1682
|
+
return /* @__PURE__ */ jsxs19("div", { "aria-hidden": "true", className: cn("fractal-ghost-field", className), ...props, children: [
|
|
1683
|
+
/* @__PURE__ */ jsx23(LabelGhost, { width: labelWidth }),
|
|
1684
|
+
/* @__PURE__ */ jsx23(Ghost, { className: cn("fractal-ghost-field__control", multiline && "fractal-ghost-field__control--multiline") })
|
|
1489
1685
|
] });
|
|
1490
1686
|
}
|
|
1491
1687
|
function AlertGhost({ className, ...props }) {
|
|
1492
|
-
return /* @__PURE__ */
|
|
1493
|
-
/* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1688
|
+
return /* @__PURE__ */ jsxs19("div", { "aria-hidden": "true", className: cn("fractal-ghost-alert", className), ...props, children: [
|
|
1689
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "30%" }),
|
|
1690
|
+
/* @__PURE__ */ jsx23(GhostLine, { size: "sm", width: "78%" })
|
|
1495
1691
|
] });
|
|
1496
1692
|
}
|
|
1497
1693
|
function CheckboxGhost({ className, ...props }) {
|
|
1498
|
-
return /* @__PURE__ */
|
|
1499
|
-
/* @__PURE__ */
|
|
1500
|
-
/* @__PURE__ */
|
|
1694
|
+
return /* @__PURE__ */ jsxs19("div", { "aria-hidden": "true", className: cn("fractal-ghost-choice", className), ...props, children: [
|
|
1695
|
+
/* @__PURE__ */ jsx23(Ghost, { className: "fractal-ghost-choice__control" }),
|
|
1696
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "42%" })
|
|
1501
1697
|
] });
|
|
1502
1698
|
}
|
|
1503
1699
|
var ToggleGhost = CheckboxGhost;
|
|
1504
1700
|
function ChipGhost({ className, width = 74, ...props }) {
|
|
1505
|
-
return /* @__PURE__ */
|
|
1701
|
+
return /* @__PURE__ */ jsx23(Ghost, { className: cn("fractal-ghost-chip", className), height: 24, width, ...props });
|
|
1506
1702
|
}
|
|
1507
1703
|
function LinkGhost({ className, width = 96, ...props }) {
|
|
1508
|
-
return /* @__PURE__ */
|
|
1704
|
+
return /* @__PURE__ */ jsx23(GhostLine, { className: cn("fractal-ghost-link", className), size: "sm", width, ...props });
|
|
1509
1705
|
}
|
|
1510
1706
|
var TextButtonGhost = LinkGhost;
|
|
1511
1707
|
function DropdownGhost({ className, ...props }) {
|
|
1512
|
-
return /* @__PURE__ */
|
|
1513
|
-
/* @__PURE__ */
|
|
1514
|
-
/* @__PURE__ */
|
|
1708
|
+
return /* @__PURE__ */ jsxs19("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropdown", className), ...props, children: [
|
|
1709
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "38%" }),
|
|
1710
|
+
/* @__PURE__ */ jsx23(Ghost, { className: "fractal-ghost-dropdown__chevron" })
|
|
1515
1711
|
] });
|
|
1516
1712
|
}
|
|
1517
1713
|
function ContentSwitcherGhost({ className, options = 3, ...props }) {
|
|
1518
|
-
return /* @__PURE__ */
|
|
1714
|
+
return /* @__PURE__ */ jsx23("div", { "aria-hidden": "true", className: cn("fractal-ghost-switcher", className), ...props, children: Array.from({ length: options }, (_, index) => /* @__PURE__ */ jsx23(Ghost, {}, index)) });
|
|
1519
1715
|
}
|
|
1520
1716
|
var TabsGhost = ContentSwitcherGhost;
|
|
1521
1717
|
function DisclosureGhost({ className, ...props }) {
|
|
1522
|
-
return /* @__PURE__ */
|
|
1523
|
-
/* @__PURE__ */
|
|
1524
|
-
/* @__PURE__ */
|
|
1718
|
+
return /* @__PURE__ */ jsxs19("div", { "aria-hidden": "true", className: cn("fractal-ghost-disclosure", className), ...props, children: [
|
|
1719
|
+
/* @__PURE__ */ jsx23(Ghost, { className: "fractal-ghost-disclosure__icon" }),
|
|
1720
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "42%" })
|
|
1525
1721
|
] });
|
|
1526
1722
|
}
|
|
1527
1723
|
function PaginationGhost({ className, pages = 5, ...props }) {
|
|
1528
|
-
return /* @__PURE__ */
|
|
1724
|
+
return /* @__PURE__ */ jsx23("div", { "aria-hidden": "true", className: cn("fractal-ghost-pagination", className), ...props, children: Array.from({ length: pages }, (_, index) => /* @__PURE__ */ jsx23(Ghost, {}, index)) });
|
|
1529
1725
|
}
|
|
1530
1726
|
function FileDropzoneGhost({ className, ...props }) {
|
|
1531
|
-
return /* @__PURE__ */
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1727
|
+
return /* @__PURE__ */ jsxs19("div", { "aria-hidden": "true", className: cn("fractal-ghost-dropzone", className), ...props, children: [
|
|
1728
|
+
/* @__PURE__ */ jsx23(Ghost, { className: "fractal-ghost-dropzone__icon" }),
|
|
1729
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "26%" }),
|
|
1730
|
+
/* @__PURE__ */ jsx23(GhostLine, { size: "sm", width: "46%" })
|
|
1535
1731
|
] });
|
|
1536
1732
|
}
|
|
1537
1733
|
function PromptCardGhost({ className, ...props }) {
|
|
1538
|
-
return /* @__PURE__ */
|
|
1734
|
+
return /* @__PURE__ */ jsx23(CardGhost, { className: cn("fractal-ghost-prompt-card", className), lines: 4, ...props });
|
|
1539
1735
|
}
|
|
1540
1736
|
function ConversationGhost({
|
|
1541
1737
|
className,
|
|
1542
1738
|
"aria-label": ariaLabel = "Loading conversation",
|
|
1543
1739
|
...props
|
|
1544
1740
|
}) {
|
|
1545
|
-
return /* @__PURE__ */
|
|
1741
|
+
return /* @__PURE__ */ jsxs19(
|
|
1546
1742
|
"div",
|
|
1547
1743
|
{
|
|
1548
1744
|
"aria-busy": "true",
|
|
@@ -1551,54 +1747,54 @@ function ConversationGhost({
|
|
|
1551
1747
|
role: "status",
|
|
1552
1748
|
...props,
|
|
1553
1749
|
children: [
|
|
1554
|
-
/* @__PURE__ */
|
|
1555
|
-
/* @__PURE__ */
|
|
1556
|
-
/* @__PURE__ */
|
|
1557
|
-
/* @__PURE__ */
|
|
1750
|
+
/* @__PURE__ */ jsx23("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--user", children: /* @__PURE__ */ jsxs19("div", { className: "fractal-ghost-conversation__bubble", children: [
|
|
1751
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "100%" }),
|
|
1752
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "86%" }),
|
|
1753
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "64%" })
|
|
1558
1754
|
] }) }),
|
|
1559
|
-
/* @__PURE__ */
|
|
1560
|
-
/* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */
|
|
1562
|
-
/* @__PURE__ */
|
|
1755
|
+
/* @__PURE__ */ jsxs19("div", { "aria-hidden": "true", className: "fractal-ghost-conversation__message fractal-ghost-conversation__message--assistant", children: [
|
|
1756
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "92%" }),
|
|
1757
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "78%" }),
|
|
1758
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "58%" })
|
|
1563
1759
|
] })
|
|
1564
1760
|
]
|
|
1565
1761
|
}
|
|
1566
1762
|
);
|
|
1567
1763
|
}
|
|
1568
1764
|
function SortableTableGhost(props) {
|
|
1569
|
-
return /* @__PURE__ */
|
|
1765
|
+
return /* @__PURE__ */ jsx23(DataTableGhost, { ...props });
|
|
1570
1766
|
}
|
|
1571
1767
|
function SidebarGhost({ className, items = 6, ...props }) {
|
|
1572
|
-
return /* @__PURE__ */
|
|
1573
|
-
/* @__PURE__ */
|
|
1574
|
-
/* @__PURE__ */
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
/* @__PURE__ */
|
|
1768
|
+
return /* @__PURE__ */ jsxs19("aside", { "aria-hidden": "true", className: cn("fractal-ghost-sidebar", className), ...props, children: [
|
|
1769
|
+
/* @__PURE__ */ jsx23(Ghost, { className: "fractal-ghost-sidebar__brand" }),
|
|
1770
|
+
/* @__PURE__ */ jsx23("div", { className: "fractal-ghost-sidebar__items", children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsxs19("div", { className: "fractal-ghost-sidebar__item", children: [
|
|
1771
|
+
/* @__PURE__ */ jsx23(Ghost, {}),
|
|
1772
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: `${[54, 68, 44, 61][index % 4]}%` })
|
|
1577
1773
|
] }, index)) })
|
|
1578
1774
|
] });
|
|
1579
1775
|
}
|
|
1580
1776
|
function ModalGhost({ className, title, lines = 3, ...props }) {
|
|
1581
|
-
return /* @__PURE__ */
|
|
1777
|
+
return /* @__PURE__ */ jsx23(SurfaceGhost, { className: cn("fractal-ghost-modal", className), title, lines, ...props });
|
|
1582
1778
|
}
|
|
1583
1779
|
function SidePanelGhost({ className, title, lines = 5, ...props }) {
|
|
1584
|
-
return /* @__PURE__ */
|
|
1780
|
+
return /* @__PURE__ */ jsx23(SurfaceGhost, { className: cn("fractal-ghost-side-panel", className), title, lines, ...props });
|
|
1585
1781
|
}
|
|
1586
1782
|
function SurfaceGhost({ className, title, lines = 3, ...props }) {
|
|
1587
|
-
return /* @__PURE__ */
|
|
1588
|
-
/* @__PURE__ */
|
|
1589
|
-
/* @__PURE__ */
|
|
1590
|
-
/* @__PURE__ */
|
|
1783
|
+
return /* @__PURE__ */ jsxs19("div", { "aria-hidden": "true", className: cn("fractal-ghost-surface", className), ...props, children: [
|
|
1784
|
+
/* @__PURE__ */ jsxs19("div", { className: "fractal-ghost-surface__header", children: [
|
|
1785
|
+
/* @__PURE__ */ jsx23(GhostLine, { width: "42%" }),
|
|
1786
|
+
/* @__PURE__ */ jsx23(Ghost, { className: "fractal-ghost-surface__close" })
|
|
1591
1787
|
] }),
|
|
1592
|
-
title && /* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1788
|
+
title && /* @__PURE__ */ jsx23("div", { className: "fractal-ghost-surface__title", children: title }),
|
|
1789
|
+
/* @__PURE__ */ jsx23("div", { className: "fractal-ghost-stack", children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx23(GhostLine, { width: index === lines - 1 ? "64%" : "100%" }, index)) })
|
|
1594
1790
|
] });
|
|
1595
1791
|
}
|
|
1596
1792
|
|
|
1597
1793
|
// src/components/Sidebar/Sidebar.tsx
|
|
1598
1794
|
import * as React13 from "react";
|
|
1599
|
-
import { Fragment as Fragment3, jsx as
|
|
1795
|
+
import { Fragment as Fragment3, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1600
1796
|
var Sidebar = React13.forwardRef(
|
|
1601
|
-
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */
|
|
1797
|
+
({ className, width, compact = false, style, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
1602
1798
|
"aside",
|
|
1603
1799
|
{
|
|
1604
1800
|
ref,
|
|
@@ -1611,11 +1807,11 @@ var Sidebar = React13.forwardRef(
|
|
|
1611
1807
|
);
|
|
1612
1808
|
Sidebar.displayName = "Sidebar";
|
|
1613
1809
|
var SidebarHeader = React13.forwardRef(
|
|
1614
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1810
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx24("div", { ref, className: cn("fractal-sidebar__header", className), ...props })
|
|
1615
1811
|
);
|
|
1616
1812
|
SidebarHeader.displayName = "SidebarHeader";
|
|
1617
1813
|
var SidebarBrand = React13.forwardRef(
|
|
1618
|
-
({ className, type = "button", ...props }, ref) => /* @__PURE__ */
|
|
1814
|
+
({ className, type = "button", ...props }, ref) => /* @__PURE__ */ jsx24("button", { ref, type, className: cn("fractal-sidebar__brand", className), ...props })
|
|
1619
1815
|
);
|
|
1620
1816
|
SidebarBrand.displayName = "SidebarBrand";
|
|
1621
1817
|
function SidebarAccountMenu({
|
|
@@ -1626,7 +1822,7 @@ function SidebarAccountMenu({
|
|
|
1626
1822
|
icon,
|
|
1627
1823
|
className
|
|
1628
1824
|
}) {
|
|
1629
|
-
return /* @__PURE__ */
|
|
1825
|
+
return /* @__PURE__ */ jsx24(
|
|
1630
1826
|
Dropdown,
|
|
1631
1827
|
{
|
|
1632
1828
|
align: "left",
|
|
@@ -1636,9 +1832,9 @@ function SidebarAccountMenu({
|
|
|
1636
1832
|
panelClassName: "fractal-sidebar__account-panel",
|
|
1637
1833
|
selectedValue: "",
|
|
1638
1834
|
triggerClassName: "fractal-sidebar__account-trigger",
|
|
1639
|
-
triggerContent: /* @__PURE__ */
|
|
1640
|
-
icon && /* @__PURE__ */
|
|
1641
|
-
/* @__PURE__ */
|
|
1835
|
+
triggerContent: /* @__PURE__ */ jsxs20(Fragment3, { children: [
|
|
1836
|
+
icon && /* @__PURE__ */ jsx24("span", { className: "fractal-sidebar__account-icon", "aria-hidden": "true", children: icon }),
|
|
1837
|
+
/* @__PURE__ */ jsx24("span", { className: "fractal-sidebar__account-name", children: name })
|
|
1642
1838
|
] }),
|
|
1643
1839
|
triggerLabel,
|
|
1644
1840
|
triggerVariant: "tertiary"
|
|
@@ -1646,15 +1842,15 @@ function SidebarAccountMenu({
|
|
|
1646
1842
|
);
|
|
1647
1843
|
}
|
|
1648
1844
|
var SidebarNav = React13.forwardRef(
|
|
1649
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1845
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx24("nav", { ref, className: cn("fractal-sidebar__nav", className), ...props })
|
|
1650
1846
|
);
|
|
1651
1847
|
SidebarNav.displayName = "SidebarNav";
|
|
1652
1848
|
var SidebarSection = React13.forwardRef(
|
|
1653
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1849
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx24("div", { ref, className: cn("fractal-sidebar__section", className), ...props })
|
|
1654
1850
|
);
|
|
1655
1851
|
SidebarSection.displayName = "SidebarSection";
|
|
1656
1852
|
var SidebarNavItem = React13.forwardRef(
|
|
1657
|
-
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */
|
|
1853
|
+
({ active = false, icon, endAdornment, className, type = "button", children, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
1658
1854
|
"button",
|
|
1659
1855
|
{
|
|
1660
1856
|
ref,
|
|
@@ -1664,28 +1860,28 @@ var SidebarNavItem = React13.forwardRef(
|
|
|
1664
1860
|
"aria-current": active ? "page" : void 0,
|
|
1665
1861
|
...props,
|
|
1666
1862
|
children: [
|
|
1667
|
-
icon && /* @__PURE__ */
|
|
1668
|
-
/* @__PURE__ */
|
|
1669
|
-
endAdornment && /* @__PURE__ */
|
|
1863
|
+
icon && /* @__PURE__ */ jsx24("span", { className: "fractal-sidebar__nav-item-icon", "aria-hidden": "true", children: icon }),
|
|
1864
|
+
/* @__PURE__ */ jsx24("span", { className: "fractal-sidebar__nav-item-label", children }),
|
|
1865
|
+
endAdornment && /* @__PURE__ */ jsx24("span", { className: "fractal-sidebar__nav-item-end", children: endAdornment })
|
|
1670
1866
|
]
|
|
1671
1867
|
}
|
|
1672
1868
|
)
|
|
1673
1869
|
);
|
|
1674
1870
|
SidebarNavItem.displayName = "SidebarNavItem";
|
|
1675
1871
|
var SidebarFooter = React13.forwardRef(
|
|
1676
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1872
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx24("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
|
|
1677
1873
|
);
|
|
1678
1874
|
SidebarFooter.displayName = "SidebarFooter";
|
|
1679
1875
|
|
|
1680
1876
|
// src/components/SidePanel/SidePanel.tsx
|
|
1681
1877
|
import { createPortal as createPortal2 } from "react-dom";
|
|
1682
1878
|
import { Close } from "@mirror-physics/fractal-icons";
|
|
1683
|
-
import { jsx as
|
|
1879
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1684
1880
|
function SidePanel({ open, onClose, title, description, children, footer, size = "md", loading = false, loadingLabel = "Loading", className }) {
|
|
1685
1881
|
useEscapeDismiss(80, onClose, open);
|
|
1686
1882
|
if (!open) return null;
|
|
1687
1883
|
return createPortal2(
|
|
1688
|
-
/* @__PURE__ */
|
|
1884
|
+
/* @__PURE__ */ jsx25("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ jsxs21(
|
|
1689
1885
|
"aside",
|
|
1690
1886
|
{
|
|
1691
1887
|
className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
|
|
@@ -1694,15 +1890,15 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
1694
1890
|
role: "dialog",
|
|
1695
1891
|
onMouseDown: (event) => event.stopPropagation(),
|
|
1696
1892
|
children: [
|
|
1697
|
-
/* @__PURE__ */
|
|
1698
|
-
/* @__PURE__ */
|
|
1699
|
-
typeof title === "string" ? /* @__PURE__ */
|
|
1700
|
-
description && /* @__PURE__ */
|
|
1893
|
+
/* @__PURE__ */ jsxs21("header", { className: "fractal-side-panel__header", children: [
|
|
1894
|
+
/* @__PURE__ */ jsxs21("div", { className: "fractal-side-panel__heading", children: [
|
|
1895
|
+
typeof title === "string" ? /* @__PURE__ */ jsx25("h2", { className: "fractal-side-panel__title", children: title }) : /* @__PURE__ */ jsx25("div", { className: "fractal-side-panel__title", children: title }),
|
|
1896
|
+
description && /* @__PURE__ */ jsx25("p", { className: "fractal-side-panel__description", children: description })
|
|
1701
1897
|
] }),
|
|
1702
|
-
/* @__PURE__ */
|
|
1898
|
+
/* @__PURE__ */ jsx25("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ jsx25(Close, { size: 18 }) })
|
|
1703
1899
|
] }),
|
|
1704
|
-
/* @__PURE__ */
|
|
1705
|
-
footer && /* @__PURE__ */
|
|
1900
|
+
/* @__PURE__ */ jsx25("div", { "aria-busy": loading || void 0, className: cn("fractal-side-panel__body", loading && "fractal-side-panel__body--loading"), children: loading ? /* @__PURE__ */ jsx25(UILoader, { label: loadingLabel }) : children }),
|
|
1901
|
+
footer && /* @__PURE__ */ jsx25("footer", { className: "fractal-side-panel__footer", children: footer })
|
|
1706
1902
|
]
|
|
1707
1903
|
}
|
|
1708
1904
|
) }),
|
|
@@ -1712,17 +1908,17 @@ function SidePanel({ open, onClose, title, description, children, footer, size =
|
|
|
1712
1908
|
|
|
1713
1909
|
// src/components/Textarea/Textarea.tsx
|
|
1714
1910
|
import * as React14 from "react";
|
|
1715
|
-
import { jsx as
|
|
1911
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1716
1912
|
var Textarea = React14.forwardRef(
|
|
1717
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1913
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx26("textarea", { ref, className: cn("fractal-textarea", className), ...props })
|
|
1718
1914
|
);
|
|
1719
1915
|
Textarea.displayName = "Textarea";
|
|
1720
1916
|
|
|
1721
1917
|
// src/components/TextButton/TextButton.tsx
|
|
1722
1918
|
import * as React15 from "react";
|
|
1723
|
-
import { jsx as
|
|
1919
|
+
import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1724
1920
|
var TextButton = React15.forwardRef(
|
|
1725
|
-
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */
|
|
1921
|
+
({ className, icon, iconPosition = "start", size = "md", tone = "primary", children, ...props }, ref) => /* @__PURE__ */ jsxs22(
|
|
1726
1922
|
"button",
|
|
1727
1923
|
{
|
|
1728
1924
|
ref,
|
|
@@ -1730,9 +1926,9 @@ var TextButton = React15.forwardRef(
|
|
|
1730
1926
|
type: "button",
|
|
1731
1927
|
...props,
|
|
1732
1928
|
children: [
|
|
1733
|
-
icon && iconPosition === "start" && /* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
icon && iconPosition === "end" && /* @__PURE__ */
|
|
1929
|
+
icon && iconPosition === "start" && /* @__PURE__ */ jsx27("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon }),
|
|
1930
|
+
/* @__PURE__ */ jsx27("span", { children }),
|
|
1931
|
+
icon && iconPosition === "end" && /* @__PURE__ */ jsx27("span", { className: "fractal-text-button__icon", "aria-hidden": "true", children: icon })
|
|
1736
1932
|
]
|
|
1737
1933
|
}
|
|
1738
1934
|
)
|
|
@@ -1742,7 +1938,7 @@ TextButton.displayName = "TextButton";
|
|
|
1742
1938
|
// src/components/FileDropzone/FileDropzone.tsx
|
|
1743
1939
|
import * as React16 from "react";
|
|
1744
1940
|
import { Close as Close2, FileArrowUp } from "@mirror-physics/fractal-icons";
|
|
1745
|
-
import { jsx as
|
|
1941
|
+
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1746
1942
|
function FileDropzone({
|
|
1747
1943
|
files,
|
|
1748
1944
|
onFilesChange,
|
|
@@ -1762,8 +1958,8 @@ function FileDropzone({
|
|
|
1762
1958
|
if (additions.length === 0) return;
|
|
1763
1959
|
onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
|
|
1764
1960
|
};
|
|
1765
|
-
return /* @__PURE__ */
|
|
1766
|
-
/* @__PURE__ */
|
|
1961
|
+
return /* @__PURE__ */ jsxs23("div", { className: cn("fractal-file-dropzone", className), children: [
|
|
1962
|
+
/* @__PURE__ */ jsx28(
|
|
1767
1963
|
"input",
|
|
1768
1964
|
{
|
|
1769
1965
|
ref: inputRef,
|
|
@@ -1779,7 +1975,7 @@ function FileDropzone({
|
|
|
1779
1975
|
}
|
|
1780
1976
|
}
|
|
1781
1977
|
),
|
|
1782
|
-
/* @__PURE__ */
|
|
1978
|
+
/* @__PURE__ */ jsxs23(
|
|
1783
1979
|
"button",
|
|
1784
1980
|
{
|
|
1785
1981
|
className: "fractal-file-dropzone__target",
|
|
@@ -1802,18 +1998,18 @@ function FileDropzone({
|
|
|
1802
1998
|
addFiles(event.dataTransfer.files);
|
|
1803
1999
|
},
|
|
1804
2000
|
children: [
|
|
1805
|
-
/* @__PURE__ */
|
|
1806
|
-
/* @__PURE__ */
|
|
1807
|
-
/* @__PURE__ */
|
|
1808
|
-
description && /* @__PURE__ */
|
|
2001
|
+
/* @__PURE__ */ jsx28(FileArrowUp, { "aria-hidden": "true", size: 20 }),
|
|
2002
|
+
/* @__PURE__ */ jsxs23("span", { className: "fractal-file-dropzone__copy", children: [
|
|
2003
|
+
/* @__PURE__ */ jsx28("span", { className: "fractal-file-dropzone__title", children: title }),
|
|
2004
|
+
description && /* @__PURE__ */ jsx28("span", { className: "fractal-file-dropzone__description", children: description })
|
|
1809
2005
|
] })
|
|
1810
2006
|
]
|
|
1811
2007
|
}
|
|
1812
2008
|
),
|
|
1813
|
-
files.length > 0 && /* @__PURE__ */
|
|
1814
|
-
/* @__PURE__ */
|
|
1815
|
-
/* @__PURE__ */
|
|
1816
|
-
/* @__PURE__ */
|
|
2009
|
+
files.length > 0 && /* @__PURE__ */ jsx28("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ jsxs23("li", { className: "fractal-file-dropzone__file", children: [
|
|
2010
|
+
/* @__PURE__ */ jsx28("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
|
|
2011
|
+
/* @__PURE__ */ jsx28("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
|
|
2012
|
+
/* @__PURE__ */ jsx28(
|
|
1817
2013
|
"button",
|
|
1818
2014
|
{
|
|
1819
2015
|
className: "fractal-file-dropzone__remove",
|
|
@@ -1821,7 +2017,7 @@ function FileDropzone({
|
|
|
1821
2017
|
"aria-label": `Remove ${file.name}`,
|
|
1822
2018
|
disabled,
|
|
1823
2019
|
onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
|
|
1824
|
-
children: /* @__PURE__ */
|
|
2020
|
+
children: /* @__PURE__ */ jsx28(Close2, { "aria-hidden": "true", size: 14 })
|
|
1825
2021
|
}
|
|
1826
2022
|
)
|
|
1827
2023
|
] }, `${file.name}-${file.size}-${index}`)) })
|
|
@@ -1835,7 +2031,7 @@ function formatFileSize(bytes) {
|
|
|
1835
2031
|
|
|
1836
2032
|
// src/components/Pagination/Pagination.tsx
|
|
1837
2033
|
import { ArrowLeft, ArrowRight } from "@mirror-physics/fractal-icons";
|
|
1838
|
-
import { jsx as
|
|
2034
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1839
2035
|
function Pagination({
|
|
1840
2036
|
page,
|
|
1841
2037
|
pageSize,
|
|
@@ -1851,10 +2047,10 @@ function Pagination({
|
|
|
1851
2047
|
const start = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
|
|
1852
2048
|
const end = Math.min(currentPage * pageSize, totalItems);
|
|
1853
2049
|
const canChangePageSize = pageSizeOptions != null && pageSizeOptions.length > 0 && onPageSizeChange != null;
|
|
1854
|
-
return /* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
/* @__PURE__ */
|
|
1857
|
-
canChangePageSize && /* @__PURE__ */
|
|
2050
|
+
return /* @__PURE__ */ jsxs24("nav", { className: cn("fractal-pagination", className), "aria-label": ariaLabel, children: [
|
|
2051
|
+
/* @__PURE__ */ jsx29("span", { className: "fractal-pagination__summary", children: totalItems === 0 ? "No results" : `${start}-${end} of ${totalItems}` }),
|
|
2052
|
+
/* @__PURE__ */ jsxs24("div", { className: "fractal-pagination__controls", children: [
|
|
2053
|
+
canChangePageSize && /* @__PURE__ */ jsx29(
|
|
1858
2054
|
Dropdown,
|
|
1859
2055
|
{
|
|
1860
2056
|
align: "right",
|
|
@@ -1871,7 +2067,7 @@ function Pagination({
|
|
|
1871
2067
|
triggerVariant: "tertiary"
|
|
1872
2068
|
}
|
|
1873
2069
|
),
|
|
1874
|
-
/* @__PURE__ */
|
|
2070
|
+
/* @__PURE__ */ jsx29(
|
|
1875
2071
|
"button",
|
|
1876
2072
|
{
|
|
1877
2073
|
className: "fractal-pagination__button",
|
|
@@ -1880,15 +2076,15 @@ function Pagination({
|
|
|
1880
2076
|
title: "Previous page",
|
|
1881
2077
|
disabled: currentPage === 1 || totalItems === 0,
|
|
1882
2078
|
onClick: () => onPageChange(currentPage - 1),
|
|
1883
|
-
children: /* @__PURE__ */
|
|
2079
|
+
children: /* @__PURE__ */ jsx29(ArrowLeft, { "aria-hidden": "true", size: 16 })
|
|
1884
2080
|
}
|
|
1885
2081
|
),
|
|
1886
|
-
/* @__PURE__ */
|
|
2082
|
+
/* @__PURE__ */ jsxs24("span", { className: "fractal-pagination__page", "aria-current": "page", children: [
|
|
1887
2083
|
currentPage,
|
|
1888
2084
|
" of ",
|
|
1889
2085
|
totalPages
|
|
1890
2086
|
] }),
|
|
1891
|
-
/* @__PURE__ */
|
|
2087
|
+
/* @__PURE__ */ jsx29(
|
|
1892
2088
|
"button",
|
|
1893
2089
|
{
|
|
1894
2090
|
className: "fractal-pagination__button",
|
|
@@ -1897,7 +2093,7 @@ function Pagination({
|
|
|
1897
2093
|
title: "Next page",
|
|
1898
2094
|
disabled: currentPage === totalPages || totalItems === 0,
|
|
1899
2095
|
onClick: () => onPageChange(currentPage + 1),
|
|
1900
|
-
children: /* @__PURE__ */
|
|
2096
|
+
children: /* @__PURE__ */ jsx29(ArrowRight, { "aria-hidden": "true", size: 16 })
|
|
1901
2097
|
}
|
|
1902
2098
|
)
|
|
1903
2099
|
] })
|
|
@@ -1922,6 +2118,7 @@ export {
|
|
|
1922
2118
|
CheckboxGhost,
|
|
1923
2119
|
Chip,
|
|
1924
2120
|
ChipGhost,
|
|
2121
|
+
CodeBlock,
|
|
1925
2122
|
ContentSwitcher,
|
|
1926
2123
|
ContentSwitcherGhost,
|
|
1927
2124
|
ConversationGhost,
|