@dimah-s3/ui 1.7.1 → 2.0.0-beta.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.
Files changed (133) hide show
  1. package/README.md +73 -16
  2. package/css/shadcn.css +57 -23
  3. package/dist/components/dimah-s3/attachment/circle-progress.d.ts +14 -5
  4. package/dist/components/dimah-s3/attachment/circle-progress.d.ts.map +1 -1
  5. package/dist/components/dimah-s3/attachment/dismiss-attachment-action.d.ts +6 -2
  6. package/dist/components/dimah-s3/attachment/dismiss-attachment-action.d.ts.map +1 -1
  7. package/dist/components/dimah-s3/attachment/file-attachment.d.ts +33 -18
  8. package/dist/components/dimah-s3/attachment/file-attachment.d.ts.map +1 -1
  9. package/dist/components/dimah-s3/attachment/file-name.d.ts +18 -0
  10. package/dist/components/dimah-s3/attachment/file-name.d.ts.map +1 -0
  11. package/dist/{lib/file-type-icon.d.ts → components/dimah-s3/attachment/file-type-glyph.d.ts} +5 -11
  12. package/dist/components/dimah-s3/attachment/file-type-glyph.d.ts.map +1 -0
  13. package/dist/components/dimah-s3/attachment/folder-glyph.d.ts +9 -0
  14. package/dist/components/dimah-s3/attachment/folder-glyph.d.ts.map +1 -0
  15. package/dist/components/dimah-s3/attachment/status-attachment.d.ts +9 -11
  16. package/dist/components/dimah-s3/attachment/status-attachment.d.ts.map +1 -1
  17. package/dist/components/dimah-s3/delete/delete-confirm-dialog.d.ts +20 -0
  18. package/dist/components/dimah-s3/delete/delete-confirm-dialog.d.ts.map +1 -0
  19. package/dist/components/dimah-s3/delete/delete-toasts.d.ts +34 -0
  20. package/dist/components/dimah-s3/delete/delete-toasts.d.ts.map +1 -0
  21. package/dist/components/dimah-s3/delete/delete-trigger.d.ts +18 -0
  22. package/dist/components/dimah-s3/delete/delete-trigger.d.ts.map +1 -0
  23. package/dist/components/dimah-s3/delete/delete.d.ts +83 -0
  24. package/dist/components/dimah-s3/delete/delete.d.ts.map +1 -0
  25. package/dist/components/dimah-s3/download/download-progress.d.ts +16 -0
  26. package/dist/components/dimah-s3/download/download-progress.d.ts.map +1 -0
  27. package/dist/components/dimah-s3/download/download-toasts.d.ts +25 -0
  28. package/dist/components/dimah-s3/download/download-toasts.d.ts.map +1 -0
  29. package/dist/components/dimah-s3/download/download-trigger.d.ts +32 -0
  30. package/dist/components/dimah-s3/download/download-trigger.d.ts.map +1 -0
  31. package/dist/components/dimah-s3/download/download.d.ts +30 -0
  32. package/dist/components/dimah-s3/download/download.d.ts.map +1 -0
  33. package/dist/components/dimah-s3/list/object-list-breadcrumb.d.ts +6 -5
  34. package/dist/components/dimah-s3/list/object-list-breadcrumb.d.ts.map +1 -1
  35. package/dist/components/dimah-s3/list/object-list-content.d.ts +8 -0
  36. package/dist/components/dimah-s3/list/object-list-content.d.ts.map +1 -0
  37. package/dist/components/dimah-s3/list/object-list-context.d.ts +76 -0
  38. package/dist/components/dimah-s3/list/object-list-context.d.ts.map +1 -0
  39. package/dist/components/dimah-s3/list/object-list-controls.d.ts +46 -0
  40. package/dist/components/dimah-s3/list/object-list-controls.d.ts.map +1 -0
  41. package/dist/components/dimah-s3/list/object-list-entry.d.ts +28 -0
  42. package/dist/components/dimah-s3/list/object-list-entry.d.ts.map +1 -0
  43. package/dist/components/dimah-s3/list/object-list-feedback.d.ts +26 -0
  44. package/dist/components/dimah-s3/list/object-list-feedback.d.ts.map +1 -0
  45. package/dist/components/dimah-s3/list/object-list-header.d.ts +81 -0
  46. package/dist/components/dimah-s3/list/object-list-header.d.ts.map +1 -0
  47. package/dist/components/dimah-s3/list/object-list-item-menu.d.ts +65 -0
  48. package/dist/components/dimah-s3/list/object-list-item-menu.d.ts.map +1 -0
  49. package/dist/components/dimah-s3/list/object-list-keyboard.d.ts +21 -0
  50. package/dist/components/dimah-s3/list/object-list-keyboard.d.ts.map +1 -0
  51. package/dist/components/dimah-s3/list/object-list-states.d.ts +25 -11
  52. package/dist/components/dimah-s3/list/object-list-states.d.ts.map +1 -1
  53. package/dist/components/dimah-s3/list/object-list-upload.d.ts +29 -6
  54. package/dist/components/dimah-s3/list/object-list-upload.d.ts.map +1 -1
  55. package/dist/components/dimah-s3/list/object-list-usage.d.ts +8 -6
  56. package/dist/components/dimah-s3/list/object-list-usage.d.ts.map +1 -1
  57. package/dist/components/dimah-s3/list/object-list.d.ts +78 -137
  58. package/dist/components/dimah-s3/list/object-list.d.ts.map +1 -1
  59. package/dist/components/dimah-s3/preview/object-card.d.ts +38 -0
  60. package/dist/components/dimah-s3/preview/object-card.d.ts.map +1 -0
  61. package/dist/components/dimah-s3/preview/object-image.d.ts +30 -0
  62. package/dist/components/dimah-s3/preview/object-image.d.ts.map +1 -0
  63. package/dist/components/dimah-s3/upload/avatar-upload.d.ts +47 -0
  64. package/dist/components/dimah-s3/upload/avatar-upload.d.ts.map +1 -0
  65. package/dist/components/dimah-s3/upload/upload-dropzone.d.ts +48 -25
  66. package/dist/components/dimah-s3/upload/upload-dropzone.d.ts.map +1 -1
  67. package/dist/components/dimah-s3/upload/upload-field.d.ts +96 -0
  68. package/dist/components/dimah-s3/upload/upload-field.d.ts.map +1 -0
  69. package/dist/components/dimah-s3/upload/upload-file-list.d.ts +34 -0
  70. package/dist/components/dimah-s3/upload/upload-file-list.d.ts.map +1 -0
  71. package/dist/components/dimah-s3/upload/upload-status.d.ts +25 -20
  72. package/dist/components/dimah-s3/upload/upload-status.d.ts.map +1 -1
  73. package/dist/components/dimah-s3/upload/upload-toasts.d.ts +23 -0
  74. package/dist/components/dimah-s3/upload/upload-toasts.d.ts.map +1 -0
  75. package/dist/components/dimah-s3/upload/upload-trigger.d.ts +23 -0
  76. package/dist/components/dimah-s3/upload/upload-trigger.d.ts.map +1 -0
  77. package/dist/components/dimah-s3/upload/upload.d.ts +79 -0
  78. package/dist/components/dimah-s3/upload/upload.d.ts.map +1 -0
  79. package/dist/hooks/use-file-preview.d.ts +7 -0
  80. package/dist/hooks/use-file-preview.d.ts.map +1 -0
  81. package/dist/hooks/use-own-drag.d.ts +17 -0
  82. package/dist/hooks/use-own-drag.d.ts.map +1 -0
  83. package/dist/hooks/use-paste-files.d.ts +18 -0
  84. package/dist/hooks/use-paste-files.d.ts.map +1 -0
  85. package/dist/hooks/use-toast-owner.d.ts +16 -0
  86. package/dist/hooks/use-toast-owner.d.ts.map +1 -0
  87. package/dist/index.d.ts +39 -18
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +4226 -2676
  90. package/dist/index.js.map +1 -1
  91. package/dist/lib/attachment-layout.d.ts +3 -33
  92. package/dist/lib/attachment-layout.d.ts.map +1 -1
  93. package/dist/lib/format-expires-in.d.ts +2 -2
  94. package/dist/lib/format-expires-in.d.ts.map +1 -1
  95. package/dist/lib/is-field-target.d.ts +6 -0
  96. package/dist/lib/is-field-target.d.ts.map +1 -0
  97. package/dist/lib/upload-hints.d.ts +16 -0
  98. package/dist/lib/upload-hints.d.ts.map +1 -0
  99. package/package.json +24 -13
  100. package/styles.css +4 -3
  101. package/dist/components/dimah-s3/delete/delete-button.d.ts +0 -43
  102. package/dist/components/dimah-s3/delete/delete-button.d.ts.map +0 -1
  103. package/dist/components/dimah-s3/download/download-button.d.ts +0 -39
  104. package/dist/components/dimah-s3/download/download-button.d.ts.map +0 -1
  105. package/dist/components/dimah-s3/download/progress-download-button.d.ts +0 -44
  106. package/dist/components/dimah-s3/download/progress-download-button.d.ts.map +0 -1
  107. package/dist/components/dimah-s3/list/object-list-menu.d.ts +0 -65
  108. package/dist/components/dimah-s3/list/object-list-menu.d.ts.map +0 -1
  109. package/dist/components/dimah-s3/list/object-list-rows.d.ts +0 -32
  110. package/dist/components/dimah-s3/list/object-list-rows.d.ts.map +0 -1
  111. package/dist/components/dimah-s3/list/object-list-selection-state.d.ts +0 -38
  112. package/dist/components/dimah-s3/list/object-list-selection-state.d.ts.map +0 -1
  113. package/dist/components/dimah-s3/list/object-list-selection.d.ts +0 -36
  114. package/dist/components/dimah-s3/list/object-list-selection.d.ts.map +0 -1
  115. package/dist/components/dimah-s3/upload/multi-upload-status.d.ts +0 -8
  116. package/dist/components/dimah-s3/upload/multi-upload-status.d.ts.map +0 -1
  117. package/dist/components/dimah-s3/upload/upload-button.d.ts +0 -32
  118. package/dist/components/dimah-s3/upload/upload-button.d.ts.map +0 -1
  119. package/dist/hooks/use-delete-toast.d.ts +0 -12
  120. package/dist/hooks/use-delete-toast.d.ts.map +0 -1
  121. package/dist/hooks/use-delete-ui.d.ts +0 -16
  122. package/dist/hooks/use-delete-ui.d.ts.map +0 -1
  123. package/dist/hooks/use-download-toast.d.ts +0 -17
  124. package/dist/hooks/use-download-toast.d.ts.map +0 -1
  125. package/dist/hooks/use-download-ui.d.ts +0 -19
  126. package/dist/hooks/use-download-ui.d.ts.map +0 -1
  127. package/dist/hooks/use-file-reject-toast.d.ts +0 -7
  128. package/dist/hooks/use-file-reject-toast.d.ts.map +0 -1
  129. package/dist/hooks/use-upload-toast.d.ts +0 -7
  130. package/dist/hooks/use-upload-toast.d.ts.map +0 -1
  131. package/dist/hooks/use-upload-ui.d.ts +0 -13
  132. package/dist/hooks/use-upload-ui.d.ts.map +0 -1
  133. package/dist/lib/file-type-icon.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,19 +1,21 @@
