@stridge/noctis 1.0.0-beta.4 → 1.0.0-beta.6
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/dist/components/breadcrumb/breadcrumb.d.ts +163 -0
- package/dist/components/breadcrumb/breadcrumb.js +152 -0
- package/dist/components/breadcrumb/breadcrumb.props.d.ts +59 -0
- package/dist/components/breadcrumb/breadcrumb.props.js +68 -0
- package/dist/components/breadcrumb/breadcrumb.slots.d.ts +16 -0
- package/dist/components/breadcrumb/breadcrumb.slots.js +32 -0
- package/dist/components/breadcrumb/breadcrumb.types.d.ts +9 -0
- package/dist/components/breadcrumb/index.d.ts +3 -0
- package/dist/components/command/command-listbox.js +174 -0
- package/dist/components/command/command-rank.d.ts +40 -0
- package/dist/components/command/command-rank.js +61 -0
- package/dist/components/command/command-score.d.ts +25 -0
- package/dist/components/command/command-score.js +85 -0
- package/dist/components/command/command.context.d.ts +17 -0
- package/dist/components/command/command.context.js +13 -0
- package/dist/components/command/command.d.ts +396 -0
- package/dist/components/command/command.js +471 -0
- package/dist/components/command/command.props.d.ts +91 -0
- package/dist/components/command/command.props.js +94 -0
- package/dist/components/command/command.slots.d.ts +23 -0
- package/dist/components/command/command.slots.js +60 -0
- package/dist/components/command/index.d.ts +6 -0
- package/dist/components/command/use-command-ranking.d.ts +37 -0
- package/dist/components/command/use-command-ranking.js +127 -0
- package/dist/components/pagination/index.d.ts +3 -0
- package/dist/components/pagination/pagination.context.js +16 -0
- package/dist/components/pagination/pagination.d.ts +217 -0
- package/dist/components/pagination/pagination.js +333 -0
- package/dist/components/pagination/pagination.props.d.ts +51 -0
- package/dist/components/pagination/pagination.props.js +49 -0
- package/dist/components/pagination/pagination.slots.d.ts +16 -0
- package/dist/components/pagination/pagination.slots.js +32 -0
- package/dist/components/pagination/pagination.types.d.ts +24 -0
- package/dist/components/search-dialog/parts/root.js +1 -1
- package/dist/components/skeleton/index.d.ts +3 -0
- package/dist/components/skeleton/skeleton.context.js +12 -0
- package/dist/components/skeleton/skeleton.d.ts +157 -0
- package/dist/components/skeleton/skeleton.js +130 -0
- package/dist/components/skeleton/skeleton.props.d.ts +47 -0
- package/dist/components/skeleton/skeleton.props.js +57 -0
- package/dist/components/skeleton/skeleton.slots.d.ts +15 -0
- package/dist/components/skeleton/skeleton.slots.js +28 -0
- package/dist/components/skeleton/skeleton.types.d.ts +13 -0
- package/dist/components/surface/surface.d.ts +1 -1
- package/dist/icons/glyphs.js +2 -2
- package/dist/index.d.ts +18 -3
- package/dist/index.js +15 -4
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.js +2 -2
- package/dist/props.d.ts +37 -33
- package/dist/props.js +37 -33
- package/dist/styles.css +841 -6
- package/package.json +4 -4
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { BreadcrumbSize } from "./breadcrumb.types.js";
|
|
2
|
+
import { BreadcrumbPartProps, BreadcrumbRootPropsArgs, BreadcrumbStatelessPropsArgs, ellipsisProps, iconProps, itemProps, linkProps, listProps, pageProps, rootProps, separatorProps } from "./breadcrumb.props.js";
|
|
3
|
+
import { Primitive } from "../../core/primitive/primitive.js";
|
|
4
|
+
import { ComponentProps, ReactElement } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/breadcrumb/breadcrumb.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The trail wrapper — a `<nav>` landmark named "Breadcrumb" (localized; a passed `aria-label` wins). It
|
|
9
|
+
* owns the `size` axis, stamped as `data-size` on the root so the precompiled `breadcrumb.css` keys its
|
|
10
|
+
* per-size metrics off it. Wrap the crumbs in a single `Breadcrumb.List`.
|
|
11
|
+
*/
|
|
12
|
+
declare function BreadcrumbRoot({
|
|
13
|
+
size,
|
|
14
|
+
className,
|
|
15
|
+
"aria-label": ariaLabel,
|
|
16
|
+
...props
|
|
17
|
+
}: Breadcrumb.Root.Props): ReactElement;
|
|
18
|
+
/** The ordered trail — an `<ol>` laying crumbs and separators in a wrapping row. */
|
|
19
|
+
declare function BreadcrumbList({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: Breadcrumb.List.Props): ReactElement;
|
|
23
|
+
/** A single crumb's `<li>` — wrap a `Breadcrumb.Link` (an ancestor) or `Breadcrumb.Page` (the current page). */
|
|
24
|
+
declare function BreadcrumbItem({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: Breadcrumb.Item.Props): ReactElement;
|
|
28
|
+
/**
|
|
29
|
+
* An interactive ancestor crumb. Renders an `<a>` by default — muted, lifting to the foreground on
|
|
30
|
+
* hover and focus — and accepts Base UI's `render` prop so it can compose onto a router link
|
|
31
|
+
* (`<Breadcrumb.Link href="/docs" render={<NextLink href="/docs" />}>`) while keeping its slot and skin.
|
|
32
|
+
* Compose a leading `Breadcrumb.Icon` before the label for a glyph.
|
|
33
|
+
*/
|
|
34
|
+
declare function BreadcrumbLink({
|
|
35
|
+
className,
|
|
36
|
+
...props
|
|
37
|
+
}: Breadcrumb.Link.Props): ReactElement;
|
|
38
|
+
/**
|
|
39
|
+
* The current page — the last crumb. A non-interactive `<span>` marked `aria-current="page"` so
|
|
40
|
+
* assistive tech announces it as the location; it reads in the foreground at a slightly heavier weight.
|
|
41
|
+
* Compose a leading `Breadcrumb.Icon` before the label for a glyph.
|
|
42
|
+
*/
|
|
43
|
+
declare function BreadcrumbPage({
|
|
44
|
+
className,
|
|
45
|
+
...props
|
|
46
|
+
}: Breadcrumb.Page.Props): ReactElement;
|
|
47
|
+
/**
|
|
48
|
+
* The glyph between crumbs. A presentational `<li>` (hidden from assistive tech — the list order
|
|
49
|
+
* already conveys the hierarchy) holding a directional chevron by default; pass `children` to swap the
|
|
50
|
+
* glyph (a slash, a dot, any inline svg). It mirrors under RTL.
|
|
51
|
+
*/
|
|
52
|
+
declare function BreadcrumbSeparator({
|
|
53
|
+
className,
|
|
54
|
+
children,
|
|
55
|
+
...props
|
|
56
|
+
}: Breadcrumb.Separator.Props): ReactElement;
|
|
57
|
+
/**
|
|
58
|
+
* A collapsed-run indicator standing in for crumbs hidden to fit a long trail. Draws an ellipsis glyph
|
|
59
|
+
* with a localized "More" name for assistive tech; pass `children` to swap the glyph. Wrap it in a
|
|
60
|
+
* `Breadcrumb.Item`, optionally making it the trigger of a menu that reveals the hidden crumbs.
|
|
61
|
+
*/
|
|
62
|
+
declare function BreadcrumbEllipsis({
|
|
63
|
+
className,
|
|
64
|
+
children,
|
|
65
|
+
...props
|
|
66
|
+
}: Breadcrumb.Ellipsis.Props): ReactElement;
|
|
67
|
+
/**
|
|
68
|
+
* An optional leading glyph for a crumb. Clamps its glyph to the trail's icon size and inherits the
|
|
69
|
+
* crumb's text colour, so it tracks the label in every size. Decorative by default (`aria-hidden`);
|
|
70
|
+
* wrap an `<Icon>` or any inline svg inside it — don't put `data-slot` on the icon itself, which would
|
|
71
|
+
* drop its own token sizing.
|
|
72
|
+
*/
|
|
73
|
+
declare function BreadcrumbIcon({
|
|
74
|
+
className,
|
|
75
|
+
children,
|
|
76
|
+
...props
|
|
77
|
+
}: Breadcrumb.Icon.Props): ReactElement;
|
|
78
|
+
/**
|
|
79
|
+
* A navigation trail showing the current page's location in a hierarchy. `Breadcrumb.Root` is the
|
|
80
|
+
* `<nav>` landmark and owns the `size`; inside it a single `Breadcrumb.List` (`<ol>`) holds a
|
|
81
|
+
* `Breadcrumb.Item` per crumb, separated by `Breadcrumb.Separator`. Each item wraps a
|
|
82
|
+
* `Breadcrumb.Link` (an ancestor crumb, which composes onto a router link via `render`) or the final
|
|
83
|
+
* `Breadcrumb.Page` (the current page). Compose a leading `Breadcrumb.Icon` in any crumb, and a
|
|
84
|
+
* `Breadcrumb.Ellipsis` to stand in for a collapsed run.
|
|
85
|
+
*
|
|
86
|
+
* Styling is precompiled in `breadcrumb.css`, keyed off the `data-slot` anchors plus the root's
|
|
87
|
+
* `data-size`; the colours read the `muted`/`foreground`/`subtle` roles directly, so a retheme
|
|
88
|
+
* propagates. The runtime compound is a plain object (kept tree-shakeable); per-part prop types are
|
|
89
|
+
* exposed through the matching `Breadcrumb` namespace — e.g. `Breadcrumb.Link.Props`.
|
|
90
|
+
*/
|
|
91
|
+
declare const Breadcrumb: {
|
|
92
|
+
/** The `<nav>` landmark; owns `size`. `Breadcrumb.Root.props({ size })` → its prop bag. */Root: typeof BreadcrumbRoot & {
|
|
93
|
+
props: typeof rootProps;
|
|
94
|
+
}; /** The ordered trail (`<ol>`). `Breadcrumb.List.props()` → its prop bag. */
|
|
95
|
+
List: typeof BreadcrumbList & {
|
|
96
|
+
props: typeof listProps;
|
|
97
|
+
}; /** A crumb's `<li>`. `Breadcrumb.Item.props()` → its prop bag. */
|
|
98
|
+
Item: typeof BreadcrumbItem & {
|
|
99
|
+
props: typeof itemProps;
|
|
100
|
+
}; /** An interactive ancestor crumb (`<a>`, composable via `render`). `Breadcrumb.Link.props()` → its prop bag. */
|
|
101
|
+
Link: typeof BreadcrumbLink & {
|
|
102
|
+
props: typeof linkProps;
|
|
103
|
+
}; /** The current page crumb. `Breadcrumb.Page.props()` → its prop bag (carries `aria-current="page"`). */
|
|
104
|
+
Page: typeof BreadcrumbPage & {
|
|
105
|
+
props: typeof pageProps;
|
|
106
|
+
}; /** The glyph between crumbs (presentational). `Breadcrumb.Separator.props()` → its prop bag. */
|
|
107
|
+
Separator: typeof BreadcrumbSeparator & {
|
|
108
|
+
props: typeof separatorProps;
|
|
109
|
+
}; /** A collapsed-run indicator. `Breadcrumb.Ellipsis.props()` → its prop bag. */
|
|
110
|
+
Ellipsis: typeof BreadcrumbEllipsis & {
|
|
111
|
+
props: typeof ellipsisProps;
|
|
112
|
+
}; /** A crumb's leading glyph (decorative). `Breadcrumb.Icon.props()` → its prop bag. */
|
|
113
|
+
Icon: typeof BreadcrumbIcon & {
|
|
114
|
+
props: typeof iconProps;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Per-part prop types. Types-only — it emits no runtime code and merges with the `Breadcrumb` object
|
|
119
|
+
* above, so `Breadcrumb.Root` is the component value while `Breadcrumb.Root.Props` is its prop type.
|
|
120
|
+
*/
|
|
121
|
+
declare namespace Breadcrumb {
|
|
122
|
+
/** The trail scale — `sm` | `md`. */
|
|
123
|
+
type Size = BreadcrumbSize;
|
|
124
|
+
/** The spreadable prop bag every `Breadcrumb.*.props()` returns (D12). */
|
|
125
|
+
type PartProps = BreadcrumbPartProps;
|
|
126
|
+
namespace Root {
|
|
127
|
+
type Props = ComponentProps<"nav"> & {
|
|
128
|
+
/**
|
|
129
|
+
* Trail scale — `md` (the default) or the denser `sm`. Sets the type size, the icon/separator
|
|
130
|
+
* glyph size, and the gaps.
|
|
131
|
+
* @default "md"
|
|
132
|
+
*/
|
|
133
|
+
size?: BreadcrumbSize;
|
|
134
|
+
};
|
|
135
|
+
/** Argument to the `Breadcrumb.Root.props(...)` escape-hatch helper. */
|
|
136
|
+
type PropsArgs = BreadcrumbRootPropsArgs;
|
|
137
|
+
}
|
|
138
|
+
namespace List {
|
|
139
|
+
type Props = ComponentProps<"ol">;
|
|
140
|
+
}
|
|
141
|
+
namespace Item {
|
|
142
|
+
type Props = ComponentProps<"li">;
|
|
143
|
+
}
|
|
144
|
+
namespace Link {
|
|
145
|
+
type Props = Primitive.Props<"a">;
|
|
146
|
+
}
|
|
147
|
+
namespace Page {
|
|
148
|
+
type Props = ComponentProps<"span">;
|
|
149
|
+
}
|
|
150
|
+
namespace Separator {
|
|
151
|
+
type Props = ComponentProps<"li">;
|
|
152
|
+
}
|
|
153
|
+
namespace Ellipsis {
|
|
154
|
+
type Props = ComponentProps<"span">;
|
|
155
|
+
}
|
|
156
|
+
namespace Icon {
|
|
157
|
+
type Props = ComponentProps<"span">;
|
|
158
|
+
}
|
|
159
|
+
/** Argument to a stateless part's `props(...)` helper. */
|
|
160
|
+
type StatelessPropsArgs = BreadcrumbStatelessPropsArgs;
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
export { Breadcrumb };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Icon } from "../../icons/icon.js";
|
|
3
|
+
import { ChevronRightIcon, MoreHorizontalIcon } from "../../icons/glyphs.js";
|
|
4
|
+
import { useInjectedLabels } from "../../core/use-injected-labels.js";
|
|
5
|
+
import { VisuallyHidden } from "../../core/visually-hidden/visually-hidden.js";
|
|
6
|
+
import { Primitive } from "../../core/primitive/primitive.js";
|
|
7
|
+
import { BREADCRUMB_SLOTS } from "./breadcrumb.slots.js";
|
|
8
|
+
import { ellipsisProps, iconProps, itemProps, linkProps, listProps, pageProps, rootProps, separatorProps } from "./breadcrumb.props.js";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/breadcrumb/breadcrumb.tsx
|
|
11
|
+
const ROOT_LABEL_DEFAULTS = { label: "Breadcrumb" };
|
|
12
|
+
const ROOT_LABEL_KEYS = { label: "breadcrumb.label" };
|
|
13
|
+
const ELLIPSIS_LABEL_DEFAULTS = { more: "More" };
|
|
14
|
+
const ELLIPSIS_LABEL_KEYS = { more: "breadcrumb.more" };
|
|
15
|
+
/**
|
|
16
|
+
* The trail wrapper — a `<nav>` landmark named "Breadcrumb" (localized; a passed `aria-label` wins). It
|
|
17
|
+
* owns the `size` axis, stamped as `data-size` on the root so the precompiled `breadcrumb.css` keys its
|
|
18
|
+
* per-size metrics off it. Wrap the crumbs in a single `Breadcrumb.List`.
|
|
19
|
+
*/
|
|
20
|
+
function BreadcrumbRoot({ size = "md", className, "aria-label": ariaLabel, ...props }) {
|
|
21
|
+
const labels = useInjectedLabels(ROOT_LABEL_DEFAULTS, ROOT_LABEL_KEYS, void 0);
|
|
22
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
23
|
+
"data-slot": BREADCRUMB_SLOTS.root,
|
|
24
|
+
"data-size": size,
|
|
25
|
+
"aria-label": ariaLabel ?? labels.label,
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** The ordered trail — an `<ol>` laying crumbs and separators in a wrapping row. */
|
|
31
|
+
function BreadcrumbList({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
33
|
+
"data-slot": BREADCRUMB_SLOTS.list,
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** A single crumb's `<li>` — wrap a `Breadcrumb.Link` (an ancestor) or `Breadcrumb.Page` (the current page). */
|
|
39
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx("li", {
|
|
41
|
+
"data-slot": BREADCRUMB_SLOTS.item,
|
|
42
|
+
className,
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* An interactive ancestor crumb. Renders an `<a>` by default — muted, lifting to the foreground on
|
|
48
|
+
* hover and focus — and accepts Base UI's `render` prop so it can compose onto a router link
|
|
49
|
+
* (`<Breadcrumb.Link href="/docs" render={<NextLink href="/docs" />}>`) while keeping its slot and skin.
|
|
50
|
+
* Compose a leading `Breadcrumb.Icon` before the label for a glyph.
|
|
51
|
+
*/
|
|
52
|
+
function BreadcrumbLink({ className, ...props }) {
|
|
53
|
+
return /* @__PURE__ */ jsx(Primitive, {
|
|
54
|
+
as: "a",
|
|
55
|
+
"data-slot": BREADCRUMB_SLOTS.link,
|
|
56
|
+
className,
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The current page — the last crumb. A non-interactive `<span>` marked `aria-current="page"` so
|
|
62
|
+
* assistive tech announces it as the location; it reads in the foreground at a slightly heavier weight.
|
|
63
|
+
* Compose a leading `Breadcrumb.Icon` before the label for a glyph.
|
|
64
|
+
*/
|
|
65
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
66
|
+
return /* @__PURE__ */ jsx("span", {
|
|
67
|
+
"data-slot": BREADCRUMB_SLOTS.page,
|
|
68
|
+
"aria-current": "page",
|
|
69
|
+
className,
|
|
70
|
+
...props
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The glyph between crumbs. A presentational `<li>` (hidden from assistive tech — the list order
|
|
75
|
+
* already conveys the hierarchy) holding a directional chevron by default; pass `children` to swap the
|
|
76
|
+
* glyph (a slash, a dot, any inline svg). It mirrors under RTL.
|
|
77
|
+
*/
|
|
78
|
+
function BreadcrumbSeparator({ className, children, ...props }) {
|
|
79
|
+
return /* @__PURE__ */ jsx("li", {
|
|
80
|
+
"data-slot": BREADCRUMB_SLOTS.separator,
|
|
81
|
+
role: "presentation",
|
|
82
|
+
"aria-hidden": true,
|
|
83
|
+
className,
|
|
84
|
+
...props,
|
|
85
|
+
children: children ?? /* @__PURE__ */ jsx(Icon, {
|
|
86
|
+
icon: ChevronRightIcon,
|
|
87
|
+
directional: true
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* A collapsed-run indicator standing in for crumbs hidden to fit a long trail. Draws an ellipsis glyph
|
|
93
|
+
* with a localized "More" name for assistive tech; pass `children` to swap the glyph. Wrap it in a
|
|
94
|
+
* `Breadcrumb.Item`, optionally making it the trigger of a menu that reveals the hidden crumbs.
|
|
95
|
+
*/
|
|
96
|
+
function BreadcrumbEllipsis({ className, children, ...props }) {
|
|
97
|
+
const labels = useInjectedLabels(ELLIPSIS_LABEL_DEFAULTS, ELLIPSIS_LABEL_KEYS, void 0);
|
|
98
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
99
|
+
"data-slot": BREADCRUMB_SLOTS.ellipsis,
|
|
100
|
+
className,
|
|
101
|
+
...props,
|
|
102
|
+
children: [children ?? /* @__PURE__ */ jsx(Icon, { icon: MoreHorizontalIcon }), /* @__PURE__ */ jsx(VisuallyHidden, { children: labels.more })]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* An optional leading glyph for a crumb. Clamps its glyph to the trail's icon size and inherits the
|
|
107
|
+
* crumb's text colour, so it tracks the label in every size. Decorative by default (`aria-hidden`);
|
|
108
|
+
* wrap an `<Icon>` or any inline svg inside it — don't put `data-slot` on the icon itself, which would
|
|
109
|
+
* drop its own token sizing.
|
|
110
|
+
*/
|
|
111
|
+
function BreadcrumbIcon({ className, children, ...props }) {
|
|
112
|
+
return /* @__PURE__ */ jsx("span", {
|
|
113
|
+
"data-slot": BREADCRUMB_SLOTS.icon,
|
|
114
|
+
"aria-hidden": true,
|
|
115
|
+
className,
|
|
116
|
+
...props,
|
|
117
|
+
children
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* A navigation trail showing the current page's location in a hierarchy. `Breadcrumb.Root` is the
|
|
122
|
+
* `<nav>` landmark and owns the `size`; inside it a single `Breadcrumb.List` (`<ol>`) holds a
|
|
123
|
+
* `Breadcrumb.Item` per crumb, separated by `Breadcrumb.Separator`. Each item wraps a
|
|
124
|
+
* `Breadcrumb.Link` (an ancestor crumb, which composes onto a router link via `render`) or the final
|
|
125
|
+
* `Breadcrumb.Page` (the current page). Compose a leading `Breadcrumb.Icon` in any crumb, and a
|
|
126
|
+
* `Breadcrumb.Ellipsis` to stand in for a collapsed run.
|
|
127
|
+
*
|
|
128
|
+
* Styling is precompiled in `breadcrumb.css`, keyed off the `data-slot` anchors plus the root's
|
|
129
|
+
* `data-size`; the colours read the `muted`/`foreground`/`subtle` roles directly, so a retheme
|
|
130
|
+
* propagates. The runtime compound is a plain object (kept tree-shakeable); per-part prop types are
|
|
131
|
+
* exposed through the matching `Breadcrumb` namespace — e.g. `Breadcrumb.Link.Props`.
|
|
132
|
+
*/
|
|
133
|
+
const Breadcrumb = {
|
|
134
|
+
/** The `<nav>` landmark; owns `size`. `Breadcrumb.Root.props({ size })` → its prop bag. */
|
|
135
|
+
Root: Object.assign(BreadcrumbRoot, { props: rootProps }),
|
|
136
|
+
/** The ordered trail (`<ol>`). `Breadcrumb.List.props()` → its prop bag. */
|
|
137
|
+
List: Object.assign(BreadcrumbList, { props: listProps }),
|
|
138
|
+
/** A crumb's `<li>`. `Breadcrumb.Item.props()` → its prop bag. */
|
|
139
|
+
Item: Object.assign(BreadcrumbItem, { props: itemProps }),
|
|
140
|
+
/** An interactive ancestor crumb (`<a>`, composable via `render`). `Breadcrumb.Link.props()` → its prop bag. */
|
|
141
|
+
Link: Object.assign(BreadcrumbLink, { props: linkProps }),
|
|
142
|
+
/** The current page crumb. `Breadcrumb.Page.props()` → its prop bag (carries `aria-current="page"`). */
|
|
143
|
+
Page: Object.assign(BreadcrumbPage, { props: pageProps }),
|
|
144
|
+
/** The glyph between crumbs (presentational). `Breadcrumb.Separator.props()` → its prop bag. */
|
|
145
|
+
Separator: Object.assign(BreadcrumbSeparator, { props: separatorProps }),
|
|
146
|
+
/** A collapsed-run indicator. `Breadcrumb.Ellipsis.props()` → its prop bag. */
|
|
147
|
+
Ellipsis: Object.assign(BreadcrumbEllipsis, { props: ellipsisProps }),
|
|
148
|
+
/** A crumb's leading glyph (decorative). `Breadcrumb.Icon.props()` → its prop bag. */
|
|
149
|
+
Icon: Object.assign(BreadcrumbIcon, { props: iconProps })
|
|
150
|
+
};
|
|
151
|
+
//#endregion
|
|
152
|
+
export { Breadcrumb };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { BreadcrumbSize } from "./breadcrumb.types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/breadcrumb/breadcrumb.props.d.ts
|
|
4
|
+
/** A spreadable prop bag — the shape every `Breadcrumb.*.props()` returns. */
|
|
5
|
+
type BreadcrumbPartProps = {
|
|
6
|
+
/** The slot value the matching `breadcrumb.css` rules anchor on. */"data-slot": string; /** Forwarded verbatim — styling is attribute-driven, so this is an optional consumer passthrough. */
|
|
7
|
+
className?: string; /** The trail scale, present only on the root. */
|
|
8
|
+
"data-size"?: BreadcrumbSize; /** Marks the current crumb on `Breadcrumb.Page`. */
|
|
9
|
+
"aria-current"?: "page"; /** Hides a presentational part (separator) from assistive tech. */
|
|
10
|
+
"aria-hidden"?: "true"; /** Drops a presentational part from the a11y tree where a bare element would otherwise be a list item. */
|
|
11
|
+
role?: "presentation";
|
|
12
|
+
};
|
|
13
|
+
/** Common shape: every part's `.props()` accepts an optional `className` passthrough. */
|
|
14
|
+
interface BasePropsArgs {
|
|
15
|
+
/** Forwarded verbatim onto the returned prop bag. */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Argument to `Breadcrumb.Root.props(...)` — the trail's size. */
|
|
19
|
+
interface BreadcrumbRootPropsArgs extends BasePropsArgs {
|
|
20
|
+
/** Trail scale. @default "md" */
|
|
21
|
+
size?: BreadcrumbSize;
|
|
22
|
+
}
|
|
23
|
+
/** Argument to a stateless part's `.props(...)` — no recipe of its own. */
|
|
24
|
+
type BreadcrumbStatelessPropsArgs = BasePropsArgs;
|
|
25
|
+
/** Root prop bag: `data-slot` plus the `data-size` the per-size metrics read. */
|
|
26
|
+
declare function rootProps({
|
|
27
|
+
size,
|
|
28
|
+
className
|
|
29
|
+
}?: BreadcrumbRootPropsArgs): BreadcrumbPartProps;
|
|
30
|
+
/** List prop bag: just the slot anchor (the ordered trail row). */
|
|
31
|
+
declare function listProps({
|
|
32
|
+
className
|
|
33
|
+
}?: BreadcrumbStatelessPropsArgs): BreadcrumbPartProps;
|
|
34
|
+
/** Item prop bag: just the slot anchor (wraps a single crumb). */
|
|
35
|
+
declare function itemProps({
|
|
36
|
+
className
|
|
37
|
+
}?: BreadcrumbStatelessPropsArgs): BreadcrumbPartProps;
|
|
38
|
+
/** Link prop bag: just the slot anchor — spread onto a router `<Link>` (or `<a>`) to style it as a crumb. */
|
|
39
|
+
declare function linkProps({
|
|
40
|
+
className
|
|
41
|
+
}?: BreadcrumbStatelessPropsArgs): BreadcrumbPartProps;
|
|
42
|
+
/** Page prop bag: the slot anchor plus `aria-current="page"`, marking the foreign element as the current crumb. */
|
|
43
|
+
declare function pageProps({
|
|
44
|
+
className
|
|
45
|
+
}?: BreadcrumbStatelessPropsArgs): BreadcrumbPartProps;
|
|
46
|
+
/** Separator prop bag: the slot anchor plus the presentational ARIA the glyph carries. */
|
|
47
|
+
declare function separatorProps({
|
|
48
|
+
className
|
|
49
|
+
}?: BreadcrumbStatelessPropsArgs): BreadcrumbPartProps;
|
|
50
|
+
/** Ellipsis prop bag: just the slot anchor (the collapsed-run indicator). */
|
|
51
|
+
declare function ellipsisProps({
|
|
52
|
+
className
|
|
53
|
+
}?: BreadcrumbStatelessPropsArgs): BreadcrumbPartProps;
|
|
54
|
+
/** Icon prop bag: just the slot anchor (the glyph is clamped to the crumb's icon size and inherits its colour). */
|
|
55
|
+
declare function iconProps({
|
|
56
|
+
className
|
|
57
|
+
}?: BreadcrumbStatelessPropsArgs): BreadcrumbPartProps;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { BreadcrumbPartProps, BreadcrumbRootPropsArgs, BreadcrumbStatelessPropsArgs, ellipsisProps, iconProps, itemProps, linkProps, listProps, pageProps, rootProps, separatorProps };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { BREADCRUMB_SLOTS } from "./breadcrumb.slots.js";
|
|
2
|
+
//#region src/components/breadcrumb/breadcrumb.props.ts
|
|
3
|
+
/**
|
|
4
|
+
* The D12 unified variant contract for Breadcrumb — the data-attribute-native styling helpers.
|
|
5
|
+
*
|
|
6
|
+
* Each compound part exposes a `props(...)` builder returning a **spreadable props object** of the form
|
|
7
|
+
* `{ "data-slot": "noctis-breadcrumb-<part>", ... }`, derived from the part's inputs. Under the
|
|
8
|
+
* single-`data-slot` anchor model the `data-slot` is the only styling hook needed — `breadcrumb.css`
|
|
9
|
+
* keys every rule off it plus the root's `data-size` — so spreading a part's `props()` onto a *foreign*
|
|
10
|
+
* element styles it as that part. This is the path for rendering a crumb onto a router `<Link>` from a
|
|
11
|
+
* server component:
|
|
12
|
+
*
|
|
13
|
+
* <Link href="/docs" {...Breadcrumb.Link.props()}>Docs</Link>
|
|
14
|
+
* // → <a data-slot="noctis-breadcrumb-link" href="/docs">
|
|
15
|
+
*
|
|
16
|
+
* The escape hatch carries no className (styling is attribute-driven); an optional `className`
|
|
17
|
+
* passthrough is accepted and forwarded verbatim. The same variant→data-attribute mapping is emitted
|
|
18
|
+
* as data from the token graph (`generated/declarations.json` → `variantSchema`) so non-React / agent
|
|
19
|
+
* consumers can hand-write the markup from the docs.
|
|
20
|
+
*/
|
|
21
|
+
const withClassName = (bag, className) => className === void 0 ? bag : {
|
|
22
|
+
...bag,
|
|
23
|
+
className
|
|
24
|
+
};
|
|
25
|
+
/** Root prop bag: `data-slot` plus the `data-size` the per-size metrics read. */
|
|
26
|
+
function rootProps({ size = "md", className } = {}) {
|
|
27
|
+
return withClassName({
|
|
28
|
+
"data-slot": BREADCRUMB_SLOTS.root,
|
|
29
|
+
"data-size": size
|
|
30
|
+
}, className);
|
|
31
|
+
}
|
|
32
|
+
/** List prop bag: just the slot anchor (the ordered trail row). */
|
|
33
|
+
function listProps({ className } = {}) {
|
|
34
|
+
return withClassName({ "data-slot": BREADCRUMB_SLOTS.list }, className);
|
|
35
|
+
}
|
|
36
|
+
/** Item prop bag: just the slot anchor (wraps a single crumb). */
|
|
37
|
+
function itemProps({ className } = {}) {
|
|
38
|
+
return withClassName({ "data-slot": BREADCRUMB_SLOTS.item }, className);
|
|
39
|
+
}
|
|
40
|
+
/** Link prop bag: just the slot anchor — spread onto a router `<Link>` (or `<a>`) to style it as a crumb. */
|
|
41
|
+
function linkProps({ className } = {}) {
|
|
42
|
+
return withClassName({ "data-slot": BREADCRUMB_SLOTS.link }, className);
|
|
43
|
+
}
|
|
44
|
+
/** Page prop bag: the slot anchor plus `aria-current="page"`, marking the foreign element as the current crumb. */
|
|
45
|
+
function pageProps({ className } = {}) {
|
|
46
|
+
return withClassName({
|
|
47
|
+
"data-slot": BREADCRUMB_SLOTS.page,
|
|
48
|
+
"aria-current": "page"
|
|
49
|
+
}, className);
|
|
50
|
+
}
|
|
51
|
+
/** Separator prop bag: the slot anchor plus the presentational ARIA the glyph carries. */
|
|
52
|
+
function separatorProps({ className } = {}) {
|
|
53
|
+
return withClassName({
|
|
54
|
+
"data-slot": BREADCRUMB_SLOTS.separator,
|
|
55
|
+
role: "presentation",
|
|
56
|
+
"aria-hidden": "true"
|
|
57
|
+
}, className);
|
|
58
|
+
}
|
|
59
|
+
/** Ellipsis prop bag: just the slot anchor (the collapsed-run indicator). */
|
|
60
|
+
function ellipsisProps({ className } = {}) {
|
|
61
|
+
return withClassName({ "data-slot": BREADCRUMB_SLOTS.ellipsis }, className);
|
|
62
|
+
}
|
|
63
|
+
/** Icon prop bag: just the slot anchor (the glyph is clamped to the crumb's icon size and inherits its colour). */
|
|
64
|
+
function iconProps({ className } = {}) {
|
|
65
|
+
return withClassName({ "data-slot": BREADCRUMB_SLOTS.icon }, className);
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { ellipsisProps, iconProps, itemProps, linkProps, listProps, pageProps, rootProps, separatorProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/components/breadcrumb/breadcrumb.slots.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The `data-*` / ARIA hooks `Breadcrumb` stamps on its parts, for host-side styling and tests. The
|
|
4
|
+
* slot values mark each rendered element; `data-size` on the root carries the scale the precompiled
|
|
5
|
+
* `breadcrumb.css` keys its per-size metrics off; `aria-current="page"` marks the current crumb.
|
|
6
|
+
*/
|
|
7
|
+
declare enum BreadcrumbDataAttributes {
|
|
8
|
+
/** The slot marker on every rendered part (`noctis-breadcrumb`, `noctis-breadcrumb-link`, …). */
|
|
9
|
+
slot = "data-slot",
|
|
10
|
+
/** The trail scale — `sm` | `md` (default), stamped on the root; the generated layer keys the per-size internals off it. */
|
|
11
|
+
size = "data-size",
|
|
12
|
+
/** Present as `"page"` on the current crumb (`Breadcrumb.Page`), so assistive tech announces it as the location. */
|
|
13
|
+
current = "aria-current"
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { BreadcrumbDataAttributes };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/components/breadcrumb/breadcrumb.slots.ts
|
|
2
|
+
/**
|
|
3
|
+
* The slot vocabulary every `Breadcrumb` part stamps as its `data-slot`. The authored source the
|
|
4
|
+
* orchestration file reads from, kebab-cased `{component}[-{part}]` under the `noctis-` prefix;
|
|
5
|
+
* SLOTS.md still generates from the token-graph declarations.
|
|
6
|
+
*/
|
|
7
|
+
const BREADCRUMB_SLOTS = {
|
|
8
|
+
root: "noctis-breadcrumb",
|
|
9
|
+
list: "noctis-breadcrumb-list",
|
|
10
|
+
item: "noctis-breadcrumb-item",
|
|
11
|
+
link: "noctis-breadcrumb-link",
|
|
12
|
+
page: "noctis-breadcrumb-page",
|
|
13
|
+
separator: "noctis-breadcrumb-separator",
|
|
14
|
+
ellipsis: "noctis-breadcrumb-ellipsis",
|
|
15
|
+
icon: "noctis-breadcrumb-icon"
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The `data-*` / ARIA hooks `Breadcrumb` stamps on its parts, for host-side styling and tests. The
|
|
19
|
+
* slot values mark each rendered element; `data-size` on the root carries the scale the precompiled
|
|
20
|
+
* `breadcrumb.css` keys its per-size metrics off; `aria-current="page"` marks the current crumb.
|
|
21
|
+
*/
|
|
22
|
+
let BreadcrumbDataAttributes = /* @__PURE__ */ function(BreadcrumbDataAttributes) {
|
|
23
|
+
/** The slot marker on every rendered part (`noctis-breadcrumb`, `noctis-breadcrumb-link`, …). */
|
|
24
|
+
BreadcrumbDataAttributes["slot"] = "data-slot";
|
|
25
|
+
/** The trail scale — `sm` | `md` (default), stamped on the root; the generated layer keys the per-size internals off it. */
|
|
26
|
+
BreadcrumbDataAttributes["size"] = "data-size";
|
|
27
|
+
/** Present as `"page"` on the current crumb (`Breadcrumb.Page`), so assistive tech announces it as the location. */
|
|
28
|
+
BreadcrumbDataAttributes["current"] = "aria-current";
|
|
29
|
+
return BreadcrumbDataAttributes;
|
|
30
|
+
}({});
|
|
31
|
+
//#endregion
|
|
32
|
+
export { BREADCRUMB_SLOTS, BreadcrumbDataAttributes };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/components/breadcrumb/breadcrumb.types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The size vocabulary `Breadcrumb` paints. Authored source of truth since styling is precompiled in
|
|
4
|
+
* `breadcrumb.css`. Types-only: no runtime code, so it never participates in the styling layer.
|
|
5
|
+
*/
|
|
6
|
+
/** A breadcrumb's scale — `sm` (the dense chrome trail) or `md` (the default). */
|
|
7
|
+
type BreadcrumbSize = "sm" | "md";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { BreadcrumbSize };
|