sanity-plugin-iconify 3.0.0 → 4.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/dist/index.js DELETED
@@ -1,362 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { unset, set, definePlugin } from "sanity";
3
- import { Grid, Box, Card, Text, TextInput, Button, useToast, Popover, ThemeProvider, Stack, Flex } from "@sanity/ui";
4
- import { buildTheme } from "@sanity/ui/theme";
5
- import { useState, useCallback, memo, forwardRef, useId, useRef, useEffect, useMemo } from "react";
6
- import { useCombobox } from "downshift";
7
- import { match } from "ts-pattern";
8
- import { useQueryClient, useQuery, keepPreviousData, QueryClient, QueryClientProvider as QueryClientProvider$1 } from "@tanstack/react-query";
9
- import { useDebounce } from "use-debounce";
10
- import styled from "styled-components";
11
- import { Icon } from "@iconify/react";
12
- import { TrashIcon } from "@sanity/icons";
13
- import { stringToIcon } from "@iconify/utils";
14
- import { sentenceCase } from "change-case";
15
- const BASE_API_URL = "https://api.iconify.design";
16
- function fetchJson({ url, signal }) {
17
- return fetch(url, { signal }).then((response) => {
18
- if (!response.ok)
19
- throw new Error(`Network error: status ${response.status}`);
20
- return response.json();
21
- }).then(
22
- (result) => result,
23
- (error) => {
24
- throw error instanceof Error ? error : (console.error(`Unknown error: ${error}`), new Error("Something went wrong"));
25
- }
26
- );
27
- }
28
- function useSearch({ collections }) {
29
- const queryClient2 = useQueryClient(), [term, setTerm] = useState(""), [debouncedTerm, setDebouncedTerm] = useDebounce(term, 500), updateTerm = useCallback(
30
- (newTerm, updateImmediately = !1) => {
31
- setTerm(newTerm), updateImmediately && setDebouncedTerm(newTerm);
32
- },
33
- [setDebouncedTerm]
34
- ), { isLoading, isError, error, data, isPlaceholderData } = useQuery({
35
- queryKey: ["search", collections, debouncedTerm],
36
- queryFn: async ({ signal }) => {
37
- const url = new URL("/search", BASE_API_URL);
38
- url.searchParams.append("query", debouncedTerm), url.searchParams.append("limit", "60"), collections && url.searchParams.append("prefixes", collections.join(","));
39
- const result = debouncedTerm ? await fetchJson({ url, signal }) : null;
40
- return result && Object.entries(result.collections).forEach(([prefix, info]) => {
41
- queryClient2.setQueryData(["iconSetInfo", prefix], info);
42
- }), result?.icons ?? [];
43
- },
44
- enabled: debouncedTerm.length > 0,
45
- placeholderData: keepPreviousData,
46
- staleTime: 300 * 1e3
47
- // 5 minutes
48
- });
49
- return {
50
- term,
51
- setTerm: updateTerm,
52
- debouncedTerm,
53
- isLoading,
54
- isError,
55
- error,
56
- data,
57
- isPreviousData: isPlaceholderData
58
- };
59
- }
60
- function useIconSetInfo({ prefix }) {
61
- return useQuery({
62
- queryKey: ["iconSetInfo", prefix],
63
- queryFn: async ({ signal }) => {
64
- if (!prefix) return null;
65
- const url = new URL("/collection", BASE_API_URL);
66
- return url.searchParams.append("prefix", prefix), url.searchParams.append("info", "true"), (await fetchJson({ url, signal }))?.info ?? null;
67
- },
68
- staleTime: 1 / 0
69
- });
70
- }
71
- styled(Grid)`
72
- grid-template-columns: 1fr min-content;
73
- position: relative;
74
- `;
75
- const OptionsWrapper = styled(Box)`
76
- box-sizing: border-box;
77
- padding: 0.5rem;
78
-
79
- & [role='listbox'] {
80
- display: flex;
81
- flex-wrap: wrap;
82
- gap: 0.5rem;
83
- margin: 0;
84
- padding: 0;
85
- list-style: none;
86
- }
87
-
88
- & [role='option'] {
89
- display: grid;
90
- place-items: center;
91
- width: clamp(3rem, 10vw, 4rem);
92
-
93
- & button {
94
- cursor: pointer;
95
- width: 100%;
96
-
97
- & > [data-ui='Box'] {
98
- display: flex;
99
- }
100
-
101
- & svg {
102
- aspect-ratio: 1;
103
- }
104
- }
105
- }
106
- `;
107
- function MessageWrapper({ children }) {
108
- return /* @__PURE__ */ jsx(Card, { padding: 4, children: /* @__PURE__ */ jsx(Text, { align: "center", muted: !0, children }) });
109
- }
110
- const SearchInput = memo(
111
- forwardRef((props, ref) => {
112
- const { selectedIcon, suffix, ...rest } = props;
113
- return /* @__PURE__ */ jsx(
114
- TextInput,
115
- {
116
- ...rest,
117
- ref,
118
- inputMode: "search",
119
- icon: selectedIcon ? /* @__PURE__ */ jsx(Icon, { icon: selectedIcon }) : null,
120
- placeholder: selectedIcon ? "Search and replace selected icon..." : "Search for an icon...",
121
- suffix
122
- }
123
- );
124
- })
125
- );
126
- SearchInput.displayName = "SearchInput";
127
- const SearchResults = memo(
128
- forwardRef((props, ref) => {
129
- const { state, data, getItemProps, highlightedIndex, ...rest } = props;
130
- return /* @__PURE__ */ jsxs(Fragment, { children: [
131
- (() => {
132
- switch (state) {
133
- case "initial":
134
- return /* @__PURE__ */ jsx(MessageWrapper, { children: "Search for icons" });
135
- case "loading":
136
- return /* @__PURE__ */ jsx(MessageWrapper, { children: "Searching..." });
137
- case "error":
138
- return /* @__PURE__ */ jsx(MessageWrapper, { children: "Something went wrong..." });
139
- case "empty":
140
- return /* @__PURE__ */ jsx(MessageWrapper, { children: "No icons found" });
141
- }
142
- })(),
143
- /* @__PURE__ */ jsx(
144
- "ul",
145
- {
146
- ...rest,
147
- ref,
148
- "data-testid": "iconify-results",
149
- style: { opacity: state === "stale" ? 0.5 : 1 },
150
- children: (state === "data" || state === "stale") && data?.map((icon, index) => /* @__PURE__ */ jsx("li", { ...getItemProps({ item: icon, index }), children: /* @__PURE__ */ jsx(Button, { padding: 3, mode: "bleed", selected: index === highlightedIndex, children: /* @__PURE__ */ jsx(Icon, { icon, width: "100%", height: "100%" }) }) }, icon))
151
- }
152
- )
153
- ] });
154
- })
155
- );
156
- function UnsetButton(props) {
157
- const { onUnset } = props;
158
- return /* @__PURE__ */ jsx(Card, { border: !0, borderLeft: !1, padding: 1, display: "flex", radius: 2, children: /* @__PURE__ */ jsx(
159
- Button,
160
- {
161
- "data-testid": "iconify-unset",
162
- icon: /* @__PURE__ */ jsx(TrashIcon, {}),
163
- onClick: onUnset,
164
- mode: "bleed",
165
- fontSize: 1,
166
- padding: 2
167
- }
168
- ) });
169
- }
170
- const IconifyCombobox = memo(function(props) {
171
- const {
172
- selectedIcon,
173
- onSelect: pushSelection,
174
- collections,
175
- studioElementProps,
176
- fieldFocused
177
- } = props, id = useId(), toast = useToast(), inputRef = useRef(null), composedInputRef = useCallback(
178
- (node) => {
179
- inputRef.current = node, studioElementProps?.ref && (studioElementProps.ref.current = node);
180
- },
181
- [studioElementProps?.ref]
182
- ), suppressNextBlur = useRef(!1), handleFocus = useCallback(
183
- (event) => {
184
- suppressNextBlur.current = !0, setTimeout(() => {
185
- suppressNextBlur.current = !1;
186
- }, 0), studioElementProps?.onFocus?.(event);
187
- },
188
- [studioElementProps]
189
- ), handleBlur = useCallback(
190
- (event) => {
191
- if (suppressNextBlur.current) {
192
- suppressNextBlur.current = !1;
193
- return;
194
- }
195
- studioElementProps?.onBlur?.(event);
196
- },
197
- [studioElementProps]
198
- ), { term, setTerm, debouncedTerm, isLoading, isError, error, data, isPreviousData } = useSearch({
199
- collections
200
- }), {
201
- isOpen,
202
- getMenuProps,
203
- getInputProps,
204
- highlightedIndex,
205
- getItemProps,
206
- selectItem,
207
- setInputValue,
208
- closeMenu
209
- } = useCombobox({
210
- items: data ?? [],
211
- inputValue: term,
212
- onInputValueChange({ inputValue, selectedItem }) {
213
- inputValue !== selectedItem && setTerm(inputValue);
214
- },
215
- onSelectedItemChange({ selectedItem }) {
216
- selectedItem && (pushSelection(selectedItem), setTerm("", !0), setInputValue(""));
217
- }
218
- });
219
- useEffect(() => {
220
- fieldFocused || closeMenu();
221
- }, [fieldFocused, closeMenu]);
222
- const handleUnset = useCallback(() => {
223
- pushSelection(""), setTerm("", !0), selectItem("");
224
- }, [pushSelection, setTerm, selectItem]);
225
- useEffect(() => {
226
- isError && (console.error("Iconify input error:", error), toast.push({
227
- id,
228
- status: "error",
229
- title: "Iconify input error",
230
- description: error?.message
231
- }));
232
- }, [error, id, isError, toast]);
233
- const { onBlur: _downshiftOnBlur, ...inputProps } = getInputProps({
234
- ref: composedInputRef,
235
- id: studioElementProps?.id,
236
- "aria-describedby": studioElementProps?.["aria-describedby"],
237
- onFocus: handleFocus
238
- });
239
- return /* @__PURE__ */ jsxs("div", { children: [
240
- /* @__PURE__ */ jsx(
241
- SearchInput,
242
- {
243
- ...inputProps,
244
- onBlur: handleBlur,
245
- selectedIcon,
246
- suffix: selectedIcon ? /* @__PURE__ */ jsx(UnsetButton, { onUnset: handleUnset }) : null
247
- }
248
- ),
249
- /* @__PURE__ */ jsx(
250
- Popover,
251
- {
252
- open: !0,
253
- style: { display: isOpen ? "block" : "none" },
254
- placement: "bottom",
255
- arrow: !1,
256
- matchReferenceWidth: !0,
257
- constrainSize: !0,
258
- referenceElement: inputRef.current,
259
- content: /* @__PURE__ */ jsx(OptionsWrapper, { children: /* @__PURE__ */ jsx(
260
- SearchResults,
261
- {
262
- ...getMenuProps(),
263
- state: match(!0).returnType().with(isLoading, () => "loading").with(!debouncedTerm, () => "initial").with(isError, () => "error").with(!data || data.length === 0, () => "empty").with(isPreviousData, () => "stale").otherwise(() => "data"),
264
- data,
265
- getItemProps,
266
- highlightedIndex
267
- }
268
- ) })
269
- }
270
- )
271
- ] });
272
- }), queryClient = new QueryClient();
273
- function QueryClientProvider(props) {
274
- return /* @__PURE__ */ jsx(QueryClientProvider$1, { client: queryClient, children: props.children });
275
- }
276
- function usePrettyIconName(props) {
277
- const { name } = props, iconMeta = useMemo(
278
- () => props.iconMeta ?? (name ? stringToIcon(name) : null),
279
- [name, props.iconMeta]
280
- ), iconSetInfo = useIconSetInfo({ prefix: iconMeta?.prefix ?? null });
281
- return useMemo(
282
- () => iconMeta ? {
283
- name: sentenceCase(iconMeta.name),
284
- collection: iconSetInfo.data?.name ?? iconMeta.prefix
285
- } : null,
286
- [iconMeta, iconSetInfo.data?.name]
287
- );
288
- }
289
- const theme = buildTheme(), IconifyInput = memo(function(props) {
290
- const { config, value, onChange: pushChange, schemaType, elementProps, focused } = props, selectedIcon = value?.name ?? null, options = schemaType.options, collections = !!options?.collections?.length && options.collections || !!config?.collections?.length && config.collections || null, showName = options?.showName ?? config?.showName ?? !1, handleSelect = useCallback(
291
- (icon) => {
292
- pushChange(icon === "" ? unset() : set(icon, ["name"]));
293
- },
294
- [pushChange]
295
- );
296
- return /* @__PURE__ */ jsx(QueryClientProvider, { children: /* @__PURE__ */ jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
297
- /* @__PURE__ */ jsx(
298
- IconifyCombobox,
299
- {
300
- selectedIcon,
301
- onSelect: handleSelect,
302
- collections,
303
- studioElementProps: elementProps,
304
- fieldFocused: focused
305
- }
306
- ),
307
- showName && selectedIcon ? /* @__PURE__ */ jsx(IconifyNameDisplay, { name: selectedIcon }) : null
308
- ] }) }) });
309
- });
310
- function IconifyNameDisplay(props) {
311
- const { name } = props, prettyName = usePrettyIconName({ name });
312
- return /* @__PURE__ */ jsxs(Flex, { gap: 1, children: [
313
- /* @__PURE__ */ jsx(Text, { size: 1, muted: !0, children: "Selected:" }),
314
- /* @__PURE__ */ jsx(Text, { size: 1, weight: "semibold", children: prettyName?.name ?? name }),
315
- prettyName?.collection && /* @__PURE__ */ jsxs(Text, { size: 1, muted: !0, style: { fontStyle: "italic" }, children: [
316
- "by ",
317
- prettyName?.collection
318
- ] })
319
- ] });
320
- }
321
- const IconifyPreview = memo(function(props) {
322
- const { title } = props, iconName = typeof props.title == "string" ? stringToIcon(props.title) : null;
323
- return typeof title == "string" && iconName ? /* @__PURE__ */ jsx(QueryClientProvider, { children: /* @__PURE__ */ jsx(IconifyPreviewInner, { ...props, iconName: title, iconMeta: iconName }) }) : props.renderDefault(props);
324
- });
325
- function IconifyPreviewInner(props) {
326
- const { iconMeta, iconName, ...previewProps } = props, prettyName = usePrettyIconName({ iconMeta });
327
- return props.renderDefault({
328
- ...previewProps,
329
- media: /* @__PURE__ */ jsx(Icon, { icon: iconName }),
330
- title: prettyName?.name ?? iconName,
331
- subtitle: prettyName?.collection
332
- });
333
- }
334
- const iconify = definePlugin((config = {}) => ({
335
- name: "sanity-plugin-iconify",
336
- schema: {
337
- types: [
338
- {
339
- name: "icon",
340
- title: "Icon",
341
- type: "object",
342
- fields: [
343
- {
344
- name: "name",
345
- title: "Name",
346
- type: "string"
347
- }
348
- ],
349
- components: {
350
- input: (props) => /* @__PURE__ */ jsx(IconifyInput, { ...props, config }),
351
- preview: IconifyPreview,
352
- // This makes sure the input component is not indented
353
- field: (props) => props.renderDefault({ ...props, level: 0 })
354
- }
355
- }
356
- ]
357
- }
358
- }));
359
- export {
360
- iconify
361
- };
362
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/lib/api.ts","../src/combobox/iconify-combobox.styles.tsx","../src/combobox/search-input.tsx","../src/combobox/search-result.tsx","../src/combobox/unset-button.tsx","../src/combobox/iconify-combobox.tsx","../src/lib/query-client.tsx","../src/lib/use-pretty-icon-name.ts","../src/iconify-input.tsx","../src/iconify-preview.tsx","../src/iconify-plugin.tsx"],"sourcesContent":["import type { IconifyInfo } from '@iconify/types';\nimport { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { useCallback, useState } from 'react';\nimport { useDebounce } from 'use-debounce';\nimport type { IconifySearchResult } from './types';\n\nconst BASE_API_URL = 'https://api.iconify.design';\n\nfunction fetchJson<T>({ url, signal }: { url: string | URL; signal?: AbortSignal }): Promise<T> {\n return fetch(url, { signal })\n .then((response) => {\n if (!response.ok) {\n throw new Error(`Network error: status ${response.status}`);\n }\n\n return response.json();\n })\n .then(\n (result) => result as T,\n (error) => {\n if (error instanceof Error) {\n throw error;\n } else {\n console.error(`Unknown error: ${error}`);\n throw new Error('Something went wrong');\n }\n },\n );\n}\n\nexport function useSearch({ collections }: { collections: string[] | null }) {\n const queryClient = useQueryClient();\n const [term, setTerm] = useState('');\n const [debouncedTerm, setDebouncedTerm] = useDebounce(term, 500);\n\n const updateTerm = useCallback(\n (newTerm: string, updateImmediately = false) => {\n setTerm(newTerm);\n\n if (updateImmediately) {\n setDebouncedTerm(newTerm);\n }\n },\n [setDebouncedTerm],\n );\n\n const { isLoading, isError, error, data, isPlaceholderData } = useQuery<string[], Error>({\n queryKey: ['search', collections, debouncedTerm],\n queryFn: async ({ signal }) => {\n const url = new URL(`/search`, BASE_API_URL);\n\n url.searchParams.append('query', debouncedTerm);\n url.searchParams.append('limit', '60');\n\n if (collections) {\n url.searchParams.append('prefixes', collections.join(','));\n }\n\n const result = debouncedTerm ? await fetchJson<IconifySearchResult>({ url, signal }) : null;\n\n if (result) {\n // Cache the info for each collection\n Object.entries(result.collections).forEach(([prefix, info]) => {\n queryClient.setQueryData<IconifyInfo>(['iconSetInfo', prefix], info);\n });\n }\n\n return result?.icons ?? [];\n },\n enabled: debouncedTerm.length > 0,\n placeholderData: keepPreviousData,\n staleTime: 5 * 60 * 1000, // 5 minutes\n });\n\n return {\n term,\n setTerm: updateTerm,\n debouncedTerm,\n isLoading,\n isError,\n error,\n data,\n isPreviousData: isPlaceholderData,\n };\n}\n\nexport function useIconSetInfo({ prefix }: { prefix?: string | null }) {\n return useQuery<IconifyInfo | null, Error>({\n queryKey: ['iconSetInfo', prefix],\n queryFn: async ({ signal }) => {\n if (!prefix) return null;\n\n const url = new URL('/collection', BASE_API_URL);\n\n url.searchParams.append('prefix', prefix);\n url.searchParams.append('info', 'true');\n\n const result = await fetchJson<{ info: IconifyInfo }>({ url, signal });\n\n return result?.info ?? null;\n },\n staleTime: Infinity,\n });\n}\n","import { Box, Card, Grid, Text } from '@sanity/ui';\nimport type { ReactNode } from 'react';\nimport styled from 'styled-components';\n\nexport const ComboboxWrapper = styled(Grid)`\n grid-template-columns: 1fr min-content;\n position: relative;\n`;\n\nexport const OptionsWrapper = styled(Box)`\n box-sizing: border-box;\n padding: 0.5rem;\n\n & [role='listbox'] {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin: 0;\n padding: 0;\n list-style: none;\n }\n\n & [role='option'] {\n display: grid;\n place-items: center;\n width: clamp(3rem, 10vw, 4rem);\n\n & button {\n cursor: pointer;\n width: 100%;\n\n & > [data-ui='Box'] {\n display: flex;\n }\n\n & svg {\n aspect-ratio: 1;\n }\n }\n }\n`;\n\nexport function MessageWrapper({ children }: { children: ReactNode }) {\n return (\n <Card padding={4}>\n <Text align=\"center\" muted>\n {children}\n </Text>\n </Card>\n );\n}\n","import { Icon } from '@iconify/react';\nimport { TextInput } from '@sanity/ui';\nimport { forwardRef, memo } from 'react';\n\ninterface SearchInputProps extends React.HTMLAttributes<HTMLInputElement> {\n selectedIcon: string | null;\n suffix?: React.ReactNode;\n}\n\nexport const SearchInput = memo(\n forwardRef<HTMLInputElement, SearchInputProps>((props, ref) => {\n const { selectedIcon, suffix, ...rest } = props;\n\n return (\n <TextInput\n {...rest}\n ref={ref}\n inputMode=\"search\"\n icon={selectedIcon ? <Icon icon={selectedIcon} /> : null}\n placeholder={selectedIcon ? 'Search and replace selected icon...' : 'Search for an icon...'}\n suffix={suffix}\n />\n );\n }),\n);\n\nSearchInput.displayName = 'SearchInput';\n","import { Icon } from '@iconify/react';\nimport { Button } from '@sanity/ui';\nimport type { UseComboboxGetItemPropsOptions, UseComboboxGetItemPropsReturnValue } from 'downshift';\nimport { forwardRef, memo } from 'react';\nimport { MessageWrapper } from './iconify-combobox.styles';\n\ntype GetItemProps = (\n options: UseComboboxGetItemPropsOptions<string>,\n) => UseComboboxGetItemPropsReturnValue;\n\nexport interface SearchResultsProps extends React.HTMLAttributes<HTMLUListElement> {\n state: 'initial' | 'loading' | 'error' | 'empty' | 'data' | 'stale';\n data?: string[];\n getItemProps: GetItemProps;\n highlightedIndex: number;\n}\n\nexport const SearchResults = memo(\n forwardRef<HTMLUListElement, SearchResultsProps>((props, ref) => {\n const { state, data, getItemProps, highlightedIndex, ...rest } = props;\n\n return (\n <>\n {(() => {\n switch (state) {\n case 'initial':\n return <MessageWrapper>Search for icons</MessageWrapper>;\n case 'loading':\n return <MessageWrapper>Searching...</MessageWrapper>;\n case 'error':\n return <MessageWrapper>Something went wrong...</MessageWrapper>;\n case 'empty':\n return <MessageWrapper>No icons found</MessageWrapper>;\n }\n })()}\n\n <ul\n {...rest}\n ref={ref}\n data-testid=\"iconify-results\"\n style={{ opacity: state === 'stale' ? 0.5 : 1 }}\n >\n {(state === 'data' || state === 'stale') &&\n data?.map((icon, index) => (\n <li key={icon} {...getItemProps({ item: icon, index })}>\n <Button padding={3} mode=\"bleed\" selected={index === highlightedIndex}>\n <Icon icon={icon} width=\"100%\" height=\"100%\" />\n </Button>\n </li>\n ))}\n </ul>\n </>\n );\n }),\n);\n","import { TrashIcon } from '@sanity/icons';\nimport { Button, Card } from '@sanity/ui';\n\n// ------------ //\n// UNSET BUTTON //\n// ------------ //\n\ninterface UnsetButtonProps {\n onUnset: () => void;\n}\n\nexport function UnsetButton(props: UnsetButtonProps) {\n const { onUnset } = props;\n\n return (\n <Card border borderLeft={false} padding={1} display=\"flex\" radius={2}>\n <Button\n data-testid=\"iconify-unset\"\n icon={<TrashIcon />}\n onClick={onUnset}\n mode=\"bleed\"\n fontSize={1}\n padding={2}\n />\n </Card>\n );\n}\n","import { Popover, useToast } from '@sanity/ui';\nimport { useCombobox } from 'downshift';\nimport { memo, useCallback, useEffect, useId, useRef } from 'react';\nimport type { ObjectInputProps } from 'sanity';\nimport { match } from 'ts-pattern';\nimport { useSearch } from '../lib/api';\nimport { OptionsWrapper } from './iconify-combobox.styles';\nimport { SearchInput } from './search-input';\nimport type { SearchResultsProps } from './search-result';\nimport { SearchResults } from './search-result';\nimport { UnsetButton } from './unset-button';\n\nexport interface IconifyComboboxProps {\n selectedIcon: string | null;\n onSelect: (newValue: string) => void;\n collections: string[] | null;\n studioElementProps?: ObjectInputProps['elementProps'];\n fieldFocused?: boolean;\n}\n\nexport const IconifyCombobox = memo(function IconifyCombobox(props: IconifyComboboxProps) {\n const {\n selectedIcon,\n onSelect: pushSelection,\n collections,\n studioElementProps,\n fieldFocused,\n } = props;\n\n const id = useId();\n const toast = useToast();\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Compose our inputRef (used by the Popover for positioning) with Studio's focusRef.\n // Standard Sanity inputs spread all of elementProps onto the native element, which\n // lets Studio programmatically re-focus the field and track focus via onPathFocus/onPathBlur.\n const composedInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (studioElementProps?.ref) {\n (studioElementProps.ref as React.RefObject<HTMLInputElement | null>).current = node;\n }\n },\n [studioElementProps?.ref],\n );\n\n // Studio steals focus to its field-actions-trigger immediately after field activation, then\n // re-focuses the actual input — all within the same macrotask as the original focus event.\n // We suppress the onPathBlur for this activation blur so Studio's focused state stays accurate.\n // The flag is reset via setTimeout so any blur in a later macrotask (real user navigation) is\n // forwarded normally.\n const suppressNextBlur = useRef(false);\n\n const handleFocus = useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n suppressNextBlur.current = true;\n setTimeout(() => {\n suppressNextBlur.current = false;\n }, 0);\n studioElementProps?.onFocus?.(event as unknown as React.FocusEvent<HTMLDivElement>);\n },\n [studioElementProps],\n );\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n if (suppressNextBlur.current) {\n suppressNextBlur.current = false;\n return;\n }\n studioElementProps?.onBlur?.(event as unknown as React.FocusEvent<HTMLDivElement>);\n },\n [studioElementProps],\n );\n\n const { term, setTerm, debouncedTerm, isLoading, isError, error, data, isPreviousData } =\n useSearch({\n collections,\n });\n\n const {\n isOpen,\n getMenuProps,\n getInputProps,\n highlightedIndex,\n getItemProps,\n selectItem,\n setInputValue,\n closeMenu,\n } = useCombobox({\n items: data ?? [],\n inputValue: term,\n onInputValueChange({ inputValue, selectedItem }) {\n if (inputValue !== selectedItem) {\n setTerm(inputValue);\n }\n },\n onSelectedItemChange({ selectedItem }) {\n if (selectedItem) {\n pushSelection(selectedItem);\n setTerm('', true);\n setInputValue('');\n }\n },\n });\n\n // Close the menu when Studio considers the field unfocused. This is the state→UI equivalent\n // of the old stateReducer: instead of intercepting downshift's blur handling imperatively,\n // we let Studio's focused state drive whether the menu should be open.\n useEffect(() => {\n if (!fieldFocused) closeMenu();\n }, [fieldFocused, closeMenu]);\n\n const handleUnset = useCallback(() => {\n pushSelection('');\n setTerm('', true);\n selectItem('');\n }, [pushSelection, setTerm, selectItem]);\n\n useEffect(() => {\n if (isError) {\n console.error('Iconify input error:', error);\n\n toast.push({\n id,\n status: 'error',\n title: 'Iconify input error',\n description: error?.message,\n });\n }\n }, [error, id, isError, toast]);\n\n // Destructure onBlur out so downshift's InputBlur doesn't close the menu —\n // menu lifecycle is now driven by fieldFocused via the effect above.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onBlur: _downshiftOnBlur, ...inputProps } = getInputProps({\n ref: composedInputRef,\n id: studioElementProps?.id,\n 'aria-describedby': studioElementProps?.['aria-describedby'],\n onFocus: handleFocus,\n });\n\n return (\n <div>\n <SearchInput\n {...inputProps}\n onBlur={handleBlur}\n selectedIcon={selectedIcon}\n suffix={selectedIcon ? <UnsetButton onUnset={handleUnset} /> : null}\n />\n\n <Popover\n open={true}\n style={{ display: isOpen ? 'block' : 'none' }}\n placement=\"bottom\"\n arrow={false}\n matchReferenceWidth\n constrainSize\n referenceElement={inputRef.current}\n content={\n <OptionsWrapper>\n <SearchResults\n {...getMenuProps()}\n state={match<boolean>(true)\n .returnType<SearchResultsProps['state']>()\n .with(isLoading, () => 'loading')\n .with(!debouncedTerm, () => 'initial')\n .with(isError, () => 'error')\n .with(!data || data.length === 0, () => 'empty')\n .with(isPreviousData, () => 'stale')\n .otherwise(() => 'data')}\n data={data}\n getItemProps={getItemProps}\n highlightedIndex={highlightedIndex}\n />\n </OptionsWrapper>\n }\n />\n </div>\n );\n});\n","import {\n QueryClient,\n QueryClientProvider as ReactQueryClientProvider,\n} from '@tanstack/react-query';\nimport type { ReactNode } from 'react';\n\nexport const queryClient = new QueryClient();\n\nexport function QueryClientProvider(props: { children: ReactNode }) {\n return <ReactQueryClientProvider client={queryClient}>{props.children}</ReactQueryClientProvider>;\n}\n","import type { IconifyIconName } from '@iconify/utils';\nimport { stringToIcon } from '@iconify/utils';\nimport { sentenceCase } from 'change-case';\nimport { useMemo } from 'react';\nimport { useIconSetInfo } from './api';\n\ninterface UsePrettyIconNameProps {\n name?: string | null;\n iconMeta?: IconifyIconName | null;\n}\n\nexport function usePrettyIconName(props: UsePrettyIconNameProps) {\n const { name } = props;\n const iconMeta = useMemo(\n () => props.iconMeta ?? (name ? stringToIcon(name) : null),\n [name, props.iconMeta],\n );\n const iconSetInfo = useIconSetInfo({ prefix: iconMeta?.prefix ?? null });\n\n return useMemo(\n () =>\n iconMeta\n ? {\n name: sentenceCase(iconMeta.name),\n collection: iconSetInfo.data?.name ?? iconMeta.prefix,\n }\n : null,\n [iconMeta, iconSetInfo.data?.name],\n );\n}\n","import { Flex, Stack, Text, ThemeProvider } from '@sanity/ui';\nimport { buildTheme } from '@sanity/ui/theme';\nimport { memo, useCallback } from 'react';\nimport type { ObjectInputProps } from 'sanity';\nimport { set, unset } from 'sanity';\nimport { IconifyCombobox } from './combobox';\nimport { QueryClientProvider } from './lib/query-client';\nimport type { IconifyPluginConfig, IconOptions } from './lib/types';\nimport { usePrettyIconName } from './lib/use-pretty-icon-name';\n\nconst theme = buildTheme();\n\ninterface IconifyInputProps extends ObjectInputProps {\n config: IconifyPluginConfig;\n}\n\nexport const IconifyInput = memo(function IconifyInput(props: IconifyInputProps) {\n const { config, value, onChange: pushChange, schemaType, elementProps, focused } = props;\n\n const selectedIcon: string | null = value?.name ?? null;\n\n const options: IconOptions = schemaType.options;\n const collections =\n (!!options?.collections?.length && options.collections) ||\n (!!config?.collections?.length && config.collections) ||\n null;\n const showName = options?.showName ?? config?.showName ?? false;\n\n const handleSelect = useCallback(\n (icon: string) => {\n pushChange(icon === '' ? unset() : set(icon, ['name']));\n },\n [pushChange],\n );\n\n return (\n <QueryClientProvider>\n <ThemeProvider theme={theme}>\n <Stack space={2}>\n <IconifyCombobox\n selectedIcon={selectedIcon}\n onSelect={handleSelect}\n collections={collections}\n studioElementProps={elementProps}\n fieldFocused={focused}\n />\n\n {showName && selectedIcon ? <IconifyNameDisplay name={selectedIcon} /> : null}\n </Stack>\n </ThemeProvider>\n </QueryClientProvider>\n );\n});\n\ninterface IconifyNameDisplayProps {\n name?: string | null;\n}\n\nexport function IconifyNameDisplay(props: IconifyNameDisplayProps) {\n const { name } = props;\n const prettyName = usePrettyIconName({ name });\n\n return (\n <Flex gap={1}>\n <Text size={1} muted>\n Selected:\n </Text>\n\n <Text size={1} weight=\"semibold\">\n {prettyName?.name ?? name}\n </Text>\n\n {prettyName?.collection && (\n <Text size={1} muted style={{ fontStyle: 'italic' }}>\n by {prettyName?.collection}\n </Text>\n )}\n </Flex>\n );\n}\n","import { Icon } from '@iconify/react';\nimport type { IconifyIconName } from '@iconify/utils';\nimport { stringToIcon } from '@iconify/utils';\nimport { memo } from 'react';\nimport type { PreviewProps } from 'sanity';\nimport { QueryClientProvider } from './lib/query-client';\nimport { usePrettyIconName } from './lib/use-pretty-icon-name';\n\n// --------------- //\n// ICONIFY PREVIEW //\n// --------------- //\n\nexport const IconifyPreview = memo(function IconifyPreview(props: PreviewProps) {\n const { title } = props;\n const iconName = typeof props.title === 'string' ? stringToIcon(props.title) : null;\n\n // We check this double to avoid the TS error\n if (typeof title === 'string' && iconName) {\n return (\n <QueryClientProvider>\n <IconifyPreviewInner {...props} iconName={title} iconMeta={iconName} />\n </QueryClientProvider>\n );\n }\n\n return props.renderDefault(props);\n});\n\n// --------------------- //\n// ICONIFY PREVIEW INNER //\n// --------------------- //\n\ninterface IconifyPreviewInnerProps extends PreviewProps {\n iconName: string;\n iconMeta: IconifyIconName;\n}\n\nfunction IconifyPreviewInner(props: IconifyPreviewInnerProps) {\n const { iconMeta, iconName, ...previewProps } = props;\n const prettyName = usePrettyIconName({ iconMeta });\n\n return props.renderDefault({\n ...previewProps,\n media: <Icon icon={iconName} />,\n title: prettyName?.name ?? iconName,\n subtitle: prettyName?.collection,\n });\n}\n","import type { FieldProps, ObjectInputProps } from 'sanity';\nimport { definePlugin } from 'sanity';\nimport { IconifyInput } from './iconify-input';\nimport { IconifyPreview } from './iconify-preview';\nimport type { IconifyPluginConfig } from './lib/types';\n\n/**\n * Usage in `sanity.config.ts` (or .js)\n *\n * ```ts\n * import { defineConfig } from 'sanity'\n * import { iconify } from 'sanity-plugin-iconify'\n *\n * export default defineConfig({\n * // ...\n * plugins: [iconify()],\n * })\n * ```\n */\nexport const iconify = definePlugin<IconifyPluginConfig | void>((config = {}) => {\n return {\n name: 'sanity-plugin-iconify',\n schema: {\n types: [\n {\n name: 'icon',\n title: 'Icon',\n type: 'object',\n fields: [\n {\n name: 'name',\n title: 'Name',\n type: 'string',\n },\n ],\n components: {\n input: (props: ObjectInputProps) => <IconifyInput {...props} config={config!} />,\n preview: IconifyPreview,\n\n // This makes sure the input component is not indented\n field: (props: FieldProps) => props.renderDefault({ ...props, level: 0 }),\n },\n },\n ],\n },\n };\n});\n"],"names":["queryClient","ReactQueryClientProvider"],"mappings":";;;;;;;;;;;;;;AAMA,MAAM,eAAe;AAErB,SAAS,UAAa,EAAE,KAAK,UAAmE;AAC9F,SAAO,MAAM,KAAK,EAAE,OAAA,CAAQ,EACzB,KAAK,CAAC,aAAa;AAClB,QAAI,CAAC,SAAS;AACZ,YAAM,IAAI,MAAM,yBAAyB,SAAS,MAAM,EAAE;AAG5D,WAAO,SAAS,KAAA;AAAA,EAClB,CAAC,EACA;AAAA,IACC,CAAC,WAAW;AAAA,IACZ,CAAC,UAAU;AACT,YAAI,iBAAiB,QACb,SAEN,QAAQ,MAAM,kBAAkB,KAAK,EAAE,GACjC,IAAI,MAAM,sBAAsB;AAAA,IAE1C;AAAA,EAAA;AAEN;AAEO,SAAS,UAAU,EAAE,eAAiD;AAC3E,QAAMA,eAAc,kBACd,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE,GAC7B,CAAC,eAAe,gBAAgB,IAAI,YAAY,MAA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