@pallasoft/ps-mobile-components 1.2.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 (159) 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-form-sheet/ps-form-sheet-props.d.ts +2 -0
  20. package/dist/components/ps-form-sheet/ps-form-sheet.d.ts +1 -1
  21. package/dist/components/ps-form-sheet/ps-form-sheet.js +17 -7
  22. package/dist/components/ps-list/ps-list-context-menu.js +1 -1
  23. package/dist/components/ps-list/ps-list-link-menu-entry.d.ts +5 -0
  24. package/dist/components/ps-list/ps-list-link-menu-entry.js +11 -0
  25. package/dist/components/ps-list/ps-list-link-menu.d.ts +10 -0
  26. package/dist/components/ps-list/ps-list-link-menu.js +16 -0
  27. package/dist/components/ps-list/ps-list-link-row.js +1 -1
  28. package/dist/components/ps-list/ps-list-props.d.ts +3 -1
  29. package/dist/components/ps-list/ps-list-row-body.js +2 -4
  30. package/dist/components/ps-list/ps-list-row.d.ts +1 -1
  31. package/dist/components/ps-list/ps-list-row.js +3 -2
  32. package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider-props.d.ts +4 -2
  33. package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider.d.ts +1 -1
  34. package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider.js +20 -10
  35. package/dist/components/ps-native-menu/ps-native-menu.android.js +1 -1
  36. package/dist/components/ps-option-picker/index.d.ts +2 -0
  37. package/dist/components/ps-option-picker/index.js +2 -0
  38. package/dist/components/ps-option-picker/ps-option-picker-props.d.ts +16 -0
  39. package/dist/components/ps-option-picker/ps-option-picker-props.js +1 -0
  40. package/dist/components/ps-option-picker/ps-option-picker.d.ts +2 -0
  41. package/dist/components/ps-option-picker/ps-option-picker.js +33 -0
  42. package/dist/components/ps-privacy-cover/index.d.ts +2 -0
  43. package/dist/components/ps-privacy-cover/index.js +2 -0
  44. package/dist/components/ps-privacy-cover/ps-privacy-cover-props.d.ts +4 -0
  45. package/dist/components/ps-privacy-cover/ps-privacy-cover-props.js +1 -0
  46. package/dist/components/ps-privacy-cover/ps-privacy-cover.d.ts +2 -0
  47. package/dist/components/ps-privacy-cover/ps-privacy-cover.js +17 -0
  48. package/dist/components/ps-search-select-field/index.d.ts +2 -0
  49. package/dist/components/ps-search-select-field/index.js +2 -0
  50. package/dist/components/ps-search-select-field/ps-search-select-field-props.d.ts +10 -0
  51. package/dist/components/ps-search-select-field/ps-search-select-field-props.js +1 -0
  52. package/dist/components/ps-search-select-field/ps-search-select-field.d.ts +2 -0
  53. package/dist/components/ps-search-select-field/ps-search-select-field.js +15 -0
  54. package/dist/components/ps-selection-mode/index.d.ts +2 -0
  55. package/dist/components/ps-selection-mode/index.js +2 -0
  56. package/dist/components/ps-selection-mode/ps-selection-mode-props.d.ts +13 -0
  57. package/dist/components/ps-selection-mode/ps-selection-mode-props.js +1 -0
  58. package/dist/components/ps-selection-mode/ps-selection-mode.d.ts +2 -0
  59. package/dist/components/ps-selection-mode/ps-selection-mode.js +28 -0
  60. package/dist/components/ps-sheet/ps-sheet-props.d.ts +4 -1
  61. package/dist/components/ps-sheet/ps-sheet.d.ts +1 -1
  62. package/dist/components/ps-sheet/ps-sheet.js +4 -5
  63. package/dist/components/ps-sheet-header/ps-sheet-header-props.d.ts +2 -0
  64. package/dist/components/ps-sheet-header/ps-sheet-header.d.ts +1 -1
  65. package/dist/components/ps-sheet-header/ps-sheet-header.js +2 -2
  66. package/dist/components/ps-sheet-page/ps-sheet-page-view.d.ts +8 -0
  67. package/dist/components/ps-sheet-page/ps-sheet-page-view.js +11 -0
  68. package/dist/components/ps-sheet-presenter/ps-sheet-presenter.ios.js +9 -2
  69. package/dist/components/ps-tab-bar-provider/index.d.ts +2 -0
  70. package/dist/components/ps-tab-bar-provider/index.js +2 -0
  71. package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider-props.d.ts +4 -0
  72. package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider-props.js +1 -0
  73. package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider.d.ts +2 -0
  74. package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider.js +8 -0
  75. package/dist/components/ps-tabs/ps-tabs.js +1 -1
  76. package/dist/components/ps-text-link/ps-text-link.js +1 -1
  77. package/dist/constants/ps-app-lock-config.d.ts +13 -0
  78. package/dist/constants/ps-app-lock-config.js +13 -0
  79. package/dist/constants/ps-app-lock-native-codes.d.ts +10 -0
  80. package/dist/constants/ps-app-lock-native-codes.js +10 -0
  81. package/dist/constants/ps-biometry-kind.d.ts +7 -0
  82. package/dist/constants/ps-biometry-kind.js +6 -0
  83. package/dist/constants/ps-list-config.d.ts +2 -0
  84. package/dist/constants/ps-list-config.js +2 -0
  85. package/dist/constants/ps-menu-tile-config.d.ts +9 -0
  86. package/dist/constants/ps-menu-tile-config.js +9 -0
  87. package/dist/constants/ps-mobile-control-config.d.ts +0 -12
  88. package/dist/constants/ps-mobile-control-config.js +0 -6
  89. package/dist/constants/ps-option-picker-config.d.ts +6 -0
  90. package/dist/constants/ps-option-picker-config.js +6 -0
  91. package/dist/constants/ps-sf-symbol-config.d.ts +92 -0
  92. package/dist/constants/ps-sf-symbol-config.js +92 -0
  93. package/dist/constants/ps-sheet-page-config.d.ts +4 -0
  94. package/dist/constants/ps-sheet-page-config.js +4 -0
  95. package/dist/contexts/ps-tab-bar-context.d.ts +2 -0
  96. package/dist/contexts/ps-tab-bar-context.js +5 -0
  97. package/dist/hooks/use-ps-app-lock.d.ts +3 -0
  98. package/dist/hooks/use-ps-app-lock.js +72 -0
  99. package/dist/hooks/use-ps-menu-tiles.d.ts +4 -0
  100. package/dist/hooks/use-ps-menu-tiles.js +8 -0
  101. package/dist/hooks/use-ps-tab-bar.d.ts +2 -0
  102. package/dist/hooks/use-ps-tab-bar.js +3 -0
  103. package/dist/index.d.ts +18 -0
  104. package/dist/index.js +18 -0
  105. package/dist/interfaces/ps-action-menu-header.d.ts +1 -0
  106. package/dist/interfaces/ps-app-lock-native.d.ts +13 -0
  107. package/dist/interfaces/ps-app-lock-native.js +1 -0
  108. package/dist/interfaces/ps-app-lock-prompt.d.ts +4 -0
  109. package/dist/interfaces/ps-app-lock-prompt.js +1 -0
  110. package/dist/interfaces/ps-menu-item.d.ts +2 -0
  111. package/dist/interfaces/ps-menu-tile-request.d.ts +7 -0
  112. package/dist/interfaces/ps-menu-tile-request.js +1 -0
  113. package/dist/interfaces/ps-menu-tile-shape.d.ts +1 -0
  114. package/dist/interfaces/ps-menu-tile-shape.js +1 -0
  115. package/dist/interfaces/ps-mobile-brand-colors.d.ts +5 -0
  116. package/dist/interfaces/ps-mobile-brand-colors.js +1 -0
  117. package/dist/interfaces/ps-mobile-brand-input.d.ts +7 -0
  118. package/dist/interfaces/ps-mobile-brand-input.js +1 -0
  119. package/dist/interfaces/ps-mobile-theme-input.d.ts +1 -1
  120. package/dist/interfaces/ps-mobile-theme.d.ts +32 -0
  121. package/dist/interfaces/ps-sheet-leading-kind.d.ts +1 -0
  122. package/dist/interfaces/ps-sheet-leading-kind.js +1 -0
  123. package/dist/interfaces/ps-sheet-page.d.ts +8 -0
  124. package/dist/interfaces/ps-sheet-page.js +1 -0
  125. package/dist/interfaces/ps-tab-bar-context-data.d.ts +4 -0
  126. package/dist/interfaces/ps-tab-bar-context-data.js +1 -0
  127. package/dist/interfaces/use-ps-app-lock-options.d.ts +6 -0
  128. package/dist/interfaces/use-ps-app-lock-options.js +1 -0
  129. package/dist/interfaces/use-ps-app-lock-result.d.ts +7 -0
  130. package/dist/interfaces/use-ps-app-lock-result.js +1 -0
  131. package/dist/services/ps-action-menu-service.d.ts +4 -0
  132. package/dist/services/ps-action-menu-service.js +25 -2
  133. package/dist/services/ps-app-lock-grace-service.d.ts +6 -0
  134. package/dist/services/ps-app-lock-grace-service.js +17 -0
  135. package/dist/services/ps-app-lock-service.d.ts +10 -0
  136. package/dist/services/ps-app-lock-service.js +84 -0
  137. package/dist/services/ps-badge-tone-service.js +3 -3
  138. package/dist/services/ps-button-style-service.js +2 -2
  139. package/dist/services/ps-context-menu-service.d.ts +1 -0
  140. package/dist/services/ps-context-menu-service.js +13 -0
  141. package/dist/services/ps-list-row-style-service.d.ts +4 -0
  142. package/dist/services/ps-list-row-style-service.js +11 -0
  143. package/dist/services/ps-menu-tile-service.d.ts +16 -0
  144. package/dist/services/ps-menu-tile-service.js +70 -0
  145. package/dist/services/ps-menu-tile-style-service.d.ts +4 -0
  146. package/dist/services/ps-menu-tile-style-service.js +5 -0
  147. package/dist/services/ps-mobile-brand-service.d.ts +5 -0
  148. package/dist/services/ps-mobile-brand-service.js +24 -0
  149. package/dist/services/ps-mobile-theme-service.d.ts +0 -2
  150. package/dist/services/ps-mobile-theme-service.js +64 -94
  151. package/dist/services/ps-option-picker-service.d.ts +8 -0
  152. package/dist/services/ps-option-picker-service.js +10 -0
  153. package/dist/services/ps-selection-service.d.ts +5 -0
  154. package/dist/services/ps-selection-service.js +13 -0
  155. package/dist/services/ps-sheet-service.d.ts +5 -0
  156. package/dist/services/ps-sheet-service.js +11 -0
  157. package/dist/services/ps-text-service.js +4 -4
  158. package/jest-setup.js +71 -0
  159. package/package.json +14 -2
