@fldr/ui 0.3.8 → 0.3.10

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.
Files changed (73) hide show
  1. package/README.md +67 -448
  2. package/ai/component-registry.json +27 -14
  3. package/ai/component-registry.md +3 -3
  4. package/dist/.build-complete +1 -1
  5. package/dist/blocks-source/auth-card/auth-card.test.tsx +20 -14
  6. package/dist/blocks-source/auth-card/auth-card.tsx +73 -55
  7. package/dist/blocks-source/file-table/file-table.tsx +197 -150
  8. package/dist/blocks-source/login-page/login-page.tsx +3 -1
  9. package/dist/blocks-source/share-dialog/share-dialog.test.tsx +9 -3
  10. package/dist/blocks-source/share-dialog/share-dialog.tsx +50 -35
  11. package/dist/blocks.d.ts +24 -5
  12. package/dist/blocks.js +250 -197
  13. package/dist/brands.d.ts +143 -0
  14. package/dist/brands.js +92 -0
  15. package/dist/{button-DzavLWXm.d.ts → button-CS82eT0x.d.ts} +1 -1
  16. package/dist/chunks/{checkbox-eifiwbw34xwsikvf.js → checkbox-d5epe4dl78bzy4f8.js} +8 -8
  17. package/dist/chunks/{dropdown-e5zk0ez21busnt0b.js → dropdown-oec4g1w9kbsjsg15.js} +1 -1
  18. package/dist/chunks/highlighter-kb7huz24pcziin6d.js +57 -0
  19. package/dist/chunks/{layer-dialog-m8qb0wzfg3k7406a.js → layer-dialog-ioa3r4ayemppsspx.js} +4 -3
  20. package/dist/chunks/{table-ngl1b5yc8mcur662.js → table-bdye068ekayq3u1n.js} +1 -1
  21. package/dist/chunks/table-n5yarooiknhc18ln.js +448 -0
  22. package/dist/chunks/{table-of-contents-gkjv9ck8etbz64ej.js → table-of-contents-d3pmkrk223umdz9h.js} +1 -1
  23. package/dist/code/server.js +1 -1
  24. package/dist/code.js +4 -131
  25. package/dist/components/banner.d.ts +1 -1
  26. package/dist/components/button.d.ts +2 -2
  27. package/dist/components/checkbox.d.ts +1 -1
  28. package/dist/components/checkbox.js +1 -1
  29. package/dist/components/dropdown.js +1 -1
  30. package/dist/components/input-group.d.ts +2 -1
  31. package/dist/components/input.d.ts +2 -2
  32. package/dist/components/layer-dialog.js +1 -1
  33. package/dist/components/link.d.ts +2 -67
  34. package/dist/components/sidebar.d.ts +2 -1
  35. package/dist/components/table-of-contents.js +1 -1
  36. package/dist/components/table.d.ts +1 -1
  37. package/dist/components/table.js +1 -1
  38. package/dist/components/toast.d.ts +1 -1
  39. package/dist/components/toolbar.d.ts +1 -1
  40. package/dist/form.d.ts +207 -0
  41. package/dist/form.js +317 -0
  42. package/dist/hotkeys.d.ts +135 -0
  43. package/dist/hotkeys.js +203 -0
  44. package/dist/index-9LwQy84o.d.ts +1 -0
  45. package/dist/index-B7iG0qDU.d.ts +1 -0
  46. package/dist/{index-B6JNUfG9.d.ts → index-BMXHK-3k.d.ts} +2 -2
  47. package/dist/{index-B6Wo_iiN.d.ts → index-B_ug9XY7.d.ts} +1 -1
  48. package/dist/{index-RP_rt8vB.d.ts → index-Bh9kuAvN.d.ts} +1 -1
  49. package/dist/{index-DjSGDESy.d.ts → index-CAUjUp2G.d.ts} +1 -1
  50. package/dist/{index-NnHba-T1.d.ts → index-DK28YxxP.d.ts} +2 -2
  51. package/dist/{index-aahL-0Zw.d.ts → index-DOVlARA6.d.ts} +2 -2
  52. package/dist/index-DTj6M6kA.d.ts +1 -0
  53. package/dist/index.d.ts +14 -12
  54. package/dist/index.js +5 -6
  55. package/dist/{input-group-8gEtPiKw.d.ts → input-group-Swzit45o.d.ts} +1 -1
  56. package/dist/link-CoVXE5W2.d.ts +68 -0
  57. package/dist/query.d.ts +156 -0
  58. package/dist/query.js +204 -0
  59. package/dist/router.d.ts +95 -0
  60. package/dist/router.js +146 -0
  61. package/dist/skeleton.d.ts +3 -0
  62. package/dist/skeleton.js +4 -0
  63. package/dist/styles/kumo-binding.css +36 -0
  64. package/dist/styles/kumo-standalone.css +1 -1
  65. package/dist/styles/theme-fldr.css +18 -18
  66. package/dist/table.d.ts +245 -0
  67. package/dist/table.js +3 -0
  68. package/dist/theming.d.ts +4 -4
  69. package/dist/theming.js +2 -2
  70. package/package.json +46 -1
  71. package/dist/chunks/highlighter-mouttug0tu8xg1i8.js +0 -1364
  72. package/dist/index-DL1-uSuH.d.ts +0 -1
  73. /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-eifiwbw34xwsikvf.js";
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
- import { t as DropdownMenu } from "./chunks/dropdown-e5zk0ez21busnt0b.js";
8
+ import { t as DropdownMenu } from "./chunks/dropdown-oec4g1w9kbsjsg15.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-m8qb0wzfg3k7406a.js";
14
+ import { t as LayerDialog } from "./chunks/layer-dialog-ioa3r4ayemppsspx.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-n5yarooiknhc18ln.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, CaretDownIcon, CaretUpIcon, ChatCircleIcon, CheckCircleIcon, CircleIcon, DotsThreeIcon, FileIcon, FileImageIcon, FilePdfIcon, FileXlsIcon, FolderSimpleIcon, GlobeIcon, LockIcon, PencilSimpleIcon, ShareNetworkIcon, TrashIcon, UploadSimpleIcon, WarningCircleIcon, XIcon } from "@phosphor-icons/react";
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 handleSubmit = (event) => {
276
- event.preventDefault();
277
- if (loading) return;
278
- const data = new FormData(event.currentTarget);
279
- const get = (key) => {
280
- const value = data.get(key);
281
- return typeof value === "string" ? value : void 0;
282
- };
283
- onSubmit({
284
- email: get("email") ?? "",
285
- ...hasPassword && { password: get("password") ?? "" },
286
- ...isSignUp && { name: get("name") ?? "" }
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("form", {
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(Input, {
335
- label: labels.name,
337
+ isSignUp && /* @__PURE__ */ jsx(form.AppField, {
336
338
  name: "name",
337
- autoComplete: "name",
338
- required: true,
339
- disabled: loading
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(Input, {
342
- label: labels.email,
346
+ /* @__PURE__ */ jsx(form.AppField, {
343
347
  name: "email",
344
- type: "email",
345
- autoComplete: "email",
346
- placeholder: "you@example.com",
347
- required: true,
348
- disabled: loading
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(Input, {
351
- label: labels.password,
357
+ hasPassword && /* @__PURE__ */ jsx(form.AppField, {
352
358
  name: "password",
353
- type: "password",
354
- autoComplete: isSignUp ? "new-password" : "current-password",
355
- required: true,
356
- disabled: loading
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(Button, {
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,132 +488,167 @@ 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
- if (items.length === 0 && empty) return /* @__PURE__ */ jsx(Fragment$1, { children: empty });
495
- const allSelected = items.length > 0 && selected.length === items.length;
496
- const toggle = (id, checked) => setSelected(checked ? [...selected, id] : selected.filter((s) => s !== id));
497
- const head = (key, label, cls) => {
498
- const active = sort.key === key;
499
- const Caret = sort.direction === "asc" ? CaretUpIcon : CaretDownIcon;
500
- return /* @__PURE__ */ jsx(Table.Head, {
501
- className: cn("font-medium", cls),
502
- "aria-sort": active ? sort.direction === "asc" ? "ascending" : "descending" : void 0,
503
- children: /* @__PURE__ */ jsxs("button", {
504
- type: "button",
505
- className: "inline-flex cursor-pointer items-center gap-1 text-kumo-subtle hover:text-kumo-default",
506
- onClick: () => setSort({
507
- key,
508
- direction: active && sort.direction === "asc" ? "desc" : "asc"
509
- }),
510
- children: [label, active && /* @__PURE__ */ jsx(Caret, {
511
- size: 12,
512
- weight: "bold",
513
- "aria-hidden": true
514
- })]
515
- })
516
- });
517
- };
518
- const bulk = typeof bulkActions === "function" ? bulkActions(selected) : bulkActions;
519
- return /* @__PURE__ */ jsxs("div", {
520
- className: cn("w-full", className),
521
- children: [selectable && selected.length > 0 && /* @__PURE__ */ jsxs("div", {
522
- role: "toolbar",
523
- "aria-label": labels.selected(selected.length),
524
- className: "flex items-center gap-2 bg-kumo-tint px-3 py-1.5",
525
- children: [/* @__PURE__ */ jsx("span", {
526
- className: "text-sm font-medium text-kumo-default",
527
- children: labels.selected(selected.length)
528
- }), /* @__PURE__ */ jsxs("div", {
529
- className: "ml-auto flex items-center gap-1.5",
530
- children: [bulk, /* @__PURE__ */ jsx(Button, {
531
- variant: "ghost",
532
- size: "sm",
533
- shape: "square",
534
- icon: /* @__PURE__ */ jsx(XIcon, {}),
535
- "aria-label": labels.clearSelection,
536
- onClick: () => setSelected([])
537
- })]
538
- })]
539
- }), /* @__PURE__ */ jsxs(Table, { children: [/* @__PURE__ */ jsx(Table.Header, {
540
- variant: "compact",
541
- children: /* @__PURE__ */ jsxs(Table.Row, { children: [
542
- selectable && /* @__PURE__ */ jsx(Table.CheckHead, {
543
- label: labels.selectAll,
544
- checked: allSelected,
545
- indeterminate: selected.length > 0 && !allSelected,
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
604
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
558
+ });
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
+ ]);
605
652
  }
606
653
  //#endregion
607
654
  //#region src/blocks/onboarding-checklist/onboarding-checklist.tsx
@@ -1041,9 +1088,11 @@ function FolderGrid({ items, selectable = false, selectedIds, defaultSelectedIds
1041
1088
  *
1042
1089
  * @example
1043
1090
  * ```tsx
1091
+ * import { Google } from "@fldr/ui/brands";
1092
+ *
1044
1093
  * <LoginPage
1045
1094
  * logo={<FldrMark />}
1046
- * providers={[{ id: "google", label: "Continue with Google", icon: <GoogleLogoIcon /> }]}
1095
+ * providers={[{ id: "google", label: "Continue with Google", icon: <Google /> }]}
1047
1096
  * onProvider={startOAuth}
1048
1097
  * onSubmit={({ email, password }) => signIn(email, password)}
1049
1098
  * legal={<>By continuing you agree to the <a href="/terms">Terms</a>.</>}
@@ -1259,7 +1308,6 @@ const DEFAULT_ROLES = {
1259
1308
  viewer: "Viewer",
1260
1309
  editor: "Editor"
1261
1310
  };
1262
- const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
1263
1311
  function initials(name) {
1264
1312
  const parts = name.trim().split(/\s+/);
1265
1313
  return ((parts[0]?.[0] ?? "") + (parts[1]?.[0] ?? "")).toUpperCase();
@@ -1285,11 +1333,10 @@ function initials(name) {
1285
1333
  */
1286
1334
  function ShareDialog({ resourceName, members, linkAccess, link, onInvite, onRoleChange, onRemove, onLinkAccessChange, roles = DEFAULT_ROLES, open, onOpenChange, trigger, labels = {}, className }) {
1287
1335
  const roleKeys = Object.keys(roles);
1288
- const [email, setEmail] = useState("");
1289
- const [inviteRole, setInviteRole] = useState(roleKeys[0] ?? "");
1290
1336
  const l = {
1291
1337
  title: (name) => `Share "${name}"`,
1292
1338
  emailPlaceholder: "Add people by email",
1339
+ invalidEmail: "Enter a valid email",
1293
1340
  invite: "Invite",
1294
1341
  people: "People with access",
1295
1342
  owner: "Owner",
@@ -1304,13 +1351,18 @@ function ShareDialog({ resourceName, members, linkAccess, link, onInvite, onRole
1304
1351
  copyLink: "Copy link",
1305
1352
  ...labels
1306
1353
  };
1307
- const valid = EMAIL_RE.test(email.trim());
1308
- const submit = (event) => {
1309
- event.preventDefault();
1310
- if (!valid) return;
1311
- onInvite(email.trim(), inviteRole);
1312
- setEmail("");
1313
- };
1354
+ const form = useAppForm({
1355
+ defaultValues: {
1356
+ email: "",
1357
+ role: roleKeys[0] ?? ""
1358
+ },
1359
+ onSubmit: ({ value, formApi }) => {
1360
+ const email = value.email.trim();
1361
+ if (!email) return;
1362
+ onInvite(email, value.role);
1363
+ formApi.resetField("email");
1364
+ }
1365
+ });
1314
1366
  const roleOptions = roleKeys.map((key) => /* @__PURE__ */ jsx(Select.Option, {
1315
1367
  value: key,
1316
1368
  children: roles[key]
@@ -1324,34 +1376,35 @@ function ShareDialog({ resourceName, members, linkAccess, link, onInvite, onRole
1324
1376
  children: [/* @__PURE__ */ jsx(LayerDialog.Title, { children: l.title(resourceName) }), /* @__PURE__ */ jsx(LayerDialog.Body, { children: /* @__PURE__ */ jsxs("div", {
1325
1377
  className: cn("flex flex-col gap-4", className),
1326
1378
  children: [
1327
- /* @__PURE__ */ jsxs("form", {
1328
- onSubmit: submit,
1329
- className: "flex gap-2",
1330
- children: [
1331
- /* @__PURE__ */ jsx(Input, {
1332
- type: "email",
1333
- "aria-label": l.emailPlaceholder,
1334
- placeholder: l.emailPlaceholder,
1335
- value: email,
1336
- onChange: (event) => setEmail(event.target.value),
1337
- className: "min-w-0 flex-1"
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
1379
+ /* @__PURE__ */ jsx(form.AppForm, { children: /* @__PURE__ */ jsxs(form.Form, {
1380
+ className: "flex items-start gap-2",
1381
+ children: [/* @__PURE__ */ jsx("div", {
1382
+ className: "min-w-0 flex-1",
1383
+ children: /* @__PURE__ */ jsx(form.AppField, {
1384
+ name: "email",
1385
+ validators: { onChange: email(l.invalidEmail) },
1386
+ children: (field) => /* @__PURE__ */ jsx(field.TextField, {
1387
+ type: "email",
1388
+ "aria-label": l.emailPlaceholder,
1389
+ placeholder: l.emailPlaceholder
1390
+ })
1352
1391
  })
1353
- ]
1354
- }),
1392
+ }), /* @__PURE__ */ jsx(form.Subscribe, {
1393
+ selector: (s) => s.values.email.trim(),
1394
+ children: (email) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(form.AppField, {
1395
+ name: "role",
1396
+ children: (field) => /* @__PURE__ */ jsx(field.SelectField, {
1397
+ "aria-label": l.roleFor(email || l.invite),
1398
+ items: roles,
1399
+ renderValue: (value) => roles[value],
1400
+ className: "w-26"
1401
+ })
1402
+ }), /* @__PURE__ */ jsx(form.SubmitButton, {
1403
+ disabled: !email,
1404
+ children: l.invite
1405
+ })] })
1406
+ })]
1407
+ }) }),
1355
1408
  /* @__PURE__ */ jsxs("section", {
1356
1409
  className: "flex flex-col gap-1",
1357
1410
  children: [/* @__PURE__ */ jsx("h3", {