@sdxc/ui 2026.10.23 → 2026.10.26
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/README.md +4 -0
- package/dist/components/breadcrumbs.d.ts +17 -3
- package/dist/components/breadcrumbs.js +5 -3
- package/dist/components/group.js +3 -2
- package/dist/components/link-button.d.ts +14 -1
- package/dist/components/link-button.js +173 -169
- package/dist/components/link.d.ts +14 -1
- package/dist/components/link.js +63 -59
- package/dist/components/nav-link.d.ts +14 -1
- package/dist/components/nav-link.js +61 -57
- package/dist/components/navigation-menu.d.ts +12 -0
- package/dist/components/navigation-menu.js +15 -6
- package/dist/components/pagination.d.ts +17 -4
- package/dist/components/pagination.js +14 -7
- package/dist/components/sidebar.d.ts +18 -0
- package/dist/components/sidebar.js +22 -9
- package/dist/mixins/active-descendant-keys.d.ts +33 -3
- package/dist/mixins/active-descendant-keys.js +101 -13
- package/dist/mixins/frame-refresh.d.ts +30 -0
- package/dist/mixins/frame-refresh.js +85 -0
- package/dist/mixins/frame-submit.d.ts +65 -0
- package/dist/mixins/frame-submit.js +104 -0
- package/dist/mixins/index.d.ts +2 -0
- package/dist/mixins/index.js +2 -0
- package/dist/mixins/view-transition.js +5 -5
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/link-prefetch.d.ts +33 -0
- package/dist/utils/link-prefetch.js +31 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -273,6 +273,8 @@ Each mixin module documents why it needs JavaScript and what still works without
|
|
|
273
273
|
| `dragReorder(session)` | `GridList` / `Tree` | Pointer reordering through a `DragSession`. |
|
|
274
274
|
| `dropZone(session)` | `DropZone` | File drag-and-drop through a `DragSession`. |
|
|
275
275
|
| `dualRange()` | a two-thumb `Slider` | Thumbs that cannot cross. |
|
|
276
|
+
| `frameRefresh(options)` | any host in a frame | Its frame reloaded on a schedule or an event, resting while hidden. |
|
|
277
|
+
| `frameSubmit(options?)` | a `<form>` in a frame | The form posted through its frame, answered in place in one request. |
|
|
276
278
|
| `gridListKeys(model)` | `GridList` | The ARIA grid keyboard pattern over a `SelectionModel`. |
|
|
277
279
|
| `headingLevelFallback(options)` | an island's `HeadingScope` | Reports the page's heading depth to `onLevel` once on attach. |
|
|
278
280
|
| `hotkey(combo)` | a `<dialog>`/`[popover]` | A document-wide shortcut toggling its host. |
|
|
@@ -306,6 +308,8 @@ Helpers for writing your own:
|
|
|
306
308
|
stand-down rules as `isClaimedKeystroke(event, scope?)`.
|
|
307
309
|
- `chooseOption(combobox, index)` and `chosenOption(combobox)` — set and read the option
|
|
308
310
|
`activeDescendantKeys` has chosen, after a reload replaces the options.
|
|
311
|
+
- `prefetchOption(combobox, index, strategy)` — loads an option's link ahead, as
|
|
312
|
+
`activeDescendantKeys({ prefetch })` does for a resting choice, e.g. the top result once it settles.
|
|
309
313
|
- `syncAriaChecked(control)` — refreshes `ariaChecked` after a programmatic checked write or reset.
|
|
310
314
|
- `colorChannelProperty(channel)` and `getCommandItemId(item, index)` — the custom property and the
|
|
311
315
|
item id `channelSync` and `commandFilter` read.
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* @copyright Sergio Xalambrí 2026
|
|
12
12
|
*/
|
|
13
13
|
import type { Handle, Props as TagProps } from "remix/component";
|
|
14
|
+
import type { LinkPrefetch } from "../utils/link-prefetch.js";
|
|
14
15
|
import { Link } from "./link.js";
|
|
15
16
|
/**
|
|
16
17
|
* Prop types for {@link Breadcrumbs} and its compound parts.
|
|
@@ -32,11 +33,24 @@ export declare namespace Breadcrumbs {
|
|
|
32
33
|
interface ItemProps extends TagProps<"li"> {
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
36
|
+
* When a segment's destination starts loading: on intent, once in the
|
|
37
|
+
* viewport, on render through a `<link rel="prefetch">` that also serves
|
|
38
|
+
* full-document navigations, or only on navigation (`"none"`).
|
|
39
|
+
*/
|
|
40
|
+
type Prefetch = LinkPrefetch;
|
|
41
|
+
/**
|
|
42
|
+
* Every prop {@link Link.Props} accepts. A type alias rather than an
|
|
43
|
+
* interface, since {@link Link.Props} resolves through a conditional type
|
|
37
44
|
* that an `interface extends` clause can't statically extend.
|
|
38
45
|
*/
|
|
39
|
-
type LinkProps = Link.Props
|
|
46
|
+
type LinkProps = Link.Props & {
|
|
47
|
+
/**
|
|
48
|
+
* Prefetch mode, for segments whose GET is safe to repeat. `"render"` suits
|
|
49
|
+
* multi-page navigations; a long trail keeps it to its nearest parents, since
|
|
50
|
+
* each hint is a request on page load. Defaults to {@link DEFAULT_PREFETCH}.
|
|
51
|
+
*/
|
|
52
|
+
prefetch?: Prefetch;
|
|
53
|
+
};
|
|
40
54
|
}
|
|
41
55
|
/**
|
|
42
56
|
* Renders the trail's `<nav>` root, laying {@link Breadcrumbs.List} as a row.
|
|
@@ -9,6 +9,8 @@ import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js"
|
|
|
9
9
|
import { Link } from "./link.js";
|
|
10
10
|
/** Semantic color role {@link Breadcrumbs.Link} falls back to when `color` is omitted. */
|
|
11
11
|
const DEFAULT_COLOR = "neutral";
|
|
12
|
+
/** Prefetch mode {@link Breadcrumbs.Link} falls back to when `prefetch` is omitted. */
|
|
13
|
+
const DEFAULT_PREFETCH = "none";
|
|
12
14
|
/**
|
|
13
15
|
* Renders the trail's `<nav>` root, laying {@link Breadcrumbs.List} as a row.
|
|
14
16
|
* A root missing `aria-label` or `aria-labelledby` logs a dev-mode
|
|
@@ -92,7 +94,7 @@ Breadcrumbs.Item = function BreadcrumbsItem(handle) {
|
|
|
92
94
|
* @param handle Runtime handle carrying the host `<a>`'s props.
|
|
93
95
|
* @returns The render function producing the segment's markup.
|
|
94
96
|
* @example
|
|
95
|
-
* <Breadcrumbs.Link href="/settings">{t("nav.settings")}</Breadcrumbs.Link>
|
|
97
|
+
* <Breadcrumbs.Link href="/settings" prefetch="render">{t("nav.settings")}</Breadcrumbs.Link>
|
|
96
98
|
* @example
|
|
97
99
|
* <Breadcrumbs.Link href="/settings/profile" aria-current="page">
|
|
98
100
|
* {t("nav.profile")}
|
|
@@ -102,9 +104,9 @@ Breadcrumbs.Item = function BreadcrumbsItem(handle) {
|
|
|
102
104
|
*/
|
|
103
105
|
Breadcrumbs.Link = function BreadcrumbsLink(handle) {
|
|
104
106
|
return () => {
|
|
105
|
-
let { color, mix, ...rest } = handle.props;
|
|
107
|
+
let { color, prefetch, mix, ...rest } = handle.props;
|
|
106
108
|
let resolvedColor = color ?? DEFAULT_COLOR;
|
|
107
|
-
return (_jsx(Link, { color: resolvedColor, ...rest, "data-slot": "link", mix: [
|
|
109
|
+
return (_jsx(Link, { color: resolvedColor, prefetch: prefetch ?? DEFAULT_PREFETCH, ...rest, "data-slot": "link", mix: [
|
|
108
110
|
fontSize("sm"),
|
|
109
111
|
/**
|
|
110
112
|
* The space around each separator lives in the link's own padding, so the
|
package/dist/components/group.js
CHANGED
|
@@ -41,14 +41,15 @@ export function Group(handle) {
|
|
|
41
41
|
items("center"),
|
|
42
42
|
/**
|
|
43
43
|
* The controls compose into one shape, so the cluster keeps the rounding on
|
|
44
|
-
* its own outer corners and the seam where two of them meet is drawn once
|
|
44
|
+
* its own outer corners and the seam where two of them meet is drawn once; the
|
|
45
|
+
* last control before a trailing `<link rel="prefetch">` hint keeps its corners.
|
|
45
46
|
*/
|
|
46
47
|
when("& > *:not(:first-child)", [
|
|
47
48
|
roundedCorner("start-start", "none"),
|
|
48
49
|
roundedCorner("end-start", "none"),
|
|
49
50
|
mis("-1px"),
|
|
50
51
|
]),
|
|
51
|
-
when("& > *:not(
|
|
52
|
+
when("& > *:has(~ :not(link))", [
|
|
52
53
|
roundedCorner("start-end", "none"),
|
|
53
54
|
roundedCorner("end-end", "none"),
|
|
54
55
|
]),
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @copyright Sergio Xalambrí 2026
|
|
10
10
|
*/
|
|
11
11
|
import type { Handle, Props as TagProps } from "remix/component";
|
|
12
|
+
import type { LinkPrefetch } from "../utils/link-prefetch.js";
|
|
12
13
|
import type { SemanticColor } from "../utils/semantic-color.js";
|
|
13
14
|
/**
|
|
14
15
|
* Prop types for {@link LinkButton}.
|
|
@@ -28,6 +29,12 @@ export declare namespace LinkButton {
|
|
|
28
29
|
* Size variant controlling the link's padding and font size.
|
|
29
30
|
*/
|
|
30
31
|
type Size = "sm" | "md" | "lg";
|
|
32
|
+
/**
|
|
33
|
+
* When the destination starts loading: on intent, once in the viewport, on
|
|
34
|
+
* render through a `<link rel="prefetch">` that also serves full-document
|
|
35
|
+
* navigations, or only on navigation (`"none"`).
|
|
36
|
+
*/
|
|
37
|
+
type Prefetch = LinkPrefetch;
|
|
31
38
|
/**
|
|
32
39
|
* Props accepted by {@link LinkButton}. A type alias rather than an
|
|
33
40
|
* interface, since the native anchor props resolve to an intersection
|
|
@@ -40,6 +47,12 @@ export declare namespace LinkButton {
|
|
|
40
47
|
variant?: Variant;
|
|
41
48
|
/** Size variant. Defaults to {@link DEFAULT_SIZE}. */
|
|
42
49
|
size?: Size;
|
|
50
|
+
/**
|
|
51
|
+
* Prefetch mode, for links whose GET is safe to repeat. `"render"` suits
|
|
52
|
+
* multi-page navigations; a list keeps it to its first few items, since each
|
|
53
|
+
* hint is a request on page load. Defaults to {@link DEFAULT_PREFETCH}.
|
|
54
|
+
*/
|
|
55
|
+
prefetch?: Prefetch;
|
|
43
56
|
};
|
|
44
57
|
}
|
|
45
58
|
/**
|
|
@@ -50,7 +63,7 @@ export declare namespace LinkButton {
|
|
|
50
63
|
* @param handle Runtime handle carrying the host `<a>`'s props.
|
|
51
64
|
* @returns The render function producing the link's markup.
|
|
52
65
|
* @example
|
|
53
|
-
* <LinkButton href="/projects/new">{t("actions.createProject")}</LinkButton>
|
|
66
|
+
* <LinkButton href="/projects/new" prefetch="intent">{t("actions.createProject")}</LinkButton>
|
|
54
67
|
* @example
|
|
55
68
|
* <LinkButton href="/projects" color="neutral" variant="outline" size="sm">{t("actions.cancel")}</LinkButton>
|
|
56
69
|
* @example
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
2
|
import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
3
3
|
import { opacity, rounded } from "@sdxc/u/effects";
|
|
4
4
|
import { cursor, pointerEvents, userSelect } from "@sdxc/u/general";
|
|
@@ -9,12 +9,15 @@ import { text, weight } from "@sdxc/u/typography";
|
|
|
9
9
|
import { hitArea } from "../styles/hit-area.js";
|
|
10
10
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
11
11
|
import { glyphEdges } from "../utils/glyph-edges.js";
|
|
12
|
+
import { prefetchAttribute, rendersPrefetchHint } from "../utils/link-prefetch.js";
|
|
12
13
|
/** Semantic color role {@link LinkButton} falls back to when `color` is omitted. */
|
|
13
14
|
const DEFAULT_COLOR = "neutral";
|
|
14
15
|
/** Visual weight {@link LinkButton} falls back to when `variant` is omitted. */
|
|
15
16
|
const DEFAULT_VARIANT = "solid";
|
|
16
17
|
/** Size variant {@link LinkButton} falls back to when `size` is omitted. */
|
|
17
18
|
const DEFAULT_SIZE = "md";
|
|
19
|
+
/** Prefetch mode {@link LinkButton} falls back to when `prefetch` is omitted. */
|
|
20
|
+
const DEFAULT_PREFETCH = "none";
|
|
18
21
|
/**
|
|
19
22
|
* Renders a native `<a>` host, colored and shaped through the same color,
|
|
20
23
|
* variant, and size data attributes as {@link Button}. `aria-disabled="true"`
|
|
@@ -23,7 +26,7 @@ const DEFAULT_SIZE = "md";
|
|
|
23
26
|
* @param handle Runtime handle carrying the host `<a>`'s props.
|
|
24
27
|
* @returns The render function producing the link's markup.
|
|
25
28
|
* @example
|
|
26
|
-
* <LinkButton href="/projects/new">{t("actions.createProject")}</LinkButton>
|
|
29
|
+
* <LinkButton href="/projects/new" prefetch="intent">{t("actions.createProject")}</LinkButton>
|
|
27
30
|
* @example
|
|
28
31
|
* <LinkButton href="/projects" color="neutral" variant="outline" size="sm">{t("actions.cancel")}</LinkButton>
|
|
29
32
|
* @example
|
|
@@ -31,176 +34,177 @@ const DEFAULT_SIZE = "md";
|
|
|
31
34
|
*/
|
|
32
35
|
export function LinkButton(handle) {
|
|
33
36
|
return () => {
|
|
34
|
-
let { color, variant, size, children, mix, ...rest } = handle.props;
|
|
37
|
+
let { color, variant, size, prefetch, children, mix, ...rest } = handle.props;
|
|
35
38
|
let resolvedColor = color ?? DEFAULT_COLOR;
|
|
36
39
|
let resolvedVariant = variant ?? DEFAULT_VARIANT;
|
|
37
40
|
let resolvedSize = size ?? DEFAULT_SIZE;
|
|
41
|
+
let resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;
|
|
38
42
|
let edges = glyphEdges(children);
|
|
39
|
-
return (_jsx("a", { ...rest, "data-color": resolvedColor, "data-variant": resolvedVariant, "data-size": resolvedSize, "data-glyph-start": edges.start || undefined, "data-glyph-end": edges.end || undefined, mix: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsx("a", { ...rest, "data-color": resolvedColor, "data-variant": resolvedVariant, "data-size": resolvedSize, "data-rmx-prefetch": prefetchAttribute(resolvedPrefetch), "data-glyph-start": edges.start || undefined, "data-glyph-end": edges.end || undefined, mix: [
|
|
44
|
+
when("&:focus-visible", [
|
|
45
|
+
outline({ color: "brand.ring", offset: 2 }),
|
|
46
|
+
data("color", "neutral", outline("neutral.ring")),
|
|
47
|
+
data("color", "success", outline("success.ring")),
|
|
48
|
+
data("color", "warning", outline("warning.ring")),
|
|
49
|
+
data("color", "danger", outline("danger.ring")),
|
|
50
|
+
]),
|
|
51
|
+
interactiveTransition(),
|
|
52
|
+
inlineFlex(),
|
|
53
|
+
items("center"),
|
|
54
|
+
justify("center"),
|
|
55
|
+
gap(2),
|
|
56
|
+
/**
|
|
57
|
+
* A glyph inside a link button is measured and held at size by the same rules
|
|
58
|
+
* `Button` states, for the same reasons: it is sized against the label beside
|
|
59
|
+
* it so the row keeps the height its text and padding ask for, and it never
|
|
60
|
+
* shrinks, since the default `flex-shrink: 1` would compress the glyph rather
|
|
61
|
+
* than the words and a squashed icon reads as a rendering fault.
|
|
62
|
+
*/
|
|
63
|
+
when("& > svg", [shrink(), is(4), bs(4)]),
|
|
64
|
+
rounded("md"),
|
|
65
|
+
weight("medium"),
|
|
66
|
+
/** A small control reaches `--ui-target-size` however a consumer positions it. */
|
|
67
|
+
hitArea({ anchor: "flex-center" }),
|
|
68
|
+
pi(4),
|
|
69
|
+
pb(2),
|
|
70
|
+
/**
|
|
71
|
+
* Every variant carries the same border width, colored to match its
|
|
72
|
+
* own fill (transparent for ghost), so solid, outline, and ghost
|
|
73
|
+
* render at the same footprint.
|
|
74
|
+
*/
|
|
75
|
+
border({ width: 1 }),
|
|
76
|
+
/**
|
|
77
|
+
* The row measure is stated, so the control lines up with a field of the same size when
|
|
78
|
+
* a Group fuses the two, and still grows when a long label wraps.
|
|
79
|
+
*/
|
|
80
|
+
minBs("2.5rem"),
|
|
81
|
+
data("size", "sm", [pi(3), pb(1.5), minBs("2rem"), when("& > svg", [is(3), bs(3)])]),
|
|
82
|
+
data("size", "lg", [
|
|
83
|
+
pi(5),
|
|
84
|
+
pb(2.5),
|
|
85
|
+
text("base"),
|
|
86
|
+
minBs("3rem"),
|
|
87
|
+
when("& > svg", [is(5), bs(5)]),
|
|
88
|
+
]),
|
|
89
|
+
/**
|
|
90
|
+
* A glyph beside a label carries its own side bearing, so the padding on that
|
|
91
|
+
* side drops one step and the glyph and the words read as evenly inset.
|
|
92
|
+
*/
|
|
93
|
+
when("&[data-glyph-start]:has(> svg:first-child)", [
|
|
94
|
+
pis(3),
|
|
95
|
+
data("size", "sm", pis(2)),
|
|
96
|
+
data("size", "lg", pis(4)),
|
|
97
|
+
]),
|
|
98
|
+
when("&[data-glyph-end]:has(> svg:last-child)", [
|
|
99
|
+
pie(3),
|
|
100
|
+
data("size", "sm", pie(2)),
|
|
101
|
+
data("size", "lg", pie(4)),
|
|
102
|
+
]),
|
|
103
|
+
data("variant", "solid", [
|
|
104
|
+
data("color", "brand", [
|
|
105
|
+
bg("brand.solid"),
|
|
106
|
+
border("brand.solid"),
|
|
107
|
+
fg("brand.onSolid"),
|
|
108
|
+
hover([bg("brand.bg-solid-hover"), border("brand.bg-solid-hover")]),
|
|
109
|
+
active([bg("brand.bg-solid-pressed"), border("brand.bg-solid-pressed")]),
|
|
110
|
+
]),
|
|
111
|
+
data("color", "neutral", [
|
|
112
|
+
bg("neutral.solid"),
|
|
113
|
+
border("neutral.solid"),
|
|
114
|
+
fg("neutral.onSolid"),
|
|
115
|
+
hover([bg("neutral.bg-solid-hover"), border("neutral.bg-solid-hover")]),
|
|
116
|
+
active([bg("neutral.bg-solid-pressed"), border("neutral.bg-solid-pressed")]),
|
|
117
|
+
]),
|
|
118
|
+
data("color", "success", [
|
|
119
|
+
bg("success.solid"),
|
|
120
|
+
border("success.solid"),
|
|
121
|
+
fg("success.onSolid"),
|
|
122
|
+
hover([bg("success.bg-solid-hover"), border("success.bg-solid-hover")]),
|
|
123
|
+
active([bg("success.bg-solid-pressed"), border("success.bg-solid-pressed")]),
|
|
124
|
+
]),
|
|
125
|
+
data("color", "warning", [
|
|
126
|
+
bg("warning.solid"),
|
|
127
|
+
border("warning.solid"),
|
|
128
|
+
fg("warning.onSolid"),
|
|
129
|
+
hover([bg("warning.bg-solid-hover"), border("warning.bg-solid-hover")]),
|
|
130
|
+
active([bg("warning.bg-solid-pressed"), border("warning.bg-solid-pressed")]),
|
|
131
|
+
]),
|
|
132
|
+
data("color", "danger", [
|
|
133
|
+
bg("danger.solid"),
|
|
134
|
+
border("danger.solid"),
|
|
135
|
+
fg("danger.onSolid"),
|
|
136
|
+
hover([bg("danger.bg-solid-hover"), border("danger.bg-solid-hover")]),
|
|
137
|
+
active([bg("danger.bg-solid-pressed"), border("danger.bg-solid-pressed")]),
|
|
138
|
+
]),
|
|
139
|
+
]),
|
|
140
|
+
data("variant", "outline", [
|
|
141
|
+
data("color", "brand", [
|
|
142
|
+
border("brand"),
|
|
143
|
+
fg("brand"),
|
|
144
|
+
hover([bg("brand.tint"), border("brand.border-hover")]),
|
|
145
|
+
active(bg("brand.bg-tint-hover")),
|
|
146
|
+
]),
|
|
147
|
+
data("color", "neutral", [
|
|
148
|
+
border("neutral"),
|
|
149
|
+
fg("neutral"),
|
|
150
|
+
hover([bg("neutral.tint"), border("neutral.border-hover")]),
|
|
151
|
+
active(bg("neutral.bg-tint-hover")),
|
|
152
|
+
]),
|
|
153
|
+
data("color", "success", [
|
|
154
|
+
border("success"),
|
|
155
|
+
fg("success"),
|
|
156
|
+
hover([bg("success.tint"), border("success.border-hover")]),
|
|
157
|
+
active(bg("success.bg-tint-hover")),
|
|
158
|
+
]),
|
|
159
|
+
data("color", "warning", [
|
|
160
|
+
border("warning"),
|
|
161
|
+
fg("warning"),
|
|
162
|
+
hover([bg("warning.tint"), border("warning.border-hover")]),
|
|
163
|
+
active(bg("warning.bg-tint-hover")),
|
|
164
|
+
]),
|
|
165
|
+
data("color", "danger", [
|
|
166
|
+
border("danger"),
|
|
167
|
+
fg("danger"),
|
|
168
|
+
hover([bg("danger.tint"), border("danger.border-hover")]),
|
|
169
|
+
active(bg("danger.bg-tint-hover")),
|
|
170
|
+
]),
|
|
171
|
+
]),
|
|
172
|
+
data("variant", "outline", bg("transparent")),
|
|
173
|
+
data("variant", "ghost", [
|
|
174
|
+
data("color", "brand", [
|
|
175
|
+
fg("brand"),
|
|
176
|
+
hover(bg("brand.tint")),
|
|
177
|
+
active(bg("brand.bg-tint-hover")),
|
|
178
|
+
]),
|
|
179
|
+
data("color", "neutral", [
|
|
180
|
+
fg("neutral"),
|
|
181
|
+
hover(bg("neutral.bg-tint-hover")),
|
|
182
|
+
active(bg("neutral.bg-tint-pressed")),
|
|
183
|
+
]),
|
|
184
|
+
data("color", "success", [
|
|
185
|
+
fg("success"),
|
|
186
|
+
hover(bg("success.tint")),
|
|
187
|
+
active(bg("success.bg-tint-hover")),
|
|
188
|
+
]),
|
|
189
|
+
data("color", "warning", [
|
|
190
|
+
fg("warning"),
|
|
191
|
+
hover(bg("warning.tint")),
|
|
192
|
+
active(bg("warning.bg-tint-hover")),
|
|
193
|
+
]),
|
|
194
|
+
data("color", "danger", [
|
|
195
|
+
fg("danger"),
|
|
196
|
+
hover(bg("danger.tint")),
|
|
197
|
+
active(bg("danger.bg-tint-hover")),
|
|
198
|
+
]),
|
|
199
|
+
]),
|
|
200
|
+
data("variant", "ghost", [bg("transparent"), border("transparent")]),
|
|
201
|
+
when('&[aria-disabled="true"]', opacity(50)),
|
|
202
|
+
when('&[aria-disabled="true"]', [cursor("not-allowed"), pointerEvents()]),
|
|
203
|
+
cursor("default"),
|
|
204
|
+
userSelect(),
|
|
205
|
+
text("sm"),
|
|
206
|
+
data("size", "sm", text("xs")),
|
|
207
|
+
mix,
|
|
208
|
+
], children: children }), rendersPrefetchHint(resolvedPrefetch, rest.href) && (_jsx("link", { rel: "prefetch", href: rest.href }))] }));
|
|
205
209
|
};
|
|
206
210
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @copyright Sergio Xalambrí 2026
|
|
8
8
|
*/
|
|
9
9
|
import type { Handle, Props as TagProps } from "remix/component";
|
|
10
|
+
import type { LinkPrefetch } from "../utils/link-prefetch.js";
|
|
10
11
|
import type { SemanticColor } from "../utils/semantic-color.js";
|
|
11
12
|
/**
|
|
12
13
|
* Prop types for {@link Link}.
|
|
@@ -16,6 +17,12 @@ export declare namespace Link {
|
|
|
16
17
|
* Semantic color role, each mapped to its matching `--ui-*` variables.
|
|
17
18
|
*/
|
|
18
19
|
type Color = SemanticColor;
|
|
20
|
+
/**
|
|
21
|
+
* When the destination starts loading: on intent, once in the viewport, on
|
|
22
|
+
* render through a `<link rel="prefetch">` that also serves full-document
|
|
23
|
+
* navigations, or only on navigation (`"none"`).
|
|
24
|
+
*/
|
|
25
|
+
type Prefetch = LinkPrefetch;
|
|
19
26
|
/**
|
|
20
27
|
* Props accepted by {@link Link}. A type alias rather than an interface,
|
|
21
28
|
* since the native anchor props resolve through a conditional type that an
|
|
@@ -24,6 +31,12 @@ export declare namespace Link {
|
|
|
24
31
|
type Props = TagProps<"a"> & {
|
|
25
32
|
/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */
|
|
26
33
|
color?: Color;
|
|
34
|
+
/**
|
|
35
|
+
* Prefetch mode, for links whose GET is safe to repeat. `"render"` suits
|
|
36
|
+
* multi-page navigations; a list keeps it to its first few items, since each
|
|
37
|
+
* hint is a request on page load. Defaults to {@link DEFAULT_PREFETCH}.
|
|
38
|
+
*/
|
|
39
|
+
prefetch?: Prefetch;
|
|
27
40
|
};
|
|
28
41
|
}
|
|
29
42
|
/**
|
|
@@ -36,7 +49,7 @@ export declare namespace Link {
|
|
|
36
49
|
* @example
|
|
37
50
|
* <Link href="/about">{t("nav.about")}</Link>
|
|
38
51
|
* @example
|
|
39
|
-
* <Link href="/
|
|
52
|
+
* <Link href="/products/shirt" prefetch="render">{t("products.shirt")}</Link>
|
|
40
53
|
* @example
|
|
41
54
|
* <Link href="/settings" aria-disabled="true">{t("nav.settings")}</Link>
|
|
42
55
|
*/
|