@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
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Justin Lanfermann
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
The name "Lanfermann" and its logos are not licensed under these terms. See
|
|
24
|
+
TRADEMARK.md.
|
package/README.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @lanfermann/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React components for Next.js and Tailwind CSS v4, built on [Base UI](https://base-ui.com). It
|
|
4
|
+
is the design system I use for my own sites and apps.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
bun add @lanfermann/ui
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```css
|
|
11
|
+
@import "tailwindcss";
|
|
12
|
+
@import "@lanfermann/ui/styles.css";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
What the app has to provide (fonts, the root element, grounds and density) and how the system
|
|
16
|
+
looks and moves are in the [repository](https://github.com/jaylann/lanfermann-system).
|
|
17
|
+
|
|
18
|
+
The code is under the MIT license. The name and the logo are not: see `TRADEMARK.md`.
|
package/TRADEMARK.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Name and logo
|
|
2
|
+
|
|
3
|
+
The code in this repository is under the MIT license. The name "Lanfermann", the logomark and
|
|
4
|
+
the wordmark are not. They identify Justin Lanfermann and his work.
|
|
5
|
+
|
|
6
|
+
This covers the paths in `packages/ui/src/components/logo/` and the files in `packages/ui/brand/`.
|
|
7
|
+
You may ship them unchanged inside the package, as npm does. You may not use them to name or mark
|
|
8
|
+
your own product, site or fork.
|
|
9
|
+
|
|
10
|
+
Building your own design system on this code is fine. Give it its own name and its own logo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -16 16 16" width="16" height="16" role="img" aria-label="Lanfermann"><path fill="#13121c" d="M0 0V-16H16V0Z"></path><path fill="#fbfbfd" d="M3 -2.21L3 -14L6 -14L6 -5.21Z"></path><path fill="#a6a1fd" d="M3.21 -2L13 -2L13 -5L6.21 -5Z"></path></svg>
|
package/brand/avatar.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -16 16 16" width="16" height="16" role="img" aria-label="Lanfermann"><path fill="#13121c" d="M0 -8A8 8 0 0 1 16 -8A8 8 0 0 1 0 -8Z"></path><path fill="#fbfbfd" d="M4.6 -3.72L4.6 -12.44L6.82 -12.44L6.82 -5.94Z"></path><path fill="#a6a1fd" d="M4.76 -3.56L12 -3.56L12 -5.78L6.98 -5.78Z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -16 16 16" width="16" height="16" role="img" aria-label="Lanfermann"><path fill="#13121c" d="M0 0V-16H16V0Z"></path><path fill="#fbfbfd" d="M3 -2L3 -14L6 -14L6 -5Z"></path><path fill="#a6a1fd" d="M3 -2L13 -2L13 -5L6 -5Z"></path></svg>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
2
|
+
export type AccordionProps = Accordion$1.Root.Props;
|
|
3
|
+
/**
|
|
4
|
+
* Questions with their answers, or the sections of a long page that are read one at a time. One
|
|
5
|
+
* item is open at a time; `multiple` lets several stay open, for sections that are compared.
|
|
6
|
+
*
|
|
7
|
+
* Word each row as the question a customer would ask ("Was kostet eine Website?"). Do not hide
|
|
8
|
+
* what everybody needs behind a row: an accordion is for the second look. `hiddenUntilFound`
|
|
9
|
+
* lets the browser's page search open the row that holds the match.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Accordion({ className, ...props }: AccordionProps): import("react").JSX.Element;
|
|
12
|
+
export type AccordionItemProps = Accordion$1.Item.Props;
|
|
13
|
+
/** One row with its panel. Give it a `value` to open it at first or to control it. */
|
|
14
|
+
export declare function AccordionItem({ className, ...props }: AccordionItemProps): import("react").JSX.Element;
|
|
15
|
+
export type AccordionTriggerProps = Accordion$1.Trigger.Props & {
|
|
16
|
+
/** The heading level of the row, so it fits the outline of the page it stands on. */
|
|
17
|
+
level?: 2 | 3 | 4 | 5 | 6;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The row: a heading that is a button. The chevron stays on the first line of a long question
|
|
21
|
+
* and turns when the panel opens.
|
|
22
|
+
*/
|
|
23
|
+
export declare function AccordionTrigger({ className, children, level, ...props }: AccordionTriggerProps): import("react").JSX.Element;
|
|
24
|
+
export type AccordionPanelProps = Accordion$1.Panel.Props;
|
|
25
|
+
/** The answer. It opens on `settle` to its own height and leaves faster than it came. */
|
|
26
|
+
export declare function AccordionPanel({ className, children, ...props }: AccordionPanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { disclosureChevron, disclosurePanel } from "../../internal/disclosure.js";
|
|
3
|
+
import { ChevronDownGlyph } from "../../internal/glyphs.js";
|
|
4
|
+
import { cn, mergeClassName } from "../../lib/cn.js";
|
|
5
|
+
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/accordion/accordion.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Questions with their answers, or the sections of a long page that are read one at a time. One
|
|
10
|
+
* item is open at a time; `multiple` lets several stay open, for sections that are compared.
|
|
11
|
+
*
|
|
12
|
+
* Word each row as the question a customer would ask ("Was kostet eine Website?"). Do not hide
|
|
13
|
+
* what everybody needs behind a row: an accordion is for the second look. `hiddenUntilFound`
|
|
14
|
+
* lets the browser's page search open the row that holds the match.
|
|
15
|
+
*/
|
|
16
|
+
function Accordion({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(Accordion$1.Root, {
|
|
18
|
+
"data-slot": "accordion",
|
|
19
|
+
className: mergeClassName("flex w-full flex-col border-t-2 border-rule", className),
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** One row with its panel. Give it a `value` to open it at first or to control it. */
|
|
24
|
+
function AccordionItem({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(Accordion$1.Item, {
|
|
26
|
+
"data-slot": "accordion-item",
|
|
27
|
+
className: mergeClassName("border-b border-hairline", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The row: a heading that is a button. The chevron stays on the first line of a long question
|
|
33
|
+
* and turns when the panel opens.
|
|
34
|
+
*/
|
|
35
|
+
function AccordionTrigger({ className, children, level = 3, ...props }) {
|
|
36
|
+
const Heading = `h${level}`;
|
|
37
|
+
return /* @__PURE__ */ jsx(Accordion$1.Header, {
|
|
38
|
+
"data-slot": "accordion-header",
|
|
39
|
+
render: /* @__PURE__ */ jsx(Heading, {}),
|
|
40
|
+
className: "flex",
|
|
41
|
+
children: /* @__PURE__ */ jsxs(Accordion$1.Trigger, {
|
|
42
|
+
"data-slot": "accordion-trigger",
|
|
43
|
+
className: mergeClassName([
|
|
44
|
+
"group touch-target relative flex min-h-(--control-lg) w-full items-start gap-4 rounded-sm px-3 py-3 text-left text-base font-medium text-fg select-none",
|
|
45
|
+
"hover:bg-hover",
|
|
46
|
+
"focus-visible:relative focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",
|
|
47
|
+
"data-disabled:pointer-events-none data-disabled:text-on-disabled"
|
|
48
|
+
], className),
|
|
49
|
+
...props,
|
|
50
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
51
|
+
"data-slot": "accordion-trigger-label",
|
|
52
|
+
className: "min-w-0 flex-1",
|
|
53
|
+
children
|
|
54
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
55
|
+
"aria-hidden": true,
|
|
56
|
+
className: "flex h-lh shrink-0 items-center",
|
|
57
|
+
children: /* @__PURE__ */ jsx(ChevronDownGlyph, {
|
|
58
|
+
"data-slot": "accordion-chevron",
|
|
59
|
+
className: cn(disclosureChevron, "group-data-panel-open:rotate-180")
|
|
60
|
+
})
|
|
61
|
+
})]
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** The answer. It opens on `settle` to its own height and leaves faster than it came. */
|
|
66
|
+
function AccordionPanel({ className, children, ...props }) {
|
|
67
|
+
return /* @__PURE__ */ jsx(Accordion$1.Panel, {
|
|
68
|
+
"data-slot": "accordion-panel",
|
|
69
|
+
className: mergeClassName(["h-(--accordion-panel-height) text-base text-fg-body", disclosurePanel], className),
|
|
70
|
+
...props,
|
|
71
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
72
|
+
"data-slot": "accordion-panel-content",
|
|
73
|
+
className: "px-3 pt-0.5 pb-4",
|
|
74
|
+
children
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IconSvgElement } from "../icon/icon.js";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
declare const alertVariants: (props?: ({
|
|
5
|
+
tone?: "neutral" | "info" | "success" | "warning" | "danger" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export type AlertProps = ComponentProps<"div"> & VariantProps<typeof alertVariants> & {
|
|
8
|
+
/** Replaces the tone's icon. An alert always has one: colour alone never carries a status. */
|
|
9
|
+
icon?: IconSvgElement;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A message that belongs to the page, not to a moment: a plan that ends, a form that could not
|
|
13
|
+
* be sent. Say what happened in the title and what to do in the description. It is announced
|
|
14
|
+
* politely (`role="status"`); pass `role="alert"` only when the person must act now.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Alert({ className, tone, icon, children, ...props }: AlertProps): import("react").JSX.Element;
|
|
17
|
+
export declare function AlertTitle({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
|
|
18
|
+
export declare function AlertDescription({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Icon } from "../icon/icon.js";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Alert02Icon, AlertCircleIcon, CheckmarkCircle02Icon, InformationCircleIcon } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
// src/components/alert/alert.tsx
|
|
7
|
+
const alertVariants = cva("grid grid-cols-[auto_1fr] items-start gap-x-3 rounded-lg px-4 py-3 text-base text-fg-body inset-ring forced-colors:outline", {
|
|
8
|
+
variants: { tone: {
|
|
9
|
+
neutral: "bg-surface-quiet inset-ring-hairline",
|
|
10
|
+
info: "bg-info-soft inset-ring-info/20",
|
|
11
|
+
success: "bg-success-soft inset-ring-success/25",
|
|
12
|
+
warning: "bg-warning-soft inset-ring-warning/30",
|
|
13
|
+
danger: "bg-danger-soft inset-ring-danger/25"
|
|
14
|
+
} },
|
|
15
|
+
defaultVariants: { tone: "neutral" }
|
|
16
|
+
});
|
|
17
|
+
const icons = {
|
|
18
|
+
neutral: InformationCircleIcon,
|
|
19
|
+
info: InformationCircleIcon,
|
|
20
|
+
success: CheckmarkCircle02Icon,
|
|
21
|
+
warning: Alert02Icon,
|
|
22
|
+
danger: AlertCircleIcon
|
|
23
|
+
};
|
|
24
|
+
const iconTone = {
|
|
25
|
+
neutral: "text-fg-muted",
|
|
26
|
+
info: "text-fg",
|
|
27
|
+
success: "text-success",
|
|
28
|
+
warning: "text-warning",
|
|
29
|
+
danger: "text-danger"
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A message that belongs to the page, not to a moment: a plan that ends, a form that could not
|
|
33
|
+
* be sent. Say what happened in the title and what to do in the description. It is announced
|
|
34
|
+
* politely (`role="status"`); pass `role="alert"` only when the person must act now.
|
|
35
|
+
*/
|
|
36
|
+
function Alert({ className, tone, icon, children, ...props }) {
|
|
37
|
+
const resolved = tone ?? "neutral";
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
39
|
+
"data-slot": "alert",
|
|
40
|
+
"data-tone": resolved,
|
|
41
|
+
role: "status",
|
|
42
|
+
className: cn(alertVariants({ tone }), className),
|
|
43
|
+
...props,
|
|
44
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
45
|
+
icon: icon ?? icons[resolved],
|
|
46
|
+
size: 18,
|
|
47
|
+
className: cn("mt-[3px]", iconTone[resolved])
|
|
48
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: "flex min-w-0 flex-col gap-0.5",
|
|
50
|
+
children
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function AlertTitle({ className, ...props }) {
|
|
55
|
+
return /* @__PURE__ */ jsx("p", {
|
|
56
|
+
"data-slot": "alert-title",
|
|
57
|
+
className: cn("font-semibold text-fg", className),
|
|
58
|
+
...props
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function AlertDescription({ className, ...props }) {
|
|
62
|
+
return /* @__PURE__ */ jsx("p", {
|
|
63
|
+
"data-slot": "alert-description",
|
|
64
|
+
className: cn("text-fg-body", className),
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export { Alert, AlertDescription, AlertTitle };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* A question that must be answered before anything else: confirming something that cannot be
|
|
5
|
+
* undone. It has no close button and a click outside does not dismiss it. Name the consequence in
|
|
6
|
+
* the title, and label the buttons with what they do ("Angebot löschen", "Behalten"), never "OK".
|
|
7
|
+
*/
|
|
8
|
+
export declare const AlertDialog: typeof AlertDialog$1.Root;
|
|
9
|
+
export declare function AlertDialogTrigger(props: AlertDialog$1.Trigger.Props): import("react").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Closes the dialog. Both answers are rendered through it:
|
|
12
|
+
* `<AlertDialogClose render={<Button variant="danger" onClick={remove} />}>`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function AlertDialogClose(props: AlertDialog$1.Close.Props): import("react").JSX.Element;
|
|
15
|
+
export declare function AlertDialogContent({ className, ...props }: AlertDialog$1.Popup.Props): import("react").JSX.Element;
|
|
16
|
+
export declare function AlertDialogHeader({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
17
|
+
/** The consequence, as a question or a sentence ("Angebot wirklich löschen?"). */
|
|
18
|
+
export declare function AlertDialogTitle({ className, ...props }: AlertDialog$1.Title.Props): import("react").JSX.Element;
|
|
19
|
+
export declare function AlertDialogDescription({ className, ...props }: AlertDialog$1.Description.Props): import("react").JSX.Element;
|
|
20
|
+
export declare function AlertDialogFooter({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useGround } from "../ground/ground.js";
|
|
3
|
+
import { overlayBackdrop, overlayDescription, overlayFooter, overlayHeader, overlayPopup, overlayTitle, overlayViewport } from "../../internal/overlay.js";
|
|
4
|
+
import { cn, mergeClassName } from "../../lib/cn.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
|
|
7
|
+
// src/components/alert-dialog/alert-dialog.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A question that must be answered before anything else: confirming something that cannot be
|
|
10
|
+
* undone. It has no close button and a click outside does not dismiss it. Name the consequence in
|
|
11
|
+
* the title, and label the buttons with what they do ("Angebot löschen", "Behalten"), never "OK".
|
|
12
|
+
*/
|
|
13
|
+
const AlertDialog = AlertDialog$1.Root;
|
|
14
|
+
function AlertDialogTrigger(props) {
|
|
15
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Trigger, {
|
|
16
|
+
"data-slot": "alert-dialog-trigger",
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Closes the dialog. Both answers are rendered through it:
|
|
22
|
+
* `<AlertDialogClose render={<Button variant="danger" onClick={remove} />}>`.
|
|
23
|
+
*/
|
|
24
|
+
function AlertDialogClose(props) {
|
|
25
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Close, {
|
|
26
|
+
"data-slot": "alert-dialog-close",
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function AlertDialogContent({ className, ...props }) {
|
|
31
|
+
const ground = useGround();
|
|
32
|
+
return /* @__PURE__ */ jsxs(AlertDialog$1.Portal, { children: [/* @__PURE__ */ jsx(AlertDialog$1.Backdrop, {
|
|
33
|
+
"data-slot": "alert-dialog-backdrop",
|
|
34
|
+
className: overlayBackdrop
|
|
35
|
+
}), /* @__PURE__ */ jsx(AlertDialog$1.Viewport, {
|
|
36
|
+
"data-slot": "alert-dialog-viewport",
|
|
37
|
+
className: overlayViewport,
|
|
38
|
+
children: /* @__PURE__ */ jsx(AlertDialog$1.Popup, {
|
|
39
|
+
"data-slot": "alert-dialog-content",
|
|
40
|
+
"data-theme": ground,
|
|
41
|
+
className: mergeClassName([overlayPopup, "max-w-sm"], className),
|
|
42
|
+
...props
|
|
43
|
+
})
|
|
44
|
+
})] });
|
|
45
|
+
}
|
|
46
|
+
function AlertDialogHeader({ className, ...props }) {
|
|
47
|
+
return /* @__PURE__ */ jsx("div", {
|
|
48
|
+
"data-slot": "alert-dialog-header",
|
|
49
|
+
className: cn(overlayHeader, "pr-0", className),
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** The consequence, as a question or a sentence ("Angebot wirklich löschen?"). */
|
|
54
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
55
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Title, {
|
|
56
|
+
"data-slot": "alert-dialog-title",
|
|
57
|
+
className: mergeClassName(overlayTitle, className),
|
|
58
|
+
...props
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
62
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Description, {
|
|
63
|
+
"data-slot": "alert-dialog-description",
|
|
64
|
+
className: mergeClassName(overlayDescription, className),
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function AlertDialogFooter({ className, ...props }) {
|
|
69
|
+
return /* @__PURE__ */ jsx("div", {
|
|
70
|
+
"data-slot": "alert-dialog-footer",
|
|
71
|
+
className: cn(overlayFooter, className),
|
|
72
|
+
...props
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export { AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HeadingProps } from "../heading/heading.js";
|
|
2
|
+
export type AnchorHeadingProps = Omit<HeadingProps, "id" | "level"> & {
|
|
3
|
+
/** The section's id: the part of the address after `#`. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** `<h2>` to `<h4>`: a section of a page and its parts. The page's title is `PageHeaderTitle`. */
|
|
6
|
+
level?: 2 | 3 | 4;
|
|
7
|
+
/** The name of the link to the section, read out by a screen reader. */
|
|
8
|
+
anchorLabel?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A heading in a long page that can be linked to: a section of the docs, an entry in a
|
|
12
|
+
* reference. A link symbol after its text sets the address to the section, so a reader can copy
|
|
13
|
+
* it and send someone straight there. The symbol shows when the heading is pointed at or the link
|
|
14
|
+
* has the keyboard, so thirty headings do not carry thirty symbols at rest.
|
|
15
|
+
*
|
|
16
|
+
* It stops below a sticky bar when it is jumped to: set `--anchor-offset` (the bar's height and
|
|
17
|
+
* some air) on the page, or `scroll-padding-top` on `<html>`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function AnchorHeading({ id, level, anchorLabel, className, children, ...props }: AnchorHeadingProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Heading } from "../heading/heading.js";
|
|
2
|
+
import { Icon } from "../icon/icon.js";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Link04Icon } from "@hugeicons/core-free-icons";
|
|
6
|
+
// src/components/anchor-heading/anchor-heading.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A heading in a long page that can be linked to: a section of the docs, an entry in a
|
|
9
|
+
* reference. A link symbol after its text sets the address to the section, so a reader can copy
|
|
10
|
+
* it and send someone straight there. The symbol shows when the heading is pointed at or the link
|
|
11
|
+
* has the keyboard, so thirty headings do not carry thirty symbols at rest.
|
|
12
|
+
*
|
|
13
|
+
* It stops below a sticky bar when it is jumped to: set `--anchor-offset` (the bar's height and
|
|
14
|
+
* some air) on the page, or `scroll-padding-top` on `<html>`.
|
|
15
|
+
*/
|
|
16
|
+
function AnchorHeading({ id, level = 2, anchorLabel = "Link zu diesem Abschnitt", className, children, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsxs(Heading, {
|
|
18
|
+
"data-slot": "anchor-heading",
|
|
19
|
+
id,
|
|
20
|
+
level,
|
|
21
|
+
className: cn("group/anchor scroll-mt-[var(--anchor-offset,0px)]", className),
|
|
22
|
+
...props,
|
|
23
|
+
children: [
|
|
24
|
+
children,
|
|
25
|
+
"\xA0",
|
|
26
|
+
/* @__PURE__ */ jsx("a", {
|
|
27
|
+
href: `#${id}`,
|
|
28
|
+
"aria-label": anchorLabel,
|
|
29
|
+
"data-slot": "anchor-heading-link",
|
|
30
|
+
className: cn("touch-target relative inline-flex size-5 items-center justify-center rounded-xs align-middle text-fg-muted", "opacity-0 transition-[opacity,color] spring-snap group-hover/anchor:opacity-100 hover:text-fg focus-visible:opacity-100", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent"),
|
|
31
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
32
|
+
icon: Link04Icon,
|
|
33
|
+
size: 16
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export { AnchorHeading };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import { Avatar as Avatar$1 } from "@base-ui/react/avatar";
|
|
3
|
+
declare const avatarVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export type AvatarProps = Avatar$1.Root.Props & VariantProps<typeof avatarVariants>;
|
|
7
|
+
/**
|
|
8
|
+
* A person or a business, as a rounded square. Put an `AvatarImage` and an `AvatarFallback` with
|
|
9
|
+
* one or two initials inside; the initials show until the picture has loaded, or if there is none.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Avatar({ className, size, ...props }: AvatarProps): import("react").JSX.Element;
|
|
12
|
+
export declare function AvatarImage({ className, alt, ...props }: Avatar$1.Image.Props): import("react").JSX.Element;
|
|
13
|
+
export declare function AvatarFallback({ className, ...props }: Avatar$1.Fallback.Props): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { Avatar as Avatar$1 } from "@base-ui/react/avatar";
|
|
6
|
+
// src/components/avatar/avatar.tsx
|
|
7
|
+
const avatarVariants = cva("relative inline-flex shrink-0 items-center justify-center overflow-hidden bg-fg font-semibold text-ground select-none forced-colors:outline", {
|
|
8
|
+
variants: { size: {
|
|
9
|
+
sm: "size-6 rounded-xs text-xs",
|
|
10
|
+
md: "size-7 rounded-sm text-xs",
|
|
11
|
+
lg: "size-9 rounded-md text-sm",
|
|
12
|
+
xl: "size-12 rounded-lg text-base"
|
|
13
|
+
} },
|
|
14
|
+
defaultVariants: { size: "md" }
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* A person or a business, as a rounded square. Put an `AvatarImage` and an `AvatarFallback` with
|
|
18
|
+
* one or two initials inside; the initials show until the picture has loaded, or if there is none.
|
|
19
|
+
*/
|
|
20
|
+
function Avatar({ className, size, ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(Avatar$1.Root, {
|
|
22
|
+
"data-slot": "avatar",
|
|
23
|
+
className: mergeClassName(avatarVariants({ size }), className),
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function AvatarImage({ className, alt = "", ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx(Avatar$1.Image, {
|
|
29
|
+
"data-slot": "avatar-image",
|
|
30
|
+
alt,
|
|
31
|
+
className: mergeClassName("size-full object-cover", className),
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function AvatarFallback({ className, ...props }) {
|
|
36
|
+
return /* @__PURE__ */ jsx(Avatar$1.Fallback, {
|
|
37
|
+
"data-slot": "avatar-fallback",
|
|
38
|
+
className: mergeClassName("flex size-full items-center justify-center", className),
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
tone?: "neutral" | "info" | "success" | "warning" | "danger" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export type BadgeProps = ComponentProps<"span"> & VariantProps<typeof badgeVariants>;
|
|
7
|
+
/**
|
|
8
|
+
* A short state on a row or a card: "Entwurf", "Bezahlt", "Überfällig". One or two words, in
|
|
9
|
+
* sentence case. Colour never carries the state alone: the word does, and a 12px icon may help.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Badge({ className, tone, ...props }: BadgeProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
// src/components/badge/badge.tsx
|
|
5
|
+
const badgeVariants = cva("inline-flex h-[1.375rem] shrink-0 items-center gap-1 rounded-sm px-2 text-sm font-medium whitespace-nowrap inset-ring inset-ring-current/15 forced-colors:outline", {
|
|
6
|
+
variants: { tone: {
|
|
7
|
+
neutral: "bg-surface-quiet text-fg-body",
|
|
8
|
+
info: "bg-info-soft text-info",
|
|
9
|
+
success: "bg-success-soft text-success",
|
|
10
|
+
warning: "bg-warning-soft text-warning",
|
|
11
|
+
danger: "bg-danger-soft text-danger"
|
|
12
|
+
} },
|
|
13
|
+
defaultVariants: { tone: "neutral" }
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* A short state on a row or a card: "Entwurf", "Bezahlt", "Überfällig". One or two words, in
|
|
17
|
+
* sentence case. Colour never carries the state alone: the word does, and a 12px icon may help.
|
|
18
|
+
*/
|
|
19
|
+
function Badge({ className, tone, ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx("span", {
|
|
21
|
+
"data-slot": "badge",
|
|
22
|
+
"data-tone": tone ?? "neutral",
|
|
23
|
+
className: cn(badgeVariants({ tone }), className),
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { Badge };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
export type BreadcrumbsProps = ComponentProps<"nav"> & {
|
|
4
|
+
/** The name of the trail for assistive tech. */
|
|
5
|
+
label?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Where a page stands: the places above it, from the outside in, each a step back. It stands
|
|
9
|
+
* above a page's title in place of a label ("Doku › Anleitungen"), small and muted, so the title
|
|
10
|
+
* stays the first thing read.
|
|
11
|
+
*
|
|
12
|
+
* Put a `BreadcrumbItem` per place: a `BreadcrumbLink` for a place that is a page, plain text
|
|
13
|
+
* for a group that is none. The page itself may end the trail as `BreadcrumbPage`; leave it out
|
|
14
|
+
* when its title follows right below.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Breadcrumbs({ label, className, children, ...props }: BreadcrumbsProps): import("react").JSX.Element;
|
|
17
|
+
/** One place in the trail. A chevron before it says it lies inside the one before. */
|
|
18
|
+
export declare function BreadcrumbItem({ className, children, ...props }: ComponentProps<"li">): import("react").JSX.Element;
|
|
19
|
+
export type BreadcrumbLinkProps = useRender.ComponentProps<"a">;
|
|
20
|
+
/** A place that is a page. For a router's link, pass it as `render`. */
|
|
21
|
+
export declare function BreadcrumbLink({ render, className, ...props }: BreadcrumbLinkProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
22
|
+
/** The page the reader is on, at the end of the trail. */
|
|
23
|
+
export declare function BreadcrumbPage({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ChevronRightGlyph } from "../../internal/glyphs.js";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
+
// src/components/breadcrumbs/breadcrumbs.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Where a page stands: the places above it, from the outside in, each a step back. It stands
|
|
9
|
+
* above a page's title in place of a label ("Doku › Anleitungen"), small and muted, so the title
|
|
10
|
+
* stays the first thing read.
|
|
11
|
+
*
|
|
12
|
+
* Put a `BreadcrumbItem` per place: a `BreadcrumbLink` for a place that is a page, plain text
|
|
13
|
+
* for a group that is none. The page itself may end the trail as `BreadcrumbPage`; leave it out
|
|
14
|
+
* when its title follows right below.
|
|
15
|
+
*/
|
|
16
|
+
function Breadcrumbs({ label = "Pfad", className, children, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
18
|
+
"data-slot": "breadcrumbs",
|
|
19
|
+
"aria-label": label,
|
|
20
|
+
className,
|
|
21
|
+
...props,
|
|
22
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
23
|
+
className: "flex flex-wrap items-center gap-x-1.5 gap-y-1 text-sm text-fg-muted",
|
|
24
|
+
children
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/** One place in the trail. A chevron before it says it lies inside the one before. */
|
|
29
|
+
function BreadcrumbItem({ className, children, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
31
|
+
"data-slot": "breadcrumb-item",
|
|
32
|
+
className: cn("group/crumb inline-flex min-w-0 items-center gap-1.5 [&:first-child>[data-slot=breadcrumb-separator]]:hidden", className),
|
|
33
|
+
...props,
|
|
34
|
+
children: [/* @__PURE__ */ jsx(ChevronRightGlyph, {
|
|
35
|
+
"data-slot": "breadcrumb-separator",
|
|
36
|
+
"aria-hidden": true,
|
|
37
|
+
strokeWidth: 1.5,
|
|
38
|
+
className: "text-line"
|
|
39
|
+
}), children]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/** A place that is a page. For a router's link, pass it as `render`. */
|
|
43
|
+
function BreadcrumbLink({ render, className, ...props }) {
|
|
44
|
+
return useRender({
|
|
45
|
+
defaultTagName: "a",
|
|
46
|
+
render,
|
|
47
|
+
props: {
|
|
48
|
+
...props,
|
|
49
|
+
"data-slot": "breadcrumb-link",
|
|
50
|
+
className: cn("rounded-xs 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", className)
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** The page the reader is on, at the end of the trail. */
|
|
55
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
56
|
+
return /* @__PURE__ */ jsx("span", {
|
|
57
|
+
"data-slot": "breadcrumb-page",
|
|
58
|
+
"aria-current": "page",
|
|
59
|
+
className: cn("truncate text-fg", className),
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export { BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, Breadcrumbs };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
/**
|
|
3
|
+
* The look of a button as class names. It lives outside the client component so Server Components
|
|
4
|
+
* can call it, e.g. for a link that should look like a button:
|
|
5
|
+
*
|
|
6
|
+
* <a href="/angebot" className={buttonVariants({ variant: "primary" })}>Angebot ansehen</a>
|
|
7
|
+
*
|
|
8
|
+
* (A link keeps its own semantics; do not render one through `Button`.)
|
|
9
|
+
*/
|
|
10
|
+
export declare const buttonVariants: (props?: ({
|
|
11
|
+
variant?: "danger" | "primary" | "secondary" | "quiet" | "ask" | null | undefined;
|
|
12
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
13
|
+
iconOnly?: boolean | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
|
+
export type ButtonVariants = VariantProps<typeof buttonVariants>;
|