@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
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
|
-
import { forwardRef, useCallback, useEffect, useMemo, useRef, useState
|
|
3
|
+
import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { FlatList, Pressable, StyleSheet, Text, View } from "react-native";
|
|
5
5
|
import { hasDefinedKeys, useForm } from "react-ux-form";
|
|
6
|
-
import { Rifm } from "rifm";
|
|
7
6
|
import { P, match } from "ts-pattern";
|
|
8
7
|
import { colors, shadows, spacings } from "../constants/design";
|
|
9
8
|
import { useDisclosure } from "../hooks/useDisclosure";
|
|
@@ -11,6 +10,7 @@ import { useMergeRefs } from "../hooks/useMergeRefs";
|
|
|
11
10
|
import { usePreviousValue } from "../hooks/usePreviousValue";
|
|
12
11
|
import { isNotNullish } from "../utils/nullish";
|
|
13
12
|
import { Box } from "./Box";
|
|
13
|
+
import { DatePickerModal, } from "./DatePicker";
|
|
14
14
|
import { Icon } from "./Icon";
|
|
15
15
|
import { LakeButton } from "./LakeButton";
|
|
16
16
|
import { LakeCheckbox } from "./LakeCheckbox";
|
|
@@ -154,28 +154,14 @@ function FilterCheckbox({ label, items, width, checkAllLabel, value, onValueChan
|
|
|
154
154
|
return (_jsxs(Pressable, { role: "radio", "aria-checked": isSelected, style: ({ hovered }) => [styles.radio, hovered && styles.itemHovered], onPress: onPress, children: [_jsx(LakeCheckbox, { value: isSelected }), _jsx(Space, { width: 12 }), _jsx(Text, { style: styles.itemLabel, children: item.label })] }));
|
|
155
155
|
} }), _jsx(Space, { height: 8 }), _jsx(View, { style: styles.buttonContainer, children: _jsx(LakeButton, { color: "current", onPress: save, children: applyButtonLabel }) }), _jsx(Space, { height: 24 })] }) })] }));
|
|
156
156
|
}
|
|
157
|
-
function FilterDate({ label, initialValue, noValueText, submitText, dateFormat,
|
|
157
|
+
function FilterDate({ label, monthNames, dayNames, initialValue, noValueText, cancelText, submitText, dateFormat, isSelectable, validate, onSave, onPressRemove, autoOpen = false, }) {
|
|
158
158
|
const inputRef = useRef(null);
|
|
159
159
|
const [visible, { close, toggle }] = useDisclosure(autoOpen);
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
});
|
|
166
|
-
useEffect(() => {
|
|
167
|
-
setFieldValue("date", isNotNullish(initialValue) ? dayjs(initialValue).format(dateFormat) : "");
|
|
168
|
-
}, [initialValue, dateFormat, setFieldValue]);
|
|
169
|
-
const onSubmit = () => {
|
|
170
|
-
submitForm(values => {
|
|
171
|
-
if (hasDefinedKeys(values, ["date"])) {
|
|
172
|
-
const date = dayjs(values.date, dateFormat, true).toJSON();
|
|
173
|
-
onSave(date);
|
|
174
|
-
close();
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: isNotNullish(initialValue) ? dayjs(initialValue).format(dateFormat) : noValueText }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsxs(View, { style: [styles.dropdown, styles.inputContent], children: [_jsx(Field, { name: "date", children: ({ value, onChange, error }) => (_jsx(Rifm, { value: value, onChange: onChange, ...rifmProps, children: ({ value, onChange }) => (_jsx(LakeLabel, { label: label, render: id => (_jsx(LakeTextInput, { nativeID: id, error: error, style: styles.input, placeholder: dateFormat, value: value, onChange: onChange })) })) })) }), _jsx(LakeButton, { color: "current", size: "small", onPress: onSubmit, children: submitText })] }) })] }));
|
|
160
|
+
const value = useMemo(() => (isNotNullish(initialValue) ? dayjs(initialValue).format(dateFormat) : ""), [initialValue, dateFormat]);
|
|
161
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: isNotNullish(initialValue) ? dayjs(initialValue).format(dateFormat) : noValueText }), _jsx(DatePickerModal, { visible: visible, monthNames: monthNames, weekDayNames: dayNames, format: dateFormat, firstWeekDay: "monday", label: label, cancelLabel: cancelText, confirmLabel: submitText, value: value, isSelectable: isSelectable, validate: validate, onChange: value => {
|
|
162
|
+
const formattedValue = dayjs(value, dateFormat, true).toJSON();
|
|
163
|
+
onSave(formattedValue);
|
|
164
|
+
}, onDissmiss: close })] }));
|
|
179
165
|
}
|
|
180
166
|
function FilterInput({ label, initialValue = "", noValueText, submitText, autoOpen = false, placeholder, validate, onSave, onPressRemove, }) {
|
|
181
167
|
const inputRef = useRef(null);
|
|
@@ -225,7 +211,7 @@ export const FiltersStack = ({ filters, openedFilters, definition, onChangeOpene
|
|
|
225
211
|
onChangeFilters({ ...filters, [filterName]: undefined });
|
|
226
212
|
onChangeOpened(openedFilters.filter(f => f !== filterName));
|
|
227
213
|
} })))
|
|
228
|
-
.with({ type: "date" }, ({ type, label, noValueText, submitText, dateFormat,
|
|
214
|
+
.with({ type: "date" }, ({ type, label, monthNames, dayNames, noValueText, cancelText, submitText, dateFormat, isSelectable, validate, }) => (_jsx(FilterDate, { label: label, monthNames: monthNames, dayNames: dayNames, noValueText: noValueText, cancelText: cancelText, submitText: submitText, dateFormat: dateFormat, autoOpen: lastOpenedFilter === filterName, isSelectable: isSelectable ? date => isSelectable(date, filters) : undefined, validate: validate ? value => validate(value, filters) : undefined, initialValue: getFilterValue(type, filters, filterName), onSave: value => onChangeFilters({ ...filters, [filterName]: value }), onPressRemove: () => {
|
|
229
215
|
onChangeFilters({ ...filters, [filterName]: undefined });
|
|
230
216
|
onChangeOpened(openedFilters.filter(f => f !== filterName));
|
|
231
217
|
} })))
|
|
@@ -19,13 +19,13 @@ export declare const SimpleTitleCell: ({ isHighlighted, text, }: {
|
|
|
19
19
|
text: string;
|
|
20
20
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
export declare const SimpleRegularTextCell: ({ variant, text, textAlign, color, }: {
|
|
22
|
-
variant?: "
|
|
22
|
+
variant?: "light" | "semibold" | "medium" | "regular" | "smallSemibold" | "smallMedium" | "smallRegular" | undefined;
|
|
23
23
|
text: string;
|
|
24
24
|
textAlign?: "left" | "right" | "center" | undefined;
|
|
25
25
|
color?: string | undefined;
|
|
26
26
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
export declare const CopyableRegularTextCell: ({ variant, text, copyWording, copiedWording, }: {
|
|
28
|
-
variant?: "
|
|
28
|
+
variant?: "light" | "semibold" | "medium" | "regular" | "smallSemibold" | "smallMedium" | "smallRegular" | undefined;
|
|
29
29
|
text: string;
|
|
30
30
|
copyWording: string;
|
|
31
31
|
copiedWording: string;
|
package/src/components/Icon.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { StyleProp, ViewStyle, WebAccessibilityProps } from "react-native";
|
|
3
3
|
declare const paths: {
|
|
4
|
+
"lake-building-bank": string;
|
|
4
5
|
"lake-calendar-arrow-swap": string;
|
|
5
6
|
"lake-card": string;
|
|
6
7
|
"lake-card-filled": string;
|
|
@@ -68,6 +69,8 @@ declare const paths: {
|
|
|
68
69
|
"cart-regular": string;
|
|
69
70
|
"chat-help-filled": string;
|
|
70
71
|
"chat-help-regular": string;
|
|
72
|
+
"check-filled": string;
|
|
73
|
+
"check-regular": string;
|
|
71
74
|
"checkmark-circle-regular": string;
|
|
72
75
|
"checkmark-filled": string;
|
|
73
76
|
"chevron-down-filled": string;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { AsyncData, Result } from "@swan-io/boxed";
|
|
2
2
|
import { ForwardedRef, ReactNode, RefObject } from "react";
|
|
3
3
|
import { IconName } from "./Icon";
|
|
4
|
+
import { LakeTextInputProps } from "./LakeTextInput";
|
|
4
5
|
export type LakeComboboxProps<I> = {
|
|
5
6
|
inputRef?: RefObject<unknown>;
|
|
6
7
|
value: string;
|
|
7
8
|
items: AsyncData<Result<I[], unknown>>;
|
|
9
|
+
itemHeight?: number;
|
|
10
|
+
nbItemsDisplayed?: number;
|
|
8
11
|
ListFooterComponent?: ReactNode;
|
|
12
|
+
onChange?: LakeTextInputProps["onChange"];
|
|
9
13
|
onValueChange: (value: string) => void;
|
|
10
14
|
onSelectItem: (value: I) => void | Promise<unknown>;
|
|
11
15
|
renderItem: (item: I) => ReactNode | null;
|
|
@@ -15,6 +19,7 @@ export type LakeComboboxProps<I> = {
|
|
|
15
19
|
disabled?: boolean;
|
|
16
20
|
emptyResultText: string;
|
|
17
21
|
error?: string;
|
|
22
|
+
hideErrors?: boolean;
|
|
18
23
|
id?: string;
|
|
19
24
|
readOnly?: boolean;
|
|
20
25
|
};
|
|
@@ -22,7 +27,7 @@ export type LakeComboboxRef = {
|
|
|
22
27
|
close: () => void;
|
|
23
28
|
open: () => void;
|
|
24
29
|
};
|
|
25
|
-
declare const LakeComboboxWithRef: <I>({ inputRef, value, items, ListFooterComponent, onValueChange, onSelectItem, renderItem, keyExtractor, icon, placeholder, disabled, emptyResultText, readOnly, id, error, }: LakeComboboxProps<I>, externalRef: ForwardedRef<LakeComboboxRef>) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
declare const LakeComboboxWithRef: <I>({ inputRef, value, items, itemHeight, nbItemsDisplayed, ListFooterComponent, onChange, onValueChange, onSelectItem, renderItem, keyExtractor, icon, placeholder, disabled, emptyResultText, readOnly, id, error, hideErrors, }: LakeComboboxProps<I>, externalRef: ForwardedRef<LakeComboboxRef>) => import("react/jsx-runtime").JSX.Element;
|
|
26
31
|
export declare const LakeCombobox: <I>(props: LakeComboboxProps<I> & {
|
|
27
32
|
ref?: RefObject<LakeComboboxRef> | undefined;
|
|
28
33
|
}) => ReturnType<typeof LakeComboboxWithRef>;
|
|
@@ -12,18 +12,16 @@ import { LakeTextInput } from "./LakeTextInput";
|
|
|
12
12
|
import { LoadingView } from "./LoadingView";
|
|
13
13
|
import { Popover } from "./Popover";
|
|
14
14
|
import { Space } from "./Space";
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
const DEFAULT_ELEMENT_HEIGHT = 64;
|
|
16
|
+
const DEFAULT_NB_SUGGESTION_DISPLAYED = 3.5;
|
|
17
17
|
const styles = StyleSheet.create({
|
|
18
18
|
list: {
|
|
19
|
-
maxHeight: ELEMENT_HEIGHT * NB_SUGGESTION_DISPLAYED,
|
|
20
19
|
marginVertical: spacings[8],
|
|
21
20
|
},
|
|
22
21
|
flatList: { scrollBehavior: "smooth" },
|
|
23
22
|
item: {
|
|
24
23
|
flexShrink: 1,
|
|
25
24
|
flexGrow: 1,
|
|
26
|
-
height: ELEMENT_HEIGHT,
|
|
27
25
|
justifyContent: "center",
|
|
28
26
|
paddingHorizontal: spacings[24],
|
|
29
27
|
paddingVertical: 0,
|
|
@@ -78,11 +76,11 @@ const styles = StyleSheet.create({
|
|
|
78
76
|
});
|
|
79
77
|
const isReactText = (node) => ["string", "number"].includes(typeof node);
|
|
80
78
|
const getItemLayout = (_data, index) => ({
|
|
81
|
-
length:
|
|
82
|
-
offset:
|
|
79
|
+
length: DEFAULT_ELEMENT_HEIGHT,
|
|
80
|
+
offset: DEFAULT_ELEMENT_HEIGHT * index,
|
|
83
81
|
index,
|
|
84
82
|
});
|
|
85
|
-
const LakeComboboxWithRef = ({ inputRef, value, items, ListFooterComponent, onValueChange, onSelectItem, renderItem, keyExtractor, icon, placeholder, disabled = false, emptyResultText, readOnly, id, error, }, externalRef) => {
|
|
83
|
+
const LakeComboboxWithRef = ({ inputRef, value, items, itemHeight = DEFAULT_ELEMENT_HEIGHT, nbItemsDisplayed = DEFAULT_NB_SUGGESTION_DISPLAYED, ListFooterComponent, onChange, onValueChange, onSelectItem, renderItem, keyExtractor, icon, placeholder, disabled = false, emptyResultText, readOnly, id, error, hideErrors, }, externalRef) => {
|
|
86
84
|
const ref = useRef(null);
|
|
87
85
|
const inputTextRef = useMergeRefs(ref, inputRef);
|
|
88
86
|
const listRef = useRef(null);
|
|
@@ -143,7 +141,7 @@ const LakeComboboxWithRef = ({ inputRef, value, items, ListFooterComponent, onVa
|
|
|
143
141
|
close();
|
|
144
142
|
}, 100);
|
|
145
143
|
}, [close]);
|
|
146
|
-
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, onChangeText: onValueChange, onFocus: handleFocus, onBlur: handleBlur, onKeyPress: handleKeyPress, id: id, readOnly: readOnly }), _jsx(Popover, { id: suggestionsId, role: "listbox", matchReferenceWidth: true, onDismiss: close, referenceRef: ref, autoFocus: true, returnFocus: false, visible: isFocused && !items.isNotAsked(), underlay: false, forcedMode: "Dropdown", children: _jsx(View, { style: styles.list, children: items.match({
|
|
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: true, returnFocus: false, visible: isFocused && !items.isNotAsked(), underlay: false, forcedMode: "Dropdown", children: _jsx(View, { style: [styles.list, { maxHeight: itemHeight * nbItemsDisplayed }], children: items.match({
|
|
147
145
|
NotAsked: () => null,
|
|
148
146
|
Loading: () => _jsx(LoadingView, { style: styles.loader }),
|
|
149
147
|
Done: items => items.match({
|
|
@@ -155,6 +153,7 @@ const LakeComboboxWithRef = ({ inputRef, value, items, ListFooterComponent, onVa
|
|
|
155
153
|
hovered && styles.hoveredItem,
|
|
156
154
|
focused && styles.focusedItem,
|
|
157
155
|
pressed && styles.pressedItem,
|
|
156
|
+
{ height: itemHeight },
|
|
158
157
|
], onPress: () => {
|
|
159
158
|
window.clearTimeout(blurTimeoutId.current);
|
|
160
159
|
setIsFetchingAdditionalInfo(true);
|
|
@@ -15,6 +15,6 @@ export declare const LakeText: import("react").ForwardRefExoticComponent<TextPro
|
|
|
15
15
|
children: ReactNode;
|
|
16
16
|
color?: string | undefined;
|
|
17
17
|
userSelect?: TextStyle["userSelect"];
|
|
18
|
-
variant?: "
|
|
18
|
+
variant?: "light" | "semibold" | "medium" | "regular" | "smallSemibold" | "smallMedium" | "smallRegular" | undefined;
|
|
19
19
|
} & import("react").RefAttributes<Text>>;
|
|
20
20
|
export {};
|
|
@@ -224,7 +224,7 @@ export declare const LakeTextInput: import("react").ForwardRefExoticComponent<{
|
|
|
224
224
|
disabled?: boolean | undefined;
|
|
225
225
|
color?: "current" | "gray" | "live" | "sandbox" | "positive" | "warning" | "negative" | "partner" | "swan" | "shakespear" | "darkPink" | "sunglow" | "mediumSladeBlue" | undefined;
|
|
226
226
|
multiline?: boolean | undefined;
|
|
227
|
-
icon?: "lake-calendar-arrow-swap" | "lake-card" | "lake-card-filled" | "lake-card-one-off" | "lake-card-physical" | "lake-card-recurring" | "lake-card-single-use" | "lake-card-virtual" | "lake-chevron-double" | "lake-clipboard-bullet" | "lake-clock" | "lake-clock-arrow-swap" | "lake-close" | "lake-currencies" | "lake-delivery-grouped" | "lake-delivery-individual" | "lake-document-csv" | "lake-document-jpg" | "lake-document-pdf" | "lake-document-png" | "lake-document-xls" | "lake-email" | "lake-id-card" | "lake-inbox-empty" | "lake-menu" | "lake-people" | "lake-person-arrow-swap" | "lake-phone" | "lake-receipt" | "lake-settings" | "lake-signature" | "lake-transfer" | "lake-world-map" | "add-circle-filled" | "add-circle-regular" | "add-filled" | "approvals-app-filled" | "apps-list-filled" | "apps-list-regular" | "arrow-counterclockwise-filled" | "arrow-down-filled" | "arrow-down-regular" | "arrow-download-filled" | "arrow-left-filled" | "arrow-left-regular" | "arrow-right-filled" | "arrow-right-regular" | "arrow-swap-filled" | "arrow-swap-regular" | "arrow-up-filled" | "arrow-up-regular" | "arrow-upload-filled" | "arrow-upload-regular" | "beaker-filled" | "beaker-regular" | "board-regular" | "box-regular" | "building-bank-filled" | "building-bank-regular" | "building-filled" | "building-multiple-regular" | "building-regular" | "building-shop-regular" | "calendar-ltr-regular" | "cart-regular" | "chat-help-filled" | "chat-help-regular" | "checkmark-circle-regular" | "checkmark-filled" | "chevron-down-filled" | "chevron-left-filled" | "chevron-right-filled" | "chevron-up-down-regular" | "chevron-up-filled" | "clipboard-search-regular" | "clock-filled" | "clock-regular" | "cloud-sync-filled" | "cloud-sync-regular" | "code-filled" | "code-regular" | "color-regular" | "comment-note-regular" | "copy-filled" | "copy-regular" | "cursor-click-regular" | "database-filled" | "database-regular" | "delete-filled" | "delete-regular" | "desktop-regular" | "device-meeting-room-regular" | "dismiss-circle-regular" | "dismiss-filled" | "dismiss-regular" | "document-regular" | "earth-regular" | "edit-filled" | "edit-regular" | "error-circle-filled" | "error-circle-regular" | "eye-filled" | "eye-off-filled" | "eye-regular" | "filter-filled" | "flag-filled" | "flag-regular" | "flash-filled" | "flash-regular" | "form-new-filled" | "form-new-regular" | "hand-right-regular" | "image-add-filled" | "image-add-regular" | "image-filled" | "image-regular" | "info-filled" | "info-regular" | "key-regular" | "link-filled" | "live-filled" | "live-regular" | "lock-closed-filled" | "lock-closed-regular" | "lock-open-filled" | "lock-open-regular" | "mail-filled" | "mail-regular" | "money-regular" | "more-vertical-filled" | "open-filled" | "open-regular" | "options-regular" | "paint-brush-filled" | "paint-brush-regular" | "pause-regular" | "payment-filled" | "payment-regular" | "people-add-regular" | "people-community-filled" | "people-community-regular" | "people-filled" | "people-regular" | "people-team-regular" | "person-accounts-filled" | "person-accounts-regular" | "person-add-regular" | "person-call-filled" | "person-call-regular" | "person-filled" | "person-lock-regular" | "person-regular" | "phone-filled" | "phone-regular" | "pin-regular" | "play-filled" | "play-regular" | "preview-link-filled" | "question-circle-regular" | "receipt-money-filled" | "receipt-money-regular" | "rocket-regular" | "search-filled" | "send-filled" | "send-regular" | "settings-filled" | "settings-regular" | "shield-checkmark-filled" | "shield-checkmark-regular" | "shield-error-regular" | "shield-regular" | "sign-out-regular" | "signature-filled" | "signature-regular" | "subtract-circle-filled" | "subtract-circle-regular" | "target-arrow-regular" | "warning-filled" | "warning-regular" | "window-dev-tools-filled" | "window-dev-tools-regular" | undefined;
|
|
227
|
+
icon?: "lake-building-bank" | "lake-calendar-arrow-swap" | "lake-card" | "lake-card-filled" | "lake-card-one-off" | "lake-card-physical" | "lake-card-recurring" | "lake-card-single-use" | "lake-card-virtual" | "lake-chevron-double" | "lake-clipboard-bullet" | "lake-clock" | "lake-clock-arrow-swap" | "lake-close" | "lake-currencies" | "lake-delivery-grouped" | "lake-delivery-individual" | "lake-document-csv" | "lake-document-jpg" | "lake-document-pdf" | "lake-document-png" | "lake-document-xls" | "lake-email" | "lake-id-card" | "lake-inbox-empty" | "lake-menu" | "lake-people" | "lake-person-arrow-swap" | "lake-phone" | "lake-receipt" | "lake-settings" | "lake-signature" | "lake-transfer" | "lake-world-map" | "add-circle-filled" | "add-circle-regular" | "add-filled" | "approvals-app-filled" | "apps-list-filled" | "apps-list-regular" | "arrow-counterclockwise-filled" | "arrow-down-filled" | "arrow-down-regular" | "arrow-download-filled" | "arrow-left-filled" | "arrow-left-regular" | "arrow-right-filled" | "arrow-right-regular" | "arrow-swap-filled" | "arrow-swap-regular" | "arrow-up-filled" | "arrow-up-regular" | "arrow-upload-filled" | "arrow-upload-regular" | "beaker-filled" | "beaker-regular" | "board-regular" | "box-regular" | "building-bank-filled" | "building-bank-regular" | "building-filled" | "building-multiple-regular" | "building-regular" | "building-shop-regular" | "calendar-ltr-regular" | "cart-regular" | "chat-help-filled" | "chat-help-regular" | "check-filled" | "check-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;
|
|
228
228
|
unit?: string | undefined;
|
|
229
229
|
inputMode?: TextInputProps["inputMode"];
|
|
230
230
|
pattern?: string | undefined;
|
|
@@ -7,6 +7,6 @@ export declare const Stack: import("react").ForwardRefExoticComponent<import("re
|
|
|
7
7
|
justifyContent?: ("end" | "start" | "normal" | "center" | "spaceBetween" | "spaceAround" | "spaceEvenly") | undefined;
|
|
8
8
|
style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
9
9
|
} & {
|
|
10
|
-
space?: 4 |
|
|
10
|
+
space?: 4 | 16 | 8 | 12 | 20 | 24 | 32 | 40 | 48 | 72 | 96 | undefined;
|
|
11
11
|
wrap?: boolean | undefined;
|
|
12
12
|
} & import("react").RefAttributes<View>>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Option } from "@swan-io/boxed";
|
|
2
|
+
type Time = {
|
|
3
|
+
hour: number;
|
|
4
|
+
minute: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const parseTime: (time: string) => Option<Time>;
|
|
7
|
+
export declare const parseTimeRange: (value: {
|
|
8
|
+
start?: string;
|
|
9
|
+
end?: string;
|
|
10
|
+
}) => {
|
|
11
|
+
start: Option<Time>;
|
|
12
|
+
end: Option<Time>;
|
|
13
|
+
};
|
|
14
|
+
export declare const validateTime: (time: Time) => boolean;
|
|
15
|
+
export declare const validateTimeRange: (range: {
|
|
16
|
+
start: Option<Time>;
|
|
17
|
+
end: Option<Time>;
|
|
18
|
+
}) => boolean;
|
|
19
|
+
export type TimePickerProps = {
|
|
20
|
+
value?: string;
|
|
21
|
+
onChangeText: (value: string) => void;
|
|
22
|
+
suggestionStart?: Time;
|
|
23
|
+
suggestionEnd?: Time;
|
|
24
|
+
intervalInMinutes?: number;
|
|
25
|
+
nbMaxSuggestions?: number;
|
|
26
|
+
suggestionSuffix?: (option: Time) => string;
|
|
27
|
+
readOnly?: boolean;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
error?: string;
|
|
30
|
+
hideErrors?: boolean;
|
|
31
|
+
noSuggestionLabel: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const TimePicker: ({ value, onChangeText, suggestionStart, suggestionEnd, intervalInMinutes, nbMaxSuggestions, suggestionSuffix, readOnly, disabled, error, hideErrors, noSuggestionLabel, }: TimePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export type TimeRangePickerProps = {
|
|
35
|
+
value: {
|
|
36
|
+
start?: string;
|
|
37
|
+
end?: string;
|
|
38
|
+
};
|
|
39
|
+
onChange: (value: {
|
|
40
|
+
start?: string;
|
|
41
|
+
end?: string;
|
|
42
|
+
}) => void;
|
|
43
|
+
intervalInMinutes?: number;
|
|
44
|
+
nbMaxSuggestions?: number;
|
|
45
|
+
readOnly?: boolean;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
error?: string;
|
|
48
|
+
startLabel: string;
|
|
49
|
+
endLabel: string;
|
|
50
|
+
minutesLabel: string;
|
|
51
|
+
hoursLabel: string;
|
|
52
|
+
noSuggestionLabel: string;
|
|
53
|
+
};
|
|
54
|
+
export declare const TimeRangePicker: ({ value, onChange, intervalInMinutes, nbMaxSuggestions, readOnly, disabled, error, startLabel, endLabel, minutesLabel, hoursLabel, noSuggestionLabel, }: TimeRangePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AsyncData, Option, Result } from "@swan-io/boxed";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { StyleSheet, View } from "react-native";
|
|
5
|
+
import { Rifm } from "rifm";
|
|
6
|
+
import { colors } from "../constants/design";
|
|
7
|
+
import { noop } from "../utils/function";
|
|
8
|
+
import { isNotNullishOrEmpty, isNullish } from "../utils/nullish";
|
|
9
|
+
import { getRifmProps } from "../utils/rifm";
|
|
10
|
+
import { Box } from "./Box";
|
|
11
|
+
import { Fill } from "./Fill";
|
|
12
|
+
import { Icon } from "./Icon";
|
|
13
|
+
import { LakeCombobox } from "./LakeCombobox";
|
|
14
|
+
import { LakeLabel } from "./LakeLabel";
|
|
15
|
+
import { LakeText } from "./LakeText";
|
|
16
|
+
import { Space } from "./Space";
|
|
17
|
+
const styles = StyleSheet.create({
|
|
18
|
+
label: {
|
|
19
|
+
flex: 1,
|
|
20
|
+
},
|
|
21
|
+
arrowContainer: {
|
|
22
|
+
height: 40, // input height
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const DEFAULT_START_TIME = { hour: 0, minute: 0 };
|
|
26
|
+
const DEFAULT_END_TIME = { hour: 23, minute: 59 };
|
|
27
|
+
const DEFAULT_INTERVAL_IN_MINUTES = 15;
|
|
28
|
+
const rifmTimeProps = getRifmProps({
|
|
29
|
+
accept: "numeric",
|
|
30
|
+
charMap: { 2: ":" },
|
|
31
|
+
maxLength: 4,
|
|
32
|
+
});
|
|
33
|
+
export const parseTime = (time) => {
|
|
34
|
+
const [hours, minutes] = time.split(":").map(Number);
|
|
35
|
+
if (isNullish(hours) || isNaN(hours) || isNullish(minutes) || isNaN(minutes)) {
|
|
36
|
+
return Option.None();
|
|
37
|
+
}
|
|
38
|
+
return Option.Some({ hour: hours, minute: minutes });
|
|
39
|
+
};
|
|
40
|
+
export const parseTimeRange = (value) => {
|
|
41
|
+
const start = isNotNullishOrEmpty(value.start) ? parseTime(value.start) : Option.None();
|
|
42
|
+
const end = isNotNullishOrEmpty(value.end) ? parseTime(value.end) : Option.None();
|
|
43
|
+
return { start, end };
|
|
44
|
+
};
|
|
45
|
+
const parseTypingHours = (time) => {
|
|
46
|
+
const [hours, minutes] = time.split(":");
|
|
47
|
+
if (isNullish(hours) || hours?.length !== 2 || isNotNullishOrEmpty(minutes)) {
|
|
48
|
+
return Option.None();
|
|
49
|
+
}
|
|
50
|
+
const parsedHours = Number(hours);
|
|
51
|
+
if (parsedHours < 0 || parsedHours > 23) {
|
|
52
|
+
return Option.None();
|
|
53
|
+
}
|
|
54
|
+
if (isNaN(parsedHours)) {
|
|
55
|
+
return Option.None();
|
|
56
|
+
}
|
|
57
|
+
return Option.Some(parsedHours);
|
|
58
|
+
};
|
|
59
|
+
const stringifyTime = (time) => {
|
|
60
|
+
return `${time.hour.toString().padStart(2, "0")}:${time.minute.toString().padStart(2, "0")}`;
|
|
61
|
+
};
|
|
62
|
+
const timeToMinutes = (time) => {
|
|
63
|
+
return time.hour * 60 + time.minute;
|
|
64
|
+
};
|
|
65
|
+
const minutesToTime = (minutes) => {
|
|
66
|
+
return {
|
|
67
|
+
hour: Math.floor(minutes / 60),
|
|
68
|
+
minute: minutes % 60,
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const addMinutes = (time, minutes) => {
|
|
72
|
+
return minutesToTime(timeToMinutes(time) + minutes);
|
|
73
|
+
};
|
|
74
|
+
const floorTime = (time, intervalInMinutes) => {
|
|
75
|
+
const minutes = timeToMinutes(time);
|
|
76
|
+
const flooredMinutes = Math.floor(minutes / intervalInMinutes) * intervalInMinutes;
|
|
77
|
+
return minutesToTime(flooredMinutes);
|
|
78
|
+
};
|
|
79
|
+
export const validateTime = (time) => {
|
|
80
|
+
return time.hour >= 0 && time.hour <= 23 && time.minute >= 0 && time.minute <= 59;
|
|
81
|
+
};
|
|
82
|
+
const isTimeBefore = (time1, time2) => {
|
|
83
|
+
return timeToMinutes(time1) < timeToMinutes(time2);
|
|
84
|
+
};
|
|
85
|
+
export const validateTimeRange = (range) => {
|
|
86
|
+
if (range.start.isNone() || range.end.isNone()) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
return isTimeBefore(range.start.value, range.end.value);
|
|
90
|
+
};
|
|
91
|
+
const minTime = (...times) => {
|
|
92
|
+
const timesInMinutes = times.map(timeToMinutes);
|
|
93
|
+
const minTimeInMinutes = Math.min(...timesInMinutes);
|
|
94
|
+
return minutesToTime(minTimeInMinutes);
|
|
95
|
+
};
|
|
96
|
+
const maxTime = (...times) => {
|
|
97
|
+
const timesInMinutes = times.map(timeToMinutes);
|
|
98
|
+
const maxTimeInMinutes = Math.max(...timesInMinutes);
|
|
99
|
+
return minutesToTime(maxTimeInMinutes);
|
|
100
|
+
};
|
|
101
|
+
const generateTimeList = (start, end, intervalInMinutes) => {
|
|
102
|
+
const startMinutes = timeToMinutes(start);
|
|
103
|
+
const endMinutes = timeToMinutes(end);
|
|
104
|
+
const timeList = [];
|
|
105
|
+
for (let i = startMinutes; i <= endMinutes; i += intervalInMinutes) {
|
|
106
|
+
const time = minutesToTime(i);
|
|
107
|
+
timeList.push(time);
|
|
108
|
+
}
|
|
109
|
+
return timeList;
|
|
110
|
+
};
|
|
111
|
+
const formatTimeDuration = (time, minutesLabel, hoursLabel) => {
|
|
112
|
+
if (time.hour === 0) {
|
|
113
|
+
return `${time.minute} ${minutesLabel}`;
|
|
114
|
+
}
|
|
115
|
+
if (time.minute === 0) {
|
|
116
|
+
return `${time.hour} ${hoursLabel}`;
|
|
117
|
+
}
|
|
118
|
+
return `${time.hour} ${hoursLabel} ${time.minute} ${minutesLabel}`;
|
|
119
|
+
};
|
|
120
|
+
export const TimePicker = ({ value, onChangeText, suggestionStart = DEFAULT_START_TIME, suggestionEnd = DEFAULT_END_TIME, intervalInMinutes = DEFAULT_INTERVAL_IN_MINUTES, nbMaxSuggestions, suggestionSuffix, readOnly, disabled, error, hideErrors, noSuggestionLabel, }) => {
|
|
121
|
+
const typingHour = parseTypingHours(value ?? "");
|
|
122
|
+
const optionsInterval = useMemo(() => typingHour.match({
|
|
123
|
+
Some: hour => [
|
|
124
|
+
maxTime({ hour, minute: 0 }, suggestionStart),
|
|
125
|
+
minTime({ hour, minute: 59 }, suggestionEnd),
|
|
126
|
+
],
|
|
127
|
+
None: () => [suggestionStart, suggestionEnd],
|
|
128
|
+
}), [typingHour, suggestionStart, suggestionEnd]);
|
|
129
|
+
const options = useMemo(() => generateTimeList(optionsInterval[0], optionsInterval[1], intervalInMinutes).slice(0, nbMaxSuggestions), [optionsInterval, intervalInMinutes, nbMaxSuggestions]);
|
|
130
|
+
const items = useMemo(() => AsyncData.Done(Result.Ok(options)), [options]);
|
|
131
|
+
return (_jsx(Rifm, { value: value ?? "", onChange: onChangeText, ...rifmTimeProps, children: ({ value, onChange }) => (_jsx(LakeCombobox, { keyExtractor: stringifyTime, placeholder: "HH:MM", value: value, items: items, itemHeight: 40, nbItemsDisplayed: 4.5, renderItem: item => {
|
|
132
|
+
const text = stringifyTime(item);
|
|
133
|
+
const selected = text === value;
|
|
134
|
+
const suffix = suggestionSuffix?.(item);
|
|
135
|
+
const label = isNotNullishOrEmpty(suffix) ? `${text} ${suffix}` : text;
|
|
136
|
+
return (_jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(LakeText, { color: selected ? colors.gray[700] : colors.gray[900], variant: selected ? "smallRegular" : "medium", children: label }), _jsx(Fill, { minWidth: 8 }), selected && (_jsx(Icon, { name: "checkmark-filled", color: colors.positive[500], size: 16 }))] }));
|
|
137
|
+
}, readOnly: readOnly, disabled: disabled, error: error, hideErrors: hideErrors, emptyResultText: noSuggestionLabel, onChange: onChange, onValueChange: noop, onSelectItem: item => onChangeText(stringifyTime(item)) })) }));
|
|
138
|
+
};
|
|
139
|
+
export const TimeRangePicker = ({ value, onChange, intervalInMinutes = DEFAULT_INTERVAL_IN_MINUTES, nbMaxSuggestions, readOnly, disabled, error, startLabel, endLabel, minutesLabel, hoursLabel, noSuggestionLabel, }) => {
|
|
140
|
+
const start = parseTime(value.start ?? "");
|
|
141
|
+
const handleStartChange = (startValue) => {
|
|
142
|
+
onChange({
|
|
143
|
+
start: startValue,
|
|
144
|
+
end: value.end,
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const handleEndChange = (endValue) => {
|
|
148
|
+
onChange({
|
|
149
|
+
start: value.start,
|
|
150
|
+
end: endValue,
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
return (_jsxs(View, { children: [_jsxs(Box, { direction: "row", alignItems: "end", children: [_jsx(LakeLabel, { label: startLabel, style: styles.label, render: () => (_jsx(TimePicker, { value: value.start, intervalInMinutes: intervalInMinutes, nbMaxSuggestions: nbMaxSuggestions, error: error, hideErrors: true, disabled: disabled, readOnly: readOnly, noSuggestionLabel: noSuggestionLabel, onChangeText: handleStartChange })) }), _jsx(Space, { width: 12 }), _jsx(Box, { style: styles.arrowContainer, justifyContent: "center", children: _jsx(Icon, { name: "arrow-right-filled", size: 20 }) }), _jsx(Space, { width: 12 }), _jsx(LakeLabel, { label: endLabel, style: styles.label, render: () => (_jsx(TimePicker, { value: value.end, intervalInMinutes: intervalInMinutes, nbMaxSuggestions: nbMaxSuggestions, suggestionStart: start
|
|
154
|
+
.map(time => floorTime(time, intervalInMinutes))
|
|
155
|
+
.map(time => addMinutes(time, intervalInMinutes))
|
|
156
|
+
.match({
|
|
157
|
+
Some: time => time,
|
|
158
|
+
None: () => undefined,
|
|
159
|
+
}), suggestionSuffix: time => {
|
|
160
|
+
if (start.isNone()) {
|
|
161
|
+
return "";
|
|
162
|
+
}
|
|
163
|
+
const durationInMinutes = timeToMinutes(time) - timeToMinutes(start.value);
|
|
164
|
+
if (durationInMinutes > 0 && durationInMinutes <= 60) {
|
|
165
|
+
const timeDuration = minutesToTime(durationInMinutes);
|
|
166
|
+
return `(${formatTimeDuration(timeDuration, minutesLabel, hoursLabel)})`;
|
|
167
|
+
}
|
|
168
|
+
return "";
|
|
169
|
+
}, error: error, hideErrors: true, disabled: disabled, readOnly: readOnly, noSuggestionLabel: noSuggestionLabel, onChangeText: handleEndChange })) })] }), _jsx(Space, { height: 4 }), _jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], children: error ?? " " })] }));
|
|
170
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"lake-building-bank": "M6.86995 10.4254C6.86995 10.3592 6.81622 10.3054 6.74995 10.3054H6.31432C5.84044 10.3054 5.63999 9.70175 6.01971 9.41832L11.6007 5.2527C11.8375 5.07592 12.1624 5.07592 12.3992 5.25271L17.9799 9.41833C18.3597 9.70176 18.1592 10.3054 17.6853 10.3054H17.2499C17.1837 10.3054 17.1299 10.3592 17.1299 10.4254V14.6271C17.1299 14.6734 17.1566 14.7156 17.1985 14.7355C17.779 15.0113 18.1799 15.6028 18.1799 16.2877V17.5126C18.1799 17.688 18.0378 17.8301 17.8624 17.8301H6.13745C5.96209 17.8301 5.81995 17.688 5.81995 17.5126V16.2877C5.81995 15.6028 6.2209 15.0113 6.80144 14.7355C6.84328 14.7156 6.86995 14.6734 6.86995 14.6271V10.4254ZM16.3749 14.5703C16.4412 14.5703 16.4949 14.5166 16.4949 14.4503V10.4254C16.4949 10.3592 16.4412 10.3054 16.3749 10.3054H14.7999C14.7337 10.3054 14.6799 10.3592 14.6799 10.4254V14.4503C14.6799 14.5166 14.7337 14.5703 14.7999 14.5703H16.3749ZM13.9249 14.5703C13.9912 14.5703 14.0449 14.5166 14.0449 14.4503V10.4254C14.0449 10.3592 13.9912 10.3054 13.9249 10.3054H12.4374C12.3712 10.3054 12.3174 10.3592 12.3174 10.4254V14.4503C12.3174 14.5166 12.3712 14.5703 12.4374 14.5703H13.9249ZM11.5624 14.5703C11.6287 14.5703 11.6824 14.5166 11.6824 14.4503V10.4254C11.6824 10.3592 11.6287 10.3054 11.5624 10.3054H10.0749C10.0087 10.3054 9.95495 10.3592 9.95495 10.4254V14.4503C9.95495 14.5166 10.0087 14.5703 10.0749 14.5703H11.5624ZM9.19995 14.5703C9.26622 14.5703 9.31995 14.5166 9.31995 14.4503V10.4254C9.31995 10.3592 9.26622 10.3054 9.19995 10.3054H7.62495C7.55867 10.3054 7.50495 10.3592 7.50495 10.4254V14.4503C7.50495 14.5166 7.55867 14.5703 7.62495 14.5703H9.19995ZM7.03304 9.45432C6.99161 9.48524 6.97464 9.53923 6.99094 9.5883C7.00723 9.63737 7.05312 9.67048 7.10482 9.67048H16.8949C16.9466 9.67048 16.9924 9.63737 17.0087 9.5883C17.025 9.53923 17.0081 9.48525 16.9666 9.45432L12.0717 5.80059C12.0291 5.76881 11.9707 5.76881 11.9282 5.80059L7.03304 9.45432ZM17.4249 17.1952C17.4912 17.1952 17.5449 17.1414 17.5449 17.0752V16.2877C17.5449 15.6899 17.0603 15.2053 16.4624 15.2053H7.53745C6.9396 15.2053 6.45495 15.6899 6.45495 16.2877V17.0752C6.45495 17.1414 6.50867 17.1952 6.57495 17.1952H17.4249ZM12.5799 7.80065C12.5799 8.12095 12.3203 8.38062 11.9999 8.38062C11.6796 8.38062 11.4199 8.12095 11.4199 7.80065C11.4199 7.48035 11.6796 7.22069 11.9999 7.22069C12.3203 7.22069 12.5799 7.48035 12.5799 7.80065Z",
|
|
2
3
|
"lake-calendar-arrow-swap": "M9 12.38a1.13 1.13 0 1 1-2.25 0 1.13 1.13 0 0 1 2.25 0Zm-1.12 4.87a1.13 1.13 0 1 0 0-2.25 1.13 1.13 0 0 0 0 2.25Zm4.36-.03a1.13 1.13 0 0 1-1.37-1.1 1.13 1.13 0 0 1 1.86-.85 6.73 6.73 0 0 0-.49 1.95Z M12.43 19.5H6.75c-1.24 0-2.25-1-2.25-2.25V9h15v2.36c.52.06 1.02.18 1.5.36V6.75A3.75 3.75 0 0 0 17.25 3H6.75A3.75 3.75 0 0 0 3 6.75v10.5A3.75 3.75 0 0 0 6.75 21h6.29a6.47 6.47 0 0 1-.6-1.5ZM4.5 6.75c0-1.24 1-2.25 2.25-2.25h10.5c1.24 0 2.25 1 2.25 2.25v.75h-15v-.75Z M16.91 11.57a1.12 1.12 0 0 0-1.9.91c.57-.4 1.21-.7 1.9-.9ZM12 13.5a1.13 1.13 0 1 0 0-2.25 1.13 1.13 0 0 0 0 2.25Z M18.73 22.97a5.14 5.14 0 1 0 0-10.28 5.14 5.14 0 0 0 0 10.28Zm.59-7.47c.1-.1.26-.1.36 0l1.03 1.03c.1.1.1.27 0 .37l-1.03 1.02a.26.26 0 1 1-.36-.36l.59-.59h-2.98a.26.26 0 1 1 0-.51h2.98l-.6-.6a.26.26 0 0 1 0-.36Zm-1.18 2.23c.1.1.1.27 0 .37l-.6.59h2.99a.26.26 0 0 1 0 .51h-2.98l.59.59a.26.26 0 0 1-.36.36l-1.03-1.03a.26.26 0 0 1 0-.36l1.03-1.03c.1-.1.26-.1.36 0Z",
|
|
3
4
|
"lake-card": "M5.54815 10.596H18.4521V15.398C18.4521 15.8962 18.0483 16.3 17.5501 16.3H6.45015C5.95199 16.3 5.54815 15.8962 5.54815 15.398V10.596ZM5.54815 10V8.498C5.54815 7.99984 5.95199 7.596 6.45015 7.596H17.5501C18.0483 7.596 18.4521 7.99984 18.4521 8.498V10H5.54815ZM14.6999 13.84C14.4856 13.84 14.3119 14.0137 14.3119 14.228C14.3119 14.4423 14.4856 14.616 14.6999 14.616H16.4999C16.7142 14.616 16.8879 14.4423 16.8879 14.228C16.8879 14.0137 16.7142 13.84 16.4999 13.84H14.6999ZM6.45015 7C5.62283 7 4.95215 7.67068 4.95215 8.498V15.398C4.95215 16.2253 5.62283 16.896 6.45015 16.896H17.5501C18.3775 16.896 19.0481 16.2253 19.0481 15.398V8.498C19.0481 7.67068 18.3775 7 17.5501 7H6.45015Z",
|
|
4
5
|
"lake-card-filled": "M15.75 15C15.3358 15 15 15.3358 15 15.75C15 16.1642 15.3358 16.5 15.75 16.5H18.75C19.1642 16.5 19.5 16.1642 19.5 15.75C19.5 15.3358 19.1642 15 18.75 15H15.75ZM1.5 7.5C1.5 5.84315 2.84315 4.5 4.5 4.5H19.5C21.1569 4.5 22.5 5.84315 22.5 7.5V16.5C22.5 18.1569 21.1569 19.5 19.5 19.5H4.5C2.84315 19.5 1.5 18.1569 1.5 16.5V7.5ZM21 7.5C21 6.67157 20.3284 6 19.5 6H4.5C3.67157 6 3 6.67157 3 7.5V9H21V7.5ZM3 16.5C3 17.3284 3.67157 18 4.5 18H19.5C20.3284 18 21 17.3284 21 16.5V10.5H3V16.5Z",
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
"cart-regular": "M2.5 4.25c0-.41.34-.75.75-.75h.56c.95 0 1.52.64 1.84 1.23.22.4.38.86.5 1.27h12.6c.83 0 1.43.8 1.2 1.6L18.12 14a2.75 2.75 0 0 1-2.64 2H9.53a2.75 2.75 0 0 1-2.65-2.02l-.76-2.78-1.26-4.24v-.01c-.16-.57-.3-1.1-.52-1.5C4.13 5.07 3.96 5 3.8 5h-.56a.75.75 0 0 1-.75-.75Zm5.07 6.59.75 2.74c.15.54.65.92 1.21.92h5.95c.56 0 1.05-.37 1.2-.9l1.74-6.1H6.59l.97 3.29.01.05ZM11 19a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm-1.5 0a.5.5 0 1 0-1 0 .5.5 0 0 0 1 0Zm8.5 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm-1.5 0a.5.5 0 1 0-1 0 .5.5 0 0 0 1 0Z",
|
|
34
34
|
"chat-help-filled": "M12 2a10 10 0 1 1-4.64 18.86l-4.3 1.12a.85.85 0 0 1-1.03-1.04l1.11-4.29A10 10 0 0 1 12 2Zm0 13.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm0-8.75A2.75 2.75 0 0 0 9.25 9.5a.75.75 0 0 0 1.5.1v-.23a1.25 1.25 0 0 1 2.5.13c0 .54-.13.8-.64 1.33l-.3.31c-.76.79-1.06 1.35-1.06 2.36a.75.75 0 0 0 1.5 0c0-.54.13-.8.64-1.33l.3-.31c.76-.79 1.06-1.35 1.06-2.36A2.75 2.75 0 0 0 12 6.75Z",
|
|
35
35
|
"chat-help-regular": "M12 2a10 10 0 1 1-4.59 18.89L3.6 21.96a1.25 1.25 0 0 1-1.54-1.54l1.06-3.83A10 10 0 0 1 12 2Zm0 1.5a8.5 8.5 0 0 0-7.43 12.64l.15.27-1.1 3.98 3.98-1.11.27.15A8.5 8.5 0 1 0 12 3.5Zm0 12a1 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",
|
|
36
|
+
"check-filled": "M21.77 5.79a.75.75 0 1 0-1.04-1.08l-6.75 6.5a.75.75 0 1 0 1.04 1.08l6.75-6.5ZM18.99 5H4.55A2.55 2.55 0 0 0 2 7.55v6.9C2 15.85 3.14 17 4.55 17h14.9c1.4 0 2.55-1.14 2.55-2.55v-6.9c0-.18-.02-.36-.06-.54l-6.23 6a1.75 1.75 0 0 1-2.42-2.52L18.99 5ZM4.5 9.25c0-.41.34-.75.75-.75h2a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1-.75-.75Zm0 3.5c0-.41.34-.75.75-.75h5a.75.75 0 0 1 0 1.5h-5a.75.75 0 0 1-.75-.75Z",
|
|
37
|
+
"check-regular": "M21.78 5.78a.75.75 0 0 0-1.06-1.06l-7.5 7.5a.75.75 0 1 0 1.06 1.06l7.5-7.5Zm.17 1.25c.03.17.05.34.05.52v6.9c0 1.4-1.14 2.55-2.55 2.55H4.55A2.55 2.55 0 0 1 2 14.45v-6.9C2 6.15 3.14 5 4.55 5h14.48l-1.5 1.5H4.55c-.58 0-1.05.47-1.05 1.05v6.9c0 .58.47 1.05 1.05 1.05h14.9c.58 0 1.05-.47 1.05-1.05V8.47l1.45-1.44ZM4.5 9.25c0-.41.34-.75.75-.75h2a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1-.75-.75Zm0 3.5c0-.41.34-.75.75-.75h5a.75.75 0 0 1 0 1.5h-5a.75.75 0 0 1-.75-.75Z",
|
|
36
38
|
"checkmark-circle-regular": "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm0 1.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17Zm-1.25 9.94 4.47-4.47a.75.75 0 0 1 1.13.98l-.07.08-5 5a.75.75 0 0 1-.98.07l-.08-.07-2.5-2.5a.75.75 0 0 1 .98-1.13l.08.07 1.97 1.97 4.47-4.47-4.47 4.47Z",
|
|
37
39
|
"checkmark-filled": "m8.5 16.59-3.8-3.8a1 1 0 0 0-1.4 1.42l4.5 4.5a1 1 0 0 0 1.4 0l11-11a1 1 0 0 0-1.4-1.42L8.5 16.6Z",
|
|
38
40
|
"chevron-down-filled": "M4.3 8.3a1 1 0 0 1 1.4 0l6.3 6.29 6.3-6.3a1 1 0 1 1 1.4 1.42l-7 7a1 1 0 0 1-1.4 0l-7-7a1 1 0 0 1 0-1.42Z",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Result } from "@swan-io/boxed";
|
|
2
|
+
type Size = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const convertSvgToBase64Uri: (svg: SVGElement) => string;
|
|
7
|
+
export declare const getSvgSize: (svg: SVGElement) => Result<Size, string>;
|
|
8
|
+
export declare const getMonochromeSvg: (svg: SVGElement, color: "white" | "black") => SVGElement;
|
|
9
|
+
export declare const createSvgImage: (svg: SVGElement) => Result<HTMLImageElement, string>;
|
|
10
|
+
export {};
|