@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.
Files changed (186) hide show
  1. package/dist/components/accordion/accordion.d.ts +11 -3
  2. package/dist/components/accordion/accordion.js +15 -10
  3. package/dist/components/action-bar/action-bar.d.ts +60 -0
  4. package/dist/components/action-bar/action-bar.js +117 -0
  5. package/dist/components/alert/alert.d.ts +1 -1
  6. package/dist/components/alert/alert.js +3 -17
  7. package/dist/components/alert-dialog/alert-dialog.d.ts +1 -1
  8. package/dist/components/app-shell/app-shell.d.ts +33 -0
  9. package/dist/components/app-shell/app-shell.js +93 -0
  10. package/dist/components/attachment/attachment.d.ts +51 -0
  11. package/dist/components/attachment/attachment.js +255 -0
  12. package/dist/components/attachment/kinds.d.ts +7 -0
  13. package/dist/components/attachment/kinds.js +142 -0
  14. package/dist/components/avatar/avatar.d.ts +14 -4
  15. package/dist/components/avatar/avatar.js +57 -13
  16. package/dist/components/avatar-group/avatar-group.d.ts +33 -0
  17. package/dist/components/avatar-group/avatar-group.js +110 -0
  18. package/dist/components/avatar-group/people.d.ts +12 -0
  19. package/dist/components/avatar-group/people.js +24 -0
  20. package/dist/components/badge/badge.d.ts +9 -3
  21. package/dist/components/badge/badge.js +21 -6
  22. package/dist/components/banner/banner.d.ts +39 -0
  23. package/dist/components/banner/banner.js +149 -0
  24. package/dist/components/button-group/button-group-variants.d.ts +4 -3
  25. package/dist/components/button-group/button-group-variants.js +13 -12
  26. package/dist/components/button-group/button-group.d.ts +3 -3
  27. package/dist/components/button-group/button-group.js +3 -3
  28. package/dist/components/card/card.d.ts +20 -4
  29. package/dist/components/card/card.js +32 -6
  30. package/dist/components/checkbox-card/checkbox-card.d.ts +21 -0
  31. package/dist/components/checkbox-card/checkbox-card.js +50 -0
  32. package/dist/components/chip/chip-group.d.ts +15 -0
  33. package/dist/components/chip/chip-group.js +44 -0
  34. package/dist/components/chip/chip-variants.d.ts +6 -0
  35. package/dist/components/chip/chip-variants.js +28 -0
  36. package/dist/components/chip/chip.d.ts +39 -0
  37. package/dist/components/chip/chip.js +71 -0
  38. package/dist/components/code-block/code-copy.d.ts +3 -11
  39. package/dist/components/code-block/code-copy.js +15 -62
  40. package/dist/components/code-block/code-keys.js +10 -22
  41. package/dist/components/collapsible/collapsible.js +7 -3
  42. package/dist/components/combobox/combobox.d.ts +53 -3
  43. package/dist/components/combobox/combobox.js +204 -20
  44. package/dist/components/command/command.d.ts +131 -0
  45. package/dist/components/command/command.js +335 -0
  46. package/dist/components/consent/consent-card.js +365 -0
  47. package/dist/components/consent/consent-embed.d.ts +21 -0
  48. package/dist/components/consent/consent-embed.js +111 -0
  49. package/dist/components/consent/consent-labels.d.ts +70 -0
  50. package/dist/components/consent/consent-labels.js +61 -0
  51. package/dist/components/consent/consent-record.d.ts +95 -0
  52. package/dist/components/consent/consent-record.js +112 -0
  53. package/dist/components/consent/consent-store.d.ts +26 -0
  54. package/dist/components/consent/consent-store.js +240 -0
  55. package/dist/components/consent/consent.d.ts +86 -0
  56. package/dist/components/consent/consent.js +306 -0
  57. package/dist/components/container/container.d.ts +1 -1
  58. package/dist/components/context-menu/context-menu.d.ts +23 -0
  59. package/dist/components/context-menu/context-menu.js +50 -0
  60. package/dist/components/conversation/conversation.d.ts +45 -0
  61. package/dist/components/conversation/conversation.js +295 -0
  62. package/dist/components/conversation/stick.js +23 -0
  63. package/dist/components/copy-button/copy-button.d.ts +50 -0
  64. package/dist/components/copy-button/copy-button.js +65 -0
  65. package/dist/components/copy-page/copy-page.d.ts +4 -4
  66. package/dist/components/copy-page/copy-page.js +16 -36
  67. package/dist/components/copy-pill/copy-pill.js +1 -1
  68. package/dist/components/description-list/description-list.d.ts +32 -0
  69. package/dist/components/description-list/description-list.js +51 -0
  70. package/dist/components/empty/empty.d.ts +38 -0
  71. package/dist/components/empty/empty.js +57 -0
  72. package/dist/components/field/field.js +1 -1
  73. package/dist/components/file-upload/file-upload.d.ts +96 -0
  74. package/dist/components/file-upload/file-upload.js +347 -0
  75. package/dist/components/file-upload/files.d.ts +39 -0
  76. package/dist/components/file-upload/files.js +74 -0
  77. package/dist/components/grow/grow.d.ts +15 -3
  78. package/dist/components/grow/grow.js +24 -9
  79. package/dist/components/heading/heading.d.ts +1 -1
  80. package/dist/components/icon/icon.d.ts +1 -1
  81. package/dist/components/input/input.js +1 -1
  82. package/dist/components/menu/menu.d.ts +20 -8
  83. package/dist/components/menu/menu.js +51 -29
  84. package/dist/components/message/message.d.ts +81 -0
  85. package/dist/components/message/message.js +208 -0
  86. package/dist/components/navigation-menu/navigation-menu.d.ts +7 -1
  87. package/dist/components/navigation-menu/navigation-menu.js +11 -4
  88. package/dist/components/otp-field/otp-field.d.ts +37 -0
  89. package/dist/components/otp-field/otp-field.js +161 -0
  90. package/dist/components/pagination/pagination.d.ts +50 -0
  91. package/dist/components/pagination/pagination.js +188 -0
  92. package/dist/components/prompt-input/keys.js +15 -0
  93. package/dist/components/prompt-input/prompt-input.d.ts +89 -0
  94. package/dist/components/prompt-input/prompt-input.js +331 -0
  95. package/dist/components/radio-card/radio-card.d.ts +23 -0
  96. package/dist/components/radio-card/radio-card.js +49 -0
  97. package/dist/components/rolling-number/rolling-number.d.ts +30 -0
  98. package/dist/components/rolling-number/rolling-number.js +149 -0
  99. package/dist/components/seam/seam.d.ts +1 -1
  100. package/dist/components/secret-field/secret-field.d.ts +53 -0
  101. package/dist/components/secret-field/secret-field.js +121 -0
  102. package/dist/components/section/section.d.ts +1 -1
  103. package/dist/components/segmented-control/segmented-control.js +29 -16
  104. package/dist/components/select/select.d.ts +5 -4
  105. package/dist/components/select/select.js +16 -11
  106. package/dist/components/shortcut/shortcut.d.ts +46 -0
  107. package/dist/components/shortcut/shortcut.js +87 -0
  108. package/dist/components/sidebar/sidebar-context.js +16 -0
  109. package/dist/components/sidebar/sidebar.d.ts +161 -0
  110. package/dist/components/sidebar/sidebar.js +588 -0
  111. package/dist/components/site-header/site-header.js +1 -1
  112. package/dist/components/skeleton/loaded.d.ts +21 -0
  113. package/dist/components/skeleton/loaded.js +57 -0
  114. package/dist/components/skeleton/skeleton.d.ts +43 -0
  115. package/dist/components/skeleton/skeleton.js +48 -0
  116. package/dist/components/sources/source-list.d.ts +17 -0
  117. package/dist/components/sources/source-list.js +26 -0
  118. package/dist/components/sources/sources.d.ts +45 -0
  119. package/dist/components/sources/sources.js +167 -0
  120. package/dist/components/stat/stat.d.ts +59 -0
  121. package/dist/components/stat/stat.js +112 -0
  122. package/dist/components/steps/steps.d.ts +57 -0
  123. package/dist/components/steps/steps.js +134 -0
  124. package/dist/components/table/table.d.ts +18 -9
  125. package/dist/components/table/table.js +21 -13
  126. package/dist/components/text/text.d.ts +1 -1
  127. package/dist/components/theme-switch/theme-switch.js +1 -1
  128. package/dist/components/time-field/time-field.js +7 -6
  129. package/dist/components/timeline/timeline.d.ts +45 -0
  130. package/dist/components/timeline/timeline.js +86 -0
  131. package/dist/components/toast/toast.js +10 -26
  132. package/dist/components/toggle/toggle.d.ts +27 -0
  133. package/dist/components/toggle/toggle.js +61 -0
  134. package/dist/components/toggle-group/toggle-group.d.ts +27 -0
  135. package/dist/components/toggle-group/toggle-group.js +38 -0
  136. package/dist/components/toolbar/toolbar-context.js +12 -0
  137. package/dist/components/toolbar/toolbar.d.ts +52 -0
  138. package/dist/components/toolbar/toolbar.js +105 -0
  139. package/dist/components/trace/trace.d.ts +2 -1
  140. package/dist/components/trace/trace.js +15 -27
  141. package/dist/index.d.ts +46 -3
  142. package/dist/index.js +44 -3
  143. package/dist/internal/arriving-pieces.js +56 -0
  144. package/dist/internal/arriving.js +171 -0
  145. package/dist/internal/avatar-cut.d.ts +15 -0
  146. package/dist/internal/avatar-cut.js +83 -0
  147. package/dist/internal/choice-card.d.ts +15 -0
  148. package/dist/internal/choice-card.js +81 -0
  149. package/dist/internal/clipboard.js +37 -0
  150. package/dist/internal/copy.js +58 -0
  151. package/dist/internal/disclosure.js +15 -3
  152. package/dist/internal/field.js +24 -4
  153. package/dist/internal/glyphs.js +26 -1
  154. package/dist/internal/key-tip.js +18 -0
  155. package/dist/internal/list-mark.js +39 -0
  156. package/dist/internal/live-list.js +41 -0
  157. package/dist/internal/number-places.js +157 -0
  158. package/dist/internal/picker-sheet.js +1 -1
  159. package/dist/internal/presence-dot.js +24 -0
  160. package/dist/internal/presence.js +104 -0
  161. package/dist/internal/rail-mark.d.ts +3 -0
  162. package/dist/internal/rail-mark.js +33 -0
  163. package/dist/internal/rule.js +2 -1
  164. package/dist/internal/status-icon.js +22 -0
  165. package/dist/internal/tile.js +23 -0
  166. package/dist/internal/travelling-mark.js +204 -0
  167. package/dist/lib/cn.js +10 -0
  168. package/dist/lib/shortcut.d.ts +11 -0
  169. package/dist/lib/shortcut.js +165 -0
  170. package/package.json +1 -1
  171. package/src/styles/accordion.css +176 -0
  172. package/src/styles/action-bar.css +28 -0
  173. package/src/styles/assistant.css +83 -0
  174. package/src/styles/avatar.css +24 -0
  175. package/src/styles/consent.css +65 -0
  176. package/src/styles/copy.css +12 -11
  177. package/src/styles/depth.css +120 -4
  178. package/src/styles/marks.css +20 -2
  179. package/src/styles/motion.css +3 -0
  180. package/src/styles/rail.css +49 -0
  181. package/src/styles/rolling-number.css +94 -0
  182. package/src/styles/segmented.css +14 -7
  183. package/src/styles/steps.css +98 -0
  184. package/src/styles/timeline.css +48 -0
  185. package/src/styles/travel.css +36 -0
  186. package/src/styles.css +10 -0
