@fgv/ts-app-shell 5.1.0-1
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 +26 -0
- package/dist/index.browser.js +3 -0
- package/dist/index.js +43 -0
- package/dist/packlets/ai-assist/index.js +6 -0
- package/dist/packlets/ai-assist/useAiAssist.js +219 -0
- package/dist/packlets/cascade/CascadeContainer.js +83 -0
- package/dist/packlets/cascade/ComparisonView.js +48 -0
- package/dist/packlets/cascade/EntityTabLayout.js +104 -0
- package/dist/packlets/cascade/MobileCascadeStack.js +63 -0
- package/dist/packlets/cascade/index.js +37 -0
- package/dist/packlets/cascade/model.js +30 -0
- package/dist/packlets/cascade/useCascadeOps.js +206 -0
- package/dist/packlets/cascade/useCascadeTransitions.js +58 -0
- package/dist/packlets/detail/DetailHelpers.js +103 -0
- package/dist/packlets/detail/index.js +6 -0
- package/dist/packlets/drop-zone/JsonDropZone.js +112 -0
- package/dist/packlets/drop-zone/index.js +6 -0
- package/dist/packlets/editing/EditFieldHelpers.js +130 -0
- package/dist/packlets/editing/MultiActionButton.js +73 -0
- package/dist/packlets/editing/NumericInput.js +119 -0
- package/dist/packlets/editing/TypeaheadInput.js +207 -0
- package/dist/packlets/editing/index.js +10 -0
- package/dist/packlets/editing/useTypeaheadMatch.js +102 -0
- package/dist/packlets/keyboard/index.js +7 -0
- package/dist/packlets/keyboard/registry.js +133 -0
- package/dist/packlets/keyboard/useKeyboardShortcuts.js +117 -0
- package/dist/packlets/messages/MessagesContext.js +76 -0
- package/dist/packlets/messages/MessagesLogger.js +103 -0
- package/dist/packlets/messages/StatusBar.js +154 -0
- package/dist/packlets/messages/Toast.js +68 -0
- package/dist/packlets/messages/index.js +11 -0
- package/dist/packlets/messages/model.js +56 -0
- package/dist/packlets/messages/useLogReporter.js +66 -0
- package/dist/packlets/modal/ConfirmDialog.js +78 -0
- package/dist/packlets/modal/Modal.js +55 -0
- package/dist/packlets/modal/index.js +7 -0
- package/dist/packlets/print/PrintEnclosure.js +60 -0
- package/dist/packlets/print/index.js +7 -0
- package/dist/packlets/print/openPrintWindow.js +112 -0
- package/dist/packlets/responsive/ResponsiveProvider.js +56 -0
- package/dist/packlets/responsive/index.js +7 -0
- package/dist/packlets/responsive/useResponsiveLayout.js +118 -0
- package/dist/packlets/selectors/EntityRow.js +276 -0
- package/dist/packlets/selectors/PreferredSelector.js +251 -0
- package/dist/packlets/selectors/index.js +24 -0
- package/dist/packlets/sidebar/CollectionSection.js +107 -0
- package/dist/packlets/sidebar/EntityList.js +164 -0
- package/dist/packlets/sidebar/FilterBar.js +42 -0
- package/dist/packlets/sidebar/FilterRow.js +182 -0
- package/dist/packlets/sidebar/GroupedEntityList.js +183 -0
- package/dist/packlets/sidebar/SearchBar.js +34 -0
- package/dist/packlets/sidebar/SidebarLayout.js +62 -0
- package/dist/packlets/sidebar/index.js +12 -0
- package/dist/packlets/theme/ThemeProvider.js +141 -0
- package/dist/packlets/theme/index.js +6 -0
- package/dist/packlets/top-bar/ModeSelector.js +46 -0
- package/dist/packlets/top-bar/TabBar.js +37 -0
- package/dist/packlets/top-bar/index.js +7 -0
- package/dist/packlets/url-sync/index.js +6 -0
- package/dist/packlets/url-sync/useUrlSync.js +157 -0
- package/eslint.config.js +22 -0
- package/lib/index.browser.d.ts +2 -0
- package/lib/index.browser.js +19 -0
- package/lib/index.d.ts +28 -0
- package/lib/index.js +59 -0
- package/lib/packlets/ai-assist/index.d.ts +6 -0
- package/lib/packlets/ai-assist/index.js +11 -0
- package/lib/packlets/ai-assist/useAiAssist.d.ts +77 -0
- package/lib/packlets/ai-assist/useAiAssist.js +223 -0
- package/lib/packlets/cascade/CascadeContainer.d.ts +44 -0
- package/lib/packlets/cascade/CascadeContainer.js +119 -0
- package/lib/packlets/cascade/ComparisonView.d.ts +35 -0
- package/lib/packlets/cascade/ComparisonView.js +54 -0
- package/lib/packlets/cascade/EntityTabLayout.d.ts +47 -0
- package/lib/packlets/cascade/EntityTabLayout.js +110 -0
- package/lib/packlets/cascade/MobileCascadeStack.d.ts +20 -0
- package/lib/packlets/cascade/MobileCascadeStack.js +99 -0
- package/lib/packlets/cascade/index.d.ts +12 -0
- package/lib/packlets/cascade/index.js +48 -0
- package/lib/packlets/cascade/model.d.ts +57 -0
- package/lib/packlets/cascade/model.js +33 -0
- package/lib/packlets/cascade/useCascadeOps.d.ts +111 -0
- package/lib/packlets/cascade/useCascadeOps.js +209 -0
- package/lib/packlets/cascade/useCascadeTransitions.d.ts +19 -0
- package/lib/packlets/cascade/useCascadeTransitions.js +62 -0
- package/lib/packlets/detail/DetailHelpers.d.ts +83 -0
- package/lib/packlets/detail/DetailHelpers.js +113 -0
- package/lib/packlets/detail/index.d.ts +6 -0
- package/lib/packlets/detail/index.js +14 -0
- package/lib/packlets/drop-zone/JsonDropZone.d.ts +40 -0
- package/lib/packlets/drop-zone/JsonDropZone.js +149 -0
- package/lib/packlets/drop-zone/index.d.ts +6 -0
- package/lib/packlets/drop-zone/index.js +10 -0
- package/lib/packlets/editing/EditFieldHelpers.d.ts +171 -0
- package/lib/packlets/editing/EditFieldHelpers.js +144 -0
- package/lib/packlets/editing/MultiActionButton.d.ts +45 -0
- package/lib/packlets/editing/MultiActionButton.js +109 -0
- package/lib/packlets/editing/NumericInput.d.ts +47 -0
- package/lib/packlets/editing/NumericInput.js +155 -0
- package/lib/packlets/editing/TypeaheadInput.d.ts +46 -0
- package/lib/packlets/editing/TypeaheadInput.js +243 -0
- package/lib/packlets/editing/index.d.ts +10 -0
- package/lib/packlets/editing/index.js +26 -0
- package/lib/packlets/editing/useTypeaheadMatch.d.ts +42 -0
- package/lib/packlets/editing/useTypeaheadMatch.js +105 -0
- package/lib/packlets/keyboard/index.d.ts +7 -0
- package/lib/packlets/keyboard/index.js +15 -0
- package/lib/packlets/keyboard/registry.d.ts +92 -0
- package/lib/packlets/keyboard/registry.js +138 -0
- package/lib/packlets/keyboard/useKeyboardShortcuts.d.ts +50 -0
- package/lib/packlets/keyboard/useKeyboardShortcuts.js +155 -0
- package/lib/packlets/messages/MessagesContext.d.ts +40 -0
- package/lib/packlets/messages/MessagesContext.js +113 -0
- package/lib/packlets/messages/MessagesLogger.d.ts +50 -0
- package/lib/packlets/messages/MessagesLogger.js +107 -0
- package/lib/packlets/messages/StatusBar.d.ts +22 -0
- package/lib/packlets/messages/StatusBar.js +190 -0
- package/lib/packlets/messages/Toast.d.ts +31 -0
- package/lib/packlets/messages/Toast.js +105 -0
- package/lib/packlets/messages/index.d.ts +11 -0
- package/lib/packlets/messages/index.js +24 -0
- package/lib/packlets/messages/model.d.ts +59 -0
- package/lib/packlets/messages/model.js +61 -0
- package/lib/packlets/messages/useLogReporter.d.ts +22 -0
- package/lib/packlets/messages/useLogReporter.js +69 -0
- package/lib/packlets/modal/ConfirmDialog.d.ts +39 -0
- package/lib/packlets/modal/ConfirmDialog.js +114 -0
- package/lib/packlets/modal/Modal.d.ts +22 -0
- package/lib/packlets/modal/Modal.js +91 -0
- package/lib/packlets/modal/index.d.ts +7 -0
- package/lib/packlets/modal/index.js +12 -0
- package/lib/packlets/print/PrintEnclosure.d.ts +33 -0
- package/lib/packlets/print/PrintEnclosure.js +96 -0
- package/lib/packlets/print/index.d.ts +7 -0
- package/lib/packlets/print/index.js +12 -0
- package/lib/packlets/print/openPrintWindow.d.ts +35 -0
- package/lib/packlets/print/openPrintWindow.js +118 -0
- package/lib/packlets/responsive/ResponsiveProvider.d.ts +35 -0
- package/lib/packlets/responsive/ResponsiveProvider.js +93 -0
- package/lib/packlets/responsive/index.d.ts +7 -0
- package/lib/packlets/responsive/index.js +13 -0
- package/lib/packlets/responsive/useResponsiveLayout.d.ts +48 -0
- package/lib/packlets/responsive/useResponsiveLayout.js +121 -0
- package/lib/packlets/selectors/EntityRow.d.ts +45 -0
- package/lib/packlets/selectors/EntityRow.js +315 -0
- package/lib/packlets/selectors/PreferredSelector.d.ts +50 -0
- package/lib/packlets/selectors/PreferredSelector.js +287 -0
- package/lib/packlets/selectors/index.d.ts +5 -0
- package/lib/packlets/selectors/index.js +29 -0
- package/lib/packlets/sidebar/CollectionSection.d.ts +82 -0
- package/lib/packlets/sidebar/CollectionSection.js +143 -0
- package/lib/packlets/sidebar/EntityList.d.ts +105 -0
- package/lib/packlets/sidebar/EntityList.js +200 -0
- package/lib/packlets/sidebar/FilterBar.d.ts +26 -0
- package/lib/packlets/sidebar/FilterBar.js +48 -0
- package/lib/packlets/sidebar/FilterRow.d.ts +42 -0
- package/lib/packlets/sidebar/FilterRow.js +218 -0
- package/lib/packlets/sidebar/GroupedEntityList.d.ts +59 -0
- package/lib/packlets/sidebar/GroupedEntityList.js +219 -0
- package/lib/packlets/sidebar/SearchBar.d.ts +19 -0
- package/lib/packlets/sidebar/SearchBar.js +40 -0
- package/lib/packlets/sidebar/SidebarLayout.d.ts +28 -0
- package/lib/packlets/sidebar/SidebarLayout.js +98 -0
- package/lib/packlets/sidebar/index.d.ts +12 -0
- package/lib/packlets/sidebar/index.js +22 -0
- package/lib/packlets/theme/ThemeProvider.d.ts +68 -0
- package/lib/packlets/theme/ThemeProvider.js +178 -0
- package/lib/packlets/theme/index.d.ts +6 -0
- package/lib/packlets/theme/index.js +11 -0
- package/lib/packlets/top-bar/ModeSelector.d.ts +38 -0
- package/lib/packlets/top-bar/ModeSelector.js +52 -0
- package/lib/packlets/top-bar/TabBar.d.ts +31 -0
- package/lib/packlets/top-bar/TabBar.js +43 -0
- package/lib/packlets/top-bar/index.d.ts +7 -0
- package/lib/packlets/top-bar/index.js +12 -0
- package/lib/packlets/url-sync/index.d.ts +6 -0
- package/lib/packlets/url-sync/index.js +12 -0
- package/lib/packlets/url-sync/useUrlSync.d.ts +75 -0
- package/lib/packlets/url-sync/useUrlSync.js +162 -0
- package/package.json +82 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message model types for the observability system.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Severity levels for messages.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export type MessageSeverity = 'info' | 'success' | 'warning' | 'error';
|
|
10
|
+
/**
|
|
11
|
+
* A single message in the observability stream.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export interface IMessage {
|
|
15
|
+
/** Unique message ID */
|
|
16
|
+
readonly id: string;
|
|
17
|
+
/** Message severity */
|
|
18
|
+
readonly severity: MessageSeverity;
|
|
19
|
+
/** Message text */
|
|
20
|
+
readonly text: string;
|
|
21
|
+
/** Timestamp (ms since epoch) */
|
|
22
|
+
readonly timestamp: number;
|
|
23
|
+
/** Optional action (e.g., a link or callback) */
|
|
24
|
+
readonly action?: IMessageAction;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* An actionable element attached to a message (e.g., "Go to Session" link).
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export interface IMessageAction {
|
|
31
|
+
/** Action label */
|
|
32
|
+
readonly label: string;
|
|
33
|
+
/** Callback when the action is triggered */
|
|
34
|
+
readonly onAction: () => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Configuration for toast auto-dismiss behavior.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export interface IToastConfig {
|
|
41
|
+
/** Auto-dismiss duration in ms. 0 = no auto-dismiss. */
|
|
42
|
+
readonly autoDismissMs: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Default toast configuration by severity.
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export declare const DEFAULT_TOAST_CONFIG: Record<MessageSeverity, IToastConfig>;
|
|
49
|
+
/**
|
|
50
|
+
* Generates a unique message ID.
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare function generateMessageId(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new message.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export declare function createMessage(severity: MessageSeverity, text: string, action?: IMessageAction): IMessage;
|
|
59
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.DEFAULT_TOAST_CONFIG = void 0;
|
|
25
|
+
exports.generateMessageId = generateMessageId;
|
|
26
|
+
exports.createMessage = createMessage;
|
|
27
|
+
/**
|
|
28
|
+
* Default toast configuration by severity.
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
exports.DEFAULT_TOAST_CONFIG = {
|
|
32
|
+
info: { autoDismissMs: 3000 },
|
|
33
|
+
success: { autoDismissMs: 3000 },
|
|
34
|
+
warning: { autoDismissMs: 5000 },
|
|
35
|
+
error: { autoDismissMs: 0 }
|
|
36
|
+
};
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// Helpers
|
|
39
|
+
// ============================================================================
|
|
40
|
+
let _nextId = 0;
|
|
41
|
+
/**
|
|
42
|
+
* Generates a unique message ID.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
function generateMessageId() {
|
|
46
|
+
return `msg-${++_nextId}-${Date.now().toString(36)}`;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new message.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
function createMessage(severity, text, action) {
|
|
53
|
+
return {
|
|
54
|
+
id: generateMessageId(),
|
|
55
|
+
severity,
|
|
56
|
+
text,
|
|
57
|
+
timestamp: Date.now(),
|
|
58
|
+
action
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Logging } from '@fgv/ts-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the useLogReporter hook.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface IUseLogReporterOptions {
|
|
7
|
+
/** Minimum log level (default: 'info') */
|
|
8
|
+
readonly logLevel?: Logging.ReporterLogLevel;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* React hook that creates a {@link @fgv/ts-utils#Logging.LogReporter | LogReporter}
|
|
12
|
+
* backed by the MessagesContext.
|
|
13
|
+
*
|
|
14
|
+
* The returned reporter implements both `ILogger` and `IResultReporter<unknown>`,
|
|
15
|
+
* so it can be used with `Result.report()` and direct logging calls.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Optional configuration
|
|
18
|
+
* @returns A LogReporter that routes messages into the toast/log system
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare function useLogReporter(options?: IUseLogReporterOptions): Logging.LogReporter<unknown>;
|
|
22
|
+
//# sourceMappingURL=useLogReporter.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.useLogReporter = useLogReporter;
|
|
25
|
+
/**
|
|
26
|
+
* React hook that provides a LogReporter wired into the MessagesContext.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* function MyComponent() {
|
|
31
|
+
* const reporter = useLogReporter();
|
|
32
|
+
*
|
|
33
|
+
* const handleSave = () => {
|
|
34
|
+
* const result = workspace.save(data);
|
|
35
|
+
* // Automatically shows success toast or error in log panel
|
|
36
|
+
* result.report(reporter, {
|
|
37
|
+
* success: { level: 'info', message: () => 'Saved successfully' },
|
|
38
|
+
* failure: 'error'
|
|
39
|
+
* });
|
|
40
|
+
* };
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @packageDocumentation
|
|
45
|
+
*/
|
|
46
|
+
const react_1 = require("react");
|
|
47
|
+
const ts_utils_1 = require("@fgv/ts-utils");
|
|
48
|
+
const MessagesContext_1 = require("./MessagesContext");
|
|
49
|
+
const MessagesLogger_1 = require("./MessagesLogger");
|
|
50
|
+
/**
|
|
51
|
+
* React hook that creates a {@link @fgv/ts-utils#Logging.LogReporter | LogReporter}
|
|
52
|
+
* backed by the MessagesContext.
|
|
53
|
+
*
|
|
54
|
+
* The returned reporter implements both `ILogger` and `IResultReporter<unknown>`,
|
|
55
|
+
* so it can be used with `Result.report()` and direct logging calls.
|
|
56
|
+
*
|
|
57
|
+
* @param options - Optional configuration
|
|
58
|
+
* @returns A LogReporter that routes messages into the toast/log system
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
function useLogReporter(options) {
|
|
62
|
+
const { addMessage } = (0, MessagesContext_1.useMessages)();
|
|
63
|
+
const logLevel = options === null || options === void 0 ? void 0 : options.logLevel;
|
|
64
|
+
return (0, react_1.useMemo)(() => {
|
|
65
|
+
const logger = new MessagesLogger_1.MessagesLogger(addMessage, logLevel);
|
|
66
|
+
return new ts_utils_1.Logging.LogReporter({ logger });
|
|
67
|
+
}, [addMessage, logLevel]);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=useLogReporter.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Severity level for the confirm dialog.
|
|
4
|
+
* Controls the color of the confirm button.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type ConfirmDialogSeverity = 'danger' | 'warning' | 'info';
|
|
8
|
+
/**
|
|
9
|
+
* Props for the ConfirmDialog component.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export interface IConfirmDialogProps {
|
|
13
|
+
/** Whether the dialog is open */
|
|
14
|
+
readonly isOpen: boolean;
|
|
15
|
+
/** Dialog title */
|
|
16
|
+
readonly title: string;
|
|
17
|
+
/** Dialog message body */
|
|
18
|
+
readonly message: React.ReactNode;
|
|
19
|
+
/** Label for the confirm button (defaults to 'Confirm') */
|
|
20
|
+
readonly confirmLabel?: string;
|
|
21
|
+
/** Label for the cancel button (defaults to 'Cancel') */
|
|
22
|
+
readonly cancelLabel?: string;
|
|
23
|
+
/** Severity level controlling confirm button color (defaults to 'danger') */
|
|
24
|
+
readonly severity?: ConfirmDialogSeverity;
|
|
25
|
+
/** Called when the user confirms */
|
|
26
|
+
readonly onConfirm: () => void;
|
|
27
|
+
/** Called when the user cancels or closes */
|
|
28
|
+
readonly onCancel: () => void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Generic confirmation dialog.
|
|
32
|
+
*
|
|
33
|
+
* Renders a modal overlay with a title, message, and confirm/cancel buttons.
|
|
34
|
+
* Closes on Escape key or backdrop click (treated as cancel).
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export declare function ConfirmDialog(props: IConfirmDialogProps): React.ReactElement | null;
|
|
39
|
+
//# sourceMappingURL=ConfirmDialog.d.ts.map
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
27
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
28
|
+
}
|
|
29
|
+
Object.defineProperty(o, k2, desc);
|
|
30
|
+
}) : (function(o, m, k, k2) {
|
|
31
|
+
if (k2 === undefined) k2 = k;
|
|
32
|
+
o[k2] = m[k];
|
|
33
|
+
}));
|
|
34
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
+
}) : function(o, v) {
|
|
37
|
+
o["default"] = v;
|
|
38
|
+
});
|
|
39
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
40
|
+
var ownKeys = function(o) {
|
|
41
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
42
|
+
var ar = [];
|
|
43
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
44
|
+
return ar;
|
|
45
|
+
};
|
|
46
|
+
return ownKeys(o);
|
|
47
|
+
};
|
|
48
|
+
return function (mod) {
|
|
49
|
+
if (mod && mod.__esModule) return mod;
|
|
50
|
+
var result = {};
|
|
51
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
52
|
+
__setModuleDefault(result, mod);
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
})();
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.ConfirmDialog = ConfirmDialog;
|
|
58
|
+
const react_1 = __importStar(require("react"));
|
|
59
|
+
const responsive_1 = require("../responsive");
|
|
60
|
+
const severityClasses = {
|
|
61
|
+
danger: 'bg-status-error-btn hover:bg-status-error-btn-hover focus:ring-status-error-accent',
|
|
62
|
+
warning: 'bg-status-warning-btn hover:bg-status-warning-btn-hover focus:ring-status-warning-strong',
|
|
63
|
+
info: 'bg-status-info-btn hover:bg-status-info-btn-hover focus:ring-status-info-icon'
|
|
64
|
+
};
|
|
65
|
+
const severityIconClasses = {
|
|
66
|
+
danger: 'text-status-error-icon',
|
|
67
|
+
warning: 'text-status-warning-icon',
|
|
68
|
+
info: 'text-status-info-icon'
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Generic confirmation dialog.
|
|
72
|
+
*
|
|
73
|
+
* Renders a modal overlay with a title, message, and confirm/cancel buttons.
|
|
74
|
+
* Closes on Escape key or backdrop click (treated as cancel).
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
function ConfirmDialog(props) {
|
|
79
|
+
const { isOpen, title, message, confirmLabel = 'Confirm', cancelLabel = 'Cancel', severity = 'danger', onConfirm, onCancel } = props;
|
|
80
|
+
const { layoutMode } = (0, responsive_1.useResponsive)();
|
|
81
|
+
const handleKeyDown = (0, react_1.useCallback)((e) => {
|
|
82
|
+
if (e.key === 'Escape') {
|
|
83
|
+
onCancel();
|
|
84
|
+
}
|
|
85
|
+
}, [onCancel]);
|
|
86
|
+
(0, react_1.useEffect)(() => {
|
|
87
|
+
if (isOpen) {
|
|
88
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
89
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
92
|
+
}, [isOpen, handleKeyDown]);
|
|
93
|
+
if (!isOpen) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
return (react_1.default.createElement("div", { className: "fixed inset-0 z-50 flex items-center justify-center" },
|
|
97
|
+
react_1.default.createElement("div", { className: "absolute inset-0 bg-backdrop", onClick: onCancel, role: "presentation" }),
|
|
98
|
+
react_1.default.createElement("div", { className: `relative bg-surface rounded-lg shadow-xl ${layoutMode === 'mobile' ? 'w-[95vw]' : 'max-w-md w-full mx-4'}`, role: "alertdialog", "aria-modal": "true", "aria-labelledby": "confirm-dialog-title", "aria-describedby": "confirm-dialog-message" },
|
|
99
|
+
react_1.default.createElement("div", { className: "p-6" },
|
|
100
|
+
react_1.default.createElement("div", { className: "flex items-start gap-4" },
|
|
101
|
+
react_1.default.createElement("div", { className: `flex-shrink-0 w-10 h-10 flex items-center justify-center rounded-full ${severity === 'danger'
|
|
102
|
+
? 'bg-status-error-bg'
|
|
103
|
+
: severity === 'warning'
|
|
104
|
+
? 'bg-status-warning-bg'
|
|
105
|
+
: 'bg-status-info-bg'}` },
|
|
106
|
+
react_1.default.createElement("svg", { className: `w-6 h-6 ${severityIconClasses[severity]}`, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2 }, severity === 'info' ? (react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" })) : (react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" })))),
|
|
107
|
+
react_1.default.createElement("div", { className: "flex-1 min-w-0" },
|
|
108
|
+
react_1.default.createElement("h3", { id: "confirm-dialog-title", className: "text-base font-semibold text-primary leading-6" }, title),
|
|
109
|
+
react_1.default.createElement("div", { id: "confirm-dialog-message", className: "mt-2 text-sm text-secondary" }, typeof message === 'string' ? react_1.default.createElement("p", null, message) : message))),
|
|
110
|
+
react_1.default.createElement("div", { className: "mt-6 flex justify-end gap-3" },
|
|
111
|
+
react_1.default.createElement("button", { type: "button", onClick: onCancel, className: "px-4 py-2 text-sm font-medium text-secondary bg-surface border border-border rounded-md hover:bg-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-focus-ring transition-colors" }, cancelLabel),
|
|
112
|
+
react_1.default.createElement("button", { type: "button", onClick: onConfirm, className: `px-4 py-2 text-sm font-medium text-white rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors ${severityClasses[severity]}` }, confirmLabel))))));
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=ConfirmDialog.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the Modal component.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface IModalProps {
|
|
7
|
+
/** Whether the modal is open */
|
|
8
|
+
readonly isOpen: boolean;
|
|
9
|
+
/** Callback to close the modal */
|
|
10
|
+
readonly onClose: () => void;
|
|
11
|
+
/** Modal title */
|
|
12
|
+
readonly title: string;
|
|
13
|
+
/** Modal content */
|
|
14
|
+
readonly children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generic modal overlay component.
|
|
18
|
+
* Renders a centered dialog with a backdrop that closes on click or Escape.
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare function Modal(props: IModalProps): React.ReactElement | null;
|
|
22
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
27
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
28
|
+
}
|
|
29
|
+
Object.defineProperty(o, k2, desc);
|
|
30
|
+
}) : (function(o, m, k, k2) {
|
|
31
|
+
if (k2 === undefined) k2 = k;
|
|
32
|
+
o[k2] = m[k];
|
|
33
|
+
}));
|
|
34
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
+
}) : function(o, v) {
|
|
37
|
+
o["default"] = v;
|
|
38
|
+
});
|
|
39
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
40
|
+
var ownKeys = function(o) {
|
|
41
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
42
|
+
var ar = [];
|
|
43
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
44
|
+
return ar;
|
|
45
|
+
};
|
|
46
|
+
return ownKeys(o);
|
|
47
|
+
};
|
|
48
|
+
return function (mod) {
|
|
49
|
+
if (mod && mod.__esModule) return mod;
|
|
50
|
+
var result = {};
|
|
51
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
52
|
+
__setModuleDefault(result, mod);
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
})();
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.Modal = Modal;
|
|
58
|
+
const react_1 = __importStar(require("react"));
|
|
59
|
+
const responsive_1 = require("../responsive");
|
|
60
|
+
/**
|
|
61
|
+
* Generic modal overlay component.
|
|
62
|
+
* Renders a centered dialog with a backdrop that closes on click or Escape.
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
function Modal(props) {
|
|
66
|
+
const { isOpen, onClose, title, children } = props;
|
|
67
|
+
const { layoutMode } = (0, responsive_1.useResponsive)();
|
|
68
|
+
const handleKeyDown = (0, react_1.useCallback)((e) => {
|
|
69
|
+
if (e.key === 'Escape') {
|
|
70
|
+
onClose();
|
|
71
|
+
}
|
|
72
|
+
}, [onClose]);
|
|
73
|
+
(0, react_1.useEffect)(() => {
|
|
74
|
+
if (isOpen) {
|
|
75
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
76
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}, [isOpen, handleKeyDown]);
|
|
80
|
+
if (!isOpen) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
return (react_1.default.createElement("div", { className: "fixed inset-0 z-50 flex items-center justify-center" },
|
|
84
|
+
react_1.default.createElement("div", { className: "absolute inset-0 bg-backdrop", onClick: onClose, role: "presentation" }),
|
|
85
|
+
react_1.default.createElement("div", { className: `relative bg-surface rounded-lg shadow-xl flex flex-col ${layoutMode === 'mobile' ? 'w-[95vw] max-h-[95vh]' : 'max-w-lg w-full mx-4 max-h-[80vh]'}`, role: "dialog", "aria-modal": "true", "aria-label": title },
|
|
86
|
+
react_1.default.createElement("div", { className: "flex items-center justify-between px-6 py-4 border-b border-border" },
|
|
87
|
+
react_1.default.createElement("h2", { className: "text-lg font-semibold text-primary" }, title),
|
|
88
|
+
react_1.default.createElement("button", { onClick: onClose, className: "text-muted hover:text-secondary transition-colors", "aria-label": "Close" }, "\u00D7")),
|
|
89
|
+
react_1.default.createElement("div", { className: "px-6 py-4 overflow-y-auto flex-1" }, children))));
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=Modal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal packlet - generic overlay dialog component.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
export { Modal, type IModalProps } from './Modal';
|
|
6
|
+
export { ConfirmDialog, type IConfirmDialogProps, type ConfirmDialogSeverity } from './ConfirmDialog';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Modal packlet - generic overlay dialog component.
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ConfirmDialog = exports.Modal = void 0;
|
|
8
|
+
var Modal_1 = require("./Modal");
|
|
9
|
+
Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return Modal_1.Modal; } });
|
|
10
|
+
var ConfirmDialog_1 = require("./ConfirmDialog");
|
|
11
|
+
Object.defineProperty(exports, "ConfirmDialog", { enumerable: true, get: function () { return ConfirmDialog_1.ConfirmDialog; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Print enclosure component rendered inside the popup window.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* Props for {@link PrintEnclosure}.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface IPrintEnclosureProps {
|
|
11
|
+
/** Title displayed in the toolbar. */
|
|
12
|
+
readonly title: string;
|
|
13
|
+
/** Optional extra controls rendered in the toolbar (e.g. toggles). */
|
|
14
|
+
readonly toolbarExtras?: React.ReactNode;
|
|
15
|
+
/** Reference to the popup window (used for print and close actions). */
|
|
16
|
+
readonly popupWindow: Window;
|
|
17
|
+
/** Content to display and print. */
|
|
18
|
+
readonly children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A container component rendered inside a popup window that provides a
|
|
22
|
+
* toolbar with Print and Close buttons and renders children as the
|
|
23
|
+
* printable content.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* The toolbar is hidden when printing via CSS (`print-toolbar` class).
|
|
27
|
+
* Children are rendered at full width with no scroll constraints so
|
|
28
|
+
* multi-page content flows naturally to the printer.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export declare function PrintEnclosure({ title, toolbarExtras, popupWindow, children }: IPrintEnclosureProps): React.JSX.Element;
|
|
33
|
+
//# sourceMappingURL=PrintEnclosure.d.ts.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
27
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
28
|
+
}
|
|
29
|
+
Object.defineProperty(o, k2, desc);
|
|
30
|
+
}) : (function(o, m, k, k2) {
|
|
31
|
+
if (k2 === undefined) k2 = k;
|
|
32
|
+
o[k2] = m[k];
|
|
33
|
+
}));
|
|
34
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
+
}) : function(o, v) {
|
|
37
|
+
o["default"] = v;
|
|
38
|
+
});
|
|
39
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
40
|
+
var ownKeys = function(o) {
|
|
41
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
42
|
+
var ar = [];
|
|
43
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
44
|
+
return ar;
|
|
45
|
+
};
|
|
46
|
+
return ownKeys(o);
|
|
47
|
+
};
|
|
48
|
+
return function (mod) {
|
|
49
|
+
if (mod && mod.__esModule) return mod;
|
|
50
|
+
var result = {};
|
|
51
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
52
|
+
__setModuleDefault(result, mod);
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
})();
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.PrintEnclosure = PrintEnclosure;
|
|
58
|
+
/**
|
|
59
|
+
* Print enclosure component rendered inside the popup window.
|
|
60
|
+
* @packageDocumentation
|
|
61
|
+
*/
|
|
62
|
+
const react_1 = __importStar(require("react"));
|
|
63
|
+
const outline_1 = require("@heroicons/react/24/outline");
|
|
64
|
+
/**
|
|
65
|
+
* A container component rendered inside a popup window that provides a
|
|
66
|
+
* toolbar with Print and Close buttons and renders children as the
|
|
67
|
+
* printable content.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* The toolbar is hidden when printing via CSS (`print-toolbar` class).
|
|
71
|
+
* Children are rendered at full width with no scroll constraints so
|
|
72
|
+
* multi-page content flows naturally to the printer.
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
function PrintEnclosure({ title, toolbarExtras, popupWindow, children }) {
|
|
77
|
+
const handlePrint = (0, react_1.useCallback)(() => {
|
|
78
|
+
popupWindow.print();
|
|
79
|
+
}, [popupWindow]);
|
|
80
|
+
const handleClose = (0, react_1.useCallback)(() => {
|
|
81
|
+
popupWindow.close();
|
|
82
|
+
}, [popupWindow]);
|
|
83
|
+
return (react_1.default.createElement("div", null,
|
|
84
|
+
react_1.default.createElement("div", { className: "print-toolbar sticky top-0 z-10 flex items-center justify-between gap-4 bg-surface border-b border-border px-6 py-3 mb-6 shadow-sm" },
|
|
85
|
+
react_1.default.createElement("h1", { className: "text-lg font-semibold text-primary truncate" }, title),
|
|
86
|
+
react_1.default.createElement("div", { className: "flex items-center gap-3 shrink-0" },
|
|
87
|
+
toolbarExtras,
|
|
88
|
+
react_1.default.createElement("button", { type: "button", onClick: handlePrint, className: "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-white bg-brand-primary hover:bg-brand-primary/90 rounded-md transition-colors" },
|
|
89
|
+
react_1.default.createElement(outline_1.PrinterIcon, { className: "w-4 h-4" }),
|
|
90
|
+
"Print"),
|
|
91
|
+
react_1.default.createElement("button", { type: "button", onClick: handleClose, className: "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-secondary bg-surface-raised hover:bg-surface-raised rounded-md transition-colors" },
|
|
92
|
+
react_1.default.createElement(outline_1.XMarkIcon, { className: "w-4 h-4" }),
|
|
93
|
+
"Close"))),
|
|
94
|
+
react_1.default.createElement("div", { className: "max-w-4xl mx-auto px-6" }, children)));
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=PrintEnclosure.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Print packlet - popup window for print-optimized content rendering.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
export { openPrintWindow, type IPrintWindowOptions } from './openPrintWindow';
|
|
6
|
+
export { PrintEnclosure, type IPrintEnclosureProps } from './PrintEnclosure';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Print packlet - popup window for print-optimized content rendering.
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.PrintEnclosure = exports.openPrintWindow = void 0;
|
|
8
|
+
var openPrintWindow_1 = require("./openPrintWindow");
|
|
9
|
+
Object.defineProperty(exports, "openPrintWindow", { enumerable: true, get: function () { return openPrintWindow_1.openPrintWindow; } });
|
|
10
|
+
var PrintEnclosure_1 = require("./PrintEnclosure");
|
|
11
|
+
Object.defineProperty(exports, "PrintEnclosure", { enumerable: true, get: function () { return PrintEnclosure_1.PrintEnclosure; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|