@fairmint/ui 0.3.29 → 0.3.31
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 +3 -5
- package/dist/_virtual/index3.cjs.map +1 -1
- package/dist/_virtual/index3.js +2 -5
- package/dist/_virtual/index3.js.map +1 -1
- package/dist/_virtual/index4.cjs +5 -3
- package/dist/_virtual/index4.cjs.map +1 -1
- package/dist/_virtual/index4.js +5 -2
- package/dist/_virtual/index4.js.map +1 -1
- package/dist/components/generic/TablePagination/TablePagination.cjs +86 -0
- package/dist/components/generic/TablePagination/TablePagination.cjs.map +1 -0
- package/dist/components/generic/TablePagination/TablePagination.d.ts +29 -0
- package/dist/components/generic/TablePagination/TablePagination.d.ts.map +1 -0
- package/dist/components/generic/TablePagination/TablePagination.js +86 -0
- package/dist/components/generic/TablePagination/TablePagination.js.map +1 -0
- package/dist/components/layout/SideNav/studioNavFixtures.d.ts +19 -0
- package/dist/components/layout/SideNav/studioNavFixtures.d.ts.map +1 -0
- package/dist/components/primitives/muiCompat.cjs +0 -84
- package/dist/components/primitives/muiCompat.cjs.map +1 -1
- package/dist/components/primitives/muiCompat.d.ts +1 -1
- package/dist/components/primitives/muiCompat.d.ts.map +1 -1
- package/dist/components/primitives/muiCompat.js +0 -84
- package/dist/components/primitives/muiCompat.js.map +1 -1
- package/dist/fairmint-ui.cjs +2 -1
- package/dist/fairmint-ui.cjs.map +1 -1
- package/dist/fairmint-ui.js +2 -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/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,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=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,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=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,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=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,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=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,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const Select = require("../../primitives/Select/Select.cjs");
|
|
5
|
+
const Group = require("../../../node_modules/@mantine/core/esm/components/Group/Group.cjs");
|
|
6
|
+
const Text = require("../../../node_modules/@mantine/core/esm/components/Text/Text.cjs");
|
|
7
|
+
const Pagination = require("../../../node_modules/@mantine/core/esm/components/Pagination/Pagination.cjs");
|
|
8
|
+
function toSelectOption(option) {
|
|
9
|
+
if (option && typeof option === "object") {
|
|
10
|
+
return { label: String(option.label ?? option.value), value: String(option.value) };
|
|
11
|
+
}
|
|
12
|
+
return { label: String(option), value: String(option) };
|
|
13
|
+
}
|
|
14
|
+
function getRangeLabel(count, page, rowsPerPage) {
|
|
15
|
+
const isAllRows = rowsPerPage === -1;
|
|
16
|
+
const hasRows = count !== 0;
|
|
17
|
+
const firstRow = hasRows ? isAllRows ? 1 : page * rowsPerPage + 1 : 0;
|
|
18
|
+
const lastRow = !hasRows ? 0 : isAllRows ? count === -1 ? firstRow : count : count === -1 ? (page + 1) * rowsPerPage : Math.min(count, (page + 1) * rowsPerPage);
|
|
19
|
+
const totalRowsLabel = count === -1 ? `more than ${lastRow}` : count;
|
|
20
|
+
return `${firstRow}–${lastRow} of ${totalRowsLabel}`;
|
|
21
|
+
}
|
|
22
|
+
function getTotalPages(count, page, rowsPerPage) {
|
|
23
|
+
if (rowsPerPage === -1) {
|
|
24
|
+
return 1;
|
|
25
|
+
}
|
|
26
|
+
if (count === -1) {
|
|
27
|
+
return Math.max(page + 2, 1);
|
|
28
|
+
}
|
|
29
|
+
if (count <= 0) {
|
|
30
|
+
return 1;
|
|
31
|
+
}
|
|
32
|
+
return Math.max(1, Math.ceil(count / rowsPerPage));
|
|
33
|
+
}
|
|
34
|
+
function TablePagination({
|
|
35
|
+
count,
|
|
36
|
+
onPageChange,
|
|
37
|
+
onRowsPerPageChange,
|
|
38
|
+
page,
|
|
39
|
+
rowsPerPage,
|
|
40
|
+
rowsPerPageOptions = [10, 25, 50, 100],
|
|
41
|
+
component: _component,
|
|
42
|
+
className,
|
|
43
|
+
style
|
|
44
|
+
}) {
|
|
45
|
+
const rowsPerPageData = rowsPerPageOptions.map(toSelectOption);
|
|
46
|
+
const totalPages = getTotalPages(count, page, rowsPerPage);
|
|
47
|
+
const activePage = Math.min(Math.max(page + 1, 1), totalPages);
|
|
48
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Group.Group, { gap: "sm", justify: "flex-end", className, style, wrap: "wrap", children: [
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text.Text, { size: "sm", children: "Rows per page:" }),
|
|
50
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
51
|
+
Select.Select,
|
|
52
|
+
{
|
|
53
|
+
"aria-label": "Rows per page",
|
|
54
|
+
value: String(rowsPerPage),
|
|
55
|
+
data: rowsPerPageData,
|
|
56
|
+
onChange: (value) => {
|
|
57
|
+
if (value == null) return;
|
|
58
|
+
onRowsPerPageChange?.({ target: { value } });
|
|
59
|
+
},
|
|
60
|
+
w: 88,
|
|
61
|
+
allowDeselect: false
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text.Text, { size: "sm", children: getRangeLabel(count, page, rowsPerPage) }),
|
|
65
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
+
Pagination.Pagination,
|
|
67
|
+
{
|
|
68
|
+
total: totalPages,
|
|
69
|
+
value: activePage,
|
|
70
|
+
onChange: (nextPage) => onPageChange?.(null, nextPage - 1),
|
|
71
|
+
withEdges: false,
|
|
72
|
+
getControlProps: (control) => {
|
|
73
|
+
if (control === "previous") {
|
|
74
|
+
return { "aria-label": "Previous page" };
|
|
75
|
+
}
|
|
76
|
+
if (control === "next") {
|
|
77
|
+
return { "aria-label": "Next page" };
|
|
78
|
+
}
|
|
79
|
+
return {};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] });
|
|
84
|
+
}
|
|
85
|
+
exports.TablePagination = TablePagination;
|
|
86
|
+
//# sourceMappingURL=TablePagination.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TablePagination.cjs","sources":["../../../../src/components/generic/TablePagination/TablePagination.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport { Group, Pagination, Text } from \"../../primitives/layout\";\nimport { Select } from \"../../primitives/Select/Select\";\n\nexport type TablePaginationRowsPerPageOption = number | { label: ReactNode; value: number };\n\nexport interface TablePaginationProps {\n /** Total row count. Use `-1` when the total is unknown. */\n count: number;\n /** Zero-based page index. */\n page: number;\n /** Rows shown per page. Use `-1` to show all rows. */\n rowsPerPage: number;\n /** Available rows-per-page choices. @default [10, 25, 50, 100] */\n rowsPerPageOptions?: TablePaginationRowsPerPageOption[];\n /** Called with `(event, nextPage)` using a zero-based page index. */\n onPageChange?: (event: unknown, page: number) => void;\n /** Called with a synthetic `{ target: { value } }` change event. */\n onRowsPerPageChange?: (event: { target: { value: string } }) => void;\n /** Ignored MUI-compat prop retained so existing call sites type-check. */\n component?: unknown;\n className?: string;\n style?: CSSProperties;\n}\n\nfunction toSelectOption(option: TablePaginationRowsPerPageOption): {\n label: string;\n value: string;\n} {\n if (option && typeof option === \"object\") {\n return { label: String(option.label ?? option.value), value: String(option.value) };\n }\n\n return { label: String(option), value: String(option) };\n}\n\nfunction getRangeLabel(count: number, page: number, rowsPerPage: number): string {\n const isAllRows = rowsPerPage === -1;\n const hasRows = count !== 0;\n const firstRow = hasRows ? (isAllRows ? 1 : page * rowsPerPage + 1) : 0;\n const lastRow = !hasRows\n ? 0\n : isAllRows\n ? count === -1\n ? firstRow\n : count\n : count === -1\n ? (page + 1) * rowsPerPage\n : Math.min(count, (page + 1) * rowsPerPage);\n const totalRowsLabel = count === -1 ? `more than ${lastRow}` : count;\n\n return `${firstRow}–${lastRow} of ${totalRowsLabel}`;\n}\n\nfunction getTotalPages(count: number, page: number, rowsPerPage: number): number {\n if (rowsPerPage === -1) {\n return 1;\n }\n\n if (count === -1) {\n // Unknown totals: keep the current page selectable and one page ahead available.\n return Math.max(page + 2, 1);\n }\n\n if (count <= 0) {\n return 1;\n }\n\n return Math.max(1, Math.ceil(count / rowsPerPage));\n}\n\nexport function TablePagination({\n count,\n onPageChange,\n onRowsPerPageChange,\n page,\n rowsPerPage,\n rowsPerPageOptions = [10, 25, 50, 100],\n component: _component,\n className,\n style,\n}: TablePaginationProps) {\n const rowsPerPageData = rowsPerPageOptions.map(toSelectOption);\n const totalPages = getTotalPages(count, page, rowsPerPage);\n const activePage = Math.min(Math.max(page + 1, 1), totalPages);\n\n return (\n <Group gap=\"sm\" justify=\"flex-end\" className={className} style={style} wrap=\"wrap\">\n <Text size=\"sm\">Rows per page:</Text>\n <Select\n aria-label=\"Rows per page\"\n value={String(rowsPerPage)}\n data={rowsPerPageData}\n onChange={(value: string | null) => {\n if (value == null) return;\n onRowsPerPageChange?.({ target: { value } });\n }}\n w={88}\n allowDeselect={false}\n />\n <Text size=\"sm\">{getRangeLabel(count, page, rowsPerPage)}</Text>\n <Pagination\n total={totalPages}\n value={activePage}\n onChange={(nextPage) => onPageChange?.(null, nextPage - 1)}\n withEdges={false}\n getControlProps={(control) => {\n if (control === \"previous\") {\n return { \"aria-label\": \"Previous page\" };\n }\n if (control === \"next\") {\n return { \"aria-label\": \"Next page\" };\n }\n return {};\n }}\n />\n </Group>\n );\n}\n"],"names":["jsxs","Group","jsx","Text","Select","Pagination"],"mappings":";;;;;;;AAyBA,SAAS,eAAe,QAGtB;AACA,MAAI,UAAU,OAAO,WAAW,UAAU;AACxC,WAAO,EAAE,OAAO,OAAO,OAAO,SAAS,OAAO,KAAK,GAAG,OAAO,OAAO,OAAO,KAAK,EAAA;AAAA,EAClF;AAEA,SAAO,EAAE,OAAO,OAAO,MAAM,GAAG,OAAO,OAAO,MAAM,EAAA;AACtD;AAEA,SAAS,cAAc,OAAe,MAAc,aAA6B;AAC/E,QAAM,YAAY,gBAAgB;AAClC,QAAM,UAAU,UAAU;AAC1B,QAAM,WAAW,UAAW,YAAY,IAAI,OAAO,cAAc,IAAK;AACtE,QAAM,UAAU,CAAC,UACb,IACA,YACE,UAAU,KACR,WACA,QACF,UAAU,MACP,OAAO,KAAK,cACb,KAAK,IAAI,QAAQ,OAAO,KAAK,WAAW;AAChD,QAAM,iBAAiB,UAAU,KAAK,aAAa,OAAO,KAAK;AAE/D,SAAO,GAAG,QAAQ,IAAI,OAAO,OAAO,cAAc;AACpD;AAEA,SAAS,c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AAAA,QACP,UAAU,CAAC,aAAa,eAAe,MAAM,WAAW,CAAC;AAAA,QACzD,WAAW;AAAA,QACX,iBAAiB,CAAC,YAAY;AAC5B,cAAI,YAAY,YAAY;AAC1B,mBAAO,EAAE,cAAc,gBAAA;AAAA,UACzB;AACA,cAAI,YAAY,QAAQ;AACtB,mBAAO,EAAE,cAAc,YAAA;AAAA,UACzB;AACA,iBAAO,CAAA;AAAA,QACT;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export type TablePaginationRowsPerPageOption = number | {
|
|
3
|
+
label: ReactNode;
|
|
4
|
+
value: number;
|
|
5
|
+
};
|
|
6
|
+
export interface TablePaginationProps {
|
|
7
|
+
/** Total row count. Use `-1` when the total is unknown. */
|
|
8
|
+
count: number;
|
|
9
|
+
/** Zero-based page index. */
|
|
10
|
+
page: number;
|
|
11
|
+
/** Rows shown per page. Use `-1` to show all rows. */
|
|
12
|
+
rowsPerPage: number;
|
|
13
|
+
/** Available rows-per-page choices. @default [10, 25, 50, 100] */
|
|
14
|
+
rowsPerPageOptions?: TablePaginationRowsPerPageOption[];
|
|
15
|
+
/** Called with `(event, nextPage)` using a zero-based page index. */
|
|
16
|
+
onPageChange?: (event: unknown, page: number) => void;
|
|
17
|
+
/** Called with a synthetic `{ target: { value } }` change event. */
|
|
18
|
+
onRowsPerPageChange?: (event: {
|
|
19
|
+
target: {
|
|
20
|
+
value: string;
|
|
21
|
+
};
|
|
22
|
+
}) => void;
|
|
23
|
+
/** Ignored MUI-compat prop retained so existing call sites type-check. */
|
|
24
|
+
component?: unknown;
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
export declare function TablePagination({ count, onPageChange, onRowsPerPageChange, page, rowsPerPage, rowsPerPageOptions, component: _component, className, style, }: TablePaginationProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=TablePagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TablePagination.d.ts","sourceRoot":"","sources":["../../../../src/components/generic/TablePagination/TablePagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAItD,MAAM,MAAM,gCAAgC,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5F,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,kBAAkB,CAAC,EAAE,gCAAgC,EAAE,CAAC;IACxD,qEAAqE;IACrE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IACrE,0EAA0E;IAC1E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAgDD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,YAAY,EACZ,mBAAmB,EACnB,IAAI,EACJ,WAAW,EACX,kBAAsC,EACtC,SAAS,EAAE,UAAU,EACrB,SAAS,EACT,KAAK,GACN,EAAE,oBAAoB,2CAqCtB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Select } from "../../primitives/Select/Select.js";
|
|
3
|
+
import { Group } from "../../../node_modules/@mantine/core/esm/components/Group/Group.js";
|
|
4
|
+
import { Text } from "../../../node_modules/@mantine/core/esm/components/Text/Text.js";
|
|
5
|
+
import { Pagination } from "../../../node_modules/@mantine/core/esm/components/Pagination/Pagination.js";
|
|
6
|
+
function toSelectOption(option) {
|
|
7
|
+
if (option && typeof option === "object") {
|
|
8
|
+
return { label: String(option.label ?? option.value), value: String(option.value) };
|
|
9
|
+
}
|
|
10
|
+
return { label: String(option), value: String(option) };
|
|
11
|
+
}
|
|
12
|
+
function getRangeLabel(count, page, rowsPerPage) {
|
|
13
|
+
const isAllRows = rowsPerPage === -1;
|
|
14
|
+
const hasRows = count !== 0;
|
|
15
|
+
const firstRow = hasRows ? isAllRows ? 1 : page * rowsPerPage + 1 : 0;
|
|
16
|
+
const lastRow = !hasRows ? 0 : isAllRows ? count === -1 ? firstRow : count : count === -1 ? (page + 1) * rowsPerPage : Math.min(count, (page + 1) * rowsPerPage);
|
|
17
|
+
const totalRowsLabel = count === -1 ? `more than ${lastRow}` : count;
|
|
18
|
+
return `${firstRow}–${lastRow} of ${totalRowsLabel}`;
|
|
19
|
+
}
|
|
20
|
+
function getTotalPages(count, page, rowsPerPage) {
|
|
21
|
+
if (rowsPerPage === -1) {
|
|
22
|
+
return 1;
|
|
23
|
+
}
|
|
24
|
+
if (count === -1) {
|
|
25
|
+
return Math.max(page + 2, 1);
|
|
26
|
+
}
|
|
27
|
+
if (count <= 0) {
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
return Math.max(1, Math.ceil(count / rowsPerPage));
|
|
31
|
+
}
|
|
32
|
+
function TablePagination({
|
|
33
|
+
count,
|
|
34
|
+
onPageChange,
|
|
35
|
+
onRowsPerPageChange,
|
|
36
|
+
page,
|
|
37
|
+
rowsPerPage,
|
|
38
|
+
rowsPerPageOptions = [10, 25, 50, 100],
|
|
39
|
+
component: _component,
|
|
40
|
+
className,
|
|
41
|
+
style
|
|
42
|
+
}) {
|
|
43
|
+
const rowsPerPageData = rowsPerPageOptions.map(toSelectOption);
|
|
44
|
+
const totalPages = getTotalPages(count, page, rowsPerPage);
|
|
45
|
+
const activePage = Math.min(Math.max(page + 1, 1), totalPages);
|
|
46
|
+
return /* @__PURE__ */ jsxs(Group, { gap: "sm", justify: "flex-end", className, style, wrap: "wrap", children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", children: "Rows per page:" }),
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
Select,
|
|
50
|
+
{
|
|
51
|
+
"aria-label": "Rows per page",
|
|
52
|
+
value: String(rowsPerPage),
|
|
53
|
+
data: rowsPerPageData,
|
|
54
|
+
onChange: (value) => {
|
|
55
|
+
if (value == null) return;
|
|
56
|
+
onRowsPerPageChange?.({ target: { value } });
|
|
57
|
+
},
|
|
58
|
+
w: 88,
|
|
59
|
+
allowDeselect: false
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", children: getRangeLabel(count, page, rowsPerPage) }),
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
Pagination,
|
|
65
|
+
{
|
|
66
|
+
total: totalPages,
|
|
67
|
+
value: activePage,
|
|
68
|
+
onChange: (nextPage) => onPageChange?.(null, nextPage - 1),
|
|
69
|
+
withEdges: false,
|
|
70
|
+
getControlProps: (control) => {
|
|
71
|
+
if (control === "previous") {
|
|
72
|
+
return { "aria-label": "Previous page" };
|
|
73
|
+
}
|
|
74
|
+
if (control === "next") {
|
|
75
|
+
return { "aria-label": "Next page" };
|
|
76
|
+
}
|
|
77
|
+
return {};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
] });
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
TablePagination
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=TablePagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TablePagination.js","sources":["../../../../src/components/generic/TablePagination/TablePagination.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport { Group, Pagination, Text } from \"../../primitives/layout\";\nimport { Select } from \"../../primitives/Select/Select\";\n\nexport type TablePaginationRowsPerPageOption = number | { label: ReactNode; value: number };\n\nexport interface TablePaginationProps {\n /** Total row count. Use `-1` when the total is unknown. */\n count: number;\n /** Zero-based page index. */\n page: number;\n /** Rows shown per page. Use `-1` to show all rows. */\n rowsPerPage: number;\n /** Available rows-per-page choices. @default [10, 25, 50, 100] */\n rowsPerPageOptions?: TablePaginationRowsPerPageOption[];\n /** Called with `(event, nextPage)` using a zero-based page index. */\n onPageChange?: (event: unknown, page: number) => void;\n /** Called with a synthetic `{ target: { value } }` change event. */\n onRowsPerPageChange?: (event: { target: { value: string } }) => void;\n /** Ignored MUI-compat prop retained so existing call sites type-check. */\n component?: unknown;\n className?: string;\n style?: CSSProperties;\n}\n\nfunction toSelectOption(option: TablePaginationRowsPerPageOption): {\n label: string;\n value: string;\n} {\n if (option && typeof option === \"object\") {\n return { label: String(option.label ?? option.value), value: String(option.value) };\n }\n\n return { label: String(option), value: String(option) };\n}\n\nfunction getRangeLabel(count: number, page: number, rowsPerPage: number): string {\n const isAllRows = rowsPerPage === -1;\n const hasRows = count !== 0;\n const firstRow = hasRows ? (isAllRows ? 1 : page * rowsPerPage + 1) : 0;\n const lastRow = !hasRows\n ? 0\n : isAllRows\n ? count === -1\n ? firstRow\n : count\n : count === -1\n ? (page + 1) * rowsPerPage\n : Math.min(count, (page + 1) * rowsPerPage);\n const totalRowsLabel = count === -1 ? `more than ${lastRow}` : count;\n\n return `${firstRow}–${lastRow} of ${totalRowsLabel}`;\n}\n\nfunction getTotalPages(count: number, page: number, rowsPerPage: number): number {\n if (rowsPerPage === -1) {\n return 1;\n }\n\n if (count === -1) {\n // Unknown totals: keep the current page selectable and one page ahead available.\n return Math.max(page + 2, 1);\n }\n\n if (count <= 0) {\n return 1;\n }\n\n return Math.max(1, Math.ceil(count / rowsPerPage));\n}\n\nexport function TablePagination({\n count,\n onPageChange,\n onRowsPerPageChange,\n page,\n rowsPerPage,\n rowsPerPageOptions = [10, 25, 50, 100],\n component: _component,\n className,\n style,\n}: TablePaginationProps) {\n const rowsPerPageData = rowsPerPageOptions.map(toSelectOption);\n const totalPages = getTotalPages(count, page, rowsPerPage);\n const activePage = Math.min(Math.max(page + 1, 1), totalPages);\n\n return (\n <Group gap=\"sm\" justify=\"flex-end\" className={className} style={style} wrap=\"wrap\">\n <Text size=\"sm\">Rows per page:</Text>\n <Select\n aria-label=\"Rows per page\"\n value={String(rowsPerPage)}\n data={rowsPerPageData}\n onChange={(value: string | null) => {\n if (value == null) return;\n onRowsPerPageChange?.({ target: { value } });\n }}\n w={88}\n allowDeselect={false}\n />\n <Text size=\"sm\">{getRangeLabel(count, page, rowsPerPage)}</Text>\n <Pagination\n total={totalPages}\n value={activePage}\n onChange={(nextPage) => onPageChange?.(null, nextPage - 1)}\n withEdges={false}\n getControlProps={(control) => {\n if (control === \"previous\") {\n return { \"aria-label\": \"Previous page\" };\n }\n if (control === \"next\") {\n return { \"aria-label\": \"Next page\" };\n }\n return {};\n }}\n />\n </Group>\n );\n}\n"],"names":[],"mappings":";;;;;AAyBA,SAAS,eAAe,QAGtB;AACA,MAAI,UAAU,OAAO,WAAW,UAAU;AACxC,WAAO,EAAE,OAAO,OAAO,OAAO,SAAS,OAAO,KAAK,GAAG,OAAO,OAAO,OAAO,KAAK,EAAA;AAAA,EAClF;AAEA,SAAO,EAAE,OAAO,OAAO,MAAM,GAAG,OAAO,OAAO,MAAM,EAAA;AACtD;AAEA,SAAS,cAAc,OAAe,MAAc,aAA6B;AAC/E,QAAM,YAAY,gBAAgB;AAClC,QAAM,UAAU,UAAU;AAC1B,QAAM,WAAW,UAAW,YAAY,IAAI,OAAO,cAAc,IAAK;AACtE,QAAM,UAAU,CAAC,UACb,IACA,YACE,UAAU,KACR,WACA,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AAK,MAAM,wBAAc,OAAO,MAAM,WAAW,GAAE;AAAA,IACzD;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,QACP,OAAO;AAAA,QACP,UAAU,CAAC,aAAa,eAAe,MAAM,WAAW,CAAC;AAAA,QACzD,WAAW;AAAA,QACX,iBAAiB,CAAC,YAAY;AAC5B,cAAI,YAAY,YAAY;AAC1B,mBAAO,EAAE,cAAc,gBAAA;AAAA,UACzB;AACA,cAAI,YAAY,QAAQ;AACtB,mBAAO,EAAE,cAAc,YAAA;AAAA,UACzB;AACA,iBAAO,CAAA;AAAA,QACT;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SideNavProps } from './SideNav';
|
|
2
|
+
/** New / unified portals: Fundraising replaces legacy Investments / Shares / SAFEs / Warrants. */
|
|
3
|
+
export declare const studioUnifiedSections: NonNullable<SideNavProps["sections"]>;
|
|
4
|
+
/** Unified portal that also sponsors an SPV vehicle. */
|
|
5
|
+
export declare const studioUnifiedWithSpvSections: NonNullable<SideNavProps["sections"]>;
|
|
6
|
+
/**
|
|
7
|
+
* Legacy issuer portal — SAFEs is the series list, not a rename of Fundraising.
|
|
8
|
+
* Fundraising is gated separately (send-one-safe / custom docs).
|
|
9
|
+
*/
|
|
10
|
+
export declare const studioLegacySections: NonNullable<SideNavProps["sections"]>;
|
|
11
|
+
/** Legacy portal with Fundraising enabled — both SAFEs and Fundraising appear. */
|
|
12
|
+
export declare const studioLegacyWithFundraisingSections: NonNullable<SideNavProps["sections"]>;
|
|
13
|
+
/** Master / venture fund portals — no Cap Table / Fundraising / Grants / Tax. */
|
|
14
|
+
export declare const studioFundSections: NonNullable<SideNavProps["sections"]>;
|
|
15
|
+
/** Labels that must appear for the unified (new portal) Studio nav. */
|
|
16
|
+
export declare const STUDIO_UNIFIED_TOP_LEVEL_LABELS: readonly ["Dashboard", "Stakeholders", "Cap Table", "Fundraising", "Grants", "Tax & Compliance", "Documents"];
|
|
17
|
+
/** Labels that must appear for the classic legacy Studio nav. */
|
|
18
|
+
export declare const STUDIO_LEGACY_TOP_LEVEL_LABELS: readonly ["Dashboard", "Stakeholders", "Investments", "Cap Table", "Shares", "SAFEs", "Warrants", "Grants", "Tax & Compliance", "Documents"];
|
|
19
|
+
//# sourceMappingURL=studioNavFixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studioNavFixtures.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/SideNav/studioNavFixtures.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AA0G9C,kGAAkG;AAClG,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAKvE,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAK9E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAgBtE,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,mCAAmC,EAAE,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAiBrF,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAmBpE,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,+BAA+B,+GAQlC,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,8BAA8B,8IAWjC,CAAC"}
|
|
@@ -25,23 +25,6 @@ const Stack$1 = require("../../node_modules/@mantine/core/esm/components/Stack/S
|
|
|
25
25
|
const Menu = require("../../node_modules/@mantine/core/esm/components/Menu/Menu.cjs");
|
|
26
26
|
const TextInput = require("../../node_modules/@mantine/core/esm/components/TextInput/TextInput.cjs");
|
|
27
27
|
dayjs_min.extend(customParseFormat);
|
|
28
|
-
const ChevronIcon = ({ direction }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
29
|
-
"svg",
|
|
30
|
-
{
|
|
31
|
-
"aria-hidden": "true",
|
|
32
|
-
fill: "none",
|
|
33
|
-
focusable: "false",
|
|
34
|
-
height: "20",
|
|
35
|
-
stroke: "currentColor",
|
|
36
|
-
strokeLinecap: "round",
|
|
37
|
-
strokeLinejoin: "round",
|
|
38
|
-
strokeWidth: "2",
|
|
39
|
-
viewBox: "0 0 24 24",
|
|
40
|
-
width: "20",
|
|
41
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: direction === "left" ? "M15 6 9 12l6 6" : "m9 6 6 6-6 6" })
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
28
|
const compatBreakpointKeys = ["xs", "sm", "md", "lg", "xl"];
|
|
46
29
|
const compatFallbackBreakpoints = {
|
|
47
30
|
xs: "30em",
|
|
@@ -628,72 +611,6 @@ const TableCell = ({ align, children, component, style, sx: sx2, ...props }) =>
|
|
|
628
611
|
const CellComponent = component === "th" ? Table.Table.Th : Table.Table.Td;
|
|
629
612
|
return /* @__PURE__ */ jsxRuntime.jsx(CellComponent, { ta: align, style: { ...sxToStyle(sx2), ...style }, ...props, children });
|
|
630
613
|
};
|
|
631
|
-
const TablePagination = ({
|
|
632
|
-
count,
|
|
633
|
-
onPageChange,
|
|
634
|
-
onRowsPerPageChange,
|
|
635
|
-
page,
|
|
636
|
-
rowsPerPage,
|
|
637
|
-
rowsPerPageOptions = [10, 25, 50, 100]
|
|
638
|
-
}) => {
|
|
639
|
-
const isAllRows = rowsPerPage === -1;
|
|
640
|
-
const hasRows = count !== 0;
|
|
641
|
-
const firstRow = hasRows ? isAllRows ? 1 : page * rowsPerPage + 1 : 0;
|
|
642
|
-
const lastRow = !hasRows ? 0 : isAllRows ? count === -1 ? firstRow : count : count === -1 ? (page + 1) * rowsPerPage : Math.min(count, (page + 1) * rowsPerPage);
|
|
643
|
-
const totalRowsLabel = count === -1 ? `more than ${lastRow}` : count;
|
|
644
|
-
const canGoBack = page > 0;
|
|
645
|
-
const canGoForward = count === -1 ? !isAllRows : !isAllRows && (page + 1) * rowsPerPage < count;
|
|
646
|
-
const rowsPerPageData = rowsPerPageOptions.map((option) => {
|
|
647
|
-
if (option && typeof option === "object") {
|
|
648
|
-
return { label: String(option.label ?? option.value), value: String(option.value) };
|
|
649
|
-
}
|
|
650
|
-
return { label: String(option), value: String(option) };
|
|
651
|
-
});
|
|
652
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Group.Group, { gap: "sm", justify: "flex-end", children: [
|
|
653
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text.Text, { size: "sm", children: "Rows per page:" }),
|
|
654
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
655
|
-
Select.Select,
|
|
656
|
-
{
|
|
657
|
-
value: String(rowsPerPage),
|
|
658
|
-
data: rowsPerPageData,
|
|
659
|
-
onChange: (value) => onRowsPerPageChange?.({ target: { value } })
|
|
660
|
-
}
|
|
661
|
-
),
|
|
662
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Text.Text, { size: "sm", children: [
|
|
663
|
-
firstRow,
|
|
664
|
-
"–",
|
|
665
|
-
lastRow,
|
|
666
|
-
" of ",
|
|
667
|
-
totalRowsLabel
|
|
668
|
-
] }),
|
|
669
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Group.Group, { gap: "xs", children: [
|
|
670
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
671
|
-
ActionIcon.ActionIcon,
|
|
672
|
-
{
|
|
673
|
-
"aria-label": "Previous page",
|
|
674
|
-
disabled: !canGoBack,
|
|
675
|
-
onClick: (event) => onPageChange?.(event, page - 1),
|
|
676
|
-
color: resolveCompatColor("default"),
|
|
677
|
-
type: "button",
|
|
678
|
-
variant: "subtle",
|
|
679
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, { direction: "left" })
|
|
680
|
-
}
|
|
681
|
-
),
|
|
682
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
683
|
-
ActionIcon.ActionIcon,
|
|
684
|
-
{
|
|
685
|
-
"aria-label": "Next page",
|
|
686
|
-
disabled: !canGoForward,
|
|
687
|
-
onClick: (event) => onPageChange?.(event, page + 1),
|
|
688
|
-
color: resolveCompatColor("default"),
|
|
689
|
-
type: "button",
|
|
690
|
-
variant: "subtle",
|
|
691
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, { direction: "right" })
|
|
692
|
-
}
|
|
693
|
-
)
|
|
694
|
-
] })
|
|
695
|
-
] });
|
|
696
|
-
};
|
|
697
614
|
const MenuItem = ({ children, component, disabled, onClick, value, ...props }) => {
|
|
698
615
|
const Component = component || Menu.Menu.Item;
|
|
699
616
|
return /* @__PURE__ */ jsxRuntime.jsx(Component, { disabled, onClick, value, ...props, children });
|
|
@@ -1605,7 +1522,6 @@ exports.SvgIcon = SvgIcon;
|
|
|
1605
1522
|
exports.TableBody = TableBody;
|
|
1606
1523
|
exports.TableCell = TableCell;
|
|
1607
1524
|
exports.TableHead = TableHead;
|
|
1608
|
-
exports.TablePagination = TablePagination;
|
|
1609
1525
|
exports.TableRow = TableRow;
|
|
1610
1526
|
exports.TextField = TextField;
|
|
1611
1527
|
exports.ThemeProvider = ThemeProvider;
|