@swan-io/lake 2.0.1 → 2.0.3
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/package.json +7 -7
- package/src/components/AutoWidthImage.d.ts +9 -0
- package/src/components/FixedListViewCells.js +1 -3
- package/src/components/Form.d.ts +2 -0
- package/src/components/Heading.d.ts +4 -0
- package/src/components/LakeHeading.d.ts +4 -0
- package/src/components/LakeTextInput.d.ts +5 -2
- package/src/components/LakeTooltip.d.ts +1 -0
- package/src/components/LakeTooltip.js +3 -3
- package/src/components/Link.d.ts +4 -0
- package/src/components/Pressable.d.ts +9 -2
- package/src/components/QuickActions.d.ts +3 -1
- package/src/components/QuickActions.js +15 -7
- package/src/utils/__tests__/rifm.test.js +21 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swan-io/lake",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=14.0.0",
|
|
6
6
|
"yarn": "^1.20.0"
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@popperjs/core": "^2.11.7",
|
|
30
|
-
"@swan-io/boxed": "^1.0.
|
|
31
|
-
"@swan-io/chicane": "^1.
|
|
30
|
+
"@swan-io/boxed": "^1.0.2",
|
|
31
|
+
"@swan-io/chicane": "^1.4.0",
|
|
32
32
|
"dayjs": "^1.11.7",
|
|
33
33
|
"polished": "^4.2.2",
|
|
34
|
-
"prism-react-renderer": "^
|
|
34
|
+
"prism-react-renderer": "^2.0.4",
|
|
35
35
|
"react": "^18.2.0",
|
|
36
36
|
"react-atomic-state": "^1.2.7",
|
|
37
37
|
"react-dom": "^18.2.0",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"uuid": "^9.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@types/react": "^18.2.
|
|
48
|
+
"@types/react": "^18.2.7",
|
|
49
49
|
"@types/react-dom": "^18.2.4",
|
|
50
|
-
"@types/react-native": "^0.
|
|
50
|
+
"@types/react-native": "^0.72.1",
|
|
51
51
|
"@types/uuid": "^9.0.1",
|
|
52
52
|
"jsdom": "^22.0.0",
|
|
53
|
-
"type-fest": "^3.
|
|
53
|
+
"type-fest": "^3.11.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -19,10 +19,17 @@ export declare const AutoWidthImage: import("react").MemoExoticComponent<import(
|
|
|
19
19
|
borderBottomRightRadius?: number | undefined;
|
|
20
20
|
resizeMode?: import("react-native").ImageResizeMode | undefined;
|
|
21
21
|
resizeMethod?: "auto" | "resize" | "scale" | undefined;
|
|
22
|
+
src?: string | undefined;
|
|
23
|
+
srcSet?: string | undefined;
|
|
22
24
|
loadingIndicatorSource?: import("react-native").ImageURISource | undefined;
|
|
23
25
|
testID?: string | undefined;
|
|
24
26
|
nativeID?: string | undefined;
|
|
25
27
|
alt?: string | undefined;
|
|
28
|
+
height?: number | undefined;
|
|
29
|
+
width?: number | undefined;
|
|
30
|
+
crossOrigin?: "anonymous" | "use-credentials" | undefined;
|
|
31
|
+
tintColor?: import("react-native").ColorValue | undefined;
|
|
32
|
+
referrerPolicy?: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | undefined;
|
|
26
33
|
blurRadius?: number | undefined;
|
|
27
34
|
capInsets?: import("react-native").Insets | undefined;
|
|
28
35
|
onProgress?: ((event: import("react-native").NativeSyntheticEvent<import("react-native").ImageProgressEventDataIOS>) => void) | undefined;
|
|
@@ -55,12 +62,14 @@ export declare const AutoWidthImage: import("react").MemoExoticComponent<import(
|
|
|
55
62
|
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
56
63
|
'aria-modal'?: boolean | undefined;
|
|
57
64
|
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
65
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
58
66
|
accessibilityElementsHidden?: boolean | undefined;
|
|
59
67
|
accessibilityViewIsModal?: boolean | undefined;
|
|
60
68
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
61
69
|
onAccessibilityTap?: (() => void) | undefined;
|
|
62
70
|
onMagicTap?: (() => void) | undefined;
|
|
63
71
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
72
|
+
accessibilityLanguage?: string | undefined;
|
|
64
73
|
tabIndex?: 0 | -1 | undefined;
|
|
65
74
|
"aria-activedescendant"?: string | undefined;
|
|
66
75
|
"aria-atomic"?: boolean | undefined;
|
|
@@ -108,9 +108,7 @@ export const SimpleHeaderCell = ({ text, sort, justifyContent = "flex-start", on
|
|
|
108
108
|
export const ColorPatchCell = ({ isHovered, alternativeText, color, }) => {
|
|
109
109
|
return isHovered ? (_jsx(View, { style: [styles.colorPatch, { backgroundColor: colors[color].primary }], children: isNotNullish(alternativeText) ? (_jsx(LakeText, { style: styles.alternativeText, children: alternativeText })) : null })) : null;
|
|
110
110
|
};
|
|
111
|
-
export const SimpleTitleCell = ({ isHighlighted = false, text, }) => (_jsx(View, { style: styles.cell, children: _jsx(LakeText, { numberOfLines: 1, color: colors.gray[900], variant: "medium",
|
|
112
|
-
color: colors.current.primary,
|
|
113
|
-
}), children: text }) }));
|
|
111
|
+
export const SimpleTitleCell = ({ isHighlighted = false, text, }) => (_jsx(View, { style: styles.cell, children: _jsx(LakeText, { numberOfLines: 1, color: isHighlighted ? colors.current.primary : colors.gray[900], style: styles.regularText, variant: "medium", children: text }) }));
|
|
114
112
|
export const SimpleRegularTextCell = ({ variant = "regular", text, textAlign = "left", }) => {
|
|
115
113
|
return (_jsx(View, { style: styles.cell, children: _jsx(LakeText, { align: textAlign, color: colors.gray[900], style: styles.regularText, variant: variant, children: text }) }));
|
|
116
114
|
};
|
package/src/components/Form.d.ts
CHANGED
|
@@ -82,12 +82,14 @@ export declare const Form: import("react").MemoExoticComponent<import("react").F
|
|
|
82
82
|
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
83
83
|
'aria-modal'?: boolean | undefined;
|
|
84
84
|
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
85
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
85
86
|
accessibilityElementsHidden?: boolean | undefined;
|
|
86
87
|
accessibilityViewIsModal?: boolean | undefined;
|
|
87
88
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
88
89
|
onAccessibilityTap?: (() => void) | undefined;
|
|
89
90
|
onMagicTap?: (() => void) | undefined;
|
|
90
91
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
92
|
+
accessibilityLanguage?: string | undefined;
|
|
91
93
|
tabIndex?: 0 | -1 | undefined;
|
|
92
94
|
"aria-activedescendant"?: string | undefined;
|
|
93
95
|
"aria-atomic"?: boolean | undefined;
|
|
@@ -72,8 +72,10 @@ export declare const Heading: import("react").ForwardRefExoticComponent<{
|
|
|
72
72
|
hrefAttrs?: import("react-native").HrefAttrs | undefined;
|
|
73
73
|
lang?: string | undefined;
|
|
74
74
|
adjustsFontSizeToFit?: boolean | undefined;
|
|
75
|
+
dynamicTypeRamp?: "body" | "caption2" | "caption1" | "footnote" | "subheadline" | "callout" | "headline" | "title3" | "title2" | "title1" | "largeTitle" | undefined;
|
|
75
76
|
minimumFontScale?: number | undefined;
|
|
76
77
|
suppressHighlighting?: boolean | undefined;
|
|
78
|
+
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
77
79
|
disabled?: boolean | undefined;
|
|
78
80
|
selectable?: boolean | undefined;
|
|
79
81
|
selectionColor?: import("react-native").ColorValue | undefined;
|
|
@@ -107,12 +109,14 @@ export declare const Heading: import("react").ForwardRefExoticComponent<{
|
|
|
107
109
|
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
108
110
|
'aria-modal'?: boolean | undefined;
|
|
109
111
|
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
112
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
110
113
|
accessibilityElementsHidden?: boolean | undefined;
|
|
111
114
|
accessibilityViewIsModal?: boolean | undefined;
|
|
112
115
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
113
116
|
onAccessibilityTap?: (() => void) | undefined;
|
|
114
117
|
onMagicTap?: (() => void) | undefined;
|
|
115
118
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
119
|
+
accessibilityLanguage?: string | undefined;
|
|
116
120
|
tabIndex?: 0 | -1 | undefined;
|
|
117
121
|
"aria-activedescendant"?: string | undefined;
|
|
118
122
|
"aria-atomic"?: boolean | undefined;
|
|
@@ -21,8 +21,10 @@ export declare const LakeHeading: import("react").ForwardRefExoticComponent<{
|
|
|
21
21
|
hrefAttrs?: import("react-native").HrefAttrs | undefined;
|
|
22
22
|
lang?: string | undefined;
|
|
23
23
|
adjustsFontSizeToFit?: boolean | undefined;
|
|
24
|
+
dynamicTypeRamp?: "body" | "caption2" | "caption1" | "footnote" | "subheadline" | "callout" | "headline" | "title3" | "title2" | "title1" | "largeTitle" | undefined;
|
|
24
25
|
minimumFontScale?: number | undefined;
|
|
25
26
|
suppressHighlighting?: boolean | undefined;
|
|
27
|
+
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
26
28
|
disabled?: boolean | undefined;
|
|
27
29
|
selectable?: boolean | undefined;
|
|
28
30
|
selectionColor?: import("react-native").ColorValue | undefined;
|
|
@@ -56,12 +58,14 @@ export declare const LakeHeading: import("react").ForwardRefExoticComponent<{
|
|
|
56
58
|
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
57
59
|
'aria-modal'?: boolean | undefined;
|
|
58
60
|
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
61
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
59
62
|
accessibilityElementsHidden?: boolean | undefined;
|
|
60
63
|
accessibilityViewIsModal?: boolean | undefined;
|
|
61
64
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
62
65
|
onAccessibilityTap?: (() => void) | undefined;
|
|
63
66
|
onMagicTap?: (() => void) | undefined;
|
|
64
67
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
68
|
+
accessibilityLanguage?: string | undefined;
|
|
65
69
|
tabIndex?: 0 | -1 | undefined;
|
|
66
70
|
"aria-activedescendant"?: string | undefined;
|
|
67
71
|
"aria-atomic"?: boolean | undefined;
|
|
@@ -27,7 +27,6 @@ export type LakeTextInputProps = Except<TextInputProps, "editable" | "keyboardTy
|
|
|
27
27
|
export declare const LakeTextInput: import("react").ForwardRefExoticComponent<{
|
|
28
28
|
allowFontScaling?: boolean | undefined;
|
|
29
29
|
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
30
|
-
autoComplete?: "off" | "name" | "email" | "tel" | "url" | "additional-name" | "address-line1" | "address-line2" | "birthdate-day" | "birthdate-full" | "birthdate-month" | "birthdate-year" | "cc-csc" | "cc-exp" | "cc-exp-day" | "cc-exp-month" | "cc-exp-year" | "cc-number" | "country" | "current-password" | "family-name" | "gender" | "given-name" | "honorific-prefix" | "honorific-suffix" | "name-family" | "name-given" | "name-middle" | "name-middle-initial" | "name-prefix" | "name-suffix" | "new-password" | "nickname" | "one-time-code" | "organization" | "organization-title" | "password" | "password-new" | "postal-address" | "postal-address-country" | "postal-address-extended" | "postal-address-extended-postal-code" | "postal-address-locality" | "postal-address-region" | "postal-code" | "street-address" | "sms-otp" | "tel-country-code" | "tel-national" | "tel-device" | "username" | "username-new" | undefined;
|
|
31
30
|
autoCorrect?: boolean | undefined;
|
|
32
31
|
autoFocus?: boolean | undefined;
|
|
33
32
|
blurOnSubmit?: boolean | undefined;
|
|
@@ -68,6 +67,7 @@ export declare const LakeTextInput: import("react").ForwardRefExoticComponent<{
|
|
|
68
67
|
role?: import("react-native").WebRole | undefined;
|
|
69
68
|
lang?: string | undefined;
|
|
70
69
|
initialValue?: string | undefined;
|
|
70
|
+
autoComplete?: "off" | "name" | "email" | "tel" | "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" | "on" | "one-time-code" | "organization" | "organization-title" | "postal-code" | "sex" | "street-address" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-national" | "transaction-amount" | "transaction-currency" | "username" | undefined;
|
|
71
71
|
enterKeyHint?: "enter" | "search" | "done" | "go" | "next" | "send" | "previous" | undefined;
|
|
72
72
|
rows?: number | undefined;
|
|
73
73
|
readOnly?: boolean | undefined;
|
|
@@ -150,12 +150,14 @@ export declare const LakeTextInput: import("react").ForwardRefExoticComponent<{
|
|
|
150
150
|
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
151
151
|
'aria-modal'?: boolean | undefined;
|
|
152
152
|
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
153
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
153
154
|
accessibilityElementsHidden?: boolean | undefined;
|
|
154
155
|
accessibilityViewIsModal?: boolean | undefined;
|
|
155
156
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
156
157
|
onAccessibilityTap?: (() => void) | undefined;
|
|
157
158
|
onMagicTap?: (() => void) | undefined;
|
|
158
159
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
160
|
+
accessibilityLanguage?: string | undefined;
|
|
159
161
|
tabIndex?: 0 | -1 | undefined;
|
|
160
162
|
"aria-activedescendant"?: string | undefined;
|
|
161
163
|
"aria-atomic"?: boolean | undefined;
|
|
@@ -197,8 +199,9 @@ export declare const LakeTextInput: import("react").ForwardRefExoticComponent<{
|
|
|
197
199
|
rejectResponderTermination?: boolean | null | undefined;
|
|
198
200
|
selectionState?: import("react-native").DocumentSelectionState | undefined;
|
|
199
201
|
spellCheck?: boolean | undefined;
|
|
200
|
-
textContentType?: "none" | "location" | "name" | "nickname" | "
|
|
202
|
+
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;
|
|
201
203
|
scrollEnabled?: boolean | undefined;
|
|
204
|
+
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
202
205
|
cursorColor?: import("react-native").ColorValue | null | undefined;
|
|
203
206
|
importantForAutofill?: "auto" | "yes" | "no" | "noExcludeDescendants" | "yesExcludeDescendants" | undefined;
|
|
204
207
|
disableFullscreenUI?: boolean | undefined;
|
|
@@ -5,7 +5,7 @@ import { usePopper } from "react-popper";
|
|
|
5
5
|
import { match } from "ts-pattern";
|
|
6
6
|
import { colors, shadows } from "../constants/design";
|
|
7
7
|
import { useHover } from "../hooks/useHover";
|
|
8
|
-
import {
|
|
8
|
+
import { isNotNullish } from "../utils/nullish";
|
|
9
9
|
import { getRootElement, matchReferenceWidthModifier } from "../utils/popper";
|
|
10
10
|
import { Icon } from "./Icon";
|
|
11
11
|
import { LakeText } from "./LakeText";
|
|
@@ -83,7 +83,7 @@ const styles = StyleSheet.create({
|
|
|
83
83
|
});
|
|
84
84
|
const isReactText = (node) => ["string", "number"].includes(typeof node);
|
|
85
85
|
const MAX_WIDTH = "calc(100vw - 20px)";
|
|
86
|
-
export const LakeTooltip = memo(forwardRef(({ children, content, describedBy, matchReferenceWidth = false, hideArrow = false, onHide, onShow, placement, width, togglableOnFocus = false, containerStyle, }, forwardedRef) => {
|
|
86
|
+
export const LakeTooltip = memo(forwardRef(({ children, content, describedBy, matchReferenceWidth = false, hideArrow = false, onHide, onShow, placement, width, togglableOnFocus = false, containerStyle, disabled = false, }, forwardedRef) => {
|
|
87
87
|
const referenceRef = useRef(null);
|
|
88
88
|
const rootElement = getRootElement(referenceRef.current);
|
|
89
89
|
const [popperElement, setPopperElement] = useState(null);
|
|
@@ -157,7 +157,7 @@ export const LakeTooltip = memo(forwardRef(({ children, content, describedBy, ma
|
|
|
157
157
|
void update?.();
|
|
158
158
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
159
159
|
}, [content]);
|
|
160
|
-
return (_jsxs(_Fragment, { children: [_jsx(View, { ref: referenceRef, style: containerStyle, children: children }),
|
|
160
|
+
return (_jsxs(_Fragment, { children: [_jsx(View, { ref: referenceRef, style: containerStyle, children: children }), isNotNullish(rootElement) && visible && !disabled && (_jsx(Portal, { container: rootElement, children: _jsx("div", { ref: setPopperElement, style: { ...popperStyles.popper, maxWidth: MAX_WIDTH }, ...attributes.popper, role: "tooltip", "aria-describedby": describedBy, children: _jsxs(View, { style: [
|
|
161
161
|
styles.base,
|
|
162
162
|
state?.placement === "top" && styles.baseTop,
|
|
163
163
|
state?.placement === "bottom" && styles.baseBottom,
|
package/src/components/Link.d.ts
CHANGED
|
@@ -31,8 +31,10 @@ export declare const Link: import("react").MemoExoticComponent<import("react").F
|
|
|
31
31
|
href?: string | undefined;
|
|
32
32
|
lang?: string | undefined;
|
|
33
33
|
adjustsFontSizeToFit?: boolean | undefined;
|
|
34
|
+
dynamicTypeRamp?: "body" | "caption2" | "caption1" | "footnote" | "subheadline" | "callout" | "headline" | "title3" | "title2" | "title1" | "largeTitle" | undefined;
|
|
34
35
|
minimumFontScale?: number | undefined;
|
|
35
36
|
suppressHighlighting?: boolean | undefined;
|
|
37
|
+
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
36
38
|
selectable?: boolean | undefined;
|
|
37
39
|
selectionColor?: import("react-native").ColorValue | undefined;
|
|
38
40
|
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
@@ -65,12 +67,14 @@ export declare const Link: import("react").MemoExoticComponent<import("react").F
|
|
|
65
67
|
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
66
68
|
'aria-modal'?: boolean | undefined;
|
|
67
69
|
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
70
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
68
71
|
accessibilityElementsHidden?: boolean | undefined;
|
|
69
72
|
accessibilityViewIsModal?: boolean | undefined;
|
|
70
73
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
71
74
|
onAccessibilityTap?: (() => void) | undefined;
|
|
72
75
|
onMagicTap?: (() => void) | undefined;
|
|
73
76
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
77
|
+
accessibilityLanguage?: string | undefined;
|
|
74
78
|
tabIndex?: 0 | -1 | undefined;
|
|
75
79
|
"aria-activedescendant"?: string | undefined;
|
|
76
80
|
"aria-atomic"?: boolean | undefined;
|
|
@@ -56,8 +56,10 @@ export declare const PressableText: FC<{
|
|
|
56
56
|
hrefAttrs?: import("react-native").HrefAttrs | undefined;
|
|
57
57
|
lang?: string | undefined;
|
|
58
58
|
adjustsFontSizeToFit?: boolean | undefined;
|
|
59
|
+
dynamicTypeRamp?: "body" | "caption2" | "caption1" | "footnote" | "subheadline" | "callout" | "headline" | "title3" | "title2" | "title1" | "largeTitle" | undefined;
|
|
59
60
|
minimumFontScale?: number | undefined;
|
|
60
61
|
suppressHighlighting?: boolean | undefined;
|
|
62
|
+
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
61
63
|
selectable?: boolean | undefined;
|
|
62
64
|
selectionColor?: import("react-native").ColorValue | undefined;
|
|
63
65
|
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
@@ -90,12 +92,14 @@ export declare const PressableText: FC<{
|
|
|
90
92
|
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
91
93
|
'aria-modal'?: boolean | undefined;
|
|
92
94
|
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
95
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
93
96
|
accessibilityElementsHidden?: boolean | undefined;
|
|
94
97
|
accessibilityViewIsModal?: boolean | undefined;
|
|
95
98
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
96
99
|
onAccessibilityTap?: (() => void) | undefined;
|
|
97
100
|
onMagicTap?: (() => void) | undefined;
|
|
98
101
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
102
|
+
accessibilityLanguage?: string | undefined;
|
|
99
103
|
tabIndex?: 0 | -1 | undefined;
|
|
100
104
|
"aria-activedescendant"?: string | undefined;
|
|
101
105
|
"aria-atomic"?: boolean | undefined;
|
|
@@ -154,7 +158,6 @@ export declare const PressableText: FC<{
|
|
|
154
158
|
export declare const PressableTextInput: FC<{
|
|
155
159
|
allowFontScaling?: boolean | undefined;
|
|
156
160
|
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
157
|
-
autoComplete?: "off" | "name" | "email" | "tel" | "url" | "additional-name" | "address-line1" | "address-line2" | "birthdate-day" | "birthdate-full" | "birthdate-month" | "birthdate-year" | "cc-csc" | "cc-exp" | "cc-exp-day" | "cc-exp-month" | "cc-exp-year" | "cc-number" | "country" | "current-password" | "family-name" | "gender" | "given-name" | "honorific-prefix" | "honorific-suffix" | "name-family" | "name-given" | "name-middle" | "name-middle-initial" | "name-prefix" | "name-suffix" | "new-password" | "nickname" | "one-time-code" | "organization" | "organization-title" | "password" | "password-new" | "postal-address" | "postal-address-country" | "postal-address-extended" | "postal-address-extended-postal-code" | "postal-address-locality" | "postal-address-region" | "postal-code" | "street-address" | "sms-otp" | "tel-country-code" | "tel-national" | "tel-device" | "username" | "username-new" | undefined;
|
|
158
161
|
autoCorrect?: boolean | undefined;
|
|
159
162
|
autoFocus?: boolean | undefined;
|
|
160
163
|
blurOnSubmit?: boolean | undefined;
|
|
@@ -191,6 +194,7 @@ export declare const PressableTextInput: FC<{
|
|
|
191
194
|
role?: import("react-native").WebRole | undefined;
|
|
192
195
|
lang?: string | undefined;
|
|
193
196
|
initialValue?: string | undefined;
|
|
197
|
+
autoComplete?: "off" | "name" | "email" | "tel" | "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" | "on" | "one-time-code" | "organization" | "organization-title" | "postal-code" | "sex" | "street-address" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-national" | "transaction-amount" | "transaction-currency" | "username" | undefined;
|
|
194
198
|
enterKeyHint?: "enter" | "search" | "done" | "go" | "next" | "send" | "previous" | undefined;
|
|
195
199
|
rows?: number | undefined;
|
|
196
200
|
readOnly?: boolean | undefined;
|
|
@@ -270,12 +274,14 @@ export declare const PressableTextInput: FC<{
|
|
|
270
274
|
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
271
275
|
'aria-modal'?: boolean | undefined;
|
|
272
276
|
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
277
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
273
278
|
accessibilityElementsHidden?: boolean | undefined;
|
|
274
279
|
accessibilityViewIsModal?: boolean | undefined;
|
|
275
280
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
276
281
|
onAccessibilityTap?: (() => void) | undefined;
|
|
277
282
|
onMagicTap?: (() => void) | undefined;
|
|
278
283
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
284
|
+
accessibilityLanguage?: string | undefined;
|
|
279
285
|
tabIndex?: 0 | -1 | undefined;
|
|
280
286
|
"aria-activedescendant"?: string | undefined;
|
|
281
287
|
"aria-atomic"?: boolean | undefined;
|
|
@@ -317,8 +323,9 @@ export declare const PressableTextInput: FC<{
|
|
|
317
323
|
rejectResponderTermination?: boolean | null | undefined;
|
|
318
324
|
selectionState?: import("react-native").DocumentSelectionState | undefined;
|
|
319
325
|
spellCheck?: boolean | undefined;
|
|
320
|
-
textContentType?: "none" | "location" | "name" | "nickname" | "
|
|
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;
|
|
321
327
|
scrollEnabled?: boolean | undefined;
|
|
328
|
+
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
322
329
|
cursorColor?: import("react-native").ColorValue | null | undefined;
|
|
323
330
|
importantForAutofill?: "auto" | "yes" | "no" | "noExcludeDescendants" | "yesExcludeDescendants" | undefined;
|
|
324
331
|
disableFullscreenUI?: boolean | undefined;
|
|
@@ -9,6 +9,8 @@ export type QuickAction = {
|
|
|
9
9
|
};
|
|
10
10
|
type Props = {
|
|
11
11
|
actions: QuickAction[];
|
|
12
|
+
tooltipDisabled?: boolean;
|
|
13
|
+
tooltipText?: string;
|
|
12
14
|
};
|
|
13
|
-
export declare const QuickActions: ({ actions }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const QuickActions: ({ actions, tooltipDisabled, tooltipText }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
16
|
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ActivityIndicator, StyleSheet, View } from "react-native";
|
|
3
3
|
import { colors, spacings } from "../constants/design";
|
|
4
|
+
import { isNullishOrEmpty } from "../utils/nullish";
|
|
4
5
|
import { Icon } from "./Icon";
|
|
5
6
|
import { LakeText } from "./LakeText";
|
|
7
|
+
import { LakeTooltip } from "./LakeTooltip";
|
|
6
8
|
import { Pressable } from "./Pressable";
|
|
7
9
|
import { Space } from "./Space";
|
|
8
10
|
const styles = StyleSheet.create({
|
|
@@ -24,15 +26,21 @@ const styles = StyleSheet.create({
|
|
|
24
26
|
paddingHorizontal: spacings[12],
|
|
25
27
|
flexBasis: "30%",
|
|
26
28
|
},
|
|
29
|
+
disabled: {
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
paddingHorizontal: spacings[12],
|
|
32
|
+
flexBasis: "30%",
|
|
33
|
+
opacity: 0.4,
|
|
34
|
+
},
|
|
27
35
|
label: {
|
|
28
36
|
lineHeight: 16,
|
|
29
37
|
},
|
|
30
38
|
});
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
export const QuickActions = ({ actions, tooltipDisabled = false, tooltipText }) => {
|
|
40
|
+
return (_jsx(View, { style: styles.container, children: actions.map((action, index) => (_jsx(LakeTooltip, { content: tooltipText, placement: "top", disabled: tooltipDisabled || isNullishOrEmpty(tooltipText), children: _jsxs(Pressable, { onPress: action.onPress, style: tooltipDisabled ? styles.action : styles.disabled, disabled: action.isLoading === true || !tooltipDisabled, children: [_jsx(View, { style: [
|
|
41
|
+
styles.icon,
|
|
42
|
+
action.backgroundColor != null
|
|
43
|
+
? { backgroundColor: action.backgroundColor, borderColor: action.backgroundColor }
|
|
44
|
+
: null,
|
|
45
|
+
], 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) }, index))) }));
|
|
38
46
|
};
|
|
@@ -20,15 +20,15 @@ test('it respects accept: "alpha" param', async () => {
|
|
|
20
20
|
return (_jsx(Rifm, { ...props, value: value, onChange: setValue, children: ({ value, onChange }) => _jsx("input", { type: "text", value: value, onChange: onChange }) }));
|
|
21
21
|
};
|
|
22
22
|
const utils = render(_jsx(Test, {}));
|
|
23
|
-
const input = await utils.findByRole("textbox");
|
|
23
|
+
const input = (await utils.findByRole("textbox"));
|
|
24
24
|
typeInInput(input, "test");
|
|
25
|
-
expect(input).
|
|
25
|
+
expect(input.value).toBe("te st/");
|
|
26
26
|
clearInput(input);
|
|
27
27
|
typeInInput(input, "1234");
|
|
28
|
-
expect(input).
|
|
28
|
+
expect(input.value).toBe("");
|
|
29
29
|
clearInput(input);
|
|
30
30
|
typeInInput(input, "te34");
|
|
31
|
-
expect(input).
|
|
31
|
+
expect(input.value).toBe("te ");
|
|
32
32
|
clearInput(input);
|
|
33
33
|
});
|
|
34
34
|
test('it respects accept: "numeric" param', async () => {
|
|
@@ -42,15 +42,15 @@ test('it respects accept: "numeric" param', async () => {
|
|
|
42
42
|
return (_jsx(Rifm, { ...props, value: value, onChange: setValue, children: ({ value, onChange }) => _jsx("input", { type: "text", value: value, onChange: onChange }) }));
|
|
43
43
|
};
|
|
44
44
|
const utils = render(_jsx(Test, {}));
|
|
45
|
-
const input = await utils.findByRole("textbox");
|
|
45
|
+
const input = (await utils.findByRole("textbox"));
|
|
46
46
|
typeInInput(input, "test");
|
|
47
|
-
expect(input).
|
|
47
|
+
expect(input.value).toBe("");
|
|
48
48
|
clearInput(input);
|
|
49
49
|
typeInInput(input, "1234");
|
|
50
|
-
expect(input).
|
|
50
|
+
expect(input.value).toBe("12 34/");
|
|
51
51
|
clearInput(input);
|
|
52
52
|
typeInInput(input, "te34");
|
|
53
|
-
expect(input).
|
|
53
|
+
expect(input.value).toBe("34 ");
|
|
54
54
|
clearInput(input);
|
|
55
55
|
});
|
|
56
56
|
test('it respects accept: "alphanumeric" param', async () => {
|
|
@@ -64,18 +64,18 @@ test('it respects accept: "alphanumeric" param', async () => {
|
|
|
64
64
|
return (_jsx(Rifm, { ...props, value: value, onChange: setValue, children: ({ value, onChange }) => _jsx("input", { type: "text", value: value, onChange: onChange }) }));
|
|
65
65
|
};
|
|
66
66
|
const utils = render(_jsx(Test, {}));
|
|
67
|
-
const input = await utils.findByRole("textbox");
|
|
67
|
+
const input = (await utils.findByRole("textbox"));
|
|
68
68
|
typeInInput(input, "test");
|
|
69
|
-
expect(input).
|
|
69
|
+
expect(input.value).toBe("te st/");
|
|
70
70
|
clearInput(input);
|
|
71
71
|
typeInInput(input, "1234");
|
|
72
|
-
expect(input).
|
|
72
|
+
expect(input.value).toBe("12 34/");
|
|
73
73
|
clearInput(input);
|
|
74
74
|
typeInInput(input, "te34");
|
|
75
|
-
expect(input).
|
|
75
|
+
expect(input.value).toBe("te 34/");
|
|
76
76
|
clearInput(input);
|
|
77
77
|
typeInInput(input, "t__4");
|
|
78
|
-
expect(input).
|
|
78
|
+
expect(input.value).toBe("t4 ");
|
|
79
79
|
clearInput(input);
|
|
80
80
|
});
|
|
81
81
|
test("it appends characters at given indexes", async () => {
|
|
@@ -89,15 +89,15 @@ test("it appends characters at given indexes", async () => {
|
|
|
89
89
|
return (_jsx(Rifm, { ...props, value: value, onChange: setValue, children: ({ value, onChange }) => _jsx("input", { type: "text", value: value, onChange: onChange }) }));
|
|
90
90
|
};
|
|
91
91
|
const utils = render(_jsx(Test, {}));
|
|
92
|
-
const input = await utils.findByRole("textbox");
|
|
92
|
+
const input = (await utils.findByRole("textbox"));
|
|
93
93
|
typeInInput(input, "12");
|
|
94
|
-
expect(input).
|
|
94
|
+
expect(input.value).toBe("12 ");
|
|
95
95
|
clearInput(input);
|
|
96
96
|
typeInInput(input, "1234");
|
|
97
|
-
expect(input).
|
|
97
|
+
expect(input.value).toBe("12 34/");
|
|
98
98
|
clearInput(input);
|
|
99
99
|
typeInInput(input, "123456");
|
|
100
|
-
expect(input).
|
|
100
|
+
expect(input.value).toBe("12 34/56");
|
|
101
101
|
clearInput(input);
|
|
102
102
|
});
|
|
103
103
|
test("it truncates the formatted text to the maximum length", async () => {
|
|
@@ -111,14 +111,14 @@ test("it truncates the formatted text to the maximum length", async () => {
|
|
|
111
111
|
return (_jsx(Rifm, { ...props, value: value, onChange: setValue, children: ({ value, onChange }) => _jsx("input", { type: "text", value: value, onChange: onChange }) }));
|
|
112
112
|
};
|
|
113
113
|
const utils = render(_jsx(Test, {}));
|
|
114
|
-
const input = await utils.findByRole("textbox");
|
|
114
|
+
const input = (await utils.findByRole("textbox"));
|
|
115
115
|
typeInInput(input, "1234");
|
|
116
|
-
expect(input).
|
|
116
|
+
expect(input.value).toBe("12 34/");
|
|
117
117
|
clearInput(input);
|
|
118
118
|
typeInInput(input, "123456");
|
|
119
|
-
expect(input).
|
|
119
|
+
expect(input.value).toBe("12 34/56");
|
|
120
120
|
clearInput(input);
|
|
121
121
|
typeInInput(input, "12345678");
|
|
122
|
-
expect(input).
|
|
122
|
+
expect(input.value).toBe("12 34/56");
|
|
123
123
|
clearInput(input);
|
|
124
124
|
});
|