@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,155 @@
1
+ "use client";
2
+ import { Calendar } from "../calendar/calendar.js";
3
+ import { InputGroup } from "../input-group/input-group.js";
4
+ import { Popover } from "../popover/popover.js";
5
+ import { DEFAULT_END_TIME, DEFAULT_TIME, formatGermanRange, outsideLimits, parseGermanMoment, parseGermanRange, parseIsoDate, parseIsoInterval, splitIsoMoment, toIsoInterval } from "../../internal/iso-date.js";
6
+ import { PickerButton, PickerSheet, PickerTime } from "../../internal/picker-sheet.js";
7
+ import { TypedInput, useTypedValue } from "../../internal/typed-input.js";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { useRef, useState } from "react";
10
+ // src/components/date-range-field/date-range-field.tsx
11
+ /** Both ends as they are stored: with their times, in order, or as days only. */
12
+ function settle(from, to, time) {
13
+ if (!time) return {
14
+ from: from.date,
15
+ to: to.date
16
+ };
17
+ const start = from.time || "09:00";
18
+ const end = to.time || (from.date === to.date && start > "17:00" ? start : "17:00");
19
+ const first = `${from.date}T${start}`;
20
+ const last = `${to.date}T${end}`;
21
+ return first <= last ? {
22
+ from: first,
23
+ to: last
24
+ } : {
25
+ from: last,
26
+ to: first
27
+ };
28
+ }
29
+ /**
30
+ * A span of days: "Urlaub vom … bis", "Leistungszeitraum". With `time`, from a moment to a
31
+ * moment: a booking.
32
+ *
33
+ * It is typed the German way and read when the field is left: `14.11. – 30.11.2026`,
34
+ * `14.–30.11.`, `14.11.2026 bis 30.11.2026`; with times `14.11., 9:00 – 16.11., 17:00` or, on one
35
+ * day, `14.11. 9–17 Uhr`. One date alone is a range of that day. In the calendar the first press
36
+ * sets one end and the second the other; with times, each end has a small `TimeField` under it.
37
+ *
38
+ * The value is `{ from, to }` in ISO strings. Inside a `Form`, `name` submits both as one ISO
39
+ * interval, `2026-11-14/2026-11-30`: split it at the slash.
40
+ */
41
+ function DateRangeField({ value, defaultValue, onValueChange, min, max, time = false, hourCycle = 24, size, className, today, disabled, ...props }) {
42
+ const now = parseIsoDate(today);
43
+ const example = hourCycle === 12 ? "14.11., 9:00 AM – 16.11., 5:00 PM" : "14.11., 09:00 – 16.11., 17:00";
44
+ const typed = useTypedValue({
45
+ value: value && toIsoInterval(value),
46
+ defaultValue: toIsoInterval(defaultValue),
47
+ onValueChange: onValueChange && ((interval) => onValueChange(parseIsoInterval(interval))),
48
+ show: (interval) => formatGermanRange(parseIsoInterval(interval), hourCycle),
49
+ read: (text) => {
50
+ const day = parseGermanMoment(text, now);
51
+ const read = parseGermanRange(text, now) ?? (day && {
52
+ from: day,
53
+ to: day
54
+ });
55
+ if (!read) return { problem: time ? `Bitte geben Sie Beginn und Ende ein, zum Beispiel ${example}.` : "Bitte geben Sie einen Zeitraum ein, zum Beispiel 14.11. – 30.11.2026." };
56
+ const outside = outsideLimits(read.from.date, min, max) ?? outsideLimits(read.to.date, min, max);
57
+ if (outside) return { problem: outside };
58
+ return toIsoInterval(settle(read.from, read.to, time));
59
+ }
60
+ });
61
+ const [open, setOpen] = useState(false);
62
+ const field = useRef(null);
63
+ const range = parseIsoInterval(typed.value);
64
+ const from = splitIsoMoment(range.from);
65
+ const to = splitIsoMoment(range.to);
66
+ const [waiting, setWaiting] = useState({
67
+ from: DEFAULT_TIME,
68
+ to: DEFAULT_END_TIME
69
+ });
70
+ const clock = {
71
+ from: from?.time || waiting.from,
72
+ to: to?.time || waiting.to
73
+ };
74
+ const setClock = (end, next) => {
75
+ const times = {
76
+ ...clock,
77
+ [end]: next
78
+ };
79
+ setWaiting(times);
80
+ if (!from || !to) return;
81
+ typed.set(toIsoInterval(settle({
82
+ date: from.date,
83
+ time: times.from
84
+ }, {
85
+ date: to.date,
86
+ time: times.to
87
+ }, true)));
88
+ };
89
+ return /* @__PURE__ */ jsxs(Popover, {
90
+ open,
91
+ onOpenChange: setOpen,
92
+ children: [/* @__PURE__ */ jsxs(InputGroup, {
93
+ ref: field,
94
+ "data-slot": "date-range-field",
95
+ size,
96
+ className,
97
+ children: [/* @__PURE__ */ jsx(TypedInput, {
98
+ placeholder: time ? `z. B. ${example}` : "z. B. 14.11. – 30.11.2026",
99
+ text: typed.text,
100
+ onTextChange: typed.setText,
101
+ onCommit: typed.commit,
102
+ formValue: typed.value,
103
+ problem: typed.problem,
104
+ disabled,
105
+ className: "tabular-nums",
106
+ ...props,
107
+ "data-slot": "date-range-field-input"
108
+ }), /* @__PURE__ */ jsx(PickerButton, {
109
+ size,
110
+ disabled: disabled || props.readOnly
111
+ })]
112
+ }), /* @__PURE__ */ jsxs(PickerSheet, {
113
+ anchor: field,
114
+ label: "Zeitraum wählen",
115
+ done: time,
116
+ children: [/* @__PURE__ */ jsx(Calendar, {
117
+ mode: "range",
118
+ value: {
119
+ from: from?.date ?? "",
120
+ to: to?.date ?? ""
121
+ },
122
+ min,
123
+ max,
124
+ today,
125
+ onValueChange: (days) => {
126
+ typed.set(toIsoInterval(settle({
127
+ date: days.from,
128
+ time: clock.from
129
+ }, {
130
+ date: days.to,
131
+ time: clock.to
132
+ }, time)));
133
+ if (!time) setOpen(false);
134
+ }
135
+ }), time && /* @__PURE__ */ jsxs("div", {
136
+ className: "flex items-center justify-between gap-3 border-t border-hairline pt-3 text-control text-fg-body",
137
+ children: [/* @__PURE__ */ jsx(PickerTime, {
138
+ label: "Von",
139
+ hourCycle,
140
+ value: clock.from,
141
+ onValueChange: (next) => next !== "" && setClock("from", next)
142
+ }), /* @__PURE__ */ jsx(PickerTime, {
143
+ label: "bis",
144
+ hourCycle,
145
+ value: clock.to,
146
+ onValueChange: (next) => next !== "" && setClock("to", next),
147
+ onKeyDown: (event) => {
148
+ if (event.key === "Enter") setOpen(false);
149
+ }
150
+ })]
151
+ })]
152
+ })]
153
+ });
154
+ }
155
+ export { DateRangeField };
@@ -0,0 +1,29 @@
1
+ import { ComponentProps } from "react";
2
+ import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
3
+ /**
4
+ * A task that needs the whole attention for a moment: a short form, a detail, a choice. The page
5
+ * behind it is dimmed and inert. Escape, a click outside or the close button leave it; if leaving
6
+ * must not happen by accident, use an `AlertDialog`.
7
+ */
8
+ export declare const Dialog: <Payload>(props: Dialog$1.Root.Props<Payload>) => React.JSX.Element;
9
+ export declare function DialogTrigger(props: Dialog$1.Trigger.Props): import("react").JSX.Element;
10
+ /** Closes the dialog. Render a `Button` through it: `<DialogClose render={<Button />}>`. */
11
+ export declare function DialogClose(props: Dialog$1.Close.Props): import("react").JSX.Element;
12
+ export type DialogContentProps = Dialog$1.Popup.Props & {
13
+ /** Leaves out the close button in the corner. The footer must then offer the way out. */
14
+ hideClose?: boolean;
15
+ /** The accessible name of the close button. */
16
+ closeLabel?: string;
17
+ };
18
+ /**
19
+ * The sheet, with its scrim. Put a `DialogHeader` with a `DialogTitle` inside (the title names
20
+ * the dialog for assistive tech), then a `DialogBody` and a `DialogFooter` as needed.
21
+ */
22
+ export declare function DialogContent({ className, children, hideClose, closeLabel, ...props }: DialogContentProps): import("react").JSX.Element;
23
+ export declare function DialogHeader({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
24
+ /** A sentence that says what this is about ("Angebot senden."). */
25
+ export declare function DialogTitle({ className, ...props }: Dialog$1.Title.Props): import("react").JSX.Element;
26
+ export declare function DialogDescription({ className, ...props }: Dialog$1.Description.Props): import("react").JSX.Element;
27
+ /** The content. It scrolls when it is taller than the window allows. */
28
+ export declare function DialogBody({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
29
+ export declare function DialogFooter({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
@@ -0,0 +1,96 @@
1
+ "use client";
2
+ import { Button } from "../button/button.js";
3
+ import { useGround } from "../ground/ground.js";
4
+ import { CloseGlyph } from "../../internal/glyphs.js";
5
+ import { overlayBackdrop, overlayBody, overlayDescription, overlayFooter, overlayHeader, overlayPopup, overlayTitle, overlayViewport } from "../../internal/overlay.js";
6
+ import { cn, mergeClassName } from "../../lib/cn.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
9
+ // src/components/dialog/dialog.tsx
10
+ /**
11
+ * A task that needs the whole attention for a moment: a short form, a detail, a choice. The page
12
+ * behind it is dimmed and inert. Escape, a click outside or the close button leave it; if leaving
13
+ * must not happen by accident, use an `AlertDialog`.
14
+ */
15
+ const Dialog = Dialog$1.Root;
16
+ function DialogTrigger(props) {
17
+ return /* @__PURE__ */ jsx(Dialog$1.Trigger, {
18
+ "data-slot": "dialog-trigger",
19
+ ...props
20
+ });
21
+ }
22
+ /** Closes the dialog. Render a `Button` through it: `<DialogClose render={<Button />}>`. */
23
+ function DialogClose(props) {
24
+ return /* @__PURE__ */ jsx(Dialog$1.Close, {
25
+ "data-slot": "dialog-close",
26
+ ...props
27
+ });
28
+ }
29
+ /**
30
+ * The sheet, with its scrim. Put a `DialogHeader` with a `DialogTitle` inside (the title names
31
+ * the dialog for assistive tech), then a `DialogBody` and a `DialogFooter` as needed.
32
+ */
33
+ function DialogContent({ className, children, hideClose = false, closeLabel = "Schließen", ...props }) {
34
+ const ground = useGround();
35
+ return /* @__PURE__ */ jsxs(Dialog$1.Portal, { children: [/* @__PURE__ */ jsx(Dialog$1.Backdrop, {
36
+ "data-slot": "dialog-backdrop",
37
+ className: overlayBackdrop
38
+ }), /* @__PURE__ */ jsx(Dialog$1.Viewport, {
39
+ "data-slot": "dialog-viewport",
40
+ className: overlayViewport,
41
+ children: /* @__PURE__ */ jsxs(Dialog$1.Popup, {
42
+ "data-slot": "dialog-content",
43
+ "data-theme": ground,
44
+ className: mergeClassName(overlayPopup, className),
45
+ ...props,
46
+ children: [children, !hideClose && /* @__PURE__ */ jsx(Dialog$1.Close, {
47
+ render: /* @__PURE__ */ jsx(Button, {
48
+ iconOnly: true,
49
+ size: "sm",
50
+ variant: "quiet",
51
+ "aria-label": closeLabel,
52
+ className: "absolute top-3 right-3 text-fg-muted"
53
+ }),
54
+ children: /* @__PURE__ */ jsx(CloseGlyph, {})
55
+ })]
56
+ })
57
+ })] });
58
+ }
59
+ function DialogHeader({ className, ...props }) {
60
+ return /* @__PURE__ */ jsx("div", {
61
+ "data-slot": "dialog-header",
62
+ className: cn(overlayHeader, className),
63
+ ...props
64
+ });
65
+ }
66
+ /** A sentence that says what this is about ("Angebot senden."). */
67
+ function DialogTitle({ className, ...props }) {
68
+ return /* @__PURE__ */ jsx(Dialog$1.Title, {
69
+ "data-slot": "dialog-title",
70
+ className: mergeClassName(overlayTitle, className),
71
+ ...props
72
+ });
73
+ }
74
+ function DialogDescription({ className, ...props }) {
75
+ return /* @__PURE__ */ jsx(Dialog$1.Description, {
76
+ "data-slot": "dialog-description",
77
+ className: mergeClassName(overlayDescription, className),
78
+ ...props
79
+ });
80
+ }
81
+ /** The content. It scrolls when it is taller than the window allows. */
82
+ function DialogBody({ className, ...props }) {
83
+ return /* @__PURE__ */ jsx("div", {
84
+ "data-slot": "dialog-body",
85
+ className: cn(overlayBody, className),
86
+ ...props
87
+ });
88
+ }
89
+ function DialogFooter({ className, ...props }) {
90
+ return /* @__PURE__ */ jsx("div", {
91
+ "data-slot": "dialog-footer",
92
+ className: cn(overlayFooter, className),
93
+ ...props
94
+ });
95
+ }
96
+ export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger };
@@ -0,0 +1,17 @@
1
+ import { ComponentProps } from "react";
2
+ /**
3
+ * The frame of a documentation page, inside the width of the site so its columns line up with
4
+ * the `SiteHeader` above and the `SiteFooter` below: the pages of the set on the left, the text
5
+ * in the middle, the page's sections on the right.
6
+ *
7
+ * The side columns stay in view while the text scrolls, below a sticky bar of the height in
8
+ * `--docs-top` (4rem: the `SiteHeader`'s bar, 8px off the top and 56px tall). The pages column shows from `lg`, the sections column
9
+ * from `xl`; below that, the pages go into the site's menu and the sections fold above the text.
10
+ */
11
+ export declare function DocsLayout({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
12
+ /** The pages of the set: a `SideNav`. Hidden below `lg`. */
13
+ export declare function DocsLayoutNav({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
14
+ /** The text of the page. It is the page's `<main>`; give it an id for the skip link. */
15
+ export declare function DocsLayoutMain({ className, ...props }: ComponentProps<"main">): import("react").JSX.Element;
16
+ /** The sections of the page: a `TableOfContents`. Hidden below `xl`. */
17
+ export declare function DocsLayoutAside({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
@@ -0,0 +1,46 @@
1
+ import { containerVariants } from "../container/container.js";
2
+ import { cn } from "../../lib/cn.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/docs-layout/docs-layout.tsx
5
+ /**
6
+ * The frame of a documentation page, inside the width of the site so its columns line up with
7
+ * the `SiteHeader` above and the `SiteFooter` below: the pages of the set on the left, the text
8
+ * in the middle, the page's sections on the right.
9
+ *
10
+ * The side columns stay in view while the text scrolls, below a sticky bar of the height in
11
+ * `--docs-top` (4rem: the `SiteHeader`'s bar, 8px off the top and 56px tall). The pages column shows from `lg`, the sections column
12
+ * from `xl`; below that, the pages go into the site's menu and the sections fold above the text.
13
+ */
14
+ function DocsLayout({ className, ...props }) {
15
+ return /* @__PURE__ */ jsx("div", {
16
+ "data-slot": "docs-layout",
17
+ className: cn(containerVariants(), "grid [--docs-top:4rem] lg:grid-cols-[13.5rem_minmax(0,1fr)] lg:gap-x-10 xl:grid-cols-[13.5rem_minmax(0,1fr)_12rem]", className),
18
+ ...props
19
+ });
20
+ }
21
+ const sticky = "sticky top-(--docs-top) max-h-[calc(100dvh-var(--docs-top))] self-start overflow-y-auto overscroll-contain [scrollbar-width:thin]";
22
+ /** The pages of the set: a `SideNav`. Hidden below `lg`. */
23
+ function DocsLayoutNav({ className, ...props }) {
24
+ return /* @__PURE__ */ jsx("div", {
25
+ "data-slot": "docs-layout-nav",
26
+ className: cn(sticky, "-ml-2.5 hidden pt-10 pr-1 pb-10 pl-2.5 lg:block", className),
27
+ ...props
28
+ });
29
+ }
30
+ /** The text of the page. It is the page's `<main>`; give it an id for the skip link. */
31
+ function DocsLayoutMain({ className, ...props }) {
32
+ return /* @__PURE__ */ jsx("main", {
33
+ "data-slot": "docs-layout-main",
34
+ className: cn("min-w-0 pt-8 pb-16 lg:pt-10", className),
35
+ ...props
36
+ });
37
+ }
38
+ /** The sections of the page: a `TableOfContents`. Hidden below `xl`. */
39
+ function DocsLayoutAside({ className, ...props }) {
40
+ return /* @__PURE__ */ jsx("div", {
41
+ "data-slot": "docs-layout-aside",
42
+ className: cn(sticky, "hidden pt-10 pb-10 pl-1 xl:block", className),
43
+ ...props
44
+ });
45
+ }
46
+ export { DocsLayout, DocsLayoutAside, DocsLayoutMain, DocsLayoutNav };
@@ -0,0 +1,39 @@
1
+ import { ComponentProps } from "react";
2
+ import { Drawer as Drawer$1 } from "@base-ui/react/drawer";
3
+ /** The edge a drawer comes from. It is swiped back towards that edge to close it. */
4
+ export type DrawerSide = "bottom" | "right" | "left";
5
+ export type DrawerProps = Omit<Drawer$1.Root.Props, "swipeDirection"> & {
6
+ /** The edge the sheet comes from: `bottom` on a phone, a side for detail next to a list. */
7
+ side?: DrawerSide;
8
+ };
9
+ /**
10
+ * A sheet from the edge of the window that can be pushed back with a finger: filters and actions
11
+ * on a phone (from the bottom), the detail of a row next to its list (from the side). The page
12
+ * behind it is dimmed and inert, as with a `Dialog`.
13
+ *
14
+ * Use it where the gesture matters. A task that needs the middle of the screen and a decision
15
+ * is a `Dialog`; a few choices next to a button are a `Menu` or a `Popover`.
16
+ */
17
+ export declare function Drawer({ side, ...props }: DrawerProps): import("react").JSX.Element;
18
+ export declare function DrawerTrigger(props: Drawer$1.Trigger.Props): import("react").JSX.Element;
19
+ /** Closes the drawer. Render a `Button` through it: `<DrawerClose render={<Button />}>`. */
20
+ export declare function DrawerClose(props: Drawer$1.Close.Props): import("react").JSX.Element;
21
+ export type DrawerContentProps = Drawer$1.Popup.Props & {
22
+ /** Leaves out the close button in the corner. The footer must then offer the way out. */
23
+ hideClose?: boolean;
24
+ /** The accessible name of the close button. */
25
+ closeLabel?: string;
26
+ };
27
+ /**
28
+ * The sheet, with its scrim. Put a `DrawerHeader` with a `DrawerTitle` inside (the title names
29
+ * the drawer for assistive tech), then a `DrawerBody` and a `DrawerFooter` as needed. A sheet
30
+ * from the bottom carries a grabber: it says that it can be pulled.
31
+ */
32
+ export declare function DrawerContent({ className, children, hideClose, closeLabel, ...props }: DrawerContentProps): import("react").JSX.Element;
33
+ export declare function DrawerHeader({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
34
+ /** A sentence that says what this is about ("Angebote filtern."). */
35
+ export declare function DrawerTitle({ className, ...props }: Drawer$1.Title.Props): import("react").JSX.Element;
36
+ export declare function DrawerDescription({ className, ...props }: Drawer$1.Description.Props): import("react").JSX.Element;
37
+ /** The content. It scrolls when it is taller than the sheet allows. */
38
+ export declare function DrawerBody({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
39
+ export declare function DrawerFooter({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
@@ -0,0 +1,181 @@
1
+ "use client";
2
+ import { Button } from "../button/button.js";
3
+ import { useGround } from "../ground/ground.js";
4
+ import { CloseGlyph } from "../../internal/glyphs.js";
5
+ import { overlayBody, overlayDescription, overlayFooter, overlayHeader, overlayTitle } from "../../internal/overlay.js";
6
+ import { cn, mergeClassName } from "../../lib/cn.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { createContext, useContext } from "react";
9
+ import { Drawer as Drawer$1 } from "@base-ui/react/drawer";
10
+ // src/components/drawer/drawer.tsx
11
+ const swipeDirections = {
12
+ bottom: "down",
13
+ right: "right",
14
+ left: "left"
15
+ };
16
+ const DrawerSideContext = createContext("bottom");
17
+ /**
18
+ * A sheet from the edge of the window that can be pushed back with a finger: filters and actions
19
+ * on a phone (from the bottom), the detail of a row next to its list (from the side). The page
20
+ * behind it is dimmed and inert, as with a `Dialog`.
21
+ *
22
+ * Use it where the gesture matters. A task that needs the middle of the screen and a decision
23
+ * is a `Dialog`; a few choices next to a button are a `Menu` or a `Popover`.
24
+ */
25
+ function Drawer({ side = "bottom", ...props }) {
26
+ return /* @__PURE__ */ jsx(DrawerSideContext, {
27
+ value: side,
28
+ children: /* @__PURE__ */ jsx(Drawer$1.Root, {
29
+ swipeDirection: swipeDirections[side],
30
+ ...props
31
+ })
32
+ });
33
+ }
34
+ function DrawerTrigger(props) {
35
+ return /* @__PURE__ */ jsx(Drawer$1.Trigger, {
36
+ "data-slot": "drawer-trigger",
37
+ ...props
38
+ });
39
+ }
40
+ /** Closes the drawer. Render a `Button` through it: `<DrawerClose render={<Button />}>`. */
41
+ function DrawerClose(props) {
42
+ return /* @__PURE__ */ jsx(Drawer$1.Close, {
43
+ "data-slot": "drawer-close",
44
+ ...props
45
+ });
46
+ }
47
+ /**
48
+ * Where the sheet stands and how it moves, per side.
49
+ *
50
+ * It follows the finger and springs back on `sheet` when let go. It arrives from its edge on
51
+ * `sheet`. Closed by a button, Escape or a press outside it leaves like every sheet, by fading;
52
+ * swiped away, it keeps going the way it was thrown, as fast as it was thrown.
53
+ *
54
+ * The offset is `transform`, not `translate` as elsewhere: under the finger Base UI sets
55
+ * `transform` (and `transition: none`) on the sheet itself, and that has to replace our offset.
56
+ * On another property the two would add up and the sheet would run twice as far as the finger.
57
+ *
58
+ * `--bleed` is sheet beyond the window's edge: pulled the other way, the sheet stretches a
59
+ * little, and no gap opens behind it.
60
+ */
61
+ const sides = {
62
+ bottom: {
63
+ viewport: "items-end justify-center",
64
+ popup: [
65
+ "-mb-(--bleed) max-h-[calc(85dvh+var(--bleed))] w-full max-w-xl rounded-t-2xl px-6 pt-3 pb-[calc(1.5rem+env(safe-area-inset-bottom,0px)+var(--bleed))]",
66
+ "[transform:translateY(calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px)))]",
67
+ "motion-safe:data-starting-style:[transform:translateY(calc(100%-var(--bleed)))]",
68
+ "motion-safe:data-swipe-dismiss:data-ending-style:[transform:translateY(calc(100%-var(--bleed)))]"
69
+ ],
70
+ close: "top-3 right-3"
71
+ },
72
+ right: {
73
+ viewport: "items-stretch justify-end",
74
+ popup: [
75
+ "-mr-(--bleed) h-full w-[calc(24rem+var(--bleed))] max-w-[calc(100vw-3rem+var(--bleed))] rounded-l-2xl py-6 pr-[calc(1.5rem+var(--bleed))] pl-6",
76
+ "[transform:translateX(var(--drawer-swipe-movement-x,0px))]",
77
+ "motion-safe:data-starting-style:[transform:translateX(calc(100%-var(--bleed)))]",
78
+ "motion-safe:data-swipe-dismiss:data-ending-style:[transform:translateX(calc(100%-var(--bleed)))]"
79
+ ],
80
+ close: "top-3 right-[calc(0.75rem+var(--bleed))]"
81
+ },
82
+ left: {
83
+ viewport: "items-stretch justify-start",
84
+ popup: [
85
+ "-ml-(--bleed) h-full w-[calc(24rem+var(--bleed))] max-w-[calc(100vw-3rem+var(--bleed))] rounded-r-2xl py-6 pr-6 pl-[calc(1.5rem+var(--bleed))]",
86
+ "[transform:translateX(var(--drawer-swipe-movement-x,0px))]",
87
+ "motion-safe:data-starting-style:[transform:translateX(calc(var(--bleed)-100%))]",
88
+ "motion-safe:data-swipe-dismiss:data-ending-style:[transform:translateX(calc(var(--bleed)-100%))]"
89
+ ],
90
+ close: "top-3 right-3"
91
+ }
92
+ };
93
+ /**
94
+ * The sheet, with its scrim. Put a `DrawerHeader` with a `DrawerTitle` inside (the title names
95
+ * the drawer for assistive tech), then a `DrawerBody` and a `DrawerFooter` as needed. A sheet
96
+ * from the bottom carries a grabber: it says that it can be pulled.
97
+ */
98
+ function DrawerContent({ className, children, hideClose = false, closeLabel = "Schließen", ...props }) {
99
+ const ground = useGround();
100
+ const side = useContext(DrawerSideContext);
101
+ return /* @__PURE__ */ jsxs(Drawer$1.Portal, { children: [/* @__PURE__ */ jsx(Drawer$1.Backdrop, {
102
+ "data-slot": "drawer-backdrop",
103
+ className: "fixed inset-x-0 top-0 z-50 h-lvh bg-scrim opacity-[calc(1-var(--drawer-swipe-progress,0))] transition-opacity duration-200 ease-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-swiping:duration-0"
104
+ }), /* @__PURE__ */ jsx(Drawer$1.Viewport, {
105
+ "data-slot": "drawer-viewport",
106
+ className: cn("fixed inset-0 z-50 flex overflow-hidden", sides[side].viewport),
107
+ children: /* @__PURE__ */ jsxs(Drawer$1.Popup, {
108
+ "data-slot": "drawer-content",
109
+ "data-theme": ground,
110
+ className: mergeClassName([
111
+ "relative flex flex-col bg-sheet text-base text-fg-body depth-overlay outline-hidden [--bleed:3rem]",
112
+ sides[side].popup,
113
+ "transition-[transform,opacity] spring-sheet data-swiping:select-none",
114
+ "motion-reduce:data-starting-style:opacity-0",
115
+ "data-ending-style:opacity-0 data-ending-style:spring-leave",
116
+ "data-swipe-dismiss:data-ending-style:duration-[calc(var(--drawer-swipe-strength,1)*400ms)] data-swipe-dismiss:data-ending-style:ease-out"
117
+ ], className),
118
+ ...props,
119
+ children: [
120
+ side === "bottom" && /* @__PURE__ */ jsx("div", {
121
+ "data-slot": "drawer-grabber",
122
+ "aria-hidden": true,
123
+ className: "mx-auto mb-4 h-1 w-9 shrink-0 rounded-full bg-line"
124
+ }),
125
+ /* @__PURE__ */ jsx(Drawer$1.Content, {
126
+ "data-slot": "drawer-inner",
127
+ className: "flex min-h-0 flex-1 flex-col gap-5",
128
+ children
129
+ }),
130
+ !hideClose && /* @__PURE__ */ jsx(Drawer$1.Close, {
131
+ render: /* @__PURE__ */ jsx(Button, {
132
+ iconOnly: true,
133
+ size: "sm",
134
+ variant: "quiet",
135
+ "aria-label": closeLabel,
136
+ className: cn("absolute text-fg-muted", sides[side].close)
137
+ }),
138
+ children: /* @__PURE__ */ jsx(CloseGlyph, {})
139
+ })
140
+ ]
141
+ })
142
+ })] });
143
+ }
144
+ function DrawerHeader({ className, ...props }) {
145
+ return /* @__PURE__ */ jsx("div", {
146
+ "data-slot": "drawer-header",
147
+ className: cn(overlayHeader, className),
148
+ ...props
149
+ });
150
+ }
151
+ /** A sentence that says what this is about ("Angebote filtern."). */
152
+ function DrawerTitle({ className, ...props }) {
153
+ return /* @__PURE__ */ jsx(Drawer$1.Title, {
154
+ "data-slot": "drawer-title",
155
+ className: mergeClassName(overlayTitle, className),
156
+ ...props
157
+ });
158
+ }
159
+ function DrawerDescription({ className, ...props }) {
160
+ return /* @__PURE__ */ jsx(Drawer$1.Description, {
161
+ "data-slot": "drawer-description",
162
+ className: mergeClassName(overlayDescription, className),
163
+ ...props
164
+ });
165
+ }
166
+ /** The content. It scrolls when it is taller than the sheet allows. */
167
+ function DrawerBody({ className, ...props }) {
168
+ return /* @__PURE__ */ jsx("div", {
169
+ "data-slot": "drawer-body",
170
+ className: cn(overlayBody, className),
171
+ ...props
172
+ });
173
+ }
174
+ function DrawerFooter({ className, ...props }) {
175
+ return /* @__PURE__ */ jsx("div", {
176
+ "data-slot": "drawer-footer",
177
+ className: cn(overlayFooter, className),
178
+ ...props
179
+ });
180
+ }
181
+ export { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger };
@@ -0,0 +1,18 @@
1
+ import { Field as Field$1 } from "@base-ui/react/field";
2
+ /**
3
+ * Groups one control with its label, description and error, and wires them for assistive tech.
4
+ * Validation, touched/dirty state and server errors come from Base UI's Field and Form.
5
+ */
6
+ export declare function Field({ className, actionsRef, children, ...props }: Field$1.Root.Props): import("react").JSX.Element;
7
+ /** Says what goes in, in sentence case. No colon, no asterisk. */
8
+ export declare function FieldLabel({ className, ...props }: Field$1.Label.Props): import("react").JSX.Element;
9
+ /** One line of help that stays visible. Why we ask, or what format is expected. */
10
+ export declare function FieldDescription({ className, ...props }: Field$1.Description.Props): import("react").JSX.Element;
11
+ /**
12
+ * The error, shown when the field is invalid. A status never relies on colour: it carries an icon
13
+ * and words that start with what to do ("Bitte geben Sie …").
14
+ *
15
+ * It opens by growing (`settle`), so what stands below is pushed down instead of jumping. The
16
+ * negative margin cancels the field's gap while it is closed; the gap lives inside it instead.
17
+ */
18
+ export declare function FieldError({ className, ...props }: Field$1.Error.Props): import("react").JSX.Element;
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { Icon } from "../icon/icon.js";
3
+ import { FieldActionsContext, FieldDisabledContext } from "../../internal/field-context.js";
4
+ import { mergeClassName } from "../../lib/cn.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { AlertCircleIcon } from "@hugeicons/core-free-icons";
7
+ import { useRef } from "react";
8
+ import { Field as Field$1 } from "@base-ui/react/field";
9
+ // src/components/field/field.tsx
10
+ /**
11
+ * Groups one control with its label, description and error, and wires them for assistive tech.
12
+ * Validation, touched/dirty state and server errors come from Base UI's Field and Form.
13
+ */
14
+ function Field({ className, actionsRef, children, ...props }) {
15
+ const own = useRef(null);
16
+ const actions = actionsRef ?? own;
17
+ return /* @__PURE__ */ jsx(Field$1.Root, {
18
+ "data-slot": "field",
19
+ className: mergeClassName("flex flex-col gap-1.5", className),
20
+ actionsRef: actions,
21
+ ...props,
22
+ children: /* @__PURE__ */ jsx(FieldActionsContext, {
23
+ value: actions,
24
+ children: /* @__PURE__ */ jsx(FieldDisabledContext, {
25
+ value: props.disabled ?? false,
26
+ children
27
+ })
28
+ })
29
+ });
30
+ }
31
+ /** Says what goes in, in sentence case. No colon, no asterisk. */
32
+ function FieldLabel({ className, ...props }) {
33
+ return /* @__PURE__ */ jsx(Field$1.Label, {
34
+ "data-slot": "field-label",
35
+ className: mergeClassName("text-control leading-5 font-medium text-fg data-disabled:text-on-disabled", className),
36
+ ...props
37
+ });
38
+ }
39
+ /** One line of help that stays visible. Why we ask, or what format is expected. */
40
+ function FieldDescription({ className, ...props }) {
41
+ return /* @__PURE__ */ jsx(Field$1.Description, {
42
+ "data-slot": "field-description",
43
+ className: mergeClassName("text-sm text-fg-muted", className),
44
+ ...props
45
+ });
46
+ }
47
+ /**
48
+ * The error, shown when the field is invalid. A status never relies on colour: it carries an icon
49
+ * and words that start with what to do ("Bitte geben Sie …").
50
+ *
51
+ * It opens by growing (`settle`), so what stands below is pushed down instead of jumping. The
52
+ * negative margin cancels the field's gap while it is closed; the gap lives inside it instead.
53
+ */
54
+ function FieldError({ className, ...props }) {
55
+ return /* @__PURE__ */ jsx(Field$1.Error, {
56
+ "data-slot": "field-error",
57
+ className: mergeClassName([
58
+ "-mt-1.5 grid grid-rows-[1fr] text-sm font-semibold text-danger",
59
+ "transition-[grid-template-rows,opacity] spring-settle",
60
+ "data-starting-style:grid-rows-[0fr] data-starting-style:opacity-0",
61
+ "data-ending-style:grid-rows-[0fr] data-ending-style:opacity-0 data-ending-style:spring-leave"
62
+ ], className),
63
+ render: ({ children, ...rest }) => /* @__PURE__ */ jsx("div", {
64
+ ...rest,
65
+ children: /* @__PURE__ */ jsxs("div", {
66
+ className: "flex min-h-0 items-start gap-1.5 overflow-hidden pt-1.5",
67
+ children: [/* @__PURE__ */ jsx(Icon, {
68
+ icon: AlertCircleIcon,
69
+ size: 14,
70
+ className: "mt-[0.2rem]"
71
+ }), /* @__PURE__ */ jsx("span", { children })]
72
+ })
73
+ }),
74
+ ...props
75
+ });
76
+ }
77
+ export { Field, FieldDescription, FieldError, FieldLabel };