@swan-io/lake 15.1.2 → 15.3.0
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 +3 -3
- package/src/components/Accordion.js +1 -1
- package/src/components/Cells.js +1 -1
- package/src/components/LakeSlider.d.ts +2 -1
- package/src/components/LakeSlider.js +1 -1
- package/src/components/MultiSelect.js +1 -1
- package/src/components/PlainListView.js +4 -4
- package/src/components/TabView.js +1 -1
- package/src/components/TilePlaceholder.js +2 -1
- package/src/components/VirtualizedList.js +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swan-io/lake",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.3.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">22.12.0"
|
|
6
6
|
},
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@types/react": "^19.2.14",
|
|
45
45
|
"@types/react-dom": "^19.2.3",
|
|
46
46
|
"@types/react-native": "^0.72.8",
|
|
47
|
-
"react": "^19.2.
|
|
48
|
-
"react-dom": "^19.2.
|
|
47
|
+
"react": "^19.2.7",
|
|
48
|
+
"react-dom": "^19.2.7",
|
|
49
49
|
"react-native-web": "^0.21.2",
|
|
50
50
|
"type-fest": "^5.6.0"
|
|
51
51
|
}
|
|
@@ -41,5 +41,5 @@ const styles = StyleSheet.create({
|
|
|
41
41
|
export const Accordion = ({ children, trigger, style, contentContainerStyle }) => {
|
|
42
42
|
const id = useId();
|
|
43
43
|
const [isOpen, { toggle }] = useDisclosure(false);
|
|
44
|
-
return (_jsxs(View, { children: [_jsxs(Pressable, { "aria-controls": id, "aria-expanded": isOpen, onPress: toggle, style: [styles.trigger, style], children: [_jsx(Icon, { name: "chevron-right-filled", size: 12, color: colors.gray[500], style: [styles.arrow, isOpen && styles.arrowOpen] }), _jsx(Space, { width: 20 }), typeof trigger === "string" ? (_jsx(LakeText, { variant: "smallMedium", color: colors.gray[900], children: trigger })) : (trigger)] }), _jsx(View, { "aria-labelledby": id, "aria-hidden": !isOpen, role: "region", style: [styles.contentContainer, isOpen && styles.contentContainerDisplayed], children: _jsx(View, { style: styles.contentInner, children: _jsx(View, { style: [styles.content, contentContainerStyle], children: children }) }) })] }));
|
|
44
|
+
return (_jsxs(View, { children: [_jsxs(Pressable, { "aria-controls": id, role: "button", "aria-expanded": isOpen, onPress: toggle, style: [styles.trigger, style], children: [_jsx(Icon, { name: "chevron-right-filled", size: 12, color: colors.gray[500], style: [styles.arrow, isOpen && styles.arrowOpen] }), _jsx(Space, { width: 20 }), typeof trigger === "string" ? (_jsx(LakeText, { variant: "smallMedium", color: colors.gray[900], children: trigger })) : (trigger)] }), _jsx(View, { "aria-labelledby": id, "aria-hidden": !isOpen, role: "region", style: [styles.contentContainer, isOpen && styles.contentContainerDisplayed], children: _jsx(View, { style: styles.contentInner, children: _jsx(View, { style: [styles.content, contentContainerStyle], children: children }) }) })] }));
|
|
45
45
|
};
|
package/src/components/Cells.js
CHANGED
|
@@ -93,7 +93,7 @@ const styles = StyleSheet.create({
|
|
|
93
93
|
paddingLeft: spacings[8],
|
|
94
94
|
},
|
|
95
95
|
});
|
|
96
|
-
export const Cell = ({ children, align = "left", direction = "row", fadeOn, style, contentContainerStyle, }) => (_jsx(View, { style: [styles.cell, style], children: _jsx(View, { style: [
|
|
96
|
+
export const Cell = ({ children, align = "left", direction = "row", fadeOn, style, contentContainerStyle, }) => (_jsx(View, { role: "cell", style: [styles.cell, style], children: _jsx(View, { style: [
|
|
97
97
|
styles.cellContentContainer,
|
|
98
98
|
directionStyles[direction],
|
|
99
99
|
alignItemsStyles[direction === "row" ? "center" : align],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ViewProps } from "react-native";
|
|
2
2
|
type Props = {
|
|
3
|
+
id?: string;
|
|
3
4
|
min: number;
|
|
4
5
|
max: number;
|
|
5
6
|
value: number;
|
|
@@ -8,5 +9,5 @@ type Props = {
|
|
|
8
9
|
style?: ViewProps["style"];
|
|
9
10
|
onChange: (value: number) => void;
|
|
10
11
|
};
|
|
11
|
-
export declare const LakeSlider: ({ min, max, value, step, disabled, style, onChange }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const LakeSlider: ({ id, min, max, value, step, disabled, style, onChange, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -8,7 +8,7 @@ const styles = StyleSheet.create({
|
|
|
8
8
|
zIndex: 1,
|
|
9
9
|
},
|
|
10
10
|
});
|
|
11
|
-
export const LakeSlider = ({ min, max, value, step, disabled = false, style, onChange }) => (_jsx(View, { style: [styles.container, style], children: _jsx("input", { type: "range", min: min, max: max, value: value, step: step, disabled: disabled, onChange: useCallback((event) => onChange(Number(event.target.value)), [onChange]), style: {
|
|
11
|
+
export const LakeSlider = ({ id, min, max, value, step, disabled = false, style, onChange, }) => (_jsx(View, { style: [styles.container, style], children: _jsx("input", { id: id, type: "range", min: min, max: max, value: value, step: step, disabled: disabled, onChange: useCallback((event) => onChange(Number(event.target.value)), [onChange]), style: {
|
|
12
12
|
backgroundSize: `${((value - min) / (max - min)) * 100}% 100%`,
|
|
13
13
|
...(disabled ? commonStyles.disabled : {}),
|
|
14
14
|
} }) }));
|
|
@@ -197,7 +197,7 @@ export const MultiSelect = ({ color = "gray", disabled = false, emptyResultText,
|
|
|
197
197
|
}, [filteredItems]);
|
|
198
198
|
const ListHeaderComponent = useMemo(() => (_jsxs(Box, { direction: "row", alignItems: "center", style: styles.filterContainer, children: [_jsx(TextInput, { autoComplete: "off", inputMode: "search", multiline: false, rows: 1, onChangeText: filterValue => setFilter(filterValue), placeholder: filterPlaceholder, value: filter, onFocus: setFilterFocused.on, onBlur: setFilterFocused.off, style: [styles.filterInput, filterFocused && styles.filterFocused] }), _jsx(Icon, { name: "search-filled", color: colors[color].primary, size: 20, style: styles.searchIcon })] })), [filter, filterFocused, setFilterFocused, filterPlaceholder, color]);
|
|
199
199
|
const ListEmptyComponent = useMemo(() => (_jsxs(Box, { justifyContent: "center", alignItems: "center", style: styles.emptyList, children: [_jsx(Icon, { name: "clipboard-search-regular", size: 24, color: colors.gray.primary }), isNotNullishOrEmpty(emptyResultText) && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 8 }), _jsx(Text, { style: styles.emptyListText, children: emptyResultText })] }))] })), [emptyResultText]);
|
|
200
|
-
return (_jsxs(View, { style: style, children: [_jsxs(Pressable, { id: id, ref: inputRef, "aria-haspopup": "listbox", "aria-expanded": visible, disabled: disabled, onPress: open, style: ({ hovered, focused }) => [
|
|
200
|
+
return (_jsxs(View, { style: style, children: [_jsxs(Pressable, { id: id, ref: inputRef, role: "button", "aria-haspopup": "listbox", "aria-expanded": visible, disabled: disabled, onPress: open, style: ({ hovered, focused }) => [
|
|
201
201
|
styles.base,
|
|
202
202
|
hovered && styles.hovered,
|
|
203
203
|
(focused || visible) && styles.focused,
|
|
@@ -98,7 +98,7 @@ const Row = ({ id, item, index, rowHeight, columns, extraInfo, isActive, isHover
|
|
|
98
98
|
onHoverStart: () => onMouseEnter(id),
|
|
99
99
|
onHoverEnd: () => onMouseLeave(),
|
|
100
100
|
});
|
|
101
|
-
return (_jsx(View, { ref: containerRef, style: [
|
|
101
|
+
return (_jsx(View, { ref: containerRef, role: "row", style: [
|
|
102
102
|
styles.segment,
|
|
103
103
|
large && styles.segmentLarge,
|
|
104
104
|
styles.row,
|
|
@@ -172,10 +172,10 @@ export const PlainListView = ({ data: originalData, keyExtractor, rowHeight, gro
|
|
|
172
172
|
minHeight: totalHeight + (isLoading ? loading.count * rowHeight : 0),
|
|
173
173
|
},
|
|
174
174
|
] })), [isLoading, loading === null || loading === void 0 ? void 0 : loading.count, rowHeight, totalHeight, withoutScroll]);
|
|
175
|
-
return (_jsx(ResponsiveContainer, { style: withoutScroll ? (isEmpty ? commonStyles.fill : undefined) : styles.root, breakpoint: breakpoint, children: ({ large }) => {
|
|
175
|
+
return (_jsx(ResponsiveContainer, { role: "table", style: withoutScroll ? (isEmpty ? commonStyles.fill : undefined) : styles.root, breakpoint: breakpoint, children: ({ large }) => {
|
|
176
176
|
const displayColumns = large ? columns : smallColumns;
|
|
177
177
|
return (_jsx(_Fragment, { children: cloneElement(listWrapper, {
|
|
178
|
-
children: (_jsxs(_Fragment, { children: [!isEmpty && large ? (_jsx(View, { style: [
|
|
178
|
+
children: (_jsxs(_Fragment, { children: [!isEmpty && large ? (_jsx(View, { role: "row", style: [
|
|
179
179
|
styles.segment,
|
|
180
180
|
styles.segmentLarge,
|
|
181
181
|
styles.header,
|
|
@@ -200,7 +200,7 @@ export const PlainListView = ({ data: originalData, keyExtractor, rowHeight, gro
|
|
|
200
200
|
paddingTop: groupHeaderHeight / 4,
|
|
201
201
|
top: stickyOffset + (large ? headerHeight : 0),
|
|
202
202
|
},
|
|
203
|
-
], children: _jsx(LakeHeading, { level:
|
|
203
|
+
], children: _jsx(LakeHeading, { level: "none", variant: "h3", children: groupName }) })) : null, items.map((item, index) => {
|
|
204
204
|
const key = keyExtractor(item, index);
|
|
205
205
|
const isActive = activeRowId === key;
|
|
206
206
|
const isHovered = isNotNullish(getRowLink) && hoveredRow === key;
|
|
@@ -406,7 +406,7 @@ export const TabView = ({ tabs, otherLabel, hideIfSingleItem = true, sticky = fa
|
|
|
406
406
|
if (tabs.length <= 1 && hideIfSingleItem) {
|
|
407
407
|
return null;
|
|
408
408
|
}
|
|
409
|
-
return (_jsxs(Box, { alignItems: "center", direction: "row", role: "
|
|
409
|
+
return (_jsxs(Box, { alignItems: "center", direction: "row", role: "navigation", ref: containerRef, style: [styles.container, sticky && styles.sticky, { paddingHorizontal: padding }], children: [_jsxs(View, { style: styles.placeholder, "aria-hidden": true, ref: placeholderRef, onLayout: onLayout, children: [tabs.map(tab => {
|
|
410
410
|
const { label, icon, count, endElement } = tab;
|
|
411
411
|
const tabId = getTabId(tab);
|
|
412
412
|
return (_jsxs(Fragment, { children: [_jsxs(TabViewLink, { ref: ref => {
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { StyleSheet, View } from "react-native";
|
|
4
4
|
import { colors, radii } from "../constants/design";
|
|
5
|
+
import { Space } from "./Space";
|
|
5
6
|
import { Tile, TileGrid } from "./Tile";
|
|
6
7
|
const styles = StyleSheet.create({
|
|
7
8
|
placeholderTitle: {
|
|
@@ -42,7 +43,7 @@ const styles = StyleSheet.create({
|
|
|
42
43
|
},
|
|
43
44
|
});
|
|
44
45
|
export const TilePlaceholder = () => {
|
|
45
|
-
return (
|
|
46
|
+
return (_jsxs(Tile, { children: [_jsx(View, { style: styles.placeholderTitle }), _jsx(Space, { height: 24 }), _jsxs(View, { style: styles.content, children: [_jsx(View, { style: styles.placeholderText }), _jsx(View, { style: styles.placeholderText }), _jsx(View, { style: styles.placeholderText }), _jsx(View, { style: styles.placeholderText })] })] }));
|
|
46
47
|
};
|
|
47
48
|
export const TileGridPlaceholder = ({ numberOfItems = 2, withTabs = true, }) => {
|
|
48
49
|
return (_jsx(View, { style: withTabs && styles.withTabs, children: _jsx(TileGrid, { children: useMemo(() => Array(numberOfItems)
|
|
@@ -393,7 +393,7 @@ export const VirtualizedList = ({ variant, data, stickedToStartColumns, columns,
|
|
|
393
393
|
}
|
|
394
394
|
}, [onEndReached, data.length]);
|
|
395
395
|
const header = useMemo(() => {
|
|
396
|
-
return (_jsxs(View, { style: [styles.headerRow, { height: headerHeight }], children: [Option.fromNullable(stickedToStartColumns)
|
|
396
|
+
return (_jsxs(View, { role: "row", style: [styles.headerRow, { height: headerHeight }], children: [Option.fromNullable(stickedToStartColumns)
|
|
397
397
|
.map(columns => (_jsx(View, { style: [
|
|
398
398
|
styles.cellsContainer,
|
|
399
399
|
styles.stickedToStartColumnGroup,
|
|
@@ -481,7 +481,7 @@ export const VirtualizedList = ({ variant, data, stickedToStartColumns, columns,
|
|
|
481
481
|
.getOr(false)) {
|
|
482
482
|
return (_jsx(ScrollView, { style: styles.container, contentContainerStyle: styles.emptyListContentContainer, children: renderEmptyList() }));
|
|
483
483
|
}
|
|
484
|
-
return (_jsxs(ScrollView, { ref: scrollViewRef, both: true, style: [styles.container, { marginHorizontal }], onScroll: onScroll, scrollEventThrottle: 32, contentContainerStyle: [
|
|
484
|
+
return (_jsxs(ScrollView, { ref: scrollViewRef, role: "table", both: true, style: [styles.container, { marginHorizontal }], onScroll: onScroll, scrollEventThrottle: 32, contentContainerStyle: [
|
|
485
485
|
styles.contentContainer,
|
|
486
486
|
{
|
|
487
487
|
height: containerContainerHeight,
|
|
@@ -512,6 +512,7 @@ const RawVirtualizedRow = ({ viewId, rowHeight, absoluteIndex, variant, stickedT
|
|
|
512
512
|
const rootElement = getRowLink != null ? (((_a = getRowLink({ item, index: absoluteIndex, extraInfo })) !== null && _a !== void 0 ? _a : _jsx(View, {}))) : (_jsx(View, {}));
|
|
513
513
|
return cloneElement(rootElement, {
|
|
514
514
|
ref: elementRef,
|
|
515
|
+
role: "row",
|
|
515
516
|
style: [
|
|
516
517
|
styles.row,
|
|
517
518
|
{
|