@openshift-migration-advisor/shared-components 0.0.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/LICENSE +13 -0
- package/README.md +76 -0
- package/dist/charts/MigrationDonutChart.d.ts +53 -0
- package/dist/charts/MigrationDonutChart.d.ts.map +1 -0
- package/dist/charts/MigrationDonutChart.js +186 -0
- package/dist/charts/index.d.ts +2 -0
- package/dist/charts/index.d.ts.map +1 -0
- package/dist/charts/index.js +1 -0
- package/dist/forms/CheckboxFormGroup.d.ts +5 -0
- package/dist/forms/CheckboxFormGroup.d.ts.map +1 -0
- package/dist/forms/CheckboxFormGroup.js +14 -0
- package/dist/forms/FormFieldHelperText.d.ts +7 -0
- package/dist/forms/FormFieldHelperText.d.ts.map +1 -0
- package/dist/forms/FormFieldHelperText.js +8 -0
- package/dist/forms/RadioButtonFormGroup.d.ts +12 -0
- package/dist/forms/RadioButtonFormGroup.d.ts.map +1 -0
- package/dist/forms/RadioButtonFormGroup.js +12 -0
- package/dist/forms/SelectFormGroup.d.ts +8 -0
- package/dist/forms/SelectFormGroup.d.ts.map +1 -0
- package/dist/forms/SelectFormGroup.js +12 -0
- package/dist/forms/TextAreaFormGroup.d.ts +3 -0
- package/dist/forms/TextAreaFormGroup.d.ts.map +1 -0
- package/dist/forms/TextAreaFormGroup.js +12 -0
- package/dist/forms/TextInputFormGroup.d.ts +11 -0
- package/dist/forms/TextInputFormGroup.d.ts.map +1 -0
- package/dist/forms/TextInputFormGroup.js +16 -0
- package/dist/forms/index.d.ts +8 -0
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/index.js +6 -0
- package/dist/forms/types.d.ts +11 -0
- package/dist/forms/types.d.ts.map +1 -0
- package/dist/forms/types.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/report/CardEmptyState.d.ts +8 -0
- package/dist/report/CardEmptyState.d.ts.map +1 -0
- package/dist/report/CardEmptyState.js +13 -0
- package/dist/report/DashboardEmptyStateBase.d.ts +8 -0
- package/dist/report/DashboardEmptyStateBase.d.ts.map +1 -0
- package/dist/report/DashboardEmptyStateBase.js +5 -0
- package/dist/report/EmptySearchResults.d.ts +7 -0
- package/dist/report/EmptySearchResults.d.ts.map +1 -0
- package/dist/report/EmptySearchResults.js +4 -0
- package/dist/report/OSDistribution.d.ts +14 -0
- package/dist/report/OSDistribution.d.ts.map +1 -0
- package/dist/report/OSDistribution.js +37 -0
- package/dist/report/OsSupportTiersHelpPopover.d.ts +3 -0
- package/dist/report/OsSupportTiersHelpPopover.d.ts.map +1 -0
- package/dist/report/OsSupportTiersHelpPopover.js +37 -0
- package/dist/report/OsUpgradeNotice.d.ts +3 -0
- package/dist/report/OsUpgradeNotice.d.ts.map +1 -0
- package/dist/report/OsUpgradeNotice.js +9 -0
- package/dist/report/OsUpgradeRecommendationPopover.d.ts +13 -0
- package/dist/report/OsUpgradeRecommendationPopover.d.ts.map +1 -0
- package/dist/report/OsUpgradeRecommendationPopover.js +24 -0
- package/dist/report/PopoverIcon.d.ts +11 -0
- package/dist/report/PopoverIcon.d.ts.map +1 -0
- package/dist/report/PopoverIcon.js +8 -0
- package/dist/report/SupportTierBadge.d.ts +9 -0
- package/dist/report/SupportTierBadge.d.ts.map +1 -0
- package/dist/report/SupportTierBadge.js +23 -0
- package/dist/report/constants.d.ts +11 -0
- package/dist/report/constants.d.ts.map +1 -0
- package/dist/report/constants.js +12 -0
- package/dist/report/dashboardStyles.d.ts +20 -0
- package/dist/report/dashboardStyles.d.ts.map +1 -0
- package/dist/report/dashboardStyles.js +99 -0
- package/dist/report/index.d.ts +15 -0
- package/dist/report/index.d.ts.map +1 -0
- package/dist/report/index.js +13 -0
- package/dist/report/osSupportTier.d.ts +42 -0
- package/dist/report/osSupportTier.d.ts.map +1 -0
- package/dist/report/osSupportTier.js +106 -0
- package/dist/report/useOsBarChartViewModel.d.ts +26 -0
- package/dist/report/useOsBarChartViewModel.d.ts.map +1 -0
- package/dist/report/useOsBarChartViewModel.js +59 -0
- package/package.json +63 -0
- package/src/charts/MigrationDonutChart.tsx +398 -0
- package/src/charts/index.ts +5 -0
- package/src/forms/CheckboxFormGroup.tsx +53 -0
- package/src/forms/FormFieldHelperText.tsx +32 -0
- package/src/forms/RadioButtonFormGroup.tsx +62 -0
- package/src/forms/SelectFormGroup.tsx +57 -0
- package/src/forms/TextAreaFormGroup.tsx +43 -0
- package/src/forms/TextInputFormGroup.tsx +63 -0
- package/src/forms/index.ts +7 -0
- package/src/forms/types.ts +11 -0
- package/src/index.ts +3 -0
- package/src/report/CardEmptyState.tsx +30 -0
- package/src/report/DashboardEmptyStateBase.tsx +30 -0
- package/src/report/EmptySearchResults.tsx +14 -0
- package/src/report/OSDistribution.tsx +206 -0
- package/src/report/OsSupportTiersHelpPopover.tsx +87 -0
- package/src/report/OsUpgradeNotice.tsx +29 -0
- package/src/report/OsUpgradeRecommendationPopover.tsx +78 -0
- package/src/report/PopoverIcon.tsx +46 -0
- package/src/report/SupportTierBadge.tsx +55 -0
- package/src/report/__tests__/OSDistribution.test.tsx +236 -0
- package/src/report/__tests__/osSupportTier.test.ts +101 -0
- package/src/report/constants.ts +14 -0
- package/src/report/dashboardStyles.ts +116 -0
- package/src/report/index.ts +54 -0
- package/src/report/osSupportTier.ts +161 -0
- package/src/report/useOsBarChartViewModel.ts +115 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2026 Red Hat, Inc.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @openshift-migration-advisor/shared-components
|
|
2
|
+
|
|
3
|
+
Shared React UI components for Migration Advisor applications (agent UI and cloud assessment UI).
|
|
4
|
+
|
|
5
|
+
Includes:
|
|
6
|
+
|
|
7
|
+
- PatternFly form field wrappers (`react-hook-form`)
|
|
8
|
+
- Guest OS support-tier helpers and badges
|
|
9
|
+
- Report chart primitives (`MigrationDonutChart`)
|
|
10
|
+
- Operating Systems distribution card
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Yarn workspace (migration-planner-ui)
|
|
16
|
+
yarn workspace @openshift-migration-advisor/agent-ui add @openshift-migration-advisor/shared-components@workspace:*
|
|
17
|
+
|
|
18
|
+
# npm (migration-planner-ui-app)
|
|
19
|
+
npm install @openshift-migration-advisor/shared-components
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Peer dependencies
|
|
23
|
+
|
|
24
|
+
Consumers must provide:
|
|
25
|
+
|
|
26
|
+
- `react` / `react-dom` (^18.3)
|
|
27
|
+
- `@patternfly/react-core`, `@patternfly/react-charts` (^8), `@patternfly/react-icons`, `@patternfly/react-table`, `@patternfly/react-tokens`
|
|
28
|
+
- `@emotion/css`
|
|
29
|
+
- `react-hook-form` (for form components)
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import {
|
|
35
|
+
MigrationDonutChart,
|
|
36
|
+
OSDistribution,
|
|
37
|
+
SupportTierBadge,
|
|
38
|
+
TextInputFormGroup,
|
|
39
|
+
} from "@openshift-migration-advisor/shared-components";
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Components are SDK-agnostic: pass already-shaped props (for example `OSDistributionEntry` maps). Map `agent-sdk` / `planner-sdk` models at the app boundary.
|
|
43
|
+
|
|
44
|
+
## Development
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
yarn workspace @openshift-migration-advisor/shared-components build
|
|
48
|
+
yarn workspace @openshift-migration-advisor/shared-components typecheck
|
|
49
|
+
yarn workspace @openshift-migration-advisor/shared-components test
|
|
50
|
+
yarn workspace @openshift-migration-advisor/shared-components check
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Publishing
|
|
54
|
+
|
|
55
|
+
The package is published to npm under `@openshift-migration-advisor/shared-components` via GitHub Actions, using the same OIDC Trusted Publishing flow as `@openshift-migration-advisor/ioc`.
|
|
56
|
+
|
|
57
|
+
**Workflow:** [`.github/workflows/release-shared-components.yaml`](../../.github/workflows/release-shared-components.yaml)
|
|
58
|
+
|
|
59
|
+
| Trigger | Result |
|
|
60
|
+
|---|---|
|
|
61
|
+
| Push to `main` / `stable` changing `packages/shared-components/**` | Prerelease: `{latestTag}-{12-char-sha}` |
|
|
62
|
+
| Tag `vX.Y.Z` | Release: `X.Y.Z` |
|
|
63
|
+
|
|
64
|
+
### One-time npm setup (required before first publish)
|
|
65
|
+
|
|
66
|
+
On [npmjs.com](https://www.npmjs.com/) for the `@openshift-migration-advisor` org, create the package (or claim the name) and configure a **Trusted Publisher**:
|
|
67
|
+
|
|
68
|
+
- **Repository:** `kubev2v/migration-planner-agent-ui` (or the current GitHub repo name)
|
|
69
|
+
- **Workflow:** `release-shared-components.yaml`
|
|
70
|
+
- **Environment:** leave empty unless you use GitHub Environments
|
|
71
|
+
|
|
72
|
+
No npm token is stored in the repo; publish uses OIDC (`id-token: write`).
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
[Apache 2.0](LICENSE)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
export interface MigrationDonutChartDatum {
|
|
3
|
+
name: string;
|
|
4
|
+
count: number;
|
|
5
|
+
legendCategory: string;
|
|
6
|
+
countDisplay?: string;
|
|
7
|
+
diskRange?: {
|
|
8
|
+
min: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
};
|
|
11
|
+
memoryRange?: {
|
|
12
|
+
min: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
};
|
|
15
|
+
clusterNames?: string[];
|
|
16
|
+
networkNames?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface MigrationDonutChartProps {
|
|
19
|
+
data: MigrationDonutChartDatum[];
|
|
20
|
+
legend?: Record<string, string>;
|
|
21
|
+
customColors?: Record<string, string>;
|
|
22
|
+
height?: number;
|
|
23
|
+
width?: number;
|
|
24
|
+
title?: string;
|
|
25
|
+
subTitle?: string;
|
|
26
|
+
titleColor?: string;
|
|
27
|
+
subTitleColor?: string;
|
|
28
|
+
marginLeft?: string;
|
|
29
|
+
titleFontSize?: number;
|
|
30
|
+
subTitleFontSize?: number;
|
|
31
|
+
donutThickness?: number;
|
|
32
|
+
padAngle?: number;
|
|
33
|
+
tooltipLabelFormatter?: (args: {
|
|
34
|
+
datum: {
|
|
35
|
+
x: string;
|
|
36
|
+
y: number;
|
|
37
|
+
countDisplay?: string | number;
|
|
38
|
+
legendCategory: string;
|
|
39
|
+
};
|
|
40
|
+
percent: number;
|
|
41
|
+
total: number;
|
|
42
|
+
}) => string;
|
|
43
|
+
onItemClick?: (item: MigrationDonutChartDatum) => void;
|
|
44
|
+
onTitleClick?: () => void;
|
|
45
|
+
/** When set, used for legend label instead of "name (countDisplay)". */
|
|
46
|
+
legendLabelFormatter?: (item: {
|
|
47
|
+
x: string;
|
|
48
|
+
countDisplay?: string | number;
|
|
49
|
+
}) => string;
|
|
50
|
+
}
|
|
51
|
+
export declare const MigrationDonutChart: FC<MigrationDonutChartProps>;
|
|
52
|
+
export default MigrationDonutChart;
|
|
53
|
+
//# sourceMappingURL=MigrationDonutChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationDonutChart.d.ts","sourceRoot":"","sources":["../../src/charts/MigrationDonutChart.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,wBAAwB,EAAE,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE;QAC7B,KAAK,EAAE;YACL,CAAC,EAAE,MAAM,CAAC;YACV,CAAC,EAAE,MAAM,CAAC;YACV,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;YAC/B,cAAc,EAAE,MAAM,CAAC;SACxB,CAAC;QACF,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACvD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,wEAAwE;IACxE,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE;QAC5B,CAAC,EAAE,MAAM,CAAC;QACV,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAChC,KAAK,MAAM,CAAC;CACd;AAkDD,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAkS5D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { css } from "@emotion/css";
|
|
3
|
+
import { ChartDonut, ChartLabel } from "@patternfly/react-charts/victory";
|
|
4
|
+
import { EmptyState, EmptyStateVariant, Flex, FlexItem, } from "@patternfly/react-core";
|
|
5
|
+
import { InboxIcon } from "@patternfly/react-icons";
|
|
6
|
+
import { useCallback, useMemo } from "react";
|
|
7
|
+
const legendColors = ["#0066cc", "#5e40be", "#b6a6e9", "#b98412"];
|
|
8
|
+
const styles = {
|
|
9
|
+
legendIcon: css `
|
|
10
|
+
margin-right: 4px;
|
|
11
|
+
`,
|
|
12
|
+
cursorPointer: css `
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
`,
|
|
15
|
+
cursorDefault: css `
|
|
16
|
+
cursor: default;
|
|
17
|
+
`,
|
|
18
|
+
chartContainer: css `
|
|
19
|
+
padding: 1em 0;
|
|
20
|
+
`,
|
|
21
|
+
donutWrapper: css `
|
|
22
|
+
position: relative;
|
|
23
|
+
display: inline-block;
|
|
24
|
+
`,
|
|
25
|
+
legendContainer: css `
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
min-height: 40px;
|
|
28
|
+
`,
|
|
29
|
+
legendButton: css `
|
|
30
|
+
gap: var(--pf-t--global--spacer--lg);
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
border: none;
|
|
33
|
+
background: none;
|
|
34
|
+
padding: var(--pf-t--global--spacer--xs) var(--pf-t--global--spacer--ml);
|
|
35
|
+
margin: 0;
|
|
36
|
+
transition: opacity var(--pf-t--global--motion--duration--short);
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
|
|
39
|
+
&:hover {
|
|
40
|
+
opacity: 0.7;
|
|
41
|
+
}
|
|
42
|
+
`,
|
|
43
|
+
legendLabel: css `
|
|
44
|
+
gap: var(--pf-t--global--spacer--lg);
|
|
45
|
+
padding: var(--pf-t--global--spacer--xs) var(--pf-t--global--spacer--ml);
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
`,
|
|
48
|
+
legendInner: css `
|
|
49
|
+
max-width: 680px;
|
|
50
|
+
padding: var(--pf-t--global--spacer--ml);
|
|
51
|
+
`,
|
|
52
|
+
};
|
|
53
|
+
export const MigrationDonutChart = ({ data, legend, customColors, height = 260, width = 420, title, subTitle, titleColor = "#000000", subTitleColor = "#000000", marginLeft = "0%", titleFontSize = 28, subTitleFontSize = 14, donutThickness = 45, padAngle = 1, tooltipLabelFormatter, onItemClick, onTitleClick, legendLabelFormatter, }) => {
|
|
54
|
+
const dynamicLegend = useMemo(() => {
|
|
55
|
+
return data.reduce((acc, current) => {
|
|
56
|
+
const key = `${current.legendCategory}`;
|
|
57
|
+
if (!acc.seen.has(key)) {
|
|
58
|
+
acc.seen.add(key);
|
|
59
|
+
const color = customColors?.[key] ??
|
|
60
|
+
legendColors[(acc.seen.size - 1) % legendColors.length];
|
|
61
|
+
acc.result.push({ [key]: color });
|
|
62
|
+
}
|
|
63
|
+
return acc;
|
|
64
|
+
}, { seen: new Set(), result: [] }).result;
|
|
65
|
+
}, [data, customColors]);
|
|
66
|
+
const chartLegend = legend ? legend : Object.assign({}, ...dynamicLegend);
|
|
67
|
+
const getColor = useCallback((name) => chartLegend[name], [chartLegend]);
|
|
68
|
+
const chartData = useMemo(() => {
|
|
69
|
+
return data.map((item) => ({
|
|
70
|
+
x: item.name,
|
|
71
|
+
y: item.count,
|
|
72
|
+
legendCategory: item.legendCategory,
|
|
73
|
+
countDisplay: item.countDisplay ?? item.count,
|
|
74
|
+
}));
|
|
75
|
+
}, [data]);
|
|
76
|
+
const colorScale = useMemo(() => {
|
|
77
|
+
return chartData.map((item) => getColor(item.legendCategory));
|
|
78
|
+
}, [chartData, getColor]);
|
|
79
|
+
const innerRadius = useMemo(() => {
|
|
80
|
+
const outerApprox = Math.min(width, height) / 2;
|
|
81
|
+
const computed = outerApprox - donutThickness;
|
|
82
|
+
return computed > 0 ? computed : 0;
|
|
83
|
+
}, [width, height, donutThickness]);
|
|
84
|
+
const totalY = useMemo(() => {
|
|
85
|
+
return chartData.reduce((sum, item) => sum + (Number(item.y) || 0), 0);
|
|
86
|
+
}, [chartData]);
|
|
87
|
+
const handleClick = useCallback(
|
|
88
|
+
// biome-ignore lint/suspicious/noExplicitAny: Victory chart types are not well-typed
|
|
89
|
+
(props) => {
|
|
90
|
+
if (!onItemClick)
|
|
91
|
+
return;
|
|
92
|
+
const datum = props?.datum;
|
|
93
|
+
if (!datum)
|
|
94
|
+
return;
|
|
95
|
+
let clickedItem = data.find((item) => item.name === datum.x);
|
|
96
|
+
if (!clickedItem && typeof props.index === "number") {
|
|
97
|
+
clickedItem = data[props.index];
|
|
98
|
+
}
|
|
99
|
+
if (!clickedItem) {
|
|
100
|
+
clickedItem = data.find((item) => item.legendCategory === datum.legendCategory);
|
|
101
|
+
}
|
|
102
|
+
if (clickedItem) {
|
|
103
|
+
onItemClick(clickedItem);
|
|
104
|
+
}
|
|
105
|
+
}, [onItemClick, data]);
|
|
106
|
+
const chartEvents = useMemo(() => {
|
|
107
|
+
if (!onItemClick)
|
|
108
|
+
return undefined;
|
|
109
|
+
return [
|
|
110
|
+
{
|
|
111
|
+
target: "data",
|
|
112
|
+
eventHandlers: {
|
|
113
|
+
onClick: () => [
|
|
114
|
+
{
|
|
115
|
+
target: "data",
|
|
116
|
+
// biome-ignore lint/suspicious/noExplicitAny: Victory chart types are not well-typed
|
|
117
|
+
mutation: (props) => {
|
|
118
|
+
handleClick(props);
|
|
119
|
+
return null;
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
}, [onItemClick, handleClick]);
|
|
127
|
+
if (!data || data.length === 0) {
|
|
128
|
+
return (_jsx(EmptyState, { headingLevel: "h3", titleText: "No data available", icon: InboxIcon, variant: EmptyStateVariant.xs }));
|
|
129
|
+
}
|
|
130
|
+
return (_jsxs(Flex, { direction: { default: "column" }, alignItems: { default: "alignItemsCenter" }, className: `${onItemClick ? styles.cursorPointer : styles.cursorDefault} ${styles.chartContainer}`, children: [_jsxs("div", { className: styles.donutWrapper, children: [_jsx(ChartDonut, { ariaDesc: "Migration data donut chart", data: chartData, events: chartEvents, labels: ({ datum, }) => {
|
|
131
|
+
const percent = totalY > 0 ? (Number(datum.y) / totalY) * 100 : 0;
|
|
132
|
+
return tooltipLabelFormatter
|
|
133
|
+
? tooltipLabelFormatter({
|
|
134
|
+
datum: {
|
|
135
|
+
x: datum.x,
|
|
136
|
+
y: Number(datum.y),
|
|
137
|
+
countDisplay: datum.countDisplay,
|
|
138
|
+
legendCategory: datum.legendCategory,
|
|
139
|
+
},
|
|
140
|
+
percent,
|
|
141
|
+
total: totalY,
|
|
142
|
+
})
|
|
143
|
+
: `${datum.x}: ${datum.countDisplay ?? datum.y}`;
|
|
144
|
+
}, colorScale: colorScale, constrainToVisibleArea: true, innerRadius: innerRadius, padAngle: padAngle, title: title, subTitle: subTitle, height: height, width: width, padding: {
|
|
145
|
+
bottom: 5,
|
|
146
|
+
left: 20,
|
|
147
|
+
right: 20,
|
|
148
|
+
top: 0,
|
|
149
|
+
}, titleComponent: title ? (_jsx(ChartLabel, { style: [
|
|
150
|
+
{
|
|
151
|
+
fill: titleColor,
|
|
152
|
+
fontSize: titleFontSize,
|
|
153
|
+
fontWeight: "bold",
|
|
154
|
+
},
|
|
155
|
+
] })) : undefined, subTitleComponent: subTitle ? (_jsx(ChartLabel, { style: [
|
|
156
|
+
{
|
|
157
|
+
fill: subTitleColor,
|
|
158
|
+
fontSize: subTitleFontSize,
|
|
159
|
+
},
|
|
160
|
+
] })) : undefined }), onTitleClick && title && (_jsx("div", { onClick: onTitleClick, className: css `
|
|
161
|
+
position: absolute;
|
|
162
|
+
top: 50%;
|
|
163
|
+
left: 50%;
|
|
164
|
+
transform: translate(-50%, -50%);
|
|
165
|
+
width: ${innerRadius * 2}px;
|
|
166
|
+
height: ${innerRadius * 2}px;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
border-radius: 50%;
|
|
169
|
+
z-index: 10;
|
|
170
|
+
`, title: "Click to view all VMs", role: "button", tabIndex: 0, onKeyDown: (e) => {
|
|
171
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
onTitleClick();
|
|
174
|
+
}
|
|
175
|
+
} }))] }), _jsx(Flex, { className: `${styles.legendContainer} ${css `margin-left: ${marginLeft};`}`, justifyContent: { default: "justifyContentCenter" }, alignItems: { default: "alignItemsFlexStart" }, children: _jsx(Flex, { className: styles.legendInner, spaceItems: { default: "spaceItemsMd" }, justifyContent: { default: "justifyContentCenter" }, alignItems: { default: "alignItemsCenter" }, flexWrap: { default: "wrap" }, children: data.map((item) => {
|
|
176
|
+
const label = legendLabelFormatter
|
|
177
|
+
? legendLabelFormatter({
|
|
178
|
+
x: item.name,
|
|
179
|
+
countDisplay: item.countDisplay,
|
|
180
|
+
})
|
|
181
|
+
: item.name;
|
|
182
|
+
const content = (_jsxs(_Fragment, { children: [_jsxs("svg", { width: "10", height: "10", "aria-hidden": "true", className: styles.legendIcon, children: [_jsx("title", { children: "Legend color indicator" }), _jsx("rect", { width: "10", height: "10", fill: getColor(item.legendCategory) })] }), _jsx("span", { children: label })] }));
|
|
183
|
+
return (_jsx(FlexItem, { children: onItemClick ? (_jsx("button", { type: "button", onClick: () => onItemClick(item), className: styles.legendButton, children: content })) : (_jsx("span", { className: styles.legendLabel, children: content })) }, `${item.legendCategory}-${item.name}`));
|
|
184
|
+
}) }) })] }));
|
|
185
|
+
};
|
|
186
|
+
export default MigrationDonutChart;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/charts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,GAC9B,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MigrationDonutChart, } from "./MigrationDonutChart.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FormGroupProps } from "./types.js";
|
|
2
|
+
type CheckboxFormGroupProps = Omit<FormGroupProps, "placeholder">;
|
|
3
|
+
export default function CheckboxFormGroup({ id, label, name, isRequired, isDisabled, helpText, ...props }: CheckboxFormGroupProps): import("react").JSX.Element;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=CheckboxFormGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxFormGroup.d.ts","sourceRoot":"","sources":["../../src/forms/CheckboxFormGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,KAAK,sBAAsB,GAAG,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;AAElE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAkB,EAClB,UAAkB,EAClB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,sBAAsB,+BAoCxB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox, FormGroup } from "@patternfly/react-core";
|
|
3
|
+
import { Controller, useFormContext } from "react-hook-form";
|
|
4
|
+
import FormFieldHelperText from "./FormFieldHelperText.js";
|
|
5
|
+
export default function CheckboxFormGroup({ id, label, name, isRequired = false, isDisabled = false, helpText, ...props }) {
|
|
6
|
+
const methods = useFormContext();
|
|
7
|
+
const error = methods.formState.errors[name];
|
|
8
|
+
const isTouched = methods.formState.touchedFields[name];
|
|
9
|
+
const isSubmitted = methods.formState.isSubmitted;
|
|
10
|
+
const showError = error && (isTouched || isSubmitted);
|
|
11
|
+
return (_jsxs(FormGroup, { isRequired: isRequired, fieldId: id, ...props, children: [_jsx(Controller, { name: name, control: methods.control, render: ({ field }) => {
|
|
12
|
+
return (_jsx(Checkbox, { label: label, id: id, isRequired: isRequired, isDisabled: isDisabled, isChecked: field.value, onChange: field.onChange, onBlur: field.onBlur, name: field.name, ref: field.ref }));
|
|
13
|
+
} }), _jsx(FormFieldHelperText, { helpText: helpText, errorMessage: showError ? error?.message : undefined })] }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface FormFieldHelperTextProps {
|
|
2
|
+
helpText?: string;
|
|
3
|
+
errorMessage?: string;
|
|
4
|
+
}
|
|
5
|
+
export default function FormFieldHelperText({ helpText, errorMessage, }: FormFieldHelperTextProps): import("react").JSX.Element | null;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=FormFieldHelperText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormFieldHelperText.d.ts","sourceRoot":"","sources":["../../src/forms/FormFieldHelperText.tsx"],"names":[],"mappings":"AAOA,UAAU,wBAAwB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,QAAQ,EACR,YAAY,GACb,EAAE,wBAAwB,sCAgB1B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FormHelperText, HelperText, HelperTextItem, } from "@patternfly/react-core";
|
|
3
|
+
import { ExclamationCircleIcon } from "@patternfly/react-icons";
|
|
4
|
+
export default function FormFieldHelperText({ helpText, errorMessage, }) {
|
|
5
|
+
if (!helpText && !errorMessage)
|
|
6
|
+
return null;
|
|
7
|
+
return (_jsx(FormHelperText, { children: _jsx(HelperText, { children: errorMessage ? (_jsx(HelperTextItem, { icon: _jsx(ExclamationCircleIcon, {}), variant: "error", children: errorMessage })) : (helpText && _jsx(HelperTextItem, { children: helpText })) }) }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FormGroupProps } from "./types.js";
|
|
2
|
+
interface RadioOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
id: string;
|
|
6
|
+
}
|
|
7
|
+
interface RadioButtonFormGroupProps extends Omit<FormGroupProps, "placeholder"> {
|
|
8
|
+
options: RadioOption[];
|
|
9
|
+
}
|
|
10
|
+
export default function RadioButtonFormGroup({ id, label, name, isRequired, options, helpText, ...props }: RadioButtonFormGroupProps): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=RadioButtonFormGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioButtonFormGroup.d.ts","sourceRoot":"","sources":["../../src/forms/RadioButtonFormGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,yBACR,SAAQ,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC;IAC3C,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAkB,EAClB,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,yBAAyB,+BAoC3B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FormGroup, Radio } from "@patternfly/react-core";
|
|
3
|
+
import { Controller, useFormContext } from "react-hook-form";
|
|
4
|
+
import FormFieldHelperText from "./FormFieldHelperText.js";
|
|
5
|
+
export default function RadioButtonFormGroup({ id, label, name, isRequired = false, options, helpText, ...props }) {
|
|
6
|
+
const methods = useFormContext();
|
|
7
|
+
const error = methods.formState.errors[name];
|
|
8
|
+
const isTouched = methods.formState.touchedFields[name];
|
|
9
|
+
const isSubmitted = methods.formState.isSubmitted;
|
|
10
|
+
const showError = error && (isTouched || isSubmitted);
|
|
11
|
+
return (_jsxs(FormGroup, { label: label, isRequired: isRequired, fieldId: id, ...props, children: [_jsx(Controller, { name: name, control: methods.control, render: ({ field }) => (_jsx("div", { style: { display: "flex", gap: "16px" }, role: "radiogroup", children: options.map((option) => (_jsx(Radio, { id: option.id, name: name, label: option.label, isChecked: field.value === option.value, onChange: () => field.onChange(option.value), onBlur: field.onBlur }, option.value))) })) }), _jsx(FormFieldHelperText, { helpText: helpText, errorMessage: showError ? error?.message : undefined })] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FormGroupProps } from "./types.js";
|
|
2
|
+
export default function SelectFormGroup({ id, label, name, isRequired, options, helpText, isDisabled, ...props }: {
|
|
3
|
+
options: {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}[];
|
|
7
|
+
} & FormGroupProps): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=SelectFormGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectFormGroup.d.ts","sourceRoot":"","sources":["../../src/forms/SelectFormGroup.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAkB,EAClB,OAAO,EACP,QAAQ,EACR,UAAkB,EAClB,GAAG,KAAK,EACT,EAAE;IACD,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;CACL,GAAG,cAAc,+BAgCjB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FormGroup, FormSelect, FormSelectOption, } from "@patternfly/react-core";
|
|
3
|
+
import { Controller, useFormContext } from "react-hook-form";
|
|
4
|
+
import FormFieldHelperText from "./FormFieldHelperText.js";
|
|
5
|
+
export default function SelectFormGroup({ id, label, name, isRequired = false, options, helpText, isDisabled = false, ...props }) {
|
|
6
|
+
const methods = useFormContext();
|
|
7
|
+
const error = methods.formState.errors[name];
|
|
8
|
+
const isTouched = methods.formState.touchedFields[name];
|
|
9
|
+
const isSubmitted = methods.formState.isSubmitted;
|
|
10
|
+
const showError = error && (isTouched || isSubmitted);
|
|
11
|
+
return (_jsxs(FormGroup, { label: label, isRequired: isRequired, fieldId: id, ...props, children: [_jsx(Controller, { name: name, control: methods.control, render: ({ field }) => (_jsx(FormSelect, { id: id, isDisabled: isDisabled, ...field, children: options.map((option) => (_jsx(FormSelectOption, { value: option.value, label: option.label }, option.value))) })) }), _jsx(FormFieldHelperText, { helpText: helpText, errorMessage: showError ? error?.message : undefined })] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAreaFormGroup.d.ts","sourceRoot":"","sources":["../../src/forms/TextAreaFormGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAkB,EAClB,UAAkB,EAClB,WAAgB,EAChB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,+BA2BhB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FormGroup, TextArea, ValidatedOptions } from "@patternfly/react-core";
|
|
3
|
+
import { useFormContext } from "react-hook-form";
|
|
4
|
+
import FormFieldHelperText from "./FormFieldHelperText.js";
|
|
5
|
+
export default function TextAreaFormGroup({ id, label, name, isRequired = false, isDisabled = false, placeholder = "", helpText, ...props }) {
|
|
6
|
+
const methods = useFormContext();
|
|
7
|
+
const error = methods.formState.errors[name];
|
|
8
|
+
const isTouched = methods.formState.touchedFields[name];
|
|
9
|
+
const isSubmitted = methods.formState.isSubmitted;
|
|
10
|
+
const showError = error && (isTouched || isSubmitted);
|
|
11
|
+
return (_jsxs(FormGroup, { label: label, isRequired: isRequired, fieldId: id, ...props, children: [_jsx(TextArea, { id: id, placeholder: placeholder, isRequired: isRequired, isDisabled: isDisabled, validated: showError ? ValidatedOptions.error : ValidatedOptions.default, ...methods.register(name) }), _jsx(FormFieldHelperText, { helpText: helpText, errorMessage: showError ? error?.message : undefined })] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TextInputProps } from "@patternfly/react-core";
|
|
2
|
+
import type { FocusEvent } from "react";
|
|
3
|
+
import type { FormGroupProps } from "./types.js";
|
|
4
|
+
interface TextInputFormGroupProps extends FormGroupProps {
|
|
5
|
+
type?: TextInputProps["type"];
|
|
6
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export default function TextInputFormGroup({ id, label, name, isRequired, placeholder, type, onBlur, isDisabled, helpText, ...props }: TextInputFormGroupProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=TextInputFormGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInputFormGroup.d.ts","sourceRoot":"","sources":["../../src/forms/TextInputFormGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,UAAU,uBAAwB,SAAQ,cAAc;IACtD,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAkB,EAClB,WAAgB,EAChB,IAAa,EACb,MAAM,EACN,UAAkB,EAClB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,uBAAuB,+BAiCzB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FormGroup, TextInput, ValidatedOptions, } from "@patternfly/react-core";
|
|
3
|
+
import { useFormContext } from "react-hook-form";
|
|
4
|
+
import FormFieldHelperText from "./FormFieldHelperText.js";
|
|
5
|
+
export default function TextInputFormGroup({ id, label, name, isRequired = false, placeholder = "", type = "text", onBlur, isDisabled = false, helpText, ...props }) {
|
|
6
|
+
const methods = useFormContext();
|
|
7
|
+
const error = methods.formState.errors[name];
|
|
8
|
+
const isTouched = methods.formState.touchedFields[name];
|
|
9
|
+
const isSubmitted = methods.formState.isSubmitted;
|
|
10
|
+
const registration = methods.register(name);
|
|
11
|
+
const showError = error && (isTouched || isSubmitted);
|
|
12
|
+
return (_jsxs(FormGroup, { label: label, isRequired: isRequired, fieldId: id, ...props, children: [_jsx(TextInput, { id: id, placeholder: placeholder, isRequired: isRequired, validated: showError ? ValidatedOptions.error : ValidatedOptions.default, type: type, isDisabled: isDisabled, ...registration, onBlur: (e) => {
|
|
13
|
+
void registration.onBlur(e);
|
|
14
|
+
onBlur?.(e);
|
|
15
|
+
} }), _jsx(FormFieldHelperText, { helpText: helpText, errorMessage: showError ? error?.message : undefined })] }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as CheckboxFormGroup } from "./CheckboxFormGroup.js";
|
|
2
|
+
export { default as FormFieldHelperText } from "./FormFieldHelperText.js";
|
|
3
|
+
export { default as RadioButtonFormGroup } from "./RadioButtonFormGroup.js";
|
|
4
|
+
export { default as SelectFormGroup } from "./SelectFormGroup.js";
|
|
5
|
+
export { default as TextAreaFormGroup } from "./TextAreaFormGroup.js";
|
|
6
|
+
export { default as TextInputFormGroup } from "./TextInputFormGroup.js";
|
|
7
|
+
export type { FormGroupProps } from "./types.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/forms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACxE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as CheckboxFormGroup } from "./CheckboxFormGroup.js";
|
|
2
|
+
export { default as FormFieldHelperText } from "./FormFieldHelperText.js";
|
|
3
|
+
export { default as RadioButtonFormGroup } from "./RadioButtonFormGroup.js";
|
|
4
|
+
export { default as SelectFormGroup } from "./SelectFormGroup.js";
|
|
5
|
+
export { default as TextAreaFormGroup } from "./TextAreaFormGroup.js";
|
|
6
|
+
export { default as TextInputFormGroup } from "./TextInputFormGroup.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FormGroupProps as PFFormGroupProps } from "@patternfly/react-core";
|
|
2
|
+
export interface FormGroupProps extends Omit<PFFormGroupProps, "fieldId"> {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
isRequired?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
helpText?: string;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/forms/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEjF,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
export declare const CARD_EMPTY_STATE_DESCRIPTION = "This data is not available for older inventories or certain imported reports.";
|
|
3
|
+
export interface CardEmptyStateProps {
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const CardEmptyState: FC<CardEmptyStateProps>;
|
|
8
|
+
//# sourceMappingURL=CardEmptyState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardEmptyState.d.ts","sourceRoot":"","sources":["../../src/report/CardEmptyState.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,eAAO,MAAM,4BAA4B,kFACwC,CAAC;AAUlF,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAOlD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { css } from "@emotion/css";
|
|
3
|
+
import { DashboardEmptyStateBase } from "./DashboardEmptyStateBase.js";
|
|
4
|
+
export const CARD_EMPTY_STATE_DESCRIPTION = "This data is not available for older inventories or certain imported reports.";
|
|
5
|
+
const cardEmptyStateContainer = css `
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
flex: 1;
|
|
10
|
+
min-height: 250px;
|
|
11
|
+
`;
|
|
12
|
+
export const CardEmptyState = ({ title, description = CARD_EMPTY_STATE_DESCRIPTION, }) => (_jsx("div", { className: cardEmptyStateContainer, children: _jsx(DashboardEmptyStateBase, { title: title, body: description }) }));
|
|
13
|
+
CardEmptyState.displayName = "CardEmptyState";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentType, FC, SVGProps } from "react";
|
|
2
|
+
export interface DashboardEmptyStateBaseProps {
|
|
3
|
+
title: string;
|
|
4
|
+
body: string;
|
|
5
|
+
icon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const DashboardEmptyStateBase: FC<DashboardEmptyStateBaseProps>;
|
|
8
|
+
//# sourceMappingURL=DashboardEmptyStateBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardEmptyStateBase.d.ts","sourceRoot":"","sources":["../../src/report/DashboardEmptyStateBase.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzD,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;CAC/C;AAED,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CAapE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { EmptyState, EmptyStateBody, EmptyStateVariant, } from "@patternfly/react-core";
|
|
3
|
+
import { SearchIcon } from "@patternfly/react-icons";
|
|
4
|
+
export const DashboardEmptyStateBase = ({ title, body, icon: IconComponent = SearchIcon, }) => (_jsx(EmptyState, { headingLevel: "h4", icon: IconComponent, titleText: title, variant: EmptyStateVariant.sm, children: _jsx(EmptyStateBody, { children: body }) }));
|
|
5
|
+
DashboardEmptyStateBase.displayName = "DashboardEmptyStateBase";
|