@pallasoft/ps-core-components 2.23.0 → 2.25.0
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-active-filter-chip.js +1 -1
- package/dist/components/ps-badge.js +1 -1
- package/dist/components/ps-empty-state.js +1 -1
- package/dist/components/ps-fab.js +1 -1
- package/dist/components/ps-form-fields-skeleton.js +1 -1
- package/dist/components/ps-icon-button.d.ts +3 -1
- package/dist/components/ps-icon-button.js +1 -1
- package/dist/components/ps-icon-link.d.ts +3 -1
- package/dist/components/ps-icon-link.js +2 -2
- package/dist/components/ps-pill.js +1 -1
- package/dist/components/ps-section-header.js +1 -1
- package/dist/components/ps-site-header.js +1 -1
- package/dist/components/ps-start-preview.js +1 -1
- package/dist/components/ps-theme-controller.js +1 -1
- package/dist/components/ps-theme-toggle.js +1 -1
- package/dist/constants/ps-button-classes.d.ts +1 -1
- package/dist/constants/ps-button-classes.js +4 -4
- package/dist/constants/ps-drag-config.d.ts +1 -1
- package/dist/constants/ps-drag-config.js +1 -1
- package/dist/constants/ps-draggable-grid.d.ts +1 -1
- package/dist/constants/ps-icon-action-config.d.ts +5 -0
- package/dist/constants/ps-icon-action-config.js +7 -2
- package/dist/constants/ps-pallasoft-sign-in-classes.d.ts +5 -5
- package/dist/constants/ps-pallasoft-sign-in-classes.js +5 -5
- package/dist/constants/ps-skeleton-config.js +1 -1
- package/dist/esm/components/ps-active-filter-chip.js +1 -1
- package/dist/esm/components/ps-badge.js +1 -1
- package/dist/esm/components/ps-empty-state.js +1 -1
- package/dist/esm/components/ps-fab.js +1 -1
- package/dist/esm/components/ps-form-fields-skeleton.js +1 -1
- package/dist/esm/components/ps-icon-button.js +1 -1
- package/dist/esm/components/ps-icon-link.js +2 -2
- package/dist/esm/components/ps-pill.js +1 -1
- package/dist/esm/components/ps-section-header.js +1 -1
- package/dist/esm/components/ps-site-header.js +1 -1
- package/dist/esm/components/ps-start-preview.js +1 -1
- package/dist/esm/components/ps-theme-controller.js +1 -1
- package/dist/esm/components/ps-theme-toggle.js +1 -1
- package/dist/esm/constants/ps-button-classes.js +4 -4
- package/dist/esm/constants/ps-drag-config.js +1 -1
- package/dist/esm/constants/ps-icon-action-config.js +7 -2
- package/dist/esm/constants/ps-pallasoft-sign-in-classes.js +5 -5
- package/dist/esm/constants/ps-skeleton-config.js +1 -1
- package/dist/esm/hooks/use-ps-exit-snapshot.js +7 -0
- package/dist/esm/hooks/use-ps-exit-transition.js +5 -2
- package/dist/esm/hooks/use-ps-restore-focus.js +16 -0
- package/dist/esm/hooks/use-ps-scroll-lock.js +9 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/services/ps-scroll-lock-service.js +23 -0
- package/dist/hooks/use-ps-exit-snapshot.d.ts +1 -0
- package/dist/hooks/use-ps-exit-snapshot.js +11 -0
- package/dist/hooks/use-ps-exit-transition.js +5 -2
- package/dist/hooks/use-ps-restore-focus.d.ts +1 -0
- package/dist/hooks/use-ps-restore-focus.js +20 -0
- package/dist/hooks/use-ps-scroll-lock.d.ts +1 -0
- package/dist/hooks/use-ps-scroll-lock.js +13 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/services/ps-scroll-lock-service.d.ts +5 -0
- package/dist/services/ps-scroll-lock-service.js +27 -0
- package/package.json +2 -2
|
@@ -4,5 +4,5 @@ exports.PsActiveFilterChip = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const ps_icons_1 = require("@pallasoft/ps-icons");
|
|
6
6
|
const ps_pill_1 = require("./ps-pill");
|
|
7
|
-
const PsActiveFilterChip = ({ id, label, onRemove, removeLabel, }) => ((0, jsx_runtime_1.jsx)("button", { "aria-label": removeLabel, className: 'ps-focus-ring shrink-0 rounded-
|
|
7
|
+
const PsActiveFilterChip = ({ id, label, onRemove, removeLabel, }) => ((0, jsx_runtime_1.jsx)("button", { "aria-label": removeLabel, className: 'ps-focus-ring shrink-0 rounded-ps-control', id: id, onClick: onRemove, type: 'button', children: (0, jsx_runtime_1.jsx)(ps_pill_1.PsPill, { className: 'pr-2', tone: 'primary', children: (0, jsx_runtime_1.jsxs)("span", { className: 'flex items-center gap-1.5', children: [label, (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { className: 'h-3 w-3', iconKey: ps_icons_1.PsIconKey.Close })] }) }) }));
|
|
8
8
|
exports.PsActiveFilterChip = PsActiveFilterChip;
|
|
@@ -12,5 +12,5 @@ const toneClassNames = {
|
|
|
12
12
|
success: 'bg-success-soft text-emerald-700 dark:bg-emerald-400/18 dark:text-emerald-50',
|
|
13
13
|
warning: 'bg-warning-soft text-amber-800 dark:bg-amber-400/18 dark:text-amber-50',
|
|
14
14
|
};
|
|
15
|
-
const PsBadge = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? ((0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: ps_design_system_1.PallasoftClassNameService.merge('h-7 w-20', className), shape: ps_skeleton_shape_1.PsSkeletonShape.Block })) : ((0, jsx_runtime_1.jsx)("span", { className: ps_design_system_1.PallasoftClassNameService.merge('inline-flex min-h-7 w-fit items-center justify-center whitespace-nowrap rounded-
|
|
15
|
+
const PsBadge = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? ((0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: ps_design_system_1.PallasoftClassNameService.merge('h-7 w-20', className), shape: ps_skeleton_shape_1.PsSkeletonShape.Block })) : ((0, jsx_runtime_1.jsx)("span", { className: ps_design_system_1.PallasoftClassNameService.merge('inline-flex min-h-7 w-fit items-center justify-center whitespace-nowrap rounded-ps-control px-3 py-0.5 text-center text-xs font-semibold capitalize', toneClassNames[tone], className), children: children }));
|
|
16
16
|
exports.PsBadge = PsBadge;
|
|
@@ -27,6 +27,6 @@ const PsEmptyState = ({ actions = [], badge, children, className, detail, descri
|
|
|
27
27
|
? 'mt-1.5 text-sm leading-6 text-ink/60'
|
|
28
28
|
: 'mt-3 text-sm leading-6 text-ink/60', children: description })) : null, detail ? ((0, jsx_runtime_1.jsx)("p", { className: 'mt-4 rounded-2xl border border-line bg-mist px-4 py-3 text-left text-xs leading-5 text-ink/60', children: detail })) : null, children ? (0, jsx_runtime_1.jsx)("div", { className: 'mt-5 flex justify-center', children: children }) : null, actions.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: isInline
|
|
29
29
|
? 'mt-5 flex flex-col justify-center gap-2 sm:flex-row'
|
|
30
|
-
: 'mt-6 flex flex-col gap-2 sm:flex-row', children: actions.map((action) => ((0, jsx_runtime_1.jsx)("a", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring ps-pressable inline-flex items-center justify-center rounded-ps-control border
|
|
30
|
+
: 'mt-6 flex flex-col gap-2 sm:flex-row', children: actions.map((action) => ((0, jsx_runtime_1.jsx)("a", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring ps-pressable ps-control ps-control-padding inline-flex items-center justify-center rounded-ps-control border border-ps-control text-sm font-semibold', getActionClassName(action.variant)), href: action.href, rel: action.rel, target: action.target, children: action.label }, `${action.href}-${action.label}`))) })) : null] })] }) }) }));
|
|
31
31
|
};
|
|
32
32
|
exports.PsEmptyState = PsEmptyState;
|
|
@@ -9,5 +9,5 @@ const positionClassNames = {
|
|
|
9
9
|
'bottom-left': 'bottom-6 left-6',
|
|
10
10
|
'bottom-center': 'bottom-6 left-1/2 -translate-x-1/2',
|
|
11
11
|
};
|
|
12
|
-
const PsFab = ({ className, position = 'bottom-right', ...props }) => ((0, jsx_runtime_1.jsx)(ps_button_1.PsButton, { size: 'large', variant: 'primary', className: ps_design_system_1.PallasoftClassNameService.merge('!fixed z-docked h-14 w-14 shrink-0 !px-0 shadow-lg', positionClassNames[position], className), ...props }));
|
|
12
|
+
const PsFab = ({ className, position = 'bottom-right', ...props }) => ((0, jsx_runtime_1.jsx)(ps_button_1.PsButton, { size: 'large', variant: 'primary', className: ps_design_system_1.PallasoftClassNameService.merge('!fixed z-docked h-14 w-14 shrink-0 !rounded-full !px-0 shadow-lg', positionClassNames[position], className), ...props }));
|
|
13
13
|
exports.PsFab = PsFab;
|
|
@@ -6,5 +6,5 @@ const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
|
6
6
|
const ps_page_skeleton_config_1 = require("../constants/ps-page-skeleton-config");
|
|
7
7
|
const ps_skeleton_shape_1 = require("../constants/ps-skeleton-shape");
|
|
8
8
|
const ps_skeleton_1 = require("./ps-skeleton");
|
|
9
|
-
const PsFormFieldsSkeleton = ({ columnsClassName = ps_page_skeleton_config_1.PsPageSkeletonConfig.formColumnsClassName, fields = ps_page_skeleton_config_1.PsPageSkeletonConfig.formFields, }) => ((0, jsx_runtime_1.jsx)("div", { className: ps_design_system_1.PallasoftClassNameService.merge('grid gap-4', columnsClassName), children: fields.map((field) => ((0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-col gap-2', children: [(0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: ps_page_skeleton_config_1.PsPageSkeletonConfig.formLabelClassName }), (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-
|
|
9
|
+
const PsFormFieldsSkeleton = ({ columnsClassName = ps_page_skeleton_config_1.PsPageSkeletonConfig.formColumnsClassName, fields = ps_page_skeleton_config_1.PsPageSkeletonConfig.formFields, }) => ((0, jsx_runtime_1.jsx)("div", { className: ps_design_system_1.PallasoftClassNameService.merge('grid gap-4', columnsClassName), children: fields.map((field) => ((0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-col gap-2', children: [(0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: ps_page_skeleton_config_1.PsPageSkeletonConfig.formLabelClassName }), (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-ps-control w-full', shape: ps_skeleton_shape_1.PsSkeletonShape.Block })] }, field))) }));
|
|
10
10
|
exports.PsFormFieldsSkeleton = PsFormFieldsSkeleton;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes } from 'react';
|
|
2
2
|
import { type PsIconKey } from '@pallasoft/ps-icons';
|
|
3
|
+
import type { PsButtonProps } from './ps-button';
|
|
3
4
|
export interface PsIconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
4
5
|
iconKey: PsIconKey;
|
|
5
6
|
label: string;
|
|
7
|
+
size?: PsButtonProps['size'];
|
|
6
8
|
}
|
|
7
|
-
export declare const PsIconButton: ({ className, iconKey, label, type, ...props }: PsIconButtonProps) => import("react").JSX.Element;
|
|
9
|
+
export declare const PsIconButton: ({ className, iconKey, label, size, type, ...props }: PsIconButtonProps) => import("react").JSX.Element;
|
|
@@ -5,5 +5,5 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
6
6
|
const ps_icons_1 = require("@pallasoft/ps-icons");
|
|
7
7
|
const ps_icon_action_config_1 = require("../constants/ps-icon-action-config");
|
|
8
|
-
const PsIconButton = ({ className, iconKey, label, type, ...props }) => ((0, jsx_runtime_1.jsx)("button", { ...props, "aria-label": label, className: ps_design_system_1.PallasoftClassNameService.merge(ps_icon_action_config_1.PsIconActionConfig.className, ps_icon_action_config_1.PsIconActionConfig.disabledClassName, className), title: label, type: type === 'submit' || type === 'reset' ? type : 'button', children: (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: ps_icon_action_config_1.PsIconActionConfig.iconClassName, iconKey: iconKey }) }));
|
|
8
|
+
const PsIconButton = ({ className, iconKey, label, size = 'default', type, ...props }) => ((0, jsx_runtime_1.jsx)("button", { ...props, "aria-label": label, className: ps_design_system_1.PallasoftClassNameService.merge(ps_icon_action_config_1.PsIconActionConfig.className, ps_icon_action_config_1.PsIconActionConfig.sizeClassNames[size], ps_icon_action_config_1.PsIconActionConfig.disabledClassName, className), title: label, type: type === 'submit' || type === 'reset' ? type : 'button', children: (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: ps_icon_action_config_1.PsIconActionConfig.iconClassName, iconKey: iconKey }) }));
|
|
9
9
|
exports.PsIconButton = PsIconButton;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ElementType } from 'react';
|
|
2
2
|
import { type PsIconKey } from '@pallasoft/ps-icons';
|
|
3
|
+
import type { PsButtonProps } from './ps-button';
|
|
3
4
|
export interface PsIconLinkProps {
|
|
4
5
|
className?: string;
|
|
5
6
|
href: string;
|
|
6
7
|
iconKey: PsIconKey;
|
|
7
8
|
label: string;
|
|
8
9
|
LinkComponent?: ElementType;
|
|
10
|
+
size?: PsButtonProps['size'];
|
|
9
11
|
}
|
|
10
|
-
export declare const PsIconLink: ({ className, href, iconKey, label, LinkComponent }: PsIconLinkProps) => import("react").JSX.Element;
|
|
12
|
+
export declare const PsIconLink: ({ className, href, iconKey, label, LinkComponent, size, }: PsIconLinkProps) => import("react").JSX.Element;
|
|
@@ -5,8 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
6
6
|
const ps_icons_1 = require("@pallasoft/ps-icons");
|
|
7
7
|
const ps_icon_action_config_1 = require("../constants/ps-icon-action-config");
|
|
8
|
-
const PsIconLink = ({ className, href, iconKey, label, LinkComponent }) => {
|
|
9
|
-
const linkClassName = ps_design_system_1.PallasoftClassNameService.merge(ps_icon_action_config_1.PsIconActionConfig.className, className);
|
|
8
|
+
const PsIconLink = ({ className, href, iconKey, label, LinkComponent, size = 'default', }) => {
|
|
9
|
+
const linkClassName = ps_design_system_1.PallasoftClassNameService.merge(ps_icon_action_config_1.PsIconActionConfig.className, ps_icon_action_config_1.PsIconActionConfig.sizeClassNames[size], className);
|
|
10
10
|
const icon = ((0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: ps_icon_action_config_1.PsIconActionConfig.iconClassName, iconKey: iconKey }));
|
|
11
11
|
return LinkComponent ? ((0, jsx_runtime_1.jsx)(LinkComponent, { "aria-label": label, className: linkClassName, prefetch: 'intent', title: label, to: href, children: icon })) : ((0, jsx_runtime_1.jsx)("a", { "aria-label": label, className: linkClassName, href: href, title: label, children: icon }));
|
|
12
12
|
};
|
|
@@ -12,5 +12,5 @@ const toneClassNames = {
|
|
|
12
12
|
success: 'bg-emerald-50 text-emerald-700 ring-emerald-100 dark:bg-emerald-400/18 dark:text-emerald-50 dark:ring-emerald-200/22',
|
|
13
13
|
warning: 'bg-amber-50 text-amber-800 ring-amber-100 dark:bg-amber-400/18 dark:text-amber-50 dark:ring-amber-200/24',
|
|
14
14
|
};
|
|
15
|
-
const PsPill = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? ((0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: ps_design_system_1.PallasoftClassNameService.merge('h-8 w-24', className), shape: ps_skeleton_shape_1.PsSkeletonShape.Block })) : ((0, jsx_runtime_1.jsx)("span", { className: ps_design_system_1.PallasoftClassNameService.merge('inline-flex min-h-8 min-w-[5.5rem] max-w-full items-center justify-center rounded-
|
|
15
|
+
const PsPill = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? ((0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: ps_design_system_1.PallasoftClassNameService.merge('h-8 w-24', className), shape: ps_skeleton_shape_1.PsSkeletonShape.Block })) : ((0, jsx_runtime_1.jsx)("span", { className: ps_design_system_1.PallasoftClassNameService.merge('inline-flex min-h-8 min-w-[5.5rem] max-w-full items-center justify-center rounded-ps-control px-5 py-1 text-center text-[0.72rem] font-black capitalize tracking-[0.01em] ring-1 ring-inset', toneClassNames[tone], className), children: (0, jsx_runtime_1.jsx)("span", { className: 'min-w-0 break-words', children: children }) }));
|
|
16
16
|
exports.PsPill = PsPill;
|
|
@@ -5,5 +5,5 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const ps_skeleton_shape_1 = require("../constants/ps-skeleton-shape");
|
|
6
6
|
const ps_skeleton_1 = require("./ps-skeleton");
|
|
7
7
|
const ps_skeleton_group_1 = require("./ps-skeleton-group");
|
|
8
|
-
const PsSectionHeader = ({ description, eyebrow, isLoading = false, leading, title, trailing, }) => isLoading ? ((0, jsx_runtime_1.jsxs)(ps_skeleton_group_1.PsSkeletonGroup, { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', label: title, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [eyebrow ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-2.5 w-24' }) : null, (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-6 w-52' }), description ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-3 w-72' }) : null] }), trailing ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-
|
|
8
|
+
const PsSectionHeader = ({ description, eyebrow, isLoading = false, leading, title, trailing, }) => isLoading ? ((0, jsx_runtime_1.jsxs)(ps_skeleton_group_1.PsSkeletonGroup, { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', label: title, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [eyebrow ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-2.5 w-24' }) : null, (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-6 w-52' }), description ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-3 w-72' }) : null] }), trailing ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-ps-control w-32', shape: ps_skeleton_shape_1.PsSkeletonShape.Block }) : null] })) : ((0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [leading, eyebrow ? ((0, jsx_runtime_1.jsx)("p", { className: 'text-[0.68rem] font-semibold uppercase tracking-[0.22em] text-ink/50', children: eyebrow })) : null, (0, jsx_runtime_1.jsx)("h1", { className: 'break-words text-xl font-extrabold text-ink sm:text-2xl', children: title }), description ? ((0, jsx_runtime_1.jsx)("p", { className: 'max-w-3xl text-sm leading-6 text-ink/60', children: description })) : null] }), trailing ? ((0, jsx_runtime_1.jsx)("div", { className: 'flex w-full shrink-0 items-center justify-end sm:ml-auto sm:w-auto', children: trailing })) : null] }));
|
|
9
9
|
exports.PsSectionHeader = PsSectionHeader;
|
|
@@ -13,6 +13,6 @@ const PsSiteHeader = ({ centerContent, className, homeHref, label, LinkComponent
|
|
|
13
13
|
const renderLogo = (src, darkSrc, baseClassName) => darkSrc ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { alt: logoAlt !== null && logoAlt !== undefined ? logoAlt : label, className: ps_design_system_1.PallasoftClassNameService.merge(baseClassName, 'dark:hidden', logoClassName), decoding: 'async', src: src }), (0, jsx_runtime_1.jsx)("img", { alt: logoAlt !== null && logoAlt !== undefined ? logoAlt : label, className: ps_design_system_1.PallasoftClassNameService.merge(baseClassName, 'hidden dark:block', logoClassName), decoding: 'async', src: darkSrc })] })) : ((0, jsx_runtime_1.jsx)("img", { alt: logoAlt !== null && logoAlt !== undefined ? logoAlt : label, className: ps_design_system_1.PallasoftClassNameService.merge(baseClassName, logoClassName), decoding: 'async', src: src }));
|
|
14
14
|
const logoContent = logoSrcMobile ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: 'hidden sm:contents', children: renderLogo(logoSrc, logoSrcDark, 'h-8 w-auto') }), (0, jsx_runtime_1.jsx)("span", { className: 'contents sm:hidden', children: renderLogo(logoSrcMobile, logoSrcMobileDark, 'h-8 w-auto') }), showLabel ? (0, jsx_runtime_1.jsx)("span", { className: 'text-base font-bold text-ink', children: label }) : null] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderLogo(logoSrc, logoSrcDark, 'h-8 w-auto'), showLabel ? (0, jsx_runtime_1.jsx)("span", { className: 'text-base font-bold text-ink', children: label }) : null] }));
|
|
15
15
|
const logoLink = LinkComponent ? ((0, jsx_runtime_1.jsx)(LinkComponent, { "aria-label": logoLabel, className: logoLinkClassName, prefetch: 'intent', to: homeHref, children: logoContent })) : ((0, jsx_runtime_1.jsx)("a", { "aria-label": logoLabel, className: logoLinkClassName, href: homeHref, children: logoContent }));
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)("header", { ref: headerRef, className: ps_design_system_1.PallasoftClassNameService.merge('fixed inset-x-0 top-0 z-header px-6 pt-4', className), children: (0, jsx_runtime_1.jsxs)("nav", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-glass mx-auto flex max-w-6xl items-center gap-3 rounded-ps-card px-5 py-3', navClassName), children: [onBack ? ((0, jsx_runtime_1.jsx)("button", { "aria-label": 'Back', className: 'ps-focus-ring
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)("header", { ref: headerRef, className: ps_design_system_1.PallasoftClassNameService.merge('fixed inset-x-0 top-0 z-header px-6 pt-4', className), children: (0, jsx_runtime_1.jsxs)("nav", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-glass mx-auto flex max-w-6xl items-center gap-3 rounded-ps-card px-5 py-3', navClassName), children: [onBack ? ((0, jsx_runtime_1.jsx)("button", { "aria-label": 'Back', className: 'ps-focus-ring ps-control-square ps-control-compact flex shrink-0 items-center justify-center rounded-ps-control text-ink md:hidden', onClick: onBack, type: 'button', children: (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { iconKey: ps_icons_1.PsIconKey.ChevronRight, width: 20, height: 20, className: 'rotate-180' }) })) : null, (0, jsx_runtime_1.jsx)("div", { className: onBack ? 'hidden md:flex' : 'contents', children: logoLink }), (0, jsx_runtime_1.jsx)("div", { className: 'flex min-w-0 flex-1 items-center justify-center gap-3', children: centerContent }), trailing ? (0, jsx_runtime_1.jsx)("div", { className: 'flex shrink-0 items-center gap-2.5', children: trailing }) : null] }) }));
|
|
17
17
|
};
|
|
18
18
|
exports.PsSiteHeader = PsSiteHeader;
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PsStartPreview = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const PsStartPreview = ({ badge, children, note, title }) => ((0, jsx_runtime_1.jsxs)("div", { className: 'rounded-2xl border border-line/60 bg-surface/60 p-5', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'mb-4 flex items-center justify-between', children: [(0, jsx_runtime_1.jsx)("span", { className: 'text-sm font-bold text-ink', children: title }), badge === undefined ? null : ((0, jsx_runtime_1.jsx)("span", { className: 'rounded-
|
|
5
|
+
const PsStartPreview = ({ badge, children, note, title }) => ((0, jsx_runtime_1.jsxs)("div", { className: 'rounded-2xl border border-line/60 bg-surface/60 p-5', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'mb-4 flex items-center justify-between', children: [(0, jsx_runtime_1.jsx)("span", { className: 'text-sm font-bold text-ink', children: title }), badge === undefined ? null : ((0, jsx_runtime_1.jsx)("span", { className: 'rounded-ps-control border border-warning/40 px-2.5 py-1 text-xs font-semibold text-warning', children: badge }))] }), (0, jsx_runtime_1.jsx)("ul", { className: 'flex flex-col', children: children }), note === undefined ? null : ((0, jsx_runtime_1.jsx)("p", { className: 'mt-4 border-t border-line/40 pt-4 text-xs leading-5 text-ink/45', children: note }))] }));
|
|
6
6
|
exports.PsStartPreview = PsStartPreview;
|
|
@@ -7,7 +7,7 @@ const ps_theme_toggle_1 = require("./ps-theme-toggle");
|
|
|
7
7
|
const PsThemeController = () => {
|
|
8
8
|
const { resolvedMode, toggle } = (0, use_ps_theme_mode_1.usePsThemeMode)();
|
|
9
9
|
if (resolvedMode === null)
|
|
10
|
-
return (0, jsx_runtime_1.jsx)("div", { className: '
|
|
10
|
+
return (0, jsx_runtime_1.jsx)("div", { className: 'ps-control-square' });
|
|
11
11
|
return (0, jsx_runtime_1.jsx)(ps_theme_toggle_1.PsThemeToggle, { mode: resolvedMode, onClick: toggle });
|
|
12
12
|
};
|
|
13
13
|
exports.PsThemeController = PsThemeController;
|
|
@@ -6,6 +6,6 @@ const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
|
6
6
|
const ps_icons_1 = require("@pallasoft/ps-icons");
|
|
7
7
|
const PsThemeToggle = ({ className, mode, type = 'button', ...props }) => {
|
|
8
8
|
const isDarkMode = mode === ps_design_system_1.PallasoftThemeMode.Dark;
|
|
9
|
-
return ((0, jsx_runtime_1.jsxs)("button", { "aria-label": isDarkMode ? 'Switch to light mode' : 'Switch to dark mode', className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring ps-glass
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)("button", { "aria-label": isDarkMode ? 'Switch to light mode' : 'Switch to dark mode', className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring ps-glass ps-control ps-control-padding flex items-center gap-2 rounded-ps-control text-sm font-semibold text-ink transition hover:border-primary/30 hover:text-primary', className), type: type, ...props, children: [(0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { className: 'size-ps-control-icon-standalone', iconKey: isDarkMode ? 'sun' : 'moon' }), (0, jsx_runtime_1.jsx)("span", { className: 'hidden sm:inline', children: ps_design_system_1.PallasoftThemeModeService.getNextMode(mode) === ps_design_system_1.PallasoftThemeMode.Dark ? 'Dark' : 'Light' })] }));
|
|
10
10
|
};
|
|
11
11
|
exports.PsThemeToggle = PsThemeToggle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const PsButtonBaseClassName = "ps-focus-ring relative inline-flex max-w-full items-center justify-center gap-2 rounded-
|
|
1
|
+
export declare const PsButtonBaseClassName = "ps-focus-ring relative inline-flex max-w-full items-center justify-center gap-2 rounded-ps-control border border-ps-control text-center text-sm font-semibold leading-5";
|
|
2
2
|
export declare const PsButtonSizeClassNames: {
|
|
3
3
|
compact: string;
|
|
4
4
|
default: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PsLinkButtonVariantClassNames = exports.PsButtonVariantClassNames = exports.PsButtonSizeClassNames = exports.PsButtonBaseClassName = void 0;
|
|
4
|
-
exports.PsButtonBaseClassName = 'ps-focus-ring relative inline-flex max-w-full items-center justify-center gap-2 rounded-
|
|
4
|
+
exports.PsButtonBaseClassName = 'ps-focus-ring relative inline-flex max-w-full items-center justify-center gap-2 rounded-ps-control border border-ps-control text-center text-sm font-semibold leading-5';
|
|
5
5
|
exports.PsButtonSizeClassNames = {
|
|
6
|
-
compact: 'ps-control-compact
|
|
7
|
-
default: 'ps-control ps-control-padding
|
|
8
|
-
large: 'ps-control-large
|
|
6
|
+
compact: 'ps-control-compact ps-control-padding-compact',
|
|
7
|
+
default: 'ps-control ps-control-padding',
|
|
8
|
+
large: 'ps-control-large ps-control-padding-large',
|
|
9
9
|
};
|
|
10
10
|
exports.PsButtonVariantClassNames = {
|
|
11
11
|
danger: 'border-danger bg-danger text-white enabled:hover:opacity-90',
|
|
@@ -9,7 +9,7 @@ export declare const PsDragConfig: {
|
|
|
9
9
|
readonly touchTolerance: 6;
|
|
10
10
|
};
|
|
11
11
|
export declare const PsDragClasses: {
|
|
12
|
-
readonly handle: "ps-focus-ring inline-flex h-7 w-7 shrink-0 cursor-grab touch-none items-center justify-center rounded-
|
|
12
|
+
readonly handle: "ps-focus-ring inline-flex h-7 w-7 shrink-0 cursor-grab touch-none items-center justify-center rounded-ps-control text-slate-400/70 transition hover:bg-white/36 hover:text-slate-600 active:cursor-grabbing dark:text-slate-300/55 dark:hover:bg-white/8 dark:hover:text-slate-100";
|
|
13
13
|
readonly listItem: "min-w-0";
|
|
14
14
|
readonly lifted: "cursor-grabbing rounded-xl bg-surface ring-1 ring-primary/30";
|
|
15
15
|
readonly placeholder: "outline-dashed outline-2 outline-offset-[-2px] outline-primary/35";
|
|
@@ -12,7 +12,7 @@ exports.PsDragConfig = {
|
|
|
12
12
|
touchTolerance: 6,
|
|
13
13
|
};
|
|
14
14
|
exports.PsDragClasses = {
|
|
15
|
-
handle: 'ps-focus-ring inline-flex h-7 w-7 shrink-0 cursor-grab touch-none items-center justify-center rounded-
|
|
15
|
+
handle: 'ps-focus-ring inline-flex h-7 w-7 shrink-0 cursor-grab touch-none items-center justify-center rounded-ps-control text-slate-400/70 transition hover:bg-white/36 hover:text-slate-600 active:cursor-grabbing dark:text-slate-300/55 dark:hover:bg-white/8 dark:hover:text-slate-100',
|
|
16
16
|
listItem: 'min-w-0',
|
|
17
17
|
lifted: 'cursor-grabbing rounded-xl bg-surface ring-1 ring-primary/30',
|
|
18
18
|
placeholder: 'outline-dashed outline-2 outline-offset-[-2px] outline-primary/35',
|
|
@@ -9,7 +9,7 @@ export declare const PsDraggableGridConfig: {
|
|
|
9
9
|
readonly touchTolerance: 6;
|
|
10
10
|
};
|
|
11
11
|
export declare const PsDraggableGridClasses: {
|
|
12
|
-
readonly handle: "ps-focus-ring inline-flex h-7 w-7 shrink-0 cursor-grab touch-none items-center justify-center rounded-
|
|
12
|
+
readonly handle: "ps-focus-ring inline-flex h-7 w-7 shrink-0 cursor-grab touch-none items-center justify-center rounded-ps-control text-slate-400/70 transition hover:bg-white/36 hover:text-slate-600 active:cursor-grabbing dark:text-slate-300/55 dark:hover:bg-white/8 dark:hover:text-slate-100";
|
|
13
13
|
readonly item: "min-w-0 rounded-[1.7rem]";
|
|
14
14
|
readonly lifted: "cursor-grabbing rounded-[1.7rem] ring-1 ring-primary/30";
|
|
15
15
|
readonly placeholder: "rounded-[1.7rem] outline-dashed outline-2 outline-offset-[-2px] outline-primary/35";
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PsIconActionConfig = void 0;
|
|
4
4
|
exports.PsIconActionConfig = {
|
|
5
|
-
className: 'ps-focus-ring relative inline-flex
|
|
5
|
+
className: 'ps-focus-ring ps-control-square relative inline-flex shrink-0 items-center justify-center rounded-ps-control text-ink/65 transition-colors hover:bg-ink/5 hover:text-ink',
|
|
6
6
|
disabledClassName: 'disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent',
|
|
7
|
-
iconClassName: 'block
|
|
7
|
+
iconClassName: 'block size-ps-control-icon-standalone shrink-0',
|
|
8
|
+
sizeClassNames: {
|
|
9
|
+
compact: 'ps-control-compact',
|
|
10
|
+
default: '',
|
|
11
|
+
large: 'ps-control-large',
|
|
12
|
+
},
|
|
8
13
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export declare const PsPallasoftSignInClasses: {
|
|
2
|
-
readonly base: "ps-focus-ring ps-liquid ps-liquid-control group relative inline-flex max-w-full items-center justify-center gap-3 rounded-
|
|
2
|
+
readonly base: "ps-focus-ring ps-liquid ps-liquid-control group relative inline-flex max-w-full items-center justify-center gap-3 rounded-ps-control border border-line bg-white font-semibold text-ink shadow-sm transition duration-200 hover:-translate-y-px hover:border-primary/40 hover:shadow-md active:translate-y-0 motion-reduce:transition-none motion-reduce:hover:translate-y-0 dark:border-white/15 dark:bg-white/10 dark:text-white dark:hover:border-white/30";
|
|
3
3
|
readonly sizes: {
|
|
4
|
-
readonly default: "ps-control
|
|
5
|
-
readonly large: "ps-control-large
|
|
4
|
+
readonly default: "ps-control ps-control-padding text-sm";
|
|
5
|
+
readonly large: "ps-control-large ps-control-padding-large text-sm";
|
|
6
6
|
};
|
|
7
7
|
readonly markSizes: {
|
|
8
|
-
readonly default: "
|
|
9
|
-
readonly large: "
|
|
8
|
+
readonly default: "size-ps-control-icon-standalone";
|
|
9
|
+
readonly large: "size-ps-control-icon-standalone";
|
|
10
10
|
};
|
|
11
11
|
};
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PsPallasoftSignInClasses = void 0;
|
|
4
4
|
exports.PsPallasoftSignInClasses = {
|
|
5
|
-
base: 'ps-focus-ring ps-liquid ps-liquid-control group relative inline-flex max-w-full items-center justify-center gap-3 rounded-
|
|
5
|
+
base: 'ps-focus-ring ps-liquid ps-liquid-control group relative inline-flex max-w-full items-center justify-center gap-3 rounded-ps-control border border-line bg-white font-semibold text-ink shadow-sm transition duration-200 hover:-translate-y-px hover:border-primary/40 hover:shadow-md active:translate-y-0 motion-reduce:transition-none motion-reduce:hover:translate-y-0 dark:border-white/15 dark:bg-white/10 dark:text-white dark:hover:border-white/30',
|
|
6
6
|
sizes: {
|
|
7
|
-
default: 'ps-control
|
|
8
|
-
large: 'ps-control-large
|
|
7
|
+
default: 'ps-control ps-control-padding text-sm',
|
|
8
|
+
large: 'ps-control-large ps-control-padding-large text-sm',
|
|
9
9
|
},
|
|
10
10
|
markSizes: {
|
|
11
|
-
default: '
|
|
12
|
-
large: '
|
|
11
|
+
default: 'size-ps-control-icon-standalone',
|
|
12
|
+
large: 'size-ps-control-icon-standalone',
|
|
13
13
|
},
|
|
14
14
|
};
|
|
@@ -19,7 +19,7 @@ exports.PsSkeletonConfig = {
|
|
|
19
19
|
[ps_skeleton_shape_1.PsSkeletonShape.Text]: 'rounded-full',
|
|
20
20
|
},
|
|
21
21
|
shapeSizes: {
|
|
22
|
-
[ps_skeleton_shape_1.PsSkeletonShape.Block]: { height: 'h-
|
|
22
|
+
[ps_skeleton_shape_1.PsSkeletonShape.Block]: { height: 'h-ps-control', width: 'w-full' },
|
|
23
23
|
[ps_skeleton_shape_1.PsSkeletonShape.Circle]: { height: 'h-9', width: 'w-9' },
|
|
24
24
|
[ps_skeleton_shape_1.PsSkeletonShape.Line]: { height: 'h-3', width: 'w-full' },
|
|
25
25
|
[ps_skeleton_shape_1.PsSkeletonShape.Text]: { height: 'h-3', width: 'w-full' },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { PsIcon, PsIconKey } from '@pallasoft/ps-icons';
|
|
3
3
|
import { PsPill } from './ps-pill';
|
|
4
|
-
export const PsActiveFilterChip = ({ id, label, onRemove, removeLabel, }) => (_jsx("button", { "aria-label": removeLabel, className: 'ps-focus-ring shrink-0 rounded-
|
|
4
|
+
export const PsActiveFilterChip = ({ id, label, onRemove, removeLabel, }) => (_jsx("button", { "aria-label": removeLabel, className: 'ps-focus-ring shrink-0 rounded-ps-control', id: id, onClick: onRemove, type: 'button', children: _jsx(PsPill, { className: 'pr-2', tone: 'primary', children: _jsxs("span", { className: 'flex items-center gap-1.5', children: [label, _jsx(PsIcon, { className: 'h-3 w-3', iconKey: PsIconKey.Close })] }) }) }));
|
|
@@ -9,4 +9,4 @@ const toneClassNames = {
|
|
|
9
9
|
success: 'bg-success-soft text-emerald-700 dark:bg-emerald-400/18 dark:text-emerald-50',
|
|
10
10
|
warning: 'bg-warning-soft text-amber-800 dark:bg-amber-400/18 dark:text-amber-50',
|
|
11
11
|
};
|
|
12
|
-
export const PsBadge = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? (_jsx(PsSkeleton, { className: PallasoftClassNameService.merge('h-7 w-20', className), shape: PsSkeletonShape.Block })) : (_jsx("span", { className: PallasoftClassNameService.merge('inline-flex min-h-7 w-fit items-center justify-center whitespace-nowrap rounded-
|
|
12
|
+
export const PsBadge = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? (_jsx(PsSkeleton, { className: PallasoftClassNameService.merge('h-7 w-20', className), shape: PsSkeletonShape.Block })) : (_jsx("span", { className: PallasoftClassNameService.merge('inline-flex min-h-7 w-fit items-center justify-center whitespace-nowrap rounded-ps-control px-3 py-0.5 text-center text-xs font-semibold capitalize', toneClassNames[tone], className), children: children }));
|
|
@@ -24,5 +24,5 @@ export const PsEmptyState = ({ actions = [], badge, children, className, detail,
|
|
|
24
24
|
? 'mt-1.5 text-sm leading-6 text-ink/60'
|
|
25
25
|
: 'mt-3 text-sm leading-6 text-ink/60', children: description })) : null, detail ? (_jsx("p", { className: 'mt-4 rounded-2xl border border-line bg-mist px-4 py-3 text-left text-xs leading-5 text-ink/60', children: detail })) : null, children ? _jsx("div", { className: 'mt-5 flex justify-center', children: children }) : null, actions.length > 0 ? (_jsx("div", { className: isInline
|
|
26
26
|
? 'mt-5 flex flex-col justify-center gap-2 sm:flex-row'
|
|
27
|
-
: 'mt-6 flex flex-col gap-2 sm:flex-row', children: actions.map((action) => (_jsx("a", { className: PallasoftClassNameService.merge('ps-focus-ring ps-pressable inline-flex items-center justify-center rounded-ps-control border
|
|
27
|
+
: 'mt-6 flex flex-col gap-2 sm:flex-row', children: actions.map((action) => (_jsx("a", { className: PallasoftClassNameService.merge('ps-focus-ring ps-pressable ps-control ps-control-padding inline-flex items-center justify-center rounded-ps-control border border-ps-control text-sm font-semibold', getActionClassName(action.variant)), href: action.href, rel: action.rel, target: action.target, children: action.label }, `${action.href}-${action.label}`))) })) : null] })] }) }) }));
|
|
28
28
|
};
|
|
@@ -6,4 +6,4 @@ const positionClassNames = {
|
|
|
6
6
|
'bottom-left': 'bottom-6 left-6',
|
|
7
7
|
'bottom-center': 'bottom-6 left-1/2 -translate-x-1/2',
|
|
8
8
|
};
|
|
9
|
-
export const PsFab = ({ className, position = 'bottom-right', ...props }) => (_jsx(PsButton, { size: 'large', variant: 'primary', className: PallasoftClassNameService.merge('!fixed z-docked h-14 w-14 shrink-0 !px-0 shadow-lg', positionClassNames[position], className), ...props }));
|
|
9
|
+
export const PsFab = ({ className, position = 'bottom-right', ...props }) => (_jsx(PsButton, { size: 'large', variant: 'primary', className: PallasoftClassNameService.merge('!fixed z-docked h-14 w-14 shrink-0 !rounded-full !px-0 shadow-lg', positionClassNames[position], className), ...props }));
|
|
@@ -3,4 +3,4 @@ import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
|
|
|
3
3
|
import { PsPageSkeletonConfig } from '../constants/ps-page-skeleton-config';
|
|
4
4
|
import { PsSkeletonShape } from '../constants/ps-skeleton-shape';
|
|
5
5
|
import { PsSkeleton } from './ps-skeleton';
|
|
6
|
-
export const PsFormFieldsSkeleton = ({ columnsClassName = PsPageSkeletonConfig.formColumnsClassName, fields = PsPageSkeletonConfig.formFields, }) => (_jsx("div", { className: PallasoftClassNameService.merge('grid gap-4', columnsClassName), children: fields.map((field) => (_jsxs("div", { className: 'flex flex-col gap-2', children: [_jsx(PsSkeleton, { className: PsPageSkeletonConfig.formLabelClassName }), _jsx(PsSkeleton, { className: 'h-
|
|
6
|
+
export const PsFormFieldsSkeleton = ({ columnsClassName = PsPageSkeletonConfig.formColumnsClassName, fields = PsPageSkeletonConfig.formFields, }) => (_jsx("div", { className: PallasoftClassNameService.merge('grid gap-4', columnsClassName), children: fields.map((field) => (_jsxs("div", { className: 'flex flex-col gap-2', children: [_jsx(PsSkeleton, { className: PsPageSkeletonConfig.formLabelClassName }), _jsx(PsSkeleton, { className: 'h-ps-control w-full', shape: PsSkeletonShape.Block })] }, field))) }));
|
|
@@ -2,4 +2,4 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
|
|
3
3
|
import { PsIcon } from '@pallasoft/ps-icons';
|
|
4
4
|
import { PsIconActionConfig } from '../constants/ps-icon-action-config';
|
|
5
|
-
export const PsIconButton = ({ className, iconKey, label, type, ...props }) => (_jsx("button", { ...props, "aria-label": label, className: PallasoftClassNameService.merge(PsIconActionConfig.className, PsIconActionConfig.disabledClassName, className), title: label, type: type === 'submit' || type === 'reset' ? type : 'button', children: _jsx(PsIcon, { "aria-hidden": 'true', className: PsIconActionConfig.iconClassName, iconKey: iconKey }) }));
|
|
5
|
+
export const PsIconButton = ({ className, iconKey, label, size = 'default', type, ...props }) => (_jsx("button", { ...props, "aria-label": label, className: PallasoftClassNameService.merge(PsIconActionConfig.className, PsIconActionConfig.sizeClassNames[size], PsIconActionConfig.disabledClassName, className), title: label, type: type === 'submit' || type === 'reset' ? type : 'button', children: _jsx(PsIcon, { "aria-hidden": 'true', className: PsIconActionConfig.iconClassName, iconKey: iconKey }) }));
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
|
|
3
3
|
import { PsIcon } from '@pallasoft/ps-icons';
|
|
4
4
|
import { PsIconActionConfig } from '../constants/ps-icon-action-config';
|
|
5
|
-
export const PsIconLink = ({ className, href, iconKey, label, LinkComponent }) => {
|
|
6
|
-
const linkClassName = PallasoftClassNameService.merge(PsIconActionConfig.className, className);
|
|
5
|
+
export const PsIconLink = ({ className, href, iconKey, label, LinkComponent, size = 'default', }) => {
|
|
6
|
+
const linkClassName = PallasoftClassNameService.merge(PsIconActionConfig.className, PsIconActionConfig.sizeClassNames[size], className);
|
|
7
7
|
const icon = (_jsx(PsIcon, { "aria-hidden": 'true', className: PsIconActionConfig.iconClassName, iconKey: iconKey }));
|
|
8
8
|
return LinkComponent ? (_jsx(LinkComponent, { "aria-label": label, className: linkClassName, prefetch: 'intent', title: label, to: href, children: icon })) : (_jsx("a", { "aria-label": label, className: linkClassName, href: href, title: label, children: icon }));
|
|
9
9
|
};
|
|
@@ -9,4 +9,4 @@ const toneClassNames = {
|
|
|
9
9
|
success: 'bg-emerald-50 text-emerald-700 ring-emerald-100 dark:bg-emerald-400/18 dark:text-emerald-50 dark:ring-emerald-200/22',
|
|
10
10
|
warning: 'bg-amber-50 text-amber-800 ring-amber-100 dark:bg-amber-400/18 dark:text-amber-50 dark:ring-amber-200/24',
|
|
11
11
|
};
|
|
12
|
-
export const PsPill = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? (_jsx(PsSkeleton, { className: PallasoftClassNameService.merge('h-8 w-24', className), shape: PsSkeletonShape.Block })) : (_jsx("span", { className: PallasoftClassNameService.merge('inline-flex min-h-8 min-w-[5.5rem] max-w-full items-center justify-center rounded-
|
|
12
|
+
export const PsPill = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? (_jsx(PsSkeleton, { className: PallasoftClassNameService.merge('h-8 w-24', className), shape: PsSkeletonShape.Block })) : (_jsx("span", { className: PallasoftClassNameService.merge('inline-flex min-h-8 min-w-[5.5rem] max-w-full items-center justify-center rounded-ps-control px-5 py-1 text-center text-[0.72rem] font-black capitalize tracking-[0.01em] ring-1 ring-inset', toneClassNames[tone], className), children: _jsx("span", { className: 'min-w-0 break-words', children: children }) }));
|
|
@@ -2,4 +2,4 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { PsSkeletonShape } from '../constants/ps-skeleton-shape';
|
|
3
3
|
import { PsSkeleton } from './ps-skeleton';
|
|
4
4
|
import { PsSkeletonGroup } from './ps-skeleton-group';
|
|
5
|
-
export const PsSectionHeader = ({ description, eyebrow, isLoading = false, leading, title, trailing, }) => isLoading ? (_jsxs(PsSkeletonGroup, { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', label: title, children: [_jsxs("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [eyebrow ? _jsx(PsSkeleton, { className: 'h-2.5 w-24' }) : null, _jsx(PsSkeleton, { className: 'h-6 w-52' }), description ? _jsx(PsSkeleton, { className: 'h-3 w-72' }) : null] }), trailing ? _jsx(PsSkeleton, { className: 'h-
|
|
5
|
+
export const PsSectionHeader = ({ description, eyebrow, isLoading = false, leading, title, trailing, }) => isLoading ? (_jsxs(PsSkeletonGroup, { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', label: title, children: [_jsxs("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [eyebrow ? _jsx(PsSkeleton, { className: 'h-2.5 w-24' }) : null, _jsx(PsSkeleton, { className: 'h-6 w-52' }), description ? _jsx(PsSkeleton, { className: 'h-3 w-72' }) : null] }), trailing ? _jsx(PsSkeleton, { className: 'h-ps-control w-32', shape: PsSkeletonShape.Block }) : null] })) : (_jsxs("div", { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', children: [_jsxs("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [leading, eyebrow ? (_jsx("p", { className: 'text-[0.68rem] font-semibold uppercase tracking-[0.22em] text-ink/50', children: eyebrow })) : null, _jsx("h1", { className: 'break-words text-xl font-extrabold text-ink sm:text-2xl', children: title }), description ? (_jsx("p", { className: 'max-w-3xl text-sm leading-6 text-ink/60', children: description })) : null] }), trailing ? (_jsx("div", { className: 'flex w-full shrink-0 items-center justify-end sm:ml-auto sm:w-auto', children: trailing })) : null] }));
|
|
@@ -10,5 +10,5 @@ export const PsSiteHeader = ({ centerContent, className, homeHref, label, LinkCo
|
|
|
10
10
|
const renderLogo = (src, darkSrc, baseClassName) => darkSrc ? (_jsxs(_Fragment, { children: [_jsx("img", { alt: logoAlt !== null && logoAlt !== undefined ? logoAlt : label, className: PallasoftClassNameService.merge(baseClassName, 'dark:hidden', logoClassName), decoding: 'async', src: src }), _jsx("img", { alt: logoAlt !== null && logoAlt !== undefined ? logoAlt : label, className: PallasoftClassNameService.merge(baseClassName, 'hidden dark:block', logoClassName), decoding: 'async', src: darkSrc })] })) : (_jsx("img", { alt: logoAlt !== null && logoAlt !== undefined ? logoAlt : label, className: PallasoftClassNameService.merge(baseClassName, logoClassName), decoding: 'async', src: src }));
|
|
11
11
|
const logoContent = logoSrcMobile ? (_jsxs(_Fragment, { children: [_jsx("span", { className: 'hidden sm:contents', children: renderLogo(logoSrc, logoSrcDark, 'h-8 w-auto') }), _jsx("span", { className: 'contents sm:hidden', children: renderLogo(logoSrcMobile, logoSrcMobileDark, 'h-8 w-auto') }), showLabel ? _jsx("span", { className: 'text-base font-bold text-ink', children: label }) : null] })) : (_jsxs(_Fragment, { children: [renderLogo(logoSrc, logoSrcDark, 'h-8 w-auto'), showLabel ? _jsx("span", { className: 'text-base font-bold text-ink', children: label }) : null] }));
|
|
12
12
|
const logoLink = LinkComponent ? (_jsx(LinkComponent, { "aria-label": logoLabel, className: logoLinkClassName, prefetch: 'intent', to: homeHref, children: logoContent })) : (_jsx("a", { "aria-label": logoLabel, className: logoLinkClassName, href: homeHref, children: logoContent }));
|
|
13
|
-
return (_jsx("header", { ref: headerRef, className: PallasoftClassNameService.merge('fixed inset-x-0 top-0 z-header px-6 pt-4', className), children: _jsxs("nav", { className: PallasoftClassNameService.merge('ps-glass mx-auto flex max-w-6xl items-center gap-3 rounded-ps-card px-5 py-3', navClassName), children: [onBack ? (_jsx("button", { "aria-label": 'Back', className: 'ps-focus-ring
|
|
13
|
+
return (_jsx("header", { ref: headerRef, className: PallasoftClassNameService.merge('fixed inset-x-0 top-0 z-header px-6 pt-4', className), children: _jsxs("nav", { className: PallasoftClassNameService.merge('ps-glass mx-auto flex max-w-6xl items-center gap-3 rounded-ps-card px-5 py-3', navClassName), children: [onBack ? (_jsx("button", { "aria-label": 'Back', className: 'ps-focus-ring ps-control-square ps-control-compact flex shrink-0 items-center justify-center rounded-ps-control text-ink md:hidden', onClick: onBack, type: 'button', children: _jsx(PsIcon, { iconKey: PsIconKey.ChevronRight, width: 20, height: 20, className: 'rotate-180' }) })) : null, _jsx("div", { className: onBack ? 'hidden md:flex' : 'contents', children: logoLink }), _jsx("div", { className: 'flex min-w-0 flex-1 items-center justify-center gap-3', children: centerContent }), trailing ? _jsx("div", { className: 'flex shrink-0 items-center gap-2.5', children: trailing }) : null] }) }));
|
|
14
14
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const PsStartPreview = ({ badge, children, note, title }) => (_jsxs("div", { className: 'rounded-2xl border border-line/60 bg-surface/60 p-5', children: [_jsxs("div", { className: 'mb-4 flex items-center justify-between', children: [_jsx("span", { className: 'text-sm font-bold text-ink', children: title }), badge === undefined ? null : (_jsx("span", { className: 'rounded-
|
|
2
|
+
export const PsStartPreview = ({ badge, children, note, title }) => (_jsxs("div", { className: 'rounded-2xl border border-line/60 bg-surface/60 p-5', children: [_jsxs("div", { className: 'mb-4 flex items-center justify-between', children: [_jsx("span", { className: 'text-sm font-bold text-ink', children: title }), badge === undefined ? null : (_jsx("span", { className: 'rounded-ps-control border border-warning/40 px-2.5 py-1 text-xs font-semibold text-warning', children: badge }))] }), _jsx("ul", { className: 'flex flex-col', children: children }), note === undefined ? null : (_jsx("p", { className: 'mt-4 border-t border-line/40 pt-4 text-xs leading-5 text-ink/45', children: note }))] }));
|
|
@@ -4,6 +4,6 @@ import { PsThemeToggle } from './ps-theme-toggle';
|
|
|
4
4
|
export const PsThemeController = () => {
|
|
5
5
|
const { resolvedMode, toggle } = usePsThemeMode();
|
|
6
6
|
if (resolvedMode === null)
|
|
7
|
-
return _jsx("div", { className: '
|
|
7
|
+
return _jsx("div", { className: 'ps-control-square' });
|
|
8
8
|
return _jsx(PsThemeToggle, { mode: resolvedMode, onClick: toggle });
|
|
9
9
|
};
|
|
@@ -3,5 +3,5 @@ import { PallasoftClassNameService, PallasoftThemeMode, PallasoftThemeModeServic
|
|
|
3
3
|
import { PsIcon } from '@pallasoft/ps-icons';
|
|
4
4
|
export const PsThemeToggle = ({ className, mode, type = 'button', ...props }) => {
|
|
5
5
|
const isDarkMode = mode === PallasoftThemeMode.Dark;
|
|
6
|
-
return (_jsxs("button", { "aria-label": isDarkMode ? 'Switch to light mode' : 'Switch to dark mode', className: PallasoftClassNameService.merge('ps-focus-ring ps-glass
|
|
6
|
+
return (_jsxs("button", { "aria-label": isDarkMode ? 'Switch to light mode' : 'Switch to dark mode', className: PallasoftClassNameService.merge('ps-focus-ring ps-glass ps-control ps-control-padding flex items-center gap-2 rounded-ps-control text-sm font-semibold text-ink transition hover:border-primary/30 hover:text-primary', className), type: type, ...props, children: [_jsx(PsIcon, { className: 'size-ps-control-icon-standalone', iconKey: isDarkMode ? 'sun' : 'moon' }), _jsx("span", { className: 'hidden sm:inline', children: PallasoftThemeModeService.getNextMode(mode) === PallasoftThemeMode.Dark ? 'Dark' : 'Light' })] }));
|
|
7
7
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export const PsButtonBaseClassName = 'ps-focus-ring relative inline-flex max-w-full items-center justify-center gap-2 rounded-
|
|
1
|
+
export const PsButtonBaseClassName = 'ps-focus-ring relative inline-flex max-w-full items-center justify-center gap-2 rounded-ps-control border border-ps-control text-center text-sm font-semibold leading-5';
|
|
2
2
|
export const PsButtonSizeClassNames = {
|
|
3
|
-
compact: 'ps-control-compact
|
|
4
|
-
default: 'ps-control ps-control-padding
|
|
5
|
-
large: 'ps-control-large
|
|
3
|
+
compact: 'ps-control-compact ps-control-padding-compact',
|
|
4
|
+
default: 'ps-control ps-control-padding',
|
|
5
|
+
large: 'ps-control-large ps-control-padding-large',
|
|
6
6
|
};
|
|
7
7
|
export const PsButtonVariantClassNames = {
|
|
8
8
|
danger: 'border-danger bg-danger text-white enabled:hover:opacity-90',
|
|
@@ -9,7 +9,7 @@ export const PsDragConfig = {
|
|
|
9
9
|
touchTolerance: 6,
|
|
10
10
|
};
|
|
11
11
|
export const PsDragClasses = {
|
|
12
|
-
handle: 'ps-focus-ring inline-flex h-7 w-7 shrink-0 cursor-grab touch-none items-center justify-center rounded-
|
|
12
|
+
handle: 'ps-focus-ring inline-flex h-7 w-7 shrink-0 cursor-grab touch-none items-center justify-center rounded-ps-control text-slate-400/70 transition hover:bg-white/36 hover:text-slate-600 active:cursor-grabbing dark:text-slate-300/55 dark:hover:bg-white/8 dark:hover:text-slate-100',
|
|
13
13
|
listItem: 'min-w-0',
|
|
14
14
|
lifted: 'cursor-grabbing rounded-xl bg-surface ring-1 ring-primary/30',
|
|
15
15
|
placeholder: 'outline-dashed outline-2 outline-offset-[-2px] outline-primary/35',
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export const PsIconActionConfig = {
|
|
2
|
-
className: 'ps-focus-ring relative inline-flex
|
|
2
|
+
className: 'ps-focus-ring ps-control-square relative inline-flex shrink-0 items-center justify-center rounded-ps-control text-ink/65 transition-colors hover:bg-ink/5 hover:text-ink',
|
|
3
3
|
disabledClassName: 'disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent',
|
|
4
|
-
iconClassName: 'block
|
|
4
|
+
iconClassName: 'block size-ps-control-icon-standalone shrink-0',
|
|
5
|
+
sizeClassNames: {
|
|
6
|
+
compact: 'ps-control-compact',
|
|
7
|
+
default: '',
|
|
8
|
+
large: 'ps-control-large',
|
|
9
|
+
},
|
|
5
10
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const PsPallasoftSignInClasses = {
|
|
2
|
-
base: 'ps-focus-ring ps-liquid ps-liquid-control group relative inline-flex max-w-full items-center justify-center gap-3 rounded-
|
|
2
|
+
base: 'ps-focus-ring ps-liquid ps-liquid-control group relative inline-flex max-w-full items-center justify-center gap-3 rounded-ps-control border border-line bg-white font-semibold text-ink shadow-sm transition duration-200 hover:-translate-y-px hover:border-primary/40 hover:shadow-md active:translate-y-0 motion-reduce:transition-none motion-reduce:hover:translate-y-0 dark:border-white/15 dark:bg-white/10 dark:text-white dark:hover:border-white/30',
|
|
3
3
|
sizes: {
|
|
4
|
-
default: 'ps-control
|
|
5
|
-
large: 'ps-control-large
|
|
4
|
+
default: 'ps-control ps-control-padding text-sm',
|
|
5
|
+
large: 'ps-control-large ps-control-padding-large text-sm',
|
|
6
6
|
},
|
|
7
7
|
markSizes: {
|
|
8
|
-
default: '
|
|
9
|
-
large: '
|
|
8
|
+
default: 'size-ps-control-icon-standalone',
|
|
9
|
+
large: 'size-ps-control-icon-standalone',
|
|
10
10
|
},
|
|
11
11
|
};
|
|
@@ -16,7 +16,7 @@ export const PsSkeletonConfig = {
|
|
|
16
16
|
[PsSkeletonShape.Text]: 'rounded-full',
|
|
17
17
|
},
|
|
18
18
|
shapeSizes: {
|
|
19
|
-
[PsSkeletonShape.Block]: { height: 'h-
|
|
19
|
+
[PsSkeletonShape.Block]: { height: 'h-ps-control', width: 'w-full' },
|
|
20
20
|
[PsSkeletonShape.Circle]: { height: 'h-9', width: 'w-9' },
|
|
21
21
|
[PsSkeletonShape.Line]: { height: 'h-3', width: 'w-full' },
|
|
22
22
|
[PsSkeletonShape.Text]: { height: 'h-3', width: 'w-full' },
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { usePsReducedMotion } from './use-ps-reduced-motion';
|
|
2
3
|
export const usePsExitTransition = (isOpen, durationMs = 180) => {
|
|
3
4
|
const [shouldRender, setShouldRender] = useState(isOpen);
|
|
4
5
|
const [isClosing, setIsClosing] = useState(false);
|
|
5
6
|
const timeoutRef = useRef();
|
|
6
7
|
const hasRenderedRef = useRef(isOpen);
|
|
8
|
+
const isReducedMotion = usePsReducedMotion();
|
|
9
|
+
const exitDurationMs = isReducedMotion ? 0 : durationMs;
|
|
7
10
|
useEffect(() => {
|
|
8
11
|
if (timeoutRef.current)
|
|
9
12
|
clearTimeout(timeoutRef.current);
|
|
@@ -18,12 +21,12 @@ export const usePsExitTransition = (isOpen, durationMs = 180) => {
|
|
|
18
21
|
timeoutRef.current = setTimeout(() => {
|
|
19
22
|
setShouldRender(false);
|
|
20
23
|
setIsClosing(false);
|
|
21
|
-
},
|
|
24
|
+
}, exitDurationMs);
|
|
22
25
|
return () => {
|
|
23
26
|
if (timeoutRef.current)
|
|
24
27
|
clearTimeout(timeoutRef.current);
|
|
25
28
|
};
|
|
26
|
-
}, [isOpen,
|
|
29
|
+
}, [isOpen, exitDurationMs]);
|
|
27
30
|
hasRenderedRef.current = shouldRender;
|
|
28
31
|
return { isClosing, shouldRender };
|
|
29
32
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
export const usePsRestoreFocus = (isActive) => {
|
|
3
|
+
const returnTargetRef = useRef(null);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
if (!isActive)
|
|
6
|
+
return;
|
|
7
|
+
returnTargetRef.current =
|
|
8
|
+
document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
9
|
+
return () => {
|
|
10
|
+
const target = returnTargetRef.current;
|
|
11
|
+
returnTargetRef.current = null;
|
|
12
|
+
if (target && target.isConnected)
|
|
13
|
+
target.focus();
|
|
14
|
+
};
|
|
15
|
+
}, [isActive]);
|
|
16
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { PsScrollLockService } from '../services/ps-scroll-lock-service';
|
|
3
|
+
export const usePsScrollLock = (isLocked) => {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
if (!isLocked)
|
|
6
|
+
return;
|
|
7
|
+
return PsScrollLockService.lock();
|
|
8
|
+
}, [isLocked]);
|
|
9
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -32,6 +32,7 @@ export * from './hooks/use-ps-published-height';
|
|
|
32
32
|
export * from './constants/ps-scaled-preview-config';
|
|
33
33
|
export * from './constants/ps-site-header-config';
|
|
34
34
|
export * from './components/ps-skeleton';
|
|
35
|
+
export * from './services/ps-scroll-lock-service';
|
|
35
36
|
export * from './services/ps-skeleton-class-service';
|
|
36
37
|
export * from './models/ps-skeleton-size';
|
|
37
38
|
export * from './constants/ps-skeleton-shape';
|
|
@@ -45,7 +46,10 @@ export * from './components/ps-spinner';
|
|
|
45
46
|
export * from './components/ps-theme-toggle';
|
|
46
47
|
export * from './components/ps-voice-orb';
|
|
47
48
|
export * from './hooks/use-ps-audio-spectrum';
|
|
49
|
+
export * from './hooks/use-ps-exit-snapshot';
|
|
48
50
|
export * from './hooks/use-ps-exit-transition';
|
|
51
|
+
export * from './hooks/use-ps-restore-focus';
|
|
52
|
+
export * from './hooks/use-ps-scroll-lock';
|
|
49
53
|
export * from './hooks/use-ps-hide-on-scroll';
|
|
50
54
|
export * from './hooks/use-ps-invisible-recaptcha';
|
|
51
55
|
export * from './contexts/ps-layer-context';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class PsScrollLockService {
|
|
2
|
+
static lock() {
|
|
3
|
+
if (typeof document === 'undefined')
|
|
4
|
+
return () => undefined;
|
|
5
|
+
if (PsScrollLockService.count === 0) {
|
|
6
|
+
PsScrollLockService.previousOverflow = document.body.style.overflow;
|
|
7
|
+
document.body.style.overflow = 'hidden';
|
|
8
|
+
}
|
|
9
|
+
PsScrollLockService.count += 1;
|
|
10
|
+
let isReleased = false;
|
|
11
|
+
return () => {
|
|
12
|
+
if (isReleased)
|
|
13
|
+
return;
|
|
14
|
+
isReleased = true;
|
|
15
|
+
PsScrollLockService.count -= 1;
|
|
16
|
+
if (PsScrollLockService.count === 0) {
|
|
17
|
+
document.body.style.overflow = PsScrollLockService.previousOverflow;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
PsScrollLockService.count = 0;
|
|
23
|
+
PsScrollLockService.previousOverflow = '';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usePsExitSnapshot: <T>(isOpen: boolean, value: T) => T;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePsExitSnapshot = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const usePsExitSnapshot = (isOpen, value) => {
|
|
6
|
+
const snapshotRef = (0, react_1.useRef)(value);
|
|
7
|
+
if (isOpen)
|
|
8
|
+
snapshotRef.current = value;
|
|
9
|
+
return snapshotRef.current;
|
|
10
|
+
};
|
|
11
|
+
exports.usePsExitSnapshot = usePsExitSnapshot;
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.usePsExitTransition = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const use_ps_reduced_motion_1 = require("./use-ps-reduced-motion");
|
|
5
6
|
const usePsExitTransition = (isOpen, durationMs = 180) => {
|
|
6
7
|
const [shouldRender, setShouldRender] = (0, react_1.useState)(isOpen);
|
|
7
8
|
const [isClosing, setIsClosing] = (0, react_1.useState)(false);
|
|
8
9
|
const timeoutRef = (0, react_1.useRef)();
|
|
9
10
|
const hasRenderedRef = (0, react_1.useRef)(isOpen);
|
|
11
|
+
const isReducedMotion = (0, use_ps_reduced_motion_1.usePsReducedMotion)();
|
|
12
|
+
const exitDurationMs = isReducedMotion ? 0 : durationMs;
|
|
10
13
|
(0, react_1.useEffect)(() => {
|
|
11
14
|
if (timeoutRef.current)
|
|
12
15
|
clearTimeout(timeoutRef.current);
|
|
@@ -21,12 +24,12 @@ const usePsExitTransition = (isOpen, durationMs = 180) => {
|
|
|
21
24
|
timeoutRef.current = setTimeout(() => {
|
|
22
25
|
setShouldRender(false);
|
|
23
26
|
setIsClosing(false);
|
|
24
|
-
},
|
|
27
|
+
}, exitDurationMs);
|
|
25
28
|
return () => {
|
|
26
29
|
if (timeoutRef.current)
|
|
27
30
|
clearTimeout(timeoutRef.current);
|
|
28
31
|
};
|
|
29
|
-
}, [isOpen,
|
|
32
|
+
}, [isOpen, exitDurationMs]);
|
|
30
33
|
hasRenderedRef.current = shouldRender;
|
|
31
34
|
return { isClosing, shouldRender };
|
|
32
35
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usePsRestoreFocus: (isActive: boolean) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePsRestoreFocus = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const usePsRestoreFocus = (isActive) => {
|
|
6
|
+
const returnTargetRef = (0, react_1.useRef)(null);
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
|
+
if (!isActive)
|
|
9
|
+
return;
|
|
10
|
+
returnTargetRef.current =
|
|
11
|
+
document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
12
|
+
return () => {
|
|
13
|
+
const target = returnTargetRef.current;
|
|
14
|
+
returnTargetRef.current = null;
|
|
15
|
+
if (target && target.isConnected)
|
|
16
|
+
target.focus();
|
|
17
|
+
};
|
|
18
|
+
}, [isActive]);
|
|
19
|
+
};
|
|
20
|
+
exports.usePsRestoreFocus = usePsRestoreFocus;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usePsScrollLock: (isLocked: boolean) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePsScrollLock = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const ps_scroll_lock_service_1 = require("../services/ps-scroll-lock-service");
|
|
6
|
+
const usePsScrollLock = (isLocked) => {
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
|
+
if (!isLocked)
|
|
9
|
+
return;
|
|
10
|
+
return ps_scroll_lock_service_1.PsScrollLockService.lock();
|
|
11
|
+
}, [isLocked]);
|
|
12
|
+
};
|
|
13
|
+
exports.usePsScrollLock = usePsScrollLock;
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export * from './hooks/use-ps-published-height';
|
|
|
32
32
|
export * from './constants/ps-scaled-preview-config';
|
|
33
33
|
export * from './constants/ps-site-header-config';
|
|
34
34
|
export * from './components/ps-skeleton';
|
|
35
|
+
export * from './services/ps-scroll-lock-service';
|
|
35
36
|
export * from './services/ps-skeleton-class-service';
|
|
36
37
|
export * from './models/ps-skeleton-size';
|
|
37
38
|
export * from './constants/ps-skeleton-shape';
|
|
@@ -45,7 +46,10 @@ export * from './components/ps-spinner';
|
|
|
45
46
|
export * from './components/ps-theme-toggle';
|
|
46
47
|
export * from './components/ps-voice-orb';
|
|
47
48
|
export * from './hooks/use-ps-audio-spectrum';
|
|
49
|
+
export * from './hooks/use-ps-exit-snapshot';
|
|
48
50
|
export * from './hooks/use-ps-exit-transition';
|
|
51
|
+
export * from './hooks/use-ps-restore-focus';
|
|
52
|
+
export * from './hooks/use-ps-scroll-lock';
|
|
49
53
|
export * from './hooks/use-ps-hide-on-scroll';
|
|
50
54
|
export * from './hooks/use-ps-invisible-recaptcha';
|
|
51
55
|
export * from './contexts/ps-layer-context';
|
package/dist/index.js
CHANGED
|
@@ -48,6 +48,7 @@ __exportStar(require("./hooks/use-ps-published-height"), exports);
|
|
|
48
48
|
__exportStar(require("./constants/ps-scaled-preview-config"), exports);
|
|
49
49
|
__exportStar(require("./constants/ps-site-header-config"), exports);
|
|
50
50
|
__exportStar(require("./components/ps-skeleton"), exports);
|
|
51
|
+
__exportStar(require("./services/ps-scroll-lock-service"), exports);
|
|
51
52
|
__exportStar(require("./services/ps-skeleton-class-service"), exports);
|
|
52
53
|
__exportStar(require("./models/ps-skeleton-size"), exports);
|
|
53
54
|
__exportStar(require("./constants/ps-skeleton-shape"), exports);
|
|
@@ -61,7 +62,10 @@ __exportStar(require("./components/ps-spinner"), exports);
|
|
|
61
62
|
__exportStar(require("./components/ps-theme-toggle"), exports);
|
|
62
63
|
__exportStar(require("./components/ps-voice-orb"), exports);
|
|
63
64
|
__exportStar(require("./hooks/use-ps-audio-spectrum"), exports);
|
|
65
|
+
__exportStar(require("./hooks/use-ps-exit-snapshot"), exports);
|
|
64
66
|
__exportStar(require("./hooks/use-ps-exit-transition"), exports);
|
|
67
|
+
__exportStar(require("./hooks/use-ps-restore-focus"), exports);
|
|
68
|
+
__exportStar(require("./hooks/use-ps-scroll-lock"), exports);
|
|
65
69
|
__exportStar(require("./hooks/use-ps-hide-on-scroll"), exports);
|
|
66
70
|
__exportStar(require("./hooks/use-ps-invisible-recaptcha"), exports);
|
|
67
71
|
__exportStar(require("./contexts/ps-layer-context"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsScrollLockService = void 0;
|
|
4
|
+
class PsScrollLockService {
|
|
5
|
+
static lock() {
|
|
6
|
+
if (typeof document === 'undefined')
|
|
7
|
+
return () => undefined;
|
|
8
|
+
if (PsScrollLockService.count === 0) {
|
|
9
|
+
PsScrollLockService.previousOverflow = document.body.style.overflow;
|
|
10
|
+
document.body.style.overflow = 'hidden';
|
|
11
|
+
}
|
|
12
|
+
PsScrollLockService.count += 1;
|
|
13
|
+
let isReleased = false;
|
|
14
|
+
return () => {
|
|
15
|
+
if (isReleased)
|
|
16
|
+
return;
|
|
17
|
+
isReleased = true;
|
|
18
|
+
PsScrollLockService.count -= 1;
|
|
19
|
+
if (PsScrollLockService.count === 0) {
|
|
20
|
+
document.body.style.overflow = PsScrollLockService.previousOverflow;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.PsScrollLockService = PsScrollLockService;
|
|
26
|
+
PsScrollLockService.count = 0;
|
|
27
|
+
PsScrollLockService.previousOverflow = '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pallasoft/ps-core-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"@dnd-kit/core": "^6.3.1",
|
|
36
36
|
"@dnd-kit/sortable": "^10.0.0",
|
|
37
37
|
"@dnd-kit/utilities": "^3.2.2",
|
|
38
|
-
"@pallasoft/ps-design-system": "^1.9.0",
|
|
39
38
|
"@pallasoft/ps-icons": "^1.5.4",
|
|
40
39
|
"@pallasoft/ps-motion-components": "^1.2.2",
|
|
41
40
|
"@pallasoft/ps-utilities": "^2.12.0",
|
|
@@ -53,6 +52,7 @@
|
|
|
53
52
|
"@commitlint/config-conventional": "^20.0.0",
|
|
54
53
|
"@eslint/compat": "^2.0.0",
|
|
55
54
|
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
|
|
55
|
+
"@pallasoft/ps-design-system": "^1.14.0",
|
|
56
56
|
"@semantic-release/changelog": "^6.0.3",
|
|
57
57
|
"@semantic-release/commit-analyzer": "^13.0.0",
|
|
58
58
|
"@semantic-release/git": "^10.0.1",
|