@swan-io/lake 11.3.1 → 11.3.2
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/Breadcrumbs.js +3 -1
- package/src/components/Cells.js +0 -3
- package/src/components/FlatList.js +3 -1
- package/src/components/FocusTrap.js +3 -1
- package/src/components/LakeButton.js +1 -1
- package/src/components/LakeCheckbox.js +2 -1
- package/src/components/LakeSelect.js +3 -1
- package/src/components/LakeStepper.js +3 -6
- package/src/components/LakeTooltip.js +1 -1
- package/src/components/MultiSelect.js +1 -0
- package/src/components/Popover.js +2 -2
- package/src/components/Pressable.js +3 -1
- package/src/components/RightPanel.js +1 -1
- package/src/components/SectionList.js +3 -1
- package/src/components/TabView.js +2 -0
- package/src/components/TimePicker.js +2 -2
- package/src/components/Toggle.js +5 -0
- package/src/components/VirtualizedList.js +1 -0
- package/src/components/WithPartnerAccentColor.js +12 -12
- package/src/hooks/useUpdateEffect.js +3 -1
- package/src/utils/array.js +1 -2
- package/src/utils/base64.js +1 -1
- package/src/utils/rifm.js +3 -3
- package/src/utils/svg.js +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swan-io/lake",
|
|
3
|
-
"version": "11.3.
|
|
3
|
+
"version": "11.3.2",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20.9.0",
|
|
6
6
|
"pnpm": "^9.13.0"
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@react-three/drei": "^9.
|
|
30
|
-
"@react-three/fiber": "^8.17.
|
|
29
|
+
"@react-three/drei": "^9.121.2",
|
|
30
|
+
"@react-three/fiber": "^8.17.12",
|
|
31
31
|
"@swan-io/boxed": "^3.2.0",
|
|
32
32
|
"@swan-io/chicane": "^2.1.0",
|
|
33
33
|
"@swan-io/use-form": "^3.1.0",
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"rifm": "^0.12.1",
|
|
41
41
|
"three": "^0.172.0",
|
|
42
42
|
"ts-dedent": "^2.2.0",
|
|
43
|
-
"ts-pattern": "^5.6.
|
|
44
|
-
"uuid": "^11.0.
|
|
43
|
+
"ts-pattern": "^5.6.1",
|
|
44
|
+
"uuid": "^11.0.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/react": "^18.3.12",
|
|
48
48
|
"@types/react-dom": "^18.3.1",
|
|
49
49
|
"@types/react-native": "^0.72.8",
|
|
50
50
|
"@types/three": "^0.172.0",
|
|
51
|
-
"jsdom": "^
|
|
52
|
-
"type-fest": "^4.
|
|
51
|
+
"jsdom": "^26.0.0",
|
|
52
|
+
"type-fest": "^4.32.0"
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -48,7 +48,7 @@ const styles = StyleSheet.create({
|
|
|
48
48
|
},
|
|
49
49
|
horizontalLinkTextHovered: {
|
|
50
50
|
color: colors.gray[900],
|
|
51
|
-
boxShadow:
|
|
51
|
+
boxShadow: "0 1px currentColor",
|
|
52
52
|
},
|
|
53
53
|
activeHorizontalLinkText: {
|
|
54
54
|
color: colors.gray[800],
|
|
@@ -127,6 +127,8 @@ export const BreadcrumbsRoot = ({ rootLevelCrumbs = emptyCrumbArray, children })
|
|
|
127
127
|
setRootCrumbs(rootLevelCrumbs.map(crumb => ({ id: uuid(), crumb, isRootCrumb: true })));
|
|
128
128
|
}, [rootLevelCrumbs]);
|
|
129
129
|
const orderedCrumbs = useMemo(() => [...crumbs].sort((a, b) => { var _a, _b; return (((_a = b.index) !== null && _a !== void 0 ? _a : -1) > ((_b = a.index) !== null && _b !== void 0 ? _b : -1) ? -1 : 1); }), [crumbs]);
|
|
130
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(setCrumbs):
|
|
131
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(currentIndexRef):
|
|
130
132
|
const value = useMemo(() => [rootCrumbs, orderedCrumbs, setCrumbs, currentIndexRef], [rootCrumbs, orderedCrumbs, setCrumbs, currentIndexRef]);
|
|
131
133
|
return _jsx(BreadcrumbsContext.Provider, { value: value, children: children });
|
|
132
134
|
};
|
package/src/components/Cells.js
CHANGED
|
@@ -13,7 +13,6 @@ import { LakeText } from "./LakeText";
|
|
|
13
13
|
import { LakeTooltip } from "./LakeTooltip";
|
|
14
14
|
import { Pressable } from "./Pressable";
|
|
15
15
|
import { Space } from "./Space";
|
|
16
|
-
/* eslint-disable react-native/no-unused-styles */
|
|
17
16
|
const directionStyles = StyleSheet.create({
|
|
18
17
|
column: { flexDirection: "column" },
|
|
19
18
|
row: { flexDirection: "row" },
|
|
@@ -28,7 +27,6 @@ const justifyContentStyles = StyleSheet.create({
|
|
|
28
27
|
center: { justifyContent: "center" },
|
|
29
28
|
right: { justifyContent: "flex-end" },
|
|
30
29
|
});
|
|
31
|
-
/* eslint-enable react-native/no-unused-styles */
|
|
32
30
|
const fadeOnLeftMask = `linear-gradient(to right, ${invariantColors.transparent}, ${invariantColors.black} ${spacings[8]})`;
|
|
33
31
|
const fadeOnRightMask = `linear-gradient(to left, ${invariantColors.transparent}, ${invariantColors.black} ${spacings[8]})`;
|
|
34
32
|
const styles = StyleSheet.create({
|
|
@@ -73,7 +71,6 @@ const styles = StyleSheet.create({
|
|
|
73
71
|
headerUnderlineActive: {
|
|
74
72
|
backgroundColor: colors.current[500],
|
|
75
73
|
},
|
|
76
|
-
// eslint-disable-next-line react-native/no-color-literals
|
|
77
74
|
buttonUnderline: {
|
|
78
75
|
position: "absolute",
|
|
79
76
|
bottom: 0,
|
|
@@ -15,6 +15,8 @@ const FlatListWithRef = ({ ItemSeparatorComponent, ListEmptyComponent, ListFoote
|
|
|
15
15
|
const scrollTrackerStyle = horizontal
|
|
16
16
|
? { top: 0, width: onEndReachedThresholdPx }
|
|
17
17
|
: { left: 0, height: onEndReachedThresholdPx };
|
|
18
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(onEndReached):
|
|
19
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(data.length):
|
|
18
20
|
useEffect(() => {
|
|
19
21
|
const element = scrollTrackerRef.current;
|
|
20
22
|
if (element != null) {
|
|
@@ -31,7 +33,7 @@ const FlatListWithRef = ({ ItemSeparatorComponent, ListEmptyComponent, ListFoote
|
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
// re-create an observer only on list length change
|
|
34
|
-
}, [data.length]);
|
|
36
|
+
}, [data.length]);
|
|
35
37
|
return (_jsxs(ScrollView, { contentContainerStyle: contentContainerStyle, horizontal: horizontal, onKeyDown: onKeyDown, onScroll: onScroll, ref: forwardedRef, role: role, scrollEventThrottle: scrollEventThrottle, showsScrollIndicators: showsScrollIndicators, style: style, children: [ListHeaderComponent, data.length <= 0
|
|
36
38
|
? ListEmptyComponent
|
|
37
39
|
: data.map((item, index) => (_jsxs(Fragment, { children: [index !== 0 && ItemSeparatorComponent, renderItem({ item, index })] }, keyExtractor(item, index)))), ListFooterComponent, _jsx(View, { role: "none", ref: scrollTrackerRef, style: [styles.scrollTracker, scrollTrackerStyle] })] }));
|
|
@@ -13,7 +13,9 @@ export const FocusTrap = forwardRef(({ children, focusLock, onClickOutside, onEs
|
|
|
13
13
|
const previouslyFocusedRef = useRef(null);
|
|
14
14
|
const hasFocusedOutside = useRef(false);
|
|
15
15
|
useImperativeHandle(ref, () => ({
|
|
16
|
-
setInitiallyFocusedElement: element =>
|
|
16
|
+
setInitiallyFocusedElement: element => {
|
|
17
|
+
previouslyFocusedRef.current = element;
|
|
18
|
+
},
|
|
17
19
|
}));
|
|
18
20
|
const [initialEscapeListenerCount] = useState(escapeListenerCount);
|
|
19
21
|
useEffect(() => {
|
|
@@ -207,7 +207,7 @@ export const LakeButton = memo(forwardRef(({ ariaControls, ariaExpanded, ariaLab
|
|
|
207
207
|
: invariantColors.transparent,
|
|
208
208
|
}))
|
|
209
209
|
.exhaustive(),
|
|
210
|
-
typeof style
|
|
210
|
+
typeof style === "function" ? style({ hovered, pressed, focused }) : style,
|
|
211
211
|
], children: ({ pressed, hovered }) => {
|
|
212
212
|
const textColor = isPrimary
|
|
213
213
|
? colors[color].contrast
|
|
@@ -39,6 +39,7 @@ const styles = StyleSheet.create({
|
|
|
39
39
|
export const LakeCheckbox = ({ value, color = "current", disabled = false, isError = false, }) => {
|
|
40
40
|
const isFirstRender = useRef(true);
|
|
41
41
|
const [shouldAnimate, setShouldAnimate] = useState(false);
|
|
42
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(value):
|
|
42
43
|
useEffect(() => {
|
|
43
44
|
if (!isFirstRender.current) {
|
|
44
45
|
setShouldAnimate(true);
|
|
@@ -56,5 +57,5 @@ export const LakeCheckbox = ({ value, color = "current", disabled = false, isErr
|
|
|
56
57
|
], 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 }] }))] }));
|
|
57
58
|
};
|
|
58
59
|
export const LakeLabelledCheckbox = ({ value, color, label, onValueChange, disabled = false, isError = false, }) => {
|
|
59
|
-
return (_jsxs(Pressable, { role: "checkbox", "aria-checked": value, style: styles.labelled, onPress: () => onValueChange(value
|
|
60
|
+
return (_jsxs(Pressable, { role: "checkbox", "aria-checked": value, style: styles.labelled, onPress: () => onValueChange(value !== 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 }), isError ? (_jsxs(_Fragment, { children: [_jsx(Space, { width: 8 }), _jsx(View, { style: styles.errorPill })] })) : null] }));
|
|
60
61
|
};
|
|
@@ -189,7 +189,9 @@ const LakeSelectWithRef = ({ title, items, valueStyle, size, color = "current",
|
|
|
189
189
|
}, keyExtractor: (_, index) => `select-item-${index}`, renderItem: ({ item, index }) => {
|
|
190
190
|
const isSelected = value === item.value;
|
|
191
191
|
const disablement = disabledItems.find(({ value }) => value === item.value);
|
|
192
|
-
return (_jsx(LakeTooltip, { placement: "right", content: disablement === null || disablement === void 0 ? void 0 : disablement.message, disabled: isNullishOrEmpty(disablement === null || disablement === void 0 ? void 0 : disablement.message), children: _jsxs(Pressable, { ref: element =>
|
|
192
|
+
return (_jsx(LakeTooltip, { placement: "right", content: disablement === null || disablement === void 0 ? void 0 : disablement.message, disabled: isNullishOrEmpty(disablement === null || disablement === void 0 ? void 0 : disablement.message), children: _jsxs(Pressable, { ref: element => {
|
|
193
|
+
listItemRefs.current[index] = element;
|
|
194
|
+
}, onKeyDown: onKeyDown, disabled: isNotNullish(disablement), style: ({ hovered, focused }) => [
|
|
193
195
|
styles.item,
|
|
194
196
|
(hovered || isSelected) && styles.itemHighlighted,
|
|
195
197
|
focused && styles.itemFocused,
|
|
@@ -66,12 +66,10 @@ const StepLink = ({ to, disabled, style, children }) => {
|
|
|
66
66
|
return disabled ? (_jsx("span", { style: style, children: children })) : (_jsx(Link, { to: to, style: style, children: children }));
|
|
67
67
|
};
|
|
68
68
|
export const LakeStepper = ({ steps, activeStepId, style }) => {
|
|
69
|
-
const stepIds = steps
|
|
70
|
-
.map(step => match(step)
|
|
69
|
+
const stepIds = steps.flatMap(step => match(step)
|
|
71
70
|
.with({ id: P.string }, ({ id }) => [id])
|
|
72
71
|
.with({ children: P.array(P.any) }, ({ children }) => children.map(({ id }) => id))
|
|
73
|
-
.exhaustive())
|
|
74
|
-
.flat();
|
|
72
|
+
.exhaustive());
|
|
75
73
|
const activeStepIndex = stepIds.indexOf(activeStepId);
|
|
76
74
|
return (_jsx(Grid, { numColumns: steps.length, horizontalSpace: 12, style: [styles.container, style], children: steps.map((step, index) => {
|
|
77
75
|
const stepNumber = index + 1;
|
|
@@ -117,14 +115,13 @@ export const LakeStepper = ({ steps, activeStepId, style }) => {
|
|
|
117
115
|
};
|
|
118
116
|
export const MobileStepTitle = ({ steps, activeStepId }) => {
|
|
119
117
|
const currentStep = Option.fromNullable(steps
|
|
120
|
-
.
|
|
118
|
+
.flatMap((step, index) => match(step)
|
|
121
119
|
.with({ id: P.string }, step => ({ ...step, number: `${index + 1}` }))
|
|
122
120
|
.with({ children: P.array(P.any) }, ({ children }) => children.map((child, subIndex) => ({
|
|
123
121
|
...child,
|
|
124
122
|
number: `${index + 1}.${subIndex + 1}`,
|
|
125
123
|
})))
|
|
126
124
|
.exhaustive())
|
|
127
|
-
.flat()
|
|
128
125
|
.find(({ id }) => id === activeStepId)).map(({ label, hasErrors, number }) => ({
|
|
129
126
|
number,
|
|
130
127
|
label,
|
|
@@ -109,7 +109,7 @@ const Tooltip = memo(forwardRef(({ children, content, describedBy, matchReferenc
|
|
|
109
109
|
}
|
|
110
110
|
node.removeEventListener("mousedown", onPress);
|
|
111
111
|
};
|
|
112
|
-
}, [referenceRef, togglableOnFocus,
|
|
112
|
+
}, [referenceRef, togglableOnFocus, onHide]);
|
|
113
113
|
useEffect(() => {
|
|
114
114
|
return () => clearTimeout(timeoutRef.current);
|
|
115
115
|
}, []);
|
|
@@ -151,6 +151,7 @@ export const MultiSelect = ({ color = "gray", disabled = false, emptyResultText,
|
|
|
151
151
|
setFilter("");
|
|
152
152
|
}
|
|
153
153
|
}, [visible]);
|
|
154
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(values):
|
|
154
155
|
useEffect(() => {
|
|
155
156
|
var _a, _b;
|
|
156
157
|
if (shouldScrollToBottomRef.current) {
|
|
@@ -105,7 +105,7 @@ export const Popover = memo(({ children, id, label, role = "dialog", describedBy
|
|
|
105
105
|
.with("Dropdown", () => "Dropdown")
|
|
106
106
|
.exhaustive();
|
|
107
107
|
if (mode === "BottomPanel") {
|
|
108
|
-
return (_jsx(BottomPanel, { visible: visible, onPressClose: onDismiss, returnFocus: false, children: typeof children
|
|
108
|
+
return (_jsx(BottomPanel, { visible: visible, onPressClose: onDismiss, returnFocus: false, children: typeof children === "function" ? children({ mode: "panel" }) : children }));
|
|
109
109
|
}
|
|
110
110
|
return (_jsxs(Portal, { container: rootElement, children: [visible && underlay ? (_jsx(Pressable, { ref: underlayRef, style: styles.underlay, onPress: onPressUnderlay, "aria-label": "Close" })) : null, _jsx(TransitionView, { style: styles.container, ...animation, children: position.isSome() ? (_jsx(View, { style: position.get().rootStyle, children: _jsx(View, { style: [
|
|
111
111
|
styles.popoverContainer,
|
|
@@ -117,5 +117,5 @@ export const Popover = memo(({ children, id, label, role = "dialog", describedBy
|
|
|
117
117
|
.with("right", () => "flex-end")
|
|
118
118
|
.exhaustive(),
|
|
119
119
|
},
|
|
120
|
-
], children: _jsx(ScrollView, { style: styles.popover, contentContainerStyle: styles.popoverContents, id: id, role: role, "aria-describedby": describedBy, "aria-label": label, children: _jsx(FocusTrap, { focusLock: true, returnFocus: returnFocus, autoFocus: autoFocus, onEscapeKey: onEscapeKey, onClickOutside: underlay ? undefined : onClickOutside, children: _jsx(Pressable, { tabIndex: -1, onPress: onPress, style: styles.defaultCursor, children: typeof children
|
|
120
|
+
], children: _jsx(ScrollView, { style: styles.popover, contentContainerStyle: styles.popoverContents, id: id, role: role, "aria-describedby": describedBy, "aria-label": label, children: _jsx(FocusTrap, { focusLock: true, returnFocus: returnFocus, autoFocus: autoFocus, onEscapeKey: onEscapeKey, onClickOutside: underlay ? undefined : onClickOutside, children: _jsx(Pressable, { tabIndex: -1, onPress: onPress, style: styles.defaultCursor, children: typeof children === "function" ? children({ mode: "dropdown" }) : children }) }) }) }) })) : null })] }));
|
|
121
121
|
});
|
|
@@ -17,7 +17,7 @@ const styles = StyleSheet.create({
|
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
19
|
const getPressable = (
|
|
20
|
-
//
|
|
20
|
+
// biome-ignore lint/suspicious/noExplicitAny:
|
|
21
21
|
Component, config = {}) => {
|
|
22
22
|
const { applyPressStyle = true } = config;
|
|
23
23
|
return forwardRef((props, forwardedRef) => {
|
|
@@ -62,12 +62,14 @@ Component, config = {}) => {
|
|
|
62
62
|
onHoverEnd: onHoverOut,
|
|
63
63
|
});
|
|
64
64
|
const interactionState = { hovered, focused, pressed };
|
|
65
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(hostRef):
|
|
65
66
|
const blurHandler = useCallback((e) => {
|
|
66
67
|
if (e.nativeEvent.target === hostRef.current) {
|
|
67
68
|
setFocused(false);
|
|
68
69
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
69
70
|
}
|
|
70
71
|
}, [hostRef, setFocused, onBlur]);
|
|
72
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(hostRef):
|
|
71
73
|
const focusHandler = useCallback((e) => {
|
|
72
74
|
if (e.nativeEvent.target === hostRef.current) {
|
|
73
75
|
setFocused(true);
|
|
@@ -103,5 +103,5 @@ export const RightPanel = forwardRef(({ visible, children, onPressClose }, ref)
|
|
|
103
103
|
setDelayedVisible(visible);
|
|
104
104
|
}, [visible]);
|
|
105
105
|
useBodyClassName("RightPanelOpen", { enabled: visible });
|
|
106
|
-
return (_jsx(Portal, { container: rootNode, children: _jsx(View, { style: [styles.root, !visible && styles.inert], children: _jsx(ResponsiveContainer, { style: styles.root, breakpoint: breakpoints.small, children: ({ large }) => (_jsxs(_Fragment, { children: [_jsx(TransitionView, { style: styles.fill, enter: styles.overlayEnter, leave: styles.overlayLeave, children: visible ? (onPressClose != null ? (_jsx(Pressable, { style: styles.overlay, onPress: onPressClose })) : (_jsx(View, { style: styles.overlay }))) : null }), _jsx(Suspendable, { fallback: _jsx(LoadingView, { color: backgroundColor.accented, delay: 0 }), children: _jsx(TransitionView, { style: [styles.fillMax, large && styles.fillMaxLarge], enter: styles.containerEnter, leave: styles.containerLeave, children: delayedVisible ? (_jsx(FocusTrap, { onEscapeKey: onPressClose, focusLock: true, autoFocus: true, returnFocus: true, ref: ref, style: styles.container, children: _jsx(TransitionView, { style: styles.contentsContainer, enter: styles.contentsEnter, leave: styles.contentsLeave, children: _jsx(View, { style: styles.contents, children: _jsx(View, { style: styles.contentsContainer, children: typeof children
|
|
106
|
+
return (_jsx(Portal, { container: rootNode, children: _jsx(View, { style: [styles.root, !visible && styles.inert], children: _jsx(ResponsiveContainer, { style: styles.root, breakpoint: breakpoints.small, children: ({ large }) => (_jsxs(_Fragment, { children: [_jsx(TransitionView, { style: styles.fill, enter: styles.overlayEnter, leave: styles.overlayLeave, children: visible ? (onPressClose != null ? (_jsx(Pressable, { style: styles.overlay, onPress: onPressClose })) : (_jsx(View, { style: styles.overlay }))) : null }), _jsx(Suspendable, { fallback: _jsx(LoadingView, { color: backgroundColor.accented, delay: 0 }), children: _jsx(TransitionView, { style: [styles.fillMax, large && styles.fillMaxLarge], enter: styles.containerEnter, leave: styles.containerLeave, children: delayedVisible ? (_jsx(FocusTrap, { onEscapeKey: onPressClose, focusLock: true, autoFocus: true, returnFocus: true, ref: ref, style: styles.container, children: _jsx(TransitionView, { style: styles.contentsContainer, enter: styles.contentsEnter, leave: styles.contentsLeave, children: _jsx(View, { style: styles.contents, children: _jsx(View, { style: styles.contentsContainer, children: typeof children === "function" ? (_jsx(ResponsiveContainer, { style: styles.root, breakpoint: breakpoints.small, children: children })) : (children) }) }) }) })) : null }) })] })) }) }) }));
|
|
107
107
|
});
|
|
@@ -16,6 +16,8 @@ const SectionListWithRef = ({ ItemSeparatorComponent, ListEmptyComponent, ListFo
|
|
|
16
16
|
const scrollTrackerStyle = horizontal
|
|
17
17
|
? { top: 0, width: onEndReachedThresholdPx }
|
|
18
18
|
: { left: 0, height: onEndReachedThresholdPx };
|
|
19
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(onEndReached):
|
|
20
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(sections.length):
|
|
19
21
|
useEffect(() => {
|
|
20
22
|
const element = scrollTrackerRef.current;
|
|
21
23
|
if (element != null) {
|
|
@@ -32,7 +34,7 @@ const SectionListWithRef = ({ ItemSeparatorComponent, ListEmptyComponent, ListFo
|
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
36
|
// re-create an observer only on list length change
|
|
35
|
-
}, [sections.length]);
|
|
37
|
+
}, [sections.length]);
|
|
36
38
|
return (_jsxs(ScrollView, { contentContainerStyle: contentContainerStyle, horizontal: horizontal, onKeyDown: onKeyDown, onScroll: onScroll, ref: forwardedRef, role: role, scrollEventThrottle: scrollEventThrottle, showsScrollIndicators: showsScrollIndicators, style: style, children: [ListHeaderComponent, sections.length <= 0
|
|
37
39
|
? ListEmptyComponent
|
|
38
40
|
: sections.map(section => (_jsxs(Fragment, { children: [renderSectionHeader === null || renderSectionHeader === void 0 ? void 0 : renderSectionHeader(section), section.data.map((item, index) => (_jsxs(Fragment, { children: [index !== 0 && ItemSeparatorComponent, renderItem({ item, index })] }, keyExtractor(item, index))))] }, `group-${groupId}-${section.title}`))), ListFooterComponent, _jsx(View, { role: "none", ref: scrollTrackerRef, style: [styles.scrollTracker, scrollTrackerStyle] })] }));
|
|
@@ -290,6 +290,8 @@ export const TabView = ({ tabs, otherLabel, hideIfSingleItem = true, sticky = fa
|
|
|
290
290
|
const location = useLocation();
|
|
291
291
|
const { path } = location;
|
|
292
292
|
const currentLocationURL = location.toString();
|
|
293
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(kept):
|
|
294
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(collapsed):
|
|
293
295
|
useEffect(() => {
|
|
294
296
|
if (isNotNullish(linksRefs.current)) {
|
|
295
297
|
const values = Object.entries(linksRefs.current);
|
|
@@ -32,7 +32,7 @@ const rifmTimeProps = getRifmProps({
|
|
|
32
32
|
});
|
|
33
33
|
export const parseTime = (time) => {
|
|
34
34
|
const [hours, minutes] = time.split(":").map(Number);
|
|
35
|
-
if (isNullish(hours) || isNaN(hours) || isNullish(minutes) || isNaN(minutes)) {
|
|
35
|
+
if (isNullish(hours) || Number.isNaN(hours) || isNullish(minutes) || Number.isNaN(minutes)) {
|
|
36
36
|
return Option.None();
|
|
37
37
|
}
|
|
38
38
|
return Option.Some({ hour: hours, minute: minutes });
|
|
@@ -51,7 +51,7 @@ const parseTypingHours = (time) => {
|
|
|
51
51
|
if (parsedHours < 0 || parsedHours > 23) {
|
|
52
52
|
return Option.None();
|
|
53
53
|
}
|
|
54
|
-
if (isNaN(parsedHours)) {
|
|
54
|
+
if (Number.isNaN(parsedHours)) {
|
|
55
55
|
return Option.None();
|
|
56
56
|
}
|
|
57
57
|
return Option.Some(parsedHours);
|
package/src/components/Toggle.js
CHANGED
|
@@ -55,6 +55,11 @@ export const Toggle = ({ onToggle, value, disabled = false, mode = "desktop", on
|
|
|
55
55
|
}));
|
|
56
56
|
}, () => { });
|
|
57
57
|
}, [value]);
|
|
58
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(reajustLayout):
|
|
59
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(value):
|
|
60
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(isMobileMode):
|
|
61
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(onLabel):
|
|
62
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(offLabel):
|
|
58
63
|
useEffect(reajustLayout, [reajustLayout, value, isMobileMode, onLabel, offLabel]);
|
|
59
64
|
return (_jsxs(Pressable, { style: [styles.switch, disabled && commonStyles.disabled], onPress: () => onToggle(!value), "aria-disabled": disabled, "aria-checked": value, disabled: disabled, ref: containerRef, role: "switch", onLayout: reajustLayout, children: [_jsx(View, { style: [
|
|
60
65
|
styles.handle,
|
|
@@ -273,6 +273,7 @@ export const VirtualizedList = ({ variant, data, stickedToStartColumns, columns,
|
|
|
273
273
|
.toUndefined();
|
|
274
274
|
}, [onLayoutUpdate]);
|
|
275
275
|
// tracks if the threshold to initiate the next data load is reached
|
|
276
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(data.length):
|
|
276
277
|
useEffect(() => {
|
|
277
278
|
const scrollTracker = scrollTrackerRef.current;
|
|
278
279
|
if (scrollTracker != null) {
|
|
@@ -26,21 +26,21 @@ export const WithPartnerAccentColor = ({ color, scoped = false, children }) => {
|
|
|
26
26
|
if (isNotNullish(containerRef.current)) {
|
|
27
27
|
const element = containerRef.current;
|
|
28
28
|
let scalePower = 1;
|
|
29
|
-
while (!meetsContrastGuidelines(setLightness(
|
|
29
|
+
while (!meetsContrastGuidelines(setLightness(0.5 ** scalePower, color), "#fff").AALarge) {
|
|
30
30
|
scalePower += 0.1;
|
|
31
31
|
}
|
|
32
32
|
const colorScale = {
|
|
33
|
-
0: setLightness(
|
|
34
|
-
50: setLightness(
|
|
35
|
-
100: setLightness(
|
|
36
|
-
200: setLightness(
|
|
37
|
-
300: setLightness(
|
|
38
|
-
400: setLightness(
|
|
39
|
-
500: setLightness(
|
|
40
|
-
600: setLightness(
|
|
41
|
-
700: setLightness(
|
|
42
|
-
800: setLightness(
|
|
43
|
-
900: setLightness(
|
|
33
|
+
0: setLightness(1.0 ** scalePower, color),
|
|
34
|
+
50: setLightness(0.97 ** scalePower, color),
|
|
35
|
+
100: setLightness(0.9 ** scalePower, color),
|
|
36
|
+
200: setLightness(0.8 ** scalePower, color),
|
|
37
|
+
300: setLightness(0.7 ** scalePower, color),
|
|
38
|
+
400: setLightness(0.6 ** scalePower, color),
|
|
39
|
+
500: setLightness(0.5 ** scalePower, color),
|
|
40
|
+
600: setLightness(0.4 ** scalePower, color),
|
|
41
|
+
700: setLightness(0.3 ** scalePower, color),
|
|
42
|
+
800: setLightness(0.2 ** scalePower, color),
|
|
43
|
+
900: setLightness(0.1 ** scalePower, color),
|
|
44
44
|
primary: color,
|
|
45
45
|
contrast: getContrastColor(color),
|
|
46
46
|
secondary: shade(0.2, color),
|
|
@@ -2,9 +2,11 @@ import { useEffect } from "react";
|
|
|
2
2
|
import { useFirstMountState } from "./useFirstMountState";
|
|
3
3
|
export const useUpdateEffect = (effect, deps) => {
|
|
4
4
|
const isFirstMount = useFirstMountState();
|
|
5
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(effect):
|
|
6
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(isFirstMount):
|
|
5
7
|
useEffect(() => {
|
|
6
8
|
if (!isFirstMount) {
|
|
7
9
|
return effect();
|
|
8
10
|
}
|
|
9
|
-
}, deps);
|
|
11
|
+
}, deps);
|
|
10
12
|
};
|
package/src/utils/array.js
CHANGED
|
@@ -3,7 +3,7 @@ export const sortBy = (array, keys) => {
|
|
|
3
3
|
let index = -1;
|
|
4
4
|
while (++index < keys.length) {
|
|
5
5
|
const key = keys[index];
|
|
6
|
-
if (key ==
|
|
6
|
+
if (key == null) {
|
|
7
7
|
return 0;
|
|
8
8
|
}
|
|
9
9
|
if (b[key] === a[key]) {
|
|
@@ -55,7 +55,6 @@ export const sortedIndexOf = (array, value) => {
|
|
|
55
55
|
}
|
|
56
56
|
if (item < value) {
|
|
57
57
|
startIndex = searchIndex;
|
|
58
|
-
continue;
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
60
|
}
|
package/src/utils/base64.js
CHANGED
|
@@ -15,6 +15,6 @@ export const encodeBase64 = (value) => {
|
|
|
15
15
|
return btoa(data.join(""));
|
|
16
16
|
};
|
|
17
17
|
const unURI = (base64) => base64
|
|
18
|
-
.replace(/[-_]/g, substring => (substring
|
|
18
|
+
.replace(/[-_]/g, substring => (substring === "-" ? "+" : "/"))
|
|
19
19
|
.replace(/[^A-Za-z0-9+/]/g, "");
|
|
20
20
|
export const decodeBase64 = (base64) => decodeUTF8(u8From(atob(unURI(base64)), value => value.charCodeAt(0)));
|
package/src/utils/rifm.js
CHANGED
|
@@ -11,7 +11,7 @@ export const getRifmProps = ({ accept, charMap, maxLength, }) => {
|
|
|
11
11
|
charIndexes.forEach(charMapIndex => {
|
|
12
12
|
const char = charMap[charMapIndex];
|
|
13
13
|
if (isNullish(char)) {
|
|
14
|
-
throw new Error(
|
|
14
|
+
throw new Error("Invalid mask character value");
|
|
15
15
|
}
|
|
16
16
|
if (char.length !== 1) {
|
|
17
17
|
throw new Error(`Invalid mask character value: "${char}"`);
|
|
@@ -25,8 +25,8 @@ export const getRifmProps = ({ accept, charMap, maxLength, }) => {
|
|
|
25
25
|
const regExp = accepted[accept];
|
|
26
26
|
const shiftedCharMap = charIndexes.reduce((acc, charIndex, index) => {
|
|
27
27
|
var _a;
|
|
28
|
-
|
|
29
|
-
return
|
|
28
|
+
acc[charIndex + index] = (_a = charMap[charIndex]) !== null && _a !== void 0 ? _a : "";
|
|
29
|
+
return acc;
|
|
30
30
|
}, {});
|
|
31
31
|
const shiftedCharIndexes = Object.keys(shiftedCharMap).map(Number);
|
|
32
32
|
return {
|
package/src/utils/svg.js
CHANGED
|
@@ -11,17 +11,17 @@ export const getSvgSize = (svg) => {
|
|
|
11
11
|
// first we try to get width and height from "width" and "height" attributes
|
|
12
12
|
const widthAttr = svg.getAttribute("width");
|
|
13
13
|
const heightAttr = svg.getAttribute("height");
|
|
14
|
-
const width = isNotNullish(widthAttr) ? parseInt(widthAttr) : NaN;
|
|
15
|
-
const height = isNotNullish(heightAttr) ? parseInt(heightAttr) : NaN;
|
|
16
|
-
if (!isNaN(width) || !isNaN(height)) {
|
|
14
|
+
const width = isNotNullish(widthAttr) ? Number.parseInt(widthAttr) : Number.NaN;
|
|
15
|
+
const height = isNotNullish(heightAttr) ? Number.parseInt(heightAttr) : Number.NaN;
|
|
16
|
+
if (!Number.isNaN(width) || !Number.isNaN(height)) {
|
|
17
17
|
return Result.Ok({ width, height });
|
|
18
18
|
}
|
|
19
19
|
// if height and width aren't provided, we get values from viewBox attribute
|
|
20
20
|
const viewBox = svg.getAttribute("viewBox");
|
|
21
21
|
const [, , boxWidthAttr, boxHeightAttr] = (_a = viewBox === null || viewBox === void 0 ? void 0 : viewBox.split(" ")) !== null && _a !== void 0 ? _a : [];
|
|
22
|
-
const boxWidth = isNotNullish(boxWidthAttr) ? parseInt(boxWidthAttr) : NaN;
|
|
23
|
-
const boxHeight = isNotNullish(boxHeightAttr) ? parseInt(boxHeightAttr) : NaN;
|
|
24
|
-
if (isNaN(boxWidth) || isNaN(boxHeight)) {
|
|
22
|
+
const boxWidth = isNotNullish(boxWidthAttr) ? Number.parseInt(boxWidthAttr) : Number.NaN;
|
|
23
|
+
const boxHeight = isNotNullish(boxHeightAttr) ? Number.parseInt(boxHeightAttr) : Number.NaN;
|
|
24
|
+
if (Number.isNaN(boxWidth) || Number.isNaN(boxHeight)) {
|
|
25
25
|
return Result.Error("VIEWBOX_MISSING");
|
|
26
26
|
}
|
|
27
27
|
return Result.Ok({
|