@aiready/components 0.13.2 → 0.13.3
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/charts/ForceDirectedGraph.js.map +1 -1
- package/dist/components/radio-group.d.ts +2 -5
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/select.d.ts +2 -5
- package/dist/components/select.js.map +1 -1
- package/dist/hooks/useForceSimulation.js.map +1 -1
- package/dist/index-CI-Ieo0x.d.ts +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/charts/ForceDirectedGraph.tsx +8 -0
- package/src/charts/GraphControls.tsx +2 -0
- package/src/components/radio-group.tsx +2 -5
- package/src/components/select.tsx +2 -5
- package/src/hooks/useForceSimulation.ts +5 -0
- package/src/types/index.ts +9 -0
- package/src/utils/__tests__/score.test.ts +1 -7
- package/src/utils/score.ts +4 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/components",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"description": "Unified shared components library (UI, charts, hooks, utilities) for AIReady",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"framer-motion": "^12.35.0",
|
|
66
66
|
"lucide-react": "^0.577.0",
|
|
67
67
|
"tailwind-merge": "^3.0.0",
|
|
68
|
-
"@aiready/core": "0.23.
|
|
68
|
+
"@aiready/core": "0.23.3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@testing-library/jest-dom": "^6.6.5",
|
|
@@ -20,6 +20,10 @@ export interface ForceDirectedGraphHandle {
|
|
|
20
20
|
resetLayout: () => void;
|
|
21
21
|
fitView: () => void;
|
|
22
22
|
getPinnedNodes: () => string[];
|
|
23
|
+
/**
|
|
24
|
+
* Enable or disable drag mode for nodes.
|
|
25
|
+
* @param enabled - When true, nodes can be dragged; when false, dragging is disabled
|
|
26
|
+
*/
|
|
23
27
|
setDragMode: (enabled: boolean) => void;
|
|
24
28
|
setLayout: (layout: LayoutType) => void;
|
|
25
29
|
getLayout: () => LayoutType;
|
|
@@ -45,6 +49,10 @@ export interface ForceDirectedGraphProps {
|
|
|
45
49
|
showLinkLabels?: boolean;
|
|
46
50
|
className?: string;
|
|
47
51
|
manualLayout?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Callback fired when manual layout mode changes.
|
|
54
|
+
* @param enabled - True when manual layout mode is enabled, false when disabled
|
|
55
|
+
*/
|
|
48
56
|
onManualLayoutChange?: (enabled: boolean) => void;
|
|
49
57
|
packageBounds?: Record<string, { x: number; y: number; r: number }>;
|
|
50
58
|
layout?: LayoutType;
|
|
@@ -9,6 +9,7 @@ export interface GraphControlsProps {
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Callback to toggle drag mode
|
|
12
|
+
* @param enabled - True when drag mode should be enabled, false when disabled
|
|
12
13
|
*/
|
|
13
14
|
onDragToggle?: (enabled: boolean) => void;
|
|
14
15
|
|
|
@@ -19,6 +20,7 @@ export interface GraphControlsProps {
|
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Callback to toggle manual layout mode
|
|
23
|
+
* @param enabled - True when manual layout should be enabled, false when disabled
|
|
22
24
|
*/
|
|
23
25
|
onManualLayoutToggle?: (enabled: boolean) => void;
|
|
24
26
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { cn } from '../utils/cn';
|
|
3
|
+
import { ComponentOption } from '../types';
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
-
value: string;
|
|
6
|
-
label: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
5
|
+
export type RadioOption = ComponentOption;
|
|
9
6
|
|
|
10
7
|
export interface RadioGroupProps extends Omit<
|
|
11
8
|
React.HTMLAttributes<HTMLDivElement>,
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { cn } from '../utils/cn';
|
|
3
|
+
import { ComponentOption } from '../types';
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
-
value: string;
|
|
6
|
-
label: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
5
|
+
export type SelectOption = ComponentOption;
|
|
9
6
|
|
|
10
7
|
export interface SelectProps extends Omit<
|
|
11
8
|
React.SelectHTMLAttributes<HTMLSelectElement>,
|
|
@@ -223,6 +223,11 @@ export function useForceSimulation(
|
|
|
223
223
|
initialLinks: SimulationLink[],
|
|
224
224
|
options: ForceSimulationOptions
|
|
225
225
|
): UseForceSimulationReturn & { setForcesEnabled: (enabled: boolean) => void } {
|
|
226
|
+
/**
|
|
227
|
+
* Enable or disable the simulation forces (charge and link forces).
|
|
228
|
+
* When disabled, nodes can still be dragged but won't be affected by forces.
|
|
229
|
+
* @param enabled - When true, simulation forces are active; when false, forces are disabled
|
|
230
|
+
*/
|
|
226
231
|
const {
|
|
227
232
|
chargeStrength = -300,
|
|
228
233
|
linkDistance = 100,
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
scoreColor,
|
|
4
|
-
scoreBg,
|
|
5
|
-
scoreLabel,
|
|
6
|
-
scoreGlow,
|
|
7
|
-
getScoreRating,
|
|
8
|
-
} from '../score';
|
|
2
|
+
import { scoreColor, scoreBg, scoreLabel, getScoreRating } from '../score';
|
|
9
3
|
|
|
10
4
|
describe('Score Utilities', () => {
|
|
11
5
|
it('should return correct color for scores', () => {
|
package/src/utils/score.ts
CHANGED
|
@@ -43,6 +43,8 @@ export function scoreGlow(score: number | null | undefined): string {
|
|
|
43
43
|
return 'shadow-red-500/20';
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
import { getRatingSlug } from '@aiready/core/client';
|
|
47
|
+
|
|
46
48
|
/**
|
|
47
49
|
* Get rating from score (for use with ScoreBar component)
|
|
48
50
|
*/
|
|
@@ -50,9 +52,6 @@ export function getScoreRating(
|
|
|
50
52
|
score: number | null | undefined
|
|
51
53
|
): 'excellent' | 'good' | 'fair' | 'needs-work' | 'critical' {
|
|
52
54
|
if (score == null) return 'critical';
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (score >= 60) return 'fair';
|
|
56
|
-
if (score >= 40) return 'needs-work';
|
|
57
|
-
return 'critical';
|
|
55
|
+
// Use core implementation to resolve duplication
|
|
56
|
+
return getRatingSlug(score) as any;
|
|
58
57
|
}
|