sanity-plugin-iconify 1.1.2 → 2.0.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/README.md +14 -6
- package/dist/index.cjs +106 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -8
- package/dist/index.d.ts +72 -8
- package/dist/index.js +106 -99
- package/dist/index.js.map +1 -1
- package/package.json +48 -54
- package/src/combobox/iconify-combobox.styles.tsx +9 -9
- package/src/combobox/iconify-combobox.tsx +64 -55
- package/src/combobox/search-input.tsx +7 -14
- package/src/combobox/search-result.tsx +36 -36
- package/src/combobox/unset-button.tsx +1 -1
- package/src/iconify-input.tsx +8 -17
- package/src/iconify-plugin.tsx +3 -3
- package/src/iconify-preview.tsx +3 -3
- package/src/lib/api.ts +2 -3
- package/src/lib/generate-types.js +0 -1
- package/src/lib/icon-types.gen.ts +1 -0
- package/src/lib/query-client.tsx +1 -1
- package/src/lib/types.ts +1 -1
- package/src/lib/use-pretty-icon-name.ts +2 -2
package/src/iconify-input.tsx
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { Flex,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { Flex, Stack, Text, ThemeProvider } from '@sanity/ui';
|
|
2
|
+
import { buildTheme } from '@sanity/ui/theme';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import type { ObjectInputProps } from 'sanity';
|
|
5
|
+
import { set, unset } from 'sanity';
|
|
5
6
|
import { IconifyCombobox } from './combobox';
|
|
6
7
|
import { QueryClientProvider } from './lib/query-client';
|
|
7
|
-
import { IconifyPluginConfig, IconOptions } from './lib/types';
|
|
8
|
+
import type { IconifyPluginConfig, IconOptions } from './lib/types';
|
|
8
9
|
import { usePrettyIconName } from './lib/use-pretty-icon-name';
|
|
9
10
|
|
|
10
|
-
// -------------- //
|
|
11
|
-
// ICONIFY INPUT //
|
|
12
|
-
// -------------- //
|
|
13
|
-
|
|
14
11
|
interface IconifyInputProps extends ObjectInputProps {
|
|
15
12
|
config: IconifyPluginConfig;
|
|
16
13
|
}
|
|
@@ -27,12 +24,6 @@ export function IconifyInput(props: IconifyInputProps) {
|
|
|
27
24
|
null;
|
|
28
25
|
const showName = options?.showName ?? config?.showName ?? false;
|
|
29
26
|
|
|
30
|
-
const parentTheme = useTheme();
|
|
31
|
-
const theme: RootTheme = useMemo(
|
|
32
|
-
() => (parentTheme ? { ...parentTheme.sanity, color: studioTheme.color } : studioTheme),
|
|
33
|
-
[parentTheme],
|
|
34
|
-
);
|
|
35
|
-
|
|
36
27
|
const handleSelect = useCallback(
|
|
37
28
|
(icon: string) => {
|
|
38
29
|
pushChange(icon === '' ? unset() : set(icon, ['name']));
|
|
@@ -42,7 +33,7 @@ export function IconifyInput(props: IconifyInputProps) {
|
|
|
42
33
|
|
|
43
34
|
return (
|
|
44
35
|
<QueryClientProvider>
|
|
45
|
-
<ThemeProvider theme={
|
|
36
|
+
<ThemeProvider theme={buildTheme()}>
|
|
46
37
|
<Stack space={2}>
|
|
47
38
|
<IconifyCombobox
|
|
48
39
|
selectedIcon={selectedIcon}
|
|
@@ -61,7 +52,7 @@ interface IconifyNameDisplayProps {
|
|
|
61
52
|
name?: string | null;
|
|
62
53
|
}
|
|
63
54
|
|
|
64
|
-
function IconifyNameDisplay(props: IconifyNameDisplayProps) {
|
|
55
|
+
export function IconifyNameDisplay(props: IconifyNameDisplayProps) {
|
|
65
56
|
const { name } = props;
|
|
66
57
|
const prettyName = usePrettyIconName({ name });
|
|
67
58
|
|
package/src/iconify-plugin.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { FieldProps, ObjectInputProps } from 'sanity';
|
|
2
|
+
import { definePlugin } from 'sanity';
|
|
3
3
|
import { IconifyInput } from './iconify-input';
|
|
4
4
|
import { IconifyPreview } from './iconify-preview';
|
|
5
|
-
import { IconifyPluginConfig } from './lib/types';
|
|
5
|
+
import type { IconifyPluginConfig } from './lib/types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Usage in `sanity.config.ts` (or .js)
|
package/src/iconify-preview.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Icon } from '@iconify/react';
|
|
2
|
-
import { IconifyIconName
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import type { IconifyIconName } from '@iconify/utils';
|
|
3
|
+
import { stringToIcon } from '@iconify/utils';
|
|
4
|
+
import type { PreviewProps } from 'sanity';
|
|
5
5
|
import { QueryClientProvider } from './lib/query-client';
|
|
6
6
|
import { usePrettyIconName } from './lib/use-pretty-icon-name';
|
|
7
7
|
|
package/src/lib/api.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { IconifyInfo } from '@iconify/types';
|
|
1
|
+
import type { IconifyInfo } from '@iconify/types';
|
|
2
2
|
import { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { useCallback, useState } from 'react';
|
|
4
4
|
import { useDebounce } from 'use-debounce';
|
|
5
|
-
|
|
6
|
-
import { IconifySearchResult } from './types';
|
|
5
|
+
import type { IconifySearchResult } from './types';
|
|
7
6
|
|
|
8
7
|
const BASE_API_URL = 'https://api.iconify.design';
|
|
9
8
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type IconPrefix = 'material-symbols' | 'material-symbols-light' | 'ic' | 'mdi' | 'ph' | 'solar' | 'tabler' | 'hugeicons' | 'mingcute' | 'ri' | 'bi' | 'carbon' | 'iconamoon' | 'iconoir' | 'ion' | 'lucide' | 'lucide-lab' | 'uil' | 'tdesign' | 'teenyicons' | 'clarity' | 'bx' | 'bxs' | 'majesticons' | 'ant-design' | 'gg' | 'gravity-ui' | 'octicon' | 'memory' | 'cil' | 'flowbite' | 'mynaui' | 'basil' | 'pixelarticons' | 'akar-icons' | 'ci' | 'system-uicons' | 'typcn' | 'radix-icons' | 'zondicons' | 'ep' | 'circum' | 'mdi-light' | 'fe' | 'eos-icons' | 'bitcoin-icons' | 'charm' | 'prime' | 'humbleicons' | 'uiw' | 'uim' | 'uit' | 'uis' | 'maki' | 'gridicons' | 'mi' | 'weui' | 'quill' | 'gala' | 'lets-icons' | 'f7' | 'mage' | 'marketeq' | 'fluent' | 'icon-park-outline' | 'icon-park-solid' | 'icon-park-twotone' | 'icon-park' | 'jam' | 'heroicons' | 'pajamas' | 'pepicons-pop' | 'pepicons-print' | 'pepicons-pencil' | 'bytesize' | 'ei' | 'streamline' | 'guidance' | 'fa6-solid' | 'fa6-regular' | 'ooui' | 'rivet-icons' | 'nimbus' | 'oui' | 'formkit' | 'line-md' | 'meteocons' | 'svg-spinners' | 'openmoji' | 'twemoji' | 'noto' | 'fluent-emoji' | 'fluent-emoji-flat' | 'fluent-emoji-high-contrast' | 'noto-v1' | 'emojione' | 'emojione-monotone' | 'emojione-v1' | 'fxemoji' | 'streamline-emojis' | 'bxl' | 'logos' | 'simple-icons' | 'cib' | 'fa6-brands' | 'nonicons' | 'arcticons' | 'cbi' | 'brandico' | 'entypo-social' | 'token' | 'token-branded' | 'cryptocurrency' | 'cryptocurrency-color' | 'flag' | 'circle-flags' | 'flagpack' | 'cif' | 'gis' | 'map' | 'geo' | 'vscode-icons' | 'codicon' | 'file-icons' | 'devicon' | 'devicon-plain' | 'catppuccin' | 'skill-icons' | 'unjs' | 'game-icons' | 'fad' | 'academicons' | 'wi' | 'healthicons' | 'medical-icon' | 'covid' | 'la' | 'eva' | 'dashicons' | 'flat-color-icons' | 'entypo' | 'foundation' | 'raphael' | 'icons8' | 'iwwa' | 'heroicons-outline' | 'heroicons-solid' | 'fa-solid' | 'fa-regular' | 'fa-brands' | 'fa' | 'fluent-mdl2' | 'fontisto' | 'icomoon-free' | 'subway' | 'oi' | 'wpf' | 'simple-line-icons' | 'et' | 'el' | 'vaadin' | 'grommet-icons' | 'whh' | 'si-glyph' | 'zmdi' | 'ls' | 'bpmn' | 'flat-ui' | 'vs' | 'topcoat' | 'il' | 'websymbol' | 'fontelico' | 'ps' | 'feather' | 'mono-icons' | 'pepicons';
|
package/src/lib/query-client.tsx
CHANGED
package/src/lib/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IconifyIconName
|
|
1
|
+
import type { IconifyIconName } from '@iconify/utils';
|
|
2
|
+
import { stringToIcon } from '@iconify/utils';
|
|
2
3
|
import { sentenceCase } from 'change-case';
|
|
3
4
|
import { useMemo } from 'react';
|
|
4
|
-
|
|
5
5
|
import { useIconSetInfo } from './api';
|
|
6
6
|
|
|
7
7
|
interface UsePrettyIconNameProps {
|