@fairmint/ui 0.3.25 → 0.3.27
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/FairmintLogo/FairmintLogoMarkRounded.cjs +82 -0
- package/dist/components/FairmintLogo/FairmintLogoMarkRounded.cjs.map +1 -0
- package/dist/components/FairmintLogo/FairmintLogoMarkRounded.d.ts +41 -0
- package/dist/components/FairmintLogo/FairmintLogoMarkRounded.d.ts.map +1 -0
- package/dist/components/FairmintLogo/FairmintLogoMarkRounded.js +82 -0
- package/dist/components/FairmintLogo/FairmintLogoMarkRounded.js.map +1 -0
- package/dist/components/layout/SideNav/SideNav.cjs +362 -19
- package/dist/components/layout/SideNav/SideNav.cjs.map +1 -1
- package/dist/components/layout/SideNav/SideNav.d.ts +45 -4
- package/dist/components/layout/SideNav/SideNav.d.ts.map +1 -1
- package/dist/components/layout/SideNav/SideNav.js +364 -21
- package/dist/components/layout/SideNav/SideNav.js.map +1 -1
- package/dist/fairmint-ui.cjs +8 -0
- package/dist/fairmint-ui.cjs.map +1 -1
- package/dist/fairmint-ui.js +9 -1
- package/dist/fairmint-ui.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/node_modules/@mantine/core/esm/components/Slider/Slider/Slider.cjs +1 -1
- package/dist/node_modules/@mantine/core/esm/components/Slider/Slider/Slider.js +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutSidebarLeftCollapse.cjs +8 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutSidebarLeftCollapse.cjs.map +1 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutSidebarLeftCollapse.js +8 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutSidebarLeftCollapse.js.map +1 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutSidebarLeftExpand.cjs +8 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutSidebarLeftExpand.cjs.map +1 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutSidebarLeftExpand.js +8 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutSidebarLeftExpand.js.map +1 -0
- package/dist/styles.css +18 -0
- package/dist/theme/index.cjs +9 -4
- package/dist/theme/index.cjs.map +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +9 -4
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/logo.cjs +2 -0
- package/dist/theme/logo.cjs.map +1 -1
- package/dist/theme/logo.d.ts +2 -0
- package/dist/theme/logo.d.ts.map +1 -1
- package/dist/theme/logo.js +2 -0
- package/dist/theme/logo.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const logo = require("../../theme/logo.cjs");
|
|
5
|
+
const LOGO_MARK_ROUNDED_VIEWBOX = { width: 36, height: 36 };
|
|
6
|
+
const LOGO_MARK_ROUNDED_TILE = logo.logoColors.markRoundedTile;
|
|
7
|
+
const SIDE_NAV_COLLAPSED_LOGO_FRAME = 48;
|
|
8
|
+
const SIDE_NAV_COLLAPSED_LOGO_SIZE = 36;
|
|
9
|
+
function FairmintLogoMarkRounded({
|
|
10
|
+
size = 32,
|
|
11
|
+
frameSize,
|
|
12
|
+
tileColor = LOGO_MARK_ROUNDED_TILE,
|
|
13
|
+
glyphColor = logo.logoFills.white,
|
|
14
|
+
alt,
|
|
15
|
+
className,
|
|
16
|
+
style
|
|
17
|
+
}) {
|
|
18
|
+
const isDecorative = !alt;
|
|
19
|
+
const resolvedFrame = frameSize && frameSize > size ? frameSize : void 0;
|
|
20
|
+
const mark = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21
|
+
"svg",
|
|
22
|
+
{
|
|
23
|
+
viewBox: `0 0 ${LOGO_MARK_ROUNDED_VIEWBOX.width} ${LOGO_MARK_ROUNDED_VIEWBOX.height}`,
|
|
24
|
+
width: size,
|
|
25
|
+
height: size,
|
|
26
|
+
className: resolvedFrame ? void 0 : className,
|
|
27
|
+
style: { display: "block", flexShrink: 0, ...resolvedFrame ? void 0 : style },
|
|
28
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
29
|
+
"aria-hidden": isDecorative || void 0,
|
|
30
|
+
role: isDecorative ? void 0 : "img",
|
|
31
|
+
"aria-label": isDecorative ? void 0 : alt,
|
|
32
|
+
children: [
|
|
33
|
+
!isDecorative && /* @__PURE__ */ jsxRuntime.jsx("title", { children: alt }),
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "36", height: "36", rx: "8", fill: tileColor }),
|
|
35
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { transform: "translate(18 18.07) scale(1.12) translate(-18 -18.07)", children: [
|
|
36
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.4661 20.3562V26.446H15.1251V18.7954L12.4661 20.3562Z", fill: glyphColor }),
|
|
37
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
38
|
+
"path",
|
|
39
|
+
{
|
|
40
|
+
d: "M22.5714 22.7206V18.7932L19.9113 20.354V22.9428C19.9113 25.447 20.5768 26.7091 23.391 26.7091C24.0115 26.7091 24.9416 26.6194 25.4954 26.3556V24.1164C25.1627 24.3598 24.5198 24.4499 24.055 24.4499C22.8819 24.4499 22.5714 23.7836 22.5714 22.7206Z",
|
|
41
|
+
fill: glyphColor
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
45
|
+
"path",
|
|
46
|
+
{
|
|
47
|
+
d: "M16.4329 9.42847C13.1307 9.42847 12.4656 11.3557 12.4656 14.3028V15.822H15.1254V13.8818C15.1254 12.7079 15.3456 11.6881 16.8315 11.6881C17.2086 11.6881 17.5629 11.7555 17.9388 11.8445L18.1148 9.5829C17.5625 9.47197 17.0071 9.42847 16.4329 9.42847Z",
|
|
48
|
+
fill: glyphColor
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M22.5714 12.7273H19.9113V15.8081H22.5714V12.7273Z", fill: glyphColor }),
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M25.7283 15.8218H10.2717V18.0841H25.7283V15.8218Z", fill: glyphColor })
|
|
53
|
+
] })
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
if (!resolvedFrame) {
|
|
58
|
+
return mark;
|
|
59
|
+
}
|
|
60
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
+
"span",
|
|
62
|
+
{
|
|
63
|
+
className,
|
|
64
|
+
style: {
|
|
65
|
+
display: "inline-flex",
|
|
66
|
+
alignItems: "center",
|
|
67
|
+
justifyContent: "center",
|
|
68
|
+
width: resolvedFrame,
|
|
69
|
+
height: resolvedFrame,
|
|
70
|
+
flexShrink: 0,
|
|
71
|
+
...style
|
|
72
|
+
},
|
|
73
|
+
children: mark
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
exports.FairmintLogoMarkRounded = FairmintLogoMarkRounded;
|
|
78
|
+
exports.LOGO_MARK_ROUNDED_TILE = LOGO_MARK_ROUNDED_TILE;
|
|
79
|
+
exports.LOGO_MARK_ROUNDED_VIEWBOX = LOGO_MARK_ROUNDED_VIEWBOX;
|
|
80
|
+
exports.SIDE_NAV_COLLAPSED_LOGO_FRAME = SIDE_NAV_COLLAPSED_LOGO_FRAME;
|
|
81
|
+
exports.SIDE_NAV_COLLAPSED_LOGO_SIZE = SIDE_NAV_COLLAPSED_LOGO_SIZE;
|
|
82
|
+
//# sourceMappingURL=FairmintLogoMarkRounded.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FairmintLogoMarkRounded.cjs","sources":["../../../src/components/FairmintLogo/FairmintLogoMarkRounded.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport { logoColors, logoFills } from \"../../theme/logo\";\n\n/** Product FT mark — rounded square tile from the brand icon asset. */\nexport const LOGO_MARK_ROUNDED_VIEWBOX = { width: 36, height: 36 } as const;\n\n/** Default tile fill from the FT Mark Rounded Square source asset. */\nexport const LOGO_MARK_ROUNDED_TILE = logoColors.markRoundedTile;\n\n/**\n * Collapsed SideNav layout: 48×48 frame with a 36×36 mark centered inside\n * (white/transparent padding around the tile).\n */\nexport const SIDE_NAV_COLLAPSED_LOGO_FRAME = 48;\nexport const SIDE_NAV_COLLAPSED_LOGO_SIZE = 36;\n\nexport interface FairmintLogoMarkRoundedProps {\n /** Square size of the filled tile in pixels. @default 32 */\n size?: number;\n /**\n * Outer frame size. When set larger than `size`, centers the tile in a\n * transparent square (e.g. frame 48 + size 36 for collapsed SideNav).\n */\n frameSize?: number;\n /** Rounded tile fill. @default LOGO_MARK_ROUNDED_TILE */\n tileColor?: string;\n /** Glyph fill on the tile. @default white */\n glyphColor?: string;\n /**\n * Accessible name when the mark is standalone (collapsed nav, favicon).\n * Omit or pass `\"\"` when decorative inside a labeled lockup or link.\n */\n alt?: string;\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * Fairmint FT mark on a rounded square — preferred collapsed SideNav / app-icon lockup.\n * Source geometry: FT Mark Rounded Square. The purple tile fills `size`; optional\n * `frameSize` adds transparent padding around it.\n */\nexport function FairmintLogoMarkRounded({\n size = 32,\n frameSize,\n tileColor = LOGO_MARK_ROUNDED_TILE,\n glyphColor = logoFills.white,\n alt,\n className,\n style,\n}: FairmintLogoMarkRoundedProps) {\n const isDecorative = !alt;\n const resolvedFrame = frameSize && frameSize > size ? frameSize : undefined;\n\n const mark = (\n <svg\n viewBox={`0 0 ${LOGO_MARK_ROUNDED_VIEWBOX.width} ${LOGO_MARK_ROUNDED_VIEWBOX.height}`}\n width={size}\n height={size}\n className={resolvedFrame ? undefined : className}\n style={{ display: \"block\", flexShrink: 0, ...(resolvedFrame ? undefined : style) }}\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden={isDecorative || undefined}\n role={isDecorative ? undefined : \"img\"}\n aria-label={isDecorative ? undefined : alt}\n >\n {!isDecorative && <title>{alt}</title>}\n {/* Tile fills the viewBox — padding belongs on `frameSize`, not inside the SVG. */}\n <rect width=\"36\" height=\"36\" rx=\"8\" fill={tileColor} />\n <g transform=\"translate(18 18.07) scale(1.12) translate(-18 -18.07)\">\n <path d=\"M12.4661 20.3562V26.446H15.1251V18.7954L12.4661 20.3562Z\" fill={glyphColor} />\n <path\n d=\"M22.5714 22.7206V18.7932L19.9113 20.354V22.9428C19.9113 25.447 20.5768 26.7091 23.391 26.7091C24.0115 26.7091 24.9416 26.6194 25.4954 26.3556V24.1164C25.1627 24.3598 24.5198 24.4499 24.055 24.4499C22.8819 24.4499 22.5714 23.7836 22.5714 22.7206Z\"\n fill={glyphColor}\n />\n <path\n d=\"M16.4329 9.42847C13.1307 9.42847 12.4656 11.3557 12.4656 14.3028V15.822H15.1254V13.8818C15.1254 12.7079 15.3456 11.6881 16.8315 11.6881C17.2086 11.6881 17.5629 11.7555 17.9388 11.8445L18.1148 9.5829C17.5625 9.47197 17.0071 9.42847 16.4329 9.42847Z\"\n fill={glyphColor}\n />\n <path d=\"M22.5714 12.7273H19.9113V15.8081H22.5714V12.7273Z\" fill={glyphColor} />\n <path d=\"M25.7283 15.8218H10.2717V18.0841H25.7283V15.8218Z\" fill={glyphColor} />\n </g>\n </svg>\n );\n\n if (!resolvedFrame) {\n return mark;\n }\n\n return (\n <span\n className={className}\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: resolvedFrame,\n height: resolvedFrame,\n flexShrink: 0,\n ...style,\n }}\n >\n {mark}\n </span>\n );\n}\n"],"names":["logoColors","logoFills","jsxs","jsx"],"mappings":";;;;AAIO,MAAM,4BAA4B,EAAE,OAAO,IAAI,QAAQ,GAAA;AAGvD,MAAM,yBAAyBA,KAAAA,WAAW;AAM1C,MAAM,gCAAgC;AACtC,MAAM,+BAA+B;AA4BrC,SAAS,wBAAwB;AAAA,EACtC,OAAO;AAAA,EACP;AAAA,EACA,YAAY;AAAA,EACZ,aAAaC,KAAAA,UAAU;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACF,GAAiC;AAC/B,QAAM,eAAe,CAAC;AACtB,QAAM,gBAAgB,aAAa,YAAY,OAAO,YAAY;AAElE,QAAM,OACJC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,OAAO,0BAA0B,KAAK,IAAI,0BAA0B,MAAM;AAAA,MACnF,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,WAAW,gBAAgB,SAAY;AAAA,MACvC,OAAO,EAAE,SAAS,SAAS,YAAY,GAAG,GAAI,gBAAgB,SAAY,MAAA;AAAA,MAC1E,OAAM;AAAA,MACN,eAAa,gBAAgB;AAAA,MAC7B,MAAM,eAAe,SAAY;AAAA,MACjC,cAAY,eAAe,SAAY;AAAA,MAEtC,UAAA;AAAA,QAAA,CAAC,gBAAgBC,2BAAAA,IAAC,SAAA,EAAO,UAAA,IAAA,CAAI;AAAA,QAE9BA,2BAAAA,IAAC,UAAK,OAAM,MAAK,QAAO,MAAK,IAAG,KAAI,MAAM,UAAA,CAAW;AAAA,QACrDD,2BAAAA,KAAC,KAAA,EAAE,WAAU,yDACX,UAAA;AAAA,UAAAC,2BAAAA,IAAC,QAAA,EAAK,GAAE,4DAA2D,MAAM,YAAY;AAAA,UACrFA,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,GAAE;AAAA,cACF,MAAM;AAAA,YAAA;AAAA,UAAA;AAAA,UAERA,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,GAAE;AAAA,cACF,MAAM;AAAA,YAAA;AAAA,UAAA;AAAA,UAERA,2BAAAA,IAAC,QAAA,EAAK,GAAE,qDAAoD,MAAM,YAAY;AAAA,UAC9EA,2BAAAA,IAAC,QAAA,EAAK,GAAE,qDAAoD,MAAM,WAAA,CAAY;AAAA,QAAA,EAAA,CAChF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ,MAAI,CAAC,eAAe;AAClB,WAAO;AAAA,EACT;AAEA,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,OAAO;AAAA,QACL,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,gBAAgB;AAAA,QAChB,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,YAAY;AAAA,QACZ,GAAG;AAAA,MAAA;AAAA,MAGJ,UAAA;AAAA,IAAA;AAAA,EAAA;AAGP;;;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
/** Product FT mark — rounded square tile from the brand icon asset. */
|
|
3
|
+
export declare const LOGO_MARK_ROUNDED_VIEWBOX: {
|
|
4
|
+
readonly width: 36;
|
|
5
|
+
readonly height: 36;
|
|
6
|
+
};
|
|
7
|
+
/** Default tile fill from the FT Mark Rounded Square source asset. */
|
|
8
|
+
export declare const LOGO_MARK_ROUNDED_TILE: "#825BFF";
|
|
9
|
+
/**
|
|
10
|
+
* Collapsed SideNav layout: 48×48 frame with a 36×36 mark centered inside
|
|
11
|
+
* (white/transparent padding around the tile).
|
|
12
|
+
*/
|
|
13
|
+
export declare const SIDE_NAV_COLLAPSED_LOGO_FRAME = 48;
|
|
14
|
+
export declare const SIDE_NAV_COLLAPSED_LOGO_SIZE = 36;
|
|
15
|
+
export interface FairmintLogoMarkRoundedProps {
|
|
16
|
+
/** Square size of the filled tile in pixels. @default 32 */
|
|
17
|
+
size?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Outer frame size. When set larger than `size`, centers the tile in a
|
|
20
|
+
* transparent square (e.g. frame 48 + size 36 for collapsed SideNav).
|
|
21
|
+
*/
|
|
22
|
+
frameSize?: number;
|
|
23
|
+
/** Rounded tile fill. @default LOGO_MARK_ROUNDED_TILE */
|
|
24
|
+
tileColor?: string;
|
|
25
|
+
/** Glyph fill on the tile. @default white */
|
|
26
|
+
glyphColor?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Accessible name when the mark is standalone (collapsed nav, favicon).
|
|
29
|
+
* Omit or pass `""` when decorative inside a labeled lockup or link.
|
|
30
|
+
*/
|
|
31
|
+
alt?: string;
|
|
32
|
+
className?: string;
|
|
33
|
+
style?: CSSProperties;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Fairmint FT mark on a rounded square — preferred collapsed SideNav / app-icon lockup.
|
|
37
|
+
* Source geometry: FT Mark Rounded Square. The purple tile fills `size`; optional
|
|
38
|
+
* `frameSize` adds transparent padding around it.
|
|
39
|
+
*/
|
|
40
|
+
export declare function FairmintLogoMarkRounded({ size, frameSize, tileColor, glyphColor, alt, className, style, }: FairmintLogoMarkRoundedProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
//# sourceMappingURL=FairmintLogoMarkRounded.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FairmintLogoMarkRounded.d.ts","sourceRoot":"","sources":["../../../src/components/FairmintLogo/FairmintLogoMarkRounded.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C,uEAAuE;AACvE,eAAO,MAAM,yBAAyB;;;CAAqC,CAAC;AAE5E,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,WAA6B,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAChD,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C,MAAM,WAAW,4BAA4B;IAC3C,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,IAAS,EACT,SAAS,EACT,SAAkC,EAClC,UAA4B,EAC5B,GAAG,EACH,SAAS,EACT,KAAK,GACN,EAAE,4BAA4B,2CAuD9B"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { logoColors, logoFills } from "../../theme/logo.js";
|
|
3
|
+
const LOGO_MARK_ROUNDED_VIEWBOX = { width: 36, height: 36 };
|
|
4
|
+
const LOGO_MARK_ROUNDED_TILE = logoColors.markRoundedTile;
|
|
5
|
+
const SIDE_NAV_COLLAPSED_LOGO_FRAME = 48;
|
|
6
|
+
const SIDE_NAV_COLLAPSED_LOGO_SIZE = 36;
|
|
7
|
+
function FairmintLogoMarkRounded({
|
|
8
|
+
size = 32,
|
|
9
|
+
frameSize,
|
|
10
|
+
tileColor = LOGO_MARK_ROUNDED_TILE,
|
|
11
|
+
glyphColor = logoFills.white,
|
|
12
|
+
alt,
|
|
13
|
+
className,
|
|
14
|
+
style
|
|
15
|
+
}) {
|
|
16
|
+
const isDecorative = !alt;
|
|
17
|
+
const resolvedFrame = frameSize && frameSize > size ? frameSize : void 0;
|
|
18
|
+
const mark = /* @__PURE__ */ jsxs(
|
|
19
|
+
"svg",
|
|
20
|
+
{
|
|
21
|
+
viewBox: `0 0 ${LOGO_MARK_ROUNDED_VIEWBOX.width} ${LOGO_MARK_ROUNDED_VIEWBOX.height}`,
|
|
22
|
+
width: size,
|
|
23
|
+
height: size,
|
|
24
|
+
className: resolvedFrame ? void 0 : className,
|
|
25
|
+
style: { display: "block", flexShrink: 0, ...resolvedFrame ? void 0 : style },
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
"aria-hidden": isDecorative || void 0,
|
|
28
|
+
role: isDecorative ? void 0 : "img",
|
|
29
|
+
"aria-label": isDecorative ? void 0 : alt,
|
|
30
|
+
children: [
|
|
31
|
+
!isDecorative && /* @__PURE__ */ jsx("title", { children: alt }),
|
|
32
|
+
/* @__PURE__ */ jsx("rect", { width: "36", height: "36", rx: "8", fill: tileColor }),
|
|
33
|
+
/* @__PURE__ */ jsxs("g", { transform: "translate(18 18.07) scale(1.12) translate(-18 -18.07)", children: [
|
|
34
|
+
/* @__PURE__ */ jsx("path", { d: "M12.4661 20.3562V26.446H15.1251V18.7954L12.4661 20.3562Z", fill: glyphColor }),
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
"path",
|
|
37
|
+
{
|
|
38
|
+
d: "M22.5714 22.7206V18.7932L19.9113 20.354V22.9428C19.9113 25.447 20.5768 26.7091 23.391 26.7091C24.0115 26.7091 24.9416 26.6194 25.4954 26.3556V24.1164C25.1627 24.3598 24.5198 24.4499 24.055 24.4499C22.8819 24.4499 22.5714 23.7836 22.5714 22.7206Z",
|
|
39
|
+
fill: glyphColor
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
"path",
|
|
44
|
+
{
|
|
45
|
+
d: "M16.4329 9.42847C13.1307 9.42847 12.4656 11.3557 12.4656 14.3028V15.822H15.1254V13.8818C15.1254 12.7079 15.3456 11.6881 16.8315 11.6881C17.2086 11.6881 17.5629 11.7555 17.9388 11.8445L18.1148 9.5829C17.5625 9.47197 17.0071 9.42847 16.4329 9.42847Z",
|
|
46
|
+
fill: glyphColor
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ jsx("path", { d: "M22.5714 12.7273H19.9113V15.8081H22.5714V12.7273Z", fill: glyphColor }),
|
|
50
|
+
/* @__PURE__ */ jsx("path", { d: "M25.7283 15.8218H10.2717V18.0841H25.7283V15.8218Z", fill: glyphColor })
|
|
51
|
+
] })
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
if (!resolvedFrame) {
|
|
56
|
+
return mark;
|
|
57
|
+
}
|
|
58
|
+
return /* @__PURE__ */ jsx(
|
|
59
|
+
"span",
|
|
60
|
+
{
|
|
61
|
+
className,
|
|
62
|
+
style: {
|
|
63
|
+
display: "inline-flex",
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
justifyContent: "center",
|
|
66
|
+
width: resolvedFrame,
|
|
67
|
+
height: resolvedFrame,
|
|
68
|
+
flexShrink: 0,
|
|
69
|
+
...style
|
|
70
|
+
},
|
|
71
|
+
children: mark
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
FairmintLogoMarkRounded,
|
|
77
|
+
LOGO_MARK_ROUNDED_TILE,
|
|
78
|
+
LOGO_MARK_ROUNDED_VIEWBOX,
|
|
79
|
+
SIDE_NAV_COLLAPSED_LOGO_FRAME,
|
|
80
|
+
SIDE_NAV_COLLAPSED_LOGO_SIZE
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=FairmintLogoMarkRounded.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FairmintLogoMarkRounded.js","sources":["../../../src/components/FairmintLogo/FairmintLogoMarkRounded.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport { logoColors, logoFills } from \"../../theme/logo\";\n\n/** Product FT mark — rounded square tile from the brand icon asset. */\nexport const LOGO_MARK_ROUNDED_VIEWBOX = { width: 36, height: 36 } as const;\n\n/** Default tile fill from the FT Mark Rounded Square source asset. */\nexport const LOGO_MARK_ROUNDED_TILE = logoColors.markRoundedTile;\n\n/**\n * Collapsed SideNav layout: 48×48 frame with a 36×36 mark centered inside\n * (white/transparent padding around the tile).\n */\nexport const SIDE_NAV_COLLAPSED_LOGO_FRAME = 48;\nexport const SIDE_NAV_COLLAPSED_LOGO_SIZE = 36;\n\nexport interface FairmintLogoMarkRoundedProps {\n /** Square size of the filled tile in pixels. @default 32 */\n size?: number;\n /**\n * Outer frame size. When set larger than `size`, centers the tile in a\n * transparent square (e.g. frame 48 + size 36 for collapsed SideNav).\n */\n frameSize?: number;\n /** Rounded tile fill. @default LOGO_MARK_ROUNDED_TILE */\n tileColor?: string;\n /** Glyph fill on the tile. @default white */\n glyphColor?: string;\n /**\n * Accessible name when the mark is standalone (collapsed nav, favicon).\n * Omit or pass `\"\"` when decorative inside a labeled lockup or link.\n */\n alt?: string;\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * Fairmint FT mark on a rounded square — preferred collapsed SideNav / app-icon lockup.\n * Source geometry: FT Mark Rounded Square. The purple tile fills `size`; optional\n * `frameSize` adds transparent padding around it.\n */\nexport function FairmintLogoMarkRounded({\n size = 32,\n frameSize,\n tileColor = LOGO_MARK_ROUNDED_TILE,\n glyphColor = logoFills.white,\n alt,\n className,\n style,\n}: FairmintLogoMarkRoundedProps) {\n const isDecorative = !alt;\n const resolvedFrame = frameSize && frameSize > size ? frameSize : undefined;\n\n const mark = (\n <svg\n viewBox={`0 0 ${LOGO_MARK_ROUNDED_VIEWBOX.width} ${LOGO_MARK_ROUNDED_VIEWBOX.height}`}\n width={size}\n height={size}\n className={resolvedFrame ? undefined : className}\n style={{ display: \"block\", flexShrink: 0, ...(resolvedFrame ? undefined : style) }}\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden={isDecorative || undefined}\n role={isDecorative ? undefined : \"img\"}\n aria-label={isDecorative ? undefined : alt}\n >\n {!isDecorative && <title>{alt}</title>}\n {/* Tile fills the viewBox — padding belongs on `frameSize`, not inside the SVG. */}\n <rect width=\"36\" height=\"36\" rx=\"8\" fill={tileColor} />\n <g transform=\"translate(18 18.07) scale(1.12) translate(-18 -18.07)\">\n <path d=\"M12.4661 20.3562V26.446H15.1251V18.7954L12.4661 20.3562Z\" fill={glyphColor} />\n <path\n d=\"M22.5714 22.7206V18.7932L19.9113 20.354V22.9428C19.9113 25.447 20.5768 26.7091 23.391 26.7091C24.0115 26.7091 24.9416 26.6194 25.4954 26.3556V24.1164C25.1627 24.3598 24.5198 24.4499 24.055 24.4499C22.8819 24.4499 22.5714 23.7836 22.5714 22.7206Z\"\n fill={glyphColor}\n />\n <path\n d=\"M16.4329 9.42847C13.1307 9.42847 12.4656 11.3557 12.4656 14.3028V15.822H15.1254V13.8818C15.1254 12.7079 15.3456 11.6881 16.8315 11.6881C17.2086 11.6881 17.5629 11.7555 17.9388 11.8445L18.1148 9.5829C17.5625 9.47197 17.0071 9.42847 16.4329 9.42847Z\"\n fill={glyphColor}\n />\n <path d=\"M22.5714 12.7273H19.9113V15.8081H22.5714V12.7273Z\" fill={glyphColor} />\n <path d=\"M25.7283 15.8218H10.2717V18.0841H25.7283V15.8218Z\" fill={glyphColor} />\n </g>\n </svg>\n );\n\n if (!resolvedFrame) {\n return mark;\n }\n\n return (\n <span\n className={className}\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: resolvedFrame,\n height: resolvedFrame,\n flexShrink: 0,\n ...style,\n }}\n >\n {mark}\n </span>\n );\n}\n"],"names":[],"mappings":";;AAIO,MAAM,4BAA4B,EAAE,OAAO,IAAI,QAAQ,GAAA;AAGvD,MAAM,yBAAyB,WAAW;AAM1C,MAAM,gCAAgC;AACtC,MAAM,+BAA+B;AA4BrC,SAAS,wBAAwB;AAAA,EACtC,OAAO;AAAA,EACP;AAAA,EACA,YAAY;AAAA,EACZ,aAAa,UAAU;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACF,GAAiC;AAC/B,QAAM,eAAe,CAAC;AACtB,QAAM,gBAAgB,aAAa,YAAY,OAAO,YAAY;AAElE,QAAM,OACJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,OAAO,0BAA0B,KAAK,IAAI,0BAA0B,MAAM;AAAA,MACnF,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,WAAW,gBAAgB,SAAY;AAAA,MACvC,OAAO,EAAE,SAAS,SAAS,YAAY,GAAG,GAAI,gBAAgB,SAAY,MAAA;AAAA,MAC1E,OAAM;AAAA,MACN,eAAa,gBAAgB;AAAA,MAC7B,MAAM,eAAe,SAAY;AAAA,MACjC,cAAY,eAAe,SAAY;AAAA,MAEtC,UAAA;AAAA,QAAA,CAAC,gBAAgB,oBAAC,SAAA,EAAO,UAAA,IAAA,CAAI;AAAA,QAE9B,oBAAC,UAAK,OAAM,MAAK,QAAO,MAAK,IAAG,KAAI,MAAM,UAAA,CAAW;AAAA,QACrD,qBAAC,KAAA,EAAE,WAAU,yDACX,UAAA;AAAA,UAAA,oBAAC,QAAA,EAAK,GAAE,4DAA2D,MAAM,YAAY;AAAA,UACrF;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,GAAE;AAAA,cACF,MAAM;AAAA,YAAA;AAAA,UAAA;AAAA,UAER;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,GAAE;AAAA,cACF,MAAM;AAAA,YAAA;AAAA,UAAA;AAAA,UAER,oBAAC,QAAA,EAAK,GAAE,qDAAoD,MAAM,YAAY;AAAA,UAC9E,oBAAC,QAAA,EAAK,GAAE,qDAAoD,MAAM,WAAA,CAAY;AAAA,QAAA,EAAA,CAChF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ,MAAI,CAAC,eAAe;AAClB,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,OAAO;AAAA,QACL,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,gBAAgB;AAAA,QAChB,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,YAAY;AAAA,QACZ,GAAG;AAAA,MAAA;AAAA,MAGJ,UAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -3,15 +3,143 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const index = require("../../../theme/index.cjs");
|
|
6
|
+
const useUncontrolled = require("../../../node_modules/@mantine/hooks/esm/use-uncontrolled/use-uncontrolled.cjs");
|
|
6
7
|
const Stack = require("../../../node_modules/@mantine/core/esm/components/Stack/Stack.cjs");
|
|
7
|
-
const
|
|
8
|
+
const Box = require("../../../node_modules/@mantine/core/esm/core/Box/Box.cjs");
|
|
9
|
+
const Group = require("../../../node_modules/@mantine/core/esm/components/Group/Group.cjs");
|
|
10
|
+
const Divider = require("../../../node_modules/@mantine/core/esm/components/Divider/Divider.cjs");
|
|
11
|
+
const UnstyledButton = require("../../../node_modules/@mantine/core/esm/components/UnstyledButton/UnstyledButton.cjs");
|
|
12
|
+
const IconLayoutSidebarLeftExpand = require("../../../node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutSidebarLeftExpand.cjs");
|
|
13
|
+
const IconLayoutSidebarLeftCollapse = require("../../../node_modules/@tabler/icons-react/dist/esm/icons/IconLayoutSidebarLeftCollapse.cjs");
|
|
14
|
+
const Tooltip = require("../../../node_modules/@mantine/core/esm/components/Tooltip/Tooltip.cjs");
|
|
15
|
+
const ActionIcon = require("../../../node_modules/@mantine/core/esm/components/ActionIcon/ActionIcon.cjs");
|
|
16
|
+
const Menu = require("../../../node_modules/@mantine/core/esm/components/Menu/Menu.cjs");
|
|
8
17
|
const NavLink = require("../../../node_modules/@mantine/core/esm/components/NavLink/NavLink.cjs");
|
|
18
|
+
const SIDE_NAV_WIDTH = 260;
|
|
19
|
+
const SIDE_NAV_COLLAPSED_WIDTH = 80;
|
|
9
20
|
function hasActiveDescendant(item) {
|
|
10
21
|
return item.children?.some((child) => child.active || hasActiveDescendant(child)) ?? false;
|
|
11
22
|
}
|
|
12
|
-
function
|
|
23
|
+
function getSideNavItemLabelText(item) {
|
|
24
|
+
if (item.ariaLabel) {
|
|
25
|
+
return item.ariaLabel;
|
|
26
|
+
}
|
|
27
|
+
if (typeof item.label === "string") {
|
|
28
|
+
return item.label;
|
|
29
|
+
}
|
|
30
|
+
if (typeof item.label === "number") {
|
|
31
|
+
return String(item.label);
|
|
32
|
+
}
|
|
33
|
+
return "Item";
|
|
34
|
+
}
|
|
35
|
+
function getSideNavLetterFallback(labelText) {
|
|
36
|
+
const match = labelText.match(/[\p{L}\p{N}]/u);
|
|
37
|
+
return match ? match[0].toUpperCase() : "?";
|
|
38
|
+
}
|
|
39
|
+
function LetterFallback({ letter, active = false }) {
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
41
|
+
Box.Box,
|
|
42
|
+
{
|
|
43
|
+
component: "span",
|
|
44
|
+
"aria-hidden": true,
|
|
45
|
+
"data-active": active || void 0,
|
|
46
|
+
style: {
|
|
47
|
+
display: "inline-flex",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
justifyContent: "center",
|
|
50
|
+
width: 20,
|
|
51
|
+
height: 20,
|
|
52
|
+
flexShrink: 0,
|
|
53
|
+
fontSize: 12,
|
|
54
|
+
fontWeight: active ? 700 : 600,
|
|
55
|
+
lineHeight: 1,
|
|
56
|
+
// Selected chrome lives on the parent control — glyph matches icon sizing.
|
|
57
|
+
color: active ? index.fairmintVars.colorIconOnSurfaceSelected : "inherit"
|
|
58
|
+
},
|
|
59
|
+
children: letter
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function CollapseToggle({
|
|
64
|
+
collapsed,
|
|
65
|
+
onToggle,
|
|
66
|
+
visible
|
|
67
|
+
}) {
|
|
68
|
+
const label = collapsed ? "Expand navigation" : "Collapse navigation";
|
|
69
|
+
const Icon = collapsed ? IconLayoutSidebarLeftExpand.default : IconLayoutSidebarLeftCollapse.default;
|
|
70
|
+
const button = /* @__PURE__ */ jsxRuntime.jsx(
|
|
71
|
+
UnstyledButton.UnstyledButton,
|
|
72
|
+
{
|
|
73
|
+
"data-sidenav-collapse": true,
|
|
74
|
+
"aria-label": label,
|
|
75
|
+
"aria-expanded": !collapsed,
|
|
76
|
+
onClick: onToggle,
|
|
77
|
+
style: {
|
|
78
|
+
display: "inline-flex",
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
justifyContent: "center",
|
|
81
|
+
height: 32,
|
|
82
|
+
flexShrink: 0,
|
|
83
|
+
borderRadius: index.radii.md,
|
|
84
|
+
color: index.fairmintVars.colorIconTertiary,
|
|
85
|
+
opacity: visible ? 1 : 0,
|
|
86
|
+
pointerEvents: visible ? "auto" : "none",
|
|
87
|
+
transition: "opacity 120ms ease",
|
|
88
|
+
// Keep a layout slot when expanded so the wordmark does not shift on hover.
|
|
89
|
+
// Collapsed: always a fixed control below the logo.
|
|
90
|
+
width: 32,
|
|
91
|
+
overflow: "hidden",
|
|
92
|
+
padding: 0
|
|
93
|
+
},
|
|
94
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 20, stroke: 1.5, "aria-hidden": true })
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
if (!collapsed) {
|
|
98
|
+
return button;
|
|
99
|
+
}
|
|
100
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
101
|
+
Tooltip.Tooltip,
|
|
102
|
+
{
|
|
103
|
+
label,
|
|
104
|
+
position: "right",
|
|
105
|
+
withArrow: true,
|
|
106
|
+
events: { hover: true, focus: true, touch: true },
|
|
107
|
+
disabled: !visible,
|
|
108
|
+
children: button
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
function resolveLeftSection(item, labelText, { requireIcon, active }) {
|
|
113
|
+
if (item.icon) {
|
|
114
|
+
return item.icon;
|
|
115
|
+
}
|
|
116
|
+
if (requireIcon) {
|
|
117
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LetterFallback, { letter: getSideNavLetterFallback(labelText), active: Boolean(active) });
|
|
118
|
+
}
|
|
119
|
+
return void 0;
|
|
120
|
+
}
|
|
121
|
+
const COLLAPSED_ITEM_SIZE = 36;
|
|
122
|
+
const navLinkStyles = (active) => ({
|
|
123
|
+
root: {
|
|
124
|
+
color: active ? index.fairmintVars.colorTextPrimary : index.fairmintVars.colorTextSecondary,
|
|
125
|
+
fontWeight: active ? 500 : 400,
|
|
126
|
+
borderRadius: index.radii.md,
|
|
127
|
+
// Prefer Fairmint selected surface over Mantine defaults for active chrome.
|
|
128
|
+
...active ? {
|
|
129
|
+
"--nl-bg": index.fairmintVars.colorSurfaceSelected,
|
|
130
|
+
"--nl-hover": index.fairmintVars.colorSurfaceSelected,
|
|
131
|
+
"--nl-color": index.fairmintVars.colorIconOnSurfaceSelected,
|
|
132
|
+
backgroundColor: index.fairmintVars.colorSurfaceSelected
|
|
133
|
+
} : {}
|
|
134
|
+
},
|
|
135
|
+
section: {
|
|
136
|
+
color: active ? index.fairmintVars.colorIconOnSurfaceSelected : index.fairmintVars.colorIconTertiary
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
function ExpandedSideNavNode({ color, item, onItemClick }) {
|
|
13
140
|
const containsActiveItem = hasActiveDescendant(item);
|
|
14
141
|
const [opened, setOpened] = React.useState(item.open ?? containsActiveItem);
|
|
142
|
+
const labelText = getSideNavItemLabelText(item);
|
|
15
143
|
React.useEffect(() => {
|
|
16
144
|
if (item.open !== void 0) {
|
|
17
145
|
setOpened(item.open);
|
|
@@ -23,8 +151,13 @@ function SideNavNode({ color, item, onItemClick }) {
|
|
|
23
151
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
152
|
NavLink.NavLink,
|
|
25
153
|
{
|
|
154
|
+
component: "button",
|
|
155
|
+
type: "button",
|
|
26
156
|
label: item.label,
|
|
27
|
-
leftSection: item
|
|
157
|
+
leftSection: resolveLeftSection(item, labelText, {
|
|
158
|
+
requireIcon: false,
|
|
159
|
+
active: item.active
|
|
160
|
+
}),
|
|
28
161
|
rightSection: item.rightSection,
|
|
29
162
|
active: item.active,
|
|
30
163
|
disabled: item.disabled,
|
|
@@ -32,20 +165,125 @@ function SideNavNode({ color, item, onItemClick }) {
|
|
|
32
165
|
variant: "light",
|
|
33
166
|
childrenOffset: 16,
|
|
34
167
|
opened: hasChildren ? opened : void 0,
|
|
168
|
+
"aria-label": item.ariaLabel,
|
|
35
169
|
onClick: hasChildren ? () => setOpened((currentOpened) => !currentOpened) : () => onItemClick(item.id),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
170
|
+
styles: navLinkStyles(item.active),
|
|
171
|
+
children: item.children?.map((child) => /* @__PURE__ */ jsxRuntime.jsx(ExpandedSideNavNode, { item: child, color, onItemClick }, child.id))
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
function collectCollapsedMenuLeaves(items) {
|
|
176
|
+
return items.flatMap(
|
|
177
|
+
(item) => item.children?.length ? collectCollapsedMenuLeaves(item.children) : [item]
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
function CollapsedNestedMenuItems({
|
|
181
|
+
items,
|
|
182
|
+
onItemClick,
|
|
183
|
+
color
|
|
184
|
+
}) {
|
|
185
|
+
return collectCollapsedMenuLeaves(items).map((child) => {
|
|
186
|
+
const childLabel = getSideNavItemLabelText(child);
|
|
187
|
+
const isActive = Boolean(child.active);
|
|
188
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
189
|
+
Menu.Menu.Item,
|
|
190
|
+
{
|
|
191
|
+
disabled: child.disabled,
|
|
192
|
+
leftSection: resolveLeftSection(child, childLabel, {
|
|
193
|
+
requireIcon: true,
|
|
194
|
+
active: isActive
|
|
195
|
+
}),
|
|
196
|
+
onClick: () => onItemClick(child.id),
|
|
197
|
+
"aria-current": isActive ? "page" : void 0,
|
|
198
|
+
"data-active": isActive || void 0,
|
|
199
|
+
color: isActive ? color : void 0,
|
|
200
|
+
style: isActive ? {
|
|
201
|
+
backgroundColor: index.fairmintVars.colorSurfaceSelected,
|
|
202
|
+
color: index.fairmintVars.colorIconOnSurfaceSelected,
|
|
203
|
+
fontWeight: 600
|
|
204
|
+
} : void 0,
|
|
205
|
+
children: child.label
|
|
206
|
+
},
|
|
207
|
+
child.id
|
|
208
|
+
);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function CollapsedSideNavNode({ color, item, onItemClick }) {
|
|
212
|
+
const labelText = getSideNavItemLabelText(item);
|
|
213
|
+
const hasChildren = Boolean(item.children?.length);
|
|
214
|
+
const isActive = Boolean(item.active || hasActiveDescendant(item));
|
|
215
|
+
const leftSection = resolveLeftSection(item, labelText, {
|
|
216
|
+
requireIcon: true,
|
|
217
|
+
active: isActive
|
|
218
|
+
});
|
|
219
|
+
const link = /* @__PURE__ */ jsxRuntime.jsx(
|
|
220
|
+
ActionIcon.ActionIcon,
|
|
221
|
+
{
|
|
222
|
+
type: "button",
|
|
223
|
+
variant: "subtle",
|
|
224
|
+
color,
|
|
225
|
+
size: COLLAPSED_ITEM_SIZE,
|
|
226
|
+
radius: "md",
|
|
227
|
+
disabled: item.disabled,
|
|
228
|
+
"aria-label": labelText,
|
|
229
|
+
"aria-current": isActive ? "page" : void 0,
|
|
230
|
+
"data-active": isActive || void 0,
|
|
231
|
+
onClick: hasChildren ? void 0 : () => onItemClick(item.id),
|
|
232
|
+
style: {
|
|
233
|
+
width: COLLAPSED_ITEM_SIZE,
|
|
234
|
+
height: COLLAPSED_ITEM_SIZE,
|
|
235
|
+
minWidth: COLLAPSED_ITEM_SIZE,
|
|
236
|
+
minHeight: COLLAPSED_ITEM_SIZE,
|
|
237
|
+
...isActive ? {
|
|
238
|
+
"--ai-bg": index.fairmintVars.colorSurfaceSelected,
|
|
239
|
+
"--ai-hover": index.fairmintVars.colorSurfaceSelected,
|
|
240
|
+
"--ai-color": index.fairmintVars.colorIconOnSurfaceSelected,
|
|
241
|
+
"--ai-hover-color": index.fairmintVars.colorIconOnSurfaceSelected,
|
|
242
|
+
backgroundColor: index.fairmintVars.colorSurfaceSelected,
|
|
243
|
+
color: index.fairmintVars.colorIconOnSurfaceSelected
|
|
244
|
+
} : {
|
|
245
|
+
color: index.fairmintVars.colorIconTertiary
|
|
44
246
|
}
|
|
45
247
|
},
|
|
46
|
-
children:
|
|
248
|
+
children: leftSection
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
const control = hasChildren ? /* @__PURE__ */ jsxRuntime.jsxs(Menu.Menu, { position: "right-start", offset: 8, withinPortal: true, children: [
|
|
252
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
253
|
+
Tooltip.Tooltip,
|
|
254
|
+
{
|
|
255
|
+
label: labelText,
|
|
256
|
+
position: "right",
|
|
257
|
+
withArrow: true,
|
|
258
|
+
events: { hover: true, focus: true, touch: true },
|
|
259
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Target, { children: link })
|
|
260
|
+
}
|
|
261
|
+
),
|
|
262
|
+
/* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Dropdown, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
263
|
+
CollapsedNestedMenuItems,
|
|
264
|
+
{
|
|
265
|
+
items: item.children ?? [],
|
|
266
|
+
onItemClick,
|
|
267
|
+
color
|
|
268
|
+
}
|
|
269
|
+
) })
|
|
270
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
271
|
+
Tooltip.Tooltip,
|
|
272
|
+
{
|
|
273
|
+
label: labelText,
|
|
274
|
+
position: "right",
|
|
275
|
+
withArrow: true,
|
|
276
|
+
events: { hover: true, focus: true, touch: true },
|
|
277
|
+
children: link
|
|
47
278
|
}
|
|
48
279
|
);
|
|
280
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box.Box, { style: { width: "100%", display: "flex", justifyContent: "center" }, children: control });
|
|
281
|
+
}
|
|
282
|
+
function SideNavNode(props) {
|
|
283
|
+
if (props.collapsed) {
|
|
284
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CollapsedSideNavNode, { ...props });
|
|
285
|
+
}
|
|
286
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ExpandedSideNavNode, { ...props });
|
|
49
287
|
}
|
|
50
288
|
function SideNav({
|
|
51
289
|
items = [],
|
|
@@ -53,28 +291,133 @@ function SideNav({
|
|
|
53
291
|
onItemClick,
|
|
54
292
|
color = "indigo",
|
|
55
293
|
ariaLabel = "Main navigation",
|
|
56
|
-
withBorder = false
|
|
294
|
+
withBorder = false,
|
|
295
|
+
header,
|
|
296
|
+
cta,
|
|
297
|
+
profile,
|
|
298
|
+
footer,
|
|
299
|
+
collapsed,
|
|
300
|
+
defaultCollapsed = false,
|
|
301
|
+
onCollapsedChange,
|
|
302
|
+
collapsible = false
|
|
57
303
|
}) {
|
|
58
304
|
const resolvedSections = sections ?? [{ id: "main", items }];
|
|
59
|
-
|
|
305
|
+
const [collapsedState, setCollapsedState] = useUncontrolled.useUncontrolled({
|
|
306
|
+
value: collapsed,
|
|
307
|
+
defaultValue: defaultCollapsed,
|
|
308
|
+
finalValue: false,
|
|
309
|
+
onChange: onCollapsedChange
|
|
310
|
+
});
|
|
311
|
+
const hasBottomChrome = Boolean(footer || cta || profile);
|
|
312
|
+
const [headerHovered, setHeaderHovered] = React.useState(false);
|
|
313
|
+
const showExpandedCollapseControl = headerHovered;
|
|
314
|
+
const showHeaderChrome = Boolean(header) || collapsible;
|
|
315
|
+
const collapseToggle = collapsible ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
316
|
+
CollapseToggle,
|
|
317
|
+
{
|
|
318
|
+
collapsed: collapsedState,
|
|
319
|
+
visible: collapsedState ? true : showExpandedCollapseControl,
|
|
320
|
+
onToggle: () => setCollapsedState(!collapsedState)
|
|
321
|
+
}
|
|
322
|
+
) : null;
|
|
323
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
60
324
|
Stack.Stack,
|
|
61
325
|
{
|
|
62
326
|
component: "nav",
|
|
63
327
|
gap: "md",
|
|
64
328
|
h: "100%",
|
|
65
|
-
p: "md",
|
|
329
|
+
p: collapsedState ? "sm" : "md",
|
|
66
330
|
"aria-label": ariaLabel,
|
|
331
|
+
"data-collapsed": collapsedState || void 0,
|
|
67
332
|
style: {
|
|
68
333
|
borderRight: withBorder ? "1px solid" : void 0,
|
|
69
334
|
borderRightColor: withBorder ? index.fairmintVars.colorBorderDefault : void 0,
|
|
70
335
|
boxShadow: "none"
|
|
71
336
|
},
|
|
72
|
-
children:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
337
|
+
children: [
|
|
338
|
+
showHeaderChrome ? collapsedState ? /* @__PURE__ */ jsxRuntime.jsxs(Stack.Stack, { gap: 6, align: "center", children: [
|
|
339
|
+
header ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
340
|
+
Box.Box,
|
|
341
|
+
{
|
|
342
|
+
style: {
|
|
343
|
+
display: "flex",
|
|
344
|
+
alignItems: "center",
|
|
345
|
+
justifyContent: "center",
|
|
346
|
+
width: "100%"
|
|
347
|
+
},
|
|
348
|
+
children: header
|
|
349
|
+
}
|
|
350
|
+
) : null,
|
|
351
|
+
collapseToggle
|
|
352
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
353
|
+
Group.Group,
|
|
354
|
+
{
|
|
355
|
+
justify: "space-between",
|
|
356
|
+
wrap: "nowrap",
|
|
357
|
+
gap: "xs",
|
|
358
|
+
align: "center",
|
|
359
|
+
style: { minHeight: 32 },
|
|
360
|
+
onMouseEnter: () => setHeaderHovered(true),
|
|
361
|
+
onMouseLeave: () => setHeaderHovered(false),
|
|
362
|
+
onFocusCapture: () => setHeaderHovered(true),
|
|
363
|
+
onBlurCapture: (event) => {
|
|
364
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
365
|
+
setHeaderHovered(false);
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
children: [
|
|
369
|
+
header ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
370
|
+
Box.Box,
|
|
371
|
+
{
|
|
372
|
+
style: {
|
|
373
|
+
flex: 1,
|
|
374
|
+
minWidth: 0,
|
|
375
|
+
overflow: "hidden",
|
|
376
|
+
display: "flex",
|
|
377
|
+
alignItems: "center",
|
|
378
|
+
justifyContent: "flex-start"
|
|
379
|
+
},
|
|
380
|
+
children: header
|
|
381
|
+
}
|
|
382
|
+
) : null,
|
|
383
|
+
collapseToggle
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
) : null,
|
|
387
|
+
/* @__PURE__ */ jsxRuntime.jsx(Stack.Stack, { gap: 4, style: { flex: 1, minHeight: 0, overflow: "auto" }, children: resolvedSections.flatMap(
|
|
388
|
+
(section) => section.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
389
|
+
SideNavNode,
|
|
390
|
+
{
|
|
391
|
+
item,
|
|
392
|
+
color,
|
|
393
|
+
onItemClick,
|
|
394
|
+
collapsed: collapsedState
|
|
395
|
+
},
|
|
396
|
+
`${section.id}:${item.id}`
|
|
397
|
+
))
|
|
398
|
+
) }),
|
|
399
|
+
hasBottomChrome ? /* @__PURE__ */ jsxRuntime.jsx(Stack.Stack, { gap: "sm", style: { flexShrink: 0 }, children: footer ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
400
|
+
cta ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
401
|
+
Box.Box,
|
|
402
|
+
{
|
|
403
|
+
style: {
|
|
404
|
+
width: "100%",
|
|
405
|
+
display: "flex",
|
|
406
|
+
justifyContent: collapsedState ? "center" : "stretch"
|
|
407
|
+
},
|
|
408
|
+
children: cta
|
|
409
|
+
}
|
|
410
|
+
) : null,
|
|
411
|
+
cta && profile ? /* @__PURE__ */ jsxRuntime.jsx(Divider.Divider, { color: index.fairmintVars.colorBorderDefault }) : null,
|
|
412
|
+
profile ? /* @__PURE__ */ jsxRuntime.jsx(Box.Box, { style: { width: "100%" }, children: profile }) : null
|
|
413
|
+
] }) }) : null
|
|
414
|
+
]
|
|
76
415
|
}
|
|
77
416
|
);
|
|
78
417
|
}
|
|
418
|
+
exports.SIDE_NAV_COLLAPSED_WIDTH = SIDE_NAV_COLLAPSED_WIDTH;
|
|
419
|
+
exports.SIDE_NAV_WIDTH = SIDE_NAV_WIDTH;
|
|
79
420
|
exports.SideNav = SideNav;
|
|
421
|
+
exports.getSideNavItemLabelText = getSideNavItemLabelText;
|
|
422
|
+
exports.getSideNavLetterFallback = getSideNavLetterFallback;
|
|
80
423
|
//# sourceMappingURL=SideNav.cjs.map
|