@lanfermann/ui 0.5.0 → 0.6.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.
Files changed (165) hide show
  1. package/dist/components/action-bar/action-bar.d.ts +59 -0
  2. package/dist/components/action-bar/action-bar.js +116 -0
  3. package/dist/components/alert/alert.d.ts +1 -1
  4. package/dist/components/alert/alert.js +3 -17
  5. package/dist/components/alert-dialog/alert-dialog.d.ts +1 -1
  6. package/dist/components/app-shell/app-shell.d.ts +33 -0
  7. package/dist/components/app-shell/app-shell.js +93 -0
  8. package/dist/components/attachment/attachment.d.ts +46 -0
  9. package/dist/components/attachment/attachment.js +222 -0
  10. package/dist/components/attachment/kinds.d.ts +7 -0
  11. package/dist/components/attachment/kinds.js +100 -0
  12. package/dist/components/avatar/avatar.d.ts +14 -4
  13. package/dist/components/avatar/avatar.js +57 -13
  14. package/dist/components/avatar-group/avatar-group.d.ts +33 -0
  15. package/dist/components/avatar-group/avatar-group.js +110 -0
  16. package/dist/components/avatar-group/people.d.ts +12 -0
  17. package/dist/components/avatar-group/people.js +24 -0
  18. package/dist/components/badge/badge.d.ts +9 -3
  19. package/dist/components/badge/badge.js +21 -6
  20. package/dist/components/banner/banner.d.ts +39 -0
  21. package/dist/components/banner/banner.js +149 -0
  22. package/dist/components/card/card.d.ts +11 -3
  23. package/dist/components/card/card.js +18 -4
  24. package/dist/components/checkbox-card/checkbox-card.d.ts +21 -0
  25. package/dist/components/checkbox-card/checkbox-card.js +49 -0
  26. package/dist/components/chip/chip-group.d.ts +15 -0
  27. package/dist/components/chip/chip-group.js +44 -0
  28. package/dist/components/chip/chip-variants.d.ts +6 -0
  29. package/dist/components/chip/chip-variants.js +28 -0
  30. package/dist/components/chip/chip.d.ts +39 -0
  31. package/dist/components/chip/chip.js +71 -0
  32. package/dist/components/code-block/code-copy.d.ts +3 -11
  33. package/dist/components/code-block/code-copy.js +15 -62
  34. package/dist/components/code-block/code-keys.js +10 -22
  35. package/dist/components/combobox/combobox.d.ts +50 -2
  36. package/dist/components/combobox/combobox.js +178 -9
  37. package/dist/components/command/command.d.ts +131 -0
  38. package/dist/components/command/command.js +335 -0
  39. package/dist/components/consent/consent-card.js +365 -0
  40. package/dist/components/consent/consent-embed.d.ts +21 -0
  41. package/dist/components/consent/consent-embed.js +111 -0
  42. package/dist/components/consent/consent-labels.d.ts +70 -0
  43. package/dist/components/consent/consent-labels.js +61 -0
  44. package/dist/components/consent/consent-record.d.ts +95 -0
  45. package/dist/components/consent/consent-record.js +112 -0
  46. package/dist/components/consent/consent-store.d.ts +26 -0
  47. package/dist/components/consent/consent-store.js +240 -0
  48. package/dist/components/consent/consent.d.ts +86 -0
  49. package/dist/components/consent/consent.js +306 -0
  50. package/dist/components/container/container.d.ts +1 -1
  51. package/dist/components/context-menu/context-menu.d.ts +23 -0
  52. package/dist/components/context-menu/context-menu.js +50 -0
  53. package/dist/components/conversation/conversation.d.ts +45 -0
  54. package/dist/components/conversation/conversation.js +295 -0
  55. package/dist/components/conversation/stick.js +23 -0
  56. package/dist/components/copy-button/copy-button.d.ts +50 -0
  57. package/dist/components/copy-button/copy-button.js +65 -0
  58. package/dist/components/copy-page/copy-page.js +7 -17
  59. package/dist/components/copy-pill/copy-pill.js +1 -1
  60. package/dist/components/description-list/description-list.d.ts +32 -0
  61. package/dist/components/description-list/description-list.js +51 -0
  62. package/dist/components/empty/empty.d.ts +38 -0
  63. package/dist/components/empty/empty.js +57 -0
  64. package/dist/components/field/field.js +1 -1
  65. package/dist/components/file-upload/file-upload.d.ts +96 -0
  66. package/dist/components/file-upload/file-upload.js +347 -0
  67. package/dist/components/file-upload/files.d.ts +39 -0
  68. package/dist/components/file-upload/files.js +74 -0
  69. package/dist/components/grow/grow.d.ts +15 -3
  70. package/dist/components/grow/grow.js +24 -9
  71. package/dist/components/heading/heading.d.ts +1 -1
  72. package/dist/components/icon/icon.d.ts +1 -1
  73. package/dist/components/input/input.js +1 -1
  74. package/dist/components/message/message.d.ts +73 -0
  75. package/dist/components/message/message.js +196 -0
  76. package/dist/components/otp-field/otp-field.d.ts +37 -0
  77. package/dist/components/otp-field/otp-field.js +126 -0
  78. package/dist/components/pagination/pagination.d.ts +50 -0
  79. package/dist/components/pagination/pagination.js +188 -0
  80. package/dist/components/prompt-input/keys.js +15 -0
  81. package/dist/components/prompt-input/prompt-input.d.ts +89 -0
  82. package/dist/components/prompt-input/prompt-input.js +331 -0
  83. package/dist/components/radio-card/radio-card.d.ts +23 -0
  84. package/dist/components/radio-card/radio-card.js +48 -0
  85. package/dist/components/rolling-number/rolling-number.d.ts +30 -0
  86. package/dist/components/rolling-number/rolling-number.js +149 -0
  87. package/dist/components/seam/seam.d.ts +1 -1
  88. package/dist/components/secret-field/secret-field.d.ts +53 -0
  89. package/dist/components/secret-field/secret-field.js +121 -0
  90. package/dist/components/section/section.d.ts +1 -1
  91. package/dist/components/select/select.d.ts +1 -1
  92. package/dist/components/select/select.js +1 -1
  93. package/dist/components/shortcut/shortcut.d.ts +46 -0
  94. package/dist/components/shortcut/shortcut.js +87 -0
  95. package/dist/components/sidebar/sidebar-context.js +16 -0
  96. package/dist/components/sidebar/sidebar.d.ts +161 -0
  97. package/dist/components/sidebar/sidebar.js +588 -0
  98. package/dist/components/site-header/site-header.js +1 -1
  99. package/dist/components/skeleton/loaded.d.ts +21 -0
  100. package/dist/components/skeleton/loaded.js +57 -0
  101. package/dist/components/skeleton/skeleton.d.ts +43 -0
  102. package/dist/components/skeleton/skeleton.js +48 -0
  103. package/dist/components/sources/source-list.d.ts +17 -0
  104. package/dist/components/sources/source-list.js +26 -0
  105. package/dist/components/sources/sources.d.ts +45 -0
  106. package/dist/components/sources/sources.js +167 -0
  107. package/dist/components/stat/stat.d.ts +57 -0
  108. package/dist/components/stat/stat.js +110 -0
  109. package/dist/components/steps/steps.d.ts +57 -0
  110. package/dist/components/steps/steps.js +131 -0
  111. package/dist/components/table/table.d.ts +18 -9
  112. package/dist/components/table/table.js +21 -13
  113. package/dist/components/text/text.d.ts +1 -1
  114. package/dist/components/theme-switch/theme-switch.js +1 -1
  115. package/dist/components/time-field/time-field.js +1 -1
  116. package/dist/components/timeline/timeline.d.ts +45 -0
  117. package/dist/components/timeline/timeline.js +86 -0
  118. package/dist/components/toast/toast.js +10 -26
  119. package/dist/components/toggle/toggle.d.ts +24 -0
  120. package/dist/components/toggle/toggle.js +53 -0
  121. package/dist/components/toggle-group/toggle-group.d.ts +27 -0
  122. package/dist/components/toggle-group/toggle-group.js +38 -0
  123. package/dist/components/toolbar/toolbar-context.js +12 -0
  124. package/dist/components/toolbar/toolbar.d.ts +45 -0
  125. package/dist/components/toolbar/toolbar.js +92 -0
  126. package/dist/components/trace/trace.d.ts +2 -1
  127. package/dist/components/trace/trace.js +14 -26
  128. package/dist/index.d.ts +46 -3
  129. package/dist/index.js +44 -3
  130. package/dist/internal/arriving-pieces.js +56 -0
  131. package/dist/internal/arriving.js +171 -0
  132. package/dist/internal/avatar-cut.d.ts +15 -0
  133. package/dist/internal/avatar-cut.js +83 -0
  134. package/dist/internal/choice-card.d.ts +15 -0
  135. package/dist/internal/choice-card.js +65 -0
  136. package/dist/internal/clipboard.js +37 -0
  137. package/dist/internal/copy.js +58 -0
  138. package/dist/internal/field.js +24 -4
  139. package/dist/internal/glyphs.js +26 -1
  140. package/dist/internal/live-list.js +41 -0
  141. package/dist/internal/number-places.js +156 -0
  142. package/dist/internal/picker-sheet.js +1 -1
  143. package/dist/internal/presence-dot.js +24 -0
  144. package/dist/internal/presence.js +104 -0
  145. package/dist/internal/rail-mark.d.ts +3 -0
  146. package/dist/internal/rail-mark.js +33 -0
  147. package/dist/internal/status-icon.js +22 -0
  148. package/dist/internal/travelling-mark.js +204 -0
  149. package/dist/lib/cn.js +4 -0
  150. package/dist/lib/shortcut.d.ts +11 -0
  151. package/dist/lib/shortcut.js +165 -0
  152. package/package.json +1 -1
  153. package/src/styles/action-bar.css +28 -0
  154. package/src/styles/assistant.css +83 -0
  155. package/src/styles/avatar.css +24 -0
  156. package/src/styles/consent.css +65 -0
  157. package/src/styles/copy.css +12 -11
  158. package/src/styles/depth.css +46 -2
  159. package/src/styles/marks.css +20 -2
  160. package/src/styles/rail.css +49 -0
  161. package/src/styles/rolling-number.css +94 -0
  162. package/src/styles/steps.css +98 -0
  163. package/src/styles/timeline.css +48 -0
  164. package/src/styles/travel.css +36 -0
  165. package/src/styles.css +9 -0
