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,33 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import * as _mantine_core from '@mantine/core';
|
|
4
|
+
import { StackProps, MantineStyleProps, CenterProps } from '@mantine/core';
|
|
5
|
+
|
|
6
|
+
interface SectionProps extends StackProps {
|
|
7
|
+
titleFz?: MantineStyleProps["fz"];
|
|
8
|
+
titleMb?: MantineStyleProps["mb"];
|
|
9
|
+
titleDimmed?: boolean;
|
|
10
|
+
titleNode?: ReactNode;
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
titleRight?: ReactNode;
|
|
13
|
+
titleOther?: ReactNode;
|
|
14
|
+
description?: ReactNode;
|
|
15
|
+
actions?: ReactNode;
|
|
16
|
+
withBorder?: boolean;
|
|
17
|
+
isPending?: boolean;
|
|
18
|
+
error?: false | string;
|
|
19
|
+
guardProps?: CenterProps;
|
|
20
|
+
forceHeaderGroup?: boolean;
|
|
21
|
+
onHeaderClick?: () => void;
|
|
22
|
+
}
|
|
23
|
+
declare const Section: (<C = "div">(props: _mantine_core.PolymorphicComponentProps<C, SectionProps>) => React.ReactElement) & Omit<react.FunctionComponent<(SectionProps & {
|
|
24
|
+
component?: any;
|
|
25
|
+
} & Omit<any, "component" | keyof SectionProps> & {
|
|
26
|
+
ref?: any;
|
|
27
|
+
renderRoot?: (props: any) => any;
|
|
28
|
+
}) | (SectionProps & {
|
|
29
|
+
component: React.ElementType;
|
|
30
|
+
renderRoot?: (props: Record<string, any>) => any;
|
|
31
|
+
})>, never> & Record<string, never>;
|
|
32
|
+
|
|
33
|
+
export { Section, type SectionProps };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import * as _mantine_core from '@mantine/core';
|
|
4
|
+
import { StackProps, MantineStyleProps, CenterProps } from '@mantine/core';
|
|
5
|
+
|
|
6
|
+
interface SectionProps extends StackProps {
|
|
7
|
+
titleFz?: MantineStyleProps["fz"];
|
|
8
|
+
titleMb?: MantineStyleProps["mb"];
|
|
9
|
+
titleDimmed?: boolean;
|
|
10
|
+
titleNode?: ReactNode;
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
titleRight?: ReactNode;
|
|
13
|
+
titleOther?: ReactNode;
|
|
14
|
+
description?: ReactNode;
|
|
15
|
+
actions?: ReactNode;
|
|
16
|
+
withBorder?: boolean;
|
|
17
|
+
isPending?: boolean;
|
|
18
|
+
error?: false | string;
|
|
19
|
+
guardProps?: CenterProps;
|
|
20
|
+
forceHeaderGroup?: boolean;
|
|
21
|
+
onHeaderClick?: () => void;
|
|
22
|
+
}
|
|
23
|
+
declare const Section: (<C = "div">(props: _mantine_core.PolymorphicComponentProps<C, SectionProps>) => React.ReactElement) & Omit<react.FunctionComponent<(SectionProps & {
|
|
24
|
+
component?: any;
|
|
25
|
+
} & Omit<any, "component" | keyof SectionProps> & {
|
|
26
|
+
ref?: any;
|
|
27
|
+
renderRoot?: (props: any) => any;
|
|
28
|
+
}) | (SectionProps & {
|
|
29
|
+
component: React.ElementType;
|
|
30
|
+
renderRoot?: (props: Record<string, any>) => any;
|
|
31
|
+
})>, never> & Record<string, never>;
|
|
32
|
+
|
|
33
|
+
export { Section, type SectionProps };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Center,
|
|
4
|
+
createPolymorphicComponent,
|
|
5
|
+
Group,
|
|
6
|
+
Loader,
|
|
7
|
+
Stack,
|
|
8
|
+
Text
|
|
9
|
+
} from "@mantine/core";
|
|
10
|
+
import { forwardRef } from "react";
|
|
11
|
+
const Section = createPolymorphicComponent(
|
|
12
|
+
forwardRef(
|
|
13
|
+
({
|
|
14
|
+
titleFz = "h2",
|
|
15
|
+
titleMb,
|
|
16
|
+
title,
|
|
17
|
+
titleDimmed,
|
|
18
|
+
titleNode,
|
|
19
|
+
icon,
|
|
20
|
+
titleRight,
|
|
21
|
+
titleOther,
|
|
22
|
+
description,
|
|
23
|
+
actions,
|
|
24
|
+
children,
|
|
25
|
+
withBorder,
|
|
26
|
+
isPending,
|
|
27
|
+
error,
|
|
28
|
+
guardProps,
|
|
29
|
+
forceHeaderGroup,
|
|
30
|
+
onHeaderClick,
|
|
31
|
+
...props
|
|
32
|
+
}, ref) => {
|
|
33
|
+
const TitleComponentInner = (title || titleNode || icon || titleRight || titleOther || actions) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
+
title || titleNode || icon ? /* @__PURE__ */ jsxs(Group, { c: titleDimmed ? "dimmed" : void 0, gap: "xs", children: [
|
|
35
|
+
icon,
|
|
36
|
+
title && /* @__PURE__ */ jsx(Text, { fz: titleFz, children: title }),
|
|
37
|
+
titleNode,
|
|
38
|
+
titleRight
|
|
39
|
+
] }) : titleRight ? /* @__PURE__ */ jsxs(Group, { c: titleDimmed ? "dimmed" : void 0, gap: "xs", children: [
|
|
40
|
+
titleOther,
|
|
41
|
+
titleRight
|
|
42
|
+
] }) : titleOther,
|
|
43
|
+
actions
|
|
44
|
+
] });
|
|
45
|
+
const TitleComponent = TitleComponentInner && (forceHeaderGroup ? /* @__PURE__ */ jsx(Group, { justify: "space-between", children: TitleComponentInner }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Stack, { hiddenFrom: "xs", children: TitleComponentInner }),
|
|
47
|
+
/* @__PURE__ */ jsx(Group, { visibleFrom: "xs", justify: "space-between", children: TitleComponentInner })
|
|
48
|
+
] }));
|
|
49
|
+
return /* @__PURE__ */ jsxs(
|
|
50
|
+
Stack,
|
|
51
|
+
{
|
|
52
|
+
px: withBorder ? "lg" : void 0,
|
|
53
|
+
pt: withBorder ? TitleComponent || description ? "sm" : "lg" : void 0,
|
|
54
|
+
pb: withBorder ? "lg" : void 0,
|
|
55
|
+
bdrs: "md",
|
|
56
|
+
className: withBorder ? "bordered-light" : void 0,
|
|
57
|
+
...props,
|
|
58
|
+
ref,
|
|
59
|
+
children: [
|
|
60
|
+
(TitleComponent || description) && /* @__PURE__ */ jsxs(
|
|
61
|
+
Stack,
|
|
62
|
+
{
|
|
63
|
+
gap: "0.2rem",
|
|
64
|
+
mb: titleMb,
|
|
65
|
+
onClick: onHeaderClick,
|
|
66
|
+
style: { cursor: onHeaderClick && "pointer" },
|
|
67
|
+
children: [
|
|
68
|
+
TitleComponent,
|
|
69
|
+
description && /* @__PURE__ */ jsx(Text, { c: "dimmed", children: description })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
isPending ? /* @__PURE__ */ jsx(Center, { ...guardProps, children: /* @__PURE__ */ jsx(Loader, { size: "xl" }) }) : error ? /* @__PURE__ */ jsx(Center, { ...guardProps, children: /* @__PURE__ */ jsx(Text, { children: error }) }) : children
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
export {
|
|
81
|
+
Section
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/section.tsx"],"sourcesContent":["import {\n Center,\n CenterProps,\n createPolymorphicComponent,\n Group,\n Loader,\n MantineStyleProps,\n Stack,\n StackProps,\n Text,\n} from \"@mantine/core\";\nimport { forwardRef, ReactNode } from \"react\";\n\n// https://mantine.dev/guides/polymorphic/#create-your-own-polymorphic-components\n\nexport interface SectionProps extends StackProps {\n titleFz?: MantineStyleProps[\"fz\"];\n titleMb?: MantineStyleProps[\"mb\"];\n titleDimmed?: boolean;\n titleNode?: ReactNode;\n icon?: ReactNode;\n titleRight?: ReactNode;\n titleOther?: ReactNode;\n description?: ReactNode;\n actions?: ReactNode;\n withBorder?: boolean;\n isPending?: boolean;\n error?: false | string;\n guardProps?: CenterProps;\n forceHeaderGroup?: boolean;\n onHeaderClick?: () => void;\n}\n\nexport const Section = createPolymorphicComponent<\"div\", SectionProps>(\n forwardRef<HTMLDivElement, SectionProps>(\n (\n {\n titleFz = \"h2\",\n titleMb,\n title,\n titleDimmed,\n titleNode,\n icon,\n titleRight,\n titleOther,\n description,\n actions,\n children,\n withBorder,\n isPending,\n error,\n guardProps,\n forceHeaderGroup,\n onHeaderClick,\n ...props\n },\n ref,\n ) => {\n const TitleComponentInner = (title ||\n titleNode ||\n icon ||\n titleRight ||\n titleOther ||\n actions) && (\n <>\n {title || titleNode || icon ? (\n <Group c={titleDimmed ? \"dimmed\" : undefined} gap=\"xs\">\n {icon}\n {title && <Text fz={titleFz}>{title}</Text>}\n {titleNode}\n {titleRight}\n </Group>\n ) : titleRight ? (\n <Group c={titleDimmed ? \"dimmed\" : undefined} gap=\"xs\">\n {titleOther}\n {titleRight}\n </Group>\n ) : (\n titleOther\n )}\n {actions}\n </>\n );\n\n const TitleComponent =\n TitleComponentInner &&\n (forceHeaderGroup ? (\n <Group justify=\"space-between\">{TitleComponentInner}</Group>\n ) : (\n <>\n <Stack hiddenFrom=\"xs\">{TitleComponentInner}</Stack>\n <Group visibleFrom=\"xs\" justify=\"space-between\">\n {TitleComponentInner}\n </Group>\n </>\n ));\n\n return (\n <Stack\n px={withBorder ? \"lg\" : undefined}\n pt={\n withBorder\n ? TitleComponent || description\n ? \"sm\"\n : \"lg\"\n : undefined\n }\n pb={withBorder ? \"lg\" : undefined}\n bdrs=\"md\"\n className={withBorder ? \"bordered-light\" : undefined}\n {...props}\n ref={ref}\n >\n {(TitleComponent || description) && (\n <Stack\n gap=\"0.2rem\"\n mb={titleMb}\n onClick={onHeaderClick}\n style={{ cursor: onHeaderClick && \"pointer\" }}\n >\n {TitleComponent}\n {description && <Text c=\"dimmed\">{description}</Text>}\n </Stack>\n )}\n {isPending ? (\n <Center {...guardProps}>\n <Loader size=\"xl\" />\n </Center>\n ) : error ? (\n <Center {...guardProps}>\n <Text>{error}</Text>\n </Center>\n ) : (\n children\n )}\n </Stack>\n );\n },\n ),\n);\n"],"mappings":"AAgEQ,mBAIgB,KAFZ,YAFJ;AAhER;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AACP,SAAS,kBAA6B;AAsB/B,MAAM,UAAU;AAAA,EACrB;AAAA,IACE,CACE;AAAA,MACE,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,GACA,QACG;AACH,YAAM,uBAAuB,SAC3B,aACA,QACA,cACA,cACA,YACA,iCACG;AAAA,iBAAS,aAAa,OACrB,qBAAC,SAAM,GAAG,cAAc,WAAW,QAAW,KAAI,MAC/C;AAAA;AAAA,UACA,SAAS,oBAAC,QAAK,IAAI,SAAU,iBAAM;AAAA,UACnC;AAAA,UACA;AAAA,WACH,IACE,aACF,qBAAC,SAAM,GAAG,cAAc,WAAW,QAAW,KAAI,MAC/C;AAAA;AAAA,UACA;AAAA,WACH,IAEA;AAAA,QAED;AAAA,SACH;AAGF,YAAM,iBACJ,wBACC,mBACC,oBAAC,SAAM,SAAQ,iBAAiB,+BAAoB,IAEpD,iCACE;AAAA,4BAAC,SAAM,YAAW,MAAM,+BAAoB;AAAA,QAC5C,oBAAC,SAAM,aAAY,MAAK,SAAQ,iBAC7B,+BACH;AAAA,SACF;AAGJ,aACE;AAAA,QAAC;AAAA;AAAA,UACC,IAAI,aAAa,OAAO;AAAA,UACxB,IACE,aACI,kBAAkB,cAChB,OACA,OACF;AAAA,UAEN,IAAI,aAAa,OAAO;AAAA,UACxB,MAAK;AAAA,UACL,WAAW,aAAa,mBAAmB;AAAA,UAC1C,GAAG;AAAA,UACJ;AAAA,UAEE;AAAA,+BAAkB,gBAClB;AAAA,cAAC;AAAA;AAAA,gBACC,KAAI;AAAA,gBACJ,IAAI;AAAA,gBACJ,SAAS;AAAA,gBACT,OAAO,EAAE,QAAQ,iBAAiB,UAAU;AAAA,gBAE3C;AAAA;AAAA,kBACA,eAAe,oBAAC,QAAK,GAAE,UAAU,uBAAY;AAAA;AAAA;AAAA,YAChD;AAAA,YAED,YACC,oBAAC,UAAQ,GAAG,YACV,8BAAC,UAAO,MAAK,MAAK,GACpB,IACE,QACF,oBAAC,UAAQ,GAAG,YACV,8BAAC,QAAM,iBAAM,GACf,IAEA;AAAA;AAAA;AAAA,MAEJ;AAAA,IAEJ;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
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 shared_text_update_exports = {};
|
|
20
|
+
__export(shared_text_update_exports, {
|
|
21
|
+
SharedTextUpdate: () => SharedTextUpdate,
|
|
22
|
+
useSharedTextUpdateData: () => useSharedTextUpdateData
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(shared_text_update_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_core = require("@mantine/core");
|
|
27
|
+
var import_lucide_react = require("lucide-react");
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
function useSharedTextUpdateData() {
|
|
30
|
+
return (0, import_react.useState)(false);
|
|
31
|
+
}
|
|
32
|
+
function SharedTextUpdate({
|
|
33
|
+
data,
|
|
34
|
+
setData,
|
|
35
|
+
disabled,
|
|
36
|
+
...modalProps
|
|
37
|
+
}) {
|
|
38
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
39
|
+
import_core.Modal,
|
|
40
|
+
{
|
|
41
|
+
title: data && (data.titleRight ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Group, { children: [
|
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { fz: "h2", children: data.title }),
|
|
43
|
+
data.titleRight
|
|
44
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { fz: "h2", children: data.title })),
|
|
45
|
+
opened: !!data,
|
|
46
|
+
onClose: () => setData(false),
|
|
47
|
+
size: "xl",
|
|
48
|
+
...modalProps,
|
|
49
|
+
children: data && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Stack, { children: [
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
import_core.Textarea,
|
|
52
|
+
{
|
|
53
|
+
value: data.value,
|
|
54
|
+
placeholder: data.placeholder,
|
|
55
|
+
onChange: (e) => setData(
|
|
56
|
+
(data2) => data2 ? { ...data2, value: e.target.value } : false
|
|
57
|
+
),
|
|
58
|
+
disabled,
|
|
59
|
+
resize: "vertical",
|
|
60
|
+
styles: { input: { minHeight: 200 } }
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
!disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Group, { justify: "end", w: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
import_core.Button,
|
|
65
|
+
{
|
|
66
|
+
leftSection: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.CheckCircle, { size: "1rem" }),
|
|
67
|
+
onClick: () => {
|
|
68
|
+
data.onUpdate(data.value);
|
|
69
|
+
setData(false);
|
|
70
|
+
},
|
|
71
|
+
children: "Update"
|
|
72
|
+
}
|
|
73
|
+
) })
|
|
74
|
+
] })
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
SharedTextUpdate,
|
|
81
|
+
useSharedTextUpdateData
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=shared-text-update.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/shared-text-update.tsx"],"sourcesContent":["import {\n Button,\n Group,\n Modal,\n ModalProps,\n Stack,\n Text,\n Textarea,\n} from \"@mantine/core\";\nimport { CheckCircle } from \"lucide-react\";\nimport { Dispatch, ReactNode, SetStateAction, useState } from \"react\";\n\nexport interface SharedTextUpdateData {\n title: string;\n value: string;\n placeholder: string;\n onUpdate: (value: string) => void;\n titleRight?: ReactNode;\n}\n\nexport function useSharedTextUpdateData() {\n return useState<false | SharedTextUpdateData>(false);\n}\n\nexport interface SharedTextUpdateProps extends Omit<\n Omit<ModalProps, \"opened\">,\n \"onClose\"\n> {\n data: false | SharedTextUpdateData;\n setData: Dispatch<SetStateAction<false | SharedTextUpdateData>>;\n disabled?: boolean;\n}\n\nexport function SharedTextUpdate({\n data,\n setData,\n disabled,\n ...modalProps\n}: SharedTextUpdateProps) {\n return (\n <Modal\n title={\n data &&\n (data.titleRight ? (\n <Group>\n <Text fz=\"h2\">{data.title}</Text>\n {data.titleRight}\n </Group>\n ) : (\n <Text fz=\"h2\">{data.title}</Text>\n ))\n }\n opened={!!data}\n onClose={() => setData(false)}\n size=\"xl\"\n {...modalProps}\n >\n {data && (\n <Stack>\n <Textarea\n value={data.value}\n placeholder={data.placeholder}\n onChange={(e) =>\n setData((data) =>\n data ? { ...data, value: e.target.value } : false,\n )\n }\n disabled={disabled}\n resize=\"vertical\"\n styles={{ input: { minHeight: 200 } }}\n />\n\n {!disabled && (\n <Group justify=\"end\" w=\"100%\">\n <Button\n leftSection={<CheckCircle size=\"1rem\" />}\n onClick={() => {\n data.onUpdate(data.value);\n setData(false);\n }}\n >\n Update\n </Button>\n </Group>\n )}\n </Stack>\n )}\n </Modal>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4CU;AA5CV,kBAQO;AACP,0BAA4B;AAC5B,mBAA8D;AAUvD,SAAS,0BAA0B;AACxC,aAAO,uBAAuC,KAAK;AACrD;AAWO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA0B;AACxB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OACE,SACC,KAAK,aACJ,6CAAC,qBACC;AAAA,oDAAC,oBAAK,IAAG,MAAM,eAAK,OAAM;AAAA,QACzB,KAAK;AAAA,SACR,IAEA,4CAAC,oBAAK,IAAG,MAAM,eAAK,OAAM;AAAA,MAG9B,QAAQ,CAAC,CAAC;AAAA,MACV,SAAS,MAAM,QAAQ,KAAK;AAAA,MAC5B,MAAK;AAAA,MACJ,GAAG;AAAA,MAEH,kBACC,6CAAC,qBACC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,KAAK;AAAA,YACZ,aAAa,KAAK;AAAA,YAClB,UAAU,CAAC,MACT;AAAA,cAAQ,CAACA,UACPA,QAAO,EAAE,GAAGA,OAAM,OAAO,EAAE,OAAO,MAAM,IAAI;AAAA,YAC9C;AAAA,YAEF;AAAA,YACA,QAAO;AAAA,YACP,QAAQ,EAAE,OAAO,EAAE,WAAW,IAAI,EAAE;AAAA;AAAA,QACtC;AAAA,QAEC,CAAC,YACA,4CAAC,qBAAM,SAAQ,OAAM,GAAE,QACrB;AAAA,UAAC;AAAA;AAAA,YACC,aAAa,4CAAC,mCAAY,MAAK,QAAO;AAAA,YACtC,SAAS,MAAM;AACb,mBAAK,SAAS,KAAK,KAAK;AACxB,sBAAQ,KAAK;AAAA,YACf;AAAA,YACD;AAAA;AAAA,QAED,GACF;AAAA,SAEJ;AAAA;AAAA,EAEJ;AAEJ;","names":["data"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ModalProps } from '@mantine/core';
|
|
3
|
+
import { ReactNode, Dispatch, SetStateAction } from 'react';
|
|
4
|
+
|
|
5
|
+
interface SharedTextUpdateData {
|
|
6
|
+
title: string;
|
|
7
|
+
value: string;
|
|
8
|
+
placeholder: string;
|
|
9
|
+
onUpdate: (value: string) => void;
|
|
10
|
+
titleRight?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
declare function useSharedTextUpdateData(): [false | SharedTextUpdateData, Dispatch<SetStateAction<false | SharedTextUpdateData>>];
|
|
13
|
+
interface SharedTextUpdateProps extends Omit<Omit<ModalProps, "opened">, "onClose"> {
|
|
14
|
+
data: false | SharedTextUpdateData;
|
|
15
|
+
setData: Dispatch<SetStateAction<false | SharedTextUpdateData>>;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare function SharedTextUpdate({ data, setData, disabled, ...modalProps }: SharedTextUpdateProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { SharedTextUpdate, type SharedTextUpdateData, type SharedTextUpdateProps, useSharedTextUpdateData };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ModalProps } from '@mantine/core';
|
|
3
|
+
import { ReactNode, Dispatch, SetStateAction } from 'react';
|
|
4
|
+
|
|
5
|
+
interface SharedTextUpdateData {
|
|
6
|
+
title: string;
|
|
7
|
+
value: string;
|
|
8
|
+
placeholder: string;
|
|
9
|
+
onUpdate: (value: string) => void;
|
|
10
|
+
titleRight?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
declare function useSharedTextUpdateData(): [false | SharedTextUpdateData, Dispatch<SetStateAction<false | SharedTextUpdateData>>];
|
|
13
|
+
interface SharedTextUpdateProps extends Omit<Omit<ModalProps, "opened">, "onClose"> {
|
|
14
|
+
data: false | SharedTextUpdateData;
|
|
15
|
+
setData: Dispatch<SetStateAction<false | SharedTextUpdateData>>;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare function SharedTextUpdate({ data, setData, disabled, ...modalProps }: SharedTextUpdateProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { SharedTextUpdate, type SharedTextUpdateData, type SharedTextUpdateProps, useSharedTextUpdateData };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Group,
|
|
5
|
+
Modal,
|
|
6
|
+
Stack,
|
|
7
|
+
Text,
|
|
8
|
+
Textarea
|
|
9
|
+
} from "@mantine/core";
|
|
10
|
+
import { CheckCircle } from "lucide-react";
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
function useSharedTextUpdateData() {
|
|
13
|
+
return useState(false);
|
|
14
|
+
}
|
|
15
|
+
function SharedTextUpdate({
|
|
16
|
+
data,
|
|
17
|
+
setData,
|
|
18
|
+
disabled,
|
|
19
|
+
...modalProps
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
Modal,
|
|
23
|
+
{
|
|
24
|
+
title: data && (data.titleRight ? /* @__PURE__ */ jsxs(Group, { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(Text, { fz: "h2", children: data.title }),
|
|
26
|
+
data.titleRight
|
|
27
|
+
] }) : /* @__PURE__ */ jsx(Text, { fz: "h2", children: data.title })),
|
|
28
|
+
opened: !!data,
|
|
29
|
+
onClose: () => setData(false),
|
|
30
|
+
size: "xl",
|
|
31
|
+
...modalProps,
|
|
32
|
+
children: data && /* @__PURE__ */ jsxs(Stack, { children: [
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
Textarea,
|
|
35
|
+
{
|
|
36
|
+
value: data.value,
|
|
37
|
+
placeholder: data.placeholder,
|
|
38
|
+
onChange: (e) => setData(
|
|
39
|
+
(data2) => data2 ? { ...data2, value: e.target.value } : false
|
|
40
|
+
),
|
|
41
|
+
disabled,
|
|
42
|
+
resize: "vertical",
|
|
43
|
+
styles: { input: { minHeight: 200 } }
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
!disabled && /* @__PURE__ */ jsx(Group, { justify: "end", w: "100%", children: /* @__PURE__ */ jsx(
|
|
47
|
+
Button,
|
|
48
|
+
{
|
|
49
|
+
leftSection: /* @__PURE__ */ jsx(CheckCircle, { size: "1rem" }),
|
|
50
|
+
onClick: () => {
|
|
51
|
+
data.onUpdate(data.value);
|
|
52
|
+
setData(false);
|
|
53
|
+
},
|
|
54
|
+
children: "Update"
|
|
55
|
+
}
|
|
56
|
+
) })
|
|
57
|
+
] })
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
SharedTextUpdate,
|
|
63
|
+
useSharedTextUpdateData
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=shared-text-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/shared-text-update.tsx"],"sourcesContent":["import {\n Button,\n Group,\n Modal,\n ModalProps,\n Stack,\n Text,\n Textarea,\n} from \"@mantine/core\";\nimport { CheckCircle } from \"lucide-react\";\nimport { Dispatch, ReactNode, SetStateAction, useState } from \"react\";\n\nexport interface SharedTextUpdateData {\n title: string;\n value: string;\n placeholder: string;\n onUpdate: (value: string) => void;\n titleRight?: ReactNode;\n}\n\nexport function useSharedTextUpdateData() {\n return useState<false | SharedTextUpdateData>(false);\n}\n\nexport interface SharedTextUpdateProps extends Omit<\n Omit<ModalProps, \"opened\">,\n \"onClose\"\n> {\n data: false | SharedTextUpdateData;\n setData: Dispatch<SetStateAction<false | SharedTextUpdateData>>;\n disabled?: boolean;\n}\n\nexport function SharedTextUpdate({\n data,\n setData,\n disabled,\n ...modalProps\n}: SharedTextUpdateProps) {\n return (\n <Modal\n title={\n data &&\n (data.titleRight ? (\n <Group>\n <Text fz=\"h2\">{data.title}</Text>\n {data.titleRight}\n </Group>\n ) : (\n <Text fz=\"h2\">{data.title}</Text>\n ))\n }\n opened={!!data}\n onClose={() => setData(false)}\n size=\"xl\"\n {...modalProps}\n >\n {data && (\n <Stack>\n <Textarea\n value={data.value}\n placeholder={data.placeholder}\n onChange={(e) =>\n setData((data) =>\n data ? { ...data, value: e.target.value } : false,\n )\n }\n disabled={disabled}\n resize=\"vertical\"\n styles={{ input: { minHeight: 200 } }}\n />\n\n {!disabled && (\n <Group justify=\"end\" w=\"100%\">\n <Button\n leftSection={<CheckCircle size=\"1rem\" />}\n onClick={() => {\n data.onUpdate(data.value);\n setData(false);\n }}\n >\n Update\n </Button>\n </Group>\n )}\n </Stack>\n )}\n </Modal>\n );\n}\n"],"mappings":"AA4CU,SACE,KADF;AA5CV;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAA8C,gBAAgB;AAUvD,SAAS,0BAA0B;AACxC,SAAO,SAAuC,KAAK;AACrD;AAWO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA0B;AACxB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OACE,SACC,KAAK,aACJ,qBAAC,SACC;AAAA,4BAAC,QAAK,IAAG,MAAM,eAAK,OAAM;AAAA,QACzB,KAAK;AAAA,SACR,IAEA,oBAAC,QAAK,IAAG,MAAM,eAAK,OAAM;AAAA,MAG9B,QAAQ,CAAC,CAAC;AAAA,MACV,SAAS,MAAM,QAAQ,KAAK;AAAA,MAC5B,MAAK;AAAA,MACJ,GAAG;AAAA,MAEH,kBACC,qBAAC,SACC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,KAAK;AAAA,YACZ,aAAa,KAAK;AAAA,YAClB,UAAU,CAAC,MACT;AAAA,cAAQ,CAACA,UACPA,QAAO,EAAE,GAAGA,OAAM,OAAO,EAAE,OAAO,MAAM,IAAI;AAAA,YAC9C;AAAA,YAEF;AAAA,YACA,QAAO;AAAA,YACP,QAAQ,EAAE,OAAO,EAAE,WAAW,IAAI,EAAE;AAAA;AAAA,QACtC;AAAA,QAEC,CAAC,YACA,oBAAC,SAAM,SAAQ,OAAM,GAAE,QACrB;AAAA,UAAC;AAAA;AAAA,YACC,aAAa,oBAAC,eAAY,MAAK,QAAO;AAAA,YACtC,SAAS,MAAM;AACb,mBAAK,SAAS,KAAK,KAAK;AACxB,sBAAQ,KAAK;AAAA,YACf;AAAA,YACD;AAAA;AAAA,QAED,GACF;AAAA,SAEJ;AAAA;AAAA,EAEJ;AAEJ;","names":["data"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 show_hide_button_exports = {};
|
|
20
|
+
__export(show_hide_button_exports, {
|
|
21
|
+
ShowHideButton: () => ShowHideButton
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(show_hide_button_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_core = require("@mantine/core");
|
|
26
|
+
var import_lucide_react = require("lucide-react");
|
|
27
|
+
function ShowHideButton({
|
|
28
|
+
show,
|
|
29
|
+
setShow
|
|
30
|
+
}) {
|
|
31
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
32
|
+
import_core.Button,
|
|
33
|
+
{
|
|
34
|
+
variant: "outline",
|
|
35
|
+
onClick: (e) => {
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
setShow(!show);
|
|
38
|
+
},
|
|
39
|
+
rightSection: show ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronUp, { size: "1rem" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDown, { size: "1rem" }),
|
|
40
|
+
children: show ? "Hide" : "Show"
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
ShowHideButton
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=show-hide-button.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/show-hide-button.tsx"],"sourcesContent":["import { Button } from \"@mantine/core\";\nimport { ChevronDown, ChevronUp } from \"lucide-react\";\n\nexport function ShowHideButton({\n show,\n setShow,\n}: {\n show: boolean;\n setShow: (show: boolean) => void;\n}) {\n return (\n <Button\n variant=\"outline\"\n onClick={(e) => {\n e.stopPropagation();\n setShow(!show);\n }}\n rightSection={\n show ? <ChevronUp size=\"1rem\" /> : <ChevronDown size=\"1rem\" />\n }\n >\n {show ? \"Hide\" : \"Show\"}\n </Button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBe;AAlBf,kBAAuB;AACvB,0BAAuC;AAEhC,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AACF,GAGG;AACD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,SAAS,CAAC,MAAM;AACd,UAAE,gBAAgB;AAClB,gBAAQ,CAAC,IAAI;AAAA,MACf;AAAA,MACA,cACE,OAAO,4CAAC,iCAAU,MAAK,QAAO,IAAK,4CAAC,mCAAY,MAAK,QAAO;AAAA,MAG7D,iBAAO,SAAS;AAAA;AAAA,EACnB;AAEJ;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "@mantine/core";
|
|
3
|
+
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
4
|
+
function ShowHideButton({
|
|
5
|
+
show,
|
|
6
|
+
setShow
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Button,
|
|
10
|
+
{
|
|
11
|
+
variant: "outline",
|
|
12
|
+
onClick: (e) => {
|
|
13
|
+
e.stopPropagation();
|
|
14
|
+
setShow(!show);
|
|
15
|
+
},
|
|
16
|
+
rightSection: show ? /* @__PURE__ */ jsx(ChevronUp, { size: "1rem" }) : /* @__PURE__ */ jsx(ChevronDown, { size: "1rem" }),
|
|
17
|
+
children: show ? "Hide" : "Show"
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
ShowHideButton
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=show-hide-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/show-hide-button.tsx"],"sourcesContent":["import { Button } from \"@mantine/core\";\nimport { ChevronDown, ChevronUp } from \"lucide-react\";\n\nexport function ShowHideButton({\n show,\n setShow,\n}: {\n show: boolean;\n setShow: (show: boolean) => void;\n}) {\n return (\n <Button\n variant=\"outline\"\n onClick={(e) => {\n e.stopPropagation();\n setShow(!show);\n }}\n rightSection={\n show ? <ChevronUp size=\"1rem\" /> : <ChevronDown size=\"1rem\" />\n }\n >\n {show ? \"Hide\" : \"Show\"}\n </Button>\n );\n}\n"],"mappings":"AAkBe;AAlBf,SAAS,cAAc;AACvB,SAAS,aAAa,iBAAiB;AAEhC,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AACF,GAGG;AACD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,SAAS,CAAC,MAAM;AACd,UAAE,gBAAgB;AAClB,gBAAQ,CAAC,IAAI;AAAA,MACf;AAAA,MACA,cACE,OAAO,oBAAC,aAAU,MAAK,QAAO,IAAK,oBAAC,eAAY,MAAK,QAAO;AAAA,MAG7D,iBAAO,SAAS;AAAA;AAAA,EACnB;AAEJ;","names":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 stat_bar_exports = {};
|
|
20
|
+
__export(stat_bar_exports, {
|
|
21
|
+
StatBar: () => StatBar
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(stat_bar_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_core = require("@mantine/core");
|
|
26
|
+
var import_color = require("../color");
|
|
27
|
+
var import_info_card = require("./info-card");
|
|
28
|
+
function StatBar({
|
|
29
|
+
title,
|
|
30
|
+
icon,
|
|
31
|
+
description,
|
|
32
|
+
percentage: _percentage,
|
|
33
|
+
warning: _warning,
|
|
34
|
+
critical: _critical,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
const percentage = _percentage ?? 0;
|
|
38
|
+
const warning = _warning ?? 100;
|
|
39
|
+
const critical = _critical ?? 100;
|
|
40
|
+
const intent = percentage > critical ? "Critical" : percentage > warning ? "Warning" : "Good";
|
|
41
|
+
const color = (0, import_color.hexColorByIntention)(intent);
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
43
|
+
import_info_card.InfoCard,
|
|
44
|
+
{
|
|
45
|
+
title,
|
|
46
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Group, { gap: "xs", children: [
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Text, { c: color, fz: "lg", children: [
|
|
48
|
+
percentage.toFixed(2),
|
|
49
|
+
"%"
|
|
50
|
+
] }),
|
|
51
|
+
icon
|
|
52
|
+
] }),
|
|
53
|
+
w: { base: "100%", lg: 300 },
|
|
54
|
+
gap: "0.2rem",
|
|
55
|
+
justify: "space-between",
|
|
56
|
+
...props,
|
|
57
|
+
children: [
|
|
58
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { c: "dimmed", size: "sm", children: description }),
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Progress, { color: "bw", value: percentage, size: "xl" })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
StatBar
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=stat-bar.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/stat-bar.tsx"],"sourcesContent":["import { Group, Progress, StackProps, Text } from \"@mantine/core\";\nimport { ReactNode } from \"react\";\nimport { hexColorByIntention } from \"../color\";\nimport { InfoCard } from \"./info-card\";\n\nexport interface StatBarProps extends StackProps {\n title: string;\n icon: ReactNode;\n description?: ReactNode;\n percentage: number | undefined;\n warning: number | undefined;\n critical: number | undefined;\n}\n\nexport function StatBar({\n title,\n icon,\n description,\n percentage: _percentage,\n warning: _warning,\n critical: _critical,\n ...props\n}: StatBarProps) {\n const percentage = _percentage ?? 0;\n const warning = _warning ?? 100;\n const critical = _critical ?? 100;\n const intent =\n percentage > critical\n ? \"Critical\"\n : percentage > warning\n ? \"Warning\"\n : \"Good\";\n const color = hexColorByIntention(intent);\n return (\n <InfoCard\n title={title}\n info={\n <Group gap=\"xs\">\n <Text c={color} fz=\"lg\">\n {percentage.toFixed(2)}%\n </Text>\n {icon}\n </Group>\n }\n w={{ base: \"100%\", lg: 300 }}\n gap=\"0.2rem\"\n justify=\"space-between\"\n {...props}\n >\n {description && (\n <Text c=\"dimmed\" size=\"sm\">\n {description}\n </Text>\n )}\n <Progress color=\"bw\" value={percentage} size=\"xl\" />\n </InfoCard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsCU;AAtCV,kBAAkD;AAElD,mBAAoC;AACpC,uBAAyB;AAWlB,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,UAAU;AAAA,EACV,GAAG;AACL,GAAiB;AACf,QAAM,aAAa,eAAe;AAClC,QAAM,UAAU,YAAY;AAC5B,QAAM,WAAW,aAAa;AAC9B,QAAM,SACJ,aAAa,WACT,aACA,aAAa,UACX,YACA;AACR,QAAM,YAAQ,kCAAoB,MAAM;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MACE,6CAAC,qBAAM,KAAI,MACT;AAAA,qDAAC,oBAAK,GAAG,OAAO,IAAG,MAChB;AAAA,qBAAW,QAAQ,CAAC;AAAA,UAAE;AAAA,WACzB;AAAA,QACC;AAAA,SACH;AAAA,MAEF,GAAG,EAAE,MAAM,QAAQ,IAAI,IAAI;AAAA,MAC3B,KAAI;AAAA,MACJ,SAAQ;AAAA,MACP,GAAG;AAAA,MAEH;AAAA,uBACC,4CAAC,oBAAK,GAAE,UAAS,MAAK,MACnB,uBACH;AAAA,QAEF,4CAAC,wBAAS,OAAM,MAAK,OAAO,YAAY,MAAK,MAAK;AAAA;AAAA;AAAA,EACpD;AAEJ;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { StackProps } from '@mantine/core';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
interface StatBarProps extends StackProps {
|
|
6
|
+
title: string;
|
|
7
|
+
icon: ReactNode;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
percentage: number | undefined;
|
|
10
|
+
warning: number | undefined;
|
|
11
|
+
critical: number | undefined;
|
|
12
|
+
}
|
|
13
|
+
declare function StatBar({ title, icon, description, percentage: _percentage, warning: _warning, critical: _critical, ...props }: StatBarProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { StatBar, type StatBarProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { StackProps } from '@mantine/core';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
interface StatBarProps extends StackProps {
|
|
6
|
+
title: string;
|
|
7
|
+
icon: ReactNode;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
percentage: number | undefined;
|
|
10
|
+
warning: number | undefined;
|
|
11
|
+
critical: number | undefined;
|
|
12
|
+
}
|
|
13
|
+
declare function StatBar({ title, icon, description, percentage: _percentage, warning: _warning, critical: _critical, ...props }: StatBarProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { StatBar, type StatBarProps };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Group, Progress, Text } from "@mantine/core";
|
|
3
|
+
import { hexColorByIntention } from "../color";
|
|
4
|
+
import { InfoCard } from "./info-card";
|
|
5
|
+
function StatBar({
|
|
6
|
+
title,
|
|
7
|
+
icon,
|
|
8
|
+
description,
|
|
9
|
+
percentage: _percentage,
|
|
10
|
+
warning: _warning,
|
|
11
|
+
critical: _critical,
|
|
12
|
+
...props
|
|
13
|
+
}) {
|
|
14
|
+
const percentage = _percentage ?? 0;
|
|
15
|
+
const warning = _warning ?? 100;
|
|
16
|
+
const critical = _critical ?? 100;
|
|
17
|
+
const intent = percentage > critical ? "Critical" : percentage > warning ? "Warning" : "Good";
|
|
18
|
+
const color = hexColorByIntention(intent);
|
|
19
|
+
return /* @__PURE__ */ jsxs(
|
|
20
|
+
InfoCard,
|
|
21
|
+
{
|
|
22
|
+
title,
|
|
23
|
+
info: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
24
|
+
/* @__PURE__ */ jsxs(Text, { c: color, fz: "lg", children: [
|
|
25
|
+
percentage.toFixed(2),
|
|
26
|
+
"%"
|
|
27
|
+
] }),
|
|
28
|
+
icon
|
|
29
|
+
] }),
|
|
30
|
+
w: { base: "100%", lg: 300 },
|
|
31
|
+
gap: "0.2rem",
|
|
32
|
+
justify: "space-between",
|
|
33
|
+
...props,
|
|
34
|
+
children: [
|
|
35
|
+
description && /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "sm", children: description }),
|
|
36
|
+
/* @__PURE__ */ jsx(Progress, { color: "bw", value: percentage, size: "xl" })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
StatBar
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=stat-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/stat-bar.tsx"],"sourcesContent":["import { Group, Progress, StackProps, Text } from \"@mantine/core\";\nimport { ReactNode } from \"react\";\nimport { hexColorByIntention } from \"../color\";\nimport { InfoCard } from \"./info-card\";\n\nexport interface StatBarProps extends StackProps {\n title: string;\n icon: ReactNode;\n description?: ReactNode;\n percentage: number | undefined;\n warning: number | undefined;\n critical: number | undefined;\n}\n\nexport function StatBar({\n title,\n icon,\n description,\n percentage: _percentage,\n warning: _warning,\n critical: _critical,\n ...props\n}: StatBarProps) {\n const percentage = _percentage ?? 0;\n const warning = _warning ?? 100;\n const critical = _critical ?? 100;\n const intent =\n percentage > critical\n ? \"Critical\"\n : percentage > warning\n ? \"Warning\"\n : \"Good\";\n const color = hexColorByIntention(intent);\n return (\n <InfoCard\n title={title}\n info={\n <Group gap=\"xs\">\n <Text c={color} fz=\"lg\">\n {percentage.toFixed(2)}%\n </Text>\n {icon}\n </Group>\n }\n w={{ base: \"100%\", lg: 300 }}\n gap=\"0.2rem\"\n justify=\"space-between\"\n {...props}\n >\n {description && (\n <Text c=\"dimmed\" size=\"sm\">\n {description}\n </Text>\n )}\n <Progress color=\"bw\" value={percentage} size=\"xl\" />\n </InfoCard>\n );\n}\n"],"mappings":"AAsCU,SAYF,KAZE;AAtCV,SAAS,OAAO,UAAsB,YAAY;AAElD,SAAS,2BAA2B;AACpC,SAAS,gBAAgB;AAWlB,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,UAAU;AAAA,EACV,GAAG;AACL,GAAiB;AACf,QAAM,aAAa,eAAe;AAClC,QAAM,UAAU,YAAY;AAC5B,QAAM,WAAW,aAAa;AAC9B,QAAM,SACJ,aAAa,WACT,aACA,aAAa,UACX,YACA;AACR,QAAM,QAAQ,oBAAoB,MAAM;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MACE,qBAAC,SAAM,KAAI,MACT;AAAA,6BAAC,QAAK,GAAG,OAAO,IAAG,MAChB;AAAA,qBAAW,QAAQ,CAAC;AAAA,UAAE;AAAA,WACzB;AAAA,QACC;AAAA,SACH;AAAA,MAEF,GAAG,EAAE,MAAM,QAAQ,IAAI,IAAI;AAAA,MAC3B,KAAI;AAAA,MACJ,SAAQ;AAAA,MACP,GAAG;AAAA,MAEH;AAAA,uBACC,oBAAC,QAAK,GAAE,UAAS,MAAK,MACnB,uBACH;AAAA,QAEF,oBAAC,YAAS,OAAM,MAAK,OAAO,YAAY,MAAK,MAAK;AAAA;AAAA;AAAA,EACpD;AAEJ;","names":[]}
|