1
1
  # @dimah-s3/ui
2
2
 
3
+ **2.0 beta.** Install with `@beta`. `@latest` stays on 1.x, and betas can include breaking changes until 2.0.0.
4
+
3
5
  Optional prebuilt UI for `dimah-s3`, on top of `@dimah-s3/react` and
4
6
  [shadcn/ui](https://ui.shadcn.com).
5
7
 
6
- Full documentation: [s3.dimah.dev/docs/react/ui](https://s3.dimah.dev/docs/react/ui) ·
7
- [llms.txt](https://s3.dimah.dev/llms.txt)
8
+ Full documentation: [v2.s3.dimah.dev/docs/react/ui](https://v2.s3.dimah.dev/docs/react/ui) ·
9
+ [llms.txt](https://v2.s3.dimah.dev/llms.txt)
8
10
 
9
11
  ## Install
10
12
 
11
13
  ```bash
12
- pnpm add @dimah-s3/ui @dimah-s3/react shadcn
14
+ pnpm add @dimah-s3/ui@beta @dimah-s3/core@beta @dimah-s3/react@beta @fuma-translate/react
13
15
  ```
14
16
 
15
- Or copy items from the shadcn registry — see
16
- [UI Setup](https://s3.dimah.dev/docs/react/ui).
17
+ Requires React 19.2. Or copy items from the shadcn registry — see
18
+ [UI Setup](https://v2.s3.dimah.dev/docs/react/ui).
17
19
 
18
20
  ## Styles
19
21
 
@@ -23,30 +25,85 @@ Import once in your CSS (Tailwind v4 source scan + shadcn color bridge):
23
25
  @import "@dimah-s3/ui/styles.css";
24
26
  ```
25
27
 
26
- Colors default to your shadcn theme (`--primary`, `--muted`, …). Override
27
- `--color-dimah-s3-*` to theme the library alone — see
28
- [Theming](https://s3.dimah.dev/docs/react/ui/customization/theming).
28
+ Colors default to your shadcn theme (`--primary`, `--muted`, …). To theme
29
+ the library alone, override the `--dimah-s3-<token>` variables on `:root` or
30
+ on any container:
31
+
32
+ ```css
33
+ .uploads-panel {
34
+ --dimah-s3-card: var(--muted);
35
+ }
36
+ ```
37
+
38
+ The tokens are `background`, `foreground`, `card`, `card-foreground`,
39
+ `primary`, `primary-foreground`, `muted`, `muted-foreground`, `accent`,
40
+ `border`, `ring`, `destructive`, `success` and `warning`. `success` and
41
+ `warning` read your theme's `--success` / `--warning` when it defines them, and
42
+ fall back to a green and an amber otherwise. See
43
+ [Theming](https://v2.s3.dimah.dev/docs/react/ui/customization/theming).
29
44
 
30
45
  ## Quick start
31
46
 
32
- ```tsx
33
- import { createS3Client, useUpload } from "@dimah-s3/react";
34
- import { UploadDropzone } from "@dimah-s3/ui";
47
+ Mount one `<Toaster />` inside your S3 provider. `s3Client` is the
48
+ `createS3Client()` from `@dimah-s3/react`:
35
49
 
36
- export const s3Client = createS3Client();
50
+ ```tsx
51
+ "use client";
37
52
 
38
- export function UploadDemo() {
39
- const upload = useUpload({ route: "uploads" });
53
+ import type { ReactNode } from "react";
54
+ import { Toaster } from "@dimah-s3/ui";
55
+ import { s3Client } from "@/lib/s3-client";
40
56
 
57
+ export function Providers({ children }: { children: ReactNode }) {
41
58
  return (
42
59
  <s3Client.Provider>
43
- <UploadDropzone upload={upload} />
60
+ {children}
61
+ <Toaster />
44
62
  </s3Client.Provider>
45
63
  );
46
64
  }
47
65
  ```
48
66
 
49
- Mount `<Toaster />` from `@dimah-s3/ui` next to `s3Client.Provider`.
67
+ Then compose a family around a hook, anywhere inside the provider:
68
+
69
+ ```tsx
70
+ "use client";
71
+
72
+ import { useUpload } from "@dimah-s3/react";
73
+ import { Upload, UploadDropzone, UploadToasts } from "@dimah-s3/ui";
74
+
75
+ export function Uploader() {
76
+ const upload = useUpload({ route: "uploads", maxFiles: 5 });
77
+
78
+ return (
79
+ <>
80
+ <Upload upload={upload}>
81
+ {/* Progress shows inside the dropzone. */}
82
+ <UploadDropzone />
83
+ </Upload>
84
+ <UploadToasts upload={upload} />
85
+ </>
86
+ );
87
+ }
88
+ ```
89
+
90
+ ## Components
91
+
92
+ - `Upload` holds a `useUpload` return for `UploadTrigger`, `UploadDropzone`,
93
+ `UploadStatus`, and `UploadFileList`. The dropzone shows the status inside
94
+ it unless you arrange its parts yourself.
95
+ - `Download` holds a `useDownload` or `useFetchDownload` return for
96
+ `DownloadTrigger` and `DownloadProgress`.
97
+ - `Delete` holds a `useDelete` return and one confirm dialog for every
98
+ `DeleteTrigger` inside it.
99
+ - `ObjectCard` shows a stored file with download and delete actions.
100
+ - `UploadField` submits uploaded keys with a form. `AvatarUpload` uploads
101
+ and shows a profile image. `ObjectImage` shows a stored image.
102
+ - `ObjectList` and its parts render a `useObjectList` file browser.
103
+
104
+ Components do not toast on their own. Mount `UploadToasts`, `DownloadToasts`,
105
+ or `DeleteToasts` once per hook. A second one for the same hook renders
106
+ nothing.
50
107
 
51
108
  ## License
52
109
 
package/css/shadcn.css CHANGED
@@ -1,30 +1,64 @@
1
1
  /**
2
- * @dimah-s3/ui color tokens ← host shadcn theme.
2
+ * @dimah-s3/ui theme tokens ← host shadcn theme.
3
3
  *
4
- * Dimah-owned components use `bg-dimah-s3-*` / `text-dimah-s3-*` utilities so the
5
- * library can be themed independently. By default every token points at the
6
- * matching shadcn CSS variable (`--primary`, `--muted`, …).
4
+ * Dimah-owned components read `--dimah-s3-*` through the `bg-dimah-s3-*` /
5
+ * `text-dimah-s3-*` utilities, so the library can be themed on its own. The
6
+ * tokens are unset by default: each utility falls back to the matching shadcn
7
+ * variable (`--primary`, `--muted`, …) where it is used, so a nested `.dark`
8
+ * or theme class reaches dimah-s3 components at any depth. `success` and
9
+ * `warning` read `--success` / `--warning` when your theme defines them, and
10
+ * fall back to a green and an amber otherwise.
7
11
  *
8
- * Override after import to theme only dimah-s3:
12
+ * Override a token after this import, on `:root` or on any container:
9
13
  *
10
- * @theme {
11
- * --color-dimah-s3-primary: oklch(0.65 0.15 150);
14
+ * :root {
15
+ * --dimah-s3-primary: oklch(0.65 0.15 150);
16
+ * }
17
+ *
18
+ * .uploads-panel {
19
+ * --dimah-s3-card: var(--muted);
12
20
  * }
13
21
  */
14
- @theme {
15
- --color-dimah-s3-background: var(--background);
16
- --color-dimah-s3-foreground: var(--foreground);
17
- --color-dimah-s3-card: var(--card);
18
- --color-dimah-s3-card-foreground: var(--card-foreground);
19
- --color-dimah-s3-primary: var(--primary);
20
- --color-dimah-s3-primary-foreground: var(--primary-foreground);
21
- --color-dimah-s3-secondary: var(--secondary);
22
- --color-dimah-s3-secondary-foreground: var(--secondary-foreground);
23
- --color-dimah-s3-muted: var(--muted);
24
- --color-dimah-s3-muted-foreground: var(--muted-foreground);
25
- --color-dimah-s3-accent: var(--accent);
26
- --color-dimah-s3-accent-foreground: var(--accent-foreground);
27
- --color-dimah-s3-destructive: var(--destructive);
28
- --color-dimah-s3-border: var(--border);
29
- --color-dimah-s3-ring: var(--ring);
22
+ :root {
23
+ --dimah-s3-success-default: oklch(0.627 0.194 149.214);
24
+ --dimah-s3-warning-default: oklch(0.769 0.188 70.08);
25
+ }
26
+
27
+ .dark {
28
+ --dimah-s3-success-default: oklch(0.723 0.219 149.579);
29
+ --dimah-s3-warning-default: oklch(0.828 0.189 84.429);
30
+ }
31
+
32
+ /* `inline` makes each utility resolve the whole chain on the element that
33
+ uses it, so overrides on a container reach the components inside it. */
34
+ @theme inline {
35
+ --color-dimah-s3-background: var(--dimah-s3-background, var(--background));
36
+ --color-dimah-s3-foreground: var(--dimah-s3-foreground, var(--foreground));
37
+ --color-dimah-s3-card: var(--dimah-s3-card, var(--card));
38
+ --color-dimah-s3-card-foreground: var(
39
+ --dimah-s3-card-foreground,
40
+ var(--card-foreground)
41
+ );
42
+ --color-dimah-s3-primary: var(--dimah-s3-primary, var(--primary));
43
+ --color-dimah-s3-primary-foreground: var(
44
+ --dimah-s3-primary-foreground,
45
+ var(--primary-foreground)
46
+ );
47
+ --color-dimah-s3-muted: var(--dimah-s3-muted, var(--muted));
48
+ --color-dimah-s3-muted-foreground: var(
49
+ --dimah-s3-muted-foreground,
50
+ var(--muted-foreground)
51
+ );
52
+ --color-dimah-s3-accent: var(--dimah-s3-accent, var(--accent));
53
+ --color-dimah-s3-border: var(--dimah-s3-border, var(--border));
54
+ --color-dimah-s3-ring: var(--dimah-s3-ring, var(--ring));
55
+ --color-dimah-s3-destructive: var(--dimah-s3-destructive, var(--destructive));
56
+ --color-dimah-s3-success: var(
57
+ --dimah-s3-success,
58
+ var(--success, var(--dimah-s3-success-default))
59
+ );
60
+ --color-dimah-s3-warning: var(
61
+ --dimah-s3-warning,
62
+ var(--warning, var(--dimah-s3-warning-default))
63
+ );
30
64
  }
@@ -1,9 +1,18 @@
1
- export declare function CircleProgress({ percent, size, strokeWidth, className, label, }: {
1
+ export type CircleProgressProps = {
2
+ /** Progress from 0 to 100. Values outside are clamped; NaN counts as 0. */
2
3
  percent: number;
3
- size?: number;
4
+ /** File the progress belongs to. It names the progressbar "Progress for {name}". */
5
+ fileName?: string;
6
+ /** Accessible name in place of the one from `fileName`, such as for a whole queue. */
7
+ label?: string;
8
+ /** Ring thickness in a 20 by 20 box. @default 2.5 */
4
9
  strokeWidth?: number;
10
+ /** Sets the size, for example `size-6`. @default "size-5" */
5
11
  className?: string;
6
- /** Accessible name. When omitted the graphic is hidden from AT. */
7
- label?: string;
8
- }): import("react").JSX.Element;
12
+ };
13
+ /**
14
+ * Determinate progress ring with `role="progressbar"`, named by `label` or
15
+ * by its file. Pass one of them.
16
+ */
17
+ export declare function CircleProgress({ percent, fileName, label, strokeWidth, className, }: CircleProgressProps): import("react").JSX.Element;
9
18
  //# sourceMappingURL=circle-progress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"circle-progress.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/circle-progress.tsx"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,IAAS,EACT,WAAiB,EACjB,SAAS,EACT,KAAK,GACN,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,+BAwCA"}
1
+ {"version":3,"file":"circle-progress.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/circle-progress.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,mBAAmB,GAAG;IAChC,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,QAAQ,EACR,KAAK,EACL,WAAiB,EACjB,SAAS,GACV,EAAE,mBAAmB,+BAqDrB"}
@@ -1,4 +1,8 @@
1
- export declare function DismissAttachmentAction({ onDismiss, }: {
1
+ export type DismissAttachmentActionProps = {
2
2
  onDismiss: () => void;
3
- }): import("react").JSX.Element;
3
+ /** Accessible name. @default "Dismiss" */
4
+ label?: string;
5
+ };
6
+ /** Icon button that dismisses an attachment, typically through `reset()`. */
7
+ export declare function DismissAttachmentAction({ onDismiss, label, }: DismissAttachmentActionProps): import("react").JSX.Element;
4
8
  //# sourceMappingURL=dismiss-attachment-action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dismiss-attachment-action.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/dismiss-attachment-action.tsx"],"names":[],"mappings":"AAMA,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,+BAgBA"}
1
+ {"version":3,"file":"dismiss-attachment-action.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/dismiss-attachment-action.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,KAAK,GACN,EAAE,4BAA4B,+BAgB9B"}
@@ -1,28 +1,43 @@
1
- import type { ReactNode } from "react";
2
- import { type APIError } from "@dimah-s3/core";
3
- import { type AttachmentOrientation, type AttachmentSize, type AttachmentState } from "../../../lib/attachment-layout.js";
4
- export type FileAttachmentProps = {
5
- /** @default "sm" */
6
- size?: AttachmentSize;
7
- /** @default "horizontal" */
8
- orientation?: AttachmentOrientation;
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ import type { APIError } from "@dimah-s3/core";
3
+ import { type AttachmentState } from "../../../lib/attachment-layout.js";
4
+ export type FileAttachmentProps = Omit<ComponentProps<"div">, "children"> & {
9
5
  state: AttachmentState;
10
6
  fileName: string;
11
- fileSize?: number;
12
- /** MIME type — used with the filename to pick a type icon when no preview. */
13
- fileType?: string | null;
14
- /** Image thumbnail URL — enables `AttachmentMedia variant="image"`. */
7
+ fileSize?: number | null;
8
+ /** MIME type. With the file name it picks the type glyph when there is no preview. */
9
+ contentType?: string | null;
10
+ /** Image thumbnail URL. Replaces the type glyph. */
15
11
  previewUrl?: string | null;
16
- /** Progress 0–100 when `state` is uploading/idle (pending). */
12
+ /** Ring progress from 0 to 100 while `state` is `idle` or `uploading`. @default 0 */
17
13
  percent?: number;
18
- /** Secondary line; defaults to size, or error text when `state="error"`. */
14
+ /** Secondary line. Defaults to the size, or the error text when `state` is `error`. */
19
15
  description?: ReactNode;
20
16
  error?: string | APIError | null;
17
+ /** Shows a cancel action while the file is queued or in flight: `state` is `idle`, `uploading` or `processing`. */
21
18
  onCancel?: () => void;
22
- onPause?: () => void;
23
- /** Shown when `state` is `done` or `error`. Typically the hook `reset()`. */
19
+ /**
20
+ * Shows a retry action when `state` is `error`. It takes the place of
21
+ * cancel, so focus stays on it once the file is back in flight.
22
+ */
23
+ onRetry?: () => void;
24
+ /** Shows a dismiss action when `state` is `done` or `error`. Typically the hook `reset()`. */
24
25
  onDismiss?: () => void;
25
- className?: string;
26
+ /** Extra controls, usually `AttachmentAction`s, placed before cancel and dismiss. */
27
+ actions?: ReactNode;
28
+ /**
29
+ * An `AttachmentTrigger` that makes the whole card one control, for
30
+ * example to open or download the file. Give it an accessible name.
31
+ * Actions stay above it.
32
+ */
33
+ trigger?: ReactNode;
26
34
  };
27
- export declare function FileAttachment({ state, fileName, fileSize, fileType, previewUrl, percent, description, error, onCancel, onPause, onDismiss, size, orientation, className, }: FileAttachmentProps): import("react").JSX.Element;
35
+ /**
36
+ * File card for upload, download and delete feedback.
37
+ *
38
+ * Set the width with `className`. The card is a size container: under a
39
+ * 9rem content width it stacks the media above the text (for example
40
+ * `className="w-32"`), otherwise it lays out as a row.
41
+ */
42
+ export declare function FileAttachment({ state, fileName, fileSize, contentType, previewUrl, percent, description, error, onCancel, onRetry, onDismiss, actions, trigger, className, ...props }: FileAttachmentProps): import("react").JSX.Element;
28
43
  //# sourceMappingURL=file-attachment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/file-attachment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAmBjE,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAYjC,MAAM,MAAM,mBAAmB,GAAG;IAChC,oBAAoB;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,OAAW,EACX,WAAW,EACX,KAAK,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,IAAW,EACX,WAA0B,EAC1B,SAAS,GACV,EAAE,mBAAmB,+BAsHrB"}
1
+ {"version":3,"file":"file-attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/file-attachment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAiB/C,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAC1E,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,sFAAsF;IACtF,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uFAAuF;IACvF,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACjC,mHAAmH;IACnH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,8FAA8F;IAC9F,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,qFAAqF;IACrF,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,UAAU,EACV,OAAW,EACX,WAAW,EACX,KAAK,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,EACP,SAAS,EACT,GAAG,KAAK,EACT,EAAE,mBAAmB,+BA6HrB"}
@@ -0,0 +1,18 @@
1
+ import type { ComponentProps } from "react";
2
+ /** Props for {@link FileName}. Other props go to the outer `<span>`. */
3
+ export type FileNameProps = Omit<ComponentProps<"span">, "children"> & {
4
+ name: string;
5
+ /**
6
+ * Keep a short extension visible while the rest shortens. Turn it off for
7
+ * folder names. @default true
8
+ */
9
+ extension?: boolean;
10
+ };
11
+ /**
12
+ * A file name that fits the width it has: the stem ends in an ellipsis and
13
+ * the extension stays visible (`a-very-long-na….pdf`). It is an isolate
14
+ * (`dir="auto"`), so the name keeps its own direction inside the sentence or
15
+ * row around it, and `title` holds the whole name.
16
+ */
17
+ export declare function FileName({ name, extension: keepExtension, className, ...props }: FileNameProps): import("react").JSX.Element;
18
+ //# sourceMappingURL=file-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-name.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/file-name.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAc5C,wEAAwE;AACxE,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,SAAS,EAAE,aAAoB,EAC/B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,aAAa,+BAgBf"}
@@ -1,8 +1,9 @@
1
1
  /** Resolve a curated extension key for icon styling (or `null` if unknown). */
2
- export declare function resolveFileTypeExtension(fileName: string, mimeType?: string | null): string | null;
2
+ export declare function resolveFileTypeExtension(fileName: string, contentType?: string | null): string | null;
3
3
  export type FileTypeGlyphProps = {
4
4
  fileName: string;
5
- fileType?: string | null;
5
+ /** MIME type. It wins over the file extension when it is known. */
6
+ contentType?: string | null;
6
7
  /**
7
8
  * `fill` tracks a parent media box (attachments).
8
9
  * `icon` is a fixed file-list glyph with no plate behind it.
@@ -15,12 +16,5 @@ export type FileTypeGlyphProps = {
15
16
  * Colored file glyph for attachment media (no image preview).
16
17
  * Uses `react-file-icon` + a lean curated extension map.
17
18
  */
18
- export declare function FileTypeGlyph({ fileName, fileType, layout, className, }: FileTypeGlyphProps): import("react").JSX.Element;
19
- /**
20
- * File-manager folder. The yellow is the glyph itself, in light and dark,
21
- * the same way a desktop folder stays yellow.
22
- */
23
- export declare function FolderGlyph({ className }: {
24
- className?: string;
25
- }): import("react").JSX.Element;
26
- //# sourceMappingURL=file-type-icon.d.ts.map
19
+ export declare function FileTypeGlyph({ fileName, contentType, layout, className, }: FileTypeGlyphProps): import("react").JSX.Element;
20
+ //# sourceMappingURL=file-type-glyph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-type-glyph.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/file-type-glyph.tsx"],"names":[],"mappings":"AAmJA,+EAA+E;AAC/E,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAC1B,MAAM,GAAG,IAAI,CAYf;AAYD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,WAAW,EACX,MAAe,EACf,SAAS,GACV,EAAE,kBAAkB,+BAmBpB"}
@@ -0,0 +1,9 @@
1
+ export type FolderGlyphProps = {
2
+ className?: string;
3
+ };
4
+ /**
5
+ * File-manager folder. The yellow is the glyph itself, in light and dark,
6
+ * the same way a desktop folder stays yellow.
7
+ */
8
+ export declare function FolderGlyph({ className }: FolderGlyphProps): import("react").JSX.Element;
9
+ //# sourceMappingURL=folder-glyph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folder-glyph.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/folder-glyph.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,gBAAgB,+BAiB1D"}
@@ -1,22 +1,20 @@
1
- import type { ReactNode } from "react";
2
- import { type AttachmentOrientation, type AttachmentSize, type AttachmentState } from "../../../lib/attachment-layout.js";
3
- export type StatusAttachmentProps = {
4
- /** @default "sm" */
5
- size?: AttachmentSize;
6
- /** @default "horizontal" */
7
- orientation?: AttachmentOrientation;
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ import { type AttachmentState } from "../../../lib/attachment-layout.js";
3
+ export type StatusAttachmentProps = Omit<ComponentProps<"div">, "children" | "title"> & {
8
4
  state: AttachmentState;
9
5
  title?: ReactNode;
10
6
  description?: ReactNode;
7
+ /** Replaces the state icon. */
11
8
  media?: ReactNode;
9
+ /** Extra controls, usually `AttachmentAction`s, placed before dismiss. */
12
10
  actions?: ReactNode;
13
11
  /** Dismiss control in `AttachmentActions`. Typically the hook `reset()`. */
14
12
  onDismiss?: () => void;
15
- className?: string;
16
13
  };
17
14
  /**
18
- * Minimal Attachment shell for operation feedback (upload/download/delete).
19
- * Relies on Attachment `data-state` styles for error/done chrome.
15
+ * Minimal attachment row for operation feedback (upload, download, delete)
16
+ * that has no single file to show. Set the width with `className`.
17
+ * Error and done chrome come from the Attachment `data-state` styles.
20
18
  */
21
- export declare function StatusAttachment({ state, title, description, media, actions, onDismiss, size, orientation, className, }: StatusAttachmentProps): import("react").JSX.Element;
19
+ export declare function StatusAttachment({ state, title, description, media, actions, onDismiss, className, ...props }: StatusAttachmentProps): import("react").JSX.Element;
22
20
  //# sourceMappingURL=status-attachment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"status-attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/status-attachment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgBvC,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,qBAAqB,GAAG;IAClC,oBAAoB;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,OAAO,EACP,SAAS,EACT,IAAW,EACX,WAA0B,EAC1B,SAAS,GACV,EAAE,qBAAqB,+BA6CvB"}
1
+ {"version":3,"file":"status-attachment.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/attachment/status-attachment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgBvD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,cAAc,CAAC,KAAK,CAAC,EACrB,UAAU,GAAG,OAAO,CACrB,GAAG;IACF,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,EACT,GAAG,KAAK,EACT,EAAE,qBAAqB,+BA0CvB"}
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from "react";
2
+ /** Props for {@link DeleteConfirmDialog}. Each one replaces the default copy. */
3
+ export type DeleteConfirmDialogProps = {
4
+ title?: ReactNode;
5
+ description?: ReactNode;
6
+ confirmLabel?: ReactNode;
7
+ cancelLabel?: ReactNode;
8
+ };
9
+ /**
10
+ * The `Delete` root's confirm dialog. The root renders one by default; pass
11
+ * your own as `<Delete dialog={<DeleteConfirmDialog title="…" />}>`.
12
+ *
13
+ * It is an alert dialog with initial focus on Cancel. It names the file (and
14
+ * its size) for one target, or the count for several, and shows the
15
+ * request's `note` as part of the dialog's description, so it is read out
16
+ * on open. Confirm stays busy until the delete settles. The root moves
17
+ * focus once the dialog closes.
18
+ */
19
+ export declare function DeleteConfirmDialog({ title, description, confirmLabel, cancelLabel, }: DeleteConfirmDialogProps): import("react").JSX.Element;
20
+ //# sourceMappingURL=delete-confirm-dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-confirm-dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/delete/delete-confirm-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAwBzD,iFAAiF;AACjF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,WAAW,EACX,YAAY,EACZ,WAAW,GACZ,EAAE,wBAAwB,+BAqF1B"}
@@ -0,0 +1,34 @@
1
+ import { type ReactNode } from "react";
2
+ import { type UseDeleteReturn } from "@dimah-s3/react";
3
+ /** Props for {@link DeleteToasts}. */
4
+ export type DeleteToastsProps = {
5
+ /** Return value of `useDelete`. */
6
+ delete: UseDeleteReturn;
7
+ };
8
+ /** One delete result message: a toast, or a live message in an ObjectList. */
9
+ export type DeleteToastMessage = {
10
+ type: "success" | "error";
11
+ title: string;
12
+ description?: ReactNode;
13
+ };
14
+ /**
15
+ * Toasts for a `useDelete` return: one success toast and one error toast
16
+ * per call, once every key of the call has settled. Mount it once per hook,
17
+ * next to one `<Toaster />`. A second owner for the same hook renders
18
+ * nothing and warns in development.
19
+ */
20
+ export declare function DeleteToasts({ delete: del }: DeleteToastsProps): null;
21
+ /**
22
+ * The hook behind {@link DeleteToasts}. `weak` owners (ObjectList built-ins)
23
+ * step aside while a strong owner is mounted for the same hook.
24
+ * Deletes that settled before mount are not toasted. `report` replaces
25
+ * `toast.add`, so an ObjectList with `toasts={false}` can read the same
26
+ * messages out in its live region.
27
+ *
28
+ * @internal
29
+ */
30
+ export declare function useDeleteToasts(del: UseDeleteReturn, options?: {
31
+ weak?: boolean;
32
+ report?: (message: DeleteToastMessage) => void;
33
+ }): void;
34
+ //# sourceMappingURL=delete-toasts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-toasts.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/delete/delete-toasts.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AAMzB,sCAAsC;AACtC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,mCAAmC;IACnC,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB,CAAC;AAQF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,iBAAiB,QAG9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,eAAe,EACpB,OAAO,GAAE;IACP,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC3C,GACL,IAAI,CA4DN"}
@@ -0,0 +1,18 @@
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ import { Button } from "../../ui/button.js";
3
+ import { type DeleteTarget } from "./delete.js";
4
+ /** Props for {@link DeleteTrigger}: `Button` props plus the target. */
5
+ export type DeleteTriggerProps = ComponentProps<typeof Button> & DeleteTarget & {
6
+ /** Extra content in the confirm dialog. */
7
+ note?: ReactNode;
8
+ /** Tooltip content. No tooltip when omitted. */
9
+ tooltip?: ReactNode;
10
+ };
11
+ /**
12
+ * Button that asks the nearest `Delete` root to delete one object. It is
13
+ * disabled, and shows a spinner, while that object is deleting. Children
14
+ * replace the default icon and label. An `onClick` that prevents the default
15
+ * stops the request.
16
+ */
17
+ export declare function DeleteTrigger({ objectKey, fileName, fileSize, note, tooltip, variant, disabled, focusableWhenDisabled, onClick, children, ...props }: DeleteTriggerProps): import("react").JSX.Element;
18
+ //# sourceMappingURL=delete-trigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-trigger.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/delete/delete-trigger.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAMhD,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,qCAAqC,CAAC;AAE7C,uEAAuE;AACvE,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAC5D,YAAY,GAAG;IACb,2CAA2C;IAC3C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,gDAAgD;IAChD,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEJ;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,OAAuB,EACvB,QAAQ,EACR,qBAAqB,EACrB,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,kBAAkB,+BA4CpB"}
@@ -0,0 +1,83 @@
1
+ import { type ReactNode } from "react";
2
+ import type { DeleteResult, UseDeleteReturn } from "@dimah-s3/react";
3
+ /** One object to delete. */
4
+ export type DeleteTarget = {
5
+ /**
6
+ * S3 object key. Named `objectKey` because React reserves the `key` prop.
7
+ */
8
+ objectKey: string;
9
+ /** Display name in the dialog and toasts. Defaults to the key's file name. */
10
+ fileName?: string;
11
+ /** Display size in the dialog. */
12
+ fileSize?: number | null;
13
+ };
14
+ /** Options for {@link DeleteContextValue.request}. */
15
+ export type DeleteRequestOptions = {
16
+ /** Extra content in the confirm dialog, below the description. */
17
+ note?: ReactNode;
18
+ /**
19
+ * The element that asked for the delete. Focus returns to it when the
20
+ * dialog closes. Defaults to the focused element.
21
+ */
22
+ trigger?: HTMLElement | null;
23
+ };
24
+ /** Props for {@link Delete}. */
25
+ export type DeleteProps = {
26
+ /** Return value of `useDelete`. */
27
+ delete: UseDeleteReturn;
28
+ /** Ask before deleting. @default true */
29
+ confirm?: boolean;
30
+ /** Replaces the default {@link DeleteConfirmDialog}. */
31
+ dialog?: ReactNode;
32
+ /** Called once per confirmed delete, with every key's outcome. */
33
+ onDeleted?: (result: DeleteResult) => void;
34
+ /**
35
+ * Where focus goes after the dialog closes. Return `null` to use the
36
+ * trigger, or the nearest `[data-dimah-s3-focus-root]` once the trigger
37
+ * is gone.
38
+ */
39
+ restoreFocus?: (targets: readonly DeleteTarget[]) => HTMLElement | null;
40
+ children: ReactNode;
41
+ };
42
+ /** What {@link useDeleteContext} returns. */
43
+ export type DeleteContextValue = {
44
+ /** The root's `useDelete` return. */
45
+ delete: UseDeleteReturn;
46
+ /** The delete waiting for confirmation, or `null`. */
47
+ pending: {
48
+ targets: readonly DeleteTarget[];
49
+ note?: ReactNode;
50
+ } | null;
51
+ /**
52
+ * Asks to delete `targets`. Opens the confirm dialog, or deletes at once
53
+ * when the root has `confirm={false}`. Replaces a pending request.
54
+ */
55
+ request: (targets: DeleteTarget | readonly DeleteTarget[], options?: DeleteRequestOptions) => void;
56
+ /**
57
+ * Deletes the pending targets, then closes the dialog. Calls made while
58
+ * the delete runs return the same promise.
59
+ */
60
+ confirm: () => Promise<DeleteResult>;
61
+ /** Closes the dialog without deleting. Does nothing while deleting. */
62
+ cancel: () => void;
63
+ };
64
+ /**
65
+ * Root of the delete family. Holds a `useDelete` return and one confirm
66
+ * dialog for every `DeleteTrigger` inside it.
67
+ *
68
+ * Confirming calls `delete.removeMany` with every target and keeps the
69
+ * dialog open until it settles. Focus then returns to `restoreFocus`, the
70
+ * trigger, or the trigger's nearest `[data-dimah-s3-focus-root]` container,
71
+ * the first one still in the document. Toasts come from `DeleteToasts`.
72
+ *
73
+ * @example
74
+ * ```tsx
75
+ * <Delete delete={remove} onDeleted={reload}>
76
+ * <DeleteTrigger objectKey={key} fileName={name} />
77
+ * </Delete>
78
+ * ```
79
+ */
80
+ export declare function Delete({ delete: del, confirm: confirmFirst, dialog, onDeleted, restoreFocus, children, }: DeleteProps): import("react").JSX.Element;
81
+ /** The nearest {@link Delete} root. Use it to build your own parts. */
82
+ export declare function useDeleteContext(): DeleteContextValue;
83
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/components/dimah-s3/delete/delete.tsx"],"names":[],"mappings":"AAEA,OAAO,EASL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGrE,4BAA4B;AAC5B,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,sDAAsD;AACtD,MAAM,MAAM,oBAAoB,GAAG;IACjC,kEAAkE;IAClE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,gCAAgC;AAChC,MAAM,MAAM,WAAW,GAAG;IACxB,mCAAmC;IACnC,MAAM,EAAE,eAAe,CAAC;IACxB,yCAAyC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,kEAAkE;IAClE,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,KAAK,WAAW,GAAG,IAAI,CAAC;IACxE,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,6CAA6C;AAC7C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,qCAAqC;IACrC,MAAM,EAAE,eAAe,CAAC;IACxB,sDAAsD;IACtD,OAAO,EAAE;QAAE,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,IAAI,CAAC;IACvE;;;OAGG;IACH,OAAO,EAAE,CACP,OAAO,EAAE,YAAY,GAAG,SAAS,YAAY,EAAE,EAC/C,OAAO,CAAC,EAAE,oBAAoB,KAC3B,IAAI,CAAC;IACV;;;OAGG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IACrC,uEAAuE;IACvE,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAqBF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EAAE,GAAG,EACX,OAAO,EAAE,YAAmB,EAC5B,MAAM,EACN,SAAS,EACT,YAAY,EACZ,QAAQ,GACT,EAAE,WAAW,+BAoGb;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,IAAI,kBAAkB,CAQrD"}