@fairmint/ui 0.3.32 → 0.3.33
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/_virtual/index3.cjs +5 -3
- package/dist/_virtual/index3.cjs.map +1 -1
- package/dist/_virtual/index3.js +5 -2
- package/dist/_virtual/index3.js.map +1 -1
- package/dist/_virtual/index4.cjs +3 -5
- package/dist/_virtual/index4.cjs.map +1 -1
- package/dist/_virtual/index4.js +2 -5
- package/dist/_virtual/index4.js.map +1 -1
- package/dist/components/generic/BottomSheet/BottomSheet.cjs +133 -0
- package/dist/components/generic/BottomSheet/BottomSheet.cjs.map +1 -0
- package/dist/components/generic/BottomSheet/BottomSheet.d.ts +31 -0
- package/dist/components/generic/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/dist/components/generic/BottomSheet/BottomSheet.js +133 -0
- package/dist/components/generic/BottomSheet/BottomSheet.js.map +1 -0
- package/dist/components/layout/AccountSheet/AccountSheet.cjs +123 -0
- package/dist/components/layout/AccountSheet/AccountSheet.cjs.map +1 -0
- package/dist/components/layout/AccountSheet/AccountSheet.d.ts +46 -0
- package/dist/components/layout/AccountSheet/AccountSheet.d.ts.map +1 -0
- package/dist/components/layout/AccountSheet/AccountSheet.js +123 -0
- package/dist/components/layout/AccountSheet/AccountSheet.js.map +1 -0
- package/dist/components/layout/MobileNav/MobileNav.cjs +267 -0
- package/dist/components/layout/MobileNav/MobileNav.cjs.map +1 -0
- package/dist/components/layout/MobileNav/MobileNav.d.ts +49 -0
- package/dist/components/layout/MobileNav/MobileNav.d.ts.map +1 -0
- package/dist/components/layout/MobileNav/MobileNav.js +267 -0
- package/dist/components/layout/MobileNav/MobileNav.js.map +1 -0
- package/dist/fairmint-ui.cjs +9 -0
- package/dist/fairmint-ui.cjs.map +1 -1
- package/dist/fairmint-ui.js +9 -0
- package/dist/fairmint-ui.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.cjs +1 -1
- package/dist/node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.js +1 -1
- package/dist/node_modules/prop-types/index.cjs +1 -1
- package/dist/node_modules/prop-types/index.js +1 -1
- package/package.json +1 -1
package/dist/_virtual/index3.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const _commonjsHelpers = require("./_commonjsHelpers.cjs");
|
|
3
|
+
const index = require("../node_modules/fast-deep-equal/index.cjs");
|
|
4
|
+
var fastDeepEqualExports = index.__require();
|
|
5
|
+
const isEqual = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(fastDeepEqualExports);
|
|
6
|
+
module.exports = isEqual;
|
|
5
7
|
//# sourceMappingURL=index3.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index3.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index3.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
package/dist/_virtual/index3.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { getDefaultExportFromCjs } from "./_commonjsHelpers.js";
|
|
2
|
+
import { __require as requireFastDeepEqual } from "../node_modules/fast-deep-equal/index.js";
|
|
3
|
+
var fastDeepEqualExports = requireFastDeepEqual();
|
|
4
|
+
const isEqual = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqualExports);
|
|
2
5
|
export {
|
|
3
|
-
|
|
6
|
+
isEqual as default
|
|
4
7
|
};
|
|
5
8
|
//# sourceMappingURL=index3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/_virtual/index4.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const isEqual = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(fastDeepEqualExports);
|
|
6
|
-
module.exports = isEqual;
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var propTypes = { exports: {} };
|
|
4
|
+
exports.__module = propTypes;
|
|
7
5
|
//# sourceMappingURL=index4.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index4.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index4.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/_virtual/index4.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { __require as requireFastDeepEqual } from "../node_modules/fast-deep-equal/index.js";
|
|
3
|
-
var fastDeepEqualExports = requireFastDeepEqual();
|
|
4
|
-
const isEqual = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqualExports);
|
|
1
|
+
var propTypes = { exports: {} };
|
|
5
2
|
export {
|
|
6
|
-
|
|
3
|
+
propTypes as __module
|
|
7
4
|
};
|
|
8
5
|
//# sourceMappingURL=index4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index4.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index4.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const index = require("../../../theme/index.cjs");
|
|
6
|
+
const zIndex = require("../../../theme/zIndex.cjs");
|
|
7
|
+
const Drawer = require("../../primitives/Drawer/Drawer.cjs");
|
|
8
|
+
const layout = require("../../primitives/layout.cjs");
|
|
9
|
+
const Text = require("../../../node_modules/@mantine/core/esm/components/Text/Text.cjs");
|
|
10
|
+
const UnstyledButton = require("../../../node_modules/@mantine/core/esm/components/UnstyledButton/UnstyledButton.cjs");
|
|
11
|
+
const CLOSE_OUTSIDE_ENABLE_MS = 100;
|
|
12
|
+
function BottomSheetScrollArea({ style, children, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
...props,
|
|
17
|
+
style: {
|
|
18
|
+
...style,
|
|
19
|
+
height: "auto",
|
|
20
|
+
maxHeight: "min(90dvh, 100%)",
|
|
21
|
+
overflow: "auto"
|
|
22
|
+
},
|
|
23
|
+
children
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function SheetGrip({ onDismiss, dismissLabel }) {
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
29
|
+
UnstyledButton.UnstyledButton,
|
|
30
|
+
{
|
|
31
|
+
type: "button",
|
|
32
|
+
"aria-label": dismissLabel,
|
|
33
|
+
onClick: onDismiss,
|
|
34
|
+
style: {
|
|
35
|
+
display: "flex",
|
|
36
|
+
justifyContent: "center",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
width: "100%",
|
|
39
|
+
minHeight: 28,
|
|
40
|
+
paddingTop: 8,
|
|
41
|
+
paddingBottom: 4,
|
|
42
|
+
cursor: "pointer"
|
|
43
|
+
},
|
|
44
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
45
|
+
layout.Box,
|
|
46
|
+
{
|
|
47
|
+
"aria-hidden": true,
|
|
48
|
+
style: {
|
|
49
|
+
width: 36,
|
|
50
|
+
height: 4,
|
|
51
|
+
borderRadius: 999,
|
|
52
|
+
backgroundColor: index.fairmintVars.colorBorderDefault
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
function BottomSheet({
|
|
60
|
+
opened,
|
|
61
|
+
onClose,
|
|
62
|
+
children,
|
|
63
|
+
title,
|
|
64
|
+
withGrip = true,
|
|
65
|
+
dismissLabel = "Dismiss",
|
|
66
|
+
zIndex: zIndex$1 = zIndex.overlayZIndexAboveLegacyShell + 10,
|
|
67
|
+
maxHeight = "90dvh"
|
|
68
|
+
}) {
|
|
69
|
+
const [closeOnClickOutside, setCloseOnClickOutside] = React.useState(false);
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
if (!opened) {
|
|
72
|
+
setCloseOnClickOutside(false);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const timer = window.setTimeout(() => setCloseOnClickOutside(true), CLOSE_OUTSIDE_ENABLE_MS);
|
|
76
|
+
return () => window.clearTimeout(timer);
|
|
77
|
+
}, [opened]);
|
|
78
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
79
|
+
Drawer.Drawer,
|
|
80
|
+
{
|
|
81
|
+
opened,
|
|
82
|
+
onClose,
|
|
83
|
+
position: "bottom",
|
|
84
|
+
size: "100%",
|
|
85
|
+
padding: 0,
|
|
86
|
+
radius: 0,
|
|
87
|
+
zIndex: zIndex$1,
|
|
88
|
+
withOverlay: true,
|
|
89
|
+
withCloseButton: false,
|
|
90
|
+
closeOnClickOutside,
|
|
91
|
+
closeOnEscape: true,
|
|
92
|
+
scrollAreaComponent: BottomSheetScrollArea,
|
|
93
|
+
styles: {
|
|
94
|
+
content: {
|
|
95
|
+
width: "100%",
|
|
96
|
+
maxWidth: "100%",
|
|
97
|
+
height: "auto",
|
|
98
|
+
maxHeight,
|
|
99
|
+
flex: "0 0 100%",
|
|
100
|
+
borderTopLeftRadius: index.radii.lg,
|
|
101
|
+
borderTopRightRadius: index.radii.lg,
|
|
102
|
+
borderTop: `1px solid ${index.fairmintVars.colorBorderDefault}`
|
|
103
|
+
},
|
|
104
|
+
header: {
|
|
105
|
+
display: "none"
|
|
106
|
+
},
|
|
107
|
+
body: {
|
|
108
|
+
height: "auto",
|
|
109
|
+
paddingInline: 16,
|
|
110
|
+
paddingBottom: "max(16px, env(safe-area-inset-bottom))",
|
|
111
|
+
paddingTop: 0
|
|
112
|
+
},
|
|
113
|
+
inner: {
|
|
114
|
+
padding: 0,
|
|
115
|
+
alignItems: "flex-end"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
style: {
|
|
119
|
+
"--drawer-size": "auto",
|
|
120
|
+
"--drawer-height": "auto",
|
|
121
|
+
"--drawer-flex": "0 0 100%",
|
|
122
|
+
"--drawer-offset": "0rem"
|
|
123
|
+
},
|
|
124
|
+
children: [
|
|
125
|
+
withGrip ? /* @__PURE__ */ jsxRuntime.jsx(SheetGrip, { onDismiss: onClose, dismissLabel }) : null,
|
|
126
|
+
typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { fw: 600, size: "md", px: 8, pb: 8, children: title }) : title,
|
|
127
|
+
children
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
exports.BottomSheet = BottomSheet;
|
|
133
|
+
//# sourceMappingURL=BottomSheet.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BottomSheet.cjs","sources":["../../../../src/components/generic/BottomSheet/BottomSheet.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n type ReactNode,\n useEffect,\n useState,\n} from \"react\";\nimport { fairmintVars, radii } from \"../../../theme\";\nimport { overlayZIndexAboveLegacyShell } from \"../../../theme/zIndex\";\nimport { Drawer } from \"../../primitives/Drawer/Drawer\";\nimport { Box, Text, UnstyledButton } from \"../../primitives/layout\";\n\n/**\n * Ignore overlay clicks briefly after open. Opening from another drawer/modal\n * (e.g. MobileNav → AccountSheet) otherwise lets the same pointerup hit the new\n * overlay and dismiss the sheet immediately — flaky on wider viewports.\n */\nconst CLOSE_OUTSIDE_ENABLE_MS = 100;\n\n/**\n * Mantine Drawer forces an inner scroll area to ~100vh; override so the sheet\n * only grows with its content.\n */\nfunction BottomSheetScrollArea({ style, children, ...props }: ComponentPropsWithoutRef<\"div\">) {\n return (\n <div\n {...props}\n style={{\n ...style,\n height: \"auto\",\n maxHeight: \"min(90dvh, 100%)\",\n overflow: \"auto\",\n }}\n >\n {children}\n </div>\n );\n}\n\nfunction SheetGrip({ onDismiss, dismissLabel }: { onDismiss: () => void; dismissLabel: string }) {\n return (\n <UnstyledButton\n type=\"button\"\n aria-label={dismissLabel}\n onClick={onDismiss}\n style={{\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n width: \"100%\",\n minHeight: 28,\n paddingTop: 8,\n paddingBottom: 4,\n cursor: \"pointer\",\n }}\n >\n <Box\n aria-hidden\n style={{\n width: 36,\n height: 4,\n borderRadius: 999,\n backgroundColor: fairmintVars.colorBorderDefault,\n }}\n />\n </UnstyledButton>\n );\n}\n\nexport interface BottomSheetProps {\n /** Whether the bottom sheet is open. */\n opened: boolean;\n /** Close handler (backdrop, escape, or grip). */\n onClose: () => void;\n /** Sheet body. */\n children: ReactNode;\n /**\n * Optional title below the grip. Pass a string for default typography, or a\n * ReactNode for custom header content.\n */\n title?: ReactNode;\n /** Show the top grip dismiss control. @default true */\n withGrip?: boolean;\n /** Accessible label for the grip. @default \"Dismiss\" */\n dismissLabel?: string;\n /** Overlay z-index. Defaults above legacy Studio/Investor shell chrome. */\n zIndex?: number;\n /** Max height of the sheet. @default \"90dvh\" */\n maxHeight?: string | number;\n}\n\n/**\n * Full-width, content-height bottom sheet with a top grip (no X) and dimmed overlay.\n *\n * Prefer this over a raw bottom `Drawer` when the sheet should hug its content\n * rather than fill the viewport. Use `AccountSheet` for the mobile account menu;\n * use `BottomSheet` for any other mobile action sheet.\n */\nexport function BottomSheet({\n opened,\n onClose,\n children,\n title,\n withGrip = true,\n dismissLabel = \"Dismiss\",\n zIndex = overlayZIndexAboveLegacyShell + 10,\n maxHeight = \"90dvh\",\n}: BottomSheetProps) {\n const [closeOnClickOutside, setCloseOnClickOutside] = useState(false);\n\n useEffect(() => {\n if (!opened) {\n setCloseOnClickOutside(false);\n return;\n }\n const timer = window.setTimeout(() => setCloseOnClickOutside(true), CLOSE_OUTSIDE_ENABLE_MS);\n return () => window.clearTimeout(timer);\n }, [opened]);\n\n return (\n <Drawer\n opened={opened}\n onClose={onClose}\n position=\"bottom\"\n size=\"100%\"\n padding={0}\n radius={0}\n zIndex={zIndex}\n withOverlay\n withCloseButton={false}\n closeOnClickOutside={closeOnClickOutside}\n closeOnEscape\n scrollAreaComponent={BottomSheetScrollArea}\n styles={{\n content: {\n width: \"100%\",\n maxWidth: \"100%\",\n height: \"auto\",\n maxHeight,\n flex: \"0 0 100%\",\n borderTopLeftRadius: radii.lg,\n borderTopRightRadius: radii.lg,\n borderTop: `1px solid ${fairmintVars.colorBorderDefault}`,\n },\n header: {\n display: \"none\",\n },\n body: {\n height: \"auto\",\n paddingInline: 16,\n paddingBottom: \"max(16px, env(safe-area-inset-bottom))\",\n paddingTop: 0,\n },\n inner: {\n padding: 0,\n alignItems: \"flex-end\",\n },\n }}\n style={\n {\n \"--drawer-size\": \"auto\",\n \"--drawer-height\": \"auto\",\n \"--drawer-flex\": \"0 0 100%\",\n \"--drawer-offset\": \"0rem\",\n } as CSSProperties\n }\n >\n {withGrip ? <SheetGrip onDismiss={onClose} dismissLabel={dismissLabel} /> : null}\n\n {typeof title === \"string\" ? (\n <Text fw={600} size=\"md\" px={8} pb={8}>\n {title}\n </Text>\n ) : (\n title\n )}\n\n {children}\n </Drawer>\n );\n}\n"],"names":["jsx","UnstyledButton","Box","fairmintVars","zIndex","overlayZIndexAboveLegacyShell","useState","useEffect","jsxs","Drawer","radii","Text"],"mappings":";;;;;;;;;;AAiBA,MAAM,0BAA0B;AAMhC,SAAS,sBAAsB,EAA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,CAAC,MAAM,CAAC;AAEX,SACEC,2BAAAA;AAAAA,IAACC,OAAAA;AAAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,UAAS;AAAA,MACT,MAAK;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,MAAA,QACRL;AAAAA,MACA,aAAW;AAAA,MACX,iBAAiB;AAAA,MACjB;AAAA,MACA,eAAa;AAAA,MACb,qBAAqB;AAAA,MACrB,QAAQ;AAAA,QACN,SAAS;AAAA,UACP,OAAO;AAAA,UACP,UAAU;AAAA,UACV,QAAQ;AAAA,UACR;AAAA,UACA,MAAM;AAAA,UACN,qBAAqBM,MAAAA,MAAM;AAAA,UAC3B,sBAAsBA,MAAAA,MAAM;AAAA,UAC5B,WAAW,aAAaP,MAAAA,aAAa,kBAAkB;AAAA,QAAA;AAAA,QAEzD,QAAQ;AAAA,UACN,SAAS;AAAA,QAAA;AAAA,QAEX,MAAM;AAAA,UACJ,QAAQ;AAAA,UACR,eAAe;AAAA,UACf,eAAe;AAAA,UACf,YAAY;AAAA,QAAA;AAAA,QAEd,OAAO;AAAA,UACL,SAAS;AAAA,UACT,YAAY;AAAA,QAAA;AAAA,MACd;AAAA,MAEF,OACE;AAAA,QACE,iBAAiB;AAAA,QACjB,mBAAmB;AAAA,QACnB,iBAAiB;AAAA,QACjB,mBAAmB;AAAA,MAAA;AAAA,MAItB,UAAA;AAAA,QAAA,WAAWH,2BAAAA,IAAC,WAAA,EAAU,WAAW,SAAS,cAA4B,IAAK;AAAA,QAE3E,OAAO,UAAU,WAChBA,2BAAAA,IAACW,KAAAA,QAAK,IAAI,KAAK,MAAK,MAAK,IAAI,GAAG,IAAI,GACjC,iBACH,IAEA;AAAA,QAGD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface BottomSheetProps {
|
|
3
|
+
/** Whether the bottom sheet is open. */
|
|
4
|
+
opened: boolean;
|
|
5
|
+
/** Close handler (backdrop, escape, or grip). */
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
/** Sheet body. */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Optional title below the grip. Pass a string for default typography, or a
|
|
11
|
+
* ReactNode for custom header content.
|
|
12
|
+
*/
|
|
13
|
+
title?: ReactNode;
|
|
14
|
+
/** Show the top grip dismiss control. @default true */
|
|
15
|
+
withGrip?: boolean;
|
|
16
|
+
/** Accessible label for the grip. @default "Dismiss" */
|
|
17
|
+
dismissLabel?: string;
|
|
18
|
+
/** Overlay z-index. Defaults above legacy Studio/Investor shell chrome. */
|
|
19
|
+
zIndex?: number;
|
|
20
|
+
/** Max height of the sheet. @default "90dvh" */
|
|
21
|
+
maxHeight?: string | number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Full-width, content-height bottom sheet with a top grip (no X) and dimmed overlay.
|
|
25
|
+
*
|
|
26
|
+
* Prefer this over a raw bottom `Drawer` when the sheet should hug its content
|
|
27
|
+
* rather than fill the viewport. Use `AccountSheet` for the mobile account menu;
|
|
28
|
+
* use `BottomSheet` for any other mobile action sheet.
|
|
29
|
+
*/
|
|
30
|
+
export declare function BottomSheet({ opened, onClose, children, title, withGrip, dismissLabel, zIndex, maxHeight, }: BottomSheetProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
//# sourceMappingURL=BottomSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../../src/components/generic/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AA+Df,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB,iDAAiD;IACjD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kBAAkB;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,OAAO,EACP,QAAQ,EACR,KAAK,EACL,QAAe,EACf,YAAwB,EACxB,MAA2C,EAC3C,SAAmB,GACpB,EAAE,gBAAgB,2CAyElB"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { fairmintVars, radii } from "../../../theme/index.js";
|
|
4
|
+
import { overlayZIndexAboveLegacyShell } from "../../../theme/zIndex.js";
|
|
5
|
+
import { Drawer } from "../../primitives/Drawer/Drawer.js";
|
|
6
|
+
import { Box } from "../../primitives/layout.js";
|
|
7
|
+
import { Text } from "../../../node_modules/@mantine/core/esm/components/Text/Text.js";
|
|
8
|
+
import { UnstyledButton } from "../../../node_modules/@mantine/core/esm/components/UnstyledButton/UnstyledButton.js";
|
|
9
|
+
const CLOSE_OUTSIDE_ENABLE_MS = 100;
|
|
10
|
+
function BottomSheetScrollArea({ style, children, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
...props,
|
|
15
|
+
style: {
|
|
16
|
+
...style,
|
|
17
|
+
height: "auto",
|
|
18
|
+
maxHeight: "min(90dvh, 100%)",
|
|
19
|
+
overflow: "auto"
|
|
20
|
+
},
|
|
21
|
+
children
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function SheetGrip({ onDismiss, dismissLabel }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
UnstyledButton,
|
|
28
|
+
{
|
|
29
|
+
type: "button",
|
|
30
|
+
"aria-label": dismissLabel,
|
|
31
|
+
onClick: onDismiss,
|
|
32
|
+
style: {
|
|
33
|
+
display: "flex",
|
|
34
|
+
justifyContent: "center",
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
width: "100%",
|
|
37
|
+
minHeight: 28,
|
|
38
|
+
paddingTop: 8,
|
|
39
|
+
paddingBottom: 4,
|
|
40
|
+
cursor: "pointer"
|
|
41
|
+
},
|
|
42
|
+
children: /* @__PURE__ */ jsx(
|
|
43
|
+
Box,
|
|
44
|
+
{
|
|
45
|
+
"aria-hidden": true,
|
|
46
|
+
style: {
|
|
47
|
+
width: 36,
|
|
48
|
+
height: 4,
|
|
49
|
+
borderRadius: 999,
|
|
50
|
+
backgroundColor: fairmintVars.colorBorderDefault
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function BottomSheet({
|
|
58
|
+
opened,
|
|
59
|
+
onClose,
|
|
60
|
+
children,
|
|
61
|
+
title,
|
|
62
|
+
withGrip = true,
|
|
63
|
+
dismissLabel = "Dismiss",
|
|
64
|
+
zIndex = overlayZIndexAboveLegacyShell + 10,
|
|
65
|
+
maxHeight = "90dvh"
|
|
66
|
+
}) {
|
|
67
|
+
const [closeOnClickOutside, setCloseOnClickOutside] = useState(false);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (!opened) {
|
|
70
|
+
setCloseOnClickOutside(false);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const timer = window.setTimeout(() => setCloseOnClickOutside(true), CLOSE_OUTSIDE_ENABLE_MS);
|
|
74
|
+
return () => window.clearTimeout(timer);
|
|
75
|
+
}, [opened]);
|
|
76
|
+
return /* @__PURE__ */ jsxs(
|
|
77
|
+
Drawer,
|
|
78
|
+
{
|
|
79
|
+
opened,
|
|
80
|
+
onClose,
|
|
81
|
+
position: "bottom",
|
|
82
|
+
size: "100%",
|
|
83
|
+
padding: 0,
|
|
84
|
+
radius: 0,
|
|
85
|
+
zIndex,
|
|
86
|
+
withOverlay: true,
|
|
87
|
+
withCloseButton: false,
|
|
88
|
+
closeOnClickOutside,
|
|
89
|
+
closeOnEscape: true,
|
|
90
|
+
scrollAreaComponent: BottomSheetScrollArea,
|
|
91
|
+
styles: {
|
|
92
|
+
content: {
|
|
93
|
+
width: "100%",
|
|
94
|
+
maxWidth: "100%",
|
|
95
|
+
height: "auto",
|
|
96
|
+
maxHeight,
|
|
97
|
+
flex: "0 0 100%",
|
|
98
|
+
borderTopLeftRadius: radii.lg,
|
|
99
|
+
borderTopRightRadius: radii.lg,
|
|
100
|
+
borderTop: `1px solid ${fairmintVars.colorBorderDefault}`
|
|
101
|
+
},
|
|
102
|
+
header: {
|
|
103
|
+
display: "none"
|
|
104
|
+
},
|
|
105
|
+
body: {
|
|
106
|
+
height: "auto",
|
|
107
|
+
paddingInline: 16,
|
|
108
|
+
paddingBottom: "max(16px, env(safe-area-inset-bottom))",
|
|
109
|
+
paddingTop: 0
|
|
110
|
+
},
|
|
111
|
+
inner: {
|
|
112
|
+
padding: 0,
|
|
113
|
+
alignItems: "flex-end"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
style: {
|
|
117
|
+
"--drawer-size": "auto",
|
|
118
|
+
"--drawer-height": "auto",
|
|
119
|
+
"--drawer-flex": "0 0 100%",
|
|
120
|
+
"--drawer-offset": "0rem"
|
|
121
|
+
},
|
|
122
|
+
children: [
|
|
123
|
+
withGrip ? /* @__PURE__ */ jsx(SheetGrip, { onDismiss: onClose, dismissLabel }) : null,
|
|
124
|
+
typeof title === "string" ? /* @__PURE__ */ jsx(Text, { fw: 600, size: "md", px: 8, pb: 8, children: title }) : title,
|
|
125
|
+
children
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
export {
|
|
131
|
+
BottomSheet
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=BottomSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BottomSheet.js","sources":["../../../../src/components/generic/BottomSheet/BottomSheet.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n type ReactNode,\n useEffect,\n useState,\n} from \"react\";\nimport { fairmintVars, radii } from \"../../../theme\";\nimport { overlayZIndexAboveLegacyShell } from \"../../../theme/zIndex\";\nimport { Drawer } from \"../../primitives/Drawer/Drawer\";\nimport { Box, Text, UnstyledButton } from \"../../primitives/layout\";\n\n/**\n * Ignore overlay clicks briefly after open. Opening from another drawer/modal\n * (e.g. MobileNav → AccountSheet) otherwise lets the same pointerup hit the new\n * overlay and dismiss the sheet immediately — flaky on wider viewports.\n */\nconst CLOSE_OUTSIDE_ENABLE_MS = 100;\n\n/**\n * Mantine Drawer forces an inner scroll area to ~100vh; override so the sheet\n * only grows with its content.\n */\nfunction BottomSheetScrollArea({ style, children, ...props }: ComponentPropsWithoutRef<\"div\">) {\n return (\n <div\n {...props}\n style={{\n ...style,\n height: \"auto\",\n maxHeight: \"min(90dvh, 100%)\",\n overflow: \"auto\",\n }}\n >\n {children}\n </div>\n );\n}\n\nfunction SheetGrip({ onDismiss, dismissLabel }: { onDismiss: () => void; dismissLabel: string }) {\n return (\n <UnstyledButton\n type=\"button\"\n aria-label={dismissLabel}\n onClick={onDismiss}\n style={{\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n width: \"100%\",\n minHeight: 28,\n paddingTop: 8,\n paddingBottom: 4,\n cursor: \"pointer\",\n }}\n >\n <Box\n aria-hidden\n style={{\n width: 36,\n height: 4,\n borderRadius: 999,\n backgroundColor: fairmintVars.colorBorderDefault,\n }}\n />\n </UnstyledButton>\n );\n}\n\nexport interface BottomSheetProps {\n /** Whether the bottom sheet is open. */\n opened: boolean;\n /** Close handler (backdrop, escape, or grip). */\n onClose: () => void;\n /** Sheet body. */\n children: ReactNode;\n /**\n * Optional title below the grip. Pass a string for default typography, or a\n * ReactNode for custom header content.\n */\n title?: ReactNode;\n /** Show the top grip dismiss control. @default true */\n withGrip?: boolean;\n /** Accessible label for the grip. @default \"Dismiss\" */\n dismissLabel?: string;\n /** Overlay z-index. Defaults above legacy Studio/Investor shell chrome. */\n zIndex?: number;\n /** Max height of the sheet. @default \"90dvh\" */\n maxHeight?: string | number;\n}\n\n/**\n * Full-width, content-height bottom sheet with a top grip (no X) and dimmed overlay.\n *\n * Prefer this over a raw bottom `Drawer` when the sheet should hug its content\n * rather than fill the viewport. Use `AccountSheet` for the mobile account menu;\n * use `BottomSheet` for any other mobile action sheet.\n */\nexport function BottomSheet({\n opened,\n onClose,\n children,\n title,\n withGrip = true,\n dismissLabel = \"Dismiss\",\n zIndex = overlayZIndexAboveLegacyShell + 10,\n maxHeight = \"90dvh\",\n}: BottomSheetProps) {\n const [closeOnClickOutside, setCloseOnClickOutside] = useState(false);\n\n useEffect(() => {\n if (!opened) {\n setCloseOnClickOutside(false);\n return;\n }\n const timer = window.setTimeout(() => setCloseOnClickOutside(true), CLOSE_OUTSIDE_ENABLE_MS);\n return () => window.clearTimeout(timer);\n }, [opened]);\n\n return (\n <Drawer\n opened={opened}\n onClose={onClose}\n position=\"bottom\"\n size=\"100%\"\n padding={0}\n radius={0}\n zIndex={zIndex}\n withOverlay\n withCloseButton={false}\n closeOnClickOutside={closeOnClickOutside}\n closeOnEscape\n scrollAreaComponent={BottomSheetScrollArea}\n styles={{\n content: {\n width: \"100%\",\n maxWidth: \"100%\",\n height: \"auto\",\n maxHeight,\n flex: \"0 0 100%\",\n borderTopLeftRadius: radii.lg,\n borderTopRightRadius: radii.lg,\n borderTop: `1px solid ${fairmintVars.colorBorderDefault}`,\n },\n header: {\n display: \"none\",\n },\n body: {\n height: \"auto\",\n paddingInline: 16,\n paddingBottom: \"max(16px, env(safe-area-inset-bottom))\",\n paddingTop: 0,\n },\n inner: {\n padding: 0,\n alignItems: \"flex-end\",\n },\n }}\n style={\n {\n \"--drawer-size\": \"auto\",\n \"--drawer-height\": \"auto\",\n \"--drawer-flex\": \"0 0 100%\",\n \"--drawer-offset\": \"0rem\",\n } as CSSProperties\n }\n >\n {withGrip ? <SheetGrip onDismiss={onClose} dismissLabel={dismissLabel} /> : null}\n\n {typeof title === \"string\" ? (\n <Text fw={600} size=\"md\" px={8} pb={8}>\n {title}\n </Text>\n ) : (\n title\n )}\n\n {children}\n </Drawer>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAiBA,MAAM,0BAA0B;AAMhC,SAAS,sBAAsB,EAAE,OAAO,UAAU,GAAG,SAA0C;AAC7F,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO;AAAA,QACL,GAAG;AAAA,QACH,QAAQ;AAAA,QACR,WAAW;AAAA,QACX,UAAU;AAAA,MAAA;AAAA,MAGX;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA,SAAS,UAAU,EAAE,WAAW,gBAAiE;AAC/F,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAY;AAAA,MACZ,SAAS;AAAA,MACT,OAAO;AAAA,QACL,SAAS;AAAA,QACT,gBAAgB;AAAA,QAChB,YAAY;AAAA,QACZ,OAAO;AAAA,QACP,WAAW;AAAA,QACX,YAAY;AAAA,QACZ,eAAe;AAAA,QACf,QAAQ;AAAA,MAAA;AAAA,MAGV,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,eAAW;AAAA,UACX,OAAO;AAAA,YACL,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,cAAc;AAAA,YACd,iBAAiB,aAAa;AAAA,UAAA;AAAA,QAChC;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;AA+BO,SAAS,YAAY;AAAA,EAC1B;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S,cAA4B,IAAK;AAAA,QAE3E,OAAO,UAAU,WAChB,oBAAC,QAAK,IAAI,KAAK,MAAK,MAAK,IAAI,GAAG,IAAI,GACjC,iBACH,IAEA;AAAA,QAGD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const index = require("../../../theme/index.cjs");
|
|
5
|
+
const zIndex = require("../../../theme/zIndex.cjs");
|
|
6
|
+
const BottomSheet = require("../../generic/BottomSheet/BottomSheet.cjs");
|
|
7
|
+
const Avatar = require("../../primitives/Avatar/Avatar.cjs");
|
|
8
|
+
const layout = require("../../primitives/layout.cjs");
|
|
9
|
+
const colors = require("../../../theme/colors.cjs");
|
|
10
|
+
const Text = require("../../../node_modules/@mantine/core/esm/components/Text/Text.cjs");
|
|
11
|
+
const UnstyledButton = require("../../../node_modules/@mantine/core/esm/components/UnstyledButton/UnstyledButton.cjs");
|
|
12
|
+
const ACCOUNT_SHEET_ROW_MIN_HEIGHT = 48;
|
|
13
|
+
function resolvePaintColor(color) {
|
|
14
|
+
if (!color) return void 0;
|
|
15
|
+
if (color === colors.colors.error || color === "error" || color === "red") {
|
|
16
|
+
return index.fairmintVars.colorErrorText;
|
|
17
|
+
}
|
|
18
|
+
if (color === colors.colors.primary || color === "indigo" || color === "primary") {
|
|
19
|
+
return index.fairmintVars.colorBrandPrimary;
|
|
20
|
+
}
|
|
21
|
+
return color;
|
|
22
|
+
}
|
|
23
|
+
function AccountSheetRow({
|
|
24
|
+
item,
|
|
25
|
+
onItemClick
|
|
26
|
+
}) {
|
|
27
|
+
const paint = resolvePaintColor(item.color);
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29
|
+
UnstyledButton.UnstyledButton,
|
|
30
|
+
{
|
|
31
|
+
type: "button",
|
|
32
|
+
onClick: () => onItemClick(item.id),
|
|
33
|
+
style: {
|
|
34
|
+
display: "flex",
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
gap: 12,
|
|
37
|
+
width: "100%",
|
|
38
|
+
minHeight: ACCOUNT_SHEET_ROW_MIN_HEIGHT,
|
|
39
|
+
paddingInline: 8,
|
|
40
|
+
paddingBlock: 12,
|
|
41
|
+
borderRadius: index.radii.md,
|
|
42
|
+
textAlign: "left",
|
|
43
|
+
cursor: "pointer",
|
|
44
|
+
color: paint ?? index.fairmintVars.colorTextPrimary
|
|
45
|
+
},
|
|
46
|
+
styles: {
|
|
47
|
+
root: {
|
|
48
|
+
"&:hover": {
|
|
49
|
+
backgroundColor: index.fairmintVars.colorBgHover
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
children: [
|
|
54
|
+
item.icon ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
55
|
+
layout.Box,
|
|
56
|
+
{
|
|
57
|
+
component: "span",
|
|
58
|
+
"aria-hidden": true,
|
|
59
|
+
style: {
|
|
60
|
+
display: "inline-flex",
|
|
61
|
+
color: paint ?? index.fairmintVars.colorIconSecondary,
|
|
62
|
+
flexShrink: 0
|
|
63
|
+
},
|
|
64
|
+
children: item.icon
|
|
65
|
+
}
|
|
66
|
+
) : null,
|
|
67
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text.Text, { size: "sm", fw: 500, style: { color: paint ?? void 0 }, children: item.label })
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function AccountSheet({
|
|
73
|
+
opened,
|
|
74
|
+
onClose,
|
|
75
|
+
displayName,
|
|
76
|
+
email,
|
|
77
|
+
avatarName,
|
|
78
|
+
avatarColor = colors.colors.primary,
|
|
79
|
+
title = "Account",
|
|
80
|
+
items,
|
|
81
|
+
onItemClick,
|
|
82
|
+
zIndex: zIndex$1 = zIndex.overlayZIndexAboveLegacyShell + 10
|
|
83
|
+
}) {
|
|
84
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
85
|
+
BottomSheet.BottomSheet,
|
|
86
|
+
{
|
|
87
|
+
opened,
|
|
88
|
+
onClose,
|
|
89
|
+
title,
|
|
90
|
+
dismissLabel: "Dismiss account menu",
|
|
91
|
+
zIndex: zIndex$1,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
94
|
+
layout.Box,
|
|
95
|
+
{
|
|
96
|
+
style: {
|
|
97
|
+
display: "flex",
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
gap: 12,
|
|
100
|
+
paddingInline: 8,
|
|
101
|
+
paddingBlock: 8
|
|
102
|
+
},
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar.Avatar, { name: avatarName ?? displayName, radius: "md", size: 40, color: avatarColor }),
|
|
105
|
+
/* @__PURE__ */ jsxRuntime.jsxs(layout.Stack, { gap: 0, style: { minWidth: 0, flex: 1 }, children: [
|
|
106
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text.Text, { size: "sm", fw: 600, truncate: true, children: displayName }),
|
|
107
|
+
email && email !== displayName ? /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { size: "xs", c: "dimmed", truncate: true, children: email }) : null
|
|
108
|
+
] })
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsxRuntime.jsx(layout.Divider, { my: "xs", color: index.fairmintVars.colorBorderDefault }),
|
|
113
|
+
/* @__PURE__ */ jsxRuntime.jsx(layout.Stack, { gap: 4, children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(layout.Box, { children: [
|
|
114
|
+
item.dividerBefore ? /* @__PURE__ */ jsxRuntime.jsx(layout.Divider, { my: "xs", color: index.fairmintVars.colorBorderDefault }) : null,
|
|
115
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccountSheetRow, { item, onItemClick })
|
|
116
|
+
] }, item.id)) })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
exports.ACCOUNT_SHEET_ROW_MIN_HEIGHT = ACCOUNT_SHEET_ROW_MIN_HEIGHT;
|
|
122
|
+
exports.AccountSheet = AccountSheet;
|
|
123
|
+
//# sourceMappingURL=AccountSheet.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountSheet.cjs","sources":["../../../../src/components/layout/AccountSheet/AccountSheet.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { colors, fairmintVars, radii } from \"../../../theme\";\nimport { overlayZIndexAboveLegacyShell } from \"../../../theme/zIndex\";\nimport { BottomSheet } from \"../../generic/BottomSheet/BottomSheet\";\nimport { Avatar } from \"../../primitives/Avatar/Avatar\";\nimport { Box, Divider, Stack, Text, UnstyledButton } from \"../../primitives/layout\";\n\n/** Minimum touch target height for mobile account actions (WCAG 2.5.5 / Apple HIG). */\nexport const ACCOUNT_SHEET_ROW_MIN_HEIGHT = 48;\n\nexport interface AccountSheetItem {\n /** Unique identifier for this action. */\n id: string;\n /** Display label. */\n label: string;\n /** Leading icon element (app-owned icon library). */\n icon?: ReactNode;\n /**\n * Item color. Accepts a CSS color or a Mantine semantic name (`colors.error` → `\"error\"`).\n * Destructive actions like Sign out should pass `colors.error`.\n */\n color?: string;\n /** Show a divider before this item. */\n dividerBefore?: boolean;\n}\n\nexport interface AccountSheetProps {\n /** Whether the bottom sheet is open. */\n opened: boolean;\n /** Close handler (backdrop, escape, or grip). */\n onClose: () => void;\n /** Primary identity line. */\n displayName: string;\n /** Optional secondary identity line (email). */\n email?: string;\n /** Name passed to Avatar (initials). Defaults to `displayName`. */\n avatarName?: string;\n /** Avatar color token. @default colors.primary */\n avatarColor?: string;\n /** Sheet title below the grip. @default \"Account\" */\n title?: string;\n /** Account actions. */\n items: AccountSheetItem[];\n /** Called when an action row is pressed. Receives the item `id`. */\n onItemClick: (id: string) => void;\n /** Overlay z-index. Defaults above legacy Studio/Investor shell chrome. */\n zIndex?: number;\n}\n\n/** Map Mantine semantic names (e.g. `colors.error`) to CSS paint tokens for inline styles. */\nfunction resolvePaintColor(color?: string): string | undefined {\n if (!color) return undefined;\n if (color === colors.error || color === \"error\" || color === \"red\") {\n return fairmintVars.colorErrorText;\n }\n if (color === colors.primary || color === \"indigo\" || color === \"primary\") {\n return fairmintVars.colorBrandPrimary;\n }\n return color;\n}\n\nfunction AccountSheetRow({\n item,\n onItemClick,\n}: {\n item: AccountSheetItem;\n onItemClick: (id: string) => void;\n}) {\n const paint = resolvePaintColor(item.color);\n\n return (\n <UnstyledButton\n type=\"button\"\n onClick={() => onItemClick(item.id)}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 12,\n width: \"100%\",\n minHeight: ACCOUNT_SHEET_ROW_MIN_HEIGHT,\n paddingInline: 8,\n paddingBlock: 12,\n borderRadius: radii.md,\n textAlign: \"left\",\n cursor: \"pointer\",\n color: paint ?? fairmintVars.colorTextPrimary,\n }}\n styles={{\n root: {\n \"&:hover\": {\n backgroundColor: fairmintVars.colorBgHover,\n },\n },\n }}\n >\n {item.icon ? (\n <Box\n component=\"span\"\n aria-hidden\n style={{\n display: \"inline-flex\",\n color: paint ?? fairmintVars.colorIconSecondary,\n flexShrink: 0,\n }}\n >\n {item.icon}\n </Box>\n ) : null}\n <Text size=\"sm\" fw={500} style={{ color: paint ?? undefined }}>\n {item.label}\n </Text>\n </UnstyledButton>\n );\n}\n\n/**\n * Touch-first account surface for mobile shells.\n * Composes `BottomSheet` with identity header + action rows.\n */\nexport function AccountSheet({\n opened,\n onClose,\n displayName,\n email,\n avatarName,\n avatarColor = colors.primary,\n title = \"Account\",\n items,\n onItemClick,\n zIndex = overlayZIndexAboveLegacyShell + 10,\n}: AccountSheetProps) {\n return (\n <BottomSheet\n opened={opened}\n onClose={onClose}\n title={title}\n dismissLabel=\"Dismiss account menu\"\n zIndex={zIndex}\n >\n <Box\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 12,\n paddingInline: 8,\n paddingBlock: 8,\n }}\n >\n <Avatar name={avatarName ?? displayName} radius=\"md\" size={40} color={avatarColor} />\n <Stack gap={0} style={{ minWidth: 0, flex: 1 }}>\n <Text size=\"sm\" fw={600} truncate>\n {displayName}\n </Text>\n {email && email !== displayName ? (\n <Text size=\"xs\" c=\"dimmed\" truncate>\n {email}\n </Text>\n ) : null}\n </Stack>\n </Box>\n\n <Divider my=\"xs\" color={fairmintVars.colorBorderDefault} />\n\n <Stack gap={4}>\n {items.map((item) => (\n <Box key={item.id}>\n {item.dividerBefore ? (\n <Divider my=\"xs\" color={fairmintVars.colorBorderDefault} />\n ) : null}\n <AccountSheetRow item={item} onItemClick={onItemClick} />\n </Box>\n ))}\n </Stack>\n </BottomSheet>\n );\n}\n"],"names":["colors","fairmintVars","jsxs","UnstyledButton","radii","jsx","Box","Text","zIndex","overlayZIndexAboveLegacyShell","BottomSheet","Avatar","Stack","Divider"],"mappings":";;;;;;;;;;;AAQO,MAAM,+BAA+B;AA0C5C,SAAS,kBAAkB,OAAoC;AAC7D,MAAI,CAAC,MAAO,QAAO;AACnB,MAAI,UAAUA,OAAAA,OAAO,SAAS,UAAU,WAAW,UAAU,OAAO;AAClE,WAAOC,MAAAA,aAAa;AAAA,EACtB;AACA,MAAI,UAAUD,OAAAA,OAAO,WAAW,UAAU,YAAY,UAAU,WAAW;AACzE,WAAOC,MAAAA,aAAa;AAAA,EACtB;AACA,SAAO;AACT;AAEA,SAAS,gBAAgB;AAAA,EACvB;AAAA,EACA;AACF,GAGG;AACD,QAAM,QAAQ,kBAAkB,KAAK,KAAK;AAE1C,SACEC,2BAAAA;AAAAA,IAACC,eAAAA;AAAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAS,MAAM,YAAY,KAAK,EAAE;AAAA,MAClC,OAAO;AAAA,QACL,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,KA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A,cACf,cAAc;AAAA,YAAA;AAAA,YAGhB,UAAA;AAAA,cAAAD,2BAAAA,IAACM,OAAAA,QAAA,EAAO,MAAM,cAAc,aAAa,QAAO,MAAK,MAAM,IAAI,OAAO,YAAA,CAAa;AAAA,cACnFT,2BAAAA,KAACU,OAAAA,OAAA,EAAM,KAAK,GAAG,OAAO,EAAE,UAAU,GAAG,MAAM,EAAA,GACzC,UAAA;AAAA,gBAAAP,2BAAAA,IAACE,KAAAA,QAAK,MAAK,MAAK,IAAI,KAAK,UAAQ,MAC9B,UAAA,YAAA,CACH;AAAA,gBACC,SAAS,UAAU,cAClBF,2BAAAA,IAACE,KAAAA,MAAA,EAAK,MAAK,MAAK,GAAE,UAAS,UAAQ,MAChC,UAAA,MAAA,CACH,IACE;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,uCAGDM,OAAAA,SAAA,EAAQ,IAAG,MAAK,OAAOZ,MAAAA,aAAa,oBAAoB;AAAA,QAEzDI,2BAAAA,IAACO,OAAAA,SAAM,KAAK,GACT,gBAAM,IAAI,CAAC,SACVV,2BAAAA,KAACI,OAAAA,KAAA,EACE,UAAA;AAAA,UAAA,KAAK,+CACHO,OAAAA,SAAA,EAAQ,IAAG,MAAK,OAAOZ,MAAAA,aAAa,oBAAoB,IACvD;AAAA,UACJI,2BAAAA,IAAC,iBAAA,EAAgB,MAAY,YAAA,CAA0B;AAAA,QAAA,KAJ/C,KAAK,EAKf,CACD,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Minimum touch target height for mobile account actions (WCAG 2.5.5 / Apple HIG). */
|
|
3
|
+
export declare const ACCOUNT_SHEET_ROW_MIN_HEIGHT = 48;
|
|
4
|
+
export interface AccountSheetItem {
|
|
5
|
+
/** Unique identifier for this action. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Display label. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Leading icon element (app-owned icon library). */
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Item color. Accepts a CSS color or a Mantine semantic name (`colors.error` → `"error"`).
|
|
13
|
+
* Destructive actions like Sign out should pass `colors.error`.
|
|
14
|
+
*/
|
|
15
|
+
color?: string;
|
|
16
|
+
/** Show a divider before this item. */
|
|
17
|
+
dividerBefore?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface AccountSheetProps {
|
|
20
|
+
/** Whether the bottom sheet is open. */
|
|
21
|
+
opened: boolean;
|
|
22
|
+
/** Close handler (backdrop, escape, or grip). */
|
|
23
|
+
onClose: () => void;
|
|
24
|
+
/** Primary identity line. */
|
|
25
|
+
displayName: string;
|
|
26
|
+
/** Optional secondary identity line (email). */
|
|
27
|
+
email?: string;
|
|
28
|
+
/** Name passed to Avatar (initials). Defaults to `displayName`. */
|
|
29
|
+
avatarName?: string;
|
|
30
|
+
/** Avatar color token. @default colors.primary */
|
|
31
|
+
avatarColor?: string;
|
|
32
|
+
/** Sheet title below the grip. @default "Account" */
|
|
33
|
+
title?: string;
|
|
34
|
+
/** Account actions. */
|
|
35
|
+
items: AccountSheetItem[];
|
|
36
|
+
/** Called when an action row is pressed. Receives the item `id`. */
|
|
37
|
+
onItemClick: (id: string) => void;
|
|
38
|
+
/** Overlay z-index. Defaults above legacy Studio/Investor shell chrome. */
|
|
39
|
+
zIndex?: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Touch-first account surface for mobile shells.
|
|
43
|
+
* Composes `BottomSheet` with identity header + action rows.
|
|
44
|
+
*/
|
|
45
|
+
export declare function AccountSheet({ opened, onClose, displayName, email, avatarName, avatarColor, title, items, onItemClick, zIndex, }: AccountSheetProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
//# sourceMappingURL=AccountSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountSheet.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/AccountSheet/AccountSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,uFAAuF;AACvF,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB,iDAAiD;IACjD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,oEAAoE;IACpE,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAoED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,EACL,UAAU,EACV,WAA4B,EAC5B,KAAiB,EACjB,KAAK,EACL,WAAW,EACX,MAA2C,GAC5C,EAAE,iBAAiB,2CA6CnB"}
|