@@ -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,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
  }
@@ -1,104 +1,74 @@
1
- import { PallasoftBrandColorService, PallasoftChartColor, PallasoftColor, PallasoftDarkChartColor, PallasoftDarkColor, } from '@pallasoft/ps-design-system';
1
+ import { PallasoftThemeService } from '@pallasoft/ps-design-system';
2
2
  import { PsFontConfig } from '../constants/ps-font-config';
3
- import { PsMobileControlConfig } from '../constants/ps-mobile-control-config';
4
- import { PsMobileColorService } from './ps-mobile-color-service';
5
3
  export class PsMobileThemeService {
6
4
  static create({ chart, hasHaptics, isDark, isReduceMotion, primary, primaryContrast, secondary, }) {
7
- const scheme = isDark
8
- ? PsMobileThemeService.dark(primary, primaryContrast)
9
- : PsMobileThemeService.light(primary, primaryContrast);
10
- const base = {
11
- ...scheme,
12
- chart: chart === undefined || chart.length === 0 ? scheme.chart : chart,
13
- hasHaptics: hasHaptics === undefined ? true : hasHaptics,
14
- isReduceMotion: isReduceMotion === undefined ? false : isReduceMotion,
15
- };
16
- const fallback = isDark ? PallasoftDarkColor.Accent : PallasoftColor.Accent;
17
- const palette = PallasoftBrandColorService.palette(secondary === undefined ? fallback : secondary);
18
- if (palette === null)
19
- return base;
20
- return {
21
- ...base,
22
- secondary: palette.primary,
23
- secondaryContrast: palette.contrast,
24
- secondarySoft: isDark ? palette.softDark : palette.softLight,
25
- };
26
- }
27
- static light(primary, primaryContrast) {
28
- return {
29
- accent: PallasoftColor.Accent,
30
- accentSoft: PallasoftColor.Mist,
31
- background: PallasoftColor.Background,
32
- chart: [
33
- PallasoftChartColor.Chart1,
34
- PallasoftChartColor.Chart2,
35
- PallasoftChartColor.Chart3,
36
- PallasoftChartColor.Chart4,
37
- PallasoftChartColor.Chart5,
38
- ],
39
- danger: PallasoftColor.Danger,
40
- dangerSoft: PallasoftColor.DangerSoft,
41
- fonts: PsFontConfig,
42
- ink: PallasoftColor.Ink,
43
- hasHaptics: true,
44
- isDark: false,
45
- isReduceMotion: false,
46
- line: PallasoftColor.Line,
47
- muted: PallasoftColor.Muted,
48
- overlay: PsMobileColorService.withAlpha(PallasoftColor.Ink, PsMobileControlConfig.overlayAlpha),
5
+ const tokens = PallasoftThemeService.build({
49
6
  primary,
50
7
  primaryContrast,
51
- primarySoft: PsMobileColorService.withAlpha(primary, PsMobileControlConfig.softAlphaLight),
52
- secondary: PallasoftColor.Accent,
53
- secondaryContrast: PallasoftColor.White,
54
- secondarySoft: PallasoftColor.Mist,
55
- skeletonBase: PsMobileColorService.withAlpha(PallasoftColor.Ink, PsMobileControlConfig.skeletonBaseAlpha.light),
56
- skeletonSweep: PsMobileColorService.withAlpha(PallasoftColor.Ink, PsMobileControlConfig.skeletonSweepAlpha.light),
57
- success: PallasoftColor.Success,
58
- successSoft: PallasoftColor.SuccessSoft,
59
- surface: PallasoftColor.White,
60
- warning: PallasoftColor.Warning,
61
- warningSoft: PallasoftColor.WarningSoft,
62
- white: PallasoftColor.White,
63
- };
64
- }
65
- static dark(primary, primaryContrast) {
66
- const alpha = PsMobileControlConfig.softAlphaDark;
8
+ scheme: isDark ? 'dark' : 'light',
9
+ secondary,
10
+ });
67
11
  return {
68
- accent: PallasoftDarkColor.Accent,
69
- accentSoft: PallasoftDarkColor.AccentSoft,
70
- background: PallasoftDarkColor.Background,
71
- chart: [
72
- PallasoftDarkChartColor.Chart1,
73
- PallasoftDarkChartColor.Chart2,
74
- PallasoftDarkChartColor.Chart3,
75
- PallasoftDarkChartColor.Chart4,
76
- PallasoftDarkChartColor.Chart5,
77
- ],
78
- danger: PallasoftDarkColor.Danger,
79
- dangerSoft: PallasoftDarkColor.DangerSoft,
12
+ accent: tokens.accent,
13
+ accentSoft: tokens.accentSoft,
14
+ background: tokens.background,
15
+ chart: chart === undefined || chart.length === 0 ? tokens.chart : chart,
16
+ danger: tokens.danger,
17
+ dangerSoft: tokens.dangerSoft,
18
+ dangerText: tokens.dangerText,
80
19
  fonts: PsFontConfig,
81
- ink: PallasoftDarkColor.Ink,
82
- hasHaptics: true,
83
- isDark: true,
84
- isReduceMotion: false,
85
- line: PallasoftDarkColor.Line,
86
- muted: PallasoftDarkColor.Muted,
87
- overlay: PsMobileColorService.withAlpha(PallasoftDarkColor.Background, PsMobileControlConfig.overlayAlphaDark),
88
- primary,
89
- primaryContrast,
90
- primarySoft: PsMobileColorService.withAlpha(primary, alpha),
91
- secondary: PallasoftDarkColor.Accent,
92
- secondaryContrast: PallasoftDarkColor.White,
93
- secondarySoft: PallasoftDarkColor.AccentSoft,
94
- skeletonBase: PsMobileColorService.withAlpha(PallasoftDarkColor.Ink, PsMobileControlConfig.skeletonBaseAlpha.dark),
95
- skeletonSweep: PsMobileColorService.withAlpha(PallasoftDarkColor.Ink, PsMobileControlConfig.skeletonSweepAlpha.dark),
96
- success: PallasoftDarkColor.Success,
97
- successSoft: PallasoftDarkColor.SuccessSoft,
98
- surface: PallasoftDarkColor.Surface,
99
- warning: PallasoftDarkColor.Warning,
100
- warningSoft: PallasoftDarkColor.WarningSoft,
101
- white: PallasoftDarkColor.White,
20
+ hasHaptics: hasHaptics === undefined ? true : hasHaptics,
21
+ info: tokens.info,
22
+ infoSoft: tokens.infoSoft,
23
+ infoText: tokens.infoText,
24
+ ink: tokens.ink,
25
+ isDark,
26
+ isReduceMotion: isReduceMotion === undefined ? false : isReduceMotion,
27
+ line: tokens.line,
28
+ muted: tokens.muted,
29
+ overlay: tokens.overlay,
30
+ primary: tokens.primary,
31
+ primary100: tokens.primary100,
32
+ primary200: tokens.primary200,
33
+ primary300: tokens.primary300,
34
+ primary400: tokens.primary400,
35
+ primary50: tokens.primary50,
36
+ primary500: tokens.primary500,
37
+ primary600: tokens.primary600,
38
+ primary700: tokens.primary700,
39
+ primary800: tokens.primary800,
40
+ primary900: tokens.primary900,
41
+ primaryContrast: tokens.primaryContrast,
42
+ primaryPressed: tokens.primaryPressed,
43
+ primarySoft: tokens.primarySoft,
44
+ primarySoftStrong: tokens.primarySoftStrong,
45
+ primaryText: tokens.primaryText,
46
+ secondary: tokens.secondary,
47
+ secondary100: tokens.secondary100,
48
+ secondary200: tokens.secondary200,
49
+ secondary300: tokens.secondary300,
50
+ secondary400: tokens.secondary400,
51
+ secondary50: tokens.secondary50,
52
+ secondary500: tokens.secondary500,
53
+ secondary600: tokens.secondary600,
54
+ secondary700: tokens.secondary700,
55
+ secondary800: tokens.secondary800,
56
+ secondary900: tokens.secondary900,
57
+ secondaryContrast: tokens.secondaryContrast,
58
+ secondaryPressed: tokens.secondaryPressed,
59
+ secondarySoft: tokens.secondarySoft,
60
+ secondarySoftStrong: tokens.secondarySoftStrong,
61
+ secondaryText: tokens.secondaryText,
62
+ skeletonBase: tokens.skeletonBase,
63
+ skeletonSweep: tokens.skeletonSweep,
64
+ success: tokens.success,
65
+ successSoft: tokens.successSoft,
66
+ successText: tokens.successText,
67
+ surface: tokens.surface,
68
+ warning: tokens.warning,
69
+ warningSoft: tokens.warningSoft,
70
+ warningText: tokens.warningText,
71
+ white: tokens.white,
102
72
  };
103
73
  }
104
74
  }
