@swan-io/lake 4.6.1 → 4.8.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.
Files changed (52) hide show
  1. package/package.json +1 -1
  2. package/src/components/AutoWidthImage.js +1 -1
  3. package/src/components/AutocompleteSearchInput.js +3 -2
  4. package/src/components/Breadcrumbs.js +1 -1
  5. package/src/components/Card3dPreview.js +2 -1
  6. package/src/components/ErrorBoundary.js +10 -7
  7. package/src/components/Filters.js +1 -1
  8. package/src/components/FixedListView.js +5 -4
  9. package/src/components/FixedListViewCells.js +2 -2
  10. package/src/components/Flag.js +2 -1
  11. package/src/components/FocusTrap.js +6 -5
  12. package/src/components/Form.js +2 -2
  13. package/src/components/Icon.d.ts +2 -0
  14. package/src/components/LakeCombobox.js +5 -3
  15. package/src/components/LakeLabel.js +1 -1
  16. package/src/components/LakeSearchField.js +1 -1
  17. package/src/components/LakeSelect.js +9 -6
  18. package/src/components/LakeStepper.js +2 -2
  19. package/src/components/LakeTagInput.js +7 -5
  20. package/src/components/LakeTextInput.d.ts +1 -1
  21. package/src/components/LakeTextInput.js +5 -5
  22. package/src/components/LakeTooltip.js +15 -14
  23. package/src/components/Link.js +1 -1
  24. package/src/components/MultiSelect.js +3 -2
  25. package/src/components/PlainListView.js +6 -5
  26. package/src/components/Popover.js +2 -1
  27. package/src/components/Pressable.js +6 -6
  28. package/src/components/QuickActions.js +9 -6
  29. package/src/components/RadioGroup.js +1 -1
  30. package/src/components/ResponsiveContainer.js +1 -1
  31. package/src/components/Separator.js +1 -1
  32. package/src/components/SidebarNavigationTracker.js +2 -2
  33. package/src/components/Slider.js +2 -1
  34. package/src/components/SortBottomPanel.js +2 -2
  35. package/src/components/Switch.js +1 -1
  36. package/src/components/TabView.js +5 -4
  37. package/src/components/TimePicker.js +7 -6
  38. package/src/components/Toggle.js +2 -1
  39. package/src/components/Tooltip.js +10 -9
  40. package/src/components/TransitionView.js +2 -2
  41. package/src/components/WithCurrentColor.js +1 -1
  42. package/src/hooks/useOutsideClick.js +2 -2
  43. package/src/hooks/useResponsive.js +1 -1
  44. package/src/icons/fluent-icons.json +8 -6
  45. package/src/state/toasts.js +7 -5
  46. package/src/utils/array.js +2 -1
  47. package/src/utils/file.js +2 -1
  48. package/src/utils/flagCountry.js +1 -1
  49. package/src/utils/rifm.js +6 -4
  50. package/src/utils/string.js +1 -1
  51. package/src/utils/svg.js +2 -1
  52. package/src/utils/viewport.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/lake",
3
- "version": "4.6.1",
3
+ "version": "4.8.0",
4
4
  "engines": {
5
5
  "node": ">=18.0.0",
6
6
  "yarn": "^1.22.0"
@@ -21,7 +21,7 @@ export const AutoWidthImage = memo(forwardRef(({ ariaLabel, maxWidth, height, so
21
21
  }, [maxWidth, height, sourceUri]);
22
22
  return (_jsx(Image, { "aria-label": ariaLabel, ref: forwardedRef, style: [style, size], source: fetching ? null : sourceUri, onLoadEnd: () => {
23
23
  if (!fetching) {
24
- onLoadEnd?.();
24
+ onLoadEnd === null || onLoadEnd === void 0 ? void 0 : onLoadEnd();
25
25
  }
26
26
  }, ...props }));
27
27
  }));
