@pallasoft/ps-internal-components 1.6.0 → 1.6.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/dist/components/ps-sidebar-workspace-switcher.js +2 -2
- package/dist/components/ps-workspace-badge.js +3 -2
- package/dist/constants/ps-workspace-badge-sizes.d.ts +14 -0
- package/dist/constants/ps-workspace-badge-sizes.js +8 -0
- package/dist/esm/components/ps-sidebar-workspace-switcher.js +2 -2
- package/dist/esm/components/ps-workspace-badge.js +3 -2
- package/dist/esm/constants/ps-workspace-badge-sizes.js +5 -0
- package/dist/esm/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models/ps-workspace-badge-props.d.ts +1 -1
- package/package.json +1 -1
|
@@ -27,13 +27,13 @@ const PsSidebarWorkspaceSwitcher = ({ appTitle, homeHref, logoAlt = ps_app_sideb
|
|
|
27
27
|
href: homeHref,
|
|
28
28
|
}) }) }) }));
|
|
29
29
|
}
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)(ps_sidebar_menu_js_1.PsSidebarMenu, { children: (0, jsx_runtime_1.jsx)(ps_sidebar_menu_item_js_1.PsSidebarMenuItem, { children: (0, jsx_runtime_1.jsxs)(ps_dropdown_menu_js_1.PsDropdownMenu, { children: [(0, jsx_runtime_1.jsx)(ps_dropdown_menu_trigger_js_1.PsDropdownMenuTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(ps_sidebar_menu_button_js_1.PsSidebarMenuButton, { className: 'data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground', size: 'lg', tooltip: active === undefined ? appTitle : active.label, children: [active === undefined ? (brand) : ((0, jsx_runtime_1.jsx)(ps_workspace_badge_js_1.PsWorkspaceBadge, { active: true, iconUrl: active.iconUrl, initials: active.initials, size: '
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(ps_sidebar_menu_js_1.PsSidebarMenu, { children: (0, jsx_runtime_1.jsx)(ps_sidebar_menu_item_js_1.PsSidebarMenuItem, { children: (0, jsx_runtime_1.jsxs)(ps_dropdown_menu_js_1.PsDropdownMenu, { children: [(0, jsx_runtime_1.jsx)(ps_dropdown_menu_trigger_js_1.PsDropdownMenuTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(ps_sidebar_menu_button_js_1.PsSidebarMenuButton, { className: 'data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground', size: 'lg', tooltip: active === undefined ? appTitle : active.label, children: [active === undefined ? (brand) : ((0, jsx_runtime_1.jsx)(ps_workspace_badge_js_1.PsWorkspaceBadge, { active: true, iconUrl: active.iconUrl, initials: active.initials, size: 'md' })), (0, jsx_runtime_1.jsxs)("div", { className: 'grid flex-1 text-left text-sm leading-tight', children: [(0, jsx_runtime_1.jsx)("span", { className: 'truncate font-semibold', children: active === undefined ? appTitle : active.label }), (0, jsx_runtime_1.jsx)("span", { className: 'truncate text-xs text-muted-foreground', children: active === undefined ? switcher.placeholder : appTitle })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: 'ml-auto' })] }) }), (0, jsx_runtime_1.jsxs)(ps_dropdown_menu_content_js_1.PsDropdownMenuContent, { align: 'start', className: 'w-[--radix-dropdown-menu-trigger-width] min-w-60 rounded-lg', side: isMobile ? 'bottom' : 'right', sideOffset: 4, children: [(0, jsx_runtime_1.jsx)(ps_dropdown_menu_label_js_1.PsDropdownMenuLabel, { className: 'text-xs text-muted-foreground', children: switcher.label }), (0, jsx_runtime_1.jsx)(ps_dropdown_menu_item_js_1.PsDropdownMenuItem, { asChild: true, className: 'gap-2 p-2', children: ps_link_service_js_1.PsLinkService.render(renderLink, {
|
|
31
31
|
children: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [brand, (0, jsx_runtime_1.jsx)("span", { className: 'font-medium', children: appTitle })] })),
|
|
32
32
|
className: '',
|
|
33
33
|
href: homeHref,
|
|
34
34
|
}) }), switcher.items.map((item) => ((0, jsx_runtime_1.jsx)(ps_dropdown_menu_item_js_1.PsDropdownMenuItem, { asChild: true, className: 'gap-2 p-2', children: ps_link_service_js_1.PsLinkService.render(renderLink, {
|
|
35
35
|
active: item.active,
|
|
36
|
-
children: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ps_workspace_badge_js_1.PsWorkspaceBadge, { active: item.active, iconUrl: item.iconUrl, initials: item.initials, size: '
|
|
36
|
+
children: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ps_workspace_badge_js_1.PsWorkspaceBadge, { active: item.active, iconUrl: item.iconUrl, initials: item.initials, size: 'md' }), (0, jsx_runtime_1.jsxs)("span", { className: 'grid min-w-0 flex-1 leading-tight', children: [(0, jsx_runtime_1.jsx)("span", { className: 'truncate font-medium', children: item.label }), (0, jsx_runtime_1.jsx)("span", { className: 'truncate text-xs text-muted-foreground', children: item.description })] })] })),
|
|
37
37
|
className: '',
|
|
38
38
|
href: item.href,
|
|
39
39
|
}) }, item.id)))] })] }) }) }));
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PsWorkspaceBadge = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ps_workspace_badge_sizes_js_1 = require("../constants/ps-workspace-badge-sizes.js");
|
|
5
6
|
const ps_class_name_service_js_1 = require("../services/ps-class-name-service.js");
|
|
6
7
|
const PsWorkspaceBadge = ({ initials, iconUrl, active = false, size = 'sm', }) => {
|
|
7
|
-
const box
|
|
8
|
+
const { box, text } = ps_workspace_badge_sizes_js_1.PsWorkspaceBadgeSizes[size];
|
|
8
9
|
if (iconUrl !== undefined)
|
|
9
10
|
return ((0, jsx_runtime_1.jsx)("img", { alt: '', "aria-hidden": 'true', className: ps_class_name_service_js_1.PsClassNameService.merge('shrink-0 object-contain', box), src: iconUrl }));
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)("span", { className: ps_class_name_service_js_1.PsClassNameService.merge('flex shrink-0 items-center justify-center border font-semibold', box,
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)("span", { className: ps_class_name_service_js_1.PsClassNameService.merge('flex shrink-0 items-center justify-center border font-semibold', box, text, active ? 'border-primary bg-primary text-primary-foreground' : 'bg-muted text-foreground'), children: initials }));
|
|
11
12
|
};
|
|
12
13
|
exports.PsWorkspaceBadge = PsWorkspaceBadge;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const PsWorkspaceBadgeSizes: {
|
|
2
|
+
readonly lg: {
|
|
3
|
+
readonly box: "size-10 rounded-lg";
|
|
4
|
+
readonly text: "text-sm";
|
|
5
|
+
};
|
|
6
|
+
readonly md: {
|
|
7
|
+
readonly box: "size-8 rounded-lg";
|
|
8
|
+
readonly text: "text-xs";
|
|
9
|
+
};
|
|
10
|
+
readonly sm: {
|
|
11
|
+
readonly box: "size-6 rounded-md";
|
|
12
|
+
readonly text: "text-[0.625rem]";
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsWorkspaceBadgeSizes = void 0;
|
|
4
|
+
exports.PsWorkspaceBadgeSizes = {
|
|
5
|
+
lg: { box: 'size-10 rounded-lg', text: 'text-sm' },
|
|
6
|
+
md: { box: 'size-8 rounded-lg', text: 'text-xs' },
|
|
7
|
+
sm: { box: 'size-6 rounded-md', text: 'text-[0.625rem]' },
|
|
8
|
+
};
|
|
@@ -24,13 +24,13 @@ export const PsSidebarWorkspaceSwitcher = ({ appTitle, homeHref, logoAlt = PsApp
|
|
|
24
24
|
href: homeHref,
|
|
25
25
|
}) }) }) }));
|
|
26
26
|
}
|
|
27
|
-
return (_jsx(PsSidebarMenu, { children: _jsx(PsSidebarMenuItem, { children: _jsxs(PsDropdownMenu, { children: [_jsx(PsDropdownMenuTrigger, { asChild: true, children: _jsxs(PsSidebarMenuButton, { className: 'data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground', size: 'lg', tooltip: active === undefined ? appTitle : active.label, children: [active === undefined ? (brand) : (_jsx(PsWorkspaceBadge, { active: true, iconUrl: active.iconUrl, initials: active.initials, size: '
|
|
27
|
+
return (_jsx(PsSidebarMenu, { children: _jsx(PsSidebarMenuItem, { children: _jsxs(PsDropdownMenu, { children: [_jsx(PsDropdownMenuTrigger, { asChild: true, children: _jsxs(PsSidebarMenuButton, { className: 'data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground', size: 'lg', tooltip: active === undefined ? appTitle : active.label, children: [active === undefined ? (brand) : (_jsx(PsWorkspaceBadge, { active: true, iconUrl: active.iconUrl, initials: active.initials, size: 'md' })), _jsxs("div", { className: 'grid flex-1 text-left text-sm leading-tight', children: [_jsx("span", { className: 'truncate font-semibold', children: active === undefined ? appTitle : active.label }), _jsx("span", { className: 'truncate text-xs text-muted-foreground', children: active === undefined ? switcher.placeholder : appTitle })] }), _jsx(ChevronsUpDown, { className: 'ml-auto' })] }) }), _jsxs(PsDropdownMenuContent, { align: 'start', className: 'w-[--radix-dropdown-menu-trigger-width] min-w-60 rounded-lg', side: isMobile ? 'bottom' : 'right', sideOffset: 4, children: [_jsx(PsDropdownMenuLabel, { className: 'text-xs text-muted-foreground', children: switcher.label }), _jsx(PsDropdownMenuItem, { asChild: true, className: 'gap-2 p-2', children: PsLinkService.render(renderLink, {
|
|
28
28
|
children: (_jsxs(_Fragment, { children: [brand, _jsx("span", { className: 'font-medium', children: appTitle })] })),
|
|
29
29
|
className: '',
|
|
30
30
|
href: homeHref,
|
|
31
31
|
}) }), switcher.items.map((item) => (_jsx(PsDropdownMenuItem, { asChild: true, className: 'gap-2 p-2', children: PsLinkService.render(renderLink, {
|
|
32
32
|
active: item.active,
|
|
33
|
-
children: (_jsxs(_Fragment, { children: [_jsx(PsWorkspaceBadge, { active: item.active, iconUrl: item.iconUrl, initials: item.initials, size: '
|
|
33
|
+
children: (_jsxs(_Fragment, { children: [_jsx(PsWorkspaceBadge, { active: item.active, iconUrl: item.iconUrl, initials: item.initials, size: 'md' }), _jsxs("span", { className: 'grid min-w-0 flex-1 leading-tight', children: [_jsx("span", { className: 'truncate font-medium', children: item.label }), _jsx("span", { className: 'truncate text-xs text-muted-foreground', children: item.description })] })] })),
|
|
34
34
|
className: '',
|
|
35
35
|
href: item.href,
|
|
36
36
|
}) }, item.id)))] })] }) }) }));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PsWorkspaceBadgeSizes } from '../constants/ps-workspace-badge-sizes.js';
|
|
2
3
|
import { PsClassNameService } from '../services/ps-class-name-service.js';
|
|
3
4
|
export const PsWorkspaceBadge = ({ initials, iconUrl, active = false, size = 'sm', }) => {
|
|
4
|
-
const box
|
|
5
|
+
const { box, text } = PsWorkspaceBadgeSizes[size];
|
|
5
6
|
if (iconUrl !== undefined)
|
|
6
7
|
return (_jsx("img", { alt: '', "aria-hidden": 'true', className: PsClassNameService.merge('shrink-0 object-contain', box), src: iconUrl }));
|
|
7
|
-
return (_jsx("span", { className: PsClassNameService.merge('flex shrink-0 items-center justify-center border font-semibold', box,
|
|
8
|
+
return (_jsx("span", { className: PsClassNameService.merge('flex shrink-0 items-center justify-center border font-semibold', box, text, active ? 'border-primary bg-primary text-primary-foreground' : 'bg-muted text-foreground'), children: initials }));
|
|
8
9
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -456,6 +456,7 @@ export * from './components/ps-page-skeleton.js';
|
|
|
456
456
|
export * from './components/ps-section-heading.js';
|
|
457
457
|
export * from './components/ps-stat-card.js';
|
|
458
458
|
export * from './constants/ps-notice-variant.js';
|
|
459
|
+
export * from './constants/ps-workspace-badge-sizes.js';
|
|
459
460
|
export * from './models/ps-confirm-action-props.js';
|
|
460
461
|
export * from './models/ps-notice-props.js';
|
|
461
462
|
export * from './models/ps-page-crumb-data.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -456,6 +456,7 @@ export * from './components/ps-page-skeleton.js';
|
|
|
456
456
|
export * from './components/ps-section-heading.js';
|
|
457
457
|
export * from './components/ps-stat-card.js';
|
|
458
458
|
export * from './constants/ps-notice-variant.js';
|
|
459
|
+
export * from './constants/ps-workspace-badge-sizes.js';
|
|
459
460
|
export * from './models/ps-confirm-action-props.js';
|
|
460
461
|
export * from './models/ps-notice-props.js';
|
|
461
462
|
export * from './models/ps-page-crumb-data.js';
|
package/dist/index.js
CHANGED
|
@@ -472,6 +472,7 @@ __exportStar(require("./components/ps-page-skeleton.js"), exports);
|
|
|
472
472
|
__exportStar(require("./components/ps-section-heading.js"), exports);
|
|
473
473
|
__exportStar(require("./components/ps-stat-card.js"), exports);
|
|
474
474
|
__exportStar(require("./constants/ps-notice-variant.js"), exports);
|
|
475
|
+
__exportStar(require("./constants/ps-workspace-badge-sizes.js"), exports);
|
|
475
476
|
__exportStar(require("./models/ps-confirm-action-props.js"), exports);
|
|
476
477
|
__exportStar(require("./models/ps-notice-props.js"), exports);
|
|
477
478
|
__exportStar(require("./models/ps-page-crumb-data.js"), exports);
|
package/package.json
CHANGED