@swan-io/lake 2.7.2 → 2.7.4
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/Card3dPreview.d.ts +16 -0
- package/src/components/Card3dPreview.js +29 -22
- package/src/components/FixedListView.d.ts +4 -1
- package/src/components/FixedListView.js +41 -34
- package/src/components/FixedListViewCells.d.ts +4 -2
- package/src/components/FixedListViewCells.js +4 -4
- package/src/components/LakeCombobox.js +1 -1
- package/src/components/LakeTextInput.js +2 -2
- package/src/assets/3d-card/shaders/shinyColorFragment.glsl +0 -11
package/package.json
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as THREE from "three";
|
|
3
|
+
export type Card3dAssetsUrls = {
|
|
4
|
+
envNx: string;
|
|
5
|
+
envNy: string;
|
|
6
|
+
envNz: string;
|
|
7
|
+
envPx: string;
|
|
8
|
+
envPy: string;
|
|
9
|
+
envPz: string;
|
|
10
|
+
fontMaisonNeueBook: string;
|
|
11
|
+
fontMarkProRegular: string;
|
|
12
|
+
bandRoughness: string;
|
|
13
|
+
cardGltf: string;
|
|
14
|
+
chipTexture: string;
|
|
15
|
+
colorBlack: string;
|
|
16
|
+
colorSilver: string;
|
|
17
|
+
};
|
|
3
18
|
type CardParams = {
|
|
4
19
|
ownerName: string;
|
|
5
20
|
cardNumber: string;
|
|
@@ -8,6 +23,7 @@ type CardParams = {
|
|
|
8
23
|
color: "Silver" | "Black";
|
|
9
24
|
logo: SVGElement | null;
|
|
10
25
|
logoScale: number;
|
|
26
|
+
assetsUrls: Card3dAssetsUrls;
|
|
11
27
|
onSvgError?: (code: string) => void;
|
|
12
28
|
};
|
|
13
29
|
type Props = CardParams & {
|
|
@@ -4,20 +4,6 @@ import { Canvas, useFrame } from "@react-three/fiber";
|
|
|
4
4
|
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
5
5
|
import * as THREE from "three";
|
|
6
6
|
import { match } from "ts-pattern";
|
|
7
|
-
import envNxUrl from "../assets/3d-card/environment/nx.png?url";
|
|
8
|
-
import envNyUrl from "../assets/3d-card/environment/ny.png?url";
|
|
9
|
-
import envNzUrl from "../assets/3d-card/environment/nz.png?url";
|
|
10
|
-
import envPxUrl from "../assets/3d-card/environment/px.png?url";
|
|
11
|
-
import envPyUrl from "../assets/3d-card/environment/py.png?url";
|
|
12
|
-
import envPzUrl from "../assets/3d-card/environment/pz.png?url";
|
|
13
|
-
import fontMaisonNeueBookUrl from "../assets/3d-card/model/MaisonNeue-Book.woff?url";
|
|
14
|
-
import fontMarkProRegularUrl from "../assets/3d-card/model/MarkPro-Regular.ttf?url";
|
|
15
|
-
import bandRoughnessUrl from "../assets/3d-card/model/band_roughness.jpg?url";
|
|
16
|
-
import cardGltfUrl from "../assets/3d-card/model/card.gltf?url";
|
|
17
|
-
import chipUrl from "../assets/3d-card/model/chip.jpg?url";
|
|
18
|
-
import colorBlackUrl from "../assets/3d-card/model/color_black.jpg?url";
|
|
19
|
-
import colorSilverUrl from "../assets/3d-card/model/color_silver.jpg?url";
|
|
20
|
-
import shinyColorFragmentShader from "../assets/3d-card/shaders/shinyColorFragment.glsl?raw";
|
|
21
7
|
import { isNotNullish, isNullish } from "../utils/nullish";
|
|
22
8
|
import { createSvgImage, getMonochromeSvg } from "../utils/svg";
|
|
23
9
|
/*
|
|
@@ -40,6 +26,19 @@ And this texture is used as an alpha map on a plane.
|
|
|
40
26
|
To reproduce the shiny effect on the back of the card, we inject a custom shader in rainbow_mastercard material.
|
|
41
27
|
This custom shader chunk change the diffuse color depending on camera position.
|
|
42
28
|
*/
|
|
29
|
+
const shinyColorFragmentShader = `
|
|
30
|
+
float red = cameraPosition.x * cameraPosition.z;
|
|
31
|
+
float green = cameraPosition.y * cameraPosition.z;
|
|
32
|
+
float blue = 0.1;
|
|
33
|
+
|
|
34
|
+
red = sin(red / 5.0) + 1.0 / 2.0;
|
|
35
|
+
green = sin(green / 5.0) + 1.0 / 2.0;
|
|
36
|
+
|
|
37
|
+
vec3 shinyColor = vec3(red, green, blue);
|
|
38
|
+
float shinyFactor = 0.35;
|
|
39
|
+
|
|
40
|
+
diffuseColor.rgb = mix(diffuseColor.rgb, shinyColor, shinyFactor);
|
|
41
|
+
`;
|
|
43
42
|
const ENV_MAP_INTENSITY = 3;
|
|
44
43
|
const CARD_WIDTH = 8.56;
|
|
45
44
|
const CARD_HEIGHT = 5.4;
|
|
@@ -72,13 +71,21 @@ export default (props) => {
|
|
|
72
71
|
return (_jsxs(Canvas, { camera: { position: [0, 0, 12], fov: 50 }, children: [_jsx(OrbitControls, { enablePan: false, enableZoom: false }), _jsx(CardScene, { ...props })] }));
|
|
73
72
|
};
|
|
74
73
|
const CardScene = ({ autoRotationDuration, ...props }) => {
|
|
74
|
+
const { assetsUrls } = props;
|
|
75
75
|
const card = useRef(null);
|
|
76
76
|
useFrame(({ clock }) => {
|
|
77
77
|
if (autoRotationDuration != null && card.current != null) {
|
|
78
78
|
card.current.rotation.y = (clock.getElapsedTime() / autoRotationDuration) * Math.PI * 2;
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
|
-
return (_jsxs(_Fragment, { children: [_jsx("ambientLight", { color: 0xffffff, intensity: 1 }), _jsx("pointLight", { intensity: 0.2, decay: 2, position: [-10, -10, -21] }), _jsx("pointLight", { intensity: 0.2, decay: 2, position: [10, 10, 21] }), _jsx(Environment, { files: [
|
|
81
|
+
return (_jsxs(_Fragment, { children: [_jsx("ambientLight", { color: 0xffffff, intensity: 1 }), _jsx("pointLight", { intensity: 0.2, decay: 2, position: [-10, -10, -21] }), _jsx("pointLight", { intensity: 0.2, decay: 2, position: [10, 10, 21] }), _jsx(Environment, { files: [
|
|
82
|
+
assetsUrls.envPx,
|
|
83
|
+
assetsUrls.envNx,
|
|
84
|
+
assetsUrls.envPy,
|
|
85
|
+
assetsUrls.envNy,
|
|
86
|
+
assetsUrls.envPz,
|
|
87
|
+
assetsUrls.envNz,
|
|
88
|
+
] }), _jsx(Card, { ref: card, ...props })] }));
|
|
82
89
|
};
|
|
83
90
|
// Set color space to sRGB for textures
|
|
84
91
|
const setTextureColorSpace = (texture) => {
|
|
@@ -86,13 +93,13 @@ const setTextureColorSpace = (texture) => {
|
|
|
86
93
|
texture.colorSpace = THREE.SRGBColorSpace;
|
|
87
94
|
}
|
|
88
95
|
};
|
|
89
|
-
export const Card = forwardRef(({ ownerName, cardNumber, expirationDate, cvv, color, logo, logoScale, onSvgError, ...props }, ref) => {
|
|
90
|
-
const { nodes, materials } = useGLTF(
|
|
96
|
+
export const Card = forwardRef(({ ownerName, cardNumber, expirationDate, cvv, color, logo, logoScale, assetsUrls, onSvgError, ...props }, ref) => {
|
|
97
|
+
const { nodes, materials } = useGLTF(assetsUrls.cardGltf);
|
|
91
98
|
const [logoData, setLogoData] = useState(null);
|
|
92
|
-
const silverTexture = useTexture(
|
|
93
|
-
const blackTexture = useTexture(
|
|
94
|
-
const chipTexture = useTexture(
|
|
95
|
-
const bandRoughnessTexture = useTexture(
|
|
99
|
+
const silverTexture = useTexture(assetsUrls.colorSilver, setTextureColorSpace);
|
|
100
|
+
const blackTexture = useTexture(assetsUrls.colorBlack, setTextureColorSpace);
|
|
101
|
+
const chipTexture = useTexture(assetsUrls.chipTexture, setTextureColorSpace);
|
|
102
|
+
const bandRoughnessTexture = useTexture(assetsUrls.bandRoughness); // keep default color space because it's grayscale
|
|
96
103
|
// Set environment map intensity for all materials
|
|
97
104
|
useEffect(() => {
|
|
98
105
|
Object.values(materials).forEach(material => {
|
|
@@ -155,7 +162,7 @@ export const Card = forwardRef(({ ownerName, cardNumber, expirationDate, cvv, co
|
|
|
155
162
|
.with("Black", () => 0xeeeeee)
|
|
156
163
|
.exhaustive(), metalness: 0.1, roughness: 0.55, envMapIntensity: ENV_MAP_INTENSITY }));
|
|
157
164
|
const secondaryTextMaterial = (_jsx("meshStandardMaterial", { color: 0x666666, metalness: 0.1, roughness: 0.55, envMapIntensity: ENV_MAP_INTENSITY }));
|
|
158
|
-
return (_jsx("group", { ref: ref, ...props, dispose: null, children: _jsxs("mesh", { geometry: nodes.card.geometry, material: materials.card, children: [_jsxs("group", { position: [0, 0, FRONT_TEXT_POSITION], children: [_jsxs(Text, { font:
|
|
165
|
+
return (_jsx("group", { ref: ref, ...props, dispose: null, children: _jsxs("mesh", { geometry: nodes.card.geometry, material: materials.card, children: [_jsxs("group", { position: [0, 0, FRONT_TEXT_POSITION], children: [_jsxs(Text, { font: assetsUrls.fontMaisonNeueBook, fontSize: 0.2, anchorX: "left", anchorY: "bottom", position: [-3.4, -1.95, 0], children: [ownerName, mainTextMaterial] }), _jsxs(Text, { font: assetsUrls.fontMarkProRegular, fontSize: 0.03, anchorX: "left", anchorY: "bottom", position: [3.85, -2.15, 0], children: ["TM", mainTextMaterial] })] }), _jsxs("group", { position: [0, 0, BACK_TEXT_POSITION], children: [_jsxs(Text, { font: assetsUrls.fontMarkProRegular, anchorX: "left", anchorY: "bottom", fontSize: 0.12, rotation: [0, Math.PI, 0], position: [4, 2.38, 0], children: ["support@swan.io", secondaryTextMaterial] }), _jsxs(Text, { font: assetsUrls.fontMarkProRegular, anchorX: "right", anchorY: "bottom", fontSize: 0.12, rotation: [0, Math.PI, 0], position: [-4, 2.38, 0], children: ["IDEMIA 9 1212121L 09/21", secondaryTextMaterial] }), _jsxs(Text, { font: assetsUrls.fontMaisonNeueBook, fontSize: 0.24, anchorX: "left", anchorY: "bottom", rotation: [0, Math.PI, 0], position: [4, 0.68, 0], children: ["Identifier: 0000000000", mainTextMaterial] }), _jsxs(Text, { font: assetsUrls.fontMaisonNeueBook, fontSize: 0.2, anchorX: "left", anchorY: "bottom", rotation: [0, Math.PI, 0], position: [4, 0.15, 0], children: ["This card is issued by Swan, pursuant to license", secondaryTextMaterial] }), _jsxs(Text, { font: assetsUrls.fontMaisonNeueBook, fontSize: 0.2, anchorX: "left", anchorY: "bottom", rotation: [0, Math.PI, 0], position: [4, -0.15, 0], children: ["by Mastercard international.", secondaryTextMaterial] }), _jsxs(Text, { font: assetsUrls.fontMaisonNeueBook, fontSize: 0.48, anchorX: "left", anchorY: "bottom", rotation: [0, Math.PI, 0], position: [4, -1.85, 0], children: [cardNumber, mainTextMaterial] }), _jsxs(Text, { font: assetsUrls.fontMaisonNeueBook, fontSize: 0.29, anchorX: "left", anchorY: "bottom", rotation: [0, Math.PI, 0], position: [4, -2.3, 0], children: [expirationDate, mainTextMaterial] }), _jsxs(Text, { font: assetsUrls.fontMaisonNeueBook, fontSize: 0.29, anchorX: "left", anchorY: "bottom", rotation: [0, Math.PI, 0], position: [2.55, -2.3, 0], children: ["CVC ", cvv, mainTextMaterial] }), _jsxs(Text, { font: assetsUrls.fontMarkProRegular, anchorX: "center", anchorY: "bottom", fontSize: 0.36, rotation: [0, Math.PI, 0], position: [-2.35, -1.15, 0], children: ["debit", mainTextMaterial] })] }), _jsx("group", {
|
|
159
166
|
// move group to change scale center at top right corner
|
|
160
167
|
position: [
|
|
161
168
|
CARD_WIDTH / 2 - LOGO_MARGIN_RIGHT,
|
|
@@ -65,9 +65,11 @@ export type FixedListViewProps<T, ExtraInfo> = {
|
|
|
65
65
|
data: T[];
|
|
66
66
|
keyExtractor: (item: T, index: number) => string;
|
|
67
67
|
highlightedRowId?: string;
|
|
68
|
+
headerBackgroundColor?: string;
|
|
68
69
|
headerHeight: number;
|
|
69
70
|
rowHeight: number;
|
|
70
71
|
rowVerticalSpacing: number;
|
|
72
|
+
horizontalPadding?: number;
|
|
71
73
|
extraInfo: ExtraInfo;
|
|
72
74
|
stickedToStartColumns?: ColumnConfig<T, ExtraInfo>[];
|
|
73
75
|
columns: ColumnConfig<T, ExtraInfo>[];
|
|
@@ -82,7 +84,8 @@ export type FixedListViewProps<T, ExtraInfo> = {
|
|
|
82
84
|
count: number;
|
|
83
85
|
};
|
|
84
86
|
};
|
|
85
|
-
export declare const
|
|
87
|
+
export declare const SCROLLBAR_RESERVED_SPACE = 20;
|
|
88
|
+
export declare const FixedListView: <T, ExtraInfo>({ data: originalData, mode, keyExtractor, highlightedRowId, rowHeight, rowVerticalSpacing, horizontalPadding, headerBackgroundColor, headerHeight, renderThreshold, stickedToStartColumns: initialStickedToStartColumns, columns: initialColumns, stickedToEndColumns: initialStickedToEndColumns, extraInfo, onEndReached, onEndReachedThresholdPx, getRowLink, renderEmptyList, loading, }: FixedListViewProps<T, ExtraInfo>) => import("react/jsx-runtime").JSX.Element;
|
|
86
89
|
type PlaceholderProps = {
|
|
87
90
|
count: number;
|
|
88
91
|
rowHeight: number;
|
|
@@ -50,7 +50,7 @@ import { LakeHeading } from "./LakeHeading";
|
|
|
50
50
|
import { LakeText } from "./LakeText";
|
|
51
51
|
import { Space } from "./Space";
|
|
52
52
|
const HORIZONTAL_SAFE_AREA = 10;
|
|
53
|
-
const SCROLLBAR_RESERVED_SPACE = 20;
|
|
53
|
+
export const SCROLLBAR_RESERVED_SPACE = 20;
|
|
54
54
|
const styles = StyleSheet.create({
|
|
55
55
|
root: {
|
|
56
56
|
height: 1,
|
|
@@ -97,16 +97,12 @@ const styles = StyleSheet.create({
|
|
|
97
97
|
top: 0,
|
|
98
98
|
bottom: 0,
|
|
99
99
|
right: "100%",
|
|
100
|
-
width: HORIZONTAL_SAFE_AREA,
|
|
101
|
-
backgroundColor: backgroundColor.default,
|
|
102
100
|
},
|
|
103
101
|
stickyColumnEndOverflow: {
|
|
104
102
|
position: "absolute",
|
|
105
103
|
top: 0,
|
|
106
104
|
bottom: 0,
|
|
107
105
|
left: "100%",
|
|
108
|
-
width: HORIZONTAL_SAFE_AREA,
|
|
109
|
-
backgroundColor: backgroundColor.default,
|
|
110
106
|
},
|
|
111
107
|
rowSegment: {
|
|
112
108
|
position: "absolute",
|
|
@@ -128,7 +124,6 @@ const styles = StyleSheet.create({
|
|
|
128
124
|
flexDirection: "row",
|
|
129
125
|
alignItems: "stretch",
|
|
130
126
|
zIndex: 2,
|
|
131
|
-
backgroundColor: backgroundColor.default,
|
|
132
127
|
},
|
|
133
128
|
segment: {
|
|
134
129
|
flexDirection: "row",
|
|
@@ -177,9 +172,6 @@ const styles = StyleSheet.create({
|
|
|
177
172
|
flexDirection: "row",
|
|
178
173
|
alignItems: "stretch",
|
|
179
174
|
},
|
|
180
|
-
stickyRow: {
|
|
181
|
-
// overflow: "hidden",
|
|
182
|
-
},
|
|
183
175
|
evenRow: {
|
|
184
176
|
backgroundColor: backgroundColor.accented,
|
|
185
177
|
},
|
|
@@ -226,7 +218,6 @@ const styles = StyleSheet.create({
|
|
|
226
218
|
transitionTimingFunction: "ease-in-out",
|
|
227
219
|
},
|
|
228
220
|
rowBackgroundContainerPlain: {
|
|
229
|
-
backgroundColor: backgroundColor.default,
|
|
230
221
|
left: -10,
|
|
231
222
|
right: -10,
|
|
232
223
|
boxShadow: `inset 0 -1px ${colors.gray[100]}`,
|
|
@@ -414,14 +405,15 @@ const findNextFocusableElement = (sortedCellIds, currentCellIndex, direction) =>
|
|
|
414
405
|
};
|
|
415
406
|
const EMPTY_COLUMNS = [];
|
|
416
407
|
const ZERO = 0;
|
|
417
|
-
export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor, highlightedRowId, rowHeight, rowVerticalSpacing, headerHeight, renderThreshold = 1000, stickedToStartColumns: initialStickedToStartColumns = EMPTY_COLUMNS, columns: initialColumns, stickedToEndColumns: initialStickedToEndColumns = EMPTY_COLUMNS, extraInfo, onEndReached, onEndReachedThresholdPx = 200, getRowLink, renderEmptyList, loading, }) => {
|
|
408
|
+
export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor, highlightedRowId, rowHeight, rowVerticalSpacing, horizontalPadding = HORIZONTAL_SAFE_AREA, headerBackgroundColor = backgroundColor.default, headerHeight, renderThreshold = 1000, stickedToStartColumns: initialStickedToStartColumns = EMPTY_COLUMNS, columns: initialColumns, stickedToEndColumns: initialStickedToEndColumns = EMPTY_COLUMNS, extraInfo, onEndReached, onEndReachedThresholdPx = 200, getRowLink, renderEmptyList, loading, }) => {
|
|
418
409
|
const [viewId] = useState(() => uuid());
|
|
419
410
|
// Those three refs are used to synchronize the horizontal scroll in the center columns
|
|
420
411
|
const centerHeadersRef = useRef(null);
|
|
421
412
|
const centerColumnsRef = useRef(null);
|
|
422
413
|
const horizontalScrollbarRef = useRef(null);
|
|
423
414
|
const totalRowHeight = rowHeight + rowVerticalSpacing;
|
|
424
|
-
const
|
|
415
|
+
const rowsHeight = originalData.length * totalRowHeight;
|
|
416
|
+
const totalHeight = headerHeight + rowsHeight;
|
|
425
417
|
// It might seem off to use the range in state instead of storing scroll/layout and deriving it,
|
|
426
418
|
// but it saves a lot of render phases by allowing to bail out from rendering when the range doesn't change
|
|
427
419
|
const [{ data, range: [renderedRangeStartIndex, renderedRangeEndIndex], }, setDataAndRenderRange,] = useState({ data: originalData, range: [0, 20] });
|
|
@@ -560,7 +552,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
560
552
|
now - lastHorizontalScroll.current.date > SCROLL_THRESHOLD_MS) {
|
|
561
553
|
const scrollLeft = centerColumns.scrollLeft;
|
|
562
554
|
setShouldShowStartGradient(scrollLeft > 0);
|
|
563
|
-
setShouldShowEndGradient(centerColumns.scrollWidth -
|
|
555
|
+
setShouldShowEndGradient(centerColumns.scrollWidth - horizontalPadding * 2 >=
|
|
564
556
|
scrollLeft + centerColumns.clientWidth);
|
|
565
557
|
centerHeaders.scrollLeft = scrollLeft;
|
|
566
558
|
horizontalScrollbar.scrollLeft = scrollLeft;
|
|
@@ -573,7 +565,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
573
565
|
now - lastHorizontalScroll.current.date > SCROLL_THRESHOLD_MS) {
|
|
574
566
|
const scrollLeft = centerHeaders.scrollLeft;
|
|
575
567
|
setShouldShowStartGradient(scrollLeft > 0);
|
|
576
|
-
setShouldShowEndGradient(centerHeaders.scrollWidth -
|
|
568
|
+
setShouldShowEndGradient(centerHeaders.scrollWidth - horizontalPadding * 2 >=
|
|
577
569
|
scrollLeft + centerHeaders.clientWidth);
|
|
578
570
|
centerColumns.scrollLeft = scrollLeft;
|
|
579
571
|
horizontalScrollbar.scrollLeft = scrollLeft;
|
|
@@ -586,7 +578,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
586
578
|
now - lastHorizontalScroll.current.date > SCROLL_THRESHOLD_MS) {
|
|
587
579
|
const scrollLeft = horizontalScrollbar.scrollLeft;
|
|
588
580
|
setShouldShowStartGradient(scrollLeft > 0);
|
|
589
|
-
setShouldShowEndGradient(horizontalScrollbar.scrollWidth -
|
|
581
|
+
setShouldShowEndGradient(horizontalScrollbar.scrollWidth - horizontalPadding * 2 >=
|
|
590
582
|
scrollLeft + horizontalScrollbar.clientWidth);
|
|
591
583
|
centerHeaders.scrollLeft = scrollLeft;
|
|
592
584
|
centerColumns.scrollLeft = scrollLeft;
|
|
@@ -602,7 +594,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
602
594
|
horizontalScrollbar.removeEventListener("scroll", onScrollbarScroll);
|
|
603
595
|
};
|
|
604
596
|
}
|
|
605
|
-
}, []);
|
|
597
|
+
}, [horizontalPadding]);
|
|
606
598
|
const onKeyDown = useCallback((event) => {
|
|
607
599
|
const target = event.nativeEvent.target;
|
|
608
600
|
const currentTarget = event.nativeEvent.currentTarget;
|
|
@@ -743,9 +735,9 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
743
735
|
], children: [_jsx(View, { "aria-busy": isLoading, style: [
|
|
744
736
|
styles.loadingPlaceholder,
|
|
745
737
|
{
|
|
746
|
-
top:
|
|
747
|
-
marginLeft:
|
|
748
|
-
marginRight:
|
|
738
|
+
top: rowsHeight,
|
|
739
|
+
marginLeft: horizontalPadding * 2,
|
|
740
|
+
marginRight: horizontalPadding * 2,
|
|
749
741
|
},
|
|
750
742
|
], children: isLoading
|
|
751
743
|
? match(mode)
|
|
@@ -755,30 +747,39 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
755
747
|
: null }), _jsx(View, { style: [styles.backgroundRows, { top: headerHeight }], children: backgroundRows }), _jsxs(View, { style: styles.scrollContentContainer, ref: scrollContentsRef, children: [stickedToStartColumns.length > 0 ? (_jsxs(View, { style: [
|
|
756
748
|
styles.stickyColumn,
|
|
757
749
|
{
|
|
758
|
-
width: stickedToStartColumnsWidth +
|
|
759
|
-
paddingLeft:
|
|
750
|
+
width: stickedToStartColumnsWidth + horizontalPadding,
|
|
751
|
+
paddingLeft: horizontalPadding,
|
|
760
752
|
},
|
|
761
|
-
], children: [_jsxs(View, { style: [
|
|
753
|
+
], children: [_jsxs(View, { style: [
|
|
754
|
+
styles.headingSegment,
|
|
755
|
+
{ height: headerHeight, backgroundColor: headerBackgroundColor },
|
|
756
|
+
], children: [_jsx(HeaderSegment, { columns: stickedToStartColumns, extraInfo: extraInfo, viewId: viewId, width: stickedToStartColumnsWidth }), _jsx(View, { style: [
|
|
757
|
+
styles.stickyColumnStartOverflow,
|
|
758
|
+
{ width: horizontalPadding, backgroundColor: headerBackgroundColor },
|
|
759
|
+
] }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient] })] }), _jsx(View, { style: { height: rowsHeight }, children: startRows })] })) : null, _jsxs(View, { style: [
|
|
762
760
|
styles.centerColumnsContainer,
|
|
763
761
|
{
|
|
764
|
-
paddingLeft: stickedToStartColumns.length === 0 ?
|
|
765
|
-
paddingRight: stickedToEndColumns.length === 0 ?
|
|
762
|
+
paddingLeft: stickedToStartColumns.length === 0 ? horizontalPadding : ZERO,
|
|
763
|
+
paddingRight: stickedToEndColumns.length === 0 ? horizontalPadding : ZERO,
|
|
766
764
|
},
|
|
767
|
-
], children: [_jsxs(View, { style: [
|
|
765
|
+
], children: [_jsxs(View, { style: [
|
|
766
|
+
styles.headingSegment,
|
|
767
|
+
{ height: headerHeight, backgroundColor: headerBackgroundColor },
|
|
768
|
+
], children: [_jsx(ScrollView, { ref: centerHeadersRef, horizontal: true, onLayout: onCenterTrackLayout, style: styles.centerColumns, contentContainerStyle: {
|
|
768
769
|
minWidth: centerColumnsWidth +
|
|
769
|
-
(stickedToStartColumns.length === 0 ?
|
|
770
|
-
(stickedToEndColumns.length === 0 ?
|
|
770
|
+
(stickedToStartColumns.length === 0 ? horizontalPadding : 0) +
|
|
771
|
+
(stickedToEndColumns.length === 0 ? horizontalPadding : 0),
|
|
771
772
|
}, children: _jsx(HeaderSegment, { columns: columns, extraInfo: extraInfo, viewId: viewId, width: centerColumnsWidth }) }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient] })] }), _jsx(ScrollView, { horizontal: true, ref: centerColumnsRef, style: styles.centerColumns, contentContainerStyle: [
|
|
772
773
|
styles.centerColumnsContentContainer,
|
|
773
774
|
{
|
|
774
775
|
minWidth: centerColumnsWidth +
|
|
775
|
-
(stickedToStartColumns.length === 0 ?
|
|
776
|
-
(stickedToEndColumns.length === 0 ?
|
|
776
|
+
(stickedToStartColumns.length === 0 ? horizontalPadding : 0) +
|
|
777
|
+
(stickedToEndColumns.length === 0 ? horizontalPadding : 0),
|
|
777
778
|
},
|
|
778
779
|
], children: centerRows }), _jsx(ScrollView, { ref: horizontalScrollbarRef, horizontal: true, style: styles.horizontalScrollbar, contentContainerStyle: {
|
|
779
780
|
minWidth: centerColumnsWidth +
|
|
780
|
-
(stickedToStartColumns.length === 0 ?
|
|
781
|
-
(stickedToEndColumns.length === 0 ?
|
|
781
|
+
(stickedToStartColumns.length === 0 ? horizontalPadding : 0) +
|
|
782
|
+
(stickedToEndColumns.length === 0 ? horizontalPadding : 0),
|
|
782
783
|
} }), stickedToStartColumns.length > 0 && hasHorizontalScroll ? (_jsx(View, { style: [
|
|
783
784
|
styles.leftToRightGradient,
|
|
784
785
|
{
|
|
@@ -798,10 +799,16 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
798
799
|
] })) : null] }), stickedToEndColumns.length > 0 ? (_jsxs(View, { style: [
|
|
799
800
|
styles.stickyColumn,
|
|
800
801
|
{
|
|
801
|
-
width: stickedToEndColumnsWidth +
|
|
802
|
-
paddingRight:
|
|
802
|
+
width: stickedToEndColumnsWidth + horizontalPadding,
|
|
803
|
+
paddingRight: horizontalPadding,
|
|
803
804
|
},
|
|
804
|
-
], children: [_jsxs(View, { style: [
|
|
805
|
+
], children: [_jsxs(View, { style: [
|
|
806
|
+
styles.headingSegment,
|
|
807
|
+
{ height: headerHeight, backgroundColor: headerBackgroundColor },
|
|
808
|
+
], children: [_jsx(View, { style: [
|
|
809
|
+
styles.stickyColumnEndOverflow,
|
|
810
|
+
{ width: horizontalPadding, backgroundColor: headerBackgroundColor },
|
|
811
|
+
] }), _jsx(HeaderSegment, { columns: stickedToEndColumns, extraInfo: extraInfo, viewId: viewId, width: stickedToEndColumnsWidth }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient] })] }), _jsx(View, { style: { height: rowsHeight }, children: endRows })] })) : null] })] }), data.length === 0 && isNotNullish(renderEmptyList) && !isLoading ? (_jsx(View, { style: styles.emptyListContainer, children: renderEmptyList() })) : null, _jsx(View, { ref: endFocusAnchorRef, tabIndex: 0 })] }));
|
|
805
812
|
};
|
|
806
813
|
export const FixedListViewPlaceholder = ({ count, rowHeight, rowVerticalSpacing, groupHeaderHeight, headerHeight, paddingHorizontal = HORIZONTAL_SAFE_AREA, }) => {
|
|
807
814
|
const totalRowHeight = rowHeight + rowVerticalSpacing;
|
|
@@ -30,7 +30,7 @@ export declare const CopyableRegularTextCell: ({ variant, text, copyWording, cop
|
|
|
30
30
|
copyWording: string;
|
|
31
31
|
copiedWording: string;
|
|
32
32
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
-
export declare const BalanceCell: ({ value, currency, originalValue, formatCurrency, textAlign, }: {
|
|
33
|
+
export declare const BalanceCell: ({ value, currency, originalValue, formatCurrency, textAlign, variant, }: {
|
|
34
34
|
value: number;
|
|
35
35
|
currency: string;
|
|
36
36
|
originalValue?: {
|
|
@@ -39,11 +39,13 @@ export declare const BalanceCell: ({ value, currency, originalValue, formatCurre
|
|
|
39
39
|
} | undefined;
|
|
40
40
|
formatCurrency: (value: number, currency: string) => string;
|
|
41
41
|
textAlign?: "left" | "right" | "center" | undefined;
|
|
42
|
+
variant?: "light" | "semibold" | "medium" | "regular" | "smallSemibold" | "smallMedium" | "smallRegular" | undefined;
|
|
42
43
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
-
export declare const LinkCell: ({ children, external, onPress, }: {
|
|
44
|
+
export declare const LinkCell: ({ children, external, onPress, variant, }: {
|
|
44
45
|
children: ReactNode;
|
|
45
46
|
onPress: () => void;
|
|
46
47
|
external?: boolean | undefined;
|
|
48
|
+
variant?: "light" | "semibold" | "medium" | "regular" | "smallSemibold" | "smallMedium" | "smallRegular" | undefined;
|
|
47
49
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
48
50
|
export declare const StartAlignedCell: ({ children }: {
|
|
49
51
|
children: ReactNode;
|
|
@@ -123,8 +123,8 @@ export const CopyableRegularTextCell = ({ variant = "regular", text, copyWording
|
|
|
123
123
|
return (_jsxs(View, { style: styles.cell, children: [_jsx(LakeTooltip, { placement: "top", onHide: () => setVisibleState("copy"), togglableOnFocus: true, content: visibleState === "copy" ? copyWording : copiedWording, containerStyle: styles.iconContainer, children: _jsx(Pressable, { role: "button", "aria-label": copyWording, onPress: onPress, style: ({ hovered }) => [styles.icon, hovered && styles.underline], children: ({ hovered }) => (_jsx(Icon, { name: hovered ? "copy-filled" : "copy-regular", color: "currentColor", size: 14 })) }) }), _jsx(Space, { width: 4 }), _jsx(LakeText, { color: colors.gray[900], style: styles.regularText, variant: variant, children: text })] }));
|
|
124
124
|
};
|
|
125
125
|
// TODO: handle `+` sign properly
|
|
126
|
-
export const BalanceCell = ({ value, currency, originalValue, formatCurrency, textAlign = "right", }) => {
|
|
127
|
-
return (_jsxs(View, { style: styles.balanceCellContainer, children: [_jsx(View, { style: styles.cell, children: _jsxs(LakeText, { align: textAlign, color: colors.gray[900], variant:
|
|
126
|
+
export const BalanceCell = ({ value, currency, originalValue, formatCurrency, textAlign = "right", variant = "medium", }) => {
|
|
127
|
+
return (_jsxs(View, { style: styles.balanceCellContainer, children: [_jsx(View, { style: styles.cell, children: _jsxs(LakeText, { align: textAlign, color: colors.gray[900], variant: variant, style: [
|
|
128
128
|
styles.mediumText,
|
|
129
129
|
{
|
|
130
130
|
justifyContent: match(textAlign)
|
|
@@ -137,11 +137,11 @@ export const BalanceCell = ({ value, currency, originalValue, formatCurrency, te
|
|
|
137
137
|
value < 0 && { color: colors.negative.primary },
|
|
138
138
|
], children: [value > 0 && "+", formatCurrency(value, currency)] }) }), isNotNullish(originalValue) && originalValue.currency !== currency && (_jsx(View, { style: styles.cell, children: _jsxs(LakeText, { style: styles.mediumText, align: textAlign, color: colors.gray[500], variant: "smallRegular", children: [originalValue.value > 0 && "+", formatCurrency(originalValue.value, originalValue.currency)] }) }))] }));
|
|
139
139
|
};
|
|
140
|
-
export const LinkCell = ({ children, external = false, onPress, }) => {
|
|
140
|
+
export const LinkCell = ({ children, external = false, onPress, variant = "medium", }) => {
|
|
141
141
|
return (_jsxs(View, { style: styles.cell, children: [_jsx(Pressable, { style: ({ hovered }) => [styles.icon, hovered && styles.underline], onPress: event => {
|
|
142
142
|
event.preventDefault();
|
|
143
143
|
onPress();
|
|
144
|
-
}, children: _jsx(Icon, { size: 14, name: external ? "open-regular" : "arrow-right-filled" }) }), _jsx(Space, { width: 8 }), _jsx(LakeText, { color: colors.gray[900], variant:
|
|
144
|
+
}, children: _jsx(Icon, { size: 14, name: external ? "open-regular" : "arrow-right-filled" }) }), _jsx(Space, { width: 8 }), _jsx(LakeText, { color: colors.gray[900], variant: variant, style: styles.mediumText, children: children })] }));
|
|
145
145
|
};
|
|
146
146
|
export const StartAlignedCell = ({ children }) => {
|
|
147
147
|
return _jsx(View, { style: styles.cell, children: children });
|
|
@@ -141,7 +141,7 @@ const LakeComboboxWithRef = ({ inputRef, value, items, itemHeight = DEFAULT_ELEM
|
|
|
141
141
|
close();
|
|
142
142
|
}, 100);
|
|
143
143
|
}, [close]);
|
|
144
|
-
return (_jsxs(View, { children: [_jsx(LakeTextInput, { ref: inputTextRef, style: styles.input, ariaExpanded: isFocused, ariaControls: isFocused ? suggestionsId : "", enterKeyHint: "search", icon: icon, role: "combobox", placeholder: placeholder, value: value, disabled: disabled, error: error, hideErrors: hideErrors, onChangeText: onValueChange, onChange: onChange, onFocus: handleFocus, onBlur: handleBlur, onKeyPress: handleKeyPress, id: id, readOnly: readOnly }), _jsx(Popover, { id: suggestionsId, role: "listbox", matchReferenceWidth: true, onDismiss: close, referenceRef: ref, autoFocus:
|
|
144
|
+
return (_jsxs(View, { children: [_jsx(LakeTextInput, { ref: inputTextRef, style: styles.input, ariaExpanded: isFocused, ariaControls: isFocused ? suggestionsId : "", enterKeyHint: "search", icon: icon, role: "combobox", placeholder: placeholder, value: value, disabled: disabled, error: error, hideErrors: hideErrors, onChangeText: onValueChange, onChange: onChange, onFocus: handleFocus, onBlur: handleBlur, onKeyPress: handleKeyPress, id: id, readOnly: readOnly }), _jsx(Popover, { id: suggestionsId, role: "listbox", matchReferenceWidth: true, onDismiss: close, referenceRef: ref, autoFocus: false, returnFocus: true, visible: isFocused && !items.isNotAsked(), underlay: false, forcedMode: "Dropdown", children: _jsx(View, { style: [styles.list, { maxHeight: itemHeight * nbItemsDisplayed }], children: items.match({
|
|
145
145
|
NotAsked: () => null,
|
|
146
146
|
Loading: () => _jsx(LoadingView, { style: styles.loader }),
|
|
147
147
|
Done: items => items.match({
|
|
@@ -43,11 +43,11 @@ const styles = StyleSheet.create({
|
|
|
43
43
|
placeholderTextColor: colors.gray[400],
|
|
44
44
|
color: colors.gray[900],
|
|
45
45
|
paddingHorizontal: spacings[8],
|
|
46
|
-
height:
|
|
46
|
+
height: 38,
|
|
47
47
|
minWidth: 0,
|
|
48
48
|
},
|
|
49
49
|
multilineInput: {
|
|
50
|
-
height: "
|
|
50
|
+
height: "100%",
|
|
51
51
|
padding: spacings[8],
|
|
52
52
|
},
|
|
53
53
|
inputWithUnit: {
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
float red = cameraPosition.x * cameraPosition.z;
|
|
2
|
-
float green = cameraPosition.y * cameraPosition.z;
|
|
3
|
-
float blue = 0.1;
|
|
4
|
-
|
|
5
|
-
red = sin(red / 5.0) + 1.0 / 2.0;
|
|
6
|
-
green = sin(green / 5.0) + 1.0 / 2.0;
|
|
7
|
-
|
|
8
|
-
vec3 shinyColor = vec3(red, green, blue);
|
|
9
|
-
float shinyFactor = 0.35;
|
|
10
|
-
|
|
11
|
-
diffuseColor.rgb = mix(diffuseColor.rgb, shinyColor, shinyFactor);
|