@swan-io/lake 1.0.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/HISTORY.md +3 -0
- package/LICENSE +21 -0
- package/README.md +49 -0
- package/package.json +60 -0
- package/src/components/Alert.d.ts +10 -0
- package/src/components/Alert.js +36 -0
- package/src/components/AppOpeningAnimation.d.ts +10 -0
- package/src/components/AppOpeningAnimation.js +50 -0
- package/src/components/AutoWidthImage.d.ts +8 -0
- package/src/components/AutoWidthImage.js +26 -0
- package/src/components/Avatar.d.ts +7 -0
- package/src/components/Avatar.js +42 -0
- package/src/components/BorderedButton.d.ts +16 -0
- package/src/components/BorderedButton.js +98 -0
- package/src/components/BorderedIcon.d.ts +12 -0
- package/src/components/BorderedIcon.js +25 -0
- package/src/components/BottomPanel.d.ts +9 -0
- package/src/components/BottomPanel.js +94 -0
- package/src/components/Box.d.ts +65 -0
- package/src/components/Box.js +31 -0
- package/src/components/Breadcrumbs.d.ts +18 -0
- package/src/components/Breadcrumbs.js +362 -0
- package/src/components/Button.d.ts +15 -0
- package/src/components/Button.js +83 -0
- package/src/components/Caption.d.ts +6 -0
- package/src/components/Caption.js +11 -0
- package/src/components/Checkbox.d.ts +12 -0
- package/src/components/Checkbox.js +83 -0
- package/src/components/ChoicePicker.d.ts +11 -0
- package/src/components/ChoicePicker.js +99 -0
- package/src/components/Combobox.d.ts +29 -0
- package/src/components/Combobox.js +182 -0
- package/src/components/FailureIcon.d.ts +8 -0
- package/src/components/FailureIcon.js +4 -0
- package/src/components/FileTile.d.ts +11 -0
- package/src/components/FileTile.js +37 -0
- package/src/components/Fill.d.ts +8 -0
- package/src/components/Fill.js +24 -0
- package/src/components/FilterChooser.d.ts +15 -0
- package/src/components/FilterChooser.js +52 -0
- package/src/components/Filters.d.ts +57 -0
- package/src/components/Filters.js +229 -0
- package/src/components/FixedListView.d.ts +104 -0
- package/src/components/FixedListView.js +821 -0
- package/src/components/FixedListViewCells.d.ts +55 -0
- package/src/components/FixedListViewCells.js +157 -0
- package/src/components/Flag.d.ts +8 -0
- package/src/components/Flag.js +36 -0
- package/src/components/FlowPresentation.d.ts +12 -0
- package/src/components/FlowPresentation.js +70 -0
- package/src/components/FocusTrap.d.ts +16 -0
- package/src/components/FocusTrap.js +90 -0
- package/src/components/Form.d.ts +8 -0
- package/src/components/Form.js +17 -0
- package/src/components/FullViewportLayer.d.ts +7 -0
- package/src/components/FullViewportLayer.js +91 -0
- package/src/components/Grid.d.ts +13 -0
- package/src/components/Grid.js +33 -0
- package/src/components/Heading.d.ts +61 -0
- package/src/components/Heading.js +27 -0
- package/src/components/Icon.d.ts +191 -0
- package/src/components/Icon.js +11 -0
- package/src/components/Input.d.ts +34 -0
- package/src/components/Input.js +115 -0
- package/src/components/InputError.d.ts +8 -0
- package/src/components/InputError.js +16 -0
- package/src/components/Label.d.ts +10 -0
- package/src/components/Label.js +19 -0
- package/src/components/LakeAlert.d.ts +14 -0
- package/src/components/LakeAlert.js +75 -0
- package/src/components/LakeButton.d.ts +36 -0
- package/src/components/LakeButton.js +171 -0
- package/src/components/LakeCheckbox.d.ts +16 -0
- package/src/components/LakeCheckbox.js +54 -0
- package/src/components/LakeCombobox.d.ts +28 -0
- package/src/components/LakeCombobox.js +166 -0
- package/src/components/LakeCopyButton.d.ts +10 -0
- package/src/components/LakeCopyButton.js +16 -0
- package/src/components/LakeDownloadButton.d.ts +8 -0
- package/src/components/LakeDownloadButton.js +6 -0
- package/src/components/LakeHeading.d.ts +10 -0
- package/src/components/LakeHeading.js +19 -0
- package/src/components/LakeLabel.d.ts +19 -0
- package/src/components/LakeLabel.js +43 -0
- package/src/components/LakeModal.d.ts +14 -0
- package/src/components/LakeModal.js +132 -0
- package/src/components/LakeRadio.d.ts +9 -0
- package/src/components/LakeRadio.js +44 -0
- package/src/components/LakeScrollView.d.ts +10 -0
- package/src/components/LakeScrollView.js +35 -0
- package/src/components/LakeSearchField.d.ts +10 -0
- package/src/components/LakeSearchField.js +111 -0
- package/src/components/LakeSelect.d.ts +30 -0
- package/src/components/LakeSelect.js +183 -0
- package/src/components/LakeSlider.d.ts +12 -0
- package/src/components/LakeSlider.js +31 -0
- package/src/components/LakeStepper.d.ts +21 -0
- package/src/components/LakeStepper.js +134 -0
- package/src/components/LakeText.d.ts +19 -0
- package/src/components/LakeText.js +20 -0
- package/src/components/LakeTextInput.d.ts +36 -0
- package/src/components/LakeTextInput.js +154 -0
- package/src/components/LakeTooltip.d.ts +24 -0
- package/src/components/LakeTooltip.js +188 -0
- package/src/components/Link.d.ts +138 -0
- package/src/components/Link.js +23 -0
- package/src/components/ListRightPanel.d.ts +17 -0
- package/src/components/ListRightPanel.js +79 -0
- package/src/components/LoadingView.d.ts +9 -0
- package/src/components/LoadingView.js +24 -0
- package/src/components/Modal.d.ts +12 -0
- package/src/components/Modal.js +80 -0
- package/src/components/MultiSelect.d.ts +27 -0
- package/src/components/MultiSelect.js +223 -0
- package/src/components/MultilineInput.d.ts +15 -0
- package/src/components/MultilineInput.js +55 -0
- package/src/components/Picker.d.ts +26 -0
- package/src/components/Picker.js +116 -0
- package/src/components/PlainListView.d.ts +36 -0
- package/src/components/PlainListView.js +208 -0
- package/src/components/Popover.d.ts +23 -0
- package/src/components/Popover.js +147 -0
- package/src/components/PopoverContent.d.ts +8 -0
- package/src/components/PopoverContent.js +9 -0
- package/src/components/Portal.d.ts +7 -0
- package/src/components/Portal.js +9 -0
- package/src/components/Pressable.d.ts +348 -0
- package/src/components/Pressable.js +91 -0
- package/src/components/ProgressBar.d.ts +11 -0
- package/src/components/ProgressBar.js +46 -0
- package/src/components/ProjectEnvTag.d.ts +7 -0
- package/src/components/ProjectEnvTag.js +12 -0
- package/src/components/QuickActions.d.ts +15 -0
- package/src/components/QuickActions.js +38 -0
- package/src/components/RadioGroup.d.ts +16 -0
- package/src/components/RadioGroup.js +34 -0
- package/src/components/ReadOnlyFieldList.d.ts +6 -0
- package/src/components/ReadOnlyFieldList.js +8 -0
- package/src/components/ResponsiveContainer.d.ts +13 -0
- package/src/components/ResponsiveContainer.js +23 -0
- package/src/components/RightPanel.d.ts +10 -0
- package/src/components/RightPanel.js +102 -0
- package/src/components/SegmentedControl.d.ts +19 -0
- package/src/components/SegmentedControl.js +74 -0
- package/src/components/Separator.d.ts +10 -0
- package/src/components/Separator.js +19 -0
- package/src/components/SidebarNavigationTracker.d.ts +13 -0
- package/src/components/SidebarNavigationTracker.js +93 -0
- package/src/components/Slider.d.ts +11 -0
- package/src/components/Slider.js +119 -0
- package/src/components/SmsOpeningAnimation.d.ts +8 -0
- package/src/components/SmsOpeningAnimation.js +52 -0
- package/src/components/Space.d.ts +10 -0
- package/src/components/Space.js +23 -0
- package/src/components/Stack.d.ts +12 -0
- package/src/components/Stack.js +23 -0
- package/src/components/StepDots.d.ts +7 -0
- package/src/components/StepDots.js +24 -0
- package/src/components/Stepper.d.ts +9 -0
- package/src/components/Stepper.js +67 -0
- package/src/components/SuccessIcon.d.ts +8 -0
- package/src/components/SuccessIcon.js +4 -0
- package/src/components/Svg.d.ts +145 -0
- package/src/components/Svg.js +24 -0
- package/src/components/SwanLogo.d.ts +8 -0
- package/src/components/SwanLogo.js +11 -0
- package/src/components/Switch.d.ts +9 -0
- package/src/components/Switch.js +74 -0
- package/src/components/TabView.d.ts +16 -0
- package/src/components/TabView.js +398 -0
- package/src/components/Table.d.ts +34 -0
- package/src/components/Table.js +79 -0
- package/src/components/Tag.d.ts +17 -0
- package/src/components/Tag.js +76 -0
- package/src/components/Tile.d.ts +34 -0
- package/src/components/Tile.js +130 -0
- package/src/components/TilePlaceholder.d.ts +6 -0
- package/src/components/TilePlaceholder.js +51 -0
- package/src/components/ToastStack.d.ts +2 -0
- package/src/components/ToastStack.js +96 -0
- package/src/components/Tooltip.d.ts +18 -0
- package/src/components/Tooltip.js +162 -0
- package/src/components/TransitionGroupView.d.ts +12 -0
- package/src/components/TransitionGroupView.js +43 -0
- package/src/components/TransitionView.d.ts +12 -0
- package/src/components/TransitionView.js +43 -0
- package/src/components/WithCurrentColor.d.ts +12 -0
- package/src/components/WithCurrentColor.js +65 -0
- package/src/components/WithPartnerAccentColor.d.ts +7 -0
- package/src/components/WithPartnerAccentColor.js +91 -0
- package/src/constants/colors.d.ts +42 -0
- package/src/constants/colors.js +42 -0
- package/src/constants/commonStyles.d.ts +66 -0
- package/src/constants/commonStyles.js +45 -0
- package/src/constants/design.d.ts +168 -0
- package/src/constants/design.js +564 -0
- package/src/constants/insets.d.ts +10 -0
- package/src/constants/insets.js +22 -0
- package/src/constants/typography.d.ts +26 -0
- package/src/constants/typography.js +54 -0
- package/src/hooks/useAnimatedValue.d.ts +2 -0
- package/src/hooks/useAnimatedValue.js +3 -0
- package/src/hooks/useBodyClassName.d.ts +3 -0
- package/src/hooks/useBodyClassName.js +14 -0
- package/src/hooks/useBoolean.d.ts +8 -0
- package/src/hooks/useBoolean.js +12 -0
- package/src/hooks/useComputedColors.d.ts +10 -0
- package/src/hooks/useComputedColors.js +42 -0
- package/src/hooks/useDebounce.d.ts +1 -0
- package/src/hooks/useDebounce.js +12 -0
- package/src/hooks/useDisclosure.d.ts +8 -0
- package/src/hooks/useDisclosure.js +12 -0
- package/src/hooks/useFirstMountState.d.ts +1 -0
- package/src/hooks/useFirstMountState.js +9 -0
- package/src/hooks/useForceableState.d.ts +1 -0
- package/src/hooks/useForceableState.js +6 -0
- package/src/hooks/useHover.d.ts +11 -0
- package/src/hooks/useHover.js +4 -0
- package/src/hooks/useInterval.d.ts +1 -0
- package/src/hooks/useInterval.js +11 -0
- package/src/hooks/useLazyRef.d.ts +2 -0
- package/src/hooks/useLazyRef.js +9 -0
- package/src/hooks/useMergeRefs.d.ts +2 -0
- package/src/hooks/useMergeRefs.js +5 -0
- package/src/hooks/useNativeProp.d.ts +2 -0
- package/src/hooks/useNativeProp.js +9 -0
- package/src/hooks/useOutsideClick.d.ts +8 -0
- package/src/hooks/useOutsideClick.js +54 -0
- package/src/hooks/usePersistedState.d.ts +1 -0
- package/src/hooks/usePersistedState.js +21 -0
- package/src/hooks/usePressEvents.d.ts +31 -0
- package/src/hooks/usePressEvents.js +4 -0
- package/src/hooks/usePreviousValue.d.ts +1 -0
- package/src/hooks/usePreviousValue.js +8 -0
- package/src/hooks/useResponsive.d.ts +7 -0
- package/src/hooks/useResponsive.js +20 -0
- package/src/hooks/useUpdateEffect.d.ts +2 -0
- package/src/hooks/useUpdateEffect.js +10 -0
- package/src/hooks/useUrqlMutation.d.ts +4 -0
- package/src/hooks/useUrqlMutation.js +30 -0
- package/src/hooks/useUrqlQuery.d.ts +19 -0
- package/src/hooks/useUrqlQuery.js +73 -0
- package/src/state/toasts.d.ts +21 -0
- package/src/state/toasts.js +61 -0
- package/src/utils/__tests__/array.test.d.ts +1 -0
- package/src/utils/__tests__/array.test.js +127 -0
- package/src/utils/__tests__/base64.test.d.ts +1 -0
- package/src/utils/__tests__/base64.test.js +27 -0
- package/src/utils/__tests__/function.test.d.ts +1 -0
- package/src/utils/__tests__/function.test.js +36 -0
- package/src/utils/__tests__/object.test.d.ts +1 -0
- package/src/utils/__tests__/object.test.js +17 -0
- package/src/utils/__tests__/rifm.test.d.ts +1 -0
- package/src/utils/__tests__/rifm.test.js +124 -0
- package/src/utils/__tests__/string.test.d.ts +1 -0
- package/src/utils/__tests__/string.test.js +16 -0
- package/src/utils/a11y.d.ts +1 -0
- package/src/utils/a11y.js +18 -0
- package/src/utils/array.d.ts +6 -0
- package/src/utils/array.js +71 -0
- package/src/utils/base64.d.ts +2 -0
- package/src/utils/base64.js +20 -0
- package/src/utils/file.d.ts +2 -0
- package/src/utils/file.js +10 -0
- package/src/utils/flagCountry.d.ts +1 -0
- package/src/utils/flagCountry.js +1 -0
- package/src/utils/function.d.ts +4 -0
- package/src/utils/function.js +19 -0
- package/src/utils/math.d.ts +16 -0
- package/src/utils/math.js +47 -0
- package/src/utils/nullish.d.ts +10 -0
- package/src/utils/nullish.js +8 -0
- package/src/utils/object.d.ts +2 -0
- package/src/utils/object.js +7 -0
- package/src/utils/popper.d.ts +3 -0
- package/src/utils/popper.js +30 -0
- package/src/utils/rifm.d.ts +14 -0
- package/src/utils/rifm.js +53 -0
- package/src/utils/string.d.ts +4 -0
- package/src/utils/string.js +233 -0
- package/src/utils/timer.d.ts +11 -0
- package/src/utils/timer.js +46 -0
- package/src/utils/types.d.ts +8 -0
- package/src/utils/types.js +1 -0
- package/src/utils/userAgent.d.ts +4 -0
- package/src/utils/userAgent.js +9 -0
- package/src/utils/viewport.d.ts +1 -0
- package/src/utils/viewport.js +12 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { FC, ReactNode, Ref } from "react";
|
|
2
|
+
import { NativeSyntheticEvent, PressableProps, PressableStateCallbackType, Text, TextInput, TextInputProps, TextProps, View, ViewProps } from "react-native";
|
|
3
|
+
import { Except, Merge } from "type-fest";
|
|
4
|
+
import { PressResponderConfig } from "../hooks/usePressEvents";
|
|
5
|
+
type Props<BaseProps extends TextProps | TextInputProps> = Merge<BaseProps, {
|
|
6
|
+
children?: ReactNode | ((state: PressableStateCallbackType) => ReactNode);
|
|
7
|
+
delayLongPress?: number;
|
|
8
|
+
delayPressIn?: number;
|
|
9
|
+
delayPressOut?: number;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
focusable?: boolean;
|
|
12
|
+
onBlur?: (event: NativeSyntheticEvent<React.FocusEvent>) => void;
|
|
13
|
+
onContextMenu?: (event: NativeSyntheticEvent<React.SyntheticEvent>) => void;
|
|
14
|
+
onFocus?: (event: NativeSyntheticEvent<React.FocusEvent>) => void;
|
|
15
|
+
onHoverIn?: (event: unknown) => void;
|
|
16
|
+
onHoverOut?: (event: unknown) => void;
|
|
17
|
+
onKeyDown?: (event: NativeSyntheticEvent<React.KeyboardEvent>) => void;
|
|
18
|
+
onLayout?: BaseProps["onLayout"];
|
|
19
|
+
onLongPress?: PressResponderConfig["onLongPress"];
|
|
20
|
+
onPress?: PressResponderConfig["onPress"];
|
|
21
|
+
onPressIn?: PressResponderConfig["onPressStart"];
|
|
22
|
+
onPressMove?: PressResponderConfig["onPressMove"];
|
|
23
|
+
onPressOut?: PressResponderConfig["onPressEnd"];
|
|
24
|
+
style?: BaseProps["style"] | ((state: PressableStateCallbackType) => BaseProps["style"]);
|
|
25
|
+
/**
|
|
26
|
+
* Used only for documentation or testing (e.g. snapshot testing).
|
|
27
|
+
*/
|
|
28
|
+
testOnly_hovered?: boolean;
|
|
29
|
+
testOnly_pressed?: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
type ExtraProps = {
|
|
32
|
+
href?: string;
|
|
33
|
+
hrefAttrs?: {
|
|
34
|
+
download?: boolean;
|
|
35
|
+
rel?: string;
|
|
36
|
+
target?: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type PressableViewProps = Except<Props<ViewProps>, "children">;
|
|
40
|
+
export type PressableTextProps = Props<TextProps>;
|
|
41
|
+
export type PressableTextInputProps = Except<Props<TextInputProps>, "children">;
|
|
42
|
+
export declare const Pressable: FC<PressableProps & ExtraProps & {
|
|
43
|
+
ref?: Ref<View> | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
export declare const PressableText: FC<{
|
|
46
|
+
testID?: string | undefined;
|
|
47
|
+
style?: false | import("react-native").TextStyle | import("react-native").RegisteredStyle<import("react-native").TextStyle> | import("react-native").RecursiveArray<import("react-native").TextStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<import("react-native").TextStyle>> | ((state: PressableStateCallbackType) => import("react-native").StyleProp<import("react-native").TextStyle>) | null | undefined;
|
|
48
|
+
children?: string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | import("react").ReactPortal | ((state: PressableStateCallbackType) => ReactNode) | null | undefined;
|
|
49
|
+
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
50
|
+
nativeID?: string | undefined;
|
|
51
|
+
accessibilityRole?: import("react-native").WebAccessibilityRole | undefined;
|
|
52
|
+
onKeyDown?: ((event: NativeSyntheticEvent<React.KeyboardEvent>) => void) | undefined;
|
|
53
|
+
focusable?: boolean | undefined;
|
|
54
|
+
accessible?: boolean | undefined;
|
|
55
|
+
accessibilityActions?: readonly Readonly<{
|
|
56
|
+
name: string;
|
|
57
|
+
label?: string | undefined;
|
|
58
|
+
}>[] | undefined;
|
|
59
|
+
accessibilityLabel?: string | undefined;
|
|
60
|
+
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
61
|
+
accessibilityHint?: string | undefined;
|
|
62
|
+
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
63
|
+
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
64
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
65
|
+
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
66
|
+
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
67
|
+
accessibilityElementsHidden?: boolean | undefined;
|
|
68
|
+
accessibilityLanguage?: string | undefined;
|
|
69
|
+
accessibilityViewIsModal?: boolean | undefined;
|
|
70
|
+
onAccessibilityEscape?: (() => void) | undefined;
|
|
71
|
+
onAccessibilityTap?: (() => void) | undefined;
|
|
72
|
+
onMagicTap?: (() => void) | undefined;
|
|
73
|
+
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
74
|
+
accessibilityActiveDescendant?: string | undefined;
|
|
75
|
+
accessibilityAtomic?: boolean | undefined;
|
|
76
|
+
accessibilityAutoComplete?: string | undefined;
|
|
77
|
+
accessibilityBusy?: boolean | undefined;
|
|
78
|
+
accessibilityChecked?: boolean | "mixed" | undefined;
|
|
79
|
+
accessibilityColumnCount?: number | undefined;
|
|
80
|
+
accessibilityColumnIndex?: number | undefined;
|
|
81
|
+
accessibilityColumnSpan?: number | undefined;
|
|
82
|
+
accessibilityControls?: string | undefined;
|
|
83
|
+
accessibilityCurrent?: boolean | "page" | "step" | "location" | "date" | "time" | undefined;
|
|
84
|
+
accessibilityDescribedBy?: string | undefined;
|
|
85
|
+
accessibilityDetails?: string | undefined;
|
|
86
|
+
accessibilityDisabled?: boolean | undefined;
|
|
87
|
+
accessibilityErrorMessage?: string | undefined;
|
|
88
|
+
accessibilityExpanded?: boolean | undefined;
|
|
89
|
+
accessibilityFlowTo?: string | undefined;
|
|
90
|
+
accessibilityHasPopup?: string | undefined;
|
|
91
|
+
accessibilityHidden?: boolean | undefined;
|
|
92
|
+
accessibilityInvalid?: boolean | undefined;
|
|
93
|
+
accessibilityKeyShortcuts?: string[] | undefined;
|
|
94
|
+
accessibilityLevel?: number | undefined;
|
|
95
|
+
accessibilityModal?: boolean | undefined;
|
|
96
|
+
accessibilityMultiSelectable?: boolean | undefined;
|
|
97
|
+
accessibilityMultiline?: boolean | undefined;
|
|
98
|
+
accessibilityOrientation?: "horizontal" | "vertical" | undefined;
|
|
99
|
+
accessibilityOwns?: string | undefined;
|
|
100
|
+
accessibilityPlaceholder?: string | undefined;
|
|
101
|
+
accessibilityPosInSet?: number | undefined;
|
|
102
|
+
accessibilityPressed?: boolean | undefined;
|
|
103
|
+
accessibilityReadOnly?: boolean | undefined;
|
|
104
|
+
accessibilityRequired?: boolean | undefined;
|
|
105
|
+
accessibilityRoleDescription?: string | undefined;
|
|
106
|
+
accessibilityRowCount?: number | undefined;
|
|
107
|
+
accessibilityRowIndex?: number | undefined;
|
|
108
|
+
accessibilityRowSpan?: number | undefined;
|
|
109
|
+
accessibilitySelected?: boolean | undefined;
|
|
110
|
+
accessibilitySetSize?: number | undefined;
|
|
111
|
+
accessibilitySort?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
112
|
+
accessibilityValueMax?: number | undefined;
|
|
113
|
+
accessibilityValueMin?: number | undefined;
|
|
114
|
+
accessibilityValueNow?: number | undefined;
|
|
115
|
+
accessibilityValueText?: string | undefined;
|
|
116
|
+
allowFontScaling?: boolean | undefined;
|
|
117
|
+
ellipsizeMode?: "clip" | "head" | "middle" | "tail" | undefined;
|
|
118
|
+
lineBreakMode?: "clip" | "head" | "middle" | "tail" | undefined;
|
|
119
|
+
numberOfLines?: number | undefined;
|
|
120
|
+
onTextLayout?: ((event: NativeSyntheticEvent<import("react-native").TextLayoutEventData>) => void) | undefined;
|
|
121
|
+
onPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
122
|
+
onPressIn?: ((event: unknown) => void) | undefined;
|
|
123
|
+
onPressOut?: ((event: unknown) => void) | undefined;
|
|
124
|
+
onLongPress?: ((event: unknown) => void) | undefined;
|
|
125
|
+
maxFontSizeMultiplier?: number | null | undefined;
|
|
126
|
+
href?: string | undefined;
|
|
127
|
+
hrefAttrs?: import("react-native").HrefAttrs | undefined;
|
|
128
|
+
lang?: string | undefined;
|
|
129
|
+
adjustsFontSizeToFit?: boolean | undefined;
|
|
130
|
+
minimumFontScale?: number | undefined;
|
|
131
|
+
suppressHighlighting?: boolean | undefined;
|
|
132
|
+
disabled?: boolean | undefined;
|
|
133
|
+
selectable?: boolean | undefined;
|
|
134
|
+
selectionColor?: import("react-native").ColorValue | undefined;
|
|
135
|
+
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
136
|
+
dataDetectorType?: "none" | "all" | "link" | "phoneNumber" | "email" | null | undefined;
|
|
137
|
+
android_hyphenationFrequency?: "none" | "normal" | "full" | undefined;
|
|
138
|
+
onBlur?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
139
|
+
onFocus?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
140
|
+
onPressMove?: ((event: unknown) => void) | undefined;
|
|
141
|
+
delayLongPress?: number | undefined;
|
|
142
|
+
delayPressIn?: number | undefined;
|
|
143
|
+
delayPressOut?: number | undefined;
|
|
144
|
+
onContextMenu?: ((event: NativeSyntheticEvent<React.SyntheticEvent>) => void) | undefined;
|
|
145
|
+
onHoverIn?: ((event: unknown) => void) | undefined;
|
|
146
|
+
onHoverOut?: ((event: unknown) => void) | undefined;
|
|
147
|
+
testOnly_hovered?: boolean | undefined;
|
|
148
|
+
testOnly_pressed?: boolean | undefined;
|
|
149
|
+
} & {
|
|
150
|
+
ref?: Ref<Text> | undefined;
|
|
151
|
+
}>;
|
|
152
|
+
export declare const PressableTextInput: FC<Except<{
|
|
153
|
+
textAlign?: "center" | "left" | "right" | undefined;
|
|
154
|
+
testID?: string | undefined;
|
|
155
|
+
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
156
|
+
style?: false | import("react-native").TextStyle | import("react-native").RegisteredStyle<import("react-native").TextStyle> | import("react-native").RecursiveArray<import("react-native").TextStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<import("react-native").TextStyle>> | ((state: PressableStateCallbackType) => import("react-native").StyleProp<import("react-native").TextStyle>) | null | undefined;
|
|
157
|
+
children?: string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | import("react").ReactPortal | ((state: PressableStateCallbackType) => ReactNode) | null | undefined;
|
|
158
|
+
hitSlop?: import("react-native").Insets | undefined;
|
|
159
|
+
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
160
|
+
pointerEvents?: "auto" | "none" | "box-none" | "box-only" | undefined;
|
|
161
|
+
removeClippedSubviews?: boolean | undefined;
|
|
162
|
+
nativeID?: string | undefined;
|
|
163
|
+
accessibilityRole?: import("react-native").WebAccessibilityRole | undefined;
|
|
164
|
+
onKeyDown?: ((event: NativeSyntheticEvent<React.KeyboardEvent>) => void) | undefined;
|
|
165
|
+
onKeyDownCapture?: ((event: NativeSyntheticEvent<import("react").KeyboardEvent<Element>>) => void) | undefined;
|
|
166
|
+
onKeyUp?: ((event: NativeSyntheticEvent<import("react").KeyboardEvent<Element>>) => void) | undefined;
|
|
167
|
+
onKeyUpCapture?: ((event: NativeSyntheticEvent<import("react").KeyboardEvent<Element>>) => void) | undefined;
|
|
168
|
+
collapsable?: boolean | undefined;
|
|
169
|
+
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
170
|
+
renderToHardwareTextureAndroid?: boolean | undefined;
|
|
171
|
+
focusable?: boolean | undefined;
|
|
172
|
+
shouldRasterizeIOS?: boolean | undefined;
|
|
173
|
+
isTVSelectable?: boolean | undefined;
|
|
174
|
+
hasTVPreferredFocus?: boolean | undefined;
|
|
175
|
+
tvParallaxProperties?: import("react-native").TVParallaxProperties | undefined;
|
|
176
|
+
tvParallaxShiftDistanceX?: number | undefined;
|
|
177
|
+
tvParallaxShiftDistanceY?: number | undefined;
|
|
178
|
+
tvParallaxTiltAngle?: number | undefined;
|
|
179
|
+
tvParallaxMagnification?: number | undefined;
|
|
180
|
+
onStartShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
181
|
+
onMoveShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
182
|
+
onResponderEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
183
|
+
onResponderGrant?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
184
|
+
onResponderReject?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
185
|
+
onResponderMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
186
|
+
onResponderRelease?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
187
|
+
onResponderStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
188
|
+
onResponderTerminationRequest?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
189
|
+
onResponderTerminate?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
190
|
+
onStartShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
191
|
+
onMoveShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
192
|
+
onTouchStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
193
|
+
onTouchMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
194
|
+
onTouchEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
195
|
+
onTouchCancel?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
196
|
+
onTouchEndCapture?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
197
|
+
onPointerEnter?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
198
|
+
onPointerEnterCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
199
|
+
onPointerLeave?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
200
|
+
onPointerLeaveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
201
|
+
onPointerMove?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
202
|
+
onPointerMoveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
203
|
+
onPointerCancel?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
204
|
+
onPointerCancelCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
205
|
+
onPointerDown?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
206
|
+
onPointerDownCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
207
|
+
onPointerUp?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
208
|
+
onPointerUpCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
209
|
+
accessible?: boolean | undefined;
|
|
210
|
+
accessibilityActions?: readonly Readonly<{
|
|
211
|
+
name: string;
|
|
212
|
+
label?: string | undefined;
|
|
213
|
+
}>[] | undefined;
|
|
214
|
+
accessibilityLabel?: string | undefined;
|
|
215
|
+
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
216
|
+
accessibilityHint?: string | undefined;
|
|
217
|
+
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
218
|
+
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
219
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
220
|
+
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
221
|
+
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
222
|
+
accessibilityElementsHidden?: boolean | undefined;
|
|
223
|
+
accessibilityLanguage?: string | undefined;
|
|
224
|
+
accessibilityViewIsModal?: boolean | undefined;
|
|
225
|
+
onAccessibilityEscape?: (() => void) | undefined;
|
|
226
|
+
onAccessibilityTap?: (() => void) | undefined;
|
|
227
|
+
onMagicTap?: (() => void) | undefined;
|
|
228
|
+
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
229
|
+
accessibilityActiveDescendant?: string | undefined;
|
|
230
|
+
accessibilityAtomic?: boolean | undefined;
|
|
231
|
+
accessibilityAutoComplete?: string | undefined;
|
|
232
|
+
accessibilityBusy?: boolean | undefined;
|
|
233
|
+
accessibilityChecked?: boolean | "mixed" | undefined;
|
|
234
|
+
accessibilityColumnCount?: number | undefined;
|
|
235
|
+
accessibilityColumnIndex?: number | undefined;
|
|
236
|
+
accessibilityColumnSpan?: number | undefined;
|
|
237
|
+
accessibilityControls?: string | undefined;
|
|
238
|
+
accessibilityCurrent?: boolean | "page" | "step" | "location" | "date" | "time" | undefined;
|
|
239
|
+
accessibilityDescribedBy?: string | undefined;
|
|
240
|
+
accessibilityDetails?: string | undefined;
|
|
241
|
+
accessibilityDisabled?: boolean | undefined;
|
|
242
|
+
accessibilityErrorMessage?: string | undefined;
|
|
243
|
+
accessibilityExpanded?: boolean | undefined;
|
|
244
|
+
accessibilityFlowTo?: string | undefined;
|
|
245
|
+
accessibilityHasPopup?: string | undefined;
|
|
246
|
+
accessibilityHidden?: boolean | undefined;
|
|
247
|
+
accessibilityInvalid?: boolean | undefined;
|
|
248
|
+
accessibilityKeyShortcuts?: string[] | undefined;
|
|
249
|
+
accessibilityLevel?: number | undefined;
|
|
250
|
+
accessibilityModal?: boolean | undefined;
|
|
251
|
+
accessibilityMultiSelectable?: boolean | undefined;
|
|
252
|
+
accessibilityMultiline?: boolean | undefined;
|
|
253
|
+
accessibilityOrientation?: "horizontal" | "vertical" | undefined;
|
|
254
|
+
accessibilityOwns?: string | undefined;
|
|
255
|
+
accessibilityPlaceholder?: string | undefined;
|
|
256
|
+
accessibilityPosInSet?: number | undefined;
|
|
257
|
+
accessibilityPressed?: boolean | undefined;
|
|
258
|
+
accessibilityReadOnly?: boolean | undefined;
|
|
259
|
+
accessibilityRequired?: boolean | undefined;
|
|
260
|
+
accessibilityRoleDescription?: string | undefined;
|
|
261
|
+
accessibilityRowCount?: number | undefined;
|
|
262
|
+
accessibilityRowIndex?: number | undefined;
|
|
263
|
+
accessibilityRowSpan?: number | undefined;
|
|
264
|
+
accessibilitySelected?: boolean | undefined;
|
|
265
|
+
accessibilitySetSize?: number | undefined;
|
|
266
|
+
accessibilitySort?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
267
|
+
accessibilityValueMax?: number | undefined;
|
|
268
|
+
accessibilityValueMin?: number | undefined;
|
|
269
|
+
accessibilityValueNow?: number | undefined;
|
|
270
|
+
accessibilityValueText?: string | undefined;
|
|
271
|
+
allowFontScaling?: boolean | undefined;
|
|
272
|
+
numberOfLines?: number | undefined;
|
|
273
|
+
onPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
274
|
+
onPressIn?: ((event: unknown) => void) | undefined;
|
|
275
|
+
onPressOut?: ((event: unknown) => void) | undefined;
|
|
276
|
+
onLongPress?: ((event: unknown) => void) | undefined;
|
|
277
|
+
maxFontSizeMultiplier?: number | null | undefined;
|
|
278
|
+
lang?: string | undefined;
|
|
279
|
+
disabled?: boolean | undefined;
|
|
280
|
+
selectionColor?: import("react-native").ColorValue | undefined;
|
|
281
|
+
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
282
|
+
value?: string | undefined;
|
|
283
|
+
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
284
|
+
autoCorrect?: boolean | undefined;
|
|
285
|
+
autoFocus?: boolean | undefined;
|
|
286
|
+
blurOnSubmit?: boolean | undefined;
|
|
287
|
+
caretHidden?: boolean | undefined;
|
|
288
|
+
contextMenuHidden?: boolean | undefined;
|
|
289
|
+
defaultValue?: string | undefined;
|
|
290
|
+
editable?: boolean | undefined;
|
|
291
|
+
keyboardType?: import("react-native").KeyboardTypeOptions | undefined;
|
|
292
|
+
maxLength?: number | undefined;
|
|
293
|
+
multiline?: boolean | undefined;
|
|
294
|
+
onBlur?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
295
|
+
onChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputChangeEventData>) => void) | undefined;
|
|
296
|
+
onChangeText?: ((text: string) => void) | undefined;
|
|
297
|
+
onContentSizeChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputContentSizeChangeEventData>) => void) | undefined;
|
|
298
|
+
onEndEditing?: ((e: NativeSyntheticEvent<import("react-native").TextInputEndEditingEventData>) => void) | undefined;
|
|
299
|
+
onFocus?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
300
|
+
onSelectionChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputSelectionChangeEventData>) => void) | undefined;
|
|
301
|
+
onSubmitEditing?: ((e: NativeSyntheticEvent<import("react-native").TextInputSubmitEditingEventData>) => void) | undefined;
|
|
302
|
+
onTextInput?: ((e: NativeSyntheticEvent<import("react-native").TextInputTextInputEventData>) => void) | undefined;
|
|
303
|
+
onScroll?: ((e: NativeSyntheticEvent<import("react-native").TextInputScrollEventData>) => void) | undefined;
|
|
304
|
+
onKeyPress?: ((e: NativeSyntheticEvent<import("react-native").TextInputKeyPressEventData>) => void) | undefined;
|
|
305
|
+
placeholder?: string | undefined;
|
|
306
|
+
placeholderTextColor?: import("react-native").ColorValue | undefined;
|
|
307
|
+
returnKeyType?: import("react-native").ReturnKeyTypeOptions | undefined;
|
|
308
|
+
secureTextEntry?: boolean | undefined;
|
|
309
|
+
selectTextOnFocus?: boolean | undefined;
|
|
310
|
+
selection?: {
|
|
311
|
+
start: number;
|
|
312
|
+
end?: number | undefined;
|
|
313
|
+
} | undefined;
|
|
314
|
+
inputAccessoryViewID?: string | undefined;
|
|
315
|
+
initialValue?: string | undefined;
|
|
316
|
+
autoComplete?: "name" | "email" | "url" | "additional-name" | "address-level1" | "address-level2" | "address-level3" | "address-level4" | "address-line1" | "address-line2" | "address-line3" | "bday" | "bday-day" | "bday-month" | "bday-year" | "cc-additional-name" | "cc-csc" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-family-name" | "cc-given-name" | "cc-name" | "cc-number" | "cc-type" | "country" | "country-name" | "current-password" | "family-name" | "given-name" | "honorific-prefix" | "honorific-suffix" | "impp" | "language" | "new-password" | "nickname" | "off" | "on" | "one-time-code" | "organization" | "organization-title" | "postal-code" | "sex" | "street-address" | "tel" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-national" | "transaction-amount" | "transaction-currency" | "username" | undefined;
|
|
317
|
+
clearButtonMode?: "never" | "while-editing" | "unless-editing" | "always" | undefined;
|
|
318
|
+
clearTextOnFocus?: boolean | undefined;
|
|
319
|
+
dataDetectorTypes?: import("react-native").DataDetectorTypes | import("react-native").DataDetectorTypes[] | undefined;
|
|
320
|
+
enablesReturnKeyAutomatically?: boolean | undefined;
|
|
321
|
+
keyboardAppearance?: "default" | "light" | "dark" | undefined;
|
|
322
|
+
passwordRules?: string | null | undefined;
|
|
323
|
+
rejectResponderTermination?: boolean | null | undefined;
|
|
324
|
+
selectionState?: import("react-native").DocumentSelectionState | undefined;
|
|
325
|
+
spellCheck?: boolean | undefined;
|
|
326
|
+
textContentType?: "none" | "location" | "name" | "nickname" | "username" | "URL" | "addressCity" | "addressCityAndState" | "addressState" | "countryName" | "creditCardNumber" | "emailAddress" | "familyName" | "fullStreetAddress" | "givenName" | "jobTitle" | "middleName" | "namePrefix" | "nameSuffix" | "organizationName" | "postalCode" | "streetAddressLine1" | "streetAddressLine2" | "sublocality" | "telephoneNumber" | "password" | "newPassword" | "oneTimeCode" | undefined;
|
|
327
|
+
scrollEnabled?: boolean | undefined;
|
|
328
|
+
cursorColor?: import("react-native").ColorValue | null | undefined;
|
|
329
|
+
importantForAutofill?: "auto" | "yes" | "no" | "noExcludeDescendants" | "yesExcludeDescendants" | undefined;
|
|
330
|
+
disableFullscreenUI?: boolean | undefined;
|
|
331
|
+
inlineImageLeft?: string | undefined;
|
|
332
|
+
inlineImagePadding?: number | undefined;
|
|
333
|
+
returnKeyLabel?: string | undefined;
|
|
334
|
+
underlineColorAndroid?: import("react-native").ColorValue | undefined;
|
|
335
|
+
showSoftInputOnFocus?: boolean | undefined;
|
|
336
|
+
onPressMove?: ((event: unknown) => void) | undefined;
|
|
337
|
+
delayLongPress?: number | undefined;
|
|
338
|
+
delayPressIn?: number | undefined;
|
|
339
|
+
delayPressOut?: number | undefined;
|
|
340
|
+
onContextMenu?: ((event: NativeSyntheticEvent<React.SyntheticEvent>) => void) | undefined;
|
|
341
|
+
onHoverIn?: ((event: unknown) => void) | undefined;
|
|
342
|
+
onHoverOut?: ((event: unknown) => void) | undefined;
|
|
343
|
+
testOnly_hovered?: boolean | undefined;
|
|
344
|
+
testOnly_pressed?: boolean | undefined;
|
|
345
|
+
}, "children"> & {
|
|
346
|
+
ref?: Ref<TextInput> | undefined;
|
|
347
|
+
}>;
|
|
348
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// https://github.com/necolas/react-native-web/blob/0.17.5/packages/react-native-web/src/exports/Pressable/index.js
|
|
3
|
+
import { forwardRef, memo, useCallback, useMemo, useRef, } from "react";
|
|
4
|
+
import { StyleSheet, Text, TextInput, View, } from "react-native";
|
|
5
|
+
import { useForceableState } from "../hooks/useForceableState";
|
|
6
|
+
import { useHover } from "../hooks/useHover";
|
|
7
|
+
import { useMergeRefs } from "../hooks/useMergeRefs";
|
|
8
|
+
import { usePressEvents } from "../hooks/usePressEvents";
|
|
9
|
+
const styles = StyleSheet.create({
|
|
10
|
+
root: {
|
|
11
|
+
cursor: "pointer",
|
|
12
|
+
touchAction: "manipulation",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
const getPressable = (
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
Component, config = {}) => {
|
|
18
|
+
const { applyPressStyle = true } = config;
|
|
19
|
+
return forwardRef((props, forwardedRef) => {
|
|
20
|
+
const { children, delayLongPress, delayPressIn, delayPressOut, disabled = false, focusable, onBlur, onContextMenu, onFocus, onHoverIn, onHoverOut, onKeyDown, onLongPress, onPress, onPressMove, onPressIn, onPressOut, style, testOnly_hovered, testOnly_pressed, ...rest } = props;
|
|
21
|
+
const [hovered, setHovered] = useForceableState(testOnly_hovered === true);
|
|
22
|
+
const [focused, setFocused] = useForceableState(false);
|
|
23
|
+
const [pressed, setPressed] = useForceableState(testOnly_pressed === true);
|
|
24
|
+
const hostRef = useRef(null);
|
|
25
|
+
const setRef = useMergeRefs(forwardedRef, hostRef);
|
|
26
|
+
const pressConfig = useMemo(() => ({
|
|
27
|
+
delayLongPress,
|
|
28
|
+
delayPressStart: delayPressIn,
|
|
29
|
+
delayPressEnd: delayPressOut,
|
|
30
|
+
disabled,
|
|
31
|
+
onLongPress,
|
|
32
|
+
onPress,
|
|
33
|
+
onPressChange: setPressed,
|
|
34
|
+
onPressStart: onPressIn,
|
|
35
|
+
onPressMove,
|
|
36
|
+
onPressEnd: onPressOut,
|
|
37
|
+
}), [
|
|
38
|
+
delayLongPress,
|
|
39
|
+
delayPressIn,
|
|
40
|
+
delayPressOut,
|
|
41
|
+
disabled,
|
|
42
|
+
onLongPress,
|
|
43
|
+
onPress,
|
|
44
|
+
onPressIn,
|
|
45
|
+
onPressMove,
|
|
46
|
+
onPressOut,
|
|
47
|
+
setPressed,
|
|
48
|
+
]);
|
|
49
|
+
// @ts-expect-error
|
|
50
|
+
const pressEventHandlers = usePressEvents(hostRef, pressConfig);
|
|
51
|
+
const { onContextMenu: onContextMenuPress, onKeyDown: onKeyDownPress } = pressEventHandlers;
|
|
52
|
+
useHover(hostRef, {
|
|
53
|
+
// The following line has been commented out as we want to event to bubble up
|
|
54
|
+
// contain: true,
|
|
55
|
+
disabled,
|
|
56
|
+
onHoverChange: setHovered,
|
|
57
|
+
onHoverStart: onHoverIn,
|
|
58
|
+
onHoverEnd: onHoverOut,
|
|
59
|
+
});
|
|
60
|
+
const interactionState = { hovered, focused, pressed };
|
|
61
|
+
const blurHandler = useCallback((e) => {
|
|
62
|
+
if (e.nativeEvent.target === hostRef.current) {
|
|
63
|
+
setFocused(false);
|
|
64
|
+
onBlur?.(e);
|
|
65
|
+
}
|
|
66
|
+
}, [hostRef, setFocused, onBlur]);
|
|
67
|
+
const focusHandler = useCallback((e) => {
|
|
68
|
+
if (e.nativeEvent.target === hostRef.current) {
|
|
69
|
+
setFocused(true);
|
|
70
|
+
onFocus?.(e);
|
|
71
|
+
}
|
|
72
|
+
}, [hostRef, setFocused, onFocus]);
|
|
73
|
+
const contextMenuHandler = useCallback((e) => {
|
|
74
|
+
onContextMenuPress?.(e);
|
|
75
|
+
onContextMenu?.(e);
|
|
76
|
+
}, [onContextMenu, onContextMenuPress]);
|
|
77
|
+
const keyDownHandler = useCallback((e) => {
|
|
78
|
+
onKeyDownPress?.(e);
|
|
79
|
+
onKeyDown?.(e);
|
|
80
|
+
}, [onKeyDown, onKeyDownPress]);
|
|
81
|
+
return (_jsx(Component, { ...rest, ...pressEventHandlers, accessibilityDisabled: disabled, focusable: !disabled && focusable !== false, onBlur: blurHandler, onContextmenu: contextMenuHandler, onFocus: focusHandler, onKeyDown: keyDownHandler, ref: setRef, style: [
|
|
82
|
+
!disabled && applyPressStyle && styles.root,
|
|
83
|
+
typeof style === "function" ? style(interactionState) : style,
|
|
84
|
+
], children: typeof children === "function" ? children(interactionState) : children }));
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
export const Pressable = memo(getPressable(View, { applyPressStyle: true }));
|
|
88
|
+
export const PressableText = memo(getPressable(Text, { applyPressStyle: true }));
|
|
89
|
+
export const PressableTextInput = memo(getPressable(TextInput, { applyPressStyle: false }));
|
|
90
|
+
PressableText.displayName = "PressableText";
|
|
91
|
+
PressableTextInput.displayName = "PressableTextInput";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
color: string;
|
|
4
|
+
label: string;
|
|
5
|
+
progressLabel: string;
|
|
6
|
+
minValue: number;
|
|
7
|
+
maxValue: number;
|
|
8
|
+
value: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const ProgressBar: ({ color, label, progressLabel, minValue, maxValue, value }: Props) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { StyleSheet, Text, View } from "react-native";
|
|
4
|
+
import { colors } from "../constants/colors";
|
|
5
|
+
import { typography } from "../constants/typography";
|
|
6
|
+
import { useComputedColors } from "../hooks/useComputedColors";
|
|
7
|
+
import { interpolate } from "../utils/math";
|
|
8
|
+
import { Box } from "./Box";
|
|
9
|
+
import { Fill } from "./Fill";
|
|
10
|
+
import { Space } from "./Space";
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
label: {
|
|
13
|
+
...typography.bodySmall,
|
|
14
|
+
lineHeight: typography.lineHeights.title,
|
|
15
|
+
color: colors.gray[50],
|
|
16
|
+
},
|
|
17
|
+
progressLabel: {
|
|
18
|
+
...typography.bodySmall,
|
|
19
|
+
fontWeight: typography.fontWeights.demi,
|
|
20
|
+
color: colors.gray[100],
|
|
21
|
+
whiteSpace: "nowrap",
|
|
22
|
+
},
|
|
23
|
+
bar: {
|
|
24
|
+
height: 8,
|
|
25
|
+
borderRadius: 4,
|
|
26
|
+
backgroundColor: colors.gray[10],
|
|
27
|
+
},
|
|
28
|
+
progressBar: {
|
|
29
|
+
height: "100%",
|
|
30
|
+
borderRadius: 4,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export const ProgressBar = ({ color, label, progressLabel, minValue, maxValue, value }) => {
|
|
34
|
+
const computedColors = useComputedColors(color);
|
|
35
|
+
const labelId = `label-${useId()}`;
|
|
36
|
+
const percentage = interpolate({
|
|
37
|
+
inputRange: [minValue, maxValue],
|
|
38
|
+
outputRange: [0, 100],
|
|
39
|
+
clamp: true,
|
|
40
|
+
})(value);
|
|
41
|
+
const fillWidth = `${Math.round(percentage)}%`;
|
|
42
|
+
return (_jsxs(View, { accessibilityRole: "progressbar", accessibilityLabelledBy: labelId, accessibilityValueMin: minValue, accessibilityValueMax: maxValue, accessibilityValueNow: value, accessibilityValueText: progressLabel, children: [_jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(Text, { nativeID: labelId, style: styles.label, children: label }), _jsx(Fill, { minWidth: 16 }), _jsx(Text, { style: styles.progressLabel, children: progressLabel })] }), _jsx(Space, { height: 8 }), _jsx(View, { style: styles.bar, children: _jsx(View, { style: [
|
|
43
|
+
styles.progressBar,
|
|
44
|
+
{ backgroundColor: computedColors.progress, width: fillWidth },
|
|
45
|
+
] }) })] }));
|
|
46
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Tag } from "@swan-io/lake/src/components/Tag";
|
|
3
|
+
import { match } from "ts-pattern";
|
|
4
|
+
import { Icon } from "./Icon";
|
|
5
|
+
export const ProjectEnvTag = (props) => {
|
|
6
|
+
const isLive = props.projectEnv === "Live";
|
|
7
|
+
return (_jsx(Tag, { color: isLive ? "live" : "sandbox", children: match(props)
|
|
8
|
+
.with({ iconOnly: true, projectEnv: "Live" }, () => _jsx(Icon, { name: "live-regular", size: 20 }))
|
|
9
|
+
.with({ iconOnly: true, projectEnv: "Sandbox" }, () => (_jsx(Icon, { name: "beaker-regular", size: 20 })))
|
|
10
|
+
.with({ projectEnv: "Sandbox" }, { projectEnv: "Live" }, ({ projectEnv }) => projectEnv)
|
|
11
|
+
.exhaustive() }));
|
|
12
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconName } from "./Icon";
|
|
3
|
+
export type QuickAction = {
|
|
4
|
+
icon: IconName;
|
|
5
|
+
label: string;
|
|
6
|
+
onPress: () => void;
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
};
|
|
11
|
+
type Props = {
|
|
12
|
+
actions: QuickAction[];
|
|
13
|
+
};
|
|
14
|
+
export declare const QuickActions: ({ actions }: Props) => JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ActivityIndicator, StyleSheet, View } from "react-native";
|
|
3
|
+
import { colors, spacings } from "../constants/design";
|
|
4
|
+
import { Icon } from "./Icon";
|
|
5
|
+
import { LakeText } from "./LakeText";
|
|
6
|
+
import { Pressable } from "./Pressable";
|
|
7
|
+
import { Space } from "./Space";
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
flexDirection: "row",
|
|
11
|
+
alignItems: "flex-start",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
},
|
|
14
|
+
icon: {
|
|
15
|
+
borderColor: colors.gray[300],
|
|
16
|
+
borderWidth: 1,
|
|
17
|
+
borderStyle: "solid",
|
|
18
|
+
paddingHorizontal: spacings[24],
|
|
19
|
+
paddingVertical: spacings[12],
|
|
20
|
+
borderRadius: 32,
|
|
21
|
+
},
|
|
22
|
+
action: {
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
paddingHorizontal: spacings[12],
|
|
25
|
+
flexBasis: "30%",
|
|
26
|
+
},
|
|
27
|
+
label: {
|
|
28
|
+
lineHeight: 16,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
export const QuickActions = ({ actions }) => {
|
|
32
|
+
return (_jsx(View, { style: styles.container, children: actions.map((action, index) => (_jsxs(Pressable, { onPress: action.onPress, style: styles.action, disabled: action.isLoading === true, children: [_jsx(View, { style: [
|
|
33
|
+
styles.icon,
|
|
34
|
+
action.backgroundColor != null
|
|
35
|
+
? { backgroundColor: action.backgroundColor, borderColor: action.backgroundColor }
|
|
36
|
+
: null,
|
|
37
|
+
], children: action.isLoading === true ? (_jsx(ActivityIndicator, { color: action.color ?? colors.gray[300], size: 16 })) : (_jsx(Icon, { name: action.icon, size: 16, color: action.color ?? colors.gray[300] })) }), _jsx(Space, { height: 8 }), _jsx(LakeText, { variant: "smallRegular", align: "center", style: styles.label, children: action.label })] }, index))) }));
|
|
38
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ColorVariants } from "../constants/design";
|
|
3
|
+
export type RadioGroupItem<V> = {
|
|
4
|
+
name: string;
|
|
5
|
+
value: V;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type RadioGroupProps<V> = {
|
|
9
|
+
items: RadioGroupItem<V>[];
|
|
10
|
+
direction?: "column" | "row";
|
|
11
|
+
color?: ColorVariants;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
value?: V;
|
|
14
|
+
onValueChange: (value: V) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare function RadioGroup<V>({ items, direction, color, disabled, value, onValueChange, }: RadioGroupProps<V>): JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { colors } from "../constants/design";
|
|
5
|
+
import { isNullish } from "../utils/nullish";
|
|
6
|
+
import { Box } from "./Box";
|
|
7
|
+
import { LakeRadio } from "./LakeRadio";
|
|
8
|
+
import { LakeText } from "./LakeText";
|
|
9
|
+
import { Pressable } from "./Pressable";
|
|
10
|
+
import { Space } from "./Space";
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
container: {
|
|
13
|
+
flexWrap: "wrap",
|
|
14
|
+
},
|
|
15
|
+
item: {
|
|
16
|
+
flexDirection: "row",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
},
|
|
19
|
+
rowItem: {
|
|
20
|
+
// use margin instead of <Space /> to avoid line starting with <Space /> because of flex-wrap
|
|
21
|
+
marginRight: 24,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
export function RadioGroup({ items, direction = "column", color = "current", disabled = false, value, onValueChange, }) {
|
|
25
|
+
return (_jsx(Box, { direction: direction, style: styles.container, children: items.map((item, index) => {
|
|
26
|
+
const isLast = index === items.length - 1;
|
|
27
|
+
const isDisabled = disabled || !isNullish(item.disabled);
|
|
28
|
+
return (_jsxs(Fragment, { children: [_jsxs(Pressable, { disabled: isDisabled, onPress: () => {
|
|
29
|
+
if (item.value !== value) {
|
|
30
|
+
onValueChange(item.value);
|
|
31
|
+
}
|
|
32
|
+
}, style: [styles.item, direction === "row" && !isLast && styles.rowItem], children: [_jsx(LakeRadio, { disabled: isDisabled, color: color, value: item.value === value }), _jsx(Space, { width: 12 }), _jsx(LakeText, { color: isDisabled ? colors.gray[300] : colors.gray[900], children: item.name })] }), !isLast && _jsx(Space, { height: direction === "column" ? 12 : 32 })] }, index));
|
|
33
|
+
}) }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Separator } from "@swan-io/lake/src/components/Separator";
|
|
3
|
+
import { isNotNullish } from "@swan-io/lake/src/utils/nullish";
|
|
4
|
+
import { Children } from "react";
|
|
5
|
+
import { View } from "react-native";
|
|
6
|
+
export const ReadOnlyFieldList = ({ children }) => (_jsx(_Fragment, { children: Children.toArray(children)
|
|
7
|
+
.filter(isNotNullish)
|
|
8
|
+
.map((node, index) => (_jsxs(View, { children: [index !== 0 && _jsx(Separator, { horizontal: false, space: 8 }), node] }, index))) }));
|