prime-ui-kit 0.13.1 → 0.14.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/README.md +7 -6
- package/dist/chunks/{chunk-XNOJEX55.js → chunk-P6ZO37JM.js} +1 -1
- package/dist/chunks/{chunk-JV2KB5JZ.js → chunk-SYEX7OVT.js} +3572 -2865
- package/dist/chunks/{chunk-PK2GC77E.js → chunk-WXKRUVSE.js} +164 -140
- package/dist/color-picker.js +2 -2
- package/dist/components/banner/Banner.d.ts +5 -2
- package/dist/components/chart-frame/ChartFrame.d.ts +19 -6
- package/dist/components/chat/Chat.d.ts +2 -2
- package/dist/components/chat/ChatPinned.d.ts +2 -2
- package/dist/components/chat/MessageList.d.ts +1 -1
- package/dist/components/chat/chatContext.d.ts +1 -1
- package/dist/components/field-list/FieldList.d.ts +90 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/input/Input.d.ts +2 -2
- package/dist/components/kanban/Kanban.d.ts +6 -3
- package/dist/components/page-content/PageContent.d.ts +55 -4
- package/dist/components/sparkline/Sparkline.d.ts +64 -15
- package/dist/components/sparkline/geometry.d.ts +26 -0
- package/dist/components/tooltip/Tooltip.d.ts +5 -2
- package/dist/hooks/usePosition.d.ts +15 -4
- package/dist/index.css +1 -1
- package/dist/index.js +4 -2
- package/dist/internal/ChartTooltip.d.ts +26 -0
- package/dist/internal/FieldAction.d.ts +6 -7
- package/dist/internal/fieldCell.d.ts +21 -0
- package/dist/internal/messageList.d.ts +2 -2
- package/dist/internal/palette.d.ts +7 -0
- package/dist/skill/SKILL.md +24 -14
- package/dist/skill/anti-slop.md +77 -4
- package/dist/skill/cheatsheet.md +24 -5
- package/dist/skill/checklist.md +19 -1
- package/dist/skill/choosing.md +10 -5
- package/dist/skill/components.md +4 -3
- package/dist/skill/composition.md +28 -15
- package/dist/skill/foundations.md +8 -6
- package/dist/skill/layouts.md +6 -6
- package/dist/skill/patterns/app-shell.module.css +1 -8
- package/dist/skill/patterns/app-shell.tsx +11 -9
- package/dist/skill/patterns/chat.tsx +23 -5
- package/dist/skill/patterns/dashboard.module.css +1 -31
- package/dist/skill/patterns/dashboard.tsx +150 -136
- package/dist/skill/patterns/detail-page.module.css +0 -3
- package/dist/skill/patterns/detail-page.tsx +4 -7
- package/dist/skill/patterns/form-drawer.tsx +2 -2
- package/dist/skill/patterns/kanban-board.tsx +4 -2
- package/dist/skill/patterns/list-page.tsx +2 -2
- package/dist/skill/patterns/media-library.module.css +0 -22
- package/dist/skill/patterns/media-library.tsx +17 -18
- package/dist/skill/patterns/record-editor.module.css +18 -0
- package/dist/skill/patterns/record-editor.tsx +356 -0
- package/dist/skill/patterns/screen-states.module.css +3 -17
- package/dist/skill/patterns/screen-states.tsx +70 -69
- package/dist/skill/patterns/settings-page.module.css +1 -21
- package/dist/skill/patterns/settings-page.tsx +58 -79
- package/dist/skill/reference/components/avatar/COMPONENT.md +4 -4
- package/dist/skill/reference/components/avatar/examples/presence.tsx +1 -1
- package/dist/skill/reference/components/avatar/examples/states.tsx +1 -1
- package/dist/skill/reference/components/banner/COMPONENT.md +6 -6
- package/dist/skill/reference/components/banner/examples/dismissible.tsx +22 -11
- package/dist/skill/reference/components/banner/examples/examples.module.css +3 -3
- package/dist/skill/reference/components/banner/examples/narrow.tsx +1 -1
- package/dist/skill/reference/components/breadcrumb/COMPONENT.md +1 -1
- package/dist/skill/reference/components/breadcrumb/examples/overflow.tsx +1 -1
- package/dist/skill/reference/components/card/COMPONENT.md +5 -4
- package/dist/skill/reference/components/card/examples/examples.module.css +0 -28
- package/dist/skill/reference/components/card/examples/kpi-media.tsx +13 -11
- package/dist/skill/reference/components/card/examples/narrow.tsx +1 -1
- package/dist/skill/reference/components/card/examples/panel-chart.tsx +45 -22
- package/dist/skill/reference/components/chart-frame/COMPONENT.md +10 -7
- package/dist/skill/reference/components/chart-frame/examples/tooltip.tsx +20 -24
- package/dist/skill/reference/components/chat/COMPONENT.md +3 -3
- package/dist/skill/reference/components/chat/examples/search.tsx +1 -1
- package/dist/skill/reference/components/chat-list/COMPONENT.md +1 -1
- package/dist/skill/reference/components/checkbox/examples/indicator.tsx +24 -2
- package/dist/skill/reference/components/color-picker/COMPONENT.md +2 -2
- package/dist/skill/reference/components/color-swatches/COMPONENT.md +1 -0
- package/dist/skill/reference/components/datepicker/COMPONENT.md +1 -0
- package/dist/skill/reference/components/dnd/COMPONENT.md +3 -3
- package/dist/skill/reference/components/field-list/COMPONENT.md +164 -0
- package/dist/skill/reference/components/field-list/examples/base-row.tsx +76 -0
- package/dist/skill/reference/components/field-list/examples/controlled.tsx +72 -0
- package/dist/skill/reference/components/field-list/examples/errors.tsx +85 -0
- package/dist/skill/reference/components/field-list/examples/examples.module.css +34 -0
- package/dist/skill/reference/components/field-list/examples/limits.tsx +55 -0
- package/dist/skill/reference/components/field-list/examples/locked.tsx +139 -0
- package/dist/skill/reference/components/field-list/examples/narrow.tsx +68 -0
- package/dist/skill/reference/components/field-list/examples/overview.tsx +66 -0
- package/dist/skill/reference/components/field-list/examples/reorder.tsx +42 -0
- package/dist/skill/reference/components/field-list/examples/sizes.tsx +42 -0
- package/dist/skill/reference/components/field-list/examples/states.tsx +51 -0
- package/dist/skill/reference/components/input/examples/examples.module.css +2 -7
- package/dist/skill/reference/components/kanban/COMPONENT.md +13 -9
- package/dist/skill/reference/components/kanban/examples/limits.tsx +2 -1
- package/dist/skill/reference/components/kanban/examples/variants.tsx +16 -8
- package/dist/skill/reference/components/list/COMPONENT.md +1 -1
- package/dist/skill/reference/components/media-viewer/COMPONENT.md +2 -2
- package/dist/skill/reference/components/message/COMPONENT.md +2 -2
- package/dist/skill/reference/components/notification/COMPONENT.md +1 -0
- package/dist/skill/reference/components/page-content/COMPONENT.md +70 -14
- package/dist/skill/reference/components/page-content/examples/grid.tsx +107 -0
- package/dist/skill/reference/components/page-content/examples/overview.tsx +2 -2
- package/dist/skill/reference/components/page-content/examples/sections.tsx +81 -0
- package/dist/skill/reference/components/page-toolbar/COMPONENT.md +1 -1
- package/dist/skill/reference/components/segmented-control/COMPONENT.md +1 -0
- package/dist/skill/reference/components/select/COMPONENT.md +4 -2
- package/dist/skill/reference/components/select/examples/icon-only.tsx +38 -0
- package/dist/skill/reference/components/sparkline/COMPONENT.md +83 -30
- package/dist/skill/reference/components/sparkline/examples/compact.tsx +1 -1
- package/dist/skill/reference/components/sparkline/examples/curve.tsx +28 -0
- package/dist/skill/reference/components/sparkline/examples/gaps.tsx +33 -0
- package/dist/skill/reference/components/sparkline/examples/overview.tsx +11 -2
- package/dist/skill/reference/components/sparkline/examples/period.tsx +7 -2
- package/dist/skill/reference/components/sparkline/examples/reference.tsx +37 -0
- package/dist/skill/reference/components/sparkline/examples/variants.tsx +2 -2
- package/dist/skill/reference/components/tabs/examples/examples.module.css +0 -6
- package/dist/skill/reference/components/tabs/examples/in-drawer.tsx +11 -13
- package/dist/skill/reference/components/timeline/examples/examples.module.css +0 -8
- package/dist/skill/reference/components/timeline/examples/narrow.tsx +2 -2
- package/dist/skill/reference/components/timeline/examples/sizes.tsx +3 -3
- package/dist/skill/reference/components/timeline/examples/variants.tsx +4 -4
- package/dist/skill/reference/components/tooltip/COMPONENT.md +6 -4
- package/dist/skill/reference/components/tooltip/examples/placement.tsx +2 -1
- package/dist/skill/reference/components/video-note/COMPONENT.md +1 -1
- package/dist/skill/reference/components/voice-player/COMPONENT.md +1 -1
- package/dist/skill/reference/layout/app-header/examples/in-app-shell.tsx +2 -2
- package/dist/skill/reference/layout/app-shell/COMPONENT.md +1 -1
- package/dist/skill/reference/layout/app-shell/examples/footer.tsx +2 -2
- package/dist/skill/reference/layout/app-shell/examples/overview.tsx +2 -2
- package/dist/skill/reference/layout/app-shell/examples/template.tsx +2 -2
- package/dist/skill/reference/layout/bottom-nav/examples/floating-action.tsx +2 -2
- package/dist/skill/reference/layout/bottom-nav/examples/floating.tsx +2 -2
- package/dist/skill/reference/layout/bottom-nav/examples/in-app-shell.tsx +2 -2
- package/dist/skill/responsive.md +5 -3
- package/dist/skill/ux.md +145 -0
- package/dist/tokens/semantic.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/avatar/COMPONENT.md +4 -4
- package/src/components/avatar/examples/presence.tsx +1 -1
- package/src/components/avatar/examples/states.tsx +1 -1
- package/src/components/banner/COMPONENT.md +6 -6
- package/src/components/banner/examples/dismissible.tsx +22 -11
- package/src/components/banner/examples/examples.module.css +3 -3
- package/src/components/banner/examples/narrow.tsx +1 -1
- package/src/components/breadcrumb/COMPONENT.md +1 -1
- package/src/components/breadcrumb/examples/overflow.tsx +1 -1
- package/src/components/card/COMPONENT.md +5 -4
- package/src/components/card/examples/examples.module.css +0 -28
- package/src/components/card/examples/kpi-media.tsx +13 -11
- package/src/components/card/examples/narrow.tsx +1 -1
- package/src/components/card/examples/panel-chart.tsx +45 -22
- package/src/components/chart-frame/COMPONENT.md +10 -7
- package/src/components/chart-frame/examples/tooltip.tsx +20 -24
- package/src/components/chat/COMPONENT.md +3 -3
- package/src/components/chat/examples/search.tsx +1 -1
- package/src/components/chat-list/COMPONENT.md +1 -1
- package/src/components/checkbox/examples/indicator.tsx +24 -2
- package/src/components/color-picker/COMPONENT.md +2 -2
- package/src/components/color-swatches/COMPONENT.md +1 -0
- package/src/components/datepicker/COMPONENT.md +1 -0
- package/src/components/dnd/COMPONENT.md +3 -3
- package/src/components/field-list/COMPONENT.md +164 -0
- package/src/components/field-list/examples/base-row.tsx +76 -0
- package/src/components/field-list/examples/controlled.tsx +72 -0
- package/src/components/field-list/examples/errors.tsx +85 -0
- package/src/components/field-list/examples/examples.module.css +34 -0
- package/src/components/field-list/examples/limits.tsx +55 -0
- package/src/components/field-list/examples/locked.tsx +139 -0
- package/src/components/field-list/examples/narrow.tsx +68 -0
- package/src/components/field-list/examples/overview.tsx +66 -0
- package/src/components/field-list/examples/reorder.tsx +42 -0
- package/src/components/field-list/examples/sizes.tsx +42 -0
- package/src/components/field-list/examples/states.tsx +51 -0
- package/src/components/input/examples/examples.module.css +2 -7
- package/src/components/kanban/COMPONENT.md +13 -9
- package/src/components/kanban/examples/limits.tsx +2 -1
- package/src/components/kanban/examples/variants.tsx +16 -8
- package/src/components/list/COMPONENT.md +1 -1
- package/src/components/media-viewer/COMPONENT.md +2 -2
- package/src/components/message/COMPONENT.md +2 -2
- package/src/components/notification/COMPONENT.md +1 -0
- package/src/components/page-content/COMPONENT.md +70 -14
- package/src/components/page-content/examples/grid.tsx +107 -0
- package/src/components/page-content/examples/overview.tsx +2 -2
- package/src/components/page-content/examples/sections.tsx +81 -0
- package/src/components/page-toolbar/COMPONENT.md +1 -1
- package/src/components/segmented-control/COMPONENT.md +1 -0
- package/src/components/select/COMPONENT.md +4 -2
- package/src/components/select/examples/icon-only.tsx +38 -0
- package/src/components/sparkline/COMPONENT.md +83 -30
- package/src/components/sparkline/examples/compact.tsx +1 -1
- package/src/components/sparkline/examples/curve.tsx +28 -0
- package/src/components/sparkline/examples/gaps.tsx +33 -0
- package/src/components/sparkline/examples/overview.tsx +11 -2
- package/src/components/sparkline/examples/period.tsx +7 -2
- package/src/components/sparkline/examples/reference.tsx +37 -0
- package/src/components/sparkline/examples/variants.tsx +2 -2
- package/src/components/tabs/examples/examples.module.css +0 -6
- package/src/components/tabs/examples/in-drawer.tsx +11 -13
- package/src/components/timeline/examples/examples.module.css +0 -8
- package/src/components/timeline/examples/narrow.tsx +2 -2
- package/src/components/timeline/examples/sizes.tsx +3 -3
- package/src/components/timeline/examples/variants.tsx +4 -4
- package/src/components/tooltip/COMPONENT.md +6 -4
- package/src/components/tooltip/examples/placement.tsx +2 -1
- package/src/components/video-note/COMPONENT.md +1 -1
- package/src/components/voice-player/COMPONENT.md +1 -1
- package/src/layout/app-header/examples/in-app-shell.tsx +2 -2
- package/src/layout/app-shell/COMPONENT.md +1 -1
- package/src/layout/app-shell/examples/footer.tsx +2 -2
- package/src/layout/app-shell/examples/overview.tsx +2 -2
- package/src/layout/app-shell/examples/template.tsx +2 -2
- package/src/layout/bottom-nav/examples/floating-action.tsx +2 -2
- package/src/layout/bottom-nav/examples/floating.tsx +2 -2
- package/src/layout/bottom-nav/examples/in-app-shell.tsx +2 -2
- package/src/styles/theme-light.css +1 -0
package/dist/color-picker.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
ColorField,
|
|
5
5
|
ColorPicker,
|
|
6
6
|
parseColor
|
|
7
|
-
} from "./chunks/chunk-
|
|
8
|
-
import "./chunks/chunk-
|
|
7
|
+
} from "./chunks/chunk-P6ZO37JM.js";
|
|
8
|
+
import "./chunks/chunk-WXKRUVSE.js";
|
|
9
9
|
import "./chunks/chunk-Q3BFRQHZ.js";
|
|
10
10
|
export {
|
|
11
11
|
ColorField,
|
|
@@ -17,12 +17,15 @@ export type BannerRootProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
17
17
|
* page content column.
|
|
18
18
|
*/
|
|
19
19
|
placement?: "inset" | "page";
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Renders a close button and calls this on its click. The parent unmounts the banner; it closes
|
|
22
|
+
* up in place, and the parent moves focus somewhere sensible.
|
|
23
|
+
*/
|
|
21
24
|
onDismiss?: () => void;
|
|
22
25
|
labels?: Partial<BannerLabels>;
|
|
23
26
|
ref?: React.Ref<HTMLDivElement>;
|
|
24
27
|
};
|
|
25
|
-
declare function BannerRoot({ variant, tone, size, placement, onDismiss, labels, className, children, ...rest }: BannerRootProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare function BannerRoot({ variant, tone, size, placement, onDismiss, labels, className, children, ref, ...rest }: BannerRootProps): import("react/jsx-runtime").JSX.Element;
|
|
26
29
|
declare namespace BannerRoot {
|
|
27
30
|
var displayName: string;
|
|
28
31
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { type AnchorPoint } from "../../internal/ChartTooltip";
|
|
2
3
|
import type { PaletteColor, Tone } from "../../internal/states";
|
|
3
4
|
/** What the chart region shows: the plot, its Skeleton, the empty state or the load error. */
|
|
4
5
|
export type ChartFrameState = "ready" | "loading" | "empty" | "error";
|
|
@@ -137,8 +138,12 @@ declare namespace ChartFrameDelta {
|
|
|
137
138
|
var displayName: string;
|
|
138
139
|
}
|
|
139
140
|
export type ChartFramePlotProps = Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
140
|
-
/**
|
|
141
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Height of the plot area in px. Default 240, 160 when the panel is narrower than 30rem. `fill` —
|
|
143
|
+
* the plot takes the free height of a stretched panel (a `PageContent.Cell` with `rows`), the
|
|
144
|
+
* default height at least.
|
|
145
|
+
*/
|
|
146
|
+
height?: number | "fill";
|
|
142
147
|
/**
|
|
143
148
|
* Renders the chart at the measured size — for libraries that need explicit `width` and
|
|
144
149
|
* `height` (Recharts without `ResponsiveContainer`, Chart.js, visx). Gets every series with its
|
|
@@ -182,14 +187,22 @@ export type ChartFrameTooltipProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
182
187
|
label?: string;
|
|
183
188
|
/** One row per series at that point; rows of hidden series are left out. */
|
|
184
189
|
items: ChartFrameTooltipItem[];
|
|
190
|
+
/**
|
|
191
|
+
* A point of the plot in the coordinates `renderPlot` draws in (the pointer, or the point the
|
|
192
|
+
* arrow keys reached): the tooltip floats beside it like every kit layer — right of it, on the
|
|
193
|
+
* left only where the right has no room; `null` hides it. Without `point` the body renders in
|
|
194
|
+
* place for a chart library's tooltip hook, which positions it.
|
|
195
|
+
*/
|
|
196
|
+
point?: AnchorPoint | null;
|
|
185
197
|
ref?: React.Ref<HTMLDivElement>;
|
|
186
198
|
};
|
|
187
199
|
/**
|
|
188
|
-
* The kit's tooltip
|
|
189
|
-
* `
|
|
190
|
-
*
|
|
200
|
+
* The kit's chart tooltip: the point's label and rows of swatch · series name · value. With
|
|
201
|
+
* `point` it floats beside that point of the plot (a hand-drawn SVG chart); without it it is the
|
|
202
|
+
* body for a chart library's custom tooltip hook (Recharts `content`, visx `TooltipWithBounds`).
|
|
203
|
+
* It must render inside `ChartFrame.Root`.
|
|
191
204
|
*/
|
|
192
|
-
declare function ChartFrameTooltip({ label, items, className, ...rest }: ChartFrameTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
205
|
+
declare function ChartFrameTooltip({ label, items, point, className, ...rest }: ChartFrameTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
193
206
|
declare namespace ChartFrameTooltip {
|
|
194
207
|
var displayName: string;
|
|
195
208
|
}
|
|
@@ -26,8 +26,8 @@ export type ChatRootProps = Omit<React.HTMLAttributes<HTMLDivElement>, "defaultV
|
|
|
26
26
|
/** The search opened, changed its query or closed (`null`). */
|
|
27
27
|
onSearchChange?: (search: string | null) => void;
|
|
28
28
|
/**
|
|
29
|
-
* A message to bring into view and point at (a link, a notification):
|
|
30
|
-
*
|
|
29
|
+
* A message to bring into view and point at (a link, a notification): it
|
|
30
|
+
* blinks. A search's current match takes its place while the search is open.
|
|
31
31
|
*/
|
|
32
32
|
current?: string | null;
|
|
33
33
|
/** The other side is typing: the header's status turns into «печатает…» and the list ends with the typing bubble. */
|
|
@@ -23,8 +23,8 @@ export type ChatPinnedProps = Omit<React.HTMLAttributes<HTMLDivElement>, "childr
|
|
|
23
23
|
/** The shown pinned message changed: a press went on to the next older one. */
|
|
24
24
|
onValueChange?: (value: string) => void;
|
|
25
25
|
/**
|
|
26
|
-
* A press on the bar, after the chat has brought the message into view and blinked
|
|
27
|
-
*
|
|
26
|
+
* A press on the bar, after the chat has brought the message into view and blinked it:
|
|
27
|
+
* load it when it is not in the list yet. The bar then moves on to the next older
|
|
28
28
|
* pinned message, the oldest wraps to the newest.
|
|
29
29
|
*/
|
|
30
30
|
onSelect?: (value: string) => void;
|
|
@@ -64,7 +64,7 @@ export type MessageListProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
64
64
|
highlight?: string;
|
|
65
65
|
/** The messages whose text holds `highlight`, in list order (oldest first), as they change. */
|
|
66
66
|
onMatchesChange?: (values: readonly string[]) => void;
|
|
67
|
-
/** Receives the list's jump: bring a message into view and blink
|
|
67
|
+
/** Receives the list's jump: bring a message into view and blink it. */
|
|
68
68
|
revealRef?: React.Ref<((value: string) => void) | null>;
|
|
69
69
|
labels?: Partial<MessageListLabels>;
|
|
70
70
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -41,7 +41,7 @@ export type ChatContextValue = {
|
|
|
41
41
|
current: string | null;
|
|
42
42
|
/** The other side types. */
|
|
43
43
|
typing: boolean;
|
|
44
|
-
/** Brings a message into view and blinks
|
|
44
|
+
/** Brings a message into view and blinks it (a pinned message's press). */
|
|
45
45
|
jump: (value: string) => void;
|
|
46
46
|
/** `Chat.SearchButton`: the focus goes back to it when the search closes from its field. */
|
|
47
47
|
searchButtonRef: React.RefObject<HTMLButtonElement | null>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type FieldRootDomProps } from "../../internal/FieldFrame";
|
|
3
|
+
import type { ControlSize } from "../../internal/states";
|
|
4
|
+
export type FieldListLabels = {
|
|
5
|
+
/** `aria-label` of a row's remove button; `{row}` is the row's name. */
|
|
6
|
+
remove: string;
|
|
7
|
+
/** `aria-label` of a row's drag handle (`reorderable`); `{row}` is the row's name. */
|
|
8
|
+
reorder: string;
|
|
9
|
+
/** Name of a row without `getLabel` text; `{index}` counts from 1. */
|
|
10
|
+
row: string;
|
|
11
|
+
/** Name of a row with `getLabel` text; `{label}` is that text. */
|
|
12
|
+
namedRow: string;
|
|
13
|
+
/** Spoken name of the lock on a `getLocked` row of a list without `reorderable`. */
|
|
14
|
+
locked: string;
|
|
15
|
+
/** Text beside the disabled add button once the list holds `max` rows; `{max}` is the limit. */
|
|
16
|
+
maxReached: string;
|
|
17
|
+
};
|
|
18
|
+
/** Width of a column: the same track in the heading row and in every row. */
|
|
19
|
+
export type FieldListColumnWidth = "fill" | "compact" | "s" | "m";
|
|
20
|
+
export type FieldListColumn = {
|
|
21
|
+
/** Column heading, shown once above the rows; it names the field of this column in every row. */
|
|
22
|
+
label: string;
|
|
23
|
+
/**
|
|
24
|
+
* `fill` (default) shares the free width; `compact` fits an icon-only control (an icon Select,
|
|
25
|
+
* a swatch button, a checkbox); `s` a short value (a quantity, a code); `m` an amount or a date.
|
|
26
|
+
*/
|
|
27
|
+
width?: FieldListColumnWidth;
|
|
28
|
+
/** A red `*` after the heading (decorative): every field of the column is required. */
|
|
29
|
+
required?: boolean;
|
|
30
|
+
};
|
|
31
|
+
/** What `renderItem` gets beside the item: its place and the edits of its row. */
|
|
32
|
+
export type FieldListRow<T> = {
|
|
33
|
+
/** Place of the row, from 0. */
|
|
34
|
+
index: number;
|
|
35
|
+
/** Merges `patch` into the item and reports the new list through `onValueChange`. */
|
|
36
|
+
update: (patch: Partial<T>) => void;
|
|
37
|
+
/** Takes the row out of the list (the row's remove button does the same). */
|
|
38
|
+
remove: () => void;
|
|
39
|
+
};
|
|
40
|
+
export type FieldListProps<T extends object> = Omit<FieldRootDomProps, "onChange"> & {
|
|
41
|
+
/** The rows (controlled). */
|
|
42
|
+
value?: readonly T[];
|
|
43
|
+
/** The first rows (uncontrolled). */
|
|
44
|
+
defaultValue?: readonly T[];
|
|
45
|
+
/** The new list after an edit, an added, removed or moved row. */
|
|
46
|
+
onValueChange?: (value: T[]) => void;
|
|
47
|
+
/** Stable unique id of an item: the row key, the drag id. */
|
|
48
|
+
getId: (item: T) => string;
|
|
49
|
+
/** The columns, in the order of the cells `renderItem` returns. */
|
|
50
|
+
columns: readonly FieldListColumn[];
|
|
51
|
+
/**
|
|
52
|
+
* The cells of a row: one element per column, in column order (a fragment of fields). A cell
|
|
53
|
+
* holds a kit field without a `label`: the column heading names it.
|
|
54
|
+
*/
|
|
55
|
+
renderItem: (item: T, row: FieldListRow<T>) => React.ReactNode;
|
|
56
|
+
/** A new empty item; with it the list shows the add button under the rows. */
|
|
57
|
+
createItem?: () => T;
|
|
58
|
+
/** Text of the add button: what is added («Добавить позицию»). */
|
|
59
|
+
addLabel?: string;
|
|
60
|
+
/** The row's own text for its handle, remove button and drag announcements (its title field). */
|
|
61
|
+
getLabel?: (item: T) => string;
|
|
62
|
+
/** Rows that hold their place and cannot be removed: a lock in the lead column. */
|
|
63
|
+
getLocked?: (item: T) => boolean;
|
|
64
|
+
/** Rows move by a leading handle (drag, a touch hold, Alt + ↑ / ↓). */
|
|
65
|
+
reorderable?: boolean;
|
|
66
|
+
/** The fewest rows: remove buttons turn disabled at this count. Default 0. */
|
|
67
|
+
min?: number;
|
|
68
|
+
/** The most rows: the add button turns disabled with `labels.maxReached` beside it. */
|
|
69
|
+
max?: number;
|
|
70
|
+
/** Heading of the list (field label); omit it inside a `Fieldset` whose legend names the list. */
|
|
71
|
+
label?: React.ReactNode;
|
|
72
|
+
hint?: React.ReactNode;
|
|
73
|
+
/** A problem of the list as a whole («Добавьте хотя бы одну позицию»); a field's own goes on it. */
|
|
74
|
+
error?: React.ReactNode;
|
|
75
|
+
/** Every field, the handles and the buttons are disabled. */
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
/** Tier of the rows, the headings and the kit fields that read the host tier. Default `m`. */
|
|
78
|
+
size?: ControlSize;
|
|
79
|
+
labels?: Partial<FieldListLabels>;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* An editable list of records of the same shape: one row per record, the column headings shown
|
|
83
|
+
* once above the rows, a remove button per row, an add button under them, an optional handle to
|
|
84
|
+
* reorder and pinned rows. In a narrow container the rows stack into blocks and each field shows
|
|
85
|
+
* its own label.
|
|
86
|
+
*/
|
|
87
|
+
export declare function FieldList<T extends object>({ value: valueProp, defaultValue, onValueChange, getId, columns, renderItem, createItem, addLabel, getLabel, getLocked, reorderable, min, max, label, hint, error, disabled: disabledProp, size: sizeProp, labels: labelsProp, className, ref, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...rest }: FieldListProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
88
|
+
export declare namespace FieldList {
|
|
89
|
+
var displayName: string;
|
|
90
|
+
}
|
|
@@ -61,6 +61,8 @@ export type { EmptyPageActionsProps, EmptyPageDescriptionProps, EmptyPageIconPro
|
|
|
61
61
|
export { EmptyPage } from "./empty-page/EmptyPage";
|
|
62
62
|
export type { ExampleFrameLabels, ExampleFramePreviewLayout, ExampleFrameProps, ExampleFrameViewport, } from "./example-frame/ExampleFrame";
|
|
63
63
|
export { ExampleFrame } from "./example-frame/ExampleFrame";
|
|
64
|
+
export type { FieldListColumn, FieldListColumnWidth, FieldListLabels, FieldListProps, FieldListRow, } from "./field-list/FieldList";
|
|
65
|
+
export { FieldList } from "./field-list/FieldList";
|
|
64
66
|
export type { FieldsetProps } from "./fieldset/Fieldset";
|
|
65
67
|
export { Fieldset } from "./fieldset/Fieldset";
|
|
66
68
|
export type { FileUploadBodyProps, FileUploadDescriptionProps, FileUploadFile, FileUploadFormatBadgeProps, FileUploadIconProps, FileUploadItemActionsProps, FileUploadItemDescriptionProps, FileUploadItemNameProps, FileUploadItemPreviewProps, FileUploadItemProgressProps, FileUploadItemProps, FileUploadLabels, FileUploadLayout, FileUploadQueueProps, FileUploadQueueSource, FileUploadRootProps, FileUploadTitleProps, FileUploadTrigger, FileUploadVariant, } from "./file-upload/FileUpload";
|
|
@@ -102,7 +104,7 @@ export type { NotificationAction, NotificationCardProps, NotificationLabels, Not
|
|
|
102
104
|
export { NotificationCard } from "./notification/Notification";
|
|
103
105
|
export type { NotificationProviderProps } from "./notification/NotificationStore";
|
|
104
106
|
export { NotificationProvider, useNotifications, } from "./notification/NotificationStore";
|
|
105
|
-
export type { PageContentActionsProps, PageContentBackButtonProps, PageContentBodyProps, PageContentDescriptionMeasure, PageContentDescriptionProps, PageContentDetailProps, PageContentHeaderProps, PageContentLabels, PageContentListProps, PageContentMaxWidth, PageContentRootProps, PageContentSectionProps, PageContentSplitProps, PageContentTitleProps, } from "./page-content/PageContent";
|
|
107
|
+
export type { PageContentActionsProps, PageContentBackButtonProps, PageContentBodyProps, PageContentCellProps, PageContentCellRows, PageContentCellSpan, PageContentDescriptionMeasure, PageContentDescriptionProps, PageContentDetailProps, PageContentGridProps, PageContentHeaderProps, PageContentLabels, PageContentListProps, PageContentMaxWidth, PageContentPageProps, PageContentRootProps, PageContentSectionLayout, PageContentSectionProps, PageContentSplitProps, PageContentTitleProps, } from "./page-content/PageContent";
|
|
106
108
|
export { PageContent } from "./page-content/PageContent";
|
|
107
109
|
export type { PageToolbarActionsProps, PageToolbarChipsProps, PageToolbarRootProps, PageToolbarSectionsProps, PageToolbarToolsProps, PageToolbarViewProps, } from "./page-toolbar/PageToolbar";
|
|
108
110
|
export { PageToolbar } from "./page-toolbar/PageToolbar";
|
|
@@ -129,7 +129,7 @@ export type InputClearButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
129
129
|
* Trailing clear action. Render it only when the field has a value; clicking returns focus
|
|
130
130
|
* to the input after `onClick` runs (clear the value in `onClick`).
|
|
131
131
|
*/
|
|
132
|
-
declare function InputClearButton({
|
|
132
|
+
declare function InputClearButton({ onClick, ref, ...rest }: InputClearButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
133
133
|
declare namespace InputClearButton {
|
|
134
134
|
var displayName: string;
|
|
135
135
|
}
|
|
@@ -159,7 +159,7 @@ export type InputRevealButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonE
|
|
|
159
159
|
* Shows a `type="password"` field as text and back (`aria-pressed`). A pointer press keeps the focus
|
|
160
160
|
* in the field; the caret and selection survive the switch.
|
|
161
161
|
*/
|
|
162
|
-
declare function InputRevealButton({
|
|
162
|
+
declare function InputRevealButton({ onClick, onMouseDown, ref, ...rest }: InputRevealButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
163
163
|
declare namespace InputRevealButton {
|
|
164
164
|
var displayName: string;
|
|
165
165
|
}
|
|
@@ -34,8 +34,8 @@ export type KanbanColumnMove = {
|
|
|
34
34
|
};
|
|
35
35
|
/** What opened a card: a click on it, or Enter / Space on the focused card. */
|
|
36
36
|
export type KanbanItemClickEvent = React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
|
|
37
|
-
/** How columns stand on the board:
|
|
38
|
-
export type KanbanVariant = "
|
|
37
|
+
/** How columns stand on the board: bare columns of cards, or filled wells. */
|
|
38
|
+
export type KanbanVariant = "plain" | "line" | "well";
|
|
39
39
|
/** System strings of the board. `{token}` values are substituted. */
|
|
40
40
|
export type KanbanLabels = {
|
|
41
41
|
/** Spoken name of the count badge: `{count}`. */
|
|
@@ -113,7 +113,10 @@ export type KanbanRootProps<T> = Omit<React.HTMLAttributes<HTMLDivElement>, "chi
|
|
|
113
113
|
* shown under the carried card. The column turns `danger` before the release.
|
|
114
114
|
*/
|
|
115
115
|
canDrop?: (id: string, columnId: string) => boolean | string;
|
|
116
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* `plain`: no wells, the cards stand on the host under a filled header plate; `line`: no wells, a
|
|
118
|
+
* bare header over a faint line; `well`: every column is a filled well.
|
|
119
|
+
*/
|
|
117
120
|
variant?: KanbanVariant;
|
|
118
121
|
/** Columns show skeleton cards; the cards cross-fade in when it turns off. */
|
|
119
122
|
loading?: boolean;
|
|
@@ -14,11 +14,12 @@ declare function PageContentRoot({ maxWidth, fill, className, ...rest }: PageCon
|
|
|
14
14
|
declare namespace PageContentRoot {
|
|
15
15
|
var displayName: string;
|
|
16
16
|
}
|
|
17
|
-
export type
|
|
17
|
+
export type PageContentPageProps = React.HTMLAttributes<HTMLElement> & {
|
|
18
18
|
ref?: React.Ref<HTMLElement>;
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
declare
|
|
20
|
+
/** The whole page as a `<section>` (full panel width): `Header` with the one h1, then `Body`. */
|
|
21
|
+
declare function PageContentPage({ className, ...rest }: PageContentPageProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare namespace PageContentPage {
|
|
22
23
|
var displayName: string;
|
|
23
24
|
}
|
|
24
25
|
type DivProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
@@ -58,6 +59,53 @@ declare function PageContentBody({ className, ...rest }: PageContentBodyProps):
|
|
|
58
59
|
declare namespace PageContentBody {
|
|
59
60
|
var displayName: string;
|
|
60
61
|
}
|
|
62
|
+
/** Where the heading of a section stands: over its content or in a column beside it. */
|
|
63
|
+
export type PageContentSectionLayout = "stack" | "aside";
|
|
64
|
+
export type PageContentSectionProps = Omit<React.HTMLAttributes<HTMLElement>, "title"> & {
|
|
65
|
+
/** The visible heading of the section (an `h2`). */
|
|
66
|
+
label: React.ReactNode;
|
|
67
|
+
/** One line of context under the heading. */
|
|
68
|
+
description?: React.ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* `stack` — the heading over the content; `aside` — a heading column beside the content (a
|
|
71
|
+
* settings page), dropping above it once the content would get narrower than 30rem.
|
|
72
|
+
*/
|
|
73
|
+
layout?: PageContentSectionLayout;
|
|
74
|
+
ref?: React.Ref<HTMLElement>;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* A titled section of the page: an `h2` heading (with an optional description and
|
|
78
|
+
* `PageContent.Actions` at its end) over its content. Sections stand further apart than the plain
|
|
79
|
+
* blocks of the body, so the air shows where a new topic starts.
|
|
80
|
+
*/
|
|
81
|
+
declare function PageContentSection({ label, description, layout, className, children, ...rest }: PageContentSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
82
|
+
declare namespace PageContentSection {
|
|
83
|
+
var displayName: string;
|
|
84
|
+
}
|
|
85
|
+
export type PageContentGridProps = DivProps;
|
|
86
|
+
/**
|
|
87
|
+
* The grid of the page's tiles (KPI cards, charts, panels): 12 columns, one gap on both axes.
|
|
88
|
+
* Columns follow the grid's own width, so tiles fold on a narrow panel by themselves.
|
|
89
|
+
*/
|
|
90
|
+
declare function PageContentGrid({ className, ...rest }: PageContentGridProps): import("react/jsx-runtime").JSX.Element;
|
|
91
|
+
declare namespace PageContentGrid {
|
|
92
|
+
var displayName: string;
|
|
93
|
+
}
|
|
94
|
+
/** Columns of 12 a cell spans on a wide grid. */
|
|
95
|
+
export type PageContentCellSpan = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
96
|
+
/** Rows a cell spans. */
|
|
97
|
+
export type PageContentCellRows = 1 | 2 | 3 | 4;
|
|
98
|
+
export type PageContentCellProps = DivProps & {
|
|
99
|
+
/** Columns of 12 on a wide grid; a medium grid rounds to half or full, a narrow one to full. */
|
|
100
|
+
span?: PageContentCellSpan;
|
|
101
|
+
/** Rows the cell spans; its child fills the height. */
|
|
102
|
+
rows?: PageContentCellRows;
|
|
103
|
+
};
|
|
104
|
+
/** One tile place in `PageContent.Grid`; its child (a Card, a ChartFrame) fills it. */
|
|
105
|
+
declare function PageContentCell({ span, rows, className, ...rest }: PageContentCellProps): import("react/jsx-runtime").JSX.Element;
|
|
106
|
+
declare namespace PageContentCell {
|
|
107
|
+
var displayName: string;
|
|
108
|
+
}
|
|
61
109
|
export type PageContentLabels = {
|
|
62
110
|
/** Name of `PageContent.BackButton` (back from the detail to the list on a narrow split). */
|
|
63
111
|
back: string;
|
|
@@ -108,12 +156,15 @@ declare namespace PageContentBackButton {
|
|
|
108
156
|
}
|
|
109
157
|
export declare const PageContent: {
|
|
110
158
|
Root: typeof PageContentRoot;
|
|
111
|
-
|
|
159
|
+
Page: typeof PageContentPage;
|
|
112
160
|
Header: typeof PageContentHeader;
|
|
113
161
|
Actions: typeof PageContentActions;
|
|
114
162
|
Title: typeof PageContentTitle;
|
|
115
163
|
Description: typeof PageContentDescription;
|
|
116
164
|
Body: typeof PageContentBody;
|
|
165
|
+
Section: typeof PageContentSection;
|
|
166
|
+
Grid: typeof PageContentGrid;
|
|
167
|
+
Cell: typeof PageContentCell;
|
|
117
168
|
Split: typeof PageContentSplit;
|
|
118
169
|
List: typeof PageContentList;
|
|
119
170
|
Detail: typeof PageContentDetail;
|
|
@@ -1,37 +1,85 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { type SparklineCurve } from "./geometry";
|
|
3
|
+
export type { SparklineCurve };
|
|
2
4
|
export type SparklinePoint = {
|
|
3
5
|
/** Name of the point on the axis: a date, a week, a month («8 окт»). */
|
|
4
6
|
label: string;
|
|
5
|
-
|
|
7
|
+
/** `null`: no data for this point — the line breaks, the bar is absent. */
|
|
8
|
+
value: number | null;
|
|
6
9
|
};
|
|
7
10
|
export type SparklineLabels = {
|
|
8
11
|
/** Spoken value of the chosen point; `{label}` and `{value}` are replaced. */
|
|
9
12
|
point: string;
|
|
13
|
+
/** The period of a `sum` / `average` headline at rest; `{first}` and `{last}` are point labels. */
|
|
14
|
+
period: string;
|
|
15
|
+
/** Shown and spoken in place of the value of a point with no data. */
|
|
16
|
+
empty: string;
|
|
17
|
+
/** Description of the reference line; `{value}` is replaced. */
|
|
18
|
+
reference: string;
|
|
10
19
|
};
|
|
11
|
-
/**
|
|
12
|
-
|
|
20
|
+
/**
|
|
21
|
+
* `area`: a line over a gradient that fades to the bottom. `line`: the line alone (many trends side
|
|
22
|
+
* by side). `bars`: a bar per point from zero — up when positive, down when negative.
|
|
23
|
+
*/
|
|
24
|
+
export type SparklineVariant = "area" | "line" | "bars";
|
|
25
|
+
/**
|
|
26
|
+
* What the change badge compares the shown point with. `previous`: the point before it.
|
|
27
|
+
* `first`: the first point of the series (the change over the period). `none`: no badge.
|
|
28
|
+
*/
|
|
29
|
+
export type SparklineChange = "previous" | "first" | "none";
|
|
30
|
+
/**
|
|
31
|
+
* What the headline shows at rest. `latest`: the latest point (or `highlight`) — a level such as
|
|
32
|
+
* MRR, a price, a conversion. `sum`: the total of the period — a flow such as revenue or orders
|
|
33
|
+
* per day. `average`: the mean of the period.
|
|
34
|
+
*/
|
|
35
|
+
export type SparklineSummary = "latest" | "sum" | "average";
|
|
13
36
|
/**
|
|
14
37
|
* `default`: the headline (title · date, value · change) over the plot. `compact`: the plot alone at
|
|
15
38
|
* the height of an `xs` control, for a table cell or a list row.
|
|
16
39
|
*/
|
|
17
40
|
export type SparklineLayout = "default" | "compact";
|
|
18
|
-
|
|
19
|
-
/**
|
|
41
|
+
type SparklineRest = {
|
|
42
|
+
/** Default `latest`. */
|
|
43
|
+
summary?: "latest";
|
|
44
|
+
/**
|
|
45
|
+
* Index of the point at rest (the current month): the headline shows it when nobody scrubs,
|
|
46
|
+
* and `bars` draw the other bars quieter. Default: the latest point with a value.
|
|
47
|
+
*/
|
|
48
|
+
highlight?: number;
|
|
49
|
+
} | {
|
|
50
|
+
summary: "sum" | "average";
|
|
51
|
+
/** A total or a mean is no point: there is nothing to highlight at rest. */
|
|
52
|
+
highlight?: never;
|
|
53
|
+
};
|
|
54
|
+
export type SparklineProps = Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & SparklineRest & {
|
|
55
|
+
/** Points in order, oldest first; two present points in a row draw a line. */
|
|
20
56
|
data: SparklinePoint[];
|
|
21
57
|
/**
|
|
22
58
|
* Visible title above the value and the accessible name of the chart; with `layout="compact"`
|
|
23
59
|
* only the accessible name.
|
|
24
60
|
*/
|
|
25
61
|
label: string;
|
|
26
|
-
/** Default `
|
|
62
|
+
/** Default `area`. */
|
|
27
63
|
variant?: SparklineVariant;
|
|
64
|
+
/** Shape of the line between points (`area`, `line`). Default `smooth`. */
|
|
65
|
+
curve?: SparklineCurve;
|
|
28
66
|
/** Default `default`. */
|
|
29
67
|
layout?: SparklineLayout;
|
|
68
|
+
/** What a scrubbed point's change badge compares with. Default `previous`. */
|
|
69
|
+
change?: SparklineChange;
|
|
30
70
|
/**
|
|
31
|
-
*
|
|
32
|
-
* `
|
|
71
|
+
* The same summary for the previous period («прошлые 30 дней»): the change badge at rest compares
|
|
72
|
+
* the headline with it. Without it a `sum` / `average` headline shows no change at rest.
|
|
33
73
|
*/
|
|
34
|
-
|
|
74
|
+
compareTo?: number;
|
|
75
|
+
/**
|
|
76
|
+
* The value axis spans at least `min`…`max`: one scale for several sparklines (a table column)
|
|
77
|
+
* or a meaningful floor. Data outside widens the scale, never gets cut.
|
|
78
|
+
*/
|
|
79
|
+
min?: number;
|
|
80
|
+
max?: number;
|
|
81
|
+
/** A dashed horizontal line at this value: a plan, a target, an average. */
|
|
82
|
+
reference?: number;
|
|
35
83
|
/**
|
|
36
84
|
* The series is on its way: Skeletons of the value, the date and the plot, which cross-fade into
|
|
37
85
|
* the data. The title stays; the root is `aria-busy`.
|
|
@@ -43,10 +91,11 @@ export type SparklineProps = Omit<React.HTMLAttributes<HTMLDivElement>, "childre
|
|
|
43
91
|
ref?: React.Ref<HTMLDivElement>;
|
|
44
92
|
};
|
|
45
93
|
/**
|
|
46
|
-
* A small chart with its headline: the value at rest (the latest point
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
94
|
+
* A small chart with its headline: the value at rest (the latest point, `highlight`, or the period's
|
|
95
|
+
* total or mean — `summary`), its change and its date or period. Scrubbing (pointer, touch, or the arrow keys on the chart) shows any point; the
|
|
96
|
+
* header follows instantly, the trend arrow turns, and leaving glides back to the point at rest.
|
|
97
|
+
* The line is a monotone curve (`curve`), `null` values break it; `bars` draw signed values from a
|
|
98
|
+
* zero line; a tooltip beside the scrubbed point shows its value and date. `layout="compact"` is
|
|
99
|
+
* the plot alone (a table cell).
|
|
51
100
|
*/
|
|
52
|
-
export declare function Sparkline({ data, label, variant, layout, highlight, loading, formatValue, labels: labelsProp, className, ref, ...rest }: SparklineProps): import("react/jsx-runtime").JSX.Element;
|
|
101
|
+
export declare function Sparkline({ data, label, variant, curve, layout, change, summary, highlight, compareTo, min, max, reference, loading, formatValue, labels: labelsProp, className, ref, ...rest }: SparklineProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** `smooth`: a monotone cubic through every point. `linear`: straight segments. `step`: a level per point, changing halfway between points. */
|
|
2
|
+
export type SparklineCurve = "smooth" | "linear" | "step";
|
|
3
|
+
export type SparklineScale = {
|
|
4
|
+
/** Lower and upper end of the value axis. */
|
|
5
|
+
lo: number;
|
|
6
|
+
hi: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The value axis: the data, widened to `min` / `max` (a scale shared by several sparklines), the
|
|
10
|
+
* reference line and — for bars — zero. Data outside `min` / `max` widens the scale instead of
|
|
11
|
+
* being cut.
|
|
12
|
+
*/
|
|
13
|
+
export declare function scaleOf(values: readonly (number | null)[], extra: readonly (number | undefined)[]): SparklineScale;
|
|
14
|
+
/** Share of the height from the top (0) to the bottom (1); a flat series sits in the middle. */
|
|
15
|
+
export declare function yOf({ lo, hi }: SparklineScale, value: number): number;
|
|
16
|
+
/** Runs of consecutive present points: a `null` value breaks the line. */
|
|
17
|
+
export declare function runsOf(values: readonly (number | null)[]): number[][];
|
|
18
|
+
export type SparklinePaths = {
|
|
19
|
+
/** The line: one subpath per run of two or more points. */
|
|
20
|
+
line: string;
|
|
21
|
+
/** The area under the line, closed down to the bottom edge. */
|
|
22
|
+
area: string;
|
|
23
|
+
/** Points standing alone between gaps: drawn as dots, a path would not show them. */
|
|
24
|
+
lone: number[];
|
|
25
|
+
};
|
|
26
|
+
export declare function pathsOf(values: readonly (number | null)[], x: (i: number) => number, y: (value: number) => number, curve: SparklineCurve): SparklinePaths;
|
|
@@ -2,8 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import { type PositionAlign, type PositionSide } from "../../hooks/usePosition";
|
|
3
3
|
import type { ControlSize } from "../../internal/states";
|
|
4
4
|
export type TooltipSide = PositionSide;
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The anchored-layer vocabulary. A tooltip centres on its trigger by default (foundation §8);
|
|
7
|
+
* `auto` lines it up with the trigger edge that has more room beyond it, as a growing panel does.
|
|
8
|
+
*/
|
|
9
|
+
export type TooltipAlign = PositionAlign;
|
|
7
10
|
export type TooltipProviderProps = {
|
|
8
11
|
/** Show delay in ms for every Tooltip.Root inside. */
|
|
9
12
|
delayDuration?: number;
|
|
@@ -65,6 +65,17 @@ export type PositionOptions = {
|
|
|
65
65
|
offsetToken?: string;
|
|
66
66
|
/** Closest the arrow may come to a layer corner, read from the layer; writes `--float-arrow`. */
|
|
67
67
|
arrowInset?: (layer: HTMLElement) => number;
|
|
68
|
+
/**
|
|
69
|
+
* A point inside the anchor (px from its top-left corner) to place the layer against instead of
|
|
70
|
+
* the whole anchor — the pointer over a chart (Floating UI's virtual element). It moves with the
|
|
71
|
+
* anchor on scroll; every new point re-places the layer before paint. Flipping stays the same:
|
|
72
|
+
* the layer keeps `side` until it has no room there.
|
|
73
|
+
*/
|
|
74
|
+
anchorPoint?: AnchorPoint | null;
|
|
75
|
+
};
|
|
76
|
+
export type AnchorPoint = {
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
68
79
|
};
|
|
69
80
|
export type Position = {
|
|
70
81
|
/** The side the layer opened on (after flipping). */
|
|
@@ -76,8 +87,8 @@ export type Position = {
|
|
|
76
87
|
* Places a floating layer (`position: fixed`) next to its anchor and follows the anchor while
|
|
77
88
|
* `enabled`: before paint, again on the next frame (fonts), and on window resize, scroll of any
|
|
78
89
|
* scrolling ancestor of the anchor, visual-viewport changes and size changes of the layer or the
|
|
79
|
-
* anchor. Shared by every anchored layer (Popover, Dropdown, Select, TagSelect, Tooltip
|
|
80
|
-
* portaled layer reaches the DOM one commit after its
|
|
81
|
-
* `attachLayer` instead of reading the ref too early.
|
|
90
|
+
* anchor. Shared by every anchored layer (Popover, Dropdown, Select, TagSelect, Tooltip, and the
|
|
91
|
+
* chart tooltip at a point — `anchorPoint`). A portaled layer reaches the DOM one commit after its
|
|
92
|
+
* owner, so the subscription waits for `attachLayer` instead of reading the ref too early.
|
|
82
93
|
*/
|
|
83
|
-
export declare function usePosition(enabled: boolean, anchorRef: React.RefObject<HTMLElement | null>, layerRef: React.RefObject<HTMLElement | null>, { side: preferredSide, align, matchAnchorWidth, offsetToken, arrowInset, }?: PositionOptions): Position;
|
|
94
|
+
export declare function usePosition(enabled: boolean, anchorRef: React.RefObject<HTMLElement | null>, layerRef: React.RefObject<HTMLElement | null>, { side: preferredSide, align, matchAnchorWidth, offsetToken, arrowInset, anchorPoint, }?: PositionOptions): Position;
|