@swan-io/lake 2.6.0 → 2.6.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/lake",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "engines": {
5
5
  "node": ">=18.0.0",
6
6
  "yarn": "^1.22.0"
@@ -27,29 +27,29 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@popperjs/core": "^2.11.8",
30
- "@react-three/drei": "^9.77.0",
31
- "@react-three/fiber": "^8.13.3",
30
+ "@react-three/drei": "^9.77.10",
31
+ "@react-three/fiber": "^8.13.4",
32
32
  "@swan-io/boxed": "^1.0.2",
33
- "@swan-io/chicane": "^1.4.0",
34
- "dayjs": "^1.11.8",
33
+ "@swan-io/chicane": "^1.4.1",
34
+ "dayjs": "^1.11.9",
35
35
  "polished": "^4.2.2",
36
- "prism-react-renderer": "^2.0.5",
36
+ "prism-react-renderer": "^2.0.6",
37
37
  "react": "^18.2.0",
38
38
  "react-atomic-state": "^1.2.7",
39
39
  "react-dom": "^18.2.0",
40
- "react-native-web": "^0.19.5",
40
+ "react-native-web": "^0.19.6",
41
41
  "react-popper": "^2.3.0",
42
42
  "react-ux-form": "^1.3.0",
43
43
  "rifm": "^0.12.1",
44
- "three": "^0.153.0",
44
+ "three": "^0.154.0",
45
45
  "ts-dedent": "^2.2.0",
46
46
  "ts-pattern": "^5.0.1",
47
47
  "urql": "^4.0.4",
48
48
  "uuid": "^9.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@types/react": "^18.2.12",
52
- "@types/react-dom": "^18.2.5",
51
+ "@types/react": "^18.2.14",
52
+ "@types/react-dom": "^18.2.6",
53
53
  "@types/react-native": "^0.72.2",
54
54
  "@types/three": "^0.152.1",
55
55
  "@types/uuid": "^9.0.2",
@@ -50,5 +50,5 @@ export const LakeCheckbox = ({ value, color = "current", disabled = false, isErr
50
50
  ], children: [value === true && (_jsx(Svg, { viewBox: "0 0 16 16", children: _jsx(Path, { d: "m3.5 7.5 2.8 3.4 5.6-6.7", stroke: colors[color].contrast, strokeWidth: 1.5, fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: "20", strokeDashoffset: shouldAnimate ? "20" : "0", children: shouldAnimate && (_jsx(Animate, { attributeName: "stroke-dashoffset", values: "20;0", dur: "150ms", begin: "150ms", fill: "freeze" })) }) })), value === "mixed" && (_jsx(View, { style: [styles.mixed, { backgroundColor: colors[color].contrast }] }))] }));
51
51
  };
52
52
  export const LakeLabelledCheckbox = ({ value, color, label, onValueChange, disabled = false, isError = false, }) => {
53
- return (_jsxs(Pressable, { "aria-checked": value, style: styles.labelled, onPress: () => onValueChange(value === true ? false : true), disabled: disabled, children: [_jsx(LakeCheckbox, { value: value, color: color, disabled: disabled, isError: isError }), _jsx(Space, { width: 8 }), _jsx(LakeText, { color: colors.gray[900], userSelect: "none", children: label })] }));
53
+ return (_jsxs(Pressable, { role: "checkbox", "aria-checked": value, style: styles.labelled, onPress: () => onValueChange(value === true ? false : true), disabled: disabled, children: [_jsx(LakeCheckbox, { value: value, color: color, disabled: disabled, isError: isError }), _jsx(Space, { width: 8 }), _jsx(LakeText, { color: colors.gray[900], userSelect: "none", children: label })] }));
54
54
  };
@@ -82,5 +82,5 @@ export const Switch = memo(forwardRef(({ value, disabled = false, onValueChange
82
82
  useNativeDriver: false,
83
83
  }).start();
84
84
  }, [animation, animatedValue]);
85
- return (_jsx(Pressable, { ref: ref, role: "switch", disabled: disabled, onPress: () => onValueChange?.(!value), children: ({ hovered }) => (_jsxs(_Fragment, { children: [_jsx(View, { style: [styles.shadow, hovered && styles.opaque] }), _jsx(View, { style: [styles.base, value && styles.active, disabled && styles.disabled], children: _jsx(View, { ref: buttonRef, style: styles.button, children: _jsx(Icon, { color: colors.positive[400], name: "checkmark-filled", size: 10, style: [styles.icon, value && styles.opaque] }) }) })] })) }));
85
+ return (_jsx(Pressable, { ref: ref, role: "switch", "aria-checked": value, disabled: disabled, onPress: () => onValueChange?.(!value), children: ({ hovered }) => (_jsxs(_Fragment, { children: [_jsx(View, { style: [styles.shadow, hovered && styles.opaque] }), _jsx(View, { style: [styles.base, value && styles.active, disabled && styles.disabled], children: _jsx(View, { ref: buttonRef, style: styles.button, children: _jsx(Icon, { color: colors.positive[400], name: "checkmark-filled", size: 10, style: [styles.icon, value && styles.opaque] }) }) })] })) }));
86
86
  }));
@@ -1,18 +1,15 @@
1
1
  import { IconName } from "./Icon";
2
2
  import { SpacingValue } from "./Space";
3
3
  export declare const tabsViewHeight: number;
4
- type Tab = {
5
- label: string;
4
+ type Tab = ({
5
+ id: string;
6
+ } | {
6
7
  url: string;
7
- icon?: IconName;
8
- withSeparator?: boolean;
8
+ }) & {
9
9
  count?: number;
10
- } | {
11
- label: string;
12
10
  icon?: IconName;
11
+ label: string;
13
12
  withSeparator?: boolean;
14
- count?: number;
15
- id: string;
16
13
  };
17
14
  type Props = {
18
15
  activeTabId?: string;
@@ -125,8 +125,7 @@ const TabViewLink = forwardRef(({ children, style, tab, onChange, activeTabId, o
125
125
  return match(tab)
126
126
  .with({ url: P.string }, ({ url }) => (_jsx(Link, { ref: ref, to: url, style: style, onFocus: onFocus, onBlur: onBlur, onPress: onPress, children: children })))
127
127
  .with({ id: P.string }, ({ id }) => {
128
- const tabId = getTabId(tab);
129
- const isActive = tabId === activeTabId;
128
+ const isActive = id === activeTabId;
130
129
  return (_jsx(PressableText, { ref: ref, style: state => style({ ...state, active: isActive }), onPress: () => {
131
130
  onChange?.(id);
132
131
  onPress?.();
@@ -265,7 +264,7 @@ const DropdownItems = forwardRef(({ tabs, otherLabel, currentUrl, activeTabId, o
265
264
  onHoverEnd,
266
265
  });
267
266
  const mergedRef = useMergeRefs(containerRef, ref);
268
- const activeTab = tabs.find(tab => isTabActive({ activeTabId, currentLocationURL: currentUrl, tab }));
267
+ const activeTab = useMemo(() => tabs.find(tab => isTabActive({ activeTabId, currentLocationURL: currentUrl, tab })), [activeTabId, currentUrl, tabs]);
269
268
  return (_jsxs(View, { style: styles.dropdownHandleContainer, ref: mergedRef, children: [_jsxs(PressableText, { ref: handleRef, role: "button", "aria-expanded": shouldOpen, "aria-haspopup": "true", onFocus: onHandleFocus, onBlur: onAnyBlur, onPress: onPress, style: ({ hovered }) => [
270
269
  styles.link,
271
270
  isNotNullish(activeTab) ? styles.activeLink : hovered ? styles.hoveredLink : null,