@@ -0,0 +1,43 @@
1
+ import { ComponentProps } from "react";
2
+ export type SkeletonProps = ComponentProps<"span"> & {
3
+ /**
4
+ * `text` (the default): a line of text. It is exactly as tall as a line of the text around
5
+ * it, so set it in the type the real line will have and nothing shifts when that arrives.
6
+ * Give it a width (`w-40`), about as long as the text will be.
7
+ * `block`: anything else, a picture, an avatar, a button. Give it the size and the corners of
8
+ * what it stands for (`size-7 rounded-sm`).
9
+ */
10
+ shape?: "text" | "block";
11
+ };
12
+ /**
13
+ * The shape of something that is still on its way. Build the page out of them the way it will
14
+ * be built out of content, line for line and block for block: the reader sees where things
15
+ * will stand, and nothing moves when they arrive.
16
+ *
17
+ * Put them inside a `SkeletonGroup`, which says in words what is being waited for and lets all
18
+ * of them breathe as one. A wait with nothing to show the shape of is a `Spinner`; a wait that
19
+ * has words is a `Shimmer`.
20
+ */
21
+ export declare function Skeleton({ shape, className, ...props }: SkeletonProps): import("react").JSX.Element;
22
+ export type SkeletonGroupProps = Omit<ComponentProps<"div">, "aria-label"> & {
23
+ /**
24
+ * What is being waited for, as a full sentence in the present ("Die Angebote werden gerade
25
+ * geladen."). It is read out; the shapes themselves are hidden from assistive tech.
26
+ */
27
+ label: string;
28
+ /**
29
+ * How the shapes show that the wait goes on. `breathing` (the default): all of them fade a
30
+ * little and come back, together. `passing`: a light runs through them. `still`: nothing
31
+ * moves.
32
+ */
33
+ light?: "breathing" | "passing" | "still";
34
+ };
35
+ /**
36
+ * A region that is loading: the `Skeleton`s of what will stand there. It is one light, not one
37
+ * per shape: the region breathes, so every shape in it does so at the same moment.
38
+ *
39
+ * It shows itself only after a fifth of a second. An answer that comes faster than that never
40
+ * flashes a skeleton; the room it takes is there from the start, so nothing shifts either way.
41
+ * To let the content fade in over it and to keep it from flickering, use `Loaded`.
42
+ */
43
+ export declare function SkeletonGroup({ label, light, className, children, ...props }: SkeletonGroupProps): import("react").JSX.Element;
@@ -0,0 +1,48 @@
1
+ import { cn } from "../../lib/cn.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ // src/components/skeleton/skeleton.tsx
4
+ /**
5
+ * The shape of something that is still on its way. Build the page out of them the way it will
6
+ * be built out of content, line for line and block for block: the reader sees where things
7
+ * will stand, and nothing moves when they arrive.
8
+ *
9
+ * Put them inside a `SkeletonGroup`, which says in words what is being waited for and lets all
10
+ * of them breathe as one. A wait with nothing to show the shape of is a `Spinner`; a wait that
11
+ * has words is a `Shimmer`.
12
+ */
13
+ function Skeleton({ shape = "text", className, ...props }) {
14
+ return /* @__PURE__ */ jsx("span", {
15
+ "data-slot": "skeleton",
16
+ "data-shape": shape,
17
+ "aria-hidden": true,
18
+ className: cn("relative block max-w-full overflow-hidden", shape === "text" ? "h-[1lh] before:absolute before:inset-x-0 before:top-1/2 before:h-[0.7em] before:-translate-y-1/2 before:rounded-xs before:bg-hover forced-colors:before:bg-[GrayText]" : "rounded-md bg-hover forced-colors:bg-[GrayText]", "in-data-[light=passing]:after:absolute in-data-[light=passing]:after:inset-y-0 in-data-[light=passing]:after:left-0 in-data-[light=passing]:after:w-2/5 in-data-[light=passing]:after:animate-indeterminate in-data-[light=passing]:after:bg-linear-to-r in-data-[light=passing]:after:from-transparent in-data-[light=passing]:after:via-ground/70 in-data-[light=passing]:after:to-transparent motion-reduce:after:hidden", className),
19
+ ...props
20
+ });
21
+ }
22
+ /**
23
+ * A region that is loading: the `Skeleton`s of what will stand there. It is one light, not one
24
+ * per shape: the region breathes, so every shape in it does so at the same moment.
25
+ *
26
+ * It shows itself only after a fifth of a second. An answer that comes faster than that never
27
+ * flashes a skeleton; the room it takes is there from the start, so nothing shifts either way.
28
+ * To let the content fade in over it and to keep it from flickering, use `Loaded`.
29
+ */
30
+ function SkeletonGroup({ label, light = "breathing", className, children, ...props }) {
31
+ return /* @__PURE__ */ jsxs("div", {
32
+ role: "status",
33
+ "aria-busy": "true",
34
+ "data-slot": "skeleton-group",
35
+ "data-light": light,
36
+ className: cn("transition-opacity delay-200 duration-150 ease-out starting:opacity-0", className),
37
+ ...props,
38
+ children: [/* @__PURE__ */ jsx("span", {
39
+ className: "sr-only",
40
+ children: label
41
+ }), /* @__PURE__ */ jsx("div", {
42
+ "data-slot": "skeleton-shapes",
43
+ className: cn(light === "breathing" && "animate-breathe"),
44
+ children
45
+ })]
46
+ });
47
+ }
48
+ export { Skeleton, SkeletonGroup };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The sources of an answer, without React: where a numbered reference points, and the site a
3
+ * source is shown under. Plain functions, so they can be tested.
4
+ */
5
+ /** One source of an answer. */
6
+ export type Source = {
7
+ /** What it is called: the page's title, a document's name. */
8
+ title: string;
9
+ /** Where it is. */
10
+ url: string;
11
+ /** The site or the place it is from, where the address says it badly („Angebote“, „Mail“). */
12
+ site?: string;
13
+ /** A line or two of what it says, the part the answer used. */
14
+ excerpt?: string;
15
+ };
16
+ /** The site a source is shown under: its own `site`, else the address's host without `www.`. */
17
+ export declare function siteOf(source: Pick<Source, "url" | "site">): string;
@@ -0,0 +1,26 @@
1
+ // src/components/sources/source-list.ts
2
+ /** The site a source is shown under: its own `site`, else the address's host without `www.`. */
3
+ function siteOf(source) {
4
+ if (source.site) return source.site;
5
+ try {
6
+ return new URL(source.url).hostname.replace(/^www\./, "");
7
+ } catch {
8
+ return source.url;
9
+ }
10
+ }
11
+ /**
12
+ * The source a reference's number stands for. A number without its source is an error, since
13
+ * the reference would lead nowhere: it is said loudly in the console, and the number stands
14
+ * without a link. It does not throw: a model may well name a source it never gave, and the
15
+ * answer must still be readable.
16
+ */
17
+ function sourceAt(sources, n) {
18
+ const source = Number.isInteger(n) ? sources[n - 1] : void 0;
19
+ if (!source) console.error(`SourceReference ${n} has no source: give Sources ${n} items or more, so the number leads somewhere.`);
20
+ return source;
21
+ }
22
+ /** The id of a source's entry in the list, which its references link to. */
23
+ function entryId(base, n) {
24
+ return `${base}-quelle-${n}`;
25
+ }
26
+ export { entryId, siteOf, sourceAt };
@@ -0,0 +1,45 @@
1
+ import { Source } from "./source-list.js";
2
+ import { ComponentProps, ReactNode } from "react";
3
+ export type SourcesProps = {
4
+ /** The sources of the answer, in the order of their numbers: the first is 1. */
5
+ items: readonly Source[];
6
+ /** The number whose card is open at first, on its first reference: for a still picture. */
7
+ defaultOpen?: number;
8
+ /** The answer with its `SourceReference`s, and the `SourceList` under it. */
9
+ children: ReactNode;
10
+ };
11
+ /**
12
+ * The sources of one answer: the numbered references in its sentences and the list under it,
13
+ * kept together so that every number leads somewhere. It draws nothing of its own; put the
14
+ * answer's content (with `SourceReference`s) and a `SourceList` inside.
15
+ *
16
+ * One card serves every reference of the answer. It opens on the first after a moment, so a
17
+ * pointer passing over the text does not open it, and then moves to a neighbour at once.
18
+ */
19
+ export declare function Sources({ items, defaultOpen, children }: SourcesProps): import("react").JSX.Element;
20
+ export type SourceReferenceProps = Omit<ComponentProps<"a">, "href" | "children"> & {
21
+ /** The source's number: its place in `Sources`' items, from 1. */
22
+ n: number;
23
+ /** Its name for assistive tech: „Quelle 1: Preisliste 2026“. */
24
+ label?: (n: number, title: string) => string;
25
+ };
26
+ /**
27
+ * A numbered reference after a sentence: a small link in tabular digits to the source's entry
28
+ * in the list under the answer. Under the pointer, or with the keyboard on it, a card shows the
29
+ * site, the title and a line of the text; on a touch screen a tap leads to the entry.
30
+ *
31
+ * A number that has no source is an error, said in the console: the number then stands bare.
32
+ */
33
+ export declare function SourceReference({ n, label, className, ...props }: SourceReferenceProps): import("react").JSX.Element;
34
+ export type SourceListProps = Omit<ComponentProps<"div">, "children"> & {
35
+ /** What stands above the list. */
36
+ title?: string;
37
+ /** Said after a title for assistive tech, since the link opens in a new tab. */
38
+ newTabLabel?: string;
39
+ };
40
+ /**
41
+ * The sources of the answer, under it: numbered, each a plain link with its site beside it. The
42
+ * entry a reference led to stands on the tint. The links open in a new tab, so the conversation
43
+ * stays where it is.
44
+ */
45
+ export declare function SourceList({ title, newTabLabel, className, ...props }: SourceListProps): import("react").JSX.Element;
@@ -0,0 +1,167 @@
1
+ "use client";
2
+ import { HoverCard, HoverCardContent } from "../hover-card/hover-card.js";
3
+ import { Icon } from "../icon/icon.js";
4
+ import { linkVariants } from "../link/link-variants.js";
5
+ import { cn } from "../../lib/cn.js";
6
+ import { entryId, siteOf, sourceAt } from "./source-list.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { createContext, useContext, useEffect, useId, useState } from "react";
9
+ import { Globe02Icon } from "@hugeicons/core-free-icons";
10
+ import { PreviewCard } from "@base-ui/react/preview-card";
11
+ // src/components/sources/sources.tsx
12
+ const SourcesContext = createContext(null);
13
+ function useSources(part) {
14
+ const context = useContext(SourcesContext);
15
+ if (!context) throw new Error(`${part} belongs inside Sources.`);
16
+ return context;
17
+ }
18
+ /**
19
+ * The sources of one answer: the numbered references in its sentences and the list under it,
20
+ * kept together so that every number leads somewhere. It draws nothing of its own; put the
21
+ * answer's content (with `SourceReference`s) and a `SourceList` inside.
22
+ *
23
+ * One card serves every reference of the answer. It opens on the first after a moment, so a
24
+ * pointer passing over the text does not open it, and then moves to a neighbour at once.
25
+ */
26
+ function Sources({ items, defaultOpen, children }) {
27
+ const base = useId().replace(/:/g, "");
28
+ const [card] = useState(() => PreviewCard.createHandle());
29
+ useEffect(() => {
30
+ if (defaultOpen === void 0) return;
31
+ const first = document.querySelector(`[data-sources="${base}"][data-n="${defaultOpen}"]`);
32
+ if (first) card.open(first.id);
33
+ }, []);
34
+ return /* @__PURE__ */ jsxs(SourcesContext, {
35
+ value: {
36
+ items,
37
+ base,
38
+ card
39
+ },
40
+ children: [children, /* @__PURE__ */ jsx(HoverCard, {
41
+ handle: card,
42
+ children: ({ payload }) => {
43
+ const source = payload === void 0 ? void 0 : items[payload - 1];
44
+ return source ? /* @__PURE__ */ jsx(SourceCard, { source }) : null;
45
+ }
46
+ })]
47
+ });
48
+ }
49
+ /** What the card shows: the site, the title, a line or two of the text. */
50
+ function SourceCard({ source }) {
51
+ return /* @__PURE__ */ jsxs(HoverCardContent, {
52
+ "data-slot": "source-card",
53
+ className: "w-80 gap-1.5",
54
+ children: [
55
+ /* @__PURE__ */ jsxs("span", {
56
+ className: "flex min-w-0 items-center gap-1.5 text-sm text-fg-muted",
57
+ children: [/* @__PURE__ */ jsx(Icon, {
58
+ icon: Globe02Icon,
59
+ size: 14
60
+ }), /* @__PURE__ */ jsx("span", {
61
+ className: "truncate",
62
+ children: siteOf(source)
63
+ })]
64
+ }),
65
+ /* @__PURE__ */ jsx("span", {
66
+ className: "line-clamp-2 font-medium text-fg",
67
+ children: source.title
68
+ }),
69
+ source.excerpt && /* @__PURE__ */ jsx("span", {
70
+ className: "line-clamp-3 text-sm text-pretty text-fg-body",
71
+ children: source.excerpt
72
+ })
73
+ ]
74
+ });
75
+ }
76
+ /**
77
+ * A footnote's digit: small, raised, in the accent, tight after the word or the stop. Chosen
78
+ * over the digit in a small raised plug on the line (Justin, 2026-11-19).
79
+ */
80
+ const referenceLook = "relative -top-[0.45em] rounded-xs px-[0.12em] text-[0.72em] leading-none font-semibold text-accent hover:text-accent-hover hover:underline";
81
+ /**
82
+ * A numbered reference after a sentence: a small link in tabular digits to the source's entry
83
+ * in the list under the answer. Under the pointer, or with the keyboard on it, a card shows the
84
+ * site, the title and a line of the text; on a touch screen a tap leads to the entry.
85
+ *
86
+ * A number that has no source is an error, said in the console: the number then stands bare.
87
+ */
88
+ function SourceReference({ n, label = (number, title) => `Quelle ${number}: ${title}`, className, ...props }) {
89
+ const { items, base, card } = useSources("SourceReference");
90
+ const id = useId();
91
+ const source = items[n - 1];
92
+ useEffect(() => {
93
+ if (!source) sourceAt(items, n);
94
+ }, [
95
+ source,
96
+ items,
97
+ n
98
+ ]);
99
+ if (!source) return /* @__PURE__ */ jsx("span", {
100
+ "data-slot": "source-reference",
101
+ "data-missing": "",
102
+ className: referenceLook,
103
+ children: n
104
+ });
105
+ return /* @__PURE__ */ jsx(PreviewCard.Trigger, {
106
+ handle: card,
107
+ payload: n,
108
+ delay: 450,
109
+ closeDelay: 150,
110
+ id,
111
+ "data-slot": "source-reference",
112
+ "data-sources": base,
113
+ "data-n": n,
114
+ href: `#${entryId(base, n)}`,
115
+ "aria-label": label(n, source.title),
116
+ className: cn("touch-target tabular-nums no-underline select-none", "focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent", referenceLook, className),
117
+ ...props,
118
+ children: n
119
+ });
120
+ }
121
+ /**
122
+ * The sources of the answer, under it: numbered, each a plain link with its site beside it. The
123
+ * entry a reference led to stands on the tint. The links open in a new tab, so the conversation
124
+ * stays where it is.
125
+ */
126
+ function SourceList({ title = "Quellen", newTabLabel = "öffnet in einem neuen Tab", className, ...props }) {
127
+ const { items, base } = useSources("SourceList");
128
+ const titleId = `${base}-quellen`;
129
+ return /* @__PURE__ */ jsxs("div", {
130
+ "data-slot": "source-list",
131
+ className: cn("mt-1 flex w-full max-w-[42rem] flex-col gap-1.5", className),
132
+ ...props,
133
+ children: [/* @__PURE__ */ jsx("p", {
134
+ id: titleId,
135
+ className: "text-sm font-medium text-fg-muted",
136
+ children: title
137
+ }), /* @__PURE__ */ jsx("ol", {
138
+ "aria-labelledby": titleId,
139
+ className: "flex flex-col",
140
+ children: items.map((source, index) => /* @__PURE__ */ jsxs("li", {
141
+ id: entryId(base, index + 1),
142
+ "data-slot": "source-entry",
143
+ className: "-mx-2 flex scroll-mt-12 items-baseline gap-2.5 rounded-md px-2 py-1 text-control target:bg-tint",
144
+ children: [/* @__PURE__ */ jsx("span", {
145
+ className: "w-4 shrink-0 text-right text-sm text-fg-muted tabular-nums",
146
+ children: index + 1
147
+ }), /* @__PURE__ */ jsxs("span", {
148
+ className: "flex min-w-0 flex-wrap items-baseline gap-x-2",
149
+ children: [/* @__PURE__ */ jsxs("a", {
150
+ href: source.url,
151
+ target: "_blank",
152
+ rel: "noreferrer",
153
+ className: cn(linkVariants({ variant: "quiet" }), "min-w-0 text-fg"),
154
+ children: [source.title, /* @__PURE__ */ jsxs("span", {
155
+ className: "sr-only",
156
+ children: [", ", newTabLabel]
157
+ })]
158
+ }), /* @__PURE__ */ jsx("span", {
159
+ className: "text-sm text-fg-muted",
160
+ children: siteOf(source)
161
+ })]
162
+ })]
163
+ }, entryId(base, index + 1)))
164
+ })]
165
+ });
166
+ }
167
+ export { SourceList, SourceReference, Sources };
@@ -0,0 +1,57 @@
1
+ import { ComponentProps, ReactNode } from "react";
2
+ export type StatGroupProps = ComponentProps<"div"> & {
3
+ /**
4
+ * `ruled` (the default) stands the figures in one row with hairlines between them. On an app's
5
+ * page put the row in a `Card`: the figures share the one card (Justin, 2026-11-19). On the
6
+ * ground a 2px rule opens it. `cards` puts each figure on a card of its own.
7
+ */
8
+ variant?: "ruled" | "cards";
9
+ };
10
+ /**
11
+ * A row of figures: what a dashboard shows first. They take the width there is and wrap; on a
12
+ * phone they stand two by two. Put `Stat`s inside.
13
+ */
14
+ export declare function StatGroup({ variant, className, children, ...props }: StatGroupProps): import("react").JSX.Element;
15
+ /**
16
+ * One figure: what it is (`StatLabel`), the figure (`StatValue`), and how it changed
17
+ * (`StatChange`). A `Meter` placed after the value shows usage against a limit.
18
+ *
19
+ * A figure is read, not operated: flat, casting no shadow. Several stand in a `StatGroup`.
20
+ * Server-safe; the value may be a `RollingNumber`, which rolls when the figure changes on screen.
21
+ */
22
+ export declare function Stat({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
23
+ /** What the figure is, in a few words: „Umsatz im November“. */
24
+ export declare function StatLabel({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
25
+ /**
26
+ * The figure, large and in tabular digits. Plain text, or a `RollingNumber`. It never breaks: a
27
+ * figure split over two lines reads as two.
28
+ */
29
+ export declare function StatValue({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
30
+ /** Which way the figure moved. */
31
+ export type StatTrend = "up" | "down" | "flat";
32
+ declare const toneClass: {
33
+ readonly positive: "text-success";
34
+ readonly negative: "text-danger";
35
+ readonly neutral: "text-fg-muted";
36
+ };
37
+ export type StatChangeProps = ComponentProps<"p"> & {
38
+ trend: StatTrend;
39
+ /**
40
+ * Whether the change is good news, which only the caller knows: more revenue is, more
41
+ * cancellations are not. `neutral` (the default) says neither.
42
+ */
43
+ tone?: keyof typeof toneClass;
44
+ /** After the amount, quieter: „gegenüber dem Vormonat“. */
45
+ context?: ReactNode;
46
+ /** What assistive tech hears before the amount, where the arrow says it to the eye. */
47
+ trendLabels?: Partial<Record<StatTrend, string>>;
48
+ };
49
+ /**
50
+ * How the figure changed: an arrow, the amount in the colour of its tone, and what it is
51
+ * compared with („+12 %“ „gegenüber dem Vormonat“). The arrow and the colour never carry it
52
+ * alone: assistive tech hears „Gestiegen“ or „Gesunken“ first, and the amount has its sign.
53
+ *
54
+ * When the trend turns, the arrow turns with it.
55
+ */
56
+ export declare function StatChange({ trend, tone, context, trendLabels, className, children, ...props }: StatChangeProps): import("react").JSX.Element;
57
+ export {};
@@ -0,0 +1,110 @@
1
+ import { Icon } from "../icon/icon.js";
2
+ import { ruleTop } from "../../internal/rule.js";
3
+ import { cn } from "../../lib/cn.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { ArrowUpRight01Icon } from "@hugeicons/core-free-icons";
6
+ // src/components/stat/stat.tsx
7
+ /**
8
+ * A row of figures: what a dashboard shows first. They take the width there is and wrap; on a
9
+ * phone they stand two by two. Put `Stat`s inside.
10
+ */
11
+ function StatGroup({ variant = "ruled", className, children, ...props }) {
12
+ return /* @__PURE__ */ jsx("div", {
13
+ "data-slot": "stat-group",
14
+ "data-variant": variant,
15
+ className: cn("group/stats", variant === "ruled" && ruleTop, variant === "ruled" && "in-data-[slot=card]:border-t-0 in-data-[slot=card]:before:hidden", className),
16
+ ...props,
17
+ children: /* @__PURE__ */ jsx("div", {
18
+ className: cn("grid grid-cols-[repeat(auto-fit,minmax(min(100%,10.5rem),1fr))] max-sm:grid-cols-2", variant === "ruled" ? "overflow-clip" : "gap-3"),
19
+ children
20
+ })
21
+ });
22
+ }
23
+ /**
24
+ * One figure: what it is (`StatLabel`), the figure (`StatValue`), and how it changed
25
+ * (`StatChange`). A `Meter` placed after the value shows usage against a limit.
26
+ *
27
+ * A figure is read, not operated: flat, casting no shadow. Several stand in a `StatGroup`.
28
+ * Server-safe; the value may be a `RollingNumber`, which rolls when the figure changes on screen.
29
+ */
30
+ function Stat({ className, ...props }) {
31
+ return /* @__PURE__ */ jsx("div", {
32
+ "data-slot": "stat",
33
+ className: cn("flex min-w-0 flex-col gap-1 [&>[data-slot=meter]]:mt-2", "group-data-[variant=ruled]/stats:-mt-px group-data-[variant=ruled]/stats:-ml-px group-data-[variant=ruled]/stats:border-t group-data-[variant=ruled]/stats:border-l group-data-[variant=ruled]/stats:border-hairline group-data-[variant=ruled]/stats:px-5 group-data-[variant=ruled]/stats:py-4 max-sm:group-data-[variant=ruled]/stats:px-4", "group-data-[variant=cards]/stats:rounded-xl group-data-[variant=cards]/stats:bg-surface group-data-[variant=cards]/stats:px-5 group-data-[variant=cards]/stats:py-4 group-data-[variant=cards]/stats:depth-card", className),
34
+ ...props
35
+ });
36
+ }
37
+ /** What the figure is, in a few words: „Umsatz im November“. */
38
+ function StatLabel({ className, ...props }) {
39
+ return /* @__PURE__ */ jsx("p", {
40
+ "data-slot": "stat-label",
41
+ className: cn("truncate text-sm text-fg-muted", className),
42
+ ...props
43
+ });
44
+ }
45
+ /**
46
+ * The figure, large and in tabular digits. Plain text, or a `RollingNumber`. It never breaks: a
47
+ * figure split over two lines reads as two.
48
+ */
49
+ function StatValue({ className, ...props }) {
50
+ return /* @__PURE__ */ jsx("p", {
51
+ "data-slot": "stat-value",
52
+ className: cn("text-xl font-medium whitespace-nowrap text-fg tabular-nums", className),
53
+ ...props
54
+ });
55
+ }
56
+ const turn = {
57
+ up: "rotate-0",
58
+ flat: "rotate-45",
59
+ down: "rotate-90"
60
+ };
61
+ const toneClass = {
62
+ positive: "text-success",
63
+ negative: "text-danger",
64
+ neutral: "text-fg-muted"
65
+ };
66
+ const defaultTrendLabels = {
67
+ up: "Gestiegen",
68
+ down: "Gesunken",
69
+ flat: "Unverändert"
70
+ };
71
+ /**
72
+ * How the figure changed: an arrow, the amount in the colour of its tone, and what it is
73
+ * compared with („+12 %“ „gegenüber dem Vormonat“). The arrow and the colour never carry it
74
+ * alone: assistive tech hears „Gestiegen“ or „Gesunken“ first, and the amount has its sign.
75
+ *
76
+ * When the trend turns, the arrow turns with it.
77
+ */
78
+ function StatChange({ trend, tone = "neutral", context, trendLabels, className, children, ...props }) {
79
+ const labels = {
80
+ ...defaultTrendLabels,
81
+ ...trendLabels
82
+ };
83
+ return /* @__PURE__ */ jsxs("p", {
84
+ "data-slot": "stat-change",
85
+ "data-trend": trend,
86
+ "data-tone": tone,
87
+ className: cn("flex min-w-0 flex-wrap items-center gap-x-1 text-sm", className),
88
+ ...props,
89
+ children: [
90
+ /* @__PURE__ */ jsx(Icon, {
91
+ icon: ArrowUpRight01Icon,
92
+ size: 14,
93
+ stroke: 1.75,
94
+ className: cn("shrink-0 [transition:rotate_var(--transition-duration-spring-seat)_var(--ease-spring-seat),color_var(--transition-duration-spring-settle)_var(--ease-spring-settle)] motion-reduce:[transition:color_var(--transition-duration-spring-settle)_var(--ease-spring-settle)]", turn[trend], toneClass[tone])
95
+ }),
96
+ /* @__PURE__ */ jsxs("span", {
97
+ className: cn("shrink-0 font-medium tabular-nums transition-colors spring-settle", toneClass[tone]),
98
+ children: [/* @__PURE__ */ jsxs("span", {
99
+ className: "sr-only",
100
+ children: [labels[trend], ": "]
101
+ }), children]
102
+ }),
103
+ context !== void 0 && /* @__PURE__ */ jsx("span", {
104
+ className: "text-fg-muted",
105
+ children: context
106
+ })
107
+ ]
108
+ });
109
+ }
110
+ export { Stat, StatChange, StatGroup, StatLabel, StatValue };
@@ -0,0 +1,57 @@
1
+ import { ComponentProps, ReactNode } from "react";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+ /** Where a step stands: behind one, the one being worked on, or still ahead. */
4
+ export type StepStatus = "done" | "current" | "upcoming";
5
+ export type StepsProps = ComponentProps<"ol"> & {
6
+ /**
7
+ * In a row (the default), with each step's name centred under its mark; in a place too narrow
8
+ * for the names only the current one is written out. Or one under the other, for a column
9
+ * beside a form.
10
+ */
11
+ orientation?: "horizontal" | "vertical";
12
+ /**
13
+ * `numbers` (the default): each step's number in a socket like a checkbox's, which takes the
14
+ * accent plug and a tick once the step is done. `dots`: the system's flat marks, ring and
15
+ * disc, as a `Trace` draws them, for a quieter place.
16
+ */
17
+ marks?: "numbers" | "dots";
18
+ };
19
+ /**
20
+ * Where one stands in a set-up of a few steps: an order, an onboarding, a form in parts. Its
21
+ * marks are a checkbox's: an empty socket with the step's number is ahead, the socket with the
22
+ * accent ring is where one stands, and a finished step is the accent plug with its tick. A line
23
+ * with round ends joins them, filled in the text colour behind a finished step.
24
+ *
25
+ * Going on is one movement along the way: the plug seats and its tick draws, the line draws on
26
+ * to the next mark, and that mark takes the ring as the line arrives. Going back runs it in
27
+ * reverse. Where the steps first show, the finished ones draw themselves in (`steps.css`).
28
+ *
29
+ * Put `Step`s inside, each with its `status`; exactly one is `current`. Name the list
30
+ * (`aria-label`: "Einrichtung"). It shows the way and does not walk it: the buttons that go on
31
+ * and back belong to the form below. Three to five steps; a longer way is better told as
32
+ * "Schritt 4 von 9" in words.
33
+ */
34
+ export declare function Steps({ orientation, marks, className, ...props }: StepsProps): import("react").JSX.Element;
35
+ export type StepProps = Omit<ComponentProps<"li">, "title"> & {
36
+ /** Where the step stands. Ahead unless said otherwise. */
37
+ status?: StepStatus;
38
+ /** The step, in a word or two: "Konto", "Tarif wählen". */
39
+ title: ReactNode;
40
+ /** A second, quieter line: what happens in this step. */
41
+ description?: ReactNode;
42
+ /**
43
+ * Where the step can be opened again. Give it to a finished step only: its name is then a
44
+ * link back. A step that is ahead is not a link.
45
+ */
46
+ href?: string;
47
+ /** A router's link in place of the `<a>`: `render={<Link href="…" />}`. */
48
+ render?: useRender.RenderProp;
49
+ /** What the state is called for assistive tech, where the mark alone would say it. */
50
+ statusLabel?: string;
51
+ };
52
+ /**
53
+ * One step. Its mark stands on the line and its name is centred under it (beside it when the
54
+ * steps stand one under the other). The current step says so to assistive tech
55
+ * (`aria-current="step"`) and has its name in the strong text colour.
56
+ */
57
+ export declare function Step({ status, title, description, href, render, statusLabel, className, ...props }: StepProps): import("react").JSX.Element;