@swan-io/lake 2.4.0 → 2.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 +5 -1
- package/src/assets/3d-card/environment/nx.png +0 -0
- package/src/assets/3d-card/environment/ny.png +0 -0
- package/src/assets/3d-card/environment/nz.png +0 -0
- package/src/assets/3d-card/environment/px.png +0 -0
- package/src/assets/3d-card/environment/py.png +0 -0
- package/src/assets/3d-card/environment/pz.png +0 -0
- package/src/assets/3d-card/model/MaisonNeue-Book.woff +0 -0
- package/src/assets/3d-card/model/MarkPro-Regular.ttf +0 -0
- package/src/assets/3d-card/model/band_roughness.jpg +0 -0
- package/src/assets/3d-card/model/card.gltf +1094 -0
- package/src/assets/3d-card/model/chip.jpg +0 -0
- package/src/assets/3d-card/model/color_black.jpg +0 -0
- package/src/assets/3d-card/model/color_silver.jpg +0 -0
- package/src/assets/3d-card/shaders/shinyColorFragment.glsl +11 -0
- package/src/components/AutoWidthImage.d.ts +1 -1
- package/src/components/Card3dPreview.d.ts +19 -0
- package/src/components/Card3dPreview.js +168 -0
- package/src/components/DatePicker.d.ts +90 -0
- package/src/components/DatePicker.js +619 -0
- package/src/components/Filters.d.ts +8 -7
- package/src/components/Filters.js +9 -23
- package/src/components/FixedListViewCells.d.ts +2 -2
- package/src/components/Icon.d.ts +3 -0
- package/src/components/LakeCombobox.d.ts +6 -1
- package/src/components/LakeCombobox.js +7 -8
- package/src/components/LakeText.d.ts +1 -1
- package/src/components/LakeTextInput.d.ts +1 -1
- package/src/components/Stack.d.ts +1 -1
- package/src/components/TimePicker.d.ts +55 -0
- package/src/components/TimePicker.js +170 -0
- package/src/icons/custom-icons.json +1 -0
- package/src/icons/fluent-icons.json +2 -0
- package/src/utils/svg.d.ts +10 -0
- package/src/utils/svg.js +147 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
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);
|
|
@@ -18,7 +18,7 @@ export declare const AutoWidthImage: import("react").MemoExoticComponent<import(
|
|
|
18
18
|
borderBottomLeftRadius?: number | undefined;
|
|
19
19
|
borderBottomRightRadius?: number | undefined;
|
|
20
20
|
resizeMode?: import("react-native").ImageResizeMode | undefined;
|
|
21
|
-
resizeMethod?: "auto" | "
|
|
21
|
+
resizeMethod?: "auto" | "scale" | "resize" | undefined;
|
|
22
22
|
src?: string | undefined;
|
|
23
23
|
srcSet?: string | undefined;
|
|
24
24
|
loadingIndicatorSource?: import("react-native").ImageURISource | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
type CardParams = {
|
|
4
|
+
ownerName: string;
|
|
5
|
+
cardNumber: string;
|
|
6
|
+
expirationDate: string;
|
|
7
|
+
cvv: string;
|
|
8
|
+
color: "Silver" | "Black";
|
|
9
|
+
logo: SVGElement | null;
|
|
10
|
+
logoScale: number;
|
|
11
|
+
onSvgError?: (code: string) => void;
|
|
12
|
+
};
|
|
13
|
+
type Props = CardParams & {
|
|
14
|
+
autoRotationDuration?: number;
|
|
15
|
+
};
|
|
16
|
+
declare const _default: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default _default;
|
|
18
|
+
type CardProps = JSX.IntrinsicElements["group"] & CardParams;
|
|
19
|
+
export declare const Card: import("react").ForwardRefExoticComponent<Omit<CardProps, "ref"> & import("react").RefAttributes<THREE.Group>>;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Environment, OrbitControls, Text, useGLTF, useTexture } from "@react-three/drei";
|
|
3
|
+
import { Canvas, useFrame } from "@react-three/fiber";
|
|
4
|
+
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
5
|
+
import * as THREE from "three";
|
|
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
|
+
import { isNotNullish, isNullish } from "../utils/nullish";
|
|
22
|
+
import { createSvgImage, getMonochromeSvg } from "../utils/svg";
|
|
23
|
+
/*
|
|
24
|
+
This Module exports 2 components:
|
|
25
|
+
- default export: A react-three-fiber scene which can be integrated in any react project
|
|
26
|
+
(We use default export to be able to use React.lazy to load this component asynchronously without impacting bundle size)
|
|
27
|
+
- Card component: which can be use for developers who already have a react-three-fiber scene or want to create there own scene
|
|
28
|
+
|
|
29
|
+
Here are some details about choices made for this components:
|
|
30
|
+
:one: Textures
|
|
31
|
+
Textures aren't integrated in gltf export because it will force all developers to put texture files in their public folder.
|
|
32
|
+
By using ?url import and `useTexture` hook, Vite will put textures in dist folder for all developers who use this component.
|
|
33
|
+
|
|
34
|
+
:two: Logo integration
|
|
35
|
+
There is an SVGLoader for threejs but it doesn't support all svg features.
|
|
36
|
+
So to be sure to support all svg features, we transform the SVG into Image element to create a texture.
|
|
37
|
+
And this texture is used as an alpha map on a plane.
|
|
38
|
+
|
|
39
|
+
:three: Mastercard shiny text on back of card
|
|
40
|
+
To reproduce the shiny effect on the back of the card, we inject a custom shader in rainbow_mastercard material.
|
|
41
|
+
This custom shader chunk change the diffuse color depending on camera position.
|
|
42
|
+
*/
|
|
43
|
+
const ENV_MAP_INTENSITY = 3;
|
|
44
|
+
const CARD_WIDTH = 8.56;
|
|
45
|
+
const CARD_HEIGHT = 5.4;
|
|
46
|
+
const FRONT_TEXT_POSITION = 0.04;
|
|
47
|
+
const BACK_TEXT_POSITION = -FRONT_TEXT_POSITION;
|
|
48
|
+
const LOGO_MARGIN_TOP = 0.3;
|
|
49
|
+
const LOGO_MARGIN_RIGHT = 0.3;
|
|
50
|
+
const LOGO_MAX_WIDTH = 5; // in cm
|
|
51
|
+
const LOGO_MAX_HEIGHT = 1; // in cm
|
|
52
|
+
const computeCardLogoSize = (logoSize) => {
|
|
53
|
+
const logoRatio = logoSize.width / logoSize.height;
|
|
54
|
+
const cardSpaceRatio = LOGO_MAX_WIDTH / LOGO_MAX_HEIGHT;
|
|
55
|
+
// if logo is wider than available space
|
|
56
|
+
// logo will have the same width than available space
|
|
57
|
+
if (logoRatio >= cardSpaceRatio) {
|
|
58
|
+
const width = LOGO_MAX_WIDTH;
|
|
59
|
+
const height = width / logoRatio;
|
|
60
|
+
return { width, height };
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
// if logo is higher than available space
|
|
64
|
+
// logo will have the same height than available space
|
|
65
|
+
const height = LOGO_MAX_HEIGHT;
|
|
66
|
+
const width = height * logoRatio;
|
|
67
|
+
return { width, height };
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
// Use export default for React.lazy
|
|
71
|
+
export default (props) => {
|
|
72
|
+
return (_jsxs(Canvas, { camera: { position: [0, 0, 12], fov: 50 }, children: [_jsx(OrbitControls, { enablePan: false, enableZoom: false }), _jsx(CardScene, { ...props })] }));
|
|
73
|
+
};
|
|
74
|
+
const CardScene = ({ autoRotationDuration, ...props }) => {
|
|
75
|
+
const card = useRef(null);
|
|
76
|
+
useFrame(({ clock }) => {
|
|
77
|
+
if (autoRotationDuration != null && card.current != null) {
|
|
78
|
+
card.current.rotation.y = (clock.getElapsedTime() / autoRotationDuration) * Math.PI * 2;
|
|
79
|
+
}
|
|
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: [envPxUrl, envNxUrl, envPyUrl, envNyUrl, envPzUrl, envNzUrl] }), _jsx(Card, { ref: card, ...props })] }));
|
|
82
|
+
};
|
|
83
|
+
// Set color space to sRGB for textures
|
|
84
|
+
const setTextureColorSpace = (texture) => {
|
|
85
|
+
if (!Array.isArray(texture)) {
|
|
86
|
+
texture.colorSpace = THREE.SRGBColorSpace;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
export const Card = forwardRef(({ ownerName, cardNumber, expirationDate, cvv, color, logo, logoScale, onSvgError, ...props }, ref) => {
|
|
90
|
+
const { nodes, materials } = useGLTF(cardGltfUrl);
|
|
91
|
+
const [logoData, setLogoData] = useState(null);
|
|
92
|
+
const silverTexture = useTexture(colorSilverUrl, setTextureColorSpace);
|
|
93
|
+
const blackTexture = useTexture(colorBlackUrl, setTextureColorSpace);
|
|
94
|
+
const chipTexture = useTexture(chipUrl, setTextureColorSpace);
|
|
95
|
+
const bandRoughnessTexture = useTexture(bandRoughnessUrl); // keep default color space because it's grayscale
|
|
96
|
+
// Set environment map intensity for all materials
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
Object.values(materials).forEach(material => {
|
|
99
|
+
material.envMapIntensity = ENV_MAP_INTENSITY;
|
|
100
|
+
});
|
|
101
|
+
}, [materials]);
|
|
102
|
+
// Set rainbow mastercard text custom fragment shader
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
materials.rainbow_mastercard.onBeforeCompile = shader => {
|
|
105
|
+
shader.fragmentShader = shader.fragmentShader.replace("#include <color_fragment>", shinyColorFragmentShader);
|
|
106
|
+
};
|
|
107
|
+
}, [materials.rainbow_mastercard]);
|
|
108
|
+
// Set band roughness and chip texture
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
materials.black_band.roughness = 0.8;
|
|
111
|
+
materials.black_band.roughnessMap = bandRoughnessTexture;
|
|
112
|
+
materials.chip.map = chipTexture;
|
|
113
|
+
}, [materials.black_band, materials.chip, bandRoughnessTexture, chipTexture]);
|
|
114
|
+
// Set color texture
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
match(color)
|
|
117
|
+
.with("Silver", () => {
|
|
118
|
+
materials.card.map = silverTexture;
|
|
119
|
+
})
|
|
120
|
+
.with("Black", () => {
|
|
121
|
+
materials.card.map = blackTexture;
|
|
122
|
+
})
|
|
123
|
+
.exhaustive();
|
|
124
|
+
}, [color, materials.card, silverTexture, blackTexture]);
|
|
125
|
+
// this avoid to have onSvgError as dependency of the effect below which should run only on logo change
|
|
126
|
+
const handleSvgError = useRef(onSvgError);
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
handleSvgError.current = onSvgError;
|
|
129
|
+
}, [onSvgError]);
|
|
130
|
+
// Handle logo
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
if (isNullish(logo)) {
|
|
133
|
+
setLogoData(null);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
// We transform the logo to white to be able to use it as alpha map
|
|
137
|
+
const whiteLogo = getMonochromeSvg(logo, "white");
|
|
138
|
+
// Convert to Image element to be able to use it as texture
|
|
139
|
+
const image = createSvgImage(whiteLogo);
|
|
140
|
+
if (image.isError()) {
|
|
141
|
+
handleSvgError.current?.(image.getError());
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
// Compute logo size depending on constraints
|
|
145
|
+
const { width: logoWidth, height: logoHeight } = computeCardLogoSize(image.get());
|
|
146
|
+
const alphaMap = new THREE.Texture(image.get());
|
|
147
|
+
alphaMap.needsUpdate = true;
|
|
148
|
+
setLogoData({
|
|
149
|
+
size: [logoWidth, logoHeight],
|
|
150
|
+
alphaMap,
|
|
151
|
+
});
|
|
152
|
+
}, [logo]);
|
|
153
|
+
const mainTextMaterial = (_jsx("meshStandardMaterial", { color: match(color)
|
|
154
|
+
.with("Silver", () => 0x000000)
|
|
155
|
+
.with("Black", () => 0xeeeeee)
|
|
156
|
+
.exhaustive(), metalness: 0.1, roughness: 0.55, envMapIntensity: ENV_MAP_INTENSITY }));
|
|
157
|
+
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: fontMaisonNeueBookUrl, fontSize: 0.2, anchorX: "left", anchorY: "bottom", position: [-3.4, -1.95, 0], children: [ownerName, mainTextMaterial] }), _jsxs(Text, { font: fontMarkProRegularUrl, 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: fontMarkProRegularUrl, 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: fontMarkProRegularUrl, 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: fontMaisonNeueBookUrl, fontSize: 0.24, anchorX: "left", anchorY: "bottom", rotation: [0, Math.PI, 0], position: [4, 0.68, 0], children: ["Identifier: 0000000000", mainTextMaterial] }), _jsxs(Text, { font: fontMaisonNeueBookUrl, 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: fontMaisonNeueBookUrl, 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: fontMaisonNeueBookUrl, fontSize: 0.48, anchorX: "left", anchorY: "bottom", rotation: [0, Math.PI, 0], position: [4, -1.85, 0], children: [cardNumber, mainTextMaterial] }), _jsxs(Text, { font: fontMaisonNeueBookUrl, fontSize: 0.29, anchorX: "left", anchorY: "bottom", rotation: [0, Math.PI, 0], position: [4, -2.3, 0], children: [expirationDate, mainTextMaterial] }), _jsxs(Text, { font: fontMaisonNeueBookUrl, 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: fontMarkProRegularUrl, anchorX: "center", anchorY: "bottom", fontSize: 0.36, rotation: [0, Math.PI, 0], position: [-2.35, -1.15, 0], children: ["debit", mainTextMaterial] })] }), _jsx("group", {
|
|
159
|
+
// move group to change scale center at top right corner
|
|
160
|
+
position: [
|
|
161
|
+
CARD_WIDTH / 2 - LOGO_MARGIN_RIGHT,
|
|
162
|
+
CARD_HEIGHT / 2 - LOGO_MARGIN_TOP,
|
|
163
|
+
FRONT_TEXT_POSITION,
|
|
164
|
+
], scale: logoScale, children: isNotNullish(logoData) && (_jsxs("mesh", { position: [-logoData.size[0] / 2, -logoData.size[1] / 2, 0], children: [_jsx("planeGeometry", { args: logoData.size }), _jsx("meshStandardMaterial", { color: match(color)
|
|
165
|
+
.with("Silver", () => 0x000000)
|
|
166
|
+
.with("Black", () => 0xffffff)
|
|
167
|
+
.exhaustive(), metalness: 0.1, roughness: 0.35, envMapIntensity: ENV_MAP_INTENSITY, transparent: true, alphaMap: logoData.alphaMap })] })) }), _jsx("mesh", { geometry: nodes.black_band.geometry, material: materials.black_band, position: [0, 1.774, BACK_TEXT_POSITION], rotation: [0, Math.PI / 2, 0] }), _jsx("mesh", { geometry: nodes.chip.geometry, material: materials.chip, position: [-2.78, 0.439, FRONT_TEXT_POSITION], rotation: [0, Math.PI / 2, 0] }), _jsx("mesh", { geometry: nodes.chip_pattern.geometry, material: materials.chip_pattern, position: [-2.778, 0.442, FRONT_TEXT_POSITION + 0.001], rotation: [0, Math.PI / 2, 0] }), _jsx("mesh", { geometry: nodes.mc_center.geometry, material: materials.mastercard_orange, position: [3.052, -1.832, FRONT_TEXT_POSITION], rotation: [Math.PI / 2, 0, 0] }), _jsx("mesh", { geometry: nodes.mc_left.geometry, material: materials.mastercard_red, position: [2.676, -1.773, FRONT_TEXT_POSITION], rotation: [Math.PI / 2, 0, 0] }), _jsx("mesh", { geometry: nodes.mc_right.geometry, material: materials.mastercard_yellow, position: [3.47, -1.773, FRONT_TEXT_POSITION], rotation: [-Math.PI / 2, 0, 0] }), _jsx("mesh", { geometry: nodes.metal_circle.geometry, material: materials.rainbow, position: [-2.33, -1.849, BACK_TEXT_POSITION], rotation: [-Math.PI / 2, Math.PI / 2, 0] }), _jsx("mesh", { geometry: nodes.metal_circle001.geometry, material: materials.rainbow_rough, position: [-2.629, -1.849, BACK_TEXT_POSITION - 0.001], rotation: [-Math.PI / 2, Math.PI / 2, 0], scale: [0.35, 1, 0.35] }), _jsx("mesh", { geometry: nodes.metal_circle002.geometry, material: materials.rainbow_rough, position: [-2.33, -1.849, BACK_TEXT_POSITION - 0.001], rotation: [-Math.PI / 2, Math.PI / 2, 0] }), _jsx("mesh", { geometry: nodes.metal_mastercard.geometry, material: materials.rainbow_mastercard, position: [0.914, -1.298, BACK_TEXT_POSITION - 0.001], rotation: [Math.PI / 2, 0, Math.PI], scale: 0.09 })] }) }));
|
|
168
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Option } from "@swan-io/boxed";
|
|
2
|
+
import { ValidatorResult } from "react-ux-form";
|
|
3
|
+
import { Except } from "type-fest";
|
|
4
|
+
export type MonthNames = readonly [
|
|
5
|
+
string,
|
|
6
|
+
string,
|
|
7
|
+
string,
|
|
8
|
+
string,
|
|
9
|
+
string,
|
|
10
|
+
string,
|
|
11
|
+
string,
|
|
12
|
+
string,
|
|
13
|
+
string,
|
|
14
|
+
string,
|
|
15
|
+
string,
|
|
16
|
+
string
|
|
17
|
+
];
|
|
18
|
+
export type WeekDayNames = readonly [string, string, string, string, string, string, string];
|
|
19
|
+
declare const weekDayIndex: {
|
|
20
|
+
sunday: number;
|
|
21
|
+
monday: number;
|
|
22
|
+
tuesday: number;
|
|
23
|
+
wednesday: number;
|
|
24
|
+
thursday: number;
|
|
25
|
+
friday: number;
|
|
26
|
+
saturday: number;
|
|
27
|
+
};
|
|
28
|
+
export type DatePickerDate = {
|
|
29
|
+
day: number;
|
|
30
|
+
month: number;
|
|
31
|
+
year: number;
|
|
32
|
+
};
|
|
33
|
+
export type DatePickerRange = {
|
|
34
|
+
start: Option<DatePickerDate>;
|
|
35
|
+
end: Option<DatePickerDate>;
|
|
36
|
+
};
|
|
37
|
+
export type DateFormat = "DD/MM/YYYY" | "MM/DD/YYYY";
|
|
38
|
+
export declare const validateDateRangeOrder: (value: {
|
|
39
|
+
start: string;
|
|
40
|
+
end: string;
|
|
41
|
+
}, format: DateFormat) => boolean;
|
|
42
|
+
export declare const isTodayOrFutureDate: (date: DatePickerDate) => boolean;
|
|
43
|
+
export declare const isDateInRange: (minDate: Date, maxDate: Date) => (date: DatePickerDate) => boolean;
|
|
44
|
+
export type DatePickerProps = {
|
|
45
|
+
label: string;
|
|
46
|
+
value?: string;
|
|
47
|
+
error?: string;
|
|
48
|
+
format: DateFormat;
|
|
49
|
+
firstWeekDay: keyof typeof weekDayIndex;
|
|
50
|
+
monthNames: MonthNames;
|
|
51
|
+
weekDayNames: WeekDayNames;
|
|
52
|
+
isSelectable?: (date: DatePickerDate) => boolean;
|
|
53
|
+
onChange: (date: string) => void;
|
|
54
|
+
};
|
|
55
|
+
export declare const DatePicker: ({ label, value, error, format, firstWeekDay, monthNames, weekDayNames, isSelectable, onChange, }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
type DatePickerModalProps = Except<DatePickerProps, "error"> & {
|
|
57
|
+
visible: boolean;
|
|
58
|
+
cancelLabel: string;
|
|
59
|
+
confirmLabel: string;
|
|
60
|
+
validate?: (value: string) => ValidatorResult;
|
|
61
|
+
onDissmiss: () => void;
|
|
62
|
+
};
|
|
63
|
+
export declare const DatePickerModal: ({ value, format, firstWeekDay, monthNames, weekDayNames, isSelectable, onChange, visible, label, cancelLabel, confirmLabel, validate, onDissmiss, }: DatePickerModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
export type DateRangePickerProps = {
|
|
65
|
+
value: {
|
|
66
|
+
start: string;
|
|
67
|
+
end: string;
|
|
68
|
+
};
|
|
69
|
+
error?: string;
|
|
70
|
+
format: DateFormat;
|
|
71
|
+
startLabel: string;
|
|
72
|
+
endLabel: string;
|
|
73
|
+
firstWeekDay: keyof typeof weekDayIndex;
|
|
74
|
+
monthNames: MonthNames;
|
|
75
|
+
weekDayNames: WeekDayNames;
|
|
76
|
+
isSelectable?: (date: DatePickerDate) => boolean;
|
|
77
|
+
onChange: (date: {
|
|
78
|
+
start: string;
|
|
79
|
+
end: string;
|
|
80
|
+
}) => void;
|
|
81
|
+
};
|
|
82
|
+
export declare const DateRangePicker: ({ value, error, format, startLabel, endLabel, firstWeekDay, monthNames, weekDayNames, isSelectable, onChange, }: DateRangePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
type DateRangePickerModalProps = DateRangePickerProps & {
|
|
84
|
+
visible: boolean;
|
|
85
|
+
cancelLabel: string;
|
|
86
|
+
confirmLabel: string;
|
|
87
|
+
onDissmiss: () => void;
|
|
88
|
+
};
|
|
89
|
+
export declare const DateRangePickerModal: ({ value, error, format, firstWeekDay, monthNames, weekDayNames, isSelectable, onChange, visible, startLabel, endLabel, cancelLabel, confirmLabel, onDissmiss, }: DateRangePickerModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
90
|
+
export {};
|