@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.
- package/dist/components/ps-action-menu/ps-action-menu-avatar-entry.d.ts +5 -0
- package/dist/components/ps-action-menu/ps-action-menu-avatar-entry.js +16 -0
- package/dist/components/ps-action-menu/ps-action-menu-entries.js +4 -2
- package/dist/components/ps-action-menu/ps-action-menu-labelled.d.ts +2 -1
- package/dist/components/ps-action-menu/ps-action-menu-labelled.js +2 -2
- package/dist/components/ps-action-menu/ps-action-menu.android.js +1 -1
- package/dist/components/ps-action-menu/ps-action-menu.ios.js +10 -1
- package/dist/components/ps-action-menu/ps-menu-tile-canvas.d.ts +6 -0
- package/dist/components/ps-action-menu/ps-menu-tile-canvas.js +5 -0
- package/dist/components/ps-action-menu/ps-menu-tile-drawing.d.ts +6 -0
- package/dist/components/ps-action-menu/ps-menu-tile-drawing.js +34 -0
- package/dist/components/ps-app-lock-screen/index.d.ts +2 -0
- package/dist/components/ps-app-lock-screen/index.js +2 -0
- package/dist/components/ps-app-lock-screen/ps-app-lock-screen-props.d.ts +9 -0
- package/dist/components/ps-app-lock-screen/ps-app-lock-screen-props.js +1 -0
- package/dist/components/ps-app-lock-screen/ps-app-lock-screen.d.ts +2 -0
- package/dist/components/ps-app-lock-screen/ps-app-lock-screen.js +19 -0
- package/dist/components/ps-chip/ps-chip.js +1 -1
- 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-form-sheet/ps-form-sheet-props.d.ts +2 -0
- package/dist/components/ps-form-sheet/ps-form-sheet.d.ts +1 -1
- package/dist/components/ps-form-sheet/ps-form-sheet.js +17 -7
- 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-context-menu.js +1 -1
- package/dist/components/ps-list/ps-list-link-menu-entry.d.ts +5 -0
- package/dist/components/ps-list/ps-list-link-menu-entry.js +11 -0
- package/dist/components/ps-list/ps-list-link-menu.d.ts +10 -0
- package/dist/components/ps-list/ps-list-link-menu.js +16 -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/components/ps-list/ps-list-props.d.ts +3 -1
- package/dist/components/ps-list/ps-list-row-body.js +2 -4
- package/dist/components/ps-list/ps-list-row.d.ts +1 -1
- package/dist/components/ps-list/ps-list-row.js +3 -2
- package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider-props.d.ts +4 -2
- package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider.d.ts +1 -1
- package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider.js +20 -10
- package/dist/components/ps-native-menu/ps-native-menu.android.js +1 -1
- package/dist/components/ps-option-picker/index.d.ts +2 -0
- package/dist/components/ps-option-picker/index.js +2 -0
- package/dist/components/ps-option-picker/ps-option-picker-props.d.ts +16 -0
- package/dist/components/ps-option-picker/ps-option-picker-props.js +1 -0
- package/dist/components/ps-option-picker/ps-option-picker.d.ts +2 -0
- package/dist/components/ps-option-picker/ps-option-picker.js +33 -0
- package/dist/components/ps-privacy-cover/index.d.ts +2 -0
- package/dist/components/ps-privacy-cover/index.js +2 -0
- package/dist/components/ps-privacy-cover/ps-privacy-cover-props.d.ts +4 -0
- package/dist/components/ps-privacy-cover/ps-privacy-cover-props.js +1 -0
- package/dist/components/ps-privacy-cover/ps-privacy-cover.d.ts +2 -0
- package/dist/components/ps-privacy-cover/ps-privacy-cover.js +17 -0
- package/dist/components/ps-search-select-field/index.d.ts +2 -0
- package/dist/components/ps-search-select-field/index.js +2 -0
- package/dist/components/ps-search-select-field/ps-search-select-field-props.d.ts +10 -0
- package/dist/components/ps-search-select-field/ps-search-select-field-props.js +1 -0
- package/dist/components/ps-search-select-field/ps-search-select-field.d.ts +2 -0
- package/dist/components/ps-search-select-field/ps-search-select-field.js +15 -0
- package/dist/components/ps-selection-mode/index.d.ts +2 -0
- package/dist/components/ps-selection-mode/index.js +2 -0
- package/dist/components/ps-selection-mode/ps-selection-mode-props.d.ts +13 -0
- package/dist/components/ps-selection-mode/ps-selection-mode-props.js +1 -0
- package/dist/components/ps-selection-mode/ps-selection-mode.d.ts +2 -0
- package/dist/components/ps-selection-mode/ps-selection-mode.js +28 -0
- package/dist/components/ps-sheet/ps-sheet-props.d.ts +4 -1
- package/dist/components/ps-sheet/ps-sheet.d.ts +1 -1
- package/dist/components/ps-sheet/ps-sheet.js +4 -5
- package/dist/components/ps-sheet-header/ps-sheet-header-props.d.ts +2 -0
- package/dist/components/ps-sheet-header/ps-sheet-header.d.ts +1 -1
- package/dist/components/ps-sheet-header/ps-sheet-header.js +2 -2
- package/dist/components/ps-sheet-page/ps-sheet-page-view.d.ts +8 -0
- package/dist/components/ps-sheet-page/ps-sheet-page-view.js +11 -0
- package/dist/components/ps-sheet-presenter/ps-sheet-presenter.ios.js +9 -2
- package/dist/components/ps-tab-bar-provider/index.d.ts +2 -0
- package/dist/components/ps-tab-bar-provider/index.js +2 -0
- package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider-props.d.ts +4 -0
- package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider-props.js +1 -0
- package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider.d.ts +2 -0
- package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider.js +8 -0
- package/dist/components/ps-tabs/ps-tabs.js +1 -1
- package/dist/components/ps-text-link/ps-text-link.js +1 -1
- package/dist/constants/ps-app-lock-config.d.ts +13 -0
- package/dist/constants/ps-app-lock-config.js +13 -0
- package/dist/constants/ps-app-lock-native-codes.d.ts +10 -0
- package/dist/constants/ps-app-lock-native-codes.js +10 -0
- package/dist/constants/ps-biometry-kind.d.ts +7 -0
- package/dist/constants/ps-biometry-kind.js +6 -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/constants/ps-list-config.d.ts +2 -0
- package/dist/constants/ps-list-config.js +2 -0
- package/dist/constants/ps-menu-tile-config.d.ts +9 -0
- package/dist/constants/ps-menu-tile-config.js +9 -0
- package/dist/constants/ps-mobile-control-config.d.ts +0 -12
- package/dist/constants/ps-mobile-control-config.js +0 -6
- package/dist/constants/ps-option-picker-config.d.ts +6 -0
- package/dist/constants/ps-option-picker-config.js +6 -0
- package/dist/constants/ps-sf-symbol-config.d.ts +92 -0
- package/dist/constants/ps-sf-symbol-config.js +92 -0
- package/dist/constants/ps-sheet-page-config.d.ts +4 -0
- package/dist/constants/ps-sheet-page-config.js +4 -0
- package/dist/contexts/ps-tab-bar-context.d.ts +2 -0
- package/dist/contexts/ps-tab-bar-context.js +5 -0
- package/dist/hooks/use-ps-app-lock.d.ts +3 -0
- package/dist/hooks/use-ps-app-lock.js +72 -0
- package/dist/hooks/use-ps-menu-tiles.d.ts +4 -0
- package/dist/hooks/use-ps-menu-tiles.js +8 -0
- package/dist/hooks/use-ps-tab-bar.d.ts +2 -0
- package/dist/hooks/use-ps-tab-bar.js +3 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/interfaces/ps-action-menu-header.d.ts +1 -0
- package/dist/interfaces/ps-app-lock-native.d.ts +13 -0
- package/dist/interfaces/ps-app-lock-native.js +1 -0
- package/dist/interfaces/ps-app-lock-prompt.d.ts +4 -0
- package/dist/interfaces/ps-app-lock-prompt.js +1 -0
- package/dist/interfaces/ps-menu-item.d.ts +2 -0
- package/dist/interfaces/ps-menu-tile-request.d.ts +7 -0
- package/dist/interfaces/ps-menu-tile-request.js +1 -0
- package/dist/interfaces/ps-menu-tile-shape.d.ts +1 -0
- package/dist/interfaces/ps-menu-tile-shape.js +1 -0
- package/dist/interfaces/ps-mobile-brand-colors.d.ts +5 -0
- package/dist/interfaces/ps-mobile-brand-colors.js +1 -0
- package/dist/interfaces/ps-mobile-brand-input.d.ts +7 -0
- package/dist/interfaces/ps-mobile-brand-input.js +1 -0
- package/dist/interfaces/ps-mobile-theme-input.d.ts +1 -1
- package/dist/interfaces/ps-mobile-theme.d.ts +32 -0
- package/dist/interfaces/ps-sheet-leading-kind.d.ts +1 -0
- package/dist/interfaces/ps-sheet-leading-kind.js +1 -0
- package/dist/interfaces/ps-sheet-page.d.ts +8 -0
- package/dist/interfaces/ps-sheet-page.js +1 -0
- package/dist/interfaces/ps-tab-bar-context-data.d.ts +4 -0
- package/dist/interfaces/ps-tab-bar-context-data.js +1 -0
- package/dist/interfaces/use-ps-app-lock-options.d.ts +6 -0
- package/dist/interfaces/use-ps-app-lock-options.js +1 -0
- package/dist/interfaces/use-ps-app-lock-result.d.ts +7 -0
- package/dist/interfaces/use-ps-app-lock-result.js +1 -0
- package/dist/services/ps-action-menu-service.d.ts +4 -0
- package/dist/services/ps-action-menu-service.js +25 -2
- package/dist/services/ps-app-lock-grace-service.d.ts +6 -0
- package/dist/services/ps-app-lock-grace-service.js +17 -0
- package/dist/services/ps-app-lock-service.d.ts +10 -0
- package/dist/services/ps-app-lock-service.js +84 -0
- package/dist/services/ps-badge-tone-service.js +3 -3
- package/dist/services/ps-button-style-service.js +2 -2
- package/dist/services/ps-context-menu-service.d.ts +1 -0
- package/dist/services/ps-context-menu-service.js +13 -0
- package/dist/services/ps-count-badge-service.d.ts +3 -0
- package/dist/services/ps-count-badge-service.js +6 -0
- package/dist/services/ps-list-row-style-service.d.ts +4 -0
- package/dist/services/ps-list-row-style-service.js +11 -0
- package/dist/services/ps-menu-tile-service.d.ts +16 -0
- package/dist/services/ps-menu-tile-service.js +70 -0
- package/dist/services/ps-menu-tile-style-service.d.ts +4 -0
- package/dist/services/ps-menu-tile-style-service.js +5 -0
- package/dist/services/ps-mobile-brand-service.d.ts +5 -0
- package/dist/services/ps-mobile-brand-service.js +24 -0
- package/dist/services/ps-mobile-theme-service.d.ts +0 -2
- package/dist/services/ps-mobile-theme-service.js +64 -94
- package/dist/services/ps-option-picker-service.d.ts +8 -0
- package/dist/services/ps-option-picker-service.js +10 -0
- package/dist/services/ps-selection-service.d.ts +5 -0
- package/dist/services/ps-selection-service.js +13 -0
- package/dist/services/ps-sheet-service.d.ts +5 -0
- package/dist/services/ps-sheet-service.js +11 -0
- package/dist/services/ps-text-service.js +4 -4
- package/jest-setup.js +71 -0
- package/package.json +14 -2
|
@@ -3,29 +3,39 @@ import { useMemo } from 'react';
|
|
|
3
3
|
import { useColorScheme } from 'react-native';
|
|
4
4
|
import { useReducedMotion } from 'react-native-reanimated';
|
|
5
5
|
import { PsMobileThemeContext } from '../../contexts/ps-mobile-theme-context';
|
|
6
|
+
import { PsMobileBrandService } from '../../services/ps-mobile-brand-service';
|
|
6
7
|
import { PsMobileThemeService } from '../../services/ps-mobile-theme-service';
|
|
7
|
-
export const PsMobileThemeProvider = ({ chartPalette, children, colorScheme, hasHaptics, isReduceMotion, primaryColor, primaryContrastColor, secondaryColor, }) => {
|
|
8
|
+
export const PsMobileThemeProvider = ({ chartPalette, children, colorScheme, hasHaptics, isReduceMotion, primaryColor, primaryContrastColor, product, secondaryColor, }) => {
|
|
8
9
|
const scheme = useColorScheme();
|
|
9
10
|
const isSystemReduced = useReducedMotion();
|
|
10
11
|
const isDark = colorScheme === undefined || colorScheme === 'system'
|
|
11
12
|
? scheme === 'dark'
|
|
12
13
|
: colorScheme === 'dark';
|
|
13
14
|
const isReduced = isSystemReduced || isReduceMotion === true;
|
|
14
|
-
const theme = useMemo(() =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const theme = useMemo(() => {
|
|
16
|
+
const brand = PsMobileBrandService.resolve({
|
|
17
|
+
primaryColor,
|
|
18
|
+
primaryContrastColor,
|
|
19
|
+
product,
|
|
20
|
+
secondaryColor,
|
|
21
|
+
});
|
|
22
|
+
return PsMobileThemeService.create({
|
|
23
|
+
chart: chartPalette === undefined ? undefined : isDark ? chartPalette.dark : chartPalette.light,
|
|
24
|
+
hasHaptics,
|
|
25
|
+
isDark,
|
|
26
|
+
isReduceMotion: isReduced,
|
|
27
|
+
primary: brand.primary,
|
|
28
|
+
primaryContrast: brand.primaryContrast,
|
|
29
|
+
secondary: brand.secondary,
|
|
30
|
+
});
|
|
31
|
+
}, [
|
|
23
32
|
chartPalette,
|
|
24
33
|
hasHaptics,
|
|
25
34
|
isDark,
|
|
26
35
|
isReduced,
|
|
27
36
|
primaryColor,
|
|
28
37
|
primaryContrastColor,
|
|
38
|
+
product,
|
|
29
39
|
secondaryColor,
|
|
30
40
|
]);
|
|
31
41
|
return _jsx(PsMobileThemeContext.Provider, { value: theme, children: children });
|
|
@@ -11,7 +11,7 @@ export const PsNativeMenu = ({ children, isDisabled = false, isFullWidth = false
|
|
|
11
11
|
const theme = usePsMobileTheme();
|
|
12
12
|
const [isOpen, setIsOpen] = useState(false);
|
|
13
13
|
const matchContents = isFullWidth ? { vertical: true } : true;
|
|
14
|
-
return (_jsx(PsHostScope, { matchContents: matchContents, children: _jsxs(DropdownMenu, { color: theme.surface, expanded: isOpen, modifiers: isFullWidth ? [fillMaxWidth()] : [], onDismissRequest: () => setIsOpen(false), children: [_jsx(DropdownMenu.Items, { children: items.map((item) => (_jsx(DropdownMenuItem, { elementColors: { textColor: item.isSelected ? theme.
|
|
14
|
+
return (_jsx(PsHostScope, { matchContents: matchContents, children: _jsxs(DropdownMenu, { color: theme.surface, expanded: isOpen, modifiers: isFullWidth ? [fillMaxWidth()] : [], onDismissRequest: () => setIsOpen(false), children: [_jsx(DropdownMenu.Items, { children: items.map((item) => (_jsx(DropdownMenuItem, { elementColors: { textColor: item.isSelected ? theme.primaryText : theme.ink }, onClick: () => {
|
|
15
15
|
setIsOpen(false);
|
|
16
16
|
haptic('selection');
|
|
17
17
|
onSelect(item.value);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface PsOptionPickerOption {
|
|
2
|
+
label: string;
|
|
3
|
+
subtitle?: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PsOptionPickerProps {
|
|
7
|
+
emptyLabel: string;
|
|
8
|
+
limit?: number;
|
|
9
|
+
moreLabel: string;
|
|
10
|
+
onSearchChange?: (search: string) => void;
|
|
11
|
+
onSelect: (value: string) => void;
|
|
12
|
+
options: PsOptionPickerOption[];
|
|
13
|
+
searchClearLabel: string;
|
|
14
|
+
searchPlaceholder: string;
|
|
15
|
+
selectedValue: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { PsOptionPickerProps } from './ps-option-picker-props';
|
|
2
|
+
export declare const PsOptionPicker: ({ emptyLabel, limit, moreLabel, onSearchChange, onSelect, options, searchClearLabel, searchPlaceholder, selectedValue, }: PsOptionPickerProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { PsIconKey } from '@pallasoft/ps-icons';
|
|
4
|
+
import { Pressable, View } from 'react-native';
|
|
5
|
+
import { PsOptionPickerConfig } from '../../constants/ps-option-picker-config';
|
|
6
|
+
import { usePsHaptics } from '../../hooks/use-ps-haptics';
|
|
7
|
+
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
8
|
+
import { PsOptionPickerService } from '../../services/ps-option-picker-service';
|
|
9
|
+
import { PsCard } from '../ps-card/ps-card';
|
|
10
|
+
import { PsIcon } from '../ps-icon/ps-icon';
|
|
11
|
+
import { PsSearchField } from '../ps-search-field/ps-search-field';
|
|
12
|
+
import { PsText } from '../ps-text/ps-text';
|
|
13
|
+
export const PsOptionPicker = ({ emptyLabel, limit = PsOptionPickerConfig.defaultLimit, moreLabel, onSearchChange, onSelect, options, searchClearLabel, searchPlaceholder, selectedValue, }) => {
|
|
14
|
+
const theme = usePsMobileTheme();
|
|
15
|
+
const haptic = usePsHaptics();
|
|
16
|
+
const [search, setSearch] = useState('');
|
|
17
|
+
const result = useMemo(() => PsOptionPickerService.visible(options, onSearchChange === undefined ? search : '', limit), [limit, onSearchChange, options, search]);
|
|
18
|
+
return (_jsxs(View, { style: { gap: PsOptionPickerConfig.gap }, children: [_jsx(PsSearchField, { clearLabel: searchClearLabel, onChange: (next) => {
|
|
19
|
+
setSearch(next);
|
|
20
|
+
if (onSearchChange !== undefined)
|
|
21
|
+
onSearchChange(next);
|
|
22
|
+
}, placeholder: searchPlaceholder, value: search }), result.options.length === 0 ? (_jsx(PsText, { tone: 'muted', children: emptyLabel })) : (_jsx(PsCard, { padding: 'none', children: result.options.map((option, index) => (_jsxs(Pressable, { accessibilityRole: 'button', accessibilityState: { selected: option.value === selectedValue }, onPress: () => {
|
|
23
|
+
haptic('selection');
|
|
24
|
+
onSelect(option.value);
|
|
25
|
+
}, style: {
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
borderTopColor: theme.line,
|
|
28
|
+
borderTopWidth: index === 0 ? 0 : 1,
|
|
29
|
+
flexDirection: 'row',
|
|
30
|
+
gap: PsOptionPickerConfig.gap,
|
|
31
|
+
padding: PsOptionPickerConfig.rowPadding,
|
|
32
|
+
}, children: [_jsxs(View, { style: { flex: 1, gap: PsOptionPickerConfig.rowGap }, children: [_jsx(PsText, { numberOfLines: 1, weight: 'semibold', children: option.label }), option.subtitle === undefined ? null : (_jsx(PsText, { numberOfLines: 1, tone: 'muted', variant: 'caption', children: option.subtitle }))] }), option.value === selectedValue ? (_jsx(PsIcon, { color: theme.primary, iconKey: PsIconKey.Check })) : null] }, option.value))) })), result.hasMore ? (_jsx(PsText, { tone: 'muted', variant: 'caption', children: moreLabel })) : null] }));
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PallasoftZIndex } from '@pallasoft/ps-design-system';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
5
|
+
import { PsPageBackdrop } from '../ps-page-backdrop/ps-page-backdrop';
|
|
6
|
+
export const PsPrivacyCover = ({ children }) => {
|
|
7
|
+
const theme = usePsMobileTheme();
|
|
8
|
+
return (_jsxs(View, { accessibilityViewIsModal: true, style: [
|
|
9
|
+
StyleSheet.absoluteFill,
|
|
10
|
+
{
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
backgroundColor: theme.background,
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
zIndex: PallasoftZIndex.TopLayer,
|
|
15
|
+
},
|
|
16
|
+
], testID: 'ps-privacy-cover', children: [_jsx(PsPageBackdrop, {}), children] }));
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { usePsHaptics } from '../../hooks/use-ps-haptics';
|
|
3
|
+
import { PsFieldFrame } from '../ps-field-frame/ps-field-frame';
|
|
4
|
+
import { PsFieldSkeleton } from '../ps-field-skeleton/ps-field-skeleton';
|
|
5
|
+
import { PsSelectControl } from '../ps-select/ps-select-control';
|
|
6
|
+
import { PsSelectTrigger } from '../ps-select/ps-select-trigger';
|
|
7
|
+
export const PsSearchSelectField = ({ errorText, helperText, isDisabled = false, isLoading = false, label, onPress, placeholder, selectedLabel, }) => {
|
|
8
|
+
const haptic = usePsHaptics();
|
|
9
|
+
if (isLoading)
|
|
10
|
+
return _jsx(PsFieldSkeleton, {});
|
|
11
|
+
return (_jsx(PsFieldFrame, { errorText: errorText, helperText: helperText, label: label, children: _jsx(PsSelectTrigger, { isDisabled: isDisabled, label: label, onPress: () => {
|
|
12
|
+
haptic('selection');
|
|
13
|
+
onPress();
|
|
14
|
+
}, children: _jsx(PsSelectControl, { errorText: errorText, isDisabled: isDisabled, isFocused: false, placeholder: placeholder, selectedLabel: selectedLabel, size: 'default' }) }) }));
|
|
15
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PsMenuItem } from '../../interfaces/ps-menu-item';
|
|
2
|
+
export interface PsSelectionModeProps {
|
|
3
|
+
actions: PsMenuItem[];
|
|
4
|
+
deselectAllLabel: string;
|
|
5
|
+
doneLabel: string;
|
|
6
|
+
isAllSelected: boolean;
|
|
7
|
+
isSelecting: boolean;
|
|
8
|
+
onDone: () => void;
|
|
9
|
+
onSelectAll: () => void;
|
|
10
|
+
selectAllLabel: string;
|
|
11
|
+
selectedTitle: string;
|
|
12
|
+
title: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { PsSelectionModeProps } from './ps-selection-mode-props';
|
|
2
|
+
export declare const PsSelectionMode: ({ actions, deselectAllLabel, doneLabel, isAllSelected, isSelecting, onDone, onSelectAll, selectAllLabel, selectedTitle, title, }: PsSelectionModeProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useEffect } from 'react';
|
|
3
|
+
import { Stack } from 'expo-router';
|
|
4
|
+
import { usePsHaptics } from '../../hooks/use-ps-haptics';
|
|
5
|
+
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
6
|
+
import { usePsTabBar } from '../../hooks/use-ps-tab-bar';
|
|
7
|
+
import { PsActionMenuService } from '../../services/ps-action-menu-service';
|
|
8
|
+
export const PsSelectionMode = ({ actions, deselectAllLabel, doneLabel, isAllSelected, isSelecting, onDone, onSelectAll, selectAllLabel, selectedTitle, title, }) => {
|
|
9
|
+
const theme = usePsMobileTheme();
|
|
10
|
+
const haptic = usePsHaptics();
|
|
11
|
+
const { setIsHidden } = usePsTabBar();
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
setIsHidden(isSelecting);
|
|
14
|
+
return () => setIsHidden(false);
|
|
15
|
+
}, [isSelecting, setIsHidden]);
|
|
16
|
+
if (!isSelecting)
|
|
17
|
+
return _jsx(Stack.Screen, { options: { headerBackVisible: true, title } });
|
|
18
|
+
return (_jsxs(_Fragment, { children: [_jsx(Stack.Screen, { options: { headerBackVisible: false, title: selectedTitle } }), _jsx(Stack.Toolbar, { placement: 'left', children: _jsx(Stack.Toolbar.Button, { onPress: () => {
|
|
19
|
+
haptic('selection');
|
|
20
|
+
onSelectAll();
|
|
21
|
+
}, tintColor: theme.primaryText, children: isAllSelected ? deselectAllLabel : selectAllLabel }) }), _jsx(Stack.Toolbar, { placement: 'right', children: _jsx(Stack.Toolbar.Button, { onPress: () => {
|
|
22
|
+
haptic('light');
|
|
23
|
+
onDone();
|
|
24
|
+
}, tintColor: theme.primaryText, variant: 'done', children: doneLabel }) }), _jsxs(Stack.Toolbar, { placement: 'bottom', children: [_jsx(Stack.Toolbar.Spacer, {}), actions.map((item) => (_jsxs(Fragment, { children: [_jsx(Stack.Toolbar.Button, { disabled: item.isDisabled === true, icon: PsActionMenuService.symbol(item), onPress: () => {
|
|
25
|
+
haptic('medium');
|
|
26
|
+
item.onSelect();
|
|
27
|
+
}, tintColor: item.isDanger === true ? theme.danger : theme.primaryText, children: item.label }), _jsx(Stack.Toolbar.Spacer, {})] }, item.id)))] })] }));
|
|
28
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { PsSheetAction } from '../../interfaces/ps-sheet-action';
|
|
3
|
+
import type { PsSheetLeadingKind } from '../../interfaces/ps-sheet-leading-kind';
|
|
3
4
|
export interface PsSheetProps {
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
closeLabel?: string;
|
|
@@ -8,8 +9,10 @@ export interface PsSheetProps {
|
|
|
8
9
|
isDismissBlocked?: boolean;
|
|
9
10
|
isOpen: boolean;
|
|
10
11
|
isScrollable?: boolean;
|
|
12
|
+
leadingKind?: PsSheetLeadingKind;
|
|
11
13
|
leadingLabel?: string;
|
|
12
14
|
onClose: () => void;
|
|
15
|
+
onLeadingPress?: () => void;
|
|
13
16
|
title: string;
|
|
14
|
-
trailingAction?: PsSheetAction;
|
|
17
|
+
trailingAction?: PsSheetAction | null;
|
|
15
18
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PsSheetProps } from './ps-sheet-props';
|
|
2
|
-
export declare const PsSheet: ({ children, closeLabel, eyebrow, footer, isDismissBlocked, isOpen, isScrollable, leadingLabel, onClose, title, trailingAction, }: PsSheetProps) => import("react").JSX.Element;
|
|
2
|
+
export declare const PsSheet: ({ children, closeLabel, eyebrow, footer, isDismissBlocked, isOpen, isScrollable, leadingKind, leadingLabel, onClose, onLeadingPress, title, trailingAction, }: PsSheetProps) => import("react").JSX.Element;
|
|
@@ -2,13 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { PsSheetService } from '../../services/ps-sheet-service';
|
|
3
3
|
import { PsSheetContent } from '../ps-sheet-content/ps-sheet-content';
|
|
4
4
|
import { PsSheetPresenter } from '../ps-sheet-presenter/ps-sheet-presenter';
|
|
5
|
-
export const PsSheet = ({ children, closeLabel, eyebrow, footer, isDismissBlocked = false, isOpen, isScrollable = true, leadingLabel, onClose, title, trailingAction, }) => (_jsx(PsSheetPresenter, { isDismissBlocked: isDismissBlocked, isOpen: isOpen, onClose: onClose, children: _jsx(PsSheetContent, { footer: footer, header: {
|
|
5
|
+
export const PsSheet = ({ children, closeLabel, eyebrow, footer, isDismissBlocked = false, isOpen, isScrollable = true, leadingKind = 'close', leadingLabel, onClose, onLeadingPress, title, trailingAction, }) => (_jsx(PsSheetPresenter, { isDismissBlocked: isDismissBlocked, isOpen: isOpen, onClose: onClose, children: _jsx(PsSheetContent, { footer: footer, header: {
|
|
6
6
|
eyebrow,
|
|
7
7
|
isLeadingDisabled: isDismissBlocked,
|
|
8
|
+
leadingKind,
|
|
8
9
|
leadingLabel,
|
|
9
|
-
onLeadingPress: onClose,
|
|
10
|
+
onLeadingPress: onLeadingPress === undefined ? onClose : onLeadingPress,
|
|
10
11
|
title,
|
|
11
|
-
trailing: trailingAction
|
|
12
|
-
? PsSheetService.closeAction(closeLabel, onClose)
|
|
13
|
-
: trailingAction,
|
|
12
|
+
trailing: PsSheetService.trailing(trailingAction, closeLabel, onClose),
|
|
14
13
|
}, isScrollable: isScrollable, children: children }) }));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { PsSheetAction } from '../../interfaces/ps-sheet-action';
|
|
2
|
+
import type { PsSheetLeadingKind } from '../../interfaces/ps-sheet-leading-kind';
|
|
2
3
|
export interface PsSheetHeaderProps {
|
|
3
4
|
eyebrow?: string;
|
|
4
5
|
isLeadingDisabled?: boolean;
|
|
6
|
+
leadingKind?: PsSheetLeadingKind;
|
|
5
7
|
leadingLabel?: string;
|
|
6
8
|
onLeadingPress?: () => void;
|
|
7
9
|
title: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PsSheetHeaderProps } from './ps-sheet-header-props';
|
|
2
|
-
export declare const PsSheetHeader: ({ eyebrow, isLeadingDisabled, leadingLabel, onLeadingPress, title, trailing, }: PsSheetHeaderProps) => import("react").JSX.Element;
|
|
2
|
+
export declare const PsSheetHeader: ({ eyebrow, isLeadingDisabled, leadingKind, leadingLabel, onLeadingPress, title, trailing, }: PsSheetHeaderProps) => import("react").JSX.Element;
|
|
@@ -8,7 +8,7 @@ import { PsSheetService } from '../../services/ps-sheet-service';
|
|
|
8
8
|
import { PsIconButton } from '../ps-icon-button/ps-icon-button';
|
|
9
9
|
import { PsSpinner } from '../ps-spinner/ps-spinner';
|
|
10
10
|
import { PsText } from '../ps-text/ps-text';
|
|
11
|
-
export const PsSheetHeader = ({ eyebrow, isLeadingDisabled = false, leadingLabel, onLeadingPress, title, trailing, }) => {
|
|
11
|
+
export const PsSheetHeader = ({ eyebrow, isLeadingDisabled = false, leadingKind = 'close', leadingLabel, onLeadingPress, title, trailing, }) => {
|
|
12
12
|
const theme = usePsMobileTheme();
|
|
13
13
|
const trailingColor = trailing?.tone === 'danger' ? theme.danger : theme.primary;
|
|
14
14
|
const trailingContrast = trailing?.tone === 'danger' ? theme.white : theme.primaryContrast;
|
|
@@ -21,7 +21,7 @@ export const PsSheetHeader = ({ eyebrow, isLeadingDisabled = false, leadingLabel
|
|
|
21
21
|
paddingBottom: PsSheetConfig.headerPaddingBottom,
|
|
22
22
|
paddingHorizontal: PsSheetConfig.headerPaddingHorizontal,
|
|
23
23
|
paddingTop: PsSheetConfig.headerPaddingTop,
|
|
24
|
-
}, testID: 'ps-sheet-header', children: [_jsx(View, { style: { alignItems: 'flex-start', minWidth: PsSheetConfig.actionMinWidth }, children: leadingLabel === undefined ? null : (_jsx(PsIconButton, { iconKey: PsIconKey.Close, isDisabled: isLeadingDisabled, label: leadingLabel, onPress: onLeadingPress, testID: 'ps-sheet-leading', variant: 'header' })) }), _jsxs(View, { style: { alignItems: 'center', flex: 1 }, children: [_jsx(PsText, { accessibilityRole: 'header', align: 'center', numberOfLines: 2, weight: 'bold', children: title }), eyebrow === undefined ? null : (_jsx(PsText, { align: 'center', numberOfLines: 1, tone: 'muted', variant: 'small', children: eyebrow }))] }), _jsx(View, { style: { alignItems: 'flex-end', minWidth: PsSheetConfig.actionMinWidth }, children: trailing === undefined ? null : trailing.isSubmitting === true ? (_jsx(View, { accessibilityLabel: trailing.label, accessibilityState: { busy: true }, style: {
|
|
24
|
+
}, testID: 'ps-sheet-header', children: [_jsx(View, { style: { alignItems: 'flex-start', minWidth: PsSheetConfig.actionMinWidth }, children: leadingLabel === undefined ? null : (_jsx(View, { style: PsSheetService.leadingIconStyle(leadingKind), children: _jsx(PsIconButton, { iconKey: leadingKind === 'back' ? PsIconKey.ChevronRight : PsIconKey.Close, isDisabled: isLeadingDisabled, label: leadingLabel, onPress: onLeadingPress, testID: 'ps-sheet-leading', variant: 'header' }) })) }), _jsxs(View, { style: { alignItems: 'center', flex: 1 }, children: [_jsx(PsText, { accessibilityRole: 'header', align: 'center', numberOfLines: 2, weight: 'bold', children: title }), eyebrow === undefined ? null : (_jsx(PsText, { align: 'center', numberOfLines: 1, tone: 'muted', variant: 'small', children: eyebrow }))] }), _jsx(View, { style: { alignItems: 'flex-end', minWidth: PsSheetConfig.actionMinWidth }, children: trailing === undefined ? null : trailing.isSubmitting === true ? (_jsx(View, { accessibilityLabel: trailing.label, accessibilityState: { busy: true }, style: {
|
|
25
25
|
alignItems: 'center',
|
|
26
26
|
backgroundColor: trailingColor,
|
|
27
27
|
borderRadius: PsPageHeaderConfig.buttonSize / 2,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface PsSheetPageViewProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
isAnimated: boolean;
|
|
5
|
+
isPage: boolean;
|
|
6
|
+
pageId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const PsSheetPageView: ({ children, isAnimated, isPage, pageId }: PsSheetPageViewProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Animated, { SlideInLeft, SlideInRight } from 'react-native-reanimated';
|
|
3
|
+
import { PsSheetPageConfig } from '../../constants/ps-sheet-page-config';
|
|
4
|
+
import { usePsMobileTheme } from '../../hooks/use-ps-mobile-theme';
|
|
5
|
+
export const PsSheetPageView = ({ children, isAnimated, isPage, pageId }) => {
|
|
6
|
+
const theme = usePsMobileTheme();
|
|
7
|
+
const entering = theme.isReduceMotion || !isAnimated
|
|
8
|
+
? undefined
|
|
9
|
+
: (isPage ? SlideInRight : SlideInLeft).duration(PsSheetPageConfig.duration);
|
|
10
|
+
return (_jsx(Animated.View, { entering: entering, testID: `ps-sheet-page-${pageId}`, children: children }, pageId));
|
|
11
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { BottomSheet, Group, RNHostView } from '@expo/ui/swift-ui';
|
|
4
4
|
import { frame, interactiveDismissDisabled, presentationBackground, presentationDetents, presentationDragIndicator, } from '@expo/ui/swift-ui/modifiers';
|
|
5
5
|
import { PsNativeTreeContext } from '../../contexts/ps-native-tree-context';
|
|
@@ -14,6 +14,13 @@ export const PsSheetPresenter = ({ children, isDismissBlocked, isOpen, onClose,
|
|
|
14
14
|
const [height, setHeight] = useState(0);
|
|
15
15
|
isOpenRef.current = isOpen;
|
|
16
16
|
isBlockedRef.current = isDismissBlocked;
|
|
17
|
+
const measure = useCallback((next) => {
|
|
18
|
+
setHeight((previous) => PsSheetService.grownHeight(previous, next, isOpenRef.current));
|
|
19
|
+
}, []);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!isOpen)
|
|
22
|
+
setHeight(0);
|
|
23
|
+
}, [isOpen]);
|
|
17
24
|
return (_jsx(PsHost, { matchContents: true, children: _jsx(BottomSheet, { isPresented: isOpen, onIsPresentedChange: (isPresented) => {
|
|
18
25
|
if (PsSheetService.shouldClose(isPresented, isOpenRef.current, isBlockedRef.current)) {
|
|
19
26
|
onClose();
|
|
@@ -24,5 +31,5 @@ export const PsSheetPresenter = ({ children, isDismissBlocked, isOpen, onClose,
|
|
|
24
31
|
presentationDragIndicator('visible'),
|
|
25
32
|
presentationBackground(theme.background),
|
|
26
33
|
interactiveDismissDisabled(isDismissBlocked),
|
|
27
|
-
], children: _jsx(RNHostView, { matchContents: { vertical: true }, children: _jsx(PsNativeTreeContext.Provider, { value: false, children: _jsx(PsSheetMeasureContext.Provider, { value:
|
|
34
|
+
], children: _jsx(RNHostView, { matchContents: { vertical: true }, children: _jsx(PsNativeTreeContext.Provider, { value: false, children: _jsx(PsSheetMeasureContext.Provider, { value: measure, children: children }) }) }) }) }) }));
|
|
28
35
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { PsTabBarContext } from '../../contexts/ps-tab-bar-context';
|
|
4
|
+
export const PsTabBarProvider = ({ children }) => {
|
|
5
|
+
const [isHidden, setIsHidden] = useState(false);
|
|
6
|
+
const value = useMemo(() => ({ isHidden, setIsHidden }), [isHidden]);
|
|
7
|
+
return _jsx(PsTabBarContext.Provider, { value: value, children: children });
|
|
8
|
+
};
|
|
@@ -25,7 +25,7 @@ export const PsTabs = ({ getItemIcon, getItemKey, getItemLabel, isLoading = fals
|
|
|
25
25
|
return (_jsx(View, { onLayout: (event) => setViewportWidth(event.nativeEvent.layout.width), style: { borderBottomColor: theme.line, borderBottomWidth: 1 }, children: _jsx(ScrollView, { accessibilityRole: 'tablist', contentContainerStyle: { flexGrow: 1 }, horizontal: true, ref: scroll, showsHorizontalScrollIndicator: false, children: items.map((item) => {
|
|
26
26
|
const key = getItemKey(item);
|
|
27
27
|
const isSelected = key === selectedKey;
|
|
28
|
-
const color = isSelected ? theme.
|
|
28
|
+
const color = isSelected ? theme.primaryText : theme.muted;
|
|
29
29
|
return (_jsxs(Pressable, { accessibilityRole: 'tab', accessibilityState: { selected: isSelected }, onLayout: (event) => frames.current.set(key, {
|
|
30
30
|
width: event.nativeEvent.layout.width,
|
|
31
31
|
x: event.nativeEvent.layout.x,
|
|
@@ -6,7 +6,7 @@ export const PsTextLink = ({ children, onPress, tone = 'emphasis' }) => {
|
|
|
6
6
|
const isEmphasis = tone === 'emphasis';
|
|
7
7
|
const isWhite = tone === 'white';
|
|
8
8
|
return (_jsx(PsText, { accessibilityRole: 'link', onPress: onPress, style: {
|
|
9
|
-
textDecorationColor: isEmphasis ? theme.
|
|
9
|
+
textDecorationColor: isEmphasis ? theme.primaryText : isWhite ? theme.white : theme.muted,
|
|
10
10
|
textDecorationLine: 'underline',
|
|
11
11
|
}, tone: isWhite ? 'white' : isEmphasis ? 'ink' : 'muted', weight: isEmphasis || isWhite ? 'semibold' : 'regular', children: children }));
|
|
12
12
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const PsAppLockConfig: {
|
|
2
|
+
readonly activeState: "active";
|
|
3
|
+
readonly backgroundState: "background";
|
|
4
|
+
readonly inactiveState: "inactive";
|
|
5
|
+
readonly defaultGraceSeconds: 60;
|
|
6
|
+
readonly iosPlatform: "ios";
|
|
7
|
+
readonly nativeModuleName: "ExpoLocalAuthentication";
|
|
8
|
+
readonly layout: {
|
|
9
|
+
readonly gap: 24;
|
|
10
|
+
readonly horizontalPadding: 20;
|
|
11
|
+
readonly maxWidth: 384;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const PsAppLockConfig = {
|
|
2
|
+
activeState: 'active',
|
|
3
|
+
backgroundState: 'background',
|
|
4
|
+
inactiveState: 'inactive',
|
|
5
|
+
defaultGraceSeconds: 60,
|
|
6
|
+
iosPlatform: 'ios',
|
|
7
|
+
nativeModuleName: 'ExpoLocalAuthentication',
|
|
8
|
+
layout: {
|
|
9
|
+
gap: 24,
|
|
10
|
+
horizontalPadding: 20,
|
|
11
|
+
maxWidth: 384,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const PsMenuTileConfig: {
|
|
2
|
+
readonly dataUriPrefix: "data:image/png;base64,";
|
|
3
|
+
readonly fontSize: 40;
|
|
4
|
+
readonly initialsFontSize: 34;
|
|
5
|
+
readonly logoPadding: 12;
|
|
6
|
+
readonly roundedRadius: 22;
|
|
7
|
+
readonly size: 96;
|
|
8
|
+
readonly textBaseline: 0.36;
|
|
9
|
+
};
|