@@ -0,0 +1,8 @@
1
+ import type { PsOptionPickerOption } from '../components/ps-option-picker/ps-option-picker-props';
2
+ export interface PsOptionPickerResult {
3
+ hasMore: boolean;
4
+ options: PsOptionPickerOption[];
5
+ }
6
+ export declare class PsOptionPickerService {
7
+ static visible(options: PsOptionPickerOption[], search: string, limit: number): PsOptionPickerResult;
8
+ }
@@ -0,0 +1,10 @@
1
+ export class PsOptionPickerService {
2
+ static visible(options, search, limit) {
3
+ const needle = search.trim().toLowerCase();
4
+ const matches = needle === ''
5
+ ? options
6
+ : options.filter((option) => option.label.toLowerCase().includes(needle) ||
7
+ (option.subtitle !== undefined && option.subtitle.toLowerCase().includes(needle)));
8
+ return { hasMore: matches.length > limit, options: matches.slice(0, limit) };
9
+ }
10
+ }
@@ -0,0 +1,5 @@
1
+ export declare class PsSelectionService {
2
+ static toggle(selectedIds: string[], id: string): string[];
3
+ static isAll(selectableIds: string[], selectedIds: string[]): boolean;
4
+ static toggleAll(selectableIds: string[], selectedIds: string[]): string[];
5
+ }
@@ -0,0 +1,13 @@
1
+ export class PsSelectionService {
2
+ static toggle(selectedIds, id) {
3
+ return selectedIds.includes(id)
4
+ ? selectedIds.filter((selectedId) => selectedId !== id)
5
+ : [...selectedIds, id];
6
+ }
7
+ static isAll(selectableIds, selectedIds) {
8
+ return selectableIds.length > 0 && selectableIds.every((id) => selectedIds.includes(id));
9
+ }
10
+ static toggleAll(selectableIds, selectedIds) {
11
+ return PsSelectionService.isAll(selectableIds, selectedIds) ? [] : [...selectableIds];
12
+ }
13
+ }
@@ -1,4 +1,6 @@
1
+ import type { ViewStyle } from 'react-native';
1
2
  import type { PsSheetAction } from '../interfaces/ps-sheet-action';
