@fldr/ui 0.3.8 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -448
- package/ai/component-registry.json +25 -13
- package/ai/component-registry.md +2 -2
- package/dist/.build-complete +1 -1
- package/dist/blocks-source/auth-card/auth-card.test.tsx +20 -14
- package/dist/blocks-source/auth-card/auth-card.tsx +73 -55
- package/dist/blocks-source/file-table/file-table.tsx +197 -150
- package/dist/blocks-source/share-dialog/share-dialog.test.tsx +9 -3
- package/dist/blocks-source/share-dialog/share-dialog.tsx +50 -35
- package/dist/blocks.d.ts +21 -4
- package/dist/blocks.js +246 -195
- package/dist/{button-DzavLWXm.d.ts → button-CS82eT0x.d.ts} +1 -1
- package/dist/chunks/{checkbox-eifiwbw34xwsikvf.js → checkbox-d5epe4dl78bzy4f8.js} +8 -8
- package/dist/chunks/highlighter-kb7huz24pcziin6d.js +57 -0
- package/dist/chunks/{layer-dialog-m8qb0wzfg3k7406a.js → layer-dialog-mnaw06pxom8q771w.js} +3 -2
- package/dist/chunks/{table-ngl1b5yc8mcur662.js → table-bdye068ekayq3u1n.js} +1 -1
- package/dist/chunks/table-f8vl74hdx3bzqqbf.js +448 -0
- package/dist/code/server.js +1 -1
- package/dist/code.js +4 -131
- package/dist/components/banner.d.ts +1 -1
- package/dist/components/button.d.ts +2 -2
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/input-group.d.ts +2 -1
- package/dist/components/input.d.ts +2 -2
- package/dist/components/layer-dialog.js +1 -1
- package/dist/components/link.d.ts +2 -67
- package/dist/components/sidebar.d.ts +2 -1
- package/dist/components/table.d.ts +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/toast.d.ts +1 -1
- package/dist/components/toolbar.d.ts +1 -1
- package/dist/form.d.ts +207 -0
- package/dist/form.js +317 -0
- package/dist/hotkeys.d.ts +135 -0
- package/dist/hotkeys.js +206 -0
- package/dist/index-9LwQy84o.d.ts +1 -0
- package/dist/index-B7iG0qDU.d.ts +1 -0
- package/dist/{index-B6JNUfG9.d.ts → index-BMXHK-3k.d.ts} +2 -2
- package/dist/{index-B6Wo_iiN.d.ts → index-B_ug9XY7.d.ts} +1 -1
- package/dist/{index-RP_rt8vB.d.ts → index-Bh9kuAvN.d.ts} +1 -1
- package/dist/{index-DjSGDESy.d.ts → index-CAUjUp2G.d.ts} +1 -1
- package/dist/{index-NnHba-T1.d.ts → index-DK28YxxP.d.ts} +2 -2
- package/dist/{index-aahL-0Zw.d.ts → index-DOVlARA6.d.ts} +2 -2
- package/dist/index-DTj6M6kA.d.ts +1 -0
- package/dist/index.d.ts +14 -12
- package/dist/index.js +3 -4
- package/dist/{input-group-8gEtPiKw.d.ts → input-group-Swzit45o.d.ts} +1 -1
- package/dist/link-CoVXE5W2.d.ts +68 -0
- package/dist/query.d.ts +156 -0
- package/dist/query.js +204 -0
- package/dist/router.d.ts +95 -0
- package/dist/router.js +146 -0
- package/dist/skeleton.d.ts +3 -0
- package/dist/skeleton.js +4 -0
- package/dist/styles/kumo-binding.css +10 -0
- package/dist/styles/kumo-standalone.css +1 -1
- package/dist/styles/theme-fldr.css +18 -18
- package/dist/table.d.ts +245 -0
- package/dist/table.js +3 -0
- package/dist/theming.d.ts +4 -4
- package/dist/theming.js +2 -2
- package/package.json +41 -1
- package/dist/chunks/highlighter-mouttug0tu8xg1i8.js +0 -1364
- package/dist/index-DL1-uSuH.d.ts +0 -1
- /package/dist/{index-BkTAB4wj.d.ts → sidebar-BkTAB4wj.d.ts} +0 -0
package/dist/blocks.js
CHANGED
|
@@ -3,20 +3,20 @@ import { t as cn } from "./chunks/vendor-styling-gs32v7xt5znc8kg0.js";
|
|
|
3
3
|
import { r as Link } from "./chunks/link-h84bkh8eem39p529.js";
|
|
4
4
|
import { n as LinkButton, t as Button } from "./chunks/button-hzvowfkbathmx8yg.js";
|
|
5
5
|
import { t as Banner } from "./chunks/banner-mo1xl9ww734kgsqh.js";
|
|
6
|
-
import { t as Checkbox } from "./chunks/checkbox-
|
|
7
|
-
import { t as Input } from "./chunks/input-kfi46426y22ocoo4.js";
|
|
6
|
+
import { t as Checkbox } from "./chunks/checkbox-d5epe4dl78bzy4f8.js";
|
|
8
7
|
import { t as ClipboardText } from "./chunks/clipboard-text-ejyilhenww9v18l4.js";
|
|
9
8
|
import { t as DropdownMenu } from "./chunks/dropdown-e5zk0ez21busnt0b.js";
|
|
10
9
|
import { n as KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS, r as KUMO_DELETE_RESOURCE_VARIANTS, t as DeleteResource } from "./chunks/delete-resource-cmlptb61ih8s84r3.js";
|
|
11
10
|
import { t as Meter } from "./chunks/meter-poh8jpe0qtq6mvee.js";
|
|
12
11
|
import { t as Select } from "./chunks/select-h2pejw38n5z3l59r.js";
|
|
13
12
|
import { t as Tabs } from "./chunks/tabs-cja62qojznpj99et.js";
|
|
14
|
-
import { r as Table } from "./chunks/table-ngl1b5yc8mcur662.js";
|
|
15
13
|
import { i as Sidebar } from "./chunks/sidebar-mhlgvpawixxoey2k.js";
|
|
16
|
-
import { t as LayerDialog } from "./chunks/layer-dialog-
|
|
14
|
+
import { t as LayerDialog } from "./chunks/layer-dialog-mnaw06pxom8q771w.js";
|
|
15
|
+
import { compose, email, required, useAppForm } from "./form.js";
|
|
16
|
+
import { a as DataTable, c as selectColumn, o as createColumnHelper, r as DataTableToolbar, t as functionalUpdate } from "./chunks/table-f8vl74hdx3bzqqbf.js";
|
|
17
17
|
import { useCallback, useId, useMemo, useRef, useState } from "react";
|
|
18
18
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
-
import { ArrowClockwiseIcon, ArrowDownIcon, ArrowUpIcon, ArrowsLeftRightIcon,
|
|
19
|
+
import { ArrowClockwiseIcon, ArrowDownIcon, ArrowUpIcon, ArrowsLeftRightIcon, ChatCircleIcon, CheckCircleIcon, CircleIcon, DotsThreeIcon, FileIcon, FileImageIcon, FilePdfIcon, FileXlsIcon, FolderSimpleIcon, GlobeIcon, LockIcon, PencilSimpleIcon, ShareNetworkIcon, TrashIcon, UploadSimpleIcon, WarningCircleIcon, XIcon } from "@phosphor-icons/react";
|
|
20
20
|
//#region src/blocks/activity-feed/activity-feed.tsx
|
|
21
21
|
const DEFAULT_LABELS$6 = {
|
|
22
22
|
today: "Today",
|
|
@@ -240,7 +240,9 @@ const DEFAULT_LABELS$5 = {
|
|
|
240
240
|
signInSubmit: "Sign in",
|
|
241
241
|
signUpSubmit: "Create account",
|
|
242
242
|
magicLinkSubmit: "Email me a sign-in link",
|
|
243
|
-
divider: "or"
|
|
243
|
+
divider: "or",
|
|
244
|
+
required: "Required",
|
|
245
|
+
invalidEmail: "Enter a valid email"
|
|
244
246
|
};
|
|
245
247
|
/**
|
|
246
248
|
* Centered sign-in / sign-up card with optional providers and magic-link mode.
|
|
@@ -272,20 +274,22 @@ function AuthCard({ mode = "sign-in", method = "password", onSubmit, providers,
|
|
|
272
274
|
className: "w-full justify-center",
|
|
273
275
|
children: p.label
|
|
274
276
|
}, p.id)) : null);
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
277
|
+
const form = useAppForm({
|
|
278
|
+
defaultValues: {
|
|
279
|
+
email: "",
|
|
280
|
+
password: "",
|
|
281
|
+
name: ""
|
|
282
|
+
},
|
|
283
|
+
onSubmit: ({ value }) => {
|
|
284
|
+
if (loading) return;
|
|
285
|
+
onSubmit({
|
|
286
|
+
email: value.email.trim(),
|
|
287
|
+
...hasPassword && { password: value.password },
|
|
288
|
+
...isSignUp && { name: value.name.trim() }
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
const isRequired = { onChange: required(labels.required) };
|
|
289
293
|
const submitLabel = !hasPassword ? labels.magicLinkSubmit : isSignUp ? labels.signUpSubmit : labels.signInSubmit;
|
|
290
294
|
return /* @__PURE__ */ jsxs("div", {
|
|
291
295
|
className: cn("mx-auto flex w-full max-w-[360px] flex-col gap-4 rounded-xl bg-kumo-elevated p-5", className),
|
|
@@ -327,43 +331,46 @@ function AuthCard({ mode = "sign-in", method = "password", onSubmit, providers,
|
|
|
327
331
|
/* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-kumo-line" })
|
|
328
332
|
]
|
|
329
333
|
})] }),
|
|
330
|
-
/* @__PURE__ */ jsxs(
|
|
334
|
+
/* @__PURE__ */ jsx(form.AppForm, { children: /* @__PURE__ */ jsxs(form.Form, {
|
|
331
335
|
className: "flex flex-col gap-3",
|
|
332
|
-
onSubmit: handleSubmit,
|
|
333
336
|
children: [
|
|
334
|
-
isSignUp && /* @__PURE__ */ jsx(
|
|
335
|
-
label: labels.name,
|
|
337
|
+
isSignUp && /* @__PURE__ */ jsx(form.AppField, {
|
|
336
338
|
name: "name",
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
339
|
+
validators: isRequired,
|
|
340
|
+
children: (field) => /* @__PURE__ */ jsx(field.TextField, {
|
|
341
|
+
label: labels.name,
|
|
342
|
+
autoComplete: "name",
|
|
343
|
+
disabled: loading
|
|
344
|
+
})
|
|
340
345
|
}),
|
|
341
|
-
/* @__PURE__ */ jsx(
|
|
342
|
-
label: labels.email,
|
|
346
|
+
/* @__PURE__ */ jsx(form.AppField, {
|
|
343
347
|
name: "email",
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
348
|
+
validators: { onChange: compose(required(labels.required), email(labels.invalidEmail)) },
|
|
349
|
+
children: (field) => /* @__PURE__ */ jsx(field.TextField, {
|
|
350
|
+
label: labels.email,
|
|
351
|
+
type: "email",
|
|
352
|
+
autoComplete: "email",
|
|
353
|
+
placeholder: "you@example.com",
|
|
354
|
+
disabled: loading
|
|
355
|
+
})
|
|
349
356
|
}),
|
|
350
|
-
hasPassword && /* @__PURE__ */ jsx(
|
|
351
|
-
label: labels.password,
|
|
357
|
+
hasPassword && /* @__PURE__ */ jsx(form.AppField, {
|
|
352
358
|
name: "password",
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
359
|
+
validators: isRequired,
|
|
360
|
+
children: (field) => /* @__PURE__ */ jsx(field.TextField, {
|
|
361
|
+
label: labels.password,
|
|
362
|
+
type: "password",
|
|
363
|
+
autoComplete: isSignUp ? "new-password" : "current-password",
|
|
364
|
+
disabled: loading
|
|
365
|
+
})
|
|
357
366
|
}),
|
|
358
|
-
/* @__PURE__ */ jsx(
|
|
359
|
-
type: "submit",
|
|
360
|
-
variant: "primary",
|
|
367
|
+
/* @__PURE__ */ jsx(form.SubmitButton, {
|
|
361
368
|
loading,
|
|
362
369
|
className: "w-full justify-center",
|
|
363
370
|
children: submitLabel
|
|
364
371
|
})
|
|
365
372
|
]
|
|
366
|
-
}),
|
|
373
|
+
}) }),
|
|
367
374
|
footer && /* @__PURE__ */ jsx("div", {
|
|
368
375
|
className: "text-center text-sm text-kumo-subtle",
|
|
369
376
|
children: footer
|
|
@@ -455,7 +462,8 @@ const DEFAULT_LABELS$4 = {
|
|
|
455
462
|
selectRow: (name) => `Select ${name}`,
|
|
456
463
|
selected: (count) => `${count} selected`,
|
|
457
464
|
clearSelection: "Clear selection",
|
|
458
|
-
actions: (name) => `Actions for ${name}
|
|
465
|
+
actions: (name) => `Actions for ${name}`,
|
|
466
|
+
search: "Search files"
|
|
459
467
|
};
|
|
460
468
|
const DEFAULT_SORT = {
|
|
461
469
|
key: "name",
|
|
@@ -466,8 +474,12 @@ function compare(a, b, key) {
|
|
|
466
474
|
if (key === "modifiedAt") return toTime(a.modifiedAt) - toTime(b.modifiedAt);
|
|
467
475
|
return (a[key] ?? "").localeCompare(b[key] ?? "", void 0, { numeric: true });
|
|
468
476
|
}
|
|
477
|
+
const getRowId = (item) => item.id;
|
|
478
|
+
const dash = "—";
|
|
479
|
+
const subtle = "whitespace-nowrap text-kumo-subtle";
|
|
469
480
|
/**
|
|
470
|
-
* FileTable — sortable, selectable list of files and folders
|
|
481
|
+
* FileTable — sortable, selectable list of files and folders, built on
|
|
482
|
+
* `DataTable`. Folders always sort above files.
|
|
471
483
|
*
|
|
472
484
|
* @example
|
|
473
485
|
* ```tsx
|
|
@@ -476,133 +488,168 @@ function compare(a, b, key) {
|
|
|
476
488
|
* onOpen={(item) => navigate(item.id)}
|
|
477
489
|
* actions={[{ label: "Delete", variant: "danger", onSelect: remove }]}
|
|
478
490
|
* bulkActions={(ids) => <Button size="sm" onClick={() => share(ids)}>Share</Button>}
|
|
491
|
+
* searchable
|
|
479
492
|
* />
|
|
480
493
|
* ```
|
|
481
494
|
*/
|
|
482
|
-
function FileTable({ items, sort: sortProp, defaultSort = DEFAULT_SORT, onSortChange, selectable = true, selectedIds, defaultSelectedIds = [], onSelectionChange, bulkActions, actions, onOpen, empty, labels: labelsProp, locale, className }) {
|
|
495
|
+
function FileTable({ items, sort: sortProp, defaultSort = DEFAULT_SORT, onSortChange, selectable = true, selectedIds, defaultSelectedIds = [], onSelectionChange, bulkActions, actions, onOpen, empty, labels: labelsProp, locale, searchable, loading, virtualize, height, className }) {
|
|
483
496
|
const labels = {
|
|
484
497
|
...DEFAULT_LABELS$4,
|
|
485
498
|
...labelsProp
|
|
486
499
|
};
|
|
487
500
|
const [sort, setSort] = useControllable(sortProp, defaultSort, onSortChange);
|
|
488
501
|
const [selected, setSelected] = useControllable(selectedIds, defaultSelectedIds, onSelectionChange);
|
|
489
|
-
const selectedSet = new Set(selected);
|
|
490
502
|
const sorted = useMemo(() => {
|
|
491
503
|
const dir = sort.direction === "asc" ? 1 : -1;
|
|
492
504
|
return [...items].sort((a, b) => Number(b.kind === "folder") - Number(a.kind === "folder") || dir * compare(a, b, sort.key));
|
|
493
505
|
}, [items, sort]);
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
onCheckedChange: (checked) => setSelected(checked ? items.map((i) => i.id) : [])
|
|
547
|
-
}),
|
|
548
|
-
head("name", labels.name, "w-full"),
|
|
549
|
-
head("size", labels.size, "text-right"),
|
|
550
|
-
head("modifiedAt", labels.modified, "hidden sm:table-cell"),
|
|
551
|
-
head("owner", labels.owner, "hidden md:table-cell"),
|
|
552
|
-
actions && /* @__PURE__ */ jsx(Table.Head, { className: "w-10" })
|
|
553
|
-
] })
|
|
554
|
-
}), /* @__PURE__ */ jsx(Table.Body, { children: sorted.map((item) => {
|
|
555
|
-
const isSelected = selectedSet.has(item.id);
|
|
556
|
-
return /* @__PURE__ */ jsxs(Table.Row, {
|
|
557
|
-
variant: isSelected ? "selected" : "default",
|
|
558
|
-
className: cn(!isSelected && "even:bg-kumo-base hover:bg-kumo-tint even:hover:bg-kumo-tint", onOpen && "cursor-pointer"),
|
|
559
|
-
onClick: onOpen && (() => onOpen(item)),
|
|
560
|
-
children: [
|
|
561
|
-
selectable && /* @__PURE__ */ jsx(Table.CheckCell, {
|
|
562
|
-
label: labels.selectRow(item.name),
|
|
563
|
-
checked: isSelected,
|
|
564
|
-
onCheckedChange: (checked) => toggle(item.id, checked),
|
|
565
|
-
onClick: (e) => e.stopPropagation()
|
|
566
|
-
}),
|
|
567
|
-
/* @__PURE__ */ jsx(Table.Cell, {
|
|
568
|
-
className: "max-w-0",
|
|
569
|
-
children: /* @__PURE__ */ jsxs("span", {
|
|
570
|
-
className: "flex min-w-0 items-center gap-2",
|
|
571
|
-
children: [/* @__PURE__ */ jsx(FileKindIcon, { kind: item.kind }), onOpen ? /* @__PURE__ */ jsx("button", {
|
|
572
|
-
type: "button",
|
|
573
|
-
className: "cursor-pointer truncate text-left",
|
|
574
|
-
children: item.name
|
|
575
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
576
|
-
className: "truncate",
|
|
577
|
-
children: item.name
|
|
578
|
-
})]
|
|
579
|
-
})
|
|
580
|
-
}),
|
|
581
|
-
/* @__PURE__ */ jsx(Table.Cell, {
|
|
582
|
-
className: "text-right whitespace-nowrap text-kumo-subtle tabular-nums",
|
|
583
|
-
children: item.size === void 0 ? "—" : formatFileSize(item.size, locale)
|
|
584
|
-
}),
|
|
585
|
-
/* @__PURE__ */ jsx(Table.Cell, {
|
|
586
|
-
className: "hidden whitespace-nowrap text-kumo-subtle sm:table-cell",
|
|
587
|
-
children: item.modifiedAt === void 0 ? "—" : formatFileDate(item.modifiedAt, locale)
|
|
588
|
-
}),
|
|
589
|
-
/* @__PURE__ */ jsx(Table.Cell, {
|
|
590
|
-
className: "hidden whitespace-nowrap text-kumo-subtle md:table-cell",
|
|
591
|
-
children: item.owner ?? "—"
|
|
592
|
-
}),
|
|
593
|
-
actions && /* @__PURE__ */ jsx(Table.Cell, {
|
|
594
|
-
className: "py-0 text-right",
|
|
595
|
-
children: /* @__PURE__ */ jsx(ItemActionsMenu, {
|
|
596
|
-
item,
|
|
597
|
-
actions,
|
|
598
|
-
label: labels.actions(item.name)
|
|
599
|
-
})
|
|
600
|
-
})
|
|
601
|
-
]
|
|
602
|
-
}, item.id);
|
|
603
|
-
}) })] })]
|
|
506
|
+
const columns = useFileColumns({
|
|
507
|
+
labels,
|
|
508
|
+
locale,
|
|
509
|
+
onOpen,
|
|
510
|
+
actions,
|
|
511
|
+
selectable
|
|
512
|
+
});
|
|
513
|
+
if (items.length === 0 && empty && !loading) return /* @__PURE__ */ jsx(Fragment$1, { children: empty });
|
|
514
|
+
const sorting = [{
|
|
515
|
+
id: sort.key,
|
|
516
|
+
desc: sort.direction === "desc"
|
|
517
|
+
}];
|
|
518
|
+
const rowSelection = Object.fromEntries(selected.map((id) => [id, true]));
|
|
519
|
+
return /* @__PURE__ */ jsx(DataTable, {
|
|
520
|
+
columns,
|
|
521
|
+
data: sorted,
|
|
522
|
+
getRowId,
|
|
523
|
+
manualSorting: true,
|
|
524
|
+
sortDescFirst: false,
|
|
525
|
+
enableSortingRemoval: false,
|
|
526
|
+
enableRowSelection: selectable,
|
|
527
|
+
state: {
|
|
528
|
+
sorting,
|
|
529
|
+
rowSelection
|
|
530
|
+
},
|
|
531
|
+
onSortingChange: (updater) => {
|
|
532
|
+
const [next] = functionalUpdate(updater, sorting);
|
|
533
|
+
if (next) setSort({
|
|
534
|
+
key: next.id,
|
|
535
|
+
direction: next.desc ? "desc" : "asc"
|
|
536
|
+
});
|
|
537
|
+
},
|
|
538
|
+
onRowSelectionChange: (updater) => {
|
|
539
|
+
const next = functionalUpdate(updater, rowSelection);
|
|
540
|
+
setSelected(items.filter((i) => next[i.id]).map((i) => i.id));
|
|
541
|
+
},
|
|
542
|
+
toolbar: searchable ? (table) => /* @__PURE__ */ jsx(DataTableToolbar, {
|
|
543
|
+
table,
|
|
544
|
+
columnVisibility: false,
|
|
545
|
+
labels: { search: labels.search }
|
|
546
|
+
}) : void 0,
|
|
547
|
+
bulkActions: typeof bulkActions === "function" ? bulkActions(selected) : bulkActions,
|
|
548
|
+
onRowClick: onOpen && ((row) => onOpen(row.original)),
|
|
549
|
+
empty,
|
|
550
|
+
loading,
|
|
551
|
+
virtualize,
|
|
552
|
+
height,
|
|
553
|
+
labels: {
|
|
554
|
+
selected: labels.selected,
|
|
555
|
+
clearSelection: labels.clearSelection
|
|
556
|
+
},
|
|
557
|
+
className
|
|
604
558
|
});
|
|
605
559
|
}
|
|
560
|
+
function useFileColumns({ labels, locale, onOpen, actions, selectable }) {
|
|
561
|
+
const { selectAll, selectRow, name, size, modified, owner } = labels;
|
|
562
|
+
const actionsLabel = labels.actions;
|
|
563
|
+
const clickable = !!onOpen;
|
|
564
|
+
return useMemo(() => {
|
|
565
|
+
const col = createColumnHelper();
|
|
566
|
+
return col.columns([
|
|
567
|
+
...selectable ? [selectColumn({
|
|
568
|
+
allLabel: selectAll,
|
|
569
|
+
rowLabel: (item) => selectRow(item.name)
|
|
570
|
+
})] : [],
|
|
571
|
+
col.accessor((item) => item.name, {
|
|
572
|
+
id: "name",
|
|
573
|
+
header: name,
|
|
574
|
+
meta: {
|
|
575
|
+
headerClassName: "w-full",
|
|
576
|
+
cellClassName: "max-w-0"
|
|
577
|
+
},
|
|
578
|
+
cell: ({ row }) => /* @__PURE__ */ jsxs("span", {
|
|
579
|
+
className: "flex min-w-0 items-center gap-2",
|
|
580
|
+
children: [/* @__PURE__ */ jsx(FileKindIcon, { kind: row.original.kind }), clickable ? /* @__PURE__ */ jsx("button", {
|
|
581
|
+
type: "button",
|
|
582
|
+
className: "cursor-pointer truncate text-left",
|
|
583
|
+
children: row.original.name
|
|
584
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
585
|
+
className: "truncate",
|
|
586
|
+
children: row.original.name
|
|
587
|
+
})]
|
|
588
|
+
})
|
|
589
|
+
}),
|
|
590
|
+
col.accessor((item) => item.size, {
|
|
591
|
+
id: "size",
|
|
592
|
+
header: size,
|
|
593
|
+
enableGlobalFilter: false,
|
|
594
|
+
meta: {
|
|
595
|
+
className: "text-right",
|
|
596
|
+
cellClassName: `${subtle} tabular-nums`
|
|
597
|
+
},
|
|
598
|
+
cell: ({ getValue }) => {
|
|
599
|
+
const value = getValue();
|
|
600
|
+
return value === void 0 ? dash : formatFileSize(value, locale);
|
|
601
|
+
}
|
|
602
|
+
}),
|
|
603
|
+
col.accessor((item) => item.modifiedAt, {
|
|
604
|
+
id: "modifiedAt",
|
|
605
|
+
header: modified,
|
|
606
|
+
enableGlobalFilter: false,
|
|
607
|
+
meta: {
|
|
608
|
+
className: "hidden sm:table-cell",
|
|
609
|
+
cellClassName: subtle
|
|
610
|
+
},
|
|
611
|
+
cell: ({ getValue }) => {
|
|
612
|
+
const value = getValue();
|
|
613
|
+
return value === void 0 ? dash : formatFileDate(value, locale);
|
|
614
|
+
}
|
|
615
|
+
}),
|
|
616
|
+
col.accessor((item) => item.owner, {
|
|
617
|
+
id: "owner",
|
|
618
|
+
header: owner,
|
|
619
|
+
meta: {
|
|
620
|
+
className: "hidden md:table-cell",
|
|
621
|
+
cellClassName: subtle
|
|
622
|
+
},
|
|
623
|
+
cell: ({ getValue }) => getValue() ?? dash
|
|
624
|
+
}),
|
|
625
|
+
...actions ? [col.display({
|
|
626
|
+
id: "actions",
|
|
627
|
+
enableHiding: false,
|
|
628
|
+
meta: {
|
|
629
|
+
className: "w-10",
|
|
630
|
+
cellClassName: "py-0 text-right"
|
|
631
|
+
},
|
|
632
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(ItemActionsMenu, {
|
|
633
|
+
item: row.original,
|
|
634
|
+
actions,
|
|
635
|
+
label: actionsLabel(row.original.name)
|
|
636
|
+
})
|
|
637
|
+
})] : []
|
|
638
|
+
]);
|
|
639
|
+
}, [
|
|
640
|
+
selectable,
|
|
641
|
+
selectAll,
|
|
642
|
+
selectRow,
|
|
643
|
+
name,
|
|
644
|
+
size,
|
|
645
|
+
modified,
|
|
646
|
+
owner,
|
|
647
|
+
actionsLabel,
|
|
648
|
+
actions,
|
|
649
|
+
locale,
|
|
650
|
+
clickable
|
|
651
|
+
]);
|
|
652
|
+
}
|
|
606
653
|
//#endregion
|
|
607
654
|
//#region src/blocks/onboarding-checklist/onboarding-checklist.tsx
|
|
608
655
|
const DEFAULT_LABELS$3 = {
|
|
@@ -1259,7 +1306,6 @@ const DEFAULT_ROLES = {
|
|
|
1259
1306
|
viewer: "Viewer",
|
|
1260
1307
|
editor: "Editor"
|
|
1261
1308
|
};
|
|
1262
|
-
const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1263
1309
|
function initials(name) {
|
|
1264
1310
|
const parts = name.trim().split(/\s+/);
|
|
1265
1311
|
return ((parts[0]?.[0] ?? "") + (parts[1]?.[0] ?? "")).toUpperCase();
|
|
@@ -1285,11 +1331,10 @@ function initials(name) {
|
|
|
1285
1331
|
*/
|
|
1286
1332
|
function ShareDialog({ resourceName, members, linkAccess, link, onInvite, onRoleChange, onRemove, onLinkAccessChange, roles = DEFAULT_ROLES, open, onOpenChange, trigger, labels = {}, className }) {
|
|
1287
1333
|
const roleKeys = Object.keys(roles);
|
|
1288
|
-
const [email, setEmail] = useState("");
|
|
1289
|
-
const [inviteRole, setInviteRole] = useState(roleKeys[0] ?? "");
|
|
1290
1334
|
const l = {
|
|
1291
1335
|
title: (name) => `Share "${name}"`,
|
|
1292
1336
|
emailPlaceholder: "Add people by email",
|
|
1337
|
+
invalidEmail: "Enter a valid email",
|
|
1293
1338
|
invite: "Invite",
|
|
1294
1339
|
people: "People with access",
|
|
1295
1340
|
owner: "Owner",
|
|
@@ -1304,13 +1349,18 @@ function ShareDialog({ resourceName, members, linkAccess, link, onInvite, onRole
|
|
|
1304
1349
|
copyLink: "Copy link",
|
|
1305
1350
|
...labels
|
|
1306
1351
|
};
|
|
1307
|
-
const
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1352
|
+
const form = useAppForm({
|
|
1353
|
+
defaultValues: {
|
|
1354
|
+
email: "",
|
|
1355
|
+
role: roleKeys[0] ?? ""
|
|
1356
|
+
},
|
|
1357
|
+
onSubmit: ({ value, formApi }) => {
|
|
1358
|
+
const email = value.email.trim();
|
|
1359
|
+
if (!email) return;
|
|
1360
|
+
onInvite(email, value.role);
|
|
1361
|
+
formApi.resetField("email");
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1314
1364
|
const roleOptions = roleKeys.map((key) => /* @__PURE__ */ jsx(Select.Option, {
|
|
1315
1365
|
value: key,
|
|
1316
1366
|
children: roles[key]
|
|
@@ -1324,34 +1374,35 @@ function ShareDialog({ resourceName, members, linkAccess, link, onInvite, onRole
|
|
|
1324
1374
|
children: [/* @__PURE__ */ jsx(LayerDialog.Title, { children: l.title(resourceName) }), /* @__PURE__ */ jsx(LayerDialog.Body, { children: /* @__PURE__ */ jsxs("div", {
|
|
1325
1375
|
className: cn("flex flex-col gap-4", className),
|
|
1326
1376
|
children: [
|
|
1327
|
-
/* @__PURE__ */ jsxs(
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
/* @__PURE__ */ jsx(
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
/* @__PURE__ */ jsx(Select, {
|
|
1340
|
-
"aria-label": l.roleFor(email || l.invite),
|
|
1341
|
-
value: inviteRole,
|
|
1342
|
-
onValueChange: (value) => setInviteRole(value),
|
|
1343
|
-
renderValue: (value) => roles[value],
|
|
1344
|
-
className: "w-26",
|
|
1345
|
-
children: roleOptions
|
|
1346
|
-
}),
|
|
1347
|
-
/* @__PURE__ */ jsx(Button, {
|
|
1348
|
-
type: "submit",
|
|
1349
|
-
variant: "primary",
|
|
1350
|
-
disabled: !valid,
|
|
1351
|
-
children: l.invite
|
|
1377
|
+
/* @__PURE__ */ jsx(form.AppForm, { children: /* @__PURE__ */ jsxs(form.Form, {
|
|
1378
|
+
className: "flex items-start gap-2",
|
|
1379
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1380
|
+
className: "min-w-0 flex-1",
|
|
1381
|
+
children: /* @__PURE__ */ jsx(form.AppField, {
|
|
1382
|
+
name: "email",
|
|
1383
|
+
validators: { onChange: email(l.invalidEmail) },
|
|
1384
|
+
children: (field) => /* @__PURE__ */ jsx(field.TextField, {
|
|
1385
|
+
type: "email",
|
|
1386
|
+
"aria-label": l.emailPlaceholder,
|
|
1387
|
+
placeholder: l.emailPlaceholder
|
|
1388
|
+
})
|
|
1352
1389
|
})
|
|
1353
|
-
|
|
1354
|
-
|
|
1390
|
+
}), /* @__PURE__ */ jsx(form.Subscribe, {
|
|
1391
|
+
selector: (s) => s.values.email.trim(),
|
|
1392
|
+
children: (email) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(form.AppField, {
|
|
1393
|
+
name: "role",
|
|
1394
|
+
children: (field) => /* @__PURE__ */ jsx(field.SelectField, {
|
|
1395
|
+
"aria-label": l.roleFor(email || l.invite),
|
|
1396
|
+
items: roles,
|
|
1397
|
+
renderValue: (value) => roles[value],
|
|
1398
|
+
className: "w-26"
|
|
1399
|
+
})
|
|
1400
|
+
}), /* @__PURE__ */ jsx(form.SubmitButton, {
|
|
1401
|
+
disabled: !email,
|
|
1402
|
+
children: l.invite
|
|
1403
|
+
})] })
|
|
1404
|
+
})]
|
|
1405
|
+
}) }),
|
|
1355
1406
|
/* @__PURE__ */ jsxs("section", {
|
|
1356
1407
|
className: "flex flex-col gap-1",
|
|
1357
1408
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
@@ -224,4 +224,4 @@ declare const LinkButton: React.ForwardRefExoticComponent<React.AnchorHTMLAttrib
|
|
|
224
224
|
linksExternal?: boolean;
|
|
225
225
|
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
226
226
|
//#endregion
|
|
227
|
-
export {
|
|
227
|
+
export { LinkButton as a, buttonVariants as c, KumoButtonVariantsProps as i, ButtonProps as n, LinkButtonProps as o, KumoButtonVariant as r, RefreshButton as s, Button as t };
|
|
@@ -13,7 +13,7 @@ import { CheckIcon, MinusIcon } from "@phosphor-icons/react";
|
|
|
13
13
|
const KUMO_CHECKBOX_VARIANTS = {
|
|
14
14
|
variant: {
|
|
15
15
|
default: {
|
|
16
|
-
classes: "[&:focus-within>span]:ring-kumo-focus [&:hover>span]:ring-kumo-
|
|
16
|
+
classes: "[&:focus-within>span]:ring-kumo-focus [&:hover>span]:ring-kumo-interact",
|
|
17
17
|
description: "Default checkbox appearance"
|
|
18
18
|
},
|
|
19
19
|
error: {
|
|
@@ -56,7 +56,7 @@ const CheckboxBase = forwardRef(({ className, checked, indeterminate, disabled,
|
|
|
56
56
|
indeterminate,
|
|
57
57
|
disabled,
|
|
58
58
|
onCheckedChange,
|
|
59
|
-
className: cn("relative flex
|
|
59
|
+
className: cn("relative flex size-3.5 shrink-0 items-center justify-center rounded-sm border-0 bg-kumo-base ring after:absolute after:-inset-x-3 after:-inset-y-2 focus:outline-hidden", label && "mt-0.75", variant === "error" ? "ring-kumo-danger" : "ring-kumo-interact", !disabled && "hover:ring-kumo-interact focus:ring-2 focus:ring-kumo-focus focus-visible:ring-2 focus-visible:ring-kumo-brand", "data-[checked]:bg-kumo-contrast data-[checked]:ring-kumo-contrast data-[indeterminate]:bg-kumo-contrast data-[indeterminate]:ring-kumo-contrast", disabled && "cursor-not-allowed opacity-50", className),
|
|
60
60
|
...props,
|
|
61
61
|
children: /* @__PURE__ */ jsx(CheckboxIndicator, {
|
|
62
62
|
keepMounted: true,
|
|
@@ -65,10 +65,10 @@ const CheckboxBase = forwardRef(({ className, checked, indeterminate, disabled,
|
|
|
65
65
|
...renderProps,
|
|
66
66
|
children: state.indeterminate ? /* @__PURE__ */ jsx(MinusIcon, {
|
|
67
67
|
weight: "bold",
|
|
68
|
-
size:
|
|
68
|
+
size: 10
|
|
69
69
|
}) : /* @__PURE__ */ jsx(CheckIcon, {
|
|
70
70
|
weight: "bold",
|
|
71
|
-
size:
|
|
71
|
+
size: 10
|
|
72
72
|
})
|
|
73
73
|
})
|
|
74
74
|
})
|
|
@@ -100,10 +100,10 @@ const CheckboxItem = forwardRef(({ className, checked, indeterminate, disabled,
|
|
|
100
100
|
...renderProps,
|
|
101
101
|
children: state.indeterminate ? /* @__PURE__ */ jsx(MinusIcon, {
|
|
102
102
|
weight: "bold",
|
|
103
|
-
size:
|
|
103
|
+
size: 10
|
|
104
104
|
}) : /* @__PURE__ */ jsx(CheckIcon, {
|
|
105
105
|
weight: "bold",
|
|
106
|
-
size:
|
|
106
|
+
size: 10
|
|
107
107
|
})
|
|
108
108
|
})
|
|
109
109
|
});
|
|
@@ -130,7 +130,7 @@ const CheckboxItem = forwardRef(({ className, checked, indeterminate, disabled,
|
|
|
130
130
|
indeterminate,
|
|
131
131
|
disabled,
|
|
132
132
|
onCheckedChange,
|
|
133
|
-
className: cn("relative mt-0.
|
|
133
|
+
className: cn("relative mt-0.75 flex size-3.5 shrink-0 items-center justify-center rounded-sm border-0 bg-kumo-base ring focus:ring-kumo-focus focus:outline-hidden focus-visible:ring-2 focus-visible:ring-kumo-brand", variant === "error" ? "ring-kumo-danger" : "ring-kumo-interact", !disabled && variant !== "error" && "group-hover:ring-kumo-interact", "data-[checked]:bg-kumo-contrast data-[checked]:ring-kumo-contrast data-[indeterminate]:bg-kumo-contrast data-[indeterminate]:ring-kumo-contrast"),
|
|
134
134
|
children: indicator
|
|
135
135
|
})]
|
|
136
136
|
});
|
|
@@ -148,7 +148,7 @@ const CheckboxItem = forwardRef(({ className, checked, indeterminate, disabled,
|
|
|
148
148
|
indeterminate,
|
|
149
149
|
disabled,
|
|
150
150
|
onCheckedChange,
|
|
151
|
-
className: cn("peer relative mt-0.
|
|
151
|
+
className: cn("peer relative mt-0.75 flex size-3.5 shrink-0 items-center justify-center rounded-sm border-0 bg-kumo-base ring after:absolute after:-inset-x-3 after:-inset-y-2", variant === "error" ? "ring-kumo-danger" : "ring-kumo-interact", !disabled && "group-hover:ring-kumo-interact hover:ring-kumo-interact focus:ring-2 focus:ring-kumo-focus focus-visible:ring-2 focus-visible:ring-kumo-brand", "data-[checked]:bg-kumo-contrast data-[checked]:ring-kumo-contrast data-[indeterminate]:bg-kumo-contrast data-[indeterminate]:ring-kumo-contrast"),
|
|
152
152
|
children: indicator
|
|
153
153
|
}), /* @__PURE__ */ jsx("span", {
|
|
154
154
|
className: "text-base text-kumo-default",
|