@pallasoft/ps-core-components 2.25.0 → 2.26.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-app-store-buttons.d.ts +10 -0
- package/dist/components/ps-app-store-buttons.js +15 -0
- package/dist/components/ps-site-header.js +1 -1
- package/dist/components/ps-store-badge.d.ts +11 -0
- package/dist/components/ps-store-badge.js +23 -0
- 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-store-badge-config.d.ts +50 -0
- package/dist/constants/ps-store-badge-config.js +64 -0
- package/dist/constants/ps-store-platform.d.ts +5 -0
- package/dist/constants/ps-store-platform.js +7 -0
- package/dist/esm/components/ps-app-store-buttons.js +11 -0
- package/dist/esm/components/ps-site-header.js +1 -1
- package/dist/esm/components/ps-store-badge.js +19 -0
- package/dist/esm/constants/ps-drag-config.js +1 -1
- package/dist/esm/constants/ps-store-badge-config.js +61 -0
- package/dist/esm/constants/ps-store-platform.js +4 -0
- package/dist/esm/hooks/use-ps-media-query.js +12 -0
- package/dist/esm/hooks/use-ps-optimistic-rows.js +6 -5
- package/dist/esm/index.js +8 -0
- package/dist/esm/models/ps-store-badge-labels.js +1 -0
- package/dist/esm/models/ps-store-badge-logo-path.js +1 -0
- package/dist/esm/models/ps-store-badge-platform-data.js +1 -0
- package/dist/hooks/use-ps-media-query.d.ts +1 -0
- package/dist/hooks/use-ps-media-query.js +16 -0
- package/dist/hooks/use-ps-optimistic-rows.js +6 -5
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/models/ps-store-badge-labels.d.ts +4 -0
- package/dist/models/ps-store-badge-labels.js +2 -0
- package/dist/models/ps-store-badge-logo-path.d.ts +4 -0
- package/dist/models/ps-store-badge-logo-path.js +2 -0
- package/dist/models/ps-store-badge-platform-data.d.ts +6 -0
- package/dist/models/ps-store-badge-platform-data.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PsStoreBadgeLabels } from '../models/ps-store-badge-labels';
|
|
2
|
+
export interface PsAppStoreButtonsProps {
|
|
3
|
+
appStoreLabels?: PsStoreBadgeLabels;
|
|
4
|
+
appStoreUrl?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
playStoreLabels?: PsStoreBadgeLabels;
|
|
7
|
+
playStoreUrl?: string;
|
|
8
|
+
size?: 'default' | 'large';
|
|
9
|
+
}
|
|
10
|
+
export declare const PsAppStoreButtons: ({ appStoreLabels, appStoreUrl, className, playStoreLabels, playStoreUrl, size, }: PsAppStoreButtonsProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsAppStoreButtons = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
6
|
+
const ps_store_badge_config_1 = require("../constants/ps-store-badge-config");
|
|
7
|
+
const ps_store_platform_1 = require("../constants/ps-store-platform");
|
|
8
|
+
const ps_store_badge_1 = require("./ps-store-badge");
|
|
9
|
+
const isLinked = (url) => url !== undefined && url.trim() !== '';
|
|
10
|
+
const PsAppStoreButtons = ({ appStoreLabels, appStoreUrl, className, playStoreLabels, playStoreUrl, size = 'default', }) => {
|
|
11
|
+
const appStoreHref = isLinked(appStoreUrl) ? appStoreUrl : undefined;
|
|
12
|
+
const playStoreHref = isLinked(playStoreUrl) ? playStoreUrl : undefined;
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: ps_design_system_1.PallasoftClassNameService.merge(ps_store_badge_config_1.PsStoreBadgeClasses.group, ps_store_badge_config_1.PsStoreBadgeClasses.sizes[size].gap, className), children: [(0, jsx_runtime_1.jsx)(ps_store_badge_1.PsStoreBadge, { href: appStoreHref, labels: appStoreLabels, platform: ps_store_platform_1.PsStorePlatform.appStore, size: size }), (0, jsx_runtime_1.jsx)(ps_store_badge_1.PsStoreBadge, { href: playStoreHref, labels: playStoreLabels, platform: ps_store_platform_1.PsStorePlatform.googlePlay, size: size })] }));
|
|
14
|
+
};
|
|
15
|
+
exports.PsAppStoreButtons = PsAppStoreButtons;
|
|
@@ -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-
|
|
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-4 pt-[max(1rem,env(safe-area-inset-top))] sm:px-6', 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;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PsStorePlatform } from '../constants/ps-store-platform';
|
|
2
|
+
import type { PsStoreBadgeLabels } from '../models/ps-store-badge-labels';
|
|
3
|
+
export interface PsStoreBadgeProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
onPress?: () => void;
|
|
7
|
+
labels?: PsStoreBadgeLabels;
|
|
8
|
+
platform: PsStorePlatform;
|
|
9
|
+
size?: 'default' | 'large';
|
|
10
|
+
}
|
|
11
|
+
export declare const PsStoreBadge: ({ className, href, labels, onPress, platform, size, }: PsStoreBadgeProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsStoreBadge = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
6
|
+
const ps_store_badge_config_1 = require("../constants/ps-store-badge-config");
|
|
7
|
+
const PsStoreBadge = ({ className, href, labels, onPress, platform, size = 'default', }) => {
|
|
8
|
+
const platformData = ps_store_badge_config_1.PsStoreBadgeConfig.platforms[platform];
|
|
9
|
+
const shownLabels = labels === undefined ? platformData.labels : labels;
|
|
10
|
+
const sizeClasses = ps_store_badge_config_1.PsStoreBadgeClasses.sizes[size];
|
|
11
|
+
const badgeClassName = ps_design_system_1.PallasoftClassNameService.merge(ps_store_badge_config_1.PsStoreBadgeClasses.base, sizeClasses.badge, className);
|
|
12
|
+
const badgeStyle = {
|
|
13
|
+
backgroundColor: ps_store_badge_config_1.PsStoreBadgeConfig.colors.background,
|
|
14
|
+
borderColor: ps_store_badge_config_1.PsStoreBadgeConfig.colors.border,
|
|
15
|
+
color: ps_store_badge_config_1.PsStoreBadgeConfig.colors.text,
|
|
16
|
+
};
|
|
17
|
+
const ariaLabel = `${shownLabels.caption} ${shownLabels.name}`;
|
|
18
|
+
const content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("svg", { "aria-hidden": 'true', className: ps_design_system_1.PallasoftClassNameService.merge('shrink-0', sizeClasses.logo), viewBox: ps_store_badge_config_1.PsStoreBadgeConfig.logoViewBox, xmlns: 'http://www.w3.org/2000/svg', children: platformData.logoPaths.map((path) => ((0, jsx_runtime_1.jsx)("path", { d: path.d, fill: path.fill }, path.d))) }), (0, jsx_runtime_1.jsxs)("span", { "aria-hidden": 'true', className: 'flex min-w-0 flex-col items-start gap-0.5', children: [(0, jsx_runtime_1.jsx)("span", { className: ps_design_system_1.PallasoftClassNameService.merge('whitespace-nowrap', sizeClasses.caption), children: shownLabels.caption }), (0, jsx_runtime_1.jsx)("span", { className: ps_design_system_1.PallasoftClassNameService.merge('whitespace-nowrap', sizeClasses.name), children: shownLabels.name })] })] }));
|
|
19
|
+
if (href === undefined)
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)("button", { "aria-label": ariaLabel, className: badgeClassName, "data-platform": platform, onClick: onPress, style: badgeStyle, type: 'button', children: content }));
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)("a", { "aria-label": ariaLabel, className: badgeClassName, "data-platform": platform, href: href, rel: 'noopener noreferrer', style: badgeStyle, target: '_blank', children: content }));
|
|
22
|
+
};
|
|
23
|
+
exports.PsStoreBadge = PsStoreBadge;
|
|
@@ -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-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";
|
|
12
|
+
readonly handle: "ps-focus-ring ps-touch-target relative 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-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',
|
|
15
|
+
handle: 'ps-focus-ring ps-touch-target relative 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-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";
|
|
12
|
+
readonly handle: "ps-focus-ring ps-touch-target relative 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";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const PsStoreBadgeConfig: {
|
|
2
|
+
readonly colors: {
|
|
3
|
+
readonly background: "#000000";
|
|
4
|
+
readonly border: "#A6A6A6";
|
|
5
|
+
readonly text: "#FFFFFF";
|
|
6
|
+
};
|
|
7
|
+
readonly logoViewBox: "0 0 24 24";
|
|
8
|
+
readonly platforms: {
|
|
9
|
+
"app-store": {
|
|
10
|
+
labels: {
|
|
11
|
+
caption: string;
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
logoPaths: {
|
|
15
|
+
d: string;
|
|
16
|
+
fill: string;
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
19
|
+
"google-play": {
|
|
20
|
+
labels: {
|
|
21
|
+
caption: string;
|
|
22
|
+
name: string;
|
|
23
|
+
};
|
|
24
|
+
logoPaths: {
|
|
25
|
+
d: string;
|
|
26
|
+
fill: string;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare const PsStoreBadgeClasses: {
|
|
32
|
+
readonly base: "ps-focus-ring inline-flex shrink-0 items-center rounded-lg border font-sans leading-none transition-opacity hover:opacity-85 motion-reduce:transition-none";
|
|
33
|
+
readonly group: "flex flex-wrap items-center";
|
|
34
|
+
readonly sizes: {
|
|
35
|
+
readonly default: {
|
|
36
|
+
readonly badge: "h-11 min-w-[8.25rem] gap-2 px-3";
|
|
37
|
+
readonly caption: "text-[0.625rem]";
|
|
38
|
+
readonly gap: "gap-3";
|
|
39
|
+
readonly logo: "size-6";
|
|
40
|
+
readonly name: "text-lg font-semibold tracking-tight";
|
|
41
|
+
};
|
|
42
|
+
readonly large: {
|
|
43
|
+
readonly badge: "h-14 min-w-[10.5rem] gap-2.5 px-4";
|
|
44
|
+
readonly caption: "text-xs";
|
|
45
|
+
readonly gap: "gap-4";
|
|
46
|
+
readonly logo: "size-8";
|
|
47
|
+
readonly name: "text-2xl font-semibold tracking-tight";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsStoreBadgeClasses = exports.PsStoreBadgeConfig = void 0;
|
|
4
|
+
const ps_store_platform_1 = require("./ps-store-platform");
|
|
5
|
+
exports.PsStoreBadgeConfig = {
|
|
6
|
+
colors: {
|
|
7
|
+
background: '#000000',
|
|
8
|
+
border: '#A6A6A6',
|
|
9
|
+
text: '#FFFFFF',
|
|
10
|
+
},
|
|
11
|
+
logoViewBox: '0 0 24 24',
|
|
12
|
+
platforms: {
|
|
13
|
+
[ps_store_platform_1.PsStorePlatform.appStore]: {
|
|
14
|
+
labels: { caption: 'Download on the', name: 'App Store' },
|
|
15
|
+
logoPaths: [
|
|
16
|
+
{
|
|
17
|
+
d: 'M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701',
|
|
18
|
+
fill: '#FFFFFF',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
[ps_store_platform_1.PsStorePlatform.googlePlay]: {
|
|
23
|
+
labels: { caption: 'GET IT ON', name: 'Google Play' },
|
|
24
|
+
logoPaths: [
|
|
25
|
+
{
|
|
26
|
+
d: 'M1.337.924a1.486 1.486 0 0 0-.112.568v21.017c0 .217.045.419.124.6l11.155-11.087L1.337.924z',
|
|
27
|
+
fill: '#4285F4',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
d: 'M13.544 10.989l3.258-3.238L3.45.195a1.466 1.466 0 0 0-.946-.179l11.04 10.973z',
|
|
31
|
+
fill: '#34A853',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
d: 'M22.018 13.298l-3.919 2.218-3.515-3.493 3.543-3.521 3.891 2.202a1.49 1.49 0 0 1 0 2.594z',
|
|
35
|
+
fill: '#FBBC04',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
d: 'M13.544 13.056l-11 10.933c.298.036.612-.016.906-.183l13.324-7.54-3.23-3.21z',
|
|
39
|
+
fill: '#EA4335',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
exports.PsStoreBadgeClasses = {
|
|
46
|
+
base: 'ps-focus-ring inline-flex shrink-0 items-center rounded-lg border font-sans leading-none transition-opacity hover:opacity-85 motion-reduce:transition-none',
|
|
47
|
+
group: 'flex flex-wrap items-center',
|
|
48
|
+
sizes: {
|
|
49
|
+
default: {
|
|
50
|
+
badge: 'h-11 min-w-[8.25rem] gap-2 px-3',
|
|
51
|
+
caption: 'text-[0.625rem]',
|
|
52
|
+
gap: 'gap-3',
|
|
53
|
+
logo: 'size-6',
|
|
54
|
+
name: 'text-lg font-semibold tracking-tight',
|
|
55
|
+
},
|
|
56
|
+
large: {
|
|
57
|
+
badge: 'h-14 min-w-[10.5rem] gap-2.5 px-4',
|
|
58
|
+
caption: 'text-xs',
|
|
59
|
+
gap: 'gap-4',
|
|
60
|
+
logo: 'size-8',
|
|
61
|
+
name: 'text-2xl font-semibold tracking-tight',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
|
|
3
|
+
import { PsStoreBadgeClasses } from '../constants/ps-store-badge-config';
|
|
4
|
+
import { PsStorePlatform } from '../constants/ps-store-platform';
|
|
5
|
+
import { PsStoreBadge } from './ps-store-badge';
|
|
6
|
+
const isLinked = (url) => url !== undefined && url.trim() !== '';
|
|
7
|
+
export const PsAppStoreButtons = ({ appStoreLabels, appStoreUrl, className, playStoreLabels, playStoreUrl, size = 'default', }) => {
|
|
8
|
+
const appStoreHref = isLinked(appStoreUrl) ? appStoreUrl : undefined;
|
|
9
|
+
const playStoreHref = isLinked(playStoreUrl) ? playStoreUrl : undefined;
|
|
10
|
+
return (_jsxs("div", { className: PallasoftClassNameService.merge(PsStoreBadgeClasses.group, PsStoreBadgeClasses.sizes[size].gap, className), children: [_jsx(PsStoreBadge, { href: appStoreHref, labels: appStoreLabels, platform: PsStorePlatform.appStore, size: size }), _jsx(PsStoreBadge, { href: playStoreHref, labels: playStoreLabels, platform: PsStorePlatform.googlePlay, size: size })] }));
|
|
11
|
+
};
|
|
@@ -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-
|
|
13
|
+
return (_jsx("header", { ref: headerRef, className: PallasoftClassNameService.merge('fixed inset-x-0 top-0 z-header px-4 pt-[max(1rem,env(safe-area-inset-top))] sm:px-6', 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
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
|
|
3
|
+
import { PsStoreBadgeClasses, PsStoreBadgeConfig } from '../constants/ps-store-badge-config';
|
|
4
|
+
export const PsStoreBadge = ({ className, href, labels, onPress, platform, size = 'default', }) => {
|
|
5
|
+
const platformData = PsStoreBadgeConfig.platforms[platform];
|
|
6
|
+
const shownLabels = labels === undefined ? platformData.labels : labels;
|
|
7
|
+
const sizeClasses = PsStoreBadgeClasses.sizes[size];
|
|
8
|
+
const badgeClassName = PallasoftClassNameService.merge(PsStoreBadgeClasses.base, sizeClasses.badge, className);
|
|
9
|
+
const badgeStyle = {
|
|
10
|
+
backgroundColor: PsStoreBadgeConfig.colors.background,
|
|
11
|
+
borderColor: PsStoreBadgeConfig.colors.border,
|
|
12
|
+
color: PsStoreBadgeConfig.colors.text,
|
|
13
|
+
};
|
|
14
|
+
const ariaLabel = `${shownLabels.caption} ${shownLabels.name}`;
|
|
15
|
+
const content = (_jsxs(_Fragment, { children: [_jsx("svg", { "aria-hidden": 'true', className: PallasoftClassNameService.merge('shrink-0', sizeClasses.logo), viewBox: PsStoreBadgeConfig.logoViewBox, xmlns: 'http://www.w3.org/2000/svg', children: platformData.logoPaths.map((path) => (_jsx("path", { d: path.d, fill: path.fill }, path.d))) }), _jsxs("span", { "aria-hidden": 'true', className: 'flex min-w-0 flex-col items-start gap-0.5', children: [_jsx("span", { className: PallasoftClassNameService.merge('whitespace-nowrap', sizeClasses.caption), children: shownLabels.caption }), _jsx("span", { className: PallasoftClassNameService.merge('whitespace-nowrap', sizeClasses.name), children: shownLabels.name })] })] }));
|
|
16
|
+
if (href === undefined)
|
|
17
|
+
return (_jsx("button", { "aria-label": ariaLabel, className: badgeClassName, "data-platform": platform, onClick: onPress, style: badgeStyle, type: 'button', children: content }));
|
|
18
|
+
return (_jsx("a", { "aria-label": ariaLabel, className: badgeClassName, "data-platform": platform, href: href, rel: 'noopener noreferrer', style: badgeStyle, target: '_blank', children: content }));
|
|
19
|
+
};
|
|
@@ -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-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',
|
|
12
|
+
handle: 'ps-focus-ring ps-touch-target relative 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',
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { PsStorePlatform } from './ps-store-platform';
|
|
2
|
+
export const PsStoreBadgeConfig = {
|
|
3
|
+
colors: {
|
|
4
|
+
background: '#000000',
|
|
5
|
+
border: '#A6A6A6',
|
|
6
|
+
text: '#FFFFFF',
|
|
7
|
+
},
|
|
8
|
+
logoViewBox: '0 0 24 24',
|
|
9
|
+
platforms: {
|
|
10
|
+
[PsStorePlatform.appStore]: {
|
|
11
|
+
labels: { caption: 'Download on the', name: 'App Store' },
|
|
12
|
+
logoPaths: [
|
|
13
|
+
{
|
|
14
|
+
d: 'M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701',
|
|
15
|
+
fill: '#FFFFFF',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
[PsStorePlatform.googlePlay]: {
|
|
20
|
+
labels: { caption: 'GET IT ON', name: 'Google Play' },
|
|
21
|
+
logoPaths: [
|
|
22
|
+
{
|
|
23
|
+
d: 'M1.337.924a1.486 1.486 0 0 0-.112.568v21.017c0 .217.045.419.124.6l11.155-11.087L1.337.924z',
|
|
24
|
+
fill: '#4285F4',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
d: 'M13.544 10.989l3.258-3.238L3.45.195a1.466 1.466 0 0 0-.946-.179l11.04 10.973z',
|
|
28
|
+
fill: '#34A853',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
d: 'M22.018 13.298l-3.919 2.218-3.515-3.493 3.543-3.521 3.891 2.202a1.49 1.49 0 0 1 0 2.594z',
|
|
32
|
+
fill: '#FBBC04',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
d: 'M13.544 13.056l-11 10.933c.298.036.612-.016.906-.183l13.324-7.54-3.23-3.21z',
|
|
36
|
+
fill: '#EA4335',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const PsStoreBadgeClasses = {
|
|
43
|
+
base: 'ps-focus-ring inline-flex shrink-0 items-center rounded-lg border font-sans leading-none transition-opacity hover:opacity-85 motion-reduce:transition-none',
|
|
44
|
+
group: 'flex flex-wrap items-center',
|
|
45
|
+
sizes: {
|
|
46
|
+
default: {
|
|
47
|
+
badge: 'h-11 min-w-[8.25rem] gap-2 px-3',
|
|
48
|
+
caption: 'text-[0.625rem]',
|
|
49
|
+
gap: 'gap-3',
|
|
50
|
+
logo: 'size-6',
|
|
51
|
+
name: 'text-lg font-semibold tracking-tight',
|
|
52
|
+
},
|
|
53
|
+
large: {
|
|
54
|
+
badge: 'h-14 min-w-[10.5rem] gap-2.5 px-4',
|
|
55
|
+
caption: 'text-xs',
|
|
56
|
+
gap: 'gap-4',
|
|
57
|
+
logo: 'size-8',
|
|
58
|
+
name: 'text-2xl font-semibold tracking-tight',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from 'react';
|
|
2
|
+
export const usePsMediaQuery = (query) => {
|
|
3
|
+
const subscribe = useCallback((onChange) => {
|
|
4
|
+
if (typeof window.matchMedia !== 'function')
|
|
5
|
+
return () => undefined;
|
|
6
|
+
const list = window.matchMedia(query);
|
|
7
|
+
list.addEventListener('change', onChange);
|
|
8
|
+
return () => list.removeEventListener('change', onChange);
|
|
9
|
+
}, [query]);
|
|
10
|
+
const clientSnapshot = useCallback(() => (typeof window.matchMedia === 'function' ? window.matchMedia(query).matches : null), [query]);
|
|
11
|
+
return useSyncExternalStore(subscribe, clientSnapshot, () => null);
|
|
12
|
+
};
|
|
@@ -4,12 +4,13 @@ export const usePsOptimisticRows = ({ apply, isHolding = false, isSaving, rows,
|
|
|
4
4
|
base: rows,
|
|
5
5
|
changes: [],
|
|
6
6
|
});
|
|
7
|
-
const
|
|
7
|
+
const isActive = isSaving || isHolding;
|
|
8
|
+
const isStale = remembered.base !== rows && !isActive;
|
|
9
|
+
if (isStale)
|
|
10
|
+
setRemembered({ base: rows, changes: [] });
|
|
11
|
+
const changes = isStale ? [] : remembered.changes;
|
|
8
12
|
const shown = useMemo(() => (changes.length === 0 ? rows : apply(rows, changes)), [apply, changes, rows]);
|
|
9
|
-
const remember = useCallback((change) => setRemembered((current) => ({
|
|
10
|
-
base: rows,
|
|
11
|
-
changes: [...(current.base === rows ? current.changes : []), change],
|
|
12
|
-
})), [rows]);
|
|
13
|
+
const remember = useCallback((change) => setRemembered((current) => ({ base: rows, changes: [...current.changes, change] })), [rows]);
|
|
13
14
|
const forgetLast = useCallback(() => setRemembered((current) => ({ base: current.base, changes: current.changes.slice(0, -1) })), []);
|
|
14
15
|
const rollback = useCallback(() => setRemembered({ base: rows, changes: [] }), [rows]);
|
|
15
16
|
return { forgetLast, remember, rollback, rows: shown };
|
package/dist/esm/index.js
CHANGED
|
@@ -8,6 +8,13 @@ export * from './components/ps-button';
|
|
|
8
8
|
export * from './components/ps-link-button';
|
|
9
9
|
export * from './components/ps-pallasoft-mark';
|
|
10
10
|
export * from './components/ps-pallasoft-sign-in-button';
|
|
11
|
+
export * from './components/ps-store-badge';
|
|
12
|
+
export * from './components/ps-app-store-buttons';
|
|
13
|
+
export * from './constants/ps-store-platform';
|
|
14
|
+
export * from './constants/ps-store-badge-config';
|
|
15
|
+
export * from './models/ps-store-badge-labels';
|
|
16
|
+
export * from './models/ps-store-badge-logo-path';
|
|
17
|
+
export * from './models/ps-store-badge-platform-data';
|
|
11
18
|
export * from './constants/ps-pallasoft-mark-config';
|
|
12
19
|
export * from './components/ps-card';
|
|
13
20
|
export * from './components/ps-client-only';
|
|
@@ -58,6 +65,7 @@ export * from './hooks/use-ps-route-loader-data';
|
|
|
58
65
|
export * from './hooks/use-ps-element-size';
|
|
59
66
|
export * from './hooks/use-ps-hydrated';
|
|
60
67
|
export * from './hooks/use-ps-viewport';
|
|
68
|
+
export * from './hooks/use-ps-media-query';
|
|
61
69
|
export * from './interfaces/ps-component-props';
|
|
62
70
|
export * from './models/ps-element-size';
|
|
63
71
|
export * from './models/ps-voice-orb';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usePsMediaQuery: (query: string) => boolean | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePsMediaQuery = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const usePsMediaQuery = (query) => {
|
|
6
|
+
const subscribe = (0, react_1.useCallback)((onChange) => {
|
|
7
|
+
if (typeof window.matchMedia !== 'function')
|
|
8
|
+
return () => undefined;
|
|
9
|
+
const list = window.matchMedia(query);
|
|
10
|
+
list.addEventListener('change', onChange);
|
|
11
|
+
return () => list.removeEventListener('change', onChange);
|
|
12
|
+
}, [query]);
|
|
13
|
+
const clientSnapshot = (0, react_1.useCallback)(() => (typeof window.matchMedia === 'function' ? window.matchMedia(query).matches : null), [query]);
|
|
14
|
+
return (0, react_1.useSyncExternalStore)(subscribe, clientSnapshot, () => null);
|
|
15
|
+
};
|
|
16
|
+
exports.usePsMediaQuery = usePsMediaQuery;
|
|
@@ -7,12 +7,13 @@ const usePsOptimisticRows = ({ apply, isHolding = false, isSaving, rows, }) => {
|
|
|
7
7
|
base: rows,
|
|
8
8
|
changes: [],
|
|
9
9
|
});
|
|
10
|
-
const
|
|
10
|
+
const isActive = isSaving || isHolding;
|
|
11
|
+
const isStale = remembered.base !== rows && !isActive;
|
|
12
|
+
if (isStale)
|
|
13
|
+
setRemembered({ base: rows, changes: [] });
|
|
14
|
+
const changes = isStale ? [] : remembered.changes;
|
|
11
15
|
const shown = (0, react_1.useMemo)(() => (changes.length === 0 ? rows : apply(rows, changes)), [apply, changes, rows]);
|
|
12
|
-
const remember = (0, react_1.useCallback)((change) => setRemembered((current) => ({
|
|
13
|
-
base: rows,
|
|
14
|
-
changes: [...(current.base === rows ? current.changes : []), change],
|
|
15
|
-
})), [rows]);
|
|
16
|
+
const remember = (0, react_1.useCallback)((change) => setRemembered((current) => ({ base: rows, changes: [...current.changes, change] })), [rows]);
|
|
16
17
|
const forgetLast = (0, react_1.useCallback)(() => setRemembered((current) => ({ base: current.base, changes: current.changes.slice(0, -1) })), []);
|
|
17
18
|
const rollback = (0, react_1.useCallback)(() => setRemembered({ base: rows, changes: [] }), [rows]);
|
|
18
19
|
return { forgetLast, remember, rollback, rows: shown };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,13 @@ export * from './components/ps-button';
|
|
|
8
8
|
export * from './components/ps-link-button';
|
|
9
9
|
export * from './components/ps-pallasoft-mark';
|
|
10
10
|
export * from './components/ps-pallasoft-sign-in-button';
|
|
11
|
+
export * from './components/ps-store-badge';
|
|
12
|
+
export * from './components/ps-app-store-buttons';
|
|
13
|
+
export * from './constants/ps-store-platform';
|
|
14
|
+
export * from './constants/ps-store-badge-config';
|
|
15
|
+
export * from './models/ps-store-badge-labels';
|
|
16
|
+
export * from './models/ps-store-badge-logo-path';
|
|
17
|
+
export * from './models/ps-store-badge-platform-data';
|
|
11
18
|
export * from './constants/ps-pallasoft-mark-config';
|
|
12
19
|
export * from './components/ps-card';
|
|
13
20
|
export * from './components/ps-client-only';
|
|
@@ -58,6 +65,7 @@ export * from './hooks/use-ps-route-loader-data';
|
|
|
58
65
|
export * from './hooks/use-ps-element-size';
|
|
59
66
|
export * from './hooks/use-ps-hydrated';
|
|
60
67
|
export * from './hooks/use-ps-viewport';
|
|
68
|
+
export * from './hooks/use-ps-media-query';
|
|
61
69
|
export * from './interfaces/ps-component-props';
|
|
62
70
|
export * from './models/ps-element-size';
|
|
63
71
|
export * from './models/ps-voice-orb';
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,13 @@ __exportStar(require("./components/ps-button"), exports);
|
|
|
24
24
|
__exportStar(require("./components/ps-link-button"), exports);
|
|
25
25
|
__exportStar(require("./components/ps-pallasoft-mark"), exports);
|
|
26
26
|
__exportStar(require("./components/ps-pallasoft-sign-in-button"), exports);
|
|
27
|
+
__exportStar(require("./components/ps-store-badge"), exports);
|
|
28
|
+
__exportStar(require("./components/ps-app-store-buttons"), exports);
|
|
29
|
+
__exportStar(require("./constants/ps-store-platform"), exports);
|
|
30
|
+
__exportStar(require("./constants/ps-store-badge-config"), exports);
|
|
31
|
+
__exportStar(require("./models/ps-store-badge-labels"), exports);
|
|
32
|
+
__exportStar(require("./models/ps-store-badge-logo-path"), exports);
|
|
33
|
+
__exportStar(require("./models/ps-store-badge-platform-data"), exports);
|
|
27
34
|
__exportStar(require("./constants/ps-pallasoft-mark-config"), exports);
|
|
28
35
|
__exportStar(require("./components/ps-card"), exports);
|
|
29
36
|
__exportStar(require("./components/ps-client-only"), exports);
|
|
@@ -74,6 +81,7 @@ __exportStar(require("./hooks/use-ps-route-loader-data"), exports);
|
|
|
74
81
|
__exportStar(require("./hooks/use-ps-element-size"), exports);
|
|
75
82
|
__exportStar(require("./hooks/use-ps-hydrated"), exports);
|
|
76
83
|
__exportStar(require("./hooks/use-ps-viewport"), exports);
|
|
84
|
+
__exportStar(require("./hooks/use-ps-media-query"), exports);
|
|
77
85
|
__exportStar(require("./interfaces/ps-component-props"), exports);
|
|
78
86
|
__exportStar(require("./models/ps-element-size"), exports);
|
|
79
87
|
__exportStar(require("./models/ps-voice-orb"), exports);
|