mogh_ui 0.1.0
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/color.cjs +62 -0
- package/dist/color.cjs.map +1 -0
- package/dist/color.d.cts +5 -0
- package/dist/color.d.ts +5 -0
- package/dist/color.js +37 -0
- package/dist/color.js.map +1 -0
- package/dist/components/back-button.cjs +43 -0
- package/dist/components/back-button.cjs.map +1 -0
- package/dist/components/back-button.d.cts +9 -0
- package/dist/components/back-button.d.ts +9 -0
- package/dist/components/back-button.js +19 -0
- package/dist/components/back-button.js.map +1 -0
- package/dist/components/config/confirm.cjs +191 -0
- package/dist/components/config/confirm.cjs.map +1 -0
- package/dist/components/config/confirm.d.cts +20 -0
- package/dist/components/config/confirm.d.ts +20 -0
- package/dist/components/config/confirm.js +167 -0
- package/dist/components/config/confirm.js.map +1 -0
- package/dist/components/config/group.cjs +102 -0
- package/dist/components/config/group.cjs.map +1 -0
- package/dist/components/config/group.d.cts +11 -0
- package/dist/components/config/group.d.ts +11 -0
- package/dist/components/config/group.js +78 -0
- package/dist/components/config/group.js.map +1 -0
- package/dist/components/config/index.cjs +237 -0
- package/dist/components/config/index.cjs.map +1 -0
- package/dist/components/config/index.d.cts +62 -0
- package/dist/components/config/index.d.ts +62 -0
- package/dist/components/config/index.js +217 -0
- package/dist/components/config/index.js.map +1 -0
- package/dist/components/config/item.cjs +139 -0
- package/dist/components/config/item.cjs.map +1 -0
- package/dist/components/config/item.d.cts +45 -0
- package/dist/components/config/item.d.ts +45 -0
- package/dist/components/config/item.js +119 -0
- package/dist/components/config/item.js.map +1 -0
- package/dist/components/config/layout.cjs +44 -0
- package/dist/components/config/layout.cjs.map +1 -0
- package/dist/components/config/layout.d.cts +11 -0
- package/dist/components/config/layout.d.ts +11 -0
- package/dist/components/config/layout.js +20 -0
- package/dist/components/config/layout.js.map +1 -0
- package/dist/components/config/unsaved-changes.cjs +47 -0
- package/dist/components/config/unsaved-changes.cjs.map +1 -0
- package/dist/components/config/unsaved-changes.d.cts +7 -0
- package/dist/components/config/unsaved-changes.d.ts +7 -0
- package/dist/components/config/unsaved-changes.js +23 -0
- package/dist/components/config/unsaved-changes.js.map +1 -0
- package/dist/components/confirm-button.cjs +85 -0
- package/dist/components/confirm-button.cjs.map +1 -0
- package/dist/components/confirm-button.d.cts +23 -0
- package/dist/components/confirm-button.d.ts +23 -0
- package/dist/components/confirm-button.js +69 -0
- package/dist/components/confirm-button.js.map +1 -0
- package/dist/components/confirm-icon.cjs +70 -0
- package/dist/components/confirm-icon.cjs.map +1 -0
- package/dist/components/confirm-icon.d.cts +20 -0
- package/dist/components/confirm-icon.d.ts +20 -0
- package/dist/components/confirm-icon.js +54 -0
- package/dist/components/confirm-icon.js.map +1 -0
- package/dist/components/confirm-modal.cjs +146 -0
- package/dist/components/confirm-modal.cjs.map +1 -0
- package/dist/components/confirm-modal.d.cts +25 -0
- package/dist/components/confirm-modal.d.ts +25 -0
- package/dist/components/confirm-modal.js +130 -0
- package/dist/components/confirm-modal.js.map +1 -0
- package/dist/components/copy-button.cjs +68 -0
- package/dist/components/copy-button.cjs.map +1 -0
- package/dist/components/copy-button.d.cts +15 -0
- package/dist/components/copy-button.d.ts +15 -0
- package/dist/components/copy-button.js +46 -0
- package/dist/components/copy-button.js.map +1 -0
- package/dist/components/copy-text.cjs +63 -0
- package/dist/components/copy-text.cjs.map +1 -0
- package/dist/components/copy-text.d.cts +11 -0
- package/dist/components/copy-text.d.ts +11 -0
- package/dist/components/copy-text.js +39 -0
- package/dist/components/copy-text.js.map +1 -0
- package/dist/components/create-modal.cjs +100 -0
- package/dist/components/create-modal.cjs.map +1 -0
- package/dist/components/create-modal.d.cts +18 -0
- package/dist/components/create-modal.d.ts +18 -0
- package/dist/components/create-modal.js +82 -0
- package/dist/components/create-modal.js.map +1 -0
- package/dist/components/data-table.cjs +240 -0
- package/dist/components/data-table.cjs.map +1 -0
- package/dist/components/data-table.d.cts +36 -0
- package/dist/components/data-table.d.ts +36 -0
- package/dist/components/data-table.js +233 -0
- package/dist/components/data-table.js.map +1 -0
- package/dist/components/divided-children/index.cjs +53 -0
- package/dist/components/divided-children/index.cjs.map +1 -0
- package/dist/components/divided-children/index.d.cts +15 -0
- package/dist/components/divided-children/index.d.ts +15 -0
- package/dist/components/divided-children/index.js +19 -0
- package/dist/components/divided-children/index.js.map +1 -0
- package/dist/components/divided-children/index.module.scss +4 -0
- package/dist/components/enable-switch.cjs +67 -0
- package/dist/components/enable-switch.cjs.map +1 -0
- package/dist/components/enable-switch.d.cts +12 -0
- package/dist/components/enable-switch.d.ts +12 -0
- package/dist/components/enable-switch.js +43 -0
- package/dist/components/enable-switch.js.map +1 -0
- package/dist/components/entity-header.cjs +137 -0
- package/dist/components/entity-header.cjs.map +1 -0
- package/dist/components/entity-header.d.cts +20 -0
- package/dist/components/entity-header.d.ts +20 -0
- package/dist/components/entity-header.js +113 -0
- package/dist/components/entity-header.js.map +1 -0
- package/dist/components/entity-page.cjs +45 -0
- package/dist/components/entity-page.cjs.map +1 -0
- package/dist/components/entity-page.d.cts +11 -0
- package/dist/components/entity-page.d.ts +11 -0
- package/dist/components/entity-page.js +21 -0
- package/dist/components/entity-page.js.map +1 -0
- package/dist/components/fancy-card/index.cjs +52 -0
- package/dist/components/fancy-card/index.cjs.map +1 -0
- package/dist/components/fancy-card/index.d.cts +17 -0
- package/dist/components/fancy-card/index.d.ts +17 -0
- package/dist/components/fancy-card/index.js +18 -0
- package/dist/components/fancy-card/index.js.map +1 -0
- package/dist/components/fancy-card/index.module.scss +13 -0
- package/dist/components/hover-error.cjs +60 -0
- package/dist/components/hover-error.cjs.map +1 -0
- package/dist/components/hover-error.d.cts +9 -0
- package/dist/components/hover-error.d.ts +9 -0
- package/dist/components/hover-error.js +36 -0
- package/dist/components/hover-error.js.map +1 -0
- package/dist/components/info-card.cjs +44 -0
- package/dist/components/info-card.cjs.map +1 -0
- package/dist/components/info-card.d.cts +21 -0
- package/dist/components/info-card.d.ts +21 -0
- package/dist/components/info-card.js +25 -0
- package/dist/components/info-card.js.map +1 -0
- package/dist/components/input-list.cjs +68 -0
- package/dist/components/input-list.cjs.map +1 -0
- package/dist/components/input-list.d.cts +14 -0
- package/dist/components/input-list.d.ts +14 -0
- package/dist/components/input-list.js +44 -0
- package/dist/components/input-list.js.map +1 -0
- package/dist/components/labelled-switch.cjs +68 -0
- package/dist/components/labelled-switch.cjs.map +1 -0
- package/dist/components/labelled-switch.d.cts +14 -0
- package/dist/components/labelled-switch.d.ts +14 -0
- package/dist/components/labelled-switch.js +48 -0
- package/dist/components/labelled-switch.js.map +1 -0
- package/dist/components/labels-group.cjs +44 -0
- package/dist/components/labels-group.cjs.map +1 -0
- package/dist/components/labels-group.d.cts +10 -0
- package/dist/components/labels-group.d.ts +10 -0
- package/dist/components/labels-group.js +20 -0
- package/dist/components/labels-group.js.map +1 -0
- package/dist/components/loading-screen.cjs +37 -0
- package/dist/components/loading-screen.cjs.map +1 -0
- package/dist/components/loading-screen.d.cts +8 -0
- package/dist/components/loading-screen.d.ts +8 -0
- package/dist/components/loading-screen.js +13 -0
- package/dist/components/loading-screen.js.map +1 -0
- package/dist/components/mobile-friendly-tabs.cjs +141 -0
- package/dist/components/mobile-friendly-tabs.cjs.map +1 -0
- package/dist/components/mobile-friendly-tabs.d.cts +43 -0
- package/dist/components/mobile-friendly-tabs.d.ts +43 -0
- package/dist/components/mobile-friendly-tabs.js +120 -0
- package/dist/components/mobile-friendly-tabs.js.map +1 -0
- package/dist/components/monaco/index.cjs +244 -0
- package/dist/components/monaco/index.cjs.map +1 -0
- package/dist/components/monaco/index.d.cts +32 -0
- package/dist/components/monaco/index.d.ts +32 -0
- package/dist/components/monaco/index.js +208 -0
- package/dist/components/monaco/index.js.map +1 -0
- package/dist/components/monaco/index.scss +3 -0
- package/dist/components/monaco/init.cjs +73 -0
- package/dist/components/monaco/init.cjs.map +1 -0
- package/dist/components/monaco/init.d.cts +2 -0
- package/dist/components/monaco/init.d.ts +2 -0
- package/dist/components/monaco/init.js +49 -0
- package/dist/components/monaco/init.js.map +1 -0
- package/dist/components/monaco/syntax/fancy_toml.cjs +241 -0
- package/dist/components/monaco/syntax/fancy_toml.cjs.map +1 -0
- package/dist/components/monaco/syntax/fancy_toml.d.cts +2 -0
- package/dist/components/monaco/syntax/fancy_toml.d.ts +2 -0
- package/dist/components/monaco/syntax/fancy_toml.js +218 -0
- package/dist/components/monaco/syntax/fancy_toml.js.map +1 -0
- package/dist/components/monaco/syntax/key_value.cjs +107 -0
- package/dist/components/monaco/syntax/key_value.cjs.map +1 -0
- package/dist/components/monaco/syntax/key_value.d.cts +2 -0
- package/dist/components/monaco/syntax/key_value.d.ts +2 -0
- package/dist/components/monaco/syntax/key_value.js +84 -0
- package/dist/components/monaco/syntax/key_value.js.map +1 -0
- package/dist/components/monaco/syntax/shell.cjs +246 -0
- package/dist/components/monaco/syntax/shell.cjs.map +1 -0
- package/dist/components/monaco/syntax/shell.d.cts +2 -0
- package/dist/components/monaco/syntax/shell.d.ts +2 -0
- package/dist/components/monaco/syntax/shell.js +223 -0
- package/dist/components/monaco/syntax/shell.js.map +1 -0
- package/dist/components/monaco/syntax/string_list.cjs +75 -0
- package/dist/components/monaco/syntax/string_list.cjs.map +1 -0
- package/dist/components/monaco/syntax/string_list.d.cts +2 -0
- package/dist/components/monaco/syntax/string_list.d.ts +2 -0
- package/dist/components/monaco/syntax/string_list.js +52 -0
- package/dist/components/monaco/syntax/string_list.js.map +1 -0
- package/dist/components/monaco/syntax/toml.cjs +157 -0
- package/dist/components/monaco/syntax/toml.cjs.map +1 -0
- package/dist/components/monaco/syntax/toml.d.cts +2 -0
- package/dist/components/monaco/syntax/toml.d.ts +2 -0
- package/dist/components/monaco/syntax/toml.js +134 -0
- package/dist/components/monaco/syntax/toml.js.map +1 -0
- package/dist/components/monaco/syntax/yaml.cjs +250 -0
- package/dist/components/monaco/syntax/yaml.cjs.map +1 -0
- package/dist/components/monaco/syntax/yaml.d.cts +2 -0
- package/dist/components/monaco/syntax/yaml.d.ts +2 -0
- package/dist/components/monaco/syntax/yaml.js +227 -0
- package/dist/components/monaco/syntax/yaml.js.map +1 -0
- package/dist/components/monaco/theme.cjs +721 -0
- package/dist/components/monaco/theme.cjs.map +1 -0
- package/dist/components/monaco/theme.d.cts +2 -0
- package/dist/components/monaco/theme.d.ts +2 -0
- package/dist/components/monaco/theme.js +698 -0
- package/dist/components/monaco/theme.js.map +1 -0
- package/dist/components/page-guard.cjs +44 -0
- package/dist/components/page-guard.cjs.map +1 -0
- package/dist/components/page-guard.d.cts +13 -0
- package/dist/components/page-guard.d.ts +13 -0
- package/dist/components/page-guard.js +20 -0
- package/dist/components/page-guard.js.map +1 -0
- package/dist/components/page.cjs +81 -0
- package/dist/components/page.cjs.map +1 -0
- package/dist/components/page.d.cts +31 -0
- package/dist/components/page.d.ts +31 -0
- package/dist/components/page.js +63 -0
- package/dist/components/page.js.map +1 -0
- package/dist/components/search-input.cjs +51 -0
- package/dist/components/search-input.cjs.map +1 -0
- package/dist/components/search-input.d.cts +9 -0
- package/dist/components/search-input.d.ts +9 -0
- package/dist/components/search-input.js +27 -0
- package/dist/components/search-input.js.map +1 -0
- package/dist/components/section.cjs +100 -0
- package/dist/components/section.cjs.map +1 -0
- package/dist/components/section.d.cts +33 -0
- package/dist/components/section.d.ts +33 -0
- package/dist/components/section.js +83 -0
- package/dist/components/section.js.map +1 -0
- package/dist/components/shared-text-update.cjs +83 -0
- package/dist/components/shared-text-update.cjs.map +1 -0
- package/dist/components/shared-text-update.d.cts +20 -0
- package/dist/components/shared-text-update.d.ts +20 -0
- package/dist/components/shared-text-update.js +65 -0
- package/dist/components/shared-text-update.js.map +1 -0
- package/dist/components/show-hide-button.cjs +48 -0
- package/dist/components/show-hide-button.cjs.map +1 -0
- package/dist/components/show-hide-button.d.cts +8 -0
- package/dist/components/show-hide-button.d.ts +8 -0
- package/dist/components/show-hide-button.js +24 -0
- package/dist/components/show-hide-button.js.map +1 -0
- package/dist/components/stat-bar.cjs +68 -0
- package/dist/components/stat-bar.cjs.map +1 -0
- package/dist/components/stat-bar.d.cts +15 -0
- package/dist/components/stat-bar.d.ts +15 -0
- package/dist/components/stat-bar.js +44 -0
- package/dist/components/stat-bar.js.map +1 -0
- package/dist/components/stat-cell.cjs +72 -0
- package/dist/components/stat-cell.cjs.map +1 -0
- package/dist/components/stat-cell.d.cts +17 -0
- package/dist/components/stat-cell.d.ts +17 -0
- package/dist/components/stat-cell.js +54 -0
- package/dist/components/stat-cell.js.map +1 -0
- package/dist/components/status-badge.cjs +63 -0
- package/dist/components/status-badge.cjs.map +1 -0
- package/dist/components/status-badge.d.cts +20 -0
- package/dist/components/status-badge.d.ts +20 -0
- package/dist/components/status-badge.js +39 -0
- package/dist/components/status-badge.js.map +1 -0
- package/dist/components/tabbed-page.cjs +64 -0
- package/dist/components/tabbed-page.cjs.map +1 -0
- package/dist/components/tabbed-page.d.cts +18 -0
- package/dist/components/tabbed-page.d.ts +18 -0
- package/dist/components/tabbed-page.js +40 -0
- package/dist/components/tabbed-page.js.map +1 -0
- package/dist/components/table-skeleton.cjs +36 -0
- package/dist/components/table-skeleton.cjs.map +1 -0
- package/dist/components/table-skeleton.d.cts +8 -0
- package/dist/components/table-skeleton.d.ts +8 -0
- package/dist/components/table-skeleton.js +12 -0
- package/dist/components/table-skeleton.js.map +1 -0
- package/dist/components/text-update-modal.cjs +102 -0
- package/dist/components/text-update-modal.cjs.map +1 -0
- package/dist/components/text-update-modal.d.cts +19 -0
- package/dist/components/text-update-modal.d.ts +19 -0
- package/dist/components/text-update-modal.js +85 -0
- package/dist/components/text-update-modal.js.map +1 -0
- package/dist/components/theme-toggle.cjs +73 -0
- package/dist/components/theme-toggle.cjs.map +1 -0
- package/dist/components/theme-toggle.d.cts +5 -0
- package/dist/components/theme-toggle.d.ts +5 -0
- package/dist/components/theme-toggle.js +54 -0
- package/dist/components/theme-toggle.js.map +1 -0
- package/dist/formatting.cjs +124 -0
- package/dist/formatting.cjs.map +1 -0
- package/dist/formatting.d.cts +14 -0
- package/dist/formatting.d.ts +14 -0
- package/dist/formatting.js +89 -0
- package/dist/formatting.js.map +1 -0
- package/dist/hooks.cjs +117 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +30 -0
- package/dist/hooks.d.ts +30 -0
- package/dist/hooks.js +88 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.cjs +99 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +47 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/index.scss +81 -0
- package/dist/theme.cjs +332 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +15 -0
- package/dist/theme.d.ts +15 -0
- package/dist/theme.js +330 -0
- package/dist/theme.js.map +1 -0
- package/dist/theme.scss +76 -0
- package/dist/utils.cjs +48 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +15 -0
- package/dist/utils.d.ts +15 -0
- package/dist/utils.js +24 -0
- package/dist/utils.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { LoaderProps, CenterProps } from '@mantine/core';
|
|
3
|
+
|
|
4
|
+
declare function LoadingScreen({ size, mt, ...centerProps }: {
|
|
5
|
+
size?: LoaderProps["size"];
|
|
6
|
+
} & CenterProps): react_jsx_runtime.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { LoadingScreen };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { LoaderProps, CenterProps } from '@mantine/core';
|
|
3
|
+
|
|
4
|
+
declare function LoadingScreen({ size, mt, ...centerProps }: {
|
|
5
|
+
size?: LoaderProps["size"];
|
|
6
|
+
} & CenterProps): react_jsx_runtime.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { LoadingScreen };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Center, Loader } from "@mantine/core";
|
|
3
|
+
function LoadingScreen({
|
|
4
|
+
size = "xl",
|
|
5
|
+
mt = "30vh",
|
|
6
|
+
...centerProps
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Center, { mt, ...centerProps, children: /* @__PURE__ */ jsx(Loader, { size }) });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
LoadingScreen
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=loading-screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/loading-screen.tsx"],"sourcesContent":["import { Center, CenterProps, Loader, LoaderProps } from \"@mantine/core\";\n\nexport function LoadingScreen({\n size = \"xl\",\n mt = \"30vh\",\n ...centerProps\n}: {\n size?: LoaderProps[\"size\"];\n} & CenterProps) {\n return (\n <Center mt={mt} {...centerProps}>\n <Loader size={size} />\n </Center>\n );\n}\n"],"mappings":"AAWM;AAXN,SAAS,QAAqB,cAA2B;AAElD,SAAS,cAAc;AAAA,EAC5B,OAAO;AAAA,EACP,KAAK;AAAA,EACL,GAAG;AACL,GAEiB;AACf,SACE,oBAAC,UAAO,IAAS,GAAG,aAClB,8BAAC,UAAO,MAAY,GACtB;AAEJ;","names":[]}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var mobile_friendly_tabs_exports = {};
|
|
20
|
+
__export(mobile_friendly_tabs_exports, {
|
|
21
|
+
MobileFriendlyTabs: () => MobileFriendlyTabs,
|
|
22
|
+
MobileFriendlyTabsContent: () => MobileFriendlyTabsContent,
|
|
23
|
+
MobileFriendlyTabsSelector: () => MobileFriendlyTabsSelector,
|
|
24
|
+
MobileFriendlyTabsWrapper: () => MobileFriendlyTabsWrapper
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(mobile_friendly_tabs_exports);
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var import_core = require("@mantine/core");
|
|
29
|
+
var import_lucide_react = require("lucide-react");
|
|
30
|
+
function MobileFriendlyTabs(props) {
|
|
31
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
32
|
+
MobileFriendlyTabsWrapper,
|
|
33
|
+
{
|
|
34
|
+
Selector: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileFriendlyTabsSelector, { ...props }),
|
|
35
|
+
tabs: props.tabs,
|
|
36
|
+
value: props.value,
|
|
37
|
+
...props.tabsProps
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function MobileFriendlyTabsWrapper({
|
|
42
|
+
Selector,
|
|
43
|
+
tabs,
|
|
44
|
+
value,
|
|
45
|
+
children,
|
|
46
|
+
...tabsProps
|
|
47
|
+
}) {
|
|
48
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Tabs, { value, ...tabsProps, children: [
|
|
49
|
+
Selector,
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Box, { mt: "xl", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileFriendlyTabsContent, { tabs, value }) })
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
function MobileFriendlyTabsSelector({
|
|
54
|
+
tabs: _tabs,
|
|
55
|
+
actions,
|
|
56
|
+
value,
|
|
57
|
+
onValueChange,
|
|
58
|
+
changeAt: _changeAt,
|
|
59
|
+
fullIconSize = "1.1rem",
|
|
60
|
+
mobileIconSize = "1rem",
|
|
61
|
+
tabProps
|
|
62
|
+
}) {
|
|
63
|
+
const tabs = _tabs.filter((t) => !t.hidden);
|
|
64
|
+
const changeAt = _changeAt ?? (tabs.length > 6 ? "lg" : tabs.length > 3 ? "md" : "sm");
|
|
65
|
+
const SelectedIcon = tabs.find((tab) => tab.value === value)?.icon;
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Group, { justify: "space-between", visibleFrom: changeAt, children: [
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Tabs.List, { children: tabs.map(({ value: tabValue, label, icon: Icon, disabled }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
import_core.Tabs.Tab,
|
|
70
|
+
{
|
|
71
|
+
value: tabValue,
|
|
72
|
+
disabled,
|
|
73
|
+
onClick: () => onValueChange(tabValue),
|
|
74
|
+
w: "fit-content",
|
|
75
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
76
|
+
import_core.Group,
|
|
77
|
+
{
|
|
78
|
+
gap: "xs",
|
|
79
|
+
fz: "lg",
|
|
80
|
+
justify: "center",
|
|
81
|
+
c: tabValue === value ? void 0 : "dimmed",
|
|
82
|
+
w: 100,
|
|
83
|
+
miw: "fit-content",
|
|
84
|
+
wrap: "nowrap",
|
|
85
|
+
...tabProps,
|
|
86
|
+
children: [
|
|
87
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { size: fullIconSize }),
|
|
88
|
+
label ?? tabValue
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
},
|
|
93
|
+
tabValue
|
|
94
|
+
)) }),
|
|
95
|
+
actions
|
|
96
|
+
] }),
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Stack, { hiddenFrom: changeAt, w: "100%", children: [
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
+
import_core.Select,
|
|
100
|
+
{
|
|
101
|
+
w: { base: "100%", md: 300 },
|
|
102
|
+
value,
|
|
103
|
+
onChange: (value2) => value2 && onValueChange(value2),
|
|
104
|
+
leftSection: SelectedIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectedIcon, { size: "1rem" }),
|
|
105
|
+
data: tabs.map((tab) => ({
|
|
106
|
+
value: tab.value,
|
|
107
|
+
label: tab.label ?? tab.value,
|
|
108
|
+
disabled: tab.disabled
|
|
109
|
+
})),
|
|
110
|
+
renderOption: ({ option, checked }) => {
|
|
111
|
+
const Icon = tabs.find((tab) => tab.value === option.value)?.icon;
|
|
112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Group, { gap: "xs", p: "0.25rem", ...tabProps, children: [
|
|
113
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { size: mobileIconSize }),
|
|
114
|
+
option.label,
|
|
115
|
+
checked && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { size: "1rem" })
|
|
116
|
+
] });
|
|
117
|
+
},
|
|
118
|
+
withScrollArea: false,
|
|
119
|
+
styles: {
|
|
120
|
+
dropdown: { maxHeight: "calc(100vh - 230px)", overflowY: "auto" }
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
actions
|
|
125
|
+
] })
|
|
126
|
+
] });
|
|
127
|
+
}
|
|
128
|
+
function MobileFriendlyTabsContent({
|
|
129
|
+
tabs,
|
|
130
|
+
value
|
|
131
|
+
}) {
|
|
132
|
+
return tabs.find((tab) => tab.value === value)?.content;
|
|
133
|
+
}
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
MobileFriendlyTabs,
|
|
137
|
+
MobileFriendlyTabsContent,
|
|
138
|
+
MobileFriendlyTabsSelector,
|
|
139
|
+
MobileFriendlyTabsWrapper
|
|
140
|
+
});
|
|
141
|
+
//# sourceMappingURL=mobile-friendly-tabs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/mobile-friendly-tabs.tsx"],"sourcesContent":["import {\n Box,\n Group,\n GroupProps,\n MantineBreakpoint,\n Select,\n Stack,\n Tabs,\n TabsProps,\n} from \"@mantine/core\";\nimport { FC, ReactNode } from \"react\";\nimport { Check } from \"lucide-react\";\n\nexport interface Tab {\n label?: string;\n icon?: FC<{ size?: string | number }>;\n hidden?: boolean;\n disabled?: boolean;\n value: string;\n content: ReactNode;\n}\n\nexport type TabNoContent = Omit<Tab, \"content\">;\n\nexport interface MobileFriendlyTabsProps extends MobileFriendlyTabsSelectorProps {\n tabs: Tab[];\n tabsProps?: Omit<TabsProps, \"value\">;\n}\n\nexport function MobileFriendlyTabs(props: MobileFriendlyTabsProps) {\n return (\n <MobileFriendlyTabsWrapper\n Selector={<MobileFriendlyTabsSelector {...props} />}\n tabs={props.tabs}\n value={props.value}\n {...props.tabsProps}\n />\n );\n}\n\nexport interface MobileFriendlyTabsWrapper extends TabsProps {\n Selector: ReactNode;\n tabs: Tab[];\n value: string;\n}\n\nexport function MobileFriendlyTabsWrapper({\n Selector,\n tabs,\n value,\n children,\n ...tabsProps\n}: MobileFriendlyTabsWrapper) {\n return (\n <Tabs value={value} {...tabsProps}>\n {Selector}\n <Box mt=\"xl\">\n <MobileFriendlyTabsContent tabs={tabs} value={value} />\n </Box>\n </Tabs>\n );\n}\n\nexport interface MobileFriendlyTabsSelectorProps {\n tabs: TabNoContent[];\n actions?: ReactNode;\n value: string;\n onValueChange: (value: string) => void;\n changeAt?: MantineBreakpoint;\n fullIconSize?: string | number;\n mobileIconSize?: string | number;\n tabProps?: GroupProps;\n}\n\nexport function MobileFriendlyTabsSelector({\n tabs: _tabs,\n actions,\n value,\n onValueChange,\n changeAt: _changeAt,\n fullIconSize = \"1.1rem\",\n mobileIconSize = \"1rem\",\n tabProps,\n}: MobileFriendlyTabsSelectorProps) {\n const tabs = _tabs.filter((t) => !t.hidden);\n const changeAt =\n _changeAt ?? (tabs.length > 6 ? \"lg\" : tabs.length > 3 ? \"md\" : \"sm\");\n const SelectedIcon = tabs.find((tab) => tab.value === value)?.icon;\n return (\n <>\n {/* DESKTOP VIEW */}\n <Group justify=\"space-between\" visibleFrom={changeAt}>\n <Tabs.List>\n {tabs.map(({ value: tabValue, label, icon: Icon, disabled }) => (\n <Tabs.Tab\n key={tabValue}\n value={tabValue}\n disabled={disabled}\n onClick={() => onValueChange(tabValue)}\n w=\"fit-content\"\n >\n <Group\n gap=\"xs\"\n fz=\"lg\"\n justify=\"center\"\n c={tabValue === value ? undefined : \"dimmed\"}\n w={100}\n miw=\"fit-content\"\n wrap=\"nowrap\"\n {...tabProps}\n >\n {Icon && <Icon size={fullIconSize} />}\n {label ?? tabValue}\n </Group>\n </Tabs.Tab>\n ))}\n </Tabs.List>\n {actions}\n </Group>\n\n {/* MOBILE VIEW */}\n <Stack hiddenFrom={changeAt} w=\"100%\">\n <Select\n w={{ base: \"100%\", md: 300 }}\n value={value}\n onChange={(value) => value && onValueChange(value)}\n leftSection={SelectedIcon && <SelectedIcon size=\"1rem\" />}\n data={tabs.map((tab) => ({\n value: tab.value,\n label: tab.label ?? tab.value,\n disabled: tab.disabled,\n }))}\n renderOption={({ option, checked }) => {\n const Icon = tabs.find((tab) => tab.value === option.value)?.icon;\n return (\n <Group gap=\"xs\" p=\"0.25rem\" {...tabProps}>\n {Icon && <Icon size={mobileIconSize} />}\n {option.label}\n {checked && <Check size=\"1rem\" />}\n </Group>\n );\n }}\n withScrollArea={false}\n styles={{\n dropdown: { maxHeight: \"calc(100vh - 230px)\", overflowY: \"auto\" },\n }}\n />\n {actions}\n </Stack>\n </>\n );\n}\n\nexport function MobileFriendlyTabsContent({\n tabs,\n value,\n}: {\n tabs: Tab[];\n value: string;\n}) {\n return tabs.find((tab) => tab.value === value)?.content;\n}\n"],"mappings":"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","names":["value"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { MantineBreakpoint, GroupProps, TabsProps } from '@mantine/core';
|
|
3
|
+
import { FC, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
interface Tab {
|
|
6
|
+
label?: string;
|
|
7
|
+
icon?: FC<{
|
|
8
|
+
size?: string | number;
|
|
9
|
+
}>;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
value: string;
|
|
13
|
+
content: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
type TabNoContent = Omit<Tab, "content">;
|
|
16
|
+
interface MobileFriendlyTabsProps extends MobileFriendlyTabsSelectorProps {
|
|
17
|
+
tabs: Tab[];
|
|
18
|
+
tabsProps?: Omit<TabsProps, "value">;
|
|
19
|
+
}
|
|
20
|
+
declare function MobileFriendlyTabs(props: MobileFriendlyTabsProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
interface MobileFriendlyTabsWrapper extends TabsProps {
|
|
22
|
+
Selector: ReactNode;
|
|
23
|
+
tabs: Tab[];
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
26
|
+
declare function MobileFriendlyTabsWrapper({ Selector, tabs, value, children, ...tabsProps }: MobileFriendlyTabsWrapper): react_jsx_runtime.JSX.Element;
|
|
27
|
+
interface MobileFriendlyTabsSelectorProps {
|
|
28
|
+
tabs: TabNoContent[];
|
|
29
|
+
actions?: ReactNode;
|
|
30
|
+
value: string;
|
|
31
|
+
onValueChange: (value: string) => void;
|
|
32
|
+
changeAt?: MantineBreakpoint;
|
|
33
|
+
fullIconSize?: string | number;
|
|
34
|
+
mobileIconSize?: string | number;
|
|
35
|
+
tabProps?: GroupProps;
|
|
36
|
+
}
|
|
37
|
+
declare function MobileFriendlyTabsSelector({ tabs: _tabs, actions, value, onValueChange, changeAt: _changeAt, fullIconSize, mobileIconSize, tabProps, }: MobileFriendlyTabsSelectorProps): react_jsx_runtime.JSX.Element;
|
|
38
|
+
declare function MobileFriendlyTabsContent({ tabs, value, }: {
|
|
39
|
+
tabs: Tab[];
|
|
40
|
+
value: string;
|
|
41
|
+
}): ReactNode;
|
|
42
|
+
|
|
43
|
+
export { MobileFriendlyTabs, MobileFriendlyTabsContent, type MobileFriendlyTabsProps, MobileFriendlyTabsSelector, type MobileFriendlyTabsSelectorProps, MobileFriendlyTabsWrapper, type Tab, type TabNoContent };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { MantineBreakpoint, GroupProps, TabsProps } from '@mantine/core';
|
|
3
|
+
import { FC, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
interface Tab {
|
|
6
|
+
label?: string;
|
|
7
|
+
icon?: FC<{
|
|
8
|
+
size?: string | number;
|
|
9
|
+
}>;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
value: string;
|
|
13
|
+
content: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
type TabNoContent = Omit<Tab, "content">;
|
|
16
|
+
interface MobileFriendlyTabsProps extends MobileFriendlyTabsSelectorProps {
|
|
17
|
+
tabs: Tab[];
|
|
18
|
+
tabsProps?: Omit<TabsProps, "value">;
|
|
19
|
+
}
|
|
20
|
+
declare function MobileFriendlyTabs(props: MobileFriendlyTabsProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
interface MobileFriendlyTabsWrapper extends TabsProps {
|
|
22
|
+
Selector: ReactNode;
|
|
23
|
+
tabs: Tab[];
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
26
|
+
declare function MobileFriendlyTabsWrapper({ Selector, tabs, value, children, ...tabsProps }: MobileFriendlyTabsWrapper): react_jsx_runtime.JSX.Element;
|
|
27
|
+
interface MobileFriendlyTabsSelectorProps {
|
|
28
|
+
tabs: TabNoContent[];
|
|
29
|
+
actions?: ReactNode;
|
|
30
|
+
value: string;
|
|
31
|
+
onValueChange: (value: string) => void;
|
|
32
|
+
changeAt?: MantineBreakpoint;
|
|
33
|
+
fullIconSize?: string | number;
|
|
34
|
+
mobileIconSize?: string | number;
|
|
35
|
+
tabProps?: GroupProps;
|
|
36
|
+
}
|
|
37
|
+
declare function MobileFriendlyTabsSelector({ tabs: _tabs, actions, value, onValueChange, changeAt: _changeAt, fullIconSize, mobileIconSize, tabProps, }: MobileFriendlyTabsSelectorProps): react_jsx_runtime.JSX.Element;
|
|
38
|
+
declare function MobileFriendlyTabsContent({ tabs, value, }: {
|
|
39
|
+
tabs: Tab[];
|
|
40
|
+
value: string;
|
|
41
|
+
}): ReactNode;
|
|
42
|
+
|
|
43
|
+
export { MobileFriendlyTabs, MobileFriendlyTabsContent, type MobileFriendlyTabsProps, MobileFriendlyTabsSelector, type MobileFriendlyTabsSelectorProps, MobileFriendlyTabsWrapper, type Tab, type TabNoContent };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Group,
|
|
5
|
+
Select,
|
|
6
|
+
Stack,
|
|
7
|
+
Tabs
|
|
8
|
+
} from "@mantine/core";
|
|
9
|
+
import { Check } from "lucide-react";
|
|
10
|
+
function MobileFriendlyTabs(props) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
MobileFriendlyTabsWrapper,
|
|
13
|
+
{
|
|
14
|
+
Selector: /* @__PURE__ */ jsx(MobileFriendlyTabsSelector, { ...props }),
|
|
15
|
+
tabs: props.tabs,
|
|
16
|
+
value: props.value,
|
|
17
|
+
...props.tabsProps
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function MobileFriendlyTabsWrapper({
|
|
22
|
+
Selector,
|
|
23
|
+
tabs,
|
|
24
|
+
value,
|
|
25
|
+
children,
|
|
26
|
+
...tabsProps
|
|
27
|
+
}) {
|
|
28
|
+
return /* @__PURE__ */ jsxs(Tabs, { value, ...tabsProps, children: [
|
|
29
|
+
Selector,
|
|
30
|
+
/* @__PURE__ */ jsx(Box, { mt: "xl", children: /* @__PURE__ */ jsx(MobileFriendlyTabsContent, { tabs, value }) })
|
|
31
|
+
] });
|
|
32
|
+
}
|
|
33
|
+
function MobileFriendlyTabsSelector({
|
|
34
|
+
tabs: _tabs,
|
|
35
|
+
actions,
|
|
36
|
+
value,
|
|
37
|
+
onValueChange,
|
|
38
|
+
changeAt: _changeAt,
|
|
39
|
+
fullIconSize = "1.1rem",
|
|
40
|
+
mobileIconSize = "1rem",
|
|
41
|
+
tabProps
|
|
42
|
+
}) {
|
|
43
|
+
const tabs = _tabs.filter((t) => !t.hidden);
|
|
44
|
+
const changeAt = _changeAt ?? (tabs.length > 6 ? "lg" : tabs.length > 3 ? "md" : "sm");
|
|
45
|
+
const SelectedIcon = tabs.find((tab) => tab.value === value)?.icon;
|
|
46
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
47
|
+
/* @__PURE__ */ jsxs(Group, { justify: "space-between", visibleFrom: changeAt, children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Tabs.List, { children: tabs.map(({ value: tabValue, label, icon: Icon, disabled }) => /* @__PURE__ */ jsx(
|
|
49
|
+
Tabs.Tab,
|
|
50
|
+
{
|
|
51
|
+
value: tabValue,
|
|
52
|
+
disabled,
|
|
53
|
+
onClick: () => onValueChange(tabValue),
|
|
54
|
+
w: "fit-content",
|
|
55
|
+
children: /* @__PURE__ */ jsxs(
|
|
56
|
+
Group,
|
|
57
|
+
{
|
|
58
|
+
gap: "xs",
|
|
59
|
+
fz: "lg",
|
|
60
|
+
justify: "center",
|
|
61
|
+
c: tabValue === value ? void 0 : "dimmed",
|
|
62
|
+
w: 100,
|
|
63
|
+
miw: "fit-content",
|
|
64
|
+
wrap: "nowrap",
|
|
65
|
+
...tabProps,
|
|
66
|
+
children: [
|
|
67
|
+
Icon && /* @__PURE__ */ jsx(Icon, { size: fullIconSize }),
|
|
68
|
+
label ?? tabValue
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
},
|
|
73
|
+
tabValue
|
|
74
|
+
)) }),
|
|
75
|
+
actions
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ jsxs(Stack, { hiddenFrom: changeAt, w: "100%", children: [
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
Select,
|
|
80
|
+
{
|
|
81
|
+
w: { base: "100%", md: 300 },
|
|
82
|
+
value,
|
|
83
|
+
onChange: (value2) => value2 && onValueChange(value2),
|
|
84
|
+
leftSection: SelectedIcon && /* @__PURE__ */ jsx(SelectedIcon, { size: "1rem" }),
|
|
85
|
+
data: tabs.map((tab) => ({
|
|
86
|
+
value: tab.value,
|
|
87
|
+
label: tab.label ?? tab.value,
|
|
88
|
+
disabled: tab.disabled
|
|
89
|
+
})),
|
|
90
|
+
renderOption: ({ option, checked }) => {
|
|
91
|
+
const Icon = tabs.find((tab) => tab.value === option.value)?.icon;
|
|
92
|
+
return /* @__PURE__ */ jsxs(Group, { gap: "xs", p: "0.25rem", ...tabProps, children: [
|
|
93
|
+
Icon && /* @__PURE__ */ jsx(Icon, { size: mobileIconSize }),
|
|
94
|
+
option.label,
|
|
95
|
+
checked && /* @__PURE__ */ jsx(Check, { size: "1rem" })
|
|
96
|
+
] });
|
|
97
|
+
},
|
|
98
|
+
withScrollArea: false,
|
|
99
|
+
styles: {
|
|
100
|
+
dropdown: { maxHeight: "calc(100vh - 230px)", overflowY: "auto" }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
actions
|
|
105
|
+
] })
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
function MobileFriendlyTabsContent({
|
|
109
|
+
tabs,
|
|
110
|
+
value
|
|
111
|
+
}) {
|
|
112
|
+
return tabs.find((tab) => tab.value === value)?.content;
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
MobileFriendlyTabs,
|
|
116
|
+
MobileFriendlyTabsContent,
|
|
117
|
+
MobileFriendlyTabsSelector,
|
|
118
|
+
MobileFriendlyTabsWrapper
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=mobile-friendly-tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/mobile-friendly-tabs.tsx"],"sourcesContent":["import {\n Box,\n Group,\n GroupProps,\n MantineBreakpoint,\n Select,\n Stack,\n Tabs,\n TabsProps,\n} from \"@mantine/core\";\nimport { FC, ReactNode } from \"react\";\nimport { Check } from \"lucide-react\";\n\nexport interface Tab {\n label?: string;\n icon?: FC<{ size?: string | number }>;\n hidden?: boolean;\n disabled?: boolean;\n value: string;\n content: ReactNode;\n}\n\nexport type TabNoContent = Omit<Tab, \"content\">;\n\nexport interface MobileFriendlyTabsProps extends MobileFriendlyTabsSelectorProps {\n tabs: Tab[];\n tabsProps?: Omit<TabsProps, \"value\">;\n}\n\nexport function MobileFriendlyTabs(props: MobileFriendlyTabsProps) {\n return (\n <MobileFriendlyTabsWrapper\n Selector={<MobileFriendlyTabsSelector {...props} />}\n tabs={props.tabs}\n value={props.value}\n {...props.tabsProps}\n />\n );\n}\n\nexport interface MobileFriendlyTabsWrapper extends TabsProps {\n Selector: ReactNode;\n tabs: Tab[];\n value: string;\n}\n\nexport function MobileFriendlyTabsWrapper({\n Selector,\n tabs,\n value,\n children,\n ...tabsProps\n}: MobileFriendlyTabsWrapper) {\n return (\n <Tabs value={value} {...tabsProps}>\n {Selector}\n <Box mt=\"xl\">\n <MobileFriendlyTabsContent tabs={tabs} value={value} />\n </Box>\n </Tabs>\n );\n}\n\nexport interface MobileFriendlyTabsSelectorProps {\n tabs: TabNoContent[];\n actions?: ReactNode;\n value: string;\n onValueChange: (value: string) => void;\n changeAt?: MantineBreakpoint;\n fullIconSize?: string | number;\n mobileIconSize?: string | number;\n tabProps?: GroupProps;\n}\n\nexport function MobileFriendlyTabsSelector({\n tabs: _tabs,\n actions,\n value,\n onValueChange,\n changeAt: _changeAt,\n fullIconSize = \"1.1rem\",\n mobileIconSize = \"1rem\",\n tabProps,\n}: MobileFriendlyTabsSelectorProps) {\n const tabs = _tabs.filter((t) => !t.hidden);\n const changeAt =\n _changeAt ?? (tabs.length > 6 ? \"lg\" : tabs.length > 3 ? \"md\" : \"sm\");\n const SelectedIcon = tabs.find((tab) => tab.value === value)?.icon;\n return (\n <>\n {/* DESKTOP VIEW */}\n <Group justify=\"space-between\" visibleFrom={changeAt}>\n <Tabs.List>\n {tabs.map(({ value: tabValue, label, icon: Icon, disabled }) => (\n <Tabs.Tab\n key={tabValue}\n value={tabValue}\n disabled={disabled}\n onClick={() => onValueChange(tabValue)}\n w=\"fit-content\"\n >\n <Group\n gap=\"xs\"\n fz=\"lg\"\n justify=\"center\"\n c={tabValue === value ? undefined : \"dimmed\"}\n w={100}\n miw=\"fit-content\"\n wrap=\"nowrap\"\n {...tabProps}\n >\n {Icon && <Icon size={fullIconSize} />}\n {label ?? tabValue}\n </Group>\n </Tabs.Tab>\n ))}\n </Tabs.List>\n {actions}\n </Group>\n\n {/* MOBILE VIEW */}\n <Stack hiddenFrom={changeAt} w=\"100%\">\n <Select\n w={{ base: \"100%\", md: 300 }}\n value={value}\n onChange={(value) => value && onValueChange(value)}\n leftSection={SelectedIcon && <SelectedIcon size=\"1rem\" />}\n data={tabs.map((tab) => ({\n value: tab.value,\n label: tab.label ?? tab.value,\n disabled: tab.disabled,\n }))}\n renderOption={({ option, checked }) => {\n const Icon = tabs.find((tab) => tab.value === option.value)?.icon;\n return (\n <Group gap=\"xs\" p=\"0.25rem\" {...tabProps}>\n {Icon && <Icon size={mobileIconSize} />}\n {option.label}\n {checked && <Check size=\"1rem\" />}\n </Group>\n );\n }}\n withScrollArea={false}\n styles={{\n dropdown: { maxHeight: \"calc(100vh - 230px)\", overflowY: \"auto\" },\n }}\n />\n {actions}\n </Stack>\n </>\n );\n}\n\nexport function MobileFriendlyTabsContent({\n tabs,\n value,\n}: {\n tabs: Tab[];\n value: string;\n}) {\n return tabs.find((tab) => tab.value === value)?.content;\n}\n"],"mappings":"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","names":["value"]}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var monaco_exports = {};
|
|
30
|
+
__export(monaco_exports, {
|
|
31
|
+
MonacoDiffEditor: () => MonacoDiffEditor,
|
|
32
|
+
MonacoEditor: () => MonacoEditor,
|
|
33
|
+
languageFromPath: () => languageFromPath
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(monaco_exports);
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_init = require("./init");
|
|
38
|
+
var import_react = require("react");
|
|
39
|
+
var import_react2 = require("@monaco-editor/react");
|
|
40
|
+
var monaco = __toESM(require("monaco-editor"), 1);
|
|
41
|
+
var prettier = __toESM(require("prettier/standalone"), 1);
|
|
42
|
+
var pluginTypescript = __toESM(require("prettier/plugins/typescript"), 1);
|
|
43
|
+
var pluginEsTree = __toESM(require("prettier/plugins/estree"), 1);
|
|
44
|
+
var pluginYaml = __toESM(require("prettier/plugins/yaml"), 1);
|
|
45
|
+
var import_hooks = require("@mantine/hooks");
|
|
46
|
+
var import_core = require("@mantine/core");
|
|
47
|
+
const MIN_EDITOR_HEIGHT = 56;
|
|
48
|
+
const LANGUAGE_EXTENSIONS = {
|
|
49
|
+
yaml: [".yaml", ".yml"],
|
|
50
|
+
toml: [".toml"],
|
|
51
|
+
fancy_toml: [],
|
|
52
|
+
json: [".json"],
|
|
53
|
+
key_value: [".env", ".conf"],
|
|
54
|
+
ini: [".ini"],
|
|
55
|
+
string_list: [],
|
|
56
|
+
shell: [".sh", ".bash", ".zsh"],
|
|
57
|
+
dockerfile: ["Dockerfile"],
|
|
58
|
+
rust: [".rs"],
|
|
59
|
+
javascript: [".js", ".jsx", ".mjs", ".cjs"],
|
|
60
|
+
typescript: [".ts", ".tsx"]
|
|
61
|
+
};
|
|
62
|
+
function languageFromPath(path) {
|
|
63
|
+
for (const [lang, extensions] of Object.entries(LANGUAGE_EXTENSIONS)) {
|
|
64
|
+
for (const extension of extensions) {
|
|
65
|
+
if (path.endsWith(extension)) {
|
|
66
|
+
return lang;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return void 0;
|
|
71
|
+
}
|
|
72
|
+
function MonacoEditor({
|
|
73
|
+
value,
|
|
74
|
+
onValueChange,
|
|
75
|
+
language: _language,
|
|
76
|
+
enableFancyToml,
|
|
77
|
+
readOnly,
|
|
78
|
+
filename,
|
|
79
|
+
minHeight,
|
|
80
|
+
maxHeightProportion,
|
|
81
|
+
maxHeight,
|
|
82
|
+
id,
|
|
83
|
+
...boxProps
|
|
84
|
+
}) {
|
|
85
|
+
const language = _language === "fancy_toml" && !enableFancyToml ? "toml" : _language;
|
|
86
|
+
const dimensions = (0, import_hooks.useViewportSize)();
|
|
87
|
+
const [editor, setEditor] = (0, import_react.useState)(null);
|
|
88
|
+
(0, import_react.useEffect)(() => {
|
|
89
|
+
if (!editor) return;
|
|
90
|
+
let node = editor.getDomNode();
|
|
91
|
+
if (!node) return;
|
|
92
|
+
const callback = (e) => {
|
|
93
|
+
if (e.key === "Escape") {
|
|
94
|
+
document.activeElement?.blur?.();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
node.addEventListener("keydown", callback);
|
|
98
|
+
return () => node.removeEventListener("keydown", callback);
|
|
99
|
+
}, [editor]);
|
|
100
|
+
(0, import_react.useEffect)(() => {
|
|
101
|
+
if (language !== "typescript" && language !== "javascript" && language !== "yaml")
|
|
102
|
+
return;
|
|
103
|
+
if (!editor) return;
|
|
104
|
+
editor.addCommand(
|
|
105
|
+
monaco.KeyMod.Alt | monaco.KeyMod.Shift | monaco.KeyCode.KeyF,
|
|
106
|
+
async () => {
|
|
107
|
+
if (!editor) return;
|
|
108
|
+
const model = editor.getModel();
|
|
109
|
+
if (!model) return;
|
|
110
|
+
const position = editor.getPosition();
|
|
111
|
+
let beforeOffset = (position && model.getOffsetAt(position)) ?? 0;
|
|
112
|
+
const curr = editor.getValue();
|
|
113
|
+
const { formatted, cursorOffset } = await prettier.formatWithCursor(
|
|
114
|
+
curr,
|
|
115
|
+
{
|
|
116
|
+
cursorOffset: beforeOffset,
|
|
117
|
+
parser: language === "yaml" ? "yaml" : "typescript",
|
|
118
|
+
plugins: language === "yaml" ? [pluginYaml] : [pluginTypescript, pluginEsTree],
|
|
119
|
+
printWidth: 80
|
|
120
|
+
// Set the desired max line length
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
editor.setValue(formatted);
|
|
124
|
+
editor.setPosition(model.getPositionAt(cursorOffset));
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}, [editor]);
|
|
128
|
+
const line_count = value?.split(/\r\n|\r|\n/).length ?? 0;
|
|
129
|
+
(0, import_react.useEffect)(() => {
|
|
130
|
+
if (!editor) return;
|
|
131
|
+
const contentHeight = line_count * 18 + 30;
|
|
132
|
+
const containerNode = editor.getContainerDomNode();
|
|
133
|
+
containerNode.style.height = `${Math.max(
|
|
134
|
+
Math.min(
|
|
135
|
+
contentHeight,
|
|
136
|
+
Math.floor(dimensions.height * 0.75),
|
|
137
|
+
maxHeightProportion ? Math.floor(maxHeightProportion * dimensions.height) : 1e4,
|
|
138
|
+
maxHeight ?? 1e4
|
|
139
|
+
),
|
|
140
|
+
minHeight ?? MIN_EDITOR_HEIGHT
|
|
141
|
+
)}px`;
|
|
142
|
+
}, [dimensions.height, editor, line_count]);
|
|
143
|
+
const currentTheme = (0, import_core.useComputedColorScheme)();
|
|
144
|
+
const options = {
|
|
145
|
+
minimap: { enabled: false },
|
|
146
|
+
// scrollbar: { alwaysConsumeMouseWheel: false },
|
|
147
|
+
scrollBeyondLastLine: false,
|
|
148
|
+
folding: false,
|
|
149
|
+
automaticLayout: true,
|
|
150
|
+
renderValidationDecorations: "on",
|
|
151
|
+
renderLineHighlightOnlyWhenFocus: true,
|
|
152
|
+
readOnly,
|
|
153
|
+
tabSize: 2,
|
|
154
|
+
detectIndentation: true,
|
|
155
|
+
quickSuggestions: true,
|
|
156
|
+
padding: {
|
|
157
|
+
top: 15
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Box, { id, onKeyDown: (e) => e.stopPropagation(), ...boxProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
161
|
+
import_react2.Editor,
|
|
162
|
+
{
|
|
163
|
+
language,
|
|
164
|
+
value,
|
|
165
|
+
theme: currentTheme,
|
|
166
|
+
defaultPath: defaultPath(filename),
|
|
167
|
+
options,
|
|
168
|
+
onChange: (v) => onValueChange?.(v ?? ""),
|
|
169
|
+
onMount: (editor2) => setEditor(editor2)
|
|
170
|
+
}
|
|
171
|
+
) });
|
|
172
|
+
}
|
|
173
|
+
function defaultPath(filename) {
|
|
174
|
+
if (!filename) return void 0;
|
|
175
|
+
const split = filename.split("/");
|
|
176
|
+
return split[split.length - 1];
|
|
177
|
+
}
|
|
178
|
+
const MIN_DIFF_HEIGHT = 100;
|
|
179
|
+
const MAX_DIFF_HEIGHT = 600;
|
|
180
|
+
function MonacoDiffEditor({
|
|
181
|
+
original,
|
|
182
|
+
modified,
|
|
183
|
+
onModifiedValueChange,
|
|
184
|
+
language: _language,
|
|
185
|
+
enableFancyToml,
|
|
186
|
+
readOnly,
|
|
187
|
+
id,
|
|
188
|
+
hideUnchangedRegions = true,
|
|
189
|
+
...boxProps
|
|
190
|
+
}) {
|
|
191
|
+
const language = _language === "fancy_toml" && !enableFancyToml ? "toml" : _language;
|
|
192
|
+
const [editor, setEditor] = (0, import_react.useState)(null);
|
|
193
|
+
const original_line_count = original?.split(/\r\n|\r|\n/).length ?? 0;
|
|
194
|
+
const modified_line_count = modified?.split(/\r\n|\r|\n/).length ?? 0;
|
|
195
|
+
const line_count = Math.max(original_line_count, modified_line_count);
|
|
196
|
+
(0, import_react.useEffect)(() => {
|
|
197
|
+
if (!editor) return;
|
|
198
|
+
const contentHeight = line_count * 18 + 30;
|
|
199
|
+
const node = editor.getContainerDomNode();
|
|
200
|
+
node.style.height = `${Math.max(
|
|
201
|
+
Math.min(contentHeight, MAX_DIFF_HEIGHT),
|
|
202
|
+
MIN_DIFF_HEIGHT
|
|
203
|
+
)}px`;
|
|
204
|
+
}, [editor, line_count]);
|
|
205
|
+
const currentTheme = (0, import_core.useComputedColorScheme)();
|
|
206
|
+
const options = {
|
|
207
|
+
minimap: { enabled: true },
|
|
208
|
+
scrollbar: { alwaysConsumeMouseWheel: false },
|
|
209
|
+
scrollBeyondLastLine: false,
|
|
210
|
+
hideUnchangedRegions: { enabled: hideUnchangedRegions },
|
|
211
|
+
folding: false,
|
|
212
|
+
automaticLayout: true,
|
|
213
|
+
renderValidationDecorations: "on",
|
|
214
|
+
renderLineHighlightOnlyWhenFocus: true,
|
|
215
|
+
readOnly,
|
|
216
|
+
padding: {
|
|
217
|
+
top: 15
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Box, { id, onKeyDown: (e) => e.stopPropagation(), ...boxProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
221
|
+
import_react2.DiffEditor,
|
|
222
|
+
{
|
|
223
|
+
language,
|
|
224
|
+
original,
|
|
225
|
+
modified,
|
|
226
|
+
theme: currentTheme,
|
|
227
|
+
options,
|
|
228
|
+
onMount: (editor2) => {
|
|
229
|
+
const modifiedEditor = editor2.getModifiedEditor();
|
|
230
|
+
modifiedEditor.onDidChangeModelContent((_) => {
|
|
231
|
+
onModifiedValueChange?.(modifiedEditor.getValue());
|
|
232
|
+
});
|
|
233
|
+
setEditor(editor2);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
) });
|
|
237
|
+
}
|
|
238
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
239
|
+
0 && (module.exports = {
|
|
240
|
+
MonacoDiffEditor,
|
|
241
|
+
MonacoEditor,
|
|
242
|
+
languageFromPath
|
|
243
|
+
});
|
|
244
|
+
//# sourceMappingURL=index.cjs.map
|