@swan-io/lake 1.2.5 → 1.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 +1 -1
- package/src/components/Breadcrumbs.js +10 -10
- package/src/components/FilterChooser.js +1 -1
- package/src/components/FlowPresentation.js +1 -1
- package/src/components/FullViewportLayer.js +3 -3
- package/src/components/Icon.d.ts +2 -0
- package/src/components/LakeTextInput.d.ts +1 -1
- package/src/components/Link.d.ts +1 -1
- package/src/components/Link.js +2 -2
- package/src/components/ListRightPanel.d.ts +6 -0
- package/src/components/ListRightPanel.js +11 -8
- package/src/components/PlainListView.d.ts +4 -1
- package/src/components/PlainListView.js +58 -65
- 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 +3 -3
- package/src/components/Space.d.ts +1 -1
- package/src/components/TabView.d.ts +5 -3
- package/src/components/TabView.js +25 -18
- package/src/components/ToastStack.js +3 -3
- package/src/components/WithPartnerAccentColor.js +43 -70
- package/src/icons/fluent-icons.json +2 -0
- package/src/utils/types.d.ts +5 -0
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FocusTrap } from "
|
|
3
|
-
import { Icon } from "
|
|
4
|
-
import { LakeText } from "
|
|
5
|
-
import { Link } from "
|
|
6
|
-
import { Space } from "
|
|
7
|
-
import { TransitionView } from "
|
|
8
|
-
import { animations, backgroundColor, colors, gray75, radii, shadows, spacings, texts, } from "
|
|
9
|
-
import { useHover } from "
|
|
10
|
-
import { usePreviousValue } from "
|
|
11
|
-
import { isNotNullish, isNullish } from "
|
|
2
|
+
import { FocusTrap } from "./FocusTrap";
|
|
3
|
+
import { Icon } from "./Icon";
|
|
4
|
+
import { LakeText } from "./LakeText";
|
|
5
|
+
import { Link } from "./Link";
|
|
6
|
+
import { Space } from "./Space";
|
|
7
|
+
import { TransitionView } from "./TransitionView";
|
|
8
|
+
import { animations, backgroundColor, colors, gray75, radii, shadows, spacings, texts, } from "../constants/design";
|
|
9
|
+
import { useHover } from "../hooks/useHover";
|
|
10
|
+
import { usePreviousValue } from "../hooks/usePreviousValue";
|
|
11
|
+
import { isNotNullish, isNullish } from "../utils/nullish";
|
|
12
12
|
import { createContext, useCallback, useContext, useEffect, useMemo, useReducer, useRef, useState, } from "react";
|
|
13
13
|
import { Pressable, StyleSheet, Text, View, } from "react-native";
|
|
14
14
|
import { match, P } from "ts-pattern";
|
|
@@ -64,7 +64,7 @@ export const FlowPresentation = ({ steps, mode }) => {
|
|
|
64
64
|
}) })))
|
|
65
65
|
.with("mobile", () => (_jsx(Box, { direction: "column", children: steps.map(({ label }, index) => {
|
|
66
66
|
const isLast = index === steps.length - 1;
|
|
67
|
-
return (_jsxs(Fragment, { children: [_jsxs(Box, { direction: "row", children: [_jsx(Box, { alignItems: "center", justifyContent: "center", style: styles.mobileNumber, children: _jsx(LakeText, { color: colors.current.primary, variant: "medium", style: styles.mobileNumberText, children: index + 1 }) }), _jsx(Space, { width: 12 }), _jsx(LakeText, { color: colors.gray[400], variant: "smallRegular", children: label })] }), !isLast && (_jsx(Box, { alignItems: "center", style: styles.mobileBarContainer, children: _jsx(View, { style: styles.mobileBar }) }))] }, index));
|
|
67
|
+
return (_jsxs(Fragment, { children: [_jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(Box, { alignItems: "center", justifyContent: "center", style: styles.mobileNumber, children: _jsx(LakeText, { color: colors.current.primary, variant: "medium", style: styles.mobileNumberText, children: index + 1 }) }), _jsx(Space, { width: 12 }), _jsx(LakeText, { color: colors.gray[400], variant: "smallRegular", children: label })] }), !isLast && (_jsx(Box, { alignItems: "center", style: styles.mobileBarContainer, children: _jsx(View, { style: styles.mobileBar }) }))] }, index));
|
|
68
68
|
}) })))
|
|
69
69
|
.exhaustive();
|
|
70
70
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FocusTrap } from "
|
|
3
|
-
import { TransitionView } from "
|
|
4
|
-
import { backgroundColor } from "
|
|
2
|
+
import { FocusTrap } from "./FocusTrap";
|
|
3
|
+
import { TransitionView } from "./TransitionView";
|
|
4
|
+
import { backgroundColor } from "../constants/design";
|
|
5
5
|
import { Suspense, useEffect, useState } from "react";
|
|
6
6
|
import { StyleSheet, View } from "react-native";
|
|
7
7
|
import { LoadingView } from "./LoadingView";
|
package/src/components/Icon.d.ts
CHANGED
|
@@ -157,6 +157,8 @@ declare const paths: {
|
|
|
157
157
|
"play-regular": string;
|
|
158
158
|
"preview-link-filled": string;
|
|
159
159
|
"question-circle-regular": string;
|
|
160
|
+
"receipt-money-filled": string;
|
|
161
|
+
"receipt-money-regular": string;
|
|
160
162
|
"rocket-regular": string;
|
|
161
163
|
"search-filled": string;
|
|
162
164
|
"send-filled": string;
|
|
@@ -27,7 +27,7 @@ export declare const LakeTextInput: import("react").ForwardRefExoticComponent<Om
|
|
|
27
27
|
disabled?: boolean | undefined;
|
|
28
28
|
color?: "warning" | "current" | "gray" | "live" | "sandbox" | "positive" | "negative" | "partner" | "swan" | "shakespear" | "darkPink" | "sunglow" | "mediumSladeBlue" | undefined;
|
|
29
29
|
multiline?: boolean | undefined;
|
|
30
|
-
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" | "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;
|
|
30
|
+
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;
|
|
31
31
|
unit?: string | undefined;
|
|
32
32
|
keyboardType?: TextInputProps["keyboardType"];
|
|
33
33
|
pattern?: string | undefined;
|
package/src/components/Link.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { PressableTextProps } from "
|
|
2
|
+
import { PressableTextProps } from "./Pressable";
|
|
3
3
|
import { HrefAttrs, PressableStateCallbackType, Text, TextProps } from "react-native";
|
|
4
4
|
import { Except } from "type-fest";
|
|
5
5
|
export type LinkProps = Except<PressableTextProps, "hrefAttrs" | "style" | "onPress" | "children"> & {
|
package/src/components/Link.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useLinkProps } from "@swan-io/chicane";
|
|
3
|
-
import { PressableText } from "
|
|
4
|
-
import { isNotNullish } from "
|
|
3
|
+
import { PressableText } from "./Pressable";
|
|
4
|
+
import { isNotNullish } from "../utils/nullish";
|
|
5
5
|
import { forwardRef, memo } from "react";
|
|
6
6
|
export const Link = memo(forwardRef(({ accessibilityRole = "link", children, disabled = false, onPress, replace = false, download = false, style, target, to, ariaCurrentValue = "page", focusable, ...props }, forwardedRef) => {
|
|
7
7
|
const { active, onClick } = useLinkProps({ href: to, replace, target });
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { MutableRefObject } from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
2
3
|
import { FocusTrapRef } from "./FocusTrap";
|
|
4
|
+
export declare const ListRightPanelContent: ({ children, large, style, }: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
large: boolean;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}) => JSX.Element;
|
|
3
9
|
type Props<T> = {
|
|
4
10
|
items: T[];
|
|
5
11
|
keyExtractor: (item: T) => string;
|
|
@@ -14,23 +14,26 @@ import { Space } from "./Space";
|
|
|
14
14
|
import { TransitionView } from "./TransitionView";
|
|
15
15
|
const styles = StyleSheet.create({
|
|
16
16
|
details: {
|
|
17
|
-
|
|
17
|
+
paddingBottom: spacings[24],
|
|
18
18
|
paddingTop: spacings[12],
|
|
19
19
|
flexGrow: 1,
|
|
20
20
|
},
|
|
21
|
-
detailsLarge: {
|
|
22
|
-
paddingVertical: spacings[24],
|
|
23
|
-
paddingTop: spacings[12],
|
|
24
|
-
paddingHorizontal: spacings[40],
|
|
25
|
-
flexGrow: 1,
|
|
26
|
-
},
|
|
27
21
|
detailsContents: {
|
|
28
22
|
...StyleSheet.absoluteFillObject,
|
|
29
23
|
},
|
|
30
24
|
detailsContainer: {
|
|
31
25
|
flexGrow: 1,
|
|
32
26
|
},
|
|
27
|
+
content: {
|
|
28
|
+
paddingHorizontal: spacings[24],
|
|
29
|
+
},
|
|
30
|
+
contentLarge: {
|
|
31
|
+
paddingHorizontal: spacings[40],
|
|
32
|
+
},
|
|
33
33
|
});
|
|
34
|
+
export const ListRightPanelContent = ({ children, large, style, }) => {
|
|
35
|
+
return _jsx(View, { style: [large ? styles.contentLarge : styles.content, style], children: children });
|
|
36
|
+
};
|
|
34
37
|
const ListRightPanel_ = forwardRef(({ items, keyExtractor, activeId, onActiveIdChange, onClose, render, closeLabel, previousLabel, nextLabel, }, ref) => {
|
|
35
38
|
const activeItem = items.find(item => keyExtractor(item) === activeId);
|
|
36
39
|
// use `Array.getIndexBy` instead of `Array.findIndex` to avoid -1 value
|
|
@@ -50,7 +53,7 @@ const ListRightPanel_ = forwardRef(({ items, keyExtractor, activeId, onActiveIdC
|
|
|
50
53
|
.when(({ activeItemIndex, previousIndex }) => activeItemIndex > previousIndex, () => animations.fadeAndSlideInFromTop)
|
|
51
54
|
.otherwise(() => null)
|
|
52
55
|
: null;
|
|
53
|
-
return (_jsx(RightPanel, { ref: ref, visible: activeItem != null, onPressClose: onClose, children: ({ large }) => (_jsxs(View, { style:
|
|
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", accessibilityLabel: closeLabel, onPress: onClose }), _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", children: [_jsx(LakeButton, { mode: "tertiary", accessibilityLabel: previousLabel, icon: "arrow-left-regular", disabled: activeItemIndex === 0, onPress: () => {
|
|
54
57
|
if (typeof activeItemIndex === "number") {
|
|
55
58
|
Option.fromNullable(items[activeItemIndex - 1]).match({
|
|
56
59
|
Some: item => onActiveIdChange(keyExtractor(item)),
|
|
@@ -31,6 +31,9 @@ type Props<T, ExtraInfo> = {
|
|
|
31
31
|
isLoading: boolean;
|
|
32
32
|
count: number;
|
|
33
33
|
};
|
|
34
|
+
breakpoint?: number;
|
|
35
|
+
withoutScroll?: boolean;
|
|
36
|
+
stickyOffset?: number;
|
|
34
37
|
};
|
|
35
|
-
export declare const PlainListView: <T, ExtraInfo>({ data: originalData, keyExtractor, rowHeight, groupHeaderHeight, headerHeight, columns, smallColumns, extraInfo, onEndReached, onEndReachedThresholdPx, getRowLink, activeRowId, renderEmptyList, onActiveRowChange, groupBy, loading, }: Props<T, ExtraInfo>) => JSX.Element;
|
|
38
|
+
export declare const PlainListView: <T, ExtraInfo>({ data: originalData, keyExtractor, rowHeight, groupHeaderHeight, headerHeight, columns, smallColumns, extraInfo, onEndReached, onEndReachedThresholdPx, getRowLink, activeRowId, renderEmptyList, onActiveRowChange, groupBy, loading, breakpoint, withoutScroll, stickyOffset, }: Props<T, ExtraInfo>) => JSX.Element;
|
|
36
39
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { cloneElement, Fragment, useCallback, useEffect, useId, useMemo, useRef, useState, } from "react";
|
|
3
|
-
import { ScrollView, StyleSheet, View
|
|
3
|
+
import { ScrollView, StyleSheet, View } from "react-native";
|
|
4
4
|
import { backgroundColor, breakpoints, colors, spacings } from "../constants/design";
|
|
5
5
|
import { useHover } from "../hooks/useHover";
|
|
6
6
|
import { isNotNullish, isNullish } from "../utils/nullish";
|
|
7
7
|
import { PlainListViewPlaceholder, } from "./FixedListView";
|
|
8
8
|
import { LakeHeading } from "./LakeHeading";
|
|
9
9
|
import { ResponsiveContainer } from "./ResponsiveContainer";
|
|
10
|
+
import { commonStyles } from "../constants/commonStyles";
|
|
10
11
|
const INHERIT = "inherit";
|
|
11
12
|
const styles = StyleSheet.create({
|
|
12
13
|
root: {
|
|
@@ -15,11 +16,6 @@ const styles = StyleSheet.create({
|
|
|
15
16
|
flexGrow: 1,
|
|
16
17
|
backgroundColor: backgroundColor.default,
|
|
17
18
|
},
|
|
18
|
-
container: {
|
|
19
|
-
height: 1,
|
|
20
|
-
alignSelf: "stretch",
|
|
21
|
-
flexGrow: 1,
|
|
22
|
-
},
|
|
23
19
|
contentContainer: {
|
|
24
20
|
flexDirection: "column",
|
|
25
21
|
alignItems: "stretch",
|
|
@@ -50,7 +46,6 @@ const styles = StyleSheet.create({
|
|
|
50
46
|
},
|
|
51
47
|
stickyHeader: {
|
|
52
48
|
position: "sticky",
|
|
53
|
-
top: 0,
|
|
54
49
|
backgroundColor: backgroundColor.default90Transparency,
|
|
55
50
|
backdropFilter: "blur(4px)",
|
|
56
51
|
zIndex: 10,
|
|
@@ -72,17 +67,19 @@ const styles = StyleSheet.create({
|
|
|
72
67
|
textDecorationLine: "none",
|
|
73
68
|
},
|
|
74
69
|
emptyListContainer: {
|
|
75
|
-
|
|
76
|
-
top: 0,
|
|
77
|
-
left: 0,
|
|
78
|
-
right: 0,
|
|
79
|
-
bottom: 0,
|
|
70
|
+
...commonStyles.fill,
|
|
80
71
|
flexDirection: "column",
|
|
81
72
|
alignItems: "center",
|
|
82
73
|
justifyContent: "center",
|
|
83
74
|
padding: spacings[48],
|
|
84
75
|
backgroundColor: backgroundColor.default,
|
|
85
76
|
},
|
|
77
|
+
scrollTracker: {
|
|
78
|
+
position: "absolute",
|
|
79
|
+
left: 0,
|
|
80
|
+
bottom: 0,
|
|
81
|
+
right: 0,
|
|
82
|
+
},
|
|
86
83
|
});
|
|
87
84
|
const ONE = 1;
|
|
88
85
|
const ZERO = 0;
|
|
@@ -107,8 +104,9 @@ const Row = ({ id, item, index, rowHeight, columns, extraInfo, isActive, isHover
|
|
|
107
104
|
},
|
|
108
105
|
], nativeID: columnId, children: renderCell({ columnId, item, index, extraInfo, isHovered }) }, columnId))) }));
|
|
109
106
|
};
|
|
110
|
-
export const PlainListView = ({ data: originalData, keyExtractor, rowHeight, groupHeaderHeight, headerHeight, columns, smallColumns = columns, extraInfo, onEndReached, onEndReachedThresholdPx = 200, getRowLink, activeRowId, renderEmptyList, onActiveRowChange, groupBy, loading, }) => {
|
|
107
|
+
export const PlainListView = ({ data: originalData, keyExtractor, rowHeight, groupHeaderHeight, headerHeight, columns, smallColumns = columns, extraInfo, onEndReached, onEndReachedThresholdPx = 200, getRowLink, activeRowId, renderEmptyList, onActiveRowChange, groupBy, loading, breakpoint = breakpoints.large, withoutScroll = false, stickyOffset = 0, }) => {
|
|
111
108
|
const viewId = useId();
|
|
109
|
+
const scrollTrackerRef = useRef(null);
|
|
112
110
|
const groups = useMemo(() => {
|
|
113
111
|
if (groupBy == null) {
|
|
114
112
|
return new Map([[null, originalData]]);
|
|
@@ -122,40 +120,28 @@ export const PlainListView = ({ data: originalData, keyExtractor, rowHeight, gro
|
|
|
122
120
|
}, [groupBy, originalData]);
|
|
123
121
|
const totalHeight = rowHeight * originalData.length + groups.size * groupHeaderHeight;
|
|
124
122
|
const isLoading = isNotNullish(loading) && loading.isLoading;
|
|
125
|
-
const
|
|
126
|
-
const lastKnownHeight = useRef(0);
|
|
123
|
+
const isEmpty = originalData.length === 0;
|
|
127
124
|
const [hoveredRow, setHoveredRow] = useState(undefined);
|
|
128
125
|
const removeHoveredRow = useCallback(() => {
|
|
129
126
|
setHoveredRow(undefined);
|
|
130
127
|
}, []);
|
|
131
|
-
const onLayout = useCallback(({ nativeEvent: { layout: { height }, }, }) => {
|
|
132
|
-
lastKnownHeight.current = height;
|
|
133
|
-
if (isNotNullish(onEndReached) &&
|
|
134
|
-
!hasEndReachedBeenCalled.current &&
|
|
135
|
-
height >= totalHeight - onEndReachedThresholdPx) {
|
|
136
|
-
hasEndReachedBeenCalled.current = true;
|
|
137
|
-
onEndReached();
|
|
138
|
-
}
|
|
139
|
-
}, [onEndReached, onEndReachedThresholdPx, totalHeight]);
|
|
140
128
|
useEffect(() => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
hasEndReachedBeenCalled.current = true;
|
|
156
|
-
onEndReached();
|
|
129
|
+
const scrollTracker = scrollTrackerRef.current;
|
|
130
|
+
if (scrollTracker != null) {
|
|
131
|
+
const scrollTrackerElement = scrollTracker;
|
|
132
|
+
const intersectionObserver = new IntersectionObserver(entries => {
|
|
133
|
+
entries.forEach(entry => {
|
|
134
|
+
if (entry.isIntersecting) {
|
|
135
|
+
if (isNotNullish(onEndReached)) {
|
|
136
|
+
onEndReached();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
intersectionObserver.observe(scrollTrackerElement);
|
|
142
|
+
return () => intersectionObserver.unobserve(scrollTrackerElement);
|
|
157
143
|
}
|
|
158
|
-
}, [onEndReached
|
|
144
|
+
}, [onEndReached]);
|
|
159
145
|
const createRowWrapper = useCallback(({ item, absoluteIndex, extraInfo, }) => {
|
|
160
146
|
const customLinkElement = getRowLink?.({ item, index: absoluteIndex, extraInfo });
|
|
161
147
|
return isNullish(customLinkElement) ? _jsx(View, {}) : customLinkElement;
|
|
@@ -169,7 +155,13 @@ export const PlainListView = ({ data: originalData, keyExtractor, rowHeight, gro
|
|
|
169
155
|
onActiveRowChange?.(element);
|
|
170
156
|
}
|
|
171
157
|
}, [activeRowId, onActiveRowChange]);
|
|
172
|
-
|
|
158
|
+
const listWrapper = useMemo(() => withoutScroll ? (_jsx(View, { style: styles.contentContainer })) : (_jsx(ScrollView, { scrollEventThrottle: 32, contentContainerStyle: [
|
|
159
|
+
styles.contentContainer,
|
|
160
|
+
{
|
|
161
|
+
minHeight: totalHeight + (isLoading ? loading.count * rowHeight : 0),
|
|
162
|
+
},
|
|
163
|
+
] })), [isLoading, loading?.count, rowHeight, totalHeight, withoutScroll]);
|
|
164
|
+
return (_jsx(ResponsiveContainer, { style: withoutScroll ? (isEmpty ? commonStyles.fill : undefined) : styles.root, breakpoint: breakpoint, children: ({ large }) => {
|
|
173
165
|
const displayColumns = large ? columns : smallColumns;
|
|
174
166
|
return (_jsxs(_Fragment, { children: [large ? (_jsx(View, { style: [styles.segment, large && styles.segmentLarge], children: displayColumns.map(({ id, width, title, renderTitle }) => {
|
|
175
167
|
const columnId = `${viewId}_${id}`;
|
|
@@ -181,28 +173,29 @@ export const PlainListView = ({ data: originalData, keyExtractor, rowHeight, gro
|
|
|
181
173
|
height: headerHeight,
|
|
182
174
|
},
|
|
183
175
|
], nativeID: columnId, children: renderTitle({ title, extraInfo, id }) }, columnId));
|
|
184
|
-
}) })) : null,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
176
|
+
}) })) : null, cloneElement(listWrapper, {
|
|
177
|
+
children: (_jsxs(_Fragment, { children: [Array.from(groups.entries()).map(([groupName, items]) => {
|
|
178
|
+
return (_jsxs(Fragment, { children: [groupName != null ? (_jsx(View, { style: [
|
|
179
|
+
styles.stickyHeader,
|
|
180
|
+
large && styles.stickyHeaderLarge,
|
|
181
|
+
{ height: groupHeaderHeight, top: stickyOffset },
|
|
182
|
+
], children: _jsx(LakeHeading, { level: 3, variant: "h3", children: groupName }) })) : null, items.map((item, index) => {
|
|
183
|
+
const key = keyExtractor(item, index);
|
|
184
|
+
const isActive = activeRowId === key;
|
|
185
|
+
const isHovered = isNotNullish(getRowLink) && hoveredRow === key;
|
|
186
|
+
const wrapper = createRowWrapper({
|
|
187
|
+
item,
|
|
188
|
+
absoluteIndex: index,
|
|
189
|
+
extraInfo,
|
|
190
|
+
});
|
|
191
|
+
return cloneElement(wrapper, {
|
|
192
|
+
style: { ...styles.rowLink, ...wrapper.props.style },
|
|
193
|
+
key: index,
|
|
194
|
+
ref: isActive ? activeItemRef : null,
|
|
195
|
+
children: (_jsx(Row, { id: key, rowHeight: rowHeight, columns: displayColumns, item: item, index: index, extraInfo: extraInfo, isActive: isActive, isHovered: isHovered, large: large, onMouseEnter: setHoveredRow, onMouseLeave: removeHoveredRow })),
|
|
196
|
+
});
|
|
197
|
+
})] }, groupName));
|
|
198
|
+
}), _jsx(View, { children: _jsx(View, { accessibilityBusy: isLoading, style: styles.loadingPlaceholder, children: isLoading ? (_jsx(PlainListViewPlaceholder, { count: loading.count, rowHeight: rowHeight, rowVerticalSpacing: 0, paddingHorizontal: 0 })) : null }) }), isEmpty && isNotNullish(renderEmptyList) && !isLoading ? (_jsx(View, { style: styles.emptyListContainer, children: renderEmptyList() })) : null, _jsx(View, { pointerEvents: "none", style: [styles.scrollTracker, { height: onEndReachedThresholdPx }], ref: scrollTrackerRef })] })),
|
|
199
|
+
})] }));
|
|
207
200
|
} }));
|
|
208
201
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Separator } from "
|
|
3
|
-
import { isNotNullish } from "
|
|
2
|
+
import { Separator } from "./Separator";
|
|
3
|
+
import { isNotNullish } from "../utils/nullish";
|
|
4
4
|
import { Children } from "react";
|
|
5
5
|
import { View } from "react-native";
|
|
6
6
|
export const ReadOnlyFieldList = ({ children }) => (_jsx(_Fragment, { children: Children.toArray(children)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FocusTrap } from "
|
|
3
|
-
import { TransitionView } from "
|
|
4
|
-
import { backgroundColor, breakpoints } from "
|
|
2
|
+
import { FocusTrap } from "./FocusTrap";
|
|
3
|
+
import { TransitionView } from "./TransitionView";
|
|
4
|
+
import { backgroundColor, breakpoints } from "../constants/design";
|
|
5
5
|
import { forwardRef, Suspense, useEffect, useState } from "react";
|
|
6
6
|
import { StyleSheet, View } from "react-native";
|
|
7
7
|
import { useBodyClassName } from "../hooks/useBodyClassName";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const spacingValues: readonly [4, 8, 12, 16, 20, 24, 32, 40, 48, 72, 96];
|
|
3
|
-
export type SpacingValue =
|
|
3
|
+
export type SpacingValue = typeof spacingValues[number];
|
|
4
4
|
type Props = {
|
|
5
5
|
height?: SpacingValue;
|
|
6
6
|
width?: SpacingValue;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IconName } from "
|
|
3
|
-
import { SpacingValue } from "
|
|
2
|
+
import { IconName } from "./Icon";
|
|
3
|
+
import { SpacingValue } from "./Space";
|
|
4
|
+
export declare const tabsViewHeight: number;
|
|
4
5
|
type Tab = {
|
|
5
6
|
label: string;
|
|
6
7
|
url: string;
|
|
@@ -13,6 +14,7 @@ type Props = {
|
|
|
13
14
|
otherLabel: string;
|
|
14
15
|
hideIfSingleItem?: boolean;
|
|
15
16
|
padding?: SpacingValue;
|
|
17
|
+
sticky?: boolean;
|
|
16
18
|
};
|
|
17
|
-
export declare const TabView: ({ tabs, otherLabel, hideIfSingleItem, padding }: Props) => JSX.Element | null;
|
|
19
|
+
export declare const TabView: ({ tabs, otherLabel, hideIfSingleItem, sticky, padding, }: Props) => JSX.Element | null;
|
|
18
20
|
export {};
|
|
@@ -1,39 +1,42 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useLocation } from "@swan-io/chicane";
|
|
3
|
-
import { Box } from "
|
|
4
|
-
import { FocusTrap } from "
|
|
5
|
-
import { Icon } from "
|
|
6
|
-
import { LakeText } from "
|
|
7
|
-
import { Link } from "
|
|
8
|
-
import { PressableText } from "
|
|
9
|
-
import { Space } from "
|
|
10
|
-
import { TransitionView } from "
|
|
11
|
-
import { animations, backgroundColor, colors, negativeSpacings, radii, shadows, spacings, texts, } from "
|
|
12
|
-
import { useHover } from "
|
|
13
|
-
import { useMergeRefs } from "
|
|
14
|
-
import { isNotNullish, isNullish } from "
|
|
3
|
+
import { Box } from "./Box";
|
|
4
|
+
import { FocusTrap } from "./FocusTrap";
|
|
5
|
+
import { Icon } from "./Icon";
|
|
6
|
+
import { LakeText } from "./LakeText";
|
|
7
|
+
import { Link } from "./Link";
|
|
8
|
+
import { PressableText } from "./Pressable";
|
|
9
|
+
import { Space } from "./Space";
|
|
10
|
+
import { TransitionView } from "./TransitionView";
|
|
11
|
+
import { animations, backgroundColor, colors, negativeSpacings, radii, shadows, spacings, texts, } from "../constants/design";
|
|
12
|
+
import { useHover } from "../hooks/useHover";
|
|
13
|
+
import { useMergeRefs } from "../hooks/useMergeRefs";
|
|
14
|
+
import { isNotNullish, isNullish } from "../utils/nullish";
|
|
15
15
|
import { forwardRef, Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, } from "react";
|
|
16
16
|
import { StyleSheet, Text, View } from "react-native";
|
|
17
17
|
import { match, P } from "ts-pattern";
|
|
18
18
|
import { noop } from "../utils/function";
|
|
19
|
+
const TABS_HEIGHT = 40;
|
|
20
|
+
export const tabsViewHeight = TABS_HEIGHT + 1;
|
|
19
21
|
const styles = StyleSheet.create({
|
|
20
22
|
container: {
|
|
21
23
|
borderBottomWidth: 1,
|
|
22
24
|
borderBottomColor: colors.gray[100],
|
|
25
|
+
backgroundColor: backgroundColor.default,
|
|
23
26
|
zIndex: 10,
|
|
24
27
|
},
|
|
25
28
|
link: {
|
|
26
29
|
...texts.medium,
|
|
27
30
|
position: "relative",
|
|
28
31
|
color: colors.gray[700],
|
|
29
|
-
height:
|
|
32
|
+
height: TABS_HEIGHT,
|
|
30
33
|
whiteSpace: "nowrap",
|
|
31
34
|
display: "flex",
|
|
32
35
|
flexDirection: "row",
|
|
33
36
|
alignItems: "center",
|
|
34
37
|
},
|
|
35
38
|
activeLink: {
|
|
36
|
-
color: colors.current
|
|
39
|
+
color: colors.current[500],
|
|
37
40
|
boxShadow: `inset 0 -2px ${colors.gray[700]}`,
|
|
38
41
|
},
|
|
39
42
|
hoveredLink: {
|
|
@@ -44,7 +47,7 @@ const styles = StyleSheet.create({
|
|
|
44
47
|
bottom: 0,
|
|
45
48
|
height: 2,
|
|
46
49
|
width: 1,
|
|
47
|
-
backgroundColor: colors.current
|
|
50
|
+
backgroundColor: colors.current[500],
|
|
48
51
|
},
|
|
49
52
|
animatedUnderline: {
|
|
50
53
|
transformOrigin: "0 0",
|
|
@@ -62,7 +65,7 @@ const styles = StyleSheet.create({
|
|
|
62
65
|
},
|
|
63
66
|
count: {
|
|
64
67
|
...texts.smallRegular,
|
|
65
|
-
color: colors.current
|
|
68
|
+
color: colors.current[500],
|
|
66
69
|
backgroundColor: colors.current[50],
|
|
67
70
|
borderColor: colors.current[100],
|
|
68
71
|
borderWidth: 1,
|
|
@@ -112,6 +115,10 @@ const styles = StyleSheet.create({
|
|
|
112
115
|
width: 1,
|
|
113
116
|
backgroundColor: colors.gray[100],
|
|
114
117
|
},
|
|
118
|
+
sticky: {
|
|
119
|
+
position: "sticky",
|
|
120
|
+
top: -1,
|
|
121
|
+
},
|
|
115
122
|
});
|
|
116
123
|
const Dropdown = ({ tabs, onHoverStart, onHoverEnd, onLinkFocus, onLinkBlur, onLinkPress, }) => {
|
|
117
124
|
const containerRef = useRef(null);
|
|
@@ -249,7 +256,7 @@ const DropdownItems = forwardRef(({ tabs, otherLabel, currentUrl }, ref) => {
|
|
|
249
256
|
isNotNullish(activeTab) ? styles.activeLink : hovered ? styles.hoveredLink : null,
|
|
250
257
|
], children: [_jsx(Text, { children: otherLabel }), _jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: tabs.length }), _jsx(Space, { width: 4 }), _jsx(Icon, { name: "chevron-down-filled", size: 12 })] }), _jsx(TransitionView, { ...animations.fadeAndSlideInFromBottom, style: styles.dropdownPlacement, children: shouldOpen ? (_jsx(FocusTrap, { autoFocus: shouldAutoFocus, focusLock: shouldLockFocus, returnFocus: shouldLockFocus, onClickOutside: onPressOutside, onEscapeKey: shouldLockFocus ? onEscapeKey : undefined, children: _jsx(Dropdown, { tabs: tabs, onHoverStart: onHoverStart, onHoverEnd: onHoverEnd, onLinkFocus: onLinkFocus, onLinkBlur: onAnyBlur, onLinkPress: onEscapeKey }) })) : null })] }));
|
|
251
258
|
});
|
|
252
|
-
export const TabView = ({ tabs, otherLabel, hideIfSingleItem = true, padding }) => {
|
|
259
|
+
export const TabView = ({ tabs, otherLabel, hideIfSingleItem = true, sticky = false, padding, }) => {
|
|
253
260
|
const containerRef = useRef(null);
|
|
254
261
|
const placeholderRef = useRef(null);
|
|
255
262
|
const otherPlaceholderRef = useRef(null);
|
|
@@ -371,7 +378,7 @@ export const TabView = ({ tabs, otherLabel, hideIfSingleItem = true, padding })
|
|
|
371
378
|
if (tabs.length <= 1 && hideIfSingleItem) {
|
|
372
379
|
return null;
|
|
373
380
|
}
|
|
374
|
-
return (_jsxs(Box, { alignItems: "center", direction: "row", accessibilityRole: "tablist", ref: containerRef, style: [styles.container, { paddingHorizontal: padding }], children: [_jsxs(View, { style: styles.placeholder, accessibilityHidden: true, ref: placeholderRef, pointerEvents: "none", onLayout: onLayout, children: [tabs.map(({ label, url, icon, count }) => (_jsxs(Fragment, { children: [_jsxs(Link, { ref: ref => {
|
|
381
|
+
return (_jsxs(Box, { alignItems: "center", direction: "row", accessibilityRole: "tablist", ref: containerRef, style: [styles.container, sticky && styles.sticky, { paddingHorizontal: padding }], children: [_jsxs(View, { style: styles.placeholder, accessibilityHidden: true, ref: placeholderRef, pointerEvents: "none", onLayout: onLayout, children: [tabs.map(({ label, url, icon, count }) => (_jsxs(Fragment, { children: [_jsxs(Link, { ref: ref => {
|
|
375
382
|
if (placeholderLinkRef.current) {
|
|
376
383
|
placeholderLinkRef.current[url] = ref;
|
|
377
384
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Box } from "
|
|
3
|
-
import { Portal } from "
|
|
4
|
-
import { animations, colors, shadows } from "
|
|
2
|
+
import { Box } from "./Box";
|
|
3
|
+
import { Portal } from "./Portal";
|
|
4
|
+
import { animations, colors, shadows } from "../constants/design";
|
|
5
5
|
import { memo, useEffect, useState } from "react";
|
|
6
6
|
import { Animated, StyleSheet, View } from "react-native";
|
|
7
7
|
import { match } from "ts-pattern";
|
|
@@ -1,90 +1,63 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { darken, getLuminance, meetsContrastGuidelines, shade, tint } from "polished";
|
|
2
|
+
import { darken, meetsContrastGuidelines, setLightness, shade } from "polished";
|
|
4
3
|
import { useLayoutEffect, useRef } from "react";
|
|
5
4
|
import { StyleSheet, View } from "react-native";
|
|
6
|
-
import { match, P } from "ts-pattern";
|
|
7
5
|
import { isNotNullish } from "../utils/nullish";
|
|
8
|
-
const colorScaleItems = [900, 800, 700, 600, 500, 400, 300, 200, 100, 50, 0];
|
|
9
6
|
const styles = StyleSheet.create({
|
|
10
7
|
container: {
|
|
11
8
|
flexGrow: 1,
|
|
12
9
|
flexBasis: "0%",
|
|
13
10
|
},
|
|
14
11
|
});
|
|
15
|
-
const getContrastColor = (color
|
|
16
|
-
if (
|
|
12
|
+
const getContrastColor = (color) => {
|
|
13
|
+
if (meetsContrastGuidelines("#FFF", color).AALarge) {
|
|
17
14
|
return "#fff";
|
|
18
15
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return text;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
return darken(delta, color);
|
|
16
|
+
let text = color;
|
|
17
|
+
while (!meetsContrastGuidelines(text, color).AALarge) {
|
|
18
|
+
text = darken(0.25, text);
|
|
26
19
|
}
|
|
20
|
+
return text;
|
|
27
21
|
};
|
|
28
22
|
export const WithPartnerAccentColor = ({ color, children }) => {
|
|
29
23
|
const containerRef = useRef(null);
|
|
30
24
|
useLayoutEffect(() => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
contrast: getContrastColor(color, luminance),
|
|
68
|
-
secondary: shade(0.2, color),
|
|
69
|
-
};
|
|
70
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-900", colorScale[900], "");
|
|
71
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-800", colorScale[800], "");
|
|
72
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-700", colorScale[700], "");
|
|
73
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-600", colorScale[600], "");
|
|
74
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-500", colorScale[500], "");
|
|
75
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-400", colorScale[400], "");
|
|
76
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-300", colorScale[300], "");
|
|
77
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-200", colorScale[200], "");
|
|
78
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-100", colorScale[100], "");
|
|
79
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-50", colorScale[50], "");
|
|
80
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-primary", colorScale.primary, "");
|
|
81
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-secondary", colorScale.secondary, "");
|
|
82
|
-
element.ownerDocument.documentElement.style.setProperty("--color-partner-contrast", colorScale.contrast, "");
|
|
83
|
-
},
|
|
84
|
-
Error: () => {
|
|
85
|
-
// Do nothing, keep partner color
|
|
86
|
-
},
|
|
87
|
-
});
|
|
25
|
+
try {
|
|
26
|
+
if (isNotNullish(containerRef.current)) {
|
|
27
|
+
const element = containerRef.current;
|
|
28
|
+
const colorScale = {
|
|
29
|
+
0: setLightness(1.0, color),
|
|
30
|
+
50: setLightness(0.97, color),
|
|
31
|
+
100: setLightness(0.9, color),
|
|
32
|
+
200: setLightness(0.8, color),
|
|
33
|
+
300: setLightness(0.7, color),
|
|
34
|
+
400: setLightness(0.6, color),
|
|
35
|
+
500: setLightness(0.5, color),
|
|
36
|
+
600: setLightness(0.4, color),
|
|
37
|
+
700: setLightness(0.3, color),
|
|
38
|
+
800: setLightness(0.2, color),
|
|
39
|
+
900: setLightness(0.1, color),
|
|
40
|
+
primary: color,
|
|
41
|
+
contrast: getContrastColor(color),
|
|
42
|
+
secondary: shade(0.2, color),
|
|
43
|
+
};
|
|
44
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-900", colorScale[900], "");
|
|
45
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-800", colorScale[800], "");
|
|
46
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-700", colorScale[700], "");
|
|
47
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-600", colorScale[600], "");
|
|
48
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-500", colorScale[500], "");
|
|
49
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-400", colorScale[400], "");
|
|
50
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-300", colorScale[300], "");
|
|
51
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-200", colorScale[200], "");
|
|
52
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-100", colorScale[100], "");
|
|
53
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-50", colorScale[50], "");
|
|
54
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-primary", colorScale.primary, "");
|
|
55
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-secondary", colorScale.secondary, "");
|
|
56
|
+
element.ownerDocument.documentElement.style.setProperty("--color-partner-contrast", colorScale.contrast, "");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
// will default to white label color
|
|
88
61
|
}
|
|
89
62
|
}, [color]);
|
|
90
63
|
return (_jsx(View, { ref: containerRef, style: styles.container, children: children }));
|
|
@@ -123,6 +123,8 @@
|
|
|
123
123
|
"play-regular": "M7.6 4.61a.75.75 0 0 0-1.1.66v13.46c0 .56.6.93 1.1.65l12.37-6.72a.75.75 0 0 0 0-1.32L7.61 4.61ZM5 5.27c0-1.7 1.83-2.79 3.33-1.97l12.36 6.72a2.25 2.25 0 0 1 0 3.96L8.33 20.7A2.25 2.25 0 0 1 5 18.73V5.27Z",
|
|
124
124
|
"preview-link-filled": "M6.02 7v2h11.96V7H6.02Zm8.96 6.48v3h3v-3h-3ZM2 5.75A2.75 2.75 0 0 1 4.75 3h14.5A2.75 2.75 0 0 1 22 5.75v12.5A2.75 2.75 0 0 1 19.25 21H4.75A2.75 2.75 0 0 1 2 18.25V5.75Zm2.52.5v3.5c0 .41.34.75.75.75h13.46c.41 0 .75-.34.75-.75v-3.5a.75.75 0 0 0-.75-.75H5.27a.75.75 0 0 0-.75.75Zm8.96 6.48v4.5c0 .41.34.75.75.75h4.5c.41 0 .75-.34.75-.75v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0-.75.75Zm-8.2-.23a.75.75 0 0 0 0 1.5h5.97a.75.75 0 0 0 0-1.5H5.27Zm-.76 4.25c0 .41.34.75.75.75h5.98a.75.75 0 0 0 0-1.5H5.27a.75.75 0 0 0-.75.75Z",
|
|
125
125
|
"question-circle-regular": "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm0 1.67a8.34 8.34 0 0 0 0 16.66 8.34 8.34 0 0 0 0-16.66Zm0 11.83a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm0-8.75a2.75 2.75 0 0 1 2.75 2.75c0 1.01-.3 1.57-1.05 2.36l-.17.17c-.62.62-.78.89-.78 1.47a.75.75 0 0 1-1.5 0c0-1.01.3-1.57 1.05-2.36l.17-.17c.62-.62.78-.89.78-1.47a1.25 1.25 0 0 0-2.5-.13v.13a.75.75 0 0 1-1.5 0A2.75 2.75 0 0 1 12 6.75Z",
|
|
126
|
+
"receipt-money-filled": "M5 6.25C5 5.01 6 4 7.25 4h8.5C16.99 4 18 5 18 6.25V14h3.5v3.25c0 1.8-1.46 3.25-3.25 3.25H13v-4a2.5 2.5 0 0 0-2.5-2.5H5V6.25ZM18 19h.25c.97 0 1.75-.78 1.75-1.75V15.5h-2V19ZM8.75 8a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5h-5.5Zm0 3.5a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5h-5.5ZM2.5 15c-.83 0-1.5.67-1.5 1.5v4c0 .83.67 1.5 1.5 1.5h8c.83 0 1.5-.67 1.5-1.5v-4c0-.83-.67-1.5-1.5-1.5h-8Zm7.5 1a1 1 0 0 0 1 1v1a2 2 0 0 1-2-2h1Zm-1 5c0-1.1.9-2 2-2v1a1 1 0 0 0-1 1H9Zm-7-4a1 1 0 0 0 1-1h1a2 2 0 0 1-2 2v-1Zm0 2a2 2 0 0 1 2 2H3a1 1 0 0 0-1-1v-1Zm4.5-2.25a1.75 1.75 0 1 1 0 3.5 1.75 1.75 0 0 1 0-3.5Z",
|
|
127
|
+
"receipt-money-regular": "M5 6.25C5 5.01 6 4 7.25 4h8.5C16.99 4 18 5 18 6.25V14h3.5v3.25c0 1.8-1.46 3.25-3.25 3.25H13V19h3.5V6.25a.75.75 0 0 0-.75-.75h-8.5a.75.75 0 0 0-.75.75V14H5V6.25ZM18 19h.25c.97 0 1.75-.78 1.75-1.75V15.5h-2V19ZM8 8.75c0-.41.34-.75.75-.75h5.5a.75.75 0 0 1 0 1.5h-5.5A.75.75 0 0 1 8 8.75Zm0 3.5c0-.41.34-.75.75-.75h5.5a.75.75 0 0 1 0 1.5h-5.5a.75.75 0 0 1-.75-.75ZM2.5 15c-.83 0-1.5.67-1.5 1.5v4c0 .83.67 1.5 1.5 1.5h8c.83 0 1.5-.67 1.5-1.5v-4c0-.83-.67-1.5-1.5-1.5h-8Zm7.5 1a1 1 0 0 0 1 1v1a2 2 0 0 1-2-2h1Zm-1 5c0-1.1.9-2 2-2v1a1 1 0 0 0-1 1H9Zm-7-4a1 1 0 0 0 1-1h1a2 2 0 0 1-2 2v-1Zm0 2a2 2 0 0 1 2 2H3a1 1 0 0 0-1-1v-1Zm4.5-2.25a1.75 1.75 0 1 1 0 3.5 1.75 1.75 0 0 1 0-3.5Z",
|
|
126
128
|
"rocket-regular": "M13.06 7.43a2.5 2.5 0 1 1 3.53 3.54 2.5 2.5 0 0 1-3.53-3.54Zm2.47 1.06a1 1 0 1 0-1.41 1.42 1 1 0 0 0 1.41-1.42Zm5.98-4.17a2.75 2.75 0 0 0-1.81-1.8l-.66-.21c-2.4-.75-5-.1-6.78 1.67l-1 1a3.5 3.5 0 0 0-4.56.32L5.45 6.55c-.29.29-.29.76 0 1.06l1.6 1.59-.18.18c-.69.68-.69 1.79 0 2.47l.5.5-1.4.8a.75.75 0 0 0-.16 1.17l3.89 3.9a.75.75 0 0 0 1.18-.16l.8-1.4.5.5c.68.68 1.78.68 2.47 0l.17-.18 1.6 1.6c.29.28.76.28 1.05 0l1.25-1.25a3.5 3.5 0 0 0 .32-4.57l1-1A6.75 6.75 0 0 0 21.72 5l-.21-.67Zm-2.26-.38c.4.13.7.43.83.83l.2.66c.58 1.86.08 3.9-1.3 5.27l-5.4 5.4c-.1.1-.25.1-.35 0l-5.3-5.3a.25.25 0 0 1 0-.36l5.4-5.4a5.25 5.25 0 0 1 5.26-1.3l.66.2Zm-1.29 9.9a2 2 0 0 1-.3 2.43l-.72.71-1.06-1.06 2.08-2.08ZM7.76 6.36a2 2 0 0 1 2.43-.3L8.1 8.14 7.05 7.08l.7-.72Zm2.82 9.2-.52.9-2.5-2.5.9-.51 2.12 2.11ZM6.69 18.4a.75.75 0 0 0-1.06-1.06l-2.48 2.48a.75.75 0 0 0 1.06 1.06l2.48-2.48Zm-1.94-3c.29.3.29.77 0 1.06l-1.07 1.06a.75.75 0 0 1-1.06-1.06l1.06-1.06c.3-.3.77-.3 1.07 0Zm3.88 4.95a.75.75 0 1 0-1.06-1.06l-1.06 1.06a.75.75 0 0 0 1.06 1.06l1.06-1.06Z",
|
|
127
129
|
"search-filled": "M10 2.5a7.5 7.5 0 0 1 5.96 12.05l4.75 4.74a1 1 0 0 1-1.32 1.5l-.1-.08-4.74-4.75A7.5 7.5 0 1 1 10 2.5Zm0 2a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11Z",
|
|
128
130
|
"send-filled": "m12.81 12.2-7.53 1.25a.5.5 0 0 0-.38.32l-2.6 6.96a.75.75 0 0 0 1.03.94l18-9a.75.75 0 0 0 0-1.34l-18-9a.75.75 0 0 0-1.03.94l2.6 6.96a.5.5 0 0 0 .38.32l7.53 1.25a.2.2 0 0 1 0 .4Z",
|
package/src/utils/types.d.ts
CHANGED
|
@@ -6,3 +6,8 @@ export type GetNode<T extends {
|
|
|
6
6
|
node: unknown;
|
|
7
7
|
}[];
|
|
8
8
|
}> = GetEdge<T>["node"];
|
|
9
|
+
type Contravariant<T> = T extends unknown ? (_: T) => void : never;
|
|
10
|
+
type InferContravariant<T> = [T] extends [(_: infer I) => void] ? I : never;
|
|
11
|
+
type PickOne<T> = InferContravariant<InferContravariant<Contravariant<Contravariant<T>>>>;
|
|
12
|
+
export type UnionToTuple<T> = PickOne<T> extends infer U ? Exclude<T, U> extends never ? [T] : [...UnionToTuple<Exclude<T, U>>, U] : never;
|
|
13
|
+
export {};
|