sanity-plugin-iconify 1.1.0 → 1.1.1

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": "sanity-plugin-iconify",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Icon picker based on Iconify",
5
5
  "keywords": [
6
6
  "sanity",
@@ -50,47 +50,47 @@
50
50
  "dependencies": {
51
51
  "@headlessui/react": "^1.7.17",
52
52
  "@iconify/react": "^4.1.1",
53
- "@iconify/utils": "^2.1.10",
54
- "@sanity/icons": "^2.4.1",
53
+ "@iconify/utils": "^2.1.11",
54
+ "@sanity/icons": "^2.7.0",
55
55
  "@sanity/incompatible-plugin": "^1.0.4",
56
- "@sanity/ui": "^1.8.2",
57
- "@tanstack/react-query": "^4.35.3",
56
+ "@sanity/ui": "^1.8.3",
57
+ "@tanstack/react-query": "^5.4.3",
58
58
  "change-case": "^4.1.2",
59
59
  "ts-pattern": "^5.0.5",
60
60
  "use-debounce": "^9.0.4"
61
61
  },
62
62
  "devDependencies": {
63
- "@commitlint/cli": "^17.7.1",
64
- "@commitlint/config-conventional": "^17.7.0",
65
- "@commitlint/load": "^17.7.1",
66
- "@iconify/json": "^2.2.116",
63
+ "@commitlint/cli": "^18.2.0",
64
+ "@commitlint/config-conventional": "^18.1.0",
65
+ "@commitlint/load": "^18.2.0",
66
+ "@iconify/json": "^2.2.137",
67
67
  "@iconify/types": "^2.0.0",
68
- "@sanity/pkg-utils": "^2.4.9",
68
+ "@sanity/pkg-utils": "^3.2.2",
69
69
  "@sanity/plugin-kit": "^3.1.10",
70
- "@sanity/semantic-release-preset": "^4.1.4",
71
- "@tanstack/eslint-plugin-query": "^4.34.1",
72
- "@tanstack/react-query-devtools": "^4.35.3",
73
- "@types/react": "^18.2.21",
74
- "@types/styled-components": "^5.1.27",
75
- "@typescript-eslint/eslint-plugin": "^6.7.0",
76
- "@typescript-eslint/parser": "^6.7.0",
77
- "eslint": "^8.49.0",
70
+ "@sanity/semantic-release-preset": "^4.1.6",
71
+ "@tanstack/eslint-plugin-query": "^5.0.5",
72
+ "@tanstack/react-query-devtools": "^5.4.3",
73
+ "@types/react": "^18.2.34",
74
+ "@types/styled-components": "^5.1.29",
75
+ "@typescript-eslint/eslint-plugin": "^6.9.1",
76
+ "@typescript-eslint/parser": "^6.9.1",
77
+ "eslint": "^8.53.0",
78
78
  "eslint-config-prettier": "^9.0.0",
79
- "eslint-config-sanity": "^6.0.0",
80
- "eslint-plugin-prettier": "^5.0.0",
79
+ "eslint-config-sanity": "^7.0.1",
80
+ "eslint-plugin-prettier": "^5.0.1",
81
81
  "eslint-plugin-react": "^7.33.2",
82
82
  "eslint-plugin-react-hooks": "^4.6.0",
83
83
  "husky": "^8.0.3",
84
- "lint-staged": "^14.0.1",
84
+ "lint-staged": "^15.0.2",
85
85
  "npm-run-all": "^4.1.5",
86
86
  "prettier": "^3.0.3",
87
- "prettier-plugin-packagejson": "^2.4.5",
87
+ "prettier-plugin-packagejson": "^2.4.6",
88
88
  "react": "^18.2.0",
89
89
  "react-dom": "^18.2.0",
90
90
  "react-is": "^18.2.0",
91
- "rimraf": "^5.0.1",
92
- "sanity": "^3.16.7",
93
- "tsx": "^3.12.10",
91
+ "rimraf": "^5.0.5",
92
+ "sanity": "^3.19.1",
93
+ "tsx": "^3.14.0",
94
94
  "typescript": "^5.2.2"
95
95
  },
96
96
  "peerDependencies": {
@@ -105,5 +105,11 @@
105
105
  "verifyPackage": {
106
106
  "scripts": false
107
107
  }
108
+ },
109
+ "pnpm": {
110
+ "overrides": {
111
+ "@babel/traverse@<7.23.2": ">=7.23.2",
112
+ "postcss@<8.4.31": ">=8.4.31"
113
+ }
108
114
  }
109
115
  }
@@ -21,7 +21,7 @@ export function IconifyCombobox(props: IconifyComboboxProps) {
21
21
  const toast = useToast();
22
22
  const inputRef = useRef<HTMLInputElement>(null);
23
23
 
24
- const { term, setTerm, debouncedTerm, isInitialLoading, isError, error, data, isPreviousData } =
24
+ const { term, setTerm, debouncedTerm, isLoading, isError, error, data, isPreviousData } =
25
25
  useSearch({
26
26
  collections,
27
27
  });
@@ -79,7 +79,7 @@ export function IconifyCombobox(props: IconifyComboboxProps) {
79
79
  <SearchResults
80
80
  state={match<boolean>(true)
81
81
  .returnType<SearchResultsProps['state']>()
82
- .with(isInitialLoading, () => 'loading')
82
+ .with(isLoading, () => 'loading')
83
83
  .with(!debouncedTerm, () => 'initial')
84
84
  .with(isError, () => 'error')
85
85
  .with(!data || data.length === 0, () => 'empty')
package/src/lib/api.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { IconifyInfo } from '@iconify/types';
2
- import { useQuery, useQueryClient } from '@tanstack/react-query';
3
- import { IconifySearchResult } from './types';
2
+ import { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query';
4
3
  import { useCallback, useState } from 'react';
5
4
  import { useDebounce } from 'use-debounce';
5
+ import { IconifySearchResult } from './types';
6
6
 
7
7
  const BASE_API_URL = 'https://api.iconify.design';
8
8
 
@@ -44,7 +44,7 @@ export function useSearch({ collections }: { collections: string[] | null }) {
44
44
  [setDebouncedTerm],
45
45
  );
46
46
 
47
- const { isInitialLoading, isError, error, data, isPreviousData } = useQuery<string[], Error>({
47
+ const { isLoading, isError, error, data, isPlaceholderData } = useQuery<string[], Error>({
48
48
  queryKey: ['search', collections, debouncedTerm],
49
49
  queryFn: async ({ signal }) => {
50
50
  const url = new URL(`/search`, BASE_API_URL);
@@ -68,7 +68,7 @@ export function useSearch({ collections }: { collections: string[] | null }) {
68
68
  return result?.icons ?? [];
69
69
  },
70
70
  enabled: debouncedTerm.length > 0,
71
- keepPreviousData: debouncedTerm.length > 0,
71
+ placeholderData: keepPreviousData,
72
72
  staleTime: 5 * 60 * 1000, // 5 minutes
73
73
  });
74
74
 
@@ -76,11 +76,11 @@ export function useSearch({ collections }: { collections: string[] | null }) {
76
76
  term,
77
77
  setTerm: updateTerm,
78
78
  debouncedTerm,
79
- isInitialLoading,
79
+ isLoading,
80
80
  isError,
81
81
  error,
82
82
  data,
83
- isPreviousData,
83
+ isPreviousData: isPlaceholderData,
84
84
  };
85
85
  }
86
86