@swan-io/lake 2.7.9 → 2.7.11
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
CHANGED
|
@@ -28,6 +28,9 @@ const styles = StyleSheet.create({
|
|
|
28
28
|
flexDirection: "row",
|
|
29
29
|
alignItems: "center",
|
|
30
30
|
},
|
|
31
|
+
disabledCellHeader: {
|
|
32
|
+
cursor: "text",
|
|
33
|
+
},
|
|
31
34
|
icon: {
|
|
32
35
|
alignSelf: "stretch",
|
|
33
36
|
alignItems: "center",
|
|
@@ -92,13 +95,14 @@ const styles = StyleSheet.create({
|
|
|
92
95
|
});
|
|
93
96
|
export const SimpleHeaderCell = ({ text, sort, justifyContent = "flex-start", onPress, }) => {
|
|
94
97
|
const sortActive = isNotNullish(sort) && isNotNullish(onPress);
|
|
98
|
+
const disabled = isNullish(onPress);
|
|
95
99
|
return (_jsx(Pressable, { onPress: () => {
|
|
96
100
|
onPress?.(match(sort)
|
|
97
101
|
.returnType()
|
|
98
102
|
.with("Desc", () => "Asc")
|
|
99
103
|
.with("Asc", () => "Desc")
|
|
100
104
|
.otherwise(() => "Desc"));
|
|
101
|
-
}, disabled:
|
|
105
|
+
}, disabled: disabled, style: [styles.cellContainer, disabled && styles.disabledCellHeader], role: "columnheader", children: ({ hovered }) => (_jsx(View, { style: [styles.cell, { justifyContent }], children: _jsxs(View, { children: [_jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(LakeText, { numberOfLines: 1, variant: "medium", color: sortActive ? colors.current[500] : colors.gray[900], style: {
|
|
102
106
|
textAlign: match(justifyContent)
|
|
103
107
|
.with("flex-start", () => "left")
|
|
104
108
|
.with("center", () => "center")
|
|
@@ -21,12 +21,12 @@ const styles = StyleSheet.create({
|
|
|
21
21
|
flexGrow: 1,
|
|
22
22
|
flexDirection: "row",
|
|
23
23
|
alignItems: "stretch",
|
|
24
|
+
width: "100%",
|
|
24
25
|
},
|
|
25
26
|
contents: {
|
|
26
27
|
flexGrow: 1,
|
|
27
28
|
flexShrink: 1,
|
|
28
29
|
flexDirection: "row",
|
|
29
|
-
width: "100%",
|
|
30
30
|
display: "flex",
|
|
31
31
|
alignItems: "center",
|
|
32
32
|
justifyContent: "center",
|
package/src/components/Link.js
CHANGED
|
@@ -5,7 +5,7 @@ import { isNotNullish } from "../utils/nullish";
|
|
|
5
5
|
import { PressableText } from "./Pressable";
|
|
6
6
|
export const Link = memo(forwardRef(({ role = "link", children, disabled = false, onPress, replace = false, download = false, style, target, to, ariaCurrentValue = "page", tabIndex, ...props }, forwardedRef) => {
|
|
7
7
|
const { active, onClick } = useLinkProps({ href: to, replace, target });
|
|
8
|
-
return (_jsx(PressableText, { ...props, role: role, "aria-disabled": disabled, tabIndex: isNotNullish(tabIndex) ? tabIndex : disabled ? -1 : 0, "aria-current": active ? ariaCurrentValue : undefined, href: to, onPress: (event) => {
|
|
8
|
+
return (_jsx(PressableText, { ...props, role: role, disabled: disabled, "aria-disabled": disabled, tabIndex: isNotNullish(tabIndex) ? tabIndex : disabled ? -1 : 0, "aria-current": active ? ariaCurrentValue : undefined, href: !disabled ? to : undefined, onPress: (event) => {
|
|
9
9
|
const e = event;
|
|
10
10
|
if (disabled) {
|
|
11
11
|
e.preventDefault();
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
// https://github.com/necolas/react-native-web/blob/0.19.1/packages/react-native-web/src/exports/Pressable/index.js
|
|
3
3
|
import { forwardRef, memo, useCallback, useMemo, useRef, } from "react";
|
|
4
4
|
import { StyleSheet, Text, TextInput, View, } from "react-native";
|
|
5
|
+
import { match } from "ts-pattern";
|
|
5
6
|
import { useForceableState } from "../hooks/useForceableState";
|
|
6
7
|
import { useHover } from "../hooks/useHover";
|
|
7
8
|
import { useMergeRefs } from "../hooks/useMergeRefs";
|
|
@@ -12,7 +13,7 @@ const styles = StyleSheet.create({
|
|
|
12
13
|
touchAction: "manipulation",
|
|
13
14
|
},
|
|
14
15
|
disabled: {
|
|
15
|
-
|
|
16
|
+
cursor: "not-allowed",
|
|
16
17
|
},
|
|
17
18
|
});
|
|
18
19
|
const getPressable = (
|
|
@@ -89,7 +90,10 @@ Component, config = {}) => {
|
|
|
89
90
|
_tabIndex = disabled ? -1 : 0;
|
|
90
91
|
}
|
|
91
92
|
return (_jsx(Component, { ...rest, ...pressEventHandlers, "aria-disabled": disabled, onBlur: blurHandler, onContextmenu: contextMenuHandler, onFocus: focusHandler, onKeyDown: keyDownHandler, ref: setRef, style: [
|
|
92
|
-
|
|
93
|
+
match({ disabled, applyPressStyle })
|
|
94
|
+
.with({ disabled: false, applyPressStyle: true }, () => styles.active)
|
|
95
|
+
.with({ disabled: true }, () => styles.disabled)
|
|
96
|
+
.otherwise(() => null),
|
|
93
97
|
typeof style === "function" ? style(interactionState) : style,
|
|
94
98
|
], tabIndex: _tabIndex, children: typeof children === "function" ? children(interactionState) : children }));
|
|
95
99
|
});
|