@swan-io/lake 1.9.0 → 2.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/lake",
3
- "version": "1.9.0",
3
+ "version": "2.0.0",
4
4
  "engines": {
5
5
  "node": ">=14.0.0",
6
6
  "yarn": "^1.20.0"
@@ -27,7 +27,7 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@popperjs/core": "^2.11.7",
30
- "@swan-io/boxed": "^0.13.0",
30
+ "@swan-io/boxed": "^1.0.1",
31
31
  "@swan-io/chicane": "^1.3.4",
32
32
  "dayjs": "^1.11.7",
33
33
  "polished": "^4.2.2",
@@ -45,9 +45,9 @@
45
45
  "uuid": "^9.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@types/react": "^18.0.35",
48
+ "@types/react": "^18.0.37",
49
49
  "@types/react-dom": "^18.0.11",
50
- "@types/react-native": "^0.71.5",
50
+ "@types/react-native": "^0.71.6",
51
51
  "@types/uuid": "^9.0.1",
52
52
  "jsdom": "^21.1.1",
53
53
  "type-fest": "^3.8.0"
@@ -27,6 +27,7 @@ export type LakeTextInputProps = Except<TextInputProps, "editable" | "keyboardTy
27
27
  export declare const LakeTextInput: import("react").ForwardRefExoticComponent<{
28
28
  allowFontScaling?: boolean | undefined;
29
29
  autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
30
+ autoComplete?: "off" | "name" | "email" | "tel" | "url" | "additional-name" | "address-line1" | "address-line2" | "birthdate-day" | "birthdate-full" | "birthdate-month" | "birthdate-year" | "cc-csc" | "cc-exp" | "cc-exp-day" | "cc-exp-month" | "cc-exp-year" | "cc-number" | "country" | "current-password" | "family-name" | "gender" | "given-name" | "honorific-prefix" | "honorific-suffix" | "name-family" | "name-given" | "name-middle" | "name-middle-initial" | "name-prefix" | "name-suffix" | "new-password" | "nickname" | "one-time-code" | "organization" | "organization-title" | "password" | "password-new" | "postal-address" | "postal-address-country" | "postal-address-extended" | "postal-address-extended-postal-code" | "postal-address-locality" | "postal-address-region" | "postal-code" | "street-address" | "sms-otp" | "tel-country-code" | "tel-national" | "tel-device" | "username" | "username-new" | undefined;
30
31
  autoCorrect?: boolean | undefined;
31
32
  autoFocus?: boolean | undefined;
32
33
  blurOnSubmit?: boolean | undefined;
@@ -67,7 +68,6 @@ export declare const LakeTextInput: import("react").ForwardRefExoticComponent<{
67
68
  role?: import("react-native").WebRole | undefined;
68
69
  lang?: string | undefined;
69
70
  initialValue?: string | undefined;
70
- autoComplete?: "off" | "name" | "email" | "tel" | "url" | "additional-name" | "address-level1" | "address-level2" | "address-level3" | "address-level4" | "address-line1" | "address-line2" | "address-line3" | "bday" | "bday-day" | "bday-month" | "bday-year" | "cc-additional-name" | "cc-csc" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-family-name" | "cc-given-name" | "cc-name" | "cc-number" | "cc-type" | "country" | "country-name" | "current-password" | "family-name" | "given-name" | "honorific-prefix" | "honorific-suffix" | "impp" | "language" | "new-password" | "nickname" | "on" | "one-time-code" | "organization" | "organization-title" | "postal-code" | "sex" | "street-address" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-national" | "transaction-amount" | "transaction-currency" | "username" | undefined;
71
71
  enterKeyHint?: "enter" | "search" | "done" | "go" | "next" | "send" | "previous" | undefined;
72
72
  rows?: number | undefined;
73
73
  readOnly?: boolean | undefined;
@@ -197,7 +197,7 @@ export declare const LakeTextInput: import("react").ForwardRefExoticComponent<{
197
197
  rejectResponderTermination?: boolean | null | undefined;
198
198
  selectionState?: import("react-native").DocumentSelectionState | undefined;
199
199
  spellCheck?: boolean | undefined;
200
- textContentType?: "none" | "location" | "name" | "nickname" | "username" | "URL" | "addressCity" | "addressCityAndState" | "addressState" | "countryName" | "creditCardNumber" | "emailAddress" | "familyName" | "fullStreetAddress" | "givenName" | "jobTitle" | "middleName" | "namePrefix" | "nameSuffix" | "organizationName" | "postalCode" | "streetAddressLine1" | "streetAddressLine2" | "sublocality" | "telephoneNumber" | "password" | "newPassword" | "oneTimeCode" | undefined;
200
+ textContentType?: "none" | "location" | "name" | "nickname" | "password" | "username" | "URL" | "addressCity" | "addressCityAndState" | "addressState" | "countryName" | "creditCardNumber" | "emailAddress" | "familyName" | "fullStreetAddress" | "givenName" | "jobTitle" | "middleName" | "namePrefix" | "nameSuffix" | "organizationName" | "postalCode" | "streetAddressLine1" | "streetAddressLine2" | "sublocality" | "telephoneNumber" | "newPassword" | "oneTimeCode" | undefined;
201
201
  scrollEnabled?: boolean | undefined;
202
202
  cursorColor?: import("react-native").ColorValue | null | undefined;
203
203
  importantForAutofill?: "auto" | "yes" | "no" | "noExcludeDescendants" | "yesExcludeDescendants" | undefined;
@@ -37,7 +37,7 @@ export const ListRightPanelContent = ({ children, large, style, }) => {
37
37
  const ListRightPanel_ = forwardRef(({ items, keyExtractor, activeId, onActiveIdChange, onClose, render, closeLabel, previousLabel, nextLabel, }, ref) => {
38
38
  const activeItem = items.find(item => keyExtractor(item) === activeId);
39
39
  // use `Array.getIndexBy` instead of `Array.findIndex` to avoid -1 value
40
- const activeItemIndex = Array.getIndexBy(items, item => keyExtractor(item) === activeId).toUndefined();
40
+ const activeItemIndex = Array.findIndex(items, item => keyExtractor(item) === activeId).toUndefined();
41
41
  const previousId = usePreviousValue(activeId);
42
42
  const previousItem = usePreviousValue(activeItem);
43
43
  const previousIndex = usePreviousValue(activeItemIndex);
@@ -186,7 +186,7 @@ export const MultiSelect = memo(({ color = "gray", disabled = false, emptyResult
186
186
  : remainingTags.filter(({ label }) => label.toLowerCase().includes(cleanedFilter));
187
187
  }, [filter, items, values]);
188
188
  const sections = useMemo(() => {
189
- return Array.keepMap(Dict.entries(groupBy(filteredItems, ({ group }) => group)), ([groupName, data]) => data === undefined ? Option.None() : Option.Some({ title: groupName, data }));
189
+ return Array.filterMap(Dict.entries(groupBy(filteredItems, ({ group }) => group)), ([groupName, data]) => data === undefined ? Option.None() : Option.Some({ title: groupName, data }));
190
190
  }, [filteredItems]);
191
191
  const ListHeaderComponent = useMemo(() => (_jsxs(Box, { direction: "row", alignItems: "center", style: styles.filterContainer, children: [_jsx(PressableTextInput, { autoComplete: "off", inputMode: "search", multiline: false, rows: 1, onChangeText: filterValue => setFilter(filterValue), placeholder: filterPlaceholder, value: filter, style: ({ focused }) => [styles.filterInput, focused && styles.filterfocused] }), _jsx(Icon, { name: "search-filled", color: colors[color].primary, size: 20, style: styles.searchIcon })] })), [filter, filterPlaceholder, color]);
192
192
  const ListEmptyComponent = useMemo(() => (_jsxs(Box, { justifyContent: "center", alignItems: "center", style: styles.emptyList, children: [_jsx(Icon, { name: "clipboard-search-regular", size: 24, color: colors.gray.primary }), isNotNullishOrEmpty(emptyResultText) && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 8 }), _jsx(Text, { style: styles.emptyListText, children: emptyResultText })] }))] })), [emptyResultText]);
@@ -154,6 +154,7 @@ export declare const PressableText: FC<{
154
154
  export declare const PressableTextInput: FC<{
155
155
  allowFontScaling?: boolean | undefined;
156
156
  autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
157
+ autoComplete?: "off" | "name" | "email" | "tel" | "url" | "additional-name" | "address-line1" | "address-line2" | "birthdate-day" | "birthdate-full" | "birthdate-month" | "birthdate-year" | "cc-csc" | "cc-exp" | "cc-exp-day" | "cc-exp-month" | "cc-exp-year" | "cc-number" | "country" | "current-password" | "family-name" | "gender" | "given-name" | "honorific-prefix" | "honorific-suffix" | "name-family" | "name-given" | "name-middle" | "name-middle-initial" | "name-prefix" | "name-suffix" | "new-password" | "nickname" | "one-time-code" | "organization" | "organization-title" | "password" | "password-new" | "postal-address" | "postal-address-country" | "postal-address-extended" | "postal-address-extended-postal-code" | "postal-address-locality" | "postal-address-region" | "postal-code" | "street-address" | "sms-otp" | "tel-country-code" | "tel-national" | "tel-device" | "username" | "username-new" | undefined;
157
158
  autoCorrect?: boolean | undefined;
158
159
  autoFocus?: boolean | undefined;
159
160
  blurOnSubmit?: boolean | undefined;
@@ -190,7 +191,6 @@ export declare const PressableTextInput: FC<{
190
191
  role?: import("react-native").WebRole | undefined;
191
192
  lang?: string | undefined;
192
193
  initialValue?: string | undefined;
193
- autoComplete?: "off" | "name" | "email" | "tel" | "url" | "additional-name" | "address-level1" | "address-level2" | "address-level3" | "address-level4" | "address-line1" | "address-line2" | "address-line3" | "bday" | "bday-day" | "bday-month" | "bday-year" | "cc-additional-name" | "cc-csc" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-family-name" | "cc-given-name" | "cc-name" | "cc-number" | "cc-type" | "country" | "country-name" | "current-password" | "family-name" | "given-name" | "honorific-prefix" | "honorific-suffix" | "impp" | "language" | "new-password" | "nickname" | "on" | "one-time-code" | "organization" | "organization-title" | "postal-code" | "sex" | "street-address" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-national" | "transaction-amount" | "transaction-currency" | "username" | undefined;
194
194
  enterKeyHint?: "enter" | "search" | "done" | "go" | "next" | "send" | "previous" | undefined;
195
195
  rows?: number | undefined;
196
196
  readOnly?: boolean | undefined;
@@ -317,7 +317,7 @@ export declare const PressableTextInput: FC<{
317
317
  rejectResponderTermination?: boolean | null | undefined;
318
318
  selectionState?: import("react-native").DocumentSelectionState | undefined;
319
319
  spellCheck?: boolean | undefined;
320
- textContentType?: "none" | "location" | "name" | "nickname" | "username" | "URL" | "addressCity" | "addressCityAndState" | "addressState" | "countryName" | "creditCardNumber" | "emailAddress" | "familyName" | "fullStreetAddress" | "givenName" | "jobTitle" | "middleName" | "namePrefix" | "nameSuffix" | "organizationName" | "postalCode" | "streetAddressLine1" | "streetAddressLine2" | "sublocality" | "telephoneNumber" | "password" | "newPassword" | "oneTimeCode" | undefined;
320
+ textContentType?: "none" | "location" | "name" | "nickname" | "password" | "username" | "URL" | "addressCity" | "addressCityAndState" | "addressState" | "countryName" | "creditCardNumber" | "emailAddress" | "familyName" | "fullStreetAddress" | "givenName" | "jobTitle" | "middleName" | "namePrefix" | "nameSuffix" | "organizationName" | "postalCode" | "streetAddressLine1" | "streetAddressLine2" | "sublocality" | "telephoneNumber" | "newPassword" | "oneTimeCode" | undefined;
321
321
  scrollEnabled?: boolean | undefined;
322
322
  cursorColor?: import("react-native").ColorValue | null | undefined;
323
323
  importantForAutofill?: "auto" | "yes" | "no" | "noExcludeDescendants" | "yesExcludeDescendants" | undefined;
@@ -12,14 +12,14 @@ export const TransitionGroupView = ({ children, enter, leave, style, childStyle
12
12
  leavingKeysAndIndicesRef.current = leavingKeysAndIndicesRef.current.filter(leavingKey => leavingKey.key !== key);
13
13
  forceUpdate();
14
14
  };
15
- const cleanedUpChildren = useMemo(() => Array.keepMap(Children.toArray(children), child => match(child)
15
+ const cleanedUpChildren = useMemo(() => Array.filterMap(Children.toArray(children), child => match(child)
16
16
  .with({ key: P.string }, child => Option.Some({ key: child.key, child }))
17
17
  .otherwise(() => Option.None())), [children]);
18
18
  const previousChildren = usePreviousValue(cleanedUpChildren);
19
19
  const newKeys = new Set(cleanedUpChildren.map(item => item.key));
20
20
  leavingKeysAndIndicesRef.current = [
21
21
  ...leavingKeysAndIndicesRef.current,
22
- ...Array.keepMap(previousChildren.map((item, index) => ({ item, index })), ({ item, index }) => newKeys.has(item.key) ||
22
+ ...Array.filterMap(previousChildren.map((item, index) => ({ item, index })), ({ item, index }) => newKeys.has(item.key) ||
23
23
  leavingKeysAndIndicesRef.current.find(prev => prev.key === item.key)
24
24
  ? Option.None()
25
25
  : Option.Some({ key: item.key, index })),
@@ -25,6 +25,6 @@ export const useUrqlMutation = (query) => {
25
25
  }, [fetching, data, error]),
26
26
  useCallback((input) => Future.fromPromise(execute(input))
27
27
  .mapError(error => error) // Only used to cast error
28
- .mapResult(toResult), [execute]),
28
+ .mapOkToResult(toResult), [execute]),
29
29
  ];
30
30
  };