@pallasoft/ps-mobile-components 1.1.0 → 1.3.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.
Files changed (178) hide show
  1. package/dist/components/ps-action-menu/ps-action-menu-avatar-entry.d.ts +5 -0
  2. package/dist/components/ps-action-menu/ps-action-menu-avatar-entry.js +16 -0
  3. package/dist/components/ps-action-menu/ps-action-menu-entries.js +4 -2
  4. package/dist/components/ps-action-menu/ps-action-menu-labelled.d.ts +2 -1
  5. package/dist/components/ps-action-menu/ps-action-menu-labelled.js +2 -2
  6. package/dist/components/ps-action-menu/ps-action-menu.android.js +1 -1
  7. package/dist/components/ps-action-menu/ps-action-menu.ios.js +10 -1
  8. package/dist/components/ps-action-menu/ps-menu-tile-canvas.d.ts +6 -0
  9. package/dist/components/ps-action-menu/ps-menu-tile-canvas.js +5 -0
  10. package/dist/components/ps-action-menu/ps-menu-tile-drawing.d.ts +6 -0
  11. package/dist/components/ps-action-menu/ps-menu-tile-drawing.js +34 -0
  12. package/dist/components/ps-app-lock-screen/index.d.ts +2 -0
  13. package/dist/components/ps-app-lock-screen/index.js +2 -0
  14. package/dist/components/ps-app-lock-screen/ps-app-lock-screen-props.d.ts +9 -0
  15. package/dist/components/ps-app-lock-screen/ps-app-lock-screen-props.js +1 -0
  16. package/dist/components/ps-app-lock-screen/ps-app-lock-screen.d.ts +2 -0
  17. package/dist/components/ps-app-lock-screen/ps-app-lock-screen.js +19 -0
  18. package/dist/components/ps-chip/ps-chip.js +1 -1
  19. package/dist/components/ps-count-badge/index.d.ts +2 -0
  20. package/dist/components/ps-count-badge/index.js +2 -0
  21. package/dist/components/ps-count-badge/ps-count-badge-props.d.ts +5 -0
  22. package/dist/components/ps-count-badge/ps-count-badge-props.js +1 -0
  23. package/dist/components/ps-count-badge/ps-count-badge.d.ts +2 -0
  24. package/dist/components/ps-count-badge/ps-count-badge.js +25 -0
  25. package/dist/components/ps-form-sheet/ps-form-sheet-props.d.ts +2 -0
  26. package/dist/components/ps-form-sheet/ps-form-sheet.d.ts +1 -1
  27. package/dist/components/ps-form-sheet/ps-form-sheet.js +17 -7
  28. package/dist/components/ps-list/index.d.ts +2 -0
  29. package/dist/components/ps-list/index.js +2 -0
  30. package/dist/components/ps-list/ps-list-context-menu.js +1 -1
  31. package/dist/components/ps-list/ps-list-link-menu-entry.d.ts +5 -0
  32. package/dist/components/ps-list/ps-list-link-menu-entry.js +11 -0
  33. package/dist/components/ps-list/ps-list-link-menu.d.ts +10 -0
  34. package/dist/components/ps-list/ps-list-link-menu.js +16 -0
  35. package/dist/components/ps-list/ps-list-link-row-props.d.ts +11 -0
  36. package/dist/components/ps-list/ps-list-link-row-props.js +1 -0
  37. package/dist/components/ps-list/ps-list-link-row-skeleton.d.ts +1 -0
  38. package/dist/components/ps-list/ps-list-link-row-skeleton.js +14 -0
  39. package/dist/components/ps-list/ps-list-link-row.d.ts +2 -0
  40. package/dist/components/ps-list/ps-list-link-row.js +40 -0
  41. package/dist/components/ps-list/ps-list-props.d.ts +3 -1
  42. package/dist/components/ps-list/ps-list-row-body.js +2 -4
  43. package/dist/components/ps-list/ps-list-row.d.ts +1 -1
  44. package/dist/components/ps-list/ps-list-row.js +3 -2
  45. package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider-props.d.ts +4 -2
  46. package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider.d.ts +1 -1
  47. package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider.js +20 -10
  48. package/dist/components/ps-native-menu/ps-native-menu.android.js +1 -1
  49. package/dist/components/ps-option-picker/index.d.ts +2 -0
  50. package/dist/components/ps-option-picker/index.js +2 -0
  51. package/dist/components/ps-option-picker/ps-option-picker-props.d.ts +16 -0
  52. package/dist/components/ps-option-picker/ps-option-picker-props.js +1 -0
  53. package/dist/components/ps-option-picker/ps-option-picker.d.ts +2 -0
  54. package/dist/components/ps-option-picker/ps-option-picker.js +33 -0
  55. package/dist/components/ps-privacy-cover/index.d.ts +2 -0
  56. package/dist/components/ps-privacy-cover/index.js +2 -0
  57. package/dist/components/ps-privacy-cover/ps-privacy-cover-props.d.ts +4 -0
  58. package/dist/components/ps-privacy-cover/ps-privacy-cover-props.js +1 -0
  59. package/dist/components/ps-privacy-cover/ps-privacy-cover.d.ts +2 -0
  60. package/dist/components/ps-privacy-cover/ps-privacy-cover.js +17 -0
  61. package/dist/components/ps-search-select-field/index.d.ts +2 -0
  62. package/dist/components/ps-search-select-field/index.js +2 -0
  63. package/dist/components/ps-search-select-field/ps-search-select-field-props.d.ts +10 -0
  64. package/dist/components/ps-search-select-field/ps-search-select-field-props.js +1 -0
  65. package/dist/components/ps-search-select-field/ps-search-select-field.d.ts +2 -0
  66. package/dist/components/ps-search-select-field/ps-search-select-field.js +15 -0
  67. package/dist/components/ps-selection-mode/index.d.ts +2 -0
  68. package/dist/components/ps-selection-mode/index.js +2 -0
  69. package/dist/components/ps-selection-mode/ps-selection-mode-props.d.ts +13 -0
  70. package/dist/components/ps-selection-mode/ps-selection-mode-props.js +1 -0
  71. package/dist/components/ps-selection-mode/ps-selection-mode.d.ts +2 -0
  72. package/dist/components/ps-selection-mode/ps-selection-mode.js +28 -0
  73. package/dist/components/ps-sheet/ps-sheet-props.d.ts +4 -1
  74. package/dist/components/ps-sheet/ps-sheet.d.ts +1 -1
  75. package/dist/components/ps-sheet/ps-sheet.js +4 -5
  76. package/dist/components/ps-sheet-header/ps-sheet-header-props.d.ts +2 -0
  77. package/dist/components/ps-sheet-header/ps-sheet-header.d.ts +1 -1
  78. package/dist/components/ps-sheet-header/ps-sheet-header.js +2 -2
  79. package/dist/components/ps-sheet-page/ps-sheet-page-view.d.ts +8 -0
  80. package/dist/components/ps-sheet-page/ps-sheet-page-view.js +11 -0
  81. package/dist/components/ps-sheet-presenter/ps-sheet-presenter.ios.js +9 -2
  82. package/dist/components/ps-tab-bar-provider/index.d.ts +2 -0
  83. package/dist/components/ps-tab-bar-provider/index.js +2 -0
  84. package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider-props.d.ts +4 -0
  85. package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider-props.js +1 -0
  86. package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider.d.ts +2 -0
  87. package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider.js +8 -0
  88. package/dist/components/ps-tabs/ps-tabs.js +1 -1
  89. package/dist/components/ps-text-link/ps-text-link.js +1 -1
  90. package/dist/constants/ps-app-lock-config.d.ts +13 -0
  91. package/dist/constants/ps-app-lock-config.js +13 -0
  92. package/dist/constants/ps-app-lock-native-codes.d.ts +10 -0
  93. package/dist/constants/ps-app-lock-native-codes.js +10 -0
  94. package/dist/constants/ps-biometry-kind.d.ts +7 -0
  95. package/dist/constants/ps-biometry-kind.js +6 -0
  96. package/dist/constants/ps-count-badge-config.d.ts +6 -0
  97. package/dist/constants/ps-count-badge-config.js +6 -0
  98. package/dist/constants/ps-layout-config.d.ts +4 -0
  99. package/dist/constants/ps-layout-config.js +4 -0
  100. package/dist/constants/ps-list-config.d.ts +2 -0
  101. package/dist/constants/ps-list-config.js +2 -0
  102. package/dist/constants/ps-menu-tile-config.d.ts +9 -0
  103. package/dist/constants/ps-menu-tile-config.js +9 -0
  104. package/dist/constants/ps-mobile-control-config.d.ts +0 -12
  105. package/dist/constants/ps-mobile-control-config.js +0 -6
  106. package/dist/constants/ps-option-picker-config.d.ts +6 -0
  107. package/dist/constants/ps-option-picker-config.js +6 -0
  108. package/dist/constants/ps-sf-symbol-config.d.ts +92 -0
  109. package/dist/constants/ps-sf-symbol-config.js +92 -0
  110. package/dist/constants/ps-sheet-page-config.d.ts +4 -0
  111. package/dist/constants/ps-sheet-page-config.js +4 -0
  112. package/dist/contexts/ps-tab-bar-context.d.ts +2 -0
  113. package/dist/contexts/ps-tab-bar-context.js +5 -0
  114. package/dist/hooks/use-ps-app-lock.d.ts +3 -0
  115. package/dist/hooks/use-ps-app-lock.js +72 -0
  116. package/dist/hooks/use-ps-menu-tiles.d.ts +4 -0
  117. package/dist/hooks/use-ps-menu-tiles.js +8 -0
  118. package/dist/hooks/use-ps-tab-bar.d.ts +2 -0
  119. package/dist/hooks/use-ps-tab-bar.js +3 -0
  120. package/dist/index.d.ts +19 -0
  121. package/dist/index.js +19 -0
  122. package/dist/interfaces/ps-action-menu-header.d.ts +1 -0
  123. package/dist/interfaces/ps-app-lock-native.d.ts +13 -0
  124. package/dist/interfaces/ps-app-lock-native.js +1 -0
  125. package/dist/interfaces/ps-app-lock-prompt.d.ts +4 -0
  126. package/dist/interfaces/ps-app-lock-prompt.js +1 -0
  127. package/dist/interfaces/ps-menu-item.d.ts +2 -0
  128. package/dist/interfaces/ps-menu-tile-request.d.ts +7 -0
  129. package/dist/interfaces/ps-menu-tile-request.js +1 -0
  130. package/dist/interfaces/ps-menu-tile-shape.d.ts +1 -0
  131. package/dist/interfaces/ps-menu-tile-shape.js +1 -0
  132. package/dist/interfaces/ps-mobile-brand-colors.d.ts +5 -0
  133. package/dist/interfaces/ps-mobile-brand-colors.js +1 -0
  134. package/dist/interfaces/ps-mobile-brand-input.d.ts +7 -0
  135. package/dist/interfaces/ps-mobile-brand-input.js +1 -0
  136. package/dist/interfaces/ps-mobile-theme-input.d.ts +1 -1
  137. package/dist/interfaces/ps-mobile-theme.d.ts +32 -0
  138. package/dist/interfaces/ps-sheet-leading-kind.d.ts +1 -0
  139. package/dist/interfaces/ps-sheet-leading-kind.js +1 -0
  140. package/dist/interfaces/ps-sheet-page.d.ts +8 -0
  141. package/dist/interfaces/ps-sheet-page.js +1 -0
  142. package/dist/interfaces/ps-tab-bar-context-data.d.ts +4 -0
  143. package/dist/interfaces/ps-tab-bar-context-data.js +1 -0
  144. package/dist/interfaces/use-ps-app-lock-options.d.ts +6 -0
  145. package/dist/interfaces/use-ps-app-lock-options.js +1 -0
  146. package/dist/interfaces/use-ps-app-lock-result.d.ts +7 -0
  147. package/dist/interfaces/use-ps-app-lock-result.js +1 -0
  148. package/dist/services/ps-action-menu-service.d.ts +4 -0
  149. package/dist/services/ps-action-menu-service.js +25 -2
  150. package/dist/services/ps-app-lock-grace-service.d.ts +6 -0
  151. package/dist/services/ps-app-lock-grace-service.js +17 -0
  152. package/dist/services/ps-app-lock-service.d.ts +10 -0
  153. package/dist/services/ps-app-lock-service.js +84 -0
  154. package/dist/services/ps-badge-tone-service.js +3 -3
  155. package/dist/services/ps-button-style-service.js +2 -2
  156. package/dist/services/ps-context-menu-service.d.ts +1 -0
  157. package/dist/services/ps-context-menu-service.js +13 -0
  158. package/dist/services/ps-count-badge-service.d.ts +3 -0
  159. package/dist/services/ps-count-badge-service.js +6 -0
  160. package/dist/services/ps-list-row-style-service.d.ts +4 -0
  161. package/dist/services/ps-list-row-style-service.js +11 -0
  162. package/dist/services/ps-menu-tile-service.d.ts +16 -0
  163. package/dist/services/ps-menu-tile-service.js +70 -0
  164. package/dist/services/ps-menu-tile-style-service.d.ts +4 -0
  165. package/dist/services/ps-menu-tile-style-service.js +5 -0
  166. package/dist/services/ps-mobile-brand-service.d.ts +5 -0
  167. package/dist/services/ps-mobile-brand-service.js +24 -0
  168. package/dist/services/ps-mobile-theme-service.d.ts +0 -2
  169. package/dist/services/ps-mobile-theme-service.js +64 -94
  170. package/dist/services/ps-option-picker-service.d.ts +8 -0
  171. package/dist/services/ps-option-picker-service.js +10 -0
  172. package/dist/services/ps-selection-service.d.ts +5 -0
  173. package/dist/services/ps-selection-service.js +13 -0
  174. package/dist/services/ps-sheet-service.d.ts +5 -0
  175. package/dist/services/ps-sheet-service.js +11 -0
  176. package/dist/services/ps-text-service.js +4 -4
  177. package/jest-setup.js +71 -0
  178. package/package.json +14 -2