@@ -1,5 +1,11 @@
1
1
  import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
2
- export type AccordionProps = Accordion$1.Root.Props;
2
+ export type AccordionProps = Accordion$1.Root.Props & {
3
+ /**
4
+ * No wash under the pointer: the lines stay and only the chevron answers. For a page where the
5
+ * accordion should recede, such as a docs page dense with other rows.
6
+ */
7
+ quiet?: boolean;
8
+ };
3
9
  /**
4
10
  * Questions with their answers, or the sections of a long page that are read one at a time. One
5
11
  * item is open at a time; `multiple` lets several stay open, for sections that are compared.
@@ -8,7 +14,7 @@ export type AccordionProps = Accordion$1.Root.Props;
8
14
  * what everybody needs behind a row: an accordion is for the second look. `hiddenUntilFound`
9
15
  * lets the browser's page search open the row that holds the match.
10
16
  */
11
- export declare function Accordion({ className, ...props }: AccordionProps): import("react").JSX.Element;
17
+ export declare function Accordion({ className, quiet, ...props }: AccordionProps): import("react").JSX.Element;
12
18
  export type AccordionItemProps = Accordion$1.Item.Props;
13
19
  /** One row with its panel. Give it a `value` to open it at first or to control it. */
14
20
  export declare function AccordionItem({ className, ...props }: AccordionItemProps): import("react").JSX.Element;
