@lanfermann/ui 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -0
- package/README.md +17 -2
- package/TRADEMARK.md +10 -0
- package/brand/app-icon.svg +1 -0
- package/brand/avatar.svg +1 -0
- package/brand/favicon.svg +1 -0
- package/dist/components/accordion/accordion.d.ts +26 -0
- package/dist/components/accordion/accordion.js +78 -0
- package/dist/components/alert/alert.d.ts +19 -0
- package/dist/components/alert/alert.js +68 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +20 -0
- package/dist/components/alert-dialog/alert-dialog.js +75 -0
- package/dist/components/anchor-heading/anchor-heading.d.ts +19 -0
- package/dist/components/anchor-heading/anchor-heading.js +39 -0
- package/dist/components/avatar/avatar.d.ts +14 -0
- package/dist/components/avatar/avatar.js +42 -0
- package/dist/components/badge/badge.d.ts +12 -0
- package/dist/components/badge/badge.js +27 -0
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +23 -0
- package/dist/components/breadcrumbs/breadcrumbs.js +63 -0
- package/dist/components/button/button-variants.d.ts +15 -0
- package/dist/components/button/button-variants.js +76 -0
- package/dist/components/button/button.d.ts +25 -0
- package/dist/components/button/button.js +50 -0
- package/dist/components/calendar/calendar-selection.js +216 -0
- package/dist/components/calendar/calendar.d.ts +44 -0
- package/dist/components/calendar/calendar.js +208 -0
- package/dist/components/callout/callout.d.ts +21 -0
- package/dist/components/callout/callout.js +75 -0
- package/dist/components/card/card.d.ts +16 -0
- package/dist/components/card/card.js +53 -0
- package/dist/components/checkbox/checkbox.d.ts +9 -0
- package/dist/components/checkbox/checkbox.js +33 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +18 -0
- package/dist/components/checkbox-group/checkbox-group.js +33 -0
- package/dist/components/code/code.d.ts +7 -0
- package/dist/components/code/code.js +16 -0
- package/dist/components/code-block/code-block-frame.js +146 -0
- package/dist/components/code-block/code-block-live.d.ts +45 -0
- package/dist/components/code-block/code-block-live.js +51 -0
- package/dist/components/code-block/code-block.d.ts +36 -0
- package/dist/components/code-block/code-block.js +51 -0
- package/dist/components/code-block/code-copy.d.ts +12 -0
- package/dist/components/code-block/code-copy.js +71 -0
- package/dist/components/code-block/code-lines-view.d.ts +16 -0
- package/dist/components/code-block/code-lines-view.js +48 -0
- package/dist/components/code-block/code-lines.js +17 -0
- package/dist/components/code-block/code-scroll.js +29 -0
- package/dist/components/code-block/code-surface.js +13 -0
- package/dist/components/code-block/code-tabs-frame.js +85 -0
- package/dist/components/code-block/code-tabs-store.js +25 -0
- package/dist/components/code-block/code-tabs.d.ts +28 -0
- package/dist/components/code-block/code-tabs.js +29 -0
- package/dist/components/code-block/highlight.d.ts +34 -0
- package/dist/components/code-block/highlight.js +258 -0
- package/dist/components/code-block/lines.d.ts +5 -0
- package/dist/components/code-block/lines.js +40 -0
- package/dist/components/collapsible/collapsible.d.ts +19 -0
- package/dist/components/collapsible/collapsible.js +54 -0
- package/dist/components/combobox/combobox.d.ts +84 -0
- package/dist/components/combobox/combobox.js +169 -0
- package/dist/components/container/container.d.ts +16 -0
- package/dist/components/container/container.js +30 -0
- package/dist/components/copy-pill/copy-pill.d.ts +52 -0
- package/dist/components/copy-pill/copy-pill.js +232 -0
- package/dist/components/cta/cta.d.ts +109 -0
- package/dist/components/cta/cta.js +375 -0
- package/dist/components/date-field/date-field.d.ts +40 -0
- package/dist/components/date-field/date-field.js +99 -0
- package/dist/components/date-range-field/date-range-field.d.ts +41 -0
- package/dist/components/date-range-field/date-range-field.js +155 -0
- package/dist/components/dialog/dialog.d.ts +29 -0
- package/dist/components/dialog/dialog.js +96 -0
- package/dist/components/docs-layout/docs-layout.d.ts +17 -0
- package/dist/components/docs-layout/docs-layout.js +46 -0
- package/dist/components/drawer/drawer.d.ts +39 -0
- package/dist/components/drawer/drawer.js +181 -0
- package/dist/components/field/field.d.ts +18 -0
- package/dist/components/field/field.js +77 -0
- package/dist/components/fieldset/fieldset.d.ts +8 -0
- package/dist/components/fieldset/fieldset.js +25 -0
- package/dist/components/figure/figure.d.ts +14 -0
- package/dist/components/figure/figure.js +35 -0
- package/dist/components/form/form.d.ts +31 -0
- package/dist/components/form/form.js +55 -0
- package/dist/components/ground/ground.d.ts +20 -0
- package/dist/components/ground/ground.js +31 -0
- package/dist/components/heading/heading.d.ts +16 -0
- package/dist/components/heading/heading.js +36 -0
- package/dist/components/icon/icon.d.ts +22 -0
- package/dist/components/icon/icon.js +24 -0
- package/dist/components/input/input.d.ts +19 -0
- package/dist/components/input/input.js +46 -0
- package/dist/components/input-group/input-group.d.ts +34 -0
- package/dist/components/input-group/input-group.js +61 -0
- package/dist/components/kbd/kbd.d.ts +6 -0
- package/dist/components/kbd/kbd.js +15 -0
- package/dist/components/link/link-variants.d.ts +13 -0
- package/dist/components/link/link-variants.js +27 -0
- package/dist/components/link/link.d.ts +9 -0
- package/dist/components/link/link.js +18 -0
- package/dist/components/logo/logo-paths.js +22 -0
- package/dist/components/logo/logomark.d.ts +19 -0
- package/dist/components/logo/logomark.js +49 -0
- package/dist/components/logo/wordmark.d.ts +35 -0
- package/dist/components/logo/wordmark.js +48 -0
- package/dist/components/menu/menu.d.ts +26 -0
- package/dist/components/menu/menu.js +132 -0
- package/dist/components/meter/meter.d.ts +29 -0
- package/dist/components/meter/meter.js +68 -0
- package/dist/components/navigation-menu/navigation-menu-variants.d.ts +12 -0
- package/dist/components/navigation-menu/navigation-menu-variants.js +18 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +42 -0
- package/dist/components/navigation-menu/navigation-menu.js +128 -0
- package/dist/components/number-field/number-field.d.ts +32 -0
- package/dist/components/number-field/number-field.js +85 -0
- package/dist/components/page-header/page-header.d.ts +27 -0
- package/dist/components/page-header/page-header.js +48 -0
- package/dist/components/pager/pager.d.ts +24 -0
- package/dist/components/pager/pager.js +51 -0
- package/dist/components/parameter-list/parameter-list.d.ts +34 -0
- package/dist/components/parameter-list/parameter-list.js +70 -0
- package/dist/components/popover/popover.d.ts +15 -0
- package/dist/components/popover/popover.js +64 -0
- package/dist/components/progress/progress.d.ts +19 -0
- package/dist/components/progress/progress.js +67 -0
- package/dist/components/prose/prose.d.ts +13 -0
- package/dist/components/prose/prose.js +22 -0
- package/dist/components/quote/quote.d.ts +21 -0
- package/dist/components/quote/quote.js +46 -0
- package/dist/components/radio/radio.d.ts +12 -0
- package/dist/components/radio/radio.js +37 -0
- package/dist/components/reference-entry/reference-entry.d.ts +25 -0
- package/dist/components/reference-entry/reference-entry.js +66 -0
- package/dist/components/section/section.d.ts +13 -0
- package/dist/components/section/section.js +30 -0
- package/dist/components/segmented-control/segmented-control.d.ts +42 -0
- package/dist/components/segmented-control/segmented-control.js +413 -0
- package/dist/components/select/select.d.ts +70 -0
- package/dist/components/select/select.js +189 -0
- package/dist/components/separator/separator.d.ts +12 -0
- package/dist/components/separator/separator.js +29 -0
- package/dist/components/side-nav/side-nav.d.ts +48 -0
- package/dist/components/side-nav/side-nav.js +89 -0
- package/dist/components/site-footer/site-footer-floor.js +48 -0
- package/dist/components/site-footer/site-footer.d.ts +38 -0
- package/dist/components/site-footer/site-footer.js +96 -0
- package/dist/components/site-header/site-header.d.ts +77 -0
- package/dist/components/site-header/site-header.js +214 -0
- package/dist/components/slider/slider.d.ts +42 -0
- package/dist/components/slider/slider.js +279 -0
- package/dist/components/spinner/spinner.d.ts +15 -0
- package/dist/components/spinner/spinner.js +34 -0
- package/dist/components/switch/switch.d.ts +8 -0
- package/dist/components/switch/switch.js +28 -0
- package/dist/components/table/table.d.ts +83 -0
- package/dist/components/table/table.js +123 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +32 -0
- package/dist/components/table-of-contents/table-of-contents.js +187 -0
- package/dist/components/tabs/tabs.d.ts +28 -0
- package/dist/components/tabs/tabs.js +124 -0
- package/dist/components/text/text.d.ts +16 -0
- package/dist/components/text/text.js +63 -0
- package/dist/components/textarea/textarea.d.ts +19 -0
- package/dist/components/textarea/textarea.js +30 -0
- package/dist/components/time-field/time-field.d.ts +40 -0
- package/dist/components/time-field/time-field.js +123 -0
- package/dist/components/toast/toast.d.ts +55 -0
- package/dist/components/toast/toast.js +129 -0
- package/dist/components/tooltip/tooltip.d.ts +16 -0
- package/dist/components/tooltip/tooltip.js +41 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +77 -0
- package/dist/internal/arrow.js +41 -0
- package/dist/internal/disclosure.js +20 -0
- package/dist/internal/field-context.js +21 -0
- package/dist/internal/field.d.ts +23 -0
- package/dist/internal/field.js +49 -0
- package/dist/internal/glyphs.js +84 -0
- package/dist/internal/iso-date.d.ts +2 -0
- package/dist/internal/iso-date.js +268 -0
- package/dist/internal/overlay.js +40 -0
- package/dist/internal/picker-sheet.js +74 -0
- package/dist/internal/popup.js +37 -0
- package/dist/internal/range-shape.js +295 -0
- package/dist/internal/reduced-motion.js +19 -0
- package/dist/internal/scroll-edges.js +45 -0
- package/dist/internal/trough.js +39 -0
- package/dist/internal/typed-input.d.ts +16 -0
- package/dist/internal/typed-input.js +133 -0
- package/dist/lib/cn.d.ts +11 -0
- package/dist/lib/cn.js +98 -0
- package/dist/motion/inertia.js +111 -0
- package/dist/motion/spring-step.js +35 -0
- package/dist/motion/springs.d.ts +78 -0
- package/dist/motion/springs.js +81 -0
- package/package.json +107 -4
- package/src/styles/base.css +93 -0
- package/src/styles/calendar.css +117 -0
- package/src/styles/code.css +252 -0
- package/src/styles/density.css +53 -0
- package/src/styles/depth.css +501 -0
- package/src/styles/grounds.css +191 -0
- package/src/styles/marks.css +50 -0
- package/src/styles/motion.css +55 -0
- package/src/styles/motion.generated.css +101 -0
- package/src/styles/prose.css +252 -0
- package/src/styles/radius.css +20 -0
- package/src/styles/segmented.css +208 -0
- package/src/styles/slider.css +110 -0
- package/src/styles/status.css +108 -0
- package/src/styles/tabs.css +39 -0
- package/src/styles/toast.css +106 -0
- package/src/styles/touch.css +41 -0
- package/src/styles/type.css +54 -0
- package/src/styles.css +38 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FieldSize } from "../../internal/field.js";
|
|
2
|
+
import { NumberField as NumberField$1 } from "@base-ui/react/number-field";
|
|
3
|
+
export type NumberFieldProps = NumberField$1.Root.Props & {
|
|
4
|
+
/** The size of the field, from the density. */
|
|
5
|
+
size?: FieldSize;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A field for a number: a price, a quantity, a share. It formats what was typed when the field
|
|
9
|
+
* is left, steps with the arrow keys (Shift for ten, Alt for a tenth) and keeps the value a
|
|
10
|
+
* `number`, never a string to parse.
|
|
11
|
+
*
|
|
12
|
+
* Put a `NumberFieldInput` inside. Around it go, as needed, an `InputGroupAddon` for a unit that
|
|
13
|
+
* Intl cannot format ("Std.", "Stück") and the two steppers: `NumberFieldDecrement` before the
|
|
14
|
+
* input, `NumberFieldIncrement` after it. Currency and percent come from
|
|
15
|
+
* `format`, which puts the sign into the text: `format={{ style: "currency", currency: "EUR" }}`.
|
|
16
|
+
*
|
|
17
|
+
* Always pass `locale` (`"de-DE"`): without it the field formats in the locale of whatever runs
|
|
18
|
+
* it, and the server's is not the browser's.
|
|
19
|
+
*/
|
|
20
|
+
export declare function NumberField({ className, size, children, ...props }: NumberFieldProps): import("react").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* The typed value: set right, in tabular digits, so amounts line up from field to field. Between
|
|
23
|
+
* two steppers it is centred instead.
|
|
24
|
+
*/
|
|
25
|
+
export declare function NumberFieldInput({ className, ...props }: NumberField$1.Input.Props): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Steps the value down. Steppers are an option, for small counts that are stepped more often
|
|
28
|
+
* than typed (a quantity); an amount of money does not get them.
|
|
29
|
+
*/
|
|
30
|
+
export declare function NumberFieldDecrement({ className, children, ...props }: NumberField$1.Decrement.Props): import("react").JSX.Element;
|
|
31
|
+
/** Steps the value up. See `NumberFieldDecrement`. */
|
|
32
|
+
export declare function NumberFieldIncrement({ className, children, ...props }: NumberField$1.Increment.Props): import("react").JSX.Element;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { bareControl, fieldShell, fieldShellSize, focusFieldControl } from "../../internal/field.js";
|
|
3
|
+
import { MinusGlyph, PlusGlyph } from "../../internal/glyphs.js";
|
|
4
|
+
import { cn, mergeClassName } from "../../lib/cn.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { NumberField as NumberField$1 } from "@base-ui/react/number-field";
|
|
7
|
+
// src/components/number-field/number-field.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A field for a number: a price, a quantity, a share. It formats what was typed when the field
|
|
10
|
+
* is left, steps with the arrow keys (Shift for ten, Alt for a tenth) and keeps the value a
|
|
11
|
+
* `number`, never a string to parse.
|
|
12
|
+
*
|
|
13
|
+
* Put a `NumberFieldInput` inside. Around it go, as needed, an `InputGroupAddon` for a unit that
|
|
14
|
+
* Intl cannot format ("Std.", "Stück") and the two steppers: `NumberFieldDecrement` before the
|
|
15
|
+
* input, `NumberFieldIncrement` after it. Currency and percent come from
|
|
16
|
+
* `format`, which puts the sign into the text: `format={{ style: "currency", currency: "EUR" }}`.
|
|
17
|
+
*
|
|
18
|
+
* Always pass `locale` (`"de-DE"`): without it the field formats in the locale of whatever runs
|
|
19
|
+
* it, and the server's is not the browser's.
|
|
20
|
+
*/
|
|
21
|
+
function NumberField({ className, size = "md", children, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(NumberField$1.Root, {
|
|
23
|
+
"data-slot": "number-field",
|
|
24
|
+
"data-size": size,
|
|
25
|
+
className: mergeClassName("relative w-full min-w-0", className),
|
|
26
|
+
...props,
|
|
27
|
+
children: /* @__PURE__ */ jsx(NumberField$1.Group, {
|
|
28
|
+
"data-slot": "number-field-group",
|
|
29
|
+
className: cn(fieldShell, fieldShellSize[size]),
|
|
30
|
+
onMouseDown: focusFieldControl,
|
|
31
|
+
children
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The typed value: set right, in tabular digits, so amounts line up from field to field. Between
|
|
37
|
+
* two steppers it is centred instead.
|
|
38
|
+
*/
|
|
39
|
+
function NumberFieldInput({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(NumberField$1.Input, {
|
|
41
|
+
"data-slot": "number-field-input",
|
|
42
|
+
"data-field-control": "",
|
|
43
|
+
className: mergeClassName([
|
|
44
|
+
bareControl,
|
|
45
|
+
"text-right tabular-nums",
|
|
46
|
+
"group-has-[[data-slot=number-field-decrement]:first-child]/field:text-center"
|
|
47
|
+
], className),
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A stepper is a quiet segment of the field, divided from its neighbour by a hairline. The glyph
|
|
53
|
+
* dips when pressed and seats back (`seat`); holding the button repeats the step.
|
|
54
|
+
*/
|
|
55
|
+
const stepper = [
|
|
56
|
+
"relative flex h-full w-[calc(var(--field-height)-4px)] shrink-0 items-center justify-center border-hairline text-fg-muted select-none first:rounded-l-[inherit] first:border-r not-first:border-l last:rounded-r-[inherit] touch-target",
|
|
57
|
+
"hover:bg-hover hover:text-fg active:bg-hover",
|
|
58
|
+
"[&>svg]:transition-[scale] [&>svg]:spring-seat active:[&>svg]:scale-[0.82] active:[&>svg]:spring-snap motion-reduce:active:[&>svg]:scale-100",
|
|
59
|
+
"focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent",
|
|
60
|
+
"data-disabled:pointer-events-none data-disabled:text-on-disabled"
|
|
61
|
+
].join(" ");
|
|
62
|
+
/**
|
|
63
|
+
* Steps the value down. Steppers are an option, for small counts that are stepped more often
|
|
64
|
+
* than typed (a quantity); an amount of money does not get them.
|
|
65
|
+
*/
|
|
66
|
+
function NumberFieldDecrement({ className, children, ...props }) {
|
|
67
|
+
return /* @__PURE__ */ jsx(NumberField$1.Decrement, {
|
|
68
|
+
"data-slot": "number-field-decrement",
|
|
69
|
+
"aria-label": "Verringern",
|
|
70
|
+
className: mergeClassName(stepper, className),
|
|
71
|
+
...props,
|
|
72
|
+
children: children ?? /* @__PURE__ */ jsx(MinusGlyph, {})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/** Steps the value up. See `NumberFieldDecrement`. */
|
|
76
|
+
function NumberFieldIncrement({ className, children, ...props }) {
|
|
77
|
+
return /* @__PURE__ */ jsx(NumberField$1.Increment, {
|
|
78
|
+
"data-slot": "number-field-increment",
|
|
79
|
+
"aria-label": "Erhöhen",
|
|
80
|
+
className: mergeClassName(stepper, className),
|
|
81
|
+
...props,
|
|
82
|
+
children: children ?? /* @__PURE__ */ jsx(PlusGlyph, {})
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
export { NumberField, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HeadingProps } from "../heading/heading.js";
|
|
2
|
+
import { TextProps } from "../text/text.js";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
export type PageHeaderProps = ComponentProps<"div"> & {
|
|
5
|
+
/** Opens the block with the 2px rule. Every section of a page has one; its opening has none. */
|
|
6
|
+
rule?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* What opens a page or one of its sections: a title, then a lead, then what the reader can do.
|
|
10
|
+
* Nothing stands above the title, no label and no number. Everything is set left.
|
|
11
|
+
*/
|
|
12
|
+
export declare function PageHeader({ rule, className, ...props }: PageHeaderProps): import("react").JSX.Element;
|
|
13
|
+
declare const titleOnAPhone: {
|
|
14
|
+
readonly display: "max-sm:text-2xl";
|
|
15
|
+
readonly title: "max-sm:text-xl";
|
|
16
|
+
};
|
|
17
|
+
export type PageHeaderTitleProps = Omit<HeadingProps, "size"> & {
|
|
18
|
+
/** `display` (54px) once on a page, for its opening. `title` (36px) for every section. */
|
|
19
|
+
size?: keyof typeof titleOnAPhone;
|
|
20
|
+
};
|
|
21
|
+
/** A sentence with a full stop, in sentence case. It states the thing, not a topic. */
|
|
22
|
+
export declare function PageHeaderTitle({ level, size, className, ...props }: PageHeaderTitleProps): import("react").JSX.Element;
|
|
23
|
+
/** One or two sentences under the title, at lines of about 55 characters. */
|
|
24
|
+
export declare function PageHeaderLead({ className, ...props }: TextProps): import("react").JSX.Element;
|
|
25
|
+
/** The next step: one button, and at most one quiet way beside it. */
|
|
26
|
+
export declare function PageHeaderActions({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Heading } from "../heading/heading.js";
|
|
2
|
+
import { Text } from "../text/text.js";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/components/page-header/page-header.tsx
|
|
6
|
+
/**
|
|
7
|
+
* What opens a page or one of its sections: a title, then a lead, then what the reader can do.
|
|
8
|
+
* Nothing stands above the title, no label and no number. Everything is set left.
|
|
9
|
+
*/
|
|
10
|
+
function PageHeader({ rule = false, className, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
"data-slot": "page-header",
|
|
13
|
+
className: cn("flex flex-col items-start gap-4", rule && "border-t-2 border-rule pt-6", className),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const titleOnAPhone = {
|
|
18
|
+
display: "max-sm:text-2xl",
|
|
19
|
+
title: "max-sm:text-xl"
|
|
20
|
+
};
|
|
21
|
+
/** A sentence with a full stop, in sentence case. It states the thing, not a topic. */
|
|
22
|
+
function PageHeaderTitle({ level = 2, size = "title", className, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Heading, {
|
|
24
|
+
"data-slot": "page-header-title",
|
|
25
|
+
level,
|
|
26
|
+
size,
|
|
27
|
+
className: cn("max-w-[44rem]", titleOnAPhone[size], className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** One or two sentences under the title, at lines of about 55 characters. */
|
|
32
|
+
function PageHeaderLead({ className, ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
34
|
+
"data-slot": "page-header-lead",
|
|
35
|
+
size: "lg",
|
|
36
|
+
className: cn("max-w-[34rem] text-pretty", className),
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** The next step: one button, and at most one quiet way beside it. */
|
|
41
|
+
function PageHeaderActions({ className, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx("div", {
|
|
43
|
+
"data-slot": "page-header-actions",
|
|
44
|
+
className: cn("flex flex-wrap items-center gap-x-5 gap-y-3 pt-2", className),
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export { PageHeader, PageHeaderActions, PageHeaderLead, PageHeaderTitle };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
export type PagerProps = ComponentProps<"nav"> & {
|
|
4
|
+
/** The name of the navigation for assistive tech. */
|
|
5
|
+
label?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The way on at the end of a page that is one of a sequence: the page before and the page after,
|
|
9
|
+
* each named by its title. Put a `PagerLink` with `direction="previous"` and one with `"next"`;
|
|
10
|
+
* at either end of the sequence leave that one out, and the other keeps its side.
|
|
11
|
+
*/
|
|
12
|
+
export declare function Pager({ label, className, children, ...props }: PagerProps): import("react").JSX.Element;
|
|
13
|
+
export type PagerLinkProps = Omit<useRender.ComponentProps<"a">, "title"> & {
|
|
14
|
+
direction: "previous" | "next";
|
|
15
|
+
/** The title of the page it leads to. */
|
|
16
|
+
title: ReactNode;
|
|
17
|
+
/** The small line above the title. */
|
|
18
|
+
label?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* One way on: a small line that says which way, and the title of the page. The whole block is
|
|
22
|
+
* the link; its arrow leads when it is pointed at. For a router's link, pass it as `render`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function PagerLink({ direction, title, label, render, className, ...props }: PagerLinkProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ActionArrow } from "../../internal/arrow.js";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
+
// src/components/pager/pager.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The way on at the end of a page that is one of a sequence: the page before and the page after,
|
|
9
|
+
* each named by its title. Put a `PagerLink` with `direction="previous"` and one with `"next"`;
|
|
10
|
+
* at either end of the sequence leave that one out, and the other keeps its side.
|
|
11
|
+
*/
|
|
12
|
+
function Pager({ label = "Weitere Seiten", className, children, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
14
|
+
"data-slot": "pager",
|
|
15
|
+
"aria-label": label,
|
|
16
|
+
className: cn("grid gap-3 border-t border-hairline pt-6 sm:grid-cols-2 sm:gap-6", className),
|
|
17
|
+
...props,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One way on: a small line that says which way, and the title of the page. The whole block is
|
|
23
|
+
* the link; its arrow leads when it is pointed at. For a router's link, pass it as `render`.
|
|
24
|
+
*/
|
|
25
|
+
function PagerLink({ direction, title, label = direction === "next" ? "Nächste Seite" : "Vorherige Seite", render, className, ...props }) {
|
|
26
|
+
const next = direction === "next";
|
|
27
|
+
return useRender({
|
|
28
|
+
defaultTagName: "a",
|
|
29
|
+
render,
|
|
30
|
+
props: {
|
|
31
|
+
...props,
|
|
32
|
+
"data-slot": "pager-link",
|
|
33
|
+
"data-direction": direction,
|
|
34
|
+
rel: next ? "next" : "prev",
|
|
35
|
+
className: cn("group/pager -mx-3 flex min-w-0 flex-col gap-1 rounded-lg px-3 py-3 transition-colors duration-150 ease-out hover:bg-hover", "focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-accent", next && "sm:col-start-2 sm:items-end sm:text-right", className),
|
|
36
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
37
|
+
"data-slot": "pager-label",
|
|
38
|
+
className: cn("flex items-center gap-1.5 text-sm text-fg-muted", next && "sm:flex-row-reverse"),
|
|
39
|
+
children: [/* @__PURE__ */ jsx(ActionArrow, {
|
|
40
|
+
direction: next ? "right" : "left",
|
|
41
|
+
size: 14
|
|
42
|
+
}), label]
|
|
43
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
44
|
+
"data-slot": "pager-title",
|
|
45
|
+
className: "max-w-full text-lg font-medium text-pretty text-fg",
|
|
46
|
+
children: title
|
|
47
|
+
})] })
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export { Pager, PagerLink };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* What a function, a command or a tool takes: one row per parameter, its name and type on the
|
|
4
|
+
* left, what it means on the right. Structured by line like a `Table` (the 2px rule opens it,
|
|
5
|
+
* hairlines divide the rows), but each row reads as a sentence, so it is a description list.
|
|
6
|
+
* Below `sm` the description goes under the name.
|
|
7
|
+
*
|
|
8
|
+
* For values compared column by column (defaults of many settings side by side), use a `Table`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ParameterList({ className, ...props }: ComponentProps<"dl">): import("react").JSX.Element;
|
|
11
|
+
export type ParameterProps = Omit<ComponentProps<"div">, "children" | "defaultValue"> & {
|
|
12
|
+
/** The name as it is written in code. */
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* Its type as it is written in code (`string`, `"draft" | "open"`). A long union breaks after
|
|
16
|
+
* each `|`, never inside a member.
|
|
17
|
+
*/
|
|
18
|
+
type?: string;
|
|
19
|
+
/** Whether it must be given. Shown in words: colour never says it alone. */
|
|
20
|
+
required?: boolean;
|
|
21
|
+
/** What it is when it is left out. */
|
|
22
|
+
defaultValue?: ReactNode;
|
|
23
|
+
/** The words for a required and an optional parameter, and before a default. */
|
|
24
|
+
requiredLabel?: string;
|
|
25
|
+
optionalLabel?: string;
|
|
26
|
+
defaultLabel?: string;
|
|
27
|
+
/** What it means, in one or a few sentences. */
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* One parameter. Write the description as a sentence that says what the value does, and what
|
|
32
|
+
* happens without it when that is not obvious.
|
|
33
|
+
*/
|
|
34
|
+
export declare function Parameter({ name, type, required, defaultValue, requiredLabel, optionalLabel, defaultLabel, className, children, ...props }: ParameterProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment as Fragment$1 } from "react";
|
|
4
|
+
// src/components/parameter-list/parameter-list.tsx
|
|
5
|
+
/**
|
|
6
|
+
* What a function, a command or a tool takes: one row per parameter, its name and type on the
|
|
7
|
+
* left, what it means on the right. Structured by line like a `Table` (the 2px rule opens it,
|
|
8
|
+
* hairlines divide the rows), but each row reads as a sentence, so it is a description list.
|
|
9
|
+
* Below `sm` the description goes under the name.
|
|
10
|
+
*
|
|
11
|
+
* For values compared column by column (defaults of many settings side by side), use a `Table`.
|
|
12
|
+
*/
|
|
13
|
+
function ParameterList({ className, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("dl", {
|
|
15
|
+
"data-slot": "parameter-list",
|
|
16
|
+
className: cn("flex flex-col border-t-2 border-rule", className),
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** A type written in code, with a place to break after each `|` of a union. */
|
|
21
|
+
function TypeText({ type }) {
|
|
22
|
+
const members = type.split(/\s*\|\s*/);
|
|
23
|
+
return /* @__PURE__ */ jsx("code", {
|
|
24
|
+
"data-slot": "parameter-type",
|
|
25
|
+
className: "font-mono text-[0.8125rem] leading-5 break-words text-fg-muted [font-variant-ligatures:none]",
|
|
26
|
+
children: members.map((member, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [index > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [" | ", /* @__PURE__ */ jsx("wbr", {})] }) : null, member] }, `${index}:${member}`))
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* One parameter. Write the description as a sentence that says what the value does, and what
|
|
31
|
+
* happens without it when that is not obvious.
|
|
32
|
+
*/
|
|
33
|
+
function Parameter({ name, type, required, defaultValue, requiredLabel = "erforderlich", optionalLabel = "optional", defaultLabel = "Standard:", className, children, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
35
|
+
"data-slot": "parameter",
|
|
36
|
+
className: cn("grid gap-x-6 gap-y-1.5 border-b border-hairline py-3.5 sm:grid-cols-[minmax(0,14rem)_minmax(0,1fr)]", "last:border-b-0", className),
|
|
37
|
+
...props,
|
|
38
|
+
children: [/* @__PURE__ */ jsxs("dt", {
|
|
39
|
+
className: "flex min-w-0 flex-col gap-1",
|
|
40
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
41
|
+
className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5",
|
|
42
|
+
children: [/* @__PURE__ */ jsx("code", {
|
|
43
|
+
"data-slot": "parameter-name",
|
|
44
|
+
className: "font-mono text-sm font-medium [overflow-wrap:anywhere] text-fg [font-variant-ligatures:none]",
|
|
45
|
+
children: name
|
|
46
|
+
}), required !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
47
|
+
"data-slot": "parameter-required",
|
|
48
|
+
"data-required": required ? "" : void 0,
|
|
49
|
+
className: "text-sm text-fg-muted data-required:font-medium data-required:text-fg",
|
|
50
|
+
children: required ? requiredLabel : optionalLabel
|
|
51
|
+
}) : null]
|
|
52
|
+
}), type ? /* @__PURE__ */ jsx(TypeText, { type }) : null]
|
|
53
|
+
}), /* @__PURE__ */ jsxs("dd", {
|
|
54
|
+
className: "flex min-w-0 flex-col gap-1.5 text-base text-pretty text-fg-body",
|
|
55
|
+
children: [children, defaultValue !== void 0 ? /* @__PURE__ */ jsxs("span", {
|
|
56
|
+
"data-slot": "parameter-default",
|
|
57
|
+
className: "text-sm text-fg-muted",
|
|
58
|
+
children: [
|
|
59
|
+
defaultLabel,
|
|
60
|
+
" ",
|
|
61
|
+
/* @__PURE__ */ jsx("span", {
|
|
62
|
+
className: "text-fg-body",
|
|
63
|
+
children: defaultValue
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
}) : null]
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export { Parameter, ParameterList };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
2
|
+
/**
|
|
3
|
+
* A small sheet anchored to what opened it: a few fields, an explanation, a filter. It may hold
|
|
4
|
+
* controls, unlike a tooltip. If it needs a decision before anything else can happen, use a
|
|
5
|
+
* `Dialog`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const Popover: typeof Popover$1.Root;
|
|
8
|
+
export declare function PopoverTrigger(props: Popover$1.Trigger.Props): import("react").JSX.Element;
|
|
9
|
+
export type PopoverContentProps = Popover$1.Popup.Props & Pick<Popover$1.Positioner.Props, "side" | "align" | "sideOffset" | "alignOffset" | "anchor">;
|
|
10
|
+
export declare function PopoverContent({ className, side, align, sideOffset, alignOffset, anchor, ...props }: PopoverContentProps): import("react").JSX.Element;
|
|
11
|
+
/** Names the popover for assistive tech. A short sentence. */
|
|
12
|
+
export declare function PopoverTitle({ className, ...props }: Popover$1.Title.Props): import("react").JSX.Element;
|
|
13
|
+
export declare function PopoverDescription({ className, ...props }: Popover$1.Description.Props): import("react").JSX.Element;
|
|
14
|
+
/** Closes the popover. Render a `Button` through it: `<PopoverClose render={<Button />}>`. */
|
|
15
|
+
export declare function PopoverClose(props: Popover$1.Close.Props): import("react").JSX.Element;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useGround } from "../ground/ground.js";
|
|
3
|
+
import { popupMotion } from "../../internal/popup.js";
|
|
4
|
+
import { mergeClassName } from "../../lib/cn.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
7
|
+
// src/components/popover/popover.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A small sheet anchored to what opened it: a few fields, an explanation, a filter. It may hold
|
|
10
|
+
* controls, unlike a tooltip. If it needs a decision before anything else can happen, use a
|
|
11
|
+
* `Dialog`.
|
|
12
|
+
*/
|
|
13
|
+
const Popover = Popover$1.Root;
|
|
14
|
+
function PopoverTrigger(props) {
|
|
15
|
+
return /* @__PURE__ */ jsx(Popover$1.Trigger, {
|
|
16
|
+
"data-slot": "popover-trigger",
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function PopoverContent({ className, side = "bottom", align = "center", sideOffset = 8, alignOffset, anchor, ...props }) {
|
|
21
|
+
const ground = useGround();
|
|
22
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
23
|
+
"data-slot": "popover-positioner",
|
|
24
|
+
side,
|
|
25
|
+
align,
|
|
26
|
+
sideOffset,
|
|
27
|
+
alignOffset,
|
|
28
|
+
anchor,
|
|
29
|
+
className: "z-50 max-w-(--available-width)",
|
|
30
|
+
children: /* @__PURE__ */ jsx(Popover$1.Popup, {
|
|
31
|
+
"data-slot": "popover-content",
|
|
32
|
+
"data-theme": ground,
|
|
33
|
+
className: mergeClassName([
|
|
34
|
+
"flex w-72 flex-col gap-3 rounded-xl bg-sheet p-4 text-control text-fg-body depth-floating",
|
|
35
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",
|
|
36
|
+
popupMotion
|
|
37
|
+
], className),
|
|
38
|
+
...props
|
|
39
|
+
})
|
|
40
|
+
}) });
|
|
41
|
+
}
|
|
42
|
+
/** Names the popover for assistive tech. A short sentence. */
|
|
43
|
+
function PopoverTitle({ className, ...props }) {
|
|
44
|
+
return /* @__PURE__ */ jsx(Popover$1.Title, {
|
|
45
|
+
"data-slot": "popover-title",
|
|
46
|
+
className: mergeClassName("text-base leading-snug font-semibold text-fg", className),
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function PopoverDescription({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx(Popover$1.Description, {
|
|
52
|
+
"data-slot": "popover-description",
|
|
53
|
+
className: mergeClassName("text-fg-body", className),
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/** Closes the popover. Render a `Button` through it: `<PopoverClose render={<Button />}>`. */
|
|
58
|
+
function PopoverClose(props) {
|
|
59
|
+
return /* @__PURE__ */ jsx(Popover$1.Close, {
|
|
60
|
+
"data-slot": "popover-close",
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export { Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Progress as Progress$1 } from "@base-ui/react/progress";
|
|
2
|
+
export type ProgressProps = Progress$1.Root.Props;
|
|
3
|
+
/**
|
|
4
|
+
* How far a task has come: an upload, an export, the steps of a setup. The trough fills with
|
|
5
|
+
* Indigo as the value rises. Pass `value={null}` while the end is not known; the fill then runs
|
|
6
|
+
* through the trough. For a wait inside a button, use a `Spinner`; for an amount that is measured
|
|
7
|
+
* and not worked towards (storage, a quota), a `Meter`.
|
|
8
|
+
*
|
|
9
|
+
* Name it: a `ProgressLabel` ("Angebot wird exportiert"), or an `aria-label` when it stands
|
|
10
|
+
* alone. Without children it is the bare track. Pass `locale` so the percentage reads the same on
|
|
11
|
+
* the server and in the browser.
|
|
12
|
+
*/
|
|
13
|
+
export declare function Progress({ className, children, ...props }: ProgressProps): import("react").JSX.Element;
|
|
14
|
+
/** Says what is being worked on, in the present tense. */
|
|
15
|
+
export declare function ProgressLabel({ className, ...props }: Progress$1.Label.Props): import("react").JSX.Element;
|
|
16
|
+
/** The value as text, a percentage unless `format` says otherwise. Empty while the end is open. */
|
|
17
|
+
export declare function ProgressValue({ className, ...props }: Progress$1.Value.Props): import("react").JSX.Element;
|
|
18
|
+
/** The trough and its fill. The fill follows the value on `glide`, without bounce. */
|
|
19
|
+
export declare function ProgressTrack({ className, ...props }: Progress$1.Track.Props): import("react").JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { fillFraction, fillStyle, gaugeLabel, gaugeRoot, gaugeValue, troughFill, troughTrack } from "../../internal/trough.js";
|
|
3
|
+
import { mergeClassName } from "../../lib/cn.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { createContext, useContext } from "react";
|
|
6
|
+
import { Progress as Progress$1 } from "@base-ui/react/progress";
|
|
7
|
+
// src/components/progress/progress.tsx
|
|
8
|
+
/** How far the fill stands, from 0 to 1; `null` while the end is not known. */
|
|
9
|
+
const ProgressFill = createContext(null);
|
|
10
|
+
/**
|
|
11
|
+
* How far a task has come: an upload, an export, the steps of a setup. The trough fills with
|
|
12
|
+
* Indigo as the value rises. Pass `value={null}` while the end is not known; the fill then runs
|
|
13
|
+
* through the trough. For a wait inside a button, use a `Spinner`; for an amount that is measured
|
|
14
|
+
* and not worked towards (storage, a quota), a `Meter`.
|
|
15
|
+
*
|
|
16
|
+
* Name it: a `ProgressLabel` ("Angebot wird exportiert"), or an `aria-label` when it stands
|
|
17
|
+
* alone. Without children it is the bare track. Pass `locale` so the percentage reads the same on
|
|
18
|
+
* the server and in the browser.
|
|
19
|
+
*/
|
|
20
|
+
function Progress({ className, children, ...props }) {
|
|
21
|
+
const { value, min, max } = props;
|
|
22
|
+
return /* @__PURE__ */ jsx(Progress$1.Root, {
|
|
23
|
+
"data-slot": "progress",
|
|
24
|
+
className: mergeClassName(gaugeRoot, className),
|
|
25
|
+
...props,
|
|
26
|
+
children: /* @__PURE__ */ jsx(ProgressFill, {
|
|
27
|
+
value: value == null ? null : fillFraction(value, min, max),
|
|
28
|
+
children: children ?? /* @__PURE__ */ jsx(ProgressTrack, {})
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** Says what is being worked on, in the present tense. */
|
|
33
|
+
function ProgressLabel({ className, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsx(Progress$1.Label, {
|
|
35
|
+
"data-slot": "progress-label",
|
|
36
|
+
className: mergeClassName(gaugeLabel, className),
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** The value as text, a percentage unless `format` says otherwise. Empty while the end is open. */
|
|
41
|
+
function ProgressValue({ className, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx(Progress$1.Value, {
|
|
43
|
+
"data-slot": "progress-value",
|
|
44
|
+
className: mergeClassName(gaugeValue, className),
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/** The trough and its fill. The fill follows the value on `glide`, without bounce. */
|
|
49
|
+
function ProgressTrack({ className, ...props }) {
|
|
50
|
+
const fill = useContext(ProgressFill);
|
|
51
|
+
return /* @__PURE__ */ jsx(Progress$1.Track, {
|
|
52
|
+
"data-slot": "progress-track",
|
|
53
|
+
className: mergeClassName(["relative col-span-2 h-2 not-first:mt-1.5", troughTrack], className),
|
|
54
|
+
...props,
|
|
55
|
+
children: /* @__PURE__ */ jsx(Progress$1.Indicator, {
|
|
56
|
+
"data-slot": "progress-indicator",
|
|
57
|
+
style: fill == null ? void 0 : fillStyle(fill),
|
|
58
|
+
className: [
|
|
59
|
+
troughFill,
|
|
60
|
+
"bg-accent transition-[translate] spring-glide",
|
|
61
|
+
"data-indeterminate:w-2/5 motion-safe:data-indeterminate:animate-indeterminate",
|
|
62
|
+
"motion-reduce:data-indeterminate:w-full motion-reduce:data-indeterminate:animate-breathe"
|
|
63
|
+
].join(" ")
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
export { Progress, ProgressLabel, ProgressTrack, ProgressValue };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Running text that arrives as markup: a page rendered from Markdown, an article from an editor.
|
|
4
|
+
* It sets the rhythm between blocks (a heading belongs to what follows it; code, tables and
|
|
5
|
+
* callouts keep a little more room) and gives plain paragraphs, lists, quotes, rules, links and
|
|
6
|
+
* inline code their look, so a renderer only has to map what needs a component of its own.
|
|
7
|
+
*
|
|
8
|
+
* Library components inside keep their own look: map headings to `AnchorHeading`, code to
|
|
9
|
+
* `CodeBlock` and `Code`, tables to `Table`, alerts to `Callout`. The measure is the caller's:
|
|
10
|
+
* put the prose in a `Container size="text"` or a docs column. `not-prose` on an element takes
|
|
11
|
+
* it out. The styles live in `src/styles/prose.css`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function Prose({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/prose/prose.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Running text that arrives as markup: a page rendered from Markdown, an article from an editor.
|
|
6
|
+
* It sets the rhythm between blocks (a heading belongs to what follows it; code, tables and
|
|
7
|
+
* callouts keep a little more room) and gives plain paragraphs, lists, quotes, rules, links and
|
|
8
|
+
* inline code their look, so a renderer only has to map what needs a component of its own.
|
|
9
|
+
*
|
|
10
|
+
* Library components inside keep their own look: map headings to `AnchorHeading`, code to
|
|
11
|
+
* `CodeBlock` and `Code`, tables to `Table`, alerts to `Callout`. The measure is the caller's:
|
|
12
|
+
* put the prose in a `Container size="text"` or a docs column. `not-prose` on an element takes
|
|
13
|
+
* it out. The styles live in `src/styles/prose.css`.
|
|
14
|
+
*/
|
|
15
|
+
function Prose({ className, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx("div", {
|
|
17
|
+
"data-slot": "prose",
|
|
18
|
+
className: cn("prose min-w-0", className),
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export { Prose };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CodeCopyLabels } from "../code-block/code-copy.js";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
export type QuoteProps = Omit<ComponentProps<"figure">, "children"> & CodeCopyLabels & {
|
|
4
|
+
/** Who said it, or what it is ("Frage an den Assistenten"). Stands small above the words. */
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Text a reader may want to take along, such as a sentence to type to an assistant. With it,
|
|
8
|
+
* a copy key stands in the bubble's corner and puts exactly this text on the clipboard.
|
|
9
|
+
*/
|
|
10
|
+
copy?: string;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Someone else's words: a sentence a customer wrote, a question to type to an assistant. They
|
|
15
|
+
* stand on the tint, the colour of words that are not the page's own, in a bubble as wide as the
|
|
16
|
+
* text, its first corner drawn tight as a message's is.
|
|
17
|
+
*
|
|
18
|
+
* Give `copy` when the words are meant to be used, so a reader can take them without selecting.
|
|
19
|
+
* One quote holds one message: for three example questions, set three quotes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function Quote({ label, copy, copyLabel, copiedLabel, copiedMessage, failedLabel, failedMessage, className, children, ...props }: QuoteProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CodeCopy } from "../code-block/code-copy.js";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useRef } from "react";
|
|
6
|
+
// src/components/quote/quote.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Someone else's words: a sentence a customer wrote, a question to type to an assistant. They
|
|
9
|
+
* stand on the tint, the colour of words that are not the page's own, in a bubble as wide as the
|
|
10
|
+
* text, its first corner drawn tight as a message's is.
|
|
11
|
+
*
|
|
12
|
+
* Give `copy` when the words are meant to be used, so a reader can take them without selecting.
|
|
13
|
+
* One quote holds one message: for three example questions, set three quotes.
|
|
14
|
+
*/
|
|
15
|
+
function Quote({ label, copy, copyLabel = "Text kopieren", copiedLabel, copiedMessage = "Der Text wurde kopiert.", failedLabel, failedMessage = "Der Text wurde nicht kopiert. Er ist markiert und kann mit ⌘C kopiert werden.", className, children, ...props }) {
|
|
16
|
+
const words = useRef(null);
|
|
17
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
18
|
+
"data-slot": "quote",
|
|
19
|
+
className: cn("flex min-w-0 flex-col items-start gap-1.5", className),
|
|
20
|
+
...props,
|
|
21
|
+
children: [label ? /* @__PURE__ */ jsx("figcaption", {
|
|
22
|
+
"data-slot": "quote-label",
|
|
23
|
+
className: "text-sm text-fg-muted",
|
|
24
|
+
children: label
|
|
25
|
+
}) : null, /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
"data-slot": "quote-bubble",
|
|
27
|
+
className: cn("flex max-w-full items-start gap-1 rounded-2xl rounded-tl-sm bg-tint py-2.5 pl-4 sm:py-3 sm:pl-5", copy ? "pr-1.5 sm:pr-2" : "pr-4 sm:pr-5"),
|
|
28
|
+
children: [/* @__PURE__ */ jsx("blockquote", {
|
|
29
|
+
ref: words,
|
|
30
|
+
"data-slot": "quote-text",
|
|
31
|
+
className: "min-w-0 text-base text-pretty text-fg [&>*+*]:mt-2",
|
|
32
|
+
children
|
|
33
|
+
}), copy ? /* @__PURE__ */ jsx(CodeCopy, {
|
|
34
|
+
text: copy,
|
|
35
|
+
codeRef: words,
|
|
36
|
+
copyLabel,
|
|
37
|
+
copiedLabel,
|
|
38
|
+
copiedMessage,
|
|
39
|
+
failedLabel,
|
|
40
|
+
failedMessage,
|
|
41
|
+
className: "-my-0.5 shrink-0"
|
|
42
|
+
}) : null]
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export { Quote };
|