@lanfermann/ui 0.4.0 → 0.6.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/dist/components/action-bar/action-bar.d.ts +59 -0
- package/dist/components/action-bar/action-bar.js +116 -0
- package/dist/components/alert/alert.d.ts +1 -1
- package/dist/components/alert/alert.js +3 -17
- package/dist/components/alert-dialog/alert-dialog.d.ts +1 -1
- package/dist/components/app-shell/app-shell.d.ts +33 -0
- package/dist/components/app-shell/app-shell.js +93 -0
- package/dist/components/attachment/attachment.d.ts +46 -0
- package/dist/components/attachment/attachment.js +222 -0
- package/dist/components/attachment/kinds.d.ts +7 -0
- package/dist/components/attachment/kinds.js +100 -0
- package/dist/components/avatar/avatar.d.ts +14 -4
- package/dist/components/avatar/avatar.js +57 -13
- package/dist/components/avatar-group/avatar-group.d.ts +33 -0
- package/dist/components/avatar-group/avatar-group.js +110 -0
- package/dist/components/avatar-group/people.d.ts +12 -0
- package/dist/components/avatar-group/people.js +24 -0
- package/dist/components/badge/badge.d.ts +9 -3
- package/dist/components/badge/badge.js +21 -6
- package/dist/components/banner/banner.d.ts +39 -0
- package/dist/components/banner/banner.js +149 -0
- package/dist/components/card/card.d.ts +11 -3
- package/dist/components/card/card.js +18 -4
- package/dist/components/checkbox-card/checkbox-card.d.ts +21 -0
- package/dist/components/checkbox-card/checkbox-card.js +49 -0
- package/dist/components/chip/chip-group.d.ts +15 -0
- package/dist/components/chip/chip-group.js +44 -0
- package/dist/components/chip/chip-variants.d.ts +6 -0
- package/dist/components/chip/chip-variants.js +28 -0
- package/dist/components/chip/chip.d.ts +39 -0
- package/dist/components/chip/chip.js +71 -0
- package/dist/components/code-block/code-block-live.d.ts +13 -1
- package/dist/components/code-block/code-block-live.js +10 -4
- package/dist/components/code-block/code-block.d.ts +1 -0
- package/dist/components/code-block/code-copy.d.ts +3 -11
- package/dist/components/code-block/code-copy.js +15 -62
- package/dist/components/code-block/code-keys.js +10 -22
- package/dist/components/code-block/code-lines-live.d.ts +7 -0
- package/dist/components/code-block/code-lines-live.js +167 -0
- package/dist/components/code-block/code-lines-view.d.ts +1 -0
- package/dist/components/code-block/code-lines-view.js +50 -18
- package/dist/components/code-block/code-lines.d.ts +3 -0
- package/dist/components/code-block/code-tabs.d.ts +1 -0
- package/dist/components/code-block/highlight.d.ts +1 -0
- package/dist/components/code-block/line-diff.js +135 -0
- package/dist/components/combobox/combobox.d.ts +50 -2
- package/dist/components/combobox/combobox.js +178 -9
- package/dist/components/command/command.d.ts +131 -0
- package/dist/components/command/command.js +335 -0
- package/dist/components/consent/consent-card.js +365 -0
- package/dist/components/consent/consent-embed.d.ts +21 -0
- package/dist/components/consent/consent-embed.js +111 -0
- package/dist/components/consent/consent-labels.d.ts +70 -0
- package/dist/components/consent/consent-labels.js +61 -0
- package/dist/components/consent/consent-record.d.ts +95 -0
- package/dist/components/consent/consent-record.js +112 -0
- package/dist/components/consent/consent-store.d.ts +26 -0
- package/dist/components/consent/consent-store.js +240 -0
- package/dist/components/consent/consent.d.ts +86 -0
- package/dist/components/consent/consent.js +306 -0
- package/dist/components/container/container.d.ts +1 -1
- package/dist/components/context-menu/context-menu.d.ts +23 -0
- package/dist/components/context-menu/context-menu.js +50 -0
- package/dist/components/conversation/conversation.d.ts +45 -0
- package/dist/components/conversation/conversation.js +295 -0
- package/dist/components/conversation/stick.js +23 -0
- package/dist/components/copy-button/copy-button.d.ts +50 -0
- package/dist/components/copy-button/copy-button.js +65 -0
- package/dist/components/copy-page/copy-page.js +7 -17
- package/dist/components/copy-pill/copy-pill.js +1 -1
- package/dist/components/description-list/description-list.d.ts +32 -0
- package/dist/components/description-list/description-list.js +51 -0
- package/dist/components/empty/empty.d.ts +38 -0
- package/dist/components/empty/empty.js +57 -0
- package/dist/components/field/field.js +1 -1
- package/dist/components/file-upload/file-upload.d.ts +96 -0
- package/dist/components/file-upload/file-upload.js +347 -0
- package/dist/components/file-upload/files.d.ts +39 -0
- package/dist/components/file-upload/files.js +74 -0
- package/dist/components/grow/grow.d.ts +15 -3
- package/dist/components/grow/grow.js +31 -10
- package/dist/components/heading/heading.d.ts +1 -1
- package/dist/components/icon/icon.d.ts +1 -1
- package/dist/components/input/input.js +1 -1
- package/dist/components/message/message.d.ts +73 -0
- package/dist/components/message/message.js +196 -0
- package/dist/components/otp-field/otp-field.d.ts +37 -0
- package/dist/components/otp-field/otp-field.js +126 -0
- package/dist/components/pagination/pagination.d.ts +50 -0
- package/dist/components/pagination/pagination.js +188 -0
- package/dist/components/prompt-input/keys.js +15 -0
- package/dist/components/prompt-input/prompt-input.d.ts +89 -0
- package/dist/components/prompt-input/prompt-input.js +331 -0
- package/dist/components/radio-card/radio-card.d.ts +23 -0
- package/dist/components/radio-card/radio-card.js +48 -0
- package/dist/components/rolling-number/rolling-number.d.ts +30 -0
- package/dist/components/rolling-number/rolling-number.js +149 -0
- package/dist/components/seam/seam.d.ts +1 -1
- package/dist/components/secret-field/secret-field.d.ts +53 -0
- package/dist/components/secret-field/secret-field.js +121 -0
- package/dist/components/section/section.d.ts +1 -1
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.js +1 -1
- package/dist/components/shortcut/shortcut.d.ts +46 -0
- package/dist/components/shortcut/shortcut.js +87 -0
- package/dist/components/sidebar/sidebar-context.js +16 -0
- package/dist/components/sidebar/sidebar.d.ts +161 -0
- package/dist/components/sidebar/sidebar.js +588 -0
- package/dist/components/site-header/site-header.js +1 -1
- package/dist/components/skeleton/loaded.d.ts +21 -0
- package/dist/components/skeleton/loaded.js +57 -0
- package/dist/components/skeleton/skeleton.d.ts +43 -0
- package/dist/components/skeleton/skeleton.js +48 -0
- package/dist/components/sources/source-list.d.ts +17 -0
- package/dist/components/sources/source-list.js +26 -0
- package/dist/components/sources/sources.d.ts +45 -0
- package/dist/components/sources/sources.js +167 -0
- package/dist/components/stat/stat.d.ts +57 -0
- package/dist/components/stat/stat.js +110 -0
- package/dist/components/steps/steps.d.ts +57 -0
- package/dist/components/steps/steps.js +131 -0
- package/dist/components/table/table.d.ts +18 -9
- package/dist/components/table/table.js +21 -13
- package/dist/components/text/text.d.ts +1 -1
- package/dist/components/theme-switch/theme-switch.js +1 -1
- package/dist/components/time-field/time-field.js +1 -1
- package/dist/components/timeline/timeline.d.ts +45 -0
- package/dist/components/timeline/timeline.js +86 -0
- package/dist/components/toast/toast.js +10 -26
- package/dist/components/toggle/toggle.d.ts +24 -0
- package/dist/components/toggle/toggle.js +53 -0
- package/dist/components/toggle-group/toggle-group.d.ts +27 -0
- package/dist/components/toggle-group/toggle-group.js +38 -0
- package/dist/components/toolbar/toolbar-context.js +12 -0
- package/dist/components/toolbar/toolbar.d.ts +45 -0
- package/dist/components/toolbar/toolbar.js +92 -0
- package/dist/components/trace/trace.d.ts +2 -1
- package/dist/components/trace/trace.js +14 -26
- package/dist/index.d.ts +46 -3
- package/dist/index.js +44 -3
- package/dist/internal/arriving-pieces.js +56 -0
- package/dist/internal/arriving.js +171 -0
- package/dist/internal/avatar-cut.d.ts +15 -0
- package/dist/internal/avatar-cut.js +83 -0
- package/dist/internal/choice-card.d.ts +15 -0
- package/dist/internal/choice-card.js +65 -0
- package/dist/internal/clipboard.js +37 -0
- package/dist/internal/copy.js +58 -0
- package/dist/internal/field.js +24 -4
- package/dist/internal/glyphs.js +26 -1
- package/dist/internal/live-list.js +41 -0
- package/dist/internal/number-places.js +156 -0
- package/dist/internal/picker-sheet.js +1 -1
- package/dist/internal/presence-dot.js +24 -0
- package/dist/internal/presence.js +104 -0
- package/dist/internal/rail-mark.d.ts +3 -0
- package/dist/internal/rail-mark.js +33 -0
- package/dist/internal/status-icon.js +22 -0
- package/dist/internal/travelling-mark.js +204 -0
- package/dist/lib/cn.js +4 -0
- package/dist/lib/shortcut.d.ts +11 -0
- package/dist/lib/shortcut.js +165 -0
- package/package.json +1 -1
- package/src/styles/action-bar.css +28 -0
- package/src/styles/assistant.css +83 -0
- package/src/styles/avatar.css +24 -0
- package/src/styles/code.css +89 -1
- package/src/styles/consent.css +65 -0
- package/src/styles/copy.css +12 -11
- package/src/styles/depth.css +46 -2
- package/src/styles/marks.css +20 -2
- package/src/styles/rail.css +49 -0
- package/src/styles/rolling-number.css +94 -0
- package/src/styles/steps.css +98 -0
- package/src/styles/timeline.css +48 -0
- package/src/styles/travel.css +36 -0
- package/src/styles.css +9 -0
|
@@ -3,8 +3,8 @@ import { Icon } from "../icon/icon.js";
|
|
|
3
3
|
import { FieldActionsContext, FieldDisabledContext } from "../../internal/field-context.js";
|
|
4
4
|
import { mergeClassName } from "../../lib/cn.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { AlertCircleIcon } from "@hugeicons/core-free-icons";
|
|
7
6
|
import { useRef } from "react";
|
|
7
|
+
import { AlertCircleIcon } from "@hugeicons/core-free-icons";
|
|
8
8
|
import { Field as Field$1 } from "@base-ui/react/field";
|
|
9
9
|
// src/components/field/field.tsx
|
|
10
10
|
/**
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { IconSvgElement } from "../icon/icon.js";
|
|
2
|
+
import { FileRejection, FileRules } from "./files.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
export type FileUploadProps = Omit<ComponentProps<"div">, "onChange"> & FileRules & {
|
|
5
|
+
/**
|
|
6
|
+
* Called with the files that were dropped, pasted or chosen and that fit the rules. Start
|
|
7
|
+
* their upload here and show each as a `FileUploadItem`.
|
|
8
|
+
*/
|
|
9
|
+
onFilesAdded: (files: File[]) => void;
|
|
10
|
+
/** Called with the files that were not taken, each with its reason. Say so in words. */
|
|
11
|
+
onReject?: (rejected: FileRejection[]) => void;
|
|
12
|
+
/** Nothing can be added right now. */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** The name the chosen files are submitted under, if the field is part of a plain form. */
|
|
15
|
+
name?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Takes files: a zone to drop them on, a button that opens the system's dialog, and a list of
|
|
19
|
+
* what was added with the state of each. It does not upload anything. It reports the files
|
|
20
|
+
* (`onFilesAdded`) and shows the progress the caller gives it; sending, resuming and checking
|
|
21
|
+
* them is the caller's work.
|
|
22
|
+
*
|
|
23
|
+
* Put a `FileUploadZone` inside and, under it, a `FileUploadList` of `FileUploadItem`s. A real
|
|
24
|
+
* file input stands behind the button, so it works from the keyboard and with assistive tech,
|
|
25
|
+
* and a file pasted while the focus is in the zone is taken as well. `accept` and `maxSize`
|
|
26
|
+
* are checked here for every way in; what does not fit comes back through `onReject`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function FileUpload({ accept, maxSize, multiple, onFilesAdded, onReject, disabled, name, className, children, ...props }: FileUploadProps): import("react").JSX.Element;
|
|
29
|
+
export type FileUploadZoneProps = Omit<ComponentProps<"div">, "title"> & {
|
|
30
|
+
/** What to do, as a short line: "Dateien hierher ziehen". */
|
|
31
|
+
title?: ReactNode;
|
|
32
|
+
/** The same line while a file hangs over the zone. */
|
|
33
|
+
dropTitle?: ReactNode;
|
|
34
|
+
/** What is taken: the kinds and the largest size ("PDF oder Bild, höchstens 10 MB"). */
|
|
35
|
+
description?: ReactNode;
|
|
36
|
+
/** The words on the button that opens the system's dialog. */
|
|
37
|
+
buttonLabel?: ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* `tile` (the default): a symbol in a small tile above the words. `plain`: the words and the
|
|
40
|
+
* button alone, for a lower zone: one of several in a form, or in a narrow card.
|
|
41
|
+
*/
|
|
42
|
+
variant?: "tile" | "plain";
|
|
43
|
+
/** The symbol in the tile. */
|
|
44
|
+
icon?: IconSvgElement;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Where files are dropped. It is a socket, cut like a field: white, with a hairline edge. While
|
|
48
|
+
* a file hangs over it, it takes the field's halo, the sign that it will take what is let go.
|
|
49
|
+
* There is no dashed border. Its button opens the system's file dialog.
|
|
50
|
+
*/
|
|
51
|
+
export declare function FileUploadZone({ title, dropTitle, description, buttonLabel, variant, icon, className, ...props }: FileUploadZoneProps): import("react").JSX.Element;
|
|
52
|
+
export type FileUploadListProps = ComponentProps<"ul">;
|
|
53
|
+
/**
|
|
54
|
+
* The files that were added, one row each, under the zone. A row that joins opens its place and
|
|
55
|
+
* fades in, and what stands below is pushed; one that is removed fades and its place folds shut.
|
|
56
|
+
* The rows that are there when the list first shows stand still.
|
|
57
|
+
*
|
|
58
|
+
* Keep it in the upload while there are no files: an empty list takes no room, the first file
|
|
59
|
+
* opens it like any other, and a screen reader hears it join (a live region has to be there
|
|
60
|
+
* before what it announces). Name it (`aria-label`: "Dateien") and give each `FileUploadItem` a
|
|
61
|
+
* `key` that stays its own.
|
|
62
|
+
*/
|
|
63
|
+
export declare function FileUploadList({ className, children, ...props }: FileUploadListProps): import("react").JSX.Element;
|
|
64
|
+
/** Where a file stands: not begun, on its way, arrived, or failed. */
|
|
65
|
+
export type FileUploadStatus = "waiting" | "uploading" | "done" | "error";
|
|
66
|
+
export type FileUploadItemProps = Omit<ComponentProps<"div">, "children"> & {
|
|
67
|
+
/** The file's name, with its ending. */
|
|
68
|
+
name: string;
|
|
69
|
+
/** Its size in bytes. */
|
|
70
|
+
size: number;
|
|
71
|
+
/** Where it stands. Arrived unless said otherwise. */
|
|
72
|
+
status?: FileUploadStatus;
|
|
73
|
+
/** How much has arrived, from 0 to 1, while it is `uploading`. Without it the bar runs through. */
|
|
74
|
+
progress?: number;
|
|
75
|
+
/** Why it failed, as a sentence: "Die Verbindung wurde unterbrochen." */
|
|
76
|
+
error?: ReactNode;
|
|
77
|
+
/** With it a failed file offers to try once more. */
|
|
78
|
+
onRetry?: () => void;
|
|
79
|
+
/** With it the row carries a key that takes the file out of the list (and stops its upload). */
|
|
80
|
+
onRemove?: () => void;
|
|
81
|
+
/** The words on the key that tries again. */
|
|
82
|
+
retryLabel?: ReactNode;
|
|
83
|
+
/** The verb of the key that removes the file. The file's name is said before it. */
|
|
84
|
+
removeLabel?: string;
|
|
85
|
+
/** What each state is called for assistive tech, where the mark alone would say it. */
|
|
86
|
+
statusLabels?: Partial<Record<FileUploadStatus, string>>;
|
|
87
|
+
/** The locale the sizes are written in. */
|
|
88
|
+
locale?: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* One file: the system's mark in front (the open ring waits, the arc works, the disc is done),
|
|
92
|
+
* its name, its size in tabular digits, and under the name a thin bar while it is on its way.
|
|
93
|
+
* The bar folds away once the file has arrived, and the mark closes where the arc was. A file
|
|
94
|
+
* that failed says so in words, with the danger symbol and a key that tries again.
|
|
95
|
+
*/
|
|
96
|
+
export declare function FileUploadItem({ name, size, status, progress, error, onRetry, onRemove, retryLabel, removeLabel, statusLabels, locale, className, ...props }: FileUploadItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "../button/button.js";
|
|
3
|
+
import { Icon } from "../icon/icon.js";
|
|
4
|
+
import { Progress, ProgressTrack } from "../progress/progress.js";
|
|
5
|
+
import { Spinner } from "../spinner/spinner.js";
|
|
6
|
+
import { CloseGlyph } from "../../internal/glyphs.js";
|
|
7
|
+
import { placeProps, useLive, usePresence } from "../../internal/presence.js";
|
|
8
|
+
import { cn } from "../../lib/cn.js";
|
|
9
|
+
import { formatFileProgress, formatFileSize, sortFiles } from "./files.js";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Children, createContext, isValidElement, useContext, useMemo, useRef, useState } from "react";
|
|
12
|
+
import { Alert02Icon, Upload04Icon } from "@hugeicons/core-free-icons";
|
|
13
|
+
// src/components/file-upload/file-upload.tsx
|
|
14
|
+
const FileUploadContext = createContext({
|
|
15
|
+
open: () => {},
|
|
16
|
+
add: () => {},
|
|
17
|
+
disabled: false,
|
|
18
|
+
live: false
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Takes files: a zone to drop them on, a button that opens the system's dialog, and a list of
|
|
22
|
+
* what was added with the state of each. It does not upload anything. It reports the files
|
|
23
|
+
* (`onFilesAdded`) and shows the progress the caller gives it; sending, resuming and checking
|
|
24
|
+
* them is the caller's work.
|
|
25
|
+
*
|
|
26
|
+
* Put a `FileUploadZone` inside and, under it, a `FileUploadList` of `FileUploadItem`s. A real
|
|
27
|
+
* file input stands behind the button, so it works from the keyboard and with assistive tech,
|
|
28
|
+
* and a file pasted while the focus is in the zone is taken as well. `accept` and `maxSize`
|
|
29
|
+
* are checked here for every way in; what does not fit comes back through `onReject`.
|
|
30
|
+
*/
|
|
31
|
+
function FileUpload({ accept, maxSize, multiple = false, onFilesAdded, onReject, disabled = false, name, className, children, ...props }) {
|
|
32
|
+
const input = useRef(null);
|
|
33
|
+
const live = useLive();
|
|
34
|
+
const context = useMemo(() => ({
|
|
35
|
+
disabled,
|
|
36
|
+
live,
|
|
37
|
+
open: () => input.current?.click(),
|
|
38
|
+
add: (files) => {
|
|
39
|
+
if (disabled || files.length === 0) return;
|
|
40
|
+
const { accepted, rejected } = sortFiles(files, {
|
|
41
|
+
accept,
|
|
42
|
+
maxSize,
|
|
43
|
+
multiple
|
|
44
|
+
});
|
|
45
|
+
if (accepted.length > 0) onFilesAdded(accepted);
|
|
46
|
+
if (rejected.length > 0) onReject?.(rejected);
|
|
47
|
+
}
|
|
48
|
+
}), [
|
|
49
|
+
accept,
|
|
50
|
+
maxSize,
|
|
51
|
+
multiple,
|
|
52
|
+
disabled,
|
|
53
|
+
live,
|
|
54
|
+
onFilesAdded,
|
|
55
|
+
onReject
|
|
56
|
+
]);
|
|
57
|
+
return /* @__PURE__ */ jsx(FileUploadContext, {
|
|
58
|
+
value: context,
|
|
59
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
60
|
+
"data-slot": "file-upload",
|
|
61
|
+
"data-live": live ? "" : void 0,
|
|
62
|
+
className: cn("flex flex-col gap-3", className),
|
|
63
|
+
...props,
|
|
64
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
65
|
+
ref: input,
|
|
66
|
+
type: "file",
|
|
67
|
+
hidden: true,
|
|
68
|
+
tabIndex: -1,
|
|
69
|
+
name,
|
|
70
|
+
accept,
|
|
71
|
+
multiple,
|
|
72
|
+
disabled,
|
|
73
|
+
"data-slot": "file-upload-input",
|
|
74
|
+
onChange: (event) => {
|
|
75
|
+
context.add([...event.currentTarget.files ?? []]);
|
|
76
|
+
if (!name) event.currentTarget.value = "";
|
|
77
|
+
}
|
|
78
|
+
}), children]
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/** Whether what is being dragged is files, and not a piece of text or a link. */
|
|
83
|
+
const carriesFiles = (event) => event.dataTransfer.types.includes("Files");
|
|
84
|
+
/**
|
|
85
|
+
* Where files are dropped. It is a socket, cut like a field: white, with a hairline edge. While
|
|
86
|
+
* a file hangs over it, it takes the field's halo, the sign that it will take what is let go.
|
|
87
|
+
* There is no dashed border. Its button opens the system's file dialog.
|
|
88
|
+
*/
|
|
89
|
+
function FileUploadZone({ title = "Dateien hierher ziehen", dropTitle = "Loslassen, um sie hinzuzufügen", description, buttonLabel = "Dateien auswählen", variant = "tile", icon = Upload04Icon, className, ...props }) {
|
|
90
|
+
const { open, add, disabled } = useContext(FileUploadContext);
|
|
91
|
+
const depth = useRef(0);
|
|
92
|
+
const [over, setOver] = useState(false);
|
|
93
|
+
const rest = () => {
|
|
94
|
+
depth.current = 0;
|
|
95
|
+
setOver(false);
|
|
96
|
+
};
|
|
97
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
98
|
+
"data-slot": "file-upload-zone",
|
|
99
|
+
"data-variant": variant,
|
|
100
|
+
"data-dragging": over ? "" : void 0,
|
|
101
|
+
"data-disabled": disabled ? "" : void 0,
|
|
102
|
+
className: cn("group/zone flex flex-col items-center gap-1 rounded-xl bg-surface px-6 py-6 text-center depth-field", "transition-[box-shadow,background-color] spring-snap data-dragging:depth-field-focus", "data-disabled:bg-disabled data-disabled:depth-flat", className),
|
|
103
|
+
onDragEnter: (event) => {
|
|
104
|
+
if (disabled || !carriesFiles(event)) return;
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
depth.current += 1;
|
|
107
|
+
setOver(true);
|
|
108
|
+
},
|
|
109
|
+
onDragOver: (event) => {
|
|
110
|
+
if (!disabled && carriesFiles(event)) event.preventDefault();
|
|
111
|
+
},
|
|
112
|
+
onDragLeave: (event) => {
|
|
113
|
+
if (disabled || !carriesFiles(event)) return;
|
|
114
|
+
depth.current = Math.max(0, depth.current - 1);
|
|
115
|
+
if (depth.current === 0) setOver(false);
|
|
116
|
+
},
|
|
117
|
+
onDrop: (event) => {
|
|
118
|
+
if (disabled || !carriesFiles(event)) return;
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
rest();
|
|
121
|
+
add([...event.dataTransfer.files]);
|
|
122
|
+
},
|
|
123
|
+
onPaste: (event) => {
|
|
124
|
+
const files = [...event.clipboardData.files];
|
|
125
|
+
if (files.length === 0) return;
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
add(files);
|
|
128
|
+
},
|
|
129
|
+
...props,
|
|
130
|
+
children: [
|
|
131
|
+
variant === "tile" && /* @__PURE__ */ jsx("span", {
|
|
132
|
+
"aria-hidden": true,
|
|
133
|
+
"data-slot": "file-upload-tile",
|
|
134
|
+
className: "mb-2 flex size-10 items-center justify-center rounded-lg bg-surface-quiet text-fg-muted inset-ring inset-ring-hairline group-data-disabled/zone:text-on-disabled forced-colors:inset-ring-[CanvasText]",
|
|
135
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
136
|
+
icon,
|
|
137
|
+
size: 18,
|
|
138
|
+
className: "transition-[translate,color] spring-seat group-data-dragging/zone:-translate-y-0.5 group-data-dragging/zone:text-accent"
|
|
139
|
+
})
|
|
140
|
+
}),
|
|
141
|
+
/* @__PURE__ */ jsx("p", {
|
|
142
|
+
"data-slot": "file-upload-title",
|
|
143
|
+
className: "text-control font-medium text-fg group-data-disabled/zone:text-on-disabled",
|
|
144
|
+
children: over ? dropTitle : title
|
|
145
|
+
}),
|
|
146
|
+
description !== void 0 && /* @__PURE__ */ jsx("p", {
|
|
147
|
+
"data-slot": "file-upload-description",
|
|
148
|
+
className: "text-sm text-pretty text-fg-muted group-data-disabled/zone:text-on-disabled",
|
|
149
|
+
children: description
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ jsx(Button, {
|
|
152
|
+
size: "sm",
|
|
153
|
+
disabled,
|
|
154
|
+
onClick: open,
|
|
155
|
+
className: "mt-3",
|
|
156
|
+
children: buttonLabel
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
const keyOf = (element) => element.key ?? "";
|
|
162
|
+
/**
|
|
163
|
+
* A row's place in the list. It opens from nothing when a file joins and folds shut when one is
|
|
164
|
+
* removed, so the rows below glide. Every change of height in the list is one of these folds,
|
|
165
|
+
* or the fold of a bar or an error inside a row: each eases by itself and the list adds them
|
|
166
|
+
* up, so a file that arrives while another is removed does not make the list chase its own
|
|
167
|
+
* height. The place clips only up and down: the focus ring of a key stays whole.
|
|
168
|
+
*/
|
|
169
|
+
const placeOfFile = [
|
|
170
|
+
"group/place grid grid-rows-[1fr] overflow-y-clip transition-[grid-template-rows] spring-settle",
|
|
171
|
+
"in-data-live:starting:grid-rows-[0fr]",
|
|
172
|
+
"data-leaving:grid-rows-[0fr] data-leaving:delay-[120ms]"
|
|
173
|
+
].join(" ");
|
|
174
|
+
/**
|
|
175
|
+
* The files that were added, one row each, under the zone. A row that joins opens its place and
|
|
176
|
+
* fades in, and what stands below is pushed; one that is removed fades and its place folds shut.
|
|
177
|
+
* The rows that are there when the list first shows stand still.
|
|
178
|
+
*
|
|
179
|
+
* Keep it in the upload while there are no files: an empty list takes no room, the first file
|
|
180
|
+
* opens it like any other, and a screen reader hears it join (a live region has to be there
|
|
181
|
+
* before what it announces). Name it (`aria-label`: "Dateien") and give each `FileUploadItem` a
|
|
182
|
+
* `key` that stays its own.
|
|
183
|
+
*/
|
|
184
|
+
function FileUploadList({ className, children, ...props }) {
|
|
185
|
+
const { live: uploadLive } = useContext(FileUploadContext);
|
|
186
|
+
const live = useLive() || uploadLive;
|
|
187
|
+
const box = useRef(null);
|
|
188
|
+
const files = useMemo(() => Children.toArray(children).filter(isValidElement), [children]);
|
|
189
|
+
const { places, left } = usePresence(files, keyOf, box);
|
|
190
|
+
const empty = places.every((place) => place.leaving);
|
|
191
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
192
|
+
ref: box,
|
|
193
|
+
"data-slot": "file-upload-list",
|
|
194
|
+
"data-live": live ? "" : void 0,
|
|
195
|
+
"data-empty": empty ? "" : void 0,
|
|
196
|
+
"aria-live": "polite",
|
|
197
|
+
"aria-relevant": "additions",
|
|
198
|
+
className: cn("flex flex-col empty:hidden", "transition-[margin-top] spring-settle data-empty:-mt-3 in-data-live:starting:-mt-3", className),
|
|
199
|
+
...props,
|
|
200
|
+
children: places.map((place) => /* @__PURE__ */ jsx("li", {
|
|
201
|
+
"data-slot": "file-upload-place",
|
|
202
|
+
...placeProps(place, left),
|
|
203
|
+
className: placeOfFile,
|
|
204
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
205
|
+
className: "min-h-0 border-t border-hairline group-first/place:border-t-0",
|
|
206
|
+
children: place.item
|
|
207
|
+
})
|
|
208
|
+
}, place.key))
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
const statusWords = {
|
|
212
|
+
waiting: "Wartet",
|
|
213
|
+
uploading: "Wird hochgeladen",
|
|
214
|
+
done: "Hochgeladen",
|
|
215
|
+
error: "Fehlgeschlagen"
|
|
216
|
+
};
|
|
217
|
+
/** The key of the row beside this one, the next if there is one, that can take the focus. */
|
|
218
|
+
function keyBeside(key) {
|
|
219
|
+
const place = key.closest("[data-slot=\"file-upload-place\"]");
|
|
220
|
+
const find = (step) => {
|
|
221
|
+
for (let other = place?.[step]; other; other = other[step]) {
|
|
222
|
+
const found = other.matches("[data-leaving]") ? null : other.querySelector("[data-slot=\"file-upload-remove\"]");
|
|
223
|
+
if (found) return found;
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
};
|
|
227
|
+
return find("nextElementSibling") ?? find("previousElementSibling");
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* A line under a file's name (its bar, or why it failed) that opens and folds. Opening, its
|
|
231
|
+
* place opens first and the line fades in behind; folding, the line fades out on `leave` first
|
|
232
|
+
* and its place folds after, so it is never cut through while it can still be read.
|
|
233
|
+
*/
|
|
234
|
+
const lineOpen = "grid grid-rows-[1fr] [transition:grid-template-rows_var(--transition-duration-spring-settle)_var(--ease-spring-settle),opacity_var(--transition-duration-spring-settle)_var(--ease-spring-settle)_80ms]";
|
|
235
|
+
const lineShut = "grid grid-rows-[0fr] opacity-0 [transition:opacity_var(--transition-duration-spring-leave)_var(--ease-spring-leave),grid-template-rows_var(--transition-duration-spring-settle)_var(--ease-spring-settle)_100ms]";
|
|
236
|
+
/** The bar of a file that arrived: seen full for a moment (its fill glides there), then gone. */
|
|
237
|
+
const lineShutLater = "grid grid-rows-[0fr] opacity-0 [transition:opacity_var(--transition-duration-spring-leave)_var(--ease-spring-leave)_200ms,grid-template-rows_var(--transition-duration-spring-settle)_var(--ease-spring-settle)_300ms]";
|
|
238
|
+
/**
|
|
239
|
+
* One file: the system's mark in front (the open ring waits, the arc works, the disc is done),
|
|
240
|
+
* its name, its size in tabular digits, and under the name a thin bar while it is on its way.
|
|
241
|
+
* The bar folds away once the file has arrived, and the mark closes where the arc was. A file
|
|
242
|
+
* that failed says so in words, with the danger symbol and a key that tries again.
|
|
243
|
+
*/
|
|
244
|
+
function FileUploadItem({ name, size, status = "done", progress, error, onRetry, onRemove, retryLabel = "Noch einmal versuchen", removeLabel = "entfernen", statusLabels, locale = "de-DE", className, ...props }) {
|
|
245
|
+
const fraction = Math.min(1, Math.max(0, progress ?? 0));
|
|
246
|
+
const failed = status === "error";
|
|
247
|
+
const [said, setSaid] = useState({
|
|
248
|
+
error,
|
|
249
|
+
retry: onRetry !== void 0
|
|
250
|
+
});
|
|
251
|
+
if (failed && (said.error !== error || said.retry !== (onRetry !== void 0))) setSaid({
|
|
252
|
+
error,
|
|
253
|
+
retry: onRetry !== void 0
|
|
254
|
+
});
|
|
255
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
256
|
+
"data-slot": "file-upload-item",
|
|
257
|
+
"data-status": status,
|
|
258
|
+
className: cn("group/file flex gap-2.5 py-2.5 text-control", "transition-[opacity,translate] spring-settle in-data-live:starting:translate-y-(--motion-enter-offset) in-data-live:starting:opacity-0", "in-data-leaving:opacity-0 in-data-leaving:spring-leave", className),
|
|
259
|
+
...props,
|
|
260
|
+
children: [
|
|
261
|
+
/* @__PURE__ */ jsx("span", {
|
|
262
|
+
"aria-hidden": true,
|
|
263
|
+
"data-slot": "file-upload-mark",
|
|
264
|
+
className: "flex h-[1.3125rem] w-4 shrink-0 items-center justify-center",
|
|
265
|
+
children: status === "uploading" ? /* @__PURE__ */ jsx(Spinner, {
|
|
266
|
+
size: 14,
|
|
267
|
+
className: "text-fg"
|
|
268
|
+
}) : status === "error" ? /* @__PURE__ */ jsx(Icon, {
|
|
269
|
+
icon: Alert02Icon,
|
|
270
|
+
size: 14,
|
|
271
|
+
className: "text-danger"
|
|
272
|
+
}) : /* @__PURE__ */ jsx("span", { className: cn("mark", status === "done" && "mark-on in-data-live:mark-closes") })
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ jsxs("div", {
|
|
275
|
+
className: "flex min-w-0 flex-1 flex-col",
|
|
276
|
+
children: [
|
|
277
|
+
/* @__PURE__ */ jsxs("div", {
|
|
278
|
+
className: "flex items-baseline gap-3",
|
|
279
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
280
|
+
"data-slot": "file-upload-name",
|
|
281
|
+
className: "min-w-0 truncate text-fg",
|
|
282
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
283
|
+
className: "sr-only",
|
|
284
|
+
children: [statusLabels?.[status] ?? statusWords[status], ": "]
|
|
285
|
+
}), name]
|
|
286
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
287
|
+
"data-slot": "file-upload-size",
|
|
288
|
+
className: "ml-auto shrink-0 text-sm whitespace-nowrap text-fg-muted tabular-nums",
|
|
289
|
+
children: status === "uploading" && progress !== void 0 ? formatFileProgress(fraction * size, size, locale) : formatFileSize(size, locale)
|
|
290
|
+
})]
|
|
291
|
+
}),
|
|
292
|
+
/* @__PURE__ */ jsx("div", {
|
|
293
|
+
"data-slot": "file-upload-progress",
|
|
294
|
+
"aria-hidden": status === "uploading" ? void 0 : true,
|
|
295
|
+
className: status === "uploading" ? lineOpen : status === "done" ? lineShutLater : lineShut,
|
|
296
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
297
|
+
className: "min-h-0 overflow-hidden",
|
|
298
|
+
children: /* @__PURE__ */ jsx(Progress, {
|
|
299
|
+
"aria-label": name,
|
|
300
|
+
value: status === "uploading" ? progress === void 0 ? null : fraction * 100 : status === "done" ? 100 : fraction * 100,
|
|
301
|
+
className: "pt-1.5 pb-0.5",
|
|
302
|
+
children: /* @__PURE__ */ jsx(ProgressTrack, { className: "h-1" })
|
|
303
|
+
})
|
|
304
|
+
})
|
|
305
|
+
}),
|
|
306
|
+
/* @__PURE__ */ jsx("div", {
|
|
307
|
+
"data-slot": "file-upload-error-fold",
|
|
308
|
+
"aria-hidden": failed ? void 0 : true,
|
|
309
|
+
inert: !failed,
|
|
310
|
+
className: cn("-my-1", failed ? lineOpen : lineShut),
|
|
311
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
312
|
+
className: "min-h-0 overflow-y-clip py-1",
|
|
313
|
+
children: (said.error !== void 0 || said.retry) && /* @__PURE__ */ jsxs("div", {
|
|
314
|
+
"data-slot": "file-upload-error",
|
|
315
|
+
className: "flex flex-wrap items-center gap-x-2 text-sm font-semibold text-danger",
|
|
316
|
+
children: [said.error !== void 0 && /* @__PURE__ */ jsx("span", { children: said.error }), said.retry && /* @__PURE__ */ jsx("button", {
|
|
317
|
+
type: "button",
|
|
318
|
+
"data-slot": "file-upload-retry",
|
|
319
|
+
onClick: onRetry,
|
|
320
|
+
className: "touch-target relative rounded-xs font-medium text-fg underline decoration-1 underline-offset-[0.25em] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",
|
|
321
|
+
children: retryLabel
|
|
322
|
+
})]
|
|
323
|
+
})
|
|
324
|
+
})
|
|
325
|
+
})
|
|
326
|
+
]
|
|
327
|
+
}),
|
|
328
|
+
onRemove && /* @__PURE__ */ jsx(Button, {
|
|
329
|
+
iconOnly: true,
|
|
330
|
+
size: "sm",
|
|
331
|
+
variant: "quiet",
|
|
332
|
+
"aria-label": `${name} ${removeLabel}`,
|
|
333
|
+
"data-slot": "file-upload-remove",
|
|
334
|
+
onClick: (event) => {
|
|
335
|
+
if (event.currentTarget === document.activeElement) keyBeside(event.currentTarget)?.focus();
|
|
336
|
+
onRemove();
|
|
337
|
+
},
|
|
338
|
+
className: "-my-[2.5px] shrink-0 text-fg-muted hover:text-fg",
|
|
339
|
+
children: /* @__PURE__ */ jsx(CloseGlyph, {
|
|
340
|
+
width: 10,
|
|
341
|
+
height: 10
|
|
342
|
+
})
|
|
343
|
+
})
|
|
344
|
+
]
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
export { FileUpload, FileUploadItem, FileUploadList, FileUploadZone };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a `FileUpload` works out without a browser: which files it takes, and how a size reads.
|
|
3
|
+
* Plain functions, so they can be tested and used on a server.
|
|
4
|
+
*/
|
|
5
|
+
/** Why a file was not taken. */
|
|
6
|
+
export type FileRejection = {
|
|
7
|
+
file: File;
|
|
8
|
+
/** `type`: not one of the kinds asked for. `size`: over the limit. `count`: one too many. */
|
|
9
|
+
reason: "type" | "size" | "count";
|
|
10
|
+
};
|
|
11
|
+
export type FileRules = {
|
|
12
|
+
/** As on an `<input type="file">`: `.pdf`, `image/*`, `application/pdf`, comma-separated. */
|
|
13
|
+
accept?: string;
|
|
14
|
+
/** The largest size a file may have, in bytes. */
|
|
15
|
+
maxSize?: number;
|
|
16
|
+
/** Whether more than one file may be taken at once. */
|
|
17
|
+
multiple?: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** Whether a file is one of the kinds an `accept` string asks for. No `accept` takes every file. */
|
|
20
|
+
export declare function acceptsFile(file: Pick<File, "name" | "type">, accept?: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Sorts dropped, pasted or chosen files into those that are taken and those that are not, each
|
|
23
|
+
* with its reason. Without `multiple` the first file that fits is taken and the others are one
|
|
24
|
+
* too many.
|
|
25
|
+
*/
|
|
26
|
+
export declare function sortFiles(files: readonly File[], { accept, maxSize, multiple }: FileRules): {
|
|
27
|
+
accepted: File[];
|
|
28
|
+
rejected: FileRejection[];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A size the way a file manager writes it, in powers of 1000 and with the locale's decimal
|
|
32
|
+
* comma: "842 KB", "2,4 MB".
|
|
33
|
+
*/
|
|
34
|
+
export declare function formatFileSize(bytes: number, locale?: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* How much of a file has arrived, both numbers in the unit of the whole: "1,2 von 2,4 MB". The
|
|
37
|
+
* word between them is the caller's, for another language.
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatFileProgress(loaded: number, total: number, locale?: string, of?: string): string;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// src/components/file-upload/files.ts
|
|
2
|
+
/** Whether a file is one of the kinds an `accept` string asks for. No `accept` takes every file. */
|
|
3
|
+
function acceptsFile(file, accept) {
|
|
4
|
+
const kinds = (accept ?? "").split(",").map((kind) => kind.trim().toLowerCase()).filter(Boolean);
|
|
5
|
+
if (kinds.length === 0) return true;
|
|
6
|
+
const name = file.name.toLowerCase();
|
|
7
|
+
const type = file.type.toLowerCase();
|
|
8
|
+
return kinds.some((kind) => {
|
|
9
|
+
if (kind.startsWith(".")) return name.endsWith(kind);
|
|
10
|
+
if (kind.endsWith("/*")) return type.startsWith(kind.slice(0, -1));
|
|
11
|
+
return type === kind;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Sorts dropped, pasted or chosen files into those that are taken and those that are not, each
|
|
16
|
+
* with its reason. Without `multiple` the first file that fits is taken and the others are one
|
|
17
|
+
* too many.
|
|
18
|
+
*/
|
|
19
|
+
function sortFiles(files, { accept, maxSize, multiple = false }) {
|
|
20
|
+
const accepted = [];
|
|
21
|
+
const rejected = [];
|
|
22
|
+
for (const file of files) if (!acceptsFile(file, accept)) rejected.push({
|
|
23
|
+
file,
|
|
24
|
+
reason: "type"
|
|
25
|
+
});
|
|
26
|
+
else if (maxSize !== void 0 && file.size > maxSize) rejected.push({
|
|
27
|
+
file,
|
|
28
|
+
reason: "size"
|
|
29
|
+
});
|
|
30
|
+
else if (!multiple && accepted.length > 0) rejected.push({
|
|
31
|
+
file,
|
|
32
|
+
reason: "count"
|
|
33
|
+
});
|
|
34
|
+
else accepted.push(file);
|
|
35
|
+
return {
|
|
36
|
+
accepted,
|
|
37
|
+
rejected
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const UNITS = [
|
|
41
|
+
"B",
|
|
42
|
+
"KB",
|
|
43
|
+
"MB",
|
|
44
|
+
"GB",
|
|
45
|
+
"TB"
|
|
46
|
+
];
|
|
47
|
+
/** The unit a number of bytes reads best in, as a power of 1000: 2 400 000 is counted in MB. */
|
|
48
|
+
function unitOf(bytes) {
|
|
49
|
+
return Math.min(UNITS.length - 1, bytes < 1 ? 0 : Math.floor(Math.log10(bytes) / 3));
|
|
50
|
+
}
|
|
51
|
+
function inUnit(bytes, unit, locale) {
|
|
52
|
+
const digits = unit < 2 ? 0 : 1;
|
|
53
|
+
return new Intl.NumberFormat(locale, {
|
|
54
|
+
minimumFractionDigits: digits,
|
|
55
|
+
maximumFractionDigits: digits
|
|
56
|
+
}).format(bytes / 1e3 ** unit);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A size the way a file manager writes it, in powers of 1000 and with the locale's decimal
|
|
60
|
+
* comma: "842 KB", "2,4 MB".
|
|
61
|
+
*/
|
|
62
|
+
function formatFileSize(bytes, locale = "de-DE") {
|
|
63
|
+
const unit = unitOf(bytes);
|
|
64
|
+
return `${inUnit(bytes, unit, locale)} ${UNITS[unit]}`;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* How much of a file has arrived, both numbers in the unit of the whole: "1,2 von 2,4 MB". The
|
|
68
|
+
* word between them is the caller's, for another language.
|
|
69
|
+
*/
|
|
70
|
+
function formatFileProgress(loaded, total, locale = "de-DE", of = "von") {
|
|
71
|
+
const unit = unitOf(total);
|
|
72
|
+
return `${inUnit(Math.min(loaded, total), unit, locale)} ${of} ${inUnit(total, unit, locale)} ${UNITS[unit]}`;
|
|
73
|
+
}
|
|
74
|
+
export { acceptsFile, formatFileProgress, formatFileSize, sortFiles };
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
export type GrowProps = ComponentProps<"div"
|
|
2
|
+
export type GrowProps = ComponentProps<"div"> & {
|
|
3
|
+
/**
|
|
4
|
+
* Classes for the box inside, which holds the content and is the one that is measured. The
|
|
5
|
+
* layout of what the block holds (a flex row, a padding) goes here: on the block itself a
|
|
6
|
+
* padding or a minimum height would be added to the measured height and the block would
|
|
7
|
+
* never come to rest at it.
|
|
8
|
+
*/
|
|
9
|
+
contentClassName?: string;
|
|
10
|
+
};
|
|
3
11
|
/**
|
|
4
12
|
* A block whose height follows what it holds. When something joins it (a step of a `Trace`, a
|
|
5
13
|
* paragraph that arrives, the next tab's panel), it eases to its new height on `settle`, and
|
|
@@ -11,10 +19,14 @@ export type GrowProps = ComponentProps<"div">;
|
|
|
11
19
|
* then learns of it a frame late.
|
|
12
20
|
*
|
|
13
21
|
* At rest it is a plain block of the content's height that clips nothing. It clips only while
|
|
14
|
-
* it moves, so a line that joins at its foot is uncovered as the
|
|
22
|
+
* it moves, and only above and below, so a line that joins at its foot is uncovered as the
|
|
23
|
+
* block opens. What paints outside its content there (the shadow of a card, an accent edge, a
|
|
24
|
+
* halo) would be cut for the length of the move and come back at its end: give it room inside
|
|
25
|
+
* the block and take the room back outside, `className="-my-5" contentClassName="py-5"`. To
|
|
26
|
+
* the sides nothing is cut. From rest it does
|
|
15
27
|
* not animate the first height, a resize of the window, or a height that something inside is
|
|
16
28
|
* already animating (an opening `Collapsible`): then it simply follows.
|
|
17
29
|
* Already on its way, it takes a new height as its goal from where it stands. Under reduced
|
|
18
30
|
* motion it always follows.
|
|
19
31
|
*/
|
|
20
|
-
export declare function Grow({ className, children, ref, ...props }: GrowProps): import("react").JSX.Element;
|
|
32
|
+
export declare function Grow({ className, contentClassName, children, ref, ...props }: GrowProps): import("react").JSX.Element;
|