@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.
- 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,70 @@
|
|
|
1
|
+
import { IconSvgElement } from "../icon/icon.js";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { Select as Select$1 } from "@base-ui/react/select";
|
|
5
|
+
/** One entry of a select's `items`. */
|
|
6
|
+
export type SelectOption<Value = string> = {
|
|
7
|
+
value: Value;
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Stands before the label, in the list and in the trigger. Give every option one or none: a
|
|
11
|
+
* list where only some rows have an icon reads as broken.
|
|
12
|
+
*/
|
|
13
|
+
icon?: IconSvgElement;
|
|
14
|
+
/**
|
|
15
|
+
* A second, quieter piece of information, set at the right edge in the muted text colour: a
|
|
16
|
+
* price, a unit, a code ("89 € / Monat", "EUR"). It shows in the list and in the trigger.
|
|
17
|
+
*/
|
|
18
|
+
detail?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
/** A labelled group of options, as Base UI's `items` accepts it. */
|
|
21
|
+
export type SelectOptionGroup<Value = string> = {
|
|
22
|
+
value: ReactNode;
|
|
23
|
+
items: ReadonlyArray<SelectOption<Value>>;
|
|
24
|
+
};
|
|
25
|
+
export type SelectProps<Value, Multiple extends boolean | undefined = false> = Omit<Select$1.Root.Props<Value, Multiple>, "items"> & {
|
|
26
|
+
/**
|
|
27
|
+
* What can be chosen: `{ value, label, icon? }` objects (or groups of them), or a
|
|
28
|
+
* `{ value: label }` record. The trigger shows the chosen option's label, and its icon.
|
|
29
|
+
*/
|
|
30
|
+
items?: Record<string, ReactNode> | ReadonlyArray<SelectOption<Value>> | ReadonlyArray<SelectOptionGroup<Value>>;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* One value out of a list that is too long for radios (more than five or so). Pass `items` to the
|
|
34
|
+
* root so the trigger can show the label of the chosen value. For very long lists, or when
|
|
35
|
+
* people know what they are looking for, a combobox is the better tool.
|
|
36
|
+
*/
|
|
37
|
+
export declare function Select<Value, Multiple extends boolean | undefined = false>({ items, ...props }: SelectProps<Value, Multiple>): import("react").JSX.Element;
|
|
38
|
+
declare const selectTriggerVariants: (props?: ({
|
|
39
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
40
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
41
|
+
export type SelectTriggerProps = Omit<Select$1.Trigger.Props, "children"> & VariantProps<typeof selectTriggerVariants> & {
|
|
42
|
+
/** Shown while nothing is chosen: an example or an instruction, in italics like any placeholder. */
|
|
43
|
+
placeholder?: ReactNode;
|
|
44
|
+
/** Replaces how the chosen value is rendered. By default its label, and icon, from `items`. */
|
|
45
|
+
children?: Select$1.Value.Props["children"];
|
|
46
|
+
};
|
|
47
|
+
/** Shows the chosen value and opens the list. Give it a name: a `FieldLabel` or `aria-label`. */
|
|
48
|
+
export declare function SelectTrigger({ className, size, placeholder, children, ...props }: SelectTriggerProps): import("react").JSX.Element;
|
|
49
|
+
export type SelectContentProps = Select$1.Popup.Props & Pick<Select$1.Positioner.Props, "side" | "align" | "sideOffset" | "alignOffset" | "alignItemWithTrigger">;
|
|
50
|
+
/**
|
|
51
|
+
* The list, as a sheet that grows out of the trigger and is at least as wide. It opens below the
|
|
52
|
+
* trigger like a menu (`alignItemWithTrigger` is off by default, unlike in Base UI).
|
|
53
|
+
*/
|
|
54
|
+
export declare function SelectContent({ className, side, align, sideOffset, alignOffset, alignItemWithTrigger, ...props }: SelectContentProps): import("react").JSX.Element;
|
|
55
|
+
export type SelectItemProps = Select$1.Item.Props & {
|
|
56
|
+
/** Stands before the label. Defaults to the icon of the matching option in the root's `items`. */
|
|
57
|
+
icon?: IconSvgElement;
|
|
58
|
+
/** Set at the right edge, muted. Defaults to the detail of the matching option in `items`. */
|
|
59
|
+
detail?: ReactNode;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* One option. The chosen one carries the mark: a disc, where the others have nothing (ring to
|
|
63
|
+
* disc, with the ring left out to keep a long list calm). An icon, if the option has one, stands
|
|
64
|
+
* between the mark and the label; a detail stands at the right edge. Both are muted.
|
|
65
|
+
*/
|
|
66
|
+
export declare function SelectItem({ className, children, icon, detail, ...props }: SelectItemProps): import("react").JSX.Element;
|
|
67
|
+
export declare const SelectGroup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").SelectGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
68
|
+
export declare function SelectGroupLabel({ className, ...props }: Select$1.GroupLabel.Props): import("react").JSX.Element;
|
|
69
|
+
export declare function SelectSeparator({ className, ...props }: Select$1.Separator.Props): import("react").JSX.Element;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useGround } from "../ground/ground.js";
|
|
3
|
+
import { Icon } from "../icon/icon.js";
|
|
4
|
+
import { ChevronDownGlyph } from "../../internal/glyphs.js";
|
|
5
|
+
import { listGroupLabel, listItem, listSeparator, listSheet, popupMotion } from "../../internal/popup.js";
|
|
6
|
+
import { mergeClassName } from "../../lib/cn.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { cva } from "class-variance-authority";
|
|
9
|
+
import { createContext, useContext, useMemo } from "react";
|
|
10
|
+
import { Select as Select$1 } from "@base-ui/react/select";
|
|
11
|
+
// src/components/select/select.tsx
|
|
12
|
+
const OptionsContext = createContext(void 0);
|
|
13
|
+
function isGroup(item) {
|
|
14
|
+
return "items" in item && Array.isArray(item.items);
|
|
15
|
+
}
|
|
16
|
+
/** The options of `items` as one flat list; `undefined` for the `{ value: label }` record form. */
|
|
17
|
+
function flattenOptions(items) {
|
|
18
|
+
if (!Array.isArray(items)) return void 0;
|
|
19
|
+
return items.flatMap((item) => isGroup(item) ? item.items : [item]);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One value out of a list that is too long for radios (more than five or so). Pass `items` to the
|
|
23
|
+
* root so the trigger can show the label of the chosen value. For very long lists, or when
|
|
24
|
+
* people know what they are looking for, a combobox is the better tool.
|
|
25
|
+
*/
|
|
26
|
+
function Select({ items, ...props }) {
|
|
27
|
+
const options = useMemo(() => flattenOptions(items), [items]);
|
|
28
|
+
return /* @__PURE__ */ jsx(OptionsContext, {
|
|
29
|
+
value: options,
|
|
30
|
+
children: /* @__PURE__ */ jsx(Select$1.Root, {
|
|
31
|
+
items,
|
|
32
|
+
...props
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const iconSize = {
|
|
37
|
+
sm: 14,
|
|
38
|
+
md: 16,
|
|
39
|
+
lg: 16
|
|
40
|
+
};
|
|
41
|
+
/** A value without a matching option still shows, if it is text. */
|
|
42
|
+
function plainLabel(value) {
|
|
43
|
+
return typeof value === "string" || typeof value === "number" ? value : null;
|
|
44
|
+
}
|
|
45
|
+
/** How the trigger shows the chosen value once options carry an icon or a detail. */
|
|
46
|
+
function renderValue(value, options, placeholder, size) {
|
|
47
|
+
if (value === null || value === void 0) return /* @__PURE__ */ jsx("span", {
|
|
48
|
+
className: "text-fg-muted italic",
|
|
49
|
+
children: placeholder
|
|
50
|
+
});
|
|
51
|
+
const find = (candidate) => options.find((option) => Object.is(option.value, candidate));
|
|
52
|
+
if (Array.isArray(value)) return value.map((entry, index) => /* @__PURE__ */ jsxs("span", { children: [index > 0 && ", ", find(entry)?.label ?? plainLabel(entry)] }, index));
|
|
53
|
+
const option = find(value);
|
|
54
|
+
if (!option) return plainLabel(value);
|
|
55
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
56
|
+
className: "flex min-w-0 items-center gap-2",
|
|
57
|
+
children: [
|
|
58
|
+
option.icon && /* @__PURE__ */ jsx(Icon, {
|
|
59
|
+
icon: option.icon,
|
|
60
|
+
size: iconSize[size],
|
|
61
|
+
className: "text-fg-muted"
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ jsx("span", {
|
|
64
|
+
className: "truncate",
|
|
65
|
+
children: option.label
|
|
66
|
+
}),
|
|
67
|
+
option.detail !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
68
|
+
"data-slot": "select-value-detail",
|
|
69
|
+
className: "ml-auto shrink-0 pl-3 whitespace-nowrap text-fg-muted tabular-nums",
|
|
70
|
+
children: option.detail
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const selectTriggerVariants = cva([
|
|
76
|
+
"inline-flex min-w-40 shrink-0 items-center justify-between gap-2 bg-raised depth-raised text-left text-fg select-none",
|
|
77
|
+
"transition-[box-shadow,background-color,scale] spring-seat",
|
|
78
|
+
"hover:depth-raised-hover hover:spring-snap active:bg-raised-pressed active:depth-pressed active:spring-snap",
|
|
79
|
+
"data-popup-open:bg-raised-pressed data-popup-open:depth-pressed",
|
|
80
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",
|
|
81
|
+
"data-invalid:depth-field-invalid",
|
|
82
|
+
"data-disabled:pointer-events-none data-disabled:bg-disabled data-disabled:depth-flat data-disabled:text-on-disabled"
|
|
83
|
+
], {
|
|
84
|
+
variants: { size: {
|
|
85
|
+
sm: "h-(--control-sm) rounded-sm pr-(--field-pad-sm) pl-(--field-pad-sm) text-sm",
|
|
86
|
+
md: "h-(--control-md) rounded-md pr-(--field-pad-md) pl-(--field-pad-md) text-control",
|
|
87
|
+
lg: "h-(--control-lg) rounded-lg pr-(--field-pad-lg) pl-(--field-pad-lg) text-control"
|
|
88
|
+
} },
|
|
89
|
+
defaultVariants: { size: "md" }
|
|
90
|
+
});
|
|
91
|
+
/** Shows the chosen value and opens the list. Give it a name: a `FieldLabel` or `aria-label`. */
|
|
92
|
+
function SelectTrigger({ className, size, placeholder, children, ...props }) {
|
|
93
|
+
const options = useContext(OptionsContext);
|
|
94
|
+
const resolvedSize = size ?? "md";
|
|
95
|
+
const rich = options?.some((option) => option.icon !== void 0 || option.detail !== void 0) === true ? (value) => renderValue(value, options, placeholder, resolvedSize) : void 0;
|
|
96
|
+
return /* @__PURE__ */ jsxs(Select$1.Trigger, {
|
|
97
|
+
"data-slot": "select-trigger",
|
|
98
|
+
"data-size": resolvedSize,
|
|
99
|
+
className: mergeClassName(selectTriggerVariants({ size }), className),
|
|
100
|
+
...props,
|
|
101
|
+
children: [/* @__PURE__ */ jsx(Select$1.Value, {
|
|
102
|
+
"data-slot": "select-value",
|
|
103
|
+
placeholder,
|
|
104
|
+
className: "min-w-0 flex-1 truncate data-placeholder:text-fg-muted data-placeholder:italic",
|
|
105
|
+
children: children ?? rich
|
|
106
|
+
}), /* @__PURE__ */ jsx(Select$1.Icon, {
|
|
107
|
+
"data-slot": "select-icon",
|
|
108
|
+
className: "text-fg-muted",
|
|
109
|
+
children: /* @__PURE__ */ jsx(ChevronDownGlyph, {})
|
|
110
|
+
})]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The list, as a sheet that grows out of the trigger and is at least as wide. It opens below the
|
|
115
|
+
* trigger like a menu (`alignItemWithTrigger` is off by default, unlike in Base UI).
|
|
116
|
+
*/
|
|
117
|
+
function SelectContent({ className, side = "bottom", align = "start", sideOffset = 6, alignOffset, alignItemWithTrigger = false, ...props }) {
|
|
118
|
+
const ground = useGround();
|
|
119
|
+
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(Select$1.Positioner, {
|
|
120
|
+
"data-slot": "select-positioner",
|
|
121
|
+
side,
|
|
122
|
+
align,
|
|
123
|
+
sideOffset,
|
|
124
|
+
alignOffset,
|
|
125
|
+
alignItemWithTrigger,
|
|
126
|
+
className: "z-50 outline-none",
|
|
127
|
+
children: /* @__PURE__ */ jsx(Select$1.Popup, {
|
|
128
|
+
"data-slot": "select-content",
|
|
129
|
+
"data-theme": ground,
|
|
130
|
+
className: mergeClassName([
|
|
131
|
+
listSheet,
|
|
132
|
+
popupMotion,
|
|
133
|
+
"max-h-(--available-height) min-w-(--anchor-width) overflow-y-auto",
|
|
134
|
+
"data-[side=none]:transition-none"
|
|
135
|
+
], className),
|
|
136
|
+
...props
|
|
137
|
+
})
|
|
138
|
+
}) });
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* One option. The chosen one carries the mark: a disc, where the others have nothing (ring to
|
|
142
|
+
* disc, with the ring left out to keep a long list calm). An icon, if the option has one, stands
|
|
143
|
+
* between the mark and the label; a detail stands at the right edge. Both are muted.
|
|
144
|
+
*/
|
|
145
|
+
function SelectItem({ className, children, icon, detail, ...props }) {
|
|
146
|
+
const option = useContext(OptionsContext)?.find((candidate) => Object.is(candidate.value, props.value));
|
|
147
|
+
const resolvedIcon = icon ?? option?.icon;
|
|
148
|
+
const resolvedDetail = detail ?? option?.detail;
|
|
149
|
+
return /* @__PURE__ */ jsxs(Select$1.Item, {
|
|
150
|
+
"data-slot": "select-item",
|
|
151
|
+
className: mergeClassName(["group", listItem], className),
|
|
152
|
+
...props,
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ jsx("span", {
|
|
155
|
+
"aria-hidden": true,
|
|
156
|
+
className: "mark mark-quiet group-data-selected:mark-on"
|
|
157
|
+
}),
|
|
158
|
+
resolvedIcon && /* @__PURE__ */ jsx(Icon, {
|
|
159
|
+
icon: resolvedIcon,
|
|
160
|
+
className: "text-fg-muted"
|
|
161
|
+
}),
|
|
162
|
+
/* @__PURE__ */ jsx(Select$1.ItemText, {
|
|
163
|
+
"data-slot": "select-item-text",
|
|
164
|
+
children
|
|
165
|
+
}),
|
|
166
|
+
resolvedDetail !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
167
|
+
"data-slot": "select-item-detail",
|
|
168
|
+
className: "ml-auto shrink-0 pl-3 whitespace-nowrap text-fg-muted tabular-nums",
|
|
169
|
+
children: resolvedDetail
|
|
170
|
+
})
|
|
171
|
+
]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
const SelectGroup = Select$1.Group;
|
|
175
|
+
function SelectGroupLabel({ className, ...props }) {
|
|
176
|
+
return /* @__PURE__ */ jsx(Select$1.GroupLabel, {
|
|
177
|
+
"data-slot": "select-group-label",
|
|
178
|
+
className: mergeClassName(listGroupLabel, className),
|
|
179
|
+
...props
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function SelectSeparator({ className, ...props }) {
|
|
183
|
+
return /* @__PURE__ */ jsx(Select$1.Separator, {
|
|
184
|
+
"data-slot": "select-separator",
|
|
185
|
+
className: mergeClassName(listSeparator, className),
|
|
186
|
+
...props
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
export { Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import { Separator as Separator$1 } from "@base-ui/react/separator";
|
|
3
|
+
declare const separatorVariants: (props?: ({
|
|
4
|
+
variant?: "line" | "hairline" | "rule" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export type SeparatorProps = Separator$1.Props & VariantProps<typeof separatorVariants>;
|
|
7
|
+
/**
|
|
8
|
+
* Structure by line instead of by box: a 2px `rule` opens a block of content, 1px lines divide
|
|
9
|
+
* what is inside it. Content that is only read needs no card.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Separator({ className, variant, ...props }: SeparatorProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { mergeClassName } from "../../lib/cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { Separator as Separator$1 } from "@base-ui/react/separator";
|
|
6
|
+
// src/components/separator/separator.tsx
|
|
7
|
+
const separatorVariants = cva("shrink-0 data-[orientation=horizontal]:h-(--separator-size) data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-(--separator-size) data-[orientation=vertical]:self-stretch forced-colors:bg-[color:CanvasText]", {
|
|
8
|
+
variants: { variant: {
|
|
9
|
+
/** A quiet 1px line between rows or groups inside a surface. */
|
|
10
|
+
hairline: "bg-hairline [--separator-size:1px]",
|
|
11
|
+
/** The kit's structural 1px line, visible on its own (3:1). */
|
|
12
|
+
line: "bg-line [--separator-size:1px]",
|
|
13
|
+
/** The 2px rule that opens a block. */
|
|
14
|
+
rule: "bg-rule [--separator-size:2px]"
|
|
15
|
+
} },
|
|
16
|
+
defaultVariants: { variant: "hairline" }
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Structure by line instead of by box: a 2px `rule` opens a block of content, 1px lines divide
|
|
20
|
+
* what is inside it. Content that is only read needs no card.
|
|
21
|
+
*/
|
|
22
|
+
function Separator({ className, variant, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Separator$1, {
|
|
24
|
+
"data-slot": "separator",
|
|
25
|
+
className: mergeClassName(separatorVariants({ variant }), className),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export { Separator };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
export type SideNavProps = ComponentProps<"nav"> & {
|
|
4
|
+
/** The name of the navigation for assistive tech ("Dokumentation"). */
|
|
5
|
+
"aria-label": string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The pages of a set that is read in parts, standing beside the page: the chapters of the docs,
|
|
9
|
+
* the parts of a handbook. Groups under their names; the page the reader is on stands on the
|
|
10
|
+
* tint, the "you are here" colour a `NavigationMenu` entry wears too.
|
|
11
|
+
*
|
|
12
|
+
* Put a `SideNavGroup` per part, with a `SideNavLink` per page. A long page may show its
|
|
13
|
+
* sections under its link (`sub`). On a phone, where there is no room beside the page, the same
|
|
14
|
+
* groups go into the site's menu.
|
|
15
|
+
*/
|
|
16
|
+
export declare function SideNav({ className, children, ...props }: SideNavProps): import("react").JSX.Element;
|
|
17
|
+
export type SideNavGroupProps = Omit<ComponentProps<"li">, "title"> & {
|
|
18
|
+
/** What the pages below have in common: a noun ("Anleitungen"). */
|
|
19
|
+
title: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
/** One part of the set: its name, and the pages under it. */
|
|
22
|
+
export declare function SideNavGroup({ title, className, children, ...props }: SideNavGroupProps): import("react").JSX.Element;
|
|
23
|
+
export type SideNavLinkProps = useRender.ComponentProps<"a"> & {
|
|
24
|
+
/** The page this link leads to is the one the reader is on. */
|
|
25
|
+
current?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* What lies under this page, as `SideNavSubLink`s: its sections, or its subpages. Shown under
|
|
28
|
+
* the current page, or under any page that is `open`.
|
|
29
|
+
*/
|
|
30
|
+
sub?: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Show `sub` although this page is not the one being read: the reader is on one of its
|
|
33
|
+
* subpages, which then wears `current` itself.
|
|
34
|
+
*/
|
|
35
|
+
open?: boolean;
|
|
36
|
+
};
|
|
37
|
+
/** One page of the set. For a router's link, pass it as `render`. */
|
|
38
|
+
export declare function SideNavLink({ current, sub, open, render, className, ...props }: SideNavLinkProps): import("react").JSX.Element;
|
|
39
|
+
export type SideNavSubLinkProps = useRender.ComponentProps<"a"> & {
|
|
40
|
+
/** The subpage this link leads to is the one the reader is on. */
|
|
41
|
+
current?: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A section or a subpage under a page's link. The subpage being read takes the hairline in the
|
|
45
|
+
* text colour, as the `TableOfContents` marks the section being read. For a router's link, pass
|
|
46
|
+
* it as `render`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function SideNavSubLink({ current, render, className, ...props }: SideNavSubLinkProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
+
// src/components/side-nav/side-nav.tsx
|
|
7
|
+
const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent";
|
|
8
|
+
/**
|
|
9
|
+
* The pages of a set that is read in parts, standing beside the page: the chapters of the docs,
|
|
10
|
+
* the parts of a handbook. Groups under their names; the page the reader is on stands on the
|
|
11
|
+
* tint, the "you are here" colour a `NavigationMenu` entry wears too.
|
|
12
|
+
*
|
|
13
|
+
* Put a `SideNavGroup` per part, with a `SideNavLink` per page. A long page may show its
|
|
14
|
+
* sections under its link (`sub`). On a phone, where there is no room beside the page, the same
|
|
15
|
+
* groups go into the site's menu.
|
|
16
|
+
*/
|
|
17
|
+
function SideNav({ className, children, ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
19
|
+
"data-slot": "side-nav",
|
|
20
|
+
className,
|
|
21
|
+
...props,
|
|
22
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
23
|
+
className: "flex flex-col gap-7",
|
|
24
|
+
children
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/** One part of the set: its name, and the pages under it. */
|
|
29
|
+
function SideNavGroup({ title, className, children, ...props }) {
|
|
30
|
+
const id = useId();
|
|
31
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
32
|
+
"data-slot": "side-nav-group",
|
|
33
|
+
className: cn("flex flex-col", className),
|
|
34
|
+
...props,
|
|
35
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
36
|
+
id,
|
|
37
|
+
className: "px-2.5 pb-2 text-sm text-fg-muted",
|
|
38
|
+
children: title
|
|
39
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
40
|
+
"aria-labelledby": id,
|
|
41
|
+
className: "flex flex-col gap-0.5",
|
|
42
|
+
children
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/** One page of the set. For a router's link, pass it as `render`. */
|
|
47
|
+
function SideNavLink({ current = false, sub, open = false, render, className, ...props }) {
|
|
48
|
+
const link = useRender({
|
|
49
|
+
defaultTagName: "a",
|
|
50
|
+
render,
|
|
51
|
+
props: {
|
|
52
|
+
...props,
|
|
53
|
+
"data-slot": "side-nav-link",
|
|
54
|
+
"aria-current": current ? "page" : void 0,
|
|
55
|
+
className: cn("flex min-h-8 items-center rounded-md px-2.5 py-1 text-control text-fg-body", "hover:bg-hover hover:text-fg", "aria-[current=page]:bg-tint aria-[current=page]:font-medium aria-[current=page]:text-fg", "forced-colors:aria-[current=page]:outline forced-colors:aria-[current=page]:-outline-offset-1", focusRing, className)
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
59
|
+
"data-slot": "side-nav-item",
|
|
60
|
+
className: "flex flex-col",
|
|
61
|
+
children: [link, (current || open) && sub ? /* @__PURE__ */ jsx("ul", {
|
|
62
|
+
"data-slot": "side-nav-sub",
|
|
63
|
+
className: "mt-1 mb-2 ml-2.5 flex flex-col border-l border-hairline",
|
|
64
|
+
children: sub
|
|
65
|
+
}) : null]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A section or a subpage under a page's link. The subpage being read takes the hairline in the
|
|
70
|
+
* text colour, as the `TableOfContents` marks the section being read. For a router's link, pass
|
|
71
|
+
* it as `render`.
|
|
72
|
+
*/
|
|
73
|
+
function SideNavSubLink({ current = false, render, className, ...props }) {
|
|
74
|
+
const link = useRender({
|
|
75
|
+
defaultTagName: "a",
|
|
76
|
+
render,
|
|
77
|
+
props: {
|
|
78
|
+
...props,
|
|
79
|
+
"data-slot": "side-nav-sub-link",
|
|
80
|
+
"aria-current": current ? "page" : void 0,
|
|
81
|
+
className: cn("-ml-px flex min-h-7 items-center rounded-r-xs border-l border-transparent py-0.5 pl-3.5 text-sm text-fg-muted hover:border-line hover:text-fg", "aria-[current=page]:border-fg aria-[current=page]:font-medium aria-[current=page]:text-fg", "forced-colors:aria-[current=page]:border-[Highlight]", focusRing, className)
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return /* @__PURE__ */ jsx("li", {
|
|
85
|
+
"data-slot": "side-nav-sub-item",
|
|
86
|
+
children: link
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export { SideNav, SideNavGroup, SideNavLink, SideNavSubLink };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
// src/components/site-footer/site-footer-floor.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Says on <html> whether the reader has come down to the floor of the page: the end of the
|
|
7
|
+
* footer is less than half a window below the window, and the page has been scrolled. Then
|
|
8
|
+
* `data-site-floor` is on <html>, and base.css paints the root in the footer's colour.
|
|
9
|
+
*
|
|
10
|
+
* Safari 26 fills what lies beyond the page from the root's colour: the strip above the page at
|
|
11
|
+
* the top (behind the status bar) and the strip under it at the end (behind the toolbar). One
|
|
12
|
+
* colour cannot match both ends, the ground above and the footer below, so the root takes the
|
|
13
|
+
* colour of the end the reader is at. A page short enough to show both ends at once keeps the
|
|
14
|
+
* ground until it is scrolled, because the status bar shows the top.
|
|
15
|
+
*/
|
|
16
|
+
function SiteFooterFloor() {
|
|
17
|
+
const mark = useRef(null);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const end = mark.current;
|
|
20
|
+
if (!end) return;
|
|
21
|
+
const html = document.documentElement;
|
|
22
|
+
let frame = 0;
|
|
23
|
+
const update = () => {
|
|
24
|
+
frame = 0;
|
|
25
|
+
if (end.getBoundingClientRect().top - window.innerHeight < window.innerHeight / 2 && window.scrollY > 0) html.dataset.siteFloor = "";
|
|
26
|
+
else delete html.dataset.siteFloor;
|
|
27
|
+
};
|
|
28
|
+
const schedule = () => {
|
|
29
|
+
frame ||= requestAnimationFrame(update);
|
|
30
|
+
};
|
|
31
|
+
update();
|
|
32
|
+
window.addEventListener("scroll", schedule, { passive: true });
|
|
33
|
+
window.addEventListener("resize", schedule);
|
|
34
|
+
return () => {
|
|
35
|
+
cancelAnimationFrame(frame);
|
|
36
|
+
window.removeEventListener("scroll", schedule);
|
|
37
|
+
window.removeEventListener("resize", schedule);
|
|
38
|
+
delete html.dataset.siteFloor;
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
return /* @__PURE__ */ jsx("span", {
|
|
42
|
+
ref: mark,
|
|
43
|
+
"aria-hidden": true,
|
|
44
|
+
"data-slot": "site-footer-floor",
|
|
45
|
+
className: "block h-0"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export { SiteFooterFloor };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The end of a website: what this is, where else one can go, who made it, and the small print.
|
|
4
|
+
* It is the floor of the page: a quiet strip one step off the ground, under a hairline, so it
|
|
5
|
+
* does not compete with the ask above it. Near its end the window around the page takes its
|
|
6
|
+
* colour, so Safari's toolbar under it matches (`SiteFooterFloor`).
|
|
7
|
+
*
|
|
8
|
+
* Put a `SiteFooterBrand` and a `SiteFooterNav` (with `SiteFooterGroup`s) in a `SiteFooterMain`,
|
|
9
|
+
* then a `SiteFooterLegal`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function SiteFooter({ className, children, ...props }: ComponentProps<"footer">): import("react").JSX.Element;
|
|
12
|
+
/** The brand beside the places on a desk, above them on a phone. */
|
|
13
|
+
export declare function SiteFooterMain({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* What this site is about: the product's mark and name, or the drawn `Wordmark` alone, and one
|
|
16
|
+
* or two lines of text beneath it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function SiteFooterBrand({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
19
|
+
/** The other places, as columns of links. Give it a name with `aria-label`. */
|
|
20
|
+
export declare function SiteFooterNav({ className, ...props }: ComponentProps<"nav">): import("react").JSX.Element;
|
|
21
|
+
export type SiteFooterGroupProps = Omit<ComponentProps<"div">, "title"> & {
|
|
22
|
+
/** What the links below have in common: a noun ("Dokumentation"). */
|
|
23
|
+
title: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
/** One column: a name, and the links under it. */
|
|
26
|
+
export declare function SiteFooterGroup({ title, className, children, ...props }: SiteFooterGroupProps): import("react").JSX.Element;
|
|
27
|
+
/** The look of a link in the footer, for a router's link in a `<li>` of its own. */
|
|
28
|
+
export declare const siteFooterLinkClass = "rounded-xs text-fg-body underline decoration-transparent decoration-1 underline-offset-[0.25em] transition-colors spring-snap hover:text-fg hover:decoration-current focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent";
|
|
29
|
+
/**
|
|
30
|
+
* One place: a link that says where it leads. In a column of links the place says that it is a
|
|
31
|
+
* link, so the underline waits for the pointer.
|
|
32
|
+
*/
|
|
33
|
+
export declare function SiteFooterLink({ className, ...props }: ComponentProps<"a">): import("react").JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* The last row: who made this on one side, the license and the year on the other, and the small
|
|
36
|
+
* print beneath, at the floor of the type scale.
|
|
37
|
+
*/
|
|
38
|
+
export declare function SiteFooterLegal({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { containerVariants } from "../container/container.js";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
import { SiteFooterFloor } from "./site-footer-floor.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/site-footer/site-footer.tsx
|
|
6
|
+
/**
|
|
7
|
+
* The end of a website: what this is, where else one can go, who made it, and the small print.
|
|
8
|
+
* It is the floor of the page: a quiet strip one step off the ground, under a hairline, so it
|
|
9
|
+
* does not compete with the ask above it. Near its end the window around the page takes its
|
|
10
|
+
* colour, so Safari's toolbar under it matches (`SiteFooterFloor`).
|
|
11
|
+
*
|
|
12
|
+
* Put a `SiteFooterBrand` and a `SiteFooterNav` (with `SiteFooterGroup`s) in a `SiteFooterMain`,
|
|
13
|
+
* then a `SiteFooterLegal`.
|
|
14
|
+
*/
|
|
15
|
+
function SiteFooter({ className, children, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsxs("footer", {
|
|
17
|
+
"data-slot": "site-footer",
|
|
18
|
+
className: cn("border-t border-hairline bg-surface-quiet text-fg-body", className),
|
|
19
|
+
...props,
|
|
20
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
21
|
+
"data-slot": "site-footer-inner",
|
|
22
|
+
className: cn(containerVariants(), "flex flex-col gap-12 pt-14 pb-10"),
|
|
23
|
+
children
|
|
24
|
+
}), /* @__PURE__ */ jsx(SiteFooterFloor, {})]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** The brand beside the places on a desk, above them on a phone. */
|
|
28
|
+
function SiteFooterMain({ className, ...props }) {
|
|
29
|
+
return /* @__PURE__ */ jsx("div", {
|
|
30
|
+
"data-slot": "site-footer-main",
|
|
31
|
+
className: cn("grid gap-x-12 gap-y-10 lg:grid-cols-[minmax(0,5fr)_minmax(0,7fr)]", className),
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* What this site is about: the product's mark and name, or the drawn `Wordmark` alone, and one
|
|
37
|
+
* or two lines of text beneath it.
|
|
38
|
+
*/
|
|
39
|
+
function SiteFooterBrand({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx("div", {
|
|
41
|
+
"data-slot": "site-footer-brand",
|
|
42
|
+
className: cn("flex max-w-[22rem] flex-col items-start gap-3 text-fg-muted", className),
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/** The other places, as columns of links. Give it a name with `aria-label`. */
|
|
47
|
+
function SiteFooterNav({ className, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
49
|
+
"data-slot": "site-footer-nav",
|
|
50
|
+
className: cn("grid grid-cols-2 gap-x-8 gap-y-10 sm:grid-cols-3", className),
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** One column: a name, and the links under it. */
|
|
55
|
+
function SiteFooterGroup({ title, className, children, ...props }) {
|
|
56
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
57
|
+
"data-slot": "site-footer-group",
|
|
58
|
+
className: cn("flex flex-col gap-3", className),
|
|
59
|
+
...props,
|
|
60
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
61
|
+
className: "text-sm font-semibold text-fg",
|
|
62
|
+
children: title
|
|
63
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
64
|
+
className: "flex flex-col gap-2",
|
|
65
|
+
children
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** The look of a link in the footer, for a router's link in a `<li>` of its own. */
|
|
70
|
+
const siteFooterLinkClass = "rounded-xs text-fg-body underline decoration-transparent decoration-1 underline-offset-[0.25em] transition-colors spring-snap hover:text-fg hover:decoration-current focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent";
|
|
71
|
+
/**
|
|
72
|
+
* One place: a link that says where it leads. In a column of links the place says that it is a
|
|
73
|
+
* link, so the underline waits for the pointer.
|
|
74
|
+
*/
|
|
75
|
+
function SiteFooterLink({ className, ...props }) {
|
|
76
|
+
return /* @__PURE__ */ jsx("li", {
|
|
77
|
+
"data-slot": "site-footer-item",
|
|
78
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
79
|
+
"data-slot": "site-footer-link",
|
|
80
|
+
className: cn(siteFooterLinkClass, className),
|
|
81
|
+
...props
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The last row: who made this on one side, the license and the year on the other, and the small
|
|
87
|
+
* print beneath, at the floor of the type scale.
|
|
88
|
+
*/
|
|
89
|
+
function SiteFooterLegal({ className, ...props }) {
|
|
90
|
+
return /* @__PURE__ */ jsx("div", {
|
|
91
|
+
"data-slot": "site-footer-legal",
|
|
92
|
+
className: cn("flex flex-col gap-4 border-t border-hairline pt-6 text-sm text-fg-muted", className),
|
|
93
|
+
...props
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
export { SiteFooter, SiteFooterBrand, SiteFooterGroup, SiteFooterLegal, SiteFooterLink, SiteFooterMain, SiteFooterNav, siteFooterLinkClass };
|