@swan-io/lake 2.7.10 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/lake",
3
- "version": "2.7.10",
3
+ "version": "2.7.11",
4
4
  "engines": {
5
5
  "node": ">=18.0.0",
6
6
  "yarn": "^1.22.0"
@@ -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: isNullish(onPress), style: styles.cellContainer, 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: {
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",
@@ -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";
@@ -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
- !disabled && applyPressStyle ? styles.active : styles.disabled,
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
  });