@lanfermann/ui 0.0.0-stage → 0.1.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 (216) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +17 -2
  3. package/TRADEMARK.md +10 -0
  4. package/brand/app-icon.svg +1 -0
  5. package/brand/avatar.svg +1 -0
  6. package/brand/favicon.svg +1 -0
  7. package/dist/components/accordion/accordion.d.ts +26 -0
  8. package/dist/components/accordion/accordion.js +78 -0
  9. package/dist/components/alert/alert.d.ts +19 -0
  10. package/dist/components/alert/alert.js +68 -0
  11. package/dist/components/alert-dialog/alert-dialog.d.ts +20 -0
  12. package/dist/components/alert-dialog/alert-dialog.js +75 -0
  13. package/dist/components/anchor-heading/anchor-heading.d.ts +19 -0
  14. package/dist/components/anchor-heading/anchor-heading.js +39 -0
  15. package/dist/components/avatar/avatar.d.ts +14 -0
  16. package/dist/components/avatar/avatar.js +42 -0
  17. package/dist/components/badge/badge.d.ts +12 -0
  18. package/dist/components/badge/badge.js +27 -0
  19. package/dist/components/breadcrumbs/breadcrumbs.d.ts +23 -0
  20. package/dist/components/breadcrumbs/breadcrumbs.js +63 -0
  21. package/dist/components/button/button-variants.d.ts +15 -0
  22. package/dist/components/button/button-variants.js +76 -0
  23. package/dist/components/button/button.d.ts +25 -0
  24. package/dist/components/button/button.js +50 -0
  25. package/dist/components/calendar/calendar-selection.js +216 -0
  26. package/dist/components/calendar/calendar.d.ts +44 -0
  27. package/dist/components/calendar/calendar.js +208 -0
  28. package/dist/components/callout/callout.d.ts +21 -0
  29. package/dist/components/callout/callout.js +75 -0
  30. package/dist/components/card/card.d.ts +16 -0
  31. package/dist/components/card/card.js +53 -0
  32. package/dist/components/checkbox/checkbox.d.ts +9 -0
  33. package/dist/components/checkbox/checkbox.js +33 -0
  34. package/dist/components/checkbox-group/checkbox-group.d.ts +18 -0
  35. package/dist/components/checkbox-group/checkbox-group.js +33 -0
  36. package/dist/components/code/code.d.ts +7 -0
  37. package/dist/components/code/code.js +16 -0
  38. package/dist/components/code-block/code-block-frame.js +146 -0
  39. package/dist/components/code-block/code-block-live.d.ts +45 -0
  40. package/dist/components/code-block/code-block-live.js +51 -0
  41. package/dist/components/code-block/code-block.d.ts +36 -0
  42. package/dist/components/code-block/code-block.js +51 -0
  43. package/dist/components/code-block/code-copy.d.ts +12 -0
  44. package/dist/components/code-block/code-copy.js +71 -0
  45. package/dist/components/code-block/code-lines-view.d.ts +16 -0
  46. package/dist/components/code-block/code-lines-view.js +48 -0
  47. package/dist/components/code-block/code-lines.js +17 -0
  48. package/dist/components/code-block/code-scroll.js +29 -0
  49. package/dist/components/code-block/code-surface.js +13 -0
  50. package/dist/components/code-block/code-tabs-frame.js +85 -0
  51. package/dist/components/code-block/code-tabs-store.js +25 -0
  52. package/dist/components/code-block/code-tabs.d.ts +28 -0
  53. package/dist/components/code-block/code-tabs.js +29 -0
  54. package/dist/components/code-block/highlight.d.ts +34 -0
  55. package/dist/components/code-block/highlight.js +258 -0
  56. package/dist/components/code-block/lines.d.ts +5 -0
  57. package/dist/components/code-block/lines.js +40 -0
  58. package/dist/components/collapsible/collapsible.d.ts +19 -0
  59. package/dist/components/collapsible/collapsible.js +54 -0
  60. package/dist/components/combobox/combobox.d.ts +84 -0
  61. package/dist/components/combobox/combobox.js +169 -0
  62. package/dist/components/container/container.d.ts +16 -0
  63. package/dist/components/container/container.js +30 -0
  64. package/dist/components/copy-pill/copy-pill.d.ts +52 -0
  65. package/dist/components/copy-pill/copy-pill.js +232 -0
  66. package/dist/components/cta/cta.d.ts +109 -0
  67. package/dist/components/cta/cta.js +375 -0
  68. package/dist/components/date-field/date-field.d.ts +40 -0
  69. package/dist/components/date-field/date-field.js +99 -0
  70. package/dist/components/date-range-field/date-range-field.d.ts +41 -0
  71. package/dist/components/date-range-field/date-range-field.js +155 -0
  72. package/dist/components/dialog/dialog.d.ts +29 -0
  73. package/dist/components/dialog/dialog.js +96 -0
  74. package/dist/components/docs-layout/docs-layout.d.ts +17 -0
  75. package/dist/components/docs-layout/docs-layout.js +46 -0
  76. package/dist/components/drawer/drawer.d.ts +39 -0
  77. package/dist/components/drawer/drawer.js +181 -0
  78. package/dist/components/field/field.d.ts +18 -0
  79. package/dist/components/field/field.js +77 -0
  80. package/dist/components/fieldset/fieldset.d.ts +8 -0
  81. package/dist/components/fieldset/fieldset.js +25 -0
  82. package/dist/components/figure/figure.d.ts +14 -0
  83. package/dist/components/figure/figure.js +35 -0
  84. package/dist/components/form/form.d.ts +31 -0
  85. package/dist/components/form/form.js +55 -0
  86. package/dist/components/ground/ground.d.ts +20 -0
  87. package/dist/components/ground/ground.js +31 -0
  88. package/dist/components/heading/heading.d.ts +16 -0
  89. package/dist/components/heading/heading.js +36 -0
  90. package/dist/components/icon/icon.d.ts +22 -0
  91. package/dist/components/icon/icon.js +24 -0
  92. package/dist/components/input/input.d.ts +19 -0
  93. package/dist/components/input/input.js +46 -0
  94. package/dist/components/input-group/input-group.d.ts +34 -0
  95. package/dist/components/input-group/input-group.js +61 -0
  96. package/dist/components/kbd/kbd.d.ts +6 -0
  97. package/dist/components/kbd/kbd.js +15 -0
  98. package/dist/components/link/link-variants.d.ts +13 -0
  99. package/dist/components/link/link-variants.js +27 -0
  100. package/dist/components/link/link.d.ts +9 -0
  101. package/dist/components/link/link.js +18 -0
  102. package/dist/components/logo/logo-paths.js +22 -0
  103. package/dist/components/logo/logomark.d.ts +19 -0
  104. package/dist/components/logo/logomark.js +49 -0
  105. package/dist/components/logo/wordmark.d.ts +35 -0
  106. package/dist/components/logo/wordmark.js +48 -0
  107. package/dist/components/menu/menu.d.ts +26 -0
  108. package/dist/components/menu/menu.js +132 -0
  109. package/dist/components/meter/meter.d.ts +29 -0
  110. package/dist/components/meter/meter.js +68 -0
  111. package/dist/components/navigation-menu/navigation-menu-variants.d.ts +12 -0
  112. package/dist/components/navigation-menu/navigation-menu-variants.js +18 -0
  113. package/dist/components/navigation-menu/navigation-menu.d.ts +42 -0
  114. package/dist/components/navigation-menu/navigation-menu.js +128 -0
  115. package/dist/components/number-field/number-field.d.ts +32 -0
  116. package/dist/components/number-field/number-field.js +85 -0
  117. package/dist/components/page-header/page-header.d.ts +27 -0
  118. package/dist/components/page-header/page-header.js +48 -0
  119. package/dist/components/pager/pager.d.ts +24 -0
  120. package/dist/components/pager/pager.js +51 -0
  121. package/dist/components/parameter-list/parameter-list.d.ts +34 -0
  122. package/dist/components/parameter-list/parameter-list.js +70 -0
  123. package/dist/components/popover/popover.d.ts +15 -0
  124. package/dist/components/popover/popover.js +64 -0
  125. package/dist/components/progress/progress.d.ts +19 -0
  126. package/dist/components/progress/progress.js +67 -0
  127. package/dist/components/prose/prose.d.ts +13 -0
  128. package/dist/components/prose/prose.js +22 -0
  129. package/dist/components/quote/quote.d.ts +21 -0
  130. package/dist/components/quote/quote.js +46 -0
  131. package/dist/components/radio/radio.d.ts +12 -0
  132. package/dist/components/radio/radio.js +37 -0
  133. package/dist/components/reference-entry/reference-entry.d.ts +25 -0
  134. package/dist/components/reference-entry/reference-entry.js +66 -0
  135. package/dist/components/section/section.d.ts +13 -0
  136. package/dist/components/section/section.js +30 -0
  137. package/dist/components/segmented-control/segmented-control.d.ts +42 -0
  138. package/dist/components/segmented-control/segmented-control.js +413 -0
  139. package/dist/components/select/select.d.ts +70 -0
  140. package/dist/components/select/select.js +189 -0
  141. package/dist/components/separator/separator.d.ts +12 -0
  142. package/dist/components/separator/separator.js +29 -0
  143. package/dist/components/side-nav/side-nav.d.ts +48 -0
  144. package/dist/components/side-nav/side-nav.js +89 -0
  145. package/dist/components/site-footer/site-footer-floor.js +48 -0
  146. package/dist/components/site-footer/site-footer.d.ts +38 -0
  147. package/dist/components/site-footer/site-footer.js +96 -0
  148. package/dist/components/site-header/site-header.d.ts +77 -0
  149. package/dist/components/site-header/site-header.js +214 -0
  150. package/dist/components/slider/slider.d.ts +42 -0
  151. package/dist/components/slider/slider.js +279 -0
  152. package/dist/components/spinner/spinner.d.ts +15 -0
  153. package/dist/components/spinner/spinner.js +34 -0
  154. package/dist/components/switch/switch.d.ts +8 -0
  155. package/dist/components/switch/switch.js +28 -0
  156. package/dist/components/table/table.d.ts +83 -0
  157. package/dist/components/table/table.js +123 -0
  158. package/dist/components/table-of-contents/table-of-contents.d.ts +32 -0
  159. package/dist/components/table-of-contents/table-of-contents.js +187 -0
  160. package/dist/components/tabs/tabs.d.ts +28 -0
  161. package/dist/components/tabs/tabs.js +124 -0
  162. package/dist/components/text/text.d.ts +16 -0
  163. package/dist/components/text/text.js +63 -0
  164. package/dist/components/textarea/textarea.d.ts +19 -0
  165. package/dist/components/textarea/textarea.js +30 -0
  166. package/dist/components/time-field/time-field.d.ts +40 -0
  167. package/dist/components/time-field/time-field.js +123 -0
  168. package/dist/components/toast/toast.d.ts +55 -0
  169. package/dist/components/toast/toast.js +129 -0
  170. package/dist/components/tooltip/tooltip.d.ts +16 -0
  171. package/dist/components/tooltip/tooltip.js +41 -0
  172. package/dist/index.d.ts +79 -0
  173. package/dist/index.js +77 -0
  174. package/dist/internal/arrow.js +41 -0
  175. package/dist/internal/disclosure.js +20 -0
  176. package/dist/internal/field-context.js +21 -0
  177. package/dist/internal/field.d.ts +23 -0
  178. package/dist/internal/field.js +49 -0
  179. package/dist/internal/glyphs.js +84 -0
  180. package/dist/internal/iso-date.d.ts +2 -0
  181. package/dist/internal/iso-date.js +268 -0
  182. package/dist/internal/overlay.js +40 -0
  183. package/dist/internal/picker-sheet.js +74 -0
  184. package/dist/internal/popup.js +37 -0
  185. package/dist/internal/range-shape.js +295 -0
  186. package/dist/internal/reduced-motion.js +19 -0
  187. package/dist/internal/scroll-edges.js +45 -0
  188. package/dist/internal/trough.js +39 -0
  189. package/dist/internal/typed-input.d.ts +16 -0
  190. package/dist/internal/typed-input.js +133 -0
  191. package/dist/lib/cn.d.ts +11 -0
  192. package/dist/lib/cn.js +98 -0
  193. package/dist/motion/inertia.js +111 -0
  194. package/dist/motion/spring-step.js +35 -0
  195. package/dist/motion/springs.d.ts +78 -0
  196. package/dist/motion/springs.js +81 -0
  197. package/package.json +107 -4
  198. package/src/styles/base.css +93 -0
  199. package/src/styles/calendar.css +117 -0
  200. package/src/styles/code.css +252 -0
  201. package/src/styles/density.css +53 -0
  202. package/src/styles/depth.css +501 -0
  203. package/src/styles/grounds.css +191 -0
  204. package/src/styles/marks.css +50 -0
  205. package/src/styles/motion.css +55 -0
  206. package/src/styles/motion.generated.css +101 -0
  207. package/src/styles/prose.css +252 -0
  208. package/src/styles/radius.css +20 -0
  209. package/src/styles/segmented.css +208 -0
  210. package/src/styles/slider.css +110 -0
  211. package/src/styles/status.css +108 -0
  212. package/src/styles/tabs.css +39 -0
  213. package/src/styles/toast.css +106 -0
  214. package/src/styles/touch.css +41 -0
  215. package/src/styles/type.css +54 -0
  216. package/src/styles.css +38 -0
