@mirror-physics/fractal-ui 0.2.0-next.10 → 0.2.0-next.3
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 +3 -155
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -274
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +2 -33
- package/dist/index.d.ts +2 -33
- package/dist/index.js +3 -152
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45,7 +45,6 @@ __export(index_exports, {
|
|
|
45
45
|
Disclosure: () => Disclosure,
|
|
46
46
|
Dropdown: () => Dropdown,
|
|
47
47
|
FeatureCard: () => FeatureCard,
|
|
48
|
-
FileDropzone: () => FileDropzone,
|
|
49
48
|
FolderCard: () => FolderCard,
|
|
50
49
|
Input: () => Input,
|
|
51
50
|
Label: () => Label,
|
|
@@ -53,7 +52,6 @@ __export(index_exports, {
|
|
|
53
52
|
Modal: () => Modal,
|
|
54
53
|
PromptCard: () => PromptCard,
|
|
55
54
|
PromptGrid: () => PromptGrid,
|
|
56
|
-
SidePanel: () => SidePanel,
|
|
57
55
|
Sidebar: () => Sidebar,
|
|
58
56
|
SidebarBrand: () => SidebarBrand,
|
|
59
57
|
SidebarFooter: () => SidebarFooter,
|
|
@@ -63,7 +61,6 @@ __export(index_exports, {
|
|
|
63
61
|
SidebarSection: () => SidebarSection,
|
|
64
62
|
SortableTable: () => SortableTable,
|
|
65
63
|
Tabs: () => Tabs,
|
|
66
|
-
Textarea: () => Textarea,
|
|
67
64
|
Toggle: () => Toggle,
|
|
68
65
|
cn: () => cn,
|
|
69
66
|
useEscapeDismiss: () => useEscapeDismiss
|
|
@@ -122,7 +119,7 @@ var colorPalette = {
|
|
|
122
119
|
var sizeConfig = {
|
|
123
120
|
xs: { height: "28px", padding: "4px 8px", iconOnly: "28px", fontSize: "0.75rem" },
|
|
124
121
|
sm: { height: "32px", padding: "6px 12px", iconOnly: "32px", fontSize: "0.75rem" },
|
|
125
|
-
md: { height: "
|
|
122
|
+
md: { height: "38px", padding: "8px 16px", iconOnly: "38px", fontSize: "0.875rem" },
|
|
126
123
|
lg: { height: "44px", padding: "10px 20px", iconOnly: "44px", fontSize: "1rem" },
|
|
127
124
|
xl: { height: "56px", padding: "14px 28px", iconOnly: "56px", fontSize: "1rem" }
|
|
128
125
|
};
|
|
@@ -752,8 +749,7 @@ function SortableTable({
|
|
|
752
749
|
sortKey: controlledKey,
|
|
753
750
|
sortDirection: controlledDirection,
|
|
754
751
|
onSortChange,
|
|
755
|
-
highlightRow
|
|
756
|
-
onRowClick
|
|
752
|
+
highlightRow
|
|
757
753
|
}) {
|
|
758
754
|
const [internalKey, setInternalKey] = (0, import_react2.useState)(defaultSortKey ?? null);
|
|
759
755
|
const [internalDirection, setInternalDirection] = (0, import_react2.useState)(defaultSortDirection);
|
|
@@ -854,18 +850,8 @@ function SortableTable({
|
|
|
854
850
|
{
|
|
855
851
|
className: cn(
|
|
856
852
|
"fractal-sortable-table-row",
|
|
857
|
-
highlighted && "fractal-sortable-table-row--highlighted"
|
|
858
|
-
onRowClick && "fractal-sortable-table-row--interactive"
|
|
853
|
+
highlighted && "fractal-sortable-table-row--highlighted"
|
|
859
854
|
),
|
|
860
|
-
onClick: onRowClick ? () => onRowClick(row, rowIndex) : void 0,
|
|
861
|
-
onKeyDown: onRowClick ? (event) => {
|
|
862
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
863
|
-
event.preventDefault();
|
|
864
|
-
onRowClick(row, rowIndex);
|
|
865
|
-
}
|
|
866
|
-
} : void 0,
|
|
867
|
-
role: onRowClick ? "button" : void 0,
|
|
868
|
-
tabIndex: onRowClick ? 0 : void 0,
|
|
869
855
|
children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
870
856
|
"td",
|
|
871
857
|
{
|
|
@@ -1110,141 +1096,6 @@ var SidebarFooter = React10.forwardRef(
|
|
|
1110
1096
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref, className: cn("fractal-sidebar__footer", className), ...props })
|
|
1111
1097
|
);
|
|
1112
1098
|
SidebarFooter.displayName = "SidebarFooter";
|
|
1113
|
-
|
|
1114
|
-
// src/components/SidePanel/SidePanel.tsx
|
|
1115
|
-
var import_react_dom2 = require("react-dom");
|
|
1116
|
-
var import_fractal_icons5 = require("@mirror-physics/fractal-icons");
|
|
1117
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1118
|
-
function SidePanel({ open, onClose, title, description, children, footer, size = "md", className }) {
|
|
1119
|
-
useEscapeDismiss(80, onClose, open);
|
|
1120
|
-
if (!open) return null;
|
|
1121
|
-
return (0, import_react_dom2.createPortal)(
|
|
1122
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "fractal-side-panel-overlay", onMouseDown: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1123
|
-
"aside",
|
|
1124
|
-
{
|
|
1125
|
-
className: cn("fractal-side-panel", `fractal-side-panel--${size}`, className),
|
|
1126
|
-
"aria-modal": "true",
|
|
1127
|
-
"aria-label": typeof title === "string" ? title : "Side panel",
|
|
1128
|
-
role: "dialog",
|
|
1129
|
-
onMouseDown: (event) => event.stopPropagation(),
|
|
1130
|
-
children: [
|
|
1131
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("header", { className: "fractal-side-panel__header", children: [
|
|
1132
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "fractal-side-panel__heading", children: [
|
|
1133
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h2", { className: "fractal-side-panel__title", children: title }),
|
|
1134
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "fractal-side-panel__description", children: description })
|
|
1135
|
-
] }),
|
|
1136
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "fractal-side-panel__close", "aria-label": "Close panel", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_fractal_icons5.Close, { size: 18 }) })
|
|
1137
|
-
] }),
|
|
1138
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "fractal-side-panel__body", children }),
|
|
1139
|
-
footer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("footer", { className: "fractal-side-panel__footer", children: footer })
|
|
1140
|
-
]
|
|
1141
|
-
}
|
|
1142
|
-
) }),
|
|
1143
|
-
document.body
|
|
1144
|
-
);
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
// src/components/Textarea/Textarea.tsx
|
|
1148
|
-
var React11 = __toESM(require("react"), 1);
|
|
1149
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1150
|
-
var Textarea = React11.forwardRef(
|
|
1151
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("textarea", { ref, className: cn("fractal-textarea", className), ...props })
|
|
1152
|
-
);
|
|
1153
|
-
Textarea.displayName = "Textarea";
|
|
1154
|
-
|
|
1155
|
-
// src/components/FileDropzone/FileDropzone.tsx
|
|
1156
|
-
var React12 = __toESM(require("react"), 1);
|
|
1157
|
-
var import_fractal_icons6 = require("@mirror-physics/fractal-icons");
|
|
1158
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1159
|
-
function FileDropzone({
|
|
1160
|
-
files,
|
|
1161
|
-
onFilesChange,
|
|
1162
|
-
accept,
|
|
1163
|
-
multiple = true,
|
|
1164
|
-
disabled = false,
|
|
1165
|
-
title = "Drop files here or click to browse",
|
|
1166
|
-
description = "Files stay attached to this record.",
|
|
1167
|
-
className
|
|
1168
|
-
}) {
|
|
1169
|
-
const inputId = React12.useId();
|
|
1170
|
-
const inputRef = React12.useRef(null);
|
|
1171
|
-
const [isDragging, setIsDragging] = React12.useState(false);
|
|
1172
|
-
const addFiles = (nextFiles) => {
|
|
1173
|
-
if (disabled) return;
|
|
1174
|
-
const additions = Array.from(nextFiles);
|
|
1175
|
-
if (additions.length === 0) return;
|
|
1176
|
-
onFilesChange(multiple ? [...files, ...additions] : additions.slice(0, 1));
|
|
1177
|
-
};
|
|
1178
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: cn("fractal-file-dropzone", className), children: [
|
|
1179
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1180
|
-
"input",
|
|
1181
|
-
{
|
|
1182
|
-
ref: inputRef,
|
|
1183
|
-
id: inputId,
|
|
1184
|
-
className: "fractal-file-dropzone__input",
|
|
1185
|
-
type: "file",
|
|
1186
|
-
accept,
|
|
1187
|
-
multiple,
|
|
1188
|
-
disabled,
|
|
1189
|
-
onChange: (event) => {
|
|
1190
|
-
if (event.target.files) addFiles(event.target.files);
|
|
1191
|
-
event.target.value = "";
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
),
|
|
1195
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1196
|
-
"button",
|
|
1197
|
-
{
|
|
1198
|
-
className: "fractal-file-dropzone__target",
|
|
1199
|
-
"data-dragging": isDragging || void 0,
|
|
1200
|
-
type: "button",
|
|
1201
|
-
disabled,
|
|
1202
|
-
onClick: () => inputRef.current?.click(),
|
|
1203
|
-
onDragEnter: (event) => {
|
|
1204
|
-
event.preventDefault();
|
|
1205
|
-
if (!disabled) setIsDragging(true);
|
|
1206
|
-
},
|
|
1207
|
-
onDragOver: (event) => event.preventDefault(),
|
|
1208
|
-
onDragLeave: (event) => {
|
|
1209
|
-
event.preventDefault();
|
|
1210
|
-
setIsDragging(false);
|
|
1211
|
-
},
|
|
1212
|
-
onDrop: (event) => {
|
|
1213
|
-
event.preventDefault();
|
|
1214
|
-
setIsDragging(false);
|
|
1215
|
-
addFiles(event.dataTransfer.files);
|
|
1216
|
-
},
|
|
1217
|
-
children: [
|
|
1218
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fractal_icons6.FileArrowUp, { "aria-hidden": "true", size: 20 }),
|
|
1219
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "fractal-file-dropzone__copy", children: [
|
|
1220
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fractal-file-dropzone__title", children: title }),
|
|
1221
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fractal-file-dropzone__description", children: description })
|
|
1222
|
-
] })
|
|
1223
|
-
]
|
|
1224
|
-
}
|
|
1225
|
-
),
|
|
1226
|
-
files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { className: "fractal-file-dropzone__files", "aria-label": "Attached files", children: files.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("li", { className: "fractal-file-dropzone__file", children: [
|
|
1227
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fractal-file-dropzone__file-name", children: file.name }),
|
|
1228
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fractal-file-dropzone__file-meta", children: formatFileSize(file.size) }),
|
|
1229
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1230
|
-
"button",
|
|
1231
|
-
{
|
|
1232
|
-
className: "fractal-file-dropzone__remove",
|
|
1233
|
-
type: "button",
|
|
1234
|
-
"aria-label": `Remove ${file.name}`,
|
|
1235
|
-
disabled,
|
|
1236
|
-
onClick: () => onFilesChange(files.filter((_, fileIndex) => fileIndex !== index)),
|
|
1237
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fractal_icons6.Close, { "aria-hidden": "true", size: 14 })
|
|
1238
|
-
}
|
|
1239
|
-
)
|
|
1240
|
-
] }, `${file.name}-${file.size}-${index}`)) })
|
|
1241
|
-
] });
|
|
1242
|
-
}
|
|
1243
|
-
function formatFileSize(bytes) {
|
|
1244
|
-
if (bytes < 1024) return `${bytes} B`;
|
|
1245
|
-
if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`;
|
|
1246
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
1247
|
-
}
|
|
1248
1099
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1249
1100
|
0 && (module.exports = {
|
|
1250
1101
|
Alert,
|
|
@@ -1262,7 +1113,6 @@ function formatFileSize(bytes) {
|
|
|
1262
1113
|
Disclosure,
|
|
1263
1114
|
Dropdown,
|
|
1264
1115
|
FeatureCard,
|
|
1265
|
-
FileDropzone,
|
|
1266
1116
|
FolderCard,
|
|
1267
1117
|
Input,
|
|
1268
1118
|
Label,
|
|
@@ -1270,7 +1120,6 @@ function formatFileSize(bytes) {
|
|
|
1270
1120
|
Modal,
|
|
1271
1121
|
PromptCard,
|
|
1272
1122
|
PromptGrid,
|
|
1273
|
-
SidePanel,
|
|
1274
1123
|
Sidebar,
|
|
1275
1124
|
SidebarBrand,
|
|
1276
1125
|
SidebarFooter,
|
|
@@ -1280,7 +1129,6 @@ function formatFileSize(bytes) {
|
|
|
1280
1129
|
SidebarSection,
|
|
1281
1130
|
SortableTable,
|
|
1282
1131
|
Tabs,
|
|
1283
|
-
Textarea,
|
|
1284
1132
|
Toggle,
|
|
1285
1133
|
cn,
|
|
1286
1134
|
useEscapeDismiss
|