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