@seekbuddy/dsh-ui 0.0.0-stage → 0.2.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.
- package/CHANGELOG.md +49 -0
- package/LICENSE +22 -0
- package/README.md +175 -2
- package/README.zh.md +176 -0
- package/THIRD_PARTY_NOTICES.md +42 -0
- package/UPSTREAM.md +56 -0
- package/dist/blocks.js +1582 -0
- package/dist/chunks/chunk-23KOEBWJ.js +104 -0
- package/dist/chunks/chunk-3HCOU44R.js +697 -0
- package/dist/chunks/chunk-5JXG4BHW.js +31 -0
- package/dist/chunks/chunk-5XDVPALS.js +61 -0
- package/dist/chunks/chunk-AY44MQMD.js +3052 -0
- package/dist/chunks/chunk-B3EEK7A2.js +408 -0
- package/dist/chunks/chunk-CEBTQO6W.js +24 -0
- package/dist/chunks/chunk-CI73NXA5.js +202 -0
- package/dist/chunks/chunk-CTQPGUZP.js +22 -0
- package/dist/chunks/chunk-F352IICS.js +57 -0
- package/dist/chunks/chunk-IOBKTEKP.js +144 -0
- package/dist/chunks/chunk-KETGFAOH.js +66 -0
- package/dist/chunks/chunk-LA3QDZYN.js +2777 -0
- package/dist/chunks/chunk-NE62SYOZ.js +89 -0
- package/dist/chunks/chunk-OQPH36OI.js +754 -0
- package/dist/chunks/chunk-QJKAQ6PO.js +155 -0
- package/dist/chunks/chunk-R6AUJQ3G.js +129 -0
- package/dist/chunks/chunk-RNVSCTW7.js +24 -0
- package/dist/chunks/chunk-RZOP2PFC.js +152 -0
- package/dist/chunks/chunk-TQU54HSM.js +112 -0
- package/dist/chunks/chunk-TUK6UGXM.js +36 -0
- package/dist/chunks/chunk-TZ7HRE6D.js +328 -0
- package/dist/chunks/chunk-VIH56PDF.js +57 -0
- package/dist/chunks/chunk-WUL523OW.js +27 -0
- package/dist/chunks/chunk-XX6MSZLS.js +261 -0
- package/dist/chunks/chunk-ZA47FP7C.js +7 -0
- package/dist/chunks/chunk-ZZNL5PWF.js +170 -0
- package/dist/icons.js +803 -0
- package/dist/index.js +1182 -0
- package/dist/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/katex.css +1 -0
- package/dist/katex.css.d.ts +2 -0
- package/dist/markdown.js +148 -0
- package/dist/meta.json +6876 -0
- package/dist/root-inputs.json +67 -0
- package/dist/seekbuddy-card.js +7 -0
- package/dist/seekbuddy-empty.js +8 -0
- package/dist/seekbuddy-internal/DangerButton.js +7 -0
- package/dist/seekbuddy-internal/Mark.js +7 -0
- package/dist/seekbuddy-internal/Message.js +10 -0
- package/dist/seekbuddy-internal/Pagination.js +9 -0
- package/dist/seekbuddy-internal/StatusBadge.js +7 -0
- package/dist/seekbuddy-internal/SubtleButton.js +7 -0
- package/dist/seekbuddy-internal/Switch.js +7 -0
- package/dist/seekbuddy-internal/Upload.js +7 -0
- package/dist/seekbuddy-internal/date/Calendar.js +8 -0
- package/dist/seekbuddy-internal/date/DatePicker.js +9 -0
- package/dist/seekbuddy-internal/date/DateRangePicker.js +9 -0
- package/dist/seekbuddy-internal/date/TimePicker.js +8 -0
- package/dist/seekbuddy-internal/date/fields.js +16 -0
- package/dist/seekbuddy-internal/qr/QrCode.js +7 -0
- package/dist/seekbuddy-spinner.js +7 -0
- package/dist/seekbuddy-tabs.js +7 -0
- package/dist/seekbuddy-timeline.js +8 -0
- package/dist/seekbuddy.js +89 -0
- package/dist/theme-bootstrap.js +13 -0
- package/dist/theme.js +37 -0
- package/dist/tokens.css +934 -0
- package/dist/tokens.css.d.ts +2 -0
- package/dist/types/Button.d.ts +18 -0
- package/dist/types/Checkbox.d.ts +19 -0
- package/dist/types/CodeFileIcon.d.ts +11 -0
- package/dist/types/CodeToolbar.d.ts +29 -0
- package/dist/types/ConfigField.d.ts +32 -0
- package/dist/types/ConnectionIndicator.d.ts +25 -0
- package/dist/types/DiffBlock.d.ts +51 -0
- package/dist/types/DisclosureRow.d.ts +35 -0
- package/dist/types/FileTypeIcon.d.ts +42 -0
- package/dist/types/FoldToggle.d.ts +19 -0
- package/dist/types/HoverCard.d.ts +36 -0
- package/dist/types/ImageLightbox.d.ts +26 -0
- package/dist/types/ImagePreview.d.ts +11 -0
- package/dist/types/Input.d.ts +11 -0
- package/dist/types/JsonTree.d.ts +58 -0
- package/dist/types/LinkIcon.d.ts +33 -0
- package/dist/types/Menu.d.ts +142 -0
- package/dist/types/MenuGroup.d.ts +21 -0
- package/dist/types/MenuSurface.d.ts +15 -0
- package/dist/types/Modal.d.ts +43 -0
- package/dist/types/PermissionIcon.d.ts +38 -0
- package/dist/types/Pill.d.ts +12 -0
- package/dist/types/ReadBlock.d.ts +47 -0
- package/dist/types/ReferenceIcon.d.ts +20 -0
- package/dist/types/RiskConfirmation.d.ts +19 -0
- package/dist/types/SearchBlock.d.ts +71 -0
- package/dist/types/SegmentedControl.d.ts +34 -0
- package/dist/types/SegmentedTabs.d.ts +25 -0
- package/dist/types/ShortcutKeys.d.ts +10 -0
- package/dist/types/SiteGlyph.d.ts +24 -0
- package/dist/types/StateDot.d.ts +19 -0
- package/dist/types/Switch.d.ts +19 -0
- package/dist/types/Tag.d.ts +31 -0
- package/dist/types/TerminalBlock.d.ts +77 -0
- package/dist/types/TextShimmer.d.ts +22 -0
- package/dist/types/Toast.d.ts +48 -0
- package/dist/types/Tooltip.d.ts +63 -0
- package/dist/types/WebBlock.d.ts +60 -0
- package/dist/types/ansi.d.ts +16 -0
- package/dist/types/blocks.d.ts +19 -0
- package/dist/types/clipboard.d.ts +8 -0
- package/dist/types/code-file-icon-artwork.d.ts +53 -0
- package/dist/types/code-file-types.d.ts +29 -0
- package/dist/types/code-highlighting.d.ts +11 -0
- package/dist/types/css-modules.d.ts +6 -0
- package/dist/types/darwin-desktop.d.ts +8 -0
- package/dist/types/file-size.d.ts +7 -0
- package/dist/types/focus.d.ts +8 -0
- package/dist/types/guide-artwork.d.ts +14 -0
- package/dist/types/head-tail-cap.d.ts +22 -0
- package/dist/types/icons/index.d.ts +384 -0
- package/dist/types/icons/props.d.ts +8 -0
- package/dist/types/icons/shared-artwork.d.ts +42 -0
- package/dist/types/icons.d.ts +6 -0
- package/dist/types/index.d.ts +53 -0
- package/dist/types/input-modality.d.ts +18 -0
- package/dist/types/keyboard-composition.d.ts +10 -0
- package/dist/types/markdown/CodeBlock.d.ts +34 -0
- package/dist/types/markdown/JsonBlock.d.ts +7 -0
- package/dist/types/markdown/MarkdownDelegate.d.ts +45 -0
- package/dist/types/markdown/MarkdownText.d.ts +47 -0
- package/dist/types/markdown/cjkFriendlyStrong.d.ts +8 -0
- package/dist/types/markdown/file-link.d.ts +12 -0
- package/dist/types/markdown/highlight.d.ts +147 -0
- package/dist/types/markdown/incremental.d.ts +79 -0
- package/dist/types/markdown/katex.d.ts +18 -0
- package/dist/types/markdown/local-image-syntax.d.ts +9 -0
- package/dist/types/markdown/mathCompatibility.d.ts +10 -0
- package/dist/types/markdown/parse.d.ts +24 -0
- package/dist/types/markdown/plain-text.d.ts +21 -0
- package/dist/types/markdown/render.d.ts +140 -0
- package/dist/types/markdown/useViewportHighlighting.d.ts +10 -0
- package/dist/types/markdown.d.ts +9 -0
- package/dist/types/overlay-top-margin.d.ts +7 -0
- package/dist/types/plugin-artwork.d.ts +16 -0
- package/dist/types/pointer-grace.d.ts +21 -0
- package/dist/types/rank-by-name.d.ts +21 -0
- package/dist/types/relative-time.d.ts +22 -0
- package/dist/types/seekbuddy/Card.d.ts +28 -0
- package/dist/types/seekbuddy/DangerButton.d.ts +31 -0
- package/dist/types/seekbuddy/Empty.d.ts +34 -0
- package/dist/types/seekbuddy/Mark.d.ts +27 -0
- package/dist/types/seekbuddy/Message.d.ts +52 -0
- package/dist/types/seekbuddy/Pagination.d.ts +66 -0
- package/dist/types/seekbuddy/Spinner.d.ts +20 -0
- package/dist/types/seekbuddy/StatusBadge.d.ts +33 -0
- package/dist/types/seekbuddy/SubtleButton.d.ts +30 -0
- package/dist/types/seekbuddy/Switch.d.ts +36 -0
- package/dist/types/seekbuddy/Tabs.d.ts +49 -0
- package/dist/types/seekbuddy/Timeline.d.ts +42 -0
- package/dist/types/seekbuddy/Upload.d.ts +101 -0
- package/dist/types/seekbuddy/date/Calendar.d.ts +94 -0
- package/dist/types/seekbuddy/date/DatePicker.d.ts +29 -0
- package/dist/types/seekbuddy/date/DateRangePicker.d.ts +41 -0
- package/dist/types/seekbuddy/date/TimePicker.d.ts +35 -0
- package/dist/types/seekbuddy/date/date.d.ts +79 -0
- package/dist/types/seekbuddy/date/fields.d.ts +45 -0
- package/dist/types/seekbuddy/index.d.ts +49 -0
- package/dist/types/seekbuddy/qr/QrCode.d.ts +37 -0
- package/dist/types/seekbuddy/qr/qr.d.ts +38 -0
- package/dist/types/theme-bootstrap.d.ts +3 -0
- package/dist/types/theme-core.d.ts +14 -0
- package/dist/types/theme.d.ts +4 -0
- package/dist/types/use-copy-feedback.d.ts +13 -0
- package/dist/types/useAnchoredMaxHeight.d.ts +13 -0
- package/dist/types/useAnchoredPosition.d.ts +35 -0
- package/dist/types/useDismissOnOutsidePointer.d.ts +10 -0
- package/dist/types/useModalLayer.d.ts +26 -0
- package/dist/types/user-text.d.ts +36 -0
- package/package.json +151 -4
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
/** Inner padding: `none` = 0 (self-laid-out content such as a cover image), `sm` = 14px (dense catalog cards), `md` = 16px (default). */
|
|
3
|
+
export type CardPadding = 'none' | 'sm' | 'md';
|
|
4
|
+
/** Rendered element; pick `li` inside a list so the card needs no wrapper. */
|
|
5
|
+
export type CardElement = 'div' | 'section' | 'article' | 'li';
|
|
6
|
+
export interface CardProps extends HTMLAttributes<HTMLElement> {
|
|
7
|
+
/** Inner padding; see `CardPadding`. Default `md` (16px). */
|
|
8
|
+
padding?: CardPadding | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Hover feedback for cards the caller makes clickable: the translucent `--dsw-alias-interactive-bg-hover`
|
|
11
|
+
* fill upstream's plugin cards use, plus the pointer cursor.
|
|
12
|
+
* Styling only — clicking is wired by the caller (`onClick` here, or a `<button>` inside).
|
|
13
|
+
*/
|
|
14
|
+
interactive?: boolean | undefined;
|
|
15
|
+
/** Element to render; see `CardElement`. Default `div`. */
|
|
16
|
+
as?: CardElement | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Card surface only — background, hairline stroke, radius, elevation, padding — with the content
|
|
20
|
+
* left entirely to `children`. Upstream primitives ship no card / panel, so hand-rolled cards
|
|
21
|
+
* tend to drift apart. No header / footer / title slots by design:
|
|
22
|
+
* business cards do not share an inner structure, so the library does not pretend they do.
|
|
23
|
+
*
|
|
24
|
+
* Server-safe (no hooks, no DOM access): a Next.js Server Component may import it from
|
|
25
|
+
* `@seekbuddy/dsh-ui/seekbuddy/card`. Sets no `role` / `tabIndex` — a fully clickable card is the
|
|
26
|
+
* caller's accessibility decision (put a `<button>` inside, or wire `role="button"` + keyboard).
|
|
27
|
+
*/
|
|
28
|
+
export declare function Card({ padding, interactive, as: Element, className, ...rest }: CardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { Button } from '@seekbuddy/dsh-ui';
|
|
3
|
+
/** Upstream `Button` props minus `variant`: the shape is fixed to the outline capsule. */
|
|
4
|
+
export type DangerButtonProps = Omit<ComponentPropsWithoutRef<typeof Button>, 'variant' | 'className'> & {
|
|
5
|
+
/** Extra class on the `<button>`, for layout. */
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Outline capsule in the error tone — red label and stroke — for destructive actions (delete,
|
|
10
|
+
* disable) and error-state affordances (e.g. a "review failed" chip that opens the reason).
|
|
11
|
+
*
|
|
12
|
+
* Upstream `ButtonVariant` has no danger family, and restyling the upstream `Button` through a
|
|
13
|
+
* consumer `className` tends to cover only the hover state. This owns the whole state set
|
|
14
|
+
* once — hover, active, focus-visible — while geometry, sizes and the disabled 40 % opacity stay
|
|
15
|
+
* with the upstream `Button` it wraps.
|
|
16
|
+
*
|
|
17
|
+
* Tokens: `--dsw-alias-state-error-primary` (label and stroke; the same token upstream `Menu`
|
|
18
|
+
* uses for its danger item), `--dsw-alias-interactive-bg-hover-danger` (hover fill), an 18 %
|
|
19
|
+
* `color-mix` of the error tone (active fill; no dedicated alias token), and the shared focus ring (width and colour from the theme's `focus.css`).
|
|
20
|
+
* All are theme-aware, so dark mode needs no extra rules.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DangerButton: import("react").ForwardRefExoticComponent<Omit<Omit<{
|
|
23
|
+
variant?: import("@seekbuddy/dsh-ui").ButtonVariant;
|
|
24
|
+
size?: 'md' | 'sm';
|
|
25
|
+
icon?: import("react").ReactNode;
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
children?: import("react").ReactNode;
|
|
28
|
+
} & import("react").ButtonHTMLAttributes<HTMLButtonElement> & import("react").RefAttributes<HTMLButtonElement>, "ref">, "className" | "variant"> & {
|
|
29
|
+
/** Extra class on the `<button>`, for layout. */
|
|
30
|
+
className?: string | undefined;
|
|
31
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/** The three content states a data-driven view has to handle. */
|
|
3
|
+
export type EmptyStatus = 'loading' | 'empty' | 'error';
|
|
4
|
+
export interface EmptyProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
5
|
+
/** Which state to show. Precedence between loading / error / empty is the caller's decision. */
|
|
6
|
+
status: EmptyStatus;
|
|
7
|
+
/** Main line; localized by the caller. */
|
|
8
|
+
title: string;
|
|
9
|
+
/** Secondary line under the title. */
|
|
10
|
+
description?: ReactNode | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Leading visual. `undefined` picks the default for the status (spinner / search / warning);
|
|
13
|
+
* `null` renders no icon at all.
|
|
14
|
+
*/
|
|
15
|
+
icon?: ReactNode | null | undefined;
|
|
16
|
+
/** Action row (e.g. a "create" button for the empty state). Rendered before the retry button. */
|
|
17
|
+
action?: ReactNode | undefined;
|
|
18
|
+
/** Label of the retry button; rendered only for `status="error"` together with `onRetry`. */
|
|
19
|
+
retryLabel?: string | undefined;
|
|
20
|
+
/** Retry handler; rendered only for `status="error"` together with `retryLabel`. */
|
|
21
|
+
onRetry?: (() => void) | undefined;
|
|
22
|
+
/** Reserved height so a list that refreshes into a state does not jump. Default 240. */
|
|
23
|
+
minHeight?: number | string | undefined;
|
|
24
|
+
/** Dashed frame; turn off for full-screen or already-framed placements. Default `true`. */
|
|
25
|
+
bordered?: boolean | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Placeholder block for the loading / empty / error states of a page or a list region: icon,
|
|
29
|
+
* title, description and an action row. Text and buttons come from the caller; the component only
|
|
30
|
+
* fixes structure, tokens and the live-region semantics per state (`status` + polite for loading,
|
|
31
|
+
* `alert` for error, nothing for empty). server-safe (no hooks); the retry button needs a handler
|
|
32
|
+
* so it is only usable from Client Components.
|
|
33
|
+
*/
|
|
34
|
+
export declare function Empty({ status, title, description, icon, action, retryLabel, onRetry, minHeight, bordered, className, style, ...rest }: EmptyProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Closed set of marks the extension layer knows how to draw. Each kind is one fixed meaning with
|
|
3
|
+
* its own glyph and colour token; adding a kind means adding an entry to `GLYPHS`, a colour class
|
|
4
|
+
* in `Mark.module.css` and a story — callers only ever pick a kind.
|
|
5
|
+
*/
|
|
6
|
+
export type MarkKind = 'official';
|
|
7
|
+
/** Pixel edge of the glyph. 14 / 16 next to card titles, 20 / 24 next to detail-page headings. */
|
|
8
|
+
export type MarkSize = 14 | 16 | 18 | 20 | 24;
|
|
9
|
+
export interface MarkProps {
|
|
10
|
+
/** Which mark to draw; each kind has a fixed glyph and colour. */
|
|
11
|
+
kind: MarkKind;
|
|
12
|
+
/** Screen-reader name and tooltip text, e.g. "Official"; localized by the caller. */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Default 16. */
|
|
15
|
+
size?: MarkSize | undefined;
|
|
16
|
+
/** Wrap in a hover / focus tooltip showing `label`. Default `true`; pass `false` when the meaning is already spelled out next to the mark. */
|
|
17
|
+
tooltip?: boolean | undefined;
|
|
18
|
+
/** Extra class on the root element, for layout. */
|
|
19
|
+
className?: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Inline status mark: a fixed glyph with one meaning per `kind`, sized to sit on the text
|
|
23
|
+
* baseline without growing the line. Not a generic badge — no free icon or colour props.
|
|
24
|
+
* `<span role="img" aria-label tabIndex={0}>` so keyboard users can reach the tooltip; the SVG is
|
|
25
|
+
* decorative. Uses the upstream `Tooltip`, so it lives in the Client Component aggregate entry only.
|
|
26
|
+
*/
|
|
27
|
+
export declare function Mark({ kind, label, size, tooltip, className }: MarkProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type MessageType = 'success' | 'info' | 'warning' | 'error' | 'loading';
|
|
3
|
+
export interface MessageOptions {
|
|
4
|
+
/** Default `info`. */
|
|
5
|
+
type?: MessageType | undefined;
|
|
6
|
+
/** Message text or nodes. */
|
|
7
|
+
content: ReactNode;
|
|
8
|
+
/** Seconds. Default 3; `0` stays until closed. `loading` defaults to 0. */
|
|
9
|
+
duration?: number | undefined;
|
|
10
|
+
/** Re-opening with the same key updates that message in place (e.g. loading → success). */
|
|
11
|
+
key?: string | undefined;
|
|
12
|
+
/** Replaces the type's default glyph. */
|
|
13
|
+
icon?: ReactNode | undefined;
|
|
14
|
+
/** Called after the message has faded out, however it closed: timeout, `close()`, `destroy`, or eviction by `maxCount`. */
|
|
15
|
+
onClose?: (() => void) | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** Closes the message it was returned for. */
|
|
18
|
+
export type MessageClose = () => void;
|
|
19
|
+
export interface MessageApi {
|
|
20
|
+
/** Shows a message with full options; returns a function that closes it. */
|
|
21
|
+
open(options: MessageOptions): MessageClose;
|
|
22
|
+
/** Shows a success message; `duration` in seconds (default 3, `0` keeps it open). */
|
|
23
|
+
success(content: ReactNode, duration?: number): MessageClose;
|
|
24
|
+
/** Shows an info message; `duration` in seconds (default 3, `0` keeps it open). */
|
|
25
|
+
info(content: ReactNode, duration?: number): MessageClose;
|
|
26
|
+
/** Shows a warning message; `duration` in seconds (default 3, `0` keeps it open). */
|
|
27
|
+
warning(content: ReactNode, duration?: number): MessageClose;
|
|
28
|
+
/** Shows an error message; `duration` in seconds (default 3, `0` keeps it open). */
|
|
29
|
+
error(content: ReactNode, duration?: number): MessageClose;
|
|
30
|
+
/** Shows a loading message; it stays until closed unless `duration` is given. */
|
|
31
|
+
loading(content: ReactNode, duration?: number): MessageClose;
|
|
32
|
+
/** Without a key closes every message. */
|
|
33
|
+
destroy(key?: string): void;
|
|
34
|
+
}
|
|
35
|
+
export interface MessageProviderProps {
|
|
36
|
+
/** Distance from the viewport top in px. Default 120, where the upstream Toast sits. */
|
|
37
|
+
top?: number | undefined;
|
|
38
|
+
/** Messages shown at once; the oldest closes when exceeded. Default 3. */
|
|
39
|
+
maxCount?: number | undefined;
|
|
40
|
+
/** The subtree that may call `useMessage()`. */
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Stacked transient messages: antd's `useMessage` shape on top of the upstream Toast look.
|
|
45
|
+
* The provider owns the stack and renders it through a body portal only while something is
|
|
46
|
+
* showing, so server rendering never touches `document`. A provider per page root, not a global
|
|
47
|
+
* singleton — separately built bundles on one page each include their own copy of this module, so a
|
|
48
|
+
* module-level store would split across them.
|
|
49
|
+
*/
|
|
50
|
+
export declare function MessageProvider({ top, maxCount, children }: MessageProviderProps): import("react").JSX.Element;
|
|
51
|
+
/** The message API of the nearest `MessageProvider`; stable across renders. Throws outside one. */
|
|
52
|
+
export declare function useMessage(): MessageApi;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** All user-visible text, localized by the caller. */
|
|
3
|
+
export interface PaginationLabels {
|
|
4
|
+
/** `aria-label` of the `<nav>`, e.g. "Pagination". */
|
|
5
|
+
navigation: string;
|
|
6
|
+
/** `aria-label` of the previous-page button. */
|
|
7
|
+
previous: string;
|
|
8
|
+
/** `aria-label` of the next-page button. */
|
|
9
|
+
next: string;
|
|
10
|
+
/** `aria-label` of a page button, e.g. `(page) => \`Page ${page}\``. */
|
|
11
|
+
page: (page: number) => string;
|
|
12
|
+
/** `aria-label` of the ellipsis that jumps back, e.g. "Previous 5 pages". */
|
|
13
|
+
jumpPrevious: string;
|
|
14
|
+
/** `aria-label` of the ellipsis that jumps forward. */
|
|
15
|
+
jumpNext: string;
|
|
16
|
+
}
|
|
17
|
+
export interface PaginationProps {
|
|
18
|
+
/** Controlled current page (1-based). Omit for uncontrolled with `defaultCurrent`. */
|
|
19
|
+
current?: number | undefined;
|
|
20
|
+
/** Initial page when uncontrolled. Default 1. */
|
|
21
|
+
defaultCurrent?: number | undefined;
|
|
22
|
+
/** Items per page; with `total` this yields the page count. */
|
|
23
|
+
pageSize?: number | undefined;
|
|
24
|
+
/** Initial page size when `pageSize` is omitted. Default 10. */
|
|
25
|
+
defaultPageSize?: number | undefined;
|
|
26
|
+
/** Total item count. */
|
|
27
|
+
total: number;
|
|
28
|
+
/** Fired with the target page; `pageSize` rides along so a future size changer keeps the signature. */
|
|
29
|
+
onChange?: ((page: number, pageSize: number) => void) | undefined;
|
|
30
|
+
/** Summary rendered at the start, e.g. `(total, [from, to]) => \`${from}–${to} of ${total}\``. */
|
|
31
|
+
showTotal?: ((total: number, range: [number, number]) => ReactNode) | undefined;
|
|
32
|
+
/** Render nothing when everything fits on one page. Default `true` (antd defaults to `false`). */
|
|
33
|
+
hideOnSinglePage?: boolean | undefined;
|
|
34
|
+
/** Previous / `current / pages` / next only. */
|
|
35
|
+
simple?: boolean | undefined;
|
|
36
|
+
/** Middle window of 3 page buttons instead of 5, for narrow rows. */
|
|
37
|
+
showLessItems?: boolean | undefined;
|
|
38
|
+
/** Disables every button in the strip. */
|
|
39
|
+
disabled?: boolean | undefined;
|
|
40
|
+
/** All visible and screen-reader text; see `PaginationLabels`. */
|
|
41
|
+
labels: PaginationLabels;
|
|
42
|
+
/** Extra class on the root `<nav>`, for layout. */
|
|
43
|
+
className?: string | undefined;
|
|
44
|
+
}
|
|
45
|
+
/** One slot of the page strip: a page button or an ellipsis that jumps by the window size. */
|
|
46
|
+
export type PaginationItem = {
|
|
47
|
+
type: 'page';
|
|
48
|
+
page: number;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'jump-previous' | 'jump-next';
|
|
51
|
+
page: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* antd's page strip: with few pages list them all; otherwise keep page 1 and the last page, a
|
|
55
|
+
* window of 5 (or 3) around `current`, and an ellipsis on each side that has a gap. Jumps move by
|
|
56
|
+
* the window size, clamped. Pure, exported for tests.
|
|
57
|
+
*/
|
|
58
|
+
export declare function pageItems(current: number, pages: number, lessItems?: boolean): PaginationItem[];
|
|
59
|
+
/**
|
|
60
|
+
* Page navigation for catalog lists. Mirrors a subset of antd's Pagination:
|
|
61
|
+
* controlled or uncontrolled `current`, `total` + `pageSize` → page count, first / last page
|
|
62
|
+
* always visible with ellipsis jumps, `showTotal`, `simple`, `hideOnSinglePage`. Text comes from
|
|
63
|
+
* `labels`; the component has no strings of its own. Client Component (state for the
|
|
64
|
+
* uncontrolled mode), aggregate entry only.
|
|
65
|
+
*/
|
|
66
|
+
export declare function Pagination({ current, defaultCurrent, pageSize, defaultPageSize, total, onChange, showTotal, hideOnSinglePage, simple, showLessItems, disabled, labels, className, }: PaginationProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** `sm` = 0.85rem / 2px ring for buttons and inline text; `md` = 2rem / 3px for page-level waits. */
|
|
2
|
+
export type SpinnerSize = 'sm' | 'md';
|
|
3
|
+
/** `inherit` rides `currentColor` (button foreground); `page` pins `--dsw-alias-label-primary`. */
|
|
4
|
+
export type SpinnerTone = 'inherit' | 'page';
|
|
5
|
+
export interface SpinnerProps {
|
|
6
|
+
/** Ring size; see `SpinnerSize`. Default `sm`. */
|
|
7
|
+
size?: SpinnerSize | undefined;
|
|
8
|
+
/** Ring colour source; see `SpinnerTone`. Default `inherit`. */
|
|
9
|
+
tone?: SpinnerTone | undefined;
|
|
10
|
+
/** Screen-reader text; when present the spinner becomes a live status region instead of aria-hidden. */
|
|
11
|
+
label?: string | undefined;
|
|
12
|
+
/** Extra class on the root element, for layout. */
|
|
13
|
+
className?: string | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The shared loading ring: track = currentColor at
|
|
17
|
+
* 35%, arc = currentColor, reduced motion keeps a static two-tone ring. Without `label`
|
|
18
|
+
* it is decorative (`aria-hidden`) and the surrounding text must say what is loading.
|
|
19
|
+
*/
|
|
20
|
+
export declare function Spinner({ size, tone, label, className }: SpinnerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Closed set of tones. Each one is a fixed meaning with its own state dot and theme token; adding a
|
|
4
|
+
* tone means adding an entry here and in `DOTS`, a colour class in `StatusBadge.module.css` and a
|
|
5
|
+
* story — callers only pick a tone, never a colour.
|
|
6
|
+
*/
|
|
7
|
+
export type StatusTone = 'neutral' | 'success' | 'progress' | 'warning' | 'error';
|
|
8
|
+
export interface StatusBadgeProps {
|
|
9
|
+
/** Meaning of the badge, which fixes its dot and colour; see `StatusTone`. */
|
|
10
|
+
tone: StatusTone;
|
|
11
|
+
/** Label text; localized by the caller. */
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/** Drop the leading dot when the row already carries one. Default `true`. */
|
|
14
|
+
dot?: boolean | undefined;
|
|
15
|
+
/** Extra class on the root element, for layout. */
|
|
16
|
+
className?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Read-only status chip: a state dot plus a label, in one of five tones — "running", "mounting",
|
|
20
|
+
* "not connected", "mount failed", "delisted" and friends.
|
|
21
|
+
*
|
|
22
|
+
* The dot is the upstream `StateDot` (the same glyph the terminal block uses for run state), so
|
|
23
|
+
* `progress` gets upstream's animated chase rather than a second spinner vocabulary. Colour comes
|
|
24
|
+
* from the tone: upstream `Pill` has no tone variants, and recolouring an upstream component through
|
|
25
|
+
* a consumer `className` couples the caller to its internal styles. This owns the tones once so no
|
|
26
|
+
* call site needs that override. Geometry — capsule,
|
|
27
|
+
* height, font — stays with the `Pill` it wraps.
|
|
28
|
+
*
|
|
29
|
+
* Static by design: no `onClick`, so `Pill` renders a `<span>` and there are no interactive states
|
|
30
|
+
* to keep in sync. The dot is `aria-hidden`; the label carries the meaning. Tokens are theme-aware
|
|
31
|
+
* (`--dsw-alias-state-*` / `--dsw-alias-label-tertiary`), so dark mode needs no extra rules.
|
|
32
|
+
*/
|
|
33
|
+
export declare function StatusBadge({ tone, children, dot, className }: StatusBadgeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { Button } from '@seekbuddy/dsh-ui';
|
|
3
|
+
/** Upstream `Button` props minus `variant`: the shape is fixed to the ghost capsule. */
|
|
4
|
+
export type SubtleButtonProps = Omit<ComponentPropsWithoutRef<typeof Button>, 'variant' | 'className'> & {
|
|
5
|
+
/** Extra class on the `<button>`, for layout. */
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Ghost capsule with a secondary label — for low-emphasis navigation that sits next to real actions
|
|
10
|
+
* (a card's "view details" link, a back button), where the default ghost label would compete with them.
|
|
11
|
+
*
|
|
12
|
+
* Upstream `ButtonVariant` has no quiet family, and setting `color` on a ghost `Button` through a consumer
|
|
13
|
+
* `className` covers its resting state only. This owns the whole state set once — the label steps up to the
|
|
14
|
+
* primary label on hover and press, plus a focus-visible ring — while geometry, sizes, the hover / press
|
|
15
|
+
* fills and the disabled 40 % opacity stay with the upstream ghost `Button` it wraps.
|
|
16
|
+
*
|
|
17
|
+
* Tokens: `--dsw-alias-label-secondary` (resting label), `--dsw-alias-label-primary` (hover / press label)
|
|
18
|
+
* and the shared focus ring (width and colour from the theme's `focus.css`).
|
|
19
|
+
* All are theme-aware, so dark mode needs no extra rules.
|
|
20
|
+
*/
|
|
21
|
+
export declare const SubtleButton: import("react").ForwardRefExoticComponent<Omit<Omit<{
|
|
22
|
+
variant?: import("@seekbuddy/dsh-ui").ButtonVariant;
|
|
23
|
+
size?: 'md' | 'sm';
|
|
24
|
+
icon?: import("react").ReactNode;
|
|
25
|
+
className?: string | undefined;
|
|
26
|
+
children?: import("react").ReactNode;
|
|
27
|
+
} & import("react").ButtonHTMLAttributes<HTMLButtonElement> & import("react").RefAttributes<HTMLButtonElement>, "ref">, "className" | "variant"> & {
|
|
28
|
+
/** Extra class on the `<button>`, for layout. */
|
|
29
|
+
className?: string | undefined;
|
|
30
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
/** `large` = 44×22 (antd default), `medium` = 36×20 (default), `small` = 28×16 for dense rows and table cells. */
|
|
3
|
+
export type SwitchSize = 'large' | 'medium' | 'small';
|
|
4
|
+
export interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'onClick' | 'children' | 'type' | 'role' | 'aria-checked' | 'defaultValue'> {
|
|
5
|
+
/** Controlled state; when given, the caller owns it and `defaultChecked` is ignored. */
|
|
6
|
+
checked?: boolean | undefined;
|
|
7
|
+
/** Initial state for the uncontrolled form. */
|
|
8
|
+
defaultChecked?: boolean | undefined;
|
|
9
|
+
/** Alias of `defaultChecked` (antd parity). */
|
|
10
|
+
defaultValue?: boolean | undefined;
|
|
11
|
+
/** Content shown inside the track while on (short text or a 12px icon). */
|
|
12
|
+
checkedChildren?: ReactNode;
|
|
13
|
+
/** Content shown inside the track while off. */
|
|
14
|
+
unCheckedChildren?: ReactNode;
|
|
15
|
+
/** Blocks clicks and dims the switch; `onChange` does not fire. */
|
|
16
|
+
disabled?: boolean | undefined;
|
|
17
|
+
/** Track size; see `SwitchSize`. Default `medium`. */
|
|
18
|
+
size?: SwitchSize | undefined;
|
|
19
|
+
/** Fires when the value flips (after `onClick`); not fired while `disabled`. */
|
|
20
|
+
onChange?: ((checked: boolean, event: MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
21
|
+
/** Fires on every click with the value the switch is about to take. */
|
|
22
|
+
onClick?: ((checked: boolean, event: MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Binary on/off toggle (`role="switch"`, WAI-ARIA switch pattern) with the antd `Switch` prop
|
|
26
|
+
* shape. Upstream's own `Switch` is a minimal, fully controlled control with a different prop shape; this
|
|
27
|
+
* one keeps antd's. Colours follow upstream's: on track
|
|
28
|
+
* `--dsw-alias-brand-primary` with thumb and track text in `--dsw-alias-label-primary-foreground`,
|
|
29
|
+
* off track a 40 % `color-mix` of `--dsw-alias-label-primary` with a `--dsw-alias-switch-thumb`
|
|
30
|
+
* thumb; capsule and thumb are true circles (`corner-shape: round`); no motion. Differences from antd (deliberate, only these two): the default `size` is `medium`
|
|
31
|
+
* (36×20) rather than `large`, and there is no `loading` prop.
|
|
32
|
+
*
|
|
33
|
+
* Accessibility: a switch without `checkedChildren` / `unCheckedChildren` is purely graphical, so
|
|
34
|
+
* pass `aria-label` (or `aria-labelledby` pointing at the visible row label).
|
|
35
|
+
*/
|
|
36
|
+
export declare function Switch({ checked, defaultChecked, defaultValue, checkedChildren, unCheckedChildren, disabled, size, onChange, onClick, className, ...rest }: SwitchProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface TabItem<T extends string> {
|
|
3
|
+
/** Stable identity of the tab; also the value handed to `onChange` (antd `items[].key`). */
|
|
4
|
+
key: T;
|
|
5
|
+
/** Visible tab text. */
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/** Optional count badge; omitted when undefined. */
|
|
8
|
+
count?: number | undefined;
|
|
9
|
+
/** Skipped by the arrow keys and not selectable. */
|
|
10
|
+
disabled?: boolean | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Optional panel content. When any item carries `children`, the component renders the
|
|
13
|
+
* active item's panel itself (`role="tabpanel"`, wired with `aria-controls` / `aria-labelledby`).
|
|
14
|
+
* Leave it out when the panel is routed content the caller renders (for example a router outlet).
|
|
15
|
+
*/
|
|
16
|
+
children?: ReactNode | undefined;
|
|
17
|
+
}
|
|
18
|
+
export interface TabsProps<T extends string> {
|
|
19
|
+
/** Accessible name of the tab list ("Skill views"). */
|
|
20
|
+
label: string;
|
|
21
|
+
/** Tabs in display order. */
|
|
22
|
+
items: ReadonlyArray<TabItem<T>>;
|
|
23
|
+
/** Controlled selection (antd `activeKey`); the caller owns it (URL state, useState, …). */
|
|
24
|
+
activeKey: T;
|
|
25
|
+
/** Called with the key of the tab the user selects. */
|
|
26
|
+
onChange: (key: T) => void;
|
|
27
|
+
/**
|
|
28
|
+
* DOM id of a caller-rendered panel showing the selected tab's content. Every tab then declares
|
|
29
|
+
* `aria-controls={panelId}` and gets the id `<panelId>-tab-<key>` for the panel's `aria-labelledby`.
|
|
30
|
+
* Ignored when items carry `children` (ids are generated and wired automatically).
|
|
31
|
+
*/
|
|
32
|
+
panelId?: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Type scale of the tab labels: `sm` = `--dsw-font-xxs-12` (default; toolbars and in-card switches),
|
|
35
|
+
* `md` = `--dsw-font-s-14`, `lg` = `--dsw-font-base-16` (page-level view switches).
|
|
36
|
+
*/
|
|
37
|
+
size?: 'sm' | 'md' | 'lg' | undefined;
|
|
38
|
+
/** Bold labels: every tab takes the `-strong-` variant of its size's font token (weight 600 in the theme). */
|
|
39
|
+
bold?: boolean | undefined;
|
|
40
|
+
/** Extra class on the root element, for layout. */
|
|
41
|
+
className?: string | undefined;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Underline tab list (WAI-ARIA tabs, automatic activation): roving tabindex, arrow /
|
|
45
|
+
* Home / End keys move selection and focus, disabled tabs are skipped. Upstream ships
|
|
46
|
+
* no Tabs — its view switchers are rows of `Pill` — so this package provides one.
|
|
47
|
+
* Data-driven like antd's `items`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function Tabs<T extends string>({ label, items, activeKey, onChange, panelId, size, bold, className, }: TabsProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** Run state shown by the left badge: grey spinner / green check / red cross / grey dash. */
|
|
3
|
+
export type TimelineStatus = 'running' | 'succeeded' | 'failed' | 'canceled';
|
|
4
|
+
export interface TimelineItem {
|
|
5
|
+
/** Stable identity of the entry (React key). */
|
|
6
|
+
key: string;
|
|
7
|
+
/** Run state shown by the left badge. */
|
|
8
|
+
status: TimelineStatus;
|
|
9
|
+
/** Title line; may carry a `Pill` tag or other inline nodes. */
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
/** Grey metadata parts (trigger kind, time, duration); the component spaces them. */
|
|
12
|
+
meta?: ReadonlyArray<ReactNode> | undefined;
|
|
13
|
+
/** Optional third line — rendered in the error color for `failed`, grey otherwise. */
|
|
14
|
+
message?: ReactNode | undefined;
|
|
15
|
+
/** When given the whole entry becomes a button (keep `message` free of interactive nodes). */
|
|
16
|
+
onSelect?: (() => void) | undefined;
|
|
17
|
+
}
|
|
18
|
+
export interface TimelineGroup {
|
|
19
|
+
/** Stable identity of the group (React key). */
|
|
20
|
+
key: string;
|
|
21
|
+
/** Group heading such as a date bucket ("Today"); omit for a headless single group. */
|
|
22
|
+
heading?: ReactNode | undefined;
|
|
23
|
+
/** Entries of the group, in display order. */
|
|
24
|
+
items: ReadonlyArray<TimelineItem>;
|
|
25
|
+
}
|
|
26
|
+
export interface TimelineProps {
|
|
27
|
+
/** Accessible name of the whole timeline ("Run history"). */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Screen-reader text per status; badges themselves are aria-hidden. Copy comes from the caller's locale. */
|
|
30
|
+
statusLabels: Readonly<Record<TimelineStatus, string>>;
|
|
31
|
+
/** Groups in display order; ordering and bucketing are the caller's. */
|
|
32
|
+
groups: ReadonlyArray<TimelineGroup>;
|
|
33
|
+
/** Extra class on the root element, for layout. */
|
|
34
|
+
className?: string | undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Vertical run timeline: date-bucket groups,
|
|
38
|
+
* each an ordered list of entries with a status badge, title, grey meta line, optional message
|
|
39
|
+
* and a rail that runs continuously inside a group. Data-driven like antd's `items`; grouping,
|
|
40
|
+
* sorting, copy and time formatting stay with the caller. Upstream ships no Timeline.
|
|
41
|
+
*/
|
|
42
|
+
export declare function Timeline({ label, statusLabels, groups, className }: TimelineProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/** `button`: a trigger button above the list. `dragger`: a dashed drop zone above the list. */
|
|
2
|
+
export type UploadLayout = 'button' | 'dragger';
|
|
3
|
+
export type UploadStatus = 'uploading' | 'done' | 'error';
|
|
4
|
+
export interface UploadItem {
|
|
5
|
+
/** Stable identity of the item. */
|
|
6
|
+
uid: string;
|
|
7
|
+
/** File name shown in the list. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** Bytes. */
|
|
10
|
+
size: number;
|
|
11
|
+
/** Transfer state of the item. */
|
|
12
|
+
status: UploadStatus;
|
|
13
|
+
/** 0–100. */
|
|
14
|
+
percent: number;
|
|
15
|
+
/** Present for files picked locally; absent on items the caller backfills from history. */
|
|
16
|
+
file?: File | undefined;
|
|
17
|
+
/** Resolved value of `upload()`. */
|
|
18
|
+
response?: unknown;
|
|
19
|
+
/** `Error.message` when `upload()` rejected. */
|
|
20
|
+
error?: string | undefined;
|
|
21
|
+
/** Address of a backfilled item, for `onPreview`. */
|
|
22
|
+
url?: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
/** Why a picked file was refused before entering the list. */
|
|
25
|
+
export type UploadRejectReason = 'accept' | 'size' | 'count';
|
|
26
|
+
export interface UploadRejection {
|
|
27
|
+
/** The refused file. */
|
|
28
|
+
file: File;
|
|
29
|
+
/** Which check refused it. */
|
|
30
|
+
reason: UploadRejectReason;
|
|
31
|
+
}
|
|
32
|
+
/** All user-visible text, localized by the caller. */
|
|
33
|
+
export interface UploadLabels {
|
|
34
|
+
/** Button caption; the drop zone's title in the `dragger` layout. */
|
|
35
|
+
trigger: string;
|
|
36
|
+
/** Caption under the trigger, e.g. ".zip only, up to 10 MB". */
|
|
37
|
+
hint?: string | undefined;
|
|
38
|
+
/** `aria-label` of the file list. */
|
|
39
|
+
list: string;
|
|
40
|
+
/** `aria-label` of an item's remove button. */
|
|
41
|
+
remove: string;
|
|
42
|
+
/** `aria-label` of a failed item's retry button. */
|
|
43
|
+
retry: string;
|
|
44
|
+
/** Status text of an item in progress; also names its progress bar. */
|
|
45
|
+
uploading: string;
|
|
46
|
+
/** Status text of a finished item. */
|
|
47
|
+
done: string;
|
|
48
|
+
/** Status text of a failed item. */
|
|
49
|
+
error: string;
|
|
50
|
+
}
|
|
51
|
+
export interface UploadProps {
|
|
52
|
+
/** Default `button`. */
|
|
53
|
+
layout?: UploadLayout | undefined;
|
|
54
|
+
/** Same grammar as the input `accept` attribute; non-matching files go to `onReject('accept')`. */
|
|
55
|
+
accept?: string | undefined;
|
|
56
|
+
/** Default `false`: a drop of several files keeps the first. */
|
|
57
|
+
multiple?: boolean | undefined;
|
|
58
|
+
/** Upper bound on list length; `1` makes a new file replace the current one (antd). */
|
|
59
|
+
maxCount?: number | undefined;
|
|
60
|
+
/** Bytes; larger files go to `onReject('size')`. */
|
|
61
|
+
maxSize?: number | undefined;
|
|
62
|
+
/** Disables picking, dropping, retry and remove. */
|
|
63
|
+
disabled?: boolean | undefined;
|
|
64
|
+
/** Controlled list; echo `onChange` back. Omit for uncontrolled with `defaultItems`. */
|
|
65
|
+
items?: UploadItem[] | undefined;
|
|
66
|
+
/** Initial list when uncontrolled. */
|
|
67
|
+
defaultItems?: UploadItem[] | undefined;
|
|
68
|
+
/** Extra check after the built-in ones (e.g. a ZIP magic number); `false` or a rejection keeps the file out. */
|
|
69
|
+
beforeUpload?: ((file: File, files: File[]) => boolean | Promise<boolean>) | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* The only transport hook (antd `customRequest`). Resolve → `done` with the value as `response`;
|
|
72
|
+
* reject → `error` with the message. `signal` aborts when the item is removed mid-flight.
|
|
73
|
+
*/
|
|
74
|
+
upload: (file: File, context: {
|
|
75
|
+
onProgress: (percent: number) => void;
|
|
76
|
+
signal: AbortSignal;
|
|
77
|
+
}) => Promise<unknown>;
|
|
78
|
+
/** Every list change: additions, progress, completion, removal. */
|
|
79
|
+
onChange?: ((items: UploadItem[]) => void) | undefined;
|
|
80
|
+
/** Files refused by `accept` / `maxSize` / `maxCount`, batched per pick, for the caller to toast. */
|
|
81
|
+
onReject?: ((rejections: UploadRejection[]) => void) | undefined;
|
|
82
|
+
/** Return `false` to keep the item. */
|
|
83
|
+
onRemove?: ((item: UploadItem) => boolean | Promise<boolean>) | undefined;
|
|
84
|
+
/** Makes file names clickable. */
|
|
85
|
+
onPreview?: ((item: UploadItem) => void) | undefined;
|
|
86
|
+
/** Default `true`. */
|
|
87
|
+
showList?: boolean | undefined;
|
|
88
|
+
/** All visible and screen-reader text; see `UploadLabels`. */
|
|
89
|
+
labels: UploadLabels;
|
|
90
|
+
/** Extra class on the root element, for layout. */
|
|
91
|
+
className?: string | undefined;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* File picker with a status list: pick or drop → built-in `accept` / `maxSize` / `maxCount`
|
|
95
|
+
* filter → `beforeUpload` → the item enters the list as `uploading` and `upload()` runs with a
|
|
96
|
+
* progress callback and an abort signal. The component never talks to the network itself — the
|
|
97
|
+
* transport (multipart POST, presigned PUT, …) belongs to the caller. Text comes
|
|
98
|
+
* from `labels`; the component has no strings of its own. Client Component (state, refs),
|
|
99
|
+
* aggregate entry only.
|
|
100
|
+
*/
|
|
101
|
+
export declare function Upload({ layout, accept, multiple, maxCount, maxSize, disabled, items, defaultItems, beforeUpload, upload, onChange, onReject, onRemove, onPreview, showList, labels, className, }: UploadProps): import("react").JSX.Element;
|