@@ -22,5 +28,7 @@ export type AccordionTriggerProps = Accordion$1.Trigger.Props & {
22
28
  */
23
29
  export declare function AccordionTrigger({ className, children, level, ...props }: AccordionTriggerProps): import("react").JSX.Element;
24
30
  export type AccordionPanelProps = Accordion$1.Panel.Props;
25
- /** The answer. It opens on `settle` to its own height and leaves faster than it came. */
31
+ /**
32
+ * The answer. It opens on `settle` to its own height and unfolds, and leaves faster than it came.
33
+ */
26
34
  export declare function AccordionPanel({ className, children, ...props }: AccordionPanelProps): import("react").JSX.Element;
@@ -1,7 +1,6 @@
1
1
  "use client";
2
- import { disclosureChevron, disclosurePanel } from "../../internal/disclosure.js";
2
+ import { disclosureChevron, disclosurePanel, disclosureUnfold } from "../../internal/disclosure.js";
3
3
  import { ChevronDownGlyph } from "../../internal/glyphs.js";
4
- import { ruleTop } from "../../internal/rule.js";
5
4
  import { cn, mergeClassName } from "../../lib/cn.js";
6
5
  import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
7
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -14,10 +13,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
14
13
  * what everybody needs behind a row: an accordion is for the second look. `hiddenUntilFound`
15
14
  * lets the browser's page search open the row that holds the match.
16
15
  */
17
- function Accordion({ className, ...props }) {
16
+ function Accordion({ className, quiet = false, ...props }) {
18
17
  return /* @__PURE__ */ jsx(Accordion$1.Root, {
19
18
  "data-slot": "accordion",
20
- className: mergeClassName(["flex w-full flex-col", ruleTop], className),
19
+ "data-quiet": quiet || void 0,
20
+ className: mergeClassName("flex w-full flex-col", className),
21
21
  ...props
22
22
  });
23
23
  }
@@ -25,7 +25,7 @@ function Accordion({ className, ...props }) {
25
25
  function AccordionItem({ className, ...props }) {
26
26
  return /* @__PURE__ */ jsx(Accordion$1.Item, {
27
27
  "data-slot": "accordion-item",
28
- className: mergeClassName("border-b border-hairline", className),
28
+ className,
29
29
  ...props
30
30
  });
31
31
  }
@@ -42,8 +42,7 @@ function AccordionTrigger({ className, children, level = 3, ...props }) {
42
42
  children: /* @__PURE__ */ jsxs(Accordion$1.Trigger, {
43
43
  "data-slot": "accordion-trigger",
44
44
  className: mergeClassName([
45
- "group touch-target relative flex min-h-(--control-lg) w-full items-start gap-4 rounded-sm px-3 py-3 text-left text-base font-medium text-fg select-none",
46
- "hover:bg-hover",
45
+ "group touch-target relative flex min-h-(--control-lg) w-full items-start gap-4 rounded-md px-3 py-3 text-left text-base font-medium text-fg select-none",
47
46
  "focus-visible:relative focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",
48
47
  "data-disabled:pointer-events-none data-disabled:text-on-disabled"
49
48
  ], className),
@@ -57,17 +56,23 @@ function AccordionTrigger({ className, children, level = 3, ...props }) {
57
56
  className: "flex h-lh shrink-0 items-center",
58
57
  children: /* @__PURE__ */ jsx(ChevronDownGlyph, {
59
58
  "data-slot": "accordion-chevron",
60
- className: cn(disclosureChevron, "group-data-panel-open:rotate-180")
59
+ className: cn(disclosureChevron, "[--lean:0_var(--motion-lean)] group-data-panel-open:rotate-180 group-data-panel-open:[--lean:0_calc(var(--motion-lean)*-1)]")
61
60
  })
62
61
  })]
63
62
  })
64
63
  });
