@fgv/ts-app-shell 5.1.0-11 → 5.1.0-12

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.
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2026 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ export { renderStatusBadge } from './renderStatusBadge';
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright (c) 2026 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ import React from 'react';
23
+ const BADGE_COUNT_BASE_CLASSES = 'ml-1.5 min-w-4 px-1.5 py-0.5 text-[0.6875rem] inline-flex shrink-0 items-center justify-center rounded-full font-medium leading-none';
24
+ const BADGE_DOT_BASE_CLASSES = 'ml-1.5 h-2 w-2 inline-block shrink-0 rounded-full';
25
+ const BADGE_COUNT_TONE_CLASSES = {
26
+ info: 'bg-status-info-bg text-status-info-text',
27
+ warning: 'bg-status-warning-bg text-status-warning-text',
28
+ danger: 'bg-status-error-bg text-status-error-text'
29
+ };
30
+ const BADGE_DOT_TONE_CLASSES = {
31
+ info: 'bg-status-info-icon',
32
+ warning: 'bg-status-warning-icon',
33
+ danger: 'bg-status-error-icon'
34
+ };
35
+ export function renderStatusBadge(badge) {
36
+ var _a, _b;
37
+ const tone = (_a = badge.tone) !== null && _a !== void 0 ? _a : 'info';
38
+ const ariaLabel = badge.ariaLabel;
39
+ if (badge.kind === 'dot') {
40
+ return (React.createElement("span", { className: `${BADGE_DOT_BASE_CLASSES} ${BADGE_DOT_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }));
41
+ }
42
+ return (React.createElement("span", { className: `${BADGE_COUNT_BASE_CLASSES} ${BADGE_COUNT_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }, (_b = badge.count) !== null && _b !== void 0 ? _b : 0));
43
+ }
44
+ //# sourceMappingURL=renderStatusBadge.js.map
@@ -30,21 +30,7 @@
30
30
  import React, { useCallback, useEffect, useRef, useState } from 'react';
31
31
  import { StarIcon as StarIconOutline } from '@heroicons/react/24/outline';
32
32
  import { StarIcon as StarIconSolid, ExclamationTriangleIcon, BuildingLibraryIcon, ShieldCheckIcon, ShieldExclamationIcon, ArrowDownTrayIcon, PencilSquareIcon, ArrowsPointingInIcon, TrashIcon, FolderPlusIcon, ArchiveBoxArrowDownIcon, FolderOpenIcon, ArrowUpTrayIcon, PlusIcon, ChevronRightIcon } from '@heroicons/react/20/solid';
33
- const BADGE_BASE_CLASSES = 'inline-flex shrink-0 items-center justify-center rounded-full font-medium leading-none';
34
- const BADGE_TONE_CLASSES = {
35
- info: 'bg-status-info-bg text-status-info-text',
36
- warning: 'bg-status-warning-bg text-status-warning-text',
37
- danger: 'bg-status-error-bg text-status-error-text'
38
- };
39
- function renderBadge(badge) {
40
- var _a, _b;
41
- const tone = (_a = badge.tone) !== null && _a !== void 0 ? _a : 'info';
42
- const ariaLabel = badge.ariaLabel;
43
- if (badge.kind === 'dot') {
44
- return (React.createElement("span", { className: `ml-1.5 h-2 w-2 ${BADGE_BASE_CLASSES} ${BADGE_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }));
45
- }
46
- return (React.createElement("span", { className: `ml-1.5 min-w-4 px-1.5 py-0.5 text-[0.6875rem] ${BADGE_BASE_CLASSES} ${BADGE_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }, (_b = badge.count) !== null && _b !== void 0 ? _b : 0));
47
- }
33
+ import { renderStatusBadge } from '../badge';
48
34
  // ============================================================================
49
35
  // Context Menu (internal)
50
36
  // ============================================================================
@@ -136,7 +122,7 @@ function CollectionRow(props) {
136
122
  }, className: "shrink-0 text-muted hover:text-star transition-colors", title: "Click to unlock", "aria-label": `Unlock ${displayName}` },
137
123
  React.createElement(ShieldExclamationIcon, { className: "w-4 h-4" })))),
138
124
  React.createElement("span", { className: "flex-1 truncate", title: displayName }, displayName),
139
- collection.badge && renderBadge(collection.badge),
125
+ collection.badge && renderStatusBadge(collection.badge),
140
126
  React.createElement("span", { className: "shrink-0 text-xs text-muted" }, collection.itemCount)),
