@lanfermann/ui 0.6.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 +2 -1
- package/dist/components/action-bar/action-bar.js +3 -2
- package/dist/components/attachment/attachment.d.ts +6 -1
- package/dist/components/attachment/attachment.js +64 -31
- package/dist/components/attachment/kinds.js +44 -2
- 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 +9 -1
- package/dist/components/card/card.js +14 -2
- package/dist/components/checkbox-card/checkbox-card.js +3 -2
- package/dist/components/collapsible/collapsible.js +7 -3
- package/dist/components/combobox/combobox.d.ts +3 -1
- package/dist/components/combobox/combobox.js +45 -30
- package/dist/components/copy-page/copy-page.d.ts +4 -4
- package/dist/components/copy-page/copy-page.js +9 -19
- package/dist/components/menu/menu.d.ts +20 -8
- package/dist/components/menu/menu.js +51 -29
- package/dist/components/message/message.d.ts +10 -2
- package/dist/components/message/message.js +20 -8
- 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.js +46 -11
- package/dist/components/radio-card/radio-card.js +3 -2
- package/dist/components/segmented-control/segmented-control.js +29 -16
- package/dist/components/select/select.d.ts +4 -3
- package/dist/components/select/select.js +15 -10
- package/dist/components/stat/stat.d.ts +3 -1
- package/dist/components/stat/stat.js +3 -1
- package/dist/components/steps/steps.js +5 -2
- package/dist/components/time-field/time-field.js +6 -5
- package/dist/components/toggle/toggle.d.ts +5 -2
- package/dist/components/toggle/toggle.js +13 -5
- package/dist/components/toolbar/toolbar.d.ts +9 -2
- package/dist/components/toolbar/toolbar.js +18 -5
- package/dist/components/trace/trace.js +1 -1
- package/dist/internal/choice-card.js +27 -11
- package/dist/internal/disclosure.js +15 -3
- package/dist/internal/key-tip.js +18 -0
- package/dist/internal/list-mark.js +39 -0
- package/dist/internal/number-places.js +4 -3
- package/dist/internal/rule.js +2 -1
- package/dist/internal/tile.js +23 -0
- package/dist/lib/cn.js +10 -4
- package/package.json +1 -1
- package/src/styles/accordion.css +176 -0
- package/src/styles/depth.css +104 -32
- package/src/styles/motion.css +3 -0
- package/src/styles/segmented.css +14 -7
- package/src/styles.css +1 -0
|
@@ -5,11 +5,12 @@ import { Grow } from "../grow/grow.js";
|
|
|
5
5
|
import { Icon } from "../icon/icon.js";
|
|
6
6
|
import { bareControl, fieldShell, fieldShellGrowing, fieldShellGrowingSize, fieldShellSize, fieldText, focusFieldControl } from "../../internal/field.js";
|
|
7
7
|
import { ChevronDownGlyph, CloseGlyph, PlusGlyph } from "../../internal/glyphs.js";
|
|
8
|
+
import { ListMark, listTint } from "../../internal/list-mark.js";
|
|
8
9
|
import { listGroupLabel, listItem, listSeparator, listSheet, popupMotion } from "../../internal/popup.js";
|
|
9
10
|
import { placeInRow, placeProps, useLive, usePresence } from "../../internal/presence.js";
|
|
10
11
|
import { cn, mergeClassName } from "../../lib/cn.js";
|
|
11
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { useRef, useState } from "react";
|
|
13
|
+
import { createContext, useContext, useRef, useState } from "react";
|
|
13
14
|
import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
|
|
14
15
|
// src/components/combobox/combobox.tsx
|
|
15
16
|
function isOption(value) {
|
|
@@ -18,6 +19,8 @@ function isOption(value) {
|
|
|
18
19
|
function isCreateOption(value) {
|
|
19
20
|
return isOption(value) && "create" in value;
|
|
20
21
|
}
|
|
22
|
+
/** Whether several options can be chosen: their rows then carry the tick, not the disc. */
|
|
23
|
+
const MultipleContext = createContext(false);
|
|
21
24
|
/**
|
|
22
25
|
* A select you can type into: for lists too long to scan (a customer out of two hundred), where
|
|
23
26
|
* people know what they are looking for. Typing filters the list; only an entry of the list can
|
|
@@ -69,24 +72,27 @@ function Combobox({ autoHighlight = true, filter, locale, items, multiple, onCre
|
|
|
69
72
|
const value = multiple ? option === void 0 ? others : [...others, option] : option ?? null;
|
|
70
73
|
onValueChange?.(value, details);
|
|
71
74
|
};
|
|
72
|
-
return /* @__PURE__ */ jsx(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
onInputValueChange
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
onOpenChange
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
return /* @__PURE__ */ jsx(MultipleContext, {
|
|
76
|
+
value: multiple === true,
|
|
77
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Root, {
|
|
78
|
+
autoHighlight,
|
|
79
|
+
locale,
|
|
80
|
+
filter: filter === void 0 ? folding.contains : filter,
|
|
81
|
+
items: offered,
|
|
82
|
+
multiple,
|
|
83
|
+
inputValue: ownsText ? typed : inputValue,
|
|
84
|
+
defaultInputValue: ownsText ? void 0 : defaultInputValue,
|
|
85
|
+
onInputValueChange: (value, details) => {
|
|
86
|
+
setTyped(value);
|
|
87
|
+
onInputValueChange?.(value, details);
|
|
88
|
+
},
|
|
89
|
+
onValueChange: changed,
|
|
90
|
+
onOpenChange: (open, details) => {
|
|
91
|
+
if (multiple && !open && details.reason === "item-press") details.cancel();
|
|
92
|
+
onOpenChange?.(open, details);
|
|
93
|
+
},
|
|
94
|
+
...props
|
|
95
|
+
})
|
|
90
96
|
});
|
|
91
97
|
}
|
|
92
98
|
/** A small quiet button inside the field: the clear cross and the chevron. */
|
|
@@ -276,43 +282,52 @@ function ComboboxContent({ className, side = "bottom", align = "start", sideOffs
|
|
|
276
282
|
}
|
|
277
283
|
/**
|
|
278
284
|
* One row. Pass the option as `value`; its label, icon and detail are shown unless you give
|
|
279
|
-
* children or props of your own.
|
|
285
|
+
* children or props of your own. As in a `Select`, the chosen row carries its mark at the right
|
|
286
|
+
* end (the disc, or the tick where several can be chosen), or stands on the tint where the rows
|
|
287
|
+
* have a detail; chosen rows that touch are one shape.
|
|
280
288
|
*/
|
|
281
289
|
function ComboboxItem({ className, children, icon, detail, value, ...props }) {
|
|
282
290
|
const itemValue = value;
|
|
283
291
|
const option = isOption(itemValue) ? itemValue : void 0;
|
|
284
292
|
const resolvedIcon = icon ?? option?.icon;
|
|
285
293
|
const resolvedDetail = detail ?? option?.detail;
|
|
294
|
+
const multiple = useContext(MultipleContext);
|
|
295
|
+
const create = isCreateOption(itemValue);
|
|
296
|
+
const tinted = resolvedDetail !== void 0;
|
|
286
297
|
return /* @__PURE__ */ jsxs(Combobox$1.Item, {
|
|
287
298
|
"data-slot": "combobox-item",
|
|
288
299
|
value: itemValue,
|
|
289
|
-
className: mergeClassName([
|
|
300
|
+
className: mergeClassName([
|
|
301
|
+
"group",
|
|
302
|
+
listItem,
|
|
303
|
+
tinted && listTint
|
|
304
|
+
], className),
|
|
290
305
|
...props,
|
|
291
306
|
children: [
|
|
292
|
-
|
|
307
|
+
create ? /* @__PURE__ */ jsx("span", {
|
|
293
308
|
"aria-hidden": true,
|
|
294
|
-
className: "flex size-
|
|
309
|
+
className: "flex size-4 shrink-0 items-center justify-center text-fg-muted",
|
|
295
310
|
children: /* @__PURE__ */ jsx(PlusGlyph, {
|
|
296
311
|
width: 10,
|
|
297
312
|
height: 10
|
|
298
313
|
})
|
|
299
|
-
}) : /* @__PURE__ */ jsx(
|
|
300
|
-
"aria-hidden": true,
|
|
301
|
-
className: "mark mark-quiet group-data-selected:mark-on"
|
|
302
|
-
}),
|
|
303
|
-
resolvedIcon && /* @__PURE__ */ jsx(Icon, {
|
|
314
|
+
}) : resolvedIcon && /* @__PURE__ */ jsx(Icon, {
|
|
304
315
|
icon: resolvedIcon,
|
|
305
|
-
className: "text-fg-muted"
|
|
316
|
+
className: "text-fg-muted group-data-highlighted:text-fg"
|
|
306
317
|
}),
|
|
307
318
|
/* @__PURE__ */ jsx("span", {
|
|
308
319
|
"data-slot": "combobox-item-text",
|
|
309
320
|
className: "min-w-0 truncate",
|
|
310
|
-
children: children ?? (
|
|
321
|
+
children: children ?? (create ? itemValue.create : option?.label)
|
|
311
322
|
}),
|
|
312
323
|
resolvedDetail !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
313
324
|
"data-slot": "combobox-item-detail",
|
|
314
325
|
className: "ml-auto shrink-0 pl-3 whitespace-nowrap text-fg-muted tabular-nums",
|
|
315
326
|
children: resolvedDetail
|
|
327
|
+
}),
|
|
328
|
+
!create && !tinted && /* @__PURE__ */ jsx(ListMark, {
|
|
329
|
+
kind: multiple ? "multiple" : "single",
|
|
330
|
+
className: "ml-auto"
|
|
316
331
|
})
|
|
317
332
|
]
|
|
318
333
|
});
|
|
@@ -27,10 +27,10 @@ export type CopyPageProps = Omit<ComponentProps<"div">, "children" | "aria-label
|
|
|
27
27
|
* menu repeats it with a line on what it is, and opens the Markdown in a new tab. Put it at the
|
|
28
28
|
* end of the row above the page's title.
|
|
29
29
|
*
|
|
30
|
-
* It is a `ButtonGroup`, named by its `label`: one part with two keys
|
|
31
|
-
* and the key under it takes the hover wash
|
|
32
|
-
*
|
|
33
|
-
*
|
|
30
|
+
* It is a `ButtonGroup`, named by its `label`: one part with two keys. Under the pointer the whole
|
|
31
|
+
* fitting lifts and the key under it takes the hover wash; a press moves only the pressed key,
|
|
32
|
+
* which takes the inner shade and goes down while the fitting and the other key stay where they
|
|
33
|
+
* are. A copy is confirmed in the key, as in a code block: the copy symbol
|
|
34
34
|
* shrinks away and the tick draws itself, short leg first, then fades where it stands while the
|
|
35
35
|
* symbol seats back. There is no toast; a screen reader hears one sentence.
|
|
36
36
|
*
|
|
@@ -7,6 +7,7 @@ import { ActionArrow } from "../../internal/arrow.js";
|
|
|
7
7
|
import { writeClipboard } from "../../internal/clipboard.js";
|
|
8
8
|
import { COPY_SHOWN_MS } from "../../internal/copy.js";
|
|
9
9
|
import { ChevronDownGlyph, TickGlyph } from "../../internal/glyphs.js";
|
|
10
|
+
import { Tile } from "../../internal/tile.js";
|
|
10
11
|
import { cn } from "../../lib/cn.js";
|
|
11
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
13
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -19,10 +20,10 @@ import { Menu } from "@base-ui/react/menu";
|
|
|
19
20
|
* menu repeats it with a line on what it is, and opens the Markdown in a new tab. Put it at the
|
|
20
21
|
* end of the row above the page's title.
|
|
21
22
|
*
|
|
22
|
-
* It is a `ButtonGroup`, named by its `label`: one part with two keys
|
|
23
|
-
* and the key under it takes the hover wash
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* It is a `ButtonGroup`, named by its `label`: one part with two keys. Under the pointer the whole
|
|
24
|
+
* fitting lifts and the key under it takes the hover wash; a press moves only the pressed key,
|
|
25
|
+
* which takes the inner shade and goes down while the fitting and the other key stay where they
|
|
26
|
+
* are. A copy is confirmed in the key, as in a code block: the copy symbol
|
|
26
27
|
* shrinks away and the tick draws itself, short leg first, then fades where it stands while the
|
|
27
28
|
* symbol seats back. There is no toast; a screen reader hears one sentence.
|
|
28
29
|
*
|
|
@@ -119,10 +120,7 @@ function CopyPage({ href, label, description, viewLabel, viewDescription, moreLa
|
|
|
119
120
|
children: [/* @__PURE__ */ jsxs(MenuItem, {
|
|
120
121
|
onClick: () => void copy(),
|
|
121
122
|
className: row,
|
|
122
|
-
children: [/* @__PURE__ */ jsx(Tile, {
|
|
123
|
-
icon: Copy01Icon,
|
|
124
|
-
size: 16
|
|
125
|
-
}) }), /* @__PURE__ */ jsx(RowText, {
|
|
123
|
+
children: [/* @__PURE__ */ jsx(Tile, { icon: Copy01Icon }), /* @__PURE__ */ jsx(RowText, {
|
|
126
124
|
title: label,
|
|
127
125
|
description
|
|
128
126
|
})]
|
|
@@ -152,14 +150,6 @@ function CopyPage({ href, label, description, viewLabel, viewDescription, moreLa
|
|
|
152
150
|
}
|
|
153
151
|
/** A row of the menu: a tile, then two lines. It keeps the list's instant highlight. */
|
|
154
152
|
const row = "group/row items-center gap-3 px-2 py-2";
|
|
155
|
-
function Tile({ children }) {
|
|
156
|
-
return /* @__PURE__ */ jsx("span", {
|
|
157
|
-
"aria-hidden": true,
|
|
158
|
-
"data-slot": "copy-page-tile",
|
|
159
|
-
className: "flex size-8 shrink-0 items-center justify-center rounded-md bg-surface text-fg-muted inset-ring inset-ring-hairline group-data-highlighted/row:text-fg forced-colors:inset-ring-[CanvasText]",
|
|
160
|
-
children
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
153
|
function RowText({ title, description }) {
|
|
164
154
|
return /* @__PURE__ */ jsxs("span", {
|
|
165
155
|
className: "flex min-w-0 flex-col gap-0.5",
|
|
@@ -176,12 +166,12 @@ function RowText({ title, description }) {
|
|
|
176
166
|
function MarkdownGlyph(props) {
|
|
177
167
|
return /* @__PURE__ */ jsxs("svg", {
|
|
178
168
|
"aria-hidden": true,
|
|
179
|
-
width:
|
|
180
|
-
height:
|
|
169
|
+
width: 18,
|
|
170
|
+
height: 18,
|
|
181
171
|
viewBox: "0 0 24 24",
|
|
182
172
|
fill: "none",
|
|
183
173
|
stroke: "currentColor",
|
|
184
|
-
strokeWidth:
|
|
174
|
+
strokeWidth: 2,
|
|
185
175
|
strokeLinecap: "round",
|
|
186
176
|
strokeLinejoin: "round",
|
|
187
177
|
...props,
|
|
@@ -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. */
|
|
@@ -39,12 +39,17 @@ export type MessageActionProps = Omit<ButtonProps, "iconOnly" | "variant" | "siz
|
|
|
39
39
|
/** What the key does, as a button says it: its name and its tooltip. */
|
|
40
40
|
label: string;
|
|
41
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";
|
|
42
47
|
};
|
|
43
48
|
/**
|
|
44
49
|
* A quiet key under an answer, with a symbol and a tooltip: „Noch einmal“, „Teilen“. Its name
|
|
45
50
|
* is its tooltip, worded like a button.
|
|
46
51
|
*/
|
|
47
|
-
export declare function MessageAction({ label, icon, className, ...props }: MessageActionProps): import("react").JSX.Element;
|
|
52
|
+
export declare function MessageAction({ label, icon, iconMotion, className, onClick, ...props }: MessageActionProps): import("react").JSX.Element;
|
|
48
53
|
/** The person's verdict on an answer: good, bad, or none yet. */
|
|
49
54
|
export type MessageVerdict = "good" | "bad" | null;
|
|
50
55
|
export type MessageFeedbackProps = Omit<ComponentProps<"div">, "defaultValue" | "onChange"> & {
|
|
@@ -56,7 +61,10 @@ export type MessageFeedbackProps = Omit<ComponentProps<"div">, "defaultValue" |
|
|
|
56
61
|
};
|
|
57
62
|
/**
|
|
58
63
|
* Two keys that stay down, thumbs up and thumbs down: at most one is on, and pressed again it
|
|
59
|
-
* is taken back. The
|
|
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.
|
|
60
68
|
*/
|
|
61
69
|
export declare function MessageFeedback({ value: valueProp, defaultValue, onValueChange, goodLabel, badLabel, className, ...props }: MessageFeedbackProps): import("react").JSX.Element;
|
|
62
70
|
export type MessageErrorProps = Omit<ComponentProps<"div">, "children"> & {
|
|
@@ -3,7 +3,7 @@ import { Button } from "../button/button.js";
|
|
|
3
3
|
import { useConversation } from "../conversation/conversation.js";
|
|
4
4
|
import { Icon } from "../icon/icon.js";
|
|
5
5
|
import { Toggle } from "../toggle/toggle.js";
|
|
6
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip/tooltip.js";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../tooltip/tooltip.js";
|
|
7
7
|
import { useArrivingText } from "../../internal/arriving.js";
|
|
8
8
|
import { useLive } from "../../internal/presence.js";
|
|
9
9
|
import { cn } from "../../lib/cn.js";
|
|
@@ -97,35 +97,45 @@ function MessageContent({ className, children, ref, ...props }) {
|
|
|
97
97
|
*/
|
|
98
98
|
function MessageActions({ className, ...props }) {
|
|
99
99
|
const { streaming } = useContext(MessageContext);
|
|
100
|
-
return /* @__PURE__ */ jsx("div", {
|
|
100
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx("div", {
|
|
101
101
|
"data-slot": "message-actions",
|
|
102
102
|
inert: streaming,
|
|
103
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
104
|
...props
|
|
105
|
-
});
|
|
105
|
+
}) });
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* A quiet key under an answer, with a symbol and a tooltip: „Noch einmal“, „Teilen“. Its name
|
|
109
109
|
* is its tooltip, worded like a button.
|
|
110
110
|
*/
|
|
111
|
-
function MessageAction({ label, icon, className, ...props }) {
|
|
111
|
+
function MessageAction({ label, icon, iconMotion, className, onClick, ...props }) {
|
|
112
|
+
const [turns, setTurns] = useState(0);
|
|
112
113
|
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx(Button, {
|
|
113
114
|
iconOnly: true,
|
|
114
115
|
size: "sm",
|
|
115
116
|
variant: "quiet",
|
|
116
117
|
"aria-label": label,
|
|
117
118
|
"data-slot": "message-action",
|
|
118
|
-
className: cn("text-fg-muted hover:text-fg", className),
|
|
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
|
+
},
|
|
119
124
|
...props,
|
|
120
125
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
121
126
|
icon,
|
|
122
|
-
size: 14
|
|
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)]")
|
|
123
130
|
})
|
|
124
131
|
}) }), /* @__PURE__ */ jsx(TooltipContent, { children: label })] });
|
|
125
132
|
}
|
|
126
133
|
/**
|
|
127
134
|
* Two keys that stay down, thumbs up and thumbs down: at most one is on, and pressed again it
|
|
128
|
-
* is taken back. The
|
|
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.
|
|
129
139
|
*/
|
|
130
140
|
function MessageFeedback({ value: valueProp, defaultValue = null, onValueChange, goodLabel = "Gute Antwort", badLabel = "Schlechte Antwort", className, ...props }) {
|
|
131
141
|
const [own, setOwn] = useState(defaultValue);
|
|
@@ -144,11 +154,13 @@ function MessageFeedback({ value: valueProp, defaultValue = null, onValueChange,
|
|
|
144
154
|
"aria-label": label,
|
|
145
155
|
pressed: on,
|
|
146
156
|
onPressedChange: (pressed) => choose(pressed ? verdict : null),
|
|
157
|
+
className: "data-pressed:bg-transparent data-pressed:hover:bg-hover",
|
|
147
158
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
148
159
|
icon,
|
|
149
160
|
size: 14,
|
|
150
161
|
"data-slot": "message-feedback-symbol",
|
|
151
|
-
|
|
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)]")
|
|
152
164
|
}, on ? "on" : "off")
|
|
153
165
|
}) }), /* @__PURE__ */ jsx(TooltipContent, { children: label })] });
|
|
154
166
|
};
|
|
@@ -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. */
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useGround } from "../ground/ground.js";
|
|
3
3
|
import { ChevronDownGlyph } from "../../internal/glyphs.js";
|
|
4
|
+
import { Tile } from "../../internal/tile.js";
|
|
4
5
|
import { cn, mergeClassName } from "../../lib/cn.js";
|
|
5
6
|
import { navigationMenuEntryVariants } from "./navigation-menu-variants.js";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { NavigationMenu as NavigationMenu$1 } from "@base-ui/react/navigation-menu";
|
|
8
9
|
// src/components/navigation-menu/navigation-menu.tsx
|
|
9
10
|
/**
|
|
@@ -98,15 +99,21 @@ function NavigationMenuContent({ className, ...props }) {
|
|
|
98
99
|
* A link in the navigation menu. Mark the page the reader is on with `active`. For a router's
|
|
99
100
|
* link, pass it as `render`: `<NavigationMenuLink render={<NextLink href="/preise" />}>`.
|
|
100
101
|
*/
|
|
101
|
-
function NavigationMenuLink({ kind = "page", className, ...props }) {
|
|
102
|
+
function NavigationMenuLink({ kind = "page", icon, className, children, ...props }) {
|
|
103
|
+
const tiled = kind === "page" && icon !== void 0;
|
|
102
104
|
return /* @__PURE__ */ jsx(NavigationMenu$1.Link, {
|
|
103
105
|
"data-slot": "navigation-menu-link",
|
|
104
106
|
className: mergeClassName(kind === "entry" ? navigationMenuEntryVariants() : [
|
|
105
|
-
"
|
|
107
|
+
"group/row flex rounded-md text-fg-body",
|
|
108
|
+
tiled ? "flex-row items-center gap-3 px-2 py-2" : "flex-col gap-0.5 px-3 py-2.5",
|
|
106
109
|
"transition-colors duration-150 ease-out hover:bg-hover data-active:bg-tint",
|
|
107
110
|
"focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent"
|
|
108
111
|
], className),
|
|
109
|
-
...props
|
|
112
|
+
...props,
|
|
113
|
+
children: tiled ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tile, { icon }), /* @__PURE__ */ jsx("span", {
|
|
114
|
+
className: "flex min-w-0 flex-col gap-0.5",
|
|
115
|
+
children
|
|
116
|
+
})] }) : children
|
|
110
117
|
});
|
|
111
118
|
}
|
|
112
119
|
/** The name of the page a row leads to. */
|