@@ -6,8 +6,12 @@ export interface PsMobileTheme {
6
6
  chart: string[];
7
7
  danger: string;
8
8
  dangerSoft: string;
9
+ dangerText: string;
9
10
  fonts: PsMobileFonts;
10
11
  hasHaptics: boolean;
12
+ info: string;
13
+ infoSoft: string;
14
+ infoText: string;
11
15
  isDark: boolean;
12
16
  isReduceMotion: boolean;
13
17
  ink: string;
@@ -15,17 +19,45 @@ export interface PsMobileTheme {
15
19
  muted: string;
16
20
  overlay: string;
17
21
  primary: string;
22
+ primary100: string;
23
+ primary200: string;
24
+ primary300: string;
25
+ primary400: string;
26
+ primary50: string;
27
+ primary500: string;
28
+ primary600: string;
29
+ primary700: string;
30
+ primary800: string;
31
+ primary900: string;
18
32
  primaryContrast: string;
33
+ primaryPressed: string;
19
34
  primarySoft: string;
35
+ primarySoftStrong: string;
36
+ primaryText: string;
20
37
  secondary: string;
38
+ secondary100: string;
39
+ secondary200: string;
40
+ secondary300: string;
41
+ secondary400: string;
42
+ secondary50: string;
43
+ secondary500: string;
44
+ secondary600: string;
45
+ secondary700: string;
46
+ secondary800: string;
47
+ secondary900: string;
21
48
  secondaryContrast: string;
49
+ secondaryPressed: string;
22
50
  secondarySoft: string;
51
+ secondarySoftStrong: string;
52
+ secondaryText: string;
23
53
  skeletonBase: string;
24
54
  skeletonSweep: string;
25
55
  success: string;
26
56
  successSoft: string;
57
+ successText: string;
27
58
  surface: string;
28
59
  warning: string;
29
60
  warningSoft: string;
61
+ warningText: string;
30
62
  white: string;
31
63
  }
@@ -0,0 +1 @@
1
+ export type PsSheetLeadingKind = 'back' | 'close';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface PsSheetPage {
3
+ backLabel: string;
4
+ children: ReactNode;
5
+ id: string;
6
+ onBack: () => void;
7
+ title: string;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface PsTabBarContextData {
2
+ isHidden: boolean;
3
+ setIsHidden: (isHidden: boolean) => void;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { PsAppLockPrompt } from './ps-app-lock-prompt';
2
+ export interface UsePsAppLockOptions {
3
+ graceSeconds?: number;
4
+ isEnabled: boolean;
5
+ prompt: PsAppLockPrompt;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface UsePsAppLockResult {
2
+ isCovered: boolean;
3
+ isLocked: boolean;
4
+ isUnlocking: boolean;
5
+ lock: () => void;
6
+ unlock: () => Promise<boolean>;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  import type { SFSymbol } from 'sf-symbols-typescript';
2
+ import type { PsActionMenuHeader } from '../interfaces/ps-action-menu-header';
2
3
  import type { PsActionMenuSection } from '../interfaces/ps-action-menu-section';
3
4
  import type { PsMenuItem } from '../interfaces/ps-menu-item';
4
5
  export declare class PsActionMenuService {
@@ -6,5 +7,8 @@ export declare class PsActionMenuService {
6
7
  static consistent(sections: PsActionMenuSection[]): PsActionMenuSection[];
7
8
  static flatten(sections: PsActionMenuSection[]): PsMenuItem[];
8
9
  static expand(item: PsMenuItem): PsMenuItem[];
10
+ static hasAvatar(item: PsMenuItem): boolean;
11
+ static monogram(item: PsMenuItem): SFSymbol | undefined;
12
+ static headerSymbol(header: PsActionMenuHeader): SFSymbol;
9
13
  static symbol(item: PsMenuItem): SFSymbol | undefined;
10
14
  }
@@ -7,7 +7,7 @@ export class PsActionMenuService {
7
7
  }
8
8
  static consistent(sections) {
9
9
  const items = sections.flatMap((section) => section.items);
10
- const hasAll = items.every((item) => item.iconKey !== undefined || item.isChecked === true);
10
+ const hasAll = items.every((item) => item.iconKey !== undefined || item.isChecked === true || PsActionMenuService.hasAvatar(item));
11
11
  if (hasAll)
12
12
  return sections;
13
13
  return sections.map((section) => ({
@@ -26,9 +26,32 @@ export class PsActionMenuService {
26
26
  ...item.children.flatMap((child) => this.expand(child)),
27
27
  ];
28
28
  }
29
+ static hasAvatar(item) {
30
+ return item.imageUri !== undefined || item.monogram !== undefined;
31
+ }
32
+ static monogram(item) {
33
+ if (item.monogram === undefined)
34
+ return undefined;
35
+ const monograms = PsSfSymbolConfig.monograms;
36
+ return monograms[item.monogram.trim().normalize('NFD').charAt(0).toLowerCase()];
37
+ }
38
+ static headerSymbol(header) {
39
+ const monogram = header.initials === undefined
40
+ ? undefined
41
+ : PsActionMenuService.monogram({
42
+ id: 'header',
43
+ label: header.title,
44
+ monogram: header.initials,
45
+ onSelect: () => undefined,
46
+ });
47
+ return monogram === undefined ? PsSfSymbolConfig.headerSymbol : monogram;
48
+ }
29
49
  static symbol(item) {
30
- if (item.isChecked)
50
+ if (item.isChecked && !PsActionMenuService.hasAvatar(item))
31
51
  return PsSfSymbolConfig.checkedSymbol;
52
+ const monogram = PsActionMenuService.monogram(item);
53
+ if (monogram !== undefined)
54
+ return monogram;
32
55
  if (item.iconKey === undefined)
33
56
  return undefined;
34
57
  const symbols = PsSfSymbolConfig.symbols;
@@ -0,0 +1,6 @@
1
+ export declare class PsAppLockGraceService {
2
+ static isExpired(backgroundedAt: number | null, now: number, graceSeconds: number): boolean;
3
+ static isActive(state: string): boolean;
4
+ static isHidden(state: string): boolean;
5
+ static isBackground(state: string): boolean;
6
+ }
@@ -0,0 +1,17 @@
1
+ import { PsAppLockConfig } from '../constants/ps-app-lock-config';
2
+ export class PsAppLockGraceService {
3
+ static isExpired(backgroundedAt, now, graceSeconds) {
4
+ if (backgroundedAt === null)
5
+ return false;
6
+ return now - backgroundedAt >= graceSeconds;
7
+ }
8
+ static isActive(state) {
9
+ return state === PsAppLockConfig.activeState;
10
+ }
11
+ static isHidden(state) {
12
+ return state === PsAppLockConfig.inactiveState || state === PsAppLockConfig.backgroundState;
13
+ }
14
+ static isBackground(state) {
15
+ return state === PsAppLockConfig.backgroundState;
16
+ }
17
+ }
@@ -0,0 +1,10 @@
1
+ import { PsBiometryKind } from '../constants/ps-biometry-kind';
2
+ export declare class PsAppLockService {
3
+ private static busyCount;
4
+ static isAvailable(): Promise<boolean>;
5
+ static biometryKind(): Promise<PsBiometryKind>;
6
+ static kindOf(types: number[], level: number, platform: string): PsBiometryKind;
7
+ static authenticate(prompt: string, cancelLabel: string): Promise<boolean>;
8
+ static isBusy(): boolean;
9
+ private static load;
10
+ }
@@ -0,0 +1,84 @@
1
+ import { requireOptionalNativeModule } from 'expo';
2
+ import { Platform } from 'react-native';
3
+ import { PsAppLockConfig } from '../constants/ps-app-lock-config';
4
+ import { PsAuthenticationTypeCode, PsSecurityLevelCode, } from '../constants/ps-app-lock-native-codes';
5
+ import { PsBiometryKind } from '../constants/ps-biometry-kind';
6
+ export class PsAppLockService {
7
+ static async isAvailable() {
8
+ const native = PsAppLockService.load();
9
+ if (native === null)
10
+ return false;
11
+ try {
12
+ return (await native.getEnrolledLevelAsync()) > PsSecurityLevelCode.none;
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ }
18
+ static async biometryKind() {
19
+ const native = PsAppLockService.load();
20
+ if (native === null)
21
+ return PsBiometryKind.passcode;
22
+ try {
23
+ const [types, level] = await Promise.all([
24
+ native.supportedAuthenticationTypesAsync(),
25
+ native.getEnrolledLevelAsync(),
26
+ ]);
27
+ return PsAppLockService.kindOf(types, level, Platform.OS);
28
+ }
29
+ catch {
30
+ return PsBiometryKind.passcode;
31
+ }
32
+ }
33
+ static kindOf(types, level, platform) {
34
+ if (level < PsSecurityLevelCode.biometricWeak)
35
+ return PsBiometryKind.passcode;
36
+ const has = (code) => types.includes(code);
37
+ const face = has(PsAuthenticationTypeCode.face);
38
+ const fingerprint = has(PsAuthenticationTypeCode.fingerprint);
39
+ if (platform === PsAppLockConfig.iosPlatform && face)
40
+ return PsBiometryKind.face;
41
+ if (fingerprint)
42
+ return PsBiometryKind.fingerprint;
43
+ if (face)
44
+ return PsBiometryKind.face;
45
+ if (has(PsAuthenticationTypeCode.iris))
46
+ return PsBiometryKind.iris;
47
+ return PsBiometryKind.passcode;
48
+ }
49
+ static async authenticate(prompt, cancelLabel) {
50
+ const native = PsAppLockService.load();
51
+ if (native === null)
52
+ return false;
53
+ PsAppLockService.busyCount += 1;
54
+ try {
55
+ const result = await native.authenticateAsync({
56
+ cancelLabel,
57
+ disableDeviceFallback: false,
58
+ promptMessage: prompt,
59
+ });
60
+ return result.success;
61
+ }
62
+ catch {
63
+ return false;
64
+ }
65
+ finally {
66
+ PsAppLockService.busyCount -= 1;
67
+ }
68
+ }
69
+ static isBusy() {
70
+ return PsAppLockService.busyCount > 0;
71
+ }
72
+ static load() {
73
+ try {
74
+ if (requireOptionalNativeModule(PsAppLockConfig.nativeModuleName) === null)
75
+ return null;
76
+ const loaded = require('expo-local-authentication');
77
+ return typeof loaded.authenticateAsync === 'function' ? loaded : null;
78
+ }
79
+ catch {
80
+ return null;
81
+ }
82
+ }
83
+ }
84
+ PsAppLockService.busyCount = 0;
@@ -4,13 +4,13 @@ export class PsBadgeToneService {
4
4
  static resolve(tone, theme) {
5
5
  switch (tone) {
6
6
  case 'danger':
7
- return { background: theme.dangerSoft, foreground: theme.danger };
7
+ return { background: theme.dangerSoft, foreground: theme.dangerText };
8
8
  case 'primary':
9
9
  return { background: theme.primarySoft, foreground: theme.ink };
10
10
  case 'success':
11
- return { background: theme.successSoft, foreground: theme.success };
11
+ return { background: theme.successSoft, foreground: theme.successText };
12
12
  case 'warning':
13
- return { background: theme.warningSoft, foreground: theme.warning };
13
+ return { background: theme.warningSoft, foreground: theme.warningText };
14
14
  default:
15
15
  return {
16
16
  background: PsMobileColorService.withAlpha(theme.ink, PsMobileControlConfig.neutralAlpha),
@@ -9,8 +9,8 @@ export class PsButtonStyleService {
9
9
  background: theme.primary,
10
10
  border: theme.primary,
11
11
  foreground: theme.primaryContrast,
12
- pressedBackground: theme.primary,
13
- pressedBorder: theme.primary,
12
+ pressedBackground: theme.primaryPressed,
13
+ pressedBorder: theme.primaryPressed,
14
14
  };
15
15
  case 'danger':
16
16
  return {
@@ -3,4 +3,5 @@ import type { PsMenuItem } from '../interfaces/ps-menu-item';
3
3
  import type { PsMobileTheme } from '../interfaces/ps-mobile-theme';
4
4
  export declare class PsContextMenuService {
5
5
  static actions(items: PsMenuItem[], theme: PsMobileTheme, hasSymbols: boolean): MenuAction[];
6
+ static find(items: PsMenuItem[], id: string): PsMenuItem | undefined;
6
7
  }
@@ -4,6 +4,9 @@ export class PsContextMenuService {
4
4
  const consistent = PsActionMenuService.consistent([{ id: 'items', items }]);
5
5
  const entries = consistent.length === 0 ? [] : consistent[0].items;
6
6
  return entries.map((item) => ({
7
+ subactions: item.children === undefined || item.children.length === 0
8
+ ? undefined
9
+ : PsContextMenuService.actions(item.children, theme, hasSymbols),
7
10
  attributes: {
8
11
  destructive: item.isDanger === true,
9
12
  disabled: item.isDisabled === true,
@@ -14,4 +17,14 @@ export class PsContextMenuService {
14
17
  title: item.label,
15
18
  }));
16
19
  }
20
+ static find(items, id) {
21
+ for (const item of items) {
22
+ if (item.id === id)
23
+ return item;
24
+ const nested = item.children === undefined ? undefined : PsContextMenuService.find(item.children, id);
25
+ if (nested !== undefined)
26
+ return nested;
27
+ }
28
+ return undefined;
29
+ }
17
30
  }
@@ -0,0 +1,3 @@
1
+ export declare class PsCountBadgeService {
2
+ static text(count: number): string;
3
+ }
@@ -0,0 +1,6 @@
1
+ import { PsCountBadgeConfig } from '../constants/ps-count-badge-config';
2
+ export class PsCountBadgeService {
3
+ static text(count) {
4
+ return count > PsCountBadgeConfig.maxCount ? `${PsCountBadgeConfig.maxCount}+` : String(count);
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ import type { PsMobileTheme } from '../interfaces/ps-mobile-theme';
2
+ export declare class PsListRowStyleService {
3
+ static background(isSelected: boolean, isPressed: boolean, theme: PsMobileTheme): string;
4
+ }
@@ -0,0 +1,11 @@
1
+ import { PsMobileControlConfig } from '../constants/ps-mobile-control-config';
2
+ import { PsMobileColorService } from './ps-mobile-color-service';
3
+ export class PsListRowStyleService {
4
+ static background(isSelected, isPressed, theme) {
5
+ if (isSelected)
6
+ return isPressed ? theme.primarySoftStrong : theme.primarySoft;
7
+ return isPressed
8
+ ? PsMobileColorService.withAlpha(theme.ink, PsMobileControlConfig.pressedAlpha)
9
+ : theme.surface;
10
+ }
11
+ }
@@ -0,0 +1,16 @@
1
+ import type { PsActionMenuHeader } from '../interfaces/ps-action-menu-header';
2
+ import type { PsActionMenuSection } from '../interfaces/ps-action-menu-section';
3
+ import type { PsMenuItem } from '../interfaces/ps-menu-item';
4
+ import type { PsMenuTileRequest } from '../interfaces/ps-menu-tile-request';
5
+ export declare class PsMenuTileService {
6
+ static itemRequest(item: PsMenuItem): PsMenuTileRequest | null;
7
+ static headerRequest(header: PsActionMenuHeader | undefined): PsMenuTileRequest | null;
8
+ static requests(header: PsActionMenuHeader | undefined, sections: PsActionMenuSection[]): PsMenuTileRequest[];
9
+ static sections(sections: PsActionMenuSection[], tiles: Record<string, string>): PsActionMenuSection[];
10
+ static item(item: PsMenuItem, tiles: Record<string, string>): PsMenuItem;
11
+ static header(header: PsActionMenuHeader | undefined, tiles: Record<string, string>): PsActionMenuHeader | undefined;
12
+ static letter(value: string): string;
13
+ private static tile;
14
+ private static tree;
15
+ private static request;
16
+ }
@@ -0,0 +1,70 @@
1
+ import { PsActionMenuService } from './ps-action-menu-service';
2
+ export class PsMenuTileService {
3
+ static itemRequest(item) {
4
+ if (!PsActionMenuService.hasAvatar(item))
5
+ return null;
6
+ const text = PsMenuTileService.letter(item.monogram === undefined ? item.label : item.monogram);
7
+ return PsMenuTileService.request('rounded', item.imageUri, text);
8
+ }
9
+ static headerRequest(header) {
10
+ if (header === undefined)
11
+ return null;
12
+ if (header.imageUri === undefined && header.initials === undefined)
13
+ return null;
14
+ return PsMenuTileService.request('circle', header.imageUri, header.initials === undefined ? '' : header.initials.trim().toUpperCase());
15
+ }
16
+ static requests(header, sections) {
17
+ const all = [
18
+ PsMenuTileService.headerRequest(header),
19
+ ...sections
20
+ .flatMap((section) => section.items.flatMap((item) => PsMenuTileService.tree(item)))
21
+ .map((item) => PsMenuTileService.itemRequest(item)),
22
+ ].filter((request) => request !== null);
23
+ return all.filter((request, index) => all.findIndex((other) => other.key === request.key) === index);
24
+ }
25
+ static sections(sections, tiles) {
26
+ return sections.map((section) => ({
27
+ ...section,
28
+ items: section.items.map((item) => PsMenuTileService.item(item, tiles)),
29
+ }));
30
+ }
31
+ static item(item, tiles) {
32
+ const children = item.children === undefined
33
+ ? undefined
34
+ : item.children.map((child) => PsMenuTileService.item(child, tiles));
35
+ const request = PsMenuTileService.itemRequest(item);
36
+ if (request === null)
37
+ return { ...item, children };
38
+ return {
39
+ ...item,
40
+ children,
41
+ imageUri: PsMenuTileService.tile(request, tiles),
42
+ monogram: item.monogram === undefined ? item.label : item.monogram,
43
+ };
44
+ }
45
+ static header(header, tiles) {
46
+ const request = PsMenuTileService.headerRequest(header);
47
+ if (header === undefined || request === null)
48
+ return header;
49
+ return { ...header, imageUri: PsMenuTileService.tile(request, tiles) };
50
+ }
51
+ static letter(value) {
52
+ return Array.from(value.trim()).slice(0, 1).join('').toUpperCase();
53
+ }
54
+ static tile(request, tiles) {
55
+ return request.key in tiles ? tiles[request.key] : undefined;
56
+ }
57
+ static tree(item) {
58
+ if (item.children === undefined)
59
+ return [item];
60
+ return [item, ...item.children.flatMap((child) => PsMenuTileService.tree(child))];
61
+ }
62
+ static request(shape, imageUri, text) {
63
+ return {
64
+ imageUri,
65
+ key: [shape, imageUri === undefined ? '' : imageUri, text].join('|'),
66
+ shape,
67
+ text,
68
+ };
69
+ }
70
+ }
@@ -0,0 +1,4 @@
1
+ import type { ViewStyle } from 'react-native';
2
+ export declare class PsMenuTileStyleService {
3
+ static canvas(): ViewStyle;
4
+ }
@@ -0,0 +1,5 @@
1
+ export class PsMenuTileStyleService {
2
+ static canvas() {
3
+ return { left: 0, opacity: 0, position: 'absolute', top: 0 };
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { PsMobileBrandColors } from '../interfaces/ps-mobile-brand-colors';
2
+ import type { PsMobileBrandInput } from '../interfaces/ps-mobile-brand-input';
3
+ export declare class PsMobileBrandService {
4
+ static resolve({ primaryColor, primaryContrastColor, product, secondaryColor, }: PsMobileBrandInput): PsMobileBrandColors;
5
+ }
@@ -0,0 +1,24 @@
1
+ import { PallasoftColor, PallasoftProductBrandService } from '@pallasoft/ps-design-system';
2
+ export class PsMobileBrandService {
3
+ static resolve({ primaryColor, primaryContrastColor, product, secondaryColor, }) {
4
+ const brand = product === undefined ? null : PallasoftProductBrandService.colors(product);
5
+ if (primaryColor === undefined) {
6
+ return brand === null
7
+ ? {
8
+ primary: PallasoftColor.Accent,
9
+ primaryContrast: primaryContrastColor,
10
+ secondary: secondaryColor,
11
+ }
12
+ : {
13
+ primary: brand.primary,
14
+ primaryContrast: brand.primaryContrast,
15
+ secondary: secondaryColor === undefined ? brand.secondary : secondaryColor,
16
+ };
17
+ }
18
+ return {
19
+ primary: primaryColor,
20
+ primaryContrast: primaryContrastColor,
21
+ secondary: secondaryColor === undefined && brand !== null ? brand.secondary : secondaryColor,
22
+ };
23
+ }
24
+ }
@@ -2,6 +2,4 @@ import type { PsMobileTheme } from '../interfaces/ps-mobile-theme';
2
2
  import type { PsMobileThemeInput } from '../interfaces/ps-mobile-theme-input';
3
3
  export declare class PsMobileThemeService {
4
4
  static create({ chart, hasHaptics, isDark, isReduceMotion, primary, primaryContrast, secondary, }: PsMobileThemeInput): PsMobileTheme;
5
- private static light;
6
- private static dark;
7
5
  }