@lanfermann/ui 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/accordion.d.ts +11 -3
- package/dist/components/accordion/accordion.js +15 -10
- package/dist/components/action-bar/action-bar.d.ts +60 -0
- package/dist/components/action-bar/action-bar.js +117 -0
- package/dist/components/alert/alert.d.ts +1 -1
- package/dist/components/alert/alert.js +3 -17
- package/dist/components/alert-dialog/alert-dialog.d.ts +1 -1
- package/dist/components/app-shell/app-shell.d.ts +33 -0
- package/dist/components/app-shell/app-shell.js +93 -0
- package/dist/components/attachment/attachment.d.ts +51 -0
- package/dist/components/attachment/attachment.js +255 -0
- package/dist/components/attachment/kinds.d.ts +7 -0
- package/dist/components/attachment/kinds.js +142 -0
- package/dist/components/avatar/avatar.d.ts +14 -4
- package/dist/components/avatar/avatar.js +57 -13
- package/dist/components/avatar-group/avatar-group.d.ts +33 -0
- package/dist/components/avatar-group/avatar-group.js +110 -0
- package/dist/components/avatar-group/people.d.ts +12 -0
- package/dist/components/avatar-group/people.js +24 -0
- package/dist/components/badge/badge.d.ts +9 -3
- package/dist/components/badge/badge.js +21 -6
- package/dist/components/banner/banner.d.ts +39 -0
- package/dist/components/banner/banner.js +149 -0
- package/dist/components/button-group/button-group-variants.d.ts +4 -3
- package/dist/components/button-group/button-group-variants.js +13 -12
- package/dist/components/button-group/button-group.d.ts +3 -3
- package/dist/components/button-group/button-group.js +3 -3
- package/dist/components/card/card.d.ts +20 -4
- package/dist/components/card/card.js +32 -6
- package/dist/components/checkbox-card/checkbox-card.d.ts +21 -0
- package/dist/components/checkbox-card/checkbox-card.js +50 -0
- package/dist/components/chip/chip-group.d.ts +15 -0
- package/dist/components/chip/chip-group.js +44 -0
- package/dist/components/chip/chip-variants.d.ts +6 -0
- package/dist/components/chip/chip-variants.js +28 -0
- package/dist/components/chip/chip.d.ts +39 -0
- package/dist/components/chip/chip.js +71 -0
- package/dist/components/code-block/code-copy.d.ts +3 -11
- package/dist/components/code-block/code-copy.js +15 -62
- package/dist/components/code-block/code-keys.js +10 -22
- package/dist/components/collapsible/collapsible.js +7 -3
- package/dist/components/combobox/combobox.d.ts +53 -3
- package/dist/components/combobox/combobox.js +204 -20
- package/dist/components/command/command.d.ts +131 -0
- package/dist/components/command/command.js +335 -0
- package/dist/components/consent/consent-card.js +365 -0
- package/dist/components/consent/consent-embed.d.ts +21 -0
- package/dist/components/consent/consent-embed.js +111 -0
- package/dist/components/consent/consent-labels.d.ts +70 -0
- package/dist/components/consent/consent-labels.js +61 -0
- package/dist/components/consent/consent-record.d.ts +95 -0
- package/dist/components/consent/consent-record.js +112 -0
- package/dist/components/consent/consent-store.d.ts +26 -0
- package/dist/components/consent/consent-store.js +240 -0
- package/dist/components/consent/consent.d.ts +86 -0
- package/dist/components/consent/consent.js +306 -0
- package/dist/components/container/container.d.ts +1 -1
- package/dist/components/context-menu/context-menu.d.ts +23 -0
- package/dist/components/context-menu/context-menu.js +50 -0
- package/dist/components/conversation/conversation.d.ts +45 -0
- package/dist/components/conversation/conversation.js +295 -0
- package/dist/components/conversation/stick.js +23 -0
- package/dist/components/copy-button/copy-button.d.ts +50 -0
- package/dist/components/copy-button/copy-button.js +65 -0
- package/dist/components/copy-page/copy-page.d.ts +4 -4
- package/dist/components/copy-page/copy-page.js +16 -36
- package/dist/components/copy-pill/copy-pill.js +1 -1
- package/dist/components/description-list/description-list.d.ts +32 -0
- package/dist/components/description-list/description-list.js +51 -0
- package/dist/components/empty/empty.d.ts +38 -0
- package/dist/components/empty/empty.js +57 -0
- package/dist/components/field/field.js +1 -1
- package/dist/components/file-upload/file-upload.d.ts +96 -0
- package/dist/components/file-upload/file-upload.js +347 -0
- package/dist/components/file-upload/files.d.ts +39 -0
- package/dist/components/file-upload/files.js +74 -0
- package/dist/components/grow/grow.d.ts +15 -3
- package/dist/components/grow/grow.js +24 -9
- package/dist/components/heading/heading.d.ts +1 -1
- package/dist/components/icon/icon.d.ts +1 -1
- package/dist/components/input/input.js +1 -1
- package/dist/components/menu/menu.d.ts +20 -8
- package/dist/components/menu/menu.js +51 -29
- package/dist/components/message/message.d.ts +81 -0
- package/dist/components/message/message.js +208 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +7 -1
- package/dist/components/navigation-menu/navigation-menu.js +11 -4
- package/dist/components/otp-field/otp-field.d.ts +37 -0
- package/dist/components/otp-field/otp-field.js +161 -0
- package/dist/components/pagination/pagination.d.ts +50 -0
- package/dist/components/pagination/pagination.js +188 -0
- package/dist/components/prompt-input/keys.js +15 -0
- package/dist/components/prompt-input/prompt-input.d.ts +89 -0
- package/dist/components/prompt-input/prompt-input.js +331 -0
- package/dist/components/radio-card/radio-card.d.ts +23 -0
- package/dist/components/radio-card/radio-card.js +49 -0
- package/dist/components/rolling-number/rolling-number.d.ts +30 -0
- package/dist/components/rolling-number/rolling-number.js +149 -0
- package/dist/components/seam/seam.d.ts +1 -1
- package/dist/components/secret-field/secret-field.d.ts +53 -0
- package/dist/components/secret-field/secret-field.js +121 -0
- package/dist/components/section/section.d.ts +1 -1
- package/dist/components/segmented-control/segmented-control.js +29 -16
- package/dist/components/select/select.d.ts +5 -4
- package/dist/components/select/select.js +16 -11
- package/dist/components/shortcut/shortcut.d.ts +46 -0
- package/dist/components/shortcut/shortcut.js +87 -0
- package/dist/components/sidebar/sidebar-context.js +16 -0
- package/dist/components/sidebar/sidebar.d.ts +161 -0
- package/dist/components/sidebar/sidebar.js +588 -0
- package/dist/components/site-header/site-header.js +1 -1
- package/dist/components/skeleton/loaded.d.ts +21 -0
- package/dist/components/skeleton/loaded.js +57 -0
- package/dist/components/skeleton/skeleton.d.ts +43 -0
- package/dist/components/skeleton/skeleton.js +48 -0
- package/dist/components/sources/source-list.d.ts +17 -0
- package/dist/components/sources/source-list.js +26 -0
- package/dist/components/sources/sources.d.ts +45 -0
- package/dist/components/sources/sources.js +167 -0
- package/dist/components/stat/stat.d.ts +59 -0
- package/dist/components/stat/stat.js +112 -0
- package/dist/components/steps/steps.d.ts +57 -0
- package/dist/components/steps/steps.js +134 -0
- package/dist/components/table/table.d.ts +18 -9
- package/dist/components/table/table.js +21 -13
- package/dist/components/text/text.d.ts +1 -1
- package/dist/components/theme-switch/theme-switch.js +1 -1
- package/dist/components/time-field/time-field.js +7 -6
- package/dist/components/timeline/timeline.d.ts +45 -0
- package/dist/components/timeline/timeline.js +86 -0
- package/dist/components/toast/toast.js +10 -26
- package/dist/components/toggle/toggle.d.ts +27 -0
- package/dist/components/toggle/toggle.js +61 -0
- package/dist/components/toggle-group/toggle-group.d.ts +27 -0
- package/dist/components/toggle-group/toggle-group.js +38 -0
- package/dist/components/toolbar/toolbar-context.js +12 -0
- package/dist/components/toolbar/toolbar.d.ts +52 -0
- package/dist/components/toolbar/toolbar.js +105 -0
- package/dist/components/trace/trace.d.ts +2 -1
- package/dist/components/trace/trace.js +15 -27
- package/dist/index.d.ts +46 -3
- package/dist/index.js +44 -3
- package/dist/internal/arriving-pieces.js +56 -0
- package/dist/internal/arriving.js +171 -0
- package/dist/internal/avatar-cut.d.ts +15 -0
- package/dist/internal/avatar-cut.js +83 -0
- package/dist/internal/choice-card.d.ts +15 -0
- package/dist/internal/choice-card.js +81 -0
- package/dist/internal/clipboard.js +37 -0
- package/dist/internal/copy.js +58 -0
- package/dist/internal/disclosure.js +15 -3
- package/dist/internal/field.js +24 -4
- package/dist/internal/glyphs.js +26 -1
- package/dist/internal/key-tip.js +18 -0
- package/dist/internal/list-mark.js +39 -0
- package/dist/internal/live-list.js +41 -0
- package/dist/internal/number-places.js +157 -0
- package/dist/internal/picker-sheet.js +1 -1
- package/dist/internal/presence-dot.js +24 -0
- package/dist/internal/presence.js +104 -0
- package/dist/internal/rail-mark.d.ts +3 -0
- package/dist/internal/rail-mark.js +33 -0
- package/dist/internal/rule.js +2 -1
- package/dist/internal/status-icon.js +22 -0
- package/dist/internal/tile.js +23 -0
- package/dist/internal/travelling-mark.js +204 -0
- package/dist/lib/cn.js +10 -0
- package/dist/lib/shortcut.d.ts +11 -0
- package/dist/lib/shortcut.js +165 -0
- package/package.json +1 -1
- package/src/styles/accordion.css +176 -0
- package/src/styles/action-bar.css +28 -0
- package/src/styles/assistant.css +83 -0
- package/src/styles/avatar.css +24 -0
- package/src/styles/consent.css +65 -0
- package/src/styles/copy.css +12 -11
- package/src/styles/depth.css +120 -4
- package/src/styles/marks.css +20 -2
- package/src/styles/motion.css +3 -0
- package/src/styles/rail.css +49 -0
- package/src/styles/rolling-number.css +94 -0
- package/src/styles/segmented.css +14 -7
- package/src/styles/steps.css +98 -0
- package/src/styles/timeline.css +48 -0
- package/src/styles/travel.css +36 -0
- package/src/styles.css +10 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
export type GrowProps = ComponentProps<"div"
|
|
2
|
+
export type GrowProps = ComponentProps<"div"> & {
|
|
3
|
+
/**
|
|
4
|
+
* Classes for the box inside, which holds the content and is the one that is measured. The
|
|
5
|
+
* layout of what the block holds (a flex row, a padding) goes here: on the block itself a
|
|
6
|
+
* padding or a minimum height would be added to the measured height and the block would
|
|
7
|
+
* never come to rest at it.
|
|
8
|
+
*/
|
|
9
|
+
contentClassName?: string;
|
|
10
|
+
};
|
|
3
11
|
/**
|
|
4
12
|
* A block whose height follows what it holds. When something joins it (a step of a `Trace`, a
|
|
5
13
|
* paragraph that arrives, the next tab's panel), it eases to its new height on `settle`, and
|
|
@@ -11,10 +19,14 @@ export type GrowProps = ComponentProps<"div">;
|
|
|
11
19
|
* then learns of it a frame late.
|
|
12
20
|
*
|
|
13
21
|
* At rest it is a plain block of the content's height that clips nothing. It clips only while
|
|
14
|
-
* it moves, so a line that joins at its foot is uncovered as the
|
|
22
|
+
* it moves, and only above and below, so a line that joins at its foot is uncovered as the
|
|
23
|
+
* block opens. What paints outside its content there (the shadow of a card, an accent edge, a
|
|
24
|
+
* halo) would be cut for the length of the move and come back at its end: give it room inside
|
|
25
|
+
* the block and take the room back outside, `className="-my-5" contentClassName="py-5"`. To
|
|
26
|
+
* the sides nothing is cut. From rest it does
|
|
15
27
|
* not animate the first height, a resize of the window, or a height that something inside is
|
|
16
28
|
* already animating (an opening `Collapsible`): then it simply follows.
|
|
17
29
|
* Already on its way, it takes a new height as its goal from where it stands. Under reduced
|
|
18
30
|
* motion it always follows.
|
|
19
31
|
*/
|
|
20
|
-
export declare function Grow({ className, children, ref, ...props }: GrowProps): import("react").JSX.Element;
|
|
32
|
+
export declare function Grow({ className, contentClassName, children, ref, ...props }: GrowProps): import("react").JSX.Element;
|
|
@@ -29,13 +29,17 @@ function heightMoving(box) {
|
|
|
29
29
|
* then learns of it a frame late.
|
|
30
30
|
*
|
|
31
31
|
* At rest it is a plain block of the content's height that clips nothing. It clips only while
|
|
32
|
-
* it moves, so a line that joins at its foot is uncovered as the
|
|
32
|
+
* it moves, and only above and below, so a line that joins at its foot is uncovered as the
|
|
33
|
+
* block opens. What paints outside its content there (the shadow of a card, an accent edge, a
|
|
34
|
+
* halo) would be cut for the length of the move and come back at its end: give it room inside
|
|
35
|
+
* the block and take the room back outside, `className="-my-5" contentClassName="py-5"`. To
|
|
36
|
+
* the sides nothing is cut. From rest it does
|
|
33
37
|
* not animate the first height, a resize of the window, or a height that something inside is
|
|
34
38
|
* already animating (an opening `Collapsible`): then it simply follows.
|
|
35
39
|
* Already on its way, it takes a new height as its goal from where it stands. Under reduced
|
|
36
40
|
* motion it always follows.
|
|
37
41
|
*/
|
|
38
|
-
function Grow({ className, children, ref, ...props }) {
|
|
42
|
+
function Grow({ className, contentClassName, children, ref, ...props }) {
|
|
39
43
|
const box = useRef(null);
|
|
40
44
|
const content = useRef(null);
|
|
41
45
|
useLayoutEffect(() => {
|
|
@@ -43,21 +47,31 @@ function Grow({ className, children, ref, ...props }) {
|
|
|
43
47
|
const inner = content.current;
|
|
44
48
|
if (!outer || !inner) return;
|
|
45
49
|
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
46
|
-
/** The content's height when it was last measured
|
|
50
|
+
/** The content's height when it was last measured. */
|
|
47
51
|
let height = inner.offsetHeight;
|
|
48
|
-
|
|
52
|
+
/**
|
|
53
|
+
* The frame in which the window last changed its size. The browser runs the resize event and
|
|
54
|
+
* then the size observers in the same frame, so a measure in that frame was caused by the
|
|
55
|
+
* resize. (A width remembered from the last measure went stale when the window was resized
|
|
56
|
+
* without this content changing, and the next real change was then taken for a resize.)
|
|
57
|
+
*/
|
|
58
|
+
const frame = () => Number(document.timeline.currentTime ?? performance.now());
|
|
59
|
+
let resizedIn = NaN;
|
|
60
|
+
const resized = () => {
|
|
61
|
+
resizedIn = frame();
|
|
62
|
+
};
|
|
63
|
+
window.addEventListener("resize", resized);
|
|
49
64
|
const rest = () => {
|
|
50
65
|
delete outer.dataset.moving;
|
|
51
66
|
outer.style.height = "";
|
|
52
67
|
};
|
|
53
68
|
const observer = new ResizeObserver(() => {
|
|
54
69
|
const nextHeight = inner.offsetHeight;
|
|
55
|
-
const nextWidth = window.innerWidth;
|
|
56
70
|
const moving = outer.dataset.moving !== void 0;
|
|
57
71
|
const from = moving ? outer.getBoundingClientRect().height : height;
|
|
58
|
-
const
|
|
72
|
+
const resizing = frame() === resizedIn;
|
|
73
|
+
const follow = reduced.matches || resizing || movingInside(inner);
|
|
59
74
|
height = nextHeight;
|
|
60
|
-
width = nextWidth;
|
|
61
75
|
if (Math.abs(nextHeight - from) < .5) {
|
|
62
76
|
if (moving) rest();
|
|
63
77
|
return;
|
|
@@ -83,6 +97,7 @@ function Grow({ className, children, ref, ...props }) {
|
|
|
83
97
|
outer.addEventListener("transitioncancel", arrived);
|
|
84
98
|
return () => {
|
|
85
99
|
observer.disconnect();
|
|
100
|
+
window.removeEventListener("resize", resized);
|
|
86
101
|
outer.removeEventListener("transitionend", arrived);
|
|
87
102
|
outer.removeEventListener("transitioncancel", arrived);
|
|
88
103
|
rest();
|
|
@@ -91,12 +106,12 @@ function Grow({ className, children, ref, ...props }) {
|
|
|
91
106
|
return /* @__PURE__ */ jsx("div", {
|
|
92
107
|
ref: mergeRefs(box, ref),
|
|
93
108
|
"data-slot": "grow",
|
|
94
|
-
className: cn("transition-
|
|
109
|
+
className: cn("[transition:height_var(--transition-duration-spring-settle)_var(--ease-spring-settle),var(--grow-also,visibility_0s)] data-moving:overflow-y-clip", className),
|
|
95
110
|
...props,
|
|
96
111
|
children: /* @__PURE__ */ jsx("div", {
|
|
97
112
|
ref: content,
|
|
98
113
|
"data-slot": "grow-content",
|
|
99
|
-
className: "flow-root",
|
|
114
|
+
className: cn("flow-root", contentClassName),
|
|
100
115
|
children
|
|
101
116
|
})
|
|
102
117
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VariantProps } from "class-variance-authority";
|
|
2
1
|
import { ComponentProps } from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const headingVariants: (props?: ({
|
|
4
4
|
size?: "label" | "section" | "sub" | "title" | "display" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IconSvgElement } from "@hugeicons/react";
|
|
2
1
|
import { SVGProps } from "react";
|
|
2
|
+
import { IconSvgElement } from "@hugeicons/react";
|
|
3
3
|
export type IconProps = Omit<SVGProps<SVGSVGElement>, "ref" | "stroke" | "strokeWidth"> & {
|
|
4
4
|
/** An icon from `@hugeicons/core-free-icons`, e.g. `Search01Icon`. */
|
|
5
5
|
icon: IconSvgElement;
|
|
@@ -3,8 +3,8 @@ import { bareControl, fieldFace, fieldText } from "../../internal/field.js";
|
|
|
3
3
|
import { FieldShellContext } from "../../internal/field-context.js";
|
|
4
4
|
import { mergeClassName } from "../../lib/cn.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import { cva } from "class-variance-authority";
|
|
7
6
|
import { useContext } from "react";
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
8
8
|
import { Input as Input$1 } from "@base-ui/react/input";
|
|
9
9
|
// src/components/input/input.tsx
|
|
10
10
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IconSvgElement } from "../icon/icon.js";
|
|
1
2
|
import { Menu as Menu$1 } from "@base-ui/react/menu";
|
|
2
3
|
/** A list of actions or places behind one trigger. */
|
|
3
4
|
export declare const Menu: typeof Menu$1.Root;
|
|
@@ -8,19 +9,30 @@ export type MenuContentProps = Menu$1.Popup.Props & Pick<Menu$1.Positioner.Props
|
|
|
8
9
|
* (lines between groups, no boxes). Items take the concentric radius of the sheet.
|
|
9
10
|
*/
|
|
10
11
|
export declare function MenuContent({ className, side, align, sideOffset, alignOffset, ...props }: MenuContentProps): import("react").JSX.Element;
|
|
11
|
-
|
|
12
|
+
/**
|
|
13
|
+
* A 16px symbol before a row's words, muted, darkening with the row's highlight. Give every row
|
|
14
|
+
* of a group one or none, so the words start on one line.
|
|
15
|
+
*/
|
|
16
|
+
type WithIcon = {
|
|
17
|
+
icon?: IconSvgElement;
|
|
18
|
+
};
|
|
19
|
+
export declare function MenuItem({ className, icon, children, ...props }: Menu$1.Item.Props & WithIcon): import("react").JSX.Element;
|
|
12
20
|
/** A place rather than an action: a real link, so it can be opened in a new tab. */
|
|
13
|
-
export declare function MenuLinkItem({ className, ...props }: Menu$1.LinkItem.Props): import("react").JSX.Element;
|
|
14
|
-
/**
|
|
15
|
-
|
|
21
|
+
export declare function MenuLinkItem({ className, icon, children, ...props }: Menu$1.LinkItem.Props & WithIcon): import("react").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* An option that is on or off. The menu stays open, so several can be set in one go. Its words
|
|
24
|
+
* start at the row's edge like every other row's; when it is on, the tick stands at the right.
|
|
25
|
+
*/
|
|
26
|
+
export declare function MenuCheckboxItem({ className, icon, children, ...props }: Menu$1.CheckboxItem.Props & WithIcon): import("react").JSX.Element;
|
|
16
27
|
export declare const MenuRadioGroup: import("react").NamedExoticComponent<Omit<import("@base-ui/react").ContextMenuRadioGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
-
/** One of several: the chosen one carries the disc. */
|
|
18
|
-
export declare function MenuRadioItem({ className, children, ...props }: Menu$1.RadioItem.Props): import("react").JSX.Element;
|
|
28
|
+
/** One of several: the chosen one carries the disc at the right. */
|
|
29
|
+
export declare function MenuRadioItem({ className, icon, children, ...props }: Menu$1.RadioItem.Props & WithIcon): import("react").JSX.Element;
|
|
19
30
|
export declare function MenuSeparator({ className, ...props }: Menu$1.Separator.Props): import("react").JSX.Element;
|
|
20
31
|
export declare const MenuGroup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
32
|
export declare function MenuGroupLabel({ className, ...props }: Menu$1.GroupLabel.Props): import("react").JSX.Element;
|
|
22
33
|
/** A menu inside a menu. One level is the limit: deeper and people lose their way. */
|
|
23
34
|
export declare const MenuSub: typeof Menu$1.SubmenuRoot;
|
|
24
|
-
export declare function MenuSubTrigger({ className, children, ...props }: Menu$1.SubmenuTrigger.Props): import("react").JSX.Element;
|
|
35
|
+
export declare function MenuSubTrigger({ className, icon, children, ...props }: Menu$1.SubmenuTrigger.Props & WithIcon): import("react").JSX.Element;
|
|
25
36
|
/** The submenu's sheet. It overlaps its parent by the sheet's padding, so the rows line up. */
|
|
26
|
-
export declare function MenuSubContent({ className, sideOffset, alignOffset, ...props }: MenuContentProps): import("react").JSX.Element;
|
|
37
|
+
export declare function MenuSubContent({ className, sideOffset, alignOffset, ...props }: MenuContentProps): import("react").JSX.Element;
|
|
38
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useGround } from "../ground/ground.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Icon } from "../icon/icon.js";
|
|
4
|
+
import { ChevronRightGlyph } from "../../internal/glyphs.js";
|
|
5
|
+
import { ListMark } from "../../internal/list-mark.js";
|
|
4
6
|
import { listGroupLabel, listItem, listSeparator, listSheet, popupMotion } from "../../internal/popup.js";
|
|
5
7
|
import { mergeClassName } from "../../lib/cn.js";
|
|
6
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -39,49 +41,61 @@ function MenuContent({ className, side = "bottom", align = "start", sideOffset =
|
|
|
39
41
|
})
|
|
40
42
|
}) });
|
|
41
43
|
}
|
|
42
|
-
function
|
|
43
|
-
return /* @__PURE__ */ jsx(
|
|
44
|
+
function RowIcon({ icon }) {
|
|
45
|
+
return icon ? /* @__PURE__ */ jsx(Icon, {
|
|
46
|
+
icon,
|
|
47
|
+
size: 16,
|
|
48
|
+
className: "text-fg-muted group-data-disabled:text-on-disabled group-data-highlighted:text-fg"
|
|
49
|
+
}) : null;
|
|
50
|
+
}
|
|
51
|
+
function MenuItem({ className, icon, children, ...props }) {
|
|
52
|
+
return /* @__PURE__ */ jsxs(Menu$1.Item, {
|
|
44
53
|
"data-slot": "menu-item",
|
|
45
|
-
className: mergeClassName(listItem, className),
|
|
46
|
-
...props
|
|
54
|
+
className: mergeClassName(["group", listItem], className),
|
|
55
|
+
...props,
|
|
56
|
+
children: [/* @__PURE__ */ jsx(RowIcon, { icon }), children]
|
|
47
57
|
});
|
|
48
58
|
}
|
|
49
59
|
/** A place rather than an action: a real link, so it can be opened in a new tab. */
|
|
50
|
-
function MenuLinkItem({ className, ...props }) {
|
|
51
|
-
return /* @__PURE__ */
|
|
60
|
+
function MenuLinkItem({ className, icon, children, ...props }) {
|
|
61
|
+
return /* @__PURE__ */ jsxs(Menu$1.LinkItem, {
|
|
52
62
|
"data-slot": "menu-item",
|
|
53
|
-
className: mergeClassName(listItem, className),
|
|
54
|
-
...props
|
|
63
|
+
className: mergeClassName(["group", listItem], className),
|
|
64
|
+
...props,
|
|
65
|
+
children: [/* @__PURE__ */ jsx(RowIcon, { icon }), children]
|
|
55
66
|
});
|
|
56
67
|
}
|
|
57
|
-
/**
|
|
58
|
-
|
|
68
|
+
/**
|
|
69
|
+
* An option that is on or off. The menu stays open, so several can be set in one go. Its words
|
|
70
|
+
* start at the row's edge like every other row's; when it is on, the tick stands at the right.
|
|
71
|
+
*/
|
|
72
|
+
function MenuCheckboxItem({ className, icon, children, ...props }) {
|
|
59
73
|
return /* @__PURE__ */ jsxs(Menu$1.CheckboxItem, {
|
|
60
74
|
"data-slot": "menu-checkbox-item",
|
|
61
|
-
className: mergeClassName(listItem, className),
|
|
75
|
+
className: mergeClassName(["group", listItem], className),
|
|
62
76
|
...props,
|
|
63
|
-
children: [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsx(RowIcon, { icon }),
|
|
79
|
+
children,
|
|
80
|
+
/* @__PURE__ */ jsx(ListMark, {
|
|
81
|
+
kind: "multiple",
|
|
82
|
+
className: "ml-auto"
|
|
69
83
|
})
|
|
70
|
-
|
|
84
|
+
]
|
|
71
85
|
});
|
|
72
86
|
}
|
|
73
87
|
const MenuRadioGroup = Menu$1.RadioGroup;
|
|
74
|
-
/** One of several: the chosen one carries the disc. */
|
|
75
|
-
function MenuRadioItem({ className, children, ...props }) {
|
|
88
|
+
/** One of several: the chosen one carries the disc at the right. */
|
|
89
|
+
function MenuRadioItem({ className, icon, children, ...props }) {
|
|
76
90
|
return /* @__PURE__ */ jsxs(Menu$1.RadioItem, {
|
|
77
91
|
"data-slot": "menu-radio-item",
|
|
78
92
|
className: mergeClassName(["group", listItem], className),
|
|
79
93
|
...props,
|
|
80
|
-
children: [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsx(RowIcon, { icon }),
|
|
96
|
+
children,
|
|
97
|
+
/* @__PURE__ */ jsx(ListMark, { className: "ml-auto" })
|
|
98
|
+
]
|
|
85
99
|
});
|
|
86
100
|
}
|
|
87
101
|
function MenuSeparator({ className, ...props }) {
|
|
@@ -101,12 +115,20 @@ function MenuGroupLabel({ className, ...props }) {
|
|
|
101
115
|
}
|
|
102
116
|
/** A menu inside a menu. One level is the limit: deeper and people lose their way. */
|
|
103
117
|
const MenuSub = Menu$1.SubmenuRoot;
|
|
104
|
-
function MenuSubTrigger({ className, children, ...props }) {
|
|
118
|
+
function MenuSubTrigger({ className, icon, children, ...props }) {
|
|
105
119
|
return /* @__PURE__ */ jsxs(Menu$1.SubmenuTrigger, {
|
|
106
120
|
"data-slot": "menu-sub-trigger",
|
|
107
|
-
className: mergeClassName([
|
|
121
|
+
className: mergeClassName([
|
|
122
|
+
"group",
|
|
123
|
+
listItem,
|
|
124
|
+
"data-popup-open:bg-hover"
|
|
125
|
+
], className),
|
|
108
126
|
...props,
|
|
109
|
-
children: [
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsx(RowIcon, { icon }),
|
|
129
|
+
children,
|
|
130
|
+
/* @__PURE__ */ jsx(ChevronRightGlyph, { className: "ml-auto text-fg-muted" })
|
|
131
|
+
]
|
|
110
132
|
});
|
|
111
133
|
}
|
|
112
134
|
/** The submenu's sheet. It overlaps its parent by the sheet's padding, so the rows line up. */
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ButtonProps } from "../button/button.js";
|
|
2
|
+
import { IconSvgElement } from "../icon/icon.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
/** Who wrote a message: the assistant, or the person using it. */
|
|
5
|
+
export type MessageFrom = "assistant" | "user";
|
|
6
|
+
export type MessageProps = ComponentProps<"article"> & {
|
|
7
|
+
from: MessageFrom;
|
|
8
|
+
/** The answer is still being written: its text arrives, and its actions wait. */
|
|
9
|
+
streaming?: boolean;
|
|
10
|
+
/** Who wrote it, for assistive tech: „KI“ for the assistant, „Du“ for the person. */
|
|
11
|
+
label?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* One message of a conversation with an assistant. The answer is read, so it is flat prose on
|
|
15
|
+
* the page, with no bubble and no avatar; the person's own words are someone else's to the
|
|
16
|
+
* page, so they stand on the tint at the right, in the bubble of a `Quote` (Justin,
|
|
17
|
+
* 2026-11-19). Put a `MessageContent` inside, and under an answer its `MessageActions`.
|
|
18
|
+
*
|
|
19
|
+
* In a `Conversation`, a message of the person's that joins rises into place, and brings the
|
|
20
|
+
* view back to the foot: whoever sends a prompt wants to see the answer.
|
|
21
|
+
*/
|
|
22
|
+
export declare function Message({ from, streaming, label, className, children, ...props }: MessageProps): import("react").JSX.Element;
|
|
23
|
+
export type MessageContentProps = ComponentProps<"div">;
|
|
24
|
+
/**
|
|
25
|
+
* What a message says. In an answer it is `Prose`: hand over the rendered Markdown (the
|
|
26
|
+
* elements, not a component that renders the Markdown itself), and while the message is
|
|
27
|
+
* `streaming` what is new fades in, a few words at a time; code and pictures arrive whole.
|
|
28
|
+
* The person's words stand as they were typed, line breaks kept.
|
|
29
|
+
*/
|
|
30
|
+
export declare function MessageContent({ className, children, ref, ...props }: MessageContentProps): import("react").JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* The keys under an answer: copy (`CopyButton`), the verdict (`MessageFeedback`), „Noch
|
|
33
|
+
* einmal“ (`MessageAction`). They are always there, not only under the pointer, so a finger and
|
|
34
|
+
* the keyboard reach them. While the answer is written they wait unseen, and come in together
|
|
35
|
+
* once it is complete; their room is kept, so nothing moves when they do.
|
|
36
|
+
*/
|
|
37
|
+
export declare function MessageActions({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
38
|
+
export type MessageActionProps = Omit<ButtonProps, "iconOnly" | "variant" | "size" | "children" | "aria-label"> & {
|
|
39
|
+
/** What the key does, as a button says it: its name and its tooltip. */
|
|
40
|
+
label: string;
|
|
41
|
+
icon: IconSvgElement;
|
|
42
|
+
/**
|
|
43
|
+
* A motion that is in the symbol: `turn` for a circling arrow („Noch einmal“), which turns a
|
|
44
|
+
* little under the pointer and once round when pressed. Every other symbol only darkens.
|
|
45
|
+
*/
|
|
46
|
+
iconMotion?: "turn";
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* A quiet key under an answer, with a symbol and a tooltip: „Noch einmal“, „Teilen“. Its name
|
|
50
|
+
* is its tooltip, worded like a button.
|
|
51
|
+
*/
|
|
52
|
+
export declare function MessageAction({ label, icon, iconMotion, className, onClick, ...props }: MessageActionProps): import("react").JSX.Element;
|
|
53
|
+
/** The person's verdict on an answer: good, bad, or none yet. */
|
|
54
|
+
export type MessageVerdict = "good" | "bad" | null;
|
|
55
|
+
export type MessageFeedbackProps = Omit<ComponentProps<"div">, "defaultValue" | "onChange"> & {
|
|
56
|
+
value?: MessageVerdict;
|
|
57
|
+
defaultValue?: MessageVerdict;
|
|
58
|
+
onValueChange?: (value: MessageVerdict) => void;
|
|
59
|
+
goodLabel?: string;
|
|
60
|
+
badLabel?: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Two keys that stay down, thumbs up and thumbs down: at most one is on, and pressed again it
|
|
64
|
+
* is taken back. The thumb that is on is drawn in the text colour, without the grey square of a
|
|
65
|
+
* quiet key that is down; the other stays muted (Justin, 2026-11-20). Its symbol nods into it,
|
|
66
|
+
* tilted and small at first; one that is taken back, or gives way to the other, tilts back the
|
|
67
|
+
* other way and settles. A verdict that is there on load does not move.
|
|
68
|
+
*/
|
|
69
|
+
export declare function MessageFeedback({ value: valueProp, defaultValue, onValueChange, goodLabel, badLabel, className, ...props }: MessageFeedbackProps): import("react").JSX.Element;
|
|
70
|
+
export type MessageErrorProps = Omit<ComponentProps<"div">, "children"> & {
|
|
71
|
+
/** What happened, as a sentence. */
|
|
72
|
+
children?: ReactNode;
|
|
73
|
+
/** Asks for the answer again. Without it there is no key. */
|
|
74
|
+
onRetry?: () => void;
|
|
75
|
+
retryLabel?: string;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* An answer that failed: the danger symbol, what happened in a sentence, and the next step as
|
|
79
|
+
* a key. Nothing shakes and no colour flashes; the words carry it.
|
|
80
|
+
*/
|
|
81
|
+
export declare function MessageError({ children, onRetry, retryLabel, className, ...props }: MessageErrorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "../button/button.js";
|
|
3
|
+
import { useConversation } from "../conversation/conversation.js";
|
|
4
|
+
import { Icon } from "../icon/icon.js";
|
|
5
|
+
import { Toggle } from "../toggle/toggle.js";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../tooltip/tooltip.js";
|
|
7
|
+
import { useArrivingText } from "../../internal/arriving.js";
|
|
8
|
+
import { useLive } from "../../internal/presence.js";
|
|
9
|
+
import { cn } from "../../lib/cn.js";
|
|
10
|
+
import { mergeRefs } from "../../lib/merge-refs.js";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { createContext, useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
13
|
+
import { Alert02Icon, RefreshIcon, ThumbsDownIcon, ThumbsUpIcon } from "@hugeicons/core-free-icons";
|
|
14
|
+
// src/components/message/message.tsx
|
|
15
|
+
const MessageContext = createContext({
|
|
16
|
+
from: "assistant",
|
|
17
|
+
streaming: false
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* One message of a conversation with an assistant. The answer is read, so it is flat prose on
|
|
21
|
+
* the page, with no bubble and no avatar; the person's own words are someone else's to the
|
|
22
|
+
* page, so they stand on the tint at the right, in the bubble of a `Quote` (Justin,
|
|
23
|
+
* 2026-11-19). Put a `MessageContent` inside, and under an answer its `MessageActions`.
|
|
24
|
+
*
|
|
25
|
+
* In a `Conversation`, a message of the person's that joins rises into place, and brings the
|
|
26
|
+
* view back to the foot: whoever sends a prompt wants to see the answer.
|
|
27
|
+
*/
|
|
28
|
+
function Message({ from, streaming = false, label = from === "user" ? "Du" : "KI", className, children, ...props }) {
|
|
29
|
+
const conversation = useConversation();
|
|
30
|
+
const joined = useRef(conversation?.live ?? false);
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
if (from === "user" && joined.current) conversation?.toLatest();
|
|
33
|
+
}, []);
|
|
34
|
+
return /* @__PURE__ */ jsx(MessageContext, {
|
|
35
|
+
value: {
|
|
36
|
+
from,
|
|
37
|
+
streaming
|
|
38
|
+
},
|
|
39
|
+
children: /* @__PURE__ */ jsx("article", {
|
|
40
|
+
"data-slot": "message",
|
|
41
|
+
"data-from": from,
|
|
42
|
+
"data-streaming": streaming ? "" : void 0,
|
|
43
|
+
"aria-label": label,
|
|
44
|
+
className: cn("flex min-w-0 flex-col", from === "user" ? ["items-end gap-2", "transition-[opacity,translate] spring-settle in-data-live:starting:translate-y-(--motion-enter-offset) in-data-live:starting:opacity-0"] : "items-start gap-3", className),
|
|
45
|
+
...props,
|
|
46
|
+
children
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* What a message says. In an answer it is `Prose`: hand over the rendered Markdown (the
|
|
52
|
+
* elements, not a component that renders the Markdown itself), and while the message is
|
|
53
|
+
* `streaming` what is new fades in, a few words at a time; code and pictures arrive whole.
|
|
54
|
+
* The person's words stand as they were typed, line breaks kept.
|
|
55
|
+
*/
|
|
56
|
+
function MessageContent({ className, children, ref, ...props }) {
|
|
57
|
+
const { from, streaming } = useContext(MessageContext);
|
|
58
|
+
const box = useRef(null);
|
|
59
|
+
const conversation = useConversation();
|
|
60
|
+
const content = useArrivingText(children, {
|
|
61
|
+
streaming: from === "assistant" && streaming,
|
|
62
|
+
box
|
|
63
|
+
});
|
|
64
|
+
const wasStreaming = useRef(streaming);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (wasStreaming.current && !streaming && from === "assistant") {
|
|
67
|
+
const text = box.current?.textContent?.trim();
|
|
68
|
+
if (text) conversation?.announce(text);
|
|
69
|
+
}
|
|
70
|
+
wasStreaming.current = streaming;
|
|
71
|
+
}, [
|
|
72
|
+
streaming,
|
|
73
|
+
from,
|
|
74
|
+
conversation
|
|
75
|
+
]);
|
|
76
|
+
if (from === "user") return /* @__PURE__ */ jsx("div", {
|
|
77
|
+
ref: mergeRefs(box, ref),
|
|
78
|
+
"data-slot": "message-content",
|
|
79
|
+
className: cn("max-w-[min(80%,36rem)] text-base break-words whitespace-pre-wrap text-fg", "rounded-2xl rounded-tr-sm bg-tint px-4 py-2.5", className),
|
|
80
|
+
...props,
|
|
81
|
+
children
|
|
82
|
+
});
|
|
83
|
+
return /* @__PURE__ */ jsx("div", {
|
|
84
|
+
ref: mergeRefs(box, ref),
|
|
85
|
+
"data-slot": "message-content",
|
|
86
|
+
"aria-busy": streaming || void 0,
|
|
87
|
+
className: cn("prose w-full max-w-[42rem] min-w-0", className),
|
|
88
|
+
...props,
|
|
89
|
+
children: content
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The keys under an answer: copy (`CopyButton`), the verdict (`MessageFeedback`), „Noch
|
|
94
|
+
* einmal“ (`MessageAction`). They are always there, not only under the pointer, so a finger and
|
|
95
|
+
* the keyboard reach them. While the answer is written they wait unseen, and come in together
|
|
96
|
+
* once it is complete; their room is kept, so nothing moves when they do.
|
|
97
|
+
*/
|
|
98
|
+
function MessageActions({ className, ...props }) {
|
|
99
|
+
const { streaming } = useContext(MessageContext);
|
|
100
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx("div", {
|
|
101
|
+
"data-slot": "message-actions",
|
|
102
|
+
inert: streaming,
|
|
103
|
+
className: cn("-ml-1 flex items-center gap-0.5", "transition-opacity spring-settle in-data-live:starting:opacity-0", streaming && "opacity-0", className),
|
|
104
|
+
...props
|
|
105
|
+
}) });
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A quiet key under an answer, with a symbol and a tooltip: „Noch einmal“, „Teilen“. Its name
|
|
109
|
+
* is its tooltip, worded like a button.
|
|
110
|
+
*/
|
|
111
|
+
function MessageAction({ label, icon, iconMotion, className, onClick, ...props }) {
|
|
112
|
+
const [turns, setTurns] = useState(0);
|
|
113
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx(Button, {
|
|
114
|
+
iconOnly: true,
|
|
115
|
+
size: "sm",
|
|
116
|
+
variant: "quiet",
|
|
117
|
+
"aria-label": label,
|
|
118
|
+
"data-slot": "message-action",
|
|
119
|
+
className: cn("group/action text-fg-muted hover:text-fg", className),
|
|
120
|
+
onClick: (event) => {
|
|
121
|
+
if (iconMotion === "turn") setTurns((count) => count + 1);
|
|
122
|
+
onClick?.(event);
|
|
123
|
+
},
|
|
124
|
+
...props,
|
|
125
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
126
|
+
icon,
|
|
127
|
+
size: 14,
|
|
128
|
+
style: iconMotion === "turn" ? { "--turns": turns } : void 0,
|
|
129
|
+
className: cn(iconMotion === "turn" && "motion-safe:rotate-[calc(var(--turns)*360deg)] motion-safe:transition-[rotate] motion-safe:spring-glide motion-safe:group-hover/action:rotate-[calc(var(--turns)*360deg+40deg)]")
|
|
130
|
+
})
|
|
131
|
+
}) }), /* @__PURE__ */ jsx(TooltipContent, { children: label })] });
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Two keys that stay down, thumbs up and thumbs down: at most one is on, and pressed again it
|
|
135
|
+
* is taken back. The thumb that is on is drawn in the text colour, without the grey square of a
|
|
136
|
+
* quiet key that is down; the other stays muted (Justin, 2026-11-20). Its symbol nods into it,
|
|
137
|
+
* tilted and small at first; one that is taken back, or gives way to the other, tilts back the
|
|
138
|
+
* other way and settles. A verdict that is there on load does not move.
|
|
139
|
+
*/
|
|
140
|
+
function MessageFeedback({ value: valueProp, defaultValue = null, onValueChange, goodLabel = "Gute Antwort", badLabel = "Schlechte Antwort", className, ...props }) {
|
|
141
|
+
const [own, setOwn] = useState(defaultValue);
|
|
142
|
+
const value = valueProp === void 0 ? own : valueProp;
|
|
143
|
+
const live = useLive();
|
|
144
|
+
const choose = (next) => {
|
|
145
|
+
setOwn(next);
|
|
146
|
+
onValueChange?.(next);
|
|
147
|
+
};
|
|
148
|
+
const key = (verdict, label, icon) => {
|
|
149
|
+
const on = value === verdict;
|
|
150
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx(Toggle, {
|
|
151
|
+
iconOnly: true,
|
|
152
|
+
size: "sm",
|
|
153
|
+
variant: "quiet",
|
|
154
|
+
"aria-label": label,
|
|
155
|
+
pressed: on,
|
|
156
|
+
onPressedChange: (pressed) => choose(pressed ? verdict : null),
|
|
157
|
+
className: "data-pressed:bg-transparent data-pressed:hover:bg-hover",
|
|
158
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
159
|
+
icon,
|
|
160
|
+
size: 14,
|
|
161
|
+
"data-slot": "message-feedback-symbol",
|
|
162
|
+
style: { "--lean": verdict === "good" ? -1 : 1 },
|
|
163
|
+
className: cn("transition-[scale,rotate,translate] spring-seat", on ? "in-data-live:motion-safe:starting:translate-y-[calc(var(--lean)*1.5px)] in-data-live:motion-safe:starting:scale-75 in-data-live:motion-safe:starting:rotate-[calc(var(--lean)*14deg)]" : "in-data-live:motion-safe:starting:scale-90 in-data-live:motion-safe:starting:rotate-[calc(var(--lean)*-8deg)]")
|
|
164
|
+
}, on ? "on" : "off")
|
|
165
|
+
}) }), /* @__PURE__ */ jsx(TooltipContent, { children: label })] });
|
|
166
|
+
};
|
|
167
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
168
|
+
role: "group",
|
|
169
|
+
"aria-label": `${goodLabel} oder ${badLabel}`,
|
|
170
|
+
"data-slot": "message-feedback",
|
|
171
|
+
"data-live": live ? "" : void 0,
|
|
172
|
+
className: cn("flex items-center gap-0.5", className),
|
|
173
|
+
...props,
|
|
174
|
+
children: [key("good", goodLabel, ThumbsUpIcon), key("bad", badLabel, ThumbsDownIcon)]
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* An answer that failed: the danger symbol, what happened in a sentence, and the next step as
|
|
179
|
+
* a key. Nothing shakes and no colour flashes; the words carry it.
|
|
180
|
+
*/
|
|
181
|
+
function MessageError({ children = "Die Antwort ist abgebrochen.", onRetry, retryLabel = "Noch einmal", className, ...props }) {
|
|
182
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
183
|
+
role: "alert",
|
|
184
|
+
"data-slot": "message-error",
|
|
185
|
+
className: cn("flex items-start gap-2.5 text-control text-fg", className),
|
|
186
|
+
...props,
|
|
187
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
188
|
+
icon: Alert02Icon,
|
|
189
|
+
size: 16,
|
|
190
|
+
className: "mt-[0.1875rem] shrink-0 text-danger"
|
|
191
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
192
|
+
className: "flex min-w-0 flex-col items-start gap-2.5",
|
|
193
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
194
|
+
className: "text-pretty",
|
|
195
|
+
children
|
|
196
|
+
}), onRetry && /* @__PURE__ */ jsxs(Button, {
|
|
197
|
+
size: "sm",
|
|
198
|
+
variant: "secondary",
|
|
199
|
+
onClick: onRetry,
|
|
200
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
201
|
+
icon: RefreshIcon,
|
|
202
|
+
size: 14
|
|
203
|
+
}), retryLabel]
|
|
204
|
+
})]
|
|
205
|
+
})]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
export { Message, MessageAction, MessageActions, MessageContent, MessageError, MessageFeedback };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IconSvgElement } from "../icon/icon.js";
|
|
1
2
|
import { ComponentProps } from "react";
|
|
2
3
|
import { NavigationMenu as NavigationMenu$1 } from "@base-ui/react/navigation-menu";
|
|
3
4
|
export type NavigationMenuProps = NavigationMenu$1.Root.Props & Pick<NavigationMenu$1.Positioner.Props, "align" | "sideOffset">;
|
|
@@ -30,12 +31,17 @@ export type NavigationMenuLinkProps = NavigationMenu$1.Link.Props & {
|
|
|
30
31
|
* link in the row itself, which looks like the entries beside it and opens nothing.
|
|
31
32
|
*/
|
|
32
33
|
kind?: "page" | "entry";
|
|
34
|
+
/**
|
|
35
|
+
* The symbol of a page, in a small tile before its title and line. Give every page of a panel
|
|
36
|
+
* one or none. Without a line under the title, rows with tiles make a compact grid of places.
|
|
37
|
+
*/
|
|
38
|
+
icon?: IconSvgElement;
|
|
33
39
|
};
|
|
34
40
|
/**
|
|
35
41
|
* A link in the navigation menu. Mark the page the reader is on with `active`. For a router's
|
|
36
42
|
* link, pass it as `render`: `<NavigationMenuLink render={<NextLink href="/preise" />}>`.
|
|
37
43
|
*/
|
|
38
|
-
export declare function NavigationMenuLink({ kind, className, ...props }: NavigationMenuLinkProps): import("react").JSX.Element;
|
|
44
|
+
export declare function NavigationMenuLink({ kind, icon, className, children, ...props }: NavigationMenuLinkProps): import("react").JSX.Element;
|
|
39
45
|
/** The name of the page a row leads to. */
|
|
40
46
|
export declare function NavigationMenuLinkTitle({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
41
47
|
/** One line that says what is on that page, without a full stop. */
|