@lec-space/liquidglass 0.0.0-stage → 1.1.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/LICENSE +22 -0
- package/README.md +60 -2
- package/dist/button-DSXdLDuQ.js +1051 -0
- package/dist/button-EFLg6M7I.cjs +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.js +8931 -0
- package/dist/styles.css +7101 -0
- package/dist/types/accordion.d.ts +33 -0
- package/dist/types/activity-calendar.d.ts +18 -0
- package/dist/types/alert.d.ts +18 -0
- package/dist/types/aspect-ratio.d.ts +10 -0
- package/dist/types/autocomplete.d.ts +41 -0
- package/dist/types/avatar-group.d.ts +16 -0
- package/dist/types/avatar.d.ts +12 -0
- package/dist/types/badge.d.ts +13 -0
- package/dist/types/box.d.ts +12 -0
- package/dist/types/breadcrumbs.d.ts +31 -0
- package/dist/types/button-group.d.ts +12 -0
- package/dist/types/button.d.ts +16 -0
- package/dist/types/calendar.d.ts +23 -0
- package/dist/types/card.d.ts +10 -0
- package/dist/types/checkbox-group.d.ts +39 -0
- package/dist/types/checkbox.d.ts +9 -0
- package/dist/types/close-button.d.ts +11 -0
- package/dist/types/color-area.d.ts +15 -0
- package/dist/types/color-field.d.ts +15 -0
- package/dist/types/color-picker.d.ts +21 -0
- package/dist/types/color-slider.d.ts +21 -0
- package/dist/types/color-swatch-picker.d.ts +24 -0
- package/dist/types/color-swatch.d.ts +15 -0
- package/dist/types/combo-box.d.ts +37 -0
- package/dist/types/command-palette.d.ts +22 -0
- package/dist/types/config-provider.d.ts +100 -0
- package/dist/types/confirm.d.ts +22 -0
- package/dist/types/container.d.ts +12 -0
- package/dist/types/context-menu.d.ts +17 -0
- package/dist/types/data-table.d.ts +32 -0
- package/dist/types/date-field.d.ts +25 -0
- package/dist/types/date-picker.d.ts +29 -0
- package/dist/types/date-range-picker.d.ts +23 -0
- package/dist/types/description.d.ts +8 -0
- package/dist/types/descriptions.d.ts +13 -0
- package/dist/types/dialog.d.ts +19 -0
- package/dist/types/disclosure-group.d.ts +18 -0
- package/dist/types/disclosure.d.ts +31 -0
- package/dist/types/drawer.d.ts +7 -0
- package/dist/types/empty.d.ts +8 -0
- package/dist/types/field-error.d.ts +12 -0
- package/dist/types/fieldset.d.ts +12 -0
- package/dist/types/filter-bar.d.ts +9 -0
- package/dist/types/flex.d.ts +32 -0
- package/dist/types/form-field.d.ts +19 -0
- package/dist/types/form.d.ts +12 -0
- package/dist/types/glass-group.d.ts +10 -0
- package/dist/types/glass.d.ts +3 -0
- package/dist/types/grid.d.ts +30 -0
- package/dist/types/import-wizard.d.ts +11 -0
- package/dist/types/index.d.ts +107 -0
- package/dist/types/input-group.d.ts +22 -0
- package/dist/types/input-otp.d.ts +29 -0
- package/dist/types/input.d.ts +13 -0
- package/dist/types/internal/bend.d.ts +15 -0
- package/dist/types/internal/calendar-day.d.ts +13 -0
- package/dist/types/internal/chevron.d.ts +6 -0
- package/dist/types/internal/color.d.ts +29 -0
- package/dist/types/internal/contour.d.ts +10 -0
- package/dist/types/internal/controllable.d.ts +1 -0
- package/dist/types/internal/cx.d.ts +1 -0
- package/dist/types/internal/date-only.d.ts +4 -0
- package/dist/types/internal/field-error.d.ts +6 -0
- package/dist/types/internal/floating.d.ts +15 -0
- package/dist/types/internal/form-context.d.ts +5 -0
- package/dist/types/internal/form-reset.d.ts +3 -0
- package/dist/types/internal/hold.d.ts +8 -0
- package/dist/types/internal/href.d.ts +7 -0
- package/dist/types/internal/jelly.d.ts +22 -0
- package/dist/types/internal/layout-style.d.ts +62 -0
- package/dist/types/internal/modal.d.ts +11 -0
- package/dist/types/internal/placement.d.ts +33 -0
- package/dist/types/internal/press.d.ts +2 -0
- package/dist/types/internal/range-calendar-navigation.d.ts +6 -0
- package/dist/types/internal/range-calendar.d.ts +11 -0
- package/dist/types/internal/refraction.d.ts +20 -0
- package/dist/types/internal/schedule-utils.d.ts +32 -0
- package/dist/types/internal/scroller.d.ts +2 -0
- package/dist/types/internal/sheet-drag.d.ts +17 -0
- package/dist/types/internal/spring.d.ts +13 -0
- package/dist/types/internal/styles.d.ts +5 -0
- package/dist/types/internal/tab-motion.d.ts +2 -0
- package/dist/types/internal/tree-branch.d.ts +13 -0
- package/dist/types/kbd.d.ts +13 -0
- package/dist/types/label.d.ts +12 -0
- package/dist/types/link.d.ts +19 -0
- package/dist/types/list-box.d.ts +39 -0
- package/dist/types/loading-overlay.d.ts +17 -0
- package/dist/types/member-picker.d.ts +15 -0
- package/dist/types/mention.d.ts +44 -0
- package/dist/types/menu.d.ts +61 -0
- package/dist/types/message.d.ts +12 -0
- package/dist/types/meter.d.ts +28 -0
- package/dist/types/multi-select.d.ts +25 -0
- package/dist/types/navigation-bar.d.ts +25 -0
- package/dist/types/number-field.d.ts +25 -0
- package/dist/types/page-control.d.ts +13 -0
- package/dist/types/pagination.d.ts +12 -0
- package/dist/types/popover.d.ts +20 -0
- package/dist/types/progress-circle.d.ts +20 -0
- package/dist/types/progress.d.ts +10 -0
- package/dist/types/radio-group.d.ts +39 -0
- package/dist/types/radio.d.ts +8 -0
- package/dist/types/range-calendar.d.ts +24 -0
- package/dist/types/schedule-calendar.d.ts +103 -0
- package/dist/types/scroll-shadow.d.ts +16 -0
- package/dist/types/search-field.d.ts +5 -0
- package/dist/types/section.d.ts +10 -0
- package/dist/types/segmented-control.d.ts +14 -0
- package/dist/types/select.d.ts +20 -0
- package/dist/types/separator.d.ts +13 -0
- package/dist/types/sheet.d.ts +14 -0
- package/dist/types/skeleton.d.ts +9 -0
- package/dist/types/slider.d.ts +10 -0
- package/dist/types/statistic.d.ts +11 -0
- package/dist/types/stepper.d.ts +12 -0
- package/dist/types/steps.d.ts +30 -0
- package/dist/types/style-entry.d.ts +1 -0
- package/dist/types/surface.d.ts +17 -0
- package/dist/types/switch.d.ts +7 -0
- package/dist/types/tab-bar.d.ts +23 -0
- package/dist/types/table.d.ts +22 -0
- package/dist/types/tabs.d.ts +19 -0
- package/dist/types/tag-group.d.ts +40 -0
- package/dist/types/tag.d.ts +10 -0
- package/dist/types/tags-input.d.ts +29 -0
- package/dist/types/text-area.d.ts +13 -0
- package/dist/types/time-field.d.ts +25 -0
- package/dist/types/toast.d.ts +35 -0
- package/dist/types/toggle-button-group.d.ts +24 -0
- package/dist/types/toggle-button.d.ts +27 -0
- package/dist/types/toolbar.d.ts +13 -0
- package/dist/types/tooltip.d.ts +16 -0
- package/dist/types/tree.d.ts +18 -0
- package/dist/types/typography.d.ts +11 -0
- package/dist/types/upload.d.ts +15 -0
- package/dist/types/workspace.d.ts +22 -0
- package/dist/workspace.cjs +1 -0
- package/dist/workspace.js +42 -0
- package/package.json +65 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** How far in, in px, the rim reaches for what it shows at its very edge. */
|
|
2
|
+
export declare const BEND_REACH = 7;
|
|
3
|
+
/** How wide the band round the rim that bends is, in px. */
|
|
4
|
+
export declare const BEND_BAND = 15;
|
|
5
|
+
/** How much further red bends than green, and blue less, as a share of the bend. */
|
|
6
|
+
export declare const BEND_SPLIT = 0.14;
|
|
7
|
+
/** How far, in px, what the rim bends is softened, as iOS softens it. */
|
|
8
|
+
export declare const BEND_BLUR = 0.9;
|
|
9
|
+
/** The bend grows with the lift in this many steps. Each is a filter of its own. */
|
|
10
|
+
export declare const BEND_STEPS = 8;
|
|
11
|
+
/**
|
|
12
|
+
* Filters that bend the rim of a capsule `width` by `height`, from barely to
|
|
13
|
+
* fully, one for each step of the lift. Index 0 is the first step, not none.
|
|
14
|
+
*/
|
|
15
|
+
export declare function bendFilters(width: number, height: number, dark: boolean): string[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** 活动日历的单个日期单元,分开表达日期、活动强度、今天与选中状态。 */
|
|
2
|
+
import type { JSX } from "react";
|
|
3
|
+
export interface CalendarDayProps {
|
|
4
|
+
date: string;
|
|
5
|
+
label: string;
|
|
6
|
+
level: number;
|
|
7
|
+
selected: boolean;
|
|
8
|
+
today: boolean;
|
|
9
|
+
focusable: boolean;
|
|
10
|
+
onFocus: (date: string) => void;
|
|
11
|
+
onSelect?: (date: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function CalendarDay({ date, label, level, selected, today, focusable, onFocus, onSelect, }: CalendarDayProps): JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** 内部色彩解析与通道转换工具,零外部依赖,支持 Hex / RGB / RGBA 与 HSVA 互转。 */
|
|
2
|
+
export interface RgbaColor {
|
|
3
|
+
r: number;
|
|
4
|
+
g: number;
|
|
5
|
+
b: number;
|
|
6
|
+
a: number;
|
|
7
|
+
}
|
|
8
|
+
export interface HsvaColor {
|
|
9
|
+
h: number;
|
|
10
|
+
s: number;
|
|
11
|
+
v: number;
|
|
12
|
+
a: number;
|
|
13
|
+
}
|
|
14
|
+
export type ColorChannel = "hue" | "saturation" | "brightness" | "alpha" | "red" | "green" | "blue";
|
|
15
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
16
|
+
/** 解析 Hex(#RGB / #RGBA / #RRGGBB / #RRGGBBAA)或 rgb()/rgba() 为 RGBA。 */
|
|
17
|
+
export declare function parseColor(input?: string): RgbaColor | null;
|
|
18
|
+
export declare function rgbaToHsva({ r, g, b, a }: RgbaColor): HsvaColor;
|
|
19
|
+
export declare function hsvaToRgba({ h, s, v, a }: HsvaColor): RgbaColor;
|
|
20
|
+
/** 序列化 RGBA 为 Hex(若包含透明度则输出 8 位 #RRGGBBAA,否则 6 位 #RRGGBB)。 */
|
|
21
|
+
export declare function formatHex(rgba: RgbaColor, includeAlpha?: boolean): string;
|
|
22
|
+
export declare function formatCssRgba(rgba: RgbaColor): string;
|
|
23
|
+
export declare function getChannelRange(channel: ColorChannel): {
|
|
24
|
+
min: number;
|
|
25
|
+
max: number;
|
|
26
|
+
step: number;
|
|
27
|
+
};
|
|
28
|
+
export declare function getChannelValue(hsva: HsvaColor, channel: ColorChannel): number;
|
|
29
|
+
export declare function setChannelValue(hsva: HsvaColor, channel: ColorChannel, next: number): HsvaColor;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface RoundedRect {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
radius: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function blended(rects: RoundedRect[], spacing: number, px: number, py: number): number;
|
|
9
|
+
/** The outline of the blended shapes, as an SVG path, by marching squares. */
|
|
10
|
+
export declare function outline(rects: RoundedRect[], spacing: number, width: number, height: number, step?: number): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useControllable<T, U extends T = T>(value: T | undefined, defaultValue: T, onChange: ((value: U) => void) | undefined): [T, (next: U) => void];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cx(...names: (string | false | null | undefined)[]): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type HTMLAttributes, type JSX, type RefObject } from "react";
|
|
2
|
+
export type FloatingSide = "top" | "bottom" | "left" | "right";
|
|
3
|
+
export type DismissReason = "escape" | "outside" | "focus";
|
|
4
|
+
interface FloatingProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
anchor: RefObject<HTMLElement | null>;
|
|
6
|
+
side?: FloatingSide;
|
|
7
|
+
align?: "start" | "center" | "end";
|
|
8
|
+
onDismiss: (reason: DismissReason) => void;
|
|
9
|
+
focusOnOpen?: boolean;
|
|
10
|
+
dismissOnBlur?: boolean;
|
|
11
|
+
/** 大型日历可在空间不足时覆盖触发器,优先使用完整视口高度。 */
|
|
12
|
+
allowAnchorOverlap?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function Floating({ anchor, side, align, onDismiss, focusOnOpen, dismissOnBlur, allowAnchorOverlap, className, children, ...props }: FloatingProps): JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** 表单校验错误共享上下文:由 Form 注入,供 FieldError 按字段名读取。 */
|
|
2
|
+
import { type Context } from "react";
|
|
3
|
+
export type FormValidationErrors = Record<string, string | readonly string[] | undefined>;
|
|
4
|
+
export declare const FormErrorsContext: Context<FormValidationErrors | undefined>;
|
|
5
|
+
export declare function useFormFieldError(name?: string): string | readonly string[] | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long a touch rests on a control before it belongs to the control rather
|
|
3
|
+
* than the page, as with UIScrollView's delay before its controls take a
|
|
4
|
+
* touch. A quick swipe that starts on a control still scrolls the page; a
|
|
5
|
+
* press held this long, or a drag already under way, keeps the touch.
|
|
6
|
+
*/
|
|
7
|
+
export declare const HOLD = 150;
|
|
8
|
+
export declare const held: (at: number, moved: boolean) => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns `href` if it is safe to navigate to, and `undefined` if it isn't.
|
|
3
|
+
* Relative links and http, https, mailto, tel and sms links are safe; anything
|
|
4
|
+
* else, such as `javascript:` or `data:`, would run script from a string that
|
|
5
|
+
* may have come from untrusted data.
|
|
6
|
+
*/
|
|
7
|
+
export declare function safeHref(href: string | undefined): string | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface Squash {
|
|
2
|
+
/** Scale along the drag. */
|
|
3
|
+
x: number;
|
|
4
|
+
/** Scale across it. */
|
|
5
|
+
y: number;
|
|
6
|
+
/** How far the body trails the place it was taken to, in px, negative behind it. */
|
|
7
|
+
shift: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const FLAT: Squash;
|
|
10
|
+
/** The shape of a lens `length` long that trails its place by `lag` px, as far as `trail` of it shows. */
|
|
11
|
+
export declare function squash(lag: number, length: number, trail?: number): Squash;
|
|
12
|
+
export interface Jelly {
|
|
13
|
+
/** Takes the lens to a place along its drag. `instant` puts it there with nothing trailing. */
|
|
14
|
+
follow(position: number, instant?: boolean): void;
|
|
15
|
+
stop(): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Follows a lens's place and reports its shape each frame it changes. `trail` is how much
|
|
19
|
+
* of the lag the body itself shows, for a lens that's moved straight to the finger: one
|
|
20
|
+
* already carried on a spring of its own trails enough by itself, and passes 0.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createJelly(length: () => number, paint: (shape: Squash) => void, trail?: number): Jelly;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Radix 风格布局原语共享工具:将语义间距阶梯(0-9)与布局简写属性转换为内联 CSSProperties。 */
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
3
|
+
export type SpaceScale = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | (string & {}) | number;
|
|
4
|
+
export type LayoutAlign = "start" | "center" | "end" | "baseline" | "stretch";
|
|
5
|
+
export type LayoutJustify = "start" | "center" | "end" | "between" | "around" | "evenly";
|
|
6
|
+
export declare function resolveSpace(value?: SpaceScale): string | undefined;
|
|
7
|
+
export declare function resolveLength(value?: number | string): string | undefined;
|
|
8
|
+
export declare function resolveAlign(value?: LayoutAlign): string | undefined;
|
|
9
|
+
export declare function resolveJustify(value?: LayoutJustify): string | undefined;
|
|
10
|
+
export interface LayoutSpaceProps {
|
|
11
|
+
/** 四周内边距(支持 0–9 阶梯或任意 CSS 长度)。 */
|
|
12
|
+
p?: SpaceScale;
|
|
13
|
+
/** 水平内边距。 */
|
|
14
|
+
px?: SpaceScale;
|
|
15
|
+
/** 垂直内边距。 */
|
|
16
|
+
py?: SpaceScale;
|
|
17
|
+
/** 上内边距。 */
|
|
18
|
+
pt?: SpaceScale;
|
|
19
|
+
/** 右内边距。 */
|
|
20
|
+
pr?: SpaceScale;
|
|
21
|
+
/** 下内边距。 */
|
|
22
|
+
pb?: SpaceScale;
|
|
23
|
+
/** 左内边距。 */
|
|
24
|
+
pl?: SpaceScale;
|
|
25
|
+
/** 四周外边距。 */
|
|
26
|
+
m?: SpaceScale;
|
|
27
|
+
/** 水平外边距。 */
|
|
28
|
+
mx?: SpaceScale;
|
|
29
|
+
/** 垂直外边距。 */
|
|
30
|
+
my?: SpaceScale;
|
|
31
|
+
/** 上外边距。 */
|
|
32
|
+
mt?: SpaceScale;
|
|
33
|
+
/** 右外边距。 */
|
|
34
|
+
mr?: SpaceScale;
|
|
35
|
+
/** 下外边距。 */
|
|
36
|
+
mb?: SpaceScale;
|
|
37
|
+
/** 左外边距。 */
|
|
38
|
+
ml?: SpaceScale;
|
|
39
|
+
/** 宽度。 */
|
|
40
|
+
width?: number | string;
|
|
41
|
+
/** 最小宽度。 */
|
|
42
|
+
minWidth?: number | string;
|
|
43
|
+
/** 最大宽度。 */
|
|
44
|
+
maxWidth?: number | string;
|
|
45
|
+
/** 高度。 */
|
|
46
|
+
height?: number | string;
|
|
47
|
+
/** 最小高度。 */
|
|
48
|
+
minHeight?: number | string;
|
|
49
|
+
/** 最大高度。 */
|
|
50
|
+
maxHeight?: number | string;
|
|
51
|
+
/** 弹性放大比例。 */
|
|
52
|
+
flexGrow?: CSSProperties["flexGrow"];
|
|
53
|
+
/** 弹性收缩比例。 */
|
|
54
|
+
flexShrink?: CSSProperties["flexShrink"];
|
|
55
|
+
/** 弹性初始尺寸。 */
|
|
56
|
+
flexBasis?: number | string;
|
|
57
|
+
/** 溢出策略。 */
|
|
58
|
+
overflow?: CSSProperties["overflow"];
|
|
59
|
+
/** 定位方式。 */
|
|
60
|
+
position?: CSSProperties["position"];
|
|
61
|
+
}
|
|
62
|
+
export declare function buildLayoutStyle(props: LayoutSpaceProps, extra?: CSSProperties): CSSProperties | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
export type ModalPhase = "closed" | "open" | "leaving";
|
|
3
|
+
/**
|
|
4
|
+
* Keeps a <dialog> in the top layer from when `open` turns true until `finished`
|
|
5
|
+
* is called after it turns false, so it has time to animate out.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useModal(ref: RefObject<HTMLDialogElement | null>, open: boolean, requestClose: () => void, returnFocusRef?: RefObject<HTMLElement | null>): {
|
|
8
|
+
phase: ModalPhase;
|
|
9
|
+
finished: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const reducedMotion: () => boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface Rect {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
export interface Placement {
|
|
8
|
+
left: number;
|
|
9
|
+
top: number;
|
|
10
|
+
/** Which way the menu grows from its trigger. */
|
|
11
|
+
side: "bottom" | "top";
|
|
12
|
+
/** The menu's height once placed: its own, or the room there is, when that's less. */
|
|
13
|
+
height: number;
|
|
14
|
+
/** Whether the menu is taller than the room, so its items scroll. */
|
|
15
|
+
scrolls: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** The space kept between a menu and the edges of the window. */
|
|
18
|
+
export declare const EDGE = 8;
|
|
19
|
+
/**
|
|
20
|
+
* Where a menu goes, given its trigger and its own size.
|
|
21
|
+
*
|
|
22
|
+
* As on iOS, the menu covers its trigger: it starts at the trigger's top and grows down, or,
|
|
23
|
+
* when there isn't room below, starts at its bottom and grows up. It centres on the trigger, or lines
|
|
24
|
+
* up with its leading or trailing edge, then moves in from the window's edge if it would cross
|
|
25
|
+
* it. A menu taller than either side takes the bigger one and scrolls.
|
|
26
|
+
*/
|
|
27
|
+
export declare function placeMenu(trigger: Rect, menu: {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
}, align: "start" | "center" | "end", viewport: {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
}): Placement;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** 日期范围浮层的月份导航,复用玻璃按钮并交给 DayPicker 管理月份边界。 */
|
|
2
|
+
import type { NavProps } from "@daypicker/react";
|
|
3
|
+
import type { JSX } from "react";
|
|
4
|
+
export interface RangeCalendarNavigationProps extends NavProps {
|
|
5
|
+
}
|
|
6
|
+
export declare function RangeCalendarNavigation({ previousMonth, nextMonth, onPreviousClick, onNextClick, ...props }: RangeCalendarNavigationProps): JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** 范围日历适配层,复用 DayPicker 的日期与键盘逻辑,视觉由组件库自己的样式控制。 */
|
|
2
|
+
import { type JSX } from "react";
|
|
3
|
+
import { type DateRange } from "@daypicker/react";
|
|
4
|
+
export interface RangeCalendarProps {
|
|
5
|
+
value?: DateRange;
|
|
6
|
+
onValueChange: (value: DateRange | undefined) => void;
|
|
7
|
+
min?: string;
|
|
8
|
+
max?: string;
|
|
9
|
+
today?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function RangeCalendar({ value, onValueChange, min, max, today, }: RangeCalendarProps): JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Lights the edge of glass that's being held, as clear glass's is: iOS shows its rim
|
|
4
|
+
* brightest when a finger is on it. `on` false puts back the rim it was drawn with.
|
|
5
|
+
*/
|
|
6
|
+
export declare function lightRim(element: HTMLElement, on: boolean): void;
|
|
7
|
+
/** Only Chromium applies SVG filters to the live backdrop. */
|
|
8
|
+
export declare const refractsBackdrop: () => boolean;
|
|
9
|
+
/** The rim alone, kept fitted as the element changes size. */
|
|
10
|
+
export declare const fitRim: (element: HTMLElement) => (() => void);
|
|
11
|
+
/** The rim for a size the element is about to reach, so it needn't be worked out on the way there. */
|
|
12
|
+
export declare function rimAt(element: HTMLElement, width: number, height: number, radius: number): () => void;
|
|
13
|
+
/** The lens for an element at its final size, where the browser can run it. Stop it before the size changes. */
|
|
14
|
+
export declare function fitLens(element: HTMLElement): () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Refracts what's behind the element. Chromium filters the live backdrop.
|
|
17
|
+
* Safari and Firefox filter a copy of content marked `data-liquidglass-backdrop`
|
|
18
|
+
* nearby, and otherwise keep the blur with the rim highlight.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useRefraction(ref: RefObject<HTMLElement | null>, selection?: boolean): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** 日程日历纯函数工具:处理本地日期偏移、月/周网格生成、跨天判断与时间轴并发分栏布局。 */
|
|
2
|
+
export interface ParsedDateTime {
|
|
3
|
+
dateKey: string;
|
|
4
|
+
/** 距离当天 00:00 的分钟数;纯日期串返回 null。 */
|
|
5
|
+
minutes: number | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function pad2(n: number): string;
|
|
8
|
+
export declare function dateToKey(date: Date): string;
|
|
9
|
+
export declare function keyToDate(dateKey: string): Date;
|
|
10
|
+
/** 解析 `YYYY-MM-DD`、`YYYY-MM-DDTHH:mm` 或 `YYYY-MM-DD HH:mm`。 */
|
|
11
|
+
export declare function parseScheduleDateTime(raw: string): ParsedDateTime;
|
|
12
|
+
export declare function formatMinutes(minutes: number): string;
|
|
13
|
+
export declare function addDays(dateKey: string, delta: number): string;
|
|
14
|
+
export declare function addMonths(dateKey: string, delta: number): string;
|
|
15
|
+
export declare function getDayOfWeek(dateKey: string): number;
|
|
16
|
+
export declare function getWeekDays(anchorDateKey: string, weekStartsOn: 0 | 1): string[];
|
|
17
|
+
/** 生成完整月网格(5 行或 6 行,自动贴合当月实际周数)。 */
|
|
18
|
+
export declare function getMonthGrid(anchorDateKey: string, weekStartsOn: 0 | 1, alwaysSixRows?: boolean): string[];
|
|
19
|
+
export interface TimedLayoutInput {
|
|
20
|
+
id: string;
|
|
21
|
+
startMinutes: number;
|
|
22
|
+
endMinutes: number;
|
|
23
|
+
}
|
|
24
|
+
export interface TimedLayoutResult {
|
|
25
|
+
id: string;
|
|
26
|
+
column: number;
|
|
27
|
+
columnCount: number;
|
|
28
|
+
topPercent: number;
|
|
29
|
+
heightPercent: number;
|
|
30
|
+
}
|
|
31
|
+
/** 对同一天内的时段日程做重叠聚类与分栏计算,确保并发日程并排展示不互相覆盖。 */
|
|
32
|
+
export declare function layoutDayTimedEvents(items: readonly TimedLayoutInput[]): Map<string, TimedLayoutResult>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** How far, in px, a drag has to go before it's known which way it's going. */
|
|
2
|
+
export declare const SLOP = 8;
|
|
3
|
+
/** Whether a drag that starts on `target` belongs to the thing itself, not the sheet. */
|
|
4
|
+
export declare function ownsDrag(target: Element): boolean;
|
|
5
|
+
/** Which of the elements from `target` up to `boundary` scroll up and down, innermost first. */
|
|
6
|
+
export declare function scrollers(target: Element, boundary: Element): HTMLElement[];
|
|
7
|
+
/** What a drag does: `dy` is the finger's travel in px, down positive. */
|
|
8
|
+
export declare function whose(dy: number, height: number, top: number, scrolled: boolean): "sheet" | "content";
|
|
9
|
+
/**
|
|
10
|
+
* Splits a drag's reach between the sheet and its content. `want` is the height
|
|
11
|
+
* the finger asks for. The sheet stops at `top`, the content scrolls by what's
|
|
12
|
+
* beyond it, up to `room`, and past that the sheet resists rather than following.
|
|
13
|
+
*/
|
|
14
|
+
export declare function split(want: number, top: number, room: number): {
|
|
15
|
+
height: number;
|
|
16
|
+
scroll: number;
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Spring {
|
|
2
|
+
paint(): void;
|
|
3
|
+
set(target: number, instant?: boolean): void;
|
|
4
|
+
tune(stiffness: number, damping: number): void;
|
|
5
|
+
stop(): void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Runs after a few frames. Glass takes a moment to reach the screen when it's first
|
|
9
|
+
* shown, and motion started at once would be half over by the time it did.
|
|
10
|
+
*/
|
|
11
|
+
export declare function afterGlassShows(callback: () => void, frames?: number): () => void;
|
|
12
|
+
export declare function prefersReducedMotion(): boolean;
|
|
13
|
+
export declare function createSpring(value: number, stiffness: number, damping: number, paint: (value: number) => void): Spring;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Tree 的递归节点,隔离层级渲染与根组件的键盘导航逻辑。 */
|
|
2
|
+
import { type JSX } from "react";
|
|
3
|
+
import type { TreeNode } from "../tree.js";
|
|
4
|
+
export interface TreeBranchProps {
|
|
5
|
+
node: TreeNode;
|
|
6
|
+
selected: string;
|
|
7
|
+
active?: string;
|
|
8
|
+
expanded: ReadonlySet<string>;
|
|
9
|
+
onToggle: (key: string) => void;
|
|
10
|
+
onSelect: (key: string) => void;
|
|
11
|
+
onFocus: (key: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function TreeBranch({ node, selected, active, expanded, onToggle, onSelect, onFocus, }: TreeBranchProps): JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** 液态玻璃快捷键键帽:支持常用修饰键符号快捷映射与常规按键展示。 */
|
|
2
|
+
import { type ForwardRefExoticComponent, type HTMLAttributes, type ReactNode, type RefAttributes } from "react";
|
|
3
|
+
export type KbdKey = "command" | "shift" | "ctrl" | "option" | "enter" | "delete" | "escape" | "tab" | "capslock" | "up" | "right" | "down" | "left" | "pageup" | "pagedown" | "home" | "end" | "space";
|
|
4
|
+
export interface KbdProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
/** 修饰键或功能键列表,按顺序渲染在主按键文字前。 */
|
|
6
|
+
keys?: KbdKey | readonly KbdKey[];
|
|
7
|
+
/** 尺寸规格。 */
|
|
8
|
+
size?: "small" | "regular";
|
|
9
|
+
/** 视觉材质:`glass` 带轻玻璃光泽,`subtle` 为柔和浅底。 */
|
|
10
|
+
variant?: "glass" | "subtle";
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const Kbd: ForwardRefExoticComponent<KbdProps & RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** 语义表单标签:关联输入控件,支持必填星标与禁用视觉状态。 */
|
|
2
|
+
import { type ForwardRefExoticComponent, type LabelHTMLAttributes, type ReactNode, type RefAttributes } from "react";
|
|
3
|
+
export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
4
|
+
/** 是否显示必填星标。 */
|
|
5
|
+
required?: boolean;
|
|
6
|
+
/** 禁用状态视觉降权。 */
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** 字号规格。 */
|
|
9
|
+
size?: "small" | "regular";
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const Label: ForwardRefExoticComponent<LabelProps & RefAttributes<HTMLLabelElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** 液态玻璃语义超链接:支持下划线策略、色调、外链安全属性与禁用状态。 */
|
|
2
|
+
import { type AnchorHTMLAttributes, type ForwardRefExoticComponent, type ReactNode, type RefAttributes } from "react";
|
|
3
|
+
export type LinkTone = "accent" | "foreground" | "muted" | "danger";
|
|
4
|
+
export type LinkUnderline = "none" | "hover" | "always";
|
|
5
|
+
export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
6
|
+
/** 颜色语义。 */
|
|
7
|
+
tone?: LinkTone;
|
|
8
|
+
/** 下划线显示时机。 */
|
|
9
|
+
underline?: LinkUnderline;
|
|
10
|
+
/** 外部链接:自动补充 `target="_blank"`、`rel="noopener noreferrer"` 并显示外链图标。 */
|
|
11
|
+
external?: boolean;
|
|
12
|
+
/** 是否显示外链尾标图标,默认随 `external` 开启。 */
|
|
13
|
+
showExternalIcon?: boolean;
|
|
14
|
+
/** 禁用链接交互并移除焦点顺序。 */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** 可选前置图标。 */
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export declare const Link: ForwardRefExoticComponent<LinkProps & RefAttributes<HTMLAnchorElement>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** 液态玻璃列表选择框:支持单选/多选、分组标题、图标描述与完整键盘导航。 */
|
|
2
|
+
import { type HTMLAttributes, type JSX, type ReactNode } from "react";
|
|
3
|
+
export interface ListBoxItem {
|
|
4
|
+
/** 唯一键值。 */
|
|
5
|
+
key: string;
|
|
6
|
+
/** 主标题。 */
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
/** 可选辅助说明。 */
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
/** 可选前置图标。 */
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
/** 可选右侧附属信息(如快捷键或计数)。 */
|
|
13
|
+
trailing?: ReactNode;
|
|
14
|
+
/** 语义色调:`danger` 用于危险操作项。 */
|
|
15
|
+
tone?: "default" | "danger";
|
|
16
|
+
/** 分组名称;连续相同分组会自动合并显示分组头。 */
|
|
17
|
+
group?: string;
|
|
18
|
+
/** 禁用该项。 */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ListBoxProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
22
|
+
/** 列表选项集合。 */
|
|
23
|
+
items: readonly ListBoxItem[];
|
|
24
|
+
/** 选择模式。 */
|
|
25
|
+
selectionMode?: "none" | "single" | "multiple";
|
|
26
|
+
/** 受控选中键集合。 */
|
|
27
|
+
selectedKeys?: readonly string[];
|
|
28
|
+
/** 非受控初始选中键集合。 */
|
|
29
|
+
defaultSelectedKeys?: readonly string[];
|
|
30
|
+
/** 选中集合变化回调。 */
|
|
31
|
+
onSelectionChange?: (keys: string[]) => void;
|
|
32
|
+
/** 点击或按回车触发某项时的动作回调(适合作为命令或导航列表)。 */
|
|
33
|
+
onAction?: (key: string) => void;
|
|
34
|
+
/** 列表为空时的自定义占位内容。 */
|
|
35
|
+
empty?: ReactNode;
|
|
36
|
+
/** 外观变体。 */
|
|
37
|
+
variant?: "glass" | "surface";
|
|
38
|
+
}
|
|
39
|
+
export declare function ListBox({ items, selectionMode, selectedKeys: controlledSelected, defaultSelectedKeys, onSelectionChange, onAction, empty, variant, className, onKeyDown, ...props }: ListBoxProps): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** 局部液态玻璃加载遮罩(LoadingOverlay):放置在 position: relative 容器内,在异步加载期间柔和模糊并阻断交互。 */
|
|
2
|
+
import { type ForwardRefExoticComponent, type HTMLAttributes, type ReactNode, type RefAttributes } from "react";
|
|
3
|
+
export interface LoadingOverlayProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** 是否显示加载遮罩。 */
|
|
5
|
+
visible: boolean;
|
|
6
|
+
/** 可选加载提示文案(如「正在保存…」)。 */
|
|
7
|
+
label?: ReactNode;
|
|
8
|
+
/** 自定义加载指示器,默认使用液态玻璃 Spinner。 */
|
|
9
|
+
loader?: ReactNode;
|
|
10
|
+
/** 背景毛玻璃模糊半径(像素),默认 `6`。 */
|
|
11
|
+
blur?: number;
|
|
12
|
+
/** 圆角继承或显式覆盖,默认 `inherit`。 */
|
|
13
|
+
radius?: number | string;
|
|
14
|
+
/** 层级,默认 `20`。 */
|
|
15
|
+
zIndex?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const LoadingOverlay: ForwardRefExoticComponent<LoadingOverlayProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** 成员选择组合,仅展示传入的成员资料;搜索和权限范围由接入项目控制。 */
|
|
2
|
+
import type { JSX } from "react";
|
|
3
|
+
import { type MultiSelectProps } from "./multi-select.js";
|
|
4
|
+
export interface MemberOption {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
avatar?: string;
|
|
9
|
+
group?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface MemberPickerProps extends Omit<MultiSelectProps, "options"> {
|
|
13
|
+
members: readonly MemberOption[];
|
|
14
|
+
}
|
|
15
|
+
export declare function MemberPicker({ members, ...props }: MemberPickerProps): JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** 液态玻璃「@提及」胶囊组件:用于行内或卡片中展示负责人、提交者、审阅者与协作贡献者,支持头像、角色副标与点击回调。 */
|
|
2
|
+
import { type HTMLAttributes, type JSX, type MouseEventHandler, type ReactNode } from "react";
|
|
3
|
+
export type MentionTone = "accent" | "neutral" | "success" | "warning";
|
|
4
|
+
export type MentionSize = "small" | "regular";
|
|
5
|
+
export interface MentionProps extends Omit<HTMLAttributes<HTMLElement>, "onClick"> {
|
|
6
|
+
/** 展示名称(如真名或用户名)。 */
|
|
7
|
+
name: string;
|
|
8
|
+
/** 可选头像链接;加载失败或未传时自动展示姓名首字徽章。 */
|
|
9
|
+
avatar?: string;
|
|
10
|
+
/** 前缀符号,默认 `@`;传空字符串可隐藏。 */
|
|
11
|
+
prefix?: string;
|
|
12
|
+
/** 尺寸:`small` 适合行内与提交记录,`regular` 适合贡献者与负责人区块。 */
|
|
13
|
+
size?: MentionSize;
|
|
14
|
+
/** 视觉色调:默认 `accent`(液态玻璃蓝调微光),未绑定外部账号可用 `neutral`。 */
|
|
15
|
+
tone?: MentionTone;
|
|
16
|
+
/** 可选角色副标(如 `负责人`、`提交者`、`联合提交`)。 */
|
|
17
|
+
roleLabel?: string;
|
|
18
|
+
/** 可选尾标图标(如第三方来源小标)。 */
|
|
19
|
+
badge?: ReactNode;
|
|
20
|
+
/** 传入后渲染为可点击的交互按钮(用于打开成员名片或主页)。 */
|
|
21
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
22
|
+
}
|
|
23
|
+
export declare function Mention({ name, avatar, prefix, size, tone, roleLabel, badge, onClick, className, ...props }: MentionProps): JSX.Element;
|
|
24
|
+
export interface MentionGroupItem {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
avatar?: string;
|
|
28
|
+
roleLabel?: string;
|
|
29
|
+
tone?: MentionTone;
|
|
30
|
+
badge?: ReactNode;
|
|
31
|
+
title?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface MentionGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
34
|
+
/** 要展示的成员列表。 */
|
|
35
|
+
items: readonly MentionGroupItem[];
|
|
36
|
+
/** 胶囊尺寸。 */
|
|
37
|
+
size?: MentionSize;
|
|
38
|
+
/** 最多直接显示的胶囊数量,超出后折叠为 `+N` 提示。 */
|
|
39
|
+
maxVisible?: number;
|
|
40
|
+
/** 点击某位成员胶囊时的回调。 */
|
|
41
|
+
onSelect?: (item: MentionGroupItem) => void;
|
|
42
|
+
}
|
|
43
|
+
/** 多人 @提及 列表容器:自动换行并支持超量折叠为 `+N` 液态胶囊。 */
|
|
44
|
+
export declare function MentionGroup({ items, size, maxVisible, onSelect, className, ...props }: MentionGroupProps): JSX.Element;
|