@@ -0,0 +1,40 @@
1
+ // src/components/code-block/lines.ts
2
+ /** The lines a spec names. Numbers that are not lines are ignored, not an error. */
3
+ function parseLines(spec) {
4
+ const lines = /* @__PURE__ */ new Set();
5
+ if (spec === void 0) return lines;
6
+ const add = (from, to) => {
7
+ for (let line = Math.min(from, to); line <= Math.max(from, to); line++) if (Number.isInteger(line) && line > 0) lines.add(line);
8
+ };
9
+ if (typeof spec === "number") add(spec, spec);
10
+ else if (typeof spec === "string") for (const part of spec.split(",")) {
11
+ const range = /^\s*(\d+)\s*(?:-\s*(\d+)\s*)?$/.exec(part);
12
+ if (range?.[1]) add(Number(range[1]), Number(range[2] ?? range[1]));
13
+ }
14
+ else for (const part of spec) if (typeof part === "number") add(part, part);
15
+ else add(part[0], part[1]);
16
+ return lines;
17
+ }
18
+ /** Code as it is shown: one trailing line break is left out, as an editor's last line has one. */
19
+ function trimCode(code) {
20
+ return code.replace(/\r\n?/g, "\n").replace(/\n$/, "");
21
+ }
22
+ /**
23
+ * What the copy button puts on the clipboard: the code as it stands after the change, so the
24
+ * removed lines of a diff are left out. The signs and line numbers are never part of the text.
25
+ */
26
+ function copyText(code, removed) {
27
+ const drop = parseLines(removed);
28
+ const lines = trimCode(code).split("\n");
29
+ return drop.size === 0 ? lines.join("\n") : lines.filter((_, i) => !drop.has(i + 1)).join("\n");
30
+ }
31
+ /** What each line is. Added and removed win over marked: a change is the stronger fact. */
32
+ function lineKinds(count, { marked, added, removed }) {
33
+ const [m, a, r] = [
34
+ parseLines(marked),
35
+ parseLines(added),
36
+ parseLines(removed)
37
+ ];
38
+ return Array.from({ length: count }, (_, i) => r.has(i + 1) ? "removed" : a.has(i + 1) ? "added" : m.has(i + 1) ? "marked" : void 0);
39
+ }
40
+ export { copyText, lineKinds, parseLines, trimCode };
@@ -0,0 +1,19 @@
1
+ import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
2
+ export type CollapsibleProps = Collapsible$1.Root.Props;
3
+ /**
4
+ * One thing that can be folded away: the optional part of a form ("Weitere Angaben"), the
5
+ * details under a sum. For several rows of the same kind, use an `Accordion`.
6
+ *
7
+ * Name the trigger after what is inside, not after the action: "Weitere Angaben", not
8
+ * "Mehr anzeigen". The chevron already says that it opens.
9
+ */
10
+ export declare function Collapsible({ className, ...props }: CollapsibleProps): import("react").JSX.Element;
11
+ export type CollapsibleTriggerProps = Collapsible$1.Trigger.Props;
12
+ /**
13
+ * A line of text with a chevron in front that turns down when the panel opens. It is as tall as
14
+ * a control, so it lines up with the fields around it.
15
+ */
16
+ export declare function CollapsibleTrigger({ className, children, ...props }: CollapsibleTriggerProps): import("react").JSX.Element;
17
+ export type CollapsiblePanelProps = Collapsible$1.Panel.Props;
18
+ /** What was folded away. It opens on `settle` to its own height and leaves faster than it came. */
19
+ export declare function CollapsiblePanel({ className, children, ...props }: CollapsiblePanelProps): import("react").JSX.Element;
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import { disclosureChevron, disclosurePanel } from "../../internal/disclosure.js";
3
+ import { ChevronRightGlyph } from "../../internal/glyphs.js";
4
+ import { cn, mergeClassName } from "../../lib/cn.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
7
+ // src/components/collapsible/collapsible.tsx
8
+ /**
9
+ * One thing that can be folded away: the optional part of a form ("Weitere Angaben"), the
10
+ * details under a sum. For several rows of the same kind, use an `Accordion`.
11
+ *
12
+ * Name the trigger after what is inside, not after the action: "Weitere Angaben", not
13
+ * "Mehr anzeigen". The chevron already says that it opens.
14
+ */
15
+ function Collapsible({ className, ...props }) {
16
+ return /* @__PURE__ */ jsx(Collapsible$1.Root, {
17
+ "data-slot": "collapsible",
18
+ className: mergeClassName("flex flex-col items-start", className),
19
+ ...props
20
+ });
21
+ }
22
+ /**
23
+ * A line of text with a chevron in front that turns down when the panel opens. It is as tall as
24
+ * a control, so it lines up with the fields around it.
25
+ */
26
+ function CollapsibleTrigger({ className, children, ...props }) {
27
+ return /* @__PURE__ */ jsxs(Collapsible$1.Trigger, {
28
+ "data-slot": "collapsible-trigger",
29
+ className: mergeClassName([
30
+ "group touch-target relative -mx-1.5 inline-flex min-h-(--control-md) items-center gap-1.5 rounded-md px-1.5 text-control font-medium text-fg select-none",
31
+ "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",
32
+ "data-disabled:pointer-events-none data-disabled:text-on-disabled"
33
+ ], className),
34
+ ...props,
35
+ children: [/* @__PURE__ */ jsx(ChevronRightGlyph, {
36
+ "data-slot": "collapsible-chevron",
37
+ className: cn(disclosureChevron, "-ml-1 group-data-panel-open:rotate-90")
38
+ }), children]
39
+ });
40
+ }
41
+ /** What was folded away. It opens on `settle` to its own height and leaves faster than it came. */
42
+ function CollapsiblePanel({ className, children, ...props }) {
43
+ return /* @__PURE__ */ jsx(Collapsible$1.Panel, {
44
+ "data-slot": "collapsible-panel",
45
+ className: mergeClassName(["-mx-1 h-(--collapsible-panel-height) self-stretch", disclosurePanel], className),
46
+ ...props,
47
+ children: /* @__PURE__ */ jsx("div", {
48
+ "data-slot": "collapsible-panel-content",
49
+ className: "px-1 pt-2 pb-1",
50
+ children
51
+ })
52
+ });
53
+ }
54
+ export { Collapsible, CollapsiblePanel, CollapsibleTrigger };
@@ -0,0 +1,84 @@
1
+ import { IconSvgElement } from "../icon/icon.js";
2
+ import { FieldSize } from "../../internal/field.js";
3
+ import { ReactNode } from "react";
4
+ import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
5
+ /** One entry of a combobox's `items`. The whole object is the value that gets chosen. */
6
+ export type ComboboxOption<Value = string> = {
7
+ /** What is submitted with a form. */
8
+ value: Value;
9
+ /** What is shown, typed against, and put into the input once chosen. */
10
+ label: string;
11
+ /** Stands before the label in the list. Give every option one or none. */
12
+ icon?: IconSvgElement;
13
+ /** A second, quieter fact at the right edge of the row: a place, a number, a price. */
14
+ detail?: ReactNode;
15
+ };
16
+ /** A labelled group of options, as Base UI's `items` accepts it. */
17
+ export type ComboboxOptionGroup<Value = string> = {
18
+ value: string;
19
+ items: ReadonlyArray<ComboboxOption<Value>>;
20
+ };
21
+ export type ComboboxProps<Option> = Combobox$1.Root.Props<Option, false>;
22
+ /**
23
+ * A select you can type into: for lists too long to scan (a customer out of two hundred), where
24
+ * people know what they are looking for. Typing filters the list; only an entry of the list can
25
+ * be chosen. For five to fifteen options a `Select` is calmer.
26
+ *
27
+ * Pass the options as `items` (`{ value, label, icon?, detail? }`). The chosen option, the whole
28
+ * object, is the value: `defaultValue={items[0]}`, `onValueChange={(option) => …}`. In a form
29
+ * its `value` is what is submitted.
30
+ *
31
+ * Typing ignores case and accents: "gart" finds "Gärtnerei" and "cafe" finds "Café". Pass
32
+ * `locale` (`"de-DE"`) so that does not depend on the machine. The first match is highlighted
33
+ * while typing, so Enter takes it.
34
+ */
35
+ export declare function Combobox<Option>({ autoHighlight, filter, locale, ...props }: ComboboxProps<Option>): import("react").JSX.Element;
36
+ export type ComboboxInputProps = Omit<Combobox$1.Input.Props, "className" | "size"> & {
37
+ /** The size of the field, from the density. */
38
+ size?: FieldSize;
39
+ /** Classes for the field as a whole, e.g. its width. */
40
+ className?: string;
41
+ /** The accessible name of the button that clears the choice. */
42
+ clearLabel?: string;
43
+ /** The accessible name of the button that opens the list. */
44
+ openLabel?: string;
45
+ };
46
+ /**
47
+ * The field: an input to type into, a cross that clears the choice once there is one, and a
48
+ * chevron that opens the whole list. Give it a name with a `FieldLabel` or an `aria-label`; a
49
+ * placeholder is an example ("z. B. Schreinerei Huber"), not a label.
50
+ */
51
+ export declare function ComboboxInput({ className, size, clearLabel, openLabel, ...props }: ComboboxInputProps): import("react").JSX.Element;
52
+ export type ComboboxContentProps = Omit<Combobox$1.Popup.Props, "children"> & Pick<Combobox$1.Positioner.Props, "side" | "align" | "sideOffset" | "alignOffset"> & {
53
+ /**
54
+ * Said when nothing matches what was typed. Name what was looked for ("Kein Kunde
55
+ * gefunden."), not the mechanism.
56
+ */
57
+ empty?: ReactNode;
58
+ /** The accessible name of the list, for when the field's label does not reach it. */
59
+ listLabel?: string;
60
+ /** The rows: a function of each item, or `ComboboxGroup`s for grouped items. */
61
+ children?: Combobox$1.List.Props["children"];
62
+ };
63
+ /**
64
+ * The list, as a sheet that grows out of the field and is at least as wide. It looks and behaves
65
+ * like the list of a `Select` or a `Menu`.
66
+ */
67
+ export declare function ComboboxContent({ className, side, align, sideOffset, alignOffset, empty, listLabel, children, ...props }: ComboboxContentProps): import("react").JSX.Element;
68
+ export type ComboboxItemProps = Combobox$1.Item.Props & {
69
+ /** Stands before the label. Defaults to the option's `icon`. */
70
+ icon?: IconSvgElement;
71
+ /** Set at the right edge, muted. Defaults to the option's `detail`. */
72
+ detail?: ReactNode;
73
+ };
74
+ /**
75
+ * One row. Pass the option as `value`; its label, icon and detail are shown unless you give
76
+ * children or props of your own. The chosen row carries the disc, as in a `Select`.
77
+ */
78
+ export declare function ComboboxItem({ className, children, icon, detail, value, ...props }: ComboboxItemProps): import("react").JSX.Element;
79
+ /** A group of rows. Pass the group's `items`, then a `ComboboxGroupLabel` and a `ComboboxCollection`. */
80
+ export declare const ComboboxGroup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
81
+ /** Renders the rows of the `ComboboxGroup` it stands in: a function of each item. */
82
+ export declare const ComboboxCollection: typeof Combobox$1.Collection;
83
+ export declare function ComboboxGroupLabel({ className, ...props }: Combobox$1.GroupLabel.Props): import("react").JSX.Element;
84
+ export declare function ComboboxSeparator({ className, ...props }: Combobox$1.Separator.Props): import("react").JSX.Element;
@@ -0,0 +1,169 @@
1
+ "use client";
2
+ import { useGround } from "../ground/ground.js";
3
+ import { Icon } from "../icon/icon.js";
4
+ import { bareControl, fieldShell, fieldShellSize, focusFieldControl } from "../../internal/field.js";
5
+ import { ChevronDownGlyph, CloseGlyph } from "../../internal/glyphs.js";
6
+ import { listGroupLabel, listItem, listSeparator, listSheet, popupMotion } from "../../internal/popup.js";
7
+ import { cn, mergeClassName } from "../../lib/cn.js";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
10
+ // src/components/combobox/combobox.tsx
11
+ /**
12
+ * A select you can type into: for lists too long to scan (a customer out of two hundred), where
13
+ * people know what they are looking for. Typing filters the list; only an entry of the list can
14
+ * be chosen. For five to fifteen options a `Select` is calmer.
15
+ *
16
+ * Pass the options as `items` (`{ value, label, icon?, detail? }`). The chosen option, the whole
17
+ * object, is the value: `defaultValue={items[0]}`, `onValueChange={(option) => …}`. In a form
18
+ * its `value` is what is submitted.
19
+ *
20
+ * Typing ignores case and accents: "gart" finds "Gärtnerei" and "cafe" finds "Café". Pass
21
+ * `locale` (`"de-DE"`) so that does not depend on the machine. The first match is highlighted
22
+ * while typing, so Enter takes it.
23
+ */
24
+ function Combobox({ autoHighlight = true, filter, locale, ...props }) {
25
+ const folding = Combobox$1.useFilter({
26
+ locale,
27
+ usage: "sort",
28
+ sensitivity: "base"
29
+ });
30
+ return /* @__PURE__ */ jsx(Combobox$1.Root, {
31
+ autoHighlight,
32
+ locale,
33
+ filter: filter === void 0 ? folding.contains : filter,
34
+ ...props
35
+ });
36
+ }
37
+ /** A small quiet button inside the field: the clear cross and the chevron. */
38
+ const innerButton = [
39
+ "relative flex size-[calc(var(--field-height)-8px)] shrink-0 items-center justify-center rounded-[calc(var(--field-radius)-3px)] text-fg-muted select-none last:mr-1 touch-target",
40
+ "hover:bg-hover hover:text-fg",
41
+ "focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-accent",
42
+ "data-disabled:pointer-events-none data-disabled:text-on-disabled"
43
+ ].join(" ");
44
+ /**
45
+ * The field: an input to type into, a cross that clears the choice once there is one, and a
46
+ * chevron that opens the whole list. Give it a name with a `FieldLabel` or an `aria-label`; a
47
+ * placeholder is an example ("z. B. Schreinerei Huber"), not a label.
48
+ */
49
+ function ComboboxInput({ className, size = "md", clearLabel = "Auswahl löschen", openLabel = "Liste öffnen", ...props }) {
50
+ return /* @__PURE__ */ jsxs(Combobox$1.InputGroup, {
51
+ "data-slot": "combobox-input-group",
52
+ "data-size": size,
53
+ className: cn(fieldShell, fieldShellSize[size], className),
54
+ onMouseDown: focusFieldControl,
55
+ children: [
56
+ /* @__PURE__ */ jsx(Combobox$1.Input, {
57
+ "data-slot": "combobox-input",
58
+ "data-field-control": "",
59
+ className: bareControl,
60
+ ...props
61
+ }),
62
+ /* @__PURE__ */ jsx(Combobox$1.Clear, {
63
+ "data-slot": "combobox-clear",
64
+ "aria-label": clearLabel,
65
+ className: cn(innerButton, "transition-[opacity,scale] spring-snap data-disabled:hidden data-starting-style:scale-75 data-starting-style:opacity-0", "data-ending-style:opacity-0 data-ending-style:spring-leave"),
66
+ children: /* @__PURE__ */ jsx(CloseGlyph, {})
67
+ }),
68
+ /* @__PURE__ */ jsx(Combobox$1.Trigger, {
69
+ "data-slot": "combobox-trigger",
70
+ "aria-label": openLabel,
71
+ className: innerButton,
72
+ children: /* @__PURE__ */ jsx(ChevronDownGlyph, {})
73
+ })
74
+ ]
75
+ });
76
+ }
77
+ /**
78
+ * The list, as a sheet that grows out of the field and is at least as wide. It looks and behaves
79
+ * like the list of a `Select` or a `Menu`.
80
+ */
81
+ function ComboboxContent({ className, side = "bottom", align = "start", sideOffset = 6, alignOffset, empty = "Nichts gefunden.", listLabel = "Vorschläge", children, ...props }) {
82
+ const ground = useGround();
83
+ return /* @__PURE__ */ jsx(Combobox$1.Portal, { children: /* @__PURE__ */ jsx(Combobox$1.Positioner, {
84
+ "data-slot": "combobox-positioner",
85
+ side,
86
+ align,
87
+ sideOffset,
88
+ alignOffset,
89
+ className: "z-50 outline-none",
90
+ children: /* @__PURE__ */ jsxs(Combobox$1.Popup, {
91
+ "data-slot": "combobox-content",
92
+ "data-theme": ground,
93
+ className: mergeClassName([
94
+ listSheet,
95
+ popupMotion,
96
+ "max-w-(--available-width) min-w-(--anchor-width)"
97
+ ], className),
98
+ ...props,
99
+ children: [/* @__PURE__ */ jsx(Combobox$1.Empty, {
100
+ "data-slot": "combobox-empty",
101
+ className: "text-control text-fg-muted not-empty:px-2.5 not-empty:py-1.5",
102
+ children: empty
103
+ }), /* @__PURE__ */ jsx(Combobox$1.List, {
104
+ "data-slot": "combobox-list",
105
+ "aria-label": listLabel,
106
+ className: "max-h-[min(20rem,calc(var(--available-height)-0.5rem))] scroll-py-1 overflow-y-auto overscroll-contain outline-none",
107
+ children
108
+ })]
109
+ })
110
+ }) });
111
+ }
112
+ function isOption(value) {
113
+ return typeof value === "object" && value !== null && "label" in value;
114
+ }
115
+ /**
116
+ * One row. Pass the option as `value`; its label, icon and detail are shown unless you give
117
+ * children or props of your own. The chosen row carries the disc, as in a `Select`.
118
+ */
119
+ function ComboboxItem({ className, children, icon, detail, value, ...props }) {
120
+ const itemValue = value;
121
+ const option = isOption(itemValue) ? itemValue : void 0;
122
+ const resolvedIcon = icon ?? option?.icon;
123
+ const resolvedDetail = detail ?? option?.detail;
124
+ return /* @__PURE__ */ jsxs(Combobox$1.Item, {
125
+ "data-slot": "combobox-item",
126
+ value: itemValue,
127
+ className: mergeClassName(["group", listItem], className),
128
+ ...props,
129
+ children: [
130
+ /* @__PURE__ */ jsx("span", {
131
+ "aria-hidden": true,
132
+ className: "mark mark-quiet group-data-selected:mark-on"
133
+ }),
134
+ resolvedIcon && /* @__PURE__ */ jsx(Icon, {
135
+ icon: resolvedIcon,
136
+ className: "text-fg-muted"
137
+ }),
138
+ /* @__PURE__ */ jsx("span", {
139
+ "data-slot": "combobox-item-text",
140
+ className: "min-w-0 truncate",
141
+ children: children ?? option?.label
142
+ }),
143
+ resolvedDetail !== void 0 && /* @__PURE__ */ jsx("span", {
144
+ "data-slot": "combobox-item-detail",
145
+ className: "ml-auto shrink-0 pl-3 whitespace-nowrap text-fg-muted tabular-nums",
146
+ children: resolvedDetail
147
+ })
148
+ ]
149
+ });
150
+ }
151
+ /** A group of rows. Pass the group's `items`, then a `ComboboxGroupLabel` and a `ComboboxCollection`. */
152
+ const ComboboxGroup = Combobox$1.Group;
153
+ /** Renders the rows of the `ComboboxGroup` it stands in: a function of each item. */
154
+ const ComboboxCollection = Combobox$1.Collection;
155
+ function ComboboxGroupLabel({ className, ...props }) {
156
+ return /* @__PURE__ */ jsx(Combobox$1.GroupLabel, {
157
+ "data-slot": "combobox-group-label",
158
+ className: mergeClassName(listGroupLabel, className),
159
+ ...props
160
+ });
161
+ }
162
+ function ComboboxSeparator({ className, ...props }) {
163
+ return /* @__PURE__ */ jsx(Combobox$1.Separator, {
164
+ "data-slot": "combobox-separator",
165
+ className: mergeClassName(listSeparator, className),
166
+ ...props
167
+ });
168
+ }
169
+ export { Combobox, ComboboxCollection, ComboboxContent, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxSeparator };
@@ -0,0 +1,16 @@
1
+ import { VariantProps } from "class-variance-authority";
2
+ import { ComponentProps } from "react";
3
+ /**
4
+ * The width of a page as class names, so the bar of a `SiteHeader` and the rows of a `SiteFooter`
5
+ * line up with the content between them. The gutter is added to the width: the content is as wide
6
+ * as the size says, at every window width that has room for it.
7
+ */
8
+ export declare const containerVariants: (props?: ({
9
+ size?: "text" | "page" | null | undefined;
10
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
11
+ export type ContainerProps = ComponentProps<"div"> & VariantProps<typeof containerVariants>;
12
+ /**
13
+ * Centres content at the width of a page and keeps it off the window's edge. Everything on a
14
+ * website stands in one: the sections, and the insides of the header and the footer.
15
+ */
16
+ export declare function Container({ size, className, ...props }: ContainerProps): import("react").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { cn } from "../../lib/cn.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { cva } from "class-variance-authority";
4
+ // src/components/container/container.tsx
5
+ /**
6
+ * The width of a page as class names, so the bar of a `SiteHeader` and the rows of a `SiteFooter`
7
+ * line up with the content between them. The gutter is added to the width: the content is as wide
8
+ * as the size says, at every window width that has room for it.
9
+ */
10
+ const containerVariants = cva("mx-auto w-full px-(--container-gutter) [--container-gutter:1.25rem] sm:[--container-gutter:2rem]", {
11
+ variants: { size: {
12
+ /** 72rem: a page, with room for a wide figure beside its reading. */
13
+ page: "max-w-[calc(72rem+2*var(--container-gutter))]",
14
+ /** 48rem: running text, at most about 80 characters of body copy. */
15
+ text: "max-w-[calc(48rem+2*var(--container-gutter))]"
16
+ } },
17
+ defaultVariants: { size: "page" }
18
+ });
19
+ /**
20
+ * Centres content at the width of a page and keeps it off the window's edge. Everything on a
21
+ * website stands in one: the sections, and the insides of the header and the footer.
22
+ */
23
+ function Container({ size, className, ...props }) {
24
+ return /* @__PURE__ */ jsx("div", {
25
+ "data-slot": "container",
26
+ className: cn(containerVariants({ size }), className),
27
+ ...props
28
+ });
29
+ }
30
+ export { Container, containerVariants };
@@ -0,0 +1,52 @@
1
+ import { ComponentProps, ReactNode } from "react";
2
+ export type CopyPillProps = Omit<ComponentProps<"button">, "children" | "onClick" | "type" | "aria-label"> & {
3
+ /** What goes to the clipboard. */
4
+ text: string;
5
+ /** Its first line, shown when the pill opens. Without it the pill stays closed. */
6
+ preview?: string;
7
+ /** The key, and the name of the control: the thing, then the action ("Prompt kopieren"). */
8
+ label: string;
9
+ /** What is announced once it is copied ("Prompt kopiert."). */
10
+ copied: string;
11
+ /** `lg` where the pill is the main action of a view. */
12
+ size?: "md" | "lg";
13
+ /** Seconds between two turns of the marks; `false` lets them stand. */
14
+ turnEvery?: number | false;
15
+ /** Called once the text has reached the clipboard. */
16
+ onCopied?: () => void;
17
+ /** The marks of what the text is for: one `CopyPillMark` each. */
18
+ children?: ReactNode;
19
+ };
20
+ /**
21
+ * A text to hand on (a prompt for an agent, a command, a link) as one fitting: a trough that
22
+ * holds the marks of where it goes, each a plug seated in it, and the key that copies it. The
23
+ * whole fitting is the button: a press anywhere in it copies.
24
+ *
25
+ * The marks lie on each other like a fanned stack, the first on top. They take turns: the one on
26
+ * top goes to the back, the others close up one after another. Under a pointer that rests on it,
27
+ * or with the keyboard's focus on it, the pill opens: the stack gathers to one plug, the trough
28
+ * shows the first line of what will be copied, and the key keeps only its symbol. A copy is
29
+ * confirmed in the key, by the tick drawing itself; there is no toast.
30
+ *
31
+ * Word the key as the thing, then the action ("Prompt kopieren"). Say beside the pill what the
32
+ * text is for; the marks alone are decoration to assistive tech.
33
+ *
34
+ * Motion. Opening waits a moment for the pointer to rest and closing for it to stay away, so a
35
+ * pass over the pill does not make it flicker. Everything that sets the pill's width (the room
36
+ * for the stack, the preview, the key) moves on one spring, `glide`, in both directions: on
37
+ * different curves their sum, the pill's outer edge, would shrink too far and come back. So the
38
+ * container never swings. What swings is inside it: let go, each mark comes back on `recoil`,
39
+ * one after another, past its place once into the gap before the key. The mark that goes to the
40
+ * back has the slider thumb's inertia: its speed stretches it along the way, and it comes to
41
+ * rest on `rebound`. Under reduced motion the marks stand still and nothing travels.
42
+ *
43
+ * The opening changes the pill's width, which is laid out and not a transform. That is the
44
+ * exception to the system's rule, and it holds because the pill only opens under a pointer or
45
+ * the keyboard: never on a phone, where a laid-out width stutters.
46
+ */
47
+ export declare function CopyPill({ text, preview, label, copied: copiedLabel, size, turnEvery, onCopied, className, style, children, ...props }: CopyPillProps): import("react").JSX.Element;
48
+ /**
49
+ * One mark in the pill: a plug seated in the trough, holding a logo or an icon at half its
50
+ * height. It is decoration; say in words beside the pill what the text is for.
51
+ */
52
+ export declare function CopyPillMark({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;