141
127
  React.createElement("div", { className: "flex items-center gap-1 mt-1 ml-[24px]" },
142
128
  collection.isMutable && onExport && (React.createElement("button", { onClick: (e) => {
@@ -20,21 +20,7 @@
20
20
  * SOFTWARE.
21
21
  */
22
22
  import React from 'react';
23
- const BADGE_BASE_CLASSES = 'inline-flex shrink-0 items-center justify-center rounded-full font-medium leading-none';
24
- const BADGE_TONE_CLASSES = {
25
- info: 'bg-status-info-bg text-status-info-text',
26
- warning: 'bg-status-warning-bg text-status-warning-text',
27
- danger: 'bg-status-error-bg text-status-error-text'
28
- };
29
- function renderBadge(badge) {
30
- var _a, _b;
31
- const tone = (_a = badge.tone) !== null && _a !== void 0 ? _a : 'info';
32
- const ariaLabel = badge.ariaLabel;
33
- if (badge.kind === 'dot') {
34
- return (React.createElement("span", { className: `ml-1.5 h-2 w-2 ${BADGE_BASE_CLASSES} ${BADGE_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }));
35
- }
36
- return (React.createElement("span", { className: `ml-1.5 min-w-4 px-1.5 py-0.5 text-[0.6875rem] ${BADGE_BASE_CLASSES} ${BADGE_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }, (_b = badge.count) !== null && _b !== void 0 ? _b : 0));
37
- }
23
+ import { renderStatusBadge } from '../badge';
38
24
  /**
39
25
  * Second-level tab bar for switching views within a mode.
40
26
  * @public
@@ -46,7 +32,7 @@ export function TabBar(props) {
46
32
  ? 'bg-white/20 text-white'
47
33
  : 'text-white/60 hover:text-white hover:bg-white/10'}`, "aria-current": activeTab === tab.id ? 'page' : undefined },
48
34
  React.createElement("span", null, tab.label),
49
- tab.badge && renderBadge(tab.badge)))),
35
+ tab.badge && renderStatusBadge(tab.badge)))),
50
36
  rightContent !== undefined && (React.createElement(React.Fragment, null,
51
37
  React.createElement("div", { className: "flex-1" }),
52
38
  rightContent))));
@@ -0,0 +1,2 @@
1
+ export { renderStatusBadge } from './renderStatusBadge';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,27 @@
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.renderStatusBadge = void 0;
25
+ var renderStatusBadge_1 = require("./renderStatusBadge");
26
+ Object.defineProperty(exports, "renderStatusBadge", { enumerable: true, get: function () { return renderStatusBadge_1.renderStatusBadge; } });
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ type BadgeTone = 'info' | 'warning' | 'danger';
3
+ interface IBadgeLike {
4
+ readonly kind: 'dot' | 'count';
5
+ readonly tone?: BadgeTone;
6
+ readonly count?: number;
7
+ readonly ariaLabel?: string;
8
+ }
9
+ export declare function renderStatusBadge(badge: IBadgeLike): React.ReactElement;
10
+ export {};
11
+ //# sourceMappingURL=renderStatusBadge.d.ts.map
@@ -0,0 +1,50 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
24
+ return (mod && mod.__esModule) ? mod : { "default": mod };
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.renderStatusBadge = renderStatusBadge;
28
+ const react_1 = __importDefault(require("react"));
29
+ const BADGE_COUNT_BASE_CLASSES = 'ml-1.5 min-w-4 px-1.5 py-0.5 text-[0.6875rem] inline-flex shrink-0 items-center justify-center rounded-full font-medium leading-none';
30
+ const BADGE_DOT_BASE_CLASSES = 'ml-1.5 h-2 w-2 inline-block shrink-0 rounded-full';
31
+ const BADGE_COUNT_TONE_CLASSES = {
32
+ info: 'bg-status-info-bg text-status-info-text',
33
+ warning: 'bg-status-warning-bg text-status-warning-text',
34
+ danger: 'bg-status-error-bg text-status-error-text'
35
+ };
36
+ const BADGE_DOT_TONE_CLASSES = {
37
+ info: 'bg-status-info-icon',
38
+ warning: 'bg-status-warning-icon',
39
+ danger: 'bg-status-error-icon'
40
+ };
41
+ function renderStatusBadge(badge) {
42
+ var _a, _b;
43
+ const tone = (_a = badge.tone) !== null && _a !== void 0 ? _a : 'info';
44
+ const ariaLabel = badge.ariaLabel;
45
+ if (badge.kind === 'dot') {
46
+ return (react_1.default.createElement("span", { className: `${BADGE_DOT_BASE_CLASSES} ${BADGE_DOT_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }));
47
+ }
48
+ return (react_1.default.createElement("span", { className: `${BADGE_COUNT_BASE_CLASSES} ${BADGE_COUNT_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }, (_b = badge.count) !== null && _b !== void 0 ? _b : 0));
49
+ }
50
+ //# sourceMappingURL=renderStatusBadge.js.map
@@ -66,21 +66,7 @@ exports.CollectionSection = CollectionSection;
66
66
  const react_1 = __importStar(require("react"));
67
67
  const outline_1 = require("@heroicons/react/24/outline");
68
68
  const solid_1 = require("@heroicons/react/20/solid");
69
- const BADGE_BASE_CLASSES = 'inline-flex shrink-0 items-center justify-center rounded-full font-medium leading-none';
70
- const BADGE_TONE_CLASSES = {
71
- info: 'bg-status-info-bg text-status-info-text',
72
- warning: 'bg-status-warning-bg text-status-warning-text',
73
- danger: 'bg-status-error-bg text-status-error-text'
74
- };
75
- function renderBadge(badge) {
76
- var _a, _b;
77
- const tone = (_a = badge.tone) !== null && _a !== void 0 ? _a : 'info';
78
- const ariaLabel = badge.ariaLabel;
79
- if (badge.kind === 'dot') {
80
- return (react_1.default.createElement("span", { className: `ml-1.5 h-2 w-2 ${BADGE_BASE_CLASSES} ${BADGE_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }));
81
- }
82
- return (react_1.default.createElement("span", { className: `ml-1.5 min-w-4 px-1.5 py-0.5 text-[0.6875rem] ${BADGE_BASE_CLASSES} ${BADGE_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }, (_b = badge.count) !== null && _b !== void 0 ? _b : 0));
83
- }
69
+ const badge_1 = require("../badge");
84
70
  // ============================================================================
85
71
  // Context Menu (internal)
86
72
  // ============================================================================
@@ -172,7 +158,7 @@ function CollectionRow(props) {
172
158
  }, className: "shrink-0 text-muted hover:text-star transition-colors", title: "Click to unlock", "aria-label": `Unlock ${displayName}` },
173
159
  react_1.default.createElement(solid_1.ShieldExclamationIcon, { className: "w-4 h-4" })))),
174
160
  react_1.default.createElement("span", { className: "flex-1 truncate", title: displayName }, displayName),
175
- collection.badge && renderBadge(collection.badge),
161
+ collection.badge && (0, badge_1.renderStatusBadge)(collection.badge),
176
162
  react_1.default.createElement("span", { className: "shrink-0 text-xs text-muted" }, collection.itemCount)),
177
163
  react_1.default.createElement("div", { className: "flex items-center gap-1 mt-1 ml-[24px]" },
178
164
  collection.isMutable && onExport && (react_1.default.createElement("button", { onClick: (e) => {
@@ -26,21 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.TabBar = TabBar;
28
28
  const react_1 = __importDefault(require("react"));
29
- const BADGE_BASE_CLASSES = 'inline-flex shrink-0 items-center justify-center rounded-full font-medium leading-none';
30
- const BADGE_TONE_CLASSES = {
31
- info: 'bg-status-info-bg text-status-info-text',
32
- warning: 'bg-status-warning-bg text-status-warning-text',
33
- danger: 'bg-status-error-bg text-status-error-text'
34
- };
35
- function renderBadge(badge) {
36
- var _a, _b;
37
- const tone = (_a = badge.tone) !== null && _a !== void 0 ? _a : 'info';
38
- const ariaLabel = badge.ariaLabel;
39
- if (badge.kind === 'dot') {
40
- return (react_1.default.createElement("span", { className: `ml-1.5 h-2 w-2 ${BADGE_BASE_CLASSES} ${BADGE_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }));
41
- }
42
- return (react_1.default.createElement("span", { className: `ml-1.5 min-w-4 px-1.5 py-0.5 text-[0.6875rem] ${BADGE_BASE_CLASSES} ${BADGE_TONE_CLASSES[tone]}`, "aria-label": ariaLabel }, (_b = badge.count) !== null && _b !== void 0 ? _b : 0));
43
- }
29
+ const badge_1 = require("../badge");
44
30
  /**
45
31
  * Second-level tab bar for switching views within a mode.
46
32
  * @public
@@ -52,7 +38,7 @@ function TabBar(props) {
52
38
  ? 'bg-white/20 text-white'
53
39
  : 'text-white/60 hover:text-white hover:bg-white/10'}`, "aria-current": activeTab === tab.id ? 'page' : undefined },
54
40
  react_1.default.createElement("span", null, tab.label),
55
- tab.badge && renderBadge(tab.badge)))),
41
+ tab.badge && (0, badge_1.renderStatusBadge)(tab.badge)))),
56
42
  rightContent !== undefined && (react_1.default.createElement(react_1.default.Fragment, null,
57
43
  react_1.default.createElement("div", { className: "flex-1" }),
58
44
  rightContent))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fgv/ts-app-shell",
3
- "version": "5.1.0-11",
3
+ "version": "5.1.0-12",
4
4
  "description": "Shared React UI primitives for application shells: column cascade, sidebar, toast/log messages, command palette, keybinding registry",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -17,8 +17,8 @@
17
17
  "dependencies": {
18
18
  "@heroicons/react": "~2.2.0",
19
19
  "tslib": "^2.8.1",
20
- "@fgv/ts-utils": "5.1.0-11",
21
- "@fgv/ts-extras": "5.1.0-11"
20
+ "@fgv/ts-utils": "5.1.0-12",
21
+ "@fgv/ts-extras": "5.1.0-12"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=18.0.0",
@@ -51,8 +51,8 @@
51
51
  "@rushstack/heft-jest-plugin": "1.2.6",
52
52
  "@testing-library/dom": "^10.4.0",
53
53
  "@rushstack/heft-node-rig": "2.11.27",
54
- "@fgv/heft-dual-rig": "5.1.0-11",
55
- "@fgv/ts-utils-jest": "5.1.0-11"
54
+ "@fgv/ts-utils-jest": "5.1.0-12",
55
+ "@fgv/heft-dual-rig": "5.1.0-12"
56
56
  },
57
57
  "exports": {
58
58
  ".": {