65
64
  }
66
- /** The answer. It opens on `settle` to its own height and leaves faster than it came. */
65
+ /**
66
+ * The answer. It opens on `settle` to its own height and unfolds, and leaves faster than it came.
67
+ */
67
68
  function AccordionPanel({ className, children, ...props }) {
68
69
  return /* @__PURE__ */ jsx(Accordion$1.Panel, {
69
70
  "data-slot": "accordion-panel",
70
- className: mergeClassName(["h-(--accordion-panel-height) text-base text-fg-body", disclosurePanel], className),
71
+ className: mergeClassName([
72
+ "h-(--accordion-panel-height) text-base text-fg-body",
73
+ disclosurePanel,
74
+ disclosureUnfold
75
+ ], className),
71
76
  ...props,
72
77
  children: /* @__PURE__ */ jsx("div", {
73
78
  "data-slot": "accordion-panel-content",
@@ -0,0 +1,60 @@
1
+ import { ButtonProps } from "../button/button.js";
2
+ import { ComponentProps, ReactNode } from "react";
3
+ export type ActionBarProps = Omit<ComponentProps<"div">, "children"> & {
4
+ /** There is a selection: the bar shows. */
5
+ open: boolean;
6
+ /** How many are selected. */
7
+ count: number;
8
+ /** The word after the count: "ausgewählt". */
9
+ countLabel?: (count: number) => ReactNode;
10
+ /** Called by the cross and by Escape. Take the selection back here. */
11
+ onClear: () => void;
12
+ /** The name of the cross. */
13
+ clearLabel?: string;
14
+ /** The name of the bar for assistive tech. */
15
+ "aria-label"?: string;
16
+ /**
17
+ * Where it stands. `fixed` (the default): at the foot of the window, in its middle.
18
+ * `sticky`: at the foot of the box it is the last child of, and of the window while that box
19
+ * is taller. For the page beside a sidebar, where the middle of the window is not the middle
20
+ * of the list; give that box `flex flex-col`, so the bar stands at its foot when the list is
21
+ * short. It keeps a place of its own at the end of that box: scrolled to the end, it stands
22
+ * under the list and not on its last row. `absolute`: at the foot of its nearest positioned
23
+ * box.
24
+ */
25
+ position?: "fixed" | "sticky" | "absolute";
26
+ /**
27
+ * What it is cut from. `ink` (the default): a dark sheet, the way a toast speaks. `paper`: a
28
+ * light one. Take the one that stands apart from the page it floats over: the dark sheet
29
+ * over a light page, the light sheet over a dark one.
30
+ */
31
+ ground?: "ink" | "paper";
32
+ /** The actions: `ActionBarButton`s. */
33
+ children: ReactNode;
34
+ };
35
+ /**
36
+ * What can be done with the rows that are selected in a list: it rises at the foot of the
37
+ * window with the first row that is ticked, counts them, and leaves with the last. It is the
38
+ * system speaking about the selection, so by default it speaks on Ink, as a toast does; over a
39
+ * dark page it can be the light one instead (`ground="paper"`). It is cut like a key that
40
+ * floats: a key's glossy face, light edge and lip, over a long, wide shadow (`depth-dock`).
41
+ *
42
+ * Put the actions inside as `ActionBarButton`s, worded like buttons ("Als PDF herunterladen").
43
+ * Two or three; what is rare belongs in a `Menu` behind the last one. The bar is one stop for
44
+ * the Tab key, and the arrow keys move between its actions. Escape, pressed inside it, takes
45
+ * the selection back, and so does the cross.
46
+ *
47
+ * It does not take the focus when it appears: whoever is ticking rows keeps doing that.
48
+ */
49
+ export declare function ActionBar({ open, count, countLabel, onClear, clearLabel, "aria-label": label, position, ground, className, children, ...props }: ActionBarProps): import("react").JSX.Element;
50
+ /** `Omit` that keeps a union a union: a button is named either by its words or by `aria-label`. */
51
+ type Without<Props, Key extends PropertyKey> = Props extends unknown ? Omit<Props, Key> : never;
52
+ export type ActionBarButtonProps = Without<ButtonProps, "variant" | "size">;
53
+ /**
54
+ * One action on the selection: a quiet button on the bar, with a 14px symbol before its words
55
+ * if it helps. Where the bar is narrow (a phone), `iconOnly` leaves the symbol alone and
56
+ * `aria-label` names it. The one that cannot be undone goes last, and is confirmed in an
57
+ * `AlertDialog`.
58
+ */
59
+ export declare function ActionBarButton({ className, disabled, ...props }: ActionBarButtonProps): import("react").JSX.Element;
60
+ export {};
@@ -0,0 +1,117 @@
1
+ "use client";
2
+ import { Button } from "../button/button.js";
3
+ import { RollingNumber } from "../rolling-number/rolling-number.js";
4
+ import { ScrollFade } from "../scroll-fade/scroll-fade.js";
5
+ import { CloseGlyph } from "../../internal/glyphs.js";
6
+ import { cn } from "../../lib/cn.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { Toolbar } from "@base-ui/react/toolbar";
9
+ import { useRef, useState } from "react";
10
+ // src/components/action-bar/action-bar.tsx
11
+ const places = {
12
+ fixed: "fixed inset-x-0 bottom-0",
13
+ absolute: "absolute inset-x-0 bottom-0",
14
+ sticky: "sticky bottom-0 mt-auto"
15
+ };
16
+ /**
17
+ * What can be done with the rows that are selected in a list: it rises at the foot of the
18
+ * window with the first row that is ticked, counts them, and leaves with the last. It is the
19
+ * system speaking about the selection, so by default it speaks on Ink, as a toast does; over a
20
+ * dark page it can be the light one instead (`ground="paper"`). It is cut like a key that
21
+ * floats: a key's glossy face, light edge and lip, over a long, wide shadow (`depth-dock`).
22
+ *
23
+ * Put the actions inside as `ActionBarButton`s, worded like buttons ("Als PDF herunterladen").
24
+ * Two or three; what is rare belongs in a `Menu` behind the last one. The bar is one stop for
25
+ * the Tab key, and the arrow keys move between its actions. Escape, pressed inside it, takes
26
+ * the selection back, and so does the cross.
27
+ *
28
+ * It does not take the focus when it appears: whoever is ticking rows keeps doing that.
29
+ */
30
+ function ActionBar({ open, count, countLabel = () => "ausgewählt", onClear, clearLabel = "Auswahl aufheben", "aria-label": label = "Auswahl", position = "fixed", ground = "ink", className, children, ...props }) {
31
+ const [last, setLast] = useState(count);
32
+ const [was, setWas] = useState(open);
33
+ const [arrivals, setArrivals] = useState(0);
34
+ if (open && count !== last) setLast(count);
35
+ if (open !== was) {
36
+ setWas(open);
37
+ if (open) setArrivals(arrivals + 1);
38
+ }
39
+ const cameFrom = useRef(null);
40
+ const clear = (bar) => {
41
+ if (bar?.contains(document.activeElement) && cameFrom.current?.isConnected) cameFrom.current.focus();
42
+ onClear();
43
+ };
44
+ return /* @__PURE__ */ jsx("div", {
45
+ "data-slot": "action-bar-place",
46
+ className: cn("pointer-events-none z-40 flex justify-center px-2 pb-[max(1rem,env(safe-area-inset-bottom))]", places[position]),
47
+ children: /* @__PURE__ */ jsxs(Toolbar.Root, {
48
+ "data-slot": "action-bar",
49
+ "data-theme": ground,
50
+ "data-open": open ? "" : void 0,
51
+ "aria-label": label,
52
+ inert: !open,
53
+ onFocus: (event) => {
54
+ const from = event.relatedTarget;
55
+ if (from instanceof HTMLElement && !event.currentTarget.contains(from)) cameFrom.current = from;
56
+ },
57
+ onKeyDown: (event) => {
58
+ if (event.key === "Escape") clear(event.currentTarget);
59
+ },
60
+ className: cn("pointer-events-auto action-bar-motion flex max-w-full items-center gap-1 rounded-xl bg-raised depth-dock py-1.5 pr-1.5 pl-3.5 text-control text-fg", className),
61
+ ...props,
62
+ children: [
63
+ /* @__PURE__ */ jsxs("p", {
64
+ "data-slot": "action-bar-count",
65
+ "aria-live": "polite",
66
+ "aria-atomic": "true",
67
+ className: "flex shrink-0 items-center gap-1.5 pr-2 font-medium whitespace-nowrap",
68
+ children: [/* @__PURE__ */ jsx(RollingNumber, { value: open ? count : last }, arrivals), /* @__PURE__ */ jsx("span", {
69
+ className: "text-fg-body",
70
+ children: countLabel(open ? count : last)
71
+ })]
72
+ }),
73
+ /* @__PURE__ */ jsx(Toolbar.Separator, {
74
+ "data-slot": "action-bar-separator",
75
+ className: "mx-1 h-5 w-px shrink-0 bg-hairline"
76
+ }),
77
+ /* @__PURE__ */ jsx(ScrollFade, {
78
+ axis: "x",
79
+ "data-slot": "action-bar-actions",
80
+ className: "-m-1 flex min-w-0 [scrollbar-width:none] items-center gap-0.5 p-1",
81
+ children
82
+ }),
83
+ /* @__PURE__ */ jsx(Toolbar.Button, {
84
+ "data-slot": "action-bar-clear",
85
+ render: /* @__PURE__ */ jsx(Button, {
86
+ iconOnly: true,
87
+ size: "sm",
88
+ variant: "quiet",
89
+ "aria-label": clearLabel,
90
+ className: "ml-1 shrink-0 text-fg-muted"
91
+ }),
92
+ onClick: (event) => clear(event.currentTarget.closest("[data-slot=\"action-bar\"]")),
93
+ children: /* @__PURE__ */ jsx(CloseGlyph, {})
94
+ })
95
+ ]
96
+ })
97
+ });
98
+ }
99
+ /**
100
+ * One action on the selection: a quiet button on the bar, with a 14px symbol before its words
101
+ * if it helps. Where the bar is narrow (a phone), `iconOnly` leaves the symbol alone and
102
+ * `aria-label` names it. The one that cannot be undone goes last, and is confirmed in an
103
+ * `AlertDialog`.
104
+ */
105
+ function ActionBarButton({ className, disabled, ...props }) {
106
+ return /* @__PURE__ */ jsx(Toolbar.Button, {
107
+ "data-slot": "action-bar-button",
108
+ disabled,
109
+ render: /* @__PURE__ */ jsx(Button, {
110
+ size: "sm",
111
+ variant: "quiet",
112
+ ...props,
113
+ className: cn("shrink-0", className)
114
+ })
115
+ });
116
+ }
117
+ export { ActionBar, ActionBarButton };
@@ -1,6 +1,6 @@
1
1
  import { IconSvgElement } from "../icon/icon.js";
2
- import { VariantProps } from "class-variance-authority";
3
2
  import { ComponentProps } from "react";
3
+ import { VariantProps } from "class-variance-authority";
4
4
  declare const alertVariants: (props?: ({
5
5
  tone?: "neutral" | "info" | "success" | "warning" | "danger" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -1,7 +1,7 @@
1
1
  import { Icon } from "../icon/icon.js";
2
+ import { statusIconTone, statusIcons } from "../../internal/status-icon.js";
2
3
  import { cn } from "../../lib/cn.js";
3
4
  import { jsx, jsxs } from "react/jsx-runtime";
4
- import { Alert02Icon, AlertCircleIcon, CheckmarkCircle02Icon, InformationCircleIcon } from "@hugeicons/core-free-icons";
5
5
  import { cva } from "class-variance-authority";
6
6
  // src/components/alert/alert.tsx
7
7
  const alertVariants = cva("grid grid-cols-[auto_1fr] items-start gap-x-3 rounded-lg px-4 py-3 text-base text-fg-body inset-ring forced-colors:outline", {
@@ -14,20 +14,6 @@ const alertVariants = cva("grid grid-cols-[auto_1fr] items-start gap-x-3 rounded
14
14
  } },
15
15
  defaultVariants: { tone: "neutral" }
16
16
  });
17
- const icons = {
18
- neutral: InformationCircleIcon,
19
- info: InformationCircleIcon,
20
- success: CheckmarkCircle02Icon,
21
- warning: Alert02Icon,
22
- danger: AlertCircleIcon
23
- };
24
- const iconTone = {
25
- neutral: "text-fg-muted",
26
- info: "text-fg",
27
- success: "text-success",
28
- warning: "text-warning",
29
- danger: "text-danger"
30
- };
31
17
  /**
32
18
  * A message that belongs to the page, not to a moment: a plan that ends, a form that could not
33
19
  * be sent. Say what happened in the title and what to do in the description. It is announced
@@ -42,9 +28,9 @@ function Alert({ className, tone, icon, children, ...props }) {
42
28
  className: cn(alertVariants({ tone }), className),
43
29
  ...props,
44
30
  children: [/* @__PURE__ */ jsx(Icon, {
45
- icon: icon ?? icons[resolved],
31
+ icon: icon ?? statusIcons[resolved],
46
32
  size: 18,
47
- className: cn("mt-[3px]", iconTone[resolved])
33
+ className: cn("mt-[3px]", statusIconTone[resolved])
48
34
  }), /* @__PURE__ */ jsx("div", {
49
35
  className: "flex min-w-0 flex-col gap-0.5",
50
36
  children
@@ -1,5 +1,5 @@
1
- import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
2
1
  import { ComponentProps } from "react";
2
+ import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
3
3
  /**
4
4
  * A question that must be answered before anything else: confirming something that cannot be
5
5
  * undone. It has no close button and a click outside does not dismiss it. Name the consequence in
@@ -0,0 +1,33 @@
1
+ import { ComponentProps } from "react";
2
+ export type AppShellProps = ComponentProps<"div"> & {
3
+ /** Whether the sidebar is open (controlled). */
4
+ sidebarOpen?: boolean;
5
+ /** Whether the sidebar is open at first. Open unless said otherwise. */
6
+ defaultSidebarOpen?: boolean;
7
+ onSidebarOpenChange?: (open: boolean) => void;
8
+ /**
9
+ * The shortcut that collapses and expands the sidebar, written like the `keys` of a
10
+ * `Shortcut`. `false` for none.
11
+ */
12
+ sidebarShortcut?: string | false;
13
+ };
14
+ /**
15
+ * The frame of an app: the `Sidebar` on the left, the page beside it. Put the sidebar first,
16
+ * then an `AppShellPage` with the page's `AppShellBar` and its `AppShellMain`.
17
+ *
18
+ * The shell keeps whether the sidebar is open, so the `SidebarTrigger` in the bar and the
19
+ * sidebar agree. To have the sidebar come back the way it was left, keep the state yourself
20
+ * (`sidebarOpen`, `onSidebarOpenChange`) in a cookie and hand it in on the server: the page
21
+ * then arrives with the sidebar at its width, and nothing moves on load.
22
+ */
23
+ export declare function AppShell({ sidebarOpen, defaultSidebarOpen, onSidebarOpenChange, sidebarShortcut, className, ...props }: AppShellProps): import("react").JSX.Element;
24
+ /** Everything beside the sidebar: the page's bar and its content, one under the other. */
25
+ export declare function AppShellPage({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
26
+ /**
27
+ * The bar across the top of the page: the `SidebarTrigger`, where one is (`Breadcrumbs`), and
28
+ * what can be done from everywhere (the search). It stays in view while the page scrolls. What
29
+ * belongs to one page only (its title, its actions) stands in the page, not here.
30
+ */
31
+ export declare function AppShellBar({ className, ...props }: ComponentProps<"header">): import("react").JSX.Element;
32
+ /** The page itself. It is the page's `<main>`; give it an id for the skip link. */
33
+ export declare function AppShellMain({ className, ...props }: ComponentProps<"main">): import("react").JSX.Element;
@@ -0,0 +1,93 @@
1
+ "use client";
2
+ import { useShortcut } from "../shortcut/shortcut.js";
3
+ import { SIDEBAR_WIDE, SidebarStateContext } from "../sidebar/sidebar-context.js";
4
+ import { cn } from "../../lib/cn.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { useCallback, useEffect, useId, useMemo, useState } from "react";
7
+ // src/components/app-shell/app-shell.tsx
8
+ /**
9
+ * The frame of an app: the `Sidebar` on the left, the page beside it. Put the sidebar first,
10
+ * then an `AppShellPage` with the page's `AppShellBar` and its `AppShellMain`.
11
+ *
12
+ * The shell keeps whether the sidebar is open, so the `SidebarTrigger` in the bar and the
13
+ * sidebar agree. To have the sidebar come back the way it was left, keep the state yourself
14
+ * (`sidebarOpen`, `onSidebarOpenChange`) in a cookie and hand it in on the server: the page
15
+ * then arrives with the sidebar at its width, and nothing moves on load.
16
+ */
17
+ function AppShell({ sidebarOpen, defaultSidebarOpen = true, onSidebarOpenChange, sidebarShortcut = "mod+b", className, ...props }) {
18
+ const id = useId();
19
+ const [kept, setKept] = useState(defaultSidebarOpen);
20
+ const open = sidebarOpen ?? kept;
21
+ const [drawerOpen, setDrawerOpen] = useState(false);
22
+ const setOpen = useCallback((next) => {
23
+ setKept(next);
24
+ onSidebarOpenChange?.(next);
25
+ }, [onSidebarOpenChange]);
26
+ const toggle = useCallback(() => {
27
+ if (window.matchMedia("(min-width: 48rem)").matches) setOpen(!open);
28
+ else setDrawerOpen((shown) => !shown);
29
+ }, [open, setOpen]);
30
+ useShortcut(sidebarShortcut || "mod+b", toggle, { enabled: sidebarShortcut !== false });
31
+ useEffect(() => {
32
+ const query = window.matchMedia(SIDEBAR_WIDE);
33
+ const widened = () => {
34
+ if (query.matches) setDrawerOpen(false);
35
+ };
36
+ query.addEventListener("change", widened);
37
+ return () => query.removeEventListener("change", widened);
38
+ }, []);
39
+ const state = useMemo(() => ({
40
+ open,
41
+ setOpen,
42
+ drawerOpen,
43
+ setDrawerOpen,
44
+ toggle,
45
+ id,
46
+ shortcut: sidebarShortcut
47
+ }), [
48
+ open,
49
+ setOpen,
50
+ drawerOpen,
51
+ toggle,
52
+ id,
53
+ sidebarShortcut
54
+ ]);
55
+ return /* @__PURE__ */ jsx(SidebarStateContext, {
56
+ value: state,
57
+ children: /* @__PURE__ */ jsx("div", {
58
+ "data-slot": "app-shell",
59
+ "data-sidebar": open ? "expanded" : "collapsed",
60
+ className: cn("flex min-h-dvh", className),
61
+ ...props
62
+ })
63
+ });
64
+ }
65
+ /** Everything beside the sidebar: the page's bar and its content, one under the other. */
66
+ function AppShellPage({ className, ...props }) {
67
+ return /* @__PURE__ */ jsx("div", {
68
+ "data-slot": "app-shell-page",
69
+ className: cn("flex min-w-0 flex-1 flex-col", className),
70
+ ...props
71
+ });
72
+ }
73
+ /**
74
+ * The bar across the top of the page: the `SidebarTrigger`, where one is (`Breadcrumbs`), and
75
+ * what can be done from everywhere (the search). It stays in view while the page scrolls. What
76
+ * belongs to one page only (its title, its actions) stands in the page, not here.
77
+ */
78
+ function AppShellBar({ className, ...props }) {
79
+ return /* @__PURE__ */ jsx("header", {
80
+ "data-slot": "app-shell-bar",
81
+ className: cn("sticky top-0 z-10 flex h-12 shrink-0 items-center gap-2 border-b border-hairline bg-ground px-3", className),
82
+ ...props
83
+ });
84
+ }
85
+ /** The page itself. It is the page's `<main>`; give it an id for the skip link. */
86
+ function AppShellMain({ className, ...props }) {
87
+ return /* @__PURE__ */ jsx("main", {
88
+ "data-slot": "app-shell-main",
89
+ className: cn("min-w-0 flex-1 px-4 py-6 sm:px-6", className),
90
+ ...props
91
+ });
92
+ }
93
+ export { AppShell, AppShellBar, AppShellMain, AppShellPage };
@@ -0,0 +1,51 @@
1
+ import { ComponentProps } from "react";
2
+ /** Where a file stands: on its way, arrived, or failed. */
3
+ export type AttachmentStatus = "uploading" | "done" | "error";
4
+ /** `chip`: a plug in a prompt. `tile`: a file shown in a message, a picture as itself. */
5
+ export type AttachmentVariant = "chip" | "tile";
6
+ export type AttachmentProps = Omit<ComponentProps<"div">, "children"> & {
7
+ /** The file's name, as it is shown and read out: „Angebot-Kornprobst.pdf“. */
8
+ name: string;
9
+ /** Its size in bytes. */
10
+ size?: number;
11
+ /** Its MIME type, which says what kind of file it is. Without it the extension does. */
12
+ type?: string;
13
+ /** The address of a picture, which then shows itself. */
14
+ src?: string;
15
+ /** Done unless said otherwise. */
16
+ status?: AttachmentStatus;
17
+ /** Why it failed, as a sentence, where there is room for one (a tile). */
18
+ error?: string;
19
+ /** With it there is a key that takes the file away again. */
20
+ onRemove?: () => void;
21
+ /** What the key that takes it away is called, as one verb after the file's name. */
22
+ removeLabel?: string;
23
+ /** Where the file can be opened: the tile becomes a link to it. */
24
+ href?: string;
25
+ /** In a prompt's row a chip, elsewhere a tile. */
26
+ variant?: AttachmentVariant;
27
+ /**
28
+ * The face of a chip: `plug` (the default), a small raised part, or `flat`, quiet like a
29
+ * `Badge`, for a row of many or a place that is already busy.
30
+ */
31
+ chipVariant?: "plug" | "flat";
32
+ /** What each state is called. */
33
+ statusLabels?: Partial<Record<AttachmentStatus, string>>;
34
+ locale?: string;
35
+ };
36
+ /**
37
+ * A file attached to a prompt or shown in a message: a symbol for its kind, its name, its size,
38
+ * and a key that takes it away while it still can be. In a prompt it is a chip, a plug in the
39
+ * field; in a message a small flat tile, and a picture shows itself.
40
+ *
41
+ * While it uploads it carries the system's arc in place of its symbol; once it has arrived, the
42
+ * symbol comes back where the arc was. A failure is said in words („Fehlgeschlagen“, and in a
43
+ * tile why). The name is cut in its middle, so the end of it and the extension stay readable.
44
+ */
45
+ export declare function Attachment({ name, size, type, src, status, error, onRemove, removeLabel, href, variant: variantProp, chipVariant, statusLabels, locale, className, ...props }: AttachmentProps): import("react").JSX.Element;
46
+ export type MessageAttachmentsProps = ComponentProps<"div">;
47
+ /**
48
+ * The files of a message, side by side, wrapping: at the start of an answer, at the right above
49
+ * the person's words. Put `Attachment`s inside.
50
+ */
51
+ export declare function MessageAttachments({ className, ...props }: MessageAttachmentsProps): import("react").JSX.Element;