@fgv/ts-res-ui-components 5.0.0-29 → 5.0.0-30
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/README.md +37 -4
- package/dist/ts-res-ui-components.d.ts +7 -24
- package/lib/components/views/CompiledView/index.js +2 -2
- package/lib/components/views/FilterView/index.js +3 -3
- package/lib/components/views/ResolutionView/index.js +3 -3
- package/lib/components/views/SourceView/index.js +2 -2
- package/lib/types/index.d.ts +3 -18
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -451,16 +451,49 @@ is a generic component used by all of the views, which can also be used to power
|
|
|
451
451
|
- **Type safety**: Full TypeScript support with generic resource types
|
|
452
452
|
- **Debug controls**: Optional ResourcePickerOptionsControl for development and debugging
|
|
453
453
|
|
|
454
|
+
#### ResourcePicker Configuration
|
|
455
|
+
|
|
456
|
+
The ResourcePicker supports two distinct configuration mechanisms:
|
|
457
|
+
|
|
458
|
+
1. **`pickerOptions`** - Controls actual picker behavior (defaultView, rootPath, search settings, etc.)
|
|
459
|
+
2. **`pickerOptionsPanelPresentation`** - Controls whether/how the debug options control panel is displayed
|
|
460
|
+
|
|
461
|
+
```tsx
|
|
462
|
+
// Example: Configure picker behavior programmatically
|
|
463
|
+
<SourceView
|
|
464
|
+
resources={state.processedResources}
|
|
465
|
+
pickerOptions={{
|
|
466
|
+
defaultView: 'tree',
|
|
467
|
+
rootPath: 'user.messages', // Focus on specific branch
|
|
468
|
+
hideRootNode: true, // Hide the root node itself
|
|
469
|
+
enableSearch: true,
|
|
470
|
+
searchPlaceholder: 'Search user messages...',
|
|
471
|
+
height: '500px'
|
|
472
|
+
}}
|
|
473
|
+
pickerOptionsPanelPresentation="hidden" // Hide debug controls in production
|
|
474
|
+
/>
|
|
475
|
+
|
|
476
|
+
// Example: Enable debug controls during development
|
|
477
|
+
<SourceView
|
|
478
|
+
resources={state.processedResources}
|
|
479
|
+
pickerOptions={{
|
|
480
|
+
defaultView: 'list',
|
|
481
|
+
enableSearch: true
|
|
482
|
+
}}
|
|
483
|
+
pickerOptionsPanelPresentation={isDevelopment ? 'collapsible' : 'hidden'}
|
|
484
|
+
/>
|
|
485
|
+
```
|
|
486
|
+
|
|
454
487
|
#### ResourcePickerOptionsControl
|
|
455
488
|
|
|
456
489
|
A debugging/design tool for interactively configuring ResourcePicker behavior. Hidden by default for production use, but can be enabled in development:
|
|
457
490
|
|
|
458
491
|
```tsx
|
|
459
|
-
// All view components support
|
|
492
|
+
// All view components support pickerOptionsPanelPresentation
|
|
460
493
|
<ObservabilityProvider observabilityContext={myObservabilityContext}>
|
|
461
494
|
<SourceView
|
|
462
495
|
resources={state.processedResources}
|
|
463
|
-
|
|
496
|
+
pickerOptionsPanelPresentation="collapsible" // Enable picker options UI
|
|
464
497
|
/>
|
|
465
498
|
</ObservabilityProvider>
|
|
466
499
|
|
|
@@ -1002,7 +1035,7 @@ Enable the context options gear icon during development for interactive configur
|
|
|
1002
1035
|
```tsx
|
|
1003
1036
|
<ResolutionView
|
|
1004
1037
|
resources={processedResources}
|
|
1005
|
-
|
|
1038
|
+
pickerOptionsPanelPresentation="collapsible" // Shows both picker & context gear icons
|
|
1006
1039
|
resolutionState={resolutionState}
|
|
1007
1040
|
resolutionActions={resolutionActions}
|
|
1008
1041
|
/>
|
|
@@ -1145,7 +1178,7 @@ Enable the context options gear icon during development for interactive filter c
|
|
|
1145
1178
|
```tsx
|
|
1146
1179
|
<FilterView
|
|
1147
1180
|
resources={processedResources}
|
|
1148
|
-
|
|
1181
|
+
pickerOptionsPanelPresentation="collapsible" // Shows both picker & context gear icons
|
|
1149
1182
|
filterState={filterState}
|
|
1150
1183
|
filterActions={filterActions}
|
|
1151
1184
|
/>
|
|
@@ -3862,23 +3862,6 @@ declare interface IResourceOrchestratorProps {
|
|
|
3862
3862
|
observabilityContext?: ObservabilityTools_2.IObservabilityContext;
|
|
3863
3863
|
}
|
|
3864
3864
|
|
|
3865
|
-
/**
|
|
3866
|
-
* Configuration options for ResourcePicker components.
|
|
3867
|
-
* Controls behavior and appearance of resource selection controls.
|
|
3868
|
-
*
|
|
3869
|
-
* @public
|
|
3870
|
-
*/
|
|
3871
|
-
declare interface IResourcePickerOptions {
|
|
3872
|
-
/** How to present the picker options control */
|
|
3873
|
-
presentation?: 'hidden' | 'inline' | 'collapsible' | 'popup' | 'popover';
|
|
3874
|
-
/** Custom CSS classes for the picker */
|
|
3875
|
-
className?: string;
|
|
3876
|
-
/** Whether to allow multi-selection */
|
|
3877
|
-
allowMultiSelect?: boolean;
|
|
3878
|
-
/** Maximum number of selectable resources */
|
|
3879
|
-
maxSelections?: number;
|
|
3880
|
-
}
|
|
3881
|
-
|
|
3882
3865
|
/**
|
|
3883
3866
|
* UI behavior configuration options for ResourcePicker.
|
|
3884
3867
|
*
|
|
@@ -3899,7 +3882,7 @@ declare interface IResourcePickerOptions {
|
|
|
3899
3882
|
*
|
|
3900
3883
|
* @public
|
|
3901
3884
|
*/
|
|
3902
|
-
declare interface
|
|
3885
|
+
declare interface IResourcePickerOptions {
|
|
3903
3886
|
/** View and navigation options */
|
|
3904
3887
|
/** Default view mode to use on initial render */
|
|
3905
3888
|
defaultView?: 'list' | 'tree';
|
|
@@ -3930,9 +3913,9 @@ declare interface IResourcePickerOptions_2 {
|
|
|
3930
3913
|
*/
|
|
3931
3914
|
declare interface IResourcePickerOptionsControlProps {
|
|
3932
3915
|
/** Current picker options */
|
|
3933
|
-
options:
|
|
3916
|
+
options: IResourcePickerOptions;
|
|
3934
3917
|
/** Callback when options change */
|
|
3935
|
-
onOptionsChange: (options:
|
|
3918
|
+
onOptionsChange: (options: IResourcePickerOptions) => void;
|
|
3936
3919
|
/** How to present the options control (default: 'hidden' for production use) */
|
|
3937
3920
|
presentation?: 'hidden' | 'inline' | 'collapsible' | 'popup' | 'popover';
|
|
3938
3921
|
/** Custom class name */
|
|
@@ -3994,7 +3977,7 @@ declare interface IResourcePickerProps<T = unknown> extends IViewBaseProps {
|
|
|
3994
3977
|
pendingResources?: IPendingResource<T>[];
|
|
3995
3978
|
/** UI behavior configuration */
|
|
3996
3979
|
/** Options controlling picker appearance and behavior */
|
|
3997
|
-
options?:
|
|
3980
|
+
options?: IResourcePickerOptions;
|
|
3998
3981
|
}
|
|
3999
3982
|
|
|
4000
3983
|
/**
|
|
@@ -4422,8 +4405,8 @@ declare interface IUseViewStateReturn {
|
|
|
4422
4405
|
declare interface IViewBaseProps {
|
|
4423
4406
|
/** Additional CSS class names for styling */
|
|
4424
4407
|
className?: string;
|
|
4425
|
-
/** How to present the ResourcePicker options control (default: 'hidden' for production use) */
|
|
4426
|
-
|
|
4408
|
+
/** How to present the ResourcePicker options control panel (default: 'hidden' for production use) */
|
|
4409
|
+
pickerOptionsPanelPresentation?: 'hidden' | 'inline' | 'collapsible' | 'popup' | 'popover';
|
|
4427
4410
|
}
|
|
4428
4411
|
|
|
4429
4412
|
export { JsonValue }
|
|
@@ -4718,7 +4701,7 @@ declare namespace PickerTools {
|
|
|
4718
4701
|
ResourcePicker,
|
|
4719
4702
|
ResourcePickerOptionsControl,
|
|
4720
4703
|
IResourcePickerProps,
|
|
4721
|
-
|
|
4704
|
+
IResourcePickerOptions,
|
|
4722
4705
|
IResourceSelection,
|
|
4723
4706
|
IResourceAnnotations,
|
|
4724
4707
|
IResourceAnnotation,
|
|
@@ -228,7 +228,7 @@ function renderCompiledItemDetail(data, index, activeCompiledCollection) {
|
|
|
228
228
|
*
|
|
229
229
|
* @public
|
|
230
230
|
*/
|
|
231
|
-
export const CompiledView = ({ resources, filterState, filterResult, useNormalization: useNormalizationProp = false, onExport, pickerOptions,
|
|
231
|
+
export const CompiledView = ({ resources, filterState, filterResult, useNormalization: useNormalizationProp = false, onExport, pickerOptions, pickerOptionsPanelPresentation = 'hidden', className = '' }) => {
|
|
232
232
|
const o11y = useSmartObservability();
|
|
233
233
|
const [selectedResourceId, setSelectedResourceId] = useState(null);
|
|
234
234
|
const [selectedMetadataSection, setSelectedMetadataSection] = useState(null);
|
|
@@ -533,7 +533,7 @@ export const CompiledView = ({ resources, filterState, filterResult, useNormaliz
|
|
|
533
533
|
React.createElement("button", { onClick: handleExportBundle, className: "inline-flex items-center px-3 py-1.5 border border-blue-300 text-xs font-medium rounded text-blue-700 bg-blue-50 hover:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" },
|
|
534
534
|
React.createElement(ArchiveBoxIcon, { className: "h-4 w-4 mr-1" }),
|
|
535
535
|
"Export Bundle")))),
|
|
536
|
-
React.createElement(ResourcePickerOptionsControl, { options: currentPickerOptions, onOptionsChange: setCurrentPickerOptions, presentation:
|
|
536
|
+
React.createElement(ResourcePickerOptionsControl, { options: currentPickerOptions, onOptionsChange: setCurrentPickerOptions, presentation: pickerOptionsPanelPresentation, title: "Compiled View Picker Options", className: "mb-6" }),
|
|
537
537
|
activeProcessedResources && (React.createElement("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 p-4 mb-6" },
|
|
538
538
|
React.createElement("div", { className: "flex items-center justify-between" },
|
|
539
539
|
React.createElement("div", { className: "flex items-center space-x-6" },
|
|
@@ -55,7 +55,7 @@ import { useSmartObservability } from '../../../hooks/useSmartObservability';
|
|
|
55
55
|
*
|
|
56
56
|
* @public
|
|
57
57
|
*/
|
|
58
|
-
export const FilterView = ({ resources, filterState, filterActions, filterResult, onFilterResult, pickerOptions,
|
|
58
|
+
export const FilterView = ({ resources, filterState, filterActions, filterResult, onFilterResult, pickerOptions, pickerOptionsPanelPresentation = 'hidden', contextOptions, className = '' }) => {
|
|
59
59
|
// Get observability context
|
|
60
60
|
const o11y = useSmartObservability();
|
|
61
61
|
// Local UI state
|
|
@@ -259,8 +259,8 @@ export const FilterView = ({ resources, filterState, filterActions, filterResult
|
|
|
259
259
|
React.createElement("div", { className: "flex items-center space-x-3 mb-6" },
|
|
260
260
|
React.createElement(FunnelIcon, { className: "h-8 w-8 text-purple-600" }),
|
|
261
261
|
React.createElement("h2", { className: "text-2xl font-bold text-gray-900" }, "Filter Tool")),
|
|
262
|
-
React.createElement(ResourcePickerOptionsControl, { options: currentPickerOptions, onOptionsChange: setCurrentPickerOptions, presentation:
|
|
263
|
-
React.createElement(ResolutionContextOptionsControl, { options: currentContextOptions, onOptionsChange: setCurrentContextOptions, availableQualifiers: availableQualifiers, presentation:
|
|
262
|
+
React.createElement(ResourcePickerOptionsControl, { options: currentPickerOptions, onOptionsChange: setCurrentPickerOptions, presentation: pickerOptionsPanelPresentation, title: "Filter Tool Picker Options", className: "mb-6" }),
|
|
263
|
+
React.createElement(ResolutionContextOptionsControl, { options: currentContextOptions, onOptionsChange: setCurrentContextOptions, availableQualifiers: availableQualifiers, presentation: pickerOptionsPanelPresentation, title: "Filter Context Options", className: "mb-6" }),
|
|
264
264
|
React.createElement("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 p-6" },
|
|
265
265
|
React.createElement("div", { className: "mb-6" },
|
|
266
266
|
React.createElement("div", { className: "flex items-center justify-between mb-4" },
|
|
@@ -56,7 +56,7 @@ import { useSmartObservability } from '../../../hooks/useSmartObservability';
|
|
|
56
56
|
*
|
|
57
57
|
* @public
|
|
58
58
|
*/
|
|
59
|
-
export const ResolutionView = ({ resources, filterState, filterResult, resolutionState, resolutionActions, availableQualifiers = [], resourceEditorFactory, pickerOptions,
|
|
59
|
+
export const ResolutionView = ({ resources, filterState, filterResult, resolutionState, resolutionActions, availableQualifiers = [], resourceEditorFactory, pickerOptions, pickerOptionsPanelPresentation = 'hidden', contextOptions, lockedViewMode, sectionTitles, allowResourceCreation = false, defaultResourceType, resourceTypeFactory, onPendingResourcesApplied, showPendingResourcesInList = true, className = '' }) => {
|
|
60
60
|
// Get smart observability context (auto-detects and upgrades as needed)
|
|
61
61
|
const o11y = useSmartObservability();
|
|
62
62
|
// State for picker options control
|
|
@@ -353,8 +353,8 @@ export const ResolutionView = ({ resources, filterState, filterResult, resolutio
|
|
|
353
353
|
React.createElement(MagnifyingGlassIcon, { className: "h-8 w-8 text-blue-600" }),
|
|
354
354
|
React.createElement("h2", { className: "text-2xl font-bold text-gray-900" }, "Resolution Viewer"),
|
|
355
355
|
isFilteringActive && (React.createElement("span", { className: "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-800" }, "Filtered"))),
|
|
356
|
-
React.createElement(ResourcePickerOptionsControl, { options: currentPickerOptions, onOptionsChange: setCurrentPickerOptions, presentation:
|
|
357
|
-
React.createElement(ResolutionContextOptionsControl, { options: currentContextOptions, onOptionsChange: setCurrentContextOptions, availableQualifiers: availableQualifiers, presentation:
|
|
356
|
+
React.createElement(ResourcePickerOptionsControl, { options: currentPickerOptions, onOptionsChange: setCurrentPickerOptions, presentation: pickerOptionsPanelPresentation, title: "Resolution Viewer Picker Options", className: "mb-6" }),
|
|
357
|
+
React.createElement(ResolutionContextOptionsControl, { options: currentContextOptions, onOptionsChange: setCurrentContextOptions, availableQualifiers: availableQualifiers, presentation: pickerOptionsPanelPresentation, title: "Resolution Context Options", className: "mb-6", allowResourceCreation: allowResourceCreationInternal, onAllowResourceCreationChange: setAllowResourceCreationInternal, showPendingResourcesInList: showPendingResourcesInListInternal, onShowPendingResourcesInListChange: setShowPendingResourcesInListInternal }),
|
|
358
358
|
React.createElement("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 p-6" },
|
|
359
359
|
effectiveContextOptions?.showContextControls !== false && (React.createElement("div", { className: "mb-6" },
|
|
360
360
|
React.createElement("h3", { className: "text-lg font-semibold text-gray-900 mb-4" }, effectiveContextOptions?.contextPanelTitle || 'Context Configuration'),
|
|
@@ -39,7 +39,7 @@ import { useSmartObservability } from '../../../hooks/useSmartObservability';
|
|
|
39
39
|
*
|
|
40
40
|
* @public
|
|
41
41
|
*/
|
|
42
|
-
export const SourceView = ({ resources, filterState, filterResult, onExport, pickerOptions,
|
|
42
|
+
export const SourceView = ({ resources, filterState, filterResult, onExport, pickerOptions, pickerOptionsPanelPresentation = 'hidden', className = '' }) => {
|
|
43
43
|
const o11y = useSmartObservability();
|
|
44
44
|
const [selectedResourceId, setSelectedResourceId] = useState(null);
|
|
45
45
|
const [showJsonView, setShowJsonView] = useState(false);
|
|
@@ -149,7 +149,7 @@ export const SourceView = ({ resources, filterState, filterResult, onExport, pic
|
|
|
149
149
|
React.createElement("button", { onClick: handleExportSourceData, className: "inline-flex items-center px-3 py-1.5 border border-gray-300 text-xs font-medium rounded text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" },
|
|
150
150
|
React.createElement(DocumentArrowDownIcon, { className: "h-4 w-4 mr-1" }),
|
|
151
151
|
"Export JSON")))),
|
|
152
|
-
React.createElement(ResourcePickerOptionsControl, { options: currentPickerOptions, onOptionsChange: setCurrentPickerOptions, presentation:
|
|
152
|
+
React.createElement(ResourcePickerOptionsControl, { options: currentPickerOptions, onOptionsChange: setCurrentPickerOptions, presentation: pickerOptionsPanelPresentation, title: "Source Browser Picker Options", className: "mb-6" }),
|
|
153
153
|
activeProcessedResources && (React.createElement("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 p-4 mb-6" },
|
|
154
154
|
React.createElement("button", { onClick: () => setShowJsonView(!showJsonView), className: "inline-flex items-center px-3 py-1.5 text-sm font-medium text-gray-700 hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" },
|
|
155
155
|
React.createElement(CodeBracketIcon, { className: "h-4 w-4 mr-2" }),
|
package/lib/types/index.d.ts
CHANGED
|
@@ -2,22 +2,7 @@ import { Result } from '@fgv/ts-utils';
|
|
|
2
2
|
import { ResourceJson, Config, Bundle, Resources, Runtime, QualifierTypes, Qualifiers, ResourceTypes, Import } from '@fgv/ts-res';
|
|
3
3
|
import { JsonCompatible, JsonValue } from '@fgv/ts-json-base';
|
|
4
4
|
import type { IObservabilityContext } from '../utils/observability';
|
|
5
|
-
|
|
6
|
-
* Configuration options for ResourcePicker components.
|
|
7
|
-
* Controls behavior and appearance of resource selection controls.
|
|
8
|
-
*
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
export interface IResourcePickerOptions {
|
|
12
|
-
/** How to present the picker options control */
|
|
13
|
-
presentation?: 'hidden' | 'inline' | 'collapsible' | 'popup' | 'popover';
|
|
14
|
-
/** Custom CSS classes for the picker */
|
|
15
|
-
className?: string;
|
|
16
|
-
/** Whether to allow multi-selection */
|
|
17
|
-
allowMultiSelect?: boolean;
|
|
18
|
-
/** Maximum number of selectable resources */
|
|
19
|
-
maxSelections?: number;
|
|
20
|
-
}
|
|
5
|
+
import type { IResourcePickerOptions } from '../components/pickers/ResourcePicker/types';
|
|
21
6
|
/**
|
|
22
7
|
* Configuration options for edit validation.
|
|
23
8
|
*
|
|
@@ -210,8 +195,8 @@ export interface IImportedDirectory {
|
|
|
210
195
|
export interface IViewBaseProps {
|
|
211
196
|
/** Additional CSS class names for styling */
|
|
212
197
|
className?: string;
|
|
213
|
-
/** How to present the ResourcePicker options control (default: 'hidden' for production use) */
|
|
214
|
-
|
|
198
|
+
/** How to present the ResourcePicker options control panel (default: 'hidden' for production use) */
|
|
199
|
+
pickerOptionsPanelPresentation?: 'hidden' | 'inline' | 'collapsible' | 'popup' | 'popover';
|
|
215
200
|
}
|
|
216
201
|
/**
|
|
217
202
|
* Props for the ImportView component.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fgv/ts-res-ui-components",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-30",
|
|
4
4
|
"description": "Reusable React components for ts-res resource visualization and management",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"@heroicons/react": "~2.2.0",
|
|
24
24
|
"tslib": "^2.8.1",
|
|
25
25
|
"json-edit-react": "~1.28.2",
|
|
26
|
-
"@fgv/ts-res": "5.0.0-
|
|
27
|
-
"@fgv/ts-utils": "5.0.0-
|
|
28
|
-
"@fgv/ts-
|
|
29
|
-
"@fgv/ts-
|
|
30
|
-
"@fgv/ts-json-base": "5.0.0-
|
|
26
|
+
"@fgv/ts-res": "5.0.0-30",
|
|
27
|
+
"@fgv/ts-utils": "5.0.0-30",
|
|
28
|
+
"@fgv/ts-extras": "5.0.0-30",
|
|
29
|
+
"@fgv/ts-json": "5.0.0-30",
|
|
30
|
+
"@fgv/ts-json-base": "5.0.0-30"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": ">=18.0.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@microsoft/api-documenter": "^7.26.31",
|
|
63
63
|
"@microsoft/api-extractor": "^7.52.10",
|
|
64
64
|
"@testing-library/dom": "^10.4.0",
|
|
65
|
-
"@fgv/ts-utils-jest": "5.0.0-
|
|
65
|
+
"@fgv/ts-utils-jest": "5.0.0-30"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "heft build --clean",
|