@softure-ai/theme-notion 0.10.3 → 0.11.0
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/CHANGELOG.md +22 -0
- package/README.md +68 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/messages/en.d.ts +17 -0
- package/dist/messages/en.d.ts.map +1 -1
- package/dist/messages/en.js +17 -0
- package/dist/messages/en.js.map +1 -1
- package/dist/messages/index.d.ts +17 -0
- package/dist/messages/index.d.ts.map +1 -1
- package/dist/notion/RouteLoading.d.ts +14 -0
- package/dist/notion/RouteLoading.d.ts.map +1 -0
- package/dist/notion/RouteLoading.js +11 -0
- package/dist/notion/RouteLoading.js.map +1 -0
- package/dist/notion/TopLoadingBar.d.ts +15 -0
- package/dist/notion/TopLoadingBar.d.ts.map +1 -0
- package/dist/notion/TopLoadingBar.js +10 -0
- package/dist/notion/TopLoadingBar.js.map +1 -0
- package/dist/notion/Upload.d.ts +66 -0
- package/dist/notion/Upload.d.ts.map +1 -0
- package/dist/notion/Upload.js +128 -0
- package/dist/notion/Upload.js.map +1 -0
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +17 -2
- package/dist/ui/progress.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +15 -0
- package/src/messages/en.ts +17 -0
- package/src/notion/RouteLoading.tsx +34 -0
- package/src/notion/TopLoadingBar.tsx +28 -0
- package/src/notion/Upload.tsx +339 -0
- package/src/ui/dialog.tsx +1 -1
- package/src/ui/progress.tsx +18 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@ Newest first. Each version lists what changed for an app that uses the theme. Wh
|
|
|
4
4
|
production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
|
|
5
5
|
"Definition of done").
|
|
6
6
|
|
|
7
|
+
## 0.11.0
|
|
8
|
+
|
|
9
|
+
- An upload control (#950): `UploadField` (a labelled area whose touch-sized button opens the native file picker,
|
|
10
|
+
`accept`/`multiple`/`capture` passed through, with dropping on wide screens), `UploadList` and `UploadItem` (one row
|
|
11
|
+
per file: name, size by locale, a `Status` word for `queued`, `uploading`, `paused`, `done` or `failed`, a
|
|
12
|
+
determinate `Progress`, the error and Retry, Pause, Resume and Remove buttons by callback), and `formatFileSize`.
|
|
13
|
+
Controlled and transport-free: the app or its upload transport owns the items. Copy in `notionMessages.en.upload`,
|
|
14
|
+
replaced through `messages`. New exports only.
|
|
15
|
+
- `DialogFooter showCloseButton` renders its close button before `children` (#921): with a confirm button in
|
|
16
|
+
`children`, cancel sits left of confirm from `sm` and below it on a phone (`flex-col-reverse`), the order of
|
|
17
|
+
`AlertDialogFooter`. Before, the close button came last. The button already had `type="button"` (from Radix
|
|
18
|
+
`DialogClose`), so in a form dialog it closes the dialog without submitting the form; a test now guards that.
|
|
19
|
+
An app that wants another order places its own `DialogClose`.
|
|
20
|
+
- A thin top loading bar for wide screens (#923): `TopLoadingBar` is a 2 px, square `Progress` fixed to the top edge
|
|
21
|
+
on a transparent track, `pointer-events-none`, so the page stays usable while a route loads; driven by the pwa
|
|
22
|
+
counter (`buildLaunchProgressScript({ rootSlot: "top-loading-bar" })`) or indeterminate. `RouteLoading` streams it
|
|
23
|
+
with `LaunchScreen` and lets CSS pick: the launch screen below `md` or in an installed app, the bar in a wide browser
|
|
24
|
+
tab, so `app/loading.tsx` needs no request reading and pages stay static.
|
|
25
|
+
- `Progress` without a `value` is indeterminate: a third of the track slides across it (still, full and half-opaque
|
|
26
|
+
with reduced motion). Before, it drew an empty track. With a value it draws as before; its indicator carries the
|
|
27
|
+
indeterminate classes under `data-[state=indeterminate]:`.
|
|
28
|
+
|
|
7
29
|
## 0.10.3
|
|
8
30
|
|
|
9
31
|
- Dialog sizes for a popup: `DialogContent size` gains `"lg"` and `"sm"`. `lg` is the standard popup, centred with a
|
package/README.md
CHANGED
|
@@ -140,7 +140,11 @@ stages with a state, below), `Timeline` (dated entries on a vertical rail, below
|
|
|
140
140
|
`MiniProgress` (a compact bar with its figure inside, for a table cell or a tile, below),
|
|
141
141
|
`UpdatePrompt` (the offer to reload into a new build, for an installed app, below),
|
|
142
142
|
`InstallBar` (the offer to install the app on a phone, below),
|
|
143
|
-
`LaunchScreen` (an installed app's icon, name and progress while its first page loads, below)
|
|
143
|
+
`LaunchScreen` (an installed app's icon, name and progress while its first page loads, below),
|
|
144
|
+
`TopLoadingBar` (a thin bar at the top while a route loads on a wide screen, below),
|
|
145
|
+
`RouteLoading` (the launch screen or the top bar, picked by the browser, below),
|
|
146
|
+
`UploadField`, `UploadList` and `UploadItem` (pick or drop files, one row per file with progress, retry and remove,
|
|
147
|
+
below).
|
|
144
148
|
|
|
145
149
|
**Touch sizes.** The controls a phone view taps most reach the `touch-target` token (44 px, Apple's HIG and WCAG
|
|
146
150
|
2.5.5): `Button` sizes `touch` (44 px high, padded like `lg`) and `icon-touch` (44 × 44), `SelectTrigger`
|
|
@@ -437,6 +441,65 @@ export default function Loading() {
|
|
|
437
441
|
}
|
|
438
442
|
```
|
|
439
443
|
|
|
444
|
+
**`TopLoadingBar`.** The wide-screen counterpart of `LaunchScreen`: a `Progress` fixed to the top edge (`inset-x-0
|
|
445
|
+
top-0 z-50`), 2 px high, square, on a transparent track and `pointer-events-none`, so the page under it stays usable
|
|
446
|
+
while a route loads. Named by `label`; `value` (0–100) when the app knows the progress, otherwise it is indeterminate:
|
|
447
|
+
a third of the track sliding across it for ever (still, full and half-opaque with reduced motion). The inline `script`
|
|
448
|
+
(`buildLaunchProgressScript({ rootSlot: "top-loading-bar" })` from `@softure-ai/pwa`) gives it the launch counter's
|
|
449
|
+
values where the browser runs it, a streamed first load; its first value makes the bar determinate. A client-side
|
|
450
|
+
navigation never runs a script React inserts, so there the bar keeps sliding. Any `Progress` without a `value` is
|
|
451
|
+
indeterminate the same way.
|
|
452
|
+
|
|
453
|
+
**`RouteLoading`.** The loading state for the root `app/loading.tsx`, picked in the browser, so reading the request
|
|
454
|
+
(which makes static pages dynamic) is not needed: it streams both `LaunchScreen` and `TopLoadingBar` and CSS shows
|
|
455
|
+
the launch screen below `md` or in an installed app (`display-mode: standalone`), the top bar on a wide screen in a
|
|
456
|
+
browser tab (`md` and `display-mode: browser`). Each takes its own counter script:
|
|
457
|
+
|
|
458
|
+
```tsx
|
|
459
|
+
// app/loading.tsx
|
|
460
|
+
import { buildLaunchProgressScript, ICONS_PATH } from "@softure-ai/pwa";
|
|
461
|
+
const LAUNCH_SCRIPT = buildLaunchProgressScript();
|
|
462
|
+
const BAR_SCRIPT = buildLaunchProgressScript({ rootSlot: "top-loading-bar" });
|
|
463
|
+
export default function Loading() {
|
|
464
|
+
return (
|
|
465
|
+
<RouteLoading
|
|
466
|
+
name={messages.app.name}
|
|
467
|
+
iconSrc={`${ICONS_PATH}/icon-192.png`}
|
|
468
|
+
label={messages.pwa.launch.label}
|
|
469
|
+
launchScript={LAUNCH_SCRIPT}
|
|
470
|
+
barScript={BAR_SCRIPT}
|
|
471
|
+
/>
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
An app with a local top bar and a stand-in script object for `launchProgress` drops both for `RouteLoading` (or
|
|
477
|
+
`TopLoadingBar` with `rootSlot`).
|
|
478
|
+
|
|
479
|
+
**`UploadField`, `UploadList`, `UploadItem`.** A file upload control that holds no files and sends nothing: the app,
|
|
480
|
+
or its transport (e.g. `@softure-ai/files`), keeps the list and does the uploading. `UploadField` is a `Field` with a
|
|
481
|
+
`label` (and optional `description` and `error`) around a dashed area: a touch-sized `Button` opens the native
|
|
482
|
+
`<input type="file">` (`accept`, `multiple` and `capture` passed through, so a phone offers its files, photos and
|
|
483
|
+
camera), and from `md` up files can also be dropped on the area, which highlights while they are dragged over it. Each
|
|
484
|
+
pick or drop goes to `onFilesSelected(files)`: only the files matching `accept` (the picker enforces it, a drop is
|
|
485
|
+
checked by extension and MIME type), the first one without `multiple`; dropped files that do not match go to
|
|
486
|
+
`onFilesRejected`. `UploadList` is the named `ul`; `UploadItem` draws one `UploadFileItem` (`{ id, name, size, state,
|
|
487
|
+
progress?, error? }`): the name, the size by `locale` (`formatFileSize`, decimal steps, e.g. "52.4 MB"), the state as
|
|
488
|
+
a `Status` word (`queued` gray, `uploading` blue, `paused` orange, `done` green, `failed` red), a determinate
|
|
489
|
+
`Progress` while uploading or paused, and under a failed row its `error`. Buttons show with their callbacks, each
|
|
490
|
+
called with the item: Retry on a failed row (`onRetry`), Pause while uploading (`onPause`), Resume when paused
|
|
491
|
+
(`onResume`) and Remove in every state (`onRemove`). Copy is `notionMessages.en.upload` (`{name}` is the file's
|
|
492
|
+
name); `messages` replaces any of it.
|
|
493
|
+
|
|
494
|
+
```tsx
|
|
495
|
+
<UploadField label="Videos" accept="video/*" multiple onFilesSelected={(files) => uploads.add(files)} />
|
|
496
|
+
<UploadList label="Files">
|
|
497
|
+
{uploads.items.map((item) => (
|
|
498
|
+
<UploadItem key={item.id} item={item} onRetry={uploads.retry} onPause={uploads.pause} onResume={uploads.resume} onRemove={uploads.remove} />
|
|
499
|
+
))}
|
|
500
|
+
</UploadList>
|
|
501
|
+
```
|
|
502
|
+
|
|
440
503
|
**`SortableList`.** A list whose rows are reordered by dragging, built on the headless `@dnd-kit/core` and
|
|
441
504
|
`@dnd-kit/sortable`. On a touch screen a long press (`holdDelay`, 500 ms) lifts a row; moving more than `tolerance`
|
|
442
505
|
(8 px) before that scrolls instead, and a tap still activates the row. A mouse drags the same way; from the keyboard
|
|
@@ -530,7 +593,10 @@ Deltas from stock shadcn:
|
|
|
530
593
|
quarters of it from `sm`, the 1 rem gutter on a phone; its height is fixed and its content scrolls in a column
|
|
531
594
|
(an app with a fixed header and footer sets `p-0 gap-0` and scrolls its own body with
|
|
532
595
|
`min-h-0 flex-1 overflow-y-auto`). `size="sm"` is a small popup for little data: `max-w-md`, its height by
|
|
533
|
-
content up to the viewport's gutter, then scrolling. `
|
|
596
|
+
content up to the viewport's gutter, then scrolling. `DialogFooter showCloseButton` puts its close button
|
|
597
|
+
before `children`, so a form dialog's footer reads cancel then confirm (confirm on top on a phone); the button is
|
|
598
|
+
`type="button"`, so inside a `<form>` it closes the dialog without submitting. `card`: `shadow-card` instead of a
|
|
599
|
+
border.
|
|
534
600
|
- `checkbox` 16 px with a 1.5 px border, `radio-group` drawn the same (round, a `primary` dot), `switch` 26 × 16
|
|
535
601
|
(thumb shadow in `SWITCH_THUMB_SHADOW_CLASS`, for a native switch drawn the same), `tooltip` dark without an arrow,
|
|
536
602
|
`tabs` default to the `line` variant, `progress` 6 px.
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export { MiniProgress, type MiniProgressProps } from "./notion/MiniProgress.js";
|
|
|
52
52
|
export { PageFrame, type PageFrameProps } from "./notion/PageFrame.js";
|
|
53
53
|
export { PageHeader, type PageCrumb, type PageHeaderProps } from "./notion/PageHeader.js";
|
|
54
54
|
export { PropertyList, type Property, type PropertyListProps } from "./notion/PropertyList.js";
|
|
55
|
+
export { RouteLoading, type RouteLoadingProps } from "./notion/RouteLoading.js";
|
|
55
56
|
export { SheetMenu, SheetMenuButton, SheetMenuItem, type SheetMenuButtonProps } from "./notion/SheetMenu.js";
|
|
56
57
|
export { SidePanel, type SidePanelLayout, type SidePanelProps } from "./notion/SidePanel.js";
|
|
57
58
|
export { SortableActivator, SortableHandle, SortableItem, SortableList, type SortableActivatorProps, type SortableAnnouncements, type SortableDragBy, type SortableHandleProps, type SortableItemProps, type SortableListProps, type SortableMove, } from "./notion/Sortable.js";
|
|
@@ -60,6 +61,8 @@ export { Status, type StatusProps } from "./notion/Status.js";
|
|
|
60
61
|
export { Steps, type StepItem, type StepState, type StepsLayout, type StepsProps } from "./notion/Steps.js";
|
|
61
62
|
export { TabBar, type TabBarItem, type TabBarProps } from "./notion/TabBar.js";
|
|
62
63
|
export { Timeline, type TimelineItem, type TimelineItemFold, type TimelineItemSize, type TimelineLine, type TimelineProps } from "./notion/Timeline.js";
|
|
64
|
+
export { TopLoadingBar, type TopLoadingBarProps } from "./notion/TopLoadingBar.js";
|
|
65
|
+
export { UploadField, UploadItem, UploadList, formatFileSize, type UploadFieldProps, type UploadFileItem, type UploadItemProps, type UploadListProps, type UploadMessages, type UploadMessagesOverride, type UploadState, } from "./notion/Upload.js";
|
|
63
66
|
export { UpdatePrompt, type UpdatePromptProps } from "./notion/UpdatePrompt.js";
|
|
64
67
|
export { TONES, TONE_COLORS, TONE_EDGE, TONE_FILL, TONE_TEXT, type Tone } from "./notion/tones.js";
|
|
65
68
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACp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,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACxJ,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,7 @@ export { MiniProgress } from "./notion/MiniProgress.js";
|
|
|
54
54
|
export { PageFrame } from "./notion/PageFrame.js";
|
|
55
55
|
export { PageHeader } from "./notion/PageHeader.js";
|
|
56
56
|
export { PropertyList } from "./notion/PropertyList.js";
|
|
57
|
+
export { RouteLoading } from "./notion/RouteLoading.js";
|
|
57
58
|
export { SheetMenu, SheetMenuButton, SheetMenuItem } from "./notion/SheetMenu.js";
|
|
58
59
|
export { SidePanel } from "./notion/SidePanel.js";
|
|
59
60
|
export { SortableActivator, SortableHandle, SortableItem, SortableList, } from "./notion/Sortable.js";
|
|
@@ -62,6 +63,8 @@ export { Status } from "./notion/Status.js";
|
|
|
62
63
|
export { Steps } from "./notion/Steps.js";
|
|
63
64
|
export { TabBar } from "./notion/TabBar.js";
|
|
64
65
|
export { Timeline } from "./notion/Timeline.js";
|
|
66
|
+
export { TopLoadingBar } from "./notion/TopLoadingBar.js";
|
|
67
|
+
export { UploadField, UploadItem, UploadList, formatFileSize, } from "./notion/Upload.js";
|
|
65
68
|
export { UpdatePrompt } from "./notion/UpdatePrompt.js";
|
|
66
69
|
export { TONES, TONE_COLORS, TONE_EDGE, TONE_FILL, TONE_TEXT } from "./notion/tones.js";
|
|
67
70
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,oGAAoG;AACpG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAuB,MAAM,qBAAqB,CAAC;AAE1E,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAA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S,EAA6C,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,YAAY,GAQb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,GAOV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAoB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAoE,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAE,MAAM,EAAqC,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAA0G,MAAM,sBAAsB,CAAC;AACxJ,OAAO,EAAE,aAAa,EAA2B,MAAM,2BAA2B,CAAC;AACnF,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,GAQf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC"}
|
package/dist/messages/en.d.ts
CHANGED
|
@@ -35,6 +35,23 @@ export declare const en: {
|
|
|
35
35
|
readonly cancelled: "Cancelled. {item} is back in place.";
|
|
36
36
|
readonly handle: "Drag to reorder";
|
|
37
37
|
};
|
|
38
|
+
readonly upload: {
|
|
39
|
+
readonly choose: "Choose files";
|
|
40
|
+
readonly chooseOne: "Choose a file";
|
|
41
|
+
readonly drop: "or drop them here";
|
|
42
|
+
readonly dropOne: "or drop it here";
|
|
43
|
+
readonly dropping: "Drop to add";
|
|
44
|
+
readonly retry: "Retry";
|
|
45
|
+
readonly pause: "Pause {name}";
|
|
46
|
+
readonly resume: "Resume {name}";
|
|
47
|
+
readonly remove: "Remove {name}";
|
|
48
|
+
readonly progress: "Upload of {name}";
|
|
49
|
+
readonly queued: "Queued";
|
|
50
|
+
readonly uploading: "Uploading";
|
|
51
|
+
readonly paused: "Paused";
|
|
52
|
+
readonly done: "Done";
|
|
53
|
+
readonly failed: "Failed";
|
|
54
|
+
};
|
|
38
55
|
readonly steps: {
|
|
39
56
|
readonly done: "Done";
|
|
40
57
|
readonly current: "Current";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCL,CAAC"}
|
package/dist/messages/en.js
CHANGED
|
@@ -18,6 +18,23 @@ export const en = {
|
|
|
18
18
|
cancelled: "Cancelled. {item} is back in place.",
|
|
19
19
|
handle: "Drag to reorder",
|
|
20
20
|
},
|
|
21
|
+
upload: {
|
|
22
|
+
choose: "Choose files",
|
|
23
|
+
chooseOne: "Choose a file",
|
|
24
|
+
drop: "or drop them here",
|
|
25
|
+
dropOne: "or drop it here",
|
|
26
|
+
dropping: "Drop to add",
|
|
27
|
+
retry: "Retry",
|
|
28
|
+
pause: "Pause {name}",
|
|
29
|
+
resume: "Resume {name}",
|
|
30
|
+
remove: "Remove {name}",
|
|
31
|
+
progress: "Upload of {name}",
|
|
32
|
+
queued: "Queued",
|
|
33
|
+
uploading: "Uploading",
|
|
34
|
+
paused: "Paused",
|
|
35
|
+
done: "Done",
|
|
36
|
+
failed: "Failed",
|
|
37
|
+
},
|
|
21
38
|
steps: { done: "Done", current: "Current", todo: "To do", failed: "Failed" },
|
|
22
39
|
command: { title: "Command Palette", description: "Search for a command to run..." },
|
|
23
40
|
};
|
package/dist/messages/en.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/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E;IACzB,SAAS,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;IAC7B,OAAO,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAChH,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;IAC7B,QAAQ,EAAE;QACR,YAAY,EACV,mIAAmI;QACrI,QAAQ,EAAE,mDAAmD;QAC7D,KAAK,EAAE,iDAAiD;QACxD,OAAO,EAAE,mDAAmD;QAC5D,SAAS,EAAE,qCAAqC;QAChD,MAAM,EAAE,iBAAiB;KAC1B;IACD,MAAM,EAAE;QACN,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,eAAe;QAC1B,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,iBAAiB;QAC1B,QAAQ,EAAE,aAAa;QACvB,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,cAAc;QACrB,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,eAAe;QACvB,QAAQ,EAAE,kBAAkB;QAC5B,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,WAAW;QACtB,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;KACjB;IACD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;IAC5E,OAAO,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,gCAAgC,EAAE;CAC5E,CAAC"}
|
package/dist/messages/index.d.ts
CHANGED
|
@@ -34,6 +34,23 @@ export declare const notionMessages: {
|
|
|
34
34
|
readonly cancelled: "Cancelled. {item} is back in place.";
|
|
35
35
|
readonly handle: "Drag to reorder";
|
|
36
36
|
};
|
|
37
|
+
readonly upload: {
|
|
38
|
+
readonly choose: "Choose files";
|
|
39
|
+
readonly chooseOne: "Choose a file";
|
|
40
|
+
readonly drop: "or drop them here";
|
|
41
|
+
readonly dropOne: "or drop it here";
|
|
42
|
+
readonly dropping: "Drop to add";
|
|
43
|
+
readonly retry: "Retry";
|
|
44
|
+
readonly pause: "Pause {name}";
|
|
45
|
+
readonly resume: "Resume {name}";
|
|
46
|
+
readonly remove: "Remove {name}";
|
|
47
|
+
readonly progress: "Upload of {name}";
|
|
48
|
+
readonly queued: "Queued";
|
|
49
|
+
readonly uploading: "Uploading";
|
|
50
|
+
readonly paused: "Paused";
|
|
51
|
+
readonly done: "Done";
|
|
52
|
+
readonly failed: "Failed";
|
|
53
|
+
};
|
|
37
54
|
readonly steps: {
|
|
38
55
|
readonly done: "Done";
|
|
39
56
|
readonly current: "Current";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,qGAAqG;AACrG,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,qGAAqG;AACrG,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAS,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface RouteLoadingProps {
|
|
2
|
+
/** The app's name, on the launch screen. */
|
|
3
|
+
readonly name: string;
|
|
4
|
+
/** The app's icon, on the launch screen. */
|
|
5
|
+
readonly iconSrc: string;
|
|
6
|
+
/** Both bars' accessible name (`pwaMessages.en.launch.label` in `@softure-ai/pwa`). */
|
|
7
|
+
readonly label: string;
|
|
8
|
+
/** The launch screen's counter: `buildLaunchProgressScript()`. */
|
|
9
|
+
readonly launchScript?: string;
|
|
10
|
+
/** The top bar's counter: `buildLaunchProgressScript({ rootSlot: "top-loading-bar" })`. */
|
|
11
|
+
readonly barScript?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function RouteLoading({ name, iconSrc, label, launchScript, barScript }: RouteLoadingProps): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=RouteLoading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteLoading.d.ts","sourceRoot":"","sources":["../../src/notion/RouteLoading.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,2FAA2F;IAC3F,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAMD,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,iBAAiB,+BAahG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LaunchScreen } from "./LaunchScreen.js";
|
|
3
|
+
import { TopLoadingBar } from "./TopLoadingBar.js";
|
|
4
|
+
// The loading state for `app/loading.tsx`, picked by the browser so the page stays static: the full-screen
|
|
5
|
+
// `LaunchScreen` below the `md` breakpoint or in an installed app (`display-mode: standalone`), the thin
|
|
6
|
+
// `TopLoadingBar` on a wide screen in a browser tab (`display-mode: browser`). Both are streamed; CSS hides the other,
|
|
7
|
+
// so screen readers meet one. The wrapper draws no box (`contents`). Each rule is one stacked media query, so no two display rules compete on order.
|
|
8
|
+
export function RouteLoading({ name, iconSrc, label, launchScript, barScript }) {
|
|
9
|
+
return (_jsxs("div", { "data-slot": "route-loading", className: "contents", children: [_jsx(LaunchScreen, { name: name, iconSrc: iconSrc, label: label, script: launchScript, className: "md:[@media(display-mode:browser)]:hidden" }), _jsx(TopLoadingBar, { label: label, script: barScript, className: "hidden md:[@media(display-mode:browser)]:block" })] }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=RouteLoading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteLoading.js","sourceRoot":"","sources":["../../src/notion/RouteLoading.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAenD,2GAA2G;AAC3G,yGAAyG;AACzG,uHAAuH;AACvH,qJAAqJ;AACrJ,MAAM,UAAU,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAqB;IAC/F,OAAO,CACL,4BAAe,eAAe,EAAC,SAAS,EAAC,UAAU,aACjD,KAAC,YAAY,IACX,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,YAAY,EACpB,SAAS,EAAC,0CAA0C,GACpD,EACF,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAC,gDAAgD,GAAG,IACzG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface TopLoadingBarProps {
|
|
2
|
+
/** The progress bar's accessible name (`pwaMessages.en.launch.label` in `@softure-ai/pwa`). */
|
|
3
|
+
readonly label: string;
|
|
4
|
+
/** 0–100 when the app knows the progress; left out, the bar slides indeterminately. */
|
|
5
|
+
readonly value?: number;
|
|
6
|
+
/**
|
|
7
|
+
* The counter's inline script (`buildLaunchProgressScript({ rootSlot: "top-loading-bar" })` from `@softure-ai/pwa`).
|
|
8
|
+
* Where the browser runs it (a streamed first load) its first value makes the bar determinate; where it does not
|
|
9
|
+
* (a client-side navigation) the bar keeps sliding.
|
|
10
|
+
*/
|
|
11
|
+
readonly script?: string;
|
|
12
|
+
readonly className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function TopLoadingBar({ label, value, script, className }: TopLoadingBarProps): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=TopLoadingBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopLoadingBar.d.ts","sourceRoot":"","sources":["../../src/notion/TopLoadingBar.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uFAAuF;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAKD,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,kBAAkB,+BAOpF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Progress } from "../ui/progress.js";
|
|
4
|
+
// A thin bar along the top edge while a route loads on a wide screen: 2 px, square, on a transparent track, above the
|
|
5
|
+
// page and never in the way of a pointer, so the page under it stays usable. `LaunchScreen` is its full-screen
|
|
6
|
+
// counterpart for a phone or an installed app; `RouteLoading` picks one of the two in the browser.
|
|
7
|
+
export function TopLoadingBar({ label, value, script, className }) {
|
|
8
|
+
return (_jsxs("div", { "data-slot": "top-loading-bar", className: cn("pointer-events-none fixed inset-x-0 top-0 z-50", className), children: [_jsx(Progress, { value: value, "aria-label": label, className: "h-0.5 rounded-none bg-transparent" }), script === undefined ? null : _jsx("script", { dangerouslySetInnerHTML: { __html: script } })] }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=TopLoadingBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopLoadingBar.js","sourceRoot":"","sources":["../../src/notion/TopLoadingBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAgB7C,sHAAsH;AACtH,+GAA+G;AAC/G,mGAAmG;AACnG,MAAM,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAsB;IACnF,OAAO,CACL,4BAAe,iBAAiB,EAAC,SAAS,EAAE,EAAE,CAAC,gDAAgD,EAAE,SAAS,CAAC,aACzG,KAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,gBAAc,KAAK,EAAE,SAAS,EAAC,mCAAmC,GAAG,EAC1F,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAQ,uBAAuB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAI,IAClF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type UploadState = "queued" | "uploading" | "paused" | "done" | "failed";
|
|
3
|
+
/** One file of an upload, as the app or its transport (e.g. `@softure-ai/files`) tracks it. */
|
|
4
|
+
export interface UploadFileItem {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly size: number;
|
|
8
|
+
readonly state: UploadState;
|
|
9
|
+
readonly progress?: number;
|
|
10
|
+
readonly error?: string;
|
|
11
|
+
}
|
|
12
|
+
/** The texts of the upload parts; `{name}` stands for the file's name. Built-in English: `notionMessages.en.upload`. */
|
|
13
|
+
export interface UploadMessages {
|
|
14
|
+
readonly choose: string;
|
|
15
|
+
readonly chooseOne: string;
|
|
16
|
+
readonly drop: string;
|
|
17
|
+
readonly dropOne: string;
|
|
18
|
+
readonly dropping: string;
|
|
19
|
+
readonly retry: string;
|
|
20
|
+
readonly pause: string;
|
|
21
|
+
readonly resume: string;
|
|
22
|
+
readonly remove: string;
|
|
23
|
+
readonly progress: string;
|
|
24
|
+
readonly queued: string;
|
|
25
|
+
readonly uploading: string;
|
|
26
|
+
readonly paused: string;
|
|
27
|
+
readonly done: string;
|
|
28
|
+
readonly failed: string;
|
|
29
|
+
}
|
|
30
|
+
/** The app's wording for the upload parts; each text left out keeps the built-in English one. */
|
|
31
|
+
export type UploadMessagesOverride = Partial<UploadMessages>;
|
|
32
|
+
/** A file size for people, in decimal steps (1 kB = 1000 bytes), written by the locale: `formatFileSize(1500)` is "1.5 kB". */
|
|
33
|
+
export declare function formatFileSize(bytes: number, locale?: string): string;
|
|
34
|
+
export interface UploadFieldProps {
|
|
35
|
+
readonly label: ReactNode;
|
|
36
|
+
readonly description?: ReactNode;
|
|
37
|
+
readonly error?: ReactNode;
|
|
38
|
+
readonly accept?: string;
|
|
39
|
+
readonly multiple?: boolean;
|
|
40
|
+
readonly capture?: "user" | "environment";
|
|
41
|
+
readonly disabled?: boolean;
|
|
42
|
+
readonly onFilesSelected: (files: File[]) => void;
|
|
43
|
+
readonly onFilesRejected?: (files: File[]) => void;
|
|
44
|
+
readonly messages?: UploadMessagesOverride;
|
|
45
|
+
readonly id?: string;
|
|
46
|
+
readonly className?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare function UploadField({ label, description, error, accept, multiple, capture, disabled, onFilesSelected, onFilesRejected, messages, id, className, }: UploadFieldProps): import("react").JSX.Element;
|
|
49
|
+
export interface UploadListProps {
|
|
50
|
+
readonly label: string;
|
|
51
|
+
readonly children: ReactNode;
|
|
52
|
+
readonly className?: string;
|
|
53
|
+
}
|
|
54
|
+
export declare function UploadList({ label, children, className }: UploadListProps): import("react").JSX.Element;
|
|
55
|
+
export interface UploadItemProps {
|
|
56
|
+
readonly item: UploadFileItem;
|
|
57
|
+
readonly onRetry?: (item: UploadFileItem) => void;
|
|
58
|
+
readonly onPause?: (item: UploadFileItem) => void;
|
|
59
|
+
readonly onResume?: (item: UploadFileItem) => void;
|
|
60
|
+
readonly onRemove?: (item: UploadFileItem) => void;
|
|
61
|
+
readonly locale?: string;
|
|
62
|
+
readonly messages?: UploadMessagesOverride;
|
|
63
|
+
readonly className?: string;
|
|
64
|
+
}
|
|
65
|
+
export declare function UploadItem({ item, onRetry, onPause, onResume, onRemove, locale, messages, className }: UploadItemProps): import("react").JSX.Element;
|
|
66
|
+
//# sourceMappingURL=Upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Upload.d.ts","sourceRoot":"","sources":["../../src/notion/Upload.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAYhF,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEhF,+FAA+F;AAC/F,MAAM,WAAW,cAAc;IAE7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAE5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wHAAwH;AACxH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM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AAsB,CAAC;IAC3C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAID,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,eAAe,+BAwD7H"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CircleAlert, CircleCheck, Clock, File as FileIcon, Pause, Play, RotateCw, Upload as UploadIcon, X } from "lucide-react";
|
|
4
|
+
import { useId, useRef, useState } from "react";
|
|
5
|
+
import { en } from "../messages/en.js";
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
|
+
import { Button } from "../ui/button.js";
|
|
8
|
+
import { Field, FieldDescription, FieldError, FieldLabel } from "../ui/field.js";
|
|
9
|
+
import { Progress } from "../ui/progress.js";
|
|
10
|
+
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
11
|
+
import { Status } from "./Status.js";
|
|
12
|
+
const SIZE_UNITS = ["kilobyte", "megabyte", "gigabyte", "terabyte"];
|
|
13
|
+
/** A file size for people, in decimal steps (1 kB = 1000 bytes), written by the locale: `formatFileSize(1500)` is "1.5 kB". */
|
|
14
|
+
export function formatFileSize(bytes, locale = "en") {
|
|
15
|
+
const size = Number.isFinite(bytes) ? Math.max(0, bytes) : 0;
|
|
16
|
+
// Bytes in full ("820 bytes"): the short form of the unit is the bare word "byte" in English.
|
|
17
|
+
if (size < 1000)
|
|
18
|
+
return new Intl.NumberFormat(locale, { style: "unit", unit: "byte", unitDisplay: "long" }).format(Math.round(size));
|
|
19
|
+
let value = size / 1000;
|
|
20
|
+
let unit = 0;
|
|
21
|
+
while (value >= 1000 && unit < SIZE_UNITS.length - 1) {
|
|
22
|
+
value /= 1000;
|
|
23
|
+
unit += 1;
|
|
24
|
+
}
|
|
25
|
+
return new Intl.NumberFormat(locale, { style: "unit", unit: SIZE_UNITS[unit], unitDisplay: "short", maximumFractionDigits: 1 }).format(value);
|
|
26
|
+
}
|
|
27
|
+
function mergeMessages(override) {
|
|
28
|
+
return { ...en.upload, ...override };
|
|
29
|
+
}
|
|
30
|
+
function fillName(template, name) {
|
|
31
|
+
return template.replaceAll("{name}", name);
|
|
32
|
+
}
|
|
33
|
+
/** Whether a file matches an `accept` list (".pdf", "video/*", "image/png"), the way the browser's picker reads it. */
|
|
34
|
+
function isAccepted(file, accept) {
|
|
35
|
+
if (accept === undefined || accept.trim() === "")
|
|
36
|
+
return true;
|
|
37
|
+
const name = file.name.toLowerCase();
|
|
38
|
+
const type = file.type.toLowerCase();
|
|
39
|
+
return accept
|
|
40
|
+
.split(",")
|
|
41
|
+
.map((entry) => entry.trim().toLowerCase())
|
|
42
|
+
.filter((entry) => entry !== "")
|
|
43
|
+
.some((entry) => {
|
|
44
|
+
if (entry.startsWith("."))
|
|
45
|
+
return name.endsWith(entry);
|
|
46
|
+
if (entry.endsWith("/*"))
|
|
47
|
+
return type.startsWith(entry.slice(0, -1));
|
|
48
|
+
return type === entry;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// A labelled area to add files: a touch-sized button opens the native picker (so a phone offers its files, photos and
|
|
52
|
+
// camera), and on a wide screen files can also be dropped on the area. It holds no files of its own: it hands each pick
|
|
53
|
+
// or drop to `onFilesSelected`, and the app or its transport keeps the list (`UploadList`).
|
|
54
|
+
export function UploadField({ label, description, error, accept, multiple = false, capture, disabled = false, onFilesSelected, onFilesRejected, messages, id, className, }) {
|
|
55
|
+
const words = mergeMessages(messages);
|
|
56
|
+
const generatedId = useId();
|
|
57
|
+
const inputId = id ?? generatedId;
|
|
58
|
+
const descriptionId = `${inputId}-description`;
|
|
59
|
+
const errorId = `${inputId}-error`;
|
|
60
|
+
const inputRef = useRef(null);
|
|
61
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
62
|
+
const isInvalid = error !== undefined && error !== null && error !== false;
|
|
63
|
+
const describedBy = [description === undefined ? undefined : descriptionId, isInvalid ? errorId : undefined].filter(Boolean).join(" ") || undefined;
|
|
64
|
+
const handOver = (files) => {
|
|
65
|
+
const accepted = files.filter((file) => isAccepted(file, accept));
|
|
66
|
+
const rejected = files.filter((file) => !isAccepted(file, accept));
|
|
67
|
+
const selected = multiple ? accepted : accepted.slice(0, 1);
|
|
68
|
+
if (selected.length > 0)
|
|
69
|
+
onFilesSelected(selected);
|
|
70
|
+
if (rejected.length > 0)
|
|
71
|
+
onFilesRejected?.(rejected);
|
|
72
|
+
};
|
|
73
|
+
const handleDragOver = (event) => {
|
|
74
|
+
if (disabled)
|
|
75
|
+
return;
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
event.dataTransfer.dropEffect = "copy";
|
|
78
|
+
setIsDragging(true);
|
|
79
|
+
};
|
|
80
|
+
const handleDragLeave = (event) => {
|
|
81
|
+
// Moving onto a child fires a leave on the area too; only leaving the area itself ends the highlight.
|
|
82
|
+
if (event.relatedTarget instanceof Node && event.currentTarget.contains(event.relatedTarget))
|
|
83
|
+
return;
|
|
84
|
+
setIsDragging(false);
|
|
85
|
+
};
|
|
86
|
+
const handleDrop = (event) => {
|
|
87
|
+
if (disabled)
|
|
88
|
+
return;
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
setIsDragging(false);
|
|
91
|
+
handOver(Array.from(event.dataTransfer.files));
|
|
92
|
+
};
|
|
93
|
+
return (_jsxs(Field, { "data-slot": "upload-field", "data-invalid": isInvalid || undefined, "data-disabled": disabled || undefined, className: className, children: [_jsx(FieldLabel, { htmlFor: inputId, children: label }), _jsxs("div", { "data-slot": "upload-drop-area", "data-dragging": isDragging || undefined, onDragOver: handleDragOver, onDragEnter: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, className: cn("flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-input p-4 text-center text-sm text-muted-foreground transition-colors duration-120", "md:flex-row md:gap-3", "data-[dragging=true]:border-primary data-[dragging=true]:bg-blue-bg", "group-data-[invalid=true]/field:border-destructive group-data-[disabled=true]/field:opacity-50"), children: [_jsx(UploadIcon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH, className: "hidden size-5 shrink-0 md:block" }), _jsxs(Button, { type: "button", variant: "outline", size: "touch", className: "md:h-7", disabled: disabled, "aria-describedby": describedBy, onClick: () => inputRef.current?.click(), children: [_jsx(UploadIcon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH, className: "md:hidden" }), multiple ? words.choose : words.chooseOne] }), _jsx("span", { "data-slot": "upload-drop-hint", "aria-hidden": "true", className: "hidden md:inline", children: isDragging ? words.dropping : multiple ? words.drop : words.dropOne }), _jsx("input", { ref: inputRef, id: inputId, type: "file", accept: accept, multiple: multiple, capture: capture, disabled: disabled, tabIndex: -1, "aria-describedby": describedBy, "aria-invalid": isInvalid || undefined, className: "sr-only", onChange: (event) => {
|
|
94
|
+
handOver(Array.from(event.currentTarget.files ?? []));
|
|
95
|
+
// Cleared, so picking the same file again after removing it is a change too.
|
|
96
|
+
event.currentTarget.value = "";
|
|
97
|
+
} })] }), description === undefined ? null : _jsx(FieldDescription, { id: descriptionId, children: description }), isInvalid ? _jsx(FieldError, { id: errorId, children: error }) : null] }));
|
|
98
|
+
}
|
|
99
|
+
// The files of an upload, one `UploadItem` per row.
|
|
100
|
+
export function UploadList({ label, children, className }) {
|
|
101
|
+
return (_jsx("ul", { "aria-label": label, "data-slot": "upload-list", className: cn("flex flex-col gap-1", className), children: children }));
|
|
102
|
+
}
|
|
103
|
+
const STATE_STATUS = {
|
|
104
|
+
queued: { color: "gray", icon: Clock },
|
|
105
|
+
uploading: { color: "blue", icon: UploadIcon },
|
|
106
|
+
paused: { color: "orange", icon: Pause },
|
|
107
|
+
done: { color: "green", icon: CircleCheck },
|
|
108
|
+
failed: { color: "red", icon: CircleAlert },
|
|
109
|
+
};
|
|
110
|
+
function clampProgress(value) {
|
|
111
|
+
if (value === undefined || !Number.isFinite(value))
|
|
112
|
+
return 0;
|
|
113
|
+
return Math.min(100, Math.max(0, value));
|
|
114
|
+
}
|
|
115
|
+
// One file of an upload: its name, size and state word, a progress bar while it uploads or waits paused, the reason and
|
|
116
|
+
// a Retry button when it failed, and a Remove button. The buttons are touch sized on a phone.
|
|
117
|
+
export function UploadItem({ item, onRetry, onPause, onResume, onRemove, locale = "en", messages, className }) {
|
|
118
|
+
const words = mergeMessages(messages);
|
|
119
|
+
const errorId = `${useId()}-error`;
|
|
120
|
+
const status = STATE_STATUS[item.state];
|
|
121
|
+
const hasProgress = item.state === "uploading" || item.state === "paused";
|
|
122
|
+
const hasError = item.state === "failed" && item.error !== undefined && item.error !== "";
|
|
123
|
+
return (_jsxs("li", { "data-slot": "upload-item", "data-upload": item.id, "data-state": item.state, className: cn("flex min-w-0 items-start gap-2 rounded-md px-2 py-1.5", className), children: [_jsx(FileIcon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH, className: "mt-0.5 size-4 shrink-0 text-muted-foreground" }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2", children: [_jsx("span", { "data-slot": "upload-item-name", title: item.name, className: "min-w-0 truncate text-sm font-medium", children: item.name }), _jsx("span", { "data-slot": "upload-item-size", className: "shrink-0 text-small text-muted-foreground tabular-nums", children: formatFileSize(item.size, locale) }), _jsx(Status, { color: status.color, icon: status.icon, className: "shrink-0 text-small", children: words[item.state] })] }), hasProgress ? (_jsx(Progress, { value: clampProgress(item.progress), "aria-label": fillName(words.progress, item.name), indicatorClassName: item.state === "paused" ? "bg-orange" : undefined })) : null, hasError ? (_jsx("p", { id: errorId, "data-slot": "upload-item-error", className: "text-small text-destructive", children: item.error })) : null] }), _jsxs("div", { "data-slot": "upload-item-actions", className: "flex shrink-0 items-center gap-1", children: [item.state === "failed" && onRetry !== undefined ? (_jsxs(Button, { type: "button", variant: "outline", size: "touch", className: "md:h-7", "aria-describedby": hasError ? errorId : undefined, onClick: () => onRetry(item), children: [_jsx(RotateCw, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }), words.retry] })) : null, item.state === "uploading" && onPause !== undefined ? (_jsx(ItemIconButton, { icon: Pause, label: fillName(words.pause, item.name), onClick: () => onPause(item) })) : null, item.state === "paused" && onResume !== undefined ? (_jsx(ItemIconButton, { icon: Play, label: fillName(words.resume, item.name), onClick: () => onResume(item) })) : null, onRemove === undefined ? null : _jsx(ItemIconButton, { icon: X, label: fillName(words.remove, item.name), onClick: () => onRemove(item) })] })] }));
|
|
124
|
+
}
|
|
125
|
+
function ItemIconButton({ icon: Icon, label, onClick }) {
|
|
126
|
+
return (_jsx(Button, { type: "button", variant: "ghost", size: "icon-touch", className: "text-muted-foreground md:size-7", "aria-label": label, title: label, onClick: onClick, children: _jsx(Icon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) }));
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=Upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Upload.js","sourceRoot":"","sources":["../../src/notion/Upload.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,UAAU,EAAE,CAAC,EAAmB,MAAM,cAAc,CAAC;AAClJ,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAkC,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE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CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAI,CACvG,CAAC,CAAC,CAAC,IAAI,EACP,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CACnD,KAAC,cAAc,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAI,CACxG,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,cAAc,IAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAI,IACjI,IACH,CACN,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAuF;IACzI,OAAO,CACL,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,YAAY,EAAC,SAAS,EAAC,iCAAiC,gBAAa,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,YACnJ,KAAC,IAAI,mBAAa,MAAM,EAAC,WAAW,EAAE,iBAAiB,GAAI,GACpD,CACV,CAAC;AACJ,CAAC"}
|
package/dist/ui/dialog.js
CHANGED
|
@@ -30,7 +30,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
30
30
|
return (_jsx("div", { "data-slot": "dialog-header", className: cn("flex flex-col gap-2 text-center sm:text-left", className), ...props }));
|
|
31
31
|
}
|
|
32
32
|
function DialogFooter({ className, showCloseButton = false, closeLabel = messages.dialog.close, children, ...props }) {
|
|
33
|
-
return (_jsxs("div", { "data-slot": "dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props, children: [
|
|
33
|
+
return (_jsxs("div", { "data-slot": "dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props, children: [showCloseButton && (_jsx(DialogPrimitive.Close, { asChild: true, children: _jsx(Button, { variant: "outline", children: closeLabel }) })), children] }));
|
|
34
34
|
}
|
|
35
35
|
function DialogTitle({ className, ...props }) {
|
|
36
36
|
return (_jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn("text-lg leading-none font-semibold", className), ...props }));
|
package/dist/ui/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,EAAE,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,SAAS,MAAM,CAAC,EACd,GAAG,KAAK,EAC0C;IAClD,OAAO,KAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,KAAK,KAAK,GAAI,CAAA;AAC/D,CAAC;AAED,SAAS,aAAa,CAAC,EACrB,GAAG,KAAK,EAC6C;IACrD,OAAO,KAAC,eAAe,CAAC,OAAO,iBAAW,gBAAgB,KAAK,KAAK,GAAI,CAAA;AAC1E,CAAC;AAED,SA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AA8C,EAAE,SAAS,CAAC,KACpE,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CAAC,EACpB,SAAS,EACT,eAAe,GAAG,KAAK,EACvB,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,EAClC,QAAQ,EACR,GAAG,KAAK,EAKT;IACC,OAAO,CACL,4BACY,eAAe,EACzB,SAAS,EAAE,EAAE,CACX,wDAAwD,EACxD,SAAS,CACV,KACG,KAAK,aAER,eAAe,IAAI,CAClB,KAAC,eAAe,CAAC,KAAK,IAAC,OAAO,kBAC5B,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,YAAE,UAAU,GAAU,GACzB,CACzB,EACA,QAAQ,IACL,CACP,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EAC2C;IACnD,OAAO,CACL,KAAC,eAAe,CAAC,KAAK,iBACV,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,oCAAoC,EAAE,SAAS,CAAC,KAC1D,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACiD;IACzD,OAAO,CACL,KAAC,eAAe,CAAC,WAAW,iBAChB,oBAAoB,EAC9B,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KACrD,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/ui/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/ui/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAwBxD,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,kBAAkB,EAClB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,GAAG;IACvD,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,qBAyBA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
package/dist/ui/progress.js
CHANGED
|
@@ -4,14 +4,29 @@ import * as React from "react";
|
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
5
|
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
6
6
|
const FILL_CLASS = /(^|\s)bg-/;
|
|
7
|
+
// Without a value the fill is a third of the track sliding across it for ever (tw-animate-css's exit slide, which
|
|
8
|
+
// adds to the `translate` that parks it left of the track); with reduced motion it stands still, full and faint.
|
|
9
|
+
const INDETERMINATE_CLASS = [
|
|
10
|
+
"data-[state=indeterminate]:w-1/3",
|
|
11
|
+
"data-[state=indeterminate]:-translate-x-full",
|
|
12
|
+
"data-[state=indeterminate]:animate-out",
|
|
13
|
+
"data-[state=indeterminate]:slide-out-to-right-[400%]",
|
|
14
|
+
"data-[state=indeterminate]:repeat-infinite",
|
|
15
|
+
"data-[state=indeterminate]:duration-1500",
|
|
16
|
+
"data-[state=indeterminate]:ease-in-out",
|
|
17
|
+
"motion-reduce:data-[state=indeterminate]:animate-none",
|
|
18
|
+
"motion-reduce:data-[state=indeterminate]:w-full",
|
|
19
|
+
"motion-reduce:data-[state=indeterminate]:translate-x-0",
|
|
20
|
+
"motion-reduce:data-[state=indeterminate]:opacity-50",
|
|
21
|
+
].join(" ");
|
|
7
22
|
function hasFillClass(className) {
|
|
8
23
|
return className !== undefined && FILL_CLASS.test(className);
|
|
9
24
|
}
|
|
10
25
|
function Progress({ className, indicatorClassName, value, ...props }) {
|
|
11
|
-
return (_jsx(ProgressPrimitive.Root, { "data-slot": "progress", value: value, className: cn("relative h-1.5 w-full overflow-hidden rounded-full bg-primary/20", className), ...props, children: _jsx(ProgressPrimitive.Indicator, { "data-slot": "progress-indicator", className: cn("h-full w-full flex-1 bg-primary transition-all",
|
|
26
|
+
return (_jsx(ProgressPrimitive.Root, { "data-slot": "progress", value: value, className: cn("relative h-1.5 w-full overflow-hidden rounded-full bg-primary/20", className), ...props, children: _jsx(ProgressPrimitive.Indicator, { "data-slot": "progress-indicator", className: cn("h-full w-full flex-1 bg-primary transition-all", INDETERMINATE_CLASS,
|
|
12
27
|
// In dark the default fill is the lighter link blue, so it reaches 3:1 against its track; a fill colour of
|
|
13
28
|
// the caller's own replaces both.
|
|
14
|
-
!hasFillClass(indicatorClassName) && "dark:bg-link", indicatorClassName), style: { transform: `translateX(-${100 -
|
|
29
|
+
!hasFillClass(indicatorClassName) && "dark:bg-link", indicatorClassName), style: value == null ? undefined : { transform: `translateX(-${100 - value}%)` } }) }));
|
|
15
30
|
}
|
|
16
31
|
export { Progress };
|
|
17
32
|
//# sourceMappingURL=progress.js.map
|
package/dist/ui/progress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/ui/progress.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAExD,MAAM,UAAU,GAAG,WAAW,CAAA;AAE9B,SAAS,YAAY,CAAC,SAA6B;IACjD,OAAO,SAAS,KAAK,SA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AE,EAAE,CACX,kEAAkE,EAClE,SAAS,CACV,KACG,KAAK,YAET,KAAC,iBAAiB,CAAC,SAAS,iBAChB,oBAAoB,EAC9B,SAAS,EAAE,EAAE,CACX,gDAAgD,EAChD,mBAAmB;YACnB,2GAA2G;YAC3G,kCAAkC;YAClC,CAAC,YAAY,CAAC,kBAAkB,CAAC,IAAI,cAAc,EACnD,kBAAkB,CACnB,EACD,KAAK,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,eAAe,GAAG,GAAG,KAAK,IAAI,EAAE,GAChF,GACqB,CAC1B,CAAA;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softure-ai/theme-notion",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "SOFTURE AI Notion theme: shadcn/ui components (new-york v4, Radix, Tailwind CSS v4, lucide) with the Notion design system's tokens and deltas, ready to import.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/index.ts
CHANGED
|
@@ -56,6 +56,7 @@ export { MiniProgress, type MiniProgressProps } from "./notion/MiniProgress.js";
|
|
|
56
56
|
export { PageFrame, type PageFrameProps } from "./notion/PageFrame.js";
|
|
57
57
|
export { PageHeader, type PageCrumb, type PageHeaderProps } from "./notion/PageHeader.js";
|
|
58
58
|
export { PropertyList, type Property, type PropertyListProps } from "./notion/PropertyList.js";
|
|
59
|
+
export { RouteLoading, type RouteLoadingProps } from "./notion/RouteLoading.js";
|
|
59
60
|
export { SheetMenu, SheetMenuButton, SheetMenuItem, type SheetMenuButtonProps } from "./notion/SheetMenu.js";
|
|
60
61
|
export { SidePanel, type SidePanelLayout, type SidePanelProps } from "./notion/SidePanel.js";
|
|
61
62
|
export {
|
|
@@ -86,5 +87,19 @@ export { Status, type StatusProps } from "./notion/Status.js";
|
|
|
86
87
|
export { Steps, type StepItem, type StepState, type StepsLayout, type StepsProps } from "./notion/Steps.js";
|
|
87
88
|
export { TabBar, type TabBarItem, type TabBarProps } from "./notion/TabBar.js";
|
|
88
89
|
export { Timeline, type TimelineItem, type TimelineItemFold, type TimelineItemSize, type TimelineLine, type TimelineProps } from "./notion/Timeline.js";
|
|
90
|
+
export { TopLoadingBar, type TopLoadingBarProps } from "./notion/TopLoadingBar.js";
|
|
91
|
+
export {
|
|
92
|
+
UploadField,
|
|
93
|
+
UploadItem,
|
|
94
|
+
UploadList,
|
|
95
|
+
formatFileSize,
|
|
96
|
+
type UploadFieldProps,
|
|
97
|
+
type UploadFileItem,
|
|
98
|
+
type UploadItemProps,
|
|
99
|
+
type UploadListProps,
|
|
100
|
+
type UploadMessages,
|
|
101
|
+
type UploadMessagesOverride,
|
|
102
|
+
type UploadState,
|
|
103
|
+
} from "./notion/Upload.js";
|
|
89
104
|
export { UpdatePrompt, type UpdatePromptProps } from "./notion/UpdatePrompt.js";
|
|
90
105
|
export { TONES, TONE_COLORS, TONE_EDGE, TONE_FILL, TONE_TEXT, type Tone } from "./notion/tones.js";
|
package/src/messages/en.ts
CHANGED
|
@@ -19,6 +19,23 @@ export const en = {
|
|
|
19
19
|
cancelled: "Cancelled. {item} is back in place.",
|
|
20
20
|
handle: "Drag to reorder",
|
|
21
21
|
},
|
|
22
|
+
upload: {
|
|
23
|
+
choose: "Choose files",
|
|
24
|
+
chooseOne: "Choose a file",
|
|
25
|
+
drop: "or drop them here",
|
|
26
|
+
dropOne: "or drop it here",
|
|
27
|
+
dropping: "Drop to add",
|
|
28
|
+
retry: "Retry",
|
|
29
|
+
pause: "Pause {name}",
|
|
30
|
+
resume: "Resume {name}",
|
|
31
|
+
remove: "Remove {name}",
|
|
32
|
+
progress: "Upload of {name}",
|
|
33
|
+
queued: "Queued",
|
|
34
|
+
uploading: "Uploading",
|
|
35
|
+
paused: "Paused",
|
|
36
|
+
done: "Done",
|
|
37
|
+
failed: "Failed",
|
|
38
|
+
},
|
|
22
39
|
steps: { done: "Done", current: "Current", todo: "To do", failed: "Failed" },
|
|
23
40
|
command: { title: "Command Palette", description: "Search for a command to run..." },
|
|
24
41
|
} as const;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LaunchScreen } from "./LaunchScreen.js";
|
|
2
|
+
import { TopLoadingBar } from "./TopLoadingBar.js";
|
|
3
|
+
|
|
4
|
+
export interface RouteLoadingProps {
|
|
5
|
+
/** The app's name, on the launch screen. */
|
|
6
|
+
readonly name: string;
|
|
7
|
+
/** The app's icon, on the launch screen. */
|
|
8
|
+
readonly iconSrc: string;
|
|
9
|
+
/** Both bars' accessible name (`pwaMessages.en.launch.label` in `@softure-ai/pwa`). */
|
|
10
|
+
readonly label: string;
|
|
11
|
+
/** The launch screen's counter: `buildLaunchProgressScript()`. */
|
|
12
|
+
readonly launchScript?: string;
|
|
13
|
+
/** The top bar's counter: `buildLaunchProgressScript({ rootSlot: "top-loading-bar" })`. */
|
|
14
|
+
readonly barScript?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// The loading state for `app/loading.tsx`, picked by the browser so the page stays static: the full-screen
|
|
18
|
+
// `LaunchScreen` below the `md` breakpoint or in an installed app (`display-mode: standalone`), the thin
|
|
19
|
+
// `TopLoadingBar` on a wide screen in a browser tab (`display-mode: browser`). Both are streamed; CSS hides the other,
|
|
20
|
+
// so screen readers meet one. The wrapper draws no box (`contents`). Each rule is one stacked media query, so no two display rules compete on order.
|
|
21
|
+
export function RouteLoading({ name, iconSrc, label, launchScript, barScript }: RouteLoadingProps) {
|
|
22
|
+
return (
|
|
23
|
+
<div data-slot="route-loading" className="contents">
|
|
24
|
+
<LaunchScreen
|
|
25
|
+
name={name}
|
|
26
|
+
iconSrc={iconSrc}
|
|
27
|
+
label={label}
|
|
28
|
+
script={launchScript}
|
|
29
|
+
className="md:[@media(display-mode:browser)]:hidden"
|
|
30
|
+
/>
|
|
31
|
+
<TopLoadingBar label={label} script={barScript} className="hidden md:[@media(display-mode:browser)]:block" />
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { Progress } from "../ui/progress.js";
|
|
3
|
+
|
|
4
|
+
export interface TopLoadingBarProps {
|
|
5
|
+
/** The progress bar's accessible name (`pwaMessages.en.launch.label` in `@softure-ai/pwa`). */
|
|
6
|
+
readonly label: string;
|
|
7
|
+
/** 0–100 when the app knows the progress; left out, the bar slides indeterminately. */
|
|
8
|
+
readonly value?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The counter's inline script (`buildLaunchProgressScript({ rootSlot: "top-loading-bar" })` from `@softure-ai/pwa`).
|
|
11
|
+
* Where the browser runs it (a streamed first load) its first value makes the bar determinate; where it does not
|
|
12
|
+
* (a client-side navigation) the bar keeps sliding.
|
|
13
|
+
*/
|
|
14
|
+
readonly script?: string;
|
|
15
|
+
readonly className?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// A thin bar along the top edge while a route loads on a wide screen: 2 px, square, on a transparent track, above the
|
|
19
|
+
// page and never in the way of a pointer, so the page under it stays usable. `LaunchScreen` is its full-screen
|
|
20
|
+
// counterpart for a phone or an installed app; `RouteLoading` picks one of the two in the browser.
|
|
21
|
+
export function TopLoadingBar({ label, value, script, className }: TopLoadingBarProps) {
|
|
22
|
+
return (
|
|
23
|
+
<div data-slot="top-loading-bar" className={cn("pointer-events-none fixed inset-x-0 top-0 z-50", className)}>
|
|
24
|
+
<Progress value={value} aria-label={label} className="h-0.5 rounded-none bg-transparent" />
|
|
25
|
+
{script === undefined ? null : <script dangerouslySetInnerHTML={{ __html: script }} />}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { CircleAlert, CircleCheck, Clock, File as FileIcon, Pause, Play, RotateCw, Upload as UploadIcon, X, type LucideIcon } from "lucide-react";
|
|
4
|
+
import { useId, useRef, useState, type DragEvent, type ReactNode } from "react";
|
|
5
|
+
|
|
6
|
+
import { en } from "../messages/en.js";
|
|
7
|
+
import { cn } from "../lib/utils.js";
|
|
8
|
+
import { Button } from "../ui/button.js";
|
|
9
|
+
import { Field, FieldDescription, FieldError, FieldLabel } from "../ui/field.js";
|
|
10
|
+
import { Progress } from "../ui/progress.js";
|
|
11
|
+
|
|
12
|
+
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
13
|
+
import type { PaletteColor } from "./palette.js";
|
|
14
|
+
import { Status } from "./Status.js";
|
|
15
|
+
|
|
16
|
+
export type UploadState = "queued" | "uploading" | "paused" | "done" | "failed";
|
|
17
|
+
|
|
18
|
+
/** One file of an upload, as the app or its transport (e.g. `@softure-ai/files`) tracks it. */
|
|
19
|
+
export interface UploadFileItem {
|
|
20
|
+
// Kept on the row as `data-upload`.
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
// In bytes.
|
|
24
|
+
readonly size: number;
|
|
25
|
+
readonly state: UploadState;
|
|
26
|
+
// 0–100, drawn while uploading or paused; clamped, and a non-finite value reads as 0.
|
|
27
|
+
readonly progress?: number;
|
|
28
|
+
// Why the upload failed, shown under a failed row.
|
|
29
|
+
readonly error?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The texts of the upload parts; `{name}` stands for the file's name. Built-in English: `notionMessages.en.upload`. */
|
|
33
|
+
export interface UploadMessages {
|
|
34
|
+
readonly choose: string;
|
|
35
|
+
readonly chooseOne: string;
|
|
36
|
+
readonly drop: string;
|
|
37
|
+
readonly dropOne: string;
|
|
38
|
+
readonly dropping: string;
|
|
39
|
+
readonly retry: string;
|
|
40
|
+
readonly pause: string;
|
|
41
|
+
readonly resume: string;
|
|
42
|
+
readonly remove: string;
|
|
43
|
+
readonly progress: string;
|
|
44
|
+
// Each state's word, e.g. `failed`.
|
|
45
|
+
readonly queued: string;
|
|
46
|
+
readonly uploading: string;
|
|
47
|
+
readonly paused: string;
|
|
48
|
+
readonly done: string;
|
|
49
|
+
readonly failed: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The app's wording for the upload parts; each text left out keeps the built-in English one. */
|
|
53
|
+
export type UploadMessagesOverride = Partial<UploadMessages>;
|
|
54
|
+
|
|
55
|
+
const SIZE_UNITS = ["kilobyte", "megabyte", "gigabyte", "terabyte"] as const;
|
|
56
|
+
|
|
57
|
+
/** A file size for people, in decimal steps (1 kB = 1000 bytes), written by the locale: `formatFileSize(1500)` is "1.5 kB". */
|
|
58
|
+
export function formatFileSize(bytes: number, locale = "en"): string {
|
|
59
|
+
const size = Number.isFinite(bytes) ? Math.max(0, bytes) : 0;
|
|
60
|
+
// Bytes in full ("820 bytes"): the short form of the unit is the bare word "byte" in English.
|
|
61
|
+
if (size < 1000) return new Intl.NumberFormat(locale, { style: "unit", unit: "byte", unitDisplay: "long" }).format(Math.round(size));
|
|
62
|
+
let value = size / 1000;
|
|
63
|
+
let unit = 0;
|
|
64
|
+
while (value >= 1000 && unit < SIZE_UNITS.length - 1) {
|
|
65
|
+
value /= 1000;
|
|
66
|
+
unit += 1;
|
|
67
|
+
}
|
|
68
|
+
return new Intl.NumberFormat(locale, { style: "unit", unit: SIZE_UNITS[unit], unitDisplay: "short", maximumFractionDigits: 1 }).format(value);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function mergeMessages(override: UploadMessagesOverride | undefined): UploadMessages {
|
|
72
|
+
return { ...en.upload, ...override };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function fillName(template: string, name: string): string {
|
|
76
|
+
return template.replaceAll("{name}", name);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Whether a file matches an `accept` list (".pdf", "video/*", "image/png"), the way the browser's picker reads it. */
|
|
80
|
+
function isAccepted(file: File, accept: string | undefined): boolean {
|
|
81
|
+
if (accept === undefined || accept.trim() === "") return true;
|
|
82
|
+
const name = file.name.toLowerCase();
|
|
83
|
+
const type = file.type.toLowerCase();
|
|
84
|
+
return accept
|
|
85
|
+
.split(",")
|
|
86
|
+
.map((entry) => entry.trim().toLowerCase())
|
|
87
|
+
.filter((entry) => entry !== "")
|
|
88
|
+
.some((entry) => {
|
|
89
|
+
if (entry.startsWith(".")) return name.endsWith(entry);
|
|
90
|
+
if (entry.endsWith("/*")) return type.startsWith(entry.slice(0, -1));
|
|
91
|
+
return type === entry;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface UploadFieldProps {
|
|
96
|
+
// The field's visible label.
|
|
97
|
+
readonly label: ReactNode;
|
|
98
|
+
readonly description?: ReactNode;
|
|
99
|
+
// A message under the area, e.g. "Choose at least one file"; marks the field invalid.
|
|
100
|
+
readonly error?: ReactNode;
|
|
101
|
+
// Passed to the native file input: file types, several files, the camera on a phone.
|
|
102
|
+
readonly accept?: string;
|
|
103
|
+
readonly multiple?: boolean;
|
|
104
|
+
readonly capture?: "user" | "environment";
|
|
105
|
+
readonly disabled?: boolean;
|
|
106
|
+
// The files picked or dropped (those matching `accept`; only the first without `multiple`).
|
|
107
|
+
readonly onFilesSelected: (files: File[]) => void;
|
|
108
|
+
// Dropped files that do not match `accept`; the picker never offers them.
|
|
109
|
+
readonly onFilesRejected?: (files: File[]) => void;
|
|
110
|
+
readonly messages?: UploadMessagesOverride;
|
|
111
|
+
// The native input's id; generated when left out.
|
|
112
|
+
readonly id?: string;
|
|
113
|
+
readonly className?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// A labelled area to add files: a touch-sized button opens the native picker (so a phone offers its files, photos and
|
|
117
|
+
// camera), and on a wide screen files can also be dropped on the area. It holds no files of its own: it hands each pick
|
|
118
|
+
// or drop to `onFilesSelected`, and the app or its transport keeps the list (`UploadList`).
|
|
119
|
+
export function UploadField({
|
|
120
|
+
label,
|
|
121
|
+
description,
|
|
122
|
+
error,
|
|
123
|
+
accept,
|
|
124
|
+
multiple = false,
|
|
125
|
+
capture,
|
|
126
|
+
disabled = false,
|
|
127
|
+
onFilesSelected,
|
|
128
|
+
onFilesRejected,
|
|
129
|
+
messages,
|
|
130
|
+
id,
|
|
131
|
+
className,
|
|
132
|
+
}: UploadFieldProps) {
|
|
133
|
+
const words = mergeMessages(messages);
|
|
134
|
+
const generatedId = useId();
|
|
135
|
+
const inputId = id ?? generatedId;
|
|
136
|
+
const descriptionId = `${inputId}-description`;
|
|
137
|
+
const errorId = `${inputId}-error`;
|
|
138
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
139
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
140
|
+
const isInvalid = error !== undefined && error !== null && error !== false;
|
|
141
|
+
const describedBy = [description === undefined ? undefined : descriptionId, isInvalid ? errorId : undefined].filter(Boolean).join(" ") || undefined;
|
|
142
|
+
|
|
143
|
+
const handOver = (files: File[]) => {
|
|
144
|
+
const accepted = files.filter((file) => isAccepted(file, accept));
|
|
145
|
+
const rejected = files.filter((file) => !isAccepted(file, accept));
|
|
146
|
+
const selected = multiple ? accepted : accepted.slice(0, 1);
|
|
147
|
+
if (selected.length > 0) onFilesSelected(selected);
|
|
148
|
+
if (rejected.length > 0) onFilesRejected?.(rejected);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const handleDragOver = (event: DragEvent<HTMLDivElement>) => {
|
|
152
|
+
if (disabled) return;
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
event.dataTransfer.dropEffect = "copy";
|
|
155
|
+
setIsDragging(true);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const handleDragLeave = (event: DragEvent<HTMLDivElement>) => {
|
|
159
|
+
// Moving onto a child fires a leave on the area too; only leaving the area itself ends the highlight.
|
|
160
|
+
if (event.relatedTarget instanceof Node && event.currentTarget.contains(event.relatedTarget)) return;
|
|
161
|
+
setIsDragging(false);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const handleDrop = (event: DragEvent<HTMLDivElement>) => {
|
|
165
|
+
if (disabled) return;
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
setIsDragging(false);
|
|
168
|
+
handOver(Array.from(event.dataTransfer.files));
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<Field data-slot="upload-field" data-invalid={isInvalid || undefined} data-disabled={disabled || undefined} className={className}>
|
|
173
|
+
<FieldLabel htmlFor={inputId}>{label}</FieldLabel>
|
|
174
|
+
<div
|
|
175
|
+
data-slot="upload-drop-area"
|
|
176
|
+
data-dragging={isDragging || undefined}
|
|
177
|
+
onDragOver={handleDragOver}
|
|
178
|
+
onDragEnter={handleDragOver}
|
|
179
|
+
onDragLeave={handleDragLeave}
|
|
180
|
+
onDrop={handleDrop}
|
|
181
|
+
className={cn(
|
|
182
|
+
"flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-input p-4 text-center text-sm text-muted-foreground transition-colors duration-120",
|
|
183
|
+
"md:flex-row md:gap-3",
|
|
184
|
+
"data-[dragging=true]:border-primary data-[dragging=true]:bg-blue-bg",
|
|
185
|
+
"group-data-[invalid=true]/field:border-destructive group-data-[disabled=true]/field:opacity-50",
|
|
186
|
+
)}
|
|
187
|
+
>
|
|
188
|
+
<UploadIcon aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} className="hidden size-5 shrink-0 md:block" />
|
|
189
|
+
<Button
|
|
190
|
+
type="button"
|
|
191
|
+
variant="outline"
|
|
192
|
+
size="touch"
|
|
193
|
+
className="md:h-7"
|
|
194
|
+
disabled={disabled}
|
|
195
|
+
aria-describedby={describedBy}
|
|
196
|
+
onClick={() => inputRef.current?.click()}
|
|
197
|
+
>
|
|
198
|
+
<UploadIcon aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} className="md:hidden" />
|
|
199
|
+
{multiple ? words.choose : words.chooseOne}
|
|
200
|
+
</Button>
|
|
201
|
+
{/* A phone has nothing to drop, so the hint shows on a wide screen only. */}
|
|
202
|
+
<span data-slot="upload-drop-hint" aria-hidden="true" className="hidden md:inline">
|
|
203
|
+
{isDragging ? words.dropping : multiple ? words.drop : words.dropOne}
|
|
204
|
+
</span>
|
|
205
|
+
<input
|
|
206
|
+
ref={inputRef}
|
|
207
|
+
id={inputId}
|
|
208
|
+
type="file"
|
|
209
|
+
accept={accept}
|
|
210
|
+
multiple={multiple}
|
|
211
|
+
capture={capture}
|
|
212
|
+
disabled={disabled}
|
|
213
|
+
tabIndex={-1}
|
|
214
|
+
aria-describedby={describedBy}
|
|
215
|
+
aria-invalid={isInvalid || undefined}
|
|
216
|
+
className="sr-only"
|
|
217
|
+
onChange={(event) => {
|
|
218
|
+
handOver(Array.from(event.currentTarget.files ?? []));
|
|
219
|
+
// Cleared, so picking the same file again after removing it is a change too.
|
|
220
|
+
event.currentTarget.value = "";
|
|
221
|
+
}}
|
|
222
|
+
/>
|
|
223
|
+
</div>
|
|
224
|
+
{description === undefined ? null : <FieldDescription id={descriptionId}>{description}</FieldDescription>}
|
|
225
|
+
{isInvalid ? <FieldError id={errorId}>{error}</FieldError> : null}
|
|
226
|
+
</Field>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface UploadListProps {
|
|
231
|
+
// The list's accessible name, e.g. "Files".
|
|
232
|
+
readonly label: string;
|
|
233
|
+
// `UploadItem` rows.
|
|
234
|
+
readonly children: ReactNode;
|
|
235
|
+
readonly className?: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// The files of an upload, one `UploadItem` per row.
|
|
239
|
+
export function UploadList({ label, children, className }: UploadListProps) {
|
|
240
|
+
return (
|
|
241
|
+
<ul aria-label={label} data-slot="upload-list" className={cn("flex flex-col gap-1", className)}>
|
|
242
|
+
{children}
|
|
243
|
+
</ul>
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const STATE_STATUS: Readonly<Record<UploadState, { readonly color: PaletteColor; readonly icon: LucideIcon }>> = {
|
|
248
|
+
queued: { color: "gray", icon: Clock },
|
|
249
|
+
uploading: { color: "blue", icon: UploadIcon },
|
|
250
|
+
paused: { color: "orange", icon: Pause },
|
|
251
|
+
done: { color: "green", icon: CircleCheck },
|
|
252
|
+
failed: { color: "red", icon: CircleAlert },
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
function clampProgress(value: number | undefined): number {
|
|
256
|
+
if (value === undefined || !Number.isFinite(value)) return 0;
|
|
257
|
+
return Math.min(100, Math.max(0, value));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface UploadItemProps {
|
|
261
|
+
readonly item: UploadFileItem;
|
|
262
|
+
// Each button shows only with its callback: Retry on a failed row, Pause while uploading, Resume when paused.
|
|
263
|
+
readonly onRetry?: (item: UploadFileItem) => void;
|
|
264
|
+
readonly onPause?: (item: UploadFileItem) => void;
|
|
265
|
+
readonly onResume?: (item: UploadFileItem) => void;
|
|
266
|
+
readonly onRemove?: (item: UploadFileItem) => void;
|
|
267
|
+
// Formats the size, e.g. "de" writes "1,5 kB".
|
|
268
|
+
readonly locale?: string;
|
|
269
|
+
readonly messages?: UploadMessagesOverride;
|
|
270
|
+
readonly className?: string;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// One file of an upload: its name, size and state word, a progress bar while it uploads or waits paused, the reason and
|
|
274
|
+
// a Retry button when it failed, and a Remove button. The buttons are touch sized on a phone.
|
|
275
|
+
export function UploadItem({ item, onRetry, onPause, onResume, onRemove, locale = "en", messages, className }: UploadItemProps) {
|
|
276
|
+
const words = mergeMessages(messages);
|
|
277
|
+
const errorId = `${useId()}-error`;
|
|
278
|
+
const status = STATE_STATUS[item.state];
|
|
279
|
+
const hasProgress = item.state === "uploading" || item.state === "paused";
|
|
280
|
+
const hasError = item.state === "failed" && item.error !== undefined && item.error !== "";
|
|
281
|
+
return (
|
|
282
|
+
<li
|
|
283
|
+
data-slot="upload-item"
|
|
284
|
+
data-upload={item.id}
|
|
285
|
+
data-state={item.state}
|
|
286
|
+
className={cn("flex min-w-0 items-start gap-2 rounded-md px-2 py-1.5", className)}
|
|
287
|
+
>
|
|
288
|
+
<FileIcon aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} className="mt-0.5 size-4 shrink-0 text-muted-foreground" />
|
|
289
|
+
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
290
|
+
<div className="flex min-w-0 flex-wrap items-center gap-x-2">
|
|
291
|
+
<span data-slot="upload-item-name" title={item.name} className="min-w-0 truncate text-sm font-medium">
|
|
292
|
+
{item.name}
|
|
293
|
+
</span>
|
|
294
|
+
<span data-slot="upload-item-size" className="shrink-0 text-small text-muted-foreground tabular-nums">
|
|
295
|
+
{formatFileSize(item.size, locale)}
|
|
296
|
+
</span>
|
|
297
|
+
<Status color={status.color} icon={status.icon} className="shrink-0 text-small">
|
|
298
|
+
{words[item.state]}
|
|
299
|
+
</Status>
|
|
300
|
+
</div>
|
|
301
|
+
{hasProgress ? (
|
|
302
|
+
<Progress
|
|
303
|
+
value={clampProgress(item.progress)}
|
|
304
|
+
aria-label={fillName(words.progress, item.name)}
|
|
305
|
+
indicatorClassName={item.state === "paused" ? "bg-orange" : undefined}
|
|
306
|
+
/>
|
|
307
|
+
) : null}
|
|
308
|
+
{hasError ? (
|
|
309
|
+
<p id={errorId} data-slot="upload-item-error" className="text-small text-destructive">
|
|
310
|
+
{item.error}
|
|
311
|
+
</p>
|
|
312
|
+
) : null}
|
|
313
|
+
</div>
|
|
314
|
+
<div data-slot="upload-item-actions" className="flex shrink-0 items-center gap-1">
|
|
315
|
+
{item.state === "failed" && onRetry !== undefined ? (
|
|
316
|
+
<Button type="button" variant="outline" size="touch" className="md:h-7" aria-describedby={hasError ? errorId : undefined} onClick={() => onRetry(item)}>
|
|
317
|
+
<RotateCw aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} />
|
|
318
|
+
{words.retry}
|
|
319
|
+
</Button>
|
|
320
|
+
) : null}
|
|
321
|
+
{item.state === "uploading" && onPause !== undefined ? (
|
|
322
|
+
<ItemIconButton icon={Pause} label={fillName(words.pause, item.name)} onClick={() => onPause(item)} />
|
|
323
|
+
) : null}
|
|
324
|
+
{item.state === "paused" && onResume !== undefined ? (
|
|
325
|
+
<ItemIconButton icon={Play} label={fillName(words.resume, item.name)} onClick={() => onResume(item)} />
|
|
326
|
+
) : null}
|
|
327
|
+
{onRemove === undefined ? null : <ItemIconButton icon={X} label={fillName(words.remove, item.name)} onClick={() => onRemove(item)} />}
|
|
328
|
+
</div>
|
|
329
|
+
</li>
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function ItemIconButton({ icon: Icon, label, onClick }: { readonly icon: LucideIcon; readonly label: string; readonly onClick: () => void }) {
|
|
334
|
+
return (
|
|
335
|
+
<Button type="button" variant="ghost" size="icon-touch" className="text-muted-foreground md:size-7" aria-label={label} title={label} onClick={onClick}>
|
|
336
|
+
<Icon aria-hidden="true" strokeWidth={ICON_STROKE_WIDTH} />
|
|
337
|
+
</Button>
|
|
338
|
+
);
|
|
339
|
+
}
|
package/src/ui/dialog.tsx
CHANGED
|
@@ -131,12 +131,12 @@ function DialogFooter({
|
|
|
131
131
|
)}
|
|
132
132
|
{...props}
|
|
133
133
|
>
|
|
134
|
-
{children}
|
|
135
134
|
{showCloseButton && (
|
|
136
135
|
<DialogPrimitive.Close asChild>
|
|
137
136
|
<Button variant="outline">{closeLabel}</Button>
|
|
138
137
|
</DialogPrimitive.Close>
|
|
139
138
|
)}
|
|
139
|
+
{children}
|
|
140
140
|
</div>
|
|
141
141
|
)
|
|
142
142
|
}
|
package/src/ui/progress.tsx
CHANGED
|
@@ -6,6 +6,22 @@ import { Progress as ProgressPrimitive } from "radix-ui"
|
|
|
6
6
|
|
|
7
7
|
const FILL_CLASS = /(^|\s)bg-/
|
|
8
8
|
|
|
9
|
+
// Without a value the fill is a third of the track sliding across it for ever (tw-animate-css's exit slide, which
|
|
10
|
+
// adds to the `translate` that parks it left of the track); with reduced motion it stands still, full and faint.
|
|
11
|
+
const INDETERMINATE_CLASS = [
|
|
12
|
+
"data-[state=indeterminate]:w-1/3",
|
|
13
|
+
"data-[state=indeterminate]:-translate-x-full",
|
|
14
|
+
"data-[state=indeterminate]:animate-out",
|
|
15
|
+
"data-[state=indeterminate]:slide-out-to-right-[400%]",
|
|
16
|
+
"data-[state=indeterminate]:repeat-infinite",
|
|
17
|
+
"data-[state=indeterminate]:duration-1500",
|
|
18
|
+
"data-[state=indeterminate]:ease-in-out",
|
|
19
|
+
"motion-reduce:data-[state=indeterminate]:animate-none",
|
|
20
|
+
"motion-reduce:data-[state=indeterminate]:w-full",
|
|
21
|
+
"motion-reduce:data-[state=indeterminate]:translate-x-0",
|
|
22
|
+
"motion-reduce:data-[state=indeterminate]:opacity-50",
|
|
23
|
+
].join(" ")
|
|
24
|
+
|
|
9
25
|
function hasFillClass(className: string | undefined): boolean {
|
|
10
26
|
return className !== undefined && FILL_CLASS.test(className)
|
|
11
27
|
}
|
|
@@ -33,12 +49,13 @@ function Progress({
|
|
|
33
49
|
data-slot="progress-indicator"
|
|
34
50
|
className={cn(
|
|
35
51
|
"h-full w-full flex-1 bg-primary transition-all",
|
|
52
|
+
INDETERMINATE_CLASS,
|
|
36
53
|
// In dark the default fill is the lighter link blue, so it reaches 3:1 against its track; a fill colour of
|
|
37
54
|
// the caller's own replaces both.
|
|
38
55
|
!hasFillClass(indicatorClassName) && "dark:bg-link",
|
|
39
56
|
indicatorClassName
|
|
40
57
|
)}
|
|
41
|
-
style={{ transform: `translateX(-${100 -
|
|
58
|
+
style={value == null ? undefined : { transform: `translateX(-${100 - value}%)` }}
|
|
42
59
|
/>
|
|
43
60
|
</ProgressPrimitive.Root>
|
|
44
61
|
)
|