@swan-io/lake 1.4.4 → 1.5.1
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 +4 -5
- package/src/components/AppOpeningAnimation.js +13 -13
- package/src/components/AutoWidthImage.d.ts +1 -0
- package/src/components/AutoWidthImage.js +3 -4
- package/src/components/Avatar.js +3 -2
- package/src/components/BorderedButton.d.ts +1 -1
- package/src/components/BorderedButton.js +6 -4
- package/src/components/BottomPanel.js +2 -2
- package/src/components/Box.js +1 -1
- package/src/components/Breadcrumbs.js +7 -7
- package/src/components/ChoicePicker.js +6 -6
- package/src/components/Fill.js +2 -1
- package/src/components/FilterChooser.js +2 -2
- package/src/components/Filters.js +9 -9
- package/src/components/FixedListView.js +15 -12
- package/src/components/FixedListViewCells.js +2 -2
- package/src/components/Form.d.ts +1 -1
- package/src/components/FullViewportLayer.js +10 -7
- package/src/components/Heading.d.ts +1 -1
- package/src/components/Heading.js +1 -1
- package/src/components/Icon.d.ts +2 -4
- package/src/components/Icon.js +7 -1
- package/src/components/Input.d.ts +6 -6
- package/src/components/Input.js +6 -11
- package/src/components/Label.d.ts +1 -1
- package/src/components/Label.js +1 -1
- package/src/components/LakeButton.d.ts +3 -3
- package/src/components/LakeButton.js +5 -5
- package/src/components/LakeCheckbox.js +2 -2
- package/src/components/LakeCombobox.d.ts +2 -2
- package/src/components/LakeCombobox.js +6 -10
- package/src/components/LakeDownloadButton.js +1 -1
- package/src/components/LakeHeading.d.ts +3 -2
- package/src/components/LakeHeading.js +7 -1
- package/src/components/LakeLabel.d.ts +0 -1
- package/src/components/LakeLabel.js +3 -3
- package/src/components/LakeModal.js +6 -3
- package/src/components/LakeRadio.js +3 -3
- package/src/components/LakeScrollView.js +2 -1
- package/src/components/LakeSearchField.js +3 -3
- package/src/components/LakeSelect.d.ts +2 -2
- package/src/components/LakeSelect.js +14 -23
- package/src/components/LakeSlider.js +1 -1
- package/src/components/LakeStepper.js +4 -4
- package/src/components/LakeText.d.ts +9 -8
- package/src/components/LakeText.js +7 -1
- package/src/components/LakeTextInput.d.ts +10 -5
- package/src/components/LakeTextInput.js +4 -4
- package/src/components/LakeTooltip.js +7 -12
- package/src/components/Link.d.ts +52 -49
- package/src/components/Link.js +2 -2
- package/src/components/ListRightPanel.js +2 -2
- package/src/components/Modal.js +15 -5
- package/src/components/MultiSelect.d.ts +1 -1
- package/src/components/MultiSelect.js +10 -7
- package/src/components/PlainListView.js +4 -3
- package/src/components/Popover.js +9 -5
- package/src/components/Portal.js +2 -2
- package/src/components/Pressable.d.ts +112 -101
- package/src/components/Pressable.js +16 -6
- package/src/components/RightPanel.js +10 -7
- package/src/components/Separator.js +1 -1
- package/src/components/SidebarNavigationTracker.js +5 -4
- package/src/components/Slider.js +28 -12
- package/src/components/SmsOpeningAnimation.js +15 -15
- package/src/components/Stack.d.ts +4 -4
- package/src/components/Stack.js +1 -1
- package/src/components/Stepper.js +1 -1
- package/src/components/Svg.d.ts +6 -7
- package/src/components/Switch.js +18 -6
- package/src/components/TabView.js +8 -7
- package/src/components/Tag.d.ts +2 -2
- package/src/components/Tag.js +6 -3
- package/src/components/Tile.js +2 -2
- package/src/components/ToastStack.js +16 -7
- package/src/components/Tooltip.js +3 -6
- package/src/components/TransitionGroupView.d.ts +2 -3
- package/src/components/TransitionGroupView.js +2 -2
- package/src/components/TransitionView.d.ts +2 -3
- package/src/components/TransitionView.js +2 -2
- package/src/components/WithCurrentColor.d.ts +1 -1
- package/src/constants/design.d.ts +4 -12
- package/src/constants/design.js +12 -12
- package/src/hooks/useAnimatedValue.js +9 -2
- package/src/hooks/useForceableState.js +1 -1
- package/src/hooks/useHover.js +1 -1
- package/src/hooks/useMergeRefs.js +1 -1
- package/src/hooks/usePressEvents.js +1 -1
- package/src/components/Alert.d.ts +0 -10
- package/src/components/Alert.js +0 -36
- package/src/components/Button.d.ts +0 -15
- package/src/components/Button.js +0 -83
- package/src/components/Checkbox.d.ts +0 -12
- package/src/components/Checkbox.js +0 -83
- package/src/components/Combobox.d.ts +0 -29
- package/src/components/Combobox.js +0 -182
- package/src/components/MultilineInput.d.ts +0 -15
- package/src/components/MultilineInput.js +0 -55
- package/src/components/Picker.d.ts +0 -26
- package/src/components/Picker.js +0 -116
- package/src/components/ProgressBar.d.ts +0 -11
- package/src/components/ProgressBar.js +0 -46
- package/src/components/SegmentedControl.d.ts +0 -19
- package/src/components/SegmentedControl.js +0 -74
- package/src/components/Table.d.ts +0 -34
- package/src/components/Table.js +0 -79
- package/src/hooks/useLazyRef.d.ts +0 -2
- package/src/hooks/useLazyRef.js +0 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swan-io/lake",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=14.0.0",
|
|
6
6
|
"yarn": "^1.20.0"
|
|
@@ -33,10 +33,9 @@
|
|
|
33
33
|
"polished": "^4.2.2",
|
|
34
34
|
"prism-react-renderer": "^1.3.5",
|
|
35
35
|
"react": "^18.2.0",
|
|
36
|
+
"react-atomic-state": "^1.2.7",
|
|
36
37
|
"react-dom": "^18.2.0",
|
|
37
|
-
"react-
|
|
38
|
-
"react-fast-compare": "^3.2.1",
|
|
39
|
-
"react-native-web": "^0.18.12",
|
|
38
|
+
"react-native-web": "^0.19.1",
|
|
40
39
|
"react-popper": "^2.3.0",
|
|
41
40
|
"react-ux-form": "^1.3.0",
|
|
42
41
|
"rifm": "^0.12.1",
|
|
@@ -49,7 +48,7 @@
|
|
|
49
48
|
"@storybook/react": "^6.5.16",
|
|
50
49
|
"@types/react": "^18.0.28",
|
|
51
50
|
"@types/react-dom": "^18.0.11",
|
|
52
|
-
"@types/react-native": "^0.
|
|
51
|
+
"@types/react-native": "^0.71.5",
|
|
53
52
|
"@types/uuid": "^9.0.1",
|
|
54
53
|
"jsdom": "^21.1.1",
|
|
55
54
|
"type-fest": "^3.6.1"
|
|
@@ -7,11 +7,11 @@ const styles = StyleSheet.create({
|
|
|
7
7
|
circle: {
|
|
8
8
|
opacity: 0,
|
|
9
9
|
animationKeyframes: {
|
|
10
|
-
"0%": { opacity: 0, transform:
|
|
11
|
-
"30%": { opacity: 0, transform:
|
|
10
|
+
"0%": { opacity: 0, transform: "scale(0.4)" },
|
|
11
|
+
"30%": { opacity: 0, transform: "scale(0.4)" },
|
|
12
12
|
"40%": { opacity: 1 },
|
|
13
|
-
"75%": { opacity: 0, transform:
|
|
14
|
-
"100%": { opacity: 0, transform:
|
|
13
|
+
"75%": { opacity: 0, transform: "scale(1.5)" },
|
|
14
|
+
"100%": { opacity: 0, transform: "scale(1.5)" },
|
|
15
15
|
},
|
|
16
16
|
animationDuration: "5000ms",
|
|
17
17
|
animationTimingFunction: "ease-in-out",
|
|
@@ -19,10 +19,10 @@ const styles = StyleSheet.create({
|
|
|
19
19
|
},
|
|
20
20
|
icon: {
|
|
21
21
|
animationKeyframes: {
|
|
22
|
-
"0%": { transform:
|
|
23
|
-
"25%": { transform:
|
|
24
|
-
"35%": { transform:
|
|
25
|
-
"100%": { transform:
|
|
22
|
+
"0%": { transform: "scale(1)" },
|
|
23
|
+
"25%": { transform: "scale(1)" },
|
|
24
|
+
"35%": { transform: "translateY(60px) scale(10)" },
|
|
25
|
+
"100%": { transform: "translateY(60px) scale(10)" },
|
|
26
26
|
},
|
|
27
27
|
animationDuration: "5000ms",
|
|
28
28
|
animationTimingFunction: "ease-in-out",
|
|
@@ -30,10 +30,10 @@ const styles = StyleSheet.create({
|
|
|
30
30
|
},
|
|
31
31
|
logo: {
|
|
32
32
|
animationKeyframes: {
|
|
33
|
-
"0%": { transform:
|
|
34
|
-
"25%": { transform:
|
|
35
|
-
"35%": { transform:
|
|
36
|
-
"100%": { transform:
|
|
33
|
+
"0%": { transform: "translateY(0px) scale(1)" },
|
|
34
|
+
"25%": { transform: "translateY(0px) scale(1)" },
|
|
35
|
+
"35%": { transform: "translateY(72px) scale(2)" },
|
|
36
|
+
"100%": { transform: "translateY(72px) scale(2)" },
|
|
37
37
|
},
|
|
38
38
|
animationDuration: "5000ms",
|
|
39
39
|
animationTimingFunction: "ease-in-out",
|
|
@@ -46,5 +46,5 @@ export const AppOpeningAnimation = ({ accentColor, appLogo, playing = true, styl
|
|
|
46
46
|
animationPlayState: playing ? "running" : "paused",
|
|
47
47
|
};
|
|
48
48
|
}, [playing]);
|
|
49
|
-
return (_jsxs(Svg, { viewBox: "0 0 442 860", style: style, children: [_jsxs(Mask, {
|
|
49
|
+
return (_jsxs(Svg, { viewBox: "0 0 442 860", style: style, children: [_jsxs(Mask, { id: "phoneScreen", children: [_jsx(Rect, { x: 0, y: 0, width: 442, height: 860, fill: "#000" }), _jsx(Rect, { fill: "#fff", x: 25, y: 21, width: 392, height: 817, rx: 45 })] }), _jsxs(G, { children: [_jsx(Rect, { fill: backgroundColor.default, x: 25, y: 21, width: 392, height: 817, rx: 45 }), _jsx(Path, { d: "M80 86h35.6c15 0 27 12 27 27v35.6c0 15-12 27-27 27H80c-15 0-27-12-27-27V113c0-15 12-27 27-27zm0 117.6h35.6c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27H80c-15 0-27-12-27-27v-35.6c0-14.9 12-27 27-27zm0 117.7h35.6c15 0 27 12 27 27v35.6c0 14.9-12 27-27 27H80c-15 0-27-12.1-27-27v-35.6c0-15 12-27 27-27zm0 117.6h35.6c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27H80c-15 0-27-12-27-27V466c0-14.9 12-27 27-27v-.1zm0 282.5h35.6c15 0 27 12 27 27V784c0 14.9-12 27-27 27H80c-15 0-27-12.1-27-27v-35.6c0-15 12-27 27-27zM203.2 86h35.6c15 0 27 12 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27V113c0-15 12-27 27-27zm0 117.6h35.6c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27v-35.6c0-14.9 12-27 27-27zm0 235.3h35.6c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27V466c0-14.9 12-27 27-27v-.1zm0 282.5h35.6c15 0 27 12 27 27V784c0 14.9-12 27-27 27h-35.6c-15 0-27-12.1-27-27v-35.6c0-15 12-27 27-27zM326.4 86H362c15 0 27 12 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27V113c0-15 12-27 27-27zm0 117.6H362c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27v-35.6c0-14.9 12-27 27-27zm0 117.7H362c15 0 27 12 27 27v35.6c0 14.9-12 27-27 27h-35.6c-15 0-27-12.1-27-27v-35.6c0-15 12-27 27-27zm0 117.6H362c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27V466c0-14.9 12-27 27-27v-.1zm0 282.5H362c15 0 27 12 27 27V784c0 14.9-12 27-27 27h-35.6c-15 0-27-12.1-27-27v-35.6c0-15 12-27 27-27z", fill: "#fff" }), _jsx(G, { mask: "url(#phoneScreen)", children: _jsx(Rect, { fill: accentColor, fillRule: "nonzero", x: 176.4, y: 321, width: 89.6, height: 89.6, rx: 27, style: [styles.icon, animationStyle], "transform-origin": "221.2 365.8" }) }), _jsx(Image, { xlinkHref: appLogo, preserveAspectRatio: "xMidYMid meet", x: 190, y: 335, height: 62, width: 62, style: [styles.logo, animationStyle], "transform-origin": "221.2 365.8" }), _jsx(Circle, { stroke: "#FFFFFF", strokeWidth: 2, cx: 219.5, cy: 439.5, r: 157.5, fill: "none", style: [styles.circle, animationStyle], "transform-origin": "219.5 439.5" }), _jsx(Path, { d: "M369 0a67.998 67.998 0 0168 68v177c1.326 0 2.598.527 3.536 1.464A5.004 5.004 0 01442 250v96a5.004 5.004 0 01-1.464 3.536A5.004 5.004 0 01437 351v441a67.996 67.996 0 01-19.917 48.083A67.996 67.996 0 01369 860H71a67.998 67.998 0 01-68-68V365.6a5 5 0 01-3-4.6v-58a5.002 5.002 0 013-4.6v-16.8a5 5 0 01-3-4.6v-58a5.002 5.002 0 013-4.6v-30.8a5 5 0 01-3-4.6v-24a5.002 5.002 0 013-4.6V68A68 68 0 0171 0h298zm0 21H71a46 46 0 00-46 45.2V792a45.999 45.999 0 0045.2 46H369a46 46 0 0046-45.2V67a45.998 45.998 0 00-46-46z", fill: "#000" })] })] }));
|
|
50
50
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Image, ImageProps } from "react-native";
|
|
3
3
|
import { Except } from "type-fest";
|
|
4
4
|
export declare const AutoWidthImage: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Except<ImageProps, "source"> & {
|
|
5
|
+
ariaLabel?: string | undefined;
|
|
5
6
|
maxWidth?: number | undefined;
|
|
6
7
|
height: number;
|
|
7
8
|
sourceUri: string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, memo, useEffect, useState } from "react";
|
|
3
|
-
import isEqual from "react-fast-compare";
|
|
4
3
|
import { Image } from "react-native";
|
|
5
4
|
import { isNotNullish } from "../utils/nullish";
|
|
6
|
-
export const AutoWidthImage = memo(forwardRef(({ maxWidth, height, sourceUri, style, ...props }, forwardedRef) => {
|
|
5
|
+
export const AutoWidthImage = memo(forwardRef(({ ariaLabel, maxWidth, height, sourceUri, style, ...props }, forwardedRef) => {
|
|
7
6
|
const [size, setSize] = useState({
|
|
8
7
|
height,
|
|
9
8
|
width: 0,
|
|
@@ -21,6 +20,6 @@ export const AutoWidthImage = memo(forwardRef(({ maxWidth, height, sourceUri, st
|
|
|
21
20
|
}
|
|
22
21
|
});
|
|
23
22
|
}, [maxWidth, height, sourceUri]);
|
|
24
|
-
return (_jsx(Image, { ref: forwardedRef, source: { uri: sourceUri }, style: [style, size], ...props }));
|
|
25
|
-
})
|
|
23
|
+
return (_jsx(Image, { "aria-label": ariaLabel, ref: forwardedRef, source: { uri: sourceUri }, style: [style, size], ...props }));
|
|
24
|
+
}));
|
|
26
25
|
AutoWidthImage.displayName = "AutoWidthImage";
|
package/src/components/Avatar.js
CHANGED
|
@@ -10,6 +10,7 @@ const styles = StyleSheet.create({
|
|
|
10
10
|
...typography.bodyLarge,
|
|
11
11
|
fontWeight: typography.fontWeights.demi,
|
|
12
12
|
textAlign: "center",
|
|
13
|
+
userSelect: "none",
|
|
13
14
|
},
|
|
14
15
|
container: {
|
|
15
16
|
borderWidth: 1,
|
|
@@ -28,7 +29,7 @@ const initialsToVariant = (initials) => {
|
|
|
28
29
|
};
|
|
29
30
|
export const Avatar = memo(({ initials = "", size }) => {
|
|
30
31
|
const variant = initialsToVariant(initials);
|
|
31
|
-
return (_jsx(View, {
|
|
32
|
+
return (_jsx(View, { role: "img", style: [
|
|
32
33
|
commonStyles.center,
|
|
33
34
|
styles.container,
|
|
34
35
|
{
|
|
@@ -38,5 +39,5 @@ export const Avatar = memo(({ initials = "", size }) => {
|
|
|
38
39
|
width: size,
|
|
39
40
|
borderRadius: size / 2,
|
|
40
41
|
},
|
|
41
|
-
], children: initials !== "" ? (_jsx(Text, { style: [styles.text, { color: colors[variant][500], fontSize: size * 0.4 }],
|
|
42
|
+
], children: initials !== "" ? (_jsx(Text, { style: [styles.text, { color: colors[variant][500], fontSize: size * 0.4 }], children: initials })) : (_jsx(Icon, { name: "person-filled", size: size - 8, color: colors[variant][50] })) }));
|
|
42
43
|
});
|
|
@@ -2,7 +2,7 @@ import { ReactText } from "react";
|
|
|
2
2
|
import { GestureResponderEvent, StyleProp, View, ViewStyle } from "react-native";
|
|
3
3
|
import { IconName } from "./Icon";
|
|
4
4
|
type Props = {
|
|
5
|
-
|
|
5
|
+
ariaLabel?: string;
|
|
6
6
|
children?: ReactText;
|
|
7
7
|
color?: string;
|
|
8
8
|
disabled?: boolean;
|
|
@@ -57,11 +57,13 @@ const styles = StyleSheet.create({
|
|
|
57
57
|
...typography.bodyLarge,
|
|
58
58
|
fontWeight: typography.fontWeights.demi,
|
|
59
59
|
lineHeight: 48,
|
|
60
|
+
userSelect: "none",
|
|
60
61
|
},
|
|
61
62
|
textSmall: {
|
|
62
63
|
...typography.bodySmall,
|
|
63
64
|
fontWeight: typography.fontWeights.demi,
|
|
64
65
|
lineHeight: 40,
|
|
66
|
+
userSelect: "none",
|
|
65
67
|
},
|
|
66
68
|
textDisabled: {
|
|
67
69
|
color: colors.gray[50],
|
|
@@ -73,11 +75,11 @@ const styles = StyleSheet.create({
|
|
|
73
75
|
justifyContent: "center",
|
|
74
76
|
},
|
|
75
77
|
});
|
|
76
|
-
export const BorderedButton = memo(forwardRef(({
|
|
78
|
+
export const BorderedButton = memo(forwardRef(({ ariaLabel, children = "", color = colors.gray[100], disabled = false, loading = false, icon, onPress, size = "large", style, }, forwardedRef) => {
|
|
77
79
|
const hasText = children !== "";
|
|
78
80
|
const isSmall = size === "small";
|
|
79
81
|
const iconSize = isSmall ? 18 : 20;
|
|
80
|
-
return (_jsxs(Pressable, {
|
|
82
|
+
return (_jsxs(Pressable, { role: "button", "aria-label": ariaLabel, "aria-busy": loading, "aria-disabled": disabled, disabled: loading || disabled, ref: forwardedRef, onPress: onPress, style: ({ hovered, pressed }) => [
|
|
81
83
|
styles.base,
|
|
82
84
|
isSmall && styles.small,
|
|
83
85
|
isNotNullish(icon) && (isSmall ? styles.withIconSmall : styles.withIcon),
|
|
@@ -90,9 +92,9 @@ export const BorderedButton = memo(forwardRef(({ accessibilityLabel, children =
|
|
|
90
92
|
? styles.hovered
|
|
91
93
|
: false,
|
|
92
94
|
style,
|
|
93
|
-
], children: [icon && _jsx(Icon, { color: color, name: icon, size: iconSize }), hasText && isNotNullish(icon) && _jsx(Space, { width: isSmall ? 8 : 12 }), hasText && (_jsx(Text, { numberOfLines: 1,
|
|
95
|
+
], children: [icon && _jsx(Icon, { color: color, name: icon, size: iconSize }), hasText && isNotNullish(icon) && _jsx(Space, { width: isSmall ? 8 : 12 }), hasText && (_jsx(Text, { numberOfLines: 1, style: [
|
|
94
96
|
isSmall ? styles.textSmall : styles.text,
|
|
95
97
|
disabled ? styles.textDisabled : { color },
|
|
96
|
-
], children: children })), loading && (_jsx(View, {
|
|
98
|
+
], children: children })), loading && (_jsx(View, { role: "none", style: styles.loaderContainer, children: _jsx(ActivityIndicator, { color: disabled ? colors.gray[50] : colors.gray[100], size: iconSize }) }))] }));
|
|
97
99
|
}));
|
|
98
100
|
BorderedButton.displayName = "BorderedButton";
|
|
@@ -37,7 +37,7 @@ const styles = StyleSheet.create({
|
|
|
37
37
|
animationKeyframes: {
|
|
38
38
|
"0%": {
|
|
39
39
|
opacity: 0,
|
|
40
|
-
transform:
|
|
40
|
+
transform: "translateY(20px)",
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
animationDuration: "300ms",
|
|
@@ -47,7 +47,7 @@ const styles = StyleSheet.create({
|
|
|
47
47
|
animationKeyframes: {
|
|
48
48
|
"100%": {
|
|
49
49
|
opacity: 0,
|
|
50
|
-
transform:
|
|
50
|
+
transform: "translateY(20px)",
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
animationDuration: "300ms",
|
package/src/components/Box.js
CHANGED
|
@@ -22,7 +22,7 @@ const justifyContentStyles = StyleSheet.create({
|
|
|
22
22
|
spaceEvenly: { justifyContent: "space-evenly" },
|
|
23
23
|
});
|
|
24
24
|
export const Box = forwardRef((
|
|
25
|
-
// Default <View /> styles https://github.com/necolas/react-native-web/blob/0.
|
|
25
|
+
// Default <View /> styles https://github.com/necolas/react-native-web/blob/0.19.1/packages/react-native-web/src/exports/View/index.js#L146
|
|
26
26
|
{ alignItems = "stretch", direction = "column", justifyContent = "normal", style, ...props }, forwardedRef) => (_jsx(View, { ref: forwardedRef, ...props, style: [
|
|
27
27
|
alignItems !== "stretch" && alignItemsStyles[alignItems],
|
|
28
28
|
direction !== "column" && directionStyles[direction],
|
|
@@ -20,14 +20,14 @@ const styles = StyleSheet.create({
|
|
|
20
20
|
flexDirection: "row",
|
|
21
21
|
alignItems: "center",
|
|
22
22
|
zIndex: 10,
|
|
23
|
-
transform:
|
|
23
|
+
transform: "translateZ(0px)",
|
|
24
24
|
},
|
|
25
25
|
item: {
|
|
26
26
|
flexDirection: "row",
|
|
27
27
|
alignItems: "center",
|
|
28
28
|
borderRadius: radii[6],
|
|
29
29
|
transitionProperty: "opacity",
|
|
30
|
-
transitionDuration: "
|
|
30
|
+
transitionDuration: "150ms",
|
|
31
31
|
},
|
|
32
32
|
itemPressed: {
|
|
33
33
|
opacity: 0.2,
|
|
@@ -59,7 +59,7 @@ const styles = StyleSheet.create({
|
|
|
59
59
|
dropdown: {
|
|
60
60
|
position: "absolute",
|
|
61
61
|
left: "50%",
|
|
62
|
-
transform:
|
|
62
|
+
transform: "translateX(-50%)",
|
|
63
63
|
top: "100%",
|
|
64
64
|
backgroundColor: backgroundColor.accented,
|
|
65
65
|
borderRadius: radii[8],
|
|
@@ -69,7 +69,7 @@ const styles = StyleSheet.create({
|
|
|
69
69
|
siblingsDropdown: {
|
|
70
70
|
position: "absolute",
|
|
71
71
|
left: "50%",
|
|
72
|
-
transform:
|
|
72
|
+
transform: "translateX(-50%)",
|
|
73
73
|
top: "100%",
|
|
74
74
|
backgroundColor: backgroundColor.accented,
|
|
75
75
|
borderRadius: radii[8],
|
|
@@ -107,7 +107,7 @@ const styles = StyleSheet.create({
|
|
|
107
107
|
position: "absolute",
|
|
108
108
|
top: "50%",
|
|
109
109
|
right: spacings[16],
|
|
110
|
-
transform:
|
|
110
|
+
transform: "translateY(-50%)",
|
|
111
111
|
},
|
|
112
112
|
});
|
|
113
113
|
const emptyCrumbWithIdArray = [];
|
|
@@ -318,7 +318,7 @@ const BreadcrumbsDropdownItems = ({ crumbs }) => {
|
|
|
318
318
|
styles.item,
|
|
319
319
|
pressed && styles.itemPressed,
|
|
320
320
|
openingStatus === "ForcedOpen" && styles.itemForcedOpen,
|
|
321
|
-
],
|
|
321
|
+
], tabIndex: 0, onFocus: onHandleFocus, onBlur: onAnyBlur, onPress: onPress, children: _jsx(View, { style: styles.horizontalLink, children: _jsx(LakeText, { style: [styles.horizontalLinkText, styles.activeHorizontalLinkText], children: "…" }) }) }), _jsx(TransitionView, { ...animations.fadeAndSlideInFromBottom, children: shouldOpen ? (_jsx(FocusTrap, { autoFocus: shouldAutoFocus, focusLock: shouldLockFocus, returnFocus: shouldLockFocus, onClickOutside: onPressOutside, onEscapeKey: shouldLockFocus ? onEscapeKey : undefined, children: _jsx(BreadcrumbsDropdown, { crumbs: crumbs, onHoverStart: onHoverStart, onHoverEnd: onHoverEnd, onLinkFocus: onLinkFocus, onLinkBlur: onAnyBlur, onLinkPress: onEscapeKey }) })) : null })] })] }));
|
|
322
322
|
};
|
|
323
323
|
// In order to preserve the horizontal space, we collapse the breadcrumbs once
|
|
324
324
|
// there's strictly more than three crumbs. In that case, the expected behavior
|
|
@@ -358,5 +358,5 @@ export const Breadcrumbs = () => {
|
|
|
358
358
|
isRootCrumb,
|
|
359
359
|
})));
|
|
360
360
|
}, [cleanCrumbs]);
|
|
361
|
-
return (_jsxs(View, {
|
|
361
|
+
return (_jsxs(View, { role: "navigation", style: styles.container, children: [start.map(({ id, crumb, isFirst, isLast, isRootCrumb }) => (_jsx(BreadcrumbsItem, { crumb: crumb, isFirstItem: isFirst, isLastItem: isLast, shouldAnimate: !previousCrumbs.has(id) && !isRootCrumb }, id))), collapsed.length > 0 ? _jsx(BreadcrumbsDropdownItems, { crumbs: collapsed }) : null, end.map(({ id, crumb, isLast, isRootCrumb }) => (_jsx(BreadcrumbsItem, { crumb: crumb, isLastItem: isLast, shouldAnimate: !previousCrumbs.has(id) && !isRootCrumb }, id)))] }));
|
|
362
362
|
};
|
|
@@ -35,15 +35,15 @@ const styles = StyleSheet.create({
|
|
|
35
35
|
flexBasis: "33.333%",
|
|
36
36
|
maxWidth: 300,
|
|
37
37
|
padding: spacings[12],
|
|
38
|
-
transform:
|
|
38
|
+
transform: "translateZ(0px)",
|
|
39
39
|
animationKeyframes: {
|
|
40
40
|
from: {
|
|
41
41
|
opacity: 0,
|
|
42
|
-
transform:
|
|
42
|
+
transform: "translateZ(0px) translateX(50px)",
|
|
43
43
|
},
|
|
44
44
|
to: {
|
|
45
45
|
opacity: 1,
|
|
46
|
-
transform:
|
|
46
|
+
transform: "translateZ(0px) translateX(0px)",
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
animationDuration: "200ms",
|
|
@@ -73,13 +73,13 @@ const styles = StyleSheet.create({
|
|
|
73
73
|
position: "absolute",
|
|
74
74
|
top: "50%",
|
|
75
75
|
left: negativeSpacings[24],
|
|
76
|
-
transform:
|
|
76
|
+
transform: "translateY(-50%)",
|
|
77
77
|
},
|
|
78
78
|
rightButton: {
|
|
79
79
|
position: "absolute",
|
|
80
80
|
top: "50%",
|
|
81
81
|
right: negativeSpacings[24],
|
|
82
|
-
transform:
|
|
82
|
+
transform: "translateY(-50%)",
|
|
83
83
|
},
|
|
84
84
|
});
|
|
85
85
|
const identity = (x) => x;
|
|
@@ -89,7 +89,7 @@ export const ChoicePicker = ({ items, getId = identity, large = false, renderIte
|
|
|
89
89
|
return (_jsxs(View, { children: [_jsx(View, { style: styles.root, children: _jsx(View, { style: [
|
|
90
90
|
styles.container,
|
|
91
91
|
!desktop && styles.mobileContainer,
|
|
92
|
-
!desktop && { transform:
|
|
92
|
+
!desktop && { transform: `translateX(-${100 * index}%)` },
|
|
93
93
|
], children: items.map((item, index) => (_jsx(Pressable, { style: [
|
|
94
94
|
styles.item,
|
|
95
95
|
large && styles.itemLarge,
|
package/src/components/Fill.js
CHANGED
|
@@ -5,6 +5,7 @@ import { spacingValues } from "./Space";
|
|
|
5
5
|
const baseStyle = {
|
|
6
6
|
flexGrow: 1,
|
|
7
7
|
flexShrink: 1,
|
|
8
|
+
pointerEvents: "none",
|
|
8
9
|
};
|
|
9
10
|
const rawHeightStyles = {};
|
|
10
11
|
const rawWidthStyles = {};
|
|
@@ -17,7 +18,7 @@ const styles = StyleSheet.create({
|
|
|
17
18
|
});
|
|
18
19
|
const heightStyles = StyleSheet.create(rawHeightStyles);
|
|
19
20
|
const widthStyles = StyleSheet.create(rawWidthStyles);
|
|
20
|
-
export const Fill = ({ minHeight, minWidth }) => (_jsx(View, {
|
|
21
|
+
export const Fill = ({ minHeight, minWidth }) => (_jsx(View, { tabIndex: -1, style: [
|
|
21
22
|
styles.base,
|
|
22
23
|
isNotNullish(minHeight) && heightStyles[minHeight],
|
|
23
24
|
isNotNullish(minWidth) && widthStyles[minWidth],
|
|
@@ -42,9 +42,9 @@ const styles = StyleSheet.create({
|
|
|
42
42
|
export function FilterChooser({ filters, openFilters, label, title, availableFilters, large = true, onAddFilter, }) {
|
|
43
43
|
const inputRef = useRef(null);
|
|
44
44
|
const [visible, { close, toggle }] = useDisclosure(false);
|
|
45
|
-
return (_jsxs(_Fragment, { children: [_jsx(Box, { direction: "row", justifyContent: "start", alignItems: "center", children: _jsx(LakeButton, { size: "small", mode: "secondary", color: "gray", onPress: toggle, ref: inputRef, icon: large ? "chevron-down-filled" : "filter-filled", iconPosition: "end",
|
|
45
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, { direction: "row", justifyContent: "start", alignItems: "center", children: _jsx(LakeButton, { size: "small", mode: "secondary", color: "gray", onPress: toggle, ref: inputRef, icon: large ? "chevron-down-filled" : "filter-filled", iconPosition: "end", ariaLabel: label, children: large ? label : null }) }), _jsx(Popover, { role: "listbox", matchReferenceMinWidth: true, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsxs(View, { style: styles.list, children: [_jsx(Text, { style: styles.availableFiltersTitle, children: title }), _jsx(Space, { height: 8 }), _jsx(FlatList, { role: "list", data: availableFilters, keyExtractor: (_, index) => `filter-item-${index}`, renderItem: ({ item }) => {
|
|
46
46
|
const isSet = Boolean(filters[item.name]) || openFilters.includes(item.name);
|
|
47
|
-
return (_jsxs(Pressable, { style: ({ hovered }) => [styles.item, hovered && styles.itemHovered],
|
|
47
|
+
return (_jsxs(Pressable, { style: ({ hovered }) => [styles.item, hovered && styles.itemHovered], role: "button", disabled: isSet, onPress: () => {
|
|
48
48
|
onAddFilter(item.name);
|
|
49
49
|
close();
|
|
50
50
|
}, children: [_jsx(Text, { style: [styles.filterName, isSet && styles.selected], children: item.label }), isSet && _jsx(Icon, { color: colors.positive[500], name: "checkmark-filled", size: 14 })] }));
|
|
@@ -12,10 +12,11 @@ import { usePreviousValue } from "../hooks/usePreviousValue";
|
|
|
12
12
|
import { isNotNullish } from "../utils/nullish";
|
|
13
13
|
import { Box } from "./Box";
|
|
14
14
|
import { Icon } from "./Icon";
|
|
15
|
-
import { Input } from "./Input";
|
|
16
15
|
import { LakeButton } from "./LakeButton";
|
|
17
16
|
import { LakeCheckbox } from "./LakeCheckbox";
|
|
17
|
+
import { LakeLabel } from "./LakeLabel";
|
|
18
18
|
import { LakeRadio } from "./LakeRadio";
|
|
19
|
+
import { LakeTextInput } from "./LakeTextInput";
|
|
19
20
|
import { Popover } from "./Popover";
|
|
20
21
|
import { Space } from "./Space";
|
|
21
22
|
import { Stack } from "./Stack";
|
|
@@ -39,7 +40,6 @@ const styles = StyleSheet.create({
|
|
|
39
40
|
opacity: 1,
|
|
40
41
|
},
|
|
41
42
|
dropdown: {
|
|
42
|
-
marginTop: 4,
|
|
43
43
|
maxHeight: 400,
|
|
44
44
|
minWidth: 200,
|
|
45
45
|
},
|
|
@@ -59,7 +59,7 @@ const styles = StyleSheet.create({
|
|
|
59
59
|
height: 32,
|
|
60
60
|
paddingHorizontal: 24,
|
|
61
61
|
},
|
|
62
|
-
|
|
62
|
+
input: {
|
|
63
63
|
width: 200,
|
|
64
64
|
},
|
|
65
65
|
value: {
|
|
@@ -79,9 +79,9 @@ function FilterRadio({ label, items, value, onValueChange, onPressRemove, autoOp
|
|
|
79
79
|
const inputRef = useRef(null);
|
|
80
80
|
const [visible, { close, toggle }] = useDisclosure(autoOpen);
|
|
81
81
|
const currentValue = useMemo(() => items.find(i => i.value === value), [items, value]);
|
|
82
|
-
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: currentValue?.label }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsx(View, { style: styles.dropdown, children: _jsx(FlatList, {
|
|
82
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: currentValue?.label }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsx(View, { style: styles.dropdown, children: _jsx(FlatList, { role: "list", data: items, contentContainerStyle: styles.content, keyExtractor: (_, index) => `filter-item-${index}`, renderItem: ({ item }) => {
|
|
83
83
|
const isSelected = value === item.value;
|
|
84
|
-
return (_jsxs(Pressable, {
|
|
84
|
+
return (_jsxs(Pressable, { role: "radio", "aria-checked": isSelected, style: ({ hovered }) => [styles.radio, hovered && styles.itemHovered], onPress: () => {
|
|
85
85
|
onValueChange(item.value);
|
|
86
86
|
close();
|
|
87
87
|
}, children: [_jsx(LakeRadio, { value: isSelected }), _jsx(Space, { width: 12 }), _jsx(Text, { children: item.label })] }));
|
|
@@ -114,7 +114,7 @@ function FilterCheckbox({ label, items, checkAllLabel, value, onValueChange, app
|
|
|
114
114
|
setLocalValue(value);
|
|
115
115
|
}
|
|
116
116
|
}, [visible, value]);
|
|
117
|
-
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: allChecked ? checkAllLabel : currentValue.map(item => item.label).join(", ") }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsxs(View, { style: styles.dropdown, children: [_jsx(FlatList, {
|
|
117
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: allChecked ? checkAllLabel : currentValue.map(item => item.label).join(", ") }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsxs(View, { style: styles.dropdown, children: [_jsx(FlatList, { role: "list", data: listItems, contentContainerStyle: styles.content, keyExtractor: (_, index) => `filter-item-${index}`, renderItem: ({ item }) => {
|
|
118
118
|
const isSelected = match(item)
|
|
119
119
|
.with({ checked: P.any }, ({ checked }) => checked)
|
|
120
120
|
.with({ value: P.any }, ({ value }) => values.has(value))
|
|
@@ -146,7 +146,7 @@ function FilterCheckbox({ label, items, checkAllLabel, value, onValueChange, app
|
|
|
146
146
|
}
|
|
147
147
|
})
|
|
148
148
|
.exhaustive();
|
|
149
|
-
return (_jsxs(Pressable, {
|
|
149
|
+
return (_jsxs(Pressable, { role: "radio", "aria-checked": isSelected, style: ({ hovered }) => [styles.radio, hovered && styles.itemHovered], onPress: onPress, children: [_jsx(LakeCheckbox, { value: isSelected }), _jsx(Space, { width: 12 }), _jsx(Text, { children: item.label })] }));
|
|
150
150
|
} }), _jsx(Space, { height: 8 }), _jsx(View, { style: styles.buttonContainer, children: _jsx(LakeButton, { color: "current", onPress: save, children: applyButtonLabel }) }), _jsx(Space, { height: 24 })] }) })] }));
|
|
151
151
|
}
|
|
152
152
|
function FilterDate({ label, initialValue, noValueText, submitText, dateFormat, rifmProps, validate, onSave, onPressRemove, autoOpen = false, }) {
|
|
@@ -170,7 +170,7 @@ function FilterDate({ label, initialValue, noValueText, submitText, dateFormat,
|
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
};
|
|
173
|
-
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: isNotNullish(initialValue) ? dayjs(initialValue).format(dateFormat) : noValueText }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsxs(View, { style: [styles.dropdown, styles.inputContent], children: [_jsx(Field, { name: "date", children: ({ value, onChange, error }) => (_jsx(Rifm, { value: value, onChange: onChange, ...rifmProps, children: ({ value, onChange }) => (_jsx(
|
|
173
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: isNotNullish(initialValue) ? dayjs(initialValue).format(dateFormat) : noValueText }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsxs(View, { style: [styles.dropdown, styles.inputContent], children: [_jsx(Field, { name: "date", children: ({ value, onChange, error }) => (_jsx(Rifm, { value: value, onChange: onChange, ...rifmProps, children: ({ value, onChange }) => (_jsx(LakeLabel, { label: label, render: id => (_jsx(LakeTextInput, { nativeID: id, error: error, style: styles.input, placeholder: dateFormat, value: value, onChange: onChange })) })) })) }), _jsx(LakeButton, { color: "current", size: "small", onPress: onSubmit, children: submitText })] }) })] }));
|
|
174
174
|
}
|
|
175
175
|
function FilterInput({ label, initialValue = "", noValueText, submitText, autoOpen = false, placeholder, validate, onSave, onPressRemove, }) {
|
|
176
176
|
const inputRef = useRef(null);
|
|
@@ -191,7 +191,7 @@ function FilterInput({ label, initialValue = "", noValueText, submitText, autoOp
|
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
193
|
};
|
|
194
|
-
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: value === "" ? noValueText : value }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsxs(View, { style: [styles.dropdown, styles.inputContent], children: [_jsx(Field, { name: "input", children: ({ error, value, onChange }) => (_jsx(
|
|
194
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: value === "" ? noValueText : value }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsxs(View, { style: [styles.dropdown, styles.inputContent], children: [_jsx(Field, { name: "input", children: ({ error, value, onChange }) => (_jsx(LakeLabel, { label: label, render: id => (_jsx(LakeTextInput, { nativeID: id, error: error, style: styles.input, placeholder: placeholder, value: value, onChangeText: onChange })) })) }), _jsx(LakeButton, { size: "small", color: "current", onPress: onSubmit, children: submitText })] }) })] }));
|
|
195
195
|
}
|
|
196
196
|
const getFilterValue = (_type, filters, name) => filters[name];
|
|
197
197
|
export const FiltersStack = ({ filters, openedFilters, definition, onChangeOpened, onChangeFilters, }) => {
|
|
@@ -152,6 +152,7 @@ const styles = StyleSheet.create({
|
|
|
152
152
|
backgroundImage: "linear-gradient(to right, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0))",
|
|
153
153
|
opacity: 0,
|
|
154
154
|
transition: "150ms ease-in-out opacity",
|
|
155
|
+
pointerEvents: "none",
|
|
155
156
|
},
|
|
156
157
|
rightToLeftGradient: {
|
|
157
158
|
position: "absolute",
|
|
@@ -162,6 +163,7 @@ const styles = StyleSheet.create({
|
|
|
162
163
|
backgroundImage: "linear-gradient(to left, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0))",
|
|
163
164
|
opacity: 0,
|
|
164
165
|
transition: "150ms ease-in-out opacity",
|
|
166
|
+
pointerEvents: "none",
|
|
165
167
|
},
|
|
166
168
|
horizontalScrollbar: {
|
|
167
169
|
position: "sticky",
|
|
@@ -312,6 +314,7 @@ const styles = StyleSheet.create({
|
|
|
312
314
|
backgroundImage: `linear-gradient(to bottom, ${backgroundColor.default}, ${backgroundColor.defaultTransparent})`,
|
|
313
315
|
opacity: 0,
|
|
314
316
|
transition: "200ms ease-in-out opacity",
|
|
317
|
+
pointerEvents: "none",
|
|
315
318
|
},
|
|
316
319
|
visibleTopGradient: {
|
|
317
320
|
opacity: 1,
|
|
@@ -349,8 +352,8 @@ const RowSegment = ({ columns, item, style, absoluteIndex, viewId, segmentColumn
|
|
|
349
352
|
});
|
|
350
353
|
const wrapper = createRowWrapper({ item, absoluteIndex, extraInfo });
|
|
351
354
|
return cloneElement(wrapper, {
|
|
352
|
-
|
|
353
|
-
|
|
355
|
+
id: focusId,
|
|
356
|
+
tabIndex: 0,
|
|
354
357
|
style: [
|
|
355
358
|
styles.rowSegment,
|
|
356
359
|
{
|
|
@@ -372,7 +375,7 @@ const RowSegment = ({ columns, item, style, absoluteIndex, viewId, segmentColumn
|
|
|
372
375
|
borderTopRightRadius: radii[4],
|
|
373
376
|
borderBottomRightRadius: radii[4],
|
|
374
377
|
},
|
|
375
|
-
], ref: containerRef,
|
|
378
|
+
], ref: containerRef, "aria-hidden": false, children: _jsx(View, { style: [styles.segmentOverflow, style], children: columns.map(({ id, width, renderCell }, index) => {
|
|
376
379
|
const columnId = `${viewId}_${id}`;
|
|
377
380
|
const paddedIndex = String(absoluteIndex).padStart(10, "0");
|
|
378
381
|
const paddedCellIndex = String(index).padStart(10, "0");
|
|
@@ -382,14 +385,14 @@ const RowSegment = ({ columns, item, style, absoluteIndex, viewId, segmentColumn
|
|
|
382
385
|
// 3. Cell index
|
|
383
386
|
// -> See the `onKeyDown` handler
|
|
384
387
|
const focusId = `${viewId}__Row_${paddedIndex}_Segment_${SEGMENTS_MAP[segmentColumn]}_Cell_${paddedCellIndex}`;
|
|
385
|
-
return (_jsx(View, { style: [styles.cell, { width }],
|
|
388
|
+
return (_jsx(View, { style: [styles.cell, { width }], "aria-describedby": columnId, id: focusId, children: renderCell({ columnId, item, index: absoluteIndex, extraInfo, isHovered }) }, columnId));
|
|
386
389
|
}) }) }));
|
|
387
390
|
};
|
|
388
391
|
const MemoizedRowSegment = memo(RowSegment);
|
|
389
392
|
const HeaderSegment = ({ columns, viewId, extraInfo, width, }) => {
|
|
390
393
|
return (_jsx(View, { style: [styles.segment, { width }], children: columns.map(({ id, width, title, renderTitle }) => {
|
|
391
394
|
const columnId = `${viewId}_${id}`;
|
|
392
|
-
return (_jsx(View, { style: [styles.segmentHeaderCell, { width }],
|
|
395
|
+
return (_jsx(View, { style: [styles.segmentHeaderCell, { width }], id: columnId, children: renderTitle({ title, extraInfo, id }) }, columnId));
|
|
393
396
|
}) }));
|
|
394
397
|
};
|
|
395
398
|
const findNextFocusableElement = (sortedCellIds, currentCellIndex, direction) => {
|
|
@@ -730,14 +733,14 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
730
733
|
setHasHorizontalScroll(centerColumnsWidth > width);
|
|
731
734
|
}, [centerColumnsWidth]);
|
|
732
735
|
const isLoading = isNotNullish(loading) && loading.isLoading;
|
|
733
|
-
return (_jsxs(View, { style: styles.root, children: [_jsx(View, { ref: startFocusAnchorRef,
|
|
736
|
+
return (_jsxs(View, { style: styles.root, children: [_jsx(View, { ref: startFocusAnchorRef, tabIndex: 0 }), _jsxs(ScrollView, { onKeyDown: onKeyDown, onLayout: onLayout, onScroll: onScroll, scrollEventThrottle: 32, style: [styles.container, mode === "tile" && styles.containerTile], contentContainerStyle: [
|
|
734
737
|
styles.contentContainer,
|
|
735
738
|
{
|
|
736
739
|
height: totalHeight +
|
|
737
740
|
SCROLLBAR_RESERVED_SPACE +
|
|
738
741
|
(isLoading ? loading.count * (rowHeight + rowVerticalSpacing) : 0),
|
|
739
742
|
},
|
|
740
|
-
], children: [_jsx(View, {
|
|
743
|
+
], children: [_jsx(View, { "aria-busy": isLoading, style: [
|
|
741
744
|
styles.loadingPlaceholder,
|
|
742
745
|
{
|
|
743
746
|
top: totalHeight,
|
|
@@ -755,7 +758,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
755
758
|
width: stickedToStartColumnsWidth + HORIZONTAL_SAFE_AREA,
|
|
756
759
|
paddingLeft: HORIZONTAL_SAFE_AREA,
|
|
757
760
|
},
|
|
758
|
-
], children: [_jsxs(View, { style: [styles.headingSegment, { height: headerHeight }], children: [_jsx(HeaderSegment, { columns: stickedToStartColumns, extraInfo: extraInfo, viewId: viewId, width: stickedToStartColumnsWidth }), _jsx(View, { style: styles.stickyColumnStartOverflow }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient]
|
|
761
|
+
], children: [_jsxs(View, { style: [styles.headingSegment, { height: headerHeight }], children: [_jsx(HeaderSegment, { columns: stickedToStartColumns, extraInfo: extraInfo, viewId: viewId, width: stickedToStartColumnsWidth }), _jsx(View, { style: styles.stickyColumnStartOverflow }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient] })] }), _jsx(View, { style: [styles.stickyRow, { height: totalHeight }], children: startRows })] })) : null, _jsxs(View, { style: [
|
|
759
762
|
styles.centerColumnsContainer,
|
|
760
763
|
{
|
|
761
764
|
paddingLeft: stickedToStartColumns.length === 0 ? HORIZONTAL_SAFE_AREA : ZERO,
|
|
@@ -765,7 +768,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
765
768
|
minWidth: centerColumnsWidth +
|
|
766
769
|
(stickedToStartColumns.length === 0 ? HORIZONTAL_SAFE_AREA : 0) +
|
|
767
770
|
(stickedToEndColumns.length === 0 ? HORIZONTAL_SAFE_AREA : 0),
|
|
768
|
-
}, children: _jsx(HeaderSegment, { columns: columns, extraInfo: extraInfo, viewId: viewId, width: centerColumnsWidth }) }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient]
|
|
771
|
+
}, children: _jsx(HeaderSegment, { columns: columns, extraInfo: extraInfo, viewId: viewId, width: centerColumnsWidth }) }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient] })] }), _jsx(ScrollView, { horizontal: true, ref: centerColumnsRef, style: styles.centerColumns, contentContainerStyle: [
|
|
769
772
|
styles.centerColumnsContentContainer,
|
|
770
773
|
{
|
|
771
774
|
minWidth: centerColumnsWidth +
|
|
@@ -776,7 +779,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
776
779
|
minWidth: centerColumnsWidth +
|
|
777
780
|
(stickedToStartColumns.length === 0 ? HORIZONTAL_SAFE_AREA : 0) +
|
|
778
781
|
(stickedToEndColumns.length === 0 ? HORIZONTAL_SAFE_AREA : 0),
|
|
779
|
-
} }), stickedToStartColumns.length > 0 && hasHorizontalScroll ? (_jsx(View, {
|
|
782
|
+
} }), stickedToStartColumns.length > 0 && hasHorizontalScroll ? (_jsx(View, { style: [
|
|
780
783
|
styles.leftToRightGradient,
|
|
781
784
|
{
|
|
782
785
|
maxHeight: data.length * totalRowHeight,
|
|
@@ -784,7 +787,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
784
787
|
bottom: SCROLLBAR_RESERVED_SPACE + rowVerticalSpacing / 2,
|
|
785
788
|
},
|
|
786
789
|
shouldShowStartGradient && styles.visibleGradient,
|
|
787
|
-
] })) : null, stickedToEndColumns.length > 0 && hasHorizontalScroll ? (_jsx(View, {
|
|
790
|
+
] })) : null, stickedToEndColumns.length > 0 && hasHorizontalScroll ? (_jsx(View, { style: [
|
|
788
791
|
styles.rightToLeftGradient,
|
|
789
792
|
{
|
|
790
793
|
maxHeight: data.length * totalRowHeight,
|
|
@@ -798,7 +801,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
798
801
|
width: stickedToEndColumnsWidth + HORIZONTAL_SAFE_AREA,
|
|
799
802
|
paddingRight: HORIZONTAL_SAFE_AREA,
|
|
800
803
|
},
|
|
801
|
-
], children: [_jsxs(View, { style: [styles.headingSegment, { height: headerHeight }], children: [_jsx(View, { style: styles.stickyColumnEndOverflow }), _jsx(HeaderSegment, { columns: stickedToEndColumns, extraInfo: extraInfo, viewId: viewId, width: stickedToEndColumnsWidth }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient]
|
|
804
|
+
], children: [_jsxs(View, { style: [styles.headingSegment, { height: headerHeight }], children: [_jsx(View, { style: styles.stickyColumnEndOverflow }), _jsx(HeaderSegment, { columns: stickedToEndColumns, extraInfo: extraInfo, viewId: viewId, width: stickedToEndColumnsWidth }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient] })] }), _jsx(View, { style: [styles.stickyRow, { height: totalHeight }], children: endRows })] })) : null] })] }), data.length === 0 && isNotNullish(renderEmptyList) && !isLoading ? (_jsx(View, { style: styles.emptyListContainer, children: renderEmptyList() })) : null, _jsx(View, { ref: endFocusAnchorRef, tabIndex: 0 })] }));
|
|
802
805
|
};
|
|
803
806
|
export const FixedListViewPlaceholder = ({ count, rowHeight, rowVerticalSpacing, groupHeaderHeight, headerHeight, paddingHorizontal = HORIZONTAL_SAFE_AREA, }) => {
|
|
804
807
|
const totalRowHeight = rowHeight + rowVerticalSpacing;
|
|
@@ -71,7 +71,7 @@ const styles = StyleSheet.create({
|
|
|
71
71
|
transitionTimingFunction: "ease-in-out",
|
|
72
72
|
},
|
|
73
73
|
sortIconReversed: {
|
|
74
|
-
transform:
|
|
74
|
+
transform: "rotate(-180deg)",
|
|
75
75
|
},
|
|
76
76
|
cellAction: {
|
|
77
77
|
paddingVertical: spacings[16],
|
|
@@ -120,7 +120,7 @@ export const CopyableRegularTextCell = ({ variant = "regular", text, copyWording
|
|
|
120
120
|
Clipboard.setString(text);
|
|
121
121
|
setVisibleState("copied");
|
|
122
122
|
}, [text]);
|
|
123
|
-
return (_jsxs(View, { style: styles.cell, children: [_jsx(LakeTooltip, { placement: "top", onHide: () => setVisibleState("copy"), togglableOnFocus: true, content: visibleState === "copy" ? copyWording : copiedWording, containerStyle: styles.iconContainer, children: _jsx(Pressable, {
|
|
123
|
+
return (_jsxs(View, { style: styles.cell, children: [_jsx(LakeTooltip, { placement: "top", onHide: () => setVisibleState("copy"), togglableOnFocus: true, content: visibleState === "copy" ? copyWording : copiedWording, containerStyle: styles.iconContainer, children: _jsx(Pressable, { role: "button", "aria-label": copyWording, onPress: onPress, style: ({ hovered }) => [styles.icon, hovered && styles.underline], children: ({ hovered }) => (_jsx(Icon, { name: hovered ? "copy-filled" : "copy-regular", color: "currentColor", size: 14 })) }) }), _jsx(Space, { width: 4 }), _jsx(LakeText, { color: colors.gray[900], style: styles.regularText, variant: variant, children: text })] }));
|
|
124
124
|
};
|
|
125
125
|
// TODO: handle `+` sign properly
|
|
126
126
|
export const BalanceCell = ({ value, currency, formatCurrency, textAlign = "right", }) => {
|
package/src/components/Form.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { View, ViewProps } from "react-native";
|
|
3
3
|
import { Except } from "type-fest";
|
|
4
|
-
export declare const Form: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Except<ViewProps, "
|
|
4
|
+
export declare const Form: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Except<ViewProps, "role"> & {
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
onReset?: ((event: React.FormEvent<HTMLElement>) => void) | undefined;
|
|
7
7
|
onSubmit?: ((event: React.FormEvent<HTMLElement>) => void) | undefined;
|