3
+ import type { PsSheetLeadingKind } from '../interfaces/ps-sheet-leading-kind';
2
4
  export declare class PsSheetService {
3
5
  static maxHeight(windowHeight: number): number;
4
6
  static bottomPadding(isFloating: boolean, bottomInset: number): number;
@@ -6,5 +8,8 @@ export declare class PsSheetService {
6
8
  static closeAction(label: string | undefined, onPress: () => void): PsSheetAction | undefined;
7
9
  static isActionInactive(action: PsSheetAction): boolean;
8
10
  static actionOpacity(action: PsSheetAction, isPressed: boolean): number;
11
+ static trailing(action: PsSheetAction | null | undefined, closeLabel: string | undefined, onClose: () => void): PsSheetAction | undefined;
12
+ static leadingIconStyle(kind: PsSheetLeadingKind): ViewStyle;
13
+ static grownHeight(previous: number, measured: number, isOpen: boolean): number;
9
14
  static shouldClose(isPresented: boolean, isOpen: boolean, isDismissBlocked: boolean): boolean;
10
15
  }
@@ -22,6 +22,17 @@ export class PsSheetService {
22
22
  }
23
23
  return isPressed ? PsSheetConfig.pressedOpacity : 1;
24
24
  }
25
+ static trailing(action, closeLabel, onClose) {
26
+ if (action === null)
27
+ return undefined;
28
+ return action === undefined ? PsSheetService.closeAction(closeLabel, onClose) : action;
29
+ }
30
+ static leadingIconStyle(kind) {
31
+ return kind === 'back' ? { transform: [{ scaleX: -1 }] } : {};
32
+ }
33
+ static grownHeight(previous, measured, isOpen) {
34
+ return isOpen ? Math.max(previous, measured) : measured;
35
+ }
25
36
  static shouldClose(isPresented, isOpen, isDismissBlocked) {
26
37
  return !isPresented && isOpen && !isDismissBlocked;
27
38
  }
@@ -3,15 +3,15 @@ export class PsTextService {
3
3
  static color(tone, theme) {
4
4
  switch (tone) {
5
5
  case 'danger':
6
- return theme.danger;
6
+ return theme.dangerText;
7
7
  case 'muted':
8
8
  return theme.muted;
9
9
  case 'primary':
10
- return theme.primary;
10
+ return theme.primaryText;
11
11
  case 'success':
12
- return theme.success;
12
+ return theme.successText;
13
13
  case 'warning':
14
- return theme.warning;
14
+ return theme.warningText;
15
15
  case 'white':
16
16
  return theme.white;
17
17
  default: