@rvx/ui 0.4.5 → 0.4.7
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/common/types.d.ts +1 -0
- package/dist/common/types.d.ts.map +1 -1
- package/dist/components/nav-bar.d.ts +36 -0
- package/dist/components/nav-bar.d.ts.map +1 -0
- package/dist/components/nav-bar.js +46 -0
- package/dist/components/nav-bar.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/common/types.tsx +1 -0
- package/src/components/nav-bar.tsx +149 -0
- package/src/index.tsx +2 -2
- package/theme/components/control-group.module.css +7 -1
- package/theme/components/nav-bar.module.css +92 -0
- package/theme/components/separated.module.css +2 -2
- package/theme/components/tabs.module.css +2 -2
- package/theme/global.css +4 -1
- package/dist/components/nav-list.d.ts +0 -19
- package/dist/components/nav-list.d.ts.map +0 -1
- package/dist/components/nav-list.js +0 -34
- package/dist/components/nav-list.js.map +0 -1
- package/src/components/nav-list.tsx +0 -78
- package/theme/components/nav-list.module.css +0 -76
package/dist/common/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type SizeContext = "content" | "group" | "control";
|
|
2
2
|
export type AriaLive = "off" | "polite" | "assertive";
|
|
3
3
|
export type AriaRelevant = "additions" | "removals" | "text" | "all" | "additions removals" | "additions text" | "removals text";
|
|
4
|
+
export type AriaCurrent = "page" | "step" | "location" | boolean;
|
|
4
5
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.tsx"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE1D,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAC;AACtD,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,oBAAoB,GAAG,gBAAgB,GAAG,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.tsx"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE1D,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAC;AACtD,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,oBAAoB,GAAG,gBAAgB,GAAG,eAAe,CAAC;AACjI,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ClassValue, Content, Expression, StyleValue } from "rvx";
|
|
2
|
+
import { Action } from "../common/events.js";
|
|
3
|
+
import { AriaCurrent } from "../common/types.js";
|
|
4
|
+
import { LinkAnchorRel, LinkAnchorTarget, LinkReferrerPolicy } from "./link.js";
|
|
5
|
+
export declare function NavBar(props: {
|
|
6
|
+
class?: ClassValue;
|
|
7
|
+
style?: StyleValue;
|
|
8
|
+
inlineSize?: Expression<string | undefined>;
|
|
9
|
+
start?: Content;
|
|
10
|
+
center?: Content;
|
|
11
|
+
end?: Content;
|
|
12
|
+
}): unknown;
|
|
13
|
+
export declare function NavBarItem(props: {
|
|
14
|
+
class?: ClassValue;
|
|
15
|
+
style?: StyleValue;
|
|
16
|
+
children?: Content;
|
|
17
|
+
disabled?: Expression<boolean | undefined>;
|
|
18
|
+
action?: Action;
|
|
19
|
+
download?: Expression<string | boolean | undefined>;
|
|
20
|
+
href?: Expression<string | undefined>;
|
|
21
|
+
hreflang?: Expression<string | undefined>;
|
|
22
|
+
target?: Expression<LinkAnchorTarget | string | undefined>;
|
|
23
|
+
referrerpolicy?: Expression<LinkReferrerPolicy | undefined>;
|
|
24
|
+
rel?: Expression<LinkAnchorRel | LinkAnchorRel[] | undefined>;
|
|
25
|
+
title?: Expression<string | undefined>;
|
|
26
|
+
current?: Expression<AriaCurrent | undefined>;
|
|
27
|
+
"aria-expanded"?: Expression<boolean | undefined>;
|
|
28
|
+
"aria-haspopup"?: Expression<string | undefined>;
|
|
29
|
+
"aria-controls"?: Expression<string | undefined>;
|
|
30
|
+
}): unknown;
|
|
31
|
+
export declare function NavBarContent(props: {
|
|
32
|
+
class?: ClassValue;
|
|
33
|
+
style?: StyleValue;
|
|
34
|
+
children?: Content;
|
|
35
|
+
}): unknown;
|
|
36
|
+
//# sourceMappingURL=nav-bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-bar.d.ts","sourceRoot":"","sources":["../../src/components/nav-bar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAY,UAAU,EAAE,MAAM,KAAK,CAAC;AAG5E,OAAO,EAAE,MAAM,EAA4B,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAGhF,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC7B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACd,WAyBA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IACjC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,UAA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ar.module.css";
|
|
3
|
+
import { get, map } from "rvx";
|
|
4
|
+
import { isPending } from "rvx/async";
|
|
5
|
+
import { optionalString, separated } from "rvx/convert";
|
|
6
|
+
import { handleActionEvent, isKey } from "../common/events.js";
|
|
7
|
+
import { Row } from "./row.js";
|
|
8
|
+
export function NavBar(props) {
|
|
9
|
+
return _jsx("nav", { class: [
|
|
10
|
+
styles.nav,
|
|
11
|
+
props.class,
|
|
12
|
+
], style: [
|
|
13
|
+
props.style,
|
|
14
|
+
{
|
|
15
|
+
"--nav-bar-inline-size": props.inlineSize,
|
|
16
|
+
}
|
|
17
|
+
], children: _jsxs("div", { class: styles.grid, children: [_jsx("div", { class: styles.start, children: props.start }), _jsx("div", { class: styles.center, children: props.center }), _jsx("div", { class: styles.end, children: props.end })] }) });
|
|
18
|
+
}
|
|
19
|
+
export function NavBarItem(props) {
|
|
20
|
+
const disabled = () => isPending() || get(props.disabled);
|
|
21
|
+
function action(event) {
|
|
22
|
+
if (disabled() || !props.action) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
handleActionEvent(event, props.action);
|
|
26
|
+
}
|
|
27
|
+
const isLink = props.href !== undefined;
|
|
28
|
+
const Tag = isLink ? "a" : "button";
|
|
29
|
+
return _jsx(Tag, { type: isLink ? undefined : "button", disabled: disabled, class: [
|
|
30
|
+
props.class,
|
|
31
|
+
styles.item,
|
|
32
|
+
map(props.current, current => current ? styles.current : undefined),
|
|
33
|
+
map(props["aria-expanded"], expanded => expanded ? styles.expanded : undefined),
|
|
34
|
+
], style: props.style, title: props.title, "aria-current": optionalString(props.current), "aria-expanded": optionalString(props["aria-expanded"]), "aria-haspopup": props["aria-haspopup"], "aria-controls": props["aria-controls"], download: isLink && props.download, href: isLink && props.href, hreflang: isLink && props.hreflang, target: isLink && props.target, referrerpolicy: isLink && map(props.referrerpolicy, v => v ?? "no-referrer"), rel: isLink && separated(map(props.rel, v => v ?? "noreferrer"), " "), "on:click": action, "on:keydown": event => {
|
|
35
|
+
if (isKey(event, "enter") || isKey(event, " ")) {
|
|
36
|
+
action(event);
|
|
37
|
+
}
|
|
38
|
+
}, children: props.children });
|
|
39
|
+
}
|
|
40
|
+
export function NavBarContent(props) {
|
|
41
|
+
return _jsx(Row, { class: [
|
|
42
|
+
props.class,
|
|
43
|
+
styles.content
|
|
44
|
+
], style: props.style, align: "center", children: props.children });
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=nav-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-bar.js","sourceRoot":"","sources":["../../src/components/nav-bar.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,6CAA6C,CAAC;AACjE,OAAO,EAAmC,GAAG,EAAE,GAAG,EAAc,MAAM,KAAK,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAU,iBAAiB,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAGvE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,UAAU,MAAM,CAAC,KAOtB;IACA,OAAO,cACN,KAAK,EAAE;YACN,MAAM,CAAC,GAAG;YACV,KAAK,CAAC,KAAK;SACX,EACD,KAAK,EAAE;YACN,KAAK,CAAC,KAAK;YACX;gBACC,uBAAuB,EAAE,KAAK,CAAC,UAAU;aACzC;SACD,YAED,eAAK,KAAK,EAAE,MAAM,CAAC,IAAI,aACtB,cAAK,KAAK,EAAE,MAAM,CAAC,KAAK,YACtB,KAAK,CAAC,KAAK,GACP,EACN,cAAK,KAAK,EAAE,MAAM,CAAC,MAAM,YACvB,KAAK,CAAC,MAAM,GACR,EACN,cAAK,KAAK,EAAE,MAAM,CAAC,GAAG,YACpB,KAAK,CAAC,GAAG,GACL,IACD,GACD,CAAC;AACR,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KA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IAAI,KAAK,CAAC,IAAI,EAC1B,QAAQ,EAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,EAClC,MAAM,EAAE,MAAM,IAAI,KAAK,CAAC,MAAM,EAC9B,cAAc,EAAE,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,aAAa,CAAC,EAC5E,GAAG,EAAE,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,YAAY,CAAC,EAAE,GAAG,CAAC,cAE3D,MAAM,gBACJ,KAAK,CAAC,EAAE;YACnB,IAAI,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;gBAChD,MAAM,CAAC,KAAK,CAAC,CAAC;YACf,CAAC;QACF,CAAC,YAEA,KAAK,CAAC,QAAQ,GACV,CAAC;AACR,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAI7B;IACA,OAAO,KAAC,GAAG,IACV,KAAK,EAAE;YACN,KAAK,CAAC,KAAK;YACX,MAAM,CAAC,OAAO;SACd,EACD,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAC,QAAQ,YAEb,KAAK,CAAC,QAAQ,GACV,CAAC;AACR,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "@rvx/ui/theme/global.css";
|
|
2
|
+
import "@rvx/ui/theme/types.d.ts";
|
|
2
3
|
export * from "./common/context.js";
|
|
3
4
|
export * from "./common/coupling.js";
|
|
4
5
|
export * from "./common/events.js";
|
|
@@ -23,7 +24,7 @@ export * from "./components/heading.js";
|
|
|
23
24
|
export * from "./components/label.js";
|
|
24
25
|
export * from "./components/layer.js";
|
|
25
26
|
export * from "./components/link.js";
|
|
26
|
-
export * from "./components/nav-
|
|
27
|
+
export * from "./components/nav-bar.js";
|
|
27
28
|
export * from "./components/notifications.js";
|
|
28
29
|
export * from "./components/page.js";
|
|
29
30
|
export * from "./components/placeholder.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAC;AAClC,OAAO,0BAA0B,CAAC;AAElC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "@rvx/ui/theme/global.css";
|
|
2
|
+
import "@rvx/ui/theme/types.d.ts";
|
|
2
3
|
export * from "./common/context.js";
|
|
3
4
|
export * from "./common/coupling.js";
|
|
4
5
|
export * from "./common/events.js";
|
|
@@ -23,7 +24,7 @@ export * from "./components/heading.js";
|
|
|
23
24
|
export * from "./components/label.js";
|
|
24
25
|
export * from "./components/layer.js";
|
|
25
26
|
export * from "./components/link.js";
|
|
26
|
-
export * from "./components/nav-
|
|
27
|
+
export * from "./components/nav-bar.js";
|
|
27
28
|
export * from "./components/notifications.js";
|
|
28
29
|
export * from "./components/page.js";
|
|
29
30
|
export * from "./components/placeholder.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAC;AAClC,OAAO,0BAA0B,CAAC;AAElC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC"}
|
package/package.json
CHANGED
package/src/common/types.tsx
CHANGED
|
@@ -3,3 +3,4 @@ export type SizeContext = "content" | "group" | "control";
|
|
|
3
3
|
|
|
4
4
|
export type AriaLive = "off" | "polite" | "assertive";
|
|
5
5
|
export type AriaRelevant = "additions" | "removals" | "text" | "all" | "additions removals" | "additions text" | "removals text";
|
|
6
|
+
export type AriaCurrent = "page" | "step" | "location" | boolean;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/nav-bar.module.css";
|
|
2
|
+
import { ClassValue, Content, Expression, get, map, StyleValue } from "rvx";
|
|
3
|
+
import { isPending } from "rvx/async";
|
|
4
|
+
import { optionalString, separated } from "rvx/convert";
|
|
5
|
+
import { Action, handleActionEvent, isKey } from "../common/events.js";
|
|
6
|
+
import { AriaCurrent } from "../common/types.js";
|
|
7
|
+
import { LinkAnchorRel, LinkAnchorTarget, LinkReferrerPolicy } from "./link.js";
|
|
8
|
+
import { Row } from "./row.js";
|
|
9
|
+
|
|
10
|
+
export function NavBar(props: {
|
|
11
|
+
class?: ClassValue;
|
|
12
|
+
style?: StyleValue;
|
|
13
|
+
inlineSize?: Expression<string | undefined>;
|
|
14
|
+
start?: Content;
|
|
15
|
+
center?: Content;
|
|
16
|
+
end?: Content;
|
|
17
|
+
}) {
|
|
18
|
+
return <nav
|
|
19
|
+
class={[
|
|
20
|
+
styles.nav,
|
|
21
|
+
props.class,
|
|
22
|
+
]}
|
|
23
|
+
style={[
|
|
24
|
+
props.style,
|
|
25
|
+
{
|
|
26
|
+
"--nav-bar-inline-size": props.inlineSize,
|
|
27
|
+
}
|
|
28
|
+
]}
|
|
29
|
+
>
|
|
30
|
+
<div class={styles.grid}>
|
|
31
|
+
<div class={styles.start}>
|
|
32
|
+
{props.start}
|
|
33
|
+
</div>
|
|
34
|
+
<div class={styles.center}>
|
|
35
|
+
{props.center}
|
|
36
|
+
</div>
|
|
37
|
+
<div class={styles.end}>
|
|
38
|
+
{props.end}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</nav>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function NavBarItem(props: {
|
|
45
|
+
class?: ClassValue;
|
|
46
|
+
style?: StyleValue;
|
|
47
|
+
children?: Content;
|
|
48
|
+
disabled?: Expression<boolean | undefined>;
|
|
49
|
+
action?: Action;
|
|
50
|
+
download?: Expression<string | boolean | undefined>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The url this link points to.
|
|
54
|
+
*/
|
|
55
|
+
href?: Expression<string | undefined>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Hints the human language of the linked url.
|
|
59
|
+
*/
|
|
60
|
+
hreflang?: Expression<string | undefined>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The link target.
|
|
64
|
+
*/
|
|
65
|
+
target?: Expression<LinkAnchorTarget | string | undefined>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* How much of the referrer to send when following the link.
|
|
69
|
+
*
|
|
70
|
+
* @default "no-referrer"
|
|
71
|
+
*/
|
|
72
|
+
referrerpolicy?: Expression<LinkReferrerPolicy | undefined>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The link type.
|
|
76
|
+
*
|
|
77
|
+
* @default "noreferrer"
|
|
78
|
+
*/
|
|
79
|
+
rel?: Expression<LinkAnchorRel | LinkAnchorRel[] | undefined>;
|
|
80
|
+
|
|
81
|
+
title?: Expression<string | undefined>;
|
|
82
|
+
current?: Expression<AriaCurrent | undefined>;
|
|
83
|
+
|
|
84
|
+
"aria-expanded"?: Expression<boolean | undefined>;
|
|
85
|
+
"aria-haspopup"?: Expression<string | undefined>;
|
|
86
|
+
"aria-controls"?: Expression<string | undefined>;
|
|
87
|
+
}) {
|
|
88
|
+
const disabled = () => isPending() || get(props.disabled);
|
|
89
|
+
|
|
90
|
+
function action(event: Event) {
|
|
91
|
+
if (disabled() || !props.action) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
handleActionEvent(event, props.action);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const isLink = props.href !== undefined;
|
|
98
|
+
const Tag = isLink ? "a" : "button";
|
|
99
|
+
|
|
100
|
+
return <Tag
|
|
101
|
+
type={isLink ? undefined : "button"}
|
|
102
|
+
disabled={disabled}
|
|
103
|
+
class={[
|
|
104
|
+
props.class,
|
|
105
|
+
styles.item,
|
|
106
|
+
map(props.current, current => current ? styles.current : undefined),
|
|
107
|
+
map(props["aria-expanded"], expanded => expanded ? styles.expanded : undefined),
|
|
108
|
+
]}
|
|
109
|
+
style={props.style}
|
|
110
|
+
title={props.title}
|
|
111
|
+
aria-current={optionalString(props.current)}
|
|
112
|
+
aria-expanded={optionalString(props["aria-expanded"])}
|
|
113
|
+
aria-haspopup={props["aria-haspopup"]}
|
|
114
|
+
aria-controls={props["aria-controls"]}
|
|
115
|
+
|
|
116
|
+
download={isLink && props.download}
|
|
117
|
+
href={isLink && props.href}
|
|
118
|
+
hreflang={isLink && props.hreflang}
|
|
119
|
+
target={isLink && props.target}
|
|
120
|
+
referrerpolicy={isLink && map(props.referrerpolicy, v => v ?? "no-referrer")}
|
|
121
|
+
rel={isLink && separated(map(props.rel, v => v ?? "noreferrer"), " ")}
|
|
122
|
+
|
|
123
|
+
on:click={action}
|
|
124
|
+
on:keydown={event => {
|
|
125
|
+
if (isKey(event, "enter") || isKey(event, " ")) {
|
|
126
|
+
action(event);
|
|
127
|
+
}
|
|
128
|
+
}}
|
|
129
|
+
>
|
|
130
|
+
{props.children}
|
|
131
|
+
</Tag>;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function NavBarContent(props: {
|
|
135
|
+
class?: ClassValue;
|
|
136
|
+
style?: StyleValue;
|
|
137
|
+
children?: Content;
|
|
138
|
+
}) {
|
|
139
|
+
return <Row
|
|
140
|
+
class={[
|
|
141
|
+
props.class,
|
|
142
|
+
styles.content
|
|
143
|
+
]}
|
|
144
|
+
style={props.style}
|
|
145
|
+
align="center"
|
|
146
|
+
>
|
|
147
|
+
{props.children}
|
|
148
|
+
</Row>;
|
|
149
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="@rvx/ui/theme/types.d.ts" />
|
|
2
1
|
import "@rvx/ui/theme/global.css";
|
|
2
|
+
import "@rvx/ui/theme/types.d.ts";
|
|
3
3
|
|
|
4
4
|
export * from "./common/context.js";
|
|
5
5
|
export * from "./common/coupling.js";
|
|
@@ -25,7 +25,7 @@ export * from "./components/heading.js";
|
|
|
25
25
|
export * from "./components/label.js";
|
|
26
26
|
export * from "./components/layer.js";
|
|
27
27
|
export * from "./components/link.js";
|
|
28
|
-
export * from "./components/nav-
|
|
28
|
+
export * from "./components/nav-bar.js";
|
|
29
29
|
export * from "./components/notifications.js";
|
|
30
30
|
export * from "./components/page.js";
|
|
31
31
|
export * from "./components/placeholder.js";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
display: flex;
|
|
4
4
|
box-shadow: var(--control-shadow);
|
|
5
5
|
border-radius: var(--control-radius);
|
|
6
|
-
gap: var(--separator);
|
|
6
|
+
gap: var(--separator-size);
|
|
7
7
|
|
|
8
8
|
& > * {
|
|
9
9
|
box-shadow: none;
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
border-start-end-radius: 0;
|
|
29
29
|
border-end-end-radius: 0;
|
|
30
30
|
}
|
|
31
|
+
& > * {
|
|
32
|
+
margin-inline-start: calc((var(--space-scale) - 1) * var(--separator-size));
|
|
33
|
+
}
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
.column {
|
|
@@ -48,4 +51,7 @@
|
|
|
48
51
|
border-end-start-radius: 0;
|
|
49
52
|
border-end-end-radius: 0;
|
|
50
53
|
}
|
|
54
|
+
& > * {
|
|
55
|
+
margin-block-start: calc((var(--space-scale) - 1) * var(--separator-size));
|
|
56
|
+
}
|
|
51
57
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
|
|
2
|
+
.nav {
|
|
3
|
+
background-color: var(--nav-bar-bg);
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: row;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.grid {
|
|
10
|
+
flex-grow: 1;
|
|
11
|
+
max-inline-size: var(--nav-bar-inline-size);
|
|
12
|
+
margin-inline: var(--page-padding-inline);
|
|
13
|
+
|
|
14
|
+
display: grid;
|
|
15
|
+
grid-template-columns: 1fr auto 1fr;
|
|
16
|
+
gap: var(--content-column-gap);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.start,
|
|
20
|
+
.center,
|
|
21
|
+
.end {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: row;
|
|
24
|
+
gap: var(--content-column-gap);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.start {
|
|
28
|
+
justify-content: start;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.end {
|
|
32
|
+
justify-content: end;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.item {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
align-items: center;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
|
|
41
|
+
font-family: inherit;
|
|
42
|
+
font-size: inherit;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
line-height: 1;
|
|
45
|
+
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
outline: none;
|
|
48
|
+
text-decoration: none;
|
|
49
|
+
|
|
50
|
+
padding-inline: 0;
|
|
51
|
+
padding-block: calc(var(--content-padding-block) + var(--marker-size)) var(--content-padding-block);
|
|
52
|
+
|
|
53
|
+
border: none;
|
|
54
|
+
border-block-end: var(--marker-size) solid transparent;
|
|
55
|
+
|
|
56
|
+
background-color: transparent;
|
|
57
|
+
color: var(--fg-secondary);
|
|
58
|
+
|
|
59
|
+
&[disabled] {
|
|
60
|
+
cursor: default;
|
|
61
|
+
filter: var(--control-disabled);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
transition: border-block-end-color var(--transition-color),
|
|
65
|
+
color var(--transition-color);
|
|
66
|
+
|
|
67
|
+
&:hover:not([disabled]),
|
|
68
|
+
&:focus-visible:not([disabled]),
|
|
69
|
+
&.expanded {
|
|
70
|
+
color: var(--fg);
|
|
71
|
+
border-block-end-color: var(--nav-bar-marker-hover);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.current.current {
|
|
75
|
+
color: var(--fg);
|
|
76
|
+
border-block-end-color: var(--accent);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.content {
|
|
81
|
+
padding-block: var(--group-padding-block);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:global(.rvx-dark) {
|
|
85
|
+
--nav-bar-bg: rgb(32 32 32);
|
|
86
|
+
--nav-bar-marker-hover: rgb(80 80 80);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:global(.rvx-light) {
|
|
90
|
+
--nav-bar-bg: rgb(240 240 240);
|
|
91
|
+
--nav-bar-marker-hover: rgb(172 172 172);
|
|
92
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
}
|
|
9
9
|
& > :not(.has_separator) + :not(.has_separator) {
|
|
10
|
-
border-block-start: calc(var(--separator) * var(--space-scale)) solid var(--separator-color);
|
|
10
|
+
border-block-start: calc(var(--separator-size) * var(--space-scale)) solid var(--separator-color);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
overflow: hidden;
|
|
20
20
|
}
|
|
21
21
|
& > :not(.has_separator) + :not(.has_separator) {
|
|
22
|
-
border-inline-start: calc(var(--separator) * var(--space-scale)) solid var(--separator-color);
|
|
22
|
+
border-inline-start: calc(var(--separator-size) * var(--space-scale)) solid var(--separator-color);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
.list {
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: row;
|
|
5
|
-
border-bottom: var(--separator) solid var(--separator-color);
|
|
5
|
+
border-bottom: var(--separator-size) solid var(--separator-color);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.list_padded {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
cursor: pointer;
|
|
19
19
|
outline: none;
|
|
20
20
|
|
|
21
|
-
padding-block: var(--control-padding-block);
|
|
21
|
+
padding-block: calc(var(--control-padding-block) + var(--control-border)) var(--control-padding-block);
|
|
22
22
|
padding-inline: calc(var(--control-padding-inline) + var(--control-border));
|
|
23
23
|
|
|
24
24
|
background-color: transparent;
|
package/theme/global.css
CHANGED
|
@@ -53,7 +53,8 @@ body {
|
|
|
53
53
|
--transition-color: .1s ease;
|
|
54
54
|
--transition-layout: .25s ease;
|
|
55
55
|
|
|
56
|
-
--separator: calc(2rem / 14);
|
|
56
|
+
--separator-size: calc(2rem / 14);
|
|
57
|
+
--marker-size: calc(3rem / 14);
|
|
57
58
|
|
|
58
59
|
--overflow-safe-area: calc(2rem / 14);
|
|
59
60
|
--input-extension: calc(5rem / 14);
|
|
@@ -71,6 +72,7 @@ body {
|
|
|
71
72
|
--fg: white;
|
|
72
73
|
--accent: rgb(64 160 255);
|
|
73
74
|
--fg-danger: rgb(255 64 64);
|
|
75
|
+
--fg-secondary: rgb(255 255 255 / .6);
|
|
74
76
|
|
|
75
77
|
--secondary-filter: opacity(.6);
|
|
76
78
|
|
|
@@ -99,6 +101,7 @@ body {
|
|
|
99
101
|
--fg: rgb(42 42 42);
|
|
100
102
|
--accent: rgb(0 127 255);
|
|
101
103
|
--fg-danger: rgb(255 64 64);
|
|
104
|
+
--fg-secondary: rgb(42 42 42 / .6);
|
|
102
105
|
|
|
103
106
|
--secondary-filter: opacity(.65);
|
|
104
107
|
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ClassValue, Expression, StyleValue } from "rvx";
|
|
2
|
-
import { Action } from "../common/events.js";
|
|
3
|
-
export declare function NavList(props: {
|
|
4
|
-
role?: Expression<string | false | undefined>;
|
|
5
|
-
class?: ClassValue;
|
|
6
|
-
style?: StyleValue;
|
|
7
|
-
id?: Expression<string | undefined>;
|
|
8
|
-
children?: unknown;
|
|
9
|
-
}): unknown;
|
|
10
|
-
export declare function NavListButton(props: {
|
|
11
|
-
current?: Expression<boolean | undefined>;
|
|
12
|
-
disabled?: Expression<boolean | undefined>;
|
|
13
|
-
class?: ClassValue;
|
|
14
|
-
style?: StyleValue;
|
|
15
|
-
id?: Expression<string | undefined>;
|
|
16
|
-
action?: Action;
|
|
17
|
-
children?: unknown;
|
|
18
|
-
}): unknown;
|
|
19
|
-
//# sourceMappingURL=nav-list.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nav-list.d.ts","sourceRoot":"","sources":["../../src/components/nav-list.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAY,UAAU,EAAE,MAAM,KAAK,CAAC;AAGnE,OAAO,EAAE,MAAM,EAA4B,MAAM,qBAAqB,CAAC;AAEvE,wBAAgB,OAAO,CAAC,KAAK,EAAE;IAM9B,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC,CAAC;IAE9C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,EAAE,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,OAAO,CAeV;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAIpC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IAE1C,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,EAAE,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,OAAO,CA8BV"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "rvx/jsx-runtime";
|
|
2
|
-
import styles from "@rvx/ui/theme/components/nav-list.module.css";
|
|
3
|
-
import { get, map } from "rvx";
|
|
4
|
-
import { isPending } from "rvx/async";
|
|
5
|
-
import { optionalString } from "rvx/convert";
|
|
6
|
-
import { handleActionEvent, isKey } from "../common/events.js";
|
|
7
|
-
export function NavList(props) {
|
|
8
|
-
return _jsx("div", { class: [
|
|
9
|
-
styles.nav_list,
|
|
10
|
-
props.class,
|
|
11
|
-
], style: [
|
|
12
|
-
{ "--nav-list-depth": String(0) },
|
|
13
|
-
props.style,
|
|
14
|
-
], id: props.id, role: map(props.role, role => role ?? "navigation"), children: props.children });
|
|
15
|
-
}
|
|
16
|
-
export function NavListButton(props) {
|
|
17
|
-
const disabled = () => isPending() || get(props.disabled);
|
|
18
|
-
function action(event) {
|
|
19
|
-
if (disabled() || !props.action) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
handleActionEvent(event, props.action);
|
|
23
|
-
}
|
|
24
|
-
return _jsx("button", { type: "button", disabled: disabled, class: [
|
|
25
|
-
styles.item,
|
|
26
|
-
map(props.current, current => current && styles.item_current),
|
|
27
|
-
props.class,
|
|
28
|
-
], style: props.style, id: props.id, "on:click": action, "on:keydown": event => {
|
|
29
|
-
if (isKey(event, "enter") || isKey(event, " ")) {
|
|
30
|
-
action(event);
|
|
31
|
-
}
|
|
32
|
-
}, "aria-current": optionalString(props.current), children: props.children });
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=nav-list.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nav-list.js","sourceRoot":"","sources":["../../src/components/nav-list.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,8CAA8C,CAAC;AAClE,OAAO,EAA0B,GAAG,EAAE,GAAG,EAAc,MAAM,KAAK,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAU,iBAAiB,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;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F,CAAC,kBACa,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,YAE1C,KAAK,CAAC,QAAQ,GACP,CAAC;AACX,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import styles from "@rvx/ui/theme/components/nav-list.module.css";
|
|
2
|
-
import { ClassValue, Expression, get, map, StyleValue } from "rvx";
|
|
3
|
-
import { isPending } from "rvx/async";
|
|
4
|
-
import { optionalString } from "rvx/convert";
|
|
5
|
-
import { Action, handleActionEvent, isKey } from "../common/events.js";
|
|
6
|
-
|
|
7
|
-
export function NavList(props: {
|
|
8
|
-
/**
|
|
9
|
-
* The element role or `false` to disable.
|
|
10
|
-
*
|
|
11
|
-
* @default "navigation"
|
|
12
|
-
*/
|
|
13
|
-
role?: Expression<string | false | undefined>;
|
|
14
|
-
|
|
15
|
-
class?: ClassValue;
|
|
16
|
-
style?: StyleValue;
|
|
17
|
-
id?: Expression<string | undefined>;
|
|
18
|
-
children?: unknown;
|
|
19
|
-
}): unknown {
|
|
20
|
-
return <div
|
|
21
|
-
class={[
|
|
22
|
-
styles.nav_list,
|
|
23
|
-
props.class,
|
|
24
|
-
]}
|
|
25
|
-
style={[
|
|
26
|
-
{ "--nav-list-depth": String(0) },
|
|
27
|
-
props.style,
|
|
28
|
-
]}
|
|
29
|
-
id={props.id}
|
|
30
|
-
role={map(props.role, role => role ?? "navigation")}
|
|
31
|
-
>
|
|
32
|
-
{props.children}
|
|
33
|
-
</div>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function NavListButton(props: {
|
|
37
|
-
/**
|
|
38
|
-
* True if this is the currently selected item.
|
|
39
|
-
*/
|
|
40
|
-
current?: Expression<boolean | undefined>;
|
|
41
|
-
|
|
42
|
-
disabled?: Expression<boolean | undefined>;
|
|
43
|
-
class?: ClassValue;
|
|
44
|
-
style?: StyleValue;
|
|
45
|
-
id?: Expression<string | undefined>;
|
|
46
|
-
action?: Action;
|
|
47
|
-
children?: unknown;
|
|
48
|
-
}): unknown {
|
|
49
|
-
const disabled = () => isPending() || get(props.disabled);
|
|
50
|
-
|
|
51
|
-
function action(event: Event) {
|
|
52
|
-
if (disabled() || !props.action) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
handleActionEvent(event, props.action);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return <button
|
|
59
|
-
type="button"
|
|
60
|
-
disabled={disabled}
|
|
61
|
-
class={[
|
|
62
|
-
styles.item,
|
|
63
|
-
map(props.current, current => current && styles.item_current),
|
|
64
|
-
props.class,
|
|
65
|
-
]}
|
|
66
|
-
style={props.style}
|
|
67
|
-
id={props.id}
|
|
68
|
-
on:click={action}
|
|
69
|
-
on:keydown={event => {
|
|
70
|
-
if (isKey(event, "enter") || isKey(event, " ")) {
|
|
71
|
-
action(event);
|
|
72
|
-
}
|
|
73
|
-
}}
|
|
74
|
-
aria-current={optionalString(props.current)}
|
|
75
|
-
>
|
|
76
|
-
{props.children}
|
|
77
|
-
</button>;
|
|
78
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
.nav_list {
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
position: relative;
|
|
6
|
-
z-index: 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.item {
|
|
10
|
-
font-family: inherit;
|
|
11
|
-
font-size: inherit;
|
|
12
|
-
font-weight: 600;
|
|
13
|
-
line-height: 1;
|
|
14
|
-
text-align: left;
|
|
15
|
-
|
|
16
|
-
background-color: var(--nav-list-item-bg);
|
|
17
|
-
color: var(--nav-list-item-fg);
|
|
18
|
-
border: var(--nav-list-item-border) solid var(--control-border);
|
|
19
|
-
border-radius: var(--control-radius);
|
|
20
|
-
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
|
|
23
|
-
outline: none;
|
|
24
|
-
padding-block: var(--control-padding-block);
|
|
25
|
-
padding-inline: var(--control-padding-inline);
|
|
26
|
-
|
|
27
|
-
transition: var(--transition-color) background-color,
|
|
28
|
-
var(--transition-color) border-color;
|
|
29
|
-
|
|
30
|
-
&[disabled] {
|
|
31
|
-
cursor: default;
|
|
32
|
-
filter: var(--control-disabled);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&:hover:not(:active):not([disabled]),
|
|
36
|
-
&:focus-visible {
|
|
37
|
-
color: var(--nav-list-item-fg-hover);
|
|
38
|
-
background-color: var(--nav-list-item-bg-hover);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&:active {
|
|
42
|
-
color: var(--nav-list-item-fg-active);
|
|
43
|
-
background-color: var(--nav-list-item-bg-active);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.item_current {
|
|
48
|
-
color: var(--nav-list-item-fg-current);
|
|
49
|
-
background-color: var(--nav-list-item-bg-current);
|
|
50
|
-
box-shadow: var(--control-shadow);
|
|
51
|
-
z-index: 1;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
:global(.rvx-dark) {
|
|
55
|
-
--nav-list-item-bg: transparent;
|
|
56
|
-
--nav-list-item-bg-hover: rgb(255 255 255 / .1);
|
|
57
|
-
--nav-list-item-bg-active: rgb(255 255 255 / .08);
|
|
58
|
-
--nav-list-item-bg-current: rgb(255 255 255 / .1);
|
|
59
|
-
--nav-list-item-fg: rgb(172 172 172);
|
|
60
|
-
--nav-list-item-fg-hover: var(--fg);
|
|
61
|
-
--nav-list-item-fg-active: var(--fg);
|
|
62
|
-
--nav-list-item-fg-current: var(--fg);
|
|
63
|
-
--nav-list-item-border: transparent;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
:global(.rvx-light) {
|
|
67
|
-
--nav-list-item-bg: transparent;
|
|
68
|
-
--nav-list-item-bg-hover: rgb(0 0 0 / .075);
|
|
69
|
-
--nav-list-item-bg-active: rgb(0 0 0 / .125);
|
|
70
|
-
--nav-list-item-bg-current: rgb(0 0 0 / .125);
|
|
71
|
-
--nav-list-item-fg: rgb(72 72 72);
|
|
72
|
-
--nav-list-item-fg-hover: var(--fg);
|
|
73
|
-
--nav-list-item-fg-active: var(--fg);
|
|
74
|
-
--nav-list-item-fg-current: var(--fg);
|
|
75
|
-
--nav-list-item-border: transparent;
|
|
76
|
-
}
|