@swan-io/lake 1.4.3 → 1.5.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 +4 -5
- package/src/components/AppOpeningAnimation.js +13 -13
- package/src/components/AutoWidthImage.d.ts +1 -0
- package/src/components/AutoWidthImage.js +3 -4
- package/src/components/Avatar.js +3 -2
- package/src/components/BorderedButton.d.ts +1 -1
- package/src/components/BorderedButton.js +6 -4
- package/src/components/BottomPanel.js +2 -2
- package/src/components/Box.js +1 -1
- package/src/components/Breadcrumbs.js +17 -17
- package/src/components/ChoicePicker.js +6 -6
- package/src/components/Fill.js +2 -1
- package/src/components/FilterChooser.js +2 -2
- package/src/components/Filters.js +10 -10
- package/src/components/FixedListView.js +15 -12
- package/src/components/FixedListViewCells.js +2 -2
- package/src/components/Form.d.ts +1 -1
- package/src/components/FullViewportLayer.js +13 -10
- package/src/components/Heading.d.ts +1 -1
- package/src/components/Heading.js +1 -1
- package/src/components/Icon.d.ts +4 -4
- package/src/components/Icon.js +7 -1
- package/src/components/Input.d.ts +6 -6
- package/src/components/Input.js +5 -10
- package/src/components/InputError.js +1 -1
- package/src/components/Label.d.ts +1 -1
- package/src/components/Label.js +1 -1
- package/src/components/LakeButton.d.ts +3 -3
- package/src/components/LakeButton.js +4 -4
- package/src/components/LakeCheckbox.js +2 -2
- package/src/components/LakeCombobox.d.ts +2 -2
- package/src/components/LakeCombobox.js +6 -10
- package/src/components/LakeDownloadButton.js +1 -1
- package/src/components/LakeHeading.d.ts +3 -2
- package/src/components/LakeHeading.js +7 -1
- package/src/components/LakeLabel.d.ts +0 -1
- package/src/components/LakeLabel.js +4 -4
- package/src/components/LakeModal.js +6 -3
- package/src/components/LakeRadio.js +3 -3
- package/src/components/LakeScrollView.js +2 -1
- package/src/components/LakeSearchField.js +3 -3
- package/src/components/LakeSelect.d.ts +2 -2
- package/src/components/LakeSelect.js +14 -23
- package/src/components/LakeSlider.js +1 -1
- package/src/components/LakeStepper.js +5 -5
- package/src/components/LakeText.d.ts +9 -8
- package/src/components/LakeText.js +7 -1
- package/src/components/LakeTextInput.d.ts +11 -6
- package/src/components/LakeTextInput.js +5 -5
- package/src/components/LakeTooltip.js +7 -12
- package/src/components/Link.d.ts +53 -50
- package/src/components/Link.js +4 -4
- package/src/components/ListRightPanel.js +2 -2
- package/src/components/Modal.js +15 -5
- package/src/components/MultiSelect.d.ts +1 -1
- package/src/components/MultiSelect.js +9 -6
- package/src/components/PlainListView.js +5 -4
- package/src/components/Popover.js +9 -5
- package/src/components/Portal.js +2 -2
- package/src/components/Pressable.d.ts +112 -101
- package/src/components/Pressable.js +16 -6
- package/src/components/ProjectEnvTag.js +1 -1
- package/src/components/ReadOnlyFieldList.js +2 -2
- package/src/components/RightPanel.d.ts +1 -1
- package/src/components/RightPanel.js +14 -11
- package/src/components/Separator.js +1 -1
- package/src/components/SidebarNavigationTracker.js +4 -3
- package/src/components/Slider.js +28 -12
- package/src/components/SmsOpeningAnimation.js +15 -15
- package/src/components/Space.d.ts +1 -1
- package/src/components/Stack.d.ts +4 -4
- package/src/components/Stack.js +1 -1
- package/src/components/Stepper.js +1 -1
- package/src/components/Svg.d.ts +6 -7
- package/src/components/Switch.js +19 -7
- package/src/components/TabView.js +16 -15
- package/src/components/Tag.d.ts +2 -2
- package/src/components/Tag.js +6 -3
- package/src/components/Tile.js +2 -2
- package/src/components/ToastStack.js +19 -10
- package/src/components/Tooltip.js +3 -6
- package/src/components/TransitionGroupView.d.ts +2 -3
- package/src/components/TransitionGroupView.js +3 -3
- package/src/components/TransitionView.d.ts +2 -3
- package/src/components/TransitionView.js +2 -2
- package/src/components/WithCurrentColor.d.ts +1 -1
- package/src/constants/design.d.ts +4 -12
- package/src/constants/design.js +12 -12
- package/src/hooks/useAnimatedValue.js +9 -2
- package/src/hooks/useForceableState.js +1 -1
- package/src/hooks/useHover.js +1 -1
- package/src/hooks/useMergeRefs.js +1 -1
- package/src/hooks/usePressEvents.js +1 -1
- package/src/icons/fluent-icons.json +9 -7
- package/src/components/Alert.d.ts +0 -10
- package/src/components/Alert.js +0 -36
- package/src/components/Button.d.ts +0 -15
- package/src/components/Button.js +0 -83
- package/src/components/Checkbox.d.ts +0 -12
- package/src/components/Checkbox.js +0 -83
- package/src/components/Combobox.d.ts +0 -29
- package/src/components/Combobox.js +0 -182
- package/src/components/MultilineInput.d.ts +0 -15
- package/src/components/MultilineInput.js +0 -55
- package/src/components/Picker.d.ts +0 -26
- package/src/components/Picker.js +0 -116
- package/src/components/ProgressBar.d.ts +0 -11
- package/src/components/ProgressBar.js +0 -46
- package/src/components/SegmentedControl.d.ts +0 -19
- package/src/components/SegmentedControl.js +0 -74
- package/src/components/Table.d.ts +0 -34
- package/src/components/Table.js +0 -79
- package/src/hooks/useLazyRef.d.ts +0 -2
- package/src/hooks/useLazyRef.js +0 -9
|
@@ -22,9 +22,9 @@ export type SelectProps<V> = {
|
|
|
22
22
|
value?: V;
|
|
23
23
|
onValueChange: (value: V) => void;
|
|
24
24
|
hideErrors?: boolean;
|
|
25
|
-
|
|
25
|
+
id?: string;
|
|
26
26
|
error?: string;
|
|
27
27
|
readOnly?: boolean;
|
|
28
28
|
style?: StyleProp<ViewStyle>;
|
|
29
29
|
};
|
|
30
|
-
export declare function LakeSelect<V>({ title, items, valueStyle, size, color, disabled, mode, placeholder, readOnly,
|
|
30
|
+
export declare function LakeSelect<V>({ title, items, valueStyle, size, color, disabled, mode, placeholder, readOnly, id, matchReferenceWidth, value, error, hideErrors, icon, onValueChange, PopoverFooter, style, }: SelectProps<V>): JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useRef } from "react";
|
|
3
3
|
import { FlatList, StyleSheet, View, } from "react-native";
|
|
4
|
-
import { match } from "ts-pattern";
|
|
5
4
|
import { commonStyles } from "../constants/commonStyles";
|
|
6
5
|
import { colors, invariantColors, radii, shadows, spacings, texts, } from "../constants/design";
|
|
7
6
|
import { useDisclosure } from "../hooks/useDisclosure";
|
|
@@ -104,7 +103,7 @@ const styles = StyleSheet.create({
|
|
|
104
103
|
borderColor: colors.negative[500],
|
|
105
104
|
},
|
|
106
105
|
});
|
|
107
|
-
export function LakeSelect({ title, items, valueStyle, size, color = "current", disabled = false, mode = "normal", placeholder, readOnly = false,
|
|
106
|
+
export function LakeSelect({ title, items, valueStyle, size, color = "current", disabled = false, mode = "normal", placeholder, readOnly = false, id, matchReferenceWidth = true, value, error, hideErrors = false, icon, onValueChange, PopoverFooter, style, }) {
|
|
108
107
|
const inputRef = useRef(null);
|
|
109
108
|
const listRef = useRef(null);
|
|
110
109
|
const typingTimeoutRef = useRef(undefined);
|
|
@@ -140,7 +139,7 @@ export function LakeSelect({ title, items, valueStyle, size, color = "current",
|
|
|
140
139
|
}, 300);
|
|
141
140
|
}, [items, onValueChange, visible]);
|
|
142
141
|
const name = itemValue?.name ?? value;
|
|
143
|
-
return (_jsxs(View, { style: commonStyles.fill, children: [_jsx(Pressable, {
|
|
142
|
+
return (_jsxs(View, { style: commonStyles.fill, children: [_jsx(Pressable, { id: id, ref: inputRef, "aria-haspopup": "listbox", role: "button", "aria-expanded": visible, disabled: readOnly || disabled, style: ({ focused }) => [
|
|
144
143
|
mode === "normal" ? styles.normal : styles.borderless,
|
|
145
144
|
size === "small" && styles.small,
|
|
146
145
|
(disabled || readOnly) && styles.inputDisabled,
|
|
@@ -149,36 +148,28 @@ export function LakeSelect({ title, items, valueStyle, size, color = "current",
|
|
|
149
148
|
mode !== "borderless" && error != null && styles.errorContainer,
|
|
150
149
|
(disabled || readOnly) && mode === "borderless" && styles.inputBorderlessDisabled,
|
|
151
150
|
style,
|
|
152
|
-
], onPress: toggle, onKeyDown: onKeyDown,
|
|
151
|
+
], onPress: toggle, onKeyDown: onKeyDown, "aria-errormessage": error, children: ({ hovered }) => (_jsxs(_Fragment, { children: [mode === "normal" && _jsx(View, { style: [styles.shadowed, hovered && styles.hovered] }), _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "center", children: [_jsxs(Box, { direction: "row", alignItems: "center", style: commonStyles.fill, children: [icon && (_jsxs(_Fragment, { children: [_jsx(Icon, { color: colors[color].primary, name: icon, size: isSmall ? 16 : 18 }), _jsx(Space, { width: 8 })] })), hasValue ? (_jsxs(Box, { direction: "row", alignItems: "center", style: commonStyles.fill, children: [isNotNullish(itemValue?.icon) && (_jsxs(_Fragment, { children: [itemValue?.icon, _jsx(Space, { width: 12 })] })), _jsx(LakeText, { color: colors.gray[900], variant: isSmall ? "smallRegular" : "regular", style: [styles.itemText, valueStyle], children: name })] })) : (_jsx(LakeText, { style: [
|
|
153
152
|
styles.itemText,
|
|
154
153
|
styles.selectPlaceholder,
|
|
155
154
|
isSmall && styles.selectSmallPlaceholder,
|
|
156
|
-
], children: placeholder ?? " " }))] }), _jsx(Fill, { minWidth: 8 }), !disabled && (_jsx(Icon, { color: colors.gray[900], name: visible ? "chevron-up-filled" : "chevron-down-filled", size: 16 }))] })] })) }), !hideErrors && (_jsx(LakeText, { color: colors.negative[
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (isNotNullish(
|
|
161
|
-
const focusableElements = getFocusableElements(
|
|
162
|
-
const current = focusableElements.indexOf(
|
|
163
|
-
|
|
155
|
+
], children: placeholder ?? " " }))] }), _jsx(Fill, { minWidth: 8 }), !disabled && (_jsx(Icon, { color: colors.gray[900], name: visible ? "chevron-up-filled" : "chevron-down-filled", size: 16 }))] })] })) }), !hideErrors && (_jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], style: styles.errorText, children: error ?? " " })), _jsxs(Popover, { role: "listbox", matchReferenceMinWidth: matchReferenceWidth, onDismiss: close, referenceRef: inputRef, returnFocus: true, visible: visible, children: [isNotNullish(title) && (_jsxs(_Fragment, { children: [_jsx(LakeText, { variant: "semibold", color: colors.gray[900], style: styles.selectListTitle, children: title }), _jsx(Separator, {})] })), _jsx(FlatList, { role: "list", data: items, ref: listRef, contentContainerStyle: styles.listContent, onKeyDown: (event) => {
|
|
156
|
+
const { key } = event.nativeEvent;
|
|
157
|
+
if (key === "ArrowDown" || key === "ArrowUp") {
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
if (isNotNullish(event.currentTarget)) {
|
|
160
|
+
const focusableElements = getFocusableElements(event.currentTarget);
|
|
161
|
+
const current = focusableElements.indexOf(event.target);
|
|
162
|
+
const nextIndex = key === "ArrowDown" ? current + 1 : current - 1;
|
|
163
|
+
focusableElements[nextIndex]?.focus();
|
|
164
164
|
}
|
|
165
|
-
}
|
|
166
|
-
.with("ArrowUp", () => {
|
|
167
|
-
e.preventDefault();
|
|
168
|
-
if (isNotNullish(e.currentTarget)) {
|
|
169
|
-
const focusableElements = getFocusableElements(e.currentTarget);
|
|
170
|
-
const current = focusableElements.indexOf(e.target);
|
|
171
|
-
focusableElements[current - 1]?.focus();
|
|
172
|
-
}
|
|
173
|
-
})
|
|
174
|
-
.otherwise(() => { });
|
|
165
|
+
}
|
|
175
166
|
}, keyExtractor: (_, index) => `select-item-${index}`, renderItem: ({ item, index }) => {
|
|
176
167
|
const isSelected = value === item.value;
|
|
177
168
|
return (_jsxs(Pressable, { ref: element => (listItemRefs.current[index] = element), onKeyDown: onKeyDown, style: ({ hovered, focused }) => [
|
|
178
169
|
styles.item,
|
|
179
170
|
(hovered || isSelected) && styles.itemHighlighted,
|
|
180
171
|
focused && styles.itemFocused,
|
|
181
|
-
],
|
|
172
|
+
], role: "option", "aria-selected": true, onPress: () => {
|
|
182
173
|
onValueChange(item.value);
|
|
183
174
|
close();
|
|
184
175
|
}, children: [isNotNullish(item.icon) && (_jsxs(_Fragment, { children: [item.icon, _jsx(Space, { width: 12 })] })), _jsx(LakeText, { color: colors.gray[900], numberOfLines: 1, style: [styles.itemText, isSelected && styles.selected], children: item.name }), _jsx(Fill, { minWidth: 12 }), isSelected && (_jsx(Icon, { color: colors.positive[500], name: "checkmark-filled", size: 14 }))] }));
|
|
@@ -27,5 +27,5 @@ export const LakeSlider = ({ label, value, min, max, step, unit, onChange }) =>
|
|
|
27
27
|
setDirtyValue(String(cleanValue));
|
|
28
28
|
onChange(cleanValue);
|
|
29
29
|
}, [min, max, dirtyValue, onChange]);
|
|
30
|
-
return (_jsx(ResponsiveContainer, { breakpoint: sliderBreakpoint, style: styles.container, children: ({ large }) => (_jsx(_Fragment, { children: large ? (_jsxs(_Fragment, { children: [_jsx(Box, { direction: "row", justifyContent: "end", children: _jsx(View, { children: _jsx(LakeTextInput, { style: styles.input, unit: unit, value: dirtyValue, onChangeText: setDirtyValue, onBlur: sanitizeInput,
|
|
30
|
+
return (_jsx(ResponsiveContainer, { breakpoint: sliderBreakpoint, style: styles.container, children: ({ large }) => (_jsx(_Fragment, { children: large ? (_jsxs(_Fragment, { children: [_jsx(Box, { direction: "row", justifyContent: "end", children: _jsx(View, { children: _jsx(LakeTextInput, { style: styles.input, unit: unit, value: dirtyValue, onChangeText: setDirtyValue, onBlur: sanitizeInput, inputMode: "decimal" }) }) }), _jsx("input", { type: "range", min: min, max: max, step: step, value: value, onChange: event => onChange(Number(event.target.value)), style: { backgroundSize: `${((value - min) / (max - min)) * 100}% 100%` } })] })) : (_jsx(LakeLabel, { label: label, render: id => (_jsx(LakeTextInput, { id: id, unit: unit, value: dirtyValue, onChangeText: setDirtyValue, onBlur: sanitizeInput, inputMode: "decimal" })) })) })) }));
|
|
31
31
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Option } from "@swan-io/boxed";
|
|
3
3
|
import { Link } from "@swan-io/chicane";
|
|
4
4
|
import { StyleSheet, View } from "react-native";
|
|
5
|
-
import {
|
|
5
|
+
import { P, match } from "ts-pattern";
|
|
6
6
|
import { colors } from "../constants/design";
|
|
7
7
|
import { Box } from "./Box";
|
|
8
8
|
import { Grid } from "./Grid";
|
|
@@ -23,23 +23,23 @@ const styles = StyleSheet.create({
|
|
|
23
23
|
backgroundColor: colors.gray[100],
|
|
24
24
|
overflow: "hidden",
|
|
25
25
|
transformOrigin: "bottom",
|
|
26
|
-
transform:
|
|
26
|
+
transform: "scaleY(0.5)",
|
|
27
27
|
transitionDuration: "300ms",
|
|
28
28
|
transitionProperty: "transform",
|
|
29
29
|
},
|
|
30
30
|
barActive: {
|
|
31
|
-
transform:
|
|
31
|
+
transform: "scaleY(1)",
|
|
32
32
|
},
|
|
33
33
|
progressBar: {
|
|
34
34
|
width: "100%",
|
|
35
35
|
height: "100%",
|
|
36
36
|
backgroundColor: colors.current[500],
|
|
37
37
|
transformOrigin: "left",
|
|
38
|
-
transform:
|
|
38
|
+
transform: "scaleX(0)",
|
|
39
39
|
transitionDuration: "300ms",
|
|
40
40
|
},
|
|
41
41
|
progressBarDone: {
|
|
42
|
-
transform:
|
|
42
|
+
transform: "scaleX(1)",
|
|
43
43
|
},
|
|
44
44
|
progressBarError: {
|
|
45
45
|
backgroundColor: colors.negative[500],
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { Text, TextProps } from "react-native";
|
|
2
|
+
import { Text, TextProps, TextStyle } from "react-native";
|
|
3
3
|
declare const variants: {
|
|
4
|
-
semibold:
|
|
5
|
-
medium:
|
|
6
|
-
regular:
|
|
7
|
-
light:
|
|
8
|
-
smallSemibold:
|
|
9
|
-
smallMedium:
|
|
10
|
-
smallRegular:
|
|
4
|
+
semibold: TextStyle;
|
|
5
|
+
medium: TextStyle;
|
|
6
|
+
regular: TextStyle;
|
|
7
|
+
light: TextStyle;
|
|
8
|
+
smallSemibold: TextStyle;
|
|
9
|
+
smallMedium: TextStyle;
|
|
10
|
+
smallRegular: TextStyle;
|
|
11
11
|
};
|
|
12
12
|
export type TextVariant = keyof typeof variants;
|
|
13
13
|
export declare const LakeText: import("react").ForwardRefExoticComponent<TextProps & {
|
|
14
14
|
align?: "left" | "right" | "center" | undefined;
|
|
15
15
|
children: ReactNode;
|
|
16
16
|
color?: string | undefined;
|
|
17
|
+
userSelect?: TextStyle["userSelect"];
|
|
17
18
|
variant?: "semibold" | "medium" | "regular" | "light" | "smallSemibold" | "smallMedium" | "smallRegular" | undefined;
|
|
18
19
|
} & import("react").RefAttributes<Text>>;
|
|
19
20
|
export {};
|
|
@@ -17,4 +17,10 @@ const variants = StyleSheet.create({
|
|
|
17
17
|
smallMedium: texts.smallMedium,
|
|
18
18
|
smallRegular: texts.smallRegular,
|
|
19
19
|
});
|
|
20
|
-
export const LakeText = forwardRef(({ align = "left", children, color, style, variant = "regular", ...props }, forwardedRef) => (_jsx(Text, { ref: forwardedRef, style: [
|
|
20
|
+
export const LakeText = forwardRef(({ align = "left", children, color, style, userSelect, variant = "regular", ...props }, forwardedRef) => (_jsx(Text, { ref: forwardedRef, style: [
|
|
21
|
+
variants[variant],
|
|
22
|
+
alignments[align],
|
|
23
|
+
isNotNullish(color) && { color },
|
|
24
|
+
isNotNullish(userSelect) && { userSelect },
|
|
25
|
+
style,
|
|
26
|
+
], ...props, children: children })));
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ChangeEventHandler, ReactNode } from "react";
|
|
2
2
|
import { TextInput, TextInputProps } from "react-native";
|
|
3
|
+
import { Except } from "type-fest";
|
|
3
4
|
import { ColorVariants } from "../constants/design";
|
|
4
5
|
import { IconName } from "./Icon";
|
|
5
|
-
export type LakeTextInputProps =
|
|
6
|
+
export type LakeTextInputProps = Except<TextInputProps, "editable" | "keyboardType" | "onChange"> & {
|
|
7
|
+
ariaExpanded?: boolean;
|
|
8
|
+
ariaControls?: string;
|
|
6
9
|
error?: string;
|
|
7
10
|
readOnly?: boolean;
|
|
8
11
|
validating?: boolean;
|
|
@@ -12,7 +15,7 @@ export type LakeTextInputProps = Omit<TextInputProps, "editable" | "onChange"> &
|
|
|
12
15
|
multiline?: boolean;
|
|
13
16
|
icon?: IconName;
|
|
14
17
|
unit?: string;
|
|
15
|
-
|
|
18
|
+
inputMode?: TextInputProps["inputMode"];
|
|
16
19
|
pattern?: string;
|
|
17
20
|
children?: ReactNode;
|
|
18
21
|
hideErrors?: boolean;
|
|
@@ -20,17 +23,19 @@ export type LakeTextInputProps = Omit<TextInputProps, "editable" | "onChange"> &
|
|
|
20
23
|
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
21
24
|
maxCharCount?: number;
|
|
22
25
|
};
|
|
23
|
-
export declare const LakeTextInput: import("react").ForwardRefExoticComponent<
|
|
26
|
+
export declare const LakeTextInput: import("react").ForwardRefExoticComponent<Except<TextInputProps, "editable" | "keyboardType" | "onChange"> & {
|
|
27
|
+
ariaExpanded?: boolean | undefined;
|
|
28
|
+
ariaControls?: string | undefined;
|
|
24
29
|
error?: string | undefined;
|
|
25
30
|
readOnly?: boolean | undefined;
|
|
26
31
|
validating?: boolean | undefined;
|
|
27
32
|
valid?: boolean | undefined;
|
|
28
33
|
disabled?: boolean | undefined;
|
|
29
|
-
color?: "
|
|
34
|
+
color?: "gray" | "live" | "sandbox" | "positive" | "warning" | "negative" | "current" | "partner" | "swan" | "shakespear" | "darkPink" | "sunglow" | "mediumSladeBlue" | undefined;
|
|
30
35
|
multiline?: boolean | undefined;
|
|
31
|
-
icon?: "lake-calendar-arrow-swap" | "lake-card" | "lake-card-one-off" | "lake-card-physical" | "lake-card-recurring" | "lake-card-single-use" | "lake-card-virtual" | "lake-chevron-double" | "lake-clipboard-bullet" | "lake-clock" | "lake-clock-arrow-swap" | "lake-close" | "lake-currencies" | "lake-delivery-grouped" | "lake-delivery-individual" | "lake-document-csv" | "lake-document-jpg" | "lake-document-pdf" | "lake-document-png" | "lake-document-xls" | "lake-email" | "lake-id-card" | "lake-inbox-empty" | "lake-menu" | "lake-people" | "lake-person-arrow-swap" | "lake-phone" | "lake-receipt" | "lake-settings" | "lake-signature" | "lake-transfer" | "lake-world-map" | "add-circle-filled" | "add-circle-regular" | "add-filled" | "approvals-app-filled" | "apps-list-filled" | "apps-list-regular" | "arrow-counterclockwise-filled" | "arrow-down-filled" | "arrow-down-regular" | "arrow-download-filled" | "arrow-left-filled" | "arrow-left-regular" | "arrow-right-filled" | "arrow-right-regular" | "arrow-swap-filled" | "arrow-swap-regular" | "arrow-up-filled" | "arrow-up-regular" | "beaker-filled" | "beaker-regular" | "board-regular" | "box-regular" | "building-bank-filled" | "building-bank-regular" | "building-filled" | "building-multiple-regular" | "building-regular" | "building-shop-regular" | "calendar-ltr-regular" | "cart-regular" | "chat-help-filled" | "chat-help-regular" | "checkmark-circle-regular" | "checkmark-filled" | "chevron-down-filled" | "chevron-left-filled" | "chevron-right-filled" | "chevron-up-down-regular" | "chevron-up-filled" | "clipboard-search-regular" | "clock-filled" | "clock-regular" | "cloud-sync-filled" | "cloud-sync-regular" | "code-filled" | "code-regular" | "color-regular" | "comment-note-regular" | "copy-filled" | "copy-regular" | "cursor-click-regular" | "database-filled" | "database-regular" | "delete-filled" | "delete-regular" | "desktop-regular" | "device-meeting-room-regular" | "dismiss-circle-regular" | "dismiss-filled" | "dismiss-regular" | "document-regular" | "earth-regular" | "edit-filled" | "edit-regular" | "error-circle-filled" | "error-circle-regular" | "eye-filled" | "eye-off-filled" | "eye-regular" | "filter-filled" | "flag-filled" | "flag-regular" | "flash-filled" | "flash-regular" | "form-new-filled" | "form-new-regular" | "hand-right-regular" | "image-add-filled" | "image-add-regular" | "image-filled" | "image-regular" | "info-filled" | "info-regular" | "key-regular" | "link-filled" | "live-filled" | "live-regular" | "lock-closed-filled" | "lock-closed-regular" | "lock-open-filled" | "lock-open-regular" | "mail-filled" | "mail-regular" | "money-regular" | "more-vertical-filled" | "open-filled" | "open-regular" | "options-regular" | "paint-brush-filled" | "paint-brush-regular" | "pause-regular" | "payment-filled" | "payment-regular" | "people-add-regular" | "people-community-filled" | "people-community-regular" | "people-filled" | "people-regular" | "people-team-regular" | "person-accounts-filled" | "person-accounts-regular" | "person-add-regular" | "person-call-filled" | "person-call-regular" | "person-filled" | "person-lock-regular" | "person-regular" | "phone-filled" | "phone-regular" | "pin-regular" | "play-filled" | "play-regular" | "preview-link-filled" | "question-circle-regular" | "receipt-money-filled" | "receipt-money-regular" | "rocket-regular" | "search-filled" | "send-filled" | "send-regular" | "settings-filled" | "settings-regular" | "shield-checkmark-filled" | "shield-checkmark-regular" | "shield-error-regular" | "shield-regular" | "sign-out-regular" | "signature-filled" | "signature-regular" | "subtract-circle-filled" | "subtract-circle-regular" | "target-arrow-regular" | "warning-filled" | "warning-regular" | "window-dev-tools-filled" | "window-dev-tools-regular" | undefined;
|
|
36
|
+
icon?: "lake-calendar-arrow-swap" | "lake-card" | "lake-card-one-off" | "lake-card-physical" | "lake-card-recurring" | "lake-card-single-use" | "lake-card-virtual" | "lake-chevron-double" | "lake-clipboard-bullet" | "lake-clock" | "lake-clock-arrow-swap" | "lake-close" | "lake-currencies" | "lake-delivery-grouped" | "lake-delivery-individual" | "lake-document-csv" | "lake-document-jpg" | "lake-document-pdf" | "lake-document-png" | "lake-document-xls" | "lake-email" | "lake-id-card" | "lake-inbox-empty" | "lake-menu" | "lake-people" | "lake-person-arrow-swap" | "lake-phone" | "lake-receipt" | "lake-settings" | "lake-signature" | "lake-transfer" | "lake-world-map" | "add-circle-filled" | "add-circle-regular" | "add-filled" | "approvals-app-filled" | "apps-list-filled" | "apps-list-regular" | "arrow-counterclockwise-filled" | "arrow-down-filled" | "arrow-down-regular" | "arrow-download-filled" | "arrow-left-filled" | "arrow-left-regular" | "arrow-right-filled" | "arrow-right-regular" | "arrow-swap-filled" | "arrow-swap-regular" | "arrow-up-filled" | "arrow-up-regular" | "arrow-upload-filled" | "arrow-upload-regular" | "beaker-filled" | "beaker-regular" | "board-regular" | "box-regular" | "building-bank-filled" | "building-bank-regular" | "building-filled" | "building-multiple-regular" | "building-regular" | "building-shop-regular" | "calendar-ltr-regular" | "cart-regular" | "chat-help-filled" | "chat-help-regular" | "checkmark-circle-regular" | "checkmark-filled" | "chevron-down-filled" | "chevron-left-filled" | "chevron-right-filled" | "chevron-up-down-regular" | "chevron-up-filled" | "clipboard-search-regular" | "clock-filled" | "clock-regular" | "cloud-sync-filled" | "cloud-sync-regular" | "code-filled" | "code-regular" | "color-regular" | "comment-note-regular" | "copy-filled" | "copy-regular" | "cursor-click-regular" | "database-filled" | "database-regular" | "delete-filled" | "delete-regular" | "desktop-regular" | "device-meeting-room-regular" | "dismiss-circle-regular" | "dismiss-filled" | "dismiss-regular" | "document-regular" | "earth-regular" | "edit-filled" | "edit-regular" | "error-circle-filled" | "error-circle-regular" | "eye-filled" | "eye-off-filled" | "eye-regular" | "filter-filled" | "flag-filled" | "flag-regular" | "flash-filled" | "flash-regular" | "form-new-filled" | "form-new-regular" | "hand-right-regular" | "image-add-filled" | "image-add-regular" | "image-filled" | "image-regular" | "info-filled" | "info-regular" | "key-regular" | "link-filled" | "live-filled" | "live-regular" | "lock-closed-filled" | "lock-closed-regular" | "lock-open-filled" | "lock-open-regular" | "mail-filled" | "mail-regular" | "money-regular" | "more-vertical-filled" | "open-filled" | "open-regular" | "options-regular" | "paint-brush-filled" | "paint-brush-regular" | "pause-regular" | "payment-filled" | "payment-regular" | "people-add-regular" | "people-community-filled" | "people-community-regular" | "people-filled" | "people-regular" | "people-team-regular" | "person-accounts-filled" | "person-accounts-regular" | "person-add-regular" | "person-call-filled" | "person-call-regular" | "person-filled" | "person-lock-regular" | "person-regular" | "phone-filled" | "phone-regular" | "pin-regular" | "play-filled" | "play-regular" | "preview-link-filled" | "question-circle-regular" | "receipt-money-filled" | "receipt-money-regular" | "rocket-regular" | "search-filled" | "send-filled" | "send-regular" | "settings-filled" | "settings-regular" | "shield-checkmark-filled" | "shield-checkmark-regular" | "shield-error-regular" | "shield-regular" | "sign-out-regular" | "signature-filled" | "signature-regular" | "subtract-circle-filled" | "subtract-circle-regular" | "target-arrow-regular" | "warning-filled" | "warning-regular" | "window-dev-tools-filled" | "window-dev-tools-regular" | undefined;
|
|
32
37
|
unit?: string | undefined;
|
|
33
|
-
|
|
38
|
+
inputMode?: TextInputProps["inputMode"];
|
|
34
39
|
pattern?: string | undefined;
|
|
35
40
|
children?: ReactNode;
|
|
36
41
|
hideErrors?: boolean | undefined;
|
|
@@ -84,13 +84,13 @@ const styles = StyleSheet.create({
|
|
|
84
84
|
position: "absolute",
|
|
85
85
|
right: spacings[16],
|
|
86
86
|
top: "50%",
|
|
87
|
-
transform:
|
|
87
|
+
transform: "translateY(-50%)",
|
|
88
88
|
},
|
|
89
89
|
icon: {
|
|
90
90
|
position: "absolute",
|
|
91
91
|
left: spacings[16],
|
|
92
92
|
top: "50%",
|
|
93
|
-
transform:
|
|
93
|
+
transform: "translateY(-50%)",
|
|
94
94
|
},
|
|
95
95
|
readOnlyEndIcon: {
|
|
96
96
|
right: 0,
|
|
@@ -121,7 +121,7 @@ const styles = StyleSheet.create({
|
|
|
121
121
|
paddingTop: spacings[4],
|
|
122
122
|
},
|
|
123
123
|
});
|
|
124
|
-
export const LakeTextInput = forwardRef(({ error, disabled = false, validating = false, valid = false, readOnly = false, icon, children, unit, color = "gray",
|
|
124
|
+
export const LakeTextInput = forwardRef(({ ariaExpanded, ariaControls, error, disabled = false, validating = false, valid = false, readOnly = false, icon, children, unit, color = "gray", inputMode = "text", hideErrors = false, onChange, pattern, style: stylesFromProps, onFocus: originalOnFocus, onBlur: originalOnBlur, value, defaultValue, multiline = false,
|
|
125
125
|
//maxCharCount is different from maxLength(props inherited of TextInput), maxLength truncates the text in the limitation asked,
|
|
126
126
|
//maxCharCount doesn't have limitation but displays a counter of characters
|
|
127
127
|
maxCharCount, ...props }, forwardRef) => {
|
|
@@ -145,7 +145,7 @@ maxCharCount, ...props }, forwardRef) => {
|
|
|
145
145
|
const isInteractive = !disabled && !readOnly;
|
|
146
146
|
const hasError = isNotNullishOrEmpty(error);
|
|
147
147
|
const charCount = isNullish(value) ? 0 : value.length;
|
|
148
|
-
return (_jsxs(View, { style: commonStyles.fill, children: [_jsxs(View, { style: styles.root,
|
|
148
|
+
return (_jsxs(View, { style: commonStyles.fill, children: [_jsxs(View, { style: styles.root, "aria-errormessage": error, children: [_jsxs(View, { style: styles.container, children: [_jsxs(View, { style: styles.contents, children: [_jsx(TextInput, { "aria-expanded": ariaExpanded, "aria-controls": ariaControls, inputMode: inputMode, ref: mergedRef, ...props, defaultValue: defaultValue, value: isNullish(defaultValue) ? value ?? "" : value, onFocus: onFocus, onBlur: onBlur, readOnly: !isInteractive, onChange: onChange, multiline: multiline, style: [
|
|
149
149
|
styles.input,
|
|
150
150
|
multiline && styles.multilineInput,
|
|
151
151
|
hasError && styles.error,
|
|
@@ -159,5 +159,5 @@ maxCharCount, ...props }, forwardRef) => {
|
|
|
159
159
|
isFocused && styles.focused,
|
|
160
160
|
isFocused && { borderColor: colors[color][500] },
|
|
161
161
|
stylesFromProps,
|
|
162
|
-
] }), validating && (_jsx(ActivityIndicator, { size: "small", style: styles.endIcon, color: colors.current[500] })), !validating && hasError && (_jsx(Icon, { name: "warning-regular", size: 20, color: colors.negative[400], style: [styles.endIcon, readOnly && styles.readOnlyEndIcon] })), !validating && !hasError && valid && (_jsx(Icon, { name: "checkmark-filled", size: 20, color: colors.positive[400], style: [styles.endIcon, readOnly && styles.readOnlyEndIcon] })), isNotNullish(icon) && (_jsx(Icon, { name: icon, size: 20, color: colors.current.primary, style: styles.icon }))] }), isNotNullish(unit) && (_jsx(LakeText, { color: colors.gray[900], style: [styles.unit, (disabled || readOnly) && styles.unitDisabled], children: unit }))] }), children] }), !hideErrors && (_jsxs(Box, { direction: "row", justifyContent: "spaceBetween", style: styles.errorContainer, children: [_jsx(LakeText, { color: colors.negative[
|
|
162
|
+
] }), validating && (_jsx(ActivityIndicator, { size: "small", style: styles.endIcon, color: colors.current[500] })), !validating && hasError && (_jsx(Icon, { name: "warning-regular", size: 20, color: colors.negative[400], style: [styles.endIcon, readOnly && styles.readOnlyEndIcon] })), !validating && !hasError && valid && (_jsx(Icon, { name: "checkmark-filled", size: 20, color: colors.positive[400], style: [styles.endIcon, readOnly && styles.readOnlyEndIcon] })), isNotNullish(icon) && (_jsx(Icon, { name: icon, size: 20, color: colors.current.primary, style: styles.icon }))] }), isNotNullish(unit) && (_jsx(LakeText, { color: colors.gray[900], style: [styles.unit, (disabled || readOnly) && styles.unitDisabled], children: unit }))] }), children] }), !hideErrors && (_jsxs(Box, { direction: "row", justifyContent: "spaceBetween", style: styles.errorContainer, children: [_jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], children: error ?? " " }), isNotNullish(maxCharCount) && (_jsxs(_Fragment, { children: [_jsx(Fill, { minWidth: 4 }), _jsxs(LakeText, { variant: "smallRegular", color: charCount > maxCharCount ? colors.negative[500] : colors.gray[400], style: styles.descriptionLimitation, children: [charCount, " / ", maxCharCount] })] }))] }))] }));
|
|
163
163
|
});
|
|
@@ -75,7 +75,7 @@ const styles = StyleSheet.create({
|
|
|
75
75
|
backgroundColor: colors.gray[900],
|
|
76
76
|
borderWidth: 1,
|
|
77
77
|
borderColor: colors.gray[900],
|
|
78
|
-
transform:
|
|
78
|
+
transform: "rotate(45deg)",
|
|
79
79
|
},
|
|
80
80
|
info: {
|
|
81
81
|
flexGrow: 0,
|
|
@@ -163,7 +163,7 @@ export const LakeTooltip = memo(forwardRef(({ children, content, describedBy, ma
|
|
|
163
163
|
state?.placement === "bottom" && styles.baseBottom,
|
|
164
164
|
state?.placement === "right" && styles.baseRight,
|
|
165
165
|
state?.placement === "left" && styles.baseLeft,
|
|
166
|
-
], children: [_jsx(View, { style: [styles.content, { width, maxWidth: MAX_WIDTH }], children: isReactText(content) ? (_jsx(LakeText, { align: "center", color: colors.gray.contrast, children: content })) : (content) }), !hideArrow && (_jsx(View, {
|
|
166
|
+
], children: [_jsx(View, { style: [styles.content, { width, maxWidth: MAX_WIDTH }], children: isReactText(content) ? (_jsx(LakeText, { align: "center", color: colors.gray.contrast, children: content })) : (content) }), !hideArrow && (_jsx(View, { role: "none", style: [
|
|
167
167
|
state?.placement === "right" || state?.placement === "left"
|
|
168
168
|
? styles.arrowContainerHorizontal
|
|
169
169
|
: styles.arrowContainer,
|
|
@@ -172,16 +172,11 @@ export const LakeTooltip = memo(forwardRef(({ children, content, describedBy, ma
|
|
|
172
172
|
state?.placement === "right" && styles.arrowContainerRight,
|
|
173
173
|
state?.placement === "left" && styles.arrowContainerLeft,
|
|
174
174
|
{
|
|
175
|
-
transform:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
.with("left", () => "-90deg")
|
|
181
|
-
.with("right", () => "90deg")
|
|
182
|
-
.otherwise(() => "0deg"),
|
|
183
|
-
},
|
|
184
|
-
],
|
|
175
|
+
transform: `translateX(${-overflowOffset}px) rotate(${match(state?.placement)
|
|
176
|
+
.with("bottom", () => "180deg")
|
|
177
|
+
.with("left", () => "-90deg")
|
|
178
|
+
.with("right", () => "90deg")
|
|
179
|
+
.otherwise(() => "0deg")})`,
|
|
185
180
|
},
|
|
186
181
|
], children: _jsx(View, { style: styles.arrow }) }))] }) }) }))] }));
|
|
187
182
|
}));
|
package/src/components/Link.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { PressableTextProps } from "./Pressable";
|
|
3
2
|
import { HrefAttrs, PressableStateCallbackType, Text, TextProps } from "react-native";
|
|
4
3
|
import { Except } from "type-fest";
|
|
4
|
+
import { PressableTextProps } from "./Pressable";
|
|
5
5
|
export type LinkProps = Except<PressableTextProps, "hrefAttrs" | "style" | "onPress" | "children"> & {
|
|
6
6
|
to: string;
|
|
7
7
|
replace?: boolean;
|
|
@@ -19,78 +19,81 @@ export type LinkProps = Except<PressableTextProps, "hrefAttrs" | "style" | "onPr
|
|
|
19
19
|
};
|
|
20
20
|
export declare const Link: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Except<{
|
|
21
21
|
testID?: string | undefined;
|
|
22
|
+
id?: string | undefined;
|
|
23
|
+
role?: import("react-native").WebRole | undefined;
|
|
22
24
|
style?: false | import("react-native").TextStyle | import("react-native").RegisteredStyle<import("react-native").TextStyle> | import("react-native").RecursiveArray<import("react-native").TextStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<import("react-native").TextStyle>> | ((state: PressableStateCallbackType) => import("react-native").StyleProp<import("react-native").TextStyle>) | null | undefined;
|
|
25
|
+
tabIndex?: 0 | -1 | undefined;
|
|
23
26
|
children?: string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | import("react").ReactPortal | ((state: PressableStateCallbackType) => import("react").ReactNode) | null | undefined;
|
|
24
27
|
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
25
28
|
nativeID?: string | undefined;
|
|
26
|
-
accessibilityRole?: import("react-native").WebAccessibilityRole | undefined;
|
|
27
29
|
onKeyDown?: ((event: import("react-native").NativeSyntheticEvent<import("react").KeyboardEvent<Element>>) => void) | undefined;
|
|
28
|
-
focusable?: boolean | undefined;
|
|
29
30
|
accessible?: boolean | undefined;
|
|
30
31
|
accessibilityActions?: readonly Readonly<{
|
|
31
32
|
name: string;
|
|
32
33
|
label?: string | undefined;
|
|
33
34
|
}>[] | undefined;
|
|
34
35
|
accessibilityLabel?: string | undefined;
|
|
36
|
+
"aria-label"?: string | undefined;
|
|
37
|
+
accessibilityRole?: import("react-native").AccessibilityRole | undefined;
|
|
35
38
|
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
39
|
+
"aria-busy"?: boolean | undefined;
|
|
40
|
+
"aria-checked"?: boolean | "mixed" | undefined;
|
|
41
|
+
"aria-disabled"?: boolean | undefined;
|
|
42
|
+
"aria-expanded"?: boolean | undefined;
|
|
43
|
+
"aria-selected"?: boolean | undefined;
|
|
44
|
+
"aria-labelledby"?: string | undefined;
|
|
36
45
|
accessibilityHint?: string | undefined;
|
|
37
46
|
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
47
|
+
"aria-valuemax"?: number | undefined;
|
|
48
|
+
"aria-valuemin"?: number | undefined;
|
|
49
|
+
"aria-valuenow"?: number | undefined;
|
|
50
|
+
"aria-valuetext"?: string | undefined;
|
|
38
51
|
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
39
|
-
accessibilityLabelledBy?: string | string[] | undefined;
|
|
40
|
-
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
41
52
|
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
53
|
+
"aria-hidden"?: boolean | undefined;
|
|
54
|
+
"aria-live"?: "polite" | "assertive" | "off" | undefined;
|
|
55
|
+
"aria-modal"?: boolean | undefined;
|
|
56
|
+
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
42
57
|
accessibilityElementsHidden?: boolean | undefined;
|
|
43
|
-
accessibilityLanguage?: string | undefined;
|
|
44
58
|
accessibilityViewIsModal?: boolean | undefined;
|
|
45
59
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
46
60
|
onAccessibilityTap?: (() => void) | undefined;
|
|
47
61
|
onMagicTap?: (() => void) | undefined;
|
|
48
62
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
accessibilityRoleDescription?: string | undefined;
|
|
81
|
-
accessibilityRowCount?: number | undefined;
|
|
82
|
-
accessibilityRowIndex?: number | undefined;
|
|
83
|
-
accessibilityRowSpan?: number | undefined;
|
|
84
|
-
accessibilitySelected?: boolean | undefined;
|
|
85
|
-
accessibilitySetSize?: number | undefined;
|
|
86
|
-
accessibilitySort?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
87
|
-
accessibilityValueMax?: number | undefined;
|
|
88
|
-
accessibilityValueMin?: number | undefined;
|
|
89
|
-
accessibilityValueNow?: number | undefined;
|
|
90
|
-
accessibilityValueText?: string | undefined;
|
|
63
|
+
"aria-activedescendant"?: string | undefined;
|
|
64
|
+
"aria-atomic"?: boolean | undefined;
|
|
65
|
+
"aria-autocomplete"?: string | undefined;
|
|
66
|
+
"aria-colcount"?: number | undefined;
|
|
67
|
+
"aria-colindex"?: number | undefined;
|
|
68
|
+
"aria-colspan"?: number | undefined;
|
|
69
|
+
"aria-controls"?: string | undefined;
|
|
70
|
+
"aria-current"?: boolean | "time" | "page" | "step" | "location" | "date" | undefined;
|
|
71
|
+
"aria-describedby"?: string | undefined;
|
|
72
|
+
"aria-details"?: string | undefined;
|
|
73
|
+
"aria-errormessage"?: string | undefined;
|
|
74
|
+
"aria-flowto"?: string | undefined;
|
|
75
|
+
"aria-haspopup"?: string | undefined;
|
|
76
|
+
"aria-invalid"?: boolean | undefined;
|
|
77
|
+
"aria-keyshortcuts"?: string | undefined;
|
|
78
|
+
"aria-level"?: number | undefined;
|
|
79
|
+
"aria-multiline"?: boolean | undefined;
|
|
80
|
+
"aria-multiselectable"?: boolean | undefined;
|
|
81
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
82
|
+
"aria-owns"?: string | undefined;
|
|
83
|
+
"aria-placeholder"?: string | undefined;
|
|
84
|
+
"aria-posinset"?: number | undefined;
|
|
85
|
+
"aria-pressed"?: boolean | undefined;
|
|
86
|
+
"aria-readonly"?: boolean | undefined;
|
|
87
|
+
"aria-required"?: boolean | undefined;
|
|
88
|
+
"aria-roledescription"?: string | undefined;
|
|
89
|
+
"aria-rowcount"?: number | undefined;
|
|
90
|
+
"aria-rowindex"?: number | undefined;
|
|
91
|
+
"aria-rowspan"?: number | undefined;
|
|
92
|
+
"aria-setsize"?: number | undefined;
|
|
93
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
91
94
|
allowFontScaling?: boolean | undefined;
|
|
92
|
-
ellipsizeMode?: "clip" | "
|
|
93
|
-
lineBreakMode?: "clip" | "
|
|
95
|
+
ellipsizeMode?: "clip" | "middle" | "head" | "tail" | undefined;
|
|
96
|
+
lineBreakMode?: "clip" | "middle" | "head" | "tail" | undefined;
|
|
94
97
|
numberOfLines?: number | undefined;
|
|
95
98
|
onTextLayout?: ((event: import("react-native").NativeSyntheticEvent<import("react-native").TextLayoutEventData>) => void) | undefined;
|
|
96
99
|
onPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
package/src/components/Link.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useLinkProps } from "@swan-io/chicane";
|
|
3
|
-
import { PressableText } from "./Pressable";
|
|
4
|
-
import { isNotNullish } from "../utils/nullish";
|
|
5
3
|
import { forwardRef, memo } from "react";
|
|
6
|
-
|
|
4
|
+
import { isNotNullish } from "../utils/nullish";
|
|
5
|
+
import { PressableText } from "./Pressable";
|
|
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,
|
|
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) => {
|
|
9
9
|
const e = event;
|
|
10
10
|
if (disabled) {
|
|
11
11
|
e.preventDefault();
|
|
@@ -53,14 +53,14 @@ const ListRightPanel_ = forwardRef(({ items, keyExtractor, activeId, onActiveIdC
|
|
|
53
53
|
.when(({ activeItemIndex, previousIndex }) => activeItemIndex > previousIndex, () => animations.fadeAndSlideInFromTop)
|
|
54
54
|
.otherwise(() => null)
|
|
55
55
|
: null;
|
|
56
|
-
return (_jsx(RightPanel, { ref: ref, visible: activeItem != null, onPressClose: onClose, children: ({ large }) => (_jsxs(View, { style: styles.details, children: [_jsxs(Box, { direction: "row", justifyContent: "spaceBetween", style: large ? styles.contentLarge : styles.content, children: [_jsx(LakeButton, { mode: "tertiary", icon: "lake-close",
|
|
56
|
+
return (_jsx(RightPanel, { ref: ref, visible: activeItem != null, onPressClose: onClose, children: ({ large }) => (_jsxs(View, { style: styles.details, children: [_jsxs(Box, { direction: "row", justifyContent: "spaceBetween", style: large ? styles.contentLarge : styles.content, children: [_jsx(LakeButton, { mode: "tertiary", icon: "lake-close", ariaLabel: closeLabel, onPress: onClose }), _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", children: [_jsx(LakeButton, { mode: "tertiary", ariaLabel: previousLabel, icon: "arrow-left-regular", disabled: activeItemIndex === 0, onPress: () => {
|
|
57
57
|
if (typeof activeItemIndex === "number") {
|
|
58
58
|
Option.fromNullable(items[activeItemIndex - 1]).match({
|
|
59
59
|
Some: item => onActiveIdChange(keyExtractor(item)),
|
|
60
60
|
None: noop,
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
} }), _jsx(LakeButton, { mode: "tertiary",
|
|
63
|
+
} }), _jsx(LakeButton, { mode: "tertiary", ariaLabel: nextLabel, icon: "arrow-right-regular", disabled: activeItemIndex === items.length - 1, onPress: () => {
|
|
64
64
|
if (typeof activeItemIndex === "number") {
|
|
65
65
|
Option.fromNullable(items[activeItemIndex + 1]).match({
|
|
66
66
|
Some: item => onActiveIdChange(keyExtractor(item)),
|
package/src/components/Modal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, memo } from "react";
|
|
3
|
-
import { Modal as BaseModal, Pressable, ScrollView, StyleSheet,
|
|
3
|
+
import { Modal as BaseModal, Pressable, ScrollView, StyleSheet, View, } from "react-native";
|
|
4
4
|
import { backgroundColor, colors, radii } from "../constants/design";
|
|
5
5
|
import { useResponsive } from "../hooks/useResponsive";
|
|
6
6
|
import { Box } from "./Box";
|
|
@@ -19,6 +19,7 @@ const styles = StyleSheet.create({
|
|
|
19
19
|
},
|
|
20
20
|
outbox: {
|
|
21
21
|
margin: 16,
|
|
22
|
+
pointerEvents: "box-none",
|
|
22
23
|
flexGrow: 1,
|
|
23
24
|
flexShrink: 1,
|
|
24
25
|
},
|
|
@@ -59,22 +60,31 @@ const styles = StyleSheet.create({
|
|
|
59
60
|
paddingLeft: 40,
|
|
60
61
|
paddingVertical: 32,
|
|
61
62
|
},
|
|
62
|
-
|
|
63
|
+
dismissButton: {
|
|
63
64
|
padding: 20,
|
|
64
65
|
right: 0,
|
|
66
|
+
transitionProperty: "opacity",
|
|
67
|
+
transitionDuration: "150ms",
|
|
65
68
|
},
|
|
66
|
-
|
|
69
|
+
dismissButtonPressed: {
|
|
70
|
+
opacity: 0.5,
|
|
71
|
+
},
|
|
72
|
+
dismissButtonDesktop: {
|
|
67
73
|
marginVertical: 12,
|
|
68
74
|
marginRight: 20,
|
|
69
75
|
},
|
|
70
76
|
});
|
|
71
77
|
export const Modal = memo(forwardRef(({ children, onDismiss, title = "", style, visible = false, wrapContent = false }, forwardedRef) => {
|
|
72
78
|
const { desktop, media } = useResponsive();
|
|
73
|
-
return (_jsxs(BaseModal, { ref: forwardedRef, animationType: "fade", visible: visible, transparent: true, onDismiss: onDismiss, onRequestClose: onDismiss, children: [_jsx(Pressable, {
|
|
79
|
+
return (_jsxs(BaseModal, { ref: forwardedRef, animationType: "fade", visible: visible, transparent: true, onDismiss: onDismiss, onRequestClose: onDismiss, children: [_jsx(Pressable, { role: "none", tabIndex: -1, onPress: onDismiss, style: styles.blanket }), _jsx(View, { style: [styles.outbox, desktop && styles.desktopOutbox], children: _jsxs(View, { style: [
|
|
74
80
|
styles.modal,
|
|
75
81
|
desktop && styles.desktopModal,
|
|
76
82
|
wrapContent && styles.wrapped,
|
|
77
83
|
style,
|
|
78
|
-
], children: [_jsxs(Box, { direction: "row",
|
|
84
|
+
], children: [_jsxs(Box, { direction: "row", role: "banner", alignItems: "center", children: [title !== "" ? (_jsx(Heading, { size: media({ mobile: 20, desktop: 24 }), level: 2, style: [styles.title, desktop && styles.titleHeader], children: title })) : (_jsx(Fill, {})), onDismiss && (_jsx(Pressable, { role: "button", onPress: onDismiss, style: ({ pressed }) => [
|
|
85
|
+
styles.dismissButton,
|
|
86
|
+
desktop && styles.dismissButtonDesktop,
|
|
87
|
+
pressed && styles.dismissButtonPressed,
|
|
88
|
+
], children: _jsx(Icon, { name: "dismiss-filled", size: 18, color: colors.gray[500] }) }))] }), title !== "" && _jsx(Separator, {}), _jsx(ScrollView, { contentContainerStyle: desktop ? styles.contentDesktop : styles.content, children: children })] }) })] }));
|
|
79
89
|
}));
|
|
80
90
|
Modal.displayName = "Modal";
|
|
@@ -20,7 +20,7 @@ export type MultiSelectProps<I> = {
|
|
|
20
20
|
renderTagGroup?: (items: readonly MultiSelectItem[]) => string;
|
|
21
21
|
style?: StyleProp<ViewStyle>;
|
|
22
22
|
values: string[];
|
|
23
|
-
|
|
23
|
+
id?: string;
|
|
24
24
|
};
|
|
25
25
|
export declare const MultiSelect: (<I extends MultiSelectItem>(props: MultiSelectProps<I>) => JSX.Element | null) & {
|
|
26
26
|
displayName?: string | undefined;
|