@@ -9,12 +9,13 @@ import { Separator } from "./Separator";
9
9
  export const AutocompleteSearchInput = ({ inputRef, value, onValueChange, disabled, id, placeholder, error, emptyResultText, ListFooterComponent, shouldDisplaySuggestions = true, loadSuggestions, onSuggestion, onLoadError, }) => {
10
10
  const [state, setState] = useState(AsyncData.NotAsked());
11
11
  const lastRequest = useRef();
12
- return (_jsx(LakeCombobox, { inputRef: inputRef, id: id, placeholder: placeholder, value: value ?? "", items: state, icon: loadSuggestions != null ? "search-filled" : undefined, disabled: disabled, error: error, ListFooterComponent: ListFooterComponent != null && (_jsxs(_Fragment, { children: [match(state)
12
+ return (_jsx(LakeCombobox, { inputRef: inputRef, id: id, placeholder: placeholder, value: value !== null && value !== void 0 ? value : "", items: state, icon: loadSuggestions != null ? "search-filled" : undefined, disabled: disabled, error: error, ListFooterComponent: ListFooterComponent != null && (_jsxs(_Fragment, { children: [match(state)
13
13
  .with(AsyncData.P.Done(Result.P.Ok(P.select())), suggestions => suggestions.length > 0 ? _jsx(Separator, {}) : null)
14
14
  .otherwise(() => null), ListFooterComponent] })), onSelectItem: item => {
15
15
  onSuggestion(item);
16
16
  }, onValueChange: value => {
17
- lastRequest.current?.cancel(); // cancel previous request to avoid race condition
17
+ var _a;
18
+ (_a = lastRequest.current) === null || _a === void 0 ? void 0 : _a.cancel(); // cancel previous request to avoid race condition
18
19
  lastRequest.current = undefined; // avoid to cancel twice the same request
19
20
  onValueChange(value);
20
21
  if (value.length <= 3 || !shouldDisplaySuggestions) {
@@ -126,7 +126,7 @@ export const BreadcrumbsRoot = ({ rootLevelCrumbs = emptyCrumbArray, children })
126
126
  }
127
127
  setRootCrumbs(rootLevelCrumbs.map(crumb => ({ id: uuid(), crumb, isRootCrumb: true })));
128
128
  }, [rootLevelCrumbs]);
129
- const orderedCrumbs = useMemo(() => [...crumbs].sort((a, b) => ((b.index ?? -1) > (a.index ?? -1) ? -1 : 1)), [crumbs]);
129
+ const orderedCrumbs = useMemo(() => [...crumbs].sort((a, b) => { var _a, _b; return (((_a = b.index) !== null && _a !== void 0 ? _a : -1) > ((_b = a.index) !== null && _b !== void 0 ? _b : -1) ? -1 : 1); }), [crumbs]);
130
130
  const value = useMemo(() => [rootCrumbs, orderedCrumbs, setCrumbs, currentIndexRef], [rootCrumbs, orderedCrumbs, setCrumbs, currentIndexRef]);
131
131
  return _jsx(BreadcrumbsContext.Provider, { value: value, children: children });
132
132
  };
@@ -146,6 +146,7 @@ export const Card = forwardRef(({ ownerName, cardNumber, expirationDate, cvv, co
146
146
  }, [onSvgError]);
147
147
  // Handle logo
148
148
  useEffect(() => {
149
+ var _a;
149
150
  if (isNullish(logo)) {
150
151
  setLogoData(null);
151
152
  return;
@@ -159,7 +160,7 @@ export const Card = forwardRef(({ ownerName, cardNumber, expirationDate, cvv, co
159
160
  return createSvgImage(whiteLogo);
160
161
  });
161
162
  if (image.isError()) {
162
- handleSvgError.current?.(image.getError());
163
+ (_a = handleSvgError.current) === null || _a === void 0 ? void 0 : _a.call(handleSvgError, image.getError());
163
164
  return;
164
165
  }
165
166
  // Compute logo size depending on constraints
@@ -34,7 +34,16 @@ const initialState = {
34
34
  error: null,
35
35
  };
36
36
  export class ErrorBoundary extends Component {
37
- state = initialState;
37
+ constructor() {
38
+ super(...arguments);
39
+ this.state = initialState;
40
+ this.resetError = () => {
41
+ const { error } = this.state;
42
+ if (error !== null) {
43
+ this.setState(initialState);
44
+ }
45
+ };
46
+ }
38
47
  static getDerivedStateFromError(error) {
39
48
  return { error };
40
49
  }
@@ -52,12 +61,6 @@ export class ErrorBoundary extends Component {
52
61
  onError(error, errorInfo);
53
62
  }
54
63
  }
55
- resetError = () => {
56
- const { error } = this.state;
57
- if (error !== null) {
58
- this.setState(initialState);
59
- }
60
- };
61
64
  render() {
62
65
  const { children, fallback } = this.props;
63
66
  const { error } = this.state;
@@ -84,7 +84,7 @@ function FilterRadio({ label, items, width, value, onValueChange, onPressRemove,
84
84
  const inputRef = useRef(null);
85
85
  const [visible, { close, toggle }] = useDisclosure(autoOpen);
86
86
  const currentValue = useMemo(() => items.find(i => i.value === value), [items, value]);
87
- return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: currentValue?.label }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsx(View, { style: [styles.dropdown, { width }], children: _jsx(FlatList, { role: "list", data: items, contentContainerStyle: styles.content, keyExtractor: (_, index) => `filter-item-${index}`, renderItem: ({ item }) => {
87
+ return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: currentValue === null || currentValue === void 0 ? void 0 : currentValue.label }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsx(View, { style: [styles.dropdown, { width }], children: _jsx(FlatList, { role: "list", data: items, contentContainerStyle: styles.content, keyExtractor: (_, index) => `filter-item-${index}`, renderItem: ({ item }) => {
88
88
  const isSelected = value === item.value;
89
89
  return (_jsxs(Pressable, { role: "radio", "aria-checked": isSelected, style: ({ hovered }) => [styles.radio, hovered && styles.itemHovered], onPress: () => {
90
90
  onValueChange(item.value);
@@ -468,7 +468,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
468
468
  stickedToEndColumns.length === 0 && styles.rowRightRadii,
469
469
  ], [stickedToStartColumns, stickedToEndColumns]);
470
470
  const createRowWrapper = useCallback(({ item, absoluteIndex, extraInfo, }) => {
471
- const customLinkElement = getRowLink?.({ item, index: absoluteIndex, extraInfo });
471
+ const customLinkElement = getRowLink === null || getRowLink === void 0 ? void 0 : getRowLink({ item, index: absoluteIndex, extraInfo });
472
472
  return isNullish(customLinkElement) ? _jsx(View, {}) : customLinkElement;
473
473
  }, [getRowLink]);
474
474
  const [backgroundRows, startRows, centerRows, endRows] = useMemo(() => {
@@ -599,10 +599,11 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
599
599
  }
600
600
  }, [horizontalPadding]);
601
601
  const onKeyDown = useCallback((event) => {
602
+ var _a, _b;
602
603
  const target = event.nativeEvent.target;
603
604
  const currentTarget = event.nativeEvent.currentTarget;
604
605
  const currentCell = target.closest(`[id^="${viewId}__Row"]`);
605
- const currentCellId = currentCell?.id;
606
+ const currentCellId = currentCell === null || currentCell === void 0 ? void 0 : currentCell.id;
606
607
  if (event.nativeEvent.key === "Tab" && isNotNullish(currentCell)) {
607
608
  const focusableElements = getFocusableElements(currentCell, false);
608
609
  const firstFocusableElement = first(focusableElements);
@@ -619,7 +620,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
619
620
  }
620
621
  else {
621
622
  event.preventDefault();
622
- startFocusAnchorRef.current?.focus();
623
+ (_a = startFocusAnchorRef.current) === null || _a === void 0 ? void 0 : _a.focus();
623
624
  }
624
625
  }
625
626
  if (isTargetLast && !event.nativeEvent.shiftKey && last(sortedCellIds) !== currentCellId) {
@@ -630,7 +631,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
630
631
  }
631
632
  else {
632
633
  event.preventDefault();
633
- endFocusAnchorRef.current?.focus();
634
+ (_b = endFocusAnchorRef.current) === null || _b === void 0 ? void 0 : _b.focus();
634
635
  }
635
636
  }
636
637
  }
@@ -97,7 +97,7 @@ export const SimpleHeaderCell = ({ text, sort, justifyContent = "flex-start", on
97
97
  const sortActive = isNotNullish(sort) && isNotNullish(onPress);
98
98
  const disabled = isNullish(onPress);
99
99
  return (_jsx(Pressable, { onPress: () => {
100
- onPress?.(match(sort)
100
+ onPress === null || onPress === void 0 ? void 0 : onPress(match(sort)
101
101
  .returnType()
102
102
  .with("Desc", () => "Asc")
103
103
  .with("Asc", () => "Desc")
@@ -119,7 +119,7 @@ export const SimpleRegularTextCell = ({ variant = "regular", text, textAlign = "
119
119
  };
120
120
  export const CopyableRegularTextCell = ({ variant = "regular", text, textToCopy, copyWording, copiedWording, tooltip, }) => {
121
121
  const [visibleState, setVisibleState] = useState("copy");
122
- const clipboardText = textToCopy ?? text;
122
+ const clipboardText = textToCopy !== null && textToCopy !== void 0 ? textToCopy : text;
123
123
  const onPress = useCallback((event) => {
124
124
  event.preventDefault();
125
125
  Clipboard.setString(clipboardText);
@@ -18,7 +18,8 @@ export const Flag = ({ icon, width }) => {
18
18
  }
19
19
  }, []);
20
20
  const flag = useMemo(() => {
21
- const cca2 = countries.find(item => item.cca3 === icon)?.cca2;
21
+ var _a;
22
+ const cca2 = (_a = countries.find(item => item.cca3 === icon)) === null || _a === void 0 ? void 0 : _a.cca2;
22
23
  if (cca2 == null) {
23
24
  return null;
24
25
  }
@@ -29,7 +29,7 @@ export const FocusTrap = forwardRef(({ children, focusLock, onClickOutside, onEs
29
29
  match(nativeEvent.key)
30
30
  .with("Escape", () => {
31
31
  if (escapeListenerCount === initialEscapeListenerCount + 1) {
32
- onEscapeKey?.();
32
+ onEscapeKey === null || onEscapeKey === void 0 ? void 0 : onEscapeKey();
33
33
  }
34
34
  })
35
35
  .with("Tab", () => {
@@ -44,11 +44,11 @@ export const FocusTrap = forwardRef(({ children, focusLock, onClickOutside, onEs
44
44
  const lastFocusableElement = last(focusableElements);
45
45
  if (target === firstFocusableElement && nativeEvent.shiftKey) {
46
46
  nativeEvent.preventDefault();
47
- lastFocusableElement?.focus();
47
+ lastFocusableElement === null || lastFocusableElement === void 0 ? void 0 : lastFocusableElement.focus();
48
48
  }
49
49
  if (target === lastFocusableElement && !nativeEvent.shiftKey) {
50
50
  nativeEvent.preventDefault();
51
- firstFocusableElement?.focus();
51
+ firstFocusableElement === null || firstFocusableElement === void 0 ? void 0 : firstFocusableElement.focus();
52
52
  }
53
53
  }
54
54
  })
@@ -58,8 +58,9 @@ export const FocusTrap = forwardRef(({ children, focusLock, onClickOutside, onEs
58
58
  if (returnFocus) {
59
59
  previouslyFocusedRef.current = document.activeElement;
60
60
  return () => {
61
+ var _a;
61
62
  if (!hasFocusedOutside.current) {
62
- previouslyFocusedRef.current?.focus();
63
+ (_a = previouslyFocusedRef.current) === null || _a === void 0 ? void 0 : _a.focus();
63
64
  }
64
65
  };
65
66
  }
@@ -73,7 +74,7 @@ export const FocusTrap = forwardRef(({ children, focusLock, onClickOutside, onEs
73
74
  }
74
75
  const focusableElements = getFocusableElements(trapElement);
75
76
  const firstFocusableElement = first(focusableElements);
76
- firstFocusableElement?.focus();
77
+ firstFocusableElement === null || firstFocusableElement === void 0 ? void 0 : firstFocusableElement.focus();
77
78
  window.clearInterval(id);
78
79
  }
79
80
  }
@@ -6,11 +6,11 @@ export const Form = memo(forwardRef(({ style, onReset, onSubmit, ...props }, for
6
6
  ref: forwardedRef,
7
7
  onReset: (event) => {
8
8
  event.preventDefault();
9
- onReset?.(event);
9
+ onReset === null || onReset === void 0 ? void 0 : onReset(event);
10
10
  },
11
11
  onSubmit: (event) => {
12
12
  event.preventDefault();
13
- onSubmit?.(event);
13
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(event);
14
14
  },
15
15
  style: [commonStyles.view, style],
16
16
  })));
@@ -149,6 +149,8 @@ declare const paths: {
149
149
  "lock-open-regular": string;
150
150
  "mail-filled": string;
151
151
  "mail-regular": string;
152
+ "money-calculator-regular": string;
153
+ "money-calculator-filled": string;
152
154
  "money-regular": string;
153
155
  "money-filled": string;
154
156
  "more-horizontal-filled": string;
@@ -99,17 +99,19 @@ const LakeComboboxWithRef = ({ inputRef, value, items, itemHeight = DEFAULT_ELEM
99
99
  });
100
100
  const suggestionsId = useId();
101
101
  const handleKeyPress = useCallback((event) => {
102
+ var _a;
102
103
  if (event.nativeEvent.key === "ArrowDown") {
103
104
  const listElement = listContainerRef.current;
104
105
  if (listElement != null) {
105
106
  const element = listElement;
106
107
  const focusableElements = getFocusableElements(element, false);
107
- focusableElements[0]?.focus();
108
+ (_a = focusableElements[0]) === null || _a === void 0 ? void 0 : _a.focus();
108
109
  event.preventDefault();
109
110
  }
110
111
  }
111
112
  }, []);
112
113
  const handleListItemKeyPress = useCallback((event) => {
114
+ var _a, _b;
113
115
  if (event.nativeEvent.key === "ArrowDown" || event.nativeEvent.key === "ArrowUp") {
114
116
  const listElement = listContainerRef.current;
115
117
  if (listElement != null) {
@@ -124,10 +126,10 @@ const LakeComboboxWithRef = ({ inputRef, value, items, itemHeight = DEFAULT_ELEM
124
126
  const nextIndex = index + direction;
125
127
  event.preventDefault();
126
128
  if (nextIndex === -1) {
127
- ref.current?.focus();
129
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
128
130
  }
129
131
  else {
130
- focusableElements[nextIndex === focusableElements.length ? 0 : nextIndex]?.focus();
132
+ (_b = focusableElements[nextIndex === focusableElements.length ? 0 : nextIndex]) === null || _b === void 0 ? void 0 : _b.focus();
131
133
  }
132
134
  }
133
135
  }
@@ -37,7 +37,7 @@ export const LakeLabel = ({ label, optionalLabel, extra, readOnly = false, color
37
37
  if (containerRef.current != null) {
38
38
  const container = containerRef.current;
39
39
  const target = container.querySelector(`[id="${id}"]`);
40
- target?.focus();
40
+ target === null || target === void 0 ? void 0 : target.focus();
41
41
  }
42
42
  }, [id]);
43
43
  return (_jsxs(Box, { style: [styles.container, style], direction: "row", alignItems: "center", justifyContent: "spaceBetween", children: [_jsxs(View, { style: commonStyles.fill, ref: containerRef, children: [_jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "center", children: [_jsxs(Box, { direction: "row", style: styles.shrink, children: [type === "form" || type === "formSmall" || type === "radioGroup" ? (_jsxs(Label, { onClick: onClick, htmlFor: id, style: [styles.label, readOnly && { color: readOnlyColor }], children: [label, optionalLabel != null ? (_jsxs(_Fragment, { children: [" - ", _jsx(LakeText, { color: colors.gray[400], style: styles.optionalLabel, children: optionalLabel })] })) : null] })) : (_jsxs(LakeText, { variant: "medium", color: readOnlyColor, id: id, children: [label, optionalLabel != null ? (_jsxs(_Fragment, { children: [" - ", _jsx(LakeText, { color: colors.gray[400], style: styles.optionalLabel, children: optionalLabel })] })) : null] })), isNotNullish(extra) && extra()] }), isNotNullish(help) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 16 }), help] }))] }), _jsx(Space, { height: match(type)
@@ -71,7 +71,7 @@ const ExpandedSearchField = ({ inputRef, placeholder, initialValue, onChange, se
71
71
  clearTimeout(timeoutRef.current);
72
72
  }
73
73
  clear();
74
- }, style: styles.clearButton, children: _jsx(Svg, { viewBox: "0 0 16 16", style: styles.clear, children: _jsxs(_Fragment, { children: [_jsx(Line, { x1: "0", x2: "16", y1: "0", y2: "16", strokeLinecap: "round", stroke: colors.gray[500], strokeWidth: 2 }), _jsx(Line, { x1: "0", x2: "16", y1: "16", y2: "0", strokeLinecap: "round", stroke: colors.gray[500], strokeWidth: 2 })] }) }) }), renderEnd?.()] })), onFocus: () => {
74
+ }, style: styles.clearButton, children: _jsx(Svg, { viewBox: "0 0 16 16", style: styles.clear, children: _jsxs(_Fragment, { children: [_jsx(Line, { x1: "0", x2: "16", y1: "0", y2: "16", strokeLinecap: "round", stroke: colors.gray[500], strokeWidth: 2 }), _jsx(Line, { x1: "0", x2: "16", y1: "16", y2: "0", strokeLinecap: "round", stroke: colors.gray[500], strokeWidth: 2 })] }) }) }), renderEnd === null || renderEnd === void 0 ? void 0 : renderEnd()] })), onFocus: () => {
75
75
  if (timeoutRef.current != null) {
76
76
  clearTimeout(timeoutRef.current);
77
77
  }
@@ -108,6 +108,7 @@ const styles = StyleSheet.create({
108
108
  },
109
109
  });
110
110
  const LakeSelectWithRef = ({ title, items, valueStyle, size, color = "current", disabled = false, mode = "normal", placeholder, readOnly = false, id, matchReferenceWidth = true, value, error, hideErrors = false, icon, onValueChange, PopoverFooter, style, }, forwardedRef) => {
111
+ var _a;
111
112
  const inputRef = useRef(null);
112
113
  const listRef = useRef(null);
113
114
  const typingTimeoutRef = useRef(undefined);
@@ -119,10 +120,11 @@ const LakeSelectWithRef = ({ title, items, valueStyle, size, color = "current",
119
120
  const isSmall = size === "small";
120
121
  const itemValue = items.find(i => i.value === value);
121
122
  const onKeyDown = useCallback((event) => {
123
+ var _a, _b;
122
124
  // this made a search not visible for user as the native select component
123
125
  if (event.nativeEvent.key.length === 1) {
124
126
  event.nativeEvent.stopPropagation();
125
- const currentlyTyped = `${currentlyTypedRef.current ?? ""}${event.nativeEvent.key.toLowerCase()}`;
127
+ const currentlyTyped = `${(_a = currentlyTypedRef.current) !== null && _a !== void 0 ? _a : ""}${event.nativeEvent.key.toLowerCase()}`;
126
128
  currentlyTypedRef.current = currentlyTyped;
127
129
  const selectedIndex = items.findIndex(item => item.name.toLowerCase().startsWith(currentlyTyped));
128
130
  const selected = items[selectedIndex];
@@ -130,7 +132,7 @@ const LakeSelectWithRef = ({ title, items, valueStyle, size, color = "current",
130
132
  if (visible) {
131
133
  const listElement = listRef.current;
132
134
  if (listElement != null) {
133
- listItemRefs.current[selectedIndex]?.focus();
135
+ (_b = listItemRefs.current[selectedIndex]) === null || _b === void 0 ? void 0 : _b.focus();
134
136
  }
135
137
  }
136
138
  else {
@@ -145,7 +147,7 @@ const LakeSelectWithRef = ({ title, items, valueStyle, size, color = "current",
145
147
  currentlyTypedRef.current = undefined;
146
148
  }, 300);
147
149
  }, [items, onValueChange, visible]);
148
- const name = itemValue?.name ?? value;
150
+ const name = (_a = itemValue === null || itemValue === void 0 ? void 0 : itemValue.name) !== null && _a !== void 0 ? _a : value;
149
151
  return (_jsxs(View, { style: commonStyles.fill, children: [_jsx(Pressable, { id: id, ref: mergedRef, "aria-haspopup": "listbox", role: "button", "aria-expanded": visible, disabled: readOnly || disabled, style: ({ focused, hovered, pressed }) => [
150
152
  mode === "normal" ? styles.normal : styles.borderless,
151
153
  size === "small" && styles.small,
@@ -164,11 +166,12 @@ const LakeSelectWithRef = ({ title, items, valueStyle, size, color = "current",
164
166
  mode !== "borderless" && error != null && styles.errorContainer,
165
167
  (disabled || readOnly) && mode === "borderless" && styles.inputBorderlessDisabled,
166
168
  style,
167
- ], onPress: open, onKeyDown: onKeyDown, "aria-errormessage": error, children: ({ hovered }) => (_jsxs(_Fragment, { children: [mode === "normal" && _jsx(View, { style: [styles.shadowed, hovered && styles.hovered] }), _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "center", children: [_jsxs(Box, { direction: "row", alignItems: "center", style: commonStyles.fill, children: [icon && (_jsxs(_Fragment, { children: [_jsx(Icon, { color: colors[color].primary, name: icon, size: isSmall ? 16 : 18 }), _jsx(Space, { width: 8 })] })), hasValue ? (_jsxs(Box, { direction: "row", alignItems: "center", style: commonStyles.fill, children: [isNotNullish(itemValue?.icon) && (_jsxs(_Fragment, { children: [itemValue?.icon, _jsx(Space, { width: 12 })] })), _jsx(LakeText, { color: colors.gray[900], variant: isSmall ? "smallRegular" : "regular", style: [styles.itemText, valueStyle], children: name })] })) : (_jsx(LakeText, { style: [
169
+ ], onPress: open, onKeyDown: onKeyDown, "aria-errormessage": error, children: ({ hovered }) => (_jsxs(_Fragment, { children: [mode === "normal" && _jsx(View, { style: [styles.shadowed, hovered && styles.hovered] }), _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "center", children: [_jsxs(Box, { direction: "row", alignItems: "center", style: commonStyles.fill, children: [icon && (_jsxs(_Fragment, { children: [_jsx(Icon, { color: colors[color].primary, name: icon, size: isSmall ? 16 : 18 }), _jsx(Space, { width: 8 })] })), hasValue ? (_jsxs(Box, { direction: "row", alignItems: "center", style: commonStyles.fill, children: [isNotNullish(itemValue === null || itemValue === void 0 ? void 0 : itemValue.icon) && (_jsxs(_Fragment, { children: [itemValue === null || itemValue === void 0 ? void 0 : itemValue.icon, _jsx(Space, { width: 12 })] })), _jsx(LakeText, { color: colors.gray[900], variant: isSmall ? "smallRegular" : "regular", style: [styles.itemText, valueStyle], children: name })] })) : (_jsx(LakeText, { style: [
168
170
  styles.itemText,
169
171
  styles.selectPlaceholder,
170
172
  isSmall && styles.selectSmallPlaceholder,
171
- ], children: placeholder ?? " " }))] }), _jsx(Fill, { minWidth: 8 }), !disabled && (_jsx(Icon, { color: colors.gray[900], name: visible ? "chevron-up-filled" : "chevron-down-filled", size: 16 }))] })] })) }), !hideErrors && (_jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], style: styles.errorText, children: error ?? " " })), _jsxs(Popover, { role: "listbox", matchReferenceMinWidth: matchReferenceWidth, onDismiss: close, referenceRef: inputRef, returnFocus: true, visible: visible, children: [isNotNullish(title) && (_jsxs(_Fragment, { children: [_jsx(LakeText, { variant: "semibold", color: colors.gray[900], style: styles.selectListTitle, children: title }), _jsx(Separator, {})] })), _jsx(FlatList, { role: "list", data: items, ref: listRef, contentContainerStyle: styles.listContent, onKeyDown: (event) => {
173
+ ], children: placeholder !== null && placeholder !== void 0 ? placeholder : " " }))] }), _jsx(Fill, { minWidth: 8 }), !disabled && (_jsx(Icon, { color: colors.gray[900], name: visible ? "chevron-up-filled" : "chevron-down-filled", size: 16 }))] })] })) }), !hideErrors && (_jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], style: styles.errorText, children: error !== null && error !== void 0 ? error : " " })), _jsxs(Popover, { role: "listbox", matchReferenceMinWidth: matchReferenceWidth, onDismiss: close, referenceRef: inputRef, returnFocus: true, visible: visible, children: [isNotNullish(title) && (_jsxs(_Fragment, { children: [_jsx(LakeText, { variant: "semibold", color: colors.gray[900], style: styles.selectListTitle, children: title }), _jsx(Separator, {})] })), _jsx(FlatList, { role: "list", data: items, ref: listRef, contentContainerStyle: styles.listContent, onKeyDown: (event) => {
174
+ var _a;
172
175
  const { key } = event.nativeEvent;
173
176
  if (key === "ArrowDown" || key === "ArrowUp") {
174
177
  event.preventDefault();
@@ -176,7 +179,7 @@ const LakeSelectWithRef = ({ title, items, valueStyle, size, color = "current",
176
179
  const focusableElements = getFocusableElements(event.currentTarget);
177
180
  const current = focusableElements.indexOf(event.target);
178
181
  const nextIndex = key === "ArrowDown" ? current + 1 : current - 1;
179
- focusableElements[nextIndex]?.focus();
182
+ (_a = focusableElements[nextIndex]) === null || _a === void 0 ? void 0 : _a.focus();
180
183
  }
181
184
  }
182
185
  }, keyExtractor: (_, index) => `select-item-${index}`, renderItem: ({ item, index }) => {
@@ -77,7 +77,7 @@ export const LakeStepper = ({ steps, activeStepId, style }) => {
77
77
  const stepNumber = index + 1;
78
78
  const currentId = match(step)
79
79
  .with({ id: P.string }, ({ id }) => id)
80
- .with({ children: P.array(P.any) }, ({ children }) => children[0]?.id ?? "")
80
+ .with({ children: P.array(P.any) }, ({ children }) => { var _a, _b; return (_b = (_a = children[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : ""; })
81
81
  .exhaustive();
82
82
  const isActive = match(step)
83
83
  .with({ id: activeStepId }, () => true)
@@ -93,7 +93,7 @@ export const LakeStepper = ({ steps, activeStepId, style }) => {
93
93
  .otherwise(() => false);
94
94
  const stepUrl = match(step)
95
95
  .with({ id: P.string }, ({ url }) => url)
96
- .with({ children: P.array(P.any) }, ({ children }) => children[0]?.url ?? "")
96
+ .with({ children: P.array(P.any) }, ({ children }) => { var _a, _b; return (_b = (_a = children[0]) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : ""; })
97
97
  .exhaustive();
98
98
  const subSteps = match(step)
99
99
  .with({ id: P.string }, step => [step])
@@ -87,8 +87,9 @@ export const LakeTagInput = forwardRef(({ validator = () => true, onFocus: origi
87
87
  onHoverEnd: () => setIsHovered(false),
88
88
  });
89
89
  const pushNewValues = useCallback((vals) => {
90
+ var _a;
90
91
  onValuesChanged([...values, ...vals.filter(v => !values.includes(v))]);
91
- inputRef.current?.clear();
92
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.clear();
92
93
  }, [values, onValuesChanged]);
93
94
  const onTextInputChange = useCallback((value) => {
94
95
  const input = [...new Set(value.split(SEPARATORS_REGEX).filter(s => s.length))];
@@ -113,11 +114,12 @@ export const LakeTagInput = forwardRef(({ validator = () => true, onFocus: origi
113
114
  });
114
115
  }, [onValuesChanged, pushNewValues, values, disabled, readOnly]);
115
116
  const autoFocus = useCallback(() => {
116
- inputRef.current?.focus();
117
+ var _a;
118
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
117
119
  }, []);
118
120
  const onFocus = useCallback((event) => {
119
121
  setIsFocused(true);
120
- originalOnFocus?.(event);
122
+ originalOnFocus === null || originalOnFocus === void 0 ? void 0 : originalOnFocus(event);
121
123
  }, [originalOnFocus]);
122
124
  const onBlur = useCallback((event) => {
123
125
  const input = inputRef.current;
@@ -127,7 +129,7 @@ export const LakeTagInput = forwardRef(({ validator = () => true, onFocus: origi
127
129
  pushNewValues([input.value]);
128
130
  }
129
131
  setIsFocused(false);
130
- originalOnBlur?.(event);
132
+ originalOnBlur === null || originalOnBlur === void 0 ? void 0 : originalOnBlur(event);
131
133
  }, [pushNewValues, originalOnBlur, validateOnBlur]);
132
134
  const mergedRef = useMergeRefs(inputRef, forwardRef);
133
135
  const hasError = isNotNullishOrEmpty(error);
@@ -142,5 +144,5 @@ export const LakeTagInput = forwardRef(({ validator = () => true, onFocus: origi
142
144
  isHovered && styles.hovered,
143
145
  ], "aria-errormessage": error, onPress: autoFocus, ref: containerRef, children: [values.map((value, i) => (_jsx(Tag, { onPressRemove: !readOnly && !disabled
144
146
  ? () => onValuesChanged(values.filter(current => current !== value))
145
- : undefined, style: styles.tag, color: validator(value) ? "gray" : "negative", children: value }, i))), _jsx(TextInput, { ref: mergedRef, style: [styles.input, disabled && styles.disabled], onFocus: onFocus, onBlur: onBlur, "aria-disabled": disabled, onChangeText: onTextInputChange, onKeyPress: onTextInputKeyPress, readOnly: readOnly, placeholder: placeholder })] }), !hideErrors && (_jsx(Box, { direction: "row", style: styles.errorContainer, children: isNotNullish(error) ? (_jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], children: error })) : (_jsx(LakeText, { variant: "smallRegular", color: colors.gray[500], children: help ?? " " })) }))] }));
147
+ : undefined, style: styles.tag, color: validator(value) ? "gray" : "negative", children: value }, i))), _jsx(TextInput, { ref: mergedRef, style: [styles.input, disabled && styles.disabled], onFocus: onFocus, onBlur: onBlur, "aria-disabled": disabled, onChangeText: onTextInputChange, onKeyPress: onTextInputKeyPress, readOnly: readOnly, placeholder: placeholder })] }), !hideErrors && (_jsx(Box, { direction: "row", style: styles.errorContainer, children: isNotNullish(error) ? (_jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], children: error })) : (_jsx(LakeText, { variant: "smallRegular", color: colors.gray[500], children: help !== null && help !== void 0 ? help : " " })) }))] }));
146
148
  });
@@ -229,7 +229,7 @@ export declare const LakeTextInput: import("react").ForwardRefExoticComponent<{
229
229
  disabled?: boolean | undefined;
230
230
  color?: "gray" | "live" | "sandbox" | "positive" | "warning" | "negative" | "current" | "partner" | "swan" | "shakespear" | "darkPink" | "sunglow" | "mediumSladeBlue" | undefined;
231
231
  multiline?: boolean | undefined;
232
- icon?: "lake-building-bank" | "lake-calendar-arrow-swap" | "lake-call" | "lake-card" | "lake-card-add" | "lake-card-filled" | "lake-card-one-off" | "lake-card-physical" | "lake-card-recurring" | "lake-card-single-use" | "lake-card-virtual" | "lake-check" | "lake-chevron-double" | "lake-clipboard-bullet" | "lake-clock" | "lake-clock-arrow-swap" | "lake-close" | "lake-compass" | "lake-currencies" | "lake-delivery-grouped" | "lake-delivery-individual" | "lake-denied" | "lake-document-csv" | "lake-document-jpg" | "lake-document-pdf" | "lake-document-png" | "lake-document-xls" | "lake-email" | "lake-eraser" | "lake-error" | "lake-face-id" | "lake-fingerprint" | "lake-id-card" | "lake-inbox-empty" | "lake-key" | "lake-lock-closed" | "lake-menu" | "lake-people" | "lake-person-arrow-swap" | "lake-person-support" | "lake-phone" | "lake-receipt" | "lake-settings" | "lake-shield" | "lake-signature" | "lake-transfer" | "lake-warning" | "lake-world-map" | "add-circle-filled" | "add-circle-regular" | "add-filled" | "approvals-app-filled" | "apps-list-filled" | "apps-list-regular" | "arrow-counterclockwise-filled" | "arrow-clockwise-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-filled" | "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" | "eye-off-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" | "money-filled" | "more-horizontal-filled" | "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" | "qr-code-regular" | "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" | "task-list-square-ltr-filled" | "task-list-square-ltr-regular" | "warning-filled" | "warning-regular" | "window-dev-tools-filled" | "window-dev-tools-regular" | undefined;
232
+ icon?: "lake-building-bank" | "lake-calendar-arrow-swap" | "lake-call" | "lake-card" | "lake-card-add" | "lake-card-filled" | "lake-card-one-off" | "lake-card-physical" | "lake-card-recurring" | "lake-card-single-use" | "lake-card-virtual" | "lake-check" | "lake-chevron-double" | "lake-clipboard-bullet" | "lake-clock" | "lake-clock-arrow-swap" | "lake-close" | "lake-compass" | "lake-currencies" | "lake-delivery-grouped" | "lake-delivery-individual" | "lake-denied" | "lake-document-csv" | "lake-document-jpg" | "lake-document-pdf" | "lake-document-png" | "lake-document-xls" | "lake-email" | "lake-eraser" | "lake-error" | "lake-face-id" | "lake-fingerprint" | "lake-id-card" | "lake-inbox-empty" | "lake-key" | "lake-lock-closed" | "lake-menu" | "lake-people" | "lake-person-arrow-swap" | "lake-person-support" | "lake-phone" | "lake-receipt" | "lake-settings" | "lake-shield" | "lake-signature" | "lake-transfer" | "lake-warning" | "lake-world-map" | "add-circle-filled" | "add-circle-regular" | "add-filled" | "approvals-app-filled" | "apps-list-filled" | "apps-list-regular" | "arrow-counterclockwise-filled" | "arrow-clockwise-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-filled" | "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" | "eye-off-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-calculator-regular" | "money-calculator-filled" | "money-regular" | "money-filled" | "more-horizontal-filled" | "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" | "qr-code-regular" | "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" | "task-list-square-ltr-filled" | "task-list-square-ltr-regular" | "warning-filled" | "warning-regular" | "window-dev-tools-filled" | "window-dev-tools-regular" | undefined;
233
233
  unit?: string | undefined;
234
234
  units?: string[] | undefined;
235
235
  inputMode?: TextInputProps["inputMode"];
@@ -139,11 +139,11 @@ maxCharCount, help, renderEnd, ...props }, forwardRef) => {
139
139
  });
140
140
  const onFocus = useCallback((event) => {
141
141
  setIsFocused(true);
142
- originalOnFocus?.(event);
142
+ originalOnFocus === null || originalOnFocus === void 0 ? void 0 : originalOnFocus(event);
143
143
  }, [originalOnFocus]);
144
144
  const onBlur = useCallback((event) => {
145
145
  setIsFocused(false);
146
- originalOnBlur?.(event);
146
+ originalOnBlur === null || originalOnBlur === void 0 ? void 0 : originalOnBlur(event);
147
147
  }, [originalOnBlur]);
148
148
  const mergedRef = useMergeRefs(inputRef, forwardRef);
149
149
  const isInteractive = !disabled && !readOnly;
@@ -157,15 +157,15 @@ maxCharCount, help, renderEnd, ...props }, forwardRef) => {
157
157
  disabled && styles.disabled,
158
158
  readOnly && styles.readOnly,
159
159
  isFocused && styles.focused,
160
- isNotNullish(unit ?? units) && styles.inputWithUnit,
160
+ isNotNullish(unit !== null && unit !== void 0 ? unit : units) && styles.inputWithUnit,
161
161
  hasError && styles.error,
162
162
  valid && styles.valid,
163
163
  stylesFromProps,
164
- ], ref: containerRef, children: [isNotNullish(icon) && (_jsx(Icon, { name: icon, size: 20, color: colors.current.primary, style: styles.icon })), _jsx(TextInput, { "aria-expanded": ariaExpanded, "aria-controls": ariaControls, inputMode: inputMode, ...props, defaultValue: defaultValue, value: isNullish(defaultValue) ? value ?? "" : value, onFocus: onFocus, onBlur: onBlur, readOnly: !isInteractive, onChange: onChange, multiline: multiline, ref: mergedRef, style: [
164
+ ], ref: containerRef, children: [isNotNullish(icon) && (_jsx(Icon, { name: icon, size: 20, color: colors.current.primary, style: styles.icon })), _jsx(TextInput, { "aria-expanded": ariaExpanded, "aria-controls": ariaControls, inputMode: inputMode, ...props, defaultValue: defaultValue, value: isNullish(defaultValue) ? value !== null && value !== void 0 ? value : "" : value, onFocus: onFocus, onBlur: onBlur, readOnly: !isInteractive, onChange: onChange, multiline: multiline, ref: mergedRef, style: [
165
165
  styles.input,
166
166
  multiline && styles.multilineInput,
167
167
  readOnly && hasError && styles.readOnlyError,
168
168
  disabled && styles.disabled,
169
169
  readOnly && styles.readOnly,
170
- ] }), isNotNullish(renderEnd) && _jsx(View, { style: styles.endComponents, children: renderEnd() }), validating && (_jsx(ActivityIndicator, { size: "small", style: styles.endIcon, color: colors.current[500] })), !validating && hasError && (_jsx(Icon, { name: "warning-regular", size: 20, color: colors.negative[400], style: [styles.endIcon, readOnly && styles.readOnlyEndIcon] })), !validating && !hasError && valid && (_jsx(Icon, { name: "checkmark-filled", size: 20, color: colors.positive[400], style: [styles.endIcon, readOnly && styles.readOnlyEndIcon] }))] }), isNotNullish(units) && isNotNullish(onUnitChange) ? (_jsx(Box, { children: _jsx(LakeSelect, { value: unit, onValueChange: onUnitChange, items: units.map(value => ({ name: value, value })), disabled: disabled, style: [styles.unit, (disabled || readOnly) && styles.unitDisabled], mode: "borderless", hideErrors: true }) })) : isNotNullish(unit) ? (_jsx(LakeText, { color: colors.gray[900], style: [styles.unit, (disabled || readOnly) && styles.unitDisabled], children: unit })) : null] }), children] }), !hideErrors && (_jsxs(Box, { direction: "row", style: styles.errorContainer, children: [isNotNullish(error) ? (_jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], children: error })) : (_jsx(LakeText, { variant: "smallRegular", color: colors.gray[500], children: help ?? " " })), isNotNullish(maxCharCount) && (_jsxs(_Fragment, { children: [_jsx(Fill, { minWidth: 4 }), _jsxs(LakeText, { variant: "smallRegular", color: charCount > maxCharCount ? colors.negative[500] : colors.gray[400], style: styles.descriptionLimitation, children: [charCount, " / ", maxCharCount] })] }))] }))] }));
170
+ ] }), isNotNullish(renderEnd) && _jsx(View, { style: styles.endComponents, children: renderEnd() }), validating && (_jsx(ActivityIndicator, { size: "small", style: styles.endIcon, color: colors.current[500] })), !validating && hasError && (_jsx(Icon, { name: "warning-regular", size: 20, color: colors.negative[400], style: [styles.endIcon, readOnly && styles.readOnlyEndIcon] })), !validating && !hasError && valid && (_jsx(Icon, { name: "checkmark-filled", size: 20, color: colors.positive[400], style: [styles.endIcon, readOnly && styles.readOnlyEndIcon] }))] }), isNotNullish(units) && isNotNullish(onUnitChange) ? (_jsx(Box, { children: _jsx(LakeSelect, { value: unit, onValueChange: onUnitChange, items: units.map(value => ({ name: value, value })), disabled: disabled, style: [styles.unit, (disabled || readOnly) && styles.unitDisabled], mode: "borderless", hideErrors: true }) })) : isNotNullish(unit) ? (_jsx(LakeText, { color: colors.gray[900], style: [styles.unit, (disabled || readOnly) && styles.unitDisabled], children: unit })) : null] }), children] }), !hideErrors && (_jsxs(Box, { direction: "row", style: styles.errorContainer, children: [isNotNullish(error) ? (_jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], children: error })) : (_jsx(LakeText, { variant: "smallRegular", color: colors.gray[500], children: help !== null && help !== void 0 ? help : " " })), isNotNullish(maxCharCount) && (_jsxs(_Fragment, { children: [_jsx(Fill, { minWidth: 4 }), _jsxs(LakeText, { variant: "smallRegular", color: charCount > maxCharCount ? colors.negative[500] : colors.gray[400], style: styles.descriptionLimitation, children: [charCount, " / ", maxCharCount] })] }))] }))] }));
171
171
  });
@@ -90,6 +90,7 @@ export const LakeTooltip = ({ content, children, ...rest }) => {
90
90
  return (_jsx(Tooltip, { content: content, ...rest, children: children }));
91
91
  };
92
92
  const Tooltip = memo(forwardRef(({ children, content, describedBy, matchReferenceWidth = false, hideArrow = false, onHide, onShow, placement, width, togglableOnFocus = false, containerStyle, disabled = false, }, forwardedRef) => {
93
+ var _a, _b;
93
94
  const referenceRef = useRef(null);
94
95
  const rootElement = getRootElement(referenceRef.current);
95
96
  const [popperElement, setPopperElement] = useState(null);
@@ -102,7 +103,7 @@ const Tooltip = memo(forwardRef(({ children, content, describedBy, matchReferenc
102
103
  useHover(referenceRef, {
103
104
  disabled: !canHover,
104
105
  onHoverChange: nextVisible => {
105
- nextVisible ? onShow?.() : onHide?.();
106
+ nextVisible ? onShow === null || onShow === void 0 ? void 0 : onShow() : onHide === null || onHide === void 0 ? void 0 : onHide();
106
107
  setVisible(nextVisible);
107
108
  },
108
109
  });
@@ -115,7 +116,7 @@ const Tooltip = memo(forwardRef(({ children, content, describedBy, matchReferenc
115
116
  { ...matchReferenceWidthModifier, enabled: matchReferenceWidth },
116
117
  ], [matchReferenceWidth]),
117
118
  });
118
- const overflowOffset = state?.modifiersData.preventOverflow?.x ?? 0;
119
+ const overflowOffset = (_b = (_a = state === null || state === void 0 ? void 0 : state.modifiersData.preventOverflow) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0;
119
120
  useEffect(() => {
120
121
  const node = referenceRef.current;
121
122
  if (!(node instanceof Element)) {
@@ -129,7 +130,7 @@ const Tooltip = memo(forwardRef(({ children, content, describedBy, matchReferenc
129
130
  event.preventDefault();
130
131
  const { target } = event;
131
132
  if (target instanceof Element && (node === target || node.contains(target))) {
132
- onHide?.();
133
+ onHide === null || onHide === void 0 ? void 0 : onHide();
133
134
  setVisible(false);
134
135
  }
135
136
  };
@@ -160,25 +161,25 @@ const Tooltip = memo(forwardRef(({ children, content, describedBy, matchReferenc
160
161
  return () => clearTimeout(timeoutRef.current);
161
162
  }, []);
162
163
  useLayoutEffect(() => {
163
- void update?.();
164
+ void (update === null || update === void 0 ? void 0 : update());
164
165
  // eslint-disable-next-line react-hooks/exhaustive-deps
165
166
  }, [content]);
166
167
  return (_jsxs(_Fragment, { children: [_jsx(View, { ref: referenceRef, style: containerStyle, children: children }), isNotNullish(rootElement) && visible && !disabled && (_jsx(Portal, { container: rootElement, children: _jsx("div", { ref: setPopperElement, style: { ...popperStyles.popper, maxWidth: MAX_WIDTH }, ...attributes.popper, role: "tooltip", "aria-describedby": describedBy, children: _jsxs(View, { style: [
167
168
  styles.base,
168
- state?.placement === "top" && styles.baseTop,
169
- state?.placement === "bottom" && styles.baseBottom,
170
- state?.placement === "right" && styles.baseRight,
171
- state?.placement === "left" && styles.baseLeft,
169
+ (state === null || state === void 0 ? void 0 : state.placement) === "top" && styles.baseTop,
170
+ (state === null || state === void 0 ? void 0 : state.placement) === "bottom" && styles.baseBottom,
171
+ (state === null || state === void 0 ? void 0 : state.placement) === "right" && styles.baseRight,
172
+ (state === null || state === void 0 ? void 0 : state.placement) === "left" && styles.baseLeft,
172
173
  ], children: [_jsx(View, { style: [styles.content, { width, maxWidth: MAX_WIDTH }], children: isReactText(content) ? (_jsx(LakeText, { align: "center", color: colors.gray.contrast, children: content })) : (content) }), !hideArrow && (_jsx(View, { role: "none", style: [
173
- state?.placement === "right" || state?.placement === "left"
174
+ (state === null || state === void 0 ? void 0 : state.placement) === "right" || (state === null || state === void 0 ? void 0 : state.placement) === "left"
174
175
  ? styles.arrowContainerHorizontal
175
176
  : styles.arrowContainer,
176
- state?.placement === "top" && styles.arrowContainerTop,
177
- state?.placement === "bottom" && styles.arrowContainerBottom,
178
- state?.placement === "right" && styles.arrowContainerRight,
179
- state?.placement === "left" && styles.arrowContainerLeft,
177
+ (state === null || state === void 0 ? void 0 : state.placement) === "top" && styles.arrowContainerTop,
178
+ (state === null || state === void 0 ? void 0 : state.placement) === "bottom" && styles.arrowContainerBottom,
179
+ (state === null || state === void 0 ? void 0 : state.placement) === "right" && styles.arrowContainerRight,
180
+ (state === null || state === void 0 ? void 0 : state.placement) === "left" && styles.arrowContainerLeft,
180
181
  {
181
- transform: `translateX(${-overflowOffset}px) rotate(${match(state?.placement)
182
+ transform: `translateX(${-overflowOffset}px) rotate(${match(state === null || state === void 0 ? void 0 : state.placement)
182
183
  .with("bottom", () => "180deg")
183
184
  .with("left", () => "-90deg")
184
185
  .with("right", () => "90deg")
@@ -11,7 +11,7 @@ export const Link = memo(forwardRef(({ role = "link", children, disabled = false
11
11
  e.preventDefault();
12
12
  }
13
13
  else {
14
- onPress?.(e);
14
+ onPress === null || onPress === void 0 ? void 0 : onPress(e);
15
15
  onClick(e);
16
16
  }
17
17
  }, ref: forwardedRef, style: typeof style === "function" ? state => style({ ...state, active }) : style, hrefAttrs: {