@fairmint/ui 0.3.31 → 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/FairmintProvider/FairmintNotifications.cjs +23 -0
- package/dist/components/FairmintProvider/FairmintNotifications.cjs.map +1 -0
- package/dist/components/FairmintProvider/FairmintNotifications.d.ts +16 -0
- package/dist/components/FairmintProvider/FairmintNotifications.d.ts.map +1 -0
- package/dist/components/FairmintProvider/FairmintNotifications.js +23 -0
- package/dist/components/FairmintProvider/FairmintNotifications.js.map +1 -0
- package/dist/components/FairmintProvider/FairmintProvider.cjs +2 -2
- package/dist/components/FairmintProvider/FairmintProvider.cjs.map +1 -1
- package/dist/components/FairmintProvider/FairmintProvider.d.ts.map +1 -1
- package/dist/components/FairmintProvider/FairmintProvider.js +2 -2
- package/dist/components/FairmintProvider/FairmintProvider.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/@mantine/notifications/esm/notifications.store.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,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const notifications_store = require("../../node_modules/@mantine/notifications/esm/notifications.store.cjs");
|
|
5
|
+
const Notifications = require("../../node_modules/@mantine/notifications/esm/Notifications.cjs");
|
|
6
|
+
function FairmintNotifications({ position = "top-right" }) {
|
|
7
|
+
const { notifications, queue } = notifications_store.useNotifications();
|
|
8
|
+
if (notifications.length === 0 && queue.length === 0) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12
|
+
Notifications.Notifications,
|
|
13
|
+
{
|
|
14
|
+
position,
|
|
15
|
+
styles: {
|
|
16
|
+
root: { pointerEvents: "none" },
|
|
17
|
+
notification: { pointerEvents: "auto" }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
exports.FairmintNotifications = FairmintNotifications;
|
|
23
|
+
//# sourceMappingURL=FairmintNotifications.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FairmintNotifications.cjs","sources":["../../../src/components/FairmintProvider/FairmintNotifications.tsx"],"sourcesContent":["import { Notifications, type NotificationsProps, useNotifications } from \"@mantine/notifications\";\n\nexport interface FairmintNotificationsProps {\n position?: NotificationsProps[\"position\"];\n}\n\n/**\n * Mantine's `<Notifications />` always portals six fixed-position roots (every\n * corner/center), even when the store is empty. Those empty shells are\n * near-full-width on mobile and sit at overlay z-index, so they can steal\n * clicks on sparse pages (e.g. Studio login) with nothing visible on screen.\n *\n * Mount the host only while there is something to show. When mounted, keep\n * pointer-events off the roots (Mantine still renders empty sibling positions\n * for unused corners) and restore them on the toast itself.\n */\nexport function FairmintNotifications({ position = \"top-right\" }: FairmintNotificationsProps) {\n const { notifications, queue } = useNotifications();\n\n if (notifications.length === 0 && queue.length === 0) {\n return null;\n }\n\n return (\n <Notifications\n position={position}\n styles={{\n root: { pointerEvents: \"none\" },\n notification: { pointerEvents: \"auto\" },\n }}\n />\n );\n}\n"],"names":["useNotifications","jsx","Notifications"],"mappings":";;;;;AAgBO,SAAS,sBAAsB,EAAE,WAAW,eAA2C;AAC5F,QAAM,EAAE,eAAe,MAAA,IAAUA,qCAAA;AAEjC,MAAI,cAAc,WAAW,KAAK,MAAM,WAAW,GAAG;AACpD,WAAO;AAAA,EACT;AAEA,SACEC,2BAAAA;AAAAA,IAACC,cAAAA;AAAAA,IAAA;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,QACN,MAAM,EAAE,eAAe,OAAA;AAAA,QACvB,cAAc,EAAE,eAAe,OAAA;AAAA,MAAO;AAAA,IACxC;AAAA,EAAA;AAGN;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NotificationsProps } from '@mantine/notifications';
|
|
2
|
+
export interface FairmintNotificationsProps {
|
|
3
|
+
position?: NotificationsProps["position"];
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Mantine's `<Notifications />` always portals six fixed-position roots (every
|
|
7
|
+
* corner/center), even when the store is empty. Those empty shells are
|
|
8
|
+
* near-full-width on mobile and sit at overlay z-index, so they can steal
|
|
9
|
+
* clicks on sparse pages (e.g. Studio login) with nothing visible on screen.
|
|
10
|
+
*
|
|
11
|
+
* Mount the host only while there is something to show. When mounted, keep
|
|
12
|
+
* pointer-events off the roots (Mantine still renders empty sibling positions
|
|
13
|
+
* for unused corners) and restore them on the toast itself.
|
|
14
|
+
*/
|
|
15
|
+
export declare function FairmintNotifications({ position }: FairmintNotificationsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
//# sourceMappingURL=FairmintNotifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FairmintNotifications.d.ts","sourceRoot":"","sources":["../../../src/components/FairmintProvider/FairmintNotifications.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,kBAAkB,EAAoB,MAAM,wBAAwB,CAAC;AAElG,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;CAC3C;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,QAAsB,EAAE,EAAE,0BAA0B,kDAgB3F"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useNotifications } from "../../node_modules/@mantine/notifications/esm/notifications.store.js";
|
|
3
|
+
import { Notifications } from "../../node_modules/@mantine/notifications/esm/Notifications.js";
|
|
4
|
+
function FairmintNotifications({ position = "top-right" }) {
|
|
5
|
+
const { notifications, queue } = useNotifications();
|
|
6
|
+
if (notifications.length === 0 && queue.length === 0) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
Notifications,
|
|
11
|
+
{
|
|
12
|
+
position,
|
|
13
|
+
styles: {
|
|
14
|
+
root: { pointerEvents: "none" },
|
|
15
|
+
notification: { pointerEvents: "auto" }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
FairmintNotifications
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=FairmintNotifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FairmintNotifications.js","sources":["../../../src/components/FairmintProvider/FairmintNotifications.tsx"],"sourcesContent":["import { Notifications, type NotificationsProps, useNotifications } from \"@mantine/notifications\";\n\nexport interface FairmintNotificationsProps {\n position?: NotificationsProps[\"position\"];\n}\n\n/**\n * Mantine's `<Notifications />` always portals six fixed-position roots (every\n * corner/center), even when the store is empty. Those empty shells are\n * near-full-width on mobile and sit at overlay z-index, so they can steal\n * clicks on sparse pages (e.g. Studio login) with nothing visible on screen.\n *\n * Mount the host only while there is something to show. When mounted, keep\n * pointer-events off the roots (Mantine still renders empty sibling positions\n * for unused corners) and restore them on the toast itself.\n */\nexport function FairmintNotifications({ position = \"top-right\" }: FairmintNotificationsProps) {\n const { notifications, queue } = useNotifications();\n\n if (notifications.length === 0 && queue.length === 0) {\n return null;\n }\n\n return (\n <Notifications\n position={position}\n styles={{\n root: { pointerEvents: \"none\" },\n notification: { pointerEvents: \"auto\" },\n }}\n />\n );\n}\n"],"names":[],"mappings":";;;AAgBO,SAAS,sBAAsB,EAAE,WAAW,eAA2C;AAC5F,QAAM,EAAE,eAAe,MAAA,IAAU,iBAAA;AAEjC,MAAI,cAAc,WAAW,KAAK,MAAM,WAAW,GAAG;AACpD,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,QACN,MAAM,EAAE,eAAe,OAAA;AAAA,QACvB,cAAc,EAAE,eAAe,OAAA;AAAA,MAAO;AAAA,IACxC;AAAA,EAAA;AAGN;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const index = require("../../theme/index.cjs");
|
|
5
|
+
const FairmintNotifications = require("./FairmintNotifications.cjs");
|
|
5
6
|
const MantineProvider = require("../../node_modules/@mantine/core/esm/core/MantineProvider/MantineProvider.cjs");
|
|
6
|
-
const Notifications = require("../../node_modules/@mantine/notifications/esm/Notifications.cjs");
|
|
7
7
|
const DatesProvider = require("../../node_modules/@mantine/dates/esm/components/DatesProvider/DatesProvider.cjs");
|
|
8
8
|
function FairmintProvider({
|
|
9
9
|
children,
|
|
@@ -18,7 +18,7 @@ function FairmintProvider({
|
|
|
18
18
|
cssVariablesResolver: index.fairmintCssVariables,
|
|
19
19
|
...colorSchemeProps,
|
|
20
20
|
children: [
|
|
21
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
+
/* @__PURE__ */ jsxRuntime.jsx(FairmintNotifications.FairmintNotifications, { position: notificationPosition }),
|
|
22
22
|
/* @__PURE__ */ jsxRuntime.jsx(DatesProvider.DatesProvider, { settings: { locale: "en", firstDayOfWeek: 0, weekendDays: [] }, children })
|
|
23
23
|
]
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FairmintProvider.cjs","sources":["../../../src/components/FairmintProvider/FairmintProvider.tsx"],"sourcesContent":["import type { MantineColorScheme } from \"@mantine/core\";\nimport { MantineProvider } from \"@mantine/core\";\nimport { DatesProvider } from \"@mantine/dates\";\nimport {
|
|
1
|
+
{"version":3,"file":"FairmintProvider.cjs","sources":["../../../src/components/FairmintProvider/FairmintProvider.tsx"],"sourcesContent":["import type { MantineColorScheme } from \"@mantine/core\";\nimport { MantineProvider } from \"@mantine/core\";\nimport { DatesProvider } from \"@mantine/dates\";\nimport type { ReactNode } from \"react\";\nimport { fairmintCssVariables, theme } from \"../../theme\";\nimport { FairmintNotifications } from \"./FairmintNotifications\";\n\nexport interface FairmintProviderProps {\n children: ReactNode;\n /** Color scheme. When `light` or `dark`, Mantine is locked to this value. @default \"light\" */\n colorScheme?: MantineColorScheme;\n /**\n * Notification position.\n * @default \"top-right\"\n */\n notificationPosition?:\n | \"top-left\"\n | \"top-right\"\n | \"top-center\"\n | \"bottom-left\"\n | \"bottom-right\"\n | \"bottom-center\";\n}\n\nexport function FairmintProvider({\n children,\n colorScheme = \"light\",\n notificationPosition = \"top-right\",\n}: FairmintProviderProps) {\n if (import.meta.env?.DEV) {\n validateSetup();\n }\n\n const colorSchemeProps =\n colorScheme === \"light\" || colorScheme === \"dark\"\n ? { forceColorScheme: colorScheme }\n : { defaultColorScheme: colorScheme };\n\n return (\n <MantineProvider\n theme={theme}\n cssVariablesResolver={fairmintCssVariables}\n {...colorSchemeProps}\n >\n <FairmintNotifications position={notificationPosition} />\n {/* weekendDays: [] disables Mantine's default red weekend-day styling — red is our\n error/destructive semantic color elsewhere, so it reads as disabled/invalid here. */}\n <DatesProvider settings={{ locale: \"en\", firstDayOfWeek: 0, weekendDays: [] }}>\n {children}\n </DatesProvider>\n </MantineProvider>\n );\n}\n\nfunction validateSetup() {\n if (typeof window === \"undefined\") return;\n if (\n (typeof process !== \"undefined\" && process.env?.NODE_ENV === \"test\") ||\n import.meta.env?.MODE === \"test\"\n )\n return;\n\n requestIdleCallback(() => {\n const root = document.documentElement;\n const mantineCss = getComputedStyle(root).getPropertyValue(\"--mantine-color-scheme\");\n if (!mantineCss) {\n console.warn(\n '[@fairmint/ui] Mantine CSS not detected. Make sure you import \"@fairmint/ui/styles.css\" in your entry file.',\n );\n }\n });\n}\n"],"names":["jsxs","MantineProvider","theme","fairmintCssVariables","jsx","FairmintNotifications","DatesProvider"],"mappings":";;;;;;;AAwBO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA,cAAc;AAAA,EACd,uBAAuB;AACzB,GAA0B;AAKxB,QAAM,mBACJ,gBAAgB,WAAW,gBAAgB,SACvC,EAAE,kBAAkB,YAAA,IACpB,EAAE,oBAAoB,YAAA;AAE5B,SACEA,2BAAAA;AAAAA,IAACC,gBAAAA;AAAAA,IAAA;AAAA,MAAA,OACCC,MAAAA;AAAAA,MACA,sBAAsBC,MAAAA;AAAAA,MACrB,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAAC,2BAAAA,IAACC,sBAAAA,uBAAA,EAAsB,UAAU,sBAAsB;AAAA,QAGvDD,2BAAAA,IAACE,cAAAA,eAAA,EAAc,UAAU,EAAE,QAAQ,MAAM,gBAAgB,GAAG,aAAa,CAAA,EAAC,GACvE,UACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FairmintProvider.d.ts","sourceRoot":"","sources":["../../../src/components/FairmintProvider/FairmintProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"FairmintProvider.d.ts","sourceRoot":"","sources":["../../../src/components/FairmintProvider/FairmintProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,8FAA8F;IAC9F,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;OAGG;IACH,oBAAoB,CAAC,EACjB,UAAU,GACV,WAAW,GACX,YAAY,GACZ,aAAa,GACb,cAAc,GACd,eAAe,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,WAAqB,EACrB,oBAAkC,GACnC,EAAE,qBAAqB,2CAwBvB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { fairmintCssVariables, theme } from "../../theme/index.js";
|
|
3
|
+
import { FairmintNotifications } from "./FairmintNotifications.js";
|
|
3
4
|
import { MantineProvider } from "../../node_modules/@mantine/core/esm/core/MantineProvider/MantineProvider.js";
|
|
4
|
-
import { Notifications } from "../../node_modules/@mantine/notifications/esm/Notifications.js";
|
|
5
5
|
import { DatesProvider } from "../../node_modules/@mantine/dates/esm/components/DatesProvider/DatesProvider.js";
|
|
6
6
|
function FairmintProvider({
|
|
7
7
|
children,
|
|
@@ -16,7 +16,7 @@ function FairmintProvider({
|
|
|
16
16
|
cssVariablesResolver: fairmintCssVariables,
|
|
17
17
|
...colorSchemeProps,
|
|
18
18
|
children: [
|
|
19
|
-
/* @__PURE__ */ jsx(
|
|
19
|
+
/* @__PURE__ */ jsx(FairmintNotifications, { position: notificationPosition }),
|
|
20
20
|
/* @__PURE__ */ jsx(DatesProvider, { settings: { locale: "en", firstDayOfWeek: 0, weekendDays: [] }, children })
|
|
21
21
|
]
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FairmintProvider.js","sources":["../../../src/components/FairmintProvider/FairmintProvider.tsx"],"sourcesContent":["import type { MantineColorScheme } from \"@mantine/core\";\nimport { MantineProvider } from \"@mantine/core\";\nimport { DatesProvider } from \"@mantine/dates\";\nimport {
|
|
1
|
+
{"version":3,"file":"FairmintProvider.js","sources":["../../../src/components/FairmintProvider/FairmintProvider.tsx"],"sourcesContent":["import type { MantineColorScheme } from \"@mantine/core\";\nimport { MantineProvider } from \"@mantine/core\";\nimport { DatesProvider } from \"@mantine/dates\";\nimport type { ReactNode } from \"react\";\nimport { fairmintCssVariables, theme } from \"../../theme\";\nimport { FairmintNotifications } from \"./FairmintNotifications\";\n\nexport interface FairmintProviderProps {\n children: ReactNode;\n /** Color scheme. When `light` or `dark`, Mantine is locked to this value. @default \"light\" */\n colorScheme?: MantineColorScheme;\n /**\n * Notification position.\n * @default \"top-right\"\n */\n notificationPosition?:\n | \"top-left\"\n | \"top-right\"\n | \"top-center\"\n | \"bottom-left\"\n | \"bottom-right\"\n | \"bottom-center\";\n}\n\nexport function FairmintProvider({\n children,\n colorScheme = \"light\",\n notificationPosition = \"top-right\",\n}: FairmintProviderProps) {\n if (import.meta.env?.DEV) {\n validateSetup();\n }\n\n const colorSchemeProps =\n colorScheme === \"light\" || colorScheme === \"dark\"\n ? { forceColorScheme: colorScheme }\n : { defaultColorScheme: colorScheme };\n\n return (\n <MantineProvider\n theme={theme}\n cssVariablesResolver={fairmintCssVariables}\n {...colorSchemeProps}\n >\n <FairmintNotifications position={notificationPosition} />\n {/* weekendDays: [] disables Mantine's default red weekend-day styling — red is our\n error/destructive semantic color elsewhere, so it reads as disabled/invalid here. */}\n <DatesProvider settings={{ locale: \"en\", firstDayOfWeek: 0, weekendDays: [] }}>\n {children}\n </DatesProvider>\n </MantineProvider>\n );\n}\n\nfunction validateSetup() {\n if (typeof window === \"undefined\") return;\n if (\n (typeof process !== \"undefined\" && process.env?.NODE_ENV === \"test\") ||\n import.meta.env?.MODE === \"test\"\n )\n return;\n\n requestIdleCallback(() => {\n const root = document.documentElement;\n const mantineCss = getComputedStyle(root).getPropertyValue(\"--mantine-color-scheme\");\n if (!mantineCss) {\n console.warn(\n '[@fairmint/ui] Mantine CSS not detected. Make sure you import \"@fairmint/ui/styles.css\" in your entry file.',\n );\n }\n });\n}\n"],"names":[],"mappings":";;;;;AAwBO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA,cAAc;AAAA,EACd,uBAAuB;AACzB,GAA0B;AAKxB,QAAM,mBACJ,gBAAgB,WAAW,gBAAgB,SACvC,EAAE,kBAAkB,YAAA,IACpB,EAAE,oBAAoB,YAAA;AAE5B,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,sBAAsB;AAAA,MACrB,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAA,oBAAC,uBAAA,EAAsB,UAAU,sBAAsB;AAAA,QAGvD,oBAAC,eAAA,EAAc,UAAU,EAAE,QAAQ,MAAM,gBAAgB,GAAG,aAAa,CAAA,EAAC,GACvE,UACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -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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|
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;A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