@pallasoft/ps-mobile-components 1.1.0 → 1.2.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-count-badge/index.d.ts +2 -0
- package/dist/components/ps-count-badge/index.js +2 -0
- package/dist/components/ps-count-badge/ps-count-badge-props.d.ts +5 -0
- package/dist/components/ps-count-badge/ps-count-badge-props.js +1 -0
- package/dist/components/ps-count-badge/ps-count-badge.d.ts +2 -0
- package/dist/components/ps-count-badge/ps-count-badge.js +25 -0
- package/dist/components/ps-list/index.d.ts +2 -0
- package/dist/components/ps-list/index.js +2 -0
- package/dist/components/ps-list/ps-list-link-row-props.d.ts +11 -0
- package/dist/components/ps-list/ps-list-link-row-props.js +1 -0
- package/dist/components/ps-list/ps-list-link-row-skeleton.d.ts +1 -0
- package/dist/components/ps-list/ps-list-link-row-skeleton.js +14 -0
- package/dist/components/ps-list/ps-list-link-row.d.ts +2 -0
- package/dist/components/ps-list/ps-list-link-row.js +40 -0
- package/dist/constants/ps-count-badge-config.d.ts +6 -0
- package/dist/constants/ps-count-badge-config.js +6 -0
- package/dist/constants/ps-layout-config.d.ts +4 -0
- package/dist/constants/ps-layout-config.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/services/ps-count-badge-service.d.ts +3 -0
- package/dist/services/ps-count-badge-service.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { PsCountBadgeConfig } from '../../constants/ps-count-badge-config';
|
|
4
|
+
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
5
|
+
import { PsCountBadgeService } from '../../services/ps-count-badge-service';
|
|
6
|
+
import { PsText } from '../ps-text/ps-text';
|
|
7
|
+
export const PsCountBadge = ({ count, isAlert = false, label }) => {
|
|
8
|
+
const theme = usePsMobileTheme();
|
|
9
|
+
if (count <= 0)
|
|
10
|
+
return null;
|
|
11
|
+
return (_jsx(View, { accessibilityLabel: label, style: {
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
alignSelf: 'center',
|
|
14
|
+
backgroundColor: isAlert ? theme.danger : theme.primary,
|
|
15
|
+
borderRadius: PsCountBadgeConfig.height / 2,
|
|
16
|
+
height: PsCountBadgeConfig.height,
|
|
17
|
+
justifyContent: 'center',
|
|
18
|
+
minWidth: PsCountBadgeConfig.height,
|
|
19
|
+
paddingHorizontal: PsCountBadgeConfig.paddingHorizontal,
|
|
20
|
+
}, testID: 'ps-count-badge', children: _jsx(PsText, { style: {
|
|
21
|
+
color: isAlert ? theme.white : theme.primaryContrast,
|
|
22
|
+
fontSize: PsCountBadgeConfig.fontSize,
|
|
23
|
+
lineHeight: PsCountBadgeConfig.height,
|
|
24
|
+
}, weight: 'bold', children: PsCountBadgeService.text(count) }) }));
|
|
25
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PsMobileIconKey } from '../../constants/ps-mobile-icon-key';
|
|
2
|
+
export interface PsListLinkRowProps {
|
|
3
|
+
count?: number;
|
|
4
|
+
countLabel?: string;
|
|
5
|
+
iconKey: PsMobileIconKey;
|
|
6
|
+
isAlert?: boolean;
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
onPress: () => void;
|
|
9
|
+
subtitle?: string;
|
|
10
|
+
title: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PsListLinkRowSkeleton: () => import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { PsLayoutConfig } from '../../constants/ps-layout-config';
|
|
4
|
+
import { PsListConfig } from '../../constants/ps-list-config';
|
|
5
|
+
import { PsSkeletonShape } from '../../constants/ps-skeleton-shape';
|
|
6
|
+
import { PsSkeleton } from '../ps-skeleton/ps-skeleton';
|
|
7
|
+
export const PsListLinkRowSkeleton = () => (_jsxs(View, { style: {
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
flexDirection: 'row',
|
|
10
|
+
gap: PsLayoutConfig.headerSlotGap,
|
|
11
|
+
minHeight: PsLayoutConfig.linkRowMinHeight,
|
|
12
|
+
paddingHorizontal: PsLayoutConfig.gutter,
|
|
13
|
+
paddingVertical: PsLayoutConfig.rowPaddingVertical,
|
|
14
|
+
}, testID: 'ps-list-link-row-skeleton', children: [_jsx(PsSkeleton, { height: PsLayoutConfig.linkRowIconBox, radius: PsLayoutConfig.linkRowIconBoxRadius, width: PsLayoutConfig.linkRowIconBox }), _jsxs(View, { style: { flex: 1, gap: PsLayoutConfig.rowLineGap * 3 }, children: [_jsx(PsSkeleton, { shape: PsSkeletonShape.Line, width: PsListConfig.skeletonTitleWidth }), _jsx(PsSkeleton, { shape: PsSkeletonShape.Line, width: PsListConfig.skeletonSubtitleWidth })] })] }));
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PsIconKey } from '@pallasoft/ps-icons';
|
|
3
|
+
import { Pressable, View } from 'react-native';
|
|
4
|
+
import { PsLayoutConfig } from '../../constants/ps-layout-config';
|
|
5
|
+
import { PsMobileControlConfig } from '../../constants/ps-mobile-control-config';
|
|
6
|
+
import { usePsHaptics } from '../../hooks/use-ps-haptics';
|
|
7
|
+
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
8
|
+
import { PsMobileColorService } from '../../services/ps-mobile-color-service';
|
|
9
|
+
import { PsCountBadge } from '../ps-count-badge/ps-count-badge';
|
|
10
|
+
import { PsIcon } from '../ps-icon/ps-icon';
|
|
11
|
+
import { PsText } from '../ps-text/ps-text';
|
|
12
|
+
import { PsListLinkRowSkeleton } from './ps-list-link-row-skeleton';
|
|
13
|
+
export const PsListLinkRow = ({ count, countLabel, iconKey, isAlert = false, isLoading = false, onPress, subtitle, title, }) => {
|
|
14
|
+
const theme = usePsMobileTheme();
|
|
15
|
+
const haptic = usePsHaptics();
|
|
16
|
+
if (isLoading)
|
|
17
|
+
return _jsx(PsListLinkRowSkeleton, {});
|
|
18
|
+
const hasCount = count !== undefined && count > 0;
|
|
19
|
+
return (_jsxs(Pressable, { accessibilityHint: countLabel, accessibilityRole: 'button', onPress: () => {
|
|
20
|
+
haptic('light');
|
|
21
|
+
onPress();
|
|
22
|
+
}, style: ({ pressed }) => ({
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
backgroundColor: pressed
|
|
25
|
+
? PsMobileColorService.withAlpha(theme.ink, PsMobileControlConfig.pressedAlpha)
|
|
26
|
+
: theme.surface,
|
|
27
|
+
flexDirection: 'row',
|
|
28
|
+
gap: PsLayoutConfig.headerSlotGap,
|
|
29
|
+
minHeight: PsLayoutConfig.linkRowMinHeight,
|
|
30
|
+
paddingHorizontal: PsLayoutConfig.gutter,
|
|
31
|
+
paddingVertical: PsLayoutConfig.rowPaddingVertical,
|
|
32
|
+
}), testID: 'ps-list-link-row', children: [_jsx(View, { style: {
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
backgroundColor: theme.primarySoft,
|
|
35
|
+
borderRadius: PsLayoutConfig.linkRowIconBoxRadius,
|
|
36
|
+
height: PsLayoutConfig.linkRowIconBox,
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
width: PsLayoutConfig.linkRowIconBox,
|
|
39
|
+
}, children: _jsx(PsIcon, { color: theme.primary, iconKey: iconKey, size: PsLayoutConfig.linkRowIconSize }) }), _jsxs(View, { style: { flex: 1, gap: PsLayoutConfig.rowLineGap }, children: [_jsx(PsText, { numberOfLines: 1, weight: 'semibold', children: title }), subtitle === undefined ? null : (_jsx(PsText, { numberOfLines: 1, tone: 'muted', variant: 'small', children: subtitle }))] }), hasCount ? _jsx(PsCountBadge, { count: count, isAlert: isAlert, label: countLabel }) : null, _jsx(PsIcon, { color: theme.muted, iconKey: PsIconKey.ChevronRight, size: PsMobileControlConfig.iconSizeInline })] }));
|
|
40
|
+
};
|
|
@@ -6,6 +6,10 @@ export declare const PsLayoutConfig: {
|
|
|
6
6
|
readonly headerGap: 4;
|
|
7
7
|
readonly headerSlotGap: 12;
|
|
8
8
|
readonly hitSlop: 8;
|
|
9
|
+
readonly linkRowIconBox: 44;
|
|
10
|
+
readonly linkRowIconBoxRadius: 12;
|
|
11
|
+
readonly linkRowIconSize: 22;
|
|
12
|
+
readonly linkRowMinHeight: 72;
|
|
9
13
|
readonly listGap: 24;
|
|
10
14
|
readonly listSectionGap: 8;
|
|
11
15
|
readonly longPressDelayMs: 350;
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * from './components/ps-mobile-theme-provider';
|
|
|
25
25
|
export * from './components/ps-page-backdrop';
|
|
26
26
|
export * from './components/ps-pallasoft-sign-in-button';
|
|
27
27
|
export * from './components/ps-color-swatches';
|
|
28
|
+
export * from './components/ps-count-badge';
|
|
28
29
|
export * from './components/ps-segmented-control';
|
|
29
30
|
export * from './components/ps-tabs';
|
|
30
31
|
export * from './components/ps-select';
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export * from './components/ps-mobile-theme-provider';
|
|
|
25
25
|
export * from './components/ps-page-backdrop';
|
|
26
26
|
export * from './components/ps-pallasoft-sign-in-button';
|
|
27
27
|
export * from './components/ps-color-swatches';
|
|
28
|
+
export * from './components/ps-count-badge';
|
|
28
29
|
export * from './components/ps-segmented-control';
|
|
29
30
|
export * from './components/ps-tabs';
|
|
30
31
|
export * from './components/ps-select';
|
